/* Optura Bedieningspaneel. Brand: spruce #12302A, chalk #F4F6F1, pollen #F2B705; Bricolage Grotesque 800 (wordmark),
   Hanken Grotesk (text). Phone first; desktop layout from 900 px. Light and dark (system, or the toggle). */
:root {
  --spruce: #12302A; --chalk: #F4F6F1; --pollen: #F2B705;
  --bg: #F4F6F1; --surface: #ffffff; --surface-2: #eef2ec; --text: #12302A; --muted: #4f625b; --border: #d6ded7;
  --accent: #12302A; --accent-text: #F4F6F1; --link: #1d6b52;
  --green: #23824f; --green-bg: #e3f3e9; --orange: #a35f00; --orange-bg: #fdf0d8; --red: #b4261a; --red-bg: #fbe4e1;
  --grey: #66756f; --grey-bg: #eceeec;
  --p0: #c0392b; --p1: #d9730d; --p2: #c9a300; --p3: #3f7cc0; --p4: #8a948f;
  --hans: #7b3fb5; --hans-bg: #f2e9fb;
  --shadow: 0 1px 2px rgba(18, 48, 42, .06), 0 2px 8px rgba(18, 48, 42, .05);
  --top: 56px; --navh: 64px; --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c1c18; --surface: #132a25; --surface-2: #1a3530; --text: #F4F6F1; --muted: #a9bbb4; --border: #2b4a43;
    --accent: #F2B705; --accent-text: #12302A; --link: #8fd6b5;
    --green: #5fd193; --green-bg: #173a2b; --orange: #f3ad4e; --orange-bg: #3b2d14; --red: #ff8a7d; --red-bg: #43201c;
    --grey: #a0aca7; --grey-bg: #243530; --hans: #c9a2f0; --hans-bg: #2e2140;
    --p0: #ff7b6e; --p1: #f5a04a; --p2: #e8cc3a; --p3: #7fb2ee; --p4: #a5aea9;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c1c18; --surface: #132a25; --surface-2: #1a3530; --text: #F4F6F1; --muted: #a9bbb4; --border: #2b4a43;
  --accent: #F2B705; --accent-text: #12302A; --link: #8fd6b5;
  --green: #5fd193; --green-bg: #173a2b; --orange: #f3ad4e; --orange-bg: #3b2d14; --red: #ff8a7d; --red-bg: #43201c;
  --grey: #a0aca7; --grey-bg: #243530; --hans: #c9a2f0; --hans-bg: #2e2140;
  --p0: #ff7b6e; --p1: #f5a04a; --p2: #e8cc3a; --p3: #7fb2ee; --p4: #a5aea9;
  --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  overflow-x: hidden;
}
a { color: var(--link); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; overflow-wrap: anywhere; }
h1 { font-size: 1.35rem; } h2 { font-size: 1.1rem; } h3 { font-size: 1rem; }
.muted { color: var(--muted); } .small { font-size: .85rem; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* Lockup: mark 1.05x wordmark, lowercase optura in Bricolage 800, product name in Hanken. */
.lockup { display: flex; align-items: center; gap: .45rem; color: var(--text); text-decoration: none; min-width: 0; }
.mark { width: 1.6rem; height: 1.45rem; flex: none; color: var(--text); }
.wordmark { font-family: "Bricolage Grotesque", system-ui, sans-serif; font-weight: 800; font-size: 1.5rem; letter-spacing: -.02em; line-height: 1; }
.product { font-weight: 500; font-size: 1rem; margin-left: .35rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lockup-stacked { flex-direction: column; text-align: center; gap: .4rem; }
.lockup-stacked .mark { width: 3.3rem; height: 3rem; }
.lockup-stacked .wordmark { font-size: 2.2rem; display: block; }
.lockup-stacked .product { display: block; margin: .2rem 0 0; }

/* Login */
.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 24px 20px; box-shadow: var(--shadow); display: grid; gap: .55rem; }
.login-card label { font-weight: 600; font-size: .9rem; margin-top: .3rem; }
input, select { font: inherit; font-size: 16px; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: .7rem .8rem; width: 100%; min-height: 46px; }
input:focus-visible, button:focus-visible, a:focus-visible, select:focus-visible { outline: 3px solid var(--pollen); outline-offset: 2px; }
.btn { border: 0; border-radius: 10px; padding: .75rem 1rem; min-height: 46px; font-weight: 700; cursor: pointer; }
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-quiet { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn:disabled { opacity: .6; cursor: wait; }
.form-error { background: var(--red-bg); color: var(--red); border-radius: 10px; padding: .6rem .75rem; margin: .2rem 0; font-weight: 600; }

/* Shell */
.topbar { position: sticky; top: 0; z-index: 30; height: var(--top); display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: 0 12px; padding-top: env(safe-area-inset-top); background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar .wordmark { font-size: 1.35rem; }
.topbar-right { display: flex; align-items: center; gap: .35rem; position: relative; flex: none; }
.icon-btn { display: inline-grid; place-items: center; color: var(--text); width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-size: 1.05rem; }
.pill { border: 1px solid var(--border); border-radius: 999px; padding: .3rem .65rem; font-size: .8rem; font-weight: 600; background: var(--grey-bg); color: var(--grey); cursor: pointer; white-space: nowrap; min-height: 32px; }
.pill.ok { background: var(--green-bg); color: var(--green); border-color: transparent; }
.pill.bad { background: var(--red-bg); color: var(--red); border-color: transparent; }
.menu { position: absolute; right: 0; top: 46px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.15); min-width: 220px; padding: .4rem; display: grid; z-index: 40; }
.menu a, .menu button { text-align: left; padding: .7rem .75rem; border-radius: 8px; border: 0; background: none; text-decoration: none; color: var(--text); cursor: pointer; min-height: 44px; }
.menu a:hover, .menu button:hover { background: var(--surface-2); }
.menu-who { padding: .5rem .75rem; font-size: .85rem; color: var(--muted); border-bottom: 1px solid var(--border); margin-bottom: .3rem; overflow-wrap: anywhere; }
.banner { position: sticky; top: var(--top); z-index: 25; padding: .6rem 16px; background: var(--red-bg); color: var(--red); font-weight: 600; font-size: .9rem; border-bottom: 1px solid var(--border); }
.banner.warn { background: var(--orange-bg); color: var(--orange); }

.nav { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; height: calc(var(--navh) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); display: grid; grid-template-columns: repeat(5, 1fr); background: var(--surface); border-top: 1px solid var(--border); }
.nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; color: var(--muted); font-size: .72rem; font-weight: 600; min-width: 0; }
.nav a span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-ico { font-size: 1.15rem; line-height: 1; }
.nav a.active { color: var(--text); }
.nav a.active .nav-ico { color: var(--pollen); }
.main { padding: 16px 16px calc(var(--navh) + 24px + env(safe-area-inset-bottom)); max-width: 1680px; margin: 0 auto; outline: none; }

/* Cards and grids */
.view-head { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin-bottom: .75rem; }
.grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); min-width: 0; }
.card h2 { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.count { font-size: .8rem; font-weight: 700; background: var(--surface-2); border-radius: 999px; padding: .05rem .5rem; color: var(--muted); }
.empty { color: var(--muted); padding: .4rem 0; }
.rows { display: grid; gap: 10px; }
.row { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: var(--bg); min-width: 0; }
.row-head { display: flex; align-items: flex-start; gap: .55rem; min-width: 0; }
.row-title { font-weight: 650; overflow-wrap: anywhere; min-width: 0; flex: 1; }
.row-meta { color: var(--muted); font-size: .85rem; margin-top: .25rem; overflow-wrap: anywhere; display: flex; flex-wrap: wrap; gap: .25rem .75rem; }
.row a { overflow-wrap: anywhere; }
.dot { width: .8rem; height: .8rem; border-radius: 50%; flex: none; margin-top: .3rem; background: var(--grey); }
.dot.green { background: var(--green); } .dot.orange { background: var(--orange); } .dot.red { background: var(--red); } .dot.grey { background: var(--grey); }
.row.red { border-color: var(--red); background: var(--red-bg); }
.row.orange { border-color: var(--orange); background: var(--orange-bg); }
.tag { display: inline-flex; align-items: center; font-size: .75rem; font-weight: 700; border-radius: 6px; padding: .05rem .4rem; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.tag.P0 { background: var(--p0); color: #fff; } .tag.P1 { background: var(--p1); color: #fff; } .tag.P2 { background: var(--p2); color: #12302A; }
.tag.P3 { background: var(--p3); color: #fff; } .tag.P4 { background: var(--p4); color: #fff; }
.tag.hans { background: var(--hans-bg); color: var(--hans); }
.tag.closed { background: var(--green-bg); color: var(--green); }

/* Waiting on Hans */
.hans-card { border-color: var(--hans); }
.hans-row { border-left: 4px solid var(--hans); }
.hans-row .row-title { font-weight: 500; }
.hans-row.done { opacity: .65; border-left-color: var(--green); }
.cellbox p { margin: 0; }

/* Releases (R-3) */
.release-time { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.bar { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; margin-top: .45rem; }
.bar > i { display: block; height: 100%; background: var(--green); }
.row.orange .bar > i { background: var(--orange); } .row.red .bar > i { background: var(--red); }

/* Health */
.health-group { margin-bottom: 14px; }
.health-group h3 { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; margin: 0 0 .4rem; }
.summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.sum { border-radius: 10px; padding: .55rem .6rem; text-align: center; font-weight: 700; }
.sum b { display: block; font-size: 1.4rem; line-height: 1.1; }
.sum.green { background: var(--green-bg); color: var(--green); } .sum.orange { background: var(--orange-bg); color: var(--orange); } .sum.red { background: var(--red-bg); color: var(--red); }

/* Modules */
.ring { margin-bottom: 18px; }
.ring h2 { font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.tiles { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tile { display: block; text-align: left; border: 1px solid var(--border); border-left: 6px solid var(--p4); border-radius: 12px; background: var(--surface); padding: 10px 12px; cursor: pointer; text-decoration: none; color: var(--text); min-height: 76px; min-width: 0; box-shadow: var(--shadow); }
.tile.P0 { border-left-color: var(--p0); } .tile.P1 { border-left-color: var(--p1); } .tile.P2 { border-left-color: var(--p2); } .tile.P3 { border-left-color: var(--p3); }
.tile.none { border-left-color: var(--green); }
.tile.active { outline: 3px solid var(--pollen); outline-offset: 1px; }
.tile-name { font-weight: 700; overflow-wrap: anywhere; }
.tile-meta { font-size: .8rem; color: var(--muted); margin-top: .2rem; display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.cat-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cat-tiles .tile { min-height: 60px; }
.back { display: inline-flex; align-items: center; gap: .3rem; margin-bottom: .6rem; min-height: 44px; padding: .4rem .7rem; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.seg button { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: .45rem .9rem; min-height: 40px; cursor: pointer; font-weight: 600; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

/* Plan */
.search { margin-bottom: 12px; }
.outline { display: grid; gap: 6px; }
.sec-btn { display: flex; gap: .5rem; align-items: flex-start; width: 100%; text-align: left; border: 1px solid var(--border); background: var(--surface); border-radius: 10px; padding: .6rem .75rem; cursor: pointer; min-height: 44px; }
.sec-btn.l3 { margin-left: 14px; width: calc(100% - 14px); font-size: .93rem; }
.sec-btn.l4 { margin-left: 28px; width: calc(100% - 28px); font-size: .9rem; }
.sec-btn.active { border-color: var(--pollen); box-shadow: 0 0 0 2px var(--pollen) inset; }
.sec-title { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.sec-tags { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.prose { overflow-wrap: break-word; }
.prose td, .prose th { overflow-wrap: break-word; word-break: normal; hyphens: auto; }
.prose td:first-child, .prose th:first-child { min-width: 5.5rem; }
.prose table { border-collapse: collapse; width: 100%; font-size: .9rem; margin: .75rem 0; }
.prose th, .prose td { border: 1px solid var(--border); padding: .4rem .5rem; vertical-align: top; text-align: left; }
.prose th { background: var(--surface-2); }
.prose code { background: var(--surface-2); padding: 0 .25rem; border-radius: 4px; font-size: .88em; overflow-wrap: anywhere; }
.prose pre { overflow-x: auto; background: var(--surface-2); padding: .6rem; border-radius: 8px; }
.prose blockquote { margin: .5rem 0; padding-left: .8rem; border-left: 3px solid var(--border); color: var(--muted); }
mark { background: var(--pollen); color: #12302A; border-radius: 3px; }
/* Phone: plan tables become stacked cards (no sideways scrolling). */
@media (max-width: 899px) {
  .prose table, .prose thead, .prose tbody, .prose tr, .prose td { display: block; width: 100%; }
  .prose thead { display: none; }
  .prose tr { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; background: var(--bg); overflow: hidden; }
  .prose td { border: 0; border-bottom: 1px solid var(--border); }
  .prose td:last-child { border-bottom: 0; }
  .prose td::before { content: attr(data-label); display: block; font-size: .75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
  .prose td:empty { display: none; }
}

/* Access */
.add-form { display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr); }
.log { font-size: .85rem; }
.log .row { padding: 8px 10px; }

.updated { font-size: .8rem; color: var(--muted); }

/* Desktop */
@media (min-width: 600px) {
  .tiles { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
  .cat-tiles { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
  .add-form { grid-template-columns: minmax(0, 2fr) minmax(0, 2fr) auto; align-items: end; }
}
@media (min-width: 900px) {
  :root { --top: 64px; }
  .topbar { padding: 0 20px; }
  .topbar .wordmark { font-size: 1.55rem; }
  .nav { top: var(--top); bottom: 0; right: auto; width: 220px; height: auto; display: flex; flex-direction: column; gap: 4px; padding: 14px 10px; border-top: 0; border-right: 1px solid var(--border); }
  .nav a { flex-direction: row; justify-content: flex-start; gap: .7rem; font-size: .95rem; padding: .65rem .8rem; border-radius: 10px; }
  .nav a.active { background: var(--surface-2); }
  .banner { margin-left: 220px; }
  .main { margin-left: 220px; padding: 22px 28px 40px; }
  .grid.now { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: start; }
  .grid.now .span-2 { grid-column: 1 / -1; }
  .split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 18px; align-items: start; }
  .split.wide { grid-template-columns: minmax(0, .75fr) minmax(0, 1.65fr); }
  .split > .sticky { position: sticky; top: calc(var(--top) + 16px); max-height: calc(100vh - var(--top) - 32px); overflow: auto; }
  .health-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
  h1 { font-size: 1.6rem; }
}
@media (min-width: 1400px) {
  .grid.now { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr); }
  .health-cols { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 479px) {
  .topbar .product { display: none; }
}
@media (prefers-reduced-motion: no-preference) { .tile, .sec-btn { transition: border-color .15s; } }

.mt { margin-top: 14px; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
