/* Datum Link demo — the app itself. Shares tokens and components with styles.css.
   Displays here are plain glass: no bezel, no screws. */

body.demo { overflow: hidden; }
.appframe { display: grid; grid-template-columns: 264px minmax(0, 1fr); height: 100vh; height: 100dvh; }

/* sidebar */
.side { background: var(--body); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 22px; padding: 20px 16px; overflow-y: auto; }
.side__brand { display: flex; align-items: center; gap: 12px; text-decoration: none; padding: 4px 6px 6px; }
.keycol { display: flex; flex-direction: column; gap: 2px; }
.keycol > .key:first-child { border-radius: var(--r-key-end) var(--r-key-end) var(--r-key) var(--r-key); }
.keycol > .key:last-child { border-radius: var(--r-key) var(--r-key) var(--r-key-end) var(--r-key-end); }
.navbtn.key { width: 100%; min-height: 56px; gap: 4px; }
.navbtn .key__cap { font-size: 16px; }
.navbtn[aria-current="page"] { background: var(--sel-bg); color: var(--sel-fg); }
.navbtn[aria-current="page"] .key__sub { color: var(--sel-sub); }
.navbtn[disabled] { opacity: 0.5; cursor: not-allowed; }
.navbtn[disabled]:hover { background: var(--key-dark); }
.navbtn[disabled]:active { transform: none; }
.side__hint { margin: -14px 6px 0; font-size: 13px; color: var(--muted); }
.side__hint[hidden] { display: none; }
.side__kit { display: flex; flex-direction: column; gap: 8px; }
.side__kit .label { margin: 0 6px 4px; }
.sk { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 10px; align-items: center; padding: 6px; border-radius: var(--r-key-end); }
.sk.is-active { background: var(--hover); }
.sk__glass { background: var(--glass); border-radius: 3px; height: 34px; display: flex; align-items: center; justify-content: center; padding: 0 8px; }
.sk__glass svg { width: 100%; height: 18px; }
.sk__glass.is-teal { background: var(--glass-teal); }
.sk__glass.is-off svg { opacity: 0.18; }
.sk__name { font-size: 14px; line-height: 1.2; }
.sk__meta { font-family: var(--mono); font-size: 11.5px; color: var(--muted); letter-spacing: 0.03em; margin-top: 3px; }
.sk__analog { font-size: 13px; color: var(--muted); padding: 4px 6px 0; }
.side__foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; padding: 0 6px; }

/* main column */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px 20px; flex-wrap: wrap; padding: 16px 28px; border-bottom: 1px solid var(--line); }
.topbar h1 { margin: 2px 0 0; font-weight: 500; font-size: 22px; letter-spacing: -0.005em; }
.topbar__right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.btn--sm { min-height: 36px; padding: 7px 12px; font-size: 14px; }
.screen-area { flex: 1 1 auto; overflow-y: auto; padding: 26px 28px 110px; outline: none; }
.screen-in { animation: enter 0.28s ease-out; }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .screen-in { animation: none; } }

