/* Raippa: calm, readable, light and dark. No external fonts or requests. */
:root {
  --bg: #f6f7f9; --card: #ffffff; --ink: #1d232b; --muted: #5d6875; --line: #e2e6eb;
  --accent: #2f6f6a; --accent-ink: #ffffff; --accent-soft: #e4f1ef;
  --ok: #2e7d4f; --warn: #a16207; --err: #b4232c; --radius: 12px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161b; --card: #1a2027; --ink: #e6eaee; --muted: #9aa5b1; --line: #2a323b;
    --accent: #5fb3aa; --accent-ink: #0d1412; --accent-soft: #1d2e2c;
    --ok: #5cc28a; --warn: #e0b04a; --err: #f07178;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--font); }
a { color: var(--accent); }
.wrap { max-width: 960px; margin: 0 auto; padding: 16px; }
header.top { background: var(--card); border-bottom: 1px solid var(--line); }
header.top .wrap { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
.brand { font-weight: 700; font-size: 18px; text-decoration: none; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.brand i { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: var(--accent-ink);
           display: inline-grid; place-items: center; font-style: normal; font-size: 15px; }
nav.main { display: flex; gap: 2px; flex-wrap: wrap; flex: 1; }
nav.main a { text-decoration: none; color: var(--muted); padding: 10px 12px; border-radius: 8px; min-height: 44px; display: inline-flex; align-items: center; }
nav.main a.on, nav.main a:hover { color: var(--ink); background: var(--accent-soft); }
h1 { font-size: 24px; margin: 8px 0 16px; }
h2 { font-size: 18px; margin: 0 0 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 13px; font-weight: 600; background: var(--accent-soft); color: var(--accent); }
.pill.ok { color: var(--ok); } .pill.err { color: var(--err); } .pill.warn { color: var(--warn); }
.btn, button { font: 600 15px var(--font); border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink);
       border-radius: 10px; padding: 10px 16px; min-height: 44px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.btn.ghost, button.ghost { background: transparent; color: var(--accent); }
.btn.danger, button.danger { background: transparent; border-color: var(--err); color: var(--err); }
button:disabled { opacity: .5; cursor: default; }
input[type=text], input[type=time], input[type=date], input[type=number], textarea, select {
  font: 16px var(--font); color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; min-height: 44px; width: 100%; }
textarea { min-height: 110px; resize: vertical; }
label { display: block; font-weight: 600; margin: 12px 0 6px; }
label.inline { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; margin: 6px 12px 6px 0; min-height: 44px; }
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--accent); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > * { flex: 0 0 auto; }
.field2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 13px; }
.flash { background: var(--accent-soft); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; }
.err-text { color: var(--err); }
.center { max-width: 440px; margin: 8vh auto; }
.codes { font: 600 16px ui-monospace, Menlo, Consolas, monospace; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
pre.output { white-space: pre-wrap; font: 15px/1.5 var(--font); background: var(--bg); border-radius: 10px; padding: 14px; margin: 0; }
.sched { display: grid; gap: 10px; grid-template-columns: 1fr; }
.sched form.edit { display: grid; gap: 8px 14px; grid-template-columns: 2fr 1fr; align-items: end; }
.days { display: flex; flex-wrap: wrap; }
@media (max-width: 640px) {
  .field2, .sched form.edit { grid-template-columns: 1fr; }
  table.stack thead { display: none; }
  table.stack td { display: block; border: 0; padding: 4px 0; }
  table.stack tr { display: block; border-bottom: 1px solid var(--line); padding: 8px 0; }
}

/* small utilities (no inline styles: the CSP forbids them) */
.mt { margin-top: 12px; } .mt-s { margin-top: 8px; } .mb { margin-bottom: 12px; } .m0 { margin: 0; }
.wide { width: 100%; justify-content: center; } .span-all { grid-column: 1 / -1; } .narrow { max-width: 240px; }
.meta { margin: 4px 0 8px; } .between { justify-content: space-between; } .inline-form { display: inline; }
.mono-big { font: 600 22px ui-monospace, Menlo, Consolas, monospace; } .big-number { font-size: 28px; margin: 4px 0; }
.cal-row { justify-content: space-between; border-bottom: 1px solid var(--line); padding: 4px 0; }
.cal-row select { width: auto; min-width: 150px; }
.cal-name { flex: 1 1 160px; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
pre.small { white-space: pre-wrap; background: var(--bg); border-radius: 10px; padding: 10px; }
.stats { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin: 8px 0 12px; }
.stats .big-number { font-size: 28px; }
.mb0 { margin-bottom: 0; }
.flash.warn { border-color: var(--warn); }
.flash.err { border-color: var(--err); }
.card p.m0 + p.m0 { margin-top: 4px; }
/* routing_tool additions */
.grow { flex: 1 1 200px; }
.chips { gap: 6px; }
.chip { padding: 6px 10px; font-size: 14px; }
.map { height: 65vh; min-height: 320px; border-radius: var(--radius); border: 1px solid var(--line); }
.wrap-any { overflow-wrap: anywhere; }
.result { padding: 14px; margin-bottom: 10px; }
.flash.warn { border-color: var(--warn); }
.flash.err { border-color: var(--err); }
.m0 { margin: 0; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
.small-btn { padding: 4px 10px; font-size: 13px; }
.keys td { vertical-align: top; }

/* costs */
.meter { height: 6px; background: var(--line); border-radius: 3px; margin-top: 8px; overflow: hidden; }
.meter-fill { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.meter-fill.w0 { width: 0%; }
.meter-fill.w5 { width: 5%; }
.meter-fill.w10 { width: 10%; }
.meter-fill.w15 { width: 15%; }
.meter-fill.w20 { width: 20%; }
.meter-fill.w25 { width: 25%; }
.meter-fill.w30 { width: 30%; }
.meter-fill.w35 { width: 35%; }
.meter-fill.w40 { width: 40%; }
.meter-fill.w45 { width: 45%; }
.meter-fill.w50 { width: 50%; }
.meter-fill.w55 { width: 55%; }
.meter-fill.w60 { width: 60%; }
.meter-fill.w65 { width: 65%; }
.meter-fill.w70 { width: 70%; }
.meter-fill.w75 { width: 75%; }
.meter-fill.w80 { width: 80%; }
.meter-fill.w85 { width: 85%; }
.meter-fill.w90 { width: 90%; }
.meter-fill.w95 { width: 95%; }
.meter-fill.w100 { width: 100%; }
.chart-wrap { width: 100%; }
.chart { width: 100%; height: 170px; display: block; }
.chart .bar { fill: var(--accent); }
.chart .hit { fill: transparent; }
.chart .day:hover .bar { opacity: .7; }
.chart .future .hit { fill: var(--line); opacity: .25; }
.chart .baseline { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; }

/* map legend */
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 8px 0; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 18px; height: 10px; border-radius: 3px; border: 2px solid; }
.sw-closed { border-color: #c62828; background: rgba(198, 40, 40, .45); }
.sw-speed { border-color: #f9a825; background: rgba(249, 168, 37, .4); }
.sw-rw { border-color: #ef6c00; border-style: dashed; background: rgba(239, 108, 0, .35); }
.sw-lam { border-color: #6a1b9a; background: rgba(106, 27, 154, .3); }
.sw-kunta { height: 0; border-width: 1px 0 0; border-color: #455a64; }
.sw-maakunta { height: 0; border-width: 3px 0 0; border-color: #1565c0; }
.sw-hva { height: 0; border-width: 2px 0 0; border-style: dashed; border-color: #2e7d32; }
