/* Innercore Data Sheet: touch-first (48px+ targets), one layout from phone to line terminal.
   Colour means one thing everywhere, and only exceptions get it:
     green = OK / no downtime / passed      red = blocks submitting / out of spec / failed
     amber = warning / hours lost / changed  blue = primary action / selected
   Normal states (in spec, ID OK, filled in) stay neutral so the exceptions stand out. */
:root {
  color-scheme: light;
  --bg: #e5eaf0; --card: #ffffff; --sunk: #f3f6fa; --ink: #111827; --muted: #475569; --line: #cbd5e1;
  --field: #64748b;                       /* strong input boundary under bright floor lighting */
  --brand: #1f3a5f; --brand-ink: #1f3a5f; --on-brand-muted: #d6e2f0;
  --accent: #1d4ed8; --accent-fg: #1d4ed8; --accent-bg: #e3eafd; --on-accent: #ffffff;
  --ok: #15803d; --ok-fg: #15803d; --ok-bg: #dcfce7; --ok-ink: #14532d;
  --bad: #b91c1c; --bad-fg: #b91c1c; --bad-bg: #fee2e2; --bad-ink: #7f1d1d;
  --warn: #b45309; --warn-fg: #b45309; --warn-bg: #fef3c7; --warn-ink: #78350f;
  --idle-bg: #e4e7ec; --idle-ink: #344054;
  --radius: 9px;
  --keyboard-occlusion: 0px;  /* updated by visualViewport / VirtualKeyboard APIs */
  --editing-reserve: 0px;     /* large fallback scroll reserve for overlay OSKs */
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0f172a; --card: #1e293b; --sunk: #111e31; --ink: #f1f5f9; --muted: #cbd5e1; --line: #475569;
    --field: #94a3b8;
    --brand: #142c4a; --brand-ink: #dbeafe; --on-brand-muted: #d6e2f0;
    --accent: #2563eb; --accent-fg: #93c5fd; --accent-bg: #1e3a8a;
    --ok-fg: #4ade80; --ok-bg: #0f2a1a; --ok-ink: #86efac;
    --bad-fg: #f87171; --bad-bg: #3b1212; --bad-ink: #fca5a5;
    --warn-fg: #fbbf24; --warn-bg: #36250a; --warn-ink: #fcd34d;
    --idle-bg: #334155; --idle-ink: #e2e8f0;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 18px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--ink);
       font-variant-numeric: tabular-nums; }
button, input, select, textarea { font: inherit; }
a { color: var(--accent-fg); }
.i { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.i.sm { width: 18px; height: 18px; }
.i.lg { width: 28px; height: 28px; }
:focus-visible { outline: 3px solid var(--accent-fg); outline-offset: 3px; }

/* ---- header: home, what you're looking at, connection ---- */
header.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; min-height: 68px;
             padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top)); background: var(--brand); color: #fff;
             box-shadow: 0 2px 8px rgba(15,23,42,.12); }
