/* ==========================================================================
   BayPay — car park themed design system
   Palette: asphalt navy, bay-marking yellow, parking-sign blue
   ========================================================================== */
:root {
  --asphalt: #1f2c47;       /* BayPay navy (from the logo) */
  --asphalt-2: #2a3a5c;
  --asphalt-3: #35476d;
  --line: #ffd21f;          /* painted bay lines */
  --line-dark: #e0b400;
  --sign: #0a66ff;          /* BayPay blue (from the logo) */
  --sign-dark: #0052d6;
  --sign-soft: #e8f0ff;
  --ink: #1b2333;
  --ink-2: #4a5568;
  --muted: #6b7482;
  --bg: #f3f5f9;
  --card: #ffffff;
  --border: #e3e7ef;
  --ok: #17a862;
  --ok-soft: #e4f7ed;
  --warn: #f59e0b;
  --warn-soft: #fff4dc;
  --bad: #e5333f;
  --bad-soft: #fde8ea;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(15, 26, 43, .12);
  --shadow-sm: 0 2px 8px rgba(15, 26, 43, .08);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --plate: 'Arial Black', 'Helvetica Neue', Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--sign); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 26px; } h2 { font-size: 20px; } h3 { font-size: 16px; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }
.row { display: flex; gap: 12px; align-items: center; }
.row.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; }
.center { text-align: center; }

/* Bay-line decorative stripe (yellow painted lines on asphalt) */
.bay-stripe { height: 6px; background: repeating-linear-gradient(90deg, var(--line) 0 40px, transparent 40px 56px); }

