/* YADIM Advanced Calculator. Scoped to .yadim-cc; colours come from CSS variables set by the module. */
.yadim-cc {
  --cc-accent: #2a7de1; --cc-text: #14213d; --cc-input-text: #1b2433; --cc-input-bg: #fbfbfd; --cc-result-bg: #eceff4; --cc-result-text: #14213d; --cc-line: rgba(20, 33, 61, .16);
  box-sizing: border-box;
  width: 100%;
  padding: 20px;
  color: var(--cc-text);
  font: 15px/1.5 -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
.yadim-cc *, .yadim-cc *::before, .yadim-cc *::after { box-sizing: border-box; }
.yadim-cc .cc-data { display: none; }
.cc-title { margin: 0 0 6px; font-size: 22px; line-height: 1.25; color: inherit; }
.cc-intro { margin: 0 0 16px; opacity: .85; }
.cc-form { display: grid; gap: 18px; }
.cc-side .cc-form { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: start; }
.cc-narrow .cc-form { grid-template-columns: 1fr; }
.cc-inputs { display: grid; gap: 14px 18px; align-content: start; }
.cc-cols-2 .cc-inputs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cc-narrow .cc-inputs { grid-template-columns: 1fr; }
.cc-field[hidden], .cc-result[hidden], .cc-error[hidden] { display: none; }
.cc-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cc-label { font-weight: 600; font-size: 14px; }
.cc-label--hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.cc-control { display: flex; align-items: center; gap: 6px; }
.cc-affix { opacity: .7; white-space: nowrap; }
.cc-field input[type="text"], .cc-field select { width: 100%; min-width: 0; padding: 9px 12px; border: 1px solid var(--cc-line); border-radius: 8px; background: var(--cc-input-bg); color: var(--cc-input-text); font: inherit; }
.cc-field input[type="text"]:focus, .cc-field select:focus { outline: 2px solid var(--cc-accent); outline-offset: 1px; }
.cc-field input[aria-invalid="true"] { border-color: #c0343b; }
.cc-radios { margin: 0; padding: 0; border: 0; display: flex; flex-direction: column; gap: 6px; }
.cc-radios legend { padding: 0; margin-bottom: 4px; }
.cc-radio, .cc-check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.cc-radio input, .cc-check input { width: 18px; height: 18px; accent-color: var(--cc-accent); }
.cc-help { margin: 0; font-size: 12px; opacity: .7; }
.cc-error { margin: 0; font-size: 12px; color: #c0343b; }
.cc-reset { justify-self: start; padding: 8px 16px; border: 1px solid var(--cc-line); border-radius: 99px; background: transparent; color: inherit; font: inherit; font-size: 13px; cursor: pointer; }
.cc-reset:hover { border-color: var(--cc-accent); color: var(--cc-accent); }
.cc-reset:focus-visible { outline: 2px solid var(--cc-accent); outline-offset: 2px; }
.cc-results { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 10px; background: var(--cc-result-bg); color: var(--cc-result-text); }
.cc-results:empty { display: none; }
.cc-result { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-bottom: 8px; border-bottom: 1px solid rgba(20, 33, 61, .1); }
.cc-result:last-child { border-bottom: 0; padding-bottom: 0; }
.cc-result-value { font-size: 18px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.cc-result--main { flex-direction: column; align-items: flex-start; }
.cc-result--main .cc-result-value { font-size: 34px; line-height: 1.15; color: var(--cc-accent); text-align: left; }
.cc-result.is-error .cc-result-value { opacity: .5; }
.cc-text-output { margin: 0; }
.cc-problems { margin: 0 0 14px; padding: 10px 14px; list-style: none; border-radius: 8px; background: #fff3dd; color: #7a4a00; font-size: 13px; }
.cc-problems-head { font-weight: 700; }
.cc-nojs { margin: 0; }
.yadim-cc-ready .cc-nojs { display: none; }

/* field and result width: 1, 2 or 3 per row (they stack when the module is narrow) */
.yadim-cc .cc-inputs, .yadim-cc.cc-cols-2 .cc-inputs { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.yadim-cc .cc-inputs .cc-w-full { grid-column: span 6; }
.yadim-cc .cc-inputs .cc-w-half { grid-column: span 3; }
.yadim-cc .cc-inputs .cc-w-third { grid-column: span 2; }
.yadim-cc.cc-narrow .cc-inputs .cc-w-half, .yadim-cc.cc-narrow .cc-inputs .cc-w-third, .yadim-cc.cc-narrow .cc-inputs .cc-reset { grid-column: span 6; }
.yadim-cc .cc-inputs .cc-reset { grid-column: span 6; justify-self: start; }
.yadim-cc .cc-results { flex-direction: row; flex-wrap: wrap; align-items: flex-start; }
.yadim-cc .cc-results .cc-w-full { flex: 1 1 100%; }
.yadim-cc .cc-results .cc-w-half { flex: 1 1 calc(50% - 8px); min-width: 0; }
.yadim-cc .cc-results .cc-w-third { flex: 1 1 calc(33.333% - 11px); min-width: 0; }
.yadim-cc.cc-narrow .cc-results .cc-w-half, .yadim-cc.cc-narrow .cc-results .cc-w-third { flex-basis: 100%; }

/* label position */
.yadim-cc.cc-lbl-before .cc-field:not(.cc-type-checkbox):not(.cc-type-radio) { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.yadim-cc.cc-lbl-before .cc-field > .cc-label { flex: 0 0 38%; max-width: 38%; }
.yadim-cc.cc-lbl-before .cc-field > .cc-control, .yadim-cc.cc-lbl-before .cc-field > select { flex: 1 1 0; min-width: 0; }
.yadim-cc.cc-lbl-before .cc-help, .yadim-cc.cc-lbl-before .cc-error { flex: 1 1 100%; }
.yadim-cc.cc-narrow.cc-lbl-before .cc-field > .cc-label { flex-basis: 100%; max-width: none; }
.yadim-cc.cc-lbl-inside .cc-field:not(.cc-type-checkbox):not(.cc-type-radio) { position: relative; }
.yadim-cc.cc-lbl-inside .cc-field > .cc-label { position: absolute; left: 12px; top: 10px; z-index: 1; font-size: 14px; opacity: .65; pointer-events: none; transition: transform .15s, font-size .15s; transform-origin: left top; }
.yadim-cc.cc-lbl-inside .cc-field:focus-within > .cc-label, .yadim-cc.cc-lbl-inside .cc-field.is-filled > .cc-label { transform: translateY(-1.25em); font-size: 11px; }
.yadim-cc.cc-lbl-inside .cc-field { padding-top: 12px; }

/* line between results */
.yadim-cc .cc-results .cc-result.cc-w-full + .cc-result { border-top: var(--cc-sep, none); padding-top: 10px; }

/* results among the inputs (the order of the Fields tab) */
.yadim-cc .cc-inputs .cc-result--inline { padding: 12px 16px; border-radius: 10px; border-bottom: 0; background: var(--cc-result-bg); color: var(--cc-result-text); }

/* "before" / "after" text inside the box with the number */
.yadim-cc.cc-affix-in .cc-control { background: var(--cc-input-bg); color: var(--cc-input-text); padding: 0 12px; border: 1px solid var(--cc-line); border-radius: 8px; }
.yadim-cc.cc-affix-in .cc-control:focus-within { outline: 2px solid var(--cc-accent); outline-offset: 1px; }
.yadim-cc.cc-affix-in .cc-control input[type="text"] { border: 0; border-radius: 0; padding-left: 0; padding-right: 0; background: transparent; }
.yadim-cc.cc-affix-in .cc-control input[type="text"]:focus { outline: 0; }
.yadim-cc.cc-affix-in .cc-control:has(input[aria-invalid="true"]) { border-color: #c0343b; }
