:root {
  --harbor: #12344D;   /* deep navy, the rail */
  --tide: #1C7C7D;     /* actions and links */
  --buoy: #E7B42C;     /* money owed */
  --hull: #F6F8F9;     /* page */
  --ink: #1B2A36;
  --rope: #D9E1E6;     /* borders */
  --muted: #5D6E7A;
  --red: #B23A3A;
  --green: #2D7A4B;
  font-family: "Figtree", "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--hull);
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 15px; line-height: 1.5; }
a { color: var(--tide); text-underline-offset: 2px; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid var(--buoy); outline-offset: 2px;
}
h1 { font-size: 1.75rem; font-weight: 700; margin: 0; letter-spacing: -0.01em; display: flex; gap: .6rem; align-items: center; }
h2 { font-size: 1.05rem; font-weight: 700; margin: 2rem 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.id { color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Layout */
.shell { display: grid; grid-template-columns: 210px 1fr; min-height: 100vh; }
.rail { background: var(--harbor); color: #fff; padding: 1.25rem .75rem; display: flex; flex-direction: column; gap: .15rem; position: sticky; top: 0; height: 100vh; }
.rail a { color: #C9D7E0; text-decoration: none; padding: .5rem .75rem; border-radius: 6px; font-weight: 500; }
.rail a:hover { color: #fff; background: rgba(255,255,255,.07); }
.rail a.on { color: #fff; background: rgba(255,255,255,.12); box-shadow: inset 3px 0 0 var(--buoy); }
.rail .brand { color: #fff; font-weight: 700; font-size: 1.1rem; margin-bottom: 1rem; }
.rail .logout { margin-top: auto; }
.rail .logout button { background: none; border: 0; color: #9FB3C1; font: inherit; cursor: pointer; padding: .5rem .75rem; }
.main { padding: 1.75rem 2.25rem 4rem; min-width: 0; max-width: 1400px; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.split { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 2.5rem; }
.split > section > h2:first-child { margin-top: 0; }

/* The ledger strip: the one bold moment */
.ledger { display: grid; grid-template-columns: 2fr 1fr 1fr; background: #fff; border: 1px solid var(--rope); border-radius: 10px; overflow: hidden; margin-bottom: 2rem; }
.ledger > div { padding: 1.1rem 1.25rem; border-left: 1px solid var(--rope); display: flex; flex-direction: column; justify-content: flex-end; }
.ledger > div:first-child { border-left: 0; }
.ledger span { color: var(--muted); font-size: .85rem; }
.ledger strong { font-size: 1.4rem; font-variant-numeric: tabular-nums; }
.ledger .owed { background: var(--harbor); color: #fff; border-left: 0; }
.ledger .owed span, .ledger .owed small { color: #C9D7E0; }
.ledger .owed strong { font-size: 2.3rem; color: var(--buoy); line-height: 1.1; margin: .2rem 0 .3rem; }

/* Tables */
.scroll { overflow-x: auto; background: #fff; border: 1px solid var(--rope); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: .8rem; padding: .6rem .75rem; border-bottom: 1px solid var(--rope); white-space: nowrap; background: #FBFCFD; }
td { padding: .55rem .75rem; border-bottom: 1px solid #EDF1F3; vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #F8FAFB; }
.r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
section > table { background: #fff; border: 1px solid var(--rope); border-radius: 8px; }

/* Status pills */
.pill { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; background: #EBEFF2; color: var(--muted); white-space: nowrap; }
.pill.good { background: #E3F1E8; color: var(--green); }
.pill.bad { background: #F6E3E3; color: var(--red); }
.pill.wait { background: #FBF1D6; color: #7A5A07; }
.warn { color: #7A5A07; font-size: .8rem; }

/* Forms */
label { display: flex; flex-direction: column; gap: .25rem; font-size: .85rem; font-weight: 600; color: var(--muted); }
label small { font-weight: 400; }
input, select, textarea { font: inherit; font-weight: 400; color: var(--ink); padding: .45rem .6rem; border: 1px solid #C5D0D7; border-radius: 6px; background: #fff; min-width: 0; }
textarea { resize: vertical; }
.filters { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; margin-bottom: 1.25rem; }
.filters.compact { margin-bottom: 1rem; }
.stack { display: flex; flex-direction: column; gap: .9rem; max-width: 520px; }
.stack .btn { align-self: flex-start; }
form.inline { display: flex; gap: .4rem; align-items: center; }
form.inline input { width: 7rem; }
.btn { font: inherit; font-weight: 600; background: var(--tide); color: #fff; border: 1px solid var(--tide); border-radius: 6px; padding: .5rem 1rem; cursor: pointer; text-decoration: none; display: inline-block; }
.btn:hover { background: #166868; }
.btn.ghost { background: #fff; color: var(--tide); }
.btn.ghost:hover { background: #EEF6F6; }
.btn.danger { background: #fff; color: var(--red); border-color: #E2B8B8; }
.btn.small { padding: .3rem .65rem; font-size: .85rem; }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin: 1.5rem 0; }

/* Facts */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .55rem 1.25rem; margin: 0; background: #fff; border: 1px solid var(--rope); border-radius: 8px; padding: 1.1rem 1.25rem; }
.facts dt { color: var(--muted); font-size: .85rem; }
.facts dd { margin: 0; }
.facts.money dd { font-variant-numeric: tabular-nums; }
.big { font-size: 1.5rem; color: var(--harbor); }
.totals { display: flex; gap: 1.5rem; flex-wrap: wrap; margin: .9rem 0; font-variant-numeric: tabular-nums; }

/* Owed list */
.owed-list { list-style: none; padding: 0; margin: 0 0 1rem; background: #fff; border: 1px solid var(--rope); border-radius: 8px; }
.owed-list li { display: grid; grid-template-columns: 1fr auto; padding: .6rem .9rem; border-bottom: 1px solid #EDF1F3; }
.owed-list li:last-child { border-bottom: 0; }
.owed-list span { font-variant-numeric: tabular-nums; font-weight: 600; }
.owed-list small { color: var(--muted); grid-column: 1 / -1; }

/* Messages */
.flash { padding: .7rem 1rem; border-radius: 6px; margin-bottom: 1.25rem; font-weight: 500; }
.flash.ok { background: #E3F1E8; color: var(--green); }
.flash.error { background: #F6E3E3; color: var(--red); }
.empty { color: var(--muted); background: #fff; border: 1px dashed var(--rope); border-radius: 8px; padding: 1.25rem; }
.raw { margin-top: 2rem; }
.raw summary { cursor: pointer; font-weight: 600; }
pre, .raw-box { background: #0F2A3E; color: #D6E4EC; padding: 1rem; border-radius: 8px; overflow: auto; max-height: 420px; font-size: .8rem; white-space: pre-wrap; word-break: break-all; }

/* Login */
.login-page { display: grid; place-items: center; min-height: 100vh; background: var(--harbor); }
.login { background: #fff; padding: 2rem; border-radius: 10px; width: min(360px, 92vw); display: flex; flex-direction: column; gap: 1rem; }
.login h1 { color: var(--harbor); }
.login p { margin: -.6rem 0 0; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; flex-direction: row; flex-wrap: wrap; padding: .6rem; }
  .rail .brand { width: 100%; margin-bottom: .25rem; }
  .rail .logout { margin-top: 0; }
  .main { padding: 1.25rem 1rem 3rem; }
  .split { grid-template-columns: 1fr; gap: 1rem; }
  .ledger { grid-template-columns: 1fr 1fr; }
  .ledger .owed { grid-column: 1 / -1; }
  .ledger > div:nth-child(2) { border-left: 0; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- v2: reports, overview periods, charts ---------- */
.head-actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.rail-gap { height: .9rem; }
.overdue-text { color: #FFD7D7; }
.sync-note { margin-top: 1.25rem; }

.periods { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.period { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--rope); border-top: 4px solid var(--tide); border-radius: 8px; padding: 1rem 1.1rem; color: var(--ink); text-decoration: none; }
.period:hover { border-color: var(--tide); }
.period-name { font-weight: 700; }
.period strong { font-size: 1.6rem; font-variant-numeric: tabular-nums; line-height: 1.2; margin-top: .4rem; }
.period-sub { color: var(--muted); font-size: .8rem; }
.period dl { display: grid; grid-template-columns: 1fr auto; gap: .2rem .75rem; margin: .8rem 0 0; padding-top: .7rem; border-top: 1px solid #EDF1F3; font-size: .85rem; }
.period dt { color: var(--muted); }
.period dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.delta { font-size: .8rem; font-weight: 600; color: var(--muted); }
.delta.up { color: var(--green); }
.delta.down { color: var(--red); }

.chart-card { background: #fff; border: 1px solid var(--rope); border-radius: 8px; padding: 1rem 1.25rem 1.25rem; margin-bottom: 2rem; }
.chart-card h2 { margin-top: 0; }
.chart-box { position: relative; height: 300px; }
.chart-box.short { height: 220px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin: 2rem 0 .75rem; }
.section-head h2 { margin: 0; }
.chart-card .section-head { margin-top: 0; }
.table-toggle { margin-top: 1rem; }
.table-toggle summary { cursor: pointer; font-weight: 600; color: var(--tide); margin-bottom: .75rem; }
tr.quiet td { color: #A3B0B8; }

.presets { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.presets a { padding: .35rem .8rem; border: 1px solid var(--rope); border-radius: 999px; background: #fff; color: var(--ink); text-decoration: none; font-size: .88rem; font-weight: 500; }
.presets a:hover { border-color: var(--tide); }
.presets a.on { background: var(--harbor); border-color: var(--harbor); color: #fff; }

.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .75rem; margin-bottom: 2rem; }
.kpi { background: #fff; border: 1px solid var(--rope); border-radius: 8px; padding: .9rem 1rem; display: flex; flex-direction: column; gap: .15rem; }
.kpi span { color: var(--muted); font-size: .82rem; }
.kpi strong { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.kpi small { color: var(--muted); font-size: .8rem; }
.kpi.lead { background: var(--harbor); border-color: var(--harbor); color: #fff; grid-column: span 2; }
.kpi.lead span, .kpi.lead small { color: #C9D7E0; }
.kpi.lead strong { color: var(--buoy); font-size: 2rem; }
.kpi.lead .delta.up { color: #8FD9A8; }
.kpi.lead .delta.down { color: #F2A7A7; }
.kpi.warn-kpi { border-color: #E8C76A; background: #FFFAEB; }

.share { display: inline-block; min-width: 4.5rem; padding-left: .4rem; background: linear-gradient(90deg, #D7ECEC var(--w), transparent var(--w)); border-radius: 3px; }

.totals span { white-space: nowrap; }
.day-block h2 { display: flex; gap: .75rem; align-items: baseline; }
.plain { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .4rem; }
.facts.narrow { max-width: 560px; margin-bottom: 1rem; }
.facts .pre { white-space: pre-line; }
label.check { flex-direction: row; align-items: center; gap: .5rem; color: var(--ink); }
.bulk { background: #fff; border: 1px solid var(--rope); border-radius: 8px; padding: 1rem 1.25rem; margin-bottom: 1.5rem; }
.bulk h2 { margin-top: 0; }
.bulk .filters { margin-bottom: .75rem; }
.link-btn { background: none; border: 0; color: var(--red); font: inherit; font-size: .8rem; cursor: pointer; padding: 0 0 0 .5rem; text-decoration: underline; }
.inline-mini { display: inline; }

.checklist { list-style: none; padding: 0; margin: 0; background: #fff; border: 1px solid var(--rope); border-radius: 8px; }
.checklist li { padding: .7rem 1rem; border-bottom: 1px solid #EDF1F3; display: flex; flex-wrap: wrap; gap: .25rem .6rem; align-items: baseline; }
.checklist li:last-child { border-bottom: 0; }
.checklist strong { font-size: .75rem; padding: .1rem .5rem; border-radius: 999px; }
.checklist .done strong { background: #E3F1E8; color: var(--green); }
.checklist .todo strong { background: #FBF1D6; color: #7A5A07; }
.checklist small { width: 100%; color: var(--muted); }

@media (max-width: 1100px) { .periods { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .rail-gap { display: none; }
  .ledger .owed { grid-column: 1 / -1; }
  .kpi.lead { grid-column: 1 / -1; }
}
@media (max-width: 560px) { .periods { grid-template-columns: 1fr; } .chart-box { height: 240px; } }

/* ---------- v3: users ---------- */
.me { margin-top: auto; border-top: 1px solid rgba(255,255,255,.12); padding-top: .75rem; display: flex; flex-direction: column; gap: .1rem; }
.me a { display: flex; flex-direction: column; color: #fff; }
.me a small { color: #9FB3C1; font-weight: 400; font-size: .78rem; }
.rail .me .logout { margin-top: 0; }
fieldset.bare { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .9rem; min-width: 0; }
fieldset.bare[disabled] input, fieldset.bare[disabled] textarea, fieldset.bare[disabled] select { background: #F1F4F6; color: var(--muted); }
fieldset.bare[disabled] .btn { display: none; }
.nowrap { white-space: nowrap; }

.password-note { background: #FFFAEB; border: 1px solid #E8C76A; border-radius: 8px; padding: 1rem 1.25rem; margin-bottom: 1.5rem; display: flex; flex-direction: column; gap: .4rem; }
.password-note code { font-size: 1.25rem; font-weight: 700; letter-spacing: .04em; color: var(--harbor); background: #fff; border: 1px dashed #E8C76A; border-radius: 6px; padding: .4rem .75rem; align-self: flex-start; user-select: all; }
.password-note span { color: #6B5410; font-size: .88rem; }

.user-list { display: flex; flex-direction: column; gap: .5rem; }
.user-card { background: #fff; border: 1px solid var(--rope); border-radius: 8px; }
.user-card.off { opacity: .7; }
.user-card summary { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; padding: .75rem 1rem; cursor: pointer; list-style: none; }
.user-card summary::-webkit-details-marker { display: none; }
.user-card .who { flex: 1 1 200px; }
.user-card .last { flex-basis: 100%; }
.user-card[open] summary { border-bottom: 1px solid #EDF1F3; }
.user-edit { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; padding: 1rem; }
.user-actions { display: flex; flex-wrap: wrap; gap: .75rem; justify-content: space-between; align-items: center; padding: 0 1rem 1rem; }
.user-actions form { display: flex; gap: .6rem; align-items: center; }

.roles-table { font-size: .85rem; }
.roles-table td.yes { color: var(--green); font-weight: 600; text-align: center; }
.roles-table td.no { color: #A3B0B8; text-align: center; }
.roles-table th:not(:first-child) { text-align: center; }

/* ---------- v5: Bókun accounts ---------- */
.actions-cell { white-space: nowrap; }
.actions-cell form { display: inline-block; margin: 0 .2rem .2rem 0; }
td form.inline input { width: 12rem; }
code { font-size: .82rem; background: #EEF2F4; padding: .1rem .35rem; border-radius: 4px; }

/* ---------- v6: sync page ---------- */
.page-head .sub { margin: .35rem 0 0; max-width: 60ch; }
.sync-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 1.6fr); background: #fff; border: 1px solid var(--rope); border-radius: 10px; margin-bottom: 2rem; overflow: hidden; }
.sync-stats > * { padding: 1rem 1.25rem; border-left: 1px solid var(--rope); display: flex; flex-direction: column; text-decoration: none; color: var(--ink); }
.sync-stats > *:first-child { border-left: 0; }
.sync-stats a:hover { background: #F8FAFB; }
.sync-stats strong { font-size: 1.6rem; font-variant-numeric: tabular-nums; line-height: 1.2; }
.sync-stats span { color: var(--muted); font-size: .85rem; }
.sync-stats .last-run { background: var(--harbor); color: #fff; }
.sync-stats .last-run span, .sync-stats .last-run small { color: #C9D7E0; }
.sync-stats .last-run strong { font-size: 1.15rem; color: #fff; margin: .1rem 0; }

.account-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; align-items: start; }
.account { background: #fff; border: 1px solid var(--rope); border-radius: 10px; padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: .45rem; }
.account.off { opacity: .65; }
.account header { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.account h3 { margin: 0; font-size: 1.05rem; }
.account p { margin: 0; }
.account .nums { display: flex; gap: 1.25rem; }
.account .nums a { color: var(--ink); text-decoration: none; }
.account .nums a:hover { color: var(--tide); }
.account .nums strong { font-size: 1.25rem; font-variant-numeric: tabular-nums; margin-right: .2rem; }
.account-error { background: #F6E3E3; color: var(--red); font-size: .82rem; padding: .5rem .65rem; border-radius: 6px; word-break: break-word; }
.account footer { display: flex; flex-wrap: wrap; gap: .25rem 1rem; align-items: center; border-top: 1px solid #EDF1F3; padding-top: .6rem; margin-top: .25rem; }
.account footer form { display: inline; margin: 0; }
button.link, summary.link { background: none; border: 0; padding: 0; font: inherit; font-size: .88rem; font-weight: 600; color: var(--tide); cursor: pointer; list-style: none; }
summary.link::-webkit-details-marker { display: none; }
button.link:hover, summary.link:hover { text-decoration: underline; }
.danger-link { color: var(--red) !important; }
.rename[open] { flex-basis: 100%; }
.rename form { margin-top: .5rem; }
.rename input { flex: 1; min-width: 0; }

.add-account { border-style: dashed; background: transparent; }
.add-account[open] { background: #fff; border-style: solid; }
.add-account summary { cursor: pointer; font-weight: 700; color: var(--tide); list-style: none; display: flex; align-items: center; gap: .5rem; padding: .35rem 0; }
.add-account summary::-webkit-details-marker { display: none; }
.add-account .plus { display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: #E3F1F1; font-size: 1.1rem; }
.add-account .stack { max-width: none; margin: .5rem 0; }

.range-import { margin-bottom: 1rem; }
.range-import summary { cursor: pointer; font-weight: 600; color: var(--tide); margin-bottom: .75rem; }
.raw-box.webhook { white-space: pre-wrap; word-break: break-all; font-size: .82rem; }

@media (max-width: 900px) {
  .sync-stats { grid-template-columns: repeat(3, 1fr); }
  .sync-stats .last-run { grid-column: 1 / -1; border-left: 0; }
}

/* ---------- v7: lists instead of wide tables, no sideways scrolling ---------- */
.scroll { overflow-x: visible; }
th { white-space: normal; }
table { table-layout: auto; }
td { overflow-wrap: anywhere; }
.r { white-space: normal; }

.back { display: inline-block; margin-bottom: .5rem; font-size: .9rem; text-decoration: none; }
.back::before { content: "\2190  "; }

.mini-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; margin-bottom: 1.25rem; }
.mini-stats div { background: #fff; border: 1px solid var(--rope); border-radius: 10px; padding: .8rem 1rem; display: flex; flex-direction: column; }
.mini-stats strong { font-size: 1.45rem; font-variant-numeric: tabular-nums; line-height: 1.2; }
.mini-stats span { color: var(--muted); font-size: .85rem; }

.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.toolbar > input[name="s"] { flex: 1 1 260px; }
.toolbar .narrow-input { width: 8rem; }
.more-filters { flex-basis: 100%; }
.more-filters summary { cursor: pointer; color: var(--tide); font-weight: 600; font-size: .9rem; display: inline-block; }
.more-filters .toolbar { margin: .6rem 0 0; }

.list { background: #fff; border: 1px solid var(--rope); border-radius: 10px; overflow: hidden; margin-bottom: 1rem; }
.list-head, .list-row { display: grid; gap: 1rem; align-items: center; padding: .7rem 1.1rem; }
.list-head { background: #FBFCFD; border-bottom: 1px solid var(--rope); font-size: .78rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.list-row { border-bottom: 1px solid #EDF1F3; color: var(--ink); text-decoration: none; }
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: #F6FAFA; }
.list-row:focus-visible { outline: 3px solid var(--buoy); outline-offset: -3px; }
.list-row > span { display: flex; flex-direction: column; min-width: 0; }
.list-row > span.r { align-items: flex-end; }
.list-row small { color: var(--muted); font-size: .8rem; margin-top: .1rem; }
.list-row .cell-main strong { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.list-row strong.regular { font-weight: 500; }
.list-row .num { font-variant-numeric: tabular-nums; }
.list-row .num strong { font-size: 1.05rem; }
.sep::before { content: ""; display: inline-block; width: 3px; height: 3px; border-radius: 50%; background: currentColor; margin: 0 .45rem; vertical-align: middle; opacity: .6; }

.pct strong { font-size: 1.25rem; font-variant-numeric: tabular-nums; color: var(--harbor); }
.pct small { font-weight: 600; }
.from-bokun { color: var(--green) !important; }
.from-you { color: var(--tide) !important; }
.from-guess { color: #9A7A1E !important; }

.tour-row { grid-template-columns: minmax(0, 3fr) minmax(0, 1.2fr) minmax(0, .8fr) minmax(0, 1fr) minmax(0, 1fr); }
.bk-row { grid-template-columns: minmax(0, 1fr) minmax(0, 2.6fr) minmax(0, 1.5fr) minmax(0, .6fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr); }
.bk-row.no-money { grid-template-columns: minmax(0, 1fr) minmax(0, 2.6fr) minmax(0, 1.5fr) minmax(0, .6fr) minmax(0, 1fr); }
.booking-row { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) minmax(0, .6fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr); }
.op-row { grid-template-columns: minmax(0, 2.6fr) minmax(0, 1.2fr) minmax(0, .6fr) minmax(0, .8fr) minmax(0, 1fr) minmax(0, 1.1fr); }
.list-row .pill { align-self: flex-start; }
form.override { margin-top: .75rem; align-items: flex-end; }
form.override input { width: 7rem; }

@media (max-width: 1000px) {
  .mini-stats { grid-template-columns: repeat(2, 1fr); }
  .list-head { display: none; }
  .tour-row, .bk-row, .bk-row.no-money, .booking-row, .op-row { grid-template-columns: 1fr 1fr; gap: .5rem 1rem; }
  .list-row > .cell-main { grid-column: 1 / -1; }
  .list-row > span.r { align-items: flex-start; }
}

/* ---------- v8: operator search ---------- */
.result-count { margin: -.25rem 0 .75rem; }
.pager { display: flex; gap: 1rem; align-items: center; justify-content: center; margin: 1rem 0 2rem; }

/* ---------- v9: notices ---------- */
.notice { background: #FFFAEB; border: 1px solid #E8C76A; color: #5C4508; border-radius: 8px; padding: .85rem 1.1rem; margin-bottom: 1.25rem; line-height: 1.5; }
.contract-row { grid-template-columns: minmax(0, 2.4fr) minmax(0, 1.1fr) minmax(0, .7fr) minmax(0, 2fr); }
.contract-row details[open] { grid-column: 1 / -1; }
.contract-row .raw-box { max-height: 320px; font-size: .75rem; }
.mini-stats .stat-link { background: #fff; border: 1px solid var(--rope); border-radius: 10px; padding: .8rem 1rem; display: flex; flex-direction: column; color: var(--ink); text-decoration: none; }
.mini-stats .stat-link:hover { border-color: var(--tide); }
.mini-stats .stat-link strong { font-size: 1.45rem; font-variant-numeric: tabular-nums; line-height: 1.2; }
.mini-stats .stat-link span { color: var(--muted); font-size: .85rem; }
.min-pct { flex-direction: row; align-items: center; gap: .4rem; font-weight: 500; color: var(--muted); white-space: nowrap; }
.min-pct input { width: 4.8rem; }
.min-pct span { color: var(--ink); }
.tour-row.with-id { grid-template-columns: 6.5rem minmax(0, 3fr) minmax(0, 1.2fr) minmax(0, .8fr) minmax(0, 1fr) minmax(0, 1fr); }
.id-cell { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width: 1000px) { .tour-row.with-id { grid-template-columns: 1fr 1fr; } }

/* ---------- v10: premium pages ---------- */
.rail-search { margin: 0 0 .75rem; }
.rail-search input { width: 100%; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18); color: #fff; padding: .5rem .7rem; border-radius: 6px; }
.rail-search input::placeholder { color: #9FB3C1; }
.up-text { color: var(--green); }
.down-text { color: var(--red); }
.site-row { grid-template-columns: minmax(0, 2fr) repeat(4, minmax(0, 1fr)); }
.site-mini { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); }
.fc-row { grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr)); }
.best-row { grid-template-columns: 6.5rem minmax(0, 3fr) minmax(0, .8fr) minmax(0, 1fr) minmax(0, 1fr); }
.opp-row { grid-template-columns: 6.5rem minmax(0, 3fr) minmax(0, 1fr) minmax(0, .8fr); }
.score-row { grid-template-columns: minmax(0, 2.4fr) minmax(0, 1fr) repeat(3, minmax(0, .8fr)) minmax(0, 1.2fr); }
.change-row { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.search-row { grid-template-columns: minmax(0, 1fr) minmax(0, 3fr) minmax(0, 1fr); }
.task-row { grid-template-columns: 2.2rem minmax(0, 3fr) minmax(0, 1fr) auto; }
.miss-row { grid-template-columns: minmax(0, 3fr) minmax(0, 1fr); }
.stripe-row { grid-template-columns: minmax(0, .9fr) minmax(0, 2.6fr) minmax(0, 1fr) minmax(0, .8fr) minmax(0, 1.4fr); }
.backup-row { grid-template-columns: minmax(0, 3fr) minmax(0, 1fr) auto; }
.portal-row { grid-template-columns: minmax(0, 1.2fr) minmax(0, 2.4fr) minmax(0, 1.6fr) minmax(0, .6fr) minmax(0, 1.2fr); }
.portal-inv { grid-template-columns: minmax(0, 3fr) minmax(0, 1fr) minmax(0, 1fr); }
.bars { background: #fff; border: 1px solid var(--rope); border-radius: 10px; padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: .55rem; }
.bar-row { display: grid; grid-template-columns: 9rem 1fr 3rem; gap: .75rem; align-items: center; font-size: .9rem; }
.bar { height: .7rem; background: #EDF1F3; border-radius: 99px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--tide); border-radius: 99px; }
.heatmap { background: #fff; border: 1px solid var(--rope); border-radius: 10px; padding: .75rem; display: grid; gap: 3px; margin-bottom: 1rem; }
.hm-row { display: grid; grid-template-columns: 6.5rem repeat(7, minmax(0, 1fr)); gap: 3px; }
.hm-head span { font-size: .75rem; color: var(--muted); text-align: center; font-weight: 600; }
.hm-label { font-size: .8rem; color: var(--muted); align-self: center; }
.hm-cell { background: rgba(28, 124, 125, calc(var(--a) * .9 + .04)); color: var(--ink); text-align: center; font-size: .75rem; padding: .3rem 0; border-radius: 4px; font-variant-numeric: tabular-nums; }
.add-task { margin-bottom: 1rem; }
.add-task summary { display: inline-block; list-style: none; }
.add-task summary::-webkit-details-marker { display: none; }
.task-form { display: flex; flex-direction: column; gap: .6rem; background: #fff; border: 1px solid var(--rope); border-radius: 10px; padding: 1rem; margin-top: .75rem; }
.task-form .toolbar { margin: 0; }
.check-btn { width: 1.6rem; height: 1.6rem; border-radius: 50%; border: 2px solid var(--tide); background: #fff; color: var(--tide); font-weight: 700; cursor: pointer; line-height: 1; }
.is-done .check-btn { background: var(--tide); color: #fff; }
.is-done strong { text-decoration: line-through; color: var(--muted); }
.note-form { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1rem; }
.note-form .btn { align-self: flex-start; }
.note { background: #fff; border: 1px solid var(--rope); border-radius: 8px; padding: .65rem .85rem; margin-bottom: .5rem; }
.note p { margin: 0 0 .25rem; white-space: pre-line; }
.link-btn.plain { color: var(--tide); }
.customer-meta { display: flex; flex-direction: column; gap: .75rem; max-width: 560px; background: #fff; border: 1px solid var(--rope); border-radius: 10px; padding: 1rem 1.1rem; margin-bottom: 1.5rem; }
.customer-meta .btn { align-self: flex-start; }
.payout-bar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; background: #fff; border: 1px solid var(--rope); border-radius: 10px; padding: .75rem 1rem; margin-bottom: 1rem; }
.export-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.export-card { background: #fff; border: 1px solid var(--rope); border-radius: 10px; padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: .4rem; }
.export-card h3 { margin: 0; font-size: 1rem; }
.export-card .btn { align-self: flex-start; margin-top: auto; }
.settings-form { display: flex; flex-direction: column; gap: 1.25rem; max-width: 680px; }
.settings-group { background: #fff; border: 1px solid var(--rope); border-radius: 10px; padding: 1rem 1.25rem 1.25rem; display: flex; flex-direction: column; gap: .85rem; }
.settings-group legend { font-weight: 700; padding: 0 .35rem; }
.settings-form > .btn { align-self: flex-start; }
.steps { line-height: 1.7; padding-left: 1.2rem; }
.big-code { font-size: 1.1rem; letter-spacing: .08em; padding: .25rem .5rem; user-select: all; }
@media (max-width: 1000px) {
  .site-row, .site-mini, .fc-row, .best-row, .opp-row, .score-row, .search-row, .stripe-row, .portal-row, .portal-inv { grid-template-columns: 1fr 1fr; }
  .hm-row { grid-template-columns: 4.5rem repeat(7, minmax(0, 1fr)); }
}
