/* Native Teams employment assistant. Layout: header bar, then either a full-height chat
   (scrolling log + docked composer) or a two-column calculator (form | result). */
:root {
  --bg: #f5f6f8; --surface: #ffffff; --surface-2: #f0f1f4; --fg: #16171b; --muted: #636672;
  --line: #e2e4e9; --line-strong: #cfd2d9;
  --brand: #ff2c55; --brand-hover: #e81e47; --brand-soft: #ffe9ee; --on-brand: #ffffff;
  --ink: #222222; --on-ink: #ffffff;
  --net: #1f8f80; --net-soft: #e1f3f0; --deduct: #9aa0ac; --employer: #ff2c55;
  --err: #c4122f; --focus: #ff2c55;
  --radius: 14px; --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(20, 22, 28, .06), 0 4px 16px rgba(20, 22, 28, .05);
  --font: "Rubik", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1013; --surface: #17181d; --surface-2: #1f2027; --fg: #ececf0; --muted: #9c9fab;
    --line: #2a2c33; --line-strong: #3a3d46;
    --brand: #ff4d6d; --brand-hover: #ff6a85; --brand-soft: #3a1720; --on-brand: #ffffff;
    --ink: #ececf0; --on-ink: #16171b;
    --net: #5cc8b8; --net-soft: #12302b; --deduct: #6f7480; --employer: #ff4d6d;
    --err: #ff7088; --focus: #ff6a85;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 20px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.5 var(--font);
       -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

.app { min-height: 100%; display: flex; flex-direction: column; max-width: 1040px; margin: 0 auto;
       padding-inline: 16px; }

/* ── Header ─────────────────────────────────────────────── */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
          padding-block: 16px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; }
.logo { width: 34px; height: 34px; border-radius: 10px; background: var(--brand); color: var(--on-brand);
        display: grid; place-items: center; font-weight: 700; font-size: 15px; letter-spacing: -.02em; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-weight: 600; font-size: 15px; }
.brand-sub { font-size: 12.5px; color: var(--muted); }

.segmented { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px; gap: 2px; }
.segmented button { border: 0; background: none; padding: 7px 14px; border-radius: 999px; font-size: 14px;
                    font-weight: 500; color: var(--muted); cursor: pointer; white-space: nowrap; }
.segmented button[aria-selected="true"], .segmented button[aria-checked="true"] {
  background: var(--surface); color: var(--fg); box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 0 0 1px var(--line); }
.segmented.small button { padding: 5px 11px; font-size: 13px; }
.segmented.full { display: flex; }
.segmented.full button { flex: 1; }

.view { flex: 1; display: flex; flex-direction: column; min-height: 0; }

/* ── Chat ───────────────────────────────────────────────── */
.view-chat { min-height: 560px; }
.chat-scroll { flex: 1; overflow-y: auto; padding-block: 28px 16px; }
.welcome { max-width: 680px; margin: 0 auto; display: grid; gap: 10px; padding-block: 12px 8px; }
.eyebrow { margin: 0; font-size: 12px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--brand); }
.welcome h1 { margin: 0; font-size: clamp(24px, 4vw, 32px); line-height: 1.15; font-weight: 600; letter-spacing: -.02em; text-wrap: balance; }
.lede { margin: 0; color: var(--muted); max-width: 60ch; }
.prompts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.prompt { text-align: left; display: grid; gap: 2px; padding: 14px 16px; border-radius: var(--radius-sm);
          border: 1px solid var(--line); background: var(--surface); cursor: pointer; transition: border-color .15s, transform .15s; }
.prompt:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.prompt-kicker { font-size: 12px; color: var(--muted); }
.prompt-text { font-weight: 500; }

.chat-log { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.chat-log:empty { display: none; }
.row { display: flex; gap: 10px; align-items: flex-start; min-width: 0; }
.row.user { justify-content: flex-end; }
.avatar { flex: none; width: 28px; height: 28px; border-radius: 8px; background: var(--brand); color: var(--on-brand);
          display: grid; place-items: center; font-size: 12px; font-weight: 700; margin-top: 2px; }
.bubble { min-width: 0; max-width: min(620px, 100%); }
.row.user .bubble { background: var(--ink); color: var(--on-ink); padding: 10px 14px; border-radius: 16px 16px 4px 16px; white-space: pre-wrap; }
.row.assistant .bubble { padding-top: 3px; }
.md p { margin: 0 0 10px; } .md p:last-child { margin-bottom: 0; }
.md ul, .md ol { margin: 0 0 10px; padding-left: 20px; display: grid; gap: 4px; }
.md strong { font-weight: 600; }
.md .h { font-weight: 600; margin-bottom: 4px; }
.stack { display: grid; gap: 12px; min-width: 0; flex: 1; }

.typing { display: inline-flex; gap: 4px; padding: 10px 0; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--deduct); animation: blink 1.2s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .typing i { animation: none; opacity: .6; } .prompt { transition: none; } }
.notice { color: var(--err); }

