:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #e2e5ea;
  --text: #171a1f;
  --muted: #646b78;
  --accent: #4f6bed;
  --accent-ink: #ffffff;
  --accent-soft: #e8ecfd;
  --ok: #17885a;
  --ok-soft: #e1f4eb;
  --warn: #a86400;
  --warn-soft: #fbefd9;
  --bad: #c9333a;
  --bad-soft: #fbe5e6;
  --idle: #7b8290;
  --idle-soft: #eceef2;
  --log-bg: #12151a;
  --log-text: #d6dbe3;
  --shadow: 0 1px 2px rgb(16 24 40 / 6%), 0 1px 3px rgb(16 24 40 / 8%);
  --radius: 10px;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%23646b78' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #171a21;
    --surface-2: #1e222b;
    --border: #2a2f3a;
    --text: #e8eaef;
    --muted: #9aa1ae;
    --accent: #7189ff;
    --accent-ink: #0b0d12;
    --accent-soft: #232b4d;
    --ok: #4cc38a;
    --ok-soft: #173326;
    --warn: #e5a23a;
    --warn-soft: #3a2c14;
    --bad: #f0686e;
    --bad-soft: #3d1c1f;
    --idle: #8d94a1;
    --idle-soft: #252a33;
    --log-bg: #0a0c10;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%);
    --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%239aa1ae' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, .mono { font-family: var(--mono); font-size: 12.5px; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 22px; font-weight: 650; }
h2 { font-size: 16px; font-weight: 620; }
h3 { font-size: 14px; font-weight: 620; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

/* ---- Top bar ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 24px; height: 56px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 680; font-size: 16px; }
.brand:hover { text-decoration: none; }
.brand svg { width: 26px; height: 26px; }
.brand svg rect { fill: var(--accent); }
.brand svg path { stroke: var(--accent-ink); stroke-width: 3; fill: none; stroke-linejoin: round; stroke-linecap: round; }
#nav { display: flex; align-items: center; gap: 4px; }
#nav a, #nav .link { color: var(--muted); padding: 6px 12px; border-radius: 8px; font-weight: 520; }
#nav a:hover, #nav .link:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
#nav a.active { color: var(--text); background: var(--surface-2); }

main { width: 100%; max-width: 1120px; margin: 0 auto; padding: 28px 24px 48px; flex: 1; }
footer { text-align: center; color: var(--muted); font-size: 12px; padding: 16px; }

/* ---- Building blocks ---- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-body { padding: 20px; }
.card + .card, .section + .section { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .sub { margin-top: 4px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 12px; }

button, .btn {
  font: inherit; font-weight: 560; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  padding: 7px 14px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); white-space: nowrap;
}
button:hover:not(:disabled), .btn:hover { background: var(--surface-2); text-decoration: none; }
button:disabled { opacity: .5; cursor: default; }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.primary:hover:not(:disabled), .btn.primary:hover { background: var(--accent); filter: brightness(1.08); }
button.danger { color: var(--bad); }
button.danger:hover:not(:disabled) { background: var(--bad-soft); }
button.danger.solid { background: var(--bad); border-color: var(--bad); color: #fff; }
button.small { padding: 4px 10px; font-size: 12.5px; }
button.link { border: 0; background: none; padding: 0; color: var(--accent); }

label.field { display: block; }
label.field > span { display: block; font-weight: 560; margin-bottom: 6px; }
label.field > small { display: block; color: var(--muted); margin-top: 5px; font-size: 12.5px; }
input[type=text], input[type=password], input[type=number], textarea, select {
  font: inherit; width: 100%; padding: 8px 11px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
textarea { resize: vertical; min-height: 76px; font-family: var(--mono); font-size: 12.5px; }
input:focus, textarea:focus, select:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid { display: grid; gap: 18px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }

/* ---- Status pills ---- */
.pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
  padding: 2px 9px; border-radius: 999px; background: var(--idle-soft); color: var(--idle);
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.plain::before { display: none; }
.badge { font-size: 11px; font-weight: 650; padding: 1px 7px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); }

