:root {
  --brand: #4054b2;
  --brand-dark: #2f3f8c;
  --brand-soft: #e9ecf8;
  --brand-line: #c9d0ee;
  --bg: #f3f5fa;
  --card: #ffffff;
  --text: #1c2233;
  --muted: #5d6578;
  --line: #e2e6ef;
  --rest: #b45309;
  --rest-soft: #fdf1e0;
  --rest-line: #f3d3a4;
  --ok: #1f8a4c;
  --ok-soft: #e4f5ea;
  --warn-soft: #fdecec;
  --warn: #a12a2a;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(28, 34, 51, 0.06), 0 4px 14px rgba(28, 34, 51, 0.05);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, p { margin: 0; }
small { font-weight: 400; color: var(--muted); }

:focus-visible { outline: 3px solid #8fa0ea; outline-offset: 2px; border-radius: 6px; }

.wrap { width: 100%; max-width: 980px; margin: 0 auto; padding: 0 14px; }
.main { flex: 1; padding-top: 14px; padding-bottom: 28px; display: flex; flex-direction: column; gap: 14px; }

/* top bar */
.topbar { background: var(--brand); color: #fff; position: sticky; top: 0; z-index: 10; padding-top: env(safe-area-inset-top); }
.topbar-in { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 58px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; min-width: 0; }
.brand:hover { text-decoration: none; }
.brand img { background: #fff; border-radius: 10px; padding: 3px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text strong { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { color: #d5dbf5; font-size: 12px; }
.nav { display: flex; gap: 2px; flex: none; }
.nav a { color: #e6e9fa; padding: 9px 11px; border-radius: 10px; font-weight: 600; font-size: 14px; }
.nav a:hover { background: rgba(255, 255, 255, 0.12); text-decoration: none; }
.nav a.on { background: #fff; color: var(--brand-dark); }

/* cards */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card.narrow { max-width: 420px; width: 100%; margin: 12px auto; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head h2, .card-head h3 { font-size: 17px; font-weight: 700; }
.card-head h2 small { margin-left: 4px; font-size: 14px; }
.card.notice h2 { font-size: 18px; margin-bottom: 6px; }
.card.notice p + p { margin-top: 12px; }
.link { font-size: 14px; font-weight: 600; white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.empty { color: var(--muted); padding: 6px 0; }
.chev { color: #9aa2b6; font-size: 20px; line-height: 1; }

/* search */
.search label { display: block; font-weight: 700; font-size: 15px; margin: 4px 2px 8px; }
.search-box { display: flex; gap: 8px; }
.search input {
  flex: 1; min-width: 0; height: 56px; padding: 0 16px; font-size: 20px; font-weight: 600; letter-spacing: 0.02em;
  border: 2px solid var(--brand-line); border-radius: var(--radius); background: #fff; color: var(--text);
  appearance: none; -webkit-appearance: none;
}
.search input::placeholder { color: #9aa2b6; font-weight: 400; font-size: 16px; letter-spacing: 0; }
.search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(64, 84, 178, 0.15); }
.search button, .btn {
  display: inline-flex; align-items: center; justify-content: center; height: 46px; padding: 0 18px;
  background: var(--brand); color: #fff; border: 0; border-radius: 12px; font: inherit; font-weight: 700; cursor: pointer;
}
.search button { height: 56px; padding: 0 22px; border-radius: var(--radius); font-size: 17px; }
.search button:hover, .btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn { white-space: nowrap; }
.btn.ghost { background: #fff; color: var(--brand); border: 1.5px solid var(--brand-line); height: 40px; padding: 0 14px; font-size: 14px; }
.btn.ghost:hover { background: var(--brand-soft); }
.textbtn { background: none; border: 0; padding: 6px 0; color: var(--muted); font: inherit; font-size: 13.5px; cursor: pointer; text-decoration: underline; }
#oneri:empty { display: none; }
#oneri { margin-top: 8px; }
.results { list-style: none; margin: 0; padding: 0; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.results li + li { border-top: 1px solid var(--line); }
.results a { display: flex; align-items: center; gap: 12px; padding: 14px 16px; color: var(--text); font-weight: 600; font-size: 17px; }
.results a:hover { background: var(--brand-soft); text-decoration: none; }
.results .chev { margin-left: auto; }
.result-type { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--brand); background: var(--brand-soft); padding: 3px 8px; border-radius: 6px; }

/* number plate */
.plate {
  display: inline-flex; align-items: center; justify-content: center; min-width: 84px; height: 60px; padding: 0 14px;
  background: var(--brand); color: #fff; border-radius: 14px; font-size: 30px; font-weight: 800;
  letter-spacing: 0.04em; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.plate.line { background: #fff; color: var(--brand-dark); border: 2px solid var(--brand); font-size: 26px; letter-spacing: 0; }
.plate.sm { min-width: 52px; height: 30px; padding: 0 8px; border-radius: 8px; font-size: 15px; font-weight: 700; vertical-align: middle; }

/* hero */
.hero { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 2px 2px 0; }
.hero-main { display: flex; align-items: center; gap: 14px; min-width: 0; }
.hero > form, .hero > .pill { flex: none; }
.hero-text { display: flex; flex-direction: column; min-width: 0; }
.hero-line { font-size: 22px; font-weight: 800; line-height: 1.2; }
.hero-line.plain { color: var(--text); }
.hero-sub { color: var(--muted); font-size: 14px; }
.pill { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-dark); font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }

/* week switcher */
.seg { display: flex; gap: 6px; background: #e4e8f3; padding: 4px; border-radius: 12px; }
.seg a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 44px; padding: 4px 6px; border-radius: 9px; color: var(--muted); font-weight: 700; font-size: 14px; text-align: center; line-height: 1.2; }
.seg a small { font-size: 11.5px; font-weight: 500; }
.seg a:hover { text-decoration: none; background: rgba(255, 255, 255, 0.6); }
.seg a.on { background: #fff; color: var(--brand-dark); box-shadow: 0 1px 3px rgba(28, 34, 51, 0.12); }

/* day strip */
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.day { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px 2px; background: #fff; border: 1.5px solid var(--line); border-radius: 12px; color: var(--text); min-width: 0; }
.day:hover { text-decoration: none; border-color: var(--brand-line); }
.day-name { font-size: 12px; font-weight: 600; color: var(--muted); }
.day-num { font-size: 17px; font-weight: 800; line-height: 1.1; }
.day-val { font-size: 12px; font-weight: 700; color: var(--brand-dark); font-variant-numeric: tabular-nums; }
.day.rest { background: var(--rest-soft); border-color: var(--rest-line); }
.day.rest .day-val { color: var(--rest); }
.day.today .day-name { color: var(--brand); }
.day.today .day-name::after { content: " •"; }
.day.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.day.on .day-name, .day.on .day-val { color: #e3e7fb; }
.day.on.rest { background: var(--rest); border-color: var(--rest); }
.days.plain .day { padding: 9px 2px; }

/* selected day */
.first { display: grid; grid-template-columns: auto 1fr; column-gap: 14px; align-items: center; background: var(--brand-soft); border-radius: 12px; padding: 12px 14px; }
.first-label { grid-column: 1 / -1; font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--brand-dark); }
.first-time { font-size: 40px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--brand-dark); }
.first-place { font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.bigline { font-size: 32px; font-weight: 800; color: var(--rest); line-height: 1.2; }
.daycard.rest { background: var(--rest-soft); box-shadow: none; border: 1.5px solid var(--rest-line); }
.sub-title { font-size: 14px; font-weight: 700; color: var(--muted); margin: 16px 0 8px; }
.daycard .muted.small { margin-top: 12px; }

.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; padding: 0 4px; }
table { border-collapse: collapse; width: 100%; }
.trips th, .trips td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); font-size: 15px; vertical-align: top; }
.trips th { font-size: 12.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; border-bottom: 2px solid var(--line); }
.trips td.time { font-weight: 700; font-size: 17px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.trips td:not(.time) { color: var(--muted); font-size: 14px; }
.trips tr:last-child td { border-bottom: 0; }
.data th, .data td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: top; }
.data th { font-size: 12.5px; color: var(--muted); white-space: nowrap; }

/* lists */
.rows, .queue, .notes { list-style: none; margin: 0; padding: 0; }
.rows li + li, .queue li + li { border-top: 1px solid var(--line); }
.rows a { display: flex; align-items: center; gap: 10px; padding: 13px 2px; color: var(--text); }
.rows a:hover, .queue a:hover { text-decoration: none; background: var(--brand-soft); }
.rows-main { flex: 1; font-weight: 600; min-width: 0; }
.rows-val { font-weight: 800; color: var(--brand-dark); white-space: nowrap; }
.queue a { display: grid; grid-template-columns: 62px 1fr auto; align-items: center; gap: 10px; padding: 10px 2px; color: var(--text); }
.queue-time { font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums; }
.queue-place { font-size: 14px; color: var(--muted); min-width: 0; overflow-wrap: anywhere; }
.notes li { padding: 6px 0; font-size: 14.5px; }
.notes li + li { border-top: 1px solid var(--line); }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.tight { gap: 6px; }
.chip { display: inline-flex; align-items: center; justify-content: center; min-width: 54px; height: 40px; padding: 0 10px; background: #fff; border: 1.5px solid var(--line); border-radius: 10px; color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
.chip:hover { text-decoration: none; border-color: var(--brand); background: var(--brand-soft); }
.chip.line { min-width: 62px; height: 44px; font-size: 17px; color: var(--brand-dark); border-color: var(--brand-line); }
.chip.rest { background: var(--rest-soft); border-color: var(--rest-line); color: var(--rest); }
.chip.me { background: var(--brand); border-color: var(--brand); color: #fff; }
.chips.tight .chip { min-width: 48px; height: 36px; padding: 0 6px; font-size: 15px; }
.group-title { font-size: 12.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin: 14px 0 8px; }
.card-head + .group-title { margin-top: 0; }

/* my vehicle on home */
.twodays { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.daybox { display: flex; flex-direction: column; gap: 2px; padding: 12px; border-radius: 12px; background: var(--brand-soft); color: var(--text); min-width: 0; }
.daybox:hover { text-decoration: none; background: #dfe4f6; }
.daybox.rest { background: var(--rest-soft); }
.daybox-when { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.daybox-main { font-size: 32px; font-weight: 800; line-height: 1.15; color: var(--brand-dark); font-variant-numeric: tabular-nums; }
.daybox-main.sm { font-size: 22px; }
.daybox.rest .daybox-main { color: var(--rest); }
.daybox-sub { font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
.forget { margin-top: 6px; text-align: right; }

/* week page */
.section-title { font-size: 13px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin: 6px 2px -4px; }
.cols { display: grid; grid-template-columns: 1fr; gap: 12px; align-items: start; }
.col .card-head { margin-bottom: 10px; }
.col .card-head h3 a { color: var(--brand-dark); }
.sub-line { font-size: 13px; font-weight: 700; color: var(--muted); margin: 12px 0 6px; }
.banner { background: var(--brand-soft); color: var(--brand-dark); border-radius: 12px; padding: 11px 14px; font-size: 14.5px; font-weight: 600; }
.banner.warn { background: var(--warn-soft); color: var(--warn); }

/* forms */
.form { display: flex; flex-direction: column; gap: 6px; }
.form label { font-size: 14px; font-weight: 700; margin-top: 8px; }
.form input { height: 48px; padding: 0 12px; font: inherit; border: 1.5px solid var(--brand-line); border-radius: 10px; background: #fff; color: var(--text); }
.form input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(64, 84, 178, 0.15); }
.form .btn { margin-top: 14px; }
.form + .muted { margin-top: 14px; }
.card form + .muted, .card .muted + form { margin-top: 12px; }

/* footer */
.foot { padding: 18px 0 calc(22px + env(safe-area-inset-bottom)); color: var(--muted); font-size: 13px; text-align: center; }
.foot p + p { margin-top: 4px; }

@media (min-width: 620px) {
  .cols { grid-template-columns: repeat(2, 1fr); }
  .day-val { font-size: 13.5px; }
  .day-num { font-size: 19px; }
}

@media (min-width: 900px) {
  .cols { grid-template-columns: repeat(3, 1fr); }
  .main { padding-top: 22px; gap: 16px; }
  .brand-text strong { font-size: 17px; }
  .nav a { font-size: 15px; padding: 9px 14px; }
}

@media (max-width: 380px) {
  .brand-text small { display: none; }
  .nav a { padding: 8px 9px; }
  .first-time { font-size: 34px; }
  .daybox-main { font-size: 27px; }
  .plate { min-width: 72px; height: 54px; font-size: 26px; }
}
