/* Photon shared components. One file for every surface: panel, employee phone/iPad, client, TV, hub.
   Rules (DESIGN.md): yellow = the one action per region, black text on yellow, red only for destructive
   or blocking, ring borders instead of shadows, sentence case, tabular figures. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 var(--fs-ui)/1.4 var(--font); font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
img, svg, video, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-underline-offset: 3px; }
h1, h2, h3, h4, p { margin: 0; }
[hidden] { display: none !important; }
:focus { outline: none; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-small); }
[tabindex="-1"]:focus, [tabindex="-1"]:focus-visible { box-shadow: none; outline: none; }
::selection { background: var(--py-50); color: #000; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 100; background: var(--surface); color: var(--text-strong); padding: 8px 16px; border-radius: var(--r-pill); box-shadow: var(--float); }
.skip-link:focus-visible { top: 8px; }

/* ---------- Type ---------- */
.display { font-size: clamp(2.5rem, 6vw, var(--fs-display)); font-weight: 700; line-height: .9; letter-spacing: -1.8px; color: var(--text-strong); }
.title, h1.title { font-size: clamp(1.75rem, 4vw, var(--fs-page)); font-weight: 700; line-height: .95; letter-spacing: -1px; color: var(--text-strong); }
.section-title, h2.section-title { font-size: var(--fs-section); font-weight: 700; line-height: 1; letter-spacing: -.5px; color: var(--text-strong); }
.card-title, h3.card-title { font-size: var(--fs-card); font-weight: 700; line-height: 1.2; letter-spacing: -.2px; color: var(--text-strong); }
.body-l { font-size: var(--fs-body-l); }
.body { font-size: var(--fs-body); }
.small { font-size: var(--fs-ui); }
.caption { font-size: var(--fs-caption); color: var(--text-muted); }
.label { font-size: var(--fs-label); font-weight: 700; letter-spacing: .4px; color: var(--text-muted); }
.muted { color: var(--text-muted); }
.strong { font-weight: 700; color: var(--text-strong); }
.num { font-variant-numeric: tabular-nums; }
.lead { font-size: var(--fs-body); color: var(--text-muted); max-width: 64ch; }
.err-text { color: var(--danger-text); font-size: var(--fs-label); }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .92em; }
.clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* ---------- Layout ---------- */
.stack { display: flex; flex-direction: column; gap: var(--gap, var(--s4)); min-width: 0; }
.stack-s { --gap: var(--s2); } .stack-l { --gap: var(--s5); } .stack-xl { --gap: var(--s6); }
.row { display: flex; align-items: center; gap: var(--gap, var(--s3)); min-width: 0; flex-wrap: wrap; }
.row-nowrap { flex-wrap: nowrap; }
.row-between { justify-content: space-between; }
.row-end { justify-content: flex-end; }
.grow { flex: 1 1 auto; min-width: 0; }
.spacer { flex: 1; }
.grid { display: grid; gap: var(--s5); grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--min, 260px)), 1fr)); }
.grid-2 { display: grid; gap: var(--s5); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { display: grid; gap: var(--s5); grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { display: grid; gap: var(--s4); grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 991px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 575px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); } }
.split { display: grid; gap: var(--s5); grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 991px) { .split { grid-template-columns: minmax(0, 1fr); } }
.center { text-align: center; }
.divider { height: 1px; background: var(--line); border: 0; margin: 0; }