/* Header */
.topbar { position: sticky; top: 0; z-index: 1000; background: var(--asphalt); color: #fff; }
.topbar .inner { max-width: 1200px; margin: 0 auto; padding: 0 16px; height: 60px; display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 800; font-size: 20px; letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.brand img { height: 38px; width: auto; display: block; }
.brand small { font-weight: 700; font-size: 11px; color: var(--line); letter-spacing: .12em; text-transform: uppercase; margin-left: 4px; padding-left: 12px; border-left: 1px solid rgba(255,255,255,.25); }
.logo-light { display: block; max-width: 220px; height: auto; margin: 0 auto 6px; }
.nav { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.nav a, .nav button.link { color: #cfd6e2; padding: 8px 12px; border-radius: 8px; font-weight: 600; font-size: 14px; background: none; border: 0; cursor: pointer; font-family: inherit; }
.nav a:hover, .nav a.active { background: var(--asphalt-3); color: #fff; text-decoration: none; }
.nav .cta { background: var(--line); color: var(--asphalt); }
.nav .cta:hover { background: var(--line-dark); color: var(--asphalt); }
@media (max-width: 640px) { .nav a span.txt { display: none; } .nav a { padding: 8px 10px; } .brand small { display: none; } .brand img { height: 32px; } .topbar .inner { padding: 0 12px; } }
/* iOS zooms into inputs smaller than 16px — keep form controls at 16px on phones */
@media (max-width: 640px) { input, select, textarea { font-size: 16px; } .page { padding: 16px 12px 48px; } .card { padding: 16px; } h1 { font-size: 22px; } }

/* Layout */
.page { max-width: 1100px; margin: 0 auto; padding: 24px 16px 64px; }
.page.narrow { max-width: 560px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 20px; border: 1px solid var(--border); }
.card + .card { margin-top: 16px; }
.card.pad-0 { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.grid { display: grid; gap: 16px; }
.grid > * { min-width: 0; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid.cols-4 { grid-template-columns: repeat(2, 1fr); } .grid.cols-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; } .grid.cols-4 { grid-template-columns: repeat(2, 1fr); gap: 10px; } .grid.stats { grid-template-columns: repeat(2, 1fr); gap: 10px; } .stat { padding: 12px; } .stat .v { font-size: 21px; } }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 18px; border-radius: 10px; border: 1px solid transparent; font-weight: 700; font-size: 15px; cursor: pointer; font-family: inherit; background: var(--sign); color: #fff; transition: transform .05s, background .15s; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--sign-dark); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.yellow { background: var(--line); color: var(--asphalt); }
.btn.yellow:hover { background: var(--line-dark); }
.btn.ghost { background: #fff; color: var(--ink); border-color: var(--border); }
.btn.ghost:hover { background: var(--bg); }
.btn.danger { background: var(--bad); }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn.lg { padding: 14px 22px; font-size: 17px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* Forms */
label.field { display: block; margin-bottom: 12px; }
label.field span, .label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
input, select, textarea { width: 100%; padding: 11px 12px; border: 1px solid #cfd5e0; border-radius: 10px; font: inherit; color: var(--ink); background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--sign); outline-offset: 0; border-color: var(--sign); }
input.plate-input { font-family: var(--plate); text-transform: uppercase; letter-spacing: .12em; font-size: 20px; background: var(--line); border: 2px solid #111; text-align: center; }
.help { font-size: 12px; color: var(--muted); margin-top: 4px; }
.form-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 560px) { .form-2 { grid-template-columns: 1fr; } }
.error { background: var(--bad-soft); color: #9b1c25; padding: 10px 12px; border-radius: 10px; font-size: 14px; margin-bottom: 12px; }
.notice { background: var(--sign-soft); color: var(--sign-dark); padding: 10px 12px; border-radius: 10px; font-size: 14px; margin-bottom: 12px; }
.success-note { background: var(--ok-soft); color: #0b6b3e; padding: 10px 12px; border-radius: 10px; font-size: 14px; margin-bottom: 12px; }

/* Number plate */
.plate { display: inline-flex; align-items: center; font-family: var(--plate); font-weight: 900; letter-spacing: .1em; background: var(--line); color: #111; border: 2px solid #111; border-radius: 6px; padding: 2px 10px 2px 0; font-size: 18px; line-height: 1.4; white-space: nowrap; }
.plate::before { content: 'GB'; font-family: var(--font); font-weight: 700; font-size: 9px; letter-spacing: 0; color: #fff; background: var(--sign); align-self: stretch; display: flex; align-items: flex-end; padding: 0 5px 2px; margin-right: 8px; border-radius: 3px 0 0 3px; }
.plate.sm { font-size: 14px; padding: 0 8px 0 0; }
.plate.lg { font-size: 26px; padding: 4px 14px 4px 0; }
.plate.white { background: #fff; }

/* Badges */
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: .02em; }
.badge.ok { background: var(--ok-soft); color: #0b6b3e; }
.badge.warn { background: var(--warn-soft); color: #92400e; }
.badge.bad { background: var(--bad-soft); color: #9b1c25; }
.badge.blue { background: var(--sign-soft); color: var(--sign-dark); }
.badge.grey { background: #eceff5; color: var(--ink-2); }
.code-chip { display: inline-block; background: var(--asphalt); color: var(--line); font-weight: 800; font-family: var(--plate); letter-spacing: .1em; padding: 2px 8px; border-radius: 6px; font-size: 13px; }

/* Tables */
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 8px 10px; border-bottom: 2px solid var(--border); }
table.tbl td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: 0; }
.tbl-wrap { overflow-x: auto; }
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl td.nw { white-space: nowrap; }

/* Stat tiles */
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.stat .k { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.stat .v { font-size: 26px; font-weight: 800; margin-top: 4px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat.dark { background: var(--asphalt); color: #fff; border-color: var(--asphalt); }
.stat.dark .k { color: #aab4c4; } .stat.dark .v { color: var(--line); }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tabs a, .tabs button { padding: 10px 14px; font-weight: 700; color: var(--muted); border: 0; background: none; cursor: pointer; font: inherit; font-weight: 700; border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.tabs a.active, .tabs button.active { color: var(--sign); border-bottom-color: var(--sign); }
.tabs a:hover { text-decoration: none; color: var(--ink); }

/* Parking ticket card */
.ticket { background: #fff; border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--border); }
.ticket .top { background: var(--asphalt); color: #fff; padding: 18px 20px; position: relative; }
.ticket .top::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 6px; background: repeating-linear-gradient(90deg, var(--line) 0 30px, transparent 30px 44px); }
.ticket .body { padding: 20px; }
.ticket .kv { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; font-size: 14px; }
.ticket .kv div:nth-child(odd) { color: var(--muted); }
.ticket .kv div:nth-child(even) { font-weight: 600; }
.countdown { font-size: 34px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.countdown.warn { color: var(--warn); } .countdown.bad { color: var(--bad); }

/* Selectable option cards (vehicle / tariff pickers) */
.opt { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 2px solid var(--border); border-radius: 12px; cursor: pointer; background: #fff; }
.opt:hover { border-color: #b9c3d6; }
.opt.selected { border-color: var(--sign); background: var(--sign-soft); }
.opt input { width: auto; margin: 0; }
.opt .price { margin-left: auto; font-weight: 800; font-size: 17px; }

/* Toast */
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--asphalt); color: #fff; padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow); z-index: 5000; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 90vw; }
#toast.show { opacity: 1; }
#toast.err { background: var(--bad); }

/* Loading */
.spinner { width: 22px; height: 22px; border: 3px solid rgba(22,82,217,.2); border-top-color: var(--sign); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-block { padding: 30px; text-align: center; color: var(--muted); }

/* Empty state */
.empty { text-align: center; padding: 30px 16px; color: var(--muted); }
.empty .ico { font-size: 40px; margin-bottom: 8px; }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(15,26,43,.55); z-index: 4000; display: flex; align-items: flex-end; justify-content: center; padding: 0; }
.modal { background: #fff; width: 100%; max-width: 520px; border-radius: 18px 18px 0 0; padding: 22px 20px 28px; max-height: 92vh; overflow: auto; }
@media (min-width: 640px) { .modal-bg { align-items: center; padding: 20px; } .modal { border-radius: 18px; } }

/* Login hero used by operator/admin portals */
.portal-login { min-height: calc(100vh - 60px); display: grid; place-items: center; padding: 20px; background: var(--asphalt) repeating-linear-gradient(135deg, transparent 0 60px, rgba(255,210,31,.05) 60px 64px); }
.portal-login .card { width: 100%; max-width: 420px; padding: 28px; }

/* Bar chart (pure CSS) */
.bars { display: flex; align-items: flex-end; gap: 4px; height: 160px; padding-top: 10px; }
.bars .bar { flex: 1; background: var(--sign); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; opacity: .9; }
.bars .bar:hover { background: var(--sign-dark); opacity: 1; }
.bars .bar[data-tip]:hover::after { content: attr(data-tip); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: var(--asphalt); color: #fff; font-size: 11px; padding: 4px 8px; border-radius: 6px; white-space: nowrap; margin-bottom: 4px; z-index: 5; }
.bars-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 4px; }

/* Footer */
.site-footer { background: #fff; border-top: 1px solid var(--border); margin-top: 40px; }
.site-footer .inner { max-width: 1100px; margin: 0 auto; padding: 22px 16px; display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: center; justify-content: space-between; font-size: 13px; color: var(--muted); }
.site-footer img { height: 34px; width: auto; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.site-footer nav a { color: var(--ink-2); font-weight: 600; }
@media (max-width: 640px) { .site-footer .inner { flex-direction: column; align-items: flex-start; } }

/* Legal / help pages */
.legal { max-width: 760px; margin: 0 auto; padding: 28px 16px 60px; }
.legal h1 { font-size: 30px; margin-bottom: 6px; }
.legal .updated { color: var(--muted); font-size: 13px; margin-bottom: 24px; }
.legal h2 { font-size: 19px; margin: 30px 0 10px; padding-top: 6px; }
.legal h3 { font-size: 16px; margin: 20px 0 6px; }
.legal p, .legal li { line-height: 1.6; }
.legal ul { padding-left: 22px; }
.legal .ph { background: var(--warn-soft); color: #92400e; padding: 1px 6px; border-radius: 4px; font-weight: 600; }
.legal .toc { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; font-size: 14px; }
.legal .toc a { display: inline-block; margin: 3px 14px 3px 0; }
.legal details { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 4px 16px; margin-bottom: 10px; }
.legal details summary { cursor: pointer; font-weight: 700; padding: 10px 0; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.legal details summary::-webkit-details-marker { display: none; }
.legal details summary::after { content: '+'; font-size: 20px; color: var(--sign); flex-shrink: 0; }
.legal details[open] summary::after { content: '–'; }
.legal details p { margin: 0 0 12px; }
