:root {
  --navy: #172554; --navy-2: #1e3a8a; --ink: #1e293b; --muted: #64748b; --line: #e2e8f0;
  --bg: #f1f5f9; --card: #fff; --accent: #1d4ed8;
  --ok: #047857; --ok-bg: #ecfdf5; --warn: #b45309; --warn-bg: #fffbeb; --bad: #b91c1c; --bad-bg: #fef2f2;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--accent); }
.header { background: var(--navy); box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.header-inner { max-width: 1040px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; gap: 16px; }
.header img { height: 52px; width: auto; }
.header .t1 { color: #bfdbfe; font-size: 13px; margin: 0; }
.header .t2 { color: #bfdbfe; font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; margin: 4px 0 0; }
.header .who { margin-left: auto; text-align: right; color: #bfdbfe; font-size: 13px; }
.header .who a { color: #fff; font-weight: 600; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 24px 16px; }
.wrap.narrow { max-width: 760px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 20px; margin-bottom: 20px; }
.card h2 { margin: 0 0 4px; font-size: 17px; }
.card .sub { margin: 0 0 16px; color: var(--muted); font-size: 13px; }
h1 { font-size: 22px; margin: 0 0 6px; }
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 18px; }
.grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .grid { grid-template-columns: 1fr; } .header img { height: 40px; } }
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.req::after { content: " *"; color: var(--bad); }
input[type=text], input[type=email], input[type=number], input[type=date], input[type=password], input[type=tel], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 6px; font: inherit; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #93c5fd; border-color: var(--accent); }
.help { font-size: 12px; color: var(--muted); margin-top: 3px; }
.errorlist { list-style: none; padding: 0; margin: 4px 0 0; color: var(--bad); font-size: 12.5px; }
.hp { position: absolute; left: -9999px; height: 0; overflow: hidden; }
.btn { display: inline-block; background: var(--accent); color: #fff; border: 0; border-radius: 6px; padding: 10px 18px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--navy-2); }
.btn.secondary { background: #fff; color: var(--ink); border: 1px solid #cbd5e1; }
/* Disabled buttons must look disabled (the panel's submit stays locked until the reply is complete). */
.btn:disabled, .btn[disabled] { background: #e2e8f0; color: #94a3b8; cursor: not-allowed; box-shadow: none; }
.btn:disabled:hover, .btn[disabled]:hover { background: #e2e8f0; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.fee { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px; padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.fee strong { font-size: 20px; }
.msg { border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; font-size: 14px; border: 1px solid; }
.msg.success { background: var(--ok-bg); border-color: #6ee7b7; color: var(--ok); }
.msg.warning { background: var(--warn-bg); border-color: #fcd34d; color: var(--warn); }
.msg.error { background: var(--bad-bg); border-color: #fca5a5; color: var(--bad); }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th, table.t td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
table.t th { background: #f8fafc; font-weight: 600; }
table.t.kv th { width: 34%; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; }
.badge.ok { background: var(--ok-bg); color: var(--ok); } .badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); } .badge.gray { background: #e2e8f0; color: #334155; }
.tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs a { padding: 6px 14px; border-radius: 999px; text-decoration: none; background: #fff; border: 1px solid #cbd5e1; color: var(--ink); font-size: 14px; }
.tabs a.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.toolbar { display: flex; gap: 8px; margin-bottom: 14px; }
.toolbar input { max-width: 320px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 860px) { .two { grid-template-columns: 1fr; } }
.footer { text-align: center; color: #94a3b8; font-size: 12px; padding: 24px 0; }
.checks td.sel select { min-width: 150px; }
.pager { display: flex; gap: 10px; align-items: center; margin-top: 12px; font-size: 14px; }
.row { display: flex; align-items: flex-start; gap: 8px; }
.row input[type=checkbox] { margin-top: 4px; }
.row label { font-weight: 400; }

/* ---------- Admin panel ---------- */
.nav { background: #fff; border-bottom: 1px solid var(--line); }
.nav-inner { max-width: 1180px; margin: 0 auto; padding: 0 16px; display: flex; gap: 4px; align-items: center; }
.nav a { padding: 12px 14px; color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 600; border-bottom: 3px solid transparent; }
.nav a.on, .nav a:hover { color: var(--navy); border-bottom-color: var(--accent); }
.nav .sp { margin-left: auto; }
.wrap.wide { max-width: 1180px; }

.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
@media (max-width: 860px) { .tiles { grid-template-columns: repeat(2, 1fr); } }
.tile { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; border-left: 4px solid var(--accent); }
.tile.amber { border-left-color: #d97706; } .tile.green { border-left-color: #059669; } .tile.slate { border-left-color: #64748b; }
.tile .n { font-size: 26px; font-weight: 700; line-height: 1.1; }
.tile .l { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

.chip { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.chip.wait { background: var(--warn-bg); color: var(--warn); } .chip.late { background: var(--bad-bg); color: var(--bad); }
.chip.ok { background: var(--ok-bg); color: var(--ok); } .chip.gray { background: #e2e8f0; color: #334155; }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
table.t.rows tr:hover td { background: #f8fafc; }
table.t.rows td a.name { color: var(--ink); font-weight: 600; text-decoration: none; }
.muted { color: var(--muted); } .small { font-size: 12.5px; }

.hero { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 16px 20px; margin-bottom: 18px; }
.hero .avatar { width: 46px; height: 46px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 18px; }
.hero h1 { margin: 0; font-size: 20px; } .hero .meta { color: var(--muted); font-size: 13.5px; }
.hero .right { margin-left: auto; text-align: right; }

.layout { display: grid; grid-template-columns: 5fr 7fr; gap: 20px; align-items: start; }
@media (max-width: 960px) { .layout { grid-template-columns: 1fr; } }
.facts { display: grid; grid-template-columns: 38% 1fr; font-size: 14px; }
.facts > div { padding: 8px 0; border-bottom: 1px solid #f1f5f9; } .facts .k { color: var(--muted); }
.facts > div:nth-last-child(-n+2) { border-bottom: 0; }
.doc { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; text-decoration: none; color: var(--ink); }
.doc:hover { border-color: var(--accent); background: #f8fafc; }
.doc .ic { width: 30px; height: 30px; border-radius: 6px; background: #e0e7ff; color: var(--navy-2); display: grid; place-items: center; font-size: 11px; font-weight: 700; }

.step { display: flex; align-items: center; gap: 10px; margin: 0 0 4px; }
.step .no { width: 26px; height: 26px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 700; flex: none; }
.step h2 { margin: 0; font-size: 17px; }
.progress { margin-left: auto; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.progress.done { color: var(--ok); }

.check-row { display: grid; grid-template-columns: 1fr auto; gap: 8px 14px; align-items: center; padding: 12px 12px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; border-left: 4px solid #cbd5e1; background: #fff; }
.check-row.s-match { border-left-color: #059669; background: #f7fdfa; } .check-row.s-mismatch { border-left-color: #dc2626; background: #fffafa; }
.check-row.s-na { border-left-color: #94a3b8; background: #f8fafc; } .check-row.dim { opacity: .5; }
.check-row .lab { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.check-row .val { font-weight: 600; font-size: 15px; word-break: break-word; }
.check-row .correct { grid-column: 1 / -1; display: none; }
.check-row.s-mismatch .correct { display: block; }
.check-row .err { grid-column: 1 / -1; }
.seg-group { display: inline-flex; border: 1px solid #cbd5e1; border-radius: 8px; overflow: hidden; background: #fff; }
.seg { position: relative; margin: 0; font-weight: 600; font-size: 13px; cursor: pointer; }
.seg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.seg span { display: block; padding: 7px 14px; color: #475569; border-right: 1px solid #e2e8f0; }
.seg:last-child span { border-right: 0; }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }
.seg-match input:checked + span { background: #059669; color: #fff; }
.seg-mismatch input:checked + span { background: #dc2626; color: #fff; }
.seg-na input:checked + span { background: #64748b; color: #fff; }
.linkbtn { background: none; border: 0; color: var(--accent); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; padding: 0; }

.result-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (max-width: 640px) { .result-cards { grid-template-columns: 1fr; } }
.rcard { position: relative; border: 2px solid var(--line); border-radius: 10px; padding: 12px 14px; cursor: pointer; background: #fff; display: block; margin: 0; }
.rcard input { position: absolute; opacity: 0; }
.rcard b { display: block; font-size: 14.5px; } .rcard small { color: var(--muted); font-weight: 400; }
.rcard:hover { border-color: #94a3b8; }
.rcard.r-verified:has(input:checked) { border-color: #059669; background: var(--ok-bg); }
.rcard.r-partial:has(input:checked) { border-color: #d97706; background: var(--warn-bg); }
.rcard.r-not_genuine:has(input:checked), .rcard.r-not_found:has(input:checked) { border-color: #dc2626; background: var(--bad-bg); }
.rcard:has(input:focus-visible) { outline: 2px solid var(--accent); }
.suggest { margin: 10px 0 0; font-size: 13px; color: var(--muted); min-height: 18px; }
.suggest b { color: var(--ink); }

.actionbar { position: sticky; bottom: 0; background: rgba(255,255,255,.96); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; display: flex; align-items: center; gap: 12px; margin-top: 4px; box-shadow: 0 -4px 14px rgba(15,23,42,.06); }
.actionbar .note { color: var(--muted); font-size: 13px; }
.actionbar .btn { margin-left: auto; padding: 11px 22px; }
.field-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.field-label.req::after { content: " *"; color: var(--bad); }
.callout { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e3a8a; border-radius: 8px; padding: 10px 14px; font-size: 13.5px; margin-bottom: 14px; }
.empty { text-align: center; padding: 38px 16px; color: var(--muted); }

/* Busy state: spinner before the label while a slow submit is in flight. */
/* Busy is not 'locked': keep the active blue (beats the greyed .btn:disabled style above). */
.btn.loading, .btn.loading:disabled, .btn.loading:disabled:hover { background: var(--accent); color: #fff; opacity: .9; cursor: progress; }
.btn.loading::before { content: ""; display: inline-block; width: 14px; height: 14px; margin-right: 8px; vertical-align: -2px;
    border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .btn.loading::before { animation-duration: 2s; } }

code { font: 12.5px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: #f1f5f9; padding: 1px 6px; border-radius: 4px; word-break: break-all; }

/* Fee breakdown (fee + GST = total) */
.fee-table { border-collapse: collapse; font-size: 14px; min-width: 260px; }
.fee-table td { padding: 3px 0; } .fee-table td:last-child { text-align: right; padding-left: 28px; font-variant-numeric: tabular-nums; }
.fee-table tr.total td { border-top: 1px solid #93c5fd; padding-top: 6px; font-weight: 700; font-size: 17px; }
.fee-note { font-size: 12.5px; color: var(--muted); margin: 6px 0 0; }
.receipt-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; align-items: center; }
.receipt-actions form { margin: 0; }
table.t.nowrap th, table.t.nowrap td { white-space: nowrap; }