/* ---------- Buttons ---------- */
.btn {
  --bh: 40px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--bh); padding: 0 20px; border: 0; border-radius: var(--r-pill);
  font-size: var(--fs-ui); font-weight: 700; line-height: 1.1; text-decoration: none; white-space: nowrap;
  background: var(--fill); color: var(--text);
  transition: transform var(--t) ease-out, background-color var(--t) linear;
  -webkit-tap-highlight-color: transparent;
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:hover { background: var(--fill-hover); transform: scale(1.02); }
.btn:active { transform: scale(.98); transition-duration: var(--t-fast); }
.btn:focus-visible { box-shadow: var(--focus); border-radius: var(--r-pill); }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--fill); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text); font-weight: 400; padding: 0 8px; text-decoration: underline; text-decoration-color: transparent; }
.btn-ghost:hover { background: transparent; text-decoration-color: currentColor; transform: none; }
.btn-danger { background: var(--danger); color: var(--on-danger); }
.btn-danger:hover { background: #B8040F; }
.btn-danger-ghost { background: transparent; color: var(--danger-text); padding: 0 8px; }
.btn-danger-ghost:hover { background: var(--danger-soft); transform: none; }
/* Remove icons in rows stay quiet: red only when you point at them (one red thing per screen). */
.btn-icon.btn-danger-ghost { color: var(--text-muted); }
.btn-icon.btn-danger-ghost:hover, .btn-icon.btn-danger-ghost:focus-visible { color: var(--danger-text); background: var(--danger-soft); }
.btn-ondark { background: rgba(255,255,255,.16); color: #fff; }
.btn-ondark:hover { background: rgba(255,255,255,.24); }
.btn-lg { --bh: 52px; font-size: var(--fs-body); padding: 0 24px; }
.btn-xl { --bh: 64px; font-size: var(--fs-body-l); padding: 0 28px; }
.btn-sm { --bh: 32px; padding: 0 14px; font-size: var(--fs-label); }
.btn-block { width: 100%; }
.btn-icon { width: var(--bh); padding: 0; }
.btn[disabled], .btn[aria-disabled="true"] { background: var(--g10); color: var(--g45); cursor: not-allowed; transform: none; }
:root[data-theme="dark"] .btn[disabled] { background: #2A2A2A; color: #8C8C8C; }
.btn[aria-busy="true"] { cursor: progress; }
.btn[aria-busy="true"]::after { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
.link-btn { background: none; border: 0; padding: 0; color: inherit; text-decoration: underline; text-underline-offset: 3px; font: inherit; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border-radius: var(--r-card); box-shadow: var(--ring); padding: var(--s5); min-width: 0; }
.card-feature { border-radius: var(--r-feature); padding: var(--s6); }
.card-flush { padding: 0; overflow: hidden; }
.card-highlight { box-shadow: var(--ring), inset 3px 0 0 var(--accent); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); padding: var(--s4); min-width: 0; }
.panel-sunken { background: var(--surface-2); border-color: transparent; }
button.card, a.card { text-align: left; border: 0; display: block; color: inherit; text-decoration: none; transition: transform var(--t) ease-out; }
button.card:hover, a.card:hover { transform: scale(1.01); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s4); flex-wrap: wrap; }

/* KPI */
.kpi { display: flex; flex-direction: column; gap: 6px; }
.kpi .kpi-value { font-size: var(--fs-page); font-weight: 700; line-height: .95; letter-spacing: -1px; color: var(--text-strong); }
.kpi .kpi-unit { font-size: var(--fs-body); color: var(--text-muted); font-weight: 400; letter-spacing: 0; }
.kpi .kpi-delta { color: var(--text-muted); font-size: var(--fs-ui); }

/* ---------- Chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; border-radius: var(--r-pill); padding: 3px 10px; font-size: var(--fs-label); font-weight: 700; line-height: 1.3; white-space: nowrap; background: var(--fill); color: var(--text); }
.chip svg { width: 12px; height: 12px; }
.chip-draft { background: var(--light-blue); color: var(--chip-text); }
.chip-review { background: var(--light-violet); color: var(--chip-text); }
.chip-approved, .chip-ok { background: var(--warm-green); color: var(--chip-text); }
.chip-published, .chip-ready { background: var(--cool-green); color: var(--chip-text); }
.chip-archived, .chip-done { background: var(--dark-violet); color: var(--chip-text); }
.chip-blocked { background: rgba(212,5,17,.12); color: var(--chip-blocked-text); }
.chip-accent, .chip-live { background: var(--py-50); color: #000; }
.chip-off { background: transparent; color: var(--text-muted); box-shadow: inset 0 0 0 1px var(--line-strong); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; background: var(--g30); }
.dot-live { background: var(--py); box-shadow: 0 0 0 1px rgba(0,0,0,.4); }
.dot-ok { background: #6E8F3A; } .dot-off { background: var(--g30); } .dot-bad { background: var(--red); }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-pill); background: var(--fill); font-size: var(--fs-caption); font-weight: 700; display: inline-grid; place-items: center; color: var(--text); }
.badge-accent { background: var(--accent); color: #000; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field > .label { font-size: var(--fs-label); font-weight: 700; color: var(--text-muted); letter-spacing: .2px; }
.field .help { font-size: var(--fs-label); color: var(--text-muted); }
.field .err-text { display: flex; gap: 6px; align-items: center; }
.input, .select, .textarea {
  width: 100%; min-height: 40px; border-radius: var(--r-input); background: var(--surface); color: var(--text);
  border: 1px solid var(--input-border); padding: 8px 12px; font-size: var(--fs-ui);
  transition: border-color var(--t) linear, box-shadow var(--t) linear;
}
.input-lg { min-height: 52px; font-size: var(--fs-body); }
.textarea { min-height: 88px; resize: vertical; line-height: 1.4; }
.select { appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; }
.input::placeholder, .textarea::placeholder { color: var(--placeholder); }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { border-color: var(--text-strong); box-shadow: var(--focus-input); border-radius: var(--r-input); }
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger); }
.input[disabled], .select[disabled], .textarea[disabled] { background: var(--surface-2); color: var(--text-faint); }
.input-group { display: flex; align-items: stretch; gap: 0; }
.input-group .input { border-radius: var(--r-input) 0 0 var(--r-input); }
.input-group .btn { border-radius: 0 var(--r-input) var(--r-input) 0; min-height: 40px; }
.search { position: relative; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-muted); pointer-events: none; }
.search .input { padding-left: 36px; border-radius: var(--r-pill); }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-size: var(--fs-ui); }
.check input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: #000; flex: none; }
.form-actions { display: flex; gap: var(--s3); justify-content: flex-end; flex-wrap: wrap; padding-top: var(--s2); }

/* Switch: <button role="switch" aria-checked> */
.switch { position: relative; width: 44px; height: 26px; border-radius: var(--r-pill); border: 0; padding: 0; background: #8C8C8C; flex: none; transition: background-color var(--t) linear; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: transform var(--t) var(--ease); }
.switch[aria-checked="true"] { background: #000; }
.switch[aria-checked="true"]::after { transform: translateX(18px); background: var(--py); }
:root[data-theme="dark"] .switch[aria-checked="true"] { background: #E6E6E6; }
:root[data-theme="dark"] .switch[aria-checked="true"]::after { background: var(--py); box-shadow: 0 0 0 1px #000; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme-lock="light"]) .switch[aria-checked="true"] { background: #E6E6E6; }
  :root:not([data-theme="light"]):not([data-theme-lock="light"]) .switch[aria-checked="true"]::after { background: var(--py); box-shadow: 0 0 0 1px #000; }
  :root:not([data-theme="light"]):not([data-theme-lock="light"]) .btn[disabled] { background: #2A2A2A; color: #8C8C8C; }
}
.switch:focus-visible { box-shadow: var(--focus); border-radius: var(--r-pill); }
.switch[disabled] { opacity: .5; cursor: not-allowed; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); padding: 14px 0; border-bottom: 1px solid var(--line); }
.setting:last-child { border-bottom: 0; }
.setting .setting-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.setting .setting-text b { color: var(--text-strong); font-weight: 700; }
.setting .setting-text span { color: var(--text-muted); font-size: var(--fs-label); }

/* Segmented control */
.segmented { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--r-pill); background: var(--fill); max-width: 100%; overflow-x: auto; }
.segmented button { border: 0; background: transparent; border-radius: var(--r-pill); padding: 7px 14px; font-weight: 700; font-size: var(--fs-label); color: var(--text-muted); white-space: nowrap; }
.segmented button[aria-pressed="true"], .segmented button[aria-selected="true"] { background: var(--surface); color: var(--text-strong); box-shadow: var(--ring); }

/* Choice cards (radio as big tiles) */
.choices { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.choice { position: relative; display: flex; flex-direction: column; gap: 6px; text-align: left; padding: var(--s4); border-radius: var(--r-card); border: 0; background: var(--surface); box-shadow: var(--ring); color: inherit; }
.choice b { color: var(--text-strong); font-size: var(--fs-body); }
.choice span { color: var(--text-muted); }
.choice svg { width: 24px; height: 24px; }
.choice[aria-checked="true"], .choice[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--text-strong); background: var(--accent-soft); }

/* Option pills (answers on phones) */
.options { display: flex; flex-wrap: wrap; gap: 8px; }
.option { border: 0; border-radius: var(--r-pill); padding: 10px 16px; background: var(--fill); color: var(--text); font-size: var(--fs-body); }
.option[aria-pressed="true"], .option[aria-checked="true"] { background: var(--accent); color: #000; font-weight: 700; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: var(--s5); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; margin-bottom: var(--s5); }
.tabs::-webkit-scrollbar { display: none; }
@media (max-width: 767px) { .tabs { -webkit-mask-image: linear-gradient(to right, #000 85%, transparent); mask-image: linear-gradient(to right, #000 85%, transparent); padding-right: 24px; } }
.tabs a, .tabs button { flex: none; border: 0; background: none; padding: 10px 0; color: var(--text-muted); text-decoration: none; font-weight: 700; font-size: var(--fs-ui); box-shadow: inset 0 -3px 0 transparent; border-radius: 0; }
.tabs a:hover, .tabs button:hover { color: var(--text-strong); }
.tabs [aria-current="page"], .tabs [aria-selected="true"] { color: var(--text-strong); box-shadow: inset 0 -3px 0 var(--accent); }
.tabs a:focus-visible, .tabs button:focus-visible { box-shadow: var(--focus); border-radius: var(--r-small); }

/* ---------- Data grid ---------- */
.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--line-strong); border-radius: var(--r-grid); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-grid); }
.table th { position: sticky; top: 0; background: var(--surface-2); color: var(--text-muted); font-size: var(--fs-label); font-weight: 700; text-align: left; padding: 10px 12px; border-bottom: 2px solid var(--line-strong); white-space: nowrap; }
.table td { padding: 8px 12px; height: 40px; border-bottom: 1px solid var(--line); color: var(--text); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background-color 100ms linear; }
.table tbody tr:hover { background: var(--surface-hover); }
.table tr[aria-selected="true"] { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.table .n, .table th.n { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }
.table .total td { background: var(--surface-2); font-weight: 700; border-top: 2px solid var(--text); }
.table a { color: var(--text-strong); font-weight: 700; text-decoration: none; }
.table a:hover { text-decoration: underline; }
.table-note { font-size: var(--fs-caption); color: var(--text-muted); margin-top: 6px; }
.hl-cell { background: var(--py); color: #000; font-weight: 700; }
/* Tablet: cells keep one line; the grid scrolls, with a soft edge that says so. */
@media (max-width: 991px) {
  .table td, .table th { white-space: nowrap; }
  .table td:first-child { white-space: normal; min-width: 160px; }
  .table-wrap { background: linear-gradient(to right, var(--surface) 30%, transparent) left / 24px 100% no-repeat local, linear-gradient(to left, var(--surface) 30%, transparent) right / 24px 100% no-repeat local, linear-gradient(to right, rgba(0,0,0,.12), transparent) left / 10px 100% no-repeat scroll, linear-gradient(to left, rgba(0,0,0,.12), transparent) right / 10px 100% no-repeat scroll, var(--surface); }
}
/* Phones: each row becomes the name, one grey line of details and the status, without labels. */
@media (max-width: 575px) {
  .table-stack thead { display: none; }
  .table-stack tbody tr { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .table-stack td { display: inline-flex; align-items: center; gap: 6px; height: auto; padding: 0; border: 0; white-space: normal; color: var(--text-muted); font-size: var(--fs-label); }
  .table-stack td:first-child { flex: 1 0 100%; color: var(--text); font-size: var(--fs-ui); min-width: 0; }
  .table-stack td:empty { display: none; }
  .table-stack td.actions { margin-left: auto; }
  .table-stack td[data-label]::before { content: none; }
}

/* ---------- Lists (grouped, iOS-like) ---------- */
.list { background: var(--surface); border-radius: var(--r-card); box-shadow: var(--ring); overflow: hidden; }
.list-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 10px 16px; border: 0; background: transparent; text-align: left; color: var(--text); text-decoration: none; font-size: var(--fs-ui); }
.list-item + .list-item { border-top: 1px solid var(--line); }
button.list-item:hover, a.list-item:hover { background: var(--surface-hover); }
.list-item:focus-visible { box-shadow: inset 0 0 0 3px var(--text-strong); border-radius: 0; }
.list-item .li-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.list-item .li-text b { color: var(--text-strong); font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.list-item .li-text small { color: var(--text-muted); font-size: var(--fs-label); }
.list-item .li-chev { color: var(--g30); width: 16px; height: 16px; flex: none; }
.list-item .li-num { width: 28px; height: 28px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-size: var(--fs-label); font-weight: 700; color: var(--text-strong); flex: none; }
.list-item.is-main .li-num { background: var(--py); color: #000; }
.list-item[aria-current="true"], .list-item[aria-selected="true"] { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.list-item[aria-checked="true"] .li-check { background: #000; color: var(--py); border-color: #000; }
.li-check { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line-strong); display: grid; place-items: center; flex: none; }
.li-check svg { width: 14px; height: 14px; }
.list-head { padding: 0 4px 8px; }

/* Drag handle and sortable rows */
.drag { cursor: grab; color: var(--text-muted); border: 0; background: none; padding: 6px; border-radius: var(--r-small); display: grid; place-items: center; }
.drag svg { width: 18px; height: 18px; }
.sortable-item.is-dragging { opacity: .5; }
.sortable-item.is-over { box-shadow: inset 0 3px 0 var(--accent); }

/* ---------- Banners, toasts, states ---------- */
.banner { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: var(--r-panel); font-size: var(--fs-ui); color: var(--text); background: var(--info-soft); }
.banner svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.banner b { color: var(--text-strong); }
.banner .banner-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.banner-warn { background: var(--accent-warn); }
.banner-error { background: var(--danger-soft); color: var(--danger-text); }
.banner-error b { color: var(--danger-text); }
.banner-ok { background: var(--ok-soft); }
.conn-banner { position: sticky; top: 0; z-index: 40; border-radius: 0; justify-content: center; }

.toasts { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast { background: var(--g80); color: #fff; padding: 10px 18px; border-radius: var(--r-pill); font-weight: 700; font-size: var(--fs-ui); box-shadow: var(--float); display: flex; gap: 8px; align-items: center; animation: toast-in var(--t-slow) var(--ease); pointer-events: auto; }
.toast svg { width: 16px; height: 16px; }
.toast-error { background: var(--red); }
/* On phones the main action sits at the bottom: toasts go to the top. */
body:has(.phone-app) .toasts { bottom: auto; top: calc(60px + env(safe-area-inset-top, 0px)); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.state { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: var(--s3); padding: var(--s7) var(--s4); min-height: 240px; }
.state .state-icon { width: 56px; height: 56px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; color: var(--text-strong); }
.state .state-icon svg { width: 26px; height: 26px; }
.state.is-error .state-icon { background: var(--danger-soft); color: var(--danger-text); }
.state h2 { font-size: var(--fs-card); font-weight: 700; color: var(--text-strong); }
.state p { color: var(--text-muted); max-width: 46ch; }
.state .row { justify-content: center; margin-top: var(--s2); }

.skeleton { display: flex; flex-direction: column; gap: 12px; padding: var(--s4) 0; }
.skeleton i { display: block; height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2), var(--line), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
.skeleton i:nth-child(3n+1) { width: 92%; } .skeleton i:nth-child(3n+2) { width: 74%; } .skeleton i:nth-child(3n) { width: 56%; }
.skeleton .sk-block { height: 120px; width: 100%; border-radius: var(--r-card); }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.spinner { width: 24px; height: 24px; border-radius: 50%; border: 3px solid var(--line-strong); border-top-color: var(--text-strong); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Progress */
.progress { height: 6px; border-radius: var(--r-pill); background: var(--line); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--text-strong); border-radius: inherit; transition: width var(--t-slow) var(--ease); }
.progress-accent > i { background: var(--py); }
.steps-dots { display: flex; gap: 5px; flex-wrap: wrap; }
.steps-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); }
.steps-dots i.on { background: var(--text-strong); }

/* Bars (charts): outlined, per DHL chart rules */
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(80px, 34%) 1fr auto; gap: 12px; align-items: center; font-size: var(--fs-ui); }
.bar-row .bar-track { height: 18px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.bar-row .bar-fill { height: 100%; background: var(--py); box-shadow: inset 0 0 0 1px #000; border-radius: 4px; }
.bar-row .bar-fill.is-muted { background: var(--g20); }
.bar-row .n { font-weight: 700; color: var(--text-strong); min-width: 3ch; text-align: right; }
@media (max-width: 575px) {
  .bar-row { grid-template-columns: 1fr auto; row-gap: 4px; }
  .bar-row > :first-child { grid-column: 1 / -1; white-space: normal; overflow: visible; text-overflow: clip; }
}
.vbars { display: flex; align-items: flex-end; gap: 8px; height: 160px; padding-top: 8px; border-bottom: 1px solid var(--line-strong); }
.vbars .vbar { flex: 1; background: var(--py); box-shadow: inset 0 0 0 1px #000; border-radius: 4px 4px 0 0; min-height: 2px; position: relative; }
.vbars-labels { display: flex; gap: 8px; }
.vbars-labels span { flex: 1; text-align: center; font-size: var(--fs-caption); color: var(--text-muted); }

/* ---------- Dialogs, sheets, drawers ---------- */
dialog.dialog { border: 0; padding: 0; border-radius: var(--r-card); background: var(--surface); color: var(--text); box-shadow: var(--modal); width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); }
dialog.dialog::backdrop { background: var(--scrim); }
dialog.dialog[open] { animation: dialog-in 160ms var(--ease); }
@keyframes dialog-in { from { opacity: 0; transform: scale(.98); } to { opacity: 1; transform: none; } }
.dialog-body { padding: var(--s5); display: flex; flex-direction: column; gap: var(--s4); overflow: auto; max-height: calc(100dvh - 120px); }
.dialog-body h2 { font-size: var(--fs-card); font-weight: 700; color: var(--text-strong); line-height: 1.2; }
.dialog-actions { display: flex; gap: var(--s3); justify-content: flex-end; padding: 0 var(--s5) var(--s5); flex-wrap: wrap; }
@media (max-width: 575px) {
  dialog.dialog.is-sheet { margin: auto 0 0; width: 100vw; max-width: 100vw; border-radius: var(--r-card) var(--r-card) 0 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions .btn { width: 100%; }
}
dialog.drawer { margin: 0 0 0 auto; height: 100dvh; max-height: 100dvh; width: min(480px, 100vw); border: 0; border-left: 1px solid var(--line); border-radius: var(--r-card) 0 0 var(--r-card); padding: 0; background: var(--surface); color: var(--text); box-shadow: -8px 0 24px rgba(0,0,0,.08); }
dialog.drawer::backdrop { background: var(--scrim); }
dialog.drawer[open] { animation: drawer-in var(--t-slow) var(--ease); }
@keyframes drawer-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Menu (popover list) */
.menu { position: absolute; z-index: 60; min-width: 200px; background: var(--surface); border-radius: var(--r-panel); box-shadow: var(--float); padding: 6px; display: flex; flex-direction: column; }
.menu button, .menu a { display: flex; gap: 10px; align-items: center; border: 0; background: none; text-align: left; padding: 9px 12px; border-radius: 8px; color: var(--text); text-decoration: none; font-size: var(--fs-ui); }
.menu button:hover, .menu a:hover { background: var(--surface-hover); }
.menu svg { width: 16px; height: 16px; }
.menu .danger { color: var(--danger-text); }

/* Empty slot / dropzone */
.dropzone { border: 2px dashed var(--line-strong); border-radius: var(--r-card); padding: var(--s6) var(--s4); display: flex; flex-direction: column; align-items: center; gap: var(--s2); text-align: center; color: var(--text-muted); background: transparent; width: 100%; }
.dropzone.is-over { border-color: var(--text-strong); background: var(--accent-soft); }
.dropzone svg { width: 28px; height: 28px; color: var(--text-strong); }

/* Diff */
.diff { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12px; line-height: 1.5; border: 1px solid var(--line-strong); border-radius: var(--r-grid); overflow-x: auto; background: var(--surface); }
.diff div { padding: 1px 12px; white-space: pre-wrap; word-break: break-word; }
.diff .add { background: var(--ok-soft); }
.diff .del { background: var(--danger-soft); text-decoration: line-through; text-decoration-color: rgba(0,0,0,.35); }
.diff .ctx { color: var(--text-muted); }
.diff .file { background: var(--surface-2); font-weight: 700; color: var(--text-strong); }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--line-strong); display: flex; flex-direction: column; gap: 16px; }
.timeline li { position: relative; display: flex; flex-direction: column; gap: 2px; }
.timeline li::before { content: ""; position: absolute; left: -24px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); box-shadow: 0 0 0 2px var(--line-strong); }
.timeline li.is-key::before { background: var(--py); box-shadow: 0 0 0 2px #000; }
.timeline time { font-size: var(--fs-label); color: var(--text-muted); }

/* Avatar */
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--g80); color: #fff; display: inline-grid; place-items: center; font-weight: 700; font-size: var(--fs-label); flex: none; }
.avatar-lg { width: 56px; height: 56px; font-size: var(--fs-card); border-radius: 16px; }

/* Code display (6 digits) and digit entry */
.digits { display: flex; gap: 8px; justify-content: center; }
.digits span { width: 44px; height: 56px; border-radius: var(--r-input); border: 1px solid var(--line-strong); background: var(--surface); display: grid; place-items: center; font-size: 26px; font-weight: 700; color: var(--text-strong); }
.digits span.is-on { border-color: var(--text-strong); box-shadow: var(--focus-input); }
.digits span.is-bad { border-color: var(--danger); }
.digits-input { position: relative; }
.digits-input input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; font-size: 16px; border: 0; }
.digits-input:focus-within .digits span.is-on { box-shadow: var(--focus-input), 0 0 0 1px var(--text-strong); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.keypad button { height: 52px; border-radius: var(--r-input); border: 0; background: var(--surface-2); font-size: 22px; color: var(--text-strong); }
.keypad button:active { background: var(--fill-hover); }
.keypad .is-empty { visibility: hidden; }
.keypad svg { width: 22px; height: 22px; margin: auto; }
@media (pointer: fine) and (min-width: 768px) { .keypad.hide-on-desktop { display: none; } }

/* Slide frame (16:9) used by TV, phones, editor and hub */
.slide { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: var(--r-panel); overflow: hidden; background: #fff; color: #000; box-shadow: var(--ring); container-type: inline-size; }
.slide-inner { position: absolute; inset: 0; padding: 6cqw 7cqw; display: flex; flex-direction: column; gap: 2.4cqw; }
.slide-kicker { font-size: 2.2cqw; font-weight: 700; color: #333; letter-spacing: .02em; }
.slide-title { font-size: 5.6cqw; font-weight: 700; line-height: .95; letter-spacing: -.04em; color: #000; max-width: 80%; }
.slide-body { font-size: 2.6cqw; line-height: 1.35; color: #333; max-width: 70%; }
.slide-bullets { margin: 0; padding: 0 0 0 3cqw; font-size: 2.6cqw; line-height: 1.5; color: #333; }
.slide-art { position: absolute; right: 6cqw; bottom: 7cqw; width: 34cqw; height: 24cqw; }
.slide-foot { position: absolute; left: 7cqw; right: 7cqw; bottom: 3.4cqw; display: flex; justify-content: space-between; font-size: 1.6cqw; color: #666; }
.slide-band { position: absolute; left: 0; top: 0; bottom: 0; width: 1.4cqw; background: var(--py); }
.slide.is-thumb { border-radius: var(--r-small); }
.slide img.slide-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #fff; }
.slide-video { background: #111; color: #fff; }
.slide-video .slide-title, .slide-video .slide-kicker, .slide-video .slide-body { color: #fff; }
.slide-demo { background: var(--g05); }
.slide .play { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); width: 12cqw; height: 12cqw; border-radius: 50%; background: rgba(255,255,255,.16); display: grid; place-items: center; }
.slide .play svg { width: 5cqw; height: 5cqw; color: #fff; }
.slide .vprogress { position: absolute; left: 7cqw; right: 7cqw; bottom: 5cqw; height: .8cqw; background: rgba(255,255,255,.2); border-radius: 99px; overflow: hidden; }
.slide .vprogress i { display: block; height: 100%; background: var(--py); }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-property: opacity, background-color, border-color, color !important; scroll-behavior: auto !important; }
  .btn:hover, .btn:active, button.card:hover, a.card:hover { transform: none; }
  .spinner, .btn[aria-busy="true"]::after { animation: spin 1.6s linear infinite !important; animation-iteration-count: infinite !important; }
}
