/* Wheal Deal portal. One family (Barlow), condensed cuts for plates and figures.
   The signature is the key tag: every bike is drawn as the tag on its key ring. */

:root {
  --red: #E42C3A;
  --red-ink: #B71C2B;
  --red-tint: #FDECEE;
  --navy: #10202C;
  --navy-2: #1B3242;
  --paper: #F3F5F7;
  --card: #FFFFFF;
  --line: #E1E5EA;
  --line-strong: #C9D0D8;
  --text: #10202C;
  --muted: #5C6876;
  --lagoon: #0B8577;
  --lagoon-tint: #E2F4F1;
  --amber: #A86A00;
  --amber-tint: #FFF3D9;
  --blue: #2563A8;
  --blue-tint: #E6EFFA;
  --focus: #2B7FFF;
  --shadow: 0 1px 2px rgba(16, 32, 44, .06), 0 4px 14px rgba(16, 32, 44, .05);
  --radius: 12px;
  --font: "Barlow", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-tight: "Barlow Condensed", "Barlow", "Inter", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --red: #F2525F; --red-ink: #FF8A93; --red-tint: #3A1519;
    --paper: #0B161E; --card: #12212B; --line: #213441; --line-strong: #2E4555;
    --text: #E6ECF1; --muted: #93A2AF;
    --lagoon: #35C2B1; --lagoon-tint: #0E2E2B; --amber: #E8AD45; --amber-tint: #33270E;
    --blue: #7FB2EE; --blue-tint: #132A44;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --red: #F2525F; --red-ink: #FF8A93; --red-tint: #3A1519;
  --paper: #0B161E; --card: #12212B; --line: #213441; --line-strong: #2E4555;
  --text: #E6ECF1; --muted: #93A2AF;
  --lagoon: #35C2B1; --lagoon-tint: #0E2E2B; --amber: #E8AD45; --amber-tint: #33270E;
  --blue: #7FB2EE; --blue-tint: #132A44;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

/* Black: the dark theme on true black (data-theme="dark" is set too, so every dark rule applies). */
:root[data-black] { --paper: #000000; --card: #0B0D10; --line: #1C2127; --line-strong: #2A3139; --navy-2: #0B0D10; }
@media (min-width: 900px) { :root[data-black] .app { background: linear-gradient(to right, #06080A 236px, transparent 236px); } }
:root[data-black] .rail { background: #06080A; box-shadow: inset -1px 0 0 var(--line); }

/* Colour choices (Settings, this browser). The brand red stays on the logo. */
:root[data-accent="ocean"] { --red: #0B63B6; --red-ink: #084E90; --red-tint: #E3EEFA; }
:root[data-accent="lagoon"] { --red: #00796F; --red-ink: #005E56; --red-tint: #DDF3F0; }
:root[data-accent="violet"] { --red: #6A3FC4; --red-ink: #54309F; --red-tint: #EFE7FF; }
:root[data-theme="dark"][data-accent="ocean"] { --red: #5AA8F2; --red-ink: #8DC4FF; --red-tint: #0F2B47; }
:root[data-theme="dark"][data-accent="lagoon"] { --red: #3CC7B5; --red-ink: #5DD9C8; --red-tint: #0C2E2A; }
:root[data-theme="dark"][data-accent="violet"] { --red: #A988F2; --red-ink: #CDB5FF; --red-tint: #261A40; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"])[data-accent="ocean"] { --red: #5AA8F2; --red-ink: #8DC4FF; --red-tint: #0F2B47; }
  :root:not([data-theme="light"])[data-accent="lagoon"] { --red: #3CC7B5; --red-ink: #5DD9C8; --red-tint: #0C2E2A; }
  :root:not([data-theme="light"])[data-accent="violet"] { --red: #A988F2; --red-ink: #CDB5FF; --red-tint: #261A40; }
}

/* Font and text size choices */
:root[data-font="inter"] { --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
:root[data-font="manrope"] { --font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
:root[data-text="l"] { font-size: 112.5%; }
:root[data-text="xl"] { font-size: 125%; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--text); font: 400 1rem/1.45 var(--font); font-feature-settings: "tnum" 0; }
a { color: inherit; }
a:hover { color: var(--red-ink); }
h1, h2, h3 { margin: 0; line-height: 1.15; }
p { margin: 0; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.visually-hidden, input.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; min-height: 0 !important; padding: 0 !important; border: 0 !important; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }
.small { font-size: .875rem; }
.icon { display: inline-flex; flex: none; }
.num, .money, .figure-value, .row-amount, .owes, .ledger-amount { font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------------------------------------------------------------- shell */

.app { min-height: 100vh; display: grid; grid-template-columns: 236px 1fr; background: linear-gradient(to right, var(--navy) 236px, transparent 236px); }
.rail { position: sticky; top: 0; height: 100vh; background: var(--navy); color: #E6ECF1; display: flex; flex-direction: column; padding: 22px 14px 16px; gap: 18px; }
.rail-logo { display: block; padding: 4px 10px 6px; }
.rail-logo img { width: 168px; height: auto; display: block; }
.rail-new { margin: 0 4px; }
.rail-search { display: flex; align-items: center; gap: 10px; margin: 0 4px; padding: 9px 12px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .14);
  color: #B9C6D1; text-decoration: none; font-weight: 500; }
.rail-search:hover, .rail-search.active { background: rgba(255, 255, 255, .08); color: #fff; }
.search-wrap { display: flex; align-items: center; gap: 8px; flex: 1; max-width: 560px; padding: 0 12px; background: var(--card); border: 1px solid var(--line-strong); border-radius: 12px; }
.search-wrap input.search { border: 0; box-shadow: none; flex: 1; min-width: 0; padding-left: 0; background: transparent; }
.search-wrap:focus-within { outline: 2px solid var(--focus); outline-offset: 1px; }
.search-results .section { margin-top: 18px; }
/* Today: quick actions */
.quick { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin: 4px 0 22px; }
.quick button { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 6px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font: 600 .88rem/1.2 var(--font); cursor: pointer; box-shadow: var(--shadow); }
.quick button:hover { border-color: var(--line-strong); }
.quick button .icon { color: var(--red); }
@media (max-width: 720px) { .quick { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.pick-rentals { display: flex; flex-direction: column; gap: 6px; }
/* Money: rentals panel, period switch */
.money-lines { margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 16px 10px; }
.money-lines .line { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.money-lines .line:last-child { border-bottom: 0; }
.money-lines dt { color: var(--muted); }
.money-lines dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.money-lines .line.warn dd { color: var(--amber); }
.money-lines p { margin: -4px 0 6px; }
.month-step { display: inline-flex; align-items: center; gap: 6px; }
.rail-nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; text-decoration: none; color: #B9C6D1; font-weight: 500; }
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item.active { background: rgba(255, 255, 255, .1); color: #fff; box-shadow: inset 3px 0 0 var(--red); }
.rail-foot { margin-top: auto; padding: 0 12px; }
.sync-note { font-size: .8rem; color: #8698A7; }
.main { min-width: 0; }
.page { max-width: 1180px; margin: 0 auto; padding: 28px 32px 64px; }
.topbar, .tabbar { display: none; }

@media (max-width: 899px) {
  .app { display: block; background: none; }
  .rail { display: none; }
  .topbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20; background: var(--navy); color: #fff; padding: 10px 12px 10px 16px; }
  .topbar-logo img { display: block; height: 26px; width: auto; }
  .topbar-title { flex: 1; font-weight: 600; font-size: 1.05rem; }
  .topbar .btn-ghost { color: #fff; }
  .tabbar { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; background: var(--card); border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
  .tabbar .nav-item { flex: 1; flex-direction: column; gap: 2px; padding: 6px 2px; font-size: .72rem; color: var(--muted); border-radius: 8px; }
  .tabbar .nav-item.active { color: var(--red); background: transparent; box-shadow: none; }
  .page { padding: 18px 16px 96px; }
}

/* ---------------------------------------------------------------- page head */

.page-head { margin-bottom: 22px; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; font-size: .9rem; margin-bottom: 8px; }
.page-head-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 2rem; font-weight: 700; letter-spacing: -.01em; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.head-meta { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; }
@media (max-width: 899px) { .page-head h1 { font-size: 1.6rem; } }

/* ---------------------------------------------------------------- buttons */

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent; font-weight: 600; font-size: .95rem; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-ink); color: #fff; }
.btn-secondary { background: var(--card); border-color: var(--line-strong); }
.btn-secondary:hover { border-color: var(--text); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text); }
.btn-ghost:hover { background: rgba(127, 140, 155, .12); color: var(--text); }
.btn-danger { background: transparent; color: var(--red-ink); border-color: currentColor; }
.btn-danger:hover { background: var(--red-tint); color: var(--red-ink); }
.btn-small { min-height: 34px; padding: 0 12px; font-size: .875rem; border-radius: 8px; }
.btn-icon { padding: 0; width: 42px; }
.btn-icon.btn-small { width: 34px; }
.btn-full { width: 100%; }
.btn:disabled { opacity: .6; cursor: default; }
.btn.busy { position: relative; color: transparent !important; }
.btn.busy::after { content: ""; position: absolute; width: 18px; height: 18px; border: 2px solid rgba(127, 127, 127, .4); border-top-color: currentColor; border-radius: 50%; animation: spin .7s linear infinite; color: var(--text); }
.btn-primary.busy::after { color: #fff; border-top-color: #fff; }
.flip .icon { transform: scaleX(-1); }
@keyframes spin { to { transform: rotate(360deg); } }
.linkish { background: none; border: 0; padding: 6px 0; color: var(--muted); text-decoration: underline; cursor: pointer; }
.more { font-size: .9rem; color: var(--muted); }

/* ---------------------------------------------------------------- pills, rows, sections */

.pill { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 99px; font-size: .8rem; font-weight: 600; background: var(--line); color: var(--text); white-space: nowrap; }
.pill-red { background: var(--red-tint); color: var(--red-ink); }
.pill-amber { background: var(--amber-tint); color: var(--amber); }
.pill-green { background: var(--lagoon-tint); color: var(--lagoon); }
.pill-blue { background: var(--blue-tint); color: var(--blue); }
.pill-muted { background: transparent; color: var(--muted); border: 1px solid var(--line-strong); }
.owes { color: var(--red-ink); font-weight: 600; font-size: .9rem; white-space: nowrap; }

.section { margin-top: 30px; }
.section:first-child { margin-top: 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.section h2 { font-size: 1.15rem; font-weight: 700; }
.section h3 { font-size: 1rem; margin-bottom: 8px; }

.rows { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.row { display: flex; align-items: center; gap: 14px; padding: 13px 16px; text-decoration: none; border: 0; border-bottom: 1px solid var(--line); background: none; width: 100%; text-align: left; cursor: pointer; }
.row:last-child { border-bottom: 0; }
.row:hover { background: rgba(127, 140, 155, .07); color: inherit; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { color: var(--muted); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-end { display: flex; align-items: center; gap: 10px; flex: none; }
.row-amount { color: var(--muted); font-size: .9rem; }
.mini-tag { flex: none; width: 64px; text-align: center; font: 700 1.05rem/1 var(--font-tight); letter-spacing: .02em; padding: 8px 0; border-radius: 16px 8px 8px 16px; background: var(--paper); border: 1px solid var(--line-strong); }
.avatar { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--navy); color: #fff; font: 700 .9rem/1 var(--font-tight); letter-spacing: .04em; }
@media (max-width: 599px) {
  .rental-row { flex-wrap: wrap; }
  .rental-row .row-end { width: 100%; padding-left: 78px; justify-content: flex-start; }
}

.empty { text-align: center; padding: 48px 20px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 8px; background: var(--card); border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.empty h3 { color: var(--text); font-size: 1.1rem; }
.empty p { max-width: 42ch; }
.empty .btn { margin-top: 8px; }
.calm { padding: 18px 20px; background: var(--card); border-radius: var(--radius); border: 1px solid var(--line); color: var(--muted); }

.facts { margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 16px; }
.facts > div { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.facts > div:last-child { border-bottom: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; text-align: right; font-weight: 500; }

/* ---------------------------------------------------------------- the key tag */

.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.board-wrap { margin-bottom: 8px; }
.keytag { --tag-bg: var(--card); --tag-edge: var(--line-strong); --tag-ink: var(--text);
  position: relative; display: flex; align-items: center; gap: 16px; padding: 18px 20px 18px 18px; min-height: 104px;
  background: var(--tag-bg); border: 1.5px solid var(--tag-edge); border-radius: 52px 16px 16px 52px;
  text-decoration: none; color: var(--text); text-align: left; font: inherit; width: 100%; box-shadow: var(--shadow); }
a.keytag:hover, button.keytag:hover { color: var(--text); border-color: var(--tag-ink); }
button.keytag { cursor: pointer; }
.keytag-hole { flex: none; width: 13px; height: 13px; border-radius: 50%; background: var(--paper); box-shadow: inset 0 1.5px 3px rgba(0, 0, 0, .35), 0 0 0 4px color-mix(in srgb, var(--tag-edge) 35%, transparent); }
.keytag-body { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.keytag-plate { font: 700 2.15rem/1 var(--font-tight); letter-spacing: .02em; color: var(--tag-ink); }
.keytag-status { display: flex; align-items: center; gap: 7px; font-weight: 600; min-width: 0; }
.keytag-status > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.keytag-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--tag-ink); flex: none; }
.keytag-sub { color: var(--muted); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.keytag.tone-free { --tag-bg: var(--lagoon-tint); --tag-edge: color-mix(in srgb, var(--lagoon) 45%, transparent); --tag-ink: var(--lagoon); }
.keytag.tone-out { --tag-bg: var(--card); --tag-edge: var(--line-strong); --tag-ink: var(--text); }
.keytag.tone-soon { --tag-bg: var(--amber-tint); --tag-edge: color-mix(in srgb, var(--amber) 50%, transparent); --tag-ink: var(--amber); }
.keytag.tone-late { --tag-bg: var(--red-tint); --tag-edge: var(--red); --tag-ink: var(--red-ink); }
.keytag.tone-off { --tag-bg: transparent; --tag-edge: var(--line-strong); --tag-ink: var(--muted); border-style: dashed; box-shadow: none; }
.keytag.compact { min-height: 76px; padding: 12px 16px 12px 14px; gap: 12px; }
.keytag.compact .keytag-plate { font-size: 1.6rem; }
.keytag.compact .keytag-hole { width: 11px; height: 11px; }
.keytag.selected { outline: 3px solid var(--red); outline-offset: 2px; }
.keytag.disabled { opacity: .55; cursor: not-allowed; }
.board-pick { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }

/* ---------------------------------------------------------------- today */

.attention { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.att { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--line-strong); border-radius: 10px; padding: 12px 14px; flex-wrap: wrap; }
.att-red { border-left-color: var(--red); }
.att-amber { border-left-color: var(--amber); }
.att-blue { border-left-color: var(--blue); }
.att-main { flex: 1; min-width: 240px; display: flex; gap: 12px; align-items: flex-start; text-decoration: none; }
.att-red .att-main > .icon { color: var(--red); }
.att-amber .att-main > .icon { color: var(--amber); }
.att-blue .att-main > .icon { color: var(--blue); }
.att-main > span { display: flex; flex-direction: column; }
.att-sub { color: var(--muted); font-size: .92rem; }
.att-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.figure { background: var(--card); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.figure-label { color: var(--muted); font-size: .9rem; }
.figure-value { font: 700 1.6rem/1.1 var(--font-tight); letter-spacing: .01em; }
.figure.pos .figure-value { color: var(--lagoon); }
.figure.neg .figure-value { color: var(--red-ink); }
.figures-big .figure-value { font-size: 2rem; }
@media (max-width: 599px) { .figures { grid-template-columns: 1fr 1fr; } .figure-value, .figures-big .figure-value { font-size: 1.35rem; } }

/* ---------------------------------------------------------------- toolbar, tabs, search */

.toolbar { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 14px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs a { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 99px; text-decoration: none; font-weight: 600; color: var(--muted); white-space: nowrap; }
.tabs a:hover { color: var(--text); background: rgba(127, 140, 155, .1); }
.tabs a.active { background: var(--navy); color: #fff; }
:root[data-theme="dark"] .tabs a.active { background: var(--text); color: var(--paper); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tabs a.active { background: var(--text); color: var(--paper); } }
.count { font-size: .78rem; background: rgba(127, 140, 155, .2); border-radius: 99px; padding: 0 7px; }
.tabs a.active .count { background: rgba(255, 255, 255, .2); }
input.search { min-width: min(100%, 320px); }
.chips .segmented label span { padding: 5px 12px; }

/* ---------------------------------------------------------------- columns */

.cols { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: start; }
.col-side { display: flex; flex-direction: column; gap: 0; }
.col-side > .section:first-child, .col-side > .money-panel:first-child { margin-top: 0; }
.sticky { position: sticky; top: 20px; display: flex; flex-direction: column; gap: 0; }
@media (max-width: 999px) { .cols { grid-template-columns: 1fr; } .sticky { position: static; } .rental .cols { display: flex; flex-direction: column-reverse; gap: 8px; } }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 599px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.stack { display: flex; flex-direction: column; gap: 14px; }
.section > :is(.field, .grid2, .grid3) + :is(.field, .grid2, .grid3) { margin-top: 14px; }

/* ---------------------------------------------------------------- rental detail */

.actions-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: -6px 0 26px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.more-actions { display: flex; flex-wrap: wrap; gap: 2px; margin-left: auto; }
@media (max-width: 899px) { .more-actions { margin-left: 0; width: 100%; } }
.money-panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.money-panel dl { margin: 0 0 12px; }
.money-panel .line { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; }
.money-panel dt { color: var(--muted); }
.money-panel dd { margin: 0; font-variant-numeric: tabular-nums; }
.money-panel .line.total { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; font-weight: 700; }
.money-panel .line.total dt { color: var(--text); }
.balance { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-radius: 10px; font-weight: 700; }
.balance strong { font: 700 1.5rem/1 var(--font-tight); }
.balance.due { background: var(--red-tint); color: var(--red-ink); }
.balance.paid { background: var(--lagoon-tint); color: var(--lagoon); }
.side-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 3px; }
.side-title { font-weight: 700; font-size: 1.05rem; }

.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 17px; top: 18px; bottom: 18px; width: 2px; background: var(--line); }
.tl { position: relative; display: flex; gap: 14px; align-items: flex-start; padding: 8px 0; }
.tl-icon { position: relative; z-index: 1; flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--card); border: 1.5px solid var(--line-strong); color: var(--muted); }
.tl-body { flex: 1; padding-top: 6px; min-width: 0; }
.tl-title { font-weight: 600; }
.tl-sub { color: var(--muted); font-size: .92rem; }
.tl-void { color: var(--red-ink); font-size: .88rem; }
.tl.voided .tl-title { text-decoration: line-through; color: var(--muted); }
.tl-actions { padding-top: 2px; }

/* ---------------------------------------------------------------- new rental */

.pick-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.pick { display: flex; flex-direction: column; align-items: flex-start; text-align: left; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); cursor: pointer; }
.pick:hover { border-color: var(--text); }
.chosen-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1.5px solid var(--text); border-radius: 12px; background: var(--card); }
.chosen-card > div { flex: 1; display: flex; flex-direction: column; }
.summary { background: var(--navy); color: #fff; border-radius: var(--radius); padding: 6px 16px; }
.summary > div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid rgba(255, 255, 255, .12); }
.summary > div:last-child { border-bottom: 0; }
.summary span { color: #B9C6D1; }
.summary strong { font-weight: 600; text-align: right; }
.summary > div:last-child strong { font: 700 1.6rem/1 var(--font-tight); }
.sticky > .btn { margin-top: 18px; min-height: 52px; font-size: 1.05rem; }

/* ---------------------------------------------------------------- forms */

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-weight: 600; font-size: .92rem; }
.hint { color: var(--muted); font-size: .85rem; }
input:not([type=checkbox]):not([type=radio]), select, textarea {
  width: 100%; min-height: 44px; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--card); }
textarea { resize: vertical; min-height: 64px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
input.money { font-variant-numeric: tabular-nums; }
.when { display: grid; grid-template-columns: 1.4fr 1fr; gap: 8px; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--red); }
.segmented { display: flex; flex-wrap: wrap; gap: 6px; }
.segmented label { cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: inline-block; padding: 8px 14px; border-radius: 99px; border: 1px solid var(--line-strong); font-weight: 600; font-size: .9rem; background: var(--card); }
.segmented input:checked + span { background: var(--navy); border-color: var(--navy); color: #fff; }
:root[data-theme="dark"] .segmented input:checked + span { background: var(--text); color: var(--paper); border-color: var(--text); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .segmented input:checked + span { background: var(--text); color: var(--paper); border-color: var(--text); } }
.segmented input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.preview { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: 10px; background: var(--paper); }
.card-form { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.form-actions { display: flex; justify-content: flex-end; }
.error { color: var(--red-ink); }

/* ---------------------------------------------------------------- dialogs and toasts */

.dialog { border: 0; padding: 0; border-radius: 16px; background: var(--card); color: var(--text); width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.dialog-wide { width: min(760px, calc(100vw - 24px)); }
.dialog::backdrop { background: rgba(8, 18, 26, .55); }
.dialog form { display: flex; flex-direction: column; max-height: calc(100vh - 32px); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 16px 8px 22px; }
.dialog-head h2 { font-size: 1.25rem; }
.dialog-body { padding: 8px 22px 16px; overflow-y: auto; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
@media (max-width: 599px) {
  .dialog { width: 100vw; max-width: 100vw; max-height: 92vh; margin: auto 0 0; border-radius: 16px 16px 0 0; }
  .dialog form { max-height: 92vh; }
  .dialog-actions .btn { flex: 1; }
}
.toasts { position: fixed; z-index: 100; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; background: var(--navy); color: #fff; padding: 11px 16px; border-radius: 12px; box-shadow: 0 8px 30px rgba(0, 0, 0, .25); max-width: min(520px, calc(100vw - 32px)); animation: rise .2s ease-out; }
.toast-error { background: var(--red-ink); }
.toast.leaving { opacity: 0; transition: opacity .35s; }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }
@media (max-width: 899px) { .toasts { bottom: 86px; } }

/* ---------------------------------------------------------------- customers, documents */

.docs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.doc { display: flex; flex-direction: column; gap: 6px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); cursor: pointer; font-size: .88rem; color: var(--muted); }
.doc:hover { border-color: var(--text); }
.img-wrap { display: block; background: var(--paper); border-radius: 8px; overflow: hidden; }
.img-wrap img { display: block; width: 100%; height: 100%; object-fit: cover; }
.doc-img { aspect-ratio: 4 / 3; }
.img-missing { display: grid; place-items: center; }
.img-missing::after { content: "Photo not available"; color: var(--muted); font-size: .8rem; }
/* rental photos */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-bottom: 12px; }
.photo { padding: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--paper); cursor: pointer; }
.photo:hover, .photo:focus-visible { border-color: var(--text); }
.photo-img { aspect-ratio: 1; border-radius: 0; }
p.label { font-weight: 600; font-size: .9rem; margin: 4px 0 8px; }
.stack-tight { display: flex; flex-direction: column; gap: 8px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumbs:empty { display: none; }
.thumb { position: relative; width: 84px; height: 84px; border-radius: 10px; overflow: hidden; background: var(--paper); border: 1px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-x { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; display: grid; place-items: center;
  background: rgba(0, 0, 0, .62); color: #fff; cursor: pointer; }
.discount { display: flex; gap: 8px; align-items: stretch; }
.discount input { flex: 1; min-width: 0; }
.discount .segmented { flex: none; }
.viewer { display: flex; justify-content: center; }
.viewer-img { max-height: 70vh; background: transparent; }
.viewer-img img { object-fit: contain; max-height: 70vh; width: auto; margin: auto; }
.upload-preview { max-height: 260px; object-fit: contain; border-radius: 10px; background: var(--paper); width: 100%; }

/* ---------------------------------------------------------------- bikes */

.fleet { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.fleet-item { display: flex; flex-direction: column; gap: 10px; }
.fleet-facts { margin: 0; padding: 0 6px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; }
.fleet-facts dt { color: var(--muted); font-size: .82rem; }
.fleet-facts dd { margin: 0; font-weight: 500; }
.warn { display: flex; gap: 6px; align-items: center; color: var(--amber); font-size: .9rem; padding: 0 6px; }
.bike-hero { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; align-items: center; }
.bike-hero-side { display: flex; flex-direction: column; gap: 12px; }
.bike-photo { aspect-ratio: 4 / 3; border-radius: var(--radius); overflow: hidden; }
.bike-photo.placeholder { display: grid; place-items: center; background: var(--card); border: 1px dashed var(--line-strong); color: var(--muted); }
.bike-photo.studio { background: #ECEFF3; }
.bike-photo.studio img { object-fit: contain; }
.public-photo { margin: 4px -8px 14px; border-radius: 16px; background: #ECEFF3; aspect-ratio: 16 / 10; overflow: hidden; }
.public-photo img { width: 100%; height: 100%; object-fit: contain; display: block; }
@media (max-width: 599px) { .bike-hero { grid-template-columns: 1fr; } }
.qr-small { width: 140px; padding: 6px; background: #fff; border-radius: 10px; border: 1px solid var(--line); }
.qr-small svg { display: block; width: 100%; height: auto; }
.plain-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.plain-list li { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.loan .inline-actions { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- money */

.month-picker { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; margin: -8px 0 16px; }
.month-picker select { width: auto; font-weight: 700; font-size: 1.1rem; border: 0; background: transparent; padding: 4px 6px; min-height: 0; }
.ledger { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.ledger-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto 36px; gap: 12px; align-items: center; padding: 10px 8px 10px 16px; border-bottom: 1px solid var(--line); }
.ledger-row:last-child { border-bottom: 0; }
.ledger-date { color: var(--muted); font-size: .88rem; }
.ledger-main { display: flex; flex-direction: column; min-width: 0; }
.ledger-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ledger-title a { text-decoration: none; }
.ledger-sub { color: var(--muted); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ledger-amount { font-weight: 700; white-space: nowrap; }
.ledger-amount.in { color: var(--lagoon); }
.ledger-row.voided .ledger-title, .ledger-row.voided .ledger-amount { text-decoration: line-through; color: var(--muted); }
.bars { display: flex; flex-direction: column; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.bar-row { display: grid; grid-template-columns: 1fr 80px auto; gap: 10px; align-items: center; font-size: .9rem; }
.bar { height: 8px; background: var(--paper); border-radius: 99px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--navy); border-radius: 99px; }
:root[data-theme="dark"] .bar span { background: var(--text); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bar span { background: var(--text); } }
.bar-value { font-variant-numeric: tabular-nums; text-align: right; }
.mini-table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; font-size: .92rem; }
.mini-table th, .mini-table td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.mini-table th { color: var(--muted); font-weight: 600; }
.mini-table .num { text-align: right; }

/* ---------------------------------------------------------------- settings */

.settings .section { max-width: 860px; }
.chip-list { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chip-list li { display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--line-strong); border-radius: 99px; background: var(--card); padding: 0 4px 0 0; }
.chip-list li > button:first-child, .chip-list li > span { border: 0; background: none; padding: 6px 12px; cursor: pointer; font-weight: 500; }
.chip-list li.archived { opacity: .55; }
.tag-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-buttons button { border: 1px solid var(--line-strong); background: var(--paper); border-radius: 6px; padding: 3px 8px; font-size: .82rem; cursor: pointer; }
pre.sample { white-space: pre-wrap; font: inherit; background: var(--paper); padding: 12px; border-radius: 10px; margin: 0; }

/* ---------------------------------------------------------------- sign in, loading, public */

.signin { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.signin-brand { background: var(--navy); color: #C9D4DD; display: flex; flex-direction: column; justify-content: center; gap: 18px; padding: 48px 8vw; }
.signin-brand img { width: min(320px, 100%); height: auto; }
.signin-brand p { max-width: 34ch; font-size: 1.1rem; }
.signin-box { align-self: center; justify-self: center; width: min(420px, calc(100vw - 32px)); display: flex; flex-direction: column; gap: 14px; padding: 32px 0; }
.signin-box h1 { font-size: 1.8rem; }
.signin-box > .icon { color: var(--lagoon); }
.signin-box form { display: flex; flex-direction: column; gap: 14px; }
input.code { font: 700 1.6rem/1 var(--font-tight); letter-spacing: .3em; text-align: center; }
@media (max-width: 799px) { .signin { grid-template-columns: 1fr; } .signin-brand { padding: 32px 20px; } .signin-box { padding: 24px 0 48px; } }
.loading { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; color: var(--muted); padding: 24px; text-align: center; }

.public { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; gap: 12px; }
.public-card { width: min(440px, 100%); display: flex; flex-direction: column; gap: 18px; background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 26px 22px; box-shadow: var(--shadow); }
.public-logo { width: 190px; height: auto; }
:root[data-theme="dark"] .public-logo, :root[data-theme="dark"] .receipt-logo { filter: none; }
.public-actions { display: flex; flex-direction: column; gap: 10px; }
.public-actions .btn { min-height: 50px; }
.public-foot { color: var(--muted); font-size: .85rem; text-align: center; }
.public-owner { font-size: .9rem; }

/* ---------------------------------------------------------------- receipt, statement, stickers (screen and print) */

.print-page { min-height: 100vh; background: var(--paper); padding: 0 16px 48px; }
.print-bar { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 0; max-width: 820px; margin: 0 auto; background: var(--paper); }
.print-bar-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.print-note { max-width: 820px; margin: 0 auto 12px; color: var(--amber); }
.receipt, .statement { --ink: #1B2A38; --grey: #5F6B78; --rule: #E2E6EA; --soft: #EFF2F5; --brand: #E63446;
  background: #fff; color: var(--ink); max-width: 640px; margin: 8px auto; padding: 44px 48px 36px; border-radius: 6px; box-shadow: 0 2px 18px rgba(0, 0, 0, .12);
  display: flex; flex-direction: column; gap: 22px; font-size: 14px; }
.statement { max-width: 820px; padding-bottom: 32px; border-bottom: 8px solid #E42C3A; padding-top: 38px; }
.receipt h2, .statement h2 { font-size: 13px; color: var(--grey); font-weight: 700; margin: 0 0 6px; }
.receipt-head, .statement-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.receipt-logo { width: 240px; height: auto; flex: none; }
.receipt-head h1 { font-size: 40px; font-weight: 800; letter-spacing: .02em; }
.statement-head h1 { font-size: 26px; letter-spacing: .02em; }
.statement-head > div { text-align: right; }
.receipt-biz { display: flex; flex-direction: column; gap: 6px; padding-bottom: 18px; border-bottom: 1px solid var(--rule); }
.receipt-biz > strong { font-size: 19px; }
.receipt-biz dl, .receipt-bank dl { display: grid; grid-template-columns: max-content 1fr; gap: 3px 20px; margin: 0; }
.receipt-biz dt { color: var(--grey); font-weight: 700; }
.receipt-biz dd, .receipt-bank dd { margin: 0; }
.receipt-meta { display: grid; grid-template-columns: 1fr max-content; gap: 14px 24px; }
.receipt-meta .wide { grid-column: 1 / -1; }
.receipt-meta p { font-size: 15px; }
.receipt-no { font-weight: 600; }
.statement-biz { display: flex; justify-content: space-between; gap: 18px; color: var(--grey); padding-bottom: 18px; border-bottom: 1px solid var(--rule); }
.statement-biz strong { color: var(--ink); }
.statement-biz > div { display: flex; flex-direction: column; }
.statement-biz > div:last-child { text-align: right; }
.receipt-cancelled { color: #B71C2B; font-weight: 700; }
.receipt-lines, .receipt-sums, .statement-table, .statement-ledger { width: 100%; border-collapse: collapse; }
.receipt-lines th { background: var(--ink); color: #fff; font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; text-align: left; padding: 12px 10px; }
.receipt-lines th:first-child { padding-left: 14px; }
.receipt-lines td { padding: 12px 10px 4px; vertical-align: top; }
.receipt-lines td:first-child { padding-left: 10px; }
.receipt-lines tbody tr:last-child td { padding-bottom: 16px; border-bottom: 1px solid var(--rule); }
.receipt-lines .period { display: block; font-size: 12.5px; margin-top: 8px; }
.receipt-lines .num, .receipt-sums .num, .statement-table .num, .statement-ledger .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.receipt-sums td { padding: 7px 10px; }
.receipt-sums tr.bal-row td { font-weight: 700; }
.receipt-sums tr.bal-row.due td { color: #B71C2B; }
.receipt-total { display: flex; justify-content: space-between; align-items: center; background: var(--ink); color: #fff; padding: 14px 18px; margin: -6px 0; }
.receipt-total > span:first-child { font-weight: 800; font-size: 18px; letter-spacing: .04em; }
.receipt-total > span:last-child { font-size: 30px; font-variant-numeric: tabular-nums; }
.receipt-total small { font-size: 15px; font-weight: 700; }
.receipt-method { display: flex; gap: 32px; padding: 16px 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.receipt-method > span:first-child { color: var(--grey); font-weight: 700; }
.receipt-foot { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.receipt-bank { background: var(--soft); padding: 10px 16px; min-width: 56%; display: flex; flex-direction: column; gap: 4px; }
.receipt-bank dt { color: var(--grey); }
.receipt-thanks { color: var(--brand); font-weight: 700; align-self: center; }
.statement-table tr.sub td { border-top: 1px solid var(--rule); font-weight: 600; }
.statement-table tr.grand td { border-top: 2px solid var(--ink); }
.statement-ledger th { text-align: left; color: var(--grey); font-size: 12px; border-bottom: 1px solid var(--rule); }
.statement-ledger td { border-bottom: 1px solid var(--rule); font-size: 13px; }
.statement-foot { color: var(--grey); font-size: 12px; }
@media (max-width: 599px) {
  .receipt, .statement { padding: 24px 16px; gap: 18px; font-size: 13px; }
  .statement-biz { flex-direction: column; }
  .statement-biz > div:last-child { text-align: left; }
  .receipt-logo { width: 150px; }
  .receipt-head h1 { font-size: 24px; }
  .receipt-total > span:last-child { font-size: 22px; }
  .receipt-lines th { padding: 10px 6px; font-size: 10px; }
  .receipt-lines td { padding: 10px 6px 4px; }
  .receipt-bank { min-width: 100%; }
}

.sticker-pick { display: flex; gap: 14px; flex-wrap: wrap; }
.sticker-pick + .field { flex-direction: row; align-items: center; }
.sticker-sheet { --sw: 55mm; background: #fff; max-width: 820px; margin: 8px auto; padding: 12mm; display: grid;
  grid-template-columns: repeat(auto-fill, var(--sw)); justify-content: center; gap: 6mm; box-shadow: 0 2px 18px rgba(0, 0, 0, .12); }
.sticker { width: var(--sw); font-size: calc(var(--sw) * .065); border: 1px dashed #C9D0D8; border-radius: 1.1em; padding: 1.3em 1em 1.1em;
  display: flex; flex-direction: column; align-items: center; gap: .55em; color: #10202C; text-align: center; break-inside: avoid; }
.no-cut .sticker { border-color: transparent; }
.sticker-logo { width: 66%; height: auto; }
.sticker-qr { width: 74%; }
.sticker-qr svg { display: block; width: 100%; height: auto; }
.sticker-label { font: 700 2.9em/1 var(--font-tight); letter-spacing: .04em; }
.sticker-call { font-size: .82em; color: #5F6A76; }
.sticker-call strong { white-space: nowrap; }
.sticker-png { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.print-bar-2 { position: static; padding-top: 0; }
@media (max-width: 599px) { .sticker-sheet { padding: 6mm; } }

@media print {
  @page { margin: 10mm; }
  body { background: #fff !important; }
  .print-bar, .print-note, .toasts { display: none !important; }
  .print-page { padding: 0; background: #fff; }
  .receipt, .statement { box-shadow: none; margin: 0 auto; max-width: none; }
  .receipt-lines th, .receipt-total { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .sticker-sheet { box-shadow: none; padding: 0; max-width: none; }
}
