/* Lab Console: one stylesheet, no framework. TheLabs.fyi colours: deep teal, cream, teal accent. */
@font-face { font-family: "Atkinson Next"; src: url("fonts/atkinson-next-latin.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }

:root {
  color-scheme: light;
  --bg: #f3f1e8; --surface: #ffffff; --surface-2: #ece9dc; --ink: #13262d; --ink-2: #44575e; --ink-3: #5a6a6f;
  --line: #dcd8c8; --primary: #0f3440; --on-primary: #f6efcf; --accent: #16736c; --brand: #0f3440; --on-brand: #e8db9c;
  --ok: #1b7f3b; --ok-bg: #e3f3e7; --on-bad: #ffffff; --bad: #b8322b; --bad-bg: #fbe9e7; --info: #66777c; --warn: #8a5a00; --focus: #1f6fd1;
  --radius: 14px; --radius-s: 9px; --shadow: 0 1px 2px rgb(19 38 45 / .06), 0 4px 16px rgb(19 38 45 / .05);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d1f26; --surface: #132b33; --surface-2: #1a3640; --ink: #eef0e6; --ink-2: #b7c3c2; --ink-3: #8fa1a2;
    --line: #24434d; --primary: #e8db9c; --on-primary: #10262d; --accent: #4fc0b4; --brand: #0a181e; --on-brand: #e8db9c;
    --ok: #5cc27f; --ok-bg: #173a29; --on-bad: #10262d; --bad: #ef6b62; --bad-bg: #3a1f1d; --info: #8fa1a2; --warn: #e3b55f; --focus: #7ab4f5;
    --shadow: 0 1px 2px rgb(0 0 0 / .3);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1f26; --surface: #132b33; --surface-2: #1a3640; --ink: #eef0e6; --ink-2: #b7c3c2; --ink-3: #8fa1a2;
  --line: #24434d; --primary: #e8db9c; --on-primary: #10262d; --accent: #4fc0b4; --brand: #0a181e; --on-brand: #e8db9c;
  --ok: #5cc27f; --ok-bg: #173a29; --on-bad: #10262d; --bad: #ef6b62; --bad-bg: #3a1f1d; --info: #8fa1a2; --warn: #e3b55f; --focus: #7ab4f5;
  --shadow: 0 1px 2px rgb(0 0 0 / .3);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.5 "Atkinson Next", system-ui, sans-serif; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .6rem; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; margin-top: 1.2rem; }
h2 small, h1 small { font-weight: 400; font-size: .85rem; }
a { color: var(--accent); }
code { font-family: ui-monospace, "JetBrains Mono", Consolas, monospace; font-size: .88em; background: var(--surface-2); padding: .05em .35em; border-radius: 5px; overflow-wrap: anywhere; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.muted { color: var(--ink-2); } .small { font-size: .875rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 16px; top: 8px; z-index: 9; background: var(--surface); padding: .5rem 1rem; }

/* ---------- shell: sidebar on wide screens, top bar + tabs on phones ---------- */
.side { position: fixed; inset: 0 auto 0 0; width: 232px; background: var(--brand); color: var(--on-brand); display: flex; flex-direction: column; padding: 18px 12px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--on-brand); font-weight: 800; font-size: 1.15rem; padding: 0 8px 18px; }
.brand b { color: #4fc0b4; } .brand small { display: block; font-weight: 400; font-size: .78rem; opacity: .75; }
.side-nav { display: grid; gap: 2px; }
.side-nav a, .tabbar a { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; border-radius: 10px; }
.side-nav a { padding: 10px 12px; opacity: .82; }
.side-nav a:hover { background: rgb(255 255 255 / .07); opacity: 1; }
.side-nav a[aria-current] { background: rgb(232 219 156 / .14); opacity: 1; font-weight: 700; }
.side-nav svg { width: 20px; height: 20px; flex: none; }
.side-foot { margin-top: auto; display: grid; gap: 6px; padding: 0 8px; font-size: .875rem; }
.side-foot .muted { color: inherit; opacity: .75; }
.link { background: none; border: 0; padding: 0; color: inherit; text-decoration: underline; cursor: pointer; text-align: left; opacity: .85; }
main { margin-left: 232px; padding: 28px 32px 48px; max-width: 1180px; }
.topbar, .tabbar { display: none; }
@media (max-width: 860px) {
  .side { display: none; }
  .topbar { display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 5; background: var(--brand); color: var(--on-brand); padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top)); }
  .topbar .brand { padding: 0; font-size: 1.05rem; }
  .topbar-title { margin-left: auto; font-size: .9rem; opacity: .8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 45vw; }
  main { margin: 0; padding: 18px 16px calc(84px + env(safe-area-inset-bottom)); }
  .tabbar { display: flex; position: fixed; inset: auto 0 0 0; z-index: 5; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar a { flex: 1; flex-direction: column; gap: 2px; padding: 6px 0; font-size: .72rem; color: var(--ink-2); }
  .tabbar a[aria-current] { color: var(--ink); font-weight: 700; }
  .tabbar a[aria-current] svg { color: var(--accent); }
  .tabbar svg { width: 22px; height: 22px; }
}

/* ---------- building blocks ---------- */
.page-title { margin-bottom: .4rem; }
.page-title + .muted { margin-top: 0; margin-bottom: 1.2rem; max-width: 70ch; }
.crumbs { margin: 0 0 .2rem; font-size: .9rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin: 0 0 16px; box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: .4rem; }
.card-head h2 { margin: 0; }
.card-danger { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
@media (max-width: 1000px) { .grid2 { grid-template-columns: minmax(0, 1fr); } }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--ink); font-weight: 700; text-decoration: none; cursor: pointer; }
.btn:hover { border-color: var(--ink-3); }
.btn-primary { background: var(--primary); color: var(--on-primary); border-color: transparent; }
.btn-danger { background: var(--bad); color: var(--on-bad); border-color: transparent; }
.btn-small { min-height: 32px; padding: 4px 12px; font-size: .875rem; }
.btn-wide { width: 100%; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

.form { display: grid; gap: 12px; align-content: start; }
.form label { display: grid; gap: 4px; font-weight: 700; font-size: .92rem; }
.form label small { font-weight: 400; }
.form .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
input[type=text], input[type=email], input[type=password], select, textarea {
  width: 100%; min-height: 44px; padding: 9px 12px; border-radius: var(--radius-s); border: 1px solid var(--line); background: var(--bg); }
textarea { resize: vertical; }
label.check { display: flex; align-items: center; gap: 10px; font-weight: 400; }
label.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.form .btn { justify-self: start; }
.inline { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inline select { width: auto; min-height: 36px; padding: 4px 10px; }
.code-chip { font: 700 .85rem ui-monospace, Consolas, monospace; background: var(--surface-2); border: 1px dashed var(--ink-3); border-radius: 6px; padding: 1px 6px; cursor: pointer; color: var(--ink); }

details.adder { margin-top: 12px; }
details.adder > summary { list-style: none; }
details.adder > summary::-webkit-details-marker { display: none; }
details.adder[open] > summary { margin-bottom: 12px; }

.flash { padding: 12px 16px; border-radius: var(--radius-s); margin: 0 0 16px; border: 1px solid transparent; }
.flash-ok { background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.flash-warn { background: var(--bad-bg); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }

.pill { display: inline-block; padding: 1px 9px; border-radius: 99px; font-size: .78rem; font-weight: 700; background: var(--surface-2); color: var(--ink-2); }
.pill-ok { background: var(--ok-bg); color: var(--ok); } .pill-off { background: var(--bad-bg); color: var(--bad); }

.table-wrap { overflow-x: auto; margin: 0 -4px; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); }
.table tr:last-child td { border-bottom: 0; }
.table td { overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; }
  .table tr { padding: 10px 4px; border-bottom: 1px solid var(--line); }
  .table td { border: 0; padding: 2px 4px; }
}
.kv { border-collapse: collapse; width: 100%; }
.kv th { text-align: left; color: var(--ink-2); font-weight: 400; padding: 6px 16px 6px 0; vertical-align: top; white-space: nowrap; width: 1%; }
.kv td { padding: 6px 0; overflow-wrap: anywhere; }
@media (max-width: 600px) { .kv th, .kv td { display: block; padding: 2px 0; } .kv td { padding-bottom: 8px; } }

.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.rows li:last-child { border-bottom: 0; }

.health { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.health li { display: flex; gap: 12px; align-items: flex-start; overflow-wrap: anywhere; }
.health .dot { flex: none; width: 12px; height: 12px; border-radius: 50%; margin-top: 5px; background: var(--info); }
.health .ok .dot { background: var(--ok); } .health .bad .dot { background: var(--bad); }

.record { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 10px 12px; margin-bottom: 10px; background: var(--bg); }
.record-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.record-value { display: block; background: none; padding: 0; font-size: .82rem; word-break: break-all; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { display: grid; gap: 2px; align-content: start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; color: inherit; text-decoration: none; box-shadow: var(--shadow); }
a.tile:hover { border-color: var(--ink-3); }
.tile-label { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); font-weight: 700; }
.tile-value { font-size: 1.45rem; font-weight: 800; }
.tile-note { font-size: .85rem; color: var(--ink-2); }
.tile-warn { border-color: var(--bad); } .tile-warn .tile-value { color: var(--bad); }
.meter { display: block; height: 8px; border-radius: 9px; background: var(--surface-2); overflow: hidden; margin: 4px 0; }
.meter span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 9px; }

.activity { list-style: none; margin: 0; padding: 0; }
.activity li { padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; overflow-wrap: anywhere; }
.activity li:last-child { border-bottom: 0; }
.activity .act { font-weight: 700; font-family: ui-monospace, Consolas, monospace; font-size: .85rem; }
.activity .muted { margin-left: auto; }
.pager { display: flex; gap: 8px; }

/* ---------- sign-in ---------- */
body.bare main { margin: 0 auto; max-width: 420px; padding: 8vh 16px 32px; }
.login-logo { display: block; width: 100%; height: auto; background: #0f3440; border-radius: var(--radius); padding: 16px 20px; margin-bottom: 16px; }
.login h1 { font-size: 1.3rem; }

/* ---------- inbox ---------- */
.inbox { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; align-items: start; }
.inbox-side { display: grid; gap: 12px; position: sticky; top: 16px; }
.inbox-side form { display: grid; gap: 4px; }
.inbox-buttons { display: grid; gap: 8px; }
.inbox-folders { display: grid; gap: 2px; }
.inbox-folders a { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-radius: 9px; color: var(--ink); text-decoration: none; }
.inbox-folders a:hover { background: var(--surface-2); }
.inbox-folders a[aria-current] { background: var(--surface); border: 1px solid var(--line); font-weight: 700; }
.inbox-folders b { background: var(--accent); color: #fff; border-radius: 99px; padding: 0 8px; font-size: .78rem; }
.inbox-folders small { color: var(--ink-3); }
@media (max-width: 860px) {
  .inbox { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .inbox-side { position: static; }
  .inbox-buttons { grid-template-columns: 1fr 1fr; }
  .inbox-folders { display: flex; overflow-x: auto; gap: 6px; padding-bottom: 4px; }
  .inbox-folders a { flex: none; gap: 8px; border: 1px solid var(--line); background: var(--surface); }
}
.search input { width: 240px; max-width: 100%; min-height: 36px; padding: 4px 10px; }
.bulk { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 8px 0; }
.bulk select { width: auto; min-height: 32px; padding: 2px 8px; }
.msglist { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.msglist li { display: flex; align-items: center; gap: 10px; padding: 0 12px; border-bottom: 1px solid var(--line); }
.msglist li:last-child { border-bottom: 0; }
.msglist input { width: 20px; height: 20px; flex: none; accent-color: var(--accent); }
.msglist a { flex: 1; min-width: 0; display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr) auto; gap: 12px; padding: 12px 0; color: var(--ink); text-decoration: none; }
.msglist a > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msglist .msg-date { color: var(--ink-3); font-size: .875rem; }
.msglist li.unread { background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.msglist li.unread .msg-from, .msglist li.unread .msg-subj { font-weight: 800; }
.msglist a:hover .msg-subj { text-decoration: underline; }
@media (max-width: 600px) {
  .msglist a { grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; }
  .msglist .msg-subj { grid-column: 1 / -1; grid-row: 2; color: var(--ink-2); }
}
.star { color: #c99a06; }
.empty p { margin: 0 0 6px; }
.msg-actions { margin: 4px 0 14px; }
.msg-actions form { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.msg-subject { overflow-wrap: anywhere; }
.msg-body { display: block; width: 100%; height: 70vh; min-height: 360px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; margin-bottom: 16px; }
.pager .btn[aria-current] { background: var(--primary); color: var(--on-primary); }

.compose textarea { font-family: inherit; min-height: 260px; }
.addr-wrap { position: relative; display: block; }
.addr-suggest { position: absolute; z-index: 6; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s);
  box-shadow: 0 8px 24px rgb(0 0 0 / .15); list-style: none; margin: 0; padding: 4px; max-height: 260px; overflow-y: auto; font-weight: 400; }
.addr-suggest li { padding: 8px 10px; border-radius: 7px; cursor: pointer; }
.addr-suggest li[aria-selected="true"], .addr-suggest li:hover { background: var(--surface-2); }
.addr-suggest small { color: var(--ink-3); }
fieldset.keep { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 8px 12px; display: grid; gap: 6px; }
.contacts .actions { flex-wrap: nowrap; }
@media (max-width: 600px) { .contacts .actions { flex-wrap: wrap; } }

/* ---------- server room ---------- */
.subtabs { display: flex; gap: 4px; margin: 0 0 16px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.subtabs a { padding: 8px 14px; color: var(--ink-2); text-decoration: none; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; font-weight: 600; }
.subtabs a[aria-current] { color: var(--ink); border-bottom-color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.chips a { padding: 5px 12px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); text-decoration: none; font-size: .88rem; font-weight: 600; }
.chips a[aria-current] { background: var(--primary); color: var(--on-primary); }
.logbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 6px; }
.logbar input[type=search] { flex: 1 1 220px; width: auto; }
.logbar select { width: auto; }
.logbar .check { margin: 0; }
.log { font-family: ui-monospace, "JetBrains Mono", Consolas, monospace; font-size: .78rem; line-height: 1.5; background: var(--surface-2); border-radius: 10px; padding: 10px 12px; margin: 8px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 320px; overflow: auto; }
.log-big { max-height: 70vh; }
.log span { display: block; padding: 1px 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 50%, transparent); }
.log .l-bad { color: var(--bad); }
.log .l-warn { color: var(--warn); }
.cert { padding: 8px 0 10px; border-bottom: 1px solid var(--line); }
.cert:last-of-type { border-bottom: 0; }
.cert-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.cert p { margin: 3px 0 0; overflow-wrap: anywhere; }
.repo { border-top: 1px solid var(--line); padding: 10px 0; }
.repo summary { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; cursor: pointer; list-style: none; }
.repo summary::-webkit-details-marker { display: none; }
.repo summary > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.lines { list-style: none; margin: 6px 0 0; padding: 0; }
.lines li { padding: 5px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.lines li:last-child { border-bottom: 0; }
.mono { font-family: ui-monospace, "JetBrains Mono", Consolas, monospace; }
ul.mono { padding-left: 1.2em; overflow-wrap: anywhere; }
.cols { columns: 2 220px; padding-left: 1.2em; }
.t-right { text-align: right; }
details > summary.small { cursor: pointer; margin-top: 10px; color: var(--ink-2); }
@media (max-width: 600px) { .table td.t-right { text-align: left; padding-top: 6px; } }
.phone-only { display: none; } @media (max-width: 600px) { .phone-only { display: inline; color: var(--ink-3); } }

/* ---------- website editor ---------- */
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-head .page-title { margin-bottom: 0; }
.flash-info { background: var(--surface-2); border-color: var(--line); color: var(--ink); }
.row-icon { display: flex; align-items: center; gap: 12px; min-width: 0; }
.row-icon img { width: 40px; height: 40px; border-radius: 10px; background: #0e2733; padding: 4px; flex: none; }
.editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.editor > .card { margin-bottom: 0; }
.editor-tabs { display: none; }
.preview-pane { position: sticky; top: 16px; height: calc(100vh - 32px); display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface); }
.preview-head { display: flex; gap: 10px; align-items: baseline; padding: 10px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.preview-head a { margin-left: auto; }
.preview-pane iframe { flex: 1; width: 100%; border: 0; background: #f6f2e4; }
@media (max-width: 1250px) {
  .editor { grid-template-columns: minmax(0, 1fr); }
  .editor-tabs { display: flex; gap: 4px; margin: -4px 0 14px; background: var(--surface-2); padding: 4px; border-radius: 10px; }
  .editor-tabs button { flex: 1; border: 0; background: none; padding: 8px; border-radius: 7px; font: inherit; font-weight: 700; color: var(--ink-2); cursor: pointer; }
  .editor-tabs button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgb(0 0 0 / .12); }
  .preview-pane { display: none; position: fixed; inset: 0; z-index: 40; height: auto; border-radius: 0; border: 0; }
  .editor[data-view="preview"] .preview-pane { display: flex; }
}
@media (max-width: 1250px) { .editor[data-view="preview"] .preview-head { padding-top: calc(10px + env(safe-area-inset-top)); } }
.md-field { display: grid; gap: 4px; margin-bottom: 14px; }
.md-tools { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--line); border-bottom: 0; border-radius: 10px 10px 0 0; }
.md-tools button { border: 0; background: none; color: var(--ink); font: inherit; font-size: .88rem; padding: 6px 9px; border-radius: 6px; cursor: pointer; min-height: 32px; }
.md-tools button:hover { background: var(--surface); }
.md-text { border-radius: 0 0 10px 10px !important; font-family: ui-monospace, "JetBrains Mono", Consolas, monospace; font-size: .9rem; line-height: 1.55; min-height: 140px; resize: vertical; }
.prefix-input { display: flex; align-items: stretch; }
.prefix-input span { display: flex; align-items: center; padding: 0 10px; background: var(--surface-2); border: 1px solid var(--line); border-right: 0; border-radius: 10px 0 0 10px; color: var(--ink-2); font-size: .9rem; white-space: nowrap; }
.prefix-input input { border-radius: 0 10px 10px 0; min-width: 0; }
.more summary { cursor: pointer; font-weight: 700; margin: 6px 0 10px; }
.sticky-actions { position: sticky; bottom: 0; background: var(--surface); padding: 12px 0 4px; margin-top: 10px; border-top: 1px solid var(--line); align-items: center; z-index: 2; }
@media (max-width: 860px) { .sticky-actions { bottom: calc(64px + env(safe-area-inset-bottom)); } }
.form h2 { margin-top: 22px; }
.form h2:first-of-type { margin-top: 0; }
.icon-field { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; }
.icon-field img { width: 64px; height: 64px; border-radius: 14px; background: #0e2733; padding: 6px; flex: none; }
.icon-field label { flex: 1; }
.narrow-field { max-width: 170px; }
.grow { flex: 1; }
.rows-edit { display: grid; gap: 8px; margin-bottom: 10px; }
.row-edit { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.row-edit label { margin: 0; }
.row-edit .row-edit-main { flex: 1 1 100%; overflow-wrap: anywhere; }
.row-stack { flex-direction: column; align-items: stretch; }
.row-stack .row-buttons { align-self: flex-end; }
.row-buttons { display: flex; gap: 4px; margin-left: auto; }
.row-buttons .btn-small { min-width: 36px; }
.row-thumb { width: 96px; height: 60px; object-fit: cover; object-position: top left; border-radius: 6px; border: 1px solid var(--line); }
.upload-box { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; padding: 12px; border: 2px dashed var(--line); border-radius: 12px; margin-bottom: 12px; }
.upload-box label { flex: 1 1 260px; margin: 0; }
.fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; margin: 0 0 14px; }
.fieldset legend { font-weight: 700; padding: 0 6px; }
.picker { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); width: min(720px, 94vw); padding: 16px; }
.picker::backdrop { background: rgb(0 0 0 / .45); }
.picker-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; max-height: 60vh; overflow: auto; }
.picker-item { border: 2px solid transparent; border-radius: 10px; padding: 0; background: var(--surface-2); cursor: pointer; aspect-ratio: 4 / 3; overflow: hidden; }
.picker-item:hover, .picker-item:focus-visible { border-color: var(--accent); }
.picker-item img { width: 100%; height: 100%; object-fit: cover; }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.file-card { margin: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.file-card img, .file-icon { display: block; width: 100%; height: 140px; object-fit: cover; }
.file-icon { display: grid; place-items: center; font-weight: 800; font-size: 1.4rem; color: var(--ink-2); text-decoration: none; }
.file-card figcaption { padding: 10px; overflow-wrap: anywhere; }
.file-card .actions { margin-top: 8px; }
.diff .l-add { color: var(--ok); background: color-mix(in srgb, var(--ok) 10%, transparent); }
.diff .l-del { color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, transparent); }
.diff .l-hunk { color: var(--ink-3); }
.topbar-account { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: var(--on-brand); }
.topbar-account svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.topbar-account[aria-current] { background: rgb(255 255 255 / .12); }
.editor .form { grid-template-columns: minmax(0, 1fr); } .editor .form .row > *, .row-edit > * { min-width: 0; } .row-edit input[type=date] { max-width: 100%; }
.icon-field label { min-width: 0; } .form input[type=file] { max-width: 100%; min-width: 0; }
.preview-back { display: none; }
@media (max-width: 1250px) { .preview-back { display: inline-flex; } }

/* Unread mail count on the Inbox menu item */
.nav-badge { margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 99px; background: var(--accent); color: var(--on-primary, #fff); font-size: .75rem; font-weight: 800; line-height: 22px; text-align: center; }
.nav-badge[hidden] { display: none; }
.tabbar a { position: relative; }
.tabbar .nav-badge { position: absolute; top: 2px; left: calc(50% + 6px); margin: 0; min-width: 18px; height: 18px; line-height: 18px; padding: 0 5px; font-size: .68rem; box-shadow: 0 0 0 2px var(--surface); }
.checks-inline { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 4px 18px; }
.checks-inline legend { margin-bottom: 4px; color: var(--ink-2); }

/* Loading feedback */
.loadbar { position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 100; background: var(--accent); box-shadow: 0 0 8px var(--accent); pointer-events: none; }
.loadbar.go { animation: loadbar 8s cubic-bezier(.1, .7, .2, 1) forwards; }
@keyframes loadbar { 0% { width: 0; } 10% { width: 35%; } 40% { width: 70%; } 100% { width: 92%; } }
.loadbar[hidden], .loadnote[hidden] { display: none; }
.loadnote { position: fixed; z-index: 100; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--primary); color: var(--on-primary); padding: 10px 18px; border-radius: 99px; font-weight: 700; box-shadow: 0 8px 24px rgb(0 0 0 / .25); display: flex; align-items: center; gap: 10px; }
.loadnote::before, .is-loading::after { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; flex: none; }
.is-loading::after { margin-left: auto; opacity: .7; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (min-width: 861px) { .loadnote { bottom: 28px; } }
@media (prefers-reduced-motion: reduce) { .loadbar.go { animation: none; width: 70%; } .loadnote::before, .is-loading::after { animation-duration: 2s; } }
.tabbar a.is-loading::after { position: absolute; top: 4px; left: calc(50% + 10px); margin: 0; width: 12px; height: 12px; }
.checked { margin: -6px 0 12px; }

/* Lab telemetry line at the bottom of every page */
.telemetry { margin: 18px 0 0; font: 400 .74rem/1.5 ui-monospace, "JetBrains Mono", Consolas, monospace; color: var(--ink-3); opacity: .8; }
.telemetry b { color: var(--ink-2); }

/* Traffic reports (GoAccess / Webalizer) shown in a frame */
.report-frame { display: block; width: 100%; height: calc(100vh - 260px); min-height: 520px; border: 1px solid var(--line); border-radius: 10px; background: #fff; margin-top: 10px; }
@media (max-width: 720px) { .report-frame { height: calc(100vh - 230px); min-height: 420px; } }
