/* secure-dl — no external fonts, images or CDNs so a strict CSP holds. */
:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --border: #dfe4ea;
  --border-strong: #c8d0da;
  --text: #16191d;
  --muted: #64707d;
  --accent: #0b5fff;
  --accent-text: #ffffff;
  --ok-bg: #e6f6ec; --ok-fg: #1a7f43;
  --warn-bg: #fff5e0; --warn-fg: #96620a;
  --err-bg: #fdeaea; --err-fg: #b3261e;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216;
    --surface: #171b21;
    --border: #262c34;
    --border-strong: #333b45;
    --text: #e8ecf1;
    --muted: #96a1ae;
    --accent: #4c8dff;
    --accent-text: #06101f;
    --ok-bg: #10281a; --ok-fg: #58d68d;
    --warn-bg: #2b2210; --warn-fg: #e5b25d;
    --err-bg: #2b1414; --err-fg: #f2857c;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.mono, code, input.mono {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", monospace;
  font-size: .92em;
}
code { background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: .05em .35em; }

/* --- chrome ------------------------------------------------------------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar-inner, main, .foot { width: 100%; max-width: 720px; margin: 0 auto; padding: 0 20px; }
.topbar-inner.wide, main.wide, .foot.wide { max-width: 1180px; }
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; min-height: 56px; flex-wrap: wrap;
}
.brand {
  display: inline-flex; align-items: center; gap: 9px;
  font-weight: 650; font-size: 15px; color: var(--text); text-decoration: none;
}
.lock {
  width: 14px; height: 16px; flex: none;
  border: 2px solid currentColor; border-radius: 3px;
  position: relative; margin-top: 4px;
}
.lock::before {
  content: ""; position: absolute; left: 2px; right: 2px; top: -7px; height: 8px;
  border: 2px solid currentColor; border-bottom: none; border-radius: 5px 5px 0 0;
}
.nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.nav-link {
  color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500;
  padding: 7px 11px; border-radius: 6px;
}
.nav-link:hover { color: var(--text); background: var(--bg); }
.nav-link.active { color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.who { color: var(--muted); font-size: 13px; margin-left: 8px; }
main { flex: 1; padding-top: 26px; padding-bottom: 40px; }
body.centered main { display: flex; align-items: center; justify-content: center; max-width: 460px; }
.foot { color: var(--muted); font-size: 12px; padding-bottom: 24px; }

/* --- containers --------------------------------------------------------- */
.card, .panel, .linkbox {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card { padding: 28px; width: 100%; }
.panel { padding: 20px 22px; margin-bottom: 20px; }
.panel-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 14px;
}
h1 { font-size: 21px; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 16px; margin: 0 0 4px; }
.sub { color: var(--muted); font-size: 14px; margin: 0 0 18px; }
.panel-head .sub { margin: 0; }
.crumb { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.crumb a { color: var(--accent); text-decoration: none; }
.crumb span { margin: 0 6px; }
.fine { color: var(--muted); font-size: 12.5px; line-height: 1.6; margin: 14px 0 0; }
.fine.warn { color: var(--warn-fg); }
.opt { color: var(--muted); font-weight: 400; }
.session-note { color: var(--muted); font-size: 12.5px; white-space: nowrap; }

/* --- forms -------------------------------------------------------------- */
label { display: block; font-size: 13px; font-weight: 600; margin: 0 0 6px; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=file], textarea, select {
  width: 100%; padding: 10px 12px; font-size: 15px; font-family: inherit;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: 6px;
  margin-bottom: 16px;
}
input:focus, textarea:focus, select:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent);
  outline-offset: 1px; border-color: var(--accent);
}
textarea { resize: vertical; }
.code-input {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 28px; letter-spacing: .35em; text-align: center; padding: 14px 12px;
}
.form-grid > div { margin-bottom: 4px; }
.row2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 0 18px; }
.checkline { display: flex; align-items: center; padding-top: 22px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; font-size: 14px; }
.check input { width: auto; margin: 0; }
.inline-form { display: inline-block; margin: 0 0 0 6px; }
.filterbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filterbar select, .filterbar input { margin: 0; width: auto; min-width: 150px; }

