/* Steam Workshop Archive — private UI. Desktop-first, compact, dark/light. */
:root {
  --bg: #f5f6f8; --panel: #ffffff; --panel-2: #f0f2f5; --panel-3: #e8ebf0; --border: #e1e5eb; --border-strong: #cfd5de;
  --text: #171b21; --text-2: #39414d; --muted: #6a7482; --faint: #98a1ad;
  --accent: #3355d1; --accent-2: #2847b8; --accent-soft: rgba(51, 85, 209, .10); --on-accent: #fff;
  --ok: #1f8a4c; --ok-soft: rgba(31, 138, 76, .12); --warn: #a86b00; --warn-soft: rgba(196, 129, 0, .14);
  --bad: #c9302c; --bad-soft: rgba(201, 48, 44, .11); --info: #2563c9; --info-soft: rgba(37, 99, 201, .11);
  --muted-soft: rgba(106, 116, 130, .12);
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .04);
  --radius: 10px; --radius-sm: 7px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0d1014; --panel: #14181e; --panel-2: #1a1f26; --panel-3: #222832; --border: #242b35; --border-strong: #313a47;
  --text: #e7eaf0; --text-2: #c3c9d3; --muted: #8c96a5; --faint: #5f6977;
  --accent: #7d9bff; --accent-2: #98b0ff; --accent-soft: rgba(125, 155, 255, .13); --on-accent: #0d1014;
  --ok: #4cc77c; --ok-soft: rgba(76, 199, 124, .14); --warn: #e3a92c; --warn-soft: rgba(227, 169, 44, .15);
  --bad: #ff6b63; --bad-soft: rgba(255, 107, 99, .14); --info: #6aa6ff; --info-soft: rgba(106, 166, 255, .14);
  --muted-soft: rgba(140, 150, 165, .14);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.5 var(--font); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 22px; line-height: 1.25; }