/* Composer */
.composer { position: sticky; bottom: 0; padding-block: 12px 14px; background: linear-gradient(to bottom, transparent, var(--bg) 18px); }
.composer-box { max-width: 760px; margin: 0 auto; display: flex; align-items: flex-end; gap: 8px; background: var(--surface);
                border: 1px solid var(--line-strong); border-radius: 16px; padding: 8px 8px 8px 16px; box-shadow: var(--shadow); }
.composer-box:focus-within { border-color: var(--brand); }
.composer textarea { flex: 1; border: 0; outline: 0; background: none; resize: none; max-height: 160px; padding: 7px 0; line-height: 1.45; }
.send { flex: none; width: 38px; height: 38px; border-radius: 11px; border: 0; background: var(--brand); color: var(--on-brand);
        display: grid; place-items: center; cursor: pointer; }
.send:hover { background: var(--brand-hover); }
.send:disabled { opacity: .45; cursor: default; }
.composer-meta { max-width: 760px; margin: 8px auto 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pill-select select { appearance: none; border: 1px solid var(--line); background: var(--surface-2); border-radius: 999px;
                      padding: 6px 30px 6px 12px; font-size: 13px; cursor: pointer;
                      background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
                      background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }

/* ── Result card ────────────────────────────────────────── */
.result { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
          overflow: hidden; min-width: 0; }
.result-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 16px 18px 0; }
.result-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cc { flex: none; font-size: 11px; font-weight: 600; letter-spacing: .04em; padding: 4px 7px; border-radius: 6px;
      background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.result-title b { font-weight: 600; }
.result-title span { color: var(--muted); font-size: 13.5px; }
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); margin: 14px 18px 0;
        border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.kpi { background: var(--surface); padding: 12px 14px; display: grid; gap: 2px; min-width: 0; }
