@font-face { font-family: "Inter"; src: url("/fonts/inter-400.woff") format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/fonts/inter-600.woff") format("woff"); font-weight: 500 650; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/fonts/inter-700.woff") format("woff"); font-weight: 651 900; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("/fonts/poppins-500.woff") format("woff"); font-weight: 400 550; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("/fonts/poppins-700.woff") format("woff"); font-weight: 551 800; font-display: swap; }
:root {
  --paper: #faf9f2;
  --card: #ffffff;
  --ink: #201e1d;
  --muted: #7b7169;
  --line: #e6e3dc;
  --accent: #00a79d;
  --accent-ink: #06695d;
  --inv: #00a79d;
  --dn: #2f6fdf;
  --po: #1f9d6b;
  --ok: #1f9d6b;
  --warn: #c98a06;
  --radius: 14px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Poppins", "Inter", ui-sans-serif, system-ui, sans-serif;
  --teal: #00a79d;
  --teal-deep: #06695d;
  --teal-night: #0e3b37;
  --leaf: #82c56b;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.5 var(--font); }
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; max-width: 980px; margin: 0 auto; padding: 22px 20px; }
.brand { display: inline-flex; align-items: center; gap: 2px; font-weight: 800; font-size: 22px; letter-spacing: -0.02em; color: var(--ink); text-decoration: none; }
.mark { display: inline-grid; place-items: center; width: 30px; height: 30px; margin-right: 4px; border-radius: 8px; background: var(--accent); color: #fff; font-size: 19px; }
.privacy { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.privacy svg { width: 15px; height: 15px; fill: none; stroke: var(--ok); stroke-width: 2; }

main { max-width: 980px; margin: 0 auto; padding: 0 20px 40px; }
.hero { padding: 28px 0 34px; }
.hero h1 { margin: 0 0 14px; font-size: clamp(34px, 6vw, 58px); line-height: 1.02; letter-spacing: -0.035em; font-weight: 800; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p { margin: 0; max-width: 560px; font-size: 18px; color: var(--muted); }

.step { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 18px; }
.step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.step-head h2 { margin: 0; font-size: 20px; letter-spacing: -0.01em; }
.num { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: #fff; font-size: 14px; font-weight: 700; flex: none; }

.drop { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 38px 20px; border: 2px dashed #cfcabd; border-radius: 12px; background: #f8f7f1; cursor: pointer; text-align: center; transition: border-color .15s, background .15s; }
.drop svg { width: 46px; height: 46px; color: var(--accent); margin-bottom: 6px; }
.drop strong { font-size: 18px; }
.drop span { color: var(--muted); font-size: 14px; }
.drop:hover, .drop.over { border-color: var(--accent); background: #eaf6f4; }
.drop.compact { padding: 18px; flex-direction: row; justify-content: center; gap: 10px; }
.drop.compact svg { width: 26px; height: 26px; margin: 0; }
.drop.compact span { display: none; }

.file-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin: 16px 0 8px; font-size: 14px; color: var(--muted); }
.bar-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.ghost { border: 1px solid var(--line); background: #fff; padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.ghost:hover { border-color: var(--ink); }
.ghost.danger:hover { border-color: var(--accent); color: var(--accent); }

.t0 { background: var(--inv) !important; } .t1 { background: var(--dn) !important; } .t2 { background: var(--po) !important; }

.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.mode input { position: absolute; opacity: 0; pointer-events: none; }
.mode-body { display: flex; flex-direction: column; gap: 4px; height: 100%; padding: 16px; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.mode-body:hover { border-color: #bdb6a8; }
.mode input:checked + .mode-body { border-color: var(--accent); box-shadow: 0 0 0 3px #c4e9e3; }
.mode input:focus-visible + .mode-body { outline: 2px solid var(--ink); outline-offset: 2px; }
.mode strong { font-size: 15px; }
.mode small { color: var(--muted); font-size: 13px; line-height: 1.35; }
.diagram { display: flex; align-items: flex-end; gap: 3px; height: 34px; margin-bottom: 8px; }
.diagram i { display: block; width: 16px; height: 22px; border-radius: 2px; }
.diagram b { color: var(--muted); font-weight: 400; margin-left: 2px; }
.diagram.stack i { width: 22px; height: 30px; box-shadow: 3px -3px 0 #fff, 4px -4px 0 currentColor, 7px -7px 0 #fff, 8px -8px 0 currentColor; margin-right: 12px; }
.diagram.stack .d-inv { color: var(--inv); } .diagram.stack .d-dn { color: var(--dn); } .diagram.stack .d-po { color: var(--po); }
.diagram.book { padding: 4px; border: 1.5px solid #cfcabd; border-radius: 4px; height: 34px; align-items: center; width: max-content; }
.diagram.book i { width: 9px; height: 20px; gap: 0; }
.d-inv { background: var(--inv); } .d-dn { background: var(--dn); } .d-po { background: var(--po); }

.per-set { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 20px; font-size: 15px; }
.stepper { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.stepper button { width: 38px; border: 0; background: #f8f7f1; cursor: pointer; font-size: 18px; }
.stepper button:hover { background: var(--paper); }
.stepper input { width: 54px; border: 0; border-left: 1px solid var(--line); border-right: 1px solid var(--line); text-align: center; padding: 8px 0; font-weight: 700; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.hint { color: var(--muted); font-size: 14px; }
.warn { margin-top: 16px; padding: 12px 14px; border-radius: 10px; background: #fff7e0; border: 1px solid #f1d98a; color: #6d4c00; font-size: 14px; }
.warn p { margin: 0; } .warn p + p { margin-top: 6px; }

.naming { margin-bottom: 22px; }
.seg { display: inline-flex; padding: 3px; background: var(--paper); border-radius: 10px; gap: 2px; }
.seg button { border: 0; background: none; padding: 7px 14px; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--muted); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.naming > .hint { margin: 10px 0 0; }
.field { display: block; margin-top: 14px; font-size: 14px; font-weight: 600; }
.field small { font-weight: 400; color: var(--muted); }
.field input { display: block; width: 100%; margin-top: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-family: var(--mono); font-size: 14px; }
.field input:focus { outline: 2px solid var(--accent); border-color: transparent; }

.pick p { margin: 14px 0 10px; font-size: 14px; color: var(--muted); }
.pick-stage { position: relative; max-width: 640px; min-height: 160px; max-height: 520px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #f8f7f1; }
.pick-stage canvas { display: block; width: 100%; height: auto; }
.pick-layer { position: absolute; left: 0; top: 0; width: 100%; aspect-ratio: var(--ar, auto); }
.pick-layer button { position: absolute; padding: 0; border: 0; background: transparent; border-radius: 3px; cursor: pointer; }
.pick-layer button:hover { background: rgba(232, 69, 44, .18); outline: 1.5px solid var(--accent); }
.pick-layer button.chosen { background: rgba(232, 69, 44, .28); outline: 2px solid var(--accent); }

.results-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.results-head h3 { margin: 0; font-size: 16px; }
.stat { font-size: 14px; color: var(--muted); }
.stat b { color: var(--ok); }
.stat b.bad { color: var(--warn); }
.table-wrap { max-height: 560px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.results { width: 100%; border-collapse: collapse; font-size: 14px; }
.results th { position: sticky; top: 0; z-index: 1; background: #f8f7f1; text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; padding: 9px 10px; border-bottom: 1px solid var(--line); }
.results td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.results tr:last-child td { border-bottom: 0; }
.results td:first-child { color: var(--muted); font-variant-numeric: tabular-nums; width: 40px; }
.thumb { width: 52px; height: 68px; border: 1px solid var(--line); border-radius: 4px; background: #f3f1ec; display: grid; place-items: center; overflow: hidden; }
.thumb canvas { width: 100%; height: 100%; object-fit: contain; }
.name-cell { display: flex; align-items: center; gap: 8px; }
.name-cell input { flex: 1; min-width: 120px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; font-family: var(--mono); font-size: 13px; }
.name-cell input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.name-cell .ext { color: var(--muted); font-family: var(--mono); font-size: 13px; }
.badge { flex: none; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; }
.badge.ok { background: var(--ok); } .badge.miss { background: var(--warn); } .badge.dup { background: var(--accent); }
.pages { display: flex; gap: 3px; }
.pages i { width: 8px; height: 12px; border-radius: 2px; background: #bbb; }
.results .dl-one { border: 1px solid var(--line); background: #fff; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; display: grid; place-items: center; }
.results .dl-one:hover { border-color: var(--ink); }
.results .dl-one svg { width: 16px; height: 16px; }

.dl { position: sticky; bottom: 0; z-index: 10; display: flex; align-items: center; flex-wrap: wrap; gap: 14px; padding: 16px 0 20px; background: linear-gradient(to top, var(--paper) 70%, rgba(246,244,239,0)); }
.primary { border: 0; background: var(--accent); color: #fff; font-weight: 700; font-size: 17px; padding: 14px 26px; border-radius: 12px; cursor: pointer; box-shadow: 0 6px 16px rgba(0,167,157,.28); }
.primary:hover { background: var(--accent-ink); }
.primary:disabled { opacity: .55; cursor: progress; }
.progress { flex-basis: 100%; height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.progress div { height: 100%; width: 0; background: var(--accent); transition: width .15s; }

.spinner { position: absolute; inset: 0; margin: auto; width: 26px; height: 26px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.foot { max-width: 980px; margin: 0 auto; padding: 10px 20px 30px; color: var(--muted); font-size: 13px; }

@media (max-width: 720px) {
  .modes { grid-template-columns: 1fr; }
  .step { padding: 18px; }
  .privacy { display: none; }
  .results th:nth-child(4), .results td:nth-child(4) { display: none; }
}

/* ---------- File grid ---------- */
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; padding: 4px 2px 2px; }
.fcard { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 10px 10px; background: #f8f7f1; border: 1.5px solid var(--line); border-radius: 12px; cursor: grab; transition: border-color .15s, box-shadow .15s, transform .15s; user-select: none; }
.fcard:hover { border-color: #bdb6a8; box-shadow: 0 6px 18px rgba(22,24,29,.08); }
.fcard.dragging { opacity: .35; }
.fcard.drop-before::before { content: ""; position: absolute; left: -9px; top: 8px; bottom: 8px; width: 3px; border-radius: 2px; background: var(--accent); }
.fcard .page { position: relative; width: 100%; aspect-ratio: 3 / 4; display: grid; place-items: center; }
.fcard .page canvas { max-width: 100%; max-height: 100%; box-shadow: 0 1px 4px rgba(0,0,0,.18); background: #fff; }
.fcard .page .spinner { position: static; }
.fcard .fname { width: 100%; font-size: 13px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fcard .pos { position: absolute; top: 8px; left: 8px; z-index: 2; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 12px; background: var(--ink); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.fcard .pos.t0 { background: var(--inv); } .fcard .pos.t1 { background: var(--dn); } .fcard .pos.t2 { background: var(--po); }
.fcard .tip { position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); z-index: 5; padding: 5px 10px; border-radius: 6px; background: #5f5852; color: #fff; font-size: 13px; font-weight: 700; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .12s; }
.fcard .tip::after { content: ""; position: absolute; top: 100%; left: 50%; margin-left: -6px; border: 6px solid transparent; border-top-color: #5f5852; }
.fcard:hover .tip { opacity: 1; }
.fcard .acts { position: absolute; top: 8px; right: 8px; z-index: 2; display: flex; flex-direction: column; gap: 5px; opacity: 0; transition: opacity .12s; }
.fcard:hover .acts, .fcard:focus-within .acts { opacity: 1; }
.fcard .acts button { width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 50%; background: #fff; cursor: pointer; display: grid; place-items: center; font-size: 13px; box-shadow: 0 2px 6px rgba(0,0,0,.1); }
.fcard .acts button:hover { border-color: var(--ink); }
.fcard .acts button[data-a=rm]:hover { border-color: var(--accent); color: var(--accent); }
.fcard .acts svg { width: 15px; height: 15px; }
@media (hover: none) { .fcard .acts { opacity: 1; } }

/* result thumbnails open the viewer */
.thumb { cursor: zoom-in; transition: box-shadow .15s; }
.thumb:hover { box-shadow: 0 0 0 2px var(--accent); }

/* ---------- Viewer ---------- */
.viewer { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; background: rgba(28,30,35,.94); }
.viewer-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; background: #201e1d; color: #fff; }
.viewer-title { min-width: 0; display: flex; flex-direction: column; }
.viewer-title strong { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-title span { font-size: 12px; color: #a6abb5; }
.viewer-tools { display: flex; align-items: center; gap: 6px; flex: none; }
.viewer-tools button { min-width: 36px; height: 36px; border: 1px solid #3a3e47; border-radius: 9px; background: #23262d; color: #fff; cursor: pointer; font-size: 18px; }
.viewer-tools button:hover { background: #2f333c; }
.viewer-tools .zval { min-width: 70px; font-size: 14px; font-variant-numeric: tabular-nums; }
.viewer-tools .close { margin-left: 8px; font-size: 16px; }
.viewer-body { flex: 1; overflow: auto; padding: 24px; display: flex; flex-direction: column; align-items: flex-start; gap: 18px; }
.vpage { position: relative; flex: none; margin: 0 auto; background: #fff; box-shadow: 0 6px 24px rgba(0,0,0,.45); }
.vpage canvas { display: block; width: 100%; height: 100%; }
.vpage .vlabel { position: absolute; top: 100%; left: 0; margin-top: 4px; font-size: 12px; color: #a6abb5; }
body.no-scroll { overflow: hidden; }
body.file-over [data-tool-panel] > .step:first-of-type { border-color: var(--accent); box-shadow: 0 0 0 4px #c4e9e3; }
body.file-over .drop { border-color: var(--accent); background: #eaf6f4; }
body.file-over .file-grid { background: #f1f9f8; border-radius: 10px; }

/* ---------- Tool tabs ---------- */
.top { flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; padding: 4px; background: #eeebe3; border-radius: 12px; }
.tabs a { padding: 8px 14px; border-radius: 9px; color: var(--muted); font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
@media (max-width: 720px) { .tabs { order: 3; width: 100%; } .tabs a { flex: 1; text-align: center; padding: 8px 6px; font-size: 13px; } }

/* ---------- Shared option controls ---------- */
.big-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.big-seg button { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 14px 16px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; text-align: left; }
.big-seg button:hover { border-color: #bdb6a8; }
.big-seg button.on { border-color: var(--accent); box-shadow: 0 0 0 3px #c4e9e3; }
.big-seg strong { font-size: 15px; }
.big-seg small { color: var(--muted); font-size: 13px; }
.sp-sub > .seg { margin-bottom: 14px; }
.seg.disabled { opacity: .45; pointer-events: none; }
.check { display: inline-flex; align-items: center; gap: 10px; margin-top: 18px; font-size: 15px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.opt { display: flex; flex-direction: column; gap: 8px; }
.opt-label { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.opt .seg { align-self: flex-start; }

.ranges { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.range-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #f8f7f1; font-size: 14px; }
.range-name { display: inline-flex; align-items: center; gap: 8px; min-width: 84px; font-weight: 700; }
.range-name i { width: 12px; height: 12px; border-radius: 3px; }
.range-row label { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }
.range-row input { width: 72px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 8px; text-align: center; font-weight: 700; color: var(--ink); }
.range-row input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.range-row .rm { margin-left: auto; width: 30px; height: 30px; border: 0; border-radius: 8px; background: none; cursor: pointer; color: var(--muted); }
.range-row .rm:hover:not(:disabled) { background: var(--paper); color: var(--accent); }
.range-row .rm:disabled { opacity: .3; cursor: default; }
.ghost.add { font-weight: 600; }

/* range colours */
.g0 { --g: #00a79d; } .g1 { --g: #2f6fdf; } .g2 { --g: #1f9d6b; } .g3 { --g: #b4569e; } .g4 { --g: #d08a0a; } .g5 { --g: #0e98a8; }
.range-name i { background: var(--g); }

/* ---------- Split page grid ---------- */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 14px; }
.pcell { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 8px 8px; border: 2px solid var(--line); border-radius: 10px; background: #f8f7f1; cursor: zoom-in; transition: border-color .12s, opacity .12s, background .12s; }
.pcell[class*=" g"] { border-color: var(--g); background: color-mix(in srgb, var(--g) 7%, #fff); }
.pcell.out { opacity: .38; }
.pcell.selectable { cursor: pointer; }
.pcell.picked { border-color: var(--accent); background: #eaf6f4; opacity: 1; }
.pthumb { width: 100%; aspect-ratio: 3 / 4; display: grid; place-items: center; }
.pthumb canvas { max-width: 100%; max-height: 100%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.18); }
.pthumb .spinner { position: static; }
.pnum { font-size: 13px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.pchip { position: absolute; top: -10px; left: 8px; padding: 1px 8px; border-radius: 10px; background: var(--g, var(--ink)); color: #fff; font-size: 11px; font-weight: 700; }
.pchip:empty { display: none; }
.pzoom { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border: 1px solid var(--line); border-radius: 50%; background: #fff; display: grid; place-items: center; cursor: zoom-in; opacity: 0; transition: opacity .12s; }
.pzoom svg { width: 14px; height: 14px; }
.pcell:hover .pzoom { opacity: 1; }
.pcheck { position: absolute; top: 6px; left: 6px; width: 22px; height: 22px; border-radius: 50%; border: 2px solid #cfcabd; background: #fff; color: transparent; font-size: 12px; font-weight: 800; display: none; place-items: center; }
.pcell.selectable .pcheck { display: grid; }
.pcell.picked .pcheck { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (hover: none) { .pzoom { opacity: 1; } }

/* ---------- Image page previews ---------- */
.img-grid .fcard .page { display: grid; place-items: center; }
.ipage { position: relative; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.18); overflow: hidden; }
.ipage canvas { position: absolute; display: block; }
.primary:disabled:not([data-busy]) { cursor: not-allowed; }

/* ---------- Weekly report ---------- */
.wk-tray { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.wk-slot { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-height: 112px; padding: 14px; text-align: left; background: #f8f7f1; border: 1.5px dashed #cfcabd; border-radius: 12px; cursor: pointer; transition: border-color .15s; }
.wk-slot:hover { border-color: var(--ink); }
.wk-slot b { font-size: 15px; }
.wk-slot .f { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.wk-slot .st { margin-top: auto; font-size: 13px; font-weight: 700; color: var(--muted); }
.wk-slot.done { border-style: solid; border-color: var(--ok); background: #fff; }
.wk-slot.done .st { color: var(--ok); }
.wk-slot.err { border-style: solid; border-color: var(--accent); }
.wk-slot.err .st { color: var(--accent); }
.wk-form { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 20px; }
.wk-fld { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.wk-fld input { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 15px; color: var(--ink); background: #fff; min-height: 44px; }
.wk-fld input:focus, .wk-in:focus { outline: 2px solid var(--accent); border-color: transparent; }
.wk-fld input[readonly] { background: #f8f7f1; color: var(--muted); min-width: 340px; }
.wk-fld #wk-arate, .wk-fld #wk-aacct { width: 140px; }
.wk-wide { flex: 1 1 320px; }
.wk-actions { margin-top: 20px; }
.wk-note { background: #f3f1ec; border-color: var(--line); color: var(--ink); }
.wk-bad { background: #e9f6f4; border-color: #9fd8d1; color: var(--accent-ink); }
.wk-stats { display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: 14px; color: var(--muted); }
.wk-stats b { color: var(--ink); }
.wk-box { margin-top: 22px; }
.wk-box h3 { margin: 0 0 4px; font-size: 16px; }
.wk-box .hint { margin: 0 0 12px; }
.wk-box a { color: var(--accent-ink); }
details.wk-box summary { cursor: pointer; font-weight: 600; margin-bottom: 10px; }
.wk-table { max-height: 460px; }
.wk-table td { white-space: nowrap; }
.wk-num { text-align: right; font-variant-numeric: tabular-nums; }
.results td.wk-num:first-child { color: var(--ink); }
.wk-in { min-width: 200px; min-height: 38px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 14px; }
.wk-in.need { border-color: var(--accent); box-shadow: 0 0 0 2px #c4e9e3; }
.wk-pill { display: inline-block; padding: 2px 8px; border-radius: 99px; background: var(--paper); color: var(--muted); font-size: 12px; font-weight: 700; }
.wk-pill.bad { color: var(--accent-ink); background: #e9f6f4; }
.wk-figs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 22px 0 14px; }
.wk-fig { padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: #f8f7f1; }
.wk-fig.key { background: var(--ink); border-color: var(--ink); color: #fff; }
.wk-fig .lab { font-size: 13px; font-weight: 700; opacity: .7; }
.wk-fig .big { font-size: clamp(24px, 3.4vw, 34px); font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.wk-fig .chg { margin-top: 4px; font-size: 14px; font-weight: 600; opacity: .85; }
#wk-result .results-head { margin-top: 24px; }
.wk-dls { display: grid; gap: 10px; }
.wk-dl { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #f8f7f1; }
.wk-dl b { display: block; overflow-wrap: anywhere; }
.wk-dl span { font-size: 13px; color: var(--muted); }
.wk-dl .ghost { padding: 9px 18px; font-weight: 600; }
@media (max-width: 860px) { .wk-tray { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .wk-tray, .wk-figs { grid-template-columns: minmax(0, 1fr); } .wk-fld input[readonly] { min-width: 0; width: 100%; } .wk-fld { flex: 1 1 100%; } }
.wk-rate { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; font-weight: 600; }
.wk-in.wk-rin { min-width: 0; width: 9em; font-variant-numeric: tabular-nums; }

/* ---------- Invoice check ---------- */
.ic-files { display: grid; gap: 8px; margin-top: 12px; }
.ic-file { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: #f8f7f1; font-size: 14px; }
.ic-file b { overflow-wrap: anywhere; }
.ic-file button, .ic-shot button { border: 0; background: none; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; padding: 4px 8px; }
.ic-file button:hover, .ic-shot button:hover { color: var(--accent); }
.ic-shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 12px; }
.ic-shot { position: relative; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.ic-shot img { display: block; width: 100%; height: 90px; object-fit: cover; object-position: left top; }
.ic-shot span { display: block; padding: 4px 8px; font-size: 12px; color: var(--muted); }
.ic-shot button { position: absolute; top: 2px; right: 2px; background: rgba(255,255,255,.9); border-radius: 99px; padding: 0 7px; }
.ic-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 18px; }
.ic-actions .hint { margin: 0; }
.ic-sum { display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: 14px; color: var(--muted); margin-bottom: 14px; }
.ic-sum b { color: var(--ink); }
.ic-head { margin: 22px 0 8px; padding: 14px 16px; border-radius: 12px; font-weight: 700; font-size: 17px; }
.ic-head.ok { background: #e8f5ee; color: #14532d; }
.ic-head.bad { background: #e9f6f4; color: var(--accent-ink); }
.ic-sec { margin-top: 22px; }
.ic-sec h3 { margin: 0 0 8px; font-size: 16px; }
.ic-sec .okline { color: var(--ok); font-weight: 600; font-size: 14px; }
.ic-table td { vertical-align: top; }
.ic-table td.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ic-table td.todo { font-weight: 600; }
.ic-snip { display: block; max-width: 520px; width: 100%; margin-top: 6px; border: 1px solid var(--line); border-radius: 6px; }
.ic-conf td input { width: 110px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }
.ic-tag { display: inline-block; padding: 1px 7px; border-radius: 99px; font-size: 12px; font-weight: 700; background: var(--paper); color: var(--muted); }
.ic-tag.warn { background: #e9f6f4; color: var(--accent-ink); }
.ic-copy { margin-left: 8px; }

/* ---------- Weekly report password gate ---------- */
.lock-card { max-width: 440px; }
.lock-form { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.lock-form input[type=password] { width: 100%; padding: 12px 14px; font: inherit; border: 1.5px solid #cfcabd; border-radius: 10px; background: #fff; }
.lock-form input[type=password]:focus { outline: none; border-color: var(--ink); }
.lock-err { margin: 0; color: #b42318; font-weight: 600; }
.foot a { color: inherit; }

/* ---------- Fine calculator ---------- */
.fn-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 16px; }
.fn-form .fn-vendor { grid-column: span 1; }
.fn-form > *, .fn-form input, .fn-pair select { min-width: 0; box-sizing: border-box; }
.fn-form input[type=date] { width: 100%; }
.fn-form .wk-fld input { width: 100%; }
.fn-pair { display: flex; gap: 6px; }
.fn-pair input { flex: 1; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 15px; color: var(--ink); background: #fff; min-height: 44px; }
.fn-pair select { padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; font: inherit; font-size: 15px; color: var(--ink); background: #fff; min-height: 44px; }
.fn-pair input:focus, .fn-pair select:focus, .fn-listbar input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.fn-work { margin-top: 20px; padding: 16px 18px; background: #f8f7f1; border: 1px solid var(--line); border-radius: 12px; font-variant-numeric: tabular-nums; }
.fn-work .hint { margin: 0; }
.fn-row { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; font-size: 15px; }
.fn-row > span:first-child { color: var(--muted); }
.fn-result { margin-top: 10px; padding-top: 12px; border-top: 1px dashed var(--line); text-align: right; }
.fn-result.ok { color: #1a7f4b; font-weight: 600; text-align: left; }
.fn-calc { font-size: 17px; }
.fn-calc b { font-size: 22px; }
.fn-calc.before { color: var(--muted); font-size: 15px; }
.fn-calc.before b { font-size: 15px; }
.fn-adj { margin: 6px 0 2px; font-weight: 700; color: var(--accent-ink); }
.fn-dup { margin-top: 16px; padding: 12px 14px; background: #fff4e5; border: 1px solid #f3c98b; border-radius: 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.fn-warn { padding: 10px 14px; background: #fff4e5; border: 1px solid #f3c98b; border-radius: 10px; }
.fn-actions { display: flex; align-items: center; gap: 10px; margin-top: 18px; }
.step-head .fn-sync { margin-left: auto; font-size: 13px; font-weight: 600; color: var(--muted); }
.fn-sync.ok::before { content: '● '; color: #1a7f4b; }
.fn-sync.warn { color: #9a5b00; }
.fn-unlock { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; padding: 12px 14px; background: #f8f7f1; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; }
.fn-unlock[hidden] { display: none; }
.fn-unlock input { flex: 1; min-width: 160px; max-width: 260px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff; }
.fn-listbar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.fn-listbar input { flex: 1; max-width: 360px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; font-size: 15px; background: #fff; }
.fn-table td:first-child { width: 48px; text-align: center; }
.fn-table input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }
.fn-table tr.sel td { background: #e8f5f3; }
.fn-num { text-align: right !important; white-space: nowrap; }
.fn-acts { white-space: nowrap; text-align: right; }
.fn-acts .ghost + .ghost { margin-left: 6px; }
.fn-subj { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
.fn-mail { padding: 18px 20px; background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; }
.fn-mail ul { padding-left: 22px; }
@media (max-width: 720px) {
  .fn-form { grid-template-columns: 1fr 1fr; }
  .fn-form .fn-vendor { grid-column: span 2; }
  .tabs { overflow-x: auto; scrollbar-width: none; }
  .tabs a { flex: 0 0 auto; padding: 8px 10px; }
  .fn-result { text-align: left; }
  .step-head:has(.fn-sync) { flex-wrap: wrap; }
  .step-head .fn-sync { margin-left: 0; width: 100%; }
  .fn-pair select { padding: 0 6px; }
}

/* ---------- AGR dropdown (Fine calculator) ---------- */
.fn-agrbox { position: relative; }
.fn-agrbox input { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 15px; color: var(--ink); background: #fff; min-height: 44px; width: 100%; }
.fn-agrbox input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.fn-dd { position: absolute; z-index: 20; top: calc(100% - 18px); left: 0; right: 0; max-height: 320px; overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 28px rgba(0,0,0,.14); font-weight: 400; }
.fn-dd[hidden] { display: none; }
.fn-ddi { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 9px 12px; cursor: pointer; color: var(--ink); font-size: 14px; border-bottom: 1px solid var(--line); }
.fn-ddi:last-child { border-bottom: 0; }
.fn-ddi.on, .fn-ddi:hover { background: #e8f5f3; }
.fn-ddi span { color: var(--muted); }
.fn-agrhint { min-height: 18px; font-weight: 400; font-size: 12.5px; color: var(--muted); }
.fn-agrhint a { color: var(--accent-ink); }

/* ---------- Agreements ---------- */
.ag-chip { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; vertical-align: middle; }
.ag-chip.active { background: #e3f4ea; color: #1a7f4b; }
.ag-chip.ending { background: #fff1d6; color: #9a5b00; }
.ag-chip.ended { background: #fde4e0; color: #b42318; }
.ag-searchrow { display: flex; align-items: center; gap: 14px; }
.ag-q { flex: 1; padding: 16px 18px; font: inherit; font-size: 20px; font-weight: 600; border: 1.5px solid var(--line); border-radius: 14px; background: #fff; min-width: 0; }
.ag-q:focus { outline: 2px solid var(--accent); border-color: transparent; }
.ag-searchrow .fn-sync { margin-left: 0; white-space: nowrap; }
#ag-results { margin-top: 14px; }
#ag-results .hint { margin: 0; }
.ag-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; max-height: 420px; overflow-y: auto; }
.ag-item { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 12px 14px; border: 0; border-bottom: 1px solid var(--line); background: #fff; text-align: left; cursor: pointer; font-size: 15px; }
.ag-item:last-child { border-bottom: 0; }
.ag-item:hover, .ag-item.on { background: #e8f5f3; }
.ag-item span { color: var(--muted); }
.ag-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 12px; }
.ag-head h2 { margin: 0; font-size: 26px; letter-spacing: -.01em; }
.ag-head p { margin: 4px 0 0; color: var(--muted); }
.ag-use { text-decoration: none; color: var(--ink); font-weight: 600; padding: 8px 14px; }
.ag-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin: 18px 0; }
.ag-kv { padding: 12px 14px; background: #f8f7f1; border: 1px solid var(--line); border-radius: 12px; }
.ag-kv > span { display: block; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 4px; }
.ag-kv > div { font-size: 16px; font-weight: 600; }
.ag-kv .hint { font-weight: 400; font-size: 13px; margin-top: 2px; }
.ag-flags ul { margin: 6px 0 0; padding-left: 20px; }
.ag-rhead { flex-wrap: wrap; margin-top: 8px; }
.ag-rhead input { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 14px; }
.ag-rtable td:first-child { width: 36px; }
.ag-import { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin: 10px 0; }
.ag-check { display: flex; align-items: center; gap: 6px; font-size: 14px; }
#ag-import-sec summary { cursor: pointer; }
.fn-ok { color: #1a7f4b; font-weight: 600; }
@media (max-width: 720px) { .ag-searchrow { flex-direction: column; align-items: stretch; } .ag-q { font-size: 17px; } }

.ag-rtable tr.ag-check-row td { background: #fff3a3; }
.ag-rtable tr.ag-check-row:hover td { background: #ffeb70; }
.ag-check-key { display: inline-block; width: 12px; height: 12px; background: #fff3a3; border: 1px solid #e0c84a; border-radius: 2px; vertical-align: -1px; }

/* Agreements: browsing and search */
.ag-layout { display: block; }
@media (min-width: 1100px) {
  .ag-layout { display: grid; grid-template-columns: minmax(340px, 420px) 1fr; gap: 20px; align-items: start; }
  .ag-layout .ag-side { position: sticky; top: 12px; }
  .ag-layout .ag-side .ag-list { max-height: calc(100vh - 290px); }
  .ag-layout .ag-searchrow { flex-direction: column; align-items: stretch; gap: 6px; }
  .ag-layout .ag-q { font-size: 18px; }
  .ag-layout .ag-main { margin-top: 0; }
}
.ag-filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.ag-fchip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 11px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--ink); }
.ag-fchip span { color: var(--muted); font-weight: 500; margin-left: 2px; }
.ag-fchip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.ag-fchip.on span { color: #d9d4cc; }
.ag-count { font-size: 12.5px; margin: 0 0 6px !important; }
.ag-item { flex-direction: column; align-items: stretch; gap: 3px; }
.ag-item .ag-i1 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--ink); }
.ag-item .ag-i2 { color: var(--ink); font-size: 14px; }
.ag-item .ag-i3 { color: var(--muted); font-size: 12.5px; }
.ag-item.amd { padding-left: 30px; background: #fbfaf5; }
.ag-item.amd .ag-i1 strong { font-weight: 600; }
.ag-item.act { box-shadow: inset 3px 0 0 var(--accent); background: #e8f5f3; }
.ag-item mark, .ag-rtable mark { background: #ffe58a; color: inherit; padding: 0 1px; border-radius: 2px; }
.ag-flagdot { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: #fff3a3; border: 1px solid #e0c84a; font-size: 11px; font-weight: 700; color: #6b5800; }
.ag-more { margin-top: 8px; width: 100%; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.ag-amdbox { padding: 12px 14px; border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 10px; background: #fdfcf8; margin: 0 0 12px; }
.ag-amdbox ul { margin: 6px 0 0; padding-left: 18px; }
.ag-amdbox div { margin-top: 4px; }

/* Agreements: calmer layout */
body[data-page="agreements"] main, body[data-page="agreements"] .top, body[data-page="agreements"] .foot, body[data-page="pv"] main, body[data-page="pv"] .top, body[data-page="pv"] .foot { max-width: 1240px; }
body[data-page="agreements"] .hero { padding: 10px 0 18px; }
body[data-page="agreements"] .hero h1 { font-size: 34px; margin-bottom: 6px; }
body[data-page="agreements"] .hero p { font-size: 15px; max-width: 720px; }
@media (min-width: 1100px) { .ag-layout { grid-template-columns: 380px 1fr; gap: 24px; } }
.ag-side { padding: 18px; }
.ag-q { font-size: 17px !important; padding: 13px 16px; }
.ag-filters { flex-wrap: nowrap; overflow-x: auto; margin: 12px -18px 8px; padding: 0 18px 4px; scrollbar-width: thin; }
.ag-fchip { white-space: nowrap; flex: none; }
.ag-count { margin: 0 0 8px !important; }
.ag-list { border-radius: 12px; }
.ag-item { padding: 12px 14px; gap: 2px; }
.ag-item .ag-i2 { font-size: 13.5px; color: #45403b; }
.ag-main { padding: 28px 32px; }
.ag-head { gap: 16px; margin-bottom: 4px; }
.ag-type { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.ag-head h2 { font-size: 28px; }
.ag-head p { margin-top: 6px; line-height: 1.45; color: var(--muted); }
.ag-head p strong { color: var(--ink); font-weight: 600; }
.ag-facts { display: flex; flex-wrap: wrap; margin: 22px 0 18px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.ag-fact { flex: 1 1 160px; padding: 14px 18px 14px 0; display: flex; flex-direction: column; gap: 2px; }
.ag-fact + .ag-fact { padding-left: 18px; border-left: 1px solid var(--line); }
.ag-fact > span { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.ag-fact > strong { font-size: 18px; font-weight: 650; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ag-fact > em { font-style: normal; font-size: 13px; color: var(--muted); }
.ag-mores { display: flex; flex-direction: column; gap: 8px; margin-bottom: 22px; }
.ag-more-d { border: 1px solid var(--line); border-radius: 10px; padding: 0 14px; background: #fff; }
.ag-more-d summary { cursor: pointer; padding: 11px 0; font-weight: 600; font-size: 14.5px; display: flex; align-items: center; gap: 8px; list-style: none; }
.ag-more-d summary::-webkit-details-marker { display: none; }
.ag-more-d summary::after { content: '▾'; margin-left: auto; color: var(--muted); }
.ag-more-d[open] summary::after { content: '▴'; }
.ag-more-d p, .ag-more-d ul { margin: 0 0 12px; font-size: 14px; line-height: 1.55; color: #45403b; }
.ag-more-d.ag-flags { background: #fffbea; border-color: #f0e2a0; }
.ag-amdbox { margin: 0 0 14px; font-size: 14.5px; }
.ag-rhead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: 6px 0 12px; }
.ag-rhead h3 { margin: 0; font-size: 19px; }
.ag-rhead h3 .hint { font-size: 13px; font-weight: 400; margin-left: 6px; }
.ag-rtools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ag-rtools input { width: 200px; }
.ag-twrap { max-height: 70vh; overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
.ag-rtable { font-size: 14px; }
.ag-rtable thead th { position: sticky; top: 0; background: #f8f7f1; z-index: 1; font-size: 12px; }
.ag-rtable td { padding: 9px 12px; vertical-align: top; line-height: 1.4; }
.ag-rtable td.ag-n, .ag-rtable th.ag-n { width: 34px; color: var(--muted); font-size: 12.5px; }
.ag-rtable td.ag-code { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.ag-rtable td.ag-qty { color: var(--muted); white-space: nowrap; }
.ag-rtable td.ag-rate { white-space: nowrap; font-weight: 600; }
.ag-rtable td.ag-rate span { margin-left: 4px; font-size: 11.5px; font-weight: 500; color: var(--muted); }
.ag-note { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.ag-rtable tr.ag-sec td { background: #f2efe7; font-weight: 700; font-size: 12.5px; letter-spacing: .04em; text-transform: uppercase; color: #4a4e57; padding: 7px 12px; position: sticky; top: 33px; }
@media (max-width: 720px) { .ag-main { padding: 20px 18px; } .ag-fact + .ag-fact { padding-left: 12px; } .ag-rtools input { width: 100%; } }

/* Invoice check: agreement rates */
.ic-agrpick { position: relative; max-width: 520px; margin-top: 8px; }
.ic-agrpick input { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; background: #fff; }
.ic-agrhits { display: flex; flex-direction: column; margin-top: 4px; border-radius: 10px; overflow: hidden; }
.ic-agrhits:not(:empty) { border: 1px solid var(--line); }
.ic-agrhits button { text-align: left; background: #fff; border: 0; border-bottom: 1px solid var(--line); padding: 9px 12px; font: inherit; font-size: 14px; cursor: pointer; }
.ic-agrhits button:hover { background: #e8f5f3; }
.ic-agrsug { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0; }
.ic-agrhead { margin: 0 0 10px; }
.ic-table tr.ic-over td { background: #fdecea; }

/* Agreements: renewals */
.ag-renew-wrap { margin-bottom: 18px; }
.ag-renew { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.ag-renew > summary { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 14px 20px; cursor: pointer; list-style: none; }
.ag-renew > summary::-webkit-details-marker { display: none; }
.ag-renew-t { font-weight: 700; font-size: 16px; }
.ag-renew-n { color: var(--muted); font-size: 14px; }
.ag-renew-n.hot { color: #b3261e; font-weight: 600; }
.ag-renew-win { margin-left: auto; display: flex; gap: 6px; }
.ag-renew-list { border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); }
.ag-renew-all { margin: 0; border: 0; border-radius: 0 0 var(--radius) var(--radius); width: 100%; }
.ag-renew-row { display: flex; align-items: center; gap: 14px; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 12px 20px; font: inherit; cursor: pointer; color: var(--ink); }
.ag-renew-row:hover { background: #e8f5f3; }
.ag-renew-d { flex: none; width: 54px; text-align: center; font-size: 11px; color: var(--muted); line-height: 1.1; border-radius: 10px; padding: 6px 0; background: #f2efe7; }
.ag-renew-d b { display: block; font-size: 19px; color: var(--ink); }
.ag-renew-d.warm { background: #fff3d6; } .ag-renew-d.hot { background: #fdecea; } .ag-renew-d.hot b { color: #b3261e; }
.ag-renew-m { flex: 1; min-width: 0; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-renew-m em, .ag-renew-e em { display: block; font-style: normal; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-renew-e { flex: none; font-size: 13px; color: var(--muted); text-align: right; }
.tabs a .tab-badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px; border-radius: 999px; background: #d64532; color: #fff; font-size: 11px; font-weight: 700; vertical-align: 1px; }

/* Weekly report: history */
.wk-chart { margin: 4px 0 16px; }
.wk-chart svg { width: 100%; height: 120px; display: block; background: #f8f7f1; border: 1px solid var(--line); border-radius: 10px; }
.wk-chart-k { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; margin-top: 6px; }
.wk-chart-k i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.wk-htable tbody tr { cursor: pointer; }
.wk-htable tbody tr:hover td { background: #e8f5f3; }
.wk-htable tbody tr.on td { background: #e8f5f3; box-shadow: inset 0 0 0 0 transparent; }
.wk-htable tbody tr.on td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.wk-up { color: #b3261e; } .wk-down { color: #1e7a46; }
.wk-hhead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: 22px 0 10px; }
.wk-hhead h3 { margin: 0; }
.wk-figs4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 860px) { .wk-figs4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.wk-hq { padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; width: 220px; }
.wk-hvend { max-height: 60vh; overflow: auto; }
.wk-pill.ok { color: #1e7a46; background: #e8f5ec; }
.wk-figs4 .big { font-size: clamp(20px, 2.2vw, 28px); }

/* Agreements: payments and balance */
.pay { margin: 4px 0 26px; }
.pay-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.pay-head h3 { margin: 0; font-size: 19px; }
.pay-figs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.pay-figs > div { padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; background: #fff; }
.pay-figs > div + div { border-left: 1px solid var(--line); }
.pay-figs span { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.pay-figs strong { font-size: 19px; font-weight: 650; font-variant-numeric: tabular-nums; }
.pay-figs em { font-style: normal; font-size: 13px; color: var(--muted); }
.pay-figs .linkish { align-self: flex-start; font-size: 13px; }
.pay-bal { background: #f2f8f4 !important; } .pay-bal strong { color: #1a7f4b; }
.pay-bal.done { background: #f2efe7 !important; } .pay-bal.done strong { color: var(--ink); }
.pay-bal.over { background: #fdecea !important; } .pay-bal.over strong, .pay-bal.over span { color: #b3261e; }
.pay-bar { height: 6px; background: #ece8df; border-radius: 999px; margin: 10px 0 14px; overflow: hidden; }
.pay-bar i { display: block; height: 100%; background: #1a7f4b; border-radius: 999px; }
.pay-bar.over i { background: #b3261e; }
.pay-twrap { border: 1px solid var(--line); border-radius: 12px; max-height: 60vh; overflow: auto; }
.pay-table { font-size: 14px; }
.pay-table thead th { position: sticky; top: 0; background: #f8f7f1; font-size: 12px; z-index: 1; }
.pay-table td { padding: 9px 12px; vertical-align: top; }
.pay-table td.ag-n { width: 30px; color: var(--muted); font-size: 12.5px; }
.pay-table .pay-inv, .pay-table .pay-date { white-space: nowrap; }
.pay-table .pay-amt { font-weight: 600; }
.pay-table .fn-num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.pay-table .pay-neg { color: #b3261e; font-weight: 600; }
.pay-table tr.on td { background: #e8f5f3; }
.pay-table tr.pay-missing td { background: #fffbea; }
.pay-act { text-align: right; width: 1%; }
.pay-total { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; padding: 14px 16px; border: 1px dashed var(--line); border-radius: 12px; background: #fdfcf8; }
.pay-total label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
.pay-total .hint { flex-basis: 100%; margin: 0; }
.pay-money { display: flex; }
.pay-money select { border: 1px solid var(--line); border-right: 0; border-radius: 10px 0 0 10px; padding: 0 8px; font: inherit; background: #f2efe7; }
.pay-money input { width: 200px; border-radius: 0 10px 10px 0 !important; font-size: 16px !important; }
.pay-form { margin-top: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: #f8f7f1; }
.pay-form h4 { margin: 0 0 10px; font-size: 15px; }
.pay-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 12px; }
.pay-grid .pay-wide { grid-column: 1 / -1; }
.pay-form label, .pay-total label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.pay-form input, .pay-total input { padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; font: inherit; font-size: 15px; color: var(--ink); background: #fff; min-width: 0; }
.pay-refs { margin-top: 10px; }
.pay-refs summary { cursor: pointer; font-size: 13.5px; color: var(--muted); margin-bottom: 8px; }
.pay-warn p { margin: 10px 0 0; padding: 8px 12px; background: #fff3d6; border-radius: 8px; font-size: 13.5px; color: #7a4a00; }
.pay-btns { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px; }
.pay-del { margin-left: auto; color: #b3261e; }
.pay-msg { font-size: 13.5px; color: #1a7f4b; font-weight: 600; }
@media (max-width: 720px) { .pay-figs, .pay-grid { grid-template-columns: 1fr; } .pay-figs > div + div { border-left: 0; border-top: 1px solid var(--line); } .pay-money input { width: 100%; } }

/* PV register */
body[data-page="pv"] .hero { padding: 10px 0 18px; }
.pv-hero { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.pv-hero h1 { font-size: 34px !important; margin-bottom: 6px !important; }
.pv-hero p { font-size: 15px !important; max-width: 700px; }
.pv-site { display: inline-flex; background: #ece8df; border-radius: 12px; padding: 4px; }
.pv-site button { border: 0; background: none; font: inherit; font-weight: 700; font-size: 15px; padding: 9px 22px; border-radius: 9px; cursor: pointer; color: var(--muted); }
.pv-site button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.pv-entry.editing { border-color: var(--accent); box-shadow: 0 0 0 3px #cfeee9; }
.pv-entry .step-head { margin-bottom: 14px; }
.pv-entry .step-head h2 .hint { font-size: 13px; font-weight: 400; margin-left: 6px; }
.pv-row { display: grid; gap: 12px; margin-bottom: 12px; }
.pv-row1 { grid-template-columns: 1.1fr .8fr 1.6fr 1.1fr; }
.pv-f { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--muted); min-width: 0; }
.pv-f .hint { font-weight: 400; }
.pv-f input, .pv-lines input, #pv-sapin { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; font-size: 15.5px; color: var(--ink); background: #fff; min-width: 0; width: 100%; box-sizing: border-box; }
.pv-f input:focus, .pv-lines input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.pv-pvbox { display: flex; align-items: center; gap: 8px; }
.pv-pvbox input { font-weight: 700; font-variant-numeric: tabular-nums; }
.pv-pvbox input[readonly] { background: #f2efe7; border-color: transparent; }
.pv-pvbox .linkish { font-size: 13px; white-space: nowrap; }
.pv-vsug { font-size: 13.5px; margin: -4px 0 10px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; color: var(--muted); }
.pv-vsug:empty, .pv-agrnote:empty, .pv-warn:empty { display: none; }
.pv-agrnote { margin: -4px 0 10px; font-size: 13px; }
.pv-lines { width: 100%; border-collapse: collapse; margin-top: 4px; }
.pv-lines th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 0 6px 5px 0; }
.pv-lines td { padding: 0 8px 8px 0; vertical-align: top; }
.pv-lines td:last-child { width: 90px; white-space: nowrap; }
.pv-num { text-align: right; font-variant-numeric: tabular-nums; }
.pv-conv { font-size: 12.5px; display: block; margin-top: 3px; }
.pv-x { border: 1px solid var(--line); background: #fff; width: 36px; height: 40px; border-radius: 10px; cursor: pointer; font-size: 18px; color: var(--muted); }
.pv-x:hover { border-color: var(--accent); color: var(--accent); }
.pv-clr { display: block; font-size: 11.5px; color: #1a7f4b; margin-top: 4px; }
.pv-linetools { display: flex; align-items: center; gap: 14px; margin-top: 2px; }
.pv-warn p { margin: 10px 0 0; padding: 9px 12px; border-radius: 8px; font-size: 14px; background: #fff3d6; color: #7a4a00; }
.pv-warn p.stop { background: #fdecea; color: #b3261e; font-weight: 600; }
.pv-btns { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 16px; }
.pv-del { margin-left: auto; }
.pv-msg { font-weight: 600; color: #1a7f4b; font-size: 14.5px; }
.pv-msg.bad { color: #b3261e; }
.pv-keys { margin-left: auto; font-size: 12.5px; }
.pv-del:not([hidden]) + .pv-msg + .pv-keys { margin-left: 0; }
.pv-reghead { display: flex; gap: 12px; align-items: center; }
.pv-q { font-size: 17px !important; padding: 13px 16px; }
.pv-reghead .ghost { white-space: nowrap; padding: 10px 14px; }
.pv-reg .ag-filters { margin: 12px 0 8px; flex-wrap: wrap; }
.pv-sum { display: flex; gap: 18px; font-size: 14px; color: var(--muted); margin: 0 0 8px; }
.pv-sum b { color: var(--ink); font-variant-numeric: tabular-nums; }
.pv-twrap { max-height: 70vh; overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
.pv-table { font-size: 13.5px; }
.pv-table td { vertical-align: top; padding: 8px 10px; }
.pv-table td:first-child { color: var(--ink); width: auto; }
.pv-table tbody tr { cursor: pointer; }
.pv-table tbody tr:hover td { background: #e8f5f3; }
.pv-table tbody tr.on td { background: #cfeee9; }
.pv-c-pv, .pv-c-d, .pv-c-po, .pv-c-c { white-space: nowrap; }
.pv-c-pv { font-weight: 600; font-variant-numeric: tabular-nums; }
.pv-c-v { min-width: 160px; }
.pv-c-i { word-break: break-word; max-width: 180px; }
.pv-table .fn-num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.pv-tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 999px; background: #f2efe7; color: var(--muted); }
.pv-tag.warn { background: #fff3d6; color: #9a5b00; }
.pv-tag.bad { background: #fdecea; color: #b3261e; }
.pv-ok { color: #1a7f4b; font-size: 12.5px; }
.pv-skips { display: flex; flex-wrap: wrap; gap: 6px; }
#pv-sap summary { cursor: pointer; }
#pv-sap summary .hint { font-size: 13px; margin-left: 6px; }
#pv-sapin { margin: 10px 0; font-family: ui-monospace, monospace; font-size: 13px; resize: vertical; }
#pv-sapgo { margin-top: 10px; }
@media (max-width: 900px) { .pv-row1, .pv-row2 { grid-template-columns: 1fr 1fr; } .pv-fv, .pv-fr { grid-column: 1 / -1; } }
@media (max-width: 600px) { .pv-row1, .pv-row2 { grid-template-columns: 1fr; } .pv-reghead { flex-direction: column; align-items: stretch; } .pv-lines th:nth-child(5), .pv-lines td:nth-child(5) { display: none; } }
.pay-pv { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 999px; background: #e8eefc; color: #2f4e9b; margin-right: 4px; }
.pay-twin { margin-top: 4px; font-size: 12.5px; color: #b3261e; font-weight: 600; }
.pv-row2 { grid-template-columns: 1fr auto; align-items: end; }
.pv-delchk { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--muted); padding: 10px 4px; white-space: nowrap; cursor: pointer; }
.pv-inv { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px 8px; margin-bottom: 10px; background: #fbfaf5; }
.pv-invhead { display: grid; grid-template-columns: auto 1.4fr 1fr auto; gap: 12px; align-items: end; margin-bottom: 10px; }
.pv-invhead:not(:has(.pv-invn)) { grid-template-columns: 1.4fr 1fr; }
.pv-invn { width: 26px; height: 26px; border-radius: 999px; background: var(--ink); color: #fff; font-weight: 700; font-size: 13px; display: grid; place-items: center; margin-bottom: 8px; }
.pv-lines select { padding: 10px 8px; border: 1px solid var(--line); border-radius: 10px; font: inherit; font-size: 15px; background: #fff; width: 100%; }
.pv-lines td:nth-child(1) { width: 15%; } .pv-lines td:nth-child(2) { width: 20%; } .pv-lines td:nth-child(3) { width: 11%; } .pv-lines td:nth-child(4) { width: 20%; }
.pv-na { display: block; padding: 10px 4px; }
.pv-addline { font-size: 13.5px; margin: 0 0 6px; }
.pv-total { margin-left: auto; font-weight: 600; font-size: 14px; font-variant-numeric: tabular-nums; }
.pv-table tr.pv-deleted td { color: var(--muted); background: #f8f6f0; }
.pv-c-fx { font-size: 12.5px; }
.pv-skip { display: inline-flex; align-items: center; gap: 10px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 13.5px; background: #fff; }
.pv-skip .linkish { font-size: 13px; }
.pv-markall { margin-top: 12px; }
@media (max-width: 600px) { .pv-invhead { grid-template-columns: 1fr !important; } .pv-row2 { grid-template-columns: 1fr; } }
.pv-impskip { color: #9a5b00; }

/* ================= IGMH theme =================
   Warm stone paper, teal accent, serif headings, soft cards, pill buttons. */
body { background: var(--paper); color: #2c2926; -webkit-font-smoothing: antialiased; }
body { position: relative; z-index: 0; }

/* Header: sticky, frosted */
.top {
  position: sticky; top: 0; z-index: 30; max-width: none !important; margin: 0;
  padding: 12px max(20px, calc((100vw - 1240px) / 2 + 20px));
  background: rgba(250,249,242,.95);
  border-bottom: 1px solid rgba(69,64,59,.08);
}
.brand { gap: 10px; }
.mark {
  width: 34px; height: 34px; border-radius: 10px; margin: 0; font-size: 18px; font-weight: 800;
  background: linear-gradient(140deg, #00b8ac 0%, #00a79d 45%, #06695d 100%);
  box-shadow: 0 4px 12px rgba(0,105,93,.28), inset 0 1px 0 rgba(255,255,255,.25);
}
.brand::after { content: 'IGMH Workspace'; font-family: var(--serif); font-weight: 600; font-size: 17px; letter-spacing: -.005em; color: var(--ink); }
@media (max-width: 720px) { .brand::after { display: none; } }
.tabs { background: rgba(69,64,59,.06); border-radius: 999px; padding: 4px; }
.tabs a { border-radius: 999px; padding: 8px 16px; color: #6e655d; }
.tabs a:hover { color: var(--teal-deep); }
.tabs a.on { background: #fff; color: var(--teal-deep); box-shadow: 0 1px 2px rgba(32,30,29,.08), 0 4px 12px rgba(32,30,29,.06); }
.privacy { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: #5f5852; text-decoration: none; font-weight: 600; }
.privacy:hover { border-color: var(--teal); color: var(--teal-deep); }
.privacy svg { stroke: var(--teal); }

main { padding-top: 8px; }

/* Headings in the hospital's serif */
.hero h1, body[data-page] .hero h1, .pv-hero h1 { font-family: var(--serif); font-weight: 500 !important; letter-spacing: -.02em !important; color: var(--ink); }
.hero h1 em { color: var(--teal); font-style: italic; }
.step-head h2, .ag-head h2, .pay-head h3, .ag-rhead h3, .wk-hhead h3, .results-head h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; }
.hero p { color: #6e655d; }

/* Cards */
.step, .ag-renew {
  border: 1px solid rgba(69,64,59,.10); border-radius: 18px;
  box-shadow: 0 1px 2px rgba(32,30,29,.04), 0 8px 24px -12px rgba(32,30,29,.10);
}
.num { background: var(--teal); }

/* Buttons */
.primary { border-radius: 999px; background: var(--teal); box-shadow: 0 6px 16px rgba(0,167,157,.28); padding: 13px 26px; }
.primary:hover { background: var(--teal-deep); }
.ghost { border-radius: 999px; padding: 7px 14px; border-color: #ddd8cf; }
.ghost:hover { border-color: var(--teal); color: var(--teal-deep); }
.linkish { color: var(--teal-deep); }
a { color: var(--teal-deep); }

/* Inputs: teal focus */
input:focus, select:focus, textarea:focus { outline: 2px solid var(--teal) !important; outline-offset: 0; border-color: transparent !important; }

/* Filter chips */
.ag-fchip { border-radius: 999px; border-color: #ddd8cf; }
.ag-fchip:hover { border-color: var(--teal); }
.ag-fchip.on { background: var(--teal-night); border-color: var(--teal-night); }

/* Agreement / list selection */
.ag-item.act { box-shadow: inset 3px 0 0 var(--teal); }
.ag-chip.active { background: #e2f4f1; color: #06695d; }

/* PV register site switch */
.pv-site { background: rgba(69,64,59,.07); border-radius: 999px; }
.pv-site button { border-radius: 999px; }
.pv-site button.on { color: var(--teal-deep); }
.pv-entry.editing { border-color: var(--teal); box-shadow: 0 0 0 4px rgba(0,167,157,.14); }
.pv-invn { background: var(--teal); }
.pv-sum b { color: var(--ink); }

/* Footer */
.foot { max-width: 1240px; text-align: center; border-top: 1px solid rgba(69,64,59,.08); padding-top: 18px; margin-top: 10px; }

/* ---- PV table: every column, scrolls sideways, PV column stays put ---- */
.pv-twrap { overflow: auto; max-height: 72vh; scrollbar-gutter: stable; }
.pv-table { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; }
.pv-table th, .pv-table td { white-space: nowrap; }
.pv-table td.pv-c-v, .pv-table td.pv-c-r { white-space: normal; min-width: 190px; max-width: 280px; }
.pv-table td.pv-c-i { white-space: nowrap; max-width: none; }
.pv-table .pv-c-i div + div { margin-top: 2px; }
.pv-table th:first-child, .pv-table td:first-child { position: sticky; left: 0; z-index: 2; background: #fff; box-shadow: 1px 0 0 var(--line); }
.pv-table thead th { z-index: 3; }
.pv-table thead th:first-child { z-index: 4; background: #f8f7f1; }
.pv-table tbody tr:hover td { background: #eef8f6; }
.pv-table tbody tr.on td { background: #d9f1ed; }
.pv-table tr.pv-deleted td:first-child { background: #f8f6f0; }
.pv-table th.pv-sep, .pv-table td.pv-sep { border-left: 1px solid var(--line); }
.pv-scrollhint { font-size: 12.5px; color: var(--muted); margin: 0 0 6px; }

/* ---- Fonts: Poppins for headings, Inter for everything else ---- */
body { font-family: var(--font); font-feature-settings: "cv11", "ss01"; letter-spacing: -0.006em; }
.hero h1, body[data-page] .hero h1, .pv-hero h1 { font-family: var(--serif); font-weight: 600 !important; letter-spacing: -.025em !important; }
.hero h1 em { font-style: normal; color: var(--teal); }
.step-head h2, .ag-head h2, .pay-head h3, .ag-rhead h3, .wk-hhead h3, .results-head h3, .brand::after { font-family: var(--serif); font-weight: 600; letter-spacing: -.015em; }
.brand::after { font-size: 16px; }
.fn-num, .pv-c-pv, .pay-figs strong, .ag-fact > strong, .pv-sum b, .wk-figs4 .big { font-variant-numeric: tabular-nums; }
.tabs a, .primary, .ghost, .ag-fchip, .pv-site button { font-family: var(--serif); font-weight: 500; letter-spacing: 0; }
.primary { font-weight: 600; }

/* ---- Animated tab background ---- */
.tab-bg { position: fixed; inset: 0; z-index: -1; pointer-events: none;
  /* A still wash in the scene colours, shown under the canvas so nothing is ever a bare backdrop. */
  background: radial-gradient(60% 50% at 85% 10%, rgba(0,167,157,.10), transparent 70%), radial-gradient(50% 45% at 10% 90%, rgba(130,197,107,.10), transparent 70%), var(--paper); }
.tab-bg canvas { position: absolute; inset: 0; width: 100%; height: 100%; will-change: opacity, transform; }

/* Cards: frosted so the background shows through a little */
.step, .ag-renew { background: rgba(255,255,255,.93); }   /* no backdrop blur: blurring over a moving canvas costs every frame */

/* ---- Moving between tabs: the page slides, the tab pill glides (Chrome/Edge; others get a fade-in) ---- */
@view-transition { navigation: auto; }
.top { view-transition-name: topbar; }
.tabs a.on { view-transition-name: tabpill; }
main { view-transition-name: page; }
.tab-bg { view-transition-name: tabbg; }
::view-transition-group(tabpill) { animation-duration: .4s; animation-timing-function: cubic-bezier(.34,1.32,.5,1); }
::view-transition-old(tabpill), ::view-transition-new(tabpill) { animation-duration: .3s; }
::view-transition-old(page) { animation: vt-out .3s cubic-bezier(.4,0,.2,1) both; }
::view-transition-new(page) { animation: vt-in .55s cubic-bezier(.22,1,.36,1) .05s both; }
::view-transition-old(tabbg), ::view-transition-new(tabbg) { mix-blend-mode: normal; }
::view-transition-group(tabbg) { animation-duration: .8s; }
::view-transition-old(tabbg) { animation: vt-fade-out .8s ease both; }
::view-transition-new(tabbg) { animation: vt-fade-in .5s ease both; }
@keyframes vt-fade-out { to { opacity: 0; } }
@keyframes vt-fade-in { from { opacity: 0; } }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .25s; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-10px) scale(.995); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(16px) scale(.99); } }
@supports not (view-transition-name: none) {
  main { animation: vt-in .4s cubic-bezier(.2,.75,.2,1) both; }
}
html.vt main > div > .hero, html.vt main > div > .step, html.vt main > div > section, html.vt main > div > .ag-layout, html.vt .ag-main { animation: none; }
main > div > .hero, main > div > .step, main > div > section, main > div > .ag-layout { animation: card-in .45s cubic-bezier(.16,1,.3,1) both; }
main > div > :nth-child(2) { animation-delay: .07s; } main > div > :nth-child(3) { animation-delay: .14s; } main > div > :nth-child(4) { animation-delay: .21s; } main > div > :nth-child(n+5) { animation-delay: .28s; }
@keyframes card-in { from { opacity: 0; transform: translateY(14px); } }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
  main, main > div > * { animation: none !important; }
}

/* ---- Dropdown (replaces the browser's dark datalist) ---- */
.combo-pop { position: fixed; z-index: 200; overflow-y: auto; padding: 6px; border-radius: 14px; background: rgba(255,255,255,.97); backdrop-filter: blur(16px) saturate(1.3); -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border: 1px solid rgba(69,64,59,.12); box-shadow: 0 2px 6px rgba(32,30,29,.06), 0 18px 40px -12px rgba(32,30,29,.28); animation: combo-in .14s ease-out; scrollbar-width: thin; }
@keyframes combo-in { from { opacity: 0; transform: translateY(-4px); } }
.combo-opt { padding: 9px 12px; border-radius: 10px; cursor: pointer; }
.combo-opt + .combo-opt { margin-top: 1px; }
.combo-opt:hover { background: #f2f7f6; }
.combo-opt.act { background: #e3f4f1; }
.combo-t { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14.5px; color: var(--ink); line-height: 1.3; }
.combo-s { font-size: 12.5px; color: var(--muted); margin-top: 2px; line-height: 1.35; }
.combo-tag { margin-left: auto; flex: none; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: #eef4f3; color: var(--teal-deep); font-variant-numeric: tabular-nums; }
.combo-opt mark { background: none; color: var(--teal-deep); font-weight: 700; text-decoration: underline; text-decoration-color: rgba(0,167,157,.45); text-underline-offset: 2px; }
.combo-empty { padding: 10px 12px; color: var(--muted); font-size: 13.5px; }
.combo-foot { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 6px; }
.combo-new { width: 100%; text-align: left; border: 0; background: none; padding: 9px 12px; border-radius: 10px; font: 600 14px var(--serif); color: var(--teal-deep); cursor: pointer; }
.combo-new:hover { background: #f2f7f6; }

/* ---- Vendors drawer ---- */
.pv-heroside { display: flex; align-items: center; gap: 10px; }
.pv-vbtn { padding: 10px 18px; font-size: 15px; }
.drawer { position: fixed; inset: 0; z-index: 100; background: rgba(20,30,28,.30); display: flex; justify-content: flex-end; animation: fade .15s; }
.drawer-card { width: min(760px, 100%); height: 100%; overflow-y: auto; background: var(--paper); box-shadow: -20px 0 60px rgba(20,30,28,.18); padding: 22px 26px 40px; animation: drawer-in .26s cubic-bezier(.2,.8,.2,1); }
@keyframes drawer-in { from { transform: translateX(40px); opacity: .4; } }
@keyframes fade { from { opacity: 0; } }
.drawer-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.drawer-head h2 { margin: 0; font: 600 24px var(--serif); letter-spacing: -.02em; }
.drawer-head .pv-x { margin-left: auto; }
.vd-form { background: #fff; border: 1px solid rgba(69,64,59,.10); border-radius: 16px; padding: 16px 18px; margin-bottom: 16px; }
.vd-form h3 { margin: 0 0 12px; font: 600 16px var(--serif); }
.vd-grid { display: grid; grid-template-columns: 1fr 2fr; gap: 10px 12px; }
.vd-grid .vd-short { grid-column: 1 / -1; }
.vd-grid .pv-delchk { grid-column: 1 / -1; padding: 2px 0; }
.vd-form input { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; font-size: 15px; background: #fff; }
.vd-warn p { margin: 10px 0 0; padding: 8px 12px; border-radius: 8px; background: #fff3d6; color: #7a4a00; font-size: 13.5px; }
.vd-q { width: 100%; font-size: 15px !important; padding: 11px 14px !important; margin-bottom: 10px; }
.vd-table { font-size: 13.5px; background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.vd-table tbody tr { cursor: pointer; }
.vd-table tbody tr:hover td, .vd-table tr.on td { background: #eef8f6; }
.vd-table td.vd-code { color: var(--teal-deep); font-weight: 600; font-variant-numeric: tabular-nums; width: 90px; }
.vd-sub { margin: 22px 0 8px; font: 600 15px var(--serif); }
.vd-loose { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.vd-lrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.vd-lrow:last-child { border-bottom: 0; }
.vd-lact { display: flex; align-items: center; gap: 10px; }
.vd-ren { display: flex; gap: 6px; }
.vd-ren input { width: 220px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px; font: inherit; font-size: 13.5px; }
@media (max-width: 640px) { .vd-grid { grid-template-columns: 1fr; } .vd-ren input { width: 150px; } .pv-hero { align-items: stretch; } }
.vd-arrow { margin-left: 8px; font-size: 12.5px; color: var(--teal-deep); font-weight: 600; }

/* One-time supply agreements */
.ag-once { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: #e6f1fb; color: #1f5f99; font-variant-numeric: tabular-nums; }
.once-figs { margin: 16px 0 14px; }
.once-wrap { border: 1px solid var(--line); border-radius: 12px; max-height: 68vh; overflow: auto; }
.once-table { font-size: 13.5px; }
.once-table tbody tr { cursor: pointer; }
.once-table tbody tr:hover td { background: #eef8f6; }
.once-table td { vertical-align: top; }
.once-table td.once-n { white-space: nowrap; }
.once-table td.once-n .ag-chip { margin-left: 6px; }
.once-v { font-weight: 600; }
.once-table .fn-num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.once-bal { font-weight: 700; color: #1a7f4b; }
.once-bal.done { color: var(--muted); font-weight: 600; }
.once-bar { height: 4px; border-radius: 9px; background: #ece8df; margin-top: 5px; overflow: hidden; min-width: 90px; }
.once-bar i { display: block; height: 100%; background: var(--teal); }
.pv-agrsug:empty { display: none; }
.pv-agrsug { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: -4px 0 12px; font-size: 13px; }
.pv-agrchip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid #c9dcef; background: #f1f7fd; color: #1f4f7f; border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.pv-agrchip:hover { border-color: #1f5f99; }
.pv-agrchip span { color: #4a6f93; font-size: 12px; }
/* PV table colours: cleared (clearing doc/date) green, document number only red */
.pv-table tbody tr.pv-st-clr td { background: #e9f6ee; }
.pv-table tbody tr.pv-st-doc td { background: #fdecea; }
.pv-table tbody tr.pv-st-clr:hover td { background: #d9f0e2; }
.pv-table tbody tr.pv-st-doc:hover td { background: #fadad6; }
.pv-table tbody tr.pv-st-clr td:first-child { box-shadow: inset 3px 0 0 #2e9e5e, 1px 0 0 var(--line); }
.pv-table tbody tr.pv-st-doc td:first-child { box-shadow: inset 3px 0 0 #d64532, 1px 0 0 var(--line); }
.pv-legend { display: inline-flex; gap: 14px; margin-left: 10px; }
.pv-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.pv-autolink { color: #1f5f99; font-weight: 600; }
.ag-layout > * { min-width: 0; }
.once-table td:nth-child(2) { min-width: 170px; }
.once-table td, .once-table th { padding-left: 10px; padding-right: 10px; }
.once-table td.once-n b { color: var(--ink); }

/* ---- PV register: full width, big table, column filters ---- */
body[data-page="pv"] main, body[data-page="pv"] .foot { max-width: none !important; padding-left: 28px; padding-right: 28px; }
body[data-page="pv"] .top { padding-left: 28px; padding-right: 28px; }
body[data-page="pv"] .hero { padding: 8px 0 14px; }
.pv-hero { align-items: center; }
.pv-hero h1 { font-size: 30px !important; margin-bottom: 2px !important; }
.pv-hero p { font-size: 14px !important; max-width: 640px; }
.pv-heroside { flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.pv-heroside .pv-vbtn { padding: 9px 16px; font-size: 14px; }
.pv-reg { padding: 18px 20px; }
.pv-reghead { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.pv-reghead .pv-q { flex: 1 1 420px; }
.pv-reghead .pv-sum { margin: 0; flex-wrap: wrap; }
.pv-reg .ag-filters { margin: 10px 0 6px; }
.pv-listbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 2px 0 6px; }
.pv-listbar .pv-scrollhint { margin: 0; }
.pv-listbar .linkish { font-size: 13px; }
.pv-twrap { max-height: calc(100vh - 150px); min-height: 420px; }
.pv-table thead tr:first-child th { top: 0; }
.pv-table thead tr.pv-frow th { top: 36px; padding: 4px 6px 6px; background: #f8f7f1; border-bottom: 1px solid var(--line); }
.pv-table thead tr:first-child th { height: 36px; }
.pv-frow input { width: 100%; min-width: 64px; padding: 5px 8px; border: 1px solid #e2ded5; border-radius: 7px; font: 500 12.5px var(--font); background: #fff; color: var(--ink); text-transform: none; letter-spacing: 0; }
.pv-frow input:not(:placeholder-shown) { border-color: var(--teal); background: #effaf8; }
.pv-frow input::placeholder { color: #b0a99f; }
.pv-table thead tr.pv-frow th:first-child { z-index: 4; }
.pv-none { padding: 14px 16px; margin: 0; }
#pv-skipbox { padding: 6px 0; }
.drawer-card textarea { width: 100%; margin: 10px 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font: 13px ui-monospace, monospace; resize: vertical; }
.drawer-card > .hint { margin: 0 0 8px; }
.pv-hrow th { cursor: pointer; user-select: none; white-space: nowrap; }
.pv-hrow th:hover { color: var(--teal-deep); }
.pv-sorti { display: inline-block; width: 0; height: 0; margin-left: 6px; vertical-align: 2px; border-left: 4px solid transparent; border-right: 4px solid transparent; opacity: 0; }
.pv-hrow th.asc .pv-sorti { border-bottom: 5px solid var(--teal-deep); opacity: 1; }
.pv-hrow th.desc .pv-sorti { border-top: 5px solid var(--teal-deep); opacity: 1; }
.pv-hrow th.asc, .pv-hrow th.desc { color: var(--teal-deep); }

/* ---- Motion polish ---- */
html { scroll-behavior: smooth; }
.primary, .ghost, .ag-fchip, .tabs a, .pv-site button, .privacy, .linkish, .pv-x, .combo-new, .pv-agrchip { transition: transform .18s cubic-bezier(.34,1.5,.6,1), background-color .2s, color .2s, border-color .2s, box-shadow .25s; }
.primary:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(0,167,157,.32); }
.primary:active, .ghost:active, .ag-fchip:active, .pv-site button:active, .pv-x:active { transform: scale(.96); }
.ghost:hover, .ag-fchip:hover { transform: translateY(-1px); }
.tabs a:hover:not(.on) { background: rgba(255,255,255,.5); }
.step, .ag-renew { transition: box-shadow .3s, border-color .3s, transform .3s; }
.step:hover { box-shadow: 0 1px 2px rgba(32,30,29,.04), 0 14px 34px -16px rgba(32,30,29,.16); }
input, select, textarea { transition: border-color .2s, box-shadow .25s, background-color .2s; }
input:focus, select:focus, textarea:focus { box-shadow: 0 0 0 4px rgba(0,167,157,.14); }
.results tbody tr td, .ag-item, .ag-renew-row, .combo-opt, .vd-table td, .once-table td { transition: background-color .16s; }
.ag-item { transition: background-color .16s, box-shadow .2s, transform .2s; }
.ag-item:hover { transform: translateX(2px); }
.combo-pop { transform-origin: top center; animation: combo-in .2s cubic-bezier(.16,1,.3,1); }
@keyframes combo-in { from { opacity: 0; transform: translateY(-6px) scale(.98); } }
.drawer { animation: dr-fade .25s ease both; }
.drawer-card { animation: drawer-in .45s cubic-bezier(.16,1,.3,1) both; }
@keyframes dr-fade { from { background: rgba(20,30,28,0); } }
@keyframes drawer-in { from { transform: translateX(60px); opacity: 0; } }
.pv-inv { animation: inv-in .4s cubic-bezier(.16,1,.3,1) both; }
@keyframes inv-in { from { opacity: 0; transform: translateY(8px); } }
.pv-warn p, .vd-warn p, .pay-warn p { animation: inv-in .3s cubic-bezier(.16,1,.3,1) both; }
.pv-msg:not(:empty), .pay-msg:not(:empty) { animation: pop-in .35s cubic-bezier(.34,1.5,.6,1) both; }
@keyframes pop-in { from { opacity: 0; transform: scale(.9); } }
.pay-bar i, .once-bar i { transition: width .8s cubic-bezier(.16,1,.3,1); }
.ag-main { animation: card-in .5s cubic-bezier(.16,1,.3,1) both; }
.tab-badge { animation: pop-in .4s cubic-bezier(.34,1.6,.6,1) .3s both; }
.mark { transition: transform .4s cubic-bezier(.34,1.6,.6,1); }
.brand:hover .mark { transform: rotate(-8deg) scale(1.06); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { animation: none !important; transition: none !important; } }
.pv-fade { animation: tb-in .35s ease both; } @keyframes tb-in { from { opacity: .35; } }

/* ---- Sign-in page ---- */
.login-page { min-height: 100vh; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; max-width: none !important; }
.login-card { width: min(440px, 100%); background: rgba(255,255,255,.88); backdrop-filter: blur(18px) saturate(1.3); -webkit-backdrop-filter: blur(18px) saturate(1.3); border: 1px solid rgba(69,64,59,.10); border-radius: 24px; padding: 30px 32px 32px; box-shadow: 0 2px 6px rgba(32,30,29,.05), 0 30px 70px -30px rgba(6,105,93,.35); animation: card-in .8s cubic-bezier(.16,1,.3,1) both; }
.login-brand { display: flex; align-items: center; gap: 10px; font: 600 16px var(--serif); margin-bottom: 22px; }
.login-brand .mark { width: 36px; height: 36px; font-size: 19px; }
.login-form h1 { margin: 0 0 6px; font: 600 26px var(--serif); letter-spacing: -.02em; }
.login-sub { margin: 0 0 20px; color: var(--muted); font-size: 14.5px; }
.login-form .pv-f { margin-bottom: 14px; font-size: 13px; }
.login-form input { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; font: inherit; font-size: 16px; background: #fff; width: 100%; }
.pw-box { position: relative; display: block; }
.pw-box input { padding-right: 64px; }
.pw-eye { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: 0; background: none; font: 600 12.5px var(--serif); color: var(--teal-deep); cursor: pointer; padding: 6px 8px; border-radius: 8px; }
.pw-eye:hover { background: #eef8f6; }
.pw-meter { height: 5px; border-radius: 9px; background: #ece8df; margin: -6px 0 14px; overflow: hidden; }
.pw-meter i { display: block; height: 100%; width: 0; border-radius: inherit; background: #d64532; transition: width .4s cubic-bezier(.16,1,.3,1), background-color .3s; }
.pw-meter i[data-s="2"] { background: #e0a32e; } .pw-meter i[data-s="3"] { background: #7cbf5a; } .pw-meter i[data-s="4"] { background: var(--teal); }
.login-rules { margin: -4px 0 12px; font-size: 12.5px; }
.login-err { min-height: 0; font-size: 14px; color: #b3261e; font-weight: 600; margin: 0 0 10px; opacity: 0; transform: translateY(-4px); transition: opacity .25s, transform .25s; }
.login-err.on { opacity: 1; transform: none; }
.login-go { width: 100%; padding: 14px; font-size: 16px; }
.login-form.in { animation: card-in .5s cubic-bezier(.16,1,.3,1) both; }
.login-form.shake { animation: shake .42s cubic-bezier(.36,.07,.19,.97); }
@keyframes shake { 15%, 55% { transform: translateX(-7px); } 35%, 75% { transform: translateX(7px); } 90% { transform: translateX(-2px); } }
body.leaving .login-card { transition: opacity .25s, transform .25s, filter .25s; opacity: 0; transform: translateY(-10px) scale(.98); filter: blur(4px); }
.out-x { margin-left: 6px; padding-left: 8px; border-left: 1px solid var(--line); color: var(--muted); font-weight: 500; }

/* ---- Users page ---- */
.u-new { display: grid; grid-template-columns: 1fr 1fr 1.3fr auto; gap: 12px; align-items: end; }
.u-new input { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; font-size: 15px; width: 100%; }
.u-pw { display: flex; gap: 6px; } .u-pw input { font-family: ui-monospace, monospace; }
.u-msg { margin-top: 12px; font-size: 14.5px; line-height: 1.7; } .u-msg.bad { color: #b3261e; font-weight: 600; }
.u-code { font: 600 15px ui-monospace, monospace; background: #eef8f6; color: var(--teal-deep); padding: 3px 8px; border-radius: 7px; }
.u-table td { vertical-align: middle; }
.u-act { white-space: nowrap; text-align: right; } .u-act .ghost { padding: 5px 10px; font-size: 13px; margin-left: 4px; }
.pv-tag.ok { background: #e3f4ea; color: #1a7f4b; }
@media (max-width: 860px) { .u-new { grid-template-columns: 1fr; } }
.u-table td:first-child { color: var(--ink); width: auto; }

/* ---------- Agreements: smooth in-page changes ---------- */
html.ag-vt #ag-detail { view-transition-name: agdetail; }
html.ag-vt #ag-results { view-transition-name: aglist; }
html.ag-vt .ag-renew { view-transition-name: agrenew; }
html.ag-vt #ag-results .ag-fchip.on { view-transition-name: agchip; }
html.ag-vt .ag-renew-win .ag-fchip.on { view-transition-name: agwin; }
html.ag-vt .tab-bg { view-transition-name: none; }
html.ag-vt main { view-transition-name: none; }
html.ag-vt .top { view-transition-name: none; }
html.ag-vt::view-transition-old(root), html.ag-vt::view-transition-new(root) { animation: none; }
::view-transition-group(agchip), ::view-transition-group(agwin) { animation-duration: .38s; animation-timing-function: cubic-bezier(.34,1.3,.5,1); z-index: 2; }
::view-transition-group(agdetail), ::view-transition-group(aglist), ::view-transition-group(agrenew) { animation-duration: .38s; animation-timing-function: cubic-bezier(.22,1,.36,1); }
::view-transition-old(agdetail) { animation: vt-fade-out .18s ease both; }
::view-transition-new(agdetail) { animation: ag-in .38s cubic-bezier(.22,1,.36,1) .04s both; }
::view-transition-old(aglist), ::view-transition-old(agrenew) { animation: vt-fade-out .2s ease both; }
::view-transition-new(aglist), ::view-transition-new(agrenew) { animation: vt-fade-in .32s ease .05s both; }
::view-transition-old(aglist), ::view-transition-new(aglist), ::view-transition-old(agrenew), ::view-transition-new(agrenew), ::view-transition-old(agdetail), ::view-transition-new(agdetail) { height: 100%; object-fit: none; object-position: top; }
@keyframes ag-in { from { opacity: 0; transform: translateY(10px); } }
/* Fold-outs open and close smoothly (newer Chrome / Edge / Opera). */
:root { interpolate-size: allow-keywords; }
details.ag-more-d::details-content, details.ag-renew::details-content { height: 0; overflow: clip; transition: height .32s cubic-bezier(.22,1,.36,1), content-visibility .32s allow-discrete; }
details.ag-more-d[open]::details-content, details.ag-renew[open]::details-content { height: auto; }
@media (prefers-reduced-motion: reduce) { details::details-content { transition: none !important; } }
