/* Spray Cart stylesheet — the settled mockup's styles.css ported line for line (plan §8 lists the edits). */
@font-face { font-family: 'Play'; src: url('../fonts/Play-Regular.ttf') format('truetype'); font-style: normal; font-weight: normal; }
@font-face { font-family: 'Jura'; src: url('../fonts/Jura-VariableFont_wght.ttf') format('truetype'); font-style: normal; font-weight: 300 700; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: 'Play', 'Helvetica Neue', Arial, sans-serif; background: #080f25; color: #464646; }
button { font-family: inherit; }

/* ───────────────────────── Theme tokens (role-named) ───────────────────────── */
.stage {
  /* the aRTiD portal's Production Order palette, named by role */
  --po-edge: #142763;
  --po-deep: #111931;
  --po-inner: #1b1f39;
  --po-black: #0d0d0d;
  --po-glow: rgba(21,87,153,.5);
  --po-grid-head: #062b4c;
  --po-grid-hover: #212643;
  --po-title: #ffffff;
  --po-label: #f2f2f2;
  --po-quiet: #c4c9e6;
  --po-ink: #08101f;
  --po-info-bg: rgba(32,41,95,.5);
  --po-info-line: rgba(255,255,255,.2);
  /* the RFID read at a rail's entry: no Cart reading (neutral), read, not read */
  --rfid-waiting: #6b7291;
  --rfid-read: #01a13b;
  --rfid-not-read: #d93025;
  --rfid-badge-ground: rgba(255,255,255,.85);
  --page-bg: #eeeeee;
  --card-bg: #ffffff;
  --card-text: #464646;
  --card-title: #5f5f5f;
  --card-muted: #908C90;
  --card-line: #e6e6e6;
  --card-inner: #f6f6f6;
  --card-shadow: 0 .5rem 1rem rgba(0,0,0,.15);
  --card-radius: .6rem;
  --detail-bg: #323232;
  --detail-text: #ffffff;
  --detail-muted: rgba(255,255,255,.6);
  --detail-inner: #444444;
  --detail-line: #404d5e;
  --pv-bg: linear-gradient(0.5turn, #ced4daba, #f8f9fa, #ced4dabf);
  --pv-text: #444444;
  --pv-control-bg: #ffffff;
  --accent: #26a69a;
  --accent-soft: rgba(38,166,154,.12);
  --accent-warm: #ffbe84;

  /* Cart state — IUX-3: the colour of a normally working machine is an open question, isolated here */
  --cart-state-active: #7dbb2b;
  --cart-state-wait: #69d0fb;
  --cart-state-transfer: #908C90;
  --cart-state-manual: #4682b4;
  --cart-state-warning: #ff8600;
  --cart-state-alarm: #f81f09;
  --cart-state-stale: #908C90;
  --stale-tag: #ca4141;

  /* Spray zones */
  --spray-forward: #69d0fb;
  --spray-facade: #4ecdc4;
  --spray-backward: #4682b4;
  --spray-home: #0d9488;

  /* Row status on the greenhouse map */
  --row-done: #01a13b;
  --row-current: #ffbe84;
  --row-planned: #d2deeb;
  --row-planned-border: #4682b4;
  --row-pending: #ed7900;
  --row-none: #e3e3e3;
  --row-double: #f81f09;

  /* Greenhouse map */
  --map-ground: #eef2f0;
  --map-edge: #d0d6d2;
  --map-grid: rgba(0,0,0,.05);
  --map-corridor: #dcdfe3;
  --map-corridor2: #cfd4d9;
  --map-dim: rgba(255,255,255,.45);

  min-height: 100vh;
  margin: 0 auto;
  background: var(--page-bg);
  color: var(--card-text);
  container-type: inline-size;
  container-name: app;
  position: relative;
}
.stage[data-theme="dark"] {
  --rfid-waiting: #8b93bd;
  --rfid-read: #3ecf6c;
  --rfid-not-read: #ff5f56;
  --rfid-badge-ground: rgba(9,12,30,.85);
  --page-bg: #080f25;
  --card-bg: #111931;
  --card-text: #d1d6f9;
  --card-title: rgba(242,242,242,.9);
  --card-muted: #908c90;
  --card-line: #2a2f4a;
  --card-inner: #1b1f39;
  --card-shadow: 0 0 10px #142763;
  --card-radius: .8rem;
  --detail-bg: #111931;
  --detail-text: #d1d6f9;
  --detail-muted: #7f87b8;
  --detail-inner: #1b1f39;
  --detail-line: #2a2f4a;
  --pv-bg: #111931;
  --pv-text: #d1d6f9;
  --pv-control-bg: #1b1f39;
  --accent: #11f0d4;
  --accent-soft: rgba(17,240,212,.10);
  --row-none: #212643;
  --row-planned: #1d3a5c;
  --row-planned-border: #69d0fb;
  --map-ground: #0d1430;
  --map-edge: #2a2f4a;
  --map-grid: rgba(120,140,210,.06);
  --map-corridor: #2a2f4a;
  --map-corridor2: #161d3b;
  --map-dim: rgba(8,15,37,.5);
}
.stage[data-theme="dark"] .dcard { box-shadow: 0 0 10px #142763; }

/* ───────────────────────── Navbar (MainLayout) ───────────────────────── */
.nav { position: sticky; top: 0; z-index: 30; background: #464646; color: #fff; font-family: 'Jura'; min-height: 3.4rem; padding: .25rem 1rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.nav-brand { display: flex; align-items: flex-end; gap: .25rem; flex-shrink: 0; }
.nav-brand img { height: 45px; width: auto; display: block; }
.nav-ver { color: #dbdbdb99; margin: 0 .5rem 0 .25rem; font-size: .95rem; }
.nav-links { display: flex; align-items: center; gap: .15rem; flex: 1; }
.nav-link { color: #fff; border-radius: 4px; height: 2.7rem; display: flex; align-items: center; padding: 0 .8rem; font-size: 1rem; cursor: pointer; white-space: nowrap; transition: background-color .2s; user-select: none; }
.nav-link:hover, .nav-link.active { background: rgba(255,255,255,.1); }
.nav-caret { margin-left: .35rem; font-size: .7rem; opacity: .8; }
.nav-right { display: flex; align-items: center; gap: .6rem; flex-shrink: 0; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: #0d9488; color: #fff; display: flex; align-items: center; justify-content: center; font-family: 'Play'; font-weight: 700; font-size: .85rem; }
.nav-user { font-size: 1.1rem; font-weight: 600; }
.nav-sep { border-left: 1px solid #fff; height: 24px; opacity: .6; }
.nav-culture { font-weight: 600; cursor: pointer; }
.hamburger { display: none; background: transparent; border: 1px solid rgba(255,255,255,.35); border-radius: 6px; width: 42px; height: 36px; color: #fff; font-size: 1.3rem; cursor: pointer; }
.drawer { display: none; position: absolute; top: 3.4rem; right: 0; width: 250px; background: #464646; z-index: 40; font-family: 'Jura'; padding: .5rem; box-shadow: -6px 6px 18px rgba(0,0,0,.3); }
.drawer.open { display: block; }
.drawer .nav-link { height: 2.6rem; }
@container app (max-width: 1399px) {
  .nav-links, .nav-right { display: none; }
  .hamburger { display: block; }
}
@container app (max-width: 520px) {
  .nav-brand img { height: 30px; }
  .nav-ver { font-size: .8rem; }
}

/* ───────────────────────── Page shell ───────────────────────── */
.page { padding: 0 2rem 3rem; }
@container app (max-width: 700px) { .page { padding: 0 .75rem 2.5rem; } }

/* SeemsPageViewBar */
.pvbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; padding: .55rem 1rem; background: var(--pv-bg); color: var(--pv-text); font-family: 'Jura'; font-weight: 700; font-size: .9rem; }
.crumbs { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; }
.crumbs .chev { opacity: .6; }
.crumbs .home-ico { width: 16px; height: 16px; }
.pv-controls { display: flex; align-items: center; gap: .5rem; }
.pv-select { background: var(--pv-control-bg); color: var(--pv-text); border: 0; border-radius: .4rem; font-family: 'Jura'; font-weight: 700; font-size: .9rem; padding: .3rem .6rem; min-width: 115px; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.pv-btn { background: #0076bda3; color: #fff; border: 0; border-radius: .4rem; padding: .32rem .7rem; font-family: 'Jura'; font-weight: 700; cursor: pointer; }
@container app (max-width: 700px) { .pv-controls { display: none; } .pvbar { padding: .45rem .7rem; font-size: .8rem; } }

/* SeemsStickyPageBar */
.sbar { position: sticky; top: 3.4rem; z-index: 20; font-family: 'Jura'; color: #fff; background: linear-gradient(0.02turn, #464646, #908C90, #464646); border-radius: 0 0 1rem 1rem; min-height: 3.25rem; padding: .4rem 1rem; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4rem .8rem; margin-bottom: 1rem; }
@container app (max-width: 1024px) { .sbar { position: relative; top: auto; } }
.sbar-left, .sbar-right { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem; }
.sbar-app { font-size: 1.5em; font-weight: 700; letter-spacing: .07em; margin-right: .5rem; white-space: nowrap; }
.toggle { display: inline-flex; background: #444444; border-radius: 20px; padding: 2px; gap: 2px; }
.toggle button { background: transparent; border: 0; color: #999; font-family: 'Jura'; font-size: 1.1em; font-weight: 600; letter-spacing: .03em; padding: 4px 11px; border-radius: 18px; cursor: pointer; white-space: nowrap; transition: background-color .25s, color .25s; }
.toggle button:hover:not(.active) { color: #fff; }
.toggle button.active { background: rgba(213,235,235,.22); color: #ffbe84; }
.sbar-sep { color: rgba(255,255,255,.6); padding: 0 .4rem; font-size: 1.5rem; line-height: 1; }
.sbar-obj { font-size: 1.2rem; font-weight: 600; white-space: nowrap; }
.sbar-live { display: inline-flex; align-items: center; gap: .55rem; font-size: 1.15rem; font-weight: 600; white-space: nowrap; }
.led { position: relative; width: 1rem; height: 1rem; border-radius: 50%; background: var(--cart-state-active); flex-shrink: 0; }
.led::after { content: ''; position: absolute; top: -.25rem; left: -.25rem; width: 1.5rem; height: 1.5rem; border-radius: 1.8rem; border: 3px solid var(--cart-state-active); box-sizing: border-box; animation: pulsate-led 1s ease-out infinite; }
.led.off { background: var(--stale-tag); }
.led.off::after { border-color: var(--stale-tag); animation: none; opacity: 0; }
@keyframes pulsate-led { 0% { transform: scale(.1); opacity: 0; } 50% { opacity: 1; } 100% { transform: scale(1.2); opacity: 0; } }
.sbar-btn { background: transparent; border: 0; color: #fff; font-family: 'Play'; font-size: 1.05rem; font-weight: 600; cursor: pointer; padding: .2rem .4rem; border-radius: 6px; white-space: nowrap; }
.sbar-btn:hover { color: #26a69a; }
.sbar-btn .muted { color: rgba(255,255,255,.65); font-weight: 400; }
@container app (max-width: 700px) {
  .sbar { justify-content: center; text-align: center; padding: .5rem .5rem .6rem; border-radius: 0 0 .8rem .8rem; }
  .sbar-left { justify-content: center; }
  .sbar-app { font-size: 1.25em; margin-right: .2rem; }
  .sbar-left .sbar-sep.hide-sm, .sbar-right { display: none; }
  .toggle { order: 9; width: 100%; justify-content: space-between; margin-top: .35rem; }
  .toggle button { font-size: 1em; padding: 4px 8px; flex: 1; }
}

/* ───────────────────────── Grid ───────────────────────── */
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 1rem; }
.c12 { grid-column: span 12; } .c9 { grid-column: span 9; } .c8 { grid-column: span 8; } .c6 { grid-column: span 6; }
.c4 { grid-column: span 4; } .c3 { grid-column: span 3; }
@container app (max-width: 1199px) {
  .c3 { grid-column: span 6; } .c4 { grid-column: span 6; } .c9, .c8 { grid-column: span 12; }
  .c4.t12 { grid-column: span 12; } .c3.t12 { grid-column: span 12; }
}
@container app (max-width: 700px) {
  .grid { gap: .75rem; }
  .c3, .c4, .c6, .c8, .c9 { grid-column: span 12; }
  .c3.k2 { grid-column: span 6; }
  .k2 .kcard { padding: .75rem .8rem .6rem; }
  .k2 .kcard-title { font-size: .95rem; white-space: normal; }
  .k2 .kval { font-size: 1.7rem; }
  .k2 .kunit { font-size: 1rem; }
  .k2 .ksub { font-size: .82rem; }
  .k2 .kfoot { display: none; }
  .hide-phone { display: none !important; }
  .kv { grid-template-columns: minmax(0,1fr) minmax(0,1.1fr); }
  .seems-kv-groups { grid-template-columns: minmax(0,1fr) minmax(0,1.1fr); }
  .kv dd { white-space: normal; }
  .tl-block { font-size: 0; }
}
@container app (max-width: 520px) { .sbar-obj, .sbar-obj + .sbar-sep { display: none; } }

/* ───────────────────────── Cards ───────────────────────── */
.kcard { background: var(--card-bg); color: var(--card-text); border-radius: var(--card-radius); box-shadow: var(--card-shadow); padding: 1rem 1.15rem .8rem; font-family: 'Play'; font-weight: 600; display: flex; flex-direction: column; min-width: 0; }
.kcard-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .4rem; }
/* a card title is a heading drawn as the text it was: block, no margin, its own size, weight and line height */
.kcard-title { display: block; margin: 0; font-size: 1.2rem; line-height: normal; color: var(--card-title); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* the muted note beside a card title is smaller and regular */
.seems-card-note { font-size: .85rem; font-weight: 400; }
.info-btn { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--card-muted); color: var(--card-muted); font-size: .75rem; display: inline-flex; align-items: center; justify-content: center; font-family: 'Play'; font-weight: 700; flex-shrink: 0; cursor: help; }
.kval { font-size: clamp(2rem, 1.5vw + 1rem, 2.4rem); color: var(--card-text); white-space: nowrap; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kunit { font-size: 1.3rem; margin-left: .25rem; color: var(--card-title); }
.ksub { font-size: .95rem; color: var(--card-title); font-weight: 600; margin-top: .25rem; }
.kfoot { margin-top: auto; padding-top: .6rem; font-size: .8rem; color: var(--card-muted); text-align: center; font-weight: 400; }

.dcard { background: var(--detail-bg); color: var(--detail-text); border-radius: 10px; padding: 1rem 1.1rem; min-width: 0; font-family: 'Play'; }
.dcard-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--detail-muted); font-weight: 600; }
.muted { color: var(--card-muted); }
.dmuted { color: var(--detail-muted); }
.num { font-variant-numeric: tabular-nums; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ───────────────────────── Status banner ───────────────────────── */
.banner { display: flex; align-items: stretch; justify-content: space-between; gap: 1rem; flex-wrap: wrap; border-left: 6px solid var(--state, var(--cart-state-active)); }
.banner-main { display: flex; flex-direction: column; justify-content: center; gap: .3rem; min-width: 0; }
.banner-phase { font-size: 2rem; font-weight: 800; letter-spacing: .02em; text-transform: uppercase; color: var(--state); line-height: 1.1; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.banner-sub { color: var(--detail-muted); font-size: 1.02rem; display: flex; gap: .4rem 1rem; flex-wrap: wrap; }
.banner-sub b { color: var(--detail-text); font-weight: 600; }
.banner-side { display: flex; align-items: center; gap: 1.4rem; flex-wrap: wrap; }
.rowchip { display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--detail-inner); border: 1px solid var(--detail-line); border-radius: 10px; padding: .45rem 1.1rem; min-width: 8.5rem; }
.rowchip-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--detail-muted); display: flex; align-items: center; gap: .3rem; }
.rowchip-val { font-size: 2.2rem; font-weight: 700; line-height: 1.05; font-variant-numeric: tabular-nums; }
.rowchip.warn { border-color: var(--cart-state-warning); box-shadow: 0 0 6px var(--cart-state-warning); }
.rowchip.fail .rowchip-val { color: var(--cart-state-warning); font-size: 1.5rem; }
.timechip .rowchip-val { font-size: 1.8rem; }
.spray-badge { display: inline-flex; align-items: center; gap: .35rem; font-size: .95rem; font-weight: 700; letter-spacing: .04em; padding: .2rem .6rem; border-radius: 999px; background: rgba(105,208,251,.16); color: #69d0fb; border: 1px solid rgba(105,208,251,.5); text-transform: uppercase; }
.notice { display: flex; align-items: flex-start; gap: .7rem; border-radius: 10px; padding: .75rem 1rem; font-family: 'Play'; font-size: 1rem; border-left: 5px solid var(--cart-state-warning); background: rgba(255,134,0,.12); color: var(--card-text); }
.notice.alarm { border-left-color: var(--cart-state-alarm); background: rgba(248,31,9,.10); }
.notice.info { border-left-color: var(--cart-state-wait); background: rgba(105,208,251,.12); }
.notice b { font-weight: 700; }
.notice .n-ico { font-size: 1.25rem; line-height: 1.2; }
.notice-wrap { display: flex; flex-direction: column; gap: .6rem; }
.notice-wrap:empty { display: none; }
@container app (max-width: 700px) {
  .banner-phase { font-size: 1.45rem; }
  .banner-side { width: 100%; justify-content: space-between; gap: .6rem; }
  .rowchip { min-width: 0; flex: 1; padding: .4rem .5rem; }
  .rowchip-val { font-size: 1.7rem; }
  .timechip .rowchip-val { font-size: 1.5rem; }
}

/* ───────────────────────── Rail strip ───────────────────────── */
.rail-head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: .5rem 1.5rem; margin-bottom: 1rem; }
.rail-pos { display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; }
.rail-pos .big { font-size: 2.6rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; }
.rail-pos .of { color: var(--detail-muted); font-size: 1.1rem; }
.rail-dir { display: inline-flex; align-items: center; gap: .35rem; background: var(--detail-inner); border: 1px solid var(--detail-line); border-radius: 999px; padding: .2rem .75rem; font-size: .95rem; font-weight: 600; }
.rail-meta { display: flex; gap: 1.6rem; flex-wrap: wrap; }
.rail-meta .m-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .07em; color: var(--detail-muted); }
.rail-meta .m-val { font-size: 1.1rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.rail { position: relative; padding: 0 2px; }
.rail-scale { position: relative; height: 1.2rem; margin: 0 0 .2rem; font-size: .75rem; color: var(--detail-muted); }
.rail-scale span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.rail-scale span.edge-l { transform: none; }
.rail-scale span.edge-r { transform: translateX(-100%); }
.lane { position: relative; height: 1.55rem; background: var(--detail-inner); border-radius: 6px; margin: .25rem 0; overflow: hidden; }
.lane-label { position: absolute; left: .35rem; top: 50%; transform: translateY(-50%); font-size: .72rem; color: #fff; background: rgba(20,20,20,.55); padding: .05rem .45rem; border-radius: 999px; z-index: 4; text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; }
.lane-label.right { left: auto; right: .35rem; }
.zone { position: absolute; top: 0; bottom: 0; opacity: .35; border-radius: 4px; }
.zone.done { opacity: .9; }
.zone.fwd { background: var(--spray-forward); }
.zone.facade { background: var(--spray-facade); }
.zone.bwd { background: var(--spray-backward); }
.zone.progress-fwd { background: repeating-linear-gradient(90deg, rgba(255,255,255,.0) 0 6px, rgba(255,255,255,.0) 6px 12px); }
.track { position: relative; height: 4.2rem; margin: .1rem 0; }
.track-pipe { position: absolute; left: 0; right: 0; height: 6px; border-radius: 3px; background: linear-gradient(#9aa3a8, #6e767a); }
.track-pipe.p1 { top: 1.35rem; } .track-pipe.p2 { top: 2.55rem; }
.track-mark { position: absolute; top: .2rem; bottom: .2rem; width: 2px; background: rgba(255,255,255,.35); }
.track-mark.target { background: #ffbe84; }
.track-mark.plate { width: 6px; background: #c7c6c7; border-radius: 2px; }
.track-mark .tm-label { position: absolute; top: -.05rem; left: 50%; transform: translateX(-50%); font-size: .7rem; color: var(--detail-muted); white-space: nowrap; }
.track-mark.target .tm-label { color: #ffbe84; left: auto; right: 6px; transform: none; }
.track-mark .tm-label { padding: 0 .3rem; }
.track-mark.home .tm-label { left: 4px; transform: none; }
.track-mark.plate .tm-label { left: auto; right: 10px; top: auto; bottom: -.05rem; transform: none; }
.cart { position: absolute; top: .35rem; width: 0; height: 3.5rem; transition: left .25s linear; z-index: 3; }
.cart-body { position: absolute; top: 0; left: -1.6rem; width: 3.2rem; height: 3.5rem; }
.cart svg { width: 100%; height: 100%; overflow: visible; }
.mist { position: absolute; top: -.3rem; left: -2.6rem; width: 5.2rem; height: 4.1rem; border-radius: 50%; background: radial-gradient(closest-side, rgba(105,208,251,.55), rgba(105,208,251,0)); opacity: 0; transition: opacity .3s; pointer-events: none; }
.cart.spraying .mist { opacity: 1; animation: mist 1.2s ease-in-out infinite; }
@keyframes mist { 0%,100% { transform: scale(.92); } 50% { transform: scale(1.08); } }
.cart.ghost .cart-body { opacity: .45; filter: grayscale(1); }
.ext-marker { position: absolute; top: 50%; transform: translate(-50%, -50%); font-size: .68rem; font-weight: 700; padding: .05rem .35rem; border-radius: 999px; background: var(--spray-facade); color: #08323a; z-index: 2; white-space: nowrap; }
.ext-marker.home { background: var(--spray-home); color: #fff; transform: translate(0, -50%); }
.ext-marker.facade { transform: translate(-100%, -50%); }
.rail-legend { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; margin-top: 1.4rem; font-size: .85rem; color: var(--detail-muted); }
.lg { display: inline-flex; align-items: center; gap: .4rem; }
.sw { width: .9rem; height: .9rem; border-radius: 3px; display: inline-block; }

/* Phase stepper */
.stepper { display: flex; align-items: flex-start; margin-top: 1.25rem; border-top: 1px solid var(--detail-line); padding-top: 1rem; }
.step { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .35rem; position: relative; text-align: center; min-width: 0; }
.step::before { content: ''; position: absolute; top: .78rem; left: -50%; width: 100%; height: 2px; background: var(--detail-line); z-index: 0; }
.step:first-child::before { display: none; }
.step-dot { width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--detail-inner); border: 2px solid var(--detail-line); display: flex; align-items: center; justify-content: center; font-size: .78rem; font-weight: 700; z-index: 1; color: var(--detail-muted); }
.step-name { font-size: .82rem; color: var(--detail-muted); line-height: 1.15; }
.step.done .step-dot { background: var(--cart-state-active); border-color: var(--cart-state-active); color: #1b2a07; }
.step.done::before, .step.now::before { background: var(--cart-state-active); }
.step.now .step-dot { background: var(--detail-bg); border-color: var(--state, var(--cart-state-active)); color: var(--detail-text); box-shadow: 0 0 0 4px color-mix(in srgb, var(--cart-state-active) 25%, transparent), 0 0 8px var(--state, var(--cart-state-active)); }
.step.now .step-name { color: var(--detail-text); font-weight: 700; }
.stepper-compact { display: none; margin-top: 1rem; border-top: 1px solid var(--detail-line); padding-top: .8rem; font-size: .95rem; }
.stepper-compact .dots { display: flex; gap: .3rem; margin-top: .45rem; }
.stepper-compact .dots i { flex: 1; height: .35rem; border-radius: 3px; background: var(--detail-inner); }
.stepper-compact .dots i.done { background: var(--cart-state-active); }
.stepper-compact .dots i.now { background: var(--state, var(--cart-state-active)); box-shadow: 0 0 6px var(--state, var(--cart-state-active)); }
@container app (max-width: 700px) {
  .stepper { display: none; }
  .stepper-compact { display: block; }
  .rail-pos .big { font-size: 2.1rem; }
  .rail-meta { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: .6rem; width: 100%; }
  .rail-meta .m-label { font-size: .64rem; }
  .rail-meta .m-val { font-size: 1rem; }
  .lane-label { font-size: .65rem; }
  .rail-scale .opt { display: none; }
  .ext-marker { font-size: .6rem; }
}

/* ───────────────────────── Ring / gauge ───────────────────────── */
.ring-wrap { display: flex; align-items: center; gap: 1rem; }
.ring { width: 96px; height: 96px; flex-shrink: 0; }
.ring-txt { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.gauge { width: 100%; max-width: 220px; margin: 0 auto; display: block; }
.mini-stats { display: flex; justify-content: space-between; gap: .5rem; margin-top: .4rem; font-size: .9rem; color: var(--card-title); }
.mini-stats b { color: var(--card-text); font-variant-numeric: tabular-nums; }

/* Spray outputs */
.outs { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin: .2rem 0 .3rem; }
.out { border-radius: 10px; border: 1px solid var(--card-line); background: var(--card-inner); padding: .55rem .3rem; display: flex; flex-direction: column; align-items: center; gap: .3rem; font-size: .85rem; color: var(--card-title); }
.out .o-led { width: 1.15rem; height: 1.15rem; border-radius: 50%; background: #c7c6c7; box-shadow: inset 0 -2px 3px rgba(0,0,0,.25); }
.out.on { border-color: rgba(105,208,251,.7); background: rgba(105,208,251,.12); color: var(--card-text); }
.out.on .o-led { background: #69d0fb; box-shadow: 0 0 8px #69d0fb; }
.out .o-state { font-weight: 700; font-size: .78rem; letter-spacing: .06em; }

/* Lists */
.kv { display: grid; grid-template-columns: 1fr auto; gap: .38rem .8rem; font-size: .95rem; }
.kv dt { color: var(--card-title); font-weight: 400; }
.kv dd { margin: 0; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
/* a details list in groups lays out as the one list did: one grid with the list's columns, row gap and outer margin (1em of its .95rem), each list on the shared columns as a subgrid, a group heading across the row in the look of the mockup's heading row */
.seems-kv-groups { display: grid; grid-template-columns: 1fr auto; gap: .38rem .8rem; margin: .95rem 0; }
.seems-kv-groups > .kv { grid-column: 1 / -1; grid-template-columns: subgrid; margin: 0; }
.seems-kv-groups > .seems-kv-sec { grid-column: 1 / -1; margin: .5rem 0 0; border-top: 1px solid var(--card-line); padding-top: .55rem; font-size: .78rem; font-weight: 400; line-height: normal; text-transform: uppercase; letter-spacing: .08em; color: var(--card-muted); }
.events { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .1rem; max-height: 17.5rem; overflow-y: auto; }
.events li { display: grid; grid-template-columns: 4.6rem 1rem 1fr; gap: .5rem; align-items: start; padding: .32rem 0; border-bottom: 1px dashed var(--card-line); font-size: .92rem; font-weight: 400; }
.events time { color: var(--card-muted); font-variant-numeric: tabular-nums; }
.ev-dot { width: .6rem; height: .6rem; border-radius: 50%; margin-top: .38rem; background: var(--card-muted); }
.ev-dot.ok { background: var(--cart-state-active); } .ev-dot.spray { background: var(--spray-forward); } .ev-dot.warn { background: var(--cart-state-warning); } .ev-dot.alarm { background: var(--cart-state-alarm); } .ev-dot.row { background: var(--accent-warm); }
.alarm-ok { display: flex; align-items: center; gap: .7rem; padding: .7rem; border-radius: 10px; background: color-mix(in srgb, var(--cart-state-active) 12%, transparent); color: var(--card-text); font-weight: 600; }
.alarm-ok .big-ico { width: 2.2rem; height: 2.2rem; border-radius: 50%; background: var(--cart-state-active); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; }
.alarm-item { display: flex; gap: .7rem; align-items: flex-start; padding: .7rem; border-radius: 10px; background: rgba(248,31,9,.10); border-left: 4px solid var(--cart-state-alarm); margin-bottom: .5rem; }
.alarm-item.warn { background: rgba(255,134,0,.12); border-left-color: var(--cart-state-warning); }
.alarm-item .a-title { font-weight: 700; }
.alarm-item .a-sub { font-size: .85rem; color: var(--card-title); font-weight: 400; margin-top: .15rem; }
.sublist-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--card-muted); margin: .8rem 0 .3rem; }

/* Technical status */
.sensors { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: .6rem; }
.sensor { display: flex; align-items: center; gap: .6rem; background: var(--detail-inner); border: 1px solid var(--detail-line); border-radius: 8px; padding: .55rem .7rem; font-size: .9rem; }
.sensor .s-led { width: .8rem; height: .8rem; border-radius: 50%; background: #6b6b6b; flex-shrink: 0; }
.sensor .s-led.on { background: var(--cart-state-active); box-shadow: 0 0 6px var(--cart-state-active); }
.sensor .s-led.bad { background: #f81f09; box-shadow: 0 0 6px #f81f09; }
.sensor .s-val { margin-left: auto; color: var(--detail-muted); font-size: .82rem; white-space: nowrap; }
.collapse-head { display: flex; justify-content: space-between; align-items: center; cursor: pointer; user-select: none; }
.collapse-head .chev { transition: transform .2s; color: var(--detail-muted); }
.collapsed .collapse-body { display: none; }
.collapsed .collapse-head .chev { transform: rotate(-90deg); }
.collapse-body { margin-top: .9rem; }
@container app (max-width: 1199px) { .sensors { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@container app (max-width: 520px) { .sensors { grid-template-columns: 1fr; } }

/* Stale / not-live data (IUX-4): never shown in the same face as a live value */
.stage.stale .live-val { color: var(--card-muted) !important; background: repeating-linear-gradient(135deg, transparent 0 6px, rgba(144,140,144,.18) 6px 9px); border-radius: 4px; }
.stage.stale .dcard .live-val { color: var(--detail-muted) !important; }
.stage.stale .banner { border-left-color: var(--cart-state-stale) !important; }
.stage.stale .banner-phase { color: var(--cart-state-stale) !important; }
.stage.stale .gauge, .stage.stale .ring, .stage.stale .out.on, .stage.stale .spray-badge, .stage.stale .gh-cart { filter: grayscale(1); opacity: .5; }
.stale-tag { display: none; font-size: .78rem; font-weight: 700; letter-spacing: .05em; padding: .12rem .55rem; border-radius: 999px; border: 1.5px dashed var(--stale-tag); color: var(--stale-tag); text-transform: uppercase; }
.stage.stale .stale-tag { display: inline-flex; }
/* The alarms card is a live value too: under stale it takes the hatch and its tick greys out (design QA M2; the dark-theme rule further down would otherwise win on order) */
.stage.stale[data-theme] .alarm-ok { background: repeating-linear-gradient(135deg, transparent 0 6px, rgba(144,140,144,.18) 6px 9px); color: var(--card-muted); }
.stage.stale .alarm-ok .big-ico { filter: grayscale(1); opacity: .5; }

/* Keyboard focus (WCAG 2.4.7, design QA M1): the browser default ring is invisible on the dark theme; the fallback serves the toast and the demo panel, which sit outside .stage */
:focus-visible { outline: 2px solid var(--accent, #11f0d4); outline-offset: 2px; }
.gm-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.gm-row:focus-visible rect { stroke: var(--accent); stroke-width: 2; }

/* ───────────────────────── Greenhouse map ───────────────────────── */
.map-card { overflow: hidden; }
.map-sections { display: flex; gap: 2rem; align-items: stretch; overflow-x: auto; padding: .4rem .2rem .2rem; }
.gh-section { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.gh-section .gh-field { margin-top: auto; }
.gh-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; margin-bottom: .5rem; flex-wrap: wrap; }
.gh-name { font-size: 1.15rem; font-weight: 700; color: var(--card-text); }
.gh-meta { font-size: .85rem; color: var(--card-muted); font-weight: 400; }
.gh-field { background: var(--map-ground); border-radius: 8px; padding: .6rem .5rem 0; border: 1px solid var(--card-line); }
.gh-rows { display: flex; gap: 3px; align-items: flex-end; }
.gh-row { flex: 1; min-width: 7px; border-radius: 3px 3px 0 0; background: var(--row-none); position: relative; cursor: pointer; transition: transform .15s, box-shadow .15s; }
.gh-row:hover { transform: translateY(-2px); box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.gh-row.sel { outline: 2px solid var(--card-text); outline-offset: 1px; }
.gh-row.done { background: var(--row-done); }
.gh-row.planned { background: var(--row-planned); box-shadow: inset 0 0 0 1.5px var(--row-planned-border); }
.gh-row.pending { background: repeating-linear-gradient(135deg, var(--row-pending) 0 5px, rgba(237,121,0,.35) 5px 10px); }
.gh-row.current { background: var(--row-planned); box-shadow: inset 0 0 0 2px var(--row-current), 0 0 10px var(--row-current); }
.gh-row.double { background: var(--row-done); box-shadow: inset 0 0 0 2px var(--row-double); }
.gh-row .fill { position: absolute; left: 0; right: 0; bottom: 0; background: var(--row-current); opacity: .7; border-radius: 0; }
.gh-row .dbl { position: absolute; top: -1.2rem; left: 50%; transform: translateX(-50%); color: var(--row-double); font-size: .8rem; font-weight: 800; }
.gh-cart { position: absolute; left: 50%; width: 1.35rem; height: 1.35rem; transform: translate(-50%, 50%); border-radius: 4px; background: #464646; border: 2px solid var(--row-current); z-index: 2; box-shadow: 0 0 8px var(--row-current); display: flex; align-items: center; justify-content: center; color: #ffbe84; font-size: .7rem; font-weight: 800; transition: bottom .25s linear; }
.stage[data-theme="dark"] .gh-cart { background: #080f25; }
.gh-corridor { margin: 0 -.5rem; height: 1.6rem; background: var(--map-corridor); display: flex; align-items: center; justify-content: center; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--card-title); border-radius: 0 0 8px 8px; }
.gh-labels { display: flex; gap: 3px; margin-top: .25rem; }
.gh-labels span { flex: 1; min-width: 7px; text-align: center; font-size: .66rem; color: var(--card-muted); font-weight: 400; }
.map-legend { display: flex; flex-wrap: wrap; gap: .45rem 1.1rem; margin-top: 1rem; font-size: .85rem; color: var(--card-title); font-weight: 400; }
.map-legend .sw { width: 1.1rem; height: .9rem; }
.sw.done { background: var(--row-done); } .sw.current { background: var(--row-planned); box-shadow: inset 0 0 0 2px var(--row-current); }
.sw.planned { background: var(--row-planned); box-shadow: inset 0 0 0 1.5px var(--row-planned-border); }
.sw.pending { background: repeating-linear-gradient(135deg, var(--row-pending) 0 4px, rgba(237,121,0,.35) 4px 8px); }
.sw.none { background: var(--row-none); } .sw.double { background: var(--row-done); box-shadow: inset 0 0 0 2px var(--row-double); }
.cart-list { display: flex; flex-direction: column; gap: .6rem; }
.cart-item { display: flex; gap: .7rem; align-items: center; padding: .65rem .75rem; border-radius: 10px; background: var(--card-inner); border: 1px solid var(--card-line); }
.cart-item .ci-dot { width: .8rem; height: .8rem; border-radius: 50%; flex-shrink: 0; }
.cart-item .ci-name { font-weight: 700; }
.cart-item .ci-sub { font-size: .85rem; color: var(--card-title); font-weight: 400; }
.cart-item .ci-go { margin-left: auto; font-size: .85rem; color: var(--accent); cursor: pointer; white-space: nowrap; }
.row-detail { border-radius: 10px; background: var(--card-inner); border: 1px solid var(--card-line); padding: .8rem .9rem; }
.row-detail h4 { margin: 0 0 .4rem; font-size: 1.4rem; display: flex; align-items: center; gap: .5rem; }
.status-pill { display: inline-flex; align-items: center; gap: .35rem; font-size: .78rem; font-weight: 700; padding: .14rem .55rem; border-radius: 999px; letter-spacing: .03em; white-space: nowrap; }
.status-pill.done { background: rgba(1,161,59,.15); color: var(--row-done); }
.status-pill.current { background: rgba(255,190,132,.22); color: #c56a16; }
.stage[data-theme="dark"] .status-pill.current { color: #ffbe84; }
.status-pill.planned { background: rgba(70,130,180,.15); color: var(--row-planned-border); }
.status-pill.pending { background: rgba(237,121,0,.15); color: #c05f00; }
.stage[data-theme="dark"] .status-pill.pending { color: #ff9f40; }
.status-pill.none { background: var(--card-line); color: var(--card-title); }
.status-pill.alarm { background: rgba(248,31,9,.12); color: var(--cart-state-alarm); }
.status-pill.unknown { background: rgba(255,134,0,.15); color: #c05f00; }
@container app (max-width: 900px) {
  .map-sections { flex-direction: column; align-items: stretch; gap: 1.4rem; }
}

/* ───────────────────────── History ───────────────────────── */
.filters { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.fld { display: flex; flex-direction: column; gap: .2rem; font-size: .78rem; color: var(--card-muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.fld select, .fld input { font-family: 'Play'; font-size: 1rem; color: var(--card-text); background: var(--card-inner); border: 1px solid var(--card-line); border-radius: .4rem; padding: .45rem .6rem; min-width: 9.5rem; min-height: 2.6rem; }
.btn { font-family: 'Jura'; font-weight: 700; font-size: .95rem; border-radius: .45rem; border: 0; padding: .55rem 1rem; cursor: pointer; min-height: 2.6rem; display: inline-flex; align-items: center; gap: .4rem; }
.btn.primary { background: #0d9488; color: #fff; }
.btn.primary:hover { background: #0a6f66; }
.btn.ghost { background: transparent; color: var(--card-text); border: 1px solid var(--card-line); }
.btn.blue { background: #0076bda3; color: #fff; }
.spacer { flex: 1; }
.timeline { position: relative; margin-top: .4rem; }
.tl-axis { position: relative; height: 1.2rem; font-size: .75rem; color: var(--card-muted); font-weight: 400; }
.tl-axis span { position: absolute; transform: translateX(-50%); }
.tl-lane { position: relative; height: 2.6rem; background: var(--card-inner); border-radius: 6px; border: 1px solid var(--card-line); }
.tl-block { position: absolute; top: 4px; bottom: 4px; border-radius: 4px; background: var(--row-done); display: flex; align-items: center; justify-content: center; color: #fff; font-size: .7rem; font-weight: 700; overflow: hidden; white-space: nowrap; cursor: default; }
.tl-block.int { background: var(--cart-state-alarm); }
.tl-block.unk { background: var(--cart-state-warning); }
.tl-block.now { background: var(--row-current); color: #5a3205; animation: nowpulse 1.6s ease-in-out infinite; }
.tl-block.proj { background: transparent; border: 1.5px dashed var(--row-planned-border); color: var(--row-planned-border); }
@keyframes nowpulse { 50% { filter: brightness(1.15); } }
.tl-now { position: absolute; top: -.3rem; bottom: -.3rem; width: 2px; background: var(--cart-state-alarm); z-index: 3; }
.tl-now::after { content: 'Τώρα'; position: absolute; top: -1.05rem; left: 50%; transform: translateX(-50%); font-size: .68rem; color: var(--cart-state-alarm); font-weight: 700; }
.tl-legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; margin-top: .7rem; font-size: .82rem; color: var(--card-title); font-weight: 400; }
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .95rem; font-weight: 400; }
.tbl th { text-align: left; font-family: 'Jura'; font-weight: 700; font-size: .85rem; color: var(--card-title); padding: .55rem .6rem; border-bottom: 2px solid var(--card-line); white-space: nowrap; }
.tbl td { padding: .55rem .6rem; border-bottom: 1px solid var(--card-line); white-space: nowrap; font-variant-numeric: tabular-nums; }
.tbl tr:nth-child(even) td { background: var(--card-inner); }
.tbl td.rowid { font-weight: 700; }
.chip { display: inline-block; font-size: .72rem; font-weight: 700; padding: .1rem .45rem; border-radius: 4px; margin-right: .2rem; }
.chip.f { background: rgba(105,208,251,.22); color: #1b7fae; } .chip.b { background: rgba(70,130,180,.2); color: #34648d; } .chip.x { background: rgba(78,205,196,.22); color: #13867e; }
.stage[data-theme="dark"] .chip.f { color: #69d0fb; } .stage[data-theme="dark"] .chip.b { color: #8fb7da; } .stage[data-theme="dark"] .chip.x { color: #4ecdc4; }
.hist-cards { display: none; flex-direction: column; gap: .6rem; }
.hcard { border: 1px solid var(--card-line); border-radius: 10px; padding: .7rem .8rem; background: var(--card-inner); font-weight: 400; }
.hcard-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: .3rem; }
.hcard-top b { font-size: 1.25rem; }
.hcard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .2rem .8rem; font-size: .88rem; color: var(--card-title); }
.hcard-grid b { color: var(--card-text); }
@container app (max-width: 700px) {
  .tbl-wrap { display: none; }
  .hist-cards { display: flex; }
  .fld select, .fld input { min-width: 0; width: 100%; }
  .filters .fld { flex: 1 1 45%; }
}

/* ───────────────────────── Plan ───────────────────────── */
.plan-step { display: flex; gap: .9rem; padding: 1rem 0; border-bottom: 1px solid var(--card-line); }
.plan-step:last-child { border-bottom: 0; }
.ps-num { width: 2rem; height: 2rem; border-radius: 50%; background: #0d9488; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; }
.ps-body { flex: 1; min-width: 0; }
.ps-title { font-size: 1.1rem; font-weight: 700; margin-bottom: .55rem; }
.seg { display: inline-flex; flex-wrap: wrap; gap: .4rem; }
.seg button { font-family: 'Play'; font-weight: 600; font-size: .98rem; padding: .55rem .95rem; border-radius: .5rem; border: 1px solid var(--card-line); background: var(--card-inner); color: var(--card-text); cursor: pointer; min-height: 2.75rem; }
.seg button.on { background: #0d9488; border-color: #0d9488; color: #fff; }
.row-chips { display: grid; grid-template-columns: repeat(12, minmax(0,1fr)); gap: .35rem; }
.row-chip { font-family: 'Play'; font-weight: 700; font-size: .9rem; padding: .5rem 0; min-height: 2.6rem; border-radius: .45rem; border: 1px solid var(--card-line); background: var(--card-inner); color: var(--card-title); cursor: pointer; }
.row-chip.on { background: rgba(13,148,136,.15); border-color: #0d9488; color: var(--card-text); box-shadow: inset 0 0 0 1px #0d9488; }
.quick { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .6rem; }
.quick button { font-family: 'Jura'; font-weight: 700; font-size: .85rem; padding: .35rem .7rem; border-radius: 999px; border: 1px solid var(--card-line); background: transparent; color: var(--card-title); cursor: pointer; min-height: 2.2rem; }
.recipes { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: .6rem; }
.recipe { border: 1.5px solid var(--card-line); border-radius: 10px; padding: .75rem .85rem; background: var(--card-inner); cursor: pointer; font-weight: 400; }
.recipe.on { border-color: #0d9488; box-shadow: 0 0 0 2px rgba(13,148,136,.25); }
.recipe .r-name { font-weight: 700; font-size: 1rem; margin-bottom: .3rem; color: var(--card-text); }
.recipe .r-line { font-size: .85rem; color: var(--card-title); }
.summary-big { font-size: 2.2rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.plans-list .pl { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .6rem 0; border-bottom: 1px solid var(--card-line); font-weight: 400; font-size: .92rem; }
.plans-list .pl:last-child { border-bottom: 0; }
.plans-list .pl b { font-weight: 700; }
.progress-mini { height: .45rem; background: rgba(213,235,235,.5); border-radius: 999px; overflow: hidden; margin-top: .3rem; width: 100%; }
.stage[data-theme="dark"] .progress-mini { background: #212643; }
.progress-mini i { display: block; height: 100%; background: #0d9488; }
@container app (max-width: 1199px) { .recipes { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@container app (max-width: 700px) {
  .row-chips { grid-template-columns: repeat(6, minmax(0,1fr)); }
  .recipes { grid-template-columns: 1fr; }
}

/* ───────────────────────── Toast & demo panel ───────────────────────── */
.toast { opacity: 0; position: fixed; left: 50%; bottom: 1.4rem; transform: translateX(-50%) translateY(150%); background: #323232; color: #fff; padding: .75rem 1.2rem; border-radius: 10px; font-family: 'Play'; font-size: 1rem; box-shadow: 0 8px 24px rgba(0,0,0,.35); z-index: 100; transition: transform .3s; border-left: 5px solid var(--cart-state-active); max-width: 92vw; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.demo { position: fixed; right: 14px; bottom: 14px; z-index: 90; width: 300px; background: rgba(20,24,33,.94); color: #e8e8e8; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.45); font-family: 'Jura'; font-size: .88rem; border: 1px solid #3a4152; }
.demo-head { display: flex; justify-content: space-between; align-items: center; padding: .55rem .8rem; cursor: pointer; font-weight: 700; letter-spacing: .06em; }
.demo-head .tag { background: #ffbe84; color: #3b2203; font-size: .7rem; padding: .05rem .45rem; border-radius: 999px; margin-left: .4rem; }
.demo-body { padding: 0 .8rem .8rem; display: flex; flex-direction: column; gap: .55rem; }
.demo.min .demo-body { display: none; }
.demo-group label { display: block; color: #9aa3b5; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; margin-bottom: .25rem; }
.demo-btns { display: flex; flex-wrap: wrap; gap: .3rem; }
.demo-btns button { background: #2a3142; color: #e8e8e8; border: 1px solid #3a4152; border-radius: 6px; padding: .3rem .55rem; font-family: 'Jura'; font-weight: 700; font-size: .8rem; cursor: pointer; }
.demo-btns button.on { background: #0d9488; border-color: #0d9488; color: #fff; }
.demo-btns button.warn.on { background: #ed7900; border-color: #ed7900; }
.demo-btns button.alarm.on { background: #ca4141; border-color: #ca4141; }
.demo-note { color: #9aa3b5; font-size: .74rem; line-height: 1.35; }
[id^="mpK"] > .kcard, [id^="hsK"] > .kcard { height: 100%; }
@media print { .demo, .toast, .nav, .sbar, .pvbar { display: none !important; } }

/* ───────── Dark theme: Production Order look (sticky title bar, bars, KPI cards) ───────── */
.stage[data-theme="dark"] { color-scheme: dark; }
.stage[data-theme="dark"] .sbar { background: radial-gradient(ellipse at center, rgba(21,87,153,.3), #111931), linear-gradient(to bottom right, #0d0d0d, #111931); border-radius: 0 0 .8rem .8rem; box-shadow: 0 0 5px #142763; }
.stage[data-theme="dark"] .toggle { background: #1b1f39; }
.stage[data-theme="dark"] .pvbar { box-shadow: 0 0 5px #142763; border-radius: 0 0 .6rem .6rem; margin-bottom: .35rem; }
.stage[data-theme="dark"] .pv-select { box-shadow: none; border: 1px solid #2a2f4a; }
.stage[data-theme="dark"] .k2 .kcard,
.stage[data-theme="dark"] #live > .c3.kcard { background: radial-gradient(ellipse at center, rgba(21,87,153,.45), #111931), linear-gradient(to bottom right, #0d0d0d, #111931); box-shadow: 0 0 5px #142763; }
.stage[data-theme="dark"] .kval, .stage[data-theme="dark"] .rowchip-val, .stage[data-theme="dark"] .rail-pos .big { color: #ffffff; }
.stage[data-theme="dark"] .alarm-ok { background: color-mix(in srgb, var(--cart-state-active) 10%, transparent); }
.stage[data-theme="dark"] .out { background: #1b1f39; }
.stage[data-theme="dark"] .gh-field { border-color: #2a2f4a; }
.stage[data-theme="dark"] .btn.blue { background: #155799; }
.stage[data-theme="dark"] .pv-btn { background: #155799; }
.stage[data-theme="dark"] .ps-num, .stage[data-theme="dark"] .seg button.on, .stage[data-theme="dark"] .btn.primary { background: #0a7f75; }
.stage[data-theme="dark"] .notice { color: #d1d6f9; }

/* ───────── Dark theme: the Production Order concept on every page ─────────
   figure cards glow blue on deep purple; large cards stay flat with the soft blue shadow; titles white and bold, large ones in Jura;
   tables in the portal grid's colours; the small cards of narrow screens as the portal's info boxes */
.stage[data-theme="dark"] .kcard { border-radius: .8rem; box-shadow: var(--card-shadow); }
.stage[data-theme="dark"] .kcard.kpi-glow,
.stage[data-theme="dark"] .kcard.kt { background: radial-gradient(ellipse at center, var(--po-glow), var(--po-deep)), linear-gradient(to bottom right, var(--po-black), var(--po-deep)); box-shadow: 0 0 5px var(--po-edge); }
.stage[data-theme="dark"] .kcard-title { color: var(--po-title); font-weight: 700; }
.stage[data-theme="dark"] .kcard:not(.kpi-glow):not(.kt) > .kcard-head .kcard-title { font-family: 'Jura'; }
.stage[data-theme="dark"] .kval { font-weight: 700; }
.stage[data-theme="dark"] .tbl th { background: var(--po-grid-head); color: var(--po-title); border-bottom: 1px solid var(--po-inner); }
.stage[data-theme="dark"] .tbl td,
.stage[data-theme="dark"] .tbl tr:nth-child(even) td { background: var(--po-inner); border-bottom: 1px solid var(--po-deep); }
.stage[data-theme="dark"] .tbl tr:hover td { background: var(--po-grid-hover); }
.stage[data-theme="dark"] .hcard { background: var(--po-info-bg); border: 1px solid var(--po-info-line); border-radius: .4rem; }

/* ═════════════════════════════ v3 additions ═════════════════════════════ */
.c2 { grid-column: span 2; } .c5 { grid-column: span 5; } .c7 { grid-column: span 7; }
@container app (max-width: 1199px) { .c2 { grid-column: span 4; } .c5, .c7 { grid-column: span 12; } .c6.t12 { grid-column: span 12; } }
@container app (max-width: 700px) { .c2 { grid-column: span 6; } .c6 { grid-column: span 12; } }

/* scene */
.scene-card { padding: 0; overflow: hidden; border-radius: 14px; background: var(--detail-bg); color: var(--detail-text); box-shadow: 0 0 18px rgba(20,39,99,.55); }
.stage[data-theme="light"] .scene-card { box-shadow: var(--card-shadow); }
.scene-wrap { position: relative; height: 430px; }
.scene-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stage.stale .scene-wrap canvas { filter: grayscale(.85) brightness(.7); }
.hud { position: absolute; z-index: 3; display: flex; gap: .55rem; }
.hud-tl { top: 1rem; left: 1rem; flex-direction: column; align-items: flex-start; }
.hud-tr { top: 1rem; right: 1rem; }
.hud-bl { left: 1rem; bottom: 1rem; flex-direction: column; }
.hud-br { right: 1rem; bottom: 1rem; }
.glass { background: rgba(9,12,30,.74); border: 1px solid rgba(255,255,255,.10); border-radius: 12px; box-shadow: 0 6px 18px rgba(0,0,0,.25); }
.stage[data-theme="light"] .glass { background: rgba(255,255,255,.78); border-color: rgba(0,0,0,.06); color: #464646; }
.hud-phase { font-family: 'Play'; font-weight: 800; font-size: 1.65rem; letter-spacing: .02em; text-transform: uppercase; color: var(--state, var(--cart-state-active)); padding: .45rem .95rem; border-left: 5px solid var(--state, var(--cart-state-active)); text-shadow: 0 0 18px rgba(0,0,0,.35); display: flex; align-items: center; gap: .6rem; }
.hud-phase .dot { width: .7rem; height: .7rem; border-radius: 50%; background: var(--state, var(--cart-state-active)); box-shadow: 0 0 10px var(--state, var(--cart-state-active)); animation: hudpulse 1.4s ease-in-out infinite; }
@keyframes hudpulse { 50% { opacity: .35; } }
.hud-sub { display: flex; gap: .45rem; flex-wrap: wrap; }
.hud-chip { display: flex; flex-direction: column; align-items: center; padding: .45rem 1rem; min-width: 7.5rem; }
.hc-l { font-family: 'Jura'; font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: rgba(209,214,249,.75); display: flex; gap: .3rem; align-items: center; }
.stage[data-theme="light"] .hc-l { color: #6b6b6b; }
.hc-v { font-family: 'Play'; font-weight: 700; font-size: 2rem; line-height: 1.05; font-variant-numeric: tabular-nums; }
.hud-chip.warn { border-color: var(--cart-state-warning); box-shadow: 0 0 10px rgba(255,134,0,.6); }
.hud-chip.fail .hc-v { color: var(--cart-state-warning); font-size: 1.4rem; }
.hud-pos { padding: .4rem .9rem .1rem; display: flex; align-items: baseline; gap: .3rem; }
.hud-pos .big { font-family: 'Play'; font-weight: 700; font-size: 3rem; line-height: 1; font-variant-numeric: tabular-nums; }
.hud-pos .u { font-size: 1.2rem; color: rgba(209,214,249,.8); }
.hud-of { padding: 0 .9rem .5rem; font-size: .95rem; color: rgba(209,214,249,.8); }
.stage[data-theme="light"] .hud-of, .stage[data-theme="light"] .hud-pos .u { color: #5f5f5f; }
.hud-metric { display: flex; flex-direction: column; padding: .45rem .9rem; min-width: 7rem; }
.hm-l { font-family: 'Jura'; font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: rgba(209,214,249,.75); }
.stage[data-theme="light"] .hm-l { color: #6b6b6b; }
.hm-v { font-family: 'Play'; font-weight: 700; font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.scene-foot { padding: .9rem 1.2rem 1rem; border-top: 1px solid var(--detail-line); }
.scene-meta { display: flex; flex-wrap: wrap; gap: .3rem 1.2rem; color: var(--detail-muted); font-size: .98rem; margin-bottom: .7rem; }
.scene-meta b { color: var(--detail-text); font-weight: 600; }
.rail-mini .lane { height: 1.1rem; margin: .15rem 0; }
.rail-mini .track { height: 2.9rem; }
.rail-mini .track-pipe.p1 { top: .95rem; } .rail-mini .track-pipe.p2 { top: 1.75rem; }
.rail-mini .cart { top: .25rem; height: 2.4rem; }
.rail-mini .cart-body { left: -1.1rem; width: 2.2rem; height: 2.4rem; }
.rail-mini .lane-label { font-size: .62rem; padding: 0 .4rem; }
.rail-mini .ext-marker { font-size: .6rem; }
.rail-mini .stepper { margin-top: .9rem; padding-top: .8rem; }
.rail-mini + .stepper { margin-top: .8rem; padding-top: .8rem; }
@container app (max-width: 1024px) { .scene-wrap { height: 380px; } }
@container app (max-width: 700px) {
  .scene-wrap { height: 300px; }
  .hud-tl { top: .6rem; left: .6rem; } .hud-tr { top: auto; bottom: .6rem; right: .6rem; } .hud-bl { bottom: .6rem; left: .6rem; } .hud-br { display: none; }
  .hud-phase { font-size: 1.05rem; padding: .35rem .7rem; }
  .hud-chip { min-width: 0; padding: .3rem .6rem; } .hc-v { font-size: 1.35rem; } .hc-l { font-size: .6rem; }
  .hud-chip.time { display: none; }
  .hud-pos .big { font-size: 1.9rem; } .hud-of { display: none; } .hud-pos { padding: .3rem .7rem; }
  .scene-foot { padding: .7rem .8rem .8rem; }
  .scene-meta { font-size: .85rem; }
  .hud-sub .spray-badge { font-size: .72rem; }
}

/* card headers with actions */
.card-actions { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.mini-seg { display: inline-flex; background: var(--card-inner); border: 1px solid var(--card-line); border-radius: 999px; padding: 2px; gap: 2px; }
.mini-seg button { border: 0; background: transparent; color: var(--card-title); font-family: 'Jura'; font-weight: 700; font-size: .85rem; padding: .3rem .75rem; border-radius: 999px; cursor: pointer; white-space: nowrap; }
.mini-seg button.on { background: #0d9488; color: #fff; }
.stage[data-theme="dark"] .mini-seg button.on { background: linear-gradient(135deg, #00BFA5, #00897B); }
.chart { width: 100%; height: 300px; }
.chart.tall { height: 340px; }
.chart.short { height: 250px; }
.kcard .chart { margin-top: .2rem; }
/* a chart or the scene that could not be drawn keeps its box and says so */
.seems-module-fail { display: flex; align-items: center; justify-content: center; height: 100%; margin: 0; padding: 1rem; text-align: center; color: var(--card-muted); font-weight: 400; }
.scene-wrap .seems-module-fail { position: absolute; inset: 0; }
@container app (max-width: 700px) { .chart, .chart.tall { height: 270px; } }

/* KPI tiles with sparkline + delta */
.kt { position: relative; overflow: hidden; }
.kt .kval { font-size: clamp(1.7rem, 1.2vw + 1rem, 2.2rem); }
.kt .kcard-title { white-space: normal; line-height: 1.2; font-size: .98rem !important; }
.minibars b { font-weight: 600; }
.kt-delta { display: inline-flex; align-items: center; gap: .25rem; font-size: .85rem; font-weight: 700; padding: .1rem .5rem; border-radius: 999px; margin-top: .35rem; }
.kt-delta.good { background: rgba(1,161,59,.15); color: #3ecf6c; }
.kt-delta.bad { background: rgba(248,31,9,.13); color: #ff6b55; }
.kt-delta.flat { background: var(--card-line); color: var(--card-title); }
.stage[data-theme="light"] .kt-delta.good { color: #01803a; } .stage[data-theme="light"] .kt-delta.bad { color: #c62828; }
.kt-spark { position: absolute; right: .6rem; bottom: .5rem; width: 46%; height: 42px; opacity: .9; }
.kt .ksub { font-size: .82rem; color: var(--card-muted); font-weight: 400; }
.kt-icon { width: 2.1rem; height: 2.1rem; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.05rem; background: var(--accent-soft); color: var(--accent); flex-shrink: 0; }

/* progress bar */
.pbar { position: relative; height: .55rem; border-radius: 999px; background: var(--card-line); overflow: visible; margin: .55rem 0 .3rem; }
.pbar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; background: linear-gradient(90deg, #26a69a, #11f0d4); }
.pbar i.over { background: linear-gradient(90deg, #ffa14a, #ff6b55); }
.pbar b { position: absolute; top: -.25rem; width: 2px; height: 1.05rem; background: var(--card-text); opacity: .7; }

/* history duration bars */
.dbar { display: flex; align-items: center; gap: .5rem; min-width: 11rem; }
.dbar .track { flex: 1; height: .6rem; border-radius: 999px; background: var(--card-line); position: relative; overflow: hidden; display: flex; }
.dbar .track span { display: block; height: 100%; }
.dbar .avgm { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--accent); }
.dbar em { font-style: normal; font-size: .82rem; font-weight: 700; min-width: 3.2rem; text-align: right; }
.dbar em.slow { color: #ff8a3d; } .dbar em.fast { color: #3ecf6c; }

/* map */
.gmap-wrap { position: relative; }
.gmap-svg { width: 100%; height: auto; display: block; }
.gm-row { cursor: pointer; }
.gm-row:hover rect:nth-child(2) { filter: brightness(1.25); }
.gm-corr { fill: var(--card-title); font-family: 'Jura'; font-weight: 700; font-size: 11px; letter-spacing: .3em; text-anchor: middle; }
.gm-sec { fill: var(--card-text); font-family: 'Play'; font-weight: 700; font-size: 15px; }
.gm-sec-meta { fill: var(--card-muted); font-family: 'Play'; font-size: 11px; }
.gm-num { fill: var(--card-muted); font-family: 'Play'; font-size: 8px; text-anchor: middle; }
.gm-cart-t { fill: #5a2d07; font-family: 'Play'; font-weight: 800; font-size: 7px; text-anchor: middle; }
.gm-pulse { animation: gmpulse 1.6s ease-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes gmpulse { 0% { transform: scale(.6); opacity: .9; } 100% { transform: scale(1.8); opacity: 0; } }
.gm-cart.ghost { opacity: .4; filter: grayscale(1); }
.gm-tip { display: none; position: absolute; pointer-events: none; background: rgba(13,20,48,.96); color: #e3e7ff; border: 1px solid #2f3a66; border-radius: 10px; padding: .5rem .7rem; font-size: .85rem; line-height: 1.35; z-index: 5; box-shadow: 0 10px 28px rgba(0,0,0,.35); max-width: 230px; }
.stage[data-theme="light"] .gm-tip { background: #fff; color: #464646; border-color: #ddd; }
.minibars { display: flex; align-items: flex-end; gap: 4px; height: 70px; margin-top: .4rem; }
.minibars div { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; height: 100%; justify-content: flex-end; }
.minibars i { display: block; width: 100%; border-radius: 3px 3px 0 0; background: linear-gradient(#69d0fb, #2b6ea3); }
.minibars i.int { background: linear-gradient(#ff6b55, #b3160c); }
.minibars span { font-size: .6rem; color: var(--card-muted); white-space: nowrap; }

/* hero strip on analytics */
.hero-strip { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; }
.hero-strip .tomato { width: 44px; height: 44px; flex-shrink: 0; filter: drop-shadow(0 4px 10px rgba(229,57,53,.45)); }
.hero-title { font-family: 'Play'; font-weight: 700; font-size: 1.35rem; color: var(--card-text); }
.hero-sub { font-size: .9rem; color: var(--card-muted); font-weight: 400; }
.sec-table td .pbar { margin: 0; min-width: 6rem; }
.toggle { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.toggle::-webkit-scrollbar { display: none; }
.sbar-tomato { width: 22px; height: 22px; margin-right: .35rem; vertical-align: -4px; }

@container app (max-width: 700px) {
  .sbar-left { width: 100%; min-width: 0; }
  .toggle { justify-content: flex-start; width: 100%; min-width: 0; }
  .toggle button { flex: none; }
  .kcard-title { white-space: normal; line-height: 1.2; }
}
.stage[data-theme="light"] .hud .spray-badge { background: #0d6b8f; color: #fff; border-color: #0d6b8f; }
.hud .spray-badge { background: rgba(9,12,30,.74); }