h2 { font-size: 15px; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
p { margin: 0 0 .6em; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
.ic { flex: none; vertical-align: -4px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.break { word-break: break-all; }
.hidden { display: none !important; }

/* Layout */
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; padding: 18px 12px;
  background: var(--panel); border-right: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: var(--text); font-weight: 700; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; color: var(--text); }
.brand .mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: var(--on-accent); }
.brand small { display: block; font-weight: 500; color: var(--muted); font-size: 11.5px; letter-spacing: 0; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius-sm); color: var(--text-2); font-weight: 500; }
.nav a:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.nav .sep { margin: 12px 10px 4px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); }
.nav .count { margin-left: auto; font-size: 11.5px; padding: 0 7px; border-radius: 99px; background: var(--panel-3); color: var(--muted); }
.side-foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.who { display: flex; align-items: center; gap: 10px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-3); font-weight: 700; color: var(--text-2); text-transform: uppercase; font-size: 12px; }
.who b { display: block; font-size: 13px; }
.who span { font-size: 11.5px; color: var(--muted); }
.side-actions { display: flex; gap: 6px; }
.side-actions form { margin: 0; flex: 1; }
.side-actions .btn { width: 100%; justify-content: center; }
.main { min-width: 0; padding: 26px 34px 60px; }
.content { max-width: 1440px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 4px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.crumbs { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.grid.halves { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
@media (max-width: 1100px) { .grid.two, .grid.halves { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .app { grid-template-columns: 1fr; } .sidebar { position: static; height: auto; } .main { padding: 18px; } }

/* Cards */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card-h { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--border); }
.card-h h2 { flex: 1; }
.card-b { padding: 16px; }
.card-b.tight { padding: 0; }
.card-f { padding: 10px 16px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12.5px; }
.kpi { padding: 14px 16px; }
.kpi .label { color: var(--muted); font-size: 12.5px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.kpi .value { font-size: 26px; font-weight: 680; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.kpi .hint { color: var(--muted); font-size: 12px; margin-top: 2px; }
.kpi.attn .value { color: var(--bad); }
.kpi.warn .value { color: var(--warn); }
.kpi a.value { color: inherit; display: block; }
.kpi a.value:hover { text-decoration: none; color: var(--accent); }
.storage-bar { display: flex; height: 10px; border-radius: 99px; overflow: hidden; background: var(--panel-3); margin: 10px 0 8px; }
.storage-bar span { display: block; height: 100%; }
.storage-bar .u { background: var(--accent); }
.storage-bar .s { background: var(--ok); opacity: .55; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; vertical-align: 0; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 7px 18px; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* Tables */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
.t th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--border); background: var(--panel-2); white-space: nowrap; }
.t td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr:hover td { background: var(--panel-2); }
.t .title-cell { display: flex; align-items: center; gap: 12px; min-width: 260px; }
.t .title-cell .t1 { font-weight: 560; color: var(--text); display: block; }
.t .title-cell .t2 { font-size: 12px; color: var(--muted); }
.t td.actions-cell { text-align: right; white-space: nowrap; }
.thumb { width: 64px; height: 36px; border-radius: 6px; object-fit: cover; background: var(--panel-3); flex: none; display: grid; place-items: center; color: var(--faint); }
.thumb.lg { width: 100%; height: auto; aspect-ratio: 16 / 9; border-radius: var(--radius); }
.empty { padding: 34px 16px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--text-2); margin-bottom: 4px; }

/* Pills */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 1px 9px; border-radius: 99px; font-size: 12px; font-weight: 560; white-space: nowrap; background: var(--muted-soft); color: var(--muted); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.pill.plain::before { display: none; }
.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.info { background: var(--info-soft); color: var(--info); }
.pill.running::before { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.tag { display: inline-block; padding: 1px 8px; border-radius: 6px; background: var(--panel-3); color: var(--text-2); font-size: 12px; margin: 0 4px 4px 0; }

/* Buttons & forms */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--panel); color: var(--text); font: inherit; font-weight: 560; cursor: pointer; line-height: 1.25; white-space: nowrap; }
.btn:hover { background: var(--panel-2); text-decoration: none; color: var(--text); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); color: var(--on-accent); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--panel-2); }
.btn.sm { padding: 4px 9px; font-size: 12.5px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
label { display: block; font-weight: 560; margin-bottom: 5px; font-size: 13px; }
.field { margin-bottom: 14px; }
.field .help { font-size: 12px; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%; padding: 7px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--panel); color: var(--text); font: inherit; }
textarea { min-height: 120px; resize: vertical; font-family: var(--mono); font-size: 13px; }
input::placeholder, textarea::placeholder { color: var(--faint); }
.check { display: flex; gap: 9px; align-items: flex-start; font-weight: 500; margin-bottom: 10px; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--accent); }
.check small { display: block; color: var(--muted); font-weight: 400; }
.radio-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.radio-cards label { border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 11px 13px; cursor: pointer; font-weight: 600; margin: 0; }
.radio-cards label small { display: block; font-weight: 400; color: var(--muted); margin-top: 2px; }
.radio-cards input { accent-color: var(--accent); margin-right: 6px; }
.radio-cards label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.filters input[type=search] { width: 280px; }
.filters select { width: auto; min-width: 130px; }
.inline-form { display: inline; margin: 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 14px; }

/* Messages */
.flash, .banner { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: var(--radius); margin-bottom: 16px; border: 1px solid transparent; }
.flash.ok { background: var(--ok-soft); color: var(--ok); }
.flash.info { background: var(--info-soft); color: var(--info); }
.flash.warn, .banner.warn { background: var(--warn-soft); color: var(--warn); }
.flash.bad, .banner.bad { background: var(--bad-soft); color: var(--bad); }
.banner a { color: inherit; font-weight: 600; text-decoration: underline; margin-left: auto; white-space: nowrap; }
.callout { padding: 12px 14px; border-radius: var(--radius); background: var(--panel-2); border: 1px solid var(--border); color: var(--text-2); }
.callout.warn { background: var(--warn-soft); border-color: transparent; }
.callout.bad { background: var(--bad-soft); border-color: transparent; }
.callout code { background: var(--panel-3); padding: 1px 5px; border-radius: 4px; }

