/* RoboGrasClippen - mobile first. Tone is always shown by text/icon as well as colour. */
:root {
  --bg: #f3f6f0; --card: #ffffff; --ink: #1c2a19; --muted: #5d6b58; --line: #dde5d7;
  --brand: #2f5d2a; --brand-ink: #ffffff;
  --ok: #1f6b2c; --ok-bg: #e2f2e0; --info: #2b4f73; --info-bg: #e3edf7;
  --warn: #7a5200; --warn-bg: #fdf0d2; --bad: #9b1c12; --bad-bg: #fbe1dd;
  --c0: #3f8f3a; --c1: #2f6fa8; --c2: #b06b14; --c3: #7c4fa8; --c4: #1e8a86; --c5: #a8324f;
  --radius: 14px; --tab-h: 64px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111610; --card: #1b221a; --ink: #e6eee2; --muted: #9fae99; --line: #2c3729;
    --brand: #79b86f; --brand-ink: #0d140c;
    --ok: #8fd486; --ok-bg: #1f3a1c; --info: #9cc3ec; --info-bg: #1b2a3b;
    --warn: #f2c56b; --warn-bg: #3a2d10; --bad: #ff9a8c; --bad-bg: #3d1a16;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif; }
.wrap { max-width: 720px; margin: 0 auto; padding: max(16px, env(safe-area-inset-top)) 16px calc(var(--tab-h) + 24px + env(safe-area-inset-bottom)); }
h1 { font-size: 1.6rem; margin: 4px 0 4px; }
h2 { font-size: 1.2rem; margin: 0 0 6px; }
h3 { font-size: 1.02rem; margin: 12px 0 6px; }
p { margin: 6px 0; }
a { color: var(--brand); }
.muted { color: var(--muted); font-size: .92em; }
.small { font-size: .88rem; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 12px 0; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.top p { margin: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid2 .card { margin: 0; }
.tile { display: flex; flex-direction: column; gap: 4px; }
.tile .label { color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; }
.tile .big { font-size: 1.7rem; font-weight: 650; }
meter { width: 100%; height: 12px; }

.status { display: flex; gap: 14px; align-items: flex-start; border-width: 2px; }
.status h2 { font-size: 1.45rem; margin: 0; }
.status-icon { flex: none; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-size: 1.5rem; font-weight: 700; }
.status.t-ok   { border-color: var(--ok); }   .status.t-ok   .status-icon { background: var(--ok-bg); color: var(--ok); }
.status.t-info { border-color: var(--info); } .status.t-info .status-icon { background: var(--info-bg); color: var(--info); }
.status.t-warn { border-color: var(--warn); } .status.t-warn .status-icon { background: var(--warn-bg); color: var(--warn); }
.status.t-bad  { border-color: var(--bad); }  .status.t-bad  .status-icon { background: var(--bad-bg); color: var(--bad); }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .85rem; font-weight: 600; }
.badge.block { display: block; border-radius: 10px; padding: 8px 12px; }
.t-ok.badge { background: var(--ok-bg); color: var(--ok); }
.t-info.badge { background: var(--info-bg); color: var(--info); }
.t-warn.badge { background: var(--warn-bg); color: var(--warn); }
.t-bad.badge { background: var(--bad-bg); color: var(--bad); }
.hint { background: var(--info-bg); color: var(--info); padding: 10px 12px; border-radius: 10px; }

.facts { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; gap: 8px 12px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 16px; border-radius: 12px;
       border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn.small { min-height: 38px; padding: 0 12px; font-size: .92rem; }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); width: 100%; }
.btn:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }

.seg-ctl { display: flex; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 4px; gap: 4px; margin: 8px 0 4px; }
.seg-ctl a { flex: 1; text-align: center; padding: 9px 6px; border-radius: 9px; text-decoration: none; color: var(--muted); font-weight: 600; }
.seg-ctl a[aria-current] { background: var(--brand); color: var(--brand-ink); }

.inbox, .plain { list-style: none; padding: 0; margin: 0; }
ol.plain { list-style: decimal; padding-left: 1.3em; }
.plain li { margin: 6px 0; }
.inbox .card { display: flex; flex-direction: column; gap: 4px; }
.inbox .btn { align-self: flex-start; margin-top: 4px; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--line); }
.timeline time { font-weight: 600; min-width: 7.5em; }
.timeline .gap { color: var(--warn); font-style: italic; }

table.list { width: 100%; border-collapse: collapse; font-size: .95rem; }
table.list th, table.list td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list th { color: var(--muted); font-weight: 600; }

/* schedule week */
.week { display: flex; flex-direction: column; gap: 6px; }
.week-hours { display: flex; justify-content: space-between; margin-left: 44px; color: var(--muted); font-size: .75rem; }
.week-row { display: flex; align-items: center; gap: 8px; }
.week-day { width: 36px; font-weight: 600; font-size: .9rem; }
.week-row.today .week-day { color: var(--brand); text-decoration: underline; }
.week-track { position: relative; flex: 1; height: 34px; background: var(--bg); border-radius: 8px; overflow: hidden; }
.seg { position: absolute; top: 3px; bottom: 3px; border-radius: 6px; color: #fff; font-size: .72rem; font-weight: 600; padding: 0 5px;
       white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 28px; }
