:root {
  --bg: #f5f6f8; --card: #fff; --text: #16181d; --muted: #667085; --line: #e3e6ea;
  --accent: #1f5fbf; --work: #1f7a4d; --work-bg: #e3f4ea; --private: #8a4b0f; --private-bg: #fcefdc;
  --danger: #b42318;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111317; --card: #1b1e24; --text: #e8eaed; --muted: #98a2b3; --line: #2c313a;
    --accent: #6ea1ff; --work: #6fd3a0; --work-bg: #173327; --private: #f5b870; --private-bg: #3a2a15;
  }
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
header { display: flex; align-items: center; gap: 16px; padding: 10px 16px; background: var(--card);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
nav { display: flex; gap: 4px; flex-wrap: wrap; }
nav a { padding: 6px 10px; border-radius: 6px; color: var(--text); text-decoration: none; }
nav a.active { background: var(--bg); font-weight: 600; }
.spacer { flex: 1; }
main { max-width: 1000px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.narrow { max-width: 360px; margin: 10vh auto; }
h1 { font-size: 22px; margin: 0 0 12px; } h2 { font-size: 18px; margin: 0 0 12px; }
label { display: block; margin-bottom: 10px; font-size: 14px; color: var(--muted); }
input, select, textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px;
  font: inherit; background: var(--card); color: var(--text); margin-top: 3px; }
button { font: inherit; padding: 8px 14px; border-radius: 6px; border: 1px solid var(--accent);
  background: var(--accent); color: #fff; cursor: pointer; }
button.secondary { background: transparent; color: var(--accent); }
button.link { background: none; border: none; color: var(--accent); padding: 4px; }
button:disabled { opacity: .5; cursor: default; }
.muted { color: var(--muted); font-size: 13px; }
.error { color: var(--danger); min-height: 1.2em; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.monthbar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.monthbar .title { font-size: 18px; font-weight: 600; min-width: 150px; text-align: center; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.stat .v { font-size: 22px; font-weight: 600; } .stat .l { color: var(--muted); font-size: 13px; }
.banner { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; background: var(--private-bg); color: var(--private); }
.day { font-weight: 600; margin: 16px 0 6px; color: var(--muted); font-size: 13px; text-transform: capitalize; }
.trip { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--work);
  border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.trip.private { border-left-color: var(--private); }
.trip .top { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.trip .time { font-weight: 600; } .trip .km { margin-left: auto; font-weight: 600; }
.trip .route { margin: 4px 0 8px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button { border: none; border-radius: 0; background: transparent; color: var(--muted); padding: 5px 12px; }
.seg button.on.work { background: var(--work-bg); color: var(--work); font-weight: 600; }
.seg button.on.private { background: var(--private-bg); color: var(--private); font-weight: 600; }
.purpose { flex: 1; min-width: 180px; margin-top: 0; }
.tag { font-size: 12px; padding: 1px 6px; border-radius: 4px; background: var(--bg); color: var(--muted); }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 13px; }
td.num, th.num { text-align: right; white-space: nowrap; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
