/* Update server page: products, releases, release detail, upload, stations, audit, administration. Light and dark. */
:root {
  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-2: #eef2f0;
  --fg: #16201d;
  --muted: #56635e;
  --line: #d6ddd9;
  --brand: #0b6e69;
  --brand-ink: #ffffff;
  --brand-soft: #dff0ed;
  --focus: #1b74d1;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --ok: #146c43;
  --ok-soft: #e3f4ea;
  --warn: #8a5300;
  --warn-soft: #fdf1d8;
  --shadow: 0 1px 2px rgb(16 24 20 / 6%), 0 4px 16px rgb(16 24 20 / 6%);
  --radius: 14px;
  --header-h: 60px;
  color-scheme: light;
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1413;
    --surface: #171e1c;
    --surface-2: #1f2825;
    --fg: #e6ecea;
    --muted: #a0aea9;
    --line: #2e3936;
    --brand: #3fb8ac;
    --brand-ink: #06201d;
    --brand-soft: #173431;
    --focus: #6aa8f0;
    --danger: #f08a80;
    --danger-soft: #3a1b18;
    --ok: #6fd39b;
    --ok-soft: #15301f;
    --warn: #f0c36d;
    --warn-soft: #3a2d12;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); color: var(--fg); font-size: 16px; line-height: 1.5; }
a { color: var(--brand); }
code, .mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 0.88em; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.4em; }
h1 { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem); letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: absolute; left: 12px; top: -48px; z-index: 20; padding: 8px 12px; background: var(--surface); border-radius: 8px; }
.skip-link:focus { top: 8px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.noscript { padding: 24px; }
.nowrap { white-space: nowrap; }

/* ---------------------------------------------------------------- header */
.site-header { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: saturate(1.4) blur(8px); border-bottom: 1px solid var(--line); }
.site-header__inner { max-width: 1180px; min-height: var(--header-h); margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; flex: none; }
.brand__mark { width: 34px; height: 34px; border-radius: 9px; background: var(--brand) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M16 8v12M10 14l6-6 6 6M9 24h14' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 28px no-repeat; }
.brand__text { display: flex; flex-direction: column; line-height: 1.1; }
.brand__title { font-weight: 700; font-size: 1.05rem; }
.brand__subtitle { color: var(--muted); font-size: 0.8rem; }
.header-nav { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.header-tools { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.user-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; color: var(--muted); font-size: 0.9rem; max-width: 220px; }
.user-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------- buttons */
.button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 7px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--fg); font: inherit; font-size: 0.92rem; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; }
.button:hover { background: var(--surface-2); }
.button:disabled { opacity: 0.6; cursor: progress; }
.button--primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.button--primary:hover { background: color-mix(in srgb, var(--brand) 88%, black); }
.button--danger { color: var(--danger); }
.button--danger:hover { background: var(--danger-soft); }
.button--ghost { background: transparent; border-color: transparent; }
.button--ghost:hover { background: var(--surface-2); }
.button--ghost[aria-current="page"] { background: var(--brand-soft); color: var(--brand); }
.button--small { min-height: 30px; padding: 3px 10px; font-size: 0.85rem; }

/* ---------------------------------------------------------------- page */
main { flex: 1; display: flex; flex-direction: column; }
main:focus { outline: none; }
.page { width: 100%; max-width: 1180px; margin: 0 auto; padding: 28px 16px 56px; }
.page--narrow { max-width: 720px; }
.site-footer { padding: 20px 16px 28px; text-align: center; color: var(--muted); font-size: 0.85rem; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { margin: 0; }
.crumbs { margin: 0 0 6px; font-size: 0.88rem; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.empty { padding: 32px; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); text-align: center; }
.message { padding: 32px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.message p { color: var(--muted); }
.alert { margin: 0 0 16px; padding: 10px 14px; border-radius: 10px; background: var(--surface-2); }
.alert--error { background: var(--danger-soft); color: var(--danger); }
.alert--ok { background: var(--ok-soft); color: var(--ok); }
.alert--warn { background: var(--warn-soft); color: var(--warn); }

.card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 18px; }
.card > h2 { margin-bottom: 12px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 16px; }
.cards .card { margin-bottom: 0; }
.product { display: flex; flex-direction: column; gap: 10px; color: inherit; text-decoration: none; }
.product:hover { border-color: var(--brand); }
.product__name { font-size: 1.25rem; font-weight: 700; }
.stats { display: flex; gap: 18px; flex-wrap: wrap; }
.stat { display: flex; flex-direction: column; }
.stat b { font-size: 1.15rem; }
.stat span { color: var(--muted); font-size: 0.8rem; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 0.78rem; font-weight: 600; 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(--danger-soft); color: var(--danger); }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th, .table td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table th { color: var(--muted); font-weight: 600; font-size: 0.82rem; white-space: nowrap; }
.table tbody tr:hover { background: var(--surface-2); }
.table a { font-weight: 600; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.filters .input { width: auto; min-width: 160px; }

/* ---------------------------------------------------------------- release detail */
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px 24px; margin: 0; }
.facts dt { color: var(--muted); font-size: 0.8rem; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.notes h1, .notes h2, .notes h3 { margin: 0.9em 0 0.3em; font-size: 1.05rem; }
.notes p { margin: 0.5em 0; }
.notes ul, .notes ol { margin: 0.4em 0; padding-left: 1.4em; }
.notes code { padding: 1px 5px; border-radius: 5px; background: var(--surface-2); }
.notes-empty { color: var(--muted); font-style: italic; }
.hash { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.hash code { overflow-wrap: anywhere; }
.history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.history li { padding: 8px 12px; border-left: 3px solid var(--line); background: var(--surface-2); border-radius: 0 8px 8px 0; font-size: 0.9rem; }
.history details { margin-top: 4px; }
.prewrap { margin: 6px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.history pre { margin: 6px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.8rem; }

/* ---------------------------------------------------------------- dialog and form */
.dialog { width: min(680px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--fg); box-shadow: 0 24px 64px rgb(0 0 0 / 30%); }
.dialog::backdrop { background: rgb(10 16 14 / 55%); }
.form { display: flex; flex-direction: column; max-height: calc(100dvh - 26px); }
.dialog__head { padding: 18px 24px 8px; }
.dialog__head h2 { margin: 0; font-size: 1.3rem; }
.dialog__body { padding: 8px 24px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.dialog__foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 24px; border-top: 1px solid var(--line); }
.field { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; border: 0; min-width: 0; }
.field label, .label { font-weight: 600; font-size: 0.92rem; }
.hint { margin: 0; color: var(--muted); font-size: 0.83rem; }
.input { width: 100%; min-height: 40px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--fg); font: inherit; }
textarea.input { resize: vertical; }
.input[readonly] { color: var(--muted); }
.form-page { display: flex; flex-direction: column; gap: 18px; }
progress { width: 100%; height: 14px; accent-color: var(--brand); }
.secret { padding: 12px 14px; border-radius: 10px; background: var(--surface-2); overflow-wrap: anywhere; user-select: all; }

@media (max-width: 640px) {
  .hide-narrow { display: none; }
  .brand__text { display: none; }
  .dialog__body, .dialog__head, .dialog__foot { padding-left: 16px; padding-right: 16px; }
}