/* Progress (native elements: the CSP forbids inline styles) */
progress.bar { -webkit-appearance: none; appearance: none; display: block; width: 100%; min-width: 90px; height: 6px; border: 0; border-radius: 99px; background: var(--panel-3); overflow: hidden; color: var(--accent); }
progress.bar::-webkit-progress-bar { background: var(--panel-3); border-radius: 99px; }
progress.bar::-webkit-progress-value { background: var(--accent); border-radius: 99px; transition: width .4s ease; }
progress.bar::-moz-progress-bar { background: var(--accent); border-radius: 99px; }
progress.bar:indeterminate { background: linear-gradient(90deg, var(--panel-3) 0%, var(--accent) 50%, var(--panel-3) 100%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
progress.bar:indeterminate::-webkit-progress-bar { background: transparent; }
progress.bar:indeterminate::-moz-progress-bar { background: transparent; }
progress.bar.ok::-webkit-progress-value { background: var(--ok); }
progress.bar.ok::-moz-progress-bar { background: var(--ok); }
progress.bar.lg { height: 10px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.progress-meta { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--muted); margin-top: 4px; }
.text-bad { color: var(--bad); }
.text-ok { color: var(--ok); }
.text-warn { color: var(--warn); }
.mt { margin-top: 14px; }
.mb { margin-bottom: 14px; }
.w-cell { min-width: 220px; }
.w-num { width: 110px !important; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 18px 1fr; gap: 10px; padding: 9px 16px; border-bottom: 1px solid var(--border); }
.timeline li:last-child { border-bottom: 0; }
.timeline .dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; background: var(--faint); box-shadow: 0 0 0 3px var(--panel-2); }
.timeline .dot.capture { background: var(--ok); }
.timeline .dot.rollback { background: var(--warn); }
.timeline .dot.availability { background: var(--bad); }
.timeline .dot.metadata, .timeline .dot.discovered { background: var(--info); }
.timeline .meta { font-size: 12px; color: var(--muted); }

/* Log */
.log { margin: 0; padding: 12px 16px; font-family: var(--mono); font-size: 12.5px; line-height: 1.6; max-height: 520px; overflow: auto; background: var(--panel-2); border-radius: 0 0 var(--radius) var(--radius); }
.log div { white-space: pre-wrap; word-break: break-word; }
.log .t { color: var(--faint); margin-right: 8px; }
.log .warn { color: var(--warn); }
.log .error { color: var(--bad); }
pre.json { margin: 0; padding: 12px 16px; font-family: var(--mono); font-size: 12.5px; overflow: auto; max-height: 360px; background: var(--panel-2); }

/* Description */
.desc { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-2); max-height: 420px; overflow: auto; font-size: 13.5px; }

/* Pager */
.pager { display: flex; gap: 6px; align-items: center; justify-content: flex-end; padding: 10px 16px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--muted); }
.pager .btn { padding: 3px 9px; }

/* Diff */
.diff-added { color: var(--ok); }
.diff-removed { color: var(--bad); }
.diff-modified { color: var(--warn); }
.diff-renamed { color: var(--info); }

/* Login */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; background:
  radial-gradient(1200px 500px at 20% -10%, var(--accent-soft), transparent 60%), var(--bg); }
.auth-card { width: 100%; max-width: 380px; }
.auth-card .card-b { padding: 26px; }
.auth-card .brand { padding: 0 0 20px; }
.secret { font-family: var(--mono); font-size: 16px; padding: 10px 12px; background: var(--panel-2); border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); user-select: all; }

.copy { cursor: pointer; }
.copy:hover { color: var(--accent); }
.dir-row a { display: inline-flex; gap: 8px; align-items: center; color: var(--text); font-weight: 520; }
.status-line { display: flex; align-items: center; gap: 8px; }
.dotted { border-bottom: 1px dotted var(--faint); cursor: help; }