.kpi span { font-size: 12.5px; color: var(--muted); }
.kpi b { font-size: clamp(17px, 2.6vw, 21px); font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.01em; overflow-wrap: anywhere; }
.kpi.net b { color: var(--net); }
.kpi.cost b { color: var(--employer); }
.bar { margin: 14px 18px 0; display: grid; gap: 8px; }
.bar-track { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--surface-2); }
.bar-track i { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.result details { margin: 12px 18px 0; border-top: 1px solid var(--line); }
.result summary { cursor: pointer; padding: 12px 0; font-size: 14px; font-weight: 500; list-style: none; display: flex; justify-content: space-between; }
.result summary::-webkit-details-marker { display: none; }
.result summary::after { content: "Show"; color: var(--muted); font-weight: 400; }
.result details[open] summary::after { content: "Hide"; }
.table-wrap { overflow-x: auto; }
table.breakdown { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.breakdown th { text-align: right; font-weight: 500; font-size: 12px; color: var(--muted); padding: 0 0 6px 12px; }
.breakdown th:first-child { text-align: left; padding-left: 0; }
.breakdown td { padding: 7px 0 7px 12px; border-top: 1px solid var(--line); text-align: right; white-space: nowrap; }
.breakdown td:first-child { text-align: left; padding-left: 0; white-space: normal; }
.breakdown tr.item td:first-child { padding-left: 12px; color: var(--muted); }
.breakdown tr.section td { font-weight: 600; padding-top: 14px; border-top: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.breakdown tr.gross td, .breakdown tr.total td { font-weight: 600; }
.breakdown tr.net td { font-weight: 600; color: var(--net); }
.breakdown tr.grandtotal td { font-weight: 700; color: var(--employer); }
.result .note { font-size: 12.5px; color: var(--muted); margin: 10px 0 14px; }
.result-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
               padding: 14px 18px; margin-top: 14px; background: var(--surface-2); border-top: 1px solid var(--line); }
.result-foot small { color: var(--muted); font-size: 12px; }
.downloads { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Buttons ────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 14px; border-radius: var(--radius-sm);
       font-weight: 500; font-size: 14px; text-decoration: none; cursor: pointer; border: 1px solid var(--line-strong);
       background: var(--surface); color: var(--fg); }
.btn:hover { border-color: var(--muted); }
.btn svg { flex: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-block { width: 100%; padding: 12px; font-size: 15px; }
.btn:disabled { opacity: .55; cursor: progress; }

/* ── Calculator ─────────────────────────────────────────── */
.view-calc { display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 20px; align-items: start; padding-block: 24px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.calc-form { display: grid; gap: 14px; }
.calc-form h2 { margin: 0; font-size: 19px; font-weight: 600; }
.calc-form > p { margin: -8px 0 4px; font-size: 13.5px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field label, .field .label { font-size: 13px; font-weight: 500; }
.field select, .field input { width: 100%; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); }
.field select:focus, .field input:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.money { display: flex; align-items: stretch; }
.currency-tag { display: grid; place-items: center; padding: 0 12px; border: 1px solid var(--line-strong); border-right: 0;
                border-radius: var(--radius-sm) 0 0 var(--radius-sm); background: var(--surface-2); font-size: 13px; font-weight: 500; color: var(--muted); }
.money input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-variant-numeric: tabular-nums; }
.hint { margin: 0; font-size: 12.5px; color: var(--muted); }
.params { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.params:empty { display: none; }
.error { color: var(--err); font-size: 13.5px; margin: 0; min-height: 1em; }
.calc-result { min-width: 0; }
.empty { border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 48px 24px; text-align: center; display: grid; gap: 4px; justify-items: center; }
.empty p { margin: 0; }
.empty-mark { width: 44px; height: 44px; border-radius: 12px; background: var(--brand-soft); margin-bottom: 8px;
              background-image: linear-gradient(var(--brand), var(--brand)), linear-gradient(var(--brand), var(--brand)), linear-gradient(var(--brand), var(--brand));
              background-size: 6px 12px, 6px 20px, 6px 16px; background-position: 12px 22px, 19px 14px, 26px 18px; background-repeat: no-repeat; }

.foot { padding-block: 14px 18px; font-size: 12px; color: var(--muted); text-align: center; border-top: 1px solid var(--line); }

@media (max-width: 760px) {
  .view-calc { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .kpi.gross { grid-column: 1 / -1; }
}
@media (max-width: 420px) {
  .prompts { grid-template-columns: minmax(0, 1fr); }
  .brand-sub { display: none; }
  .params { grid-template-columns: minmax(0, 1fr); }
  .segmented.small button { padding: 5px 8px; }
}

/* ── Country picker (custom listbox; replaces the native macOS popup) ── */
.picker { position: relative; }
.picker-btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--surface-2);
              border-radius: 999px; padding: 6px 12px; font-size: 13px; cursor: pointer; color: var(--muted); }
.picker-btn:hover { border-color: var(--line-strong); }
.picker-btn[aria-expanded="true"] { border-color: var(--brand); color: var(--fg); }
.picker-value { color: var(--fg); font-weight: 500; }
.picker-btn .chev { transition: transform .15s; }
.picker-btn[aria-expanded="false"] .chev { transform: rotate(180deg); }
.picker-pop { position: absolute; left: 0; bottom: calc(100% + 8px); z-index: 20; width: min(360px, calc(100vw - 32px));
              background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow);
              padding: 6px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px; outline: none; }
.picker-pop .opt { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; cursor: pointer;
                   font-size: 13.5px; border: 0; background: none; text-align: left; min-width: 0; }
.picker-pop .opt.any { grid-column: 1 / -1; color: var(--muted); }
.picker-pop .opt:hover, .picker-pop .opt.active { background: var(--surface-2); }
.picker-pop .opt[aria-selected="true"] { color: var(--fg); font-weight: 500; }
.picker-pop .opt[aria-selected="true"]::after { content: ""; margin-left: auto; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); flex: none; }
.picker-pop .opt .cc { font-size: 10.5px; padding: 2px 5px; }
.picker-pop .opt span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { .picker-btn .chev { transition: none; } }

/* ── Calculator page (v2) ───────────────────────────────── */
.view-calc { display: block; padding-block: 28px 8px; }
.calc-head { display: grid; gap: 8px; margin-bottom: 22px; }
.calc-head h1 { margin: 0; font-size: clamp(24px, 4vw, 32px); font-weight: 600; letter-spacing: -.02em; line-height: 1.15; }
.calc-grid { display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 20px; align-items: start; }
.calc-form { position: sticky; top: 16px; gap: 18px; }

.picker-block { display: block; }
.picker-field { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line-strong);
                border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; text-align: left; }
