:root {
  --red: #bc2336;
  --red-dark: #9a1c2c;
  --red-soft: #fbeaec;
  --ink: #1f2328;
  --muted: #646b73;
  --line: #e3e5e8;
  --bg: #f6f7f8;
  --amber: #b7791f;
  --amber-soft: #fdf3e1;
  --green: #2f7d4f;
  --green-soft: #e6f4ec;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 "Segoe UI", system-ui, -apple-system, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--red); }
header.top { background: #fff; border-bottom: 3px solid var(--red); display: flex; align-items: center; gap: 24px; padding: 10px 24px; }
header.top .brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 600; font-size: 18px; }
header.top .brand img { height: 38px; }
header.top .spacer { flex: 1; }
.switch { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.switch form { margin: 0; }
.switch button { border: 0; background: #fff; padding: 7px 14px; cursor: pointer; font: inherit; color: var(--muted); }
.switch button.on { background: var(--red); color: #fff; font-weight: 600; }
.who { color: var(--muted); font-size: 14px; display: flex; gap: 12px; align-items: center; }
.who form { margin: 0; }
.linkbtn { background: none; border: 0; color: var(--red); cursor: pointer; font: inherit; padding: 0; }
.layout { display: flex; min-height: calc(100vh - 64px); }
nav.side { width: 210px; background: #fff; border-right: 1px solid var(--line); padding: 16px 0; flex-shrink: 0; }
nav.side a { display: block; padding: 8px 22px; color: var(--ink); text-decoration: none; }
nav.side a:hover { background: var(--red-soft); }
nav.side a.on { border-left: 4px solid var(--red); padding-left: 18px; background: var(--red-soft); font-weight: 600; }
nav.side a.later { color: var(--muted); }
nav.side .group { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 16px 22px 4px; }
main { flex: 1; padding: 24px 32px; max-width: 1280px; }
h1 { margin: 0 0 18px; font-size: 24px; }
h2 { font-size: 18px; margin: 24px 0 10px; }
.banner { background: var(--red); color: #fff; text-align: center; padding: 8px; font-weight: 600; }
.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; }
.flash.ok { background: var(--green-soft); color: var(--green); }
.flash.error { background: #fbeaec; color: #9a1c2c; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; margin-bottom: 18px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.tile .n { font-size: 30px; font-weight: 700; }
.tile .l { color: var(--muted); font-size: 13px; }
.tile.red .n { color: #c0392b; }
.tile.amber .n { color: var(--amber); }
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 13px; color: var(--muted); font-weight: 600; background: #fafbfc; }
tr.click:hover td { background: var(--red-soft); cursor: pointer; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.pill.red { background: #fbeaec; color: #9a1c2c; }
.pill.amber { background: var(--amber-soft); color: var(--amber); }
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.grey, .pill.none { background: #eef0f2; color: var(--muted); }
.plate { font-family: "Arial Black", Arial, sans-serif; background: #ffd400; border: 1px solid #c9a800; border-radius: 4px; padding: 1px 7px; letter-spacing: .04em; white-space: nowrap; }
.btn { display: inline-block; background: var(--red); color: #fff; border: 0; border-radius: 7px; padding: 8px 16px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--red-dark); }
.btn.ghost { background: #fff; color: var(--red); border: 1px solid var(--red); }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
input, select, textarea { font: inherit; padding: 7px 9px; border: 1px solid #cfd3d8; border-radius: 6px; background: #fff; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--red-soft); border-color: var(--red); }
.toolbar input, .toolbar select { width: auto; }
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px 18px; }
.grid .wide { grid-column: 1 / -1; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 400; color: var(--ink); font-size: 15px; }
.check input { width: auto; }
.actions { display: flex; gap: 10px; margin-top: 18px; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px 20px; }
.facts .k { font-size: 12.5px; color: var(--muted); }
.facts .v { font-weight: 600; }
.muted { color: var(--muted); }
.login { max-width: 380px; margin: 9vh auto; }
.login .card { padding: 28px; }
.login .logo { text-align: center; margin-bottom: 18px; font-weight: 700; font-size: 20px; }
.login .logo img { max-height: 60px; display: block; margin: 0 auto 8px; }
.qr svg { width: 200px; height: 200px; display: block; margin: 10px auto; }
code.key { display: block; background: #f1f2f4; padding: 8px; border-radius: 6px; text-align: center; letter-spacing: .12em; word-break: break-all; }
.lookup-msg { font-size: 13px; margin-top: 6px; }

/* ---- filters ---- */
.filters { padding: 14px 16px; }
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filter-row + .filter-row { margin-top: 10px; }
.filter-row select, .filter-row input { width: auto; font-size: 14px; padding: 6px 8px; }
.filter-row .search { min-width: 320px; flex: 1; max-width: 480px; }
.clear { font-size: 14px; }
th a.sort { color: inherit; text-decoration: none; }
th a.sort.on, th a.sort:hover { color: var(--red); }

/* ---- dashboard ---- */
a.tile.link { text-decoration: none; color: inherit; transition: border-color .15s, box-shadow .15s; }
a.tile.link:hover { border-color: var(--red); box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 18px; }
.panel-title { margin: 0 0 14px; }
.comp + .comp { margin-top: 18px; }
.comp-head { display: flex; justify-content: space-between; font-weight: 600; margin-bottom: 6px; }
.stack { display: flex; gap: 2px; height: 18px; }
.seg { display: block; min-width: 6px; }
.seg:first-child { border-radius: 4px 0 0 4px; }
.seg:last-child { border-radius: 0 4px 4px 0; }
.seg:only-child { border-radius: 4px; }
.seg.red, .dot.red { background: #c0392b; }
.seg.amber, .dot.amber { background: #e0a030; }
.seg.green, .dot.green { background: #3f9461; }
.seg.none, .dot.none { background: #d5d9de; }
.seg:hover { filter: brightness(.9); }
.comp-key { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 6px; font-size: 13px; }
.comp-key a { color: var(--ink); text-decoration: none; }
.comp-key a:hover { color: var(--red); }
.comp-key a.zero { color: var(--muted); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: 0; }
.mix + .mix { margin-top: 16px; }
.mix-title { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.hbar { display: grid; grid-template-columns: 140px 1fr 44px; gap: 10px; align-items: center; padding: 4px 0; color: var(--ink); text-decoration: none; border-radius: 4px; }
.hbar:hover { background: var(--red-soft); }
.hbar-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.hbar-track { height: 12px; }
.hbar-fill { display: block; height: 100%; background: var(--red); border-radius: 0 4px 4px 0; min-width: 4px; }
.hbar-fill.blank { background: #c9ced4; }
.hbar-n { text-align: right; font-weight: 600; font-size: 14px; font-variant-numeric: tabular-nums; }

/* hover tooltips */
[data-tip] { position: relative; }
[data-tip]:hover::after {
  content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%);
  background: var(--ink); color: #fff; font-size: 12.5px; font-weight: 500; padding: 4px 8px; border-radius: 5px;
  white-space: nowrap; pointer-events: none; z-index: 10;
}

/* ---- finance ---- */
.money { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cols { display: flex; align-items: flex-end; gap: 2px; height: 200px; padding-top: 24px; border-bottom: 1px solid var(--line); }
.col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; text-decoration: none; }
.col-val { font-size: 11.5px; color: var(--muted); text-align: center; margin-bottom: 3px; font-variant-numeric: tabular-nums; }
.col-fill { background: var(--red); border-radius: 4px 4px 0 0; min-height: 2px; }
.col:hover .col-fill { background: var(--red-dark); }
.col:hover .col-val { color: var(--ink); }
.col-axis { display: flex; gap: 2px; margin-top: 4px; }
.col-axis span { flex: 1; text-align: center; font-size: 11.5px; color: var(--muted); }
.period { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.period a { padding: 5px 11px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; color: var(--ink); background: #fff; font-size: 14px; }
.period a.on { background: var(--red); color: #fff; border-color: var(--red); }
.period input { width: auto; font-size: 14px; padding: 4px 6px; }
.btn.small { padding: 5px 11px; font-size: 14px; }
.btn.danger { background: #fff; color: #9a1c2c; border: 1px solid #e3a5ad; }

/* ---- archive ---- */
.tabs { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-left: 12px; }
.tabs a { padding: 6px 14px; text-decoration: none; color: var(--muted); background: #fff; font-size: 14px; }
.tabs a.on { background: var(--red); color: #fff; font-weight: 600; }
.archived-bar { display: flex; justify-content: space-between; align-items: center; gap: 16px; background: #eef0f2; border: 1px solid #d5d9de; border-radius: 10px; padding: 12px 18px; margin-bottom: 18px; }
.archived-bar form { margin: 0; }

.small { font-size: 12.5px; }
/* ---- pool calendar ---- */
.cal-wrap { overflow-x: auto; padding: 0; }
table.cal { table-layout: fixed; min-width: 980px; }
table.cal th, table.cal td { text-align: center; padding: 6px 4px; border: 1px solid var(--line); font-size: 13px; }
table.cal th.cal-v, table.cal td.cal-v { text-align: left; width: 170px; padding: 8px 10px; }
table.cal th.today { background: var(--red-soft); color: var(--red); }
table.cal .wkend { background: #fafbfc; }
.cal-free a { display: block; color: #c9ced4; text-decoration: none; font-size: 16px; }
.cal-free a:hover { color: var(--red); background: var(--red-soft); border-radius: 4px; }
.cal-b a, .cal-b span { display: block; text-decoration: none; color: var(--ink); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-b.booked { background: #eef4fb; box-shadow: inset 0 0 0 2px #7aa7d6; }
.cal-b.out { background: #fbeaec; box-shadow: inset 0 0 0 2px #c0392b; }
.cal-b.returned { background: #eef0f2; }
.printonly { display: none; }
@media print {
  header.top, nav.side, .noprint, .banner, .actions { display: none !important; }
  .printonly { display: block; }
  main { padding: 0; max-width: none; }
  body { background: #fff; }
  .card { border: 0; padding: 0; }
  table { font-size: 11px; }
}

/* ---- phone / tablet ---- */
.menu-btn { display: none; background: none; border: 1px solid var(--line); border-radius: 6px; font-size: 20px; padding: 2px 10px; cursor: pointer; }
@media (max-width: 900px) {
  header.top { flex-wrap: wrap; gap: 10px; padding: 10px 14px; }
  .menu-btn { display: block; }
  header.top .spacer { display: none; }
  .who { width: 100%; justify-content: space-between; font-size: 13px; }
  .switch button { padding: 6px 10px; font-size: 14px; }
  .layout { display: block; }
  nav.side { display: none; width: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 6px 0; }
  nav.side.open { display: block; }
  main { padding: 16px 14px; }
  h1 { font-size: 20px; }
  .panels { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .tile .n { font-size: 24px; }
  .filter-row .search { min-width: 0; width: 100%; max-width: none; }
  .filter-row select, .filter-row input { flex: 1 1 140px; }
  table { display: block; overflow-x: auto; white-space: nowrap; }
  .hbar { grid-template-columns: 100px 1fr 60px; }
  .grid { grid-template-columns: 1fr; }
  .facts { grid-template-columns: repeat(2, 1fr); }
  .toolbar { flex-wrap: wrap; }
}

.panels .card { overflow-x: auto; min-width: 0; }

.attach { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.attached { margin-top: 10px; }
.attached a { text-decoration: none; }

.version { padding: 18px 22px 6px; font-size: 12px; color: var(--muted); }
td.open-cell { width: 1%; white-space: nowrap; text-align: right; }

.lic-photos { display: flex; gap: 14px; flex-wrap: wrap; }
.lic-photo { display: block; width: 220px; text-decoration: none; color: var(--ink); }
.lic-photo img { width: 220px; height: 140px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; }
.lic-photo span { display: flex; align-items: center; justify-content: center; width: 220px; height: 140px; border: 1px solid var(--line); border-radius: 8px; font-size: 40px; }

/* ---- branding ---- */
header.top .brand img { height: 38px; }
.brand-app { display: inline-flex; align-items: center; gap: 7px; padding-left: 12px; margin-left: 2px; border-left: 2px solid var(--line); color: var(--red); font-weight: 700; font-size: 19px; }
.brand-van svg { width: 30px; height: 22px; display: block; }
.hero { position: relative; overflow: hidden; display: flex; align-items: center; gap: 20px; justify-content: space-between;
  background: linear-gradient(120deg, var(--red) 0%, var(--red-dark) 100%); color: #fff; border-radius: 14px; padding: 22px 26px; margin-bottom: 20px; }
.hero h1 { margin: 2px 0 4px; font-size: 28px; color: #fff; }
.hero-kicker { text-transform: uppercase; letter-spacing: .12em; font-size: 12px; opacity: .85; font-weight: 600; }
.hero-sub { opacity: .92; font-size: 14.5px; }
.hero-text, .hero-logo { position: relative; z-index: 1; }
.hero-logo { background: #fff; border-radius: 12px; padding: 10px 14px; display: flex; align-items: center; box-shadow: 0 2px 10px rgba(0,0,0,.15); }
.hero-logo img { height: 52px; display: block; }
.hero-logo .hero-van { display: none; }
.hero-logo.nologo .hero-van { display: block; } .hero-logo.nologo .hero-van svg { width: 64px; height: 46px; display: block; }
.hero-watermark { position: absolute; right: 250px; bottom: -34px; opacity: .08; z-index: 0; pointer-events: none; }
.hero-watermark svg { width: 230px; height: 165px; }
@media (max-width: 900px) { .hero { padding: 16px 18px; } .hero h1 { font-size: 22px; } .hero-logo img { height: 36px; } .hero-watermark { display: none; } .brand-app { font-size: 16px; } }
