/* DC Relay: one stylesheet, no frameworks. Layouts for PC (≥1280 px, 16:9), tablet (768–1279 px)
   and phone (<768 px). Light and dark theme via tokens. */

:root {
  /* Colours, type and shapes follow digitalcrafted.tv: accent #4559f3, ink #050611, 4 px corners. */
  --bg: #f4f5f8;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --border: #e6e8ef;
  --border-strong: #d3d7e2;
  --text: #14172a;
  --muted: #565d78;
  --faint: #878da6;
  --primary: #4559f3;
  --primary-hover: #2d3ac2;
  --primary-soft: #eceefe;
  --btn: #4559f3;
  --btn-hover: #2d3ac2;
  --accent: #4559f3;
  --accent-bright: #6a7bff;
  --ink: #050611;
  --ok: #128a4a;
  --ok-soft: #e3f6ec;
  --warn: #b26a00;
  --warn-soft: #fff3dc;
  --bad: #c62f2f;
  --bad-soft: #fde8e8;
  --off: #6b7280;
  --off-soft: #eef0f3;
  /* Sidebar follows the theme: light in light mode, ink in dark mode. */
  --side-bg: #ffffff;
  --side-text: #3a3f57;
  --side-muted: #737993;
  --side-strong: #14172a;
  --side-active: #2d3ac2;
  --side-active-bg: #eceefe;
  --side-hover-bg: #f4f5f8;
  --side-line: #e6e8ef;
  --shadow: 0 1px 2px rgba(5, 6, 17, .05);
  --shadow-lg: 0 12px 32px rgba(5, 6, 17, .18);
  --radius: 4px;
  --radius-sm: 4px;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --side-w: 248px;
  --rail-w: 72px;
  --top-h: 64px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #050611; --surface: #101526; --surface-2: #1b2136; --border: #232a42; --border-strong: #343c5a;
    --text: #e8eaf2; --muted: #9aa1bb; --faint: #6e7591; --primary: #6a7bff; --primary-hover: #8a97ff;
    --primary-soft: #1a2152; --btn: #4559f3; --btn-hover: #6a7bff; --accent: #6a7bff;
    --ok: #3ccf82; --ok-soft: #12301f; --warn: #f2b14c; --warn-soft: #3a2a0c;
    --bad: #ff7b7b; --bad-soft: #3a1717; --off: #9aa3b2; --off-soft: #1b2136;
    --side-bg: #080a18; --side-text: #c4c8da; --side-muted: #8a91ad; --side-strong: #ffffff; --side-active: #ffffff;
    --side-active-bg: rgba(106, 123, 255, .14); --side-hover-bg: rgba(255, 255, 255, .06); --side-line: rgba(255, 255, 255, .12);
    --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lg: 0 12px 32px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #050611; --surface: #101526; --surface-2: #1b2136; --border: #232a42; --border-strong: #343c5a;
  --text: #e8eaf2; --muted: #9aa1bb; --faint: #6e7591; --primary: #6a7bff; --primary-hover: #8a97ff;
  --primary-soft: #1a2152; --btn: #4559f3; --btn-hover: #6a7bff; --accent: #6a7bff;
  --ok: #3ccf82; --ok-soft: #12301f; --warn: #f2b14c; --warn-soft: #3a2a0c;
  --bad: #ff7b7b; --bad-soft: #3a1717; --off: #9aa3b2; --off-soft: #1b2136;
  --side-bg: #080a18; --side-text: #c4c8da; --side-muted: #8a91ad; --side-strong: #ffffff; --side-active: #ffffff;
  --side-active-bg: rgba(106, 123, 255, .14); --side-hover-bg: rgba(255, 255, 255, .06); --side-line: rgba(255, 255, 255, .12);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lg: 0 12px 32px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.55 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 1.6rem; font-weight: 600; letter-spacing: -.02em; }
h2 { font-size: 1.25rem; font-weight: 600; letter-spacing: -.01em; }
h3 { font-size: 1rem; font-weight: 600; margin: 1.25rem 0 .6rem; }
.panel > h3:first-child, form > h3:first-child { margin-top: 0; }
p { margin: .5rem 0; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: .9em; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: .88rem; }
.lead { color: var(--muted); }
.grow { flex: 1; min-width: 0; }
.sprite { display: none; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
ul.plain { list-style: none; padding: 0; margin: 0; }

/* ------------------------------------------------------------------ controls */
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface); width: 100%;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: .6rem .75rem; min-height: 42px;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: var(--primary); }
:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 3px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline-offset: -1px; }
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; accent-color: var(--primary); }
label { display: block; margin: 0 0 .9rem; font-size: .9rem; color: var(--muted); }
label > span:first-child { display: block; margin-bottom: .3rem; font-weight: 550; }
label.check { display: flex; gap: .55rem; align-items: flex-start; color: var(--text); font-size: .93rem; }
label.check > span:first-child, label.check span { display: inline; margin: 0; font-weight: 400; }
label.check.inline { align-self: end; margin-bottom: .6rem; }
.field { margin-bottom: .9rem; }
.field-label { display: block; margin-bottom: .3rem; font-size: .9rem; font-weight: 550; color: var(--muted); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }

button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; font: inherit; font-weight: 600;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  padding: .55rem 1.1rem; min-height: 42px; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .18s var(--ease), border-color .18s var(--ease), color .18s var(--ease);
}
button:hover, .button:hover { border-color: var(--primary); text-decoration: none; }
button:disabled { opacity: .55; cursor: not-allowed; }
button.primary, .button.primary { background: var(--btn); border-color: var(--btn); color: #fff; }
button.primary:hover, .button.primary:hover { background: var(--btn-hover); border-color: var(--btn-hover); }
button.ghost, .button.ghost { background: transparent; }
button.danger, .button.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
button.danger:hover { background: var(--bad-soft); border-color: var(--bad); }
button.wide, .button.wide { width: 100%; }
button.small, .button.small { min-height: 32px; padding: .25rem .7rem; font-size: .85rem; }
.icon-btn { padding: 0; width: 40px; min-height: 40px; border-color: transparent; background: transparent; color: inherit; }
.icon-btn:hover { background: var(--surface-2); border-color: var(--border); }
.link-btn { border: 0; background: none; color: var(--primary); padding: .2rem 0; min-height: 0; font-weight: 550; }
.link-btn:hover { text-decoration: underline; }

.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 650;
  background: var(--primary-soft); color: var(--primary); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.off { background: var(--off-soft); color: var(--off); }

.message { padding: .7rem 1rem; border-radius: var(--radius-sm); background: var(--bad-soft); color: var(--bad); font-weight: 550; }
.message.ok { background: var(--ok-soft); color: var(--ok); }
.message.info { background: var(--primary-soft); color: var(--primary); }
.message.toast { position: fixed; z-index: 60; right: 1.25rem; bottom: 1.25rem; max-width: min(460px, calc(100vw - 2.5rem)); box-shadow: var(--shadow-lg); }

/* ------------------------------------------------------------------ brand */
.brand-mark { display: flex; align-items: center; gap: .75rem; color: var(--text); }
/* The digital crafted script logo, drawn in the current text colour so it works on light and dark. */
.dc-logo { display: inline-block; flex: none; width: 118px; height: 31px; background: currentColor;
  -webkit-mask: url("/static/dc-logo.svg") center / contain no-repeat; mask: url("/static/dc-logo.svg") center / contain no-repeat; }
.relay-word { display: inline-flex; align-items: center; gap: .75rem; font-size: .8rem; font-weight: 600; letter-spacing: .16em;
  text-transform: uppercase; color: var(--primary); }
.relay-word::before { content: ""; width: 1px; height: 1.3rem; background: currentColor; opacity: .45; }
.brand-mark.small .dc-logo { width: 100px; height: 26px; }
.brand-full { display: inline-flex; align-items: center; gap: .75rem; }
.dc-mono { display: none; width: 32px; height: 32px; border-radius: var(--radius); }
.eyebrow { display: inline-flex; align-items: center; gap: .6rem; margin: 0 0 1rem; font-size: .82rem; font-weight: 600;
  letter-spacing: .16em; text-transform: uppercase; color: var(--primary); }
.eyebrow::before { content: ""; width: 1.9rem; height: 1px; background: currentColor; opacity: .7; }
.lang-switch { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 999px; padding: 2px; background: var(--surface); }
.lang-switch button { min-height: 28px; padding: .1rem .7rem; border: 0; border-radius: 999px; font-size: .8rem; background: transparent; color: var(--muted); }
.lang-switch button.active { background: var(--btn); color: #fff; }
.lang-switch.big button { min-height: 36px; font-size: .9rem; padding: .2rem 1rem; }

/* ------------------------------------------------------------------ auth screens */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, 42%) 1fr; }
.auth-brand { position: relative; overflow: hidden; color: #eaf0ff; padding: 3rem clamp(2rem, 4vw, 4rem); display: flex; flex-direction: column; gap: 2rem;
  background: radial-gradient(90% 70% at 85% 12%, rgba(69, 89, 243, .32), transparent 62%), var(--ink);
  border-right: 1px solid rgba(255, 255, 255, .12); }