/* glass: a display without its bezel */
.glass { background: var(--glass); border-radius: 4px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 18px 20px; min-height: 120px; }
.glass.is-teal { background: var(--glass-teal); }
.glass.is-teal .legends { color: #3c4044; }
.glass .readout { justify-content: flex-start; gap: 6%; }
.glass--xl { min-height: 190px; padding: 26px 28px; }
.glass--xl .readout svg { height: 104px; width: auto; max-width: 100%; }
@media (max-width: 600px) { .glass--xl .readout svg { height: 64px; } .glass--xl { min-height: 130px; padding: 18px; } }
.glass .legends { font-size: 13px; }
.dkeys { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 3px; margin-top: 8px; }
.dkeys .key { background: var(--key); color: var(--ink); min-height: 50px; padding: 7px 11px; }
.dkeys .key:hover { background: #8d9296; }
.dkeys .key__sub { color: #0b0c0d; }
:root[data-theme="day"] .dkeys .key__sub { color: #0b0c0d; }
.dkeys .key--aux { background: var(--key-dark); color: var(--muted); box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.35); }
.dkeys .key--aux:hover { background: var(--key-hover); }
.dkeys .key--aux .key__sub { color: var(--muted); }
:root[data-theme="day"] .dkeys .key--aux { color: var(--text-2); box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.16); }
:root[data-theme="day"] .dkeys .key--aux .key__sub { color: var(--text-2); }
.dkeys .key.is-cue { background: var(--alu-hi); box-shadow: 0 0 0 2px var(--text), inset 0 -2px 0 rgba(0, 0, 0, 0.2); }
.dkeys .key[disabled] { opacity: 0.55; cursor: default; }
.dkeys > .key:first-child { border-top-left-radius: var(--r-key-end); border-bottom-left-radius: var(--r-key-end); }
.dkeys > .key:last-child { border-top-right-radius: var(--r-key-end); border-bottom-right-radius: var(--r-key-end); }

/* layouts */
.cols { display: grid; gap: 20px; }
.cols--home { grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); }
.cols--setup { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
.cols--inspect { grid-template-columns: 250px minmax(0, 1fr) minmax(300px, 0.85fr); align-items: start; }
.cols--report { grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); }
.cols--kit { grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); }
.stack-sm { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.h2 { font-weight: 400; font-size: clamp(26px, 2.6vw, 36px); letter-spacing: -0.015em; margin: 0 0 8px; line-height: 1.08; }
.lead { font-size: 17px; color: var(--text-2); margin: 0 0 22px; max-width: 58ch; font-weight: 400; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1 1 auto; }

/* connect */
.connect { max-width: 1080px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(300px, 1fr); gap: 30px; align-items: center; padding-top: 2vh; }
.connect__visual { position: relative; border-radius: 2.2% / 3.5%; overflow: hidden; transition: filter 0.6s, opacity 0.6s; }
.connect__visual.is-off { filter: grayscale(1) brightness(0.55); opacity: 0.8; }
:root[data-theme="day"] .connect__visual.is-off { filter: grayscale(1) brightness(0.92) contrast(0.85); opacity: 0.6; }
.connect__visual .screen { transition: opacity 0.3s; }
.found { list-style: none; margin: 26px 0 0; padding: 0; border-top: 1px solid var(--line); }
.found li { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 12px; align-items: center; min-height: 46px; border-bottom: 1px solid var(--line); font-size: 15px; color: var(--text); }
.found .mono { font-size: 12px; color: var(--muted); }
.tick { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--dim); }
.is-on .tick { background: var(--ok); border-color: var(--ok); }

