:root {
  --ink: #1b2333;
  --ink-2: #4b5568;
  --ink-3: #7a8396;
  --rule: #dfe3ea;
  --rule-2: #eef1f5;
  --bg: #f5f6f9;
  --card: #ffffff;
  --navy: #1f3a68;
  --brand: #5b5ff7;
  --up: #157347;       /* UpTax values */
  --sw: #2346c8;       /* tax software values */
  --bad: #c0392b;
  --warn: #b7791f;
  --crit-bg: #fdecec;
  --high-bg: #fdf3e3;
  --med-bg: #e9eef8;
  --low-bg: #f1f2f5;
  --good: #157347;
  --radius: 8px;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
a { color: var(--sw); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 0 0 10px; color: var(--navy); }
h3 { font-size: 14px; margin: 0 0 8px; }
.muted { color: var(--ink-3); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, Consolas, monospace; }

/* ---- shell ---- */
.top { background: #141a2b; color: #fff; display: flex; align-items: center; gap: 20px; padding: 0 20px; height: 52px; position: sticky; top: 0; z-index: 20; }
.top .logo { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: .2px; }
.top .logo b { color: #8fe9f8; }
.top nav { display: flex; gap: 2px; flex: 1; }
.top nav a { color: #c9cfdd; padding: 8px 12px; border-radius: 6px; }
.top nav a.on, .top nav a:hover { background: #262f48; color: #fff; text-decoration: none; }
.top .who { color: #c9cfdd; font-size: 13px; display: flex; gap: 10px; align-items: center; }
.top .who button { background: none; border: 1px solid #39425c; color: #c9cfdd; border-radius: 6px; padding: 4px 10px; cursor: pointer; }
main { max-width: 1320px; margin: 0 auto; padding: 22px 20px 60px; }
.crumbs { font-size: 13px; color: var(--ink-3); margin-bottom: 6px; }
.pagehead { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }

/* ---- cards, buttons, forms ---- */
.card { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 900px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.btn { border: 1px solid var(--rule); background: #fff; border-radius: 6px; padding: 7px 14px; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--rule-2); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: #4a4ee6; }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: default; }
label.f { display: block; font-size: 12px; color: var(--ink-2); margin-bottom: 10px; }
label.f > span { display: block; margin-bottom: 4px; }
input[type=text], input[type=password], input[type=number], select, textarea { border: 1px solid var(--rule); border-radius: 6px; padding: 7px 9px; background: #fff; width: 100%; }
textarea { resize: vertical; }
.chk { display: inline-flex; gap: 6px; align-items: center; margin: 0 14px 6px 0; font-size: 13px; }
.notice { border-radius: 6px; padding: 10px 12px; margin-bottom: 14px; font-size: 13px; }
.notice.warn { background: #fff7e6; border: 1px solid #f1d39a; }
.notice.err { background: var(--crit-bg); border: 1px solid #f0b8b2; color: #8b1d12; }
.notice.ok { background: #e8f5ee; border: 1px solid #a9d9bd; }

/* ---- tables ---- */
table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-2); border-bottom: 1px solid var(--rule); padding: 8px; background: #fafbfc; }
table.t td { padding: 8px; border-bottom: 1px solid var(--rule-2); vertical-align: top; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: #f8f9fc; }

/* ---- status chips ---- */
.chip { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 10px; background: var(--low-bg); color: var(--ink-2); white-space: nowrap; }
.chip.not_started { background: #f1f2f5; color: var(--ink-3); }
.chip.evidence { background: #eef0ff; color: #3d41c9; }
.chip.analyzing { background: #fff4d6; color: #8a5a00; }
.chip.in_review { background: #fdf3e3; color: var(--warn); }
.chip.final { background: #e3f4ea; color: var(--good); }
.sev { font-weight: 600; }
.sev.Critical { color: var(--bad); }
.sev.High { color: var(--warn); }
.sev.Medium { color: #4166b0; }
.sev.Low { color: var(--ink-3); }
.pill { display: inline-block; min-width: 20px; text-align: center; font-size: 11px; font-weight: 600; border-radius: 9px; padding: 1px 6px; }
.pill.Critical { background: var(--bad); color: #fff; }
.pill.High { background: #f0b45a; color: #3d2600; }
.pill.Medium { background: #c9d6f0; color: #213a70; }
.pill.Low { background: #e4e6ea; color: #4b5568; }

/* ---- dashboard matrix ---- */
.kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 16px; }
@media (max-width: 900px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
.kpi { background: #fff; border: 1px solid var(--rule); border-radius: var(--radius); padding: 12px 14px; }
.kpi .v { font-size: 24px; font-weight: 700; }
.kpi .l { font-size: 12px; color: var(--ink-3); }
.matrix { overflow-x: auto; }
.matrix table { border-collapse: separate; border-spacing: 0; width: 100%; }
.matrix th { font-size: 12px; color: var(--ink-2); padding: 8px; text-align: left; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.matrix td { border-bottom: 1px solid var(--rule-2); padding: 6px; vertical-align: middle; }
.matrix td.cl { min-width: 220px; }
.cell { display: block; min-width: 130px; border: 1px dashed var(--rule); border-radius: 6px; padding: 6px 8px; cursor: pointer; font-size: 12px; color: var(--ink-3); background: #fff; }
.cell:hover { border-color: var(--brand); text-decoration: none; }
.cell.has { border-style: solid; color: var(--ink); }
.cell .ct { display: flex; gap: 3px; margin-top: 4px; }

/* ---- evidence ---- */
.drop { border: 2px dashed var(--rule); border-radius: var(--radius); padding: 18px; text-align: center; color: var(--ink-3); cursor: pointer; background: #fcfcfe; }
.drop:hover, .drop.over { border-color: var(--brand); color: var(--brand); }
.file { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--rule); border-radius: 6px; margin-bottom: 8px; background: #fff; }
.file .ic { width: 30px; height: 30px; border-radius: 6px; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; background: var(--bad); flex: none; }
.file .ic.vid { background: var(--navy); }
.frames { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; max-height: 260px; overflow: auto; margin-top: 8px; }
.frames figure { margin: 0; position: relative; }
.frames img { width: 100%; display: block; border-radius: 4px; border: 1px solid var(--rule); cursor: zoom-in; }
.frames figcaption { position: absolute; left: 3px; bottom: 3px; background: rgba(0,0,0,.65); color: #fff; font-size: 10px; padding: 0 4px; border-radius: 3px; }
.bar { height: 6px; background: var(--rule-2); border-radius: 3px; overflow: hidden; margin: 8px 0; }
.bar > i { display: block; height: 100%; background: var(--brand); width: 0; transition: width .2s; }
.spin { display: inline-block; width: 12px; height: 12px; border: 2px solid #c9ccf9; border-top-color: var(--brand); border-radius: 50%; animation: sp 0.8s linear infinite; vertical-align: -2px; margin-right: 6px; }
@keyframes sp { to { transform: rotate(360deg); } }

/* ---- lightbox / modal ---- */
.overlay { position: fixed; inset: 0; background: rgba(15,20,35,.55); display: grid; place-items: center; z-index: 50; padding: 20px; }
.overlay img { max-width: 95vw; max-height: 92vh; border-radius: 6px; }
.modal { background: #fff; border-radius: 10px; width: min(560px, 100%); max-height: 90vh; overflow: auto; padding: 20px 22px; }

/* ---- login ---- */
.login { max-width: 360px; margin: 12vh auto; }
.login .card { padding: 26px; }

/* ---- issues board ---- */
.board td.ttl { font-weight: 600; }
.board td .where { font-weight: 400; color: var(--ink-3); font-size: 12px; }
.board select { width: auto; padding: 3px 6px; font-size: 12px; }

/* ==== report (matches the team's sample layout) ==== */
.rep { background: #fff; border: 1px solid var(--rule); border-radius: var(--radius); padding: 26px 30px; color: #1b2333; }
.rep h1 { font-size: 24px; margin: 0 0 4px; }
.rep .sub { color: var(--ink-3); font-size: 12.5px; margin-bottom: 14px; }
.rep h2 { font-size: 18px; color: var(--navy); margin: 20px 0 8px; }
.rep .tiles { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid #8a94a8; }
.rep .tile { padding: 8px 14px 6px; border-right: 1px solid #c3c9d4; }
.rep .tile:last-child { border-right: 0; }
.rep .tile .l { font-size: 12.5px; color: var(--ink-2); }
.rep .tile .v { font-size: 28px; font-weight: 700; margin: 6px 0; }
.rep .tile .s { font-size: 12px; color: var(--ink-2); }
.rep .v.up { color: var(--up); } .rep .v.sw { color: var(--sw); } .rep .v.bad { color: var(--bad); } .rep .v.good { color: var(--good); }
.rep table.r { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.rep table.r th { background: var(--navy); color: #fff; text-align: left; padding: 6px 9px; font-weight: 600; }
.rep table.r td { padding: 5px 9px; border-bottom: 1px solid #e3e6ec; vertical-align: top; }
.rep table.r td.n, .rep table.r th.n { text-align: right; white-space: nowrap; }
.rep table.r tr.tot td { font-weight: 700; }
.rep table.r tr.tot.end td { border-top: 2px solid #9aa3b5; }
.rep table.r tr.grp td { background: #eef1f6; color: var(--navy); font-weight: 700; }
.rep .pos { color: var(--bad); } .rep .neg { color: var(--bad); } .rep .match { color: var(--good); font-weight: 700; }
.rep .tiny { color: var(--warn); }
.rep td.upv { color: var(--up); } .rep td.swv { color: var(--sw); }
.rep .note { font-size: 12.5px; margin: 8px 0; line-height: 1.45; }
.rep .find { display: grid; grid-template-columns: 70px 1fr; border-bottom: 1px solid #e3e6ec; font-size: 12.5px; }
.rep .find > div:first-child { background: #eef1f6; font-weight: 700; font-size: 11px; padding: 7px 9px; }
.rep .find > div:last-child { padding: 6px 10px; }
.rep .sources { font-size: 11.5px; color: var(--ink-3); border-top: 1px solid #e3e6ec; margin-top: 10px; padding-top: 6px; line-height: 1.45; }
.rep table.iss td { font-size: 11.5px; line-height: 1.38; }
.rep table.iss td.sevc { min-width: 110px; }
.rep table.iss tr.Critical td.sevc { background: var(--crit-bg); }
.rep table.iss tr.High td.sevc { background: var(--high-bg); }
.rep table.iss tr.Medium td.sevc { background: var(--med-bg); }
.rep table.iss tr.Low td.sevc { background: var(--low-bg); }
.rep table.iss .it { font-weight: 700; }
.rep table.iss .wh { color: var(--ink-3); }
.rep table.iss .st { margin-top: 4px; }
.rep table.iss .st select { font-size: 11px; padding: 1px 4px; width: auto; }
.rep table.iss .rec { color: #7a4fc2; font-size: 11px; margin-top: 3px; }
.rep .warnrow td { color: var(--warn); font-style: italic; }
.rep [contenteditable=true] { outline: 1px dashed #b8bdf5; background: #fbfbff; border-radius: 2px; }
.rep [contenteditable=true]:focus { outline: 2px solid var(--brand); }
.rep .del { color: var(--bad); cursor: pointer; font-size: 11px; margin-left: 4px; }
.rep .pagebreak { break-before: page; }

@media print {
  @page { size: letter landscape; margin: 0.45in; }
  body { background: #fff; }
  .top, .noprint, .crumbs, .pagehead { display: none !important; }
  main { padding: 0; max-width: none; }
  .rep { border: 0; padding: 0; }
  .rep table.iss .st, .rep .del { display: none; }
  .rep table.r th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .rep * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---- comparisons: one table per software ---- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--rule); margin-bottom: 14px; overflow-x: auto; overflow-y: hidden; }
.tab { border: 0; background: none; padding: 10px 16px; cursor: pointer; color: var(--ink-2); border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; font-weight: 600; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--brand); border-bottom-color: var(--brand); }
.tab .n { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 9px; background: var(--rule-2); color: var(--ink-2); font-size: 11px; margin-left: 4px; }
.tab.on .n { background: #e6e7fe; color: var(--brand); }
.addrow h3 { margin-bottom: 10px; }
.addgrid { display: grid; grid-template-columns: 1.4fr 1fr 1.3fr 1.3fr 170px; gap: 12px; align-items: start; }
.addgrid.other { grid-template-columns: 1.3fr 0.9fr 1fr 1.2fr 1.2fr 160px; }
.addgrid .f { margin-bottom: 0; }
.addgrid input[type=file] { width: 100%; font-size: 12px; padding: 5px 0; }
@media (max-width: 1000px) { .addgrid, .addgrid.other { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .addgrid, .addgrid.other { grid-template-columns: 1fr; } }
table.rows td { vertical-align: middle; }
.nowrap { white-space: nowrap; }
.sum .up { color: var(--up); font-weight: 600; }
.sum .sw { color: var(--sw); font-weight: 600; }
.sum .bad { color: var(--bad); }
.sum .good { color: var(--good); }

/* ---- "For the tech team" box at the top of every report ---- */
.rep .tech { border: 2px solid var(--navy); border-radius: 8px; padding: 14px 18px 12px; margin: 6px 0 18px; background: #f7f9fd; }
.rep .tech-h { font-size: 13px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--navy); margin-bottom: 6px; }
.rep .tech-ov { font-size: 14px; margin: 0 0 10px; line-height: 1.45; }
.rep ol.fixes { margin: 0; padding-left: 22px; }
.rep ol.fixes li { margin-bottom: 8px; font-size: 13.5px; line-height: 1.4; }
.rep ol.fixes .ref { display: inline-block; font-size: 11px; font-weight: 700; color: var(--navy); background: #e3e9f5; border-radius: 4px; padding: 1px 6px; margin-right: 4px; }
.rep ol.fixes .fx { color: var(--ink-2); margin-top: 2px; }
.rep details.prompt { margin-top: 10px; border-top: 1px dashed #c3cbe0; padding-top: 8px; }
.rep details.prompt summary { cursor: pointer; font-weight: 600; color: var(--navy); font-size: 13px; }
.rep details.prompt pre { white-space: pre-wrap; background: #fff; border: 1px solid var(--rule); border-radius: 6px; padding: 10px 12px; font-size: 12px; line-height: 1.45; max-height: 360px; overflow: auto; margin: 0; }
.rep h2.fullh { margin-top: 6px; font-size: 15px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .4px; }
@media print { .rep .tech { break-inside: avoid; } }

/* ---- return types and filters ---- */
.filters { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.tchips { display: flex; gap: 6px; flex-wrap: wrap; }
.tchip { border: 1px solid var(--rule); background: #fff; border-radius: 16px; padding: 4px 12px; font-size: 12.5px; cursor: pointer; color: var(--ink-2); }
.tchip b { margin-left: 3px; color: var(--ink); }
.tchip:hover { border-color: var(--brand); }
.tchip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.tchip.on b { color: #fff; }
.rtype { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 4px; background: #e8ecf6; color: var(--navy); white-space: nowrap; }

/* ---- open issues per software ---- */
.openissues { border-left: 4px solid var(--navy); }
ol.oi { list-style: none; margin: 10px 0 0; padding: 0; }
ol.oi li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--rule-2); }
ol.oi li:first-child { border-top: 0; }
ol.oi .pill { min-width: 62px; margin-top: 1px; }
ol.oi .oi-body { flex: 1; line-height: 1.45; }
ol.oi li.done { opacity: .6; }
.good { color: var(--good); }

/* ---- open-issues panel: collapsed by default ---- */
.openissues.collapsed { padding-top: 10px; padding-bottom: 10px; }
.oi-head { cursor: pointer; user-select: none; }
.oi-plus { width: 26px; height: 26px; flex: none; border-radius: 50%; border: 1px solid var(--navy); background: #fff; color: var(--navy); font-size: 17px; line-height: 1; font-weight: 700; cursor: pointer; padding: 0; }
.oi-head:hover .oi-plus { background: var(--navy); color: #fff; }