.home { display: grid; place-items: center; flex: none; width: 48px; height: 48px; border-radius: 8px; background: rgba(255,255,255,.13); color: #fff; }
.ctx { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.ctx b { font-size: 20px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctx span { font-size: 15px; font-weight: 550; color: var(--on-brand-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctx span:empty { display: none; }
.net { display: inline-flex; align-items: center; max-width: 46vw; min-height: 36px; padding: 4px 14px; border-radius: 99px; font-size: 15px; font-weight: 650;
       white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: rgba(255,255,255,.14); color: #fff; }
.net.off { background: #fbbf24; color: #3b2203; }   /* offline is a warning, not an error: work is kept on the device */
.net.bad { background: #b91c1c; color: #fff; }      /* a save actually failed */

/* A focused input must be scrollable above an overlay keyboard. Real app: do
   not replace this with a permanently enormous bottom margin on every screen. */
main { max-width: 1100px; margin: 0 auto; padding: 18px 16px calc(160px + max(var(--keyboard-occlusion), var(--editing-reserve))); }
body.editing { --editing-reserve: max(65vh, 320px); }
body.editing .summary { visibility: hidden; pointer-events: none; }
h1 { font-size: 25px; font-weight: 800; line-height: 1.2; margin: 6px 0 12px; }
h2 { font-size: 21px; font-weight: 750; line-height: 1.25; margin: 24px 0 12px; }
h3 { margin: 0; font-weight: 750; }
p { margin: 8px 0; }
.muted { color: var(--muted); }
.fine { font-size: 15px; }
.lab { display: block; font-size: 15px; font-weight: 700; color: var(--muted); }
.sp { flex: 1; min-width: 0; }
.grow { flex: 1 1 220px; min-width: 0; }
.warnt { color: var(--warn-fg); }

/* ---- surfaces ---- */
.card { display: block; margin: 14px 0; padding: 18px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
        color: inherit; text-decoration: none; box-shadow: 0 1px 3px rgba(15,23,42,.045); }
.card.empty { background: transparent; border-style: dashed; color: var(--muted); }
.card > h2:first-child { margin-top: 0; }
.chead { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 12px; }
.chead h2 { margin: 0; }
.banner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin: 14px 0; padding: 12px 12px 12px 16px; background: var(--card);
          border: 2px solid var(--line); border-radius: var(--radius); color: var(--ink); text-decoration: none; }
.banner > .i { width: 24px; height: 24px; }
.banner.warn { border-color: var(--warn); border-left-width: 6px; } .banner.warn > .i { color: var(--warn-fg); }
.banner.bad { border-color: var(--bad); border-left-width: 6px; }   .banner.bad > .i { color: var(--bad-fg); }
.banner.ok { border-color: var(--ok); border-left-width: 6px; }     .banner.ok > .i { color: var(--ok-fg); }
.banner .btn { min-height: 48px; }
.banner a.grow { color: inherit; }

/* Finish tabs: what blocks (red) vs what to check (amber), each with a way to go fix it */
.group { margin: 12px 0; overflow: hidden; background: var(--card); border: 2px solid; border-radius: var(--radius); }
.group > .gh { display: flex; align-items: center; gap: 10px; padding: 12px 16px; font-size: 19px; font-weight: 800; }
.group.bad { border-color: var(--bad); }   .group.bad > .gh { background: var(--bad-bg); color: var(--bad-ink); }
.group.warn { border-color: var(--warn); } .group.warn > .gh { background: var(--warn-bg); color: var(--warn-ink); }
.gi { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; min-height: 64px; padding: 8px 12px 8px 16px; border-top: 1px solid var(--line); }
.gi .grow { min-width: 220px; }
.gbtns { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---- buttons ---- */
.btn, .big { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 56px; padding: 0 18px;
             font-size: 18px; font-weight: 700; border: 1.5px solid var(--field); border-radius: 8px; background: var(--card); color: var(--ink);
             text-decoration: none; cursor: pointer; white-space: nowrap; }
.big { width: 100%; min-height: 64px; margin-top: 12px; }
.btn.primary, .big.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn:disabled, .big:disabled { background: var(--idle-bg); border-color: var(--idle-bg); color: var(--idle-ink); cursor: not-allowed; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--accent-fg); }
.btn.danger { background: transparent; border-color: transparent; color: var(--bad-fg); }
.small { display: inline-flex; align-items: center; gap: 6px; min-height: 48px; padding: 0 14px; font-size: 16px; font-weight: 700;
         border: 1.5px solid var(--field); border-radius: 8px; background: var(--card); color: var(--ink); cursor: pointer; text-decoration: none; }
.icon { display: inline-grid; place-items: center; min-width: 56px; min-height: 56px; padding: 0; border: 1.5px solid var(--field); border-radius: 8px;
        background: var(--card); color: var(--ink); cursor: pointer; }
@media (hover: hover) {
  .btn:not(:disabled):hover, .small:hover, .icon:hover, .seg button:not(.on):hover, .mpick button:not(.on):hover { background: var(--accent-bg); }
  .btn.primary:not(:disabled):hover, .big.primary:not(:disabled):hover { filter: brightness(1.08); }
}

/* ---- fields ---- */
.f { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.f > span:first-child { font-size: 16px; font-weight: 700; color: var(--muted); }
input, select, textarea { width: 100%; min-height: 60px; padding: 10px 13px; font-size: 22px; font-weight: 650; line-height: 1.25; color: var(--ink);
                          background: var(--card); border: 2px solid var(--field); border-radius: 8px; scroll-margin-top: clamp(100px, 20vh, 180px); }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--accent-fg); outline-offset: 2px; border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--muted); font-weight: 450; }
textarea { min-height: 124px; font-size: 20px; font-weight: 500; resize: vertical; }
input[data-t="wall"], input[data-t="num"], input[data-st="num"] { font-size: 26px; font-weight: 750; }
input.out { background: var(--bad); border-color: var(--bad); color: #fff; }
input.invalid { border-color: var(--bad); outline: 3px solid var(--bad); }
input.out:focus, input.invalid:focus, input[aria-invalid="true"]:focus { outline-color: var(--bad); border-color: var(--bad); }
input.changed { background: var(--warn-bg); border-color: var(--warn); color: var(--warn-ink); }
input.need { border-style: dashed; }
input:disabled, select:disabled, textarea:disabled { background: transparent; border-style: dashed; border-color: var(--line); color: var(--ink); opacity: 1; }
.hint { font-size: 15px; font-weight: 700; color: var(--warn-fg); }
.hint:empty { display: none; }

.row2, .row3, .row4 { display: grid; gap: 12px; margin: 10px 0; }
.row2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.row3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.row4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.endrow { align-items: end; }

.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg button { min-height: 60px; min-width: 64px; padding: 0 18px; font-size: 18px; font-weight: 700; border: 1.5px solid var(--field);
              border-radius: 8px; background: var(--card); color: var(--ink); cursor: pointer; }
.seg button.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.seg button.need { border-style: dashed; }
.seg.id { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.seg.id button { min-width: 0; padding: 0 6px; }
.seg.id button.on.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.seg.id button.on.bad { background: var(--bad); border-color: var(--bad); color: #fff; }
.seg.tiles3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.seg.tiles3 button { min-height: 64px; font-size: 20px; }

/* ---- tabs ---- */
.tabs { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); margin: -14px -16px 12px; background: var(--card); border-bottom: 1px solid var(--line); }
.tabs a { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 60px; padding: 0 10px; font-weight: 700; color: var(--muted);
          text-decoration: none; border-bottom: 4px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--accent-fg); border-bottom-color: var(--accent); }
.tabs .cnt { font-weight: 500; }
.wide { display: none; }
@media (min-width: 1000px) { .wide { display: inline; } }

.chip { display: inline-flex; align-items: center; gap: 5px; min-height: 28px; padding: 2px 10px; border-radius: 99px; font-size: 15px; font-weight: 700;
        white-space: nowrap; background: var(--idle-bg); color: var(--idle-ink); }
.chip.open, .chip.reopened, .chip.info { background: var(--accent-bg); color: var(--accent-fg); }
.chip.submitted, .chip.ok { background: var(--ok-bg); color: var(--ok-ink); }
.chip.bad { background: var(--bad-bg); color: var(--bad-ink); }
.chip.warnc { background: var(--warn-bg); color: var(--warn-ink); }

/* ---- spec strip ---- */
.spec { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px 36px; margin: 14px 0; padding: 14px 18px; background: var(--card);
        border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: var(--radius); }
.spec > div { display: flex; flex-direction: column; }
.spec span { font-size: 15px; font-weight: 700; color: var(--muted); }
.spec b { font-size: 27px; font-weight: 800; color: var(--brand-ink); }
.spec .note { flex-basis: 100%; font-size: 15px; color: var(--muted); }

/* ---- runs: finished runs are one row each, one run is open for entry ---- */
.runs { margin: 12px 0; overflow: hidden; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.runrow, .runhead { display: grid; grid-template-columns: 76px 100px minmax(0, 1fr) 64px 84px 24px; align-items: center; gap: 10px; width: 100%; padding: 6px 12px; }
.runhead { min-height: 36px; font-size: 14px; font-weight: 650; color: var(--muted); }
.runrow { min-height: 70px; font-size: 18px; text-align: left; color: var(--ink); background: transparent; border: 0; border-top: 1px solid var(--line); cursor: pointer; }
.runrow .no b { display: block; font-size: 19px; }
.runrow .no small { font-size: 14px; color: var(--muted); }
.runrow .r, .runhead .r { text-align: right; }
.st { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; color: var(--muted); }
.st .more { font-size: 15px; font-weight: 700; }
.run { margin: 8px; padding: 16px 18px; border: 2px solid var(--accent); border-radius: var(--radius); background: var(--card); }
.run-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.run-head h3 { font-size: 22px; }
.run-head .btn { min-height: 48px; }
.run-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 10px; }
.mx { display: grid; grid-template-columns: 104px repeat(3, minmax(0, 1fr)); align-items: start; gap: 10px; margin-top: 14px; }
.mx .corner { align-self: end; font-size: 14px; line-height: 1.2; color: var(--muted); }
.mx .ch { font-size: 18px; font-weight: 800; text-align: center; }
.mx .rl { display: flex; align-items: center; min-height: 56px; font-size: 16px; font-weight: 700; color: var(--muted); }
.mx input { text-align: center; }
.flag { display: flex; align-items: center; justify-content: center; gap: 4px; margin-top: 4px; font-size: 15px; font-weight: 750; color: var(--bad-fg); }
.flag:empty { display: none; }
.idfail { margin-top: 12px; }
.run-foot { display: grid; grid-template-columns: minmax(0, 1fr) 150px 110px; align-items: end; gap: 12px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.defects { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.defect { display: grid; grid-template-columns: minmax(0, 1fr) 96px 56px; gap: 8px; }
.defects .btn.ghost { align-self: flex-start; min-height: 48px; padding: 0 6px; }
.goodbox b { display: flex; align-items: center; min-height: 56px; font-size: 24px; }

/* ---- bottom summary bar (sheet + hours-lost board) ---- */
.summary { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; align-items: center; gap: 10px 20px;
           padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--brand); color: #fff;
           box-shadow: 0 -3px 10px rgba(15,23,42,.14); }
.summary:empty { display: none; }
.sumstats { display: flex; flex-wrap: wrap; align-items: center; flex: 1; gap: 6px 24px; min-width: 0; }
.stat .k { display: block; font-size: 14px; color: var(--on-brand-muted); }
.stat .v { display: block; font-size: 24px; font-weight: 750; }
.stat .v.sm { font-size: 19px; }
.stat.sep { padding-left: 20px; border-left: 1px solid rgba(255,255,255,.25); }
.summary .btn { flex: none; min-height: 60px; font-size: 19px; }

/* ---- lists (home) ---- */
.list { display: grid; gap: 10px; }
.item { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto 24px; align-items: center; gap: 14px; min-height: 92px; padding: 14px 16px;
        background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); color: inherit; text-decoration: none; }
.mno { display: grid; place-items: center; width: 64px; height: 62px; font-size: 25px; font-weight: 850; background: var(--sunk); border: 1px solid var(--line); border-radius: 8px; color: var(--brand-ink); }
.item .body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.item .t1 { font-size: 21px; font-weight: 800; }
.item .t2 { font-size: 16px; color: var(--muted); }
.item .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.item .tags:empty { display: none; }
.item .right { font-size: 24px; font-weight: 800; text-align: right; white-space: nowrap; }
.item .right small { display: block; font-size: 14px; font-weight: 600; color: var(--muted); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin: 4px 0 12px; }
.tile { display: flex; flex-direction: column; justify-content: center; gap: 5px; min-height: 110px; padding: 18px 20px; color: var(--ink); text-decoration: none;
        background: var(--card); border: 1.5px solid var(--field); border-radius: var(--radius); }
.tile.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.tile b { display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 800; }
.tile span { font-size: 15px; opacity: .85; }
.actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.actions .btn { min-height: 64px; font-size: 19px; }

/* ---- new sheet ---- */
.mpick { display: grid; grid-template-columns: repeat(auto-fit, minmax(88px, 1fr)); gap: 8px; }
.mpick button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 92px; padding: 7px;
                border: 1.5px solid var(--field); border-radius: var(--radius); background: var(--card); color: var(--ink); cursor: pointer; }
.mpick b { font-size: 28px; font-weight: 850; line-height: 1.1; }
.mpick small { font-size: 14px; color: var(--muted); }
.mpick button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.mpick button.on small { color: #dbe5ff; }
.foot { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.foot .btn { min-width: 240px; min-height: 64px; font-size: 20px; }

/* ---- process & downtime ---- */
.ovens { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.dtline { display: grid; grid-template-columns: minmax(0, 1.2fr) 110px minmax(0, 1.8fr) 56px; align-items: end; gap: 12px; margin: 8px 0; padding: 12px 14px;
          background: var(--sunk); border: 1px solid var(--line); border-radius: 10px; }
.dtline > b { align-self: center; font-size: 19px; }
.catgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.chg { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 15px; font-weight: 750; }
.chg .btn { min-height: 48px; padding: 0 8px; }

/* ---- tables ---- */
.scroll { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 17px; background: var(--card); }
.tbl th, .tbl td { padding: 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl th { font-size: 15px; font-weight: 700; color: var(--muted); border-bottom-width: 1.5px; vertical-align: bottom; }
.tbl th small { display: block; font-weight: 500; }
.tbl .r { text-align: right; }
.tbl .z { color: var(--muted); }
.tbl .now { background: var(--accent-bg); }
.tbl tr.tot td { font-size: 19px; font-weight: 800; border-top: 2px solid var(--ink); }
.tbl .btn { min-height: 48px; }
.card > .scroll:first-child, .card > .tbl { margin: 0 -6px; }

/* ---- daily report ---- */
.daynav { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.daynav input { max-width: 260px; justify-self: center; text-align: center; font-weight: 750; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi b { display: block; font-size: 32px; font-weight: 850; line-height: 1.1; }
.kpi small { display: block; font-size: 15px; color: var(--muted); }

/* ---- hours-lost board: a tile per machine, the picked machine's lines below ---- */
.mtiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(88px, 1fr)); gap: 8px; margin: 8px 0 16px; padding: 4px; }
.mtile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 108px; padding: 8px 4px;
         border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--ink); cursor: pointer; }
.mtile b { font-size: 28px; font-weight: 800; line-height: 1; }
.mtile span { display: flex; align-items: center; gap: 4px; font-size: 15px; font-weight: 750; line-height: 1.15; text-align: center; }
.mtile.lost span { color: var(--warn-fg); }
.mtile.none span { color: var(--ok-fg); }
.mtile.empty { background: var(--idle-bg); border: 2.5px dashed var(--field); }
.mtile.sel { outline: 4px solid var(--accent); outline-offset: 3px; }
.mcard { border: 2px solid var(--accent); border-left-width: 5px; }
.mhead { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 4px; }
.mhead .mno-l { font-size: 26px; font-weight: 800; }
.entry { display: grid; gap: 12px; margin: 10px 0; padding: 12px 14px; background: var(--sunk); border: 1px solid var(--line); border-radius: var(--radius); }
.entry-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.entry-head .cat { min-width: 110px; font-size: 20px; font-weight: 750; }
.seg.planned { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; width: min(300px, 100%); }
.seg.planned button { min-width: 0; padding: 0 8px; }
.hours { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.hours .lab { min-width: 64px; }
.seg.quick button { min-width: 56px; padding: 0 8px; }
.hours .hrs { width: 112px; }
.nodown { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 72px; font-size: 20px; font-weight: 750;
          border: 2px solid var(--ok); border-radius: var(--radius); background: var(--card); color: var(--ok-fg); cursor: pointer; }
.nodown.on { background: var(--ok-bg); color: var(--ok-ink); }
.or { display: flex; align-items: center; gap: 12px; margin: 14px 0; font-weight: 650; color: var(--muted); }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---- tablet set-up ---- */
.keycard { max-width: 620px; margin: 64px auto; padding: 28px; }
.keyrow { display: grid; grid-template-columns: minmax(0, 1fr) 64px; gap: 8px; }

.toast { position: fixed; left: 50%; bottom: 120px; z-index: 30; max-width: 90vw; padding: 12px 18px; transform: translateX(-50%);
         font-size: 17px; border-radius: 10px; background: #111827; color: #fff; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.toast.ok { background: var(--ok); }
.toast.bad { background: #b91c1c; }

@media (max-width: 760px) {
  .runrow, .runhead { grid-template-columns: 70px minmax(0, 1fr) 76px 20px; }
  .hide-sm { display: none; }
  .run-foot { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .run-foot .defects { grid-column: 1 / -1; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .row2, .row3, .row4 { grid-template-columns: 1fr; }
  .ovens { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .run-meta { grid-template-columns: 1fr; }
  .mx { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .mx .corner { display: none; }
  .mx .rl { grid-column: 1 / -1; min-height: 0; margin-top: 4px; }
  .seg.id { grid-template-columns: 1fr; }
  .dtline { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 56px; }
  .dtline > b { grid-column: 1 / -1; }
  .tabs { grid-auto-columns: max-content; overflow-x: auto; }
  .runrow, .runhead { grid-template-columns: 64px minmax(0, 1fr) 60px 18px; gap: 8px; }
  .st .chip { white-space: normal; }
  .daynav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .daynav input { grid-column: 1 / -1; grid-row: 1; max-width: none; }
  .summary { gap: 8px 12px; }
  .sumstats { gap: 2px 14px; }
  .stat .k { font-size: 12px; }
  .stat.sep { padding-left: 12px; }
  .summary .btn { min-height: 52px; padding: 0 12px; font-size: 17px; }
  .item { grid-template-columns: 56px minmax(0, 1fr) auto; }
  .item > .i { display: none; }
  .mno { width: 56px; }
  .stat .v, .stat .v.sm { font-size: 17px; }
  .summary .btn { min-height: 56px; }
  .foot .btn { width: 100%; }
  .keycard { margin: 24px auto; }
}
