/* Dashboard styles. Every size, colour, radius, and shadow is copied from
   docs/design/reference/PrinterScreen.dc.html (design D1): the palette from its
   palette(), the layout from its `layout` variables, the rest from its inline
   styles. Dark is the default theme; light applies with data-theme="light"
   (set by /theme.js from the stored choice) or, with nothing stored, when the
   system prefers light (design D4). */

/* ---- Fonts (design D2): fetched by the operator into web/fonts/, never
   committed. Missing files answer 404 and the stacks fall back to system fonts. */
@font-face {
  font-family: "Satoshi";
  src: url("/fonts/satoshi-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Satoshi";
  src: url("/fonts/satoshi-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Satoshi";
  src: url("/fonts/satoshi-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Cabinet Grotesk";
  src: url("/fonts/cabinet-grotesk-800.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

/* ---- Tokens: dark palette, font stacks, phone layout ---- */
:root {
  color-scheme: dark;
  --bg: #0f0f0f;
  --sheet: linear-gradient(180deg, #1d1d1d, #161616 40%);
  --sheet-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 -18px 40px rgba(0, 0, 0, 0.6);
  --text: #ececec;
  --text-2: #b4b4b4;
  --text-3: #8b8b8b;
  --text-4: #5c5c5c;
  --line: rgba(255, 255, 255, 0.07);
  --dash: #3d3d3d;
  --tick: #2e2e2e;
  --raise: #262626;
  --input-bg: #121212;
  --btn: linear-gradient(180deg, #2a2a2a, #1f1f1f);
  --btn-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 1px 2px rgba(0, 0, 0, 0.6);
  --solid: linear-gradient(180deg, #f6f6f6, #d9d9d9);
  --on-solid: #0f0f0f;
  --solid-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), inset 0 -1px 0 rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.6), 0 8px 18px rgba(0, 0, 0, 0.4);
  --go: linear-gradient(180deg, #86e3b9, #5cc492);
  --on-go: #0b1f12;
  --go-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), inset 0 -1px 0 rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.6), 0 8px 20px rgba(111, 215, 168, 0.2);
  --ok: #6fd7a8;
  --ok-text: #a9e5c9;
  --warn: #f0c36b;
  --warn-text: #f3d79b;
  --bad: #f28b8b;
  --bad-text: #f6a5a5;
  --info: #7aa7ff;
  --info-text: #a9c5ff;
  --bad-tint: linear-gradient(180deg, rgba(242, 139, 139, 0.12), rgba(242, 139, 139, 0.06));
  --bad-ring: rgba(242, 139, 139, 0.28);
  --warn-tint: linear-gradient(180deg, rgba(56, 46, 22, 0.95), rgba(40, 33, 16, 0.95));
  --warn-ring: rgba(240, 195, 107, 0.25);
  --info-tint: linear-gradient(180deg, rgba(122, 167, 255, 0.12), rgba(122, 167, 255, 0.05));
  --info-ring: rgba(122, 167, 255, 0.35);
  --ok-tint: linear-gradient(180deg, rgba(111, 215, 168, 0.12), rgba(111, 215, 168, 0.05));
  --ok-ring: rgba(111, 215, 168, 0.3);
  --neutral-tint: rgba(255, 255, 255, 0.04);
  --neutral-ring: rgba(255, 255, 255, 0.08);
  --track: linear-gradient(180deg, rgba(242, 139, 139, 0.05), rgba(242, 139, 139, 0.09));
  --track-shadow: inset 0 0 0 1px rgba(242, 139, 139, 0.3), inset 0 2px 6px rgba(0, 0, 0, 0.45);
  --thumb: linear-gradient(180deg, #f7a3a3, #e77a7a);
  --thumb-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 1px 2px rgba(0, 0, 0, 0.5), 0 4px 10px rgba(0, 0, 0, 0.4);
  --on-thumb: #0f0f0f;

  --font-ui: "Satoshi", ui-sans-serif, system-ui, sans-serif;
  --font-display: "Cabinet Grotesk", "Satoshi", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;

  /* Phone layout (the component's `layout`, narrow). */
  --pad: 16px;
  --cam-l: 0px;
  --cam-r: 0px;
  --cam-t: 0px;
  --cam-h: 240px;
  --cam-rad: 0px;
  --cam-inset: 88px 16px 44px;
  --cam-shade: 0.65;
  --sh-l: 0px;
  --sh-r: 0px;
  --sh-t: 212px;
  --sh-b: 0px;
  --sh-rad: 20px 20px 0 0;
  --head-t: 38px;
  --head-c: #ececec;
  --head-bad: #f6a5a5;
  --hbtn-bg: rgba(20, 20, 20, 0.5);
  --hbtn-sh: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  --sh-w: auto;
}

/* Laptop layout (the component's `layout`, wide; design D6): the header on the
   page, the camera in the free width at full height, the sheet a 420 px panel
   on the right. Heights follow the viewport. */
@media (min-width: 960px) {
  :root {
    --pad: 24px;
    --cam-l: 24px;
    --cam-r: 468px;
    --cam-t: 84px;
    --cam-h: calc(100vh - 108px);
    --cam-rad: 16px;
    --cam-inset: 16px;
    --cam-shade: 0;
    --sh-l: auto;
    --sh-r: 24px;
    --sh-t: 84px;
    --sh-b: 24px;
    --sh-w: 420px;
    --sh-rad: 20px;
    --head-t: 20px;
    --head-c: var(--text);
    --head-bad: var(--bad-text);
    --hbtn-bg: var(--btn);
    --hbtn-sh: var(--btn-shadow);
  }

  @supports (height: 100dvh) {
    :root {
      --cam-h: calc(100dvh - 108px);
    }
  }

  /* No phone status bar to leave room for. */
  .tok__band {
    display: none;
  }
}

/* Light palette: chosen on this device, or the system's preference with no choice stored.
   The two blocks are the same; keep them in step. */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f3f1;
  --sheet: linear-gradient(180deg, #ffffff, #fbfbf9 40%);
  --sheet-shadow: inset 0 1px 0 #ffffff, 0 0 0 1px rgba(0, 0, 0, 0.05), 0 -10px 30px rgba(0, 0, 0, 0.1);
  --text: #161616;
  --text-2: #3f3f3f;
  --text-3: #595959;
  --text-4: #9a9a96;
  --line: rgba(0, 0, 0, 0.08);
  --dash: #b5b5b0;
  --tick: #e4e4e0;
  --raise: #e4e4e0;
  --input-bg: #ffffff;
  --btn: linear-gradient(180deg, #fafaf8, #ececea);
  --btn-shadow: inset 0 1px 0 #ffffff, inset 0 0 0 1px rgba(0, 0, 0, 0.09), 0 1px 2px rgba(0, 0, 0, 0.08);
  --solid: linear-gradient(180deg, #2c2c2c, #121212);
  --on-solid: #ffffff;
  --solid-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 14px rgba(0, 0, 0, 0.18);
  --go: linear-gradient(180deg, #1f9a66, #157a50);
  --on-go: #ffffff;
  --go-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.25), 0 6px 14px rgba(26, 138, 91, 0.2);
  --ok: #1a8a5b;
  --ok-text: #14603f;
  --warn: #946000;
  --warn-text: #6b4500;
  --bad: #c94a4a;
  --bad-text: #b42323;
  --info: #2f6fe0;
  --info-text: #1f4fb0;
  --bad-tint: rgba(201, 74, 74, 0.07);
  --bad-ring: rgba(201, 74, 74, 0.3);
  --warn-tint: rgba(217, 160, 40, 0.14);
  --warn-ring: rgba(148, 96, 0, 0.25);
  --info-tint: rgba(47, 111, 224, 0.07);
  --info-ring: rgba(47, 111, 224, 0.3);
  --ok-tint: rgba(26, 138, 91, 0.08);
  --ok-ring: rgba(26, 138, 91, 0.28);
  --neutral-tint: rgba(0, 0, 0, 0.03);
  --neutral-ring: rgba(0, 0, 0, 0.08);
  --track: rgba(201, 74, 74, 0.06);
  --track-shadow: inset 0 0 0 1px rgba(201, 74, 74, 0.3), inset 0 2px 4px rgba(0, 0, 0, 0.06);
  --thumb: linear-gradient(180deg, #d65a5a, #bd4040);
  --thumb-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 1px 2px rgba(0, 0, 0, 0.25), 0 4px 10px rgba(201, 74, 74, 0.25);
  --on-thumb: #ffffff;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    color-scheme: light;
    --bg: #f3f3f1;
    --sheet: linear-gradient(180deg, #ffffff, #fbfbf9 40%);
    --sheet-shadow: inset 0 1px 0 #ffffff, 0 0 0 1px rgba(0, 0, 0, 0.05), 0 -10px 30px rgba(0, 0, 0, 0.1);
    --text: #161616;
    --text-2: #3f3f3f;
    --text-3: #595959;
    --text-4: #9a9a96;
    --line: rgba(0, 0, 0, 0.08);
    --dash: #b5b5b0;
    --tick: #e4e4e0;
    --raise: #e4e4e0;
    --input-bg: #ffffff;
    --btn: linear-gradient(180deg, #fafaf8, #ececea);
    --btn-shadow: inset 0 1px 0 #ffffff, inset 0 0 0 1px rgba(0, 0, 0, 0.09), 0 1px 2px rgba(0, 0, 0, 0.08);
    --solid: linear-gradient(180deg, #2c2c2c, #121212);
    --on-solid: #ffffff;
    --solid-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 14px rgba(0, 0, 0, 0.18);
    --go: linear-gradient(180deg, #1f9a66, #157a50);
    --on-go: #ffffff;
    --go-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.25), 0 6px 14px rgba(26, 138, 91, 0.2);
    --ok: #1a8a5b;
    --ok-text: #14603f;
    --warn: #946000;
    --warn-text: #6b4500;
    --bad: #c94a4a;
    --bad-text: #b42323;
    --info: #2f6fe0;
    --info-text: #1f4fb0;
    --bad-tint: rgba(201, 74, 74, 0.07);
    --bad-ring: rgba(201, 74, 74, 0.3);
    --warn-tint: rgba(217, 160, 40, 0.14);
    --warn-ring: rgba(148, 96, 0, 0.25);
    --info-tint: rgba(47, 111, 224, 0.07);
    --info-ring: rgba(47, 111, 224, 0.3);
    --ok-tint: rgba(26, 138, 91, 0.08);
    --ok-ring: rgba(26, 138, 91, 0.28);
    --neutral-tint: rgba(0, 0, 0, 0.03);
    --neutral-ring: rgba(0, 0, 0, 0.08);
    --track: rgba(201, 74, 74, 0.06);
    --track-shadow: inset 0 0 0 1px rgba(201, 74, 74, 0.3), inset 0 2px 4px rgba(0, 0, 0, 0.06);
    --thumb: linear-gradient(180deg, #d65a5a, #bd4040);
    --thumb-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 1px 2px rgba(0, 0, 0, 0.25), 0 4px 10px rgba(201, 74, 74, 0.25);
    --on-thumb: #ffffff;
  }
}

/* ---- Base ---- */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  background: var(--bg);
}

body {
  color: var(--text);
  font-family: var(--font-ui);
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Under reduced motion nothing animates: no indeterminate bar, no spring-back. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ---- Dashboard frame (phone): camera box at the top, header over it, and the
   sheet from 212 px to the bottom of the viewport (design D5). The sheet grows
   with a taller screen, so the controls stay at its bottom; a shorter one scrolls. ---- */
.dash {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-weight: 500;
}

/* ---- Camera (design D11) ---- */
.cam {
  position: absolute;
  left: var(--cam-l);
  right: var(--cam-r);
  top: var(--cam-t);
  height: var(--cam-h);
  border-radius: var(--cam-rad);
  overflow: hidden;
  background: #121212;
  color: #ececec;
}

.cam__img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Vignette and the top shade under the header. */
.cam__shade {
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 95% at 50% 35%, transparent 50%, rgba(0, 0, 0, 0.5)), linear-gradient(rgba(0, 0, 0, var(--cam-shade)), transparent 42%);
}

.cam__fail {
  position: absolute;
  inset: 0;
  display: none;
  background-color: #0f0f0f;
  background-image: radial-gradient(#262626 1px, transparent 1px);
  background-size: 24px 24px;
}

.cam[data-cam="unavailable"] .cam__fail,
.cam[data-cam="offline"] .cam__fail {
  display: block;
}

.cam[data-cam="unavailable"] .cam__shade,
.cam[data-cam="offline"] .cam__shade,
.cam[data-cam="unavailable"] .cam__img,
.cam[data-cam="offline"] .cam__img {
  display: none;
}

.cam__box {
  position: absolute;
  inset: var(--cam-inset);
  border-radius: 12px;
  border: 1px dashed #3d3d3d;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 12px;
  text-align: center;
}

.cam__title {
  font-size: 14.5px;
  font-weight: 700;
  color: #b4b4b4;
}

.cam__sub {
  font-size: 12.5px;
  color: #8b8b8b;
}

.cam__retry {
  margin-top: 6px;
  height: 44px;
  padding: 0 16px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(180deg, #2a2a2a, #1f1f1f);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 1px 2px rgba(0, 0, 0, 0.6);
  color: #ececec;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

/* ---- Header: printer name, Online/Offline mark, theme toggle ---- */
.head {
  position: absolute;
  left: var(--pad);
  right: var(--pad);
  top: var(--head-t);
  height: 44px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--head-c);
}

.head__name {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.head__online,
.head__offline {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
}

.head__offline {
  color: var(--head-bad);
}

.head__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6fd7a8;
  box-shadow: 0 0 0 3px rgba(111, 215, 168, 0.18), 0 0 8px rgba(111, 215, 168, 0.6);
}

.head__ring {
  width: 8px;
  height: 8px;
  box-sizing: border-box;
  border-radius: 50%;
  border: 1.5px solid currentColor;
}

.head__theme {
  flex: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  border-radius: 12px;
  background: var(--hbtn-bg);
  box-shadow: var(--hbtn-sh);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: grid;
  place-items: center;
  cursor: pointer;
}

/* Half-filled disc. */
.head__theme > span {
  width: 16px;
  height: 16px;
  box-sizing: border-box;
  border-radius: 50%;
  border: 2px solid var(--head-c);
  background: linear-gradient(90deg, var(--head-c) 50%, transparent 50%);
}

/* ---- Status sheet ---- */
.sheet {
  position: relative;
  flex: 1 0 auto;
  width: var(--sh-w);
  margin: var(--sh-t) var(--sh-r) var(--sh-b) var(--sh-l);
  min-height: calc(100vh - var(--sh-t) - var(--sh-b));
  min-height: calc(100dvh - var(--sh-t) - var(--sh-b));
  box-sizing: border-box;
  background: var(--sheet);
  border-radius: var(--sh-rad);
  box-shadow: var(--sheet-shadow);
  padding: 16px;
  display: flex;
  flex-direction: column;
}

/* Per-state inks (the component's rootStyle): the tone of the print state, and
   the stale treatment (design D7) that puts values in secondary ink with dashed dividers. */
.dash {
  --tone: var(--text-3);
  --tone-text: var(--text-2);
  --tone-glow: transparent;
  --val: var(--text);
  --label: var(--text);
  --row-bs: solid;
  --row-bc: var(--line);
}

.dash[data-tone="ok"] {
  --tone: var(--ok);
  --tone-text: var(--ok-text);
  --tone-glow: rgba(111, 215, 168, 0.45);
}

.dash[data-tone="warn"] {
  --tone: var(--warn);
  --tone-text: var(--warn-text);
  --tone-glow: rgba(240, 195, 107, 0.4);
}

.dash[data-tone="info"] {
  --tone: var(--info);
  --tone-text: var(--info-text);
  --tone-glow: rgba(122, 167, 255, 0.4);
}

.dash[data-tone="bad"] {
  --tone: var(--bad);
  --tone-text: var(--bad-text);
  --tone-glow: rgba(242, 139, 139, 0.4);
}

.dash[data-stale] {
  --val: var(--text-2);
  --label: var(--text-2);
  --row-bs: dashed;
  --row-bc: var(--dash);
}

/* Offline banner. */
.banner {
  margin-bottom: 14px;
  border-radius: 12px;
  padding: 11px 14px;
  background: var(--warn-tint);
  box-shadow: inset 0 0 0 1px var(--warn-ring);
  color: var(--warn-text);
  font-size: 13.5px;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
}

.banner b {
  font-weight: 700;
}

/* Status line: glyph, state, file name, update time. */
.line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 18px;
  font-size: 13.5px;
  color: var(--text-2);
  min-width: 0;
}

.glyph {
  flex: none;
  width: 12px;
  height: 12px;
  display: grid;
  place-items: center;
}

.glyph__mark {
  box-sizing: border-box;
}

.glyph__mark[data-glyph="run"] {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tone);
  box-shadow: 0 0 8px var(--tone-glow);
}

.glyph__mark[data-glyph="busy"] {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid var(--tone);
  display: grid;
  place-items: center;
}

.glyph__mark[data-glyph="busy"]::before {
  content: "";
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--tone);
}

.glyph__mark[data-glyph="pause"] {
  display: flex;
  gap: 2px;
}

.glyph__mark[data-glyph="pause"]::before,
.glyph__mark[data-glyph="pause"]::after {
  content: "";
  width: 3px;
  height: 10px;
  background: var(--tone);
}

.glyph__mark[data-glyph="stop"] {
  width: 8px;
  height: 8px;
  border-radius: 1px;
  background: var(--tone);
}

.glyph__mark[data-glyph="done"] {
  width: 5px;
  height: 9px;
  border-right: 2px solid var(--tone);
  border-bottom: 2px solid var(--tone);
  transform: translateY(-1px) rotate(45deg);
}

.glyph__mark[data-glyph="idle"] {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1.5px solid var(--tone);
}

.glyph__mark[data-glyph="unknown"] {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1.5px solid var(--tone);
  display: grid;
  place-items: center;
  font-size: 8px;
  font-weight: 700;
  color: var(--tone);
}

.glyph__mark[data-glyph="unknown"]::before {
  content: "?";
}

.glyph__mark[data-glyph="stale"] {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1.5px dashed var(--text-3);
}

.line__state {
  flex: none;
  font-weight: 700;
  color: var(--tone-text);
}

.line__slash {
  flex: none;
  color: var(--text-4);
}

.line__file {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.line__spacer {
  flex: 1;
}

.line__clock {
  flex: none;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

/* Headline: time left and percent. */
.headline {
  margin-top: 8px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-variant-numeric: tabular-nums;
  color: var(--val);
}

.headline__big {
  flex: none;
  white-space: nowrap;
  font-family: var(--font-display);
  font-size: 46px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.headline__pct {
  flex: none;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.subline {
  margin-top: 4px;
  font-size: 14px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  text-wrap: pretty;
}

/* Layer ticks: 3 px marks every 6 px, filled to the progress in the tone. */
.ticks {
  margin-top: 14px;
  position: relative;
  height: 22px;
  flex: none;
}

.ticks__base,
.ticks__fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
}

.ticks__base {
  right: 0;
  background: repeating-linear-gradient(90deg, var(--tick) 0 3px, transparent 3px 6px);
}

.ticks__fill {
  background: repeating-linear-gradient(90deg, var(--tone) 0 3px, transparent 3px 6px);
}

/* The fill glows in its tone in the dark theme only, and never when stale or neutral. */
.ticks[data-glow] .ticks__fill {
  filter: drop-shadow(0 0 6px var(--tone-glow));
}

:root[data-theme="light"] .ticks[data-glow] .ticks__fill {
  filter: none;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .ticks[data-glow] .ticks__fill {
    filter: none;
  }
}

/* Error alert and the unknown-state note. */
.alert {
  margin-top: 14px;
  border-radius: 12px;
  padding: 11px 14px;
  background: var(--bad-tint);
  box-shadow: inset 0 0 0 1px var(--bad-ring), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.alert__mark {
  flex: none;
  margin-top: 6px;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--bad);
}

.alert__title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--bad-text);
  font-variant-numeric: tabular-nums;
}

.alert__text {
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--text-2);
  margin-top: 2px;
}

.note {
  margin-top: 14px;
  border-radius: 12px;
  padding: 11px 14px;
  background: var(--neutral-tint);
  box-shadow: inset 0 0 0 1px var(--neutral-ring);
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--text-2);
  text-wrap: pretty;
}

/* Reading rows: label, value, target or total. */
.rows {
  margin-top: 14px;
  border-top: 1px var(--row-bs) var(--row-bc);
  font-variant-numeric: tabular-nums;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  border-bottom: 1px var(--row-bs) var(--row-bc);
}

.row__key {
  flex: 1;
  min-width: 0;
  font-size: 14.5px;
  color: var(--label);
}

.row__value {
  font-size: 15px;
  font-weight: 700;
  color: var(--val);
}

.row__target {
  width: 52px;
  text-align: right;
  font-size: 13px;
  color: var(--text-3);
  white-space: nowrap;
}

/* Bottom of the sheet: message slot and controls. */
.sheet__foot {
  margin-top: auto;
  padding-top: 10px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Message slot (design D8): one inline line above the controls, in the tone of the command's state. */
.msg {
  --msg-tint: var(--info-tint);
  --msg-ring: var(--info-ring);
  --msg-c: var(--info);
  --msg-text: var(--info-text);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  box-sizing: border-box;
  padding: 8px 14px;
  border-radius: 12px;
  background: var(--msg-tint);
  box-shadow: inset 0 0 0 1px var(--msg-ring);
}

.msg[data-retry] {
  padding-right: 4px;
}

.msg[data-tone="ok"] {
  --msg-tint: var(--ok-tint);
  --msg-ring: var(--ok-ring);
  --msg-c: var(--ok);
  --msg-text: var(--ok-text);
}

.msg[data-tone="warn"] {
  --msg-tint: var(--warn-tint);
  --msg-ring: var(--warn-ring);
  --msg-c: var(--warn);
  --msg-text: var(--warn-text);
}

.msg[data-tone="bad"] {
  --msg-tint: var(--bad-tint);
  --msg-ring: var(--bad-ring);
  --msg-c: var(--bad);
  --msg-text: var(--bad-text);
}

.msg__mark {
  flex: none;
  width: 8px;
  height: 8px;
  background: var(--msg-c);
  border-radius: 50%;
}

.msg__mark[data-mark="square"] {
  border-radius: 2px;
}

.msg__body {
  flex: 1;
  min-width: 0;
}

.msg__title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--msg-text);
  font-variant-numeric: tabular-nums;
}

.msg__sub {
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-2);
  margin-top: 1px;
}

.msg__retry {
  flex: none;
  height: 44px;
  padding: 0 14px;
  border: none;
  border-radius: 10px;
  background: var(--btn);
  box-shadow: var(--btn-shadow);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.msg__dismiss {
  flex: none;
  width: 40px;
  height: 44px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-2);
  font-family: inherit;
  font-size: 20px;
  cursor: pointer;
}

/* Indeterminate bar of a command in flight. */
.indet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  overflow: hidden;
}

.indet > div {
  width: 35%;
  height: 100%;
  background: var(--info);
  animation: indet 1.1s ease-in-out infinite;
}

@keyframes indet {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(280%);
  }
}

/* Light, Pause, Resume. data-look: enabled (the control's own fill), disabled
   (dashed, no fill, grey text), pending (blue ring), failed (Retry in the bad tone). */
.ctls {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

.ctl {
  height: 56px;
  box-sizing: border-box;
  padding: 0 6px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid transparent;
  background: var(--btn);
  color: var(--text);
  box-shadow: var(--btn-shadow);
}

.ctl[data-action="pause"][data-look="enabled"] {
  background: var(--solid);
  color: var(--on-solid);
  box-shadow: var(--solid-shadow);
}

.ctl[data-action="resume"][data-look="enabled"] {
  background: var(--go);
  color: var(--on-go);
  box-shadow: var(--go-shadow);
}

.ctl[data-look="disabled"] {
  background: transparent;
  color: var(--text-3);
  border: 1px dashed var(--dash);
  box-shadow: none;
  cursor: not-allowed;
}

.ctl[data-look="pending"] {
  background: var(--btn);
  color: var(--text);
  box-shadow: inset 0 0 0 2px var(--info);
}

.ctl[data-look="failed"] {
  background: var(--bad-tint);
  color: var(--bad-text);
  box-shadow: inset 0 0 0 2px var(--bad);
}

.ctl__dot {
  flex: none;
  width: 10px;
  height: 10px;
  box-sizing: border-box;
  border-radius: 50%;
  border: 2px solid currentColor;
  background: transparent;
}

.ctl__dot[data-dot="filled"] {
  border-color: var(--warn);
  background: var(--warn);
}

.ctl__pause {
  flex: none;
  display: flex;
  gap: 3px;
}

.ctl__pause > span {
  width: 4px;
  height: 12px;
  background: currentColor;
  border-radius: 1px;
}

.ctl__play {
  flex: none;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 10px solid currentColor;
}

/* Stop slide (design D12): a track the full width of the sheet; the 48 px thumb
   is dragged to the end. data-look: enabled, failed (red ring), disabled (dashed, with the reason). */
.slide {
  position: relative;
  height: 56px;
  box-sizing: border-box;
  border-radius: 12px;
  overflow: hidden;
  background: var(--track);
  border: 1px solid transparent;
  box-shadow: var(--track-shadow);
}

.slide[data-look="failed"] {
  box-shadow: inset 0 0 0 2px var(--bad), inset 0 2px 6px rgba(0, 0, 0, 0.3);
}

.slide[data-look="disabled"] {
  background: transparent;
  border: 1px dashed var(--dash);
  box-shadow: none;
}

.slide__fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  background: var(--bad);
  opacity: 0.22;
}

.slide__label {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  padding-left: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  overflow: hidden;
  font-size: 14.5px;
  font-weight: 700;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
  color: var(--bad-text);
}

.slide__label[data-ink="text"] {
  color: var(--text);
}

.slide__label[data-ink="muted"] {
  color: var(--text-3);
}

.slide__thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 48px;
  height: 48px;
  padding: 0;
  border: none;
  border-radius: 9px;
  display: grid;
  place-items: center;
  cursor: grab;
  touch-action: none;
  background: var(--thumb);
  box-shadow: var(--thumb-shadow);
}

.slide__thumb > span {
  width: 11px;
  height: 11px;
  border-radius: 2px;
  background: var(--on-thumb);
}

.slide__thumb:disabled {
  background: var(--raise);
  box-shadow: none;
  cursor: not-allowed;
}

.slide__thumb:disabled > span {
  background: var(--text-4);
}

/* Spring-back when released; none while the thumb follows the pointer. */
.slide:not([data-dragging]) .slide__fill,
.slide:not([data-dragging]) .slide__thumb {
  transition: left 0.25s ease, width 0.25s ease;
}

/* The track once stop is sent: blue ring, "Stopping…", and the indeterminate bar. */
.slide-pending {
  position: relative;
  height: 56px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--btn);
  box-shadow: inset 0 0 0 2px var(--info);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14.5px;
  font-weight: 700;
}

/* ---- Token screen: app mark, title, field with Show/Hide, Connect ---- */
.tok {
  box-sizing: border-box;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0 var(--pad) var(--pad);
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-weight: 500;
}

/* The phone's status-bar band (design D5): kept empty, the page draws no clock. */
.tok__band {
  flex: none;
  height: 36px;
}

.tok__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 24px;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}

/* The app mark: one grey and two green bars on a dark rounded square. */
.tok__mark {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: linear-gradient(180deg, #222, #111);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 6px 16px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 4px;
  padding: 0 13px 13px;
  box-sizing: border-box;
}

.tok__mark > span {
  width: 100%;
  height: 6px;
  border-radius: 2px;
  background: #6fd7a8;
}

.tok__mark > span:first-child {
  width: 58%;
  background: #8b8b8b;
}

.tok__intro,
.tok__field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tok__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 30px;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.tok__text {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-2);
  text-wrap: pretty;
}

.tok__label {
  font-size: 14px;
  font-weight: 700;
}

.tok__row {
  display: flex;
  gap: 8px;
}

.tok__input {
  flex: 1;
  min-width: 0;
  height: 52px;
  box-sizing: border-box;
  border-radius: 12px;
  border: none;
  background: var(--input-bg);
  box-shadow: inset 0 0 0 1px var(--dash), inset 0 2px 4px rgba(0, 0, 0, 0.2);
  color: var(--text);
  padding: 0 14px;
  font-family: var(--font-mono);
  font-size: 15px;
  outline: none;
}

.tok__input[aria-invalid="true"] {
  box-shadow: inset 0 0 0 2px var(--bad);
}

/* The component drops the outline; keyboard focus still needs a visible ring. */
.tok__input:focus-visible:not([aria-invalid="true"]) {
  box-shadow: inset 0 0 0 2px var(--info);
}

.tok__show {
  flex: none;
  height: 52px;
  min-width: 68px;
  padding: 0 14px;
  border: none;
  border-radius: 12px;
  background: var(--btn);
  box-shadow: var(--btn-shadow);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.tok__alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 11px 14px;
  border-radius: 12px;
  background: var(--bad-tint);
  box-shadow: inset 0 0 0 1px var(--bad-ring);
  font-size: 14px;
  line-height: 1.45;
}

.tok__alert b {
  font-weight: 700;
  color: var(--bad-text);
}

.tok__alert-mark {
  flex: none;
  margin-top: 5px;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--bad);
}

.tok__connect {
  height: 56px;
  border: none;
  border-radius: 12px;
  background: var(--solid);
  color: var(--on-solid);
  box-shadow: var(--solid-shadow);
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.tok__note {
  margin: 0;
  font-size: 13px;
  color: var(--text-3);
  text-align: center;
}