.picker-field:hover { border-color: var(--muted); }
.picker-field[aria-expanded="true"] { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.picker-field .picker-value { flex: 1; font-weight: 500; }
.picker-field .chev { color: var(--muted); transition: transform .15s; }
.picker-field[aria-expanded="true"] .chev { transform: rotate(180deg); }
.picker-pop.down { top: calc(100% + 6px); bottom: auto; width: 100%; }

.money.big input { font-size: 22px; font-weight: 600; padding: 12px 14px; letter-spacing: -.01em; }
.money.big .currency-tag { font-size: 14px; padding: 0 14px; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--surface-2); border-radius: 999px; padding: 4px 11px; font-size: 12.5px;
        cursor: pointer; color: var(--muted); font-variant-numeric: tabular-nums; }
.chip:hover { color: var(--fg); border-color: var(--line-strong); }

fieldset.details { border: 0; border-top: 1px solid var(--line); margin: 0; padding: 14px 0 0; display: grid; gap: 12px; min-width: 0; }
fieldset.details legend { padding: 0 8px 0 0; font-size: 13px; font-weight: 600; }
fieldset.details .params { grid-template-columns: minmax(0, 1fr); gap: 14px; }
.param .hint { margin-top: -2px; }
.switch-row { grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.switch-text { display: grid; gap: 2px; min-width: 0; }
.switch-text label { font-size: 13px; font-weight: 500; }
.switch { position: relative; width: 40px; height: 24px; border-radius: 999px; border: 0; background: var(--line-strong); cursor: pointer; padding: 0; flex: none; }
.switch i { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff;
            box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.switch[aria-checked="true"] { background: var(--brand); }
.switch[aria-checked="true"] i { transform: translateX(16px); }

.cview { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
         padding: 20px; display: grid; gap: 20px; min-width: 0; }
.cview-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.cview-title { display: flex; gap: 12px; align-items: center; min-width: 0; }
.cview-title .cc { font-size: 12px; padding: 6px 8px; }
.cview-title h2 { margin: 0; font-size: 20px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.cview-title p { margin: 2px 0 0; font-size: 13.5px; }
.badge { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px;
         background: var(--brand-soft); color: var(--brand); }
.cview-bar { display: flex; justify-content: flex-start; margin-top: -6px; }

.hero-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.hk { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; display: grid; gap: 4px; min-width: 0; }
.hk > span { font-size: 13px; color: var(--muted); }
.hk b { font-size: clamp(20px, 3vw, 26px); font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.hk b small { font-size: 13px; font-weight: 400; color: var(--muted); letter-spacing: 0; }
.hk p { margin: 0; font-size: 12px; color: var(--muted); }
.hk.cost { background: var(--brand-soft); border-color: transparent; }
.hk.cost b { color: var(--employer); }
.hk.net b { color: var(--net); }

.cview h3 { margin: 0 0 10px; font-size: 14px; font-weight: 600; }
.cview .bar { margin: 0; }
.cview .bar-track { height: 14px; }
.cview .legend { gap: 8px 18px; }
.cview .legend b { color: var(--fg); font-weight: 600; }
.cview .legend em { font-style: normal; color: var(--muted); margin-left: 4px; font-variant-numeric: tabular-nums; }
.cview-breakdown .breakdown { font-size: 14px; }
.cview-foot { border-top: 1px solid var(--line); padding-top: 14px; display: grid; gap: 6px; }
.cview-foot p { margin: 0; font-size: 12.5px; color: var(--muted); }
.cview-foot .ref { font-size: 11.5px; }

@media (max-width: 860px) {
  .calc-grid { grid-template-columns: minmax(0, 1fr); }
  .calc-form { position: static; }
  .hero-kpis { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .hk.cost { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) { .switch i, .picker-field .chev { transition: none; } }

/* ── Live calculator states ─────────────────────────────── */
.bar-track i { transition: width .45s cubic-bezier(.2, .8, .2, 1); }
.hk-val { display: flex; align-items: baseline; gap: 4px; flex-wrap: wrap; }
.hk-val b { font-size: clamp(20px, 3vw, 26px); font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.hk-val small { font-size: 13px; color: var(--muted); }

.live { display: none; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
        color: var(--net); background: var(--net-soft); padding: 3px 8px 3px 7px; border-radius: 999px; }
.live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.cview:not(.is-empty) .live { display: inline-flex; }
.cview.is-loading .live::before { animation: pulse .9s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.7); } }

/* Empty state: the same layout, greyed out, so the reader sees what will appear */
.cview.is-empty .hero-kpis .hk { background: var(--surface-2); border-color: transparent; }
.cview.is-empty .hk-val b { color: var(--faint, var(--muted)); }
.cview.is-empty .cc { opacity: .4; }
.cview.is-empty .cview-bar, .cview.is-empty .legend em { visibility: hidden; }
.cview.is-loading .hero-kpis, .cview.is-loading .table-wrap { opacity: .72; transition: opacity .15s; }
.cview .hero-kpis, .cview .table-wrap { transition: opacity .2s; }

.skeleton { display: grid; gap: 10px; padding-block: 4px; }
.sk-row { display: grid; grid-template-columns: 1fr 90px 90px; gap: 16px; }
.sk-row i { height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2) 0%, var(--line) 50%, var(--surface-2) 100%);
            background-size: 200% 100%; animation: shimmer 1.6s linear infinite; }
.sk-row:nth-child(3n) i:first-child { width: 70%; } .sk-row:nth-child(3n+1) i:first-child { width: 85%; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.cview-breakdown .breakdown tbody tr { animation: rowIn .35s ease both; }
@keyframes rowIn { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.downloads button.btn { font: inherit; font-weight: 500; font-size: 14px; }
.downloads button.btn:disabled { opacity: .45; cursor: not-allowed; }
#amount-hint:empty { display: none; }

@media (prefers-reduced-motion: reduce) {
  .bar-track i, .cview .hero-kpis, .cview .table-wrap { transition: none; }
  .sk-row i, .cview-breakdown .breakdown tbody tr, .cview.is-loading .live::before { animation: none; }
}

/* ── Calculator v3: chips, stepper, slider, donut, email ─── */
.opt-chips { display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: 6px; }
.opt-chip { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 10px; padding: 9px 6px; font-size: 14px;
            font-weight: 500; cursor: pointer; color: var(--muted); transition: all .15s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opt-chip:hover { color: var(--fg); border-color: var(--muted); }
.opt-chip[aria-checked="true"] { background: var(--brand); border-color: var(--brand); color: var(--on-brand); box-shadow: 0 2px 10px -3px var(--brand); }
.choice { margin: 2px 0 0; font-size: 13px; font-weight: 500; color: var(--fg); }

.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: 12px; overflow: hidden; width: fit-content; }
.stepper button { width: 40px; height: 40px; border: 0; background: var(--surface-2); font-size: 18px; cursor: pointer; color: var(--fg); }
.stepper button:disabled { color: var(--muted); opacity: .5; cursor: default; }
.stepper output { min-width: 48px; text-align: center; font-weight: 600; font-size: 16px; font-variant-numeric: tabular-nums; }

.suffix-input { position: relative; }
.suffix-input input { padding-right: 34px; }
.suffix-input span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 500; }

/* Salary slider */
.range-wrap { display: grid; gap: 4px; margin-top: 4px; }
.field input.range { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 999px; outline: none; cursor: pointer;
         background: linear-gradient(to right, var(--brand) 0 var(--pct, 0%), var(--surface-2) var(--pct, 0%) 100%); border: 0; padding: 0; box-shadow: none; }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; background: #fff;
         border: 2px solid var(--brand); box-shadow: 0 2px 8px rgba(0,0,0,.25); cursor: grab; transition: transform .12s; }
.range::-webkit-slider-thumb:active { transform: scale(1.15); cursor: grabbing; }
.range::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 2px solid var(--brand); box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.range:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }
.range-scale { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Result hero: donut + figures */
.hero { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 24px; align-items: center; }
.ring { position: relative; width: 200px; height: 200px; }
.ring svg { width: 100%; height: 100%; }
.ring-bg { fill: none; stroke: var(--surface-2); stroke-width: 16; }
.ring-arc.zero { opacity: 0; }
.ring-arc { fill: none; stroke-width: 16; stroke-linecap: round; transition: stroke-dasharray .55s cubic-bezier(.2,.8,.2,1), stroke-dashoffset .55s cubic-bezier(.2,.8,.2,1); }
.ring-arc.net { stroke: var(--net); } .ring-arc.deduct { stroke: var(--deduct); } .ring-arc.employer { stroke: var(--employer); }
.ring-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 2px; }
.ring-center b { font-size: 22px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.ring-center span { font-size: 12px; color: var(--muted); }
.figs { display: grid; gap: 4px; }
.fig { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto 44px; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; }
.fig:hover { background: var(--surface-2); }
.fig i { width: 10px; height: 10px; border-radius: 3px; }
.fig.net i { background: var(--net); } .fig.deduct i { background: var(--deduct); } .fig.employer i { background: var(--employer); }
.fig.gross { border-top: 1px dashed var(--line); border-radius: 0; margin-top: 4px; padding-top: 14px; }
.fig.gross i { background: transparent; border: 2px solid var(--line-strong); }
.fig span { font-size: 13.5px; color: var(--muted); }
.fig b { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.fig.net b { color: var(--net); }
.fig em { font-style: normal; font-size: 12.5px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }

.insight { margin: 0; padding: 14px 16px; border-radius: 12px; background: var(--surface-2); font-size: 14px; line-height: 1.55; }
.insight b { font-weight: 700; font-variant-numeric: tabular-nums; }
.i-net { color: var(--net); } .i-ded { color: var(--muted); } .i-emp { color: var(--employer); }

/* Breakdown lines with meters */
.bd-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.bd-head h3 { margin: 0; }
.bd-head span { font-size: 12px; }
.line-list { display: grid; }
.ln { display: grid; grid-template-columns: minmax(0, 1fr) 110px 120px; gap: 4px 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line);
      font-size: 13.5px; font-variant-numeric: tabular-nums; animation: rowIn .35s ease both; }
.ln-m, .ln-y { text-align: right; white-space: nowrap; }
.ln-y { color: var(--muted); }
.ln.item .ln-label { color: var(--muted); padding-left: 12px; }
.ln-meter { grid-column: 1 / -1; height: 3px; border-radius: 999px; background: var(--surface-2); position: relative; margin: 0 0 0 12px; overflow: hidden; }
.ln-meter::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w); background: var(--line-strong); border-radius: inherit; }
.ln.section { border-top: 0; padding-top: 16px; font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.ln.section span { grid-column: 1 / -1; }
.ln.gross, .ln.total { font-weight: 600; }
.ln.net { font-weight: 700; color: var(--net); }
.ln.net .ln-y { color: var(--net); }
.ln.grandtotal { font-weight: 700; color: var(--employer); border-top: 2px solid var(--line-strong); }
.ln.grandtotal .ln-y { color: var(--employer); }

/* Email sheet */
.mail-sheet { border: 1px solid var(--line-strong); border-radius: 12px; padding: 16px; display: grid; gap: 10px; background: var(--surface-2); animation: rowIn .25s ease both; }
.mail-sheet h4 { margin: 0; font-size: 14px; font-weight: 600; }
.mail-row { display: flex; gap: 8px; }
.mail-row input { flex: 1; min-width: 0; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); }
.mail-row input:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.consent { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--muted); cursor: pointer; }
.consent input { margin-top: 3px; accent-color: var(--brand); }
.mail-msg { margin: 0; font-size: 13.5px; } .mail-msg:empty { display: none; }
.mail-msg.good { color: var(--net); } .mail-msg.bad { color: var(--err); }
.mail-sheet.sent .mail-row, .mail-sheet.sent .consent { display: none; }
.downloads button.btn.on { border-color: var(--brand); color: var(--brand); }

.cview.is-empty .ring-center b, .cview.is-empty .fig b { color: var(--muted); }
.cview.is-empty .insight { color: var(--muted); }
.cview.is-loading .hero, .cview.is-loading .line-list { opacity: .75; transition: opacity .15s; }

@media (max-width: 860px) {
  .hero { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .figs { width: 100%; }
}
@media (max-width: 480px) {
  .ln { grid-template-columns: minmax(0, 1fr) auto; } .ln-y { display: none; }
  .mail-row { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) { .ring-arc, .opt-chip, .range::-webkit-slider-thumb { transition: none; } .ln, .mail-sheet { animation: none; } }

/* Export actions appear only once there is a result to export */
.cview.is-empty .downloads, .cview.is-empty .cview-bar { display: none; }
.cview:not(.is-empty) .downloads { animation: actionsIn .35s cubic-bezier(.2,.8,.2,1) both; }
@keyframes actionsIn { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .cview:not(.is-empty) .downloads { animation: none; } }
