:root {
  color-scheme: light dark;
  --bg: #eceff1; --card: #fff; --ink: #14181d; --muted: #5a656f; --line: #d8dee2;
  --action: #14181d; --on-action: #fff; --ok: #17693f; --warn: #8a4b00; --danger: #b3261e;
  --sign: #14181d; --led: #ffc247;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1013; --card: #1b2026; --ink: #eef1f3; --muted: #9da8b2; --line: #303840;
    --action: #ffc247; --on-action: #14181d; --ok: #6fd39c; --warn: #ffb45c; --danger: #ff8a80;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 17px/1.4 system-ui, sans-serif; font-variant-numeric: tabular-nums;
  -webkit-text-size-adjust: 100%;
}
h1, h2, p { margin: 0; }
a { color: inherit; }

header {
  background: var(--sign); color: #fff;
  padding: calc(env(safe-area-inset-top) + 20px) max(20px, calc(50% - 280px)) 20px;
  display: flex; justify-content: space-between; align-items: flex-end; gap: 16px;
}
.label { font-size: 14px; color: #b6c0c9; }
.right { text-align: right; }
.sign { font-size: 40px; font-weight: 700; line-height: 1.15; color: var(--led); }
.sign.none { font-size: 20px; line-height: 2.3; }
.sign sup { font-size: .55em; vertical-align: top; position: relative; top: .1em; line-height: 1; }
.sum { font-size: 24px; font-weight: 600; line-height: 1.6; white-space: nowrap; }

main {
  max-width: 600px; margin: 0 auto; padding: 16px 16px calc(env(safe-area-inset-bottom) + 24px);
  display: grid; gap: 24px;
}
.card { background: var(--card); border-radius: 14px; padding: 16px; }
form { display: grid; gap: 14px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
label { display: grid; gap: 4px; font-size: 14px; color: var(--muted); min-width: 0; }
input {
  appearance: none; -webkit-appearance: none; width: 100%; min-width: 0; height: 48px; padding: 0 12px;
  font: inherit; font-size: 17px; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; text-align: left;
}
input::-webkit-date-and-time-value { text-align: left; }
button, nav a {
  min-height: 48px; padding: 0 16px; font: inherit; font-weight: 600; color: var(--ink);
  background: none; border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
}
button.primary { background: var(--action); color: var(--on-action); border-color: var(--action); }
button.danger { color: var(--danger); }
button:disabled { opacity: .5; }
:focus-visible { outline: 3px solid #3c8dde; outline-offset: 2px; }

#months { display: grid; gap: 24px; }
.month-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 0 4px 8px; }
.month-head h2 { font-size: 20px; }
.month-head p { font-weight: 600; white-space: nowrap; }
.month .card { padding: 0 16px; }
.trip {
  display: grid; grid-template-columns: 1fr auto; gap: 0 12px; width: 100%; padding: 12px 0;
  text-align: left; font-weight: 400; border: 0; border-bottom: 1px solid var(--line); border-radius: 0;
}
.trip:disabled { opacity: 1; cursor: default; }
.trip b { font-weight: 600; }
.trip small { font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.trip > :nth-child(even) { text-align: right; white-space: nowrap; }
.trip .badge { grid-column: 1 / -1; text-align: left; color: var(--warn); }
.status { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 56px; font-size: 15px; }
.status button { min-height: 44px; padding: 0; border: 0; text-decoration: underline; text-underline-offset: 3px; font-size: 15px; }
.paid { color: var(--ok); font-weight: 600; }
.total { text-align: center; font-weight: 600; }
.empty { text-align: center; color: var(--muted); }

nav { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
nav a { display: grid; place-items: center; text-decoration: none; }
footer, .hint { font-size: 14px; color: var(--muted); }
footer { text-align: center; }

dialog {
  width: min(100% - 32px, 420px); padding: 20px; border: 0; border-radius: 16px;
  background: var(--card); color: var(--ink);
}
dialog::backdrop { background: rgb(0 0 0 / .5); }
dialog h2 { font-size: 20px; }
.login { max-width: 340px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 18vh) 20px 20px; }

#toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 20px); transform: translateX(-50%);
  width: max-content; max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 10px;
  background: #14181d; color: #fff; border: 1px solid #47525c; visibility: hidden;
}
#toast.show { visibility: visible; }
#toast.error { background: #8f1d17; border-color: #8f1d17; }