/* home */
.list { display: flex; flex-direction: column; gap: 2px; }
.item { display: grid; grid-template-columns: 76px minmax(0, 1fr) auto auto; gap: 16px; align-items: center; min-height: 64px; padding: 10px 14px; border-radius: var(--r-key); background: var(--body-2); border: 0; text-align: left; color: var(--text); width: 100%; }
.item:first-child { border-radius: var(--r-key-end) var(--r-key-end) var(--r-key) var(--r-key); }
.item:last-child { border-radius: var(--r-key) var(--r-key) var(--r-key-end) var(--r-key-end); }
.item__id { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.item__name { font-size: 16px; }
.item__sub { font-size: 13px; color: var(--muted); }
.item.is-new { box-shadow: inset 3px 0 0 var(--text); }
.bigcta { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; border: 0; cursor: pointer; text-align: left; background: var(--sel-bg); color: var(--sel-fg); border-radius: var(--r-body); padding: 22px 24px; margin-bottom: 22px; }
.bigcta strong { display: block; font-size: 22px; font-weight: 500; }
.bigcta span { font-size: 14px; color: var(--sel-sub); }
.bigcta:hover { filter: brightness(1.06); }

/* setup */
.drop { border: 1.5px dashed var(--line-2); border-radius: var(--r-body); padding: 30px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.filecard { display: flex; gap: 14px; align-items: center; text-align: left; border: 1px solid var(--line-2); background: var(--well); border-radius: var(--r-key-end); padding: 14px 16px; cursor: pointer; color: var(--text); min-width: min(100%, 340px); }
.filecard:hover { border-color: var(--text); }
.parse { height: 4px; background: var(--line-2); border-radius: 2px; overflow: hidden; width: min(100%, 340px); }
.parse i { display: block; height: 100%; width: 0; background: var(--fill); transition: width 0.9s ease-out; }
.featrow { display: grid; grid-template-columns: 24px 34px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; min-height: 48px; padding: 6px 10px; border-radius: var(--r-key); cursor: pointer; }
.featrow:hover { background: var(--hover); }
.featrow input { width: 22px; height: 22px; accent-color: var(--text); margin: 0; }
.featrow .mono { font-size: 12px; color: var(--muted); }
.featrow.is-off { color: var(--dim); }
.chipnote { font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.05em; color: var(--muted); border: 1px solid var(--line-2); border-radius: var(--r-key); padding: 3px 7px; white-space: nowrap; }

/* inspect */
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.step { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 10px; align-items: center; min-height: 50px; padding: 6px 10px; border-radius: var(--r-key); background: var(--body-2); }
.step:first-child { border-radius: var(--r-key-end) var(--r-key-end) var(--r-key) var(--r-key); }
.step:last-child { border-radius: var(--r-key) var(--r-key) var(--r-key-end) var(--r-key-end); }
.step .mono { font-size: 11.5px; color: var(--muted); }
.step__name { font-size: 14.5px; line-height: 1.2; }
.step__val { font-family: var(--mono); font-size: 13.5px; }
.step.is-now { background: var(--sel-bg); color: var(--sel-fg); }
.step.is-now .mono { color: var(--sel-sub); }
.step.is-done .step__val { color: var(--text); }
.step.is-out .step__val { color: var(--out); }
.step.is-now.is-out .step__val { color: var(--sel-fg); }
.step.is-now { min-width: 0; }
.now { background: var(--body-2); border: 1px solid var(--line); border-radius: var(--r-body); padding: 22px 24px; }
.now__title { font-weight: 400; font-size: clamp(26px, 2.4vw, 34px); margin: 0 0 6px; letter-spacing: -0.015em; }
.now__do { font-size: 16px; margin: 0 0 18px; color: var(--text-2); }
.target { display: flex; gap: 22px; flex-wrap: wrap; margin: 0 0 16px; font-family: var(--mono); font-size: 13px; color: var(--muted); }
.target b { color: var(--text); font-weight: 400; }
.state-line { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 10px; min-height: 18px; }
.verdictbar { margin-top: 14px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.typed { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.typed .field { flex: 0 1 220px; }
.minisheet { width: 100%; border-collapse: collapse; font-size: 14px; }
.minisheet th { text-align: left; font-family: var(--mono); font-weight: 400; font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); padding: 0 6px 8px; border-bottom: 1px solid var(--line); }
.minisheet td { padding: 9px 6px; border-bottom: 1px solid var(--line); }
.minisheet .n { font-family: var(--mono); font-size: 14px; }
.flashrow td { animation: flash 1.2s ease-out; }
@media (prefers-reduced-motion: reduce) { .flashrow td { animation: none; } }

/* coach: a strip of display glass */
.coach { position: fixed; left: 280px; bottom: 18px; display: flex; gap: 14px; align-items: center; max-width: min(660px, calc(100vw - 300px)); background: var(--glass); color: var(--lit); border-radius: var(--r-glass); padding: 11px 16px; font-size: 14px; box-shadow: inset 0 0 0 1px #000, 0 12px 30px rgba(0, 0, 0, 0.32); z-index: 20; }
.coach__lg { font-size: 12.5px; font-weight: 500; color: var(--lit); }
.coach__step svg { display: block; height: 16px; width: auto; }
.coach__text { color: var(--lit); line-height: 1.35; }

/* states added for the full loop */
:root { --on-out: #0b0c0d; }
:root[data-theme="day"] { --on-out: #ffffff; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
#screenTitle:focus, .h2:focus { outline: none; }
.btn[disabled], .btn[aria-disabled="true"] { background: transparent; color: var(--muted); border: 1px dashed var(--line-2); cursor: not-allowed; filter: none; }
.btn[disabled]:hover, .btn[aria-disabled="true"]:hover { border-color: var(--line-2); filter: none; }
.btn--done { display: inline-flex; align-items: center; gap: 8px; border-color: var(--ok-line); }
.btn--done[disabled] { color: var(--text); border: 1px solid var(--ok-line); cursor: default; }
.chipnote--low { border-style: dashed; color: var(--text); }
.setup-notes { margin: 16px 4px 0; display: flex; flex-direction: column; gap: 8px; max-width: 70ch; }
.setup-notes p { margin: 0; }
.setup-notes b { font-weight: 500; color: var(--text); }
.lgchip { display: inline-flex; gap: 10px; background: var(--glass); border-radius: var(--r-glass); padding: 6px 10px; font-size: 12.5px; font-weight: 500; color: #3c4044; white-space: nowrap; }
.lgchip .on { color: var(--lit); }
.lgchip .on.is-out { color: #ff8a3d; }
.item--open { cursor: pointer; font: inherit; }
.item--open:hover { background: var(--hover); }
.ref-on { font-weight: 500; }
.outmark { display: inline-block; background: var(--out); color: var(--on-out); font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; line-height: 1.5; padding: 0 5px; border-radius: 2px; vertical-align: 1px; }
.glass .legends .on.is-out { color: #ff8a3d; }
.vchip { display: inline-flex; gap: 10px; align-items: baseline; flex-wrap: wrap; font-family: var(--mono); font-size: 15px; padding: 9px 14px; border-radius: var(--r-key-end); }
.vchip b { font-family: var(--sans); font-weight: 500; font-size: 17px; }
.vchip--out { background: var(--out); color: var(--on-out); }
.vchip--in { border: 1px solid var(--ok-line); color: var(--ok); }
@media (hover: none) { .nowmeta > :last-child { display: none; } }
.demo .devchart { min-width: 560px; }
.demo .devrow { grid-template-columns: 30px 140px minmax(160px, 1fr) 72px 70px 64px; }
.nowmeta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; margin: 18px 0 0; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.report-top { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-bottom: 18px; }
.report-top .h2 { margin: 0; flex: 1 1 420px; }
.report-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.gate { flex-basis: 100%; margin: 0; text-align: right; color: var(--text-2); }
.linkbtn { border: 0; background: none; padding: 0; font: inherit; color: var(--text); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.ctanote { margin: -12px 2px 22px; }
.confirm { border: 1px solid var(--out-line); border-radius: var(--r-body); padding: 14px 16px; margin: -8px 0 22px; }
.confirm p { margin: 0 0 12px; }
#restart.is-armed { border-color: var(--out); color: var(--text); }
.demo .theme button { min-height: 44px; }
.demo .btn--sm { min-height: 44px; }
.panel--out { border-color: var(--out-line); }
.stamp { display: flex; gap: 10px; align-items: baseline; background: var(--well); box-shadow: var(--well-edge); border-radius: var(--r-glass); padding: 10px 12px; margin: 0 0 10px; font-size: 15px; }
.stamp b { font-weight: 500; }
.dispform fieldset { border: 0; padding: 0; margin: 0; }
.dispform legend { padding: 0; color: var(--text-2); }
.dispnote { margin-top: 10px; }
.dispnote[hidden] { display: none; }
.formmsg { color: var(--out); }
.pt-val { fill: var(--draw-hl); font-family: var(--mono); font-size: 16px; }
.partwrap--wb { margin: 6px 0 8px; }
.panel--light { --draw: #2b2e31; --draw-2: #5d6266; --draw-hid: #858a8e; --draw-hl: #121314; --draw-call: #c8cbcd; --draw-call-text: #3b3f42; }
:root[data-theme="day"] .panel--light { --draw: #c8cbcd; --draw-2: #8c9196; --draw-hid: #6b7074; --draw-hl: #f2f2ee; --draw-call: #1a1c1e; --draw-call-text: #a6abaf; }
.panel--light .pair s { opacity: 0.6; }

/* responsive */
@media (max-width: 1180px) {
  .cols--inspect { grid-template-columns: minmax(0, 1fr) minmax(280px, 0.9fr); }
  .cols--inspect > .steps-col { grid-column: 1 / -1; }
  .steps { flex-direction: row; overflow-x: auto; scroll-snap-type: x proximity; padding-bottom: 6px; -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); mask-image: linear-gradient(90deg, #000 88%, transparent); }
  .step { min-width: 170px; scroll-snap-align: center; }
  .step.is-now { min-width: 210px; }
}
@media (max-width: 900px) {
  body.demo { overflow: auto; }
  .appframe { grid-template-columns: minmax(0, 1fr); height: auto; }
  .side { border-right: 0; border-bottom: 1px solid var(--line); flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 12px 16px; }
  .keycol { flex-direction: row; flex-wrap: wrap; }
  .keycol > .key:first-child { border-radius: var(--r-key-end) var(--r-key) var(--r-key) var(--r-key-end); }
  .keycol > .key:last-child { border-radius: var(--r-key) var(--r-key-end) var(--r-key-end) var(--r-key); }
  .side__hint { margin: 0; flex-basis: 100%; }

  .side__kit { display: none; }
  .side__foot { margin: 0 0 0 auto; flex-direction: row; align-items: center; padding: 0; }
  .side__foot a { display: none; }
  .navbtn.key { width: auto; min-height: 48px; }
  .screen-area { overflow: visible; padding: 20px 16px 110px; }
  .topbar { padding: 14px 16px; }
  .cols--home, .cols--setup, .cols--inspect, .cols--report, .cols--kit, .connect { grid-template-columns: minmax(0, 1fr); }
  .coach { left: 12px; right: 12px; max-width: none; bottom: 12px; padding: 9px 12px; gap: 10px; font-size: 13.5px; }
  .coach__lg { display: none; }
  .gate { text-align: left; }
  .item { grid-template-columns: minmax(0, 1fr) auto; }
  .item__id, .item > :nth-child(4) { display: none; }
}
@media (max-width: 720px) {
  .demo .devchart { min-width: 0; }
  .demo .devrow { grid-template-columns: 30px minmax(0, 1fr) auto auto auto; grid-template-areas: "id name meas dl res" "bar bar bar bar bar"; gap: 6px 10px; padding: 10px 0; min-height: 0; }
  .demo .devrow > :nth-child(1) { grid-area: id; }
  .demo .devrow > :nth-child(2) { grid-area: name; min-width: 0; }
  .demo .devrow > :nth-child(3) { grid-area: bar; margin-right: 0; }
  .demo .devrow > :nth-child(4) { grid-area: meas; }
  .demo .devrow > :nth-child(5) { grid-area: dl; }
  .demo .devrow > :nth-child(6) { grid-area: res; }
  .demo .devrow--head > :nth-child(3) { margin-right: 0; }
  .vchip { width: 100%; }
}
@media (max-width: 900px) {
  .cols--report > aside { order: -1; }
}
@media (max-width: 720px) {
  .featrow { grid-template-columns: 24px 30px minmax(0, 1fr); grid-template-areas: "cb id name" ". . spec" ". . chip"; row-gap: 3px; padding: 10px; align-items: center; }
  .featrow > :nth-child(1) { grid-area: cb; }
  .featrow > :nth-child(2) { grid-area: id; }
  .featrow > :nth-child(3) { grid-area: name; }
  .featrow > :nth-child(4) { grid-area: spec; }
  .featrow > :nth-child(5) { grid-area: chip; justify-self: start; white-space: normal; }
}

/* battery icon */
.batt { display: inline-block; vertical-align: -1px; width: 20px; height: 10px; color: currentColor; }
.sk__meta .batt { width: 18px; height: 9px; vertical-align: -1px; margin: 0 1px; }
.batt.is-low { color: var(--out); }
.sk__meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.sk__batt { display: inline-flex; align-items: center; justify-content: flex-end; gap: 5px; font-variant-numeric: tabular-nums; }
.sk__batt span { min-width: 3ch; text-align: right; }