.now { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--bad); }
.c0 { background: var(--c0); } .c1 { background: var(--c1); } .c2 { background: var(--c2); }
.c3 { background: var(--c3); } .c4 { background: var(--c4); } .c5 { background: var(--c5); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }

/* maps */
.map-card { padding: 10px; }
.sitemap { width: 100%; height: auto; max-height: 75vh; display: block; }
.sitemap .wa { fill: rgba(63,143,58,.35); stroke: #3f8f3a; stroke-width: 2; }
.sitemap .so { fill: rgba(200,50,40,.35); stroke: #c83228; stroke-width: 2; }
.sitemap .tp { fill: none; stroke: #2f6fa8; stroke-width: 3; stroke-dasharray: 6 4; }
.sitemap .cs { fill: none; stroke: #d9a400; stroke-width: 5; }
.sitemap .ot { fill: none; stroke: #888; stroke-width: 1; }
.sitemap .lbl { fill: var(--ink); text-anchor: middle; font-weight: 600; paint-order: stroke; stroke: var(--card); stroke-width: 3px; }
.gpsmap { height: 62vh; min-height: 320px; border-radius: 10px; }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 0; margin: 10px 4px 4px; font-size: .88rem; }
.sw { display: inline-block; width: 14px; height: 14px; border-radius: 3px; margin-right: 6px; vertical-align: -2px; }
.sw.wa { background: rgba(63,143,58,.5); border: 2px solid #3f8f3a; }
.sw.so { background: rgba(200,50,40,.5); border: 2px solid #c83228; }
.sw.tp { border-top: 3px dashed #2f6fa8; height: 0; }
.sw.cs { background: #d9a400; }
.sw.trail { background: #2f5d2a; border-radius: 50%; }
.sw.fault { background: #e2553f; border: 2px solid #a3261b; border-radius: 50%; }

/* login */
.login { max-width: 380px; margin: 8vh auto 0; text-align: center; }
.login form { text-align: left; display: flex; flex-direction: column; gap: 12px; }
label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; }
input { font: inherit; padding: 10px 12px; min-height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }

/* bottom tab bar */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-around; background: var(--card);
          border-top: 1px solid var(--line); padding: 4px 4px env(safe-area-inset-bottom); z-index: 1000; }
.tabbar a { flex: 1; max-width: 110px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0;
            min-height: calc(var(--tab-h) - 8px); color: var(--muted); text-decoration: none; font-size: .72rem; font-weight: 600; }
.tabbar svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a[aria-current] { color: var(--brand); }
.tabbar a[aria-current] svg { stroke-width: 2.4; }

@media (min-width: 720px) { body { font-size: 18px; } }

/* site-map overlays and area numbers */
.sitemap .num circle:not(.ring) { fill: var(--card); stroke: #2f5d2a; stroke-width: 1.5px; vector-effect: non-scaling-stroke; }
.sitemap .num text { fill: var(--ink); text-anchor: middle; font-weight: 700; }
.sitemap .trail { fill: none; stroke: #1c2a19; stroke-width: 1.5; opacity: .55; }
.sitemap .tdot { fill: #1c2a19; opacity: .5; }
.sitemap .me { fill: #2f5d2a; stroke: #fff; stroke-width: 2px; vector-effect: non-scaling-stroke; }
.sitemap .fault { stroke: #fff; stroke-width: 1.5px; vector-effect: non-scaling-stroke; cursor: pointer; }
.sitemap .fault.t-bad { fill: #c8321f; } .sitemap .fault.t-warn { fill: #e0a100; } .sitemap .fault.t-info { fill: #3b78b5; }
.sitemap .fault.sel { stroke: #000; stroke-width: 3px; }
@media (prefers-color-scheme: dark) { .sitemap .trail, .sitemap .tdot { stroke: #e6eee2; fill: #e6eee2; } }
.key { columns: 2; column-gap: 18px; margin: 0; padding-left: 1.8em; }
.key li { break-inside: avoid; margin: 3px 0; }
.key li::marker { font-weight: 700; color: var(--brand); }
.anum { display: inline-grid; place-items: center; min-width: 1.7em; height: 1.7em; border-radius: 50%; border: 2px solid var(--brand); color: var(--brand); font-weight: 700; font-size: .85em; margin-right: 6px; }
.sitemap .num { pointer-events: none; }
.sitemap .num .ring { fill: none; stroke: #1f8a3a; vector-effect: none; }
meter.inline { width: 70px; height: 10px; vertical-align: middle; }
.status > div:last-child { flex: 1; }
.pill-meter { width: 100%; height: 14px; margin-top: 6px; }
/* history feed */
.day { font-size: 1rem; color: var(--muted); margin: 18px 0 6px; text-transform: uppercase; letter-spacing: .04em; }
.feed { list-style: none; padding: 0; margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.feed li { display: flex; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.feed li:last-child { border-bottom: 0; }
.feed time { flex: none; width: 4.6em; font-variant-numeric: tabular-nums; color: var(--muted); font-size: .9rem; padding-top: 2px; }
.feed li > div { flex: 1; min-width: 0; }
.feed .ev { border-left: 4px solid transparent; }
.feed .ev.t-bad { border-left-color: var(--bad); } .feed .ev.t-warn { border-left-color: var(--warn); }
.feed .ev-done { background: var(--ok-bg); }
.feed .btn { margin-top: 6px; }
.feed .gap { color: var(--warn); font-style: italic; font-size: .9rem; }