/* ---- Service list ---- */
.services { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.svc-card { display: block; color: inherit; padding: 18px 20px; transition: border-color .12s; }
.svc-card:hover { text-decoration: none; border-color: var(--accent); }
.svc-card .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.svc-card .slug { color: var(--muted); font-family: var(--mono); font-size: 12px; }
.svc-card .desc { color: var(--muted); margin-top: 8px; min-height: 21px; }
.svc-card .meta { display: flex; gap: 16px; margin-top: 14px; color: var(--muted); font-size: 12.5px; flex-wrap: wrap; }
.svc-card .meta b { color: var(--text); font-weight: 560; }
.svc-card .top > div:first-child { min-width: 0; }
.svc-card h2, .svc-card .slug, .svc-card .meta .host { overflow-wrap: anywhere; }
.empty { text-align: center; padding: 56px 24px; }
.empty h2 { margin-bottom: 6px; }
.empty p { margin-bottom: 18px; }

/* ---- Detail ---- */
.stats.three { grid-template-columns: repeat(3, 1fr); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--muted); font-weight: 560; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--text); border-bottom-color: var(--accent); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--border); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.stat { background: var(--surface); padding: 14px 16px; }
.stat .k { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.stat .v { font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
.alert { padding: 12px 14px; border-radius: 8px; background: var(--bad-soft); color: var(--bad); }
.alert.info { background: var(--accent-soft); color: var(--text); }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
pre.code {
  margin: 0; padding: 14px 16px; border-radius: 8px; background: var(--surface-2);
  border: 1px solid var(--border); overflow-x: auto; white-space: pre;
}
.copyable { position: relative; }
.copyable button { position: absolute; top: 8px; right: 8px; }
.copyable pre, .copyable textarea { padding-right: 84px; }
button.copied { color: var(--ok); border-color: var(--ok); }

/* ---- Releases ---- */
.dropzone { display: block;
  border: 2px dashed var(--border); border-radius: var(--radius); padding: 28px 20px; text-align: center;
  cursor: pointer; transition: border-color .12s, background .12s; background: var(--surface);
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.dropzone.disabled { opacity: .55; pointer-events: none; }
.up-ready { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.up-file { min-width: 0; overflow-wrap: anywhere; }
.dropzone strong { display: block; font-size: 15px; margin-bottom: 4px; }
.progress { height: 6px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); width: 0; transition: width .1s; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
td.actions { text-align: right; white-space: nowrap; }
.table-wrap { overflow-x: auto; }

/* ---- Logs ---- */
.logs {
  background: var(--log-bg); color: var(--log-text); border-radius: var(--radius); padding: 12px 0;
  height: min(520px, 65vh); overflow: auto; font-family: var(--mono); font-size: 12px; line-height: 1.55;
}
.logs:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.logs .line.err { box-shadow: inset 2px 0 0 #ff9ca1; }
.logs-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.logs-tools input[type=search] { width: auto; flex: 1 1 180px; max-width: 280px; }
.logs-wrap { position: relative; }
.logs-wrap .jump { position: absolute; right: 16px; bottom: 14px; box-shadow: var(--shadow); }
.logs .line { padding: 0 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.logs .line .t { color: #6b7380; margin-right: 10px; user-select: none; }
.logs .line.err { color: #ff9ca1; }
.logs .line.mainport { color: #9fb2ff; }
.logs .none { color: #6b7380; padding: 0 16px; }

/* ---- Auth ---- */
.auth { max-width: 400px; margin: 8vh auto 0; }
.auth .card-body { padding: 28px; }
.auth h1 { margin-bottom: 6px; }
.auth p { margin-bottom: 20px; }

/* ---- Toasts & modal ---- */
#toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--text); color: var(--bg); padding: 10px 8px 10px 14px; border-radius: 8px; box-shadow: var(--shadow);
  max-width: 420px; animation: pop .15s ease-out; overflow-wrap: anywhere;
}
.toast-text { flex: 1; min-width: 0; padding-top: 1px; }
.toast-x { flex: none; border: 0; background: none; color: inherit; opacity: .7; padding: 0 6px; font-size: 18px; line-height: 1.2; }
.toast-x:hover:not(:disabled) { background: none; opacity: 1; }
.toast.bad { background: var(--bad); color: #fff; }
@keyframes pop { from { transform: translateY(6px); opacity: 0; } }
dialog {
  border: 1px solid var(--border); border-radius: 12px; padding: 0; background: var(--surface); color: var(--text);
  width: min(560px, calc(100vw - 32px)); box-shadow: 0 20px 50px rgb(0 0 0 / 25%);
  max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain;
}
dialog[open] { animation: dialog-in .14s ease-out; }
dialog[open]::backdrop { animation: backdrop-in .14s ease-out; }
@keyframes dialog-in { from { transform: translateY(8px) scale(.985); opacity: 0; } }
@keyframes backdrop-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { dialog[open], dialog[open]::backdrop { animation: none; } }
dialog::backdrop { background: rgb(10 12 16 / 45%); }
dialog .card-body > * + * { margin-top: 14px; }
dialog .row.end { justify-content: flex-end; }

@media (max-width: 640px) {
  .topbar { padding: 0 16px; }
  main { padding: 20px 16px 40px; }
  .grid-2 { grid-template-columns: 1fr; }
  .services { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stats.three { grid-template-columns: 1fr; }
  #nav a, #nav .link { padding: 6px 8px; }

  /* Cards and headers: a little less padding, and the header's button goes under its text. */
  .card-body { padding: 16px; }
  .card-head { padding: 14px 16px; flex-wrap: wrap; }
  .card-head > div { flex: 1 1 100%; }

  /* Tables become one card per row: the first cell is the title, the rest are labelled lines
     (labels from the header, see labelTables in app.js), and the actions sit underneath. */
  .table-wrap { overflow: visible; }
  .card table, .card tbody, .card tr, .card td { display: block; width: 100%; }
  .card thead { display: none; }
  .card tr { padding: 12px 16px; border-bottom: 1px solid var(--border); }
  .card tbody tr:last-child { border-bottom: 0; }
  .card td, .card tr:last-child td { border: 0; padding: 3px 0; overflow-wrap: anywhere; }
  .card td:first-child { padding-bottom: 6px; }
  .card td[data-label]:not(:first-child) { position: relative; padding-left: 104px; min-height: 22px; }
  .card td[data-label]:not(:first-child)::before {
    content: attr(data-label); position: absolute; left: 0; top: 4px; width: 96px;
    font-size: 12px; font-weight: 600; color: var(--muted);
  }
  .card td:empty { display: none; }
  .card td.actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 10px; text-align: left; white-space: normal; }
  .card td.actions:not(:has(*)) { display: none; }
  .card tr.sec-bad td:first-child { box-shadow: none; }
  .card tr.sec-bad { box-shadow: inset 3px 0 0 var(--bad); }

  .pending-requests { padding: 12px 16px; }
  .pending-request > span:nth-child(2) { min-width: 0; flex-basis: 100%; order: -1; }
}

/* ---- Changelog ---- */
.changelog { display: flex; flex-direction: column; gap: 12px; }
.cl-entry { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px; box-shadow: var(--shadow); }
.card-body .cl-entry { box-shadow: none; }
.cl-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cl-title h3 { display: flex; align-items: center; gap: 8px; }
.cl-version { font-family: var(--mono); font-weight: 650; font-size: 13px; padding: 3px 9px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); }
.cl-version.plain { background: var(--idle-soft); color: var(--muted); }
.cl-meta { margin-top: 10px; }
.md { margin-top: 10px; line-height: 1.6; }
.md > * + * { margin-top: 8px; }
.md ul, .md ol { margin: 0; padding-left: 22px; }
.md h3, .md h4, .md h5, .md h6 { font-size: 14px; margin-top: 14px; }
.md code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.md pre.code code { background: none; padding: 0; }

/* ---- Mobile: hamburger + slide-out navigation from the left ---- */
.menu-btn { display: none; border: 0; background: none; padding: 8px; margin-left: -8px; color: var(--text); }
.menu-btn:hover:not(:disabled) { background: var(--surface-2); }
.menu-btn svg { width: 22px; height: 22px; display: block; stroke: currentColor; stroke-width: 2; stroke-linecap: round; fill: none; }
.nav-scrim, .nav-head { display: none; }

@media (max-width: 760px) {
  .topbar { justify-content: flex-start; gap: 8px; }
  .menu-btn { display: inline-flex; }
  #nav {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 30;
    width: min(280px, 82vw); padding: 14px 12px 24px; overflow-y: auto;
    flex-direction: column; align-items: stretch; gap: 2px;
    background: var(--surface); border-right: 1px solid var(--border); box-shadow: 0 10px 40px rgb(0 0 0 / 35%);
    transform: translateX(-100%); visibility: hidden; transition: transform .2s ease, visibility 0s linear .2s;
  }
  body.nav-open #nav { transform: none; visibility: visible; transition: transform .2s ease; }
  .nav-head { display: block; font-weight: 680; font-size: 16px; padding: 8px 14px 14px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
  #nav a, #nav .link { padding: 12px 14px; font-size: 15px; justify-content: flex-start; text-align: left; border-radius: 8px; }
  #nav .link { margin-top: 8px; color: var(--muted); }
  .nav-scrim {
    display: block; position: fixed; inset: 0; z-index: 25;
    background: rgb(5 7 10 / 55%); opacity: 0; pointer-events: none; transition: opacity .2s ease;
  }
  body.nav-open .nav-scrim { opacity: 1; pointer-events: auto; }
  body.nav-open { overflow: hidden; }
}
@media (prefers-reduced-motion: reduce) { #nav, .nav-scrim { transition: none !important; } }

/* ---- Sign-in with passkey ---- */
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* Phones: card headers stack their button under the text instead of squeezing it */
@media (max-width: 640px) {
  .card-head { flex-direction: column; align-items: flex-start; }
  .page-head { align-items: flex-start; }
}

/* Dropdowns: same look as the other inputs, with a quiet chevron instead of the native arrow */
select {
  -webkit-appearance: none; appearance: none; cursor: pointer;
  padding: 7px 34px 7px 12px; font-size: 13.5px; font-weight: 520; line-height: 1.5;
  background-image: var(--select-arrow); background-repeat: no-repeat;
  background-position: right 11px center; background-size: 12px 12px;
}
select:hover { border-color: var(--muted); }

/* ---- Assistant approval + permission tree ---- */
.approve-code { font-size: 26px; font-weight: 700; letter-spacing: .06em; padding: 14px 18px; border-radius: 10px;
  background: var(--accent-soft); color: var(--accent); text-align: center; }
/* ---- Permission picker ---- */
.pt-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.pt-search { flex: 1 1 200px; min-width: 0; }
.pt-presets { display: flex; gap: 6px; flex-wrap: wrap; }
.pt-list { border: 1px solid var(--border); border-radius: 10px; padding: 4px; max-height: min(460px, 60vh); overflow-y: auto; overscroll-behavior: contain; }
.pt-row { padding: 8px 8px 8px calc(4px + var(--depth, 0) * 26px); border-radius: 7px; }
.pt-row + .pt-row { box-shadow: 0 -1px 0 var(--border); }
.pt-line { display: flex; align-items: center; gap: 4px; min-width: 0; }
.pt-line .check { min-width: 0; }
.pt-line .check > span { min-width: 0; overflow-wrap: anywhere; }
.pt-summary { margin-left: auto; padding-left: 12px; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 50%; }
.pt-fold, .pt-fold-gap { flex: none; width: 24px; height: 24px; }
.pt-fold { display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 0; border-radius: 6px; background: none; color: var(--muted); }
.pt-fold:hover:not(:disabled) { background: var(--border); color: var(--text); }
.pt-fold:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.pt-fold svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s ease; }
.pt-fold[aria-expanded="true"] svg { transform: rotate(90deg); }
.pt-hint { margin: 2px 0 0 52px; }
.pt-covered .check, .pt-covered .check input { cursor: default; }
.pt-covered .check > span { color: var(--muted); }
.pt-group, .pt-leaf { cursor: pointer; }
.pt-group:hover, .pt-leaf:hover { background: var(--surface-2); }
.pt-leaf.pt-covered { cursor: default; }
.pt-leaf.pt-covered:hover { background: none; }
.pt-empty { padding: 12px; }
@media (prefers-reduced-motion: reduce) { .pt-fold svg { transition: none; } }
input[type=search] { font: inherit; padding: 7px 11px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
tr.sec-bad td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
details summary { cursor: pointer; }

/* ---- Pending assistant requests: nav badge, menu dot, Access list ---- */
.nav-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px;
  border-radius: 9px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700; line-height: 1; }
#nav a { display: inline-flex; align-items: center; }
.menu-btn { position: relative; }
.menu-btn.has-badge::after { content: ""; position: absolute; top: 6px; right: 6px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 2px var(--surface); }
.btn.small { padding: 4px 10px; font-size: 12.5px; }
.pending-requests { padding: 14px 20px; border-bottom: 1px solid var(--border); background: var(--accent-soft); }
.pending-requests h3 { font-size: 13px; margin: 0 0 8px; }
.pending-request { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 12px; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.pending-request + .pending-request { margin-top: 8px; }
.pending-request:hover { text-decoration: none; border-color: var(--accent); }
.pending-request > span:nth-child(2) { flex: 1; min-width: 200px; }
.pending-request .btn { margin-left: auto; }
.approve-code-sm { font-weight: 700; letter-spacing: .04em; }


/* ---- QoL pass: shared bits ---- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
h1 { overflow-wrap: anywhere; }
h1:focus { outline: none; }
.head-main { min-width: 0; }
.back { margin-bottom: 10px; }
.form-error { color: var(--bad); background: var(--bad-soft); padding: 8px 12px; border-radius: 8px; margin: 0; }
.ok-text { color: var(--ok); font-weight: 600; }
.field-label { font-weight: 560; }
fieldset.plain { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.plain legend { float: left; margin-right: 8px; padding: 0; }
[aria-busy="true"] { cursor: progress; }
textarea.secret:not(:focus) { filter: blur(4px); }
dialog .row.end.dlg-actions { position: sticky; bottom: 0; background: var(--surface); padding: 12px 0 2px; margin-top: 14px; }

/* Write / Preview toggle in the changelog editor */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; background: none; color: var(--muted); }
.seg button.on { background: var(--surface-2); color: var(--text); }
.md-preview { min-height: 180px; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-top: 6px; }

/* Can't reach Mainport */
#offline { position: sticky; top: 0; z-index: 60; text-align: center; padding: 8px 16px; font-size: 13px; font-weight: 560; background: var(--warn-soft); color: var(--warn); border-bottom: 1px solid var(--border); }

/* Invite dialog: waiting for the assistant */
.invite-wait { display: flex; align-items: center; gap: 8px; }
.dot-pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: .25; transform: scale(.8); } 50% { opacity: 1; transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .dot-pulse { animation: none; } }

#nav.inert { opacity: .45; pointer-events: none; }

@media (max-width: 640px) {
  #toasts { left: 16px; right: 16px; bottom: 16px; }
  .toast { max-width: none; }
  .logs-tools input[type=search] { max-width: none; }
}

/* Bigger touch targets on touch screens */
@media (pointer: coarse) {
  button.small, .btn.small { min-height: 36px; padding: 6px 12px; }
  .pt-fold, .pt-fold-gap { width: 32px; height: 32px; }
  .pt-hint { margin-left: 60px; }
  .toast-x { min-width: 32px; min-height: 32px; }
}

/* Security checklist */
.checklist { list-style: none; margin: 0; padding: 4px 0; }
.check-item { display: flex; gap: 12px; align-items: flex-start; padding: 10px 20px; }
.check-item + .check-item { border-top: 1px solid var(--border); }
.check-icon { flex: none; width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; margin-top: 1px; background: var(--surface-2); color: var(--muted); }
.check-item.ok .check-icon { background: var(--ok-soft); color: var(--ok); }
.check-item.warn .check-icon { background: var(--warn-soft); color: var(--warn); }
.check-item.bad .check-icon { background: var(--bad-soft); color: var(--bad); }
@media (max-width: 640px) { .check-item { padding: 10px 16px; } }