.auth-brand .brand-mark { color: #fff; }
.auth-brand .relay-word, .auth-brand .eyebrow { color: var(--accent-bright); }
.brand-hero { margin-top: auto; }
.auth-brand h1 { font-size: clamp(2rem, 3vw, 3rem); font-weight: 600; line-height: 1.1; letter-spacing: -.02em; max-width: 14ch; margin: 0; color: #e8eaf2; }
.auth-brand h1 .accent { color: var(--accent-bright); }
.brand-points { list-style: none; padding: 0; margin: 0; display: grid; gap: .9rem; }
.brand-points li { display: flex; gap: .75rem; align-items: center; color: #c4c8da; }
.brand-points svg { color: var(--accent-bright); }
.brand-operator { margin-top: auto; color: #9aa1bb; font-size: .9rem; }
.brand-operator strong { color: #fff; }
.auth-main { display: flex; flex-direction: column; padding: 1.5rem clamp(1rem, 4vw, 3rem); }
.auth-top { display: flex; justify-content: space-between; align-items: center; }
.auth-top .brand-mark { visibility: hidden; }
.auth-card { width: 100%; max-width: 440px; margin: auto; padding: 2rem 0; }
.auth-card.wide { max-width: 760px; }
.auth-card h2 { font-size: 1.6rem; margin-bottom: .3rem; }
.auth-card form { margin-top: 1.4rem; }
.auth-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; color: var(--faint); font-size: .8rem; }
.links { margin-top: 1rem; font-size: .92rem; }
.steps { padding-left: 1.2rem; color: var(--muted); }
.qr { display: grid; place-items: center; margin: 1rem 0; }
.qr svg { width: 200px; height: 200px; background: #fff; padding: 10px; border-radius: var(--radius); stroke: none; }
.qr.big svg { width: 240px; height: 240px; }
.secret { font-size: 1rem; letter-spacing: .05em; word-break: break-all; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: .4rem; padding: 0; list-style: none; font-family: var(--mono); }
.codes li { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: .35rem .6rem; text-align: center; }

/* ------------------------------------------------------------------ app shell */
.shell { min-height: 100vh; display: grid; grid-template-columns: var(--side-w) 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 2px; padding: 1rem .75rem;
  background: var(--side-bg); color: var(--side-text); overflow-y: auto; z-index: 30; border-right: 1px solid var(--side-line); }
.side-head { display: flex; align-items: center; justify-content: space-between; padding: .25rem .4rem 1.25rem; color: var(--side-strong); }
.collapse-btn { color: var(--side-muted); }
.collapse-btn:hover { background: var(--side-hover-bg); border-color: transparent; color: var(--side-strong); }
.nav-item { display: flex; align-items: center; gap: .8rem; padding: .7rem .8rem; border-radius: var(--radius); color: var(--side-text); font-weight: 550; position: relative; }
.nav-item:hover { background: var(--side-hover-bg); color: var(--side-strong); text-decoration: none; }
.nav-item.active { background: var(--side-active-bg); color: var(--side-active); }
.nav-item.active::before { content: ""; position: absolute; left: -.75rem; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.nav-item .count { margin-left: auto; background: var(--accent); color: #fff; border-radius: 999px; font-size: .72rem; padding: 0 .45rem; font-weight: 700; }
.side-sep { height: 1px; background: var(--side-line); margin: .75rem .4rem; }
.side-foot { margin-top: auto; display: grid; gap: .6rem; padding-top: 1rem; border-top: 1px solid var(--side-line); }
.me-box { display: flex; align-items: center; gap: .7rem; padding: .5rem; border-radius: var(--radius); color: var(--side-text); }
.me-box:hover { background: var(--side-hover-bg); text-decoration: none; }
.me-box.active { background: var(--side-active-bg); }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; flex: none;
  background: var(--btn); color: #fff; }
.me-text { display: grid; min-width: 0; }
.me-text strong, .me-text small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-text small { color: var(--side-muted); }
.org-select { background: transparent; color: var(--side-text); border-color: var(--side-line); min-height: 36px; padding: .3rem .5rem; }
.org-select option { color: #000; }
.operator { font-size: .75rem; color: var(--side-muted); margin: 0 .5rem; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; height: var(--top-h); display: flex; align-items: center; gap: 1rem; padding: 0 1.5rem;
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.menu-btn { display: none; }
.banner { display: flex; align-items: center; gap: .5rem; margin: 0; color: var(--warn); font-size: .85rem; font-weight: 550; flex: 1; min-width: 0; }
.banner span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quick-search { display: flex; align-items: center; gap: .4rem; border: 1px solid var(--border-strong); border-radius: 999px; padding: 0 .8rem; background: var(--surface); width: 220px; }
.quick-search input { border: 0; min-height: 36px; padding: 0; background: transparent; }
.quick-search input:focus { outline: 0; }
.quick-search:focus-within { border-color: var(--primary); }
.quick-search svg { color: var(--faint); width: 18px; height: 18px; }

.upload-widget { gap: .75rem; min-height: 46px; padding: .3rem .4rem .3rem .9rem; border-color: var(--border); background: var(--surface-2); font-weight: 400; }
.uw-text { display: grid; text-align: left; line-height: 1.2; }
.uw-text strong { font-size: .82rem; }
.uw-text small { color: var(--muted); font-size: .75rem; font-variant-numeric: tabular-nums; }
.spark { width: 120px; height: 32px; stroke-width: 1.5; }
.spark .line { stroke: var(--primary); fill: none; }
.spark .fill { fill: color-mix(in srgb, var(--primary) 16%, transparent); stroke: none; }

.view { padding: 1.75rem 2rem 2rem; max-width: 1600px; width: 100%; }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.view-head .sub { color: var(--muted); margin: .35rem 0 0; max-width: 70ch; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); margin-bottom: 1.25rem; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; align-items: start; }
.two-col > .panel { margin-bottom: 0; }
.two-col + .panel { margin-top: 1.25rem; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.row-end { display: flex; justify-content: flex-end; gap: .5rem; }
.app-foot { margin-top: auto; padding: 1rem 2rem; color: var(--faint); font-size: .8rem; }

/* ------------------------------------------------------------------ send form */
.send-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1.25rem; align-items: start; }
.send-side { position: sticky; top: calc(var(--top-h) + 1rem); }
.send-side h3 { margin-top: 0; }
.chips-field { position: relative; }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; min-height: 42px; padding: .3rem .4rem;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); cursor: text; }
.chips:focus-within { outline: 2px solid var(--primary); outline-offset: -1px; border-color: var(--primary); }
.chip { display: inline-flex; align-items: center; gap: .3rem; background: var(--primary-soft); color: var(--text); border-radius: 999px; padding: .15rem .25rem .15rem .65rem; font-size: .88rem; max-width: 100%; }
.chip.invalid { background: var(--bad-soft); color: var(--bad); }
.chip small { color: var(--muted); }
.chip button { min-height: 22px; width: 22px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: inherit; }
.chip button svg { width: 14px; height: 14px; }
.chip-input { flex: 1; min-width: 160px; border: 0; min-height: 32px; padding: .2rem; background: transparent; }
.chip-input:focus { outline: 0; }
.suggest { position: absolute; z-index: 15; left: 0; right: 0; top: calc(100% - .2rem); list-style: none; margin: 0; padding: .3rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); max-height: 280px; overflow-y: auto; }
.suggest li { padding: .5rem .65rem; border-radius: var(--radius); cursor: pointer; display: grid; }
.suggest li small { color: var(--muted); }
.suggest li.active, .suggest li:hover { background: var(--primary-soft); }

.drop { border: 2px dashed var(--border-strong); border-radius: var(--radius); padding: 1.6rem 1rem; text-align: center; background: var(--surface-2); transition: border-color .15s, background .15s; }
.drop.over { border-color: var(--primary); background: var(--primary-soft); }
.drop .drop-icon { width: 36px; height: 36px; color: var(--primary); }
.drop p { margin: .25rem 0; }
.drop-buttons { display: flex; justify-content: center; gap: .6rem; flex-wrap: wrap; margin-top: .8rem; }
.drop.small { padding: 1rem; margin-top: .75rem; }

.pick-list { list-style: none; padding: 0; margin: .75rem 0 0; display: grid; gap: .5rem; }
.pick-list li { display: grid; grid-template-columns: auto 1fr auto; gap: .2rem .75rem; align-items: center; padding: .65rem .8rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.pick-list li > svg { color: var(--muted); grid-row: span 2; }
.pick-list .fname { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pick-list .fmeta { grid-column: 2 / 4; color: var(--muted); font-size: .82rem; display: flex; flex-wrap: wrap; gap: .25rem .9rem; font-variant-numeric: tabular-nums; }
.pick-list .fmeta .ok { color: var(--ok); }
.pick-list .fmeta .warn { color: var(--warn); }
.pick-list .fmeta .bad { color: var(--bad); }
.pick-list .ftools { display: flex; gap: .2rem; align-items: center; }
.pick-list .hash { grid-column: 2 / 4; font-family: var(--mono); font-size: .75rem; color: var(--faint); word-break: break-all; }
.bar { grid-column: 2 / 4; height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; }
.bar > span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--btn), var(--accent-bright)); border-radius: 3px; transition: width .3s; }
.bar.done > span { background: var(--ok); }
.bar.paused > span { background: var(--warn); }

.segmented { display: grid; gap: .5rem; margin-bottom: 1rem; }
.segmented label { margin: 0; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label > span { display: grid; padding: .65rem .85rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); color: var(--text); margin: 0; font-weight: 400; }
.segmented label > span small { color: var(--muted); }
.segmented input:checked + span { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.segmented input:focus-visible + span { outline: 2px solid var(--primary); }
.summary { display: grid; grid-template-columns: auto 1fr; gap: .3rem 1rem; padding: .9rem 0; margin: .5rem 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); font-size: .92rem; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.send-actions { display: grid; grid-template-columns: 1fr 1.6fr; gap: .6rem; margin-top: 1rem; }

.progress-panel { margin-top: 1.25rem; }
.stepper { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; padding: 0; margin: 1rem 0; counter-reset: step; }
.stepper li { counter-increment: step; display: flex; align-items: center; gap: .6rem; padding: .7rem .8rem; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--muted); font-weight: 550; font-size: .9rem; }
.stepper li::before { content: counter(step); display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--border-strong); font-size: .8rem; flex: none; }
.stepper li.active { color: var(--primary); background: var(--primary-soft); }
.stepper li.active::before { border-color: var(--primary); border-top-color: transparent; animation: spin 1s linear infinite; content: ""; }
.stepper li.done { color: var(--ok); background: var(--ok-soft); }
.stepper li.done::before { content: "✓"; border-color: var(--ok); background: var(--ok); color: #fff; }
.stepper li.failed { color: var(--bad); background: var(--bad-soft); }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .stepper li.active::before { animation: none; } }

/* ------------------------------------------------------------------ lists */
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .4rem 1rem; }
.filters label { margin: 0; min-width: 150px; }
.filters label.grow { flex: 1; min-width: 220px; }
.filter-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-left: auto; }
.table-panel { padding: 0; overflow: hidden; }
.search-input { margin-bottom: 1rem; }
table.list { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.list th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 650;
  padding: .75rem 1rem; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
table.list td { padding: .75rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.panel:not(.table-panel) table.list th:first-child, .panel:not(.table-panel) table.list td:first-child { padding-left: .25rem; }
table.list tbody tr:last-child td { border-bottom: 0; }
table.list tr.clickable { cursor: pointer; }
table.list tr.clickable:hover td { background: var(--surface-2); }
table.list tr.selected td { background: var(--primary-soft); }
table.list td.status-cell { position: relative; padding-left: 1.2rem; }
table.list td.status-cell::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--border-strong); }
table.list td.status-cell.ok::before { background: var(--ok); }
table.list td.status-cell.bad::before { background: var(--bad); }
table.list td.status-cell.warn::before { background: var(--warn); }
table.list td.status-cell.info::before { background: var(--primary); }
table.list .num { font-family: var(--mono); font-weight: 600; white-space: nowrap; }
table.list .sub-line { display: block; color: var(--muted); font-size: .8rem; }
table.list .cut { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.list td.tools { text-align: right; white-space: nowrap; }
.empty { padding: 2rem 1rem; text-align: center; color: var(--muted); margin: 0; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .7rem 1rem; color: var(--muted); font-size: .85rem; flex-wrap: wrap; }
.pager:empty { display: none; }
.pager .pages { display: flex; gap: .25rem; }
.pager button { min-height: 34px; min-width: 34px; padding: 0 .55rem; }
.pager button.current { background: var(--primary); color: #fff; border-color: var(--primary); }
.tag-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.tag-list li { display: inline-flex; gap: .4rem; align-items: center; padding: .25rem .3rem .25rem .75rem; border: 1px solid var(--border); border-radius: 999px; font-size: .88rem; }

/* split list + detail (PC); drawer (tablet); full screen (phone) */
.view.split { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.25rem; align-items: start; max-width: none; }
.view.split.has-detail { grid-template-columns: minmax(0, 1fr) minmax(420px, 36%); }
.detail-pane { position: sticky; top: calc(var(--top-h) + 1rem); max-height: calc(100vh - var(--top-h) - 2rem); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.detail-head { position: sticky; top: 0; z-index: 2; display: flex; gap: .75rem; align-items: flex-start; padding: 1rem 1.25rem; background: var(--surface); border-bottom: 1px solid var(--border); }
.detail-head h2 { font-size: 1.1rem; word-break: break-word; }
.detail-head p { margin: 0; font-size: .82rem; }
.detail-body { padding: .25rem 1.25rem 1.25rem; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1.25rem; margin: 1rem 0; font-size: .92rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.note { white-space: pre-wrap; background: var(--surface-2); border-left: 3px solid var(--primary); padding: .7rem .9rem; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0; }
.rlist { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; }
.rlist li { display: grid; grid-template-columns: 1fr auto; gap: .15rem .75rem; align-items: center; padding: .55rem .75rem; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.rlist small { color: var(--muted); grid-column: 1 / 2; }
.rlist .rtools { grid-row: 1 / 3; grid-column: 2; display: flex; gap: .4rem; align-items: center; }

.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.25rem; overflow-x: auto; }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: var(--muted); padding: .6rem 1rem; }
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0 1rem; }
.inline-form h3 { flex-basis: 100%; }
.inline-form .field { flex: 1; min-width: 180px; }
.inline-form button { margin-bottom: .9rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); }
.tile small { color: var(--muted); display: block; font-weight: 550; }
.tile strong { display: block; font-size: 1.5rem; margin: .2rem 0; font-variant-numeric: tabular-nums; }
.tile .meter { height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; margin-top: .5rem; }
.tile .meter span { display: block; height: 100%; background: var(--primary); }
.tile.ok strong { color: var(--ok); }
.tile.bad strong { color: var(--bad); }
.tile.warn strong { color: var(--warn); }

.invite-result { text-align: center; }
.copy-row { display: flex; gap: .4rem; }
.copy-row input { font-family: var(--mono); font-size: .8rem; }

.doc { max-width: 900px; padding: 2rem clamp(1.25rem, 3vw, 2.5rem); line-height: 1.65; }
.doc h1 { margin-bottom: .5rem; }
.doc h2 { margin: 2rem 0 .6rem; padding-top: .5rem; border-top: 1px solid var(--border); }
.doc h3 { margin: 1.4rem 0 .4rem; }
.doc nav.toc { background: var(--surface-2); border-radius: var(--radius-sm); padding: .8rem 1.2rem; margin: 1rem 0 1.5rem; }
.doc nav.toc ol { margin: 0; padding-left: 1.2rem; columns: 2; }
.doc table { border-collapse: collapse; width: 100%; margin: .8rem 0; font-size: .92rem; }
.doc th, .doc td { border: 1px solid var(--border); padding: .45rem .7rem; text-align: left; vertical-align: top; }
.doc th { background: var(--surface-2); }
.doc .callout { border-left: 3px solid var(--warn); background: var(--warn-soft); padding: .7rem 1rem; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.doc kbd { font-family: var(--mono); font-size: .85em; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0 .3rem; }

.dialog { border: 0; border-radius: var(--radius); padding: 0; width: min(480px, calc(100vw - 2rem)); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
.dialog::backdrop { background: rgba(8, 14, 28, .5); }
.dialog form { padding: 1.4rem; }
.dialog h3 { margin: 0 0 1rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: .5rem; }

.tabbar { display: none; }
.scrim { position: fixed; inset: 0; background: rgba(8, 14, 28, .45); z-index: 25; }

/* ------------------------------------------------------------------ PC wide screens (16:9, ≥1600 px) */
@media (min-width: 1600px) {
  .view { padding: 2rem 2.5rem; }
  .view.split.has-detail { grid-template-columns: minmax(0, 1fr) 560px; }
}

/* ------------------------------------------------------------------ tablet (768–1279 px) */
@media (max-width: 1279px) {
  .shell { grid-template-columns: var(--rail-w) 1fr; }
  .shell:not(.expanded) .sidebar .label, .shell:not(.expanded) .side-sep, .shell:not(.expanded) .nav-item .count { display: none; }
  .shell:not(.expanded) .sidebar { padding: 1rem .6rem; align-items: center; }
  .shell:not(.expanded) .side-head { padding: .25rem 0 1rem; flex-direction: column; gap: .75rem; }
  .shell:not(.expanded) .collapse-btn svg { transform: rotate(180deg); }
  .shell:not(.expanded) .dc-mono { display: block; }
  .shell:not(.expanded) .nav-item { justify-content: center; padding: .75rem; }
  .shell:not(.expanded) .nav-item.active::before { left: -.6rem; }
  .shell:not(.expanded) .side-foot { border-top: 0; }
  .shell.expanded .sidebar { position: fixed; left: 0; width: var(--side-w); box-shadow: var(--shadow-lg); }
  .view { padding: 1.5rem; }
  .send-grid { grid-template-columns: minmax(0, 1fr) 300px; }
  .hide-md { display: none; }
  .quick-search { width: 180px; }
  .banner span { display: none; }
  .banner::after { content: attr(data-short); }
  .view.split.has-detail { grid-template-columns: minmax(0, 1fr); }
  .detail-pane { position: fixed; z-index: 28; top: 0; right: 0; bottom: 0; width: min(560px, 92vw); max-height: none; border-radius: 0; box-shadow: var(--shadow-lg); }
}

/* ------------------------------------------------------------------ phone (<768 px) */
@media (max-width: 767px) {
  body { font-size: 16px; }
  .auth { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .auth-top .brand-mark { visibility: visible; }
  .auth-card { padding: 1.5rem 0; }

  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: min(300px, 86vw); transform: translateX(-105%); transition: transform .2s; padding: 1rem .75rem !important; align-items: stretch !important; }
  .shell.expanded .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .shell .sidebar .label, .shell .side-sep { display: revert !important; }
  .shell .sidebar .nav-item { justify-content: flex-start !important; padding: .75rem .8rem !important; }
  .shell .side-head { flex-direction: row !important; }
  .collapse-btn { display: none; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 0 .75rem; gap: .5rem; padding-top: env(safe-area-inset-top); }
  .banner { display: none; }
  .quick-search { flex: 1; width: auto; }
  .topbar .lang-switch { display: none; }
  .upload-widget { padding: .2rem .5rem; }
  .upload-widget .spark { display: none; }

  .view { padding: 1rem .9rem 6rem; }
  h1 { font-size: 1.35rem; }
  .view-head { align-items: flex-start; }
  .view-head .button, .view-head > button { display: none; }
  .panel { padding: 1rem; }
  .two-col, .send-grid, .field-row { grid-template-columns: 1fr; }
  .send-side { position: static; }
  .send-actions { position: sticky; bottom: calc(64px + env(safe-area-inset-bottom)); background: var(--surface); padding: .6rem 0; }
  .stepper { grid-template-columns: 1fr; }
  .filters label, .filters label.grow { min-width: calc(50% - .5rem); flex: 1; }
  .filters label.grow { min-width: 100%; }
  .filter-actions { margin-left: 0; width: 100%; }
  .filter-actions > * { flex: 1; }

  /* Tables become cards. */
  table.list thead { display: none; }
  table.list, table.list tbody, table.list tr, table.list td { display: block; width: 100%; }
  table.list tr { position: relative; padding: .75rem 1rem .75rem 1.2rem; border-bottom: 1px solid var(--border); }
  table.list td { padding: .1rem 0; border: 0; }
  table.list td.status-cell { position: static; padding-left: 0; }
  table.list td.status-cell::before { top: 0; bottom: 0; }
  table.list td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: .8rem; }
  table.list .cut { max-width: none; white-space: normal; }
  table.list td.tools { text-align: left; padding-top: .4rem; }
  .panel:not(.table-panel) table.list tr { padding-left: .2rem; padding-right: .2rem; }

  .detail-pane { width: 100vw; }
  .tabbar { position: fixed; z-index: 24; left: 0; right: 0; bottom: 0; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    background: var(--surface); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a, .tabbar button { display: grid; justify-items: center; gap: .1rem; padding: .5rem .2rem; min-height: 60px; border: 0; border-radius: 0;
    background: transparent; color: var(--muted); font-size: .7rem; font-weight: 600; }
  .tabbar a.active { color: var(--primary); }
  .tabbar a:hover { text-decoration: none; }
  .app-foot { padding-bottom: 5.5rem; text-align: center; }
  .message.toast { left: .75rem; right: .75rem; bottom: calc(72px + env(safe-area-inset-bottom)); max-width: none; }
  .doc nav.toc ol { columns: 1; }
  .codes { grid-template-columns: 1fr; }
}

@media print {
  .sidebar, .topbar, .tabbar, .app-foot, .view-head, #form-invite, #view-invite > .panel { display: none !important; }
  .shell { display: block; }
  .invite-result { border: 0; box-shadow: none; }
}

/* Personal link: the received view inside the sign-in card */
.guest-received .detail-head { position: static; padding: 0 0 1rem; background: none; }
.guest-received .detail-body { padding: 0; }
.nowrap { white-space: nowrap; }
.doc .callout { margin: 1rem 0; }
.doc .callout.info { border-left-color: var(--accent); background: var(--surface-2); }
.doc code { font-family: var(--mono); font-size: .88em; background: var(--surface-2); padding: .1em .35em; border-radius: 4px; }
.doc .operator-line { margin-top: 2rem; color: var(--muted); font-size: .9rem; }
@media (max-width: 767px) { .doc nav.toc ol { columns: 1; } .doc { padding: 1.25rem 1rem; } .doc table { display: block; overflow-x: auto; } }
/* With the detail pane open the list keeps only its essential columns. */
@media (min-width: 1280px) { .view.split.has-detail .list .hide-md { display: none; } }
@media (max-width: 767px) { .tabs button { padding: .6rem .6rem; flex: 0 0 auto; } }

/* Public help page (/hilfe, /help) */
body.public-doc { background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; }
.doc-top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .75rem clamp(1rem, 3vw, 2rem); background: var(--surface); border-bottom: 1px solid var(--border); }
.doc-top .brand-mark { color: var(--text); text-decoration: none; }
.doc-top-links { display: flex; align-items: center; gap: .75rem; }
.lang-switch a { min-height: 28px; display: inline-flex; align-items: center; padding: .1rem .7rem; border-radius: 999px; font-size: .8rem; color: var(--muted); text-decoration: none; }
.lang-switch a.active { background: var(--primary); color: #fff; }
.doc-main { flex: 1; display: flex; justify-content: center; padding: clamp(1rem, 3vw, 2rem); }
.doc-main .doc { width: 100%; }
.doc-foot { text-align: center; color: var(--faint); font-size: .85rem; padding: 1.5rem 1rem 2rem; }
.doc h2[id], .doc h3[id] { scroll-margin-top: 5rem; }

/* 0.10.0: file request upload page and operator area */
.ul-message { white-space: pre-wrap; background: var(--surface-2); border-left: 3px solid var(--primary); padding: .7rem .9rem; border-radius: var(--radius); margin: 0 0 1rem; }
#view-upload .drop { margin-bottom: .25rem; }
#view-upload textarea { width: 100%; }
#btn-ul-submit { margin-top: 1rem; }
.done-mark { text-align: center; margin: 1rem 0 .5rem; }
.done-mark svg { width: 56px; height: 56px; color: var(--ok); stroke-width: 2.2; }
#ul-done { text-align: center; }
details.panel > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: .5rem; }
details.panel > summary::before { content: "+"; font-weight: 700; color: var(--primary); width: 1rem; }
details.panel[open] > summary::before { content: "–"; }
details.panel[open] > summary { margin-bottom: 1rem; }
.op-form { display: grid; gap: .8rem; }
.op-form button { justify-self: start; }
#view-operator table.list tr.operator-line td { background: var(--warn-soft); }
#view-operator table.list td.tools { white-space: normal; min-width: 12rem; }
#view-operator table.list td.tools button { margin: .1rem 0 .1rem .25rem; }

/* 0.11.0: feedback box and operator list */
.fb-kind { grid-template-columns: repeat(4, minmax(0, 1fr)); border: 0; padding: 0; }
.fb-kind label > span { text-align: center; }
.fb-kind input:checked + span { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
#form-feedback textarea { width: 100%; }
.fb-list { display: grid; gap: .75rem; }
.fb-card { margin: 0; }
.fb-card header { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .75rem; }
.fb-card .fb-text { white-space: pre-wrap; margin: .75rem 0; overflow-wrap: anywhere; }
.fb-card footer { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.fb-card footer .tools { display: flex; gap: .4rem; flex: none; }
.fb-card.done { opacity: .7; }
td .badge.warn { margin-left: .3rem; }
@media (max-width: 767px) {
  .fb-kind { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fb-card footer { flex-direction: column; align-items: stretch; }
}
#view-operator table.list td.tools button { display: inline-flex; align-items: center; gap: .3rem; vertical-align: middle; }
#view-operator table.list td.tools button svg { width: 15px; height: 15px; }

/* ------------------------------------------------------------------ operator: system health */
.sys-head { display: flex; align-items: center; gap: 1rem; }
.sys-head strong { display: block; font-size: 1.15rem; }
.sys-light { width: 14px; height: 14px; border-radius: 50%; flex: none; background: var(--off); box-shadow: 0 0 0 5px var(--off-soft); }
.sys-light.ok { background: var(--ok); box-shadow: 0 0 0 5px var(--ok-soft); }
.sys-light.warn { background: var(--warn); box-shadow: 0 0 0 5px var(--warn-soft); }
.sys-light.bad { background: var(--bad); box-shadow: 0 0 0 5px var(--bad-soft); }
.sys-issues { list-style: none; padding: 0; margin: 0 0 1.25rem; display: grid; gap: .4rem; }
.sys-issues li { display: flex; align-items: center; gap: .6rem; padding: .55rem .8rem; border-radius: var(--radius); background: var(--surface);
  border: 1px solid var(--border); border-left: 3px solid var(--warn); }
.sys-issues li.bad { border-left-color: var(--bad); }
.sys-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1.25rem; margin-bottom: 1.25rem; }
.sys-grid .panel { margin: 0; }
.sys-card header { display: flex; align-items: center; gap: .6rem; margin-bottom: .9rem; }
.sys-card h3 { margin: 0; }
.sys-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); flex: none; }
.sys-dot.warn { background: var(--warn); }
.sys-dot.bad { background: var(--bad); }
.sys-gauges { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem 1.1rem; margin-bottom: .9rem; }
.sys-gauges > :only-child { grid-column: 1 / -1; }
.gauge-top { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; font-size: .85rem; color: var(--muted); }
.gauge-top strong { font-size: 1.15rem; color: var(--text); font-variant-numeric: tabular-nums; }
.gauge.warn .gauge-top strong { color: var(--warn); }
.gauge.bad .gauge-top strong { color: var(--bad); }
.gauge .meter { height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; margin-top: .35rem; }
.gauge .meter span { display: block; height: 100%; background: var(--ok); }
.gauge.warn .meter span { background: var(--warn); }
.gauge.bad .meter span { background: var(--bad); }
.gauge small, .sys-spark small { display: block; color: var(--muted); font-size: .78rem; margin-top: .25rem; }
.spark { display: block; width: 100%; height: 36px; margin-top: .35rem; overflow: visible; }
.spark path { fill: none; stroke: var(--accent); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.sys-spark { margin-bottom: .9rem; }
.sys-rows { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .35rem 1rem; margin: 0; font-size: .9rem; }
.sys-rows dt { color: var(--muted); white-space: nowrap; }
.sys-rows dd { margin: 0; text-align: right; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.sys-net-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: .75rem; }
.sys-net-head h3 { margin-top: 0; }
.sys-table { overflow-x: auto; }
.sys-table td.tools { text-align: right; white-space: nowrap; }
.sys-table td.tools button { margin-left: .3rem; }
.sys-crit { margin-left: .5rem; }
@media (max-width: 767px) {
  .sys-grid { grid-template-columns: 1fr; }
  .sys-net-head { flex-direction: column; }
}

/* Terms of use: the short version, confirmed before first use (account) or on each visit (guests). */
.terms-box { max-height: 340px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); padding: .9rem 1.1rem; margin: .8rem 0 1rem; font-size: .9rem; line-height: 1.55; }
.terms-box ol { margin: .4rem 0 .6rem; padding-left: 1.2rem; }
.terms-box li { margin: .35rem 0; }
.terms-box p { margin: .3rem 0; }
.terms-box .terms-version { color: var(--muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; }
.terms-slot { margin: .6rem 0 1rem; }
.terms-slot .terms-box { max-height: 220px; }
#view-terms .terms-box { max-height: none; }
.doc-foot a { color: inherit; }