/* --- buttons ------------------------------------------------------------ */
.btn {
  display: inline-block; font: inherit; font-weight: 600; font-size: 14.5px;
  padding: 10px 18px; border-radius: 6px; border: 1px solid transparent;
  cursor: pointer; text-decoration: none; text-align: center;
}
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--bg); }
.btn-danger { background: var(--err-bg); color: var(--err-fg); border-color: color-mix(in srgb, var(--err-fg) 30%, transparent); }
.btn-link { background: none; color: var(--accent); padding: 6px 0; border: none; }
.btn-sm { font-size: 13px; padding: 6px 12px; }
.btn[disabled] { opacity: .55; cursor: default; }
form > .btn, form > button { margin-top: 4px; }

/* --- alerts ------------------------------------------------------------- */
.alert {
  padding: 11px 14px; border-radius: 6px; font-size: 14px;
  margin: 0 0 18px; border: 1px solid transparent; line-height: 1.5;
}
.alert-error { background: var(--err-bg); color: var(--err-fg); border-color: color-mix(in srgb, var(--err-fg) 25%, transparent); }
.alert-info { background: var(--bg); color: var(--text); border-color: var(--border-strong); }
.alert-success { background: var(--ok-bg); color: var(--ok-fg); border-color: color-mix(in srgb, var(--ok-fg) 25%, transparent); }

/* --- tables ------------------------------------------------------------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-size: 11.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted);
  padding: 0 12px 8px; border-bottom: 1px solid var(--border);
}
.table td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: none; }
.table-tight td, .table-tight th { padding: 7px 10px; font-size: 13px; }
.table th:first-child, .table td:first-child { padding-left: 0; }
.table th:last-child, .table td:last-child { padding-right: 0; }
.num, .right { text-align: right; }
.nowrap { white-space: nowrap; }
.empty { color: var(--muted); text-align: center; padding: 26px 0; }
.muted, .muted a { color: var(--muted); }
.row-warn { background: color-mix(in srgb, var(--warn-bg) 60%, transparent); }
.fname { font-weight: 600; word-break: break-all; }
.fmeta { color: var(--muted); font-size: 12.5px; margin-top: 2px; word-break: break-all; }
.strong { font-weight: 600; color: var(--text); text-decoration: none; }
.strong:hover { color: var(--accent); }
.detail { color: var(--muted); font-size: 12.5px; max-width: 320px; word-break: break-word; }
.scrollx { overflow-x: auto; }
.pager { display: flex; gap: 8px; margin-top: 14px; }

.tag {
  display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; padding: 2px 7px; border-radius: 4px; vertical-align: 2px;
}
.tag-ok { background: var(--ok-bg); color: var(--ok-fg); }
.tag-warn { background: var(--warn-bg); color: var(--warn-fg); }
.tag-off { background: var(--bg); color: var(--muted); border: 1px solid var(--border); }

/* --- stats -------------------------------------------------------------- */
.statrow { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow);
}
.stat-n { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.stat-l { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; margin-top: 2px; }

/* --- misc --------------------------------------------------------------- */
.filecard {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; padding: 12px 14px; margin: 0 0 18px;
}
.filecard-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.filecard-name { font-weight: 600; margin-top: 3px; word-break: break-all; }
.filecard-meta { color: var(--muted); font-size: 12.5px; }
.linkbox { padding: 16px 18px; margin-bottom: 20px; border-color: var(--accent); }
.linkbox-label { font-size: 13px; font-weight: 700; margin-bottom: 9px; }
.linkrow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.linkrow input { margin: 0; flex: 1 1 260px; }
.linkrow .btn { flex: none; }
