/* Same family as the consignment demo: petrol for what the tool does, amber for what needs attention. */
:root {
  --paper: #f5f7f9;
  --surface: #ffffff;
  --ink: #16212c;
  --muted: #586472;
  --line: #d8dee6;
  --side: #10323a;
  --accent: #0c5b66;
  --accent-dark: #094a53;
  --accent-soft: #9ccdd3;
  --accent-wash: #e3f0f1;
  --amber: #e9a70d;
  --amber-soft: #f8dc8e;
  --amber-ink: #7a5200;
  --amber-wash: #fff6da;
  --ok: #1d7a4c;
  --ok-wash: #e6f3ec;
  --danger: #b3261e;
  --danger-wash: #fdf1f0;
  --radius: 6px;
  --font: Seravek, 'Gill Sans Nova', Ubuntu, Calibri, 'DejaVu Sans', source-sans-pro, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font); line-height: 1.45; }
h1, h2, h3, p, dl, dd, ul, ol { margin: 0; }
h1 { font-size: 1.7rem; line-height: 1.15; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 1.05rem; font-weight: 700; margin-bottom: 0.6rem; }
a { color: var(--accent); text-underline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.hint, .sub { color: var(--muted); font-size: 0.875rem; }
.sub { display: block; font-size: 0.82rem; }
.lead { font-weight: 700; margin: 1.25rem 0 0.25rem; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: 14rem minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--side); color: #fff; padding: 1.25rem 1rem; }
.brand { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 1.75rem; }
.brand-mark { position: relative; width: 1.8rem; height: 1.5rem; flex: none; }
.brand-mark i { position: absolute; width: 0.85rem; height: 1.05rem; border-radius: 2px; }
.brand-mark i:nth-child(1) { left: 0; top: 0; background: var(--accent-soft); }
.brand-mark i:nth-child(2) { left: 0.3rem; top: 0.25rem; background: #4f9aa3; }
.brand-mark i:nth-child(3) { right: 0; top: 0.1rem; width: 0.7rem; height: 1.4rem; background: var(--amber); }
.brand-name { font-weight: 700; line-height: 1.2; }
.brand-badge { font-size: 0.8rem; color: var(--accent-soft); }
.nav { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.nav a {
  display: flex; align-items: center; gap: 0.55rem; color: #dbe8ea; text-decoration: none;
  padding: 0.5rem 0.65rem; border-radius: var(--radius); border-left: 3px solid transparent;
}
.nav a:hover { background: rgba(255, 255, 255, 0.08); }
.nav a[aria-current='page'] { background: rgba(255, 255, 255, 0.12); color: #fff; border-left-color: var(--amber); font-weight: 700; }
.nav a:last-child { margin-top: 0.75rem; }
.nav-num { display: inline-grid; place-items: center; width: 1.3rem; height: 1.3rem; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.35); font-size: 0.75rem; font-weight: 700; flex: none; }
.nav-count { margin-left: auto; min-width: 1.4rem; text-align: center; font-size: 0.75rem; font-weight: 700; padding: 0.05rem 0.35rem; border-radius: 999px; background: var(--amber); color: var(--side); }
.main { padding: 2rem 2.25rem 4rem; max-width: 72rem; width: 100%; }
.main > section { margin-top: 2rem; }
.main > .panel { margin-top: 1.25rem; }
.page-head, .section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.section-head { margin-bottom: 0.6rem; }
.section-head h2 { margin: 0; }
.page-meta { margin-top: 0.4rem; color: var(--muted); max-width: 48rem; }
.narrow { max-width: 34rem; }

/* ---------- Demo strip and tour ---------- */
.strip {
  display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem 1.5rem; flex-wrap: wrap;
  margin: -0.75rem 0 1.5rem; padding-bottom: 0.7rem; border-bottom: 1px solid var(--line); font-size: 0.875rem; color: var(--muted);
}
.strip-links { display: inline-flex; gap: 1.1rem; white-space: nowrap; }
.strip-contact { font-weight: 700; }
.coach {
  display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin: 1.1rem 0; padding: 0.7rem 0.9rem;
  background: var(--amber-wash); border-left: 4px solid var(--amber); border-radius: var(--radius); font-weight: 600;
}
.coach-done { background: var(--ok-wash); border-left-color: var(--ok); }
.coach span { flex: 1 1 16rem; }
.tour { margin-top: 1.25rem; padding: 1.1rem 1.25rem; background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--amber); border-radius: var(--radius); }
.tour h2 { margin-bottom: 0.15rem; }
.tour-steps { list-style: none; margin: 0.6rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.75rem; }
.tour-step { display: grid; grid-template-columns: auto 1fr; gap: 0.3rem 0.7rem; align-items: start; padding: 0.8rem 0.9rem; background: var(--paper); border-radius: var(--radius); }
.tour-step > div { display: flex; flex-direction: column; }
.tour-step .btn { grid-column: 2; justify-self: start; margin-top: 0.3rem; }
.tour-num { display: grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: 50%; background: var(--ink); color: #fff; font-weight: 700; font-size: 0.9rem; }
.tour-step.is-done .tour-num { background: var(--ok); }
.tour-cta { margin-top: 0.9rem; }

/* ---------- Surfaces ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem; }
.panel-title { margin: 0 0 0.2rem; font-size: 1.05rem; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.empty { color: var(--muted); padding: 0.9rem 0; }
.notice { background: var(--ok-wash); color: #12512f; border-left: 4px solid var(--ok); padding: 0.55rem 0.8rem; border-radius: var(--radius); margin: 1rem 0; }
.notice-error { background: var(--danger-wash); color: var(--danger); border-left-color: var(--danger); }
.notice-warn { background: var(--amber-wash); color: var(--amber-ink); border-left-color: var(--amber); }
.big { font-size: 1.25rem; font-weight: 700; line-height: 1.3; }

/* ---------- Buttons and forms ---------- */
.btn {
  font: inherit; font-weight: 600; cursor: pointer; color: var(--ink); background: var(--surface);
  border: 1px solid #b9c2cd; border-radius: var(--radius); padding: 0.42rem 0.85rem; min-height: 2.4rem;
}
.btn:hover { border-color: var(--ink); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-quiet { background: transparent; border-color: transparent; color: var(--accent); }
.btn-quiet:hover { border-color: var(--line); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn:disabled:hover { border-color: #b9c2cd; }
.btn-primary:disabled:hover { background: var(--accent); border-color: var(--accent); }
a.btn { display: inline-flex; align-items: center; text-decoration: none; }
label { display: block; font-weight: 600; font-size: 0.9rem; margin-top: 0.85rem; }
input, select {
  display: block; width: 100%; margin-top: 0.3rem; font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid #b9c2cd; border-radius: var(--radius); padding: 0.45rem 0.6rem; min-height: 2.4rem;
}
input[type='checkbox'] { display: inline-block; width: 1.1rem; height: 1.1rem; min-height: 0; margin: 0 0.4rem 0 0; vertical-align: -0.15rem; accent-color: var(--accent); }
label.check { font-weight: 500; }
.form-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; margin-top: 1.1rem; }
.form-error { color: var(--danger); font-weight: 600; }
.actions { text-align: right; white-space: nowrap; }

/* ---------- Cases ---------- */
.cases { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.75rem; }
.case {
  font: inherit; color: inherit; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 0.35rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.9rem 1rem;
}
.case:hover { border-color: var(--accent-soft); }
.case.is-on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-wash); }
.case strong { line-height: 1.25; }
.case-icon { width: 2rem; height: 2rem; border-radius: var(--radius); background: var(--paper) center / 1.3rem no-repeat; border: 1px solid var(--line); }
.case.is-on .case-icon { background-color: var(--surface); }
.case-sales { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230c5b66' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 7h16l-1.5 12h-13z'/%3E%3Cpath d='M9 7V5a3 3 0 0 1 6 0v2'/%3E%3C/svg%3E"); }
.case-hours { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230c5b66' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='8'/%3E%3Cpath d='M12 8v4l3 2'/%3E%3C/svg%3E"); }
.case-orders { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230c5b66' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M4 8l8-4 8 4v8l-8 4-8-4z'/%3E%3Cpath d='M4 8l8 4 8-4M12 12v8'/%3E%3C/svg%3E"); }
.case-expenses { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230c5b66' stroke-width='2' stroke-linecap='round'%3E%3Crect x='3' y='6' width='18' height='12' rx='2'/%3E%3Cpath d='M3 10h18M7 15h4'/%3E%3C/svg%3E"); }

/* ---------- Files ---------- */
.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.3rem; margin: 0; padding: 1.75rem 1rem;
  border: 2px dashed #b9c2cd; border-radius: var(--radius); background: var(--paper); text-align: center; cursor: pointer; font-weight: 400;
}
.drop:hover, .drop.is-over { border-color: var(--accent); background: var(--accent-wash); }
.drop:focus-within { outline: 3px solid var(--amber); outline-offset: 2px; }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; margin: 0; padding: 0; min-height: 0; border: 0; }
.drop-title { font-weight: 700; font-size: 1.05rem; }
.samples { margin-top: 1rem; }
.samples summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.samples ul { margin: 0.6rem 0 0.4rem; padding-left: 1.2rem; }
.samples li { margin: 0.2rem 0; }
.samples li .sub { display: inline; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.table th, .table td { padding: 0.55rem 0.75rem; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); }
.table thead th { font-size: 0.8rem; font-weight: 600; color: var(--muted); white-space: nowrap; background: #fafbfc; }
.table th.num, .table td.num { text-align: right; white-space: nowrap; }
.table tbody tr:last-child td, .table tbody tr:last-child th { border-bottom: 0; }
.table td.bad, .bad { color: var(--danger); font-weight: 600; }
.sheet td { white-space: nowrap; }
.sheet td.sub { display: table-cell; }

.badge { display: inline-block; font-size: 0.78rem; font-weight: 600; padding: 0.1rem 0.5rem; border-radius: 999px; white-space: nowrap; background: #eceff2; color: var(--muted); }
.badge-ok { background: var(--ok-wash); color: #12512f; }
.badge-todo { background: var(--amber-soft); color: var(--amber-ink); }
.tab-count { display: inline-block; min-width: 1.5rem; text-align: center; font-size: 0.8rem; padding: 0.05rem 0.4rem; border-radius: 999px; background: var(--amber-soft); color: var(--amber-ink); vertical-align: middle; }

/* ---------- Columns ---------- */
.source { margin-top: 1.25rem; }
.source > label { max-width: 22rem; }
.map { margin-top: 0.9rem; }
.map tbody th { font-weight: 700; width: 24%; vertical-align: top; padding-top: 0.75rem; }
.map td { vertical-align: top; }
.map td:nth-child(2) { width: 40%; }
.map select { margin-top: 0; }
.req { display: block; font-size: 0.75rem; font-weight: 600; color: var(--muted); }
.need { display: block; font-size: 0.8rem; color: var(--amber-ink); }
.row-need th, .row-need td { background: var(--amber-wash); }
.row-need select { border-color: var(--amber); }
.preview { font-size: 0.88rem; }
.preview div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 18rem; min-height: 1.3rem; }
.inline { margin-top: 0.35rem; }
.diff { display: flex; gap: 0.5rem; }
.diff .mini { flex: 1; margin-top: 0.35rem; font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.options { display: flex; flex-wrap: wrap; gap: 0 1.25rem; align-items: flex-start; margin-top: 0.4rem; }
.options > label { flex: 0 1 15rem; }
.options .sub { font-weight: 400; margin-top: 0.25rem; }
.options .check { flex: 1 1 100%; }

/* ---------- Review ---------- */
.period { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: flex-end; }
.period > div { flex: 1 1 14rem; }
.period label { margin: 0; flex: 0 1 11rem; }
.warn-group { margin-top: 1.75rem; }
.bulk-actions { display: flex; gap: 0.25rem; }
.warns { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.warn {
  display: flex; gap: 0.75rem 1.25rem; align-items: center; justify-content: space-between; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--amber); border-radius: var(--radius); padding: 0.7rem 0.9rem;
}
.warn-return, .warn-period { border-left-color: #8aa1b4; }
.warn-invalid, .warn-missing, .warn-partial { border-left-color: var(--danger); }
.warn-text { display: flex; flex-direction: column; gap: 0.1rem; flex: 1 1 22rem; min-width: 0; }
.row-peek { font-size: 0.85rem; color: var(--ink); background: var(--paper); border-radius: 4px; padding: 0.15rem 0.45rem; margin-top: 0.25rem; overflow-wrap: anywhere; }
.warn-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; }
.fix { display: inline-flex; gap: 0.35rem; align-items: center; }
.fix .inline { margin: 0; width: 10rem; }
.resolved { margin-top: 1.75rem; }
.resolved summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.resolved ul { list-style: none; padding: 0; margin-top: 0.5rem; }
.resolved li { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; padding: 0.3rem 0; border-bottom: 1px solid var(--line); font-size: 0.9rem; }

/* ---------- Result ---------- */
.totals { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-top: 1.25rem; }
.totals > div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.75rem 1rem; }
.totals dt { font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.totals dd { font-size: 1.45rem; font-weight: 700; line-height: 1.25; }
.saving { border-left: 4px solid var(--accent); }
.saving .hint { margin-top: 0.35rem; }
.main > .group { margin-top: 1.75rem; }
.group .table { max-width: 44rem; }
.search { display: flex; align-items: center; gap: 0.5rem; margin: 0; font-weight: 600; }
.search input { margin: 0; width: 14rem; }
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 0.5rem; margin-top: 0.7rem; }
.pager .muted { margin-right: 0.4rem; }
.again { background: var(--accent-wash); border-color: var(--accent-soft); }

/* ---------- Settings ---------- */
.add-column { display: flex; flex-wrap: wrap; gap: 0 0.75rem; align-items: flex-end; margin-top: 0.5rem; }
.add-column label { flex: 1 1 12rem; }
.rules input { margin: 0; }
.saved { list-style: none; padding: 0; }
.saved li { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; padding: 0.35rem 0; border-bottom: 1px solid var(--line); }
.saved .sub { display: inline; }

/* ---------- Medium screens ---------- */
@media (max-width: 72rem) {
  .shell { grid-template-columns: 11.5rem minmax(0, 1fr); }
  .main { padding: 1.5rem 1.25rem 3rem; }
  .cases { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Narrow screens ---------- */
@media (max-width: 58rem) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { display: flex; align-items: center; gap: 1rem; padding: 0.6rem 0.9rem; position: sticky; top: 0; z-index: 2; }
  .brand { margin: 0; }
  .brand-name, .brand-badge { display: none; }
  .nav { flex-direction: row; overflow-x: auto; margin-left: auto; }
  .nav a { white-space: nowrap; border-left: 0; border-bottom: 3px solid transparent; padding: 0.4rem 0.5rem; }
  .nav a:last-child { margin-top: 0; }
  .nav a[aria-current='page'] { border-bottom-color: var(--amber); }
  .main { padding: 1.25rem 0.9rem 3rem; }
  h1 { font-size: 1.4rem; }
  .tour-steps, .cases { grid-template-columns: 1fr; }
  .case { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .case .sub { flex: 1 1 100%; }
  .totals { grid-template-columns: 1fr; gap: 0.5rem; }
  .totals > div { display: flex; justify-content: space-between; align-items: baseline; }
  .totals dd { font-size: 1.2rem; }
  .strip { margin-top: -0.25rem; }
  /* The column map becomes one card per column. */
  .map, .map tbody, .map tr, .map th, .map td { display: block; width: auto !important; }
  .map thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .map { border: 0; background: transparent; }
  .map tr { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.6rem 0.75rem; margin-bottom: 0.5rem; }
  .map th, .map td { border: 0; padding: 0.15rem 0; }
  .map .preview { display: flex; gap: 0.75rem; flex-wrap: wrap; color: var(--muted); }
  .preview div { max-width: 100%; }
  .fix .inline { width: 8rem; }
  .search input { width: 100%; }
  .search { flex: 1 1 100%; }
}

@media print {
  .side, .strip, .tour, .coach, .form-actions, .notice { display: none !important; }
  .shell { display: block; }
}
