/* Theme of the admin shell. Local fonts only, no third-party request. Inter: SIL Open Font License 1.1 (fonts/OFL.txt). */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/inter-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/inter-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/inter-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/inter-latin-700-normal.woff2") format("woff2"); }

:root {
  --primary: #229FA5; --primary-600: #0d9488; --primary-700: #0f766e; --primary-50: #f0fdfa; --on-primary: #fff;
  --bg: #F8FAFC; --card: #FFFFFF; --raised: #F1F5F9; --border: #E2E8F0;
  --text: #111827; --muted: #64748B; --sidebar: #FFFFFF;
  --ok: #16A34A; --ok-bg: #DCFCE7; --warn: #B45309; --warn-bg: #FEF3C7; --bad: #B91C1C; --bad-bg: #FEE2E2;
  --off: #475569; --off-bg: #F1F5F9; --live: #3B82F6; --live-bg: #DBEAFE;
  --radius: 10px; --sidebar-w: 240px; --sidebar-c: 56px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #09090B; --card: #18181B; --raised: #27272A; --border: #3F3F46; --text: #F4F4F5; --muted: #A1A1AA;
    --sidebar: #18181B; --primary-50: #134e4a; --primary-700: #5eead4;
    --ok: #4ADE80; --ok-bg: #14532D; --warn: #FCD34D; --warn-bg: #78350F; --bad: #FCA5A5; --bad-bg: #7F1D1D;
    --off: #D4D4D8; --off-bg: #27272A; --live: #93C5FD; --live-bg: #1E3A8A;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--primary-700); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font: 12.5px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--raised); padding: 1px 5px; border-radius: 4px; }
code.wrap { word-break: break-all; }
h1 { font-size: 20px; margin: 0 0 6px; }
h2 { font-size: 15px; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
h3 { font-size: 14px; margin: 18px 0 8px; }
h4 { font-size: 13px; margin: 16px 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ic { width: 20px; height: 20px; flex: none; }
.ic-lg { width: 28px; height: 28px; color: var(--muted); }
.logo { width: 32px; height: 32px; flex: none; }

/* shell */
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); background: var(--sidebar); border-right: 1px solid var(--border); display: flex; flex-direction: column; z-index: 30; transition: width .15s; }
.brand { height: 60px; display: flex; align-items: center; padding: 0 12px; border-bottom: 1px solid var(--border); }
.brand-link { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand-link:hover { text-decoration: none; }
.wordmark { font-weight: 700; font-size: 16px; letter-spacing: -.01em; white-space: nowrap; }
.context { margin: 14px 12px 0; padding: 6px 10px; border-left: 3px solid var(--primary); background: var(--raised); border-radius: 6px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar nav { padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 8px; color: var(--muted); font-weight: 500; white-space: nowrap; }
.nav-item:hover { background: var(--raised); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--primary-50); color: var(--primary-700); }
.main { min-height: 100vh; }
.with-shell .main { margin-left: var(--sidebar-w); transition: margin .15s; }
.collapsed .sidebar { width: var(--sidebar-c); }
.collapsed .sidebar .label { display: none; }
.collapsed .brand { justify-content: center; padding: 0; }
.collapsed .nav-item { justify-content: center; padding: 8px 0; }
.collapsed.with-shell .main { margin-left: var(--sidebar-c); }
.backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, .35); z-index: 20; }

.topbar { height: 60px; display: flex; align-items: center; gap: 12px; padding: 0 20px; background: var(--card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.topbar-title { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.link-quiet { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 500; }
.who { display: flex; flex-direction: column; line-height: 1.2; text-align: right; }
.who-name { font-weight: 600; }
.who-role { font-size: 12px; color: var(--muted); }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 0; background: transparent; color: var(--muted); border-radius: 8px; cursor: pointer; }
.icon-btn:hover { background: var(--raised); color: var(--text); }
form.inline { display: inline; margin: 0; }
.role-switch { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.role-switch button { border: 0; background: transparent; padding: 6px 10px; font: inherit; font-size: 12px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.role-switch button + button { border-left: 1px solid var(--border); }
.role-switch button[aria-pressed="true"] { background: var(--raised); color: var(--text); font-weight: 600; cursor: default; }
.content { padding: 20px; max-width: 1200px; display: flex; flex-direction: column; gap: 16px; }

/* components */
.card-own { background: var(--raised); border-left: 3px solid var(--border); }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; }
.kv-wide { grid-template-columns: minmax(180px, max-content) 1fr; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat { display: flex; flex-direction: column; padding: 12px; border: 1px solid var(--border); border-radius: 8px; color: var(--muted); }
.stat:hover { border-color: var(--primary); text-decoration: none; }
.stat-sub { margin-top: 6px; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.stat-n { font-size: 26px; font-weight: 700; color: var(--text); }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.num { text-align: right; }
.chip { display: inline-block; padding: 1px 8px; margin: 0 4px 4px 0; border-radius: 999px; background: var(--raised); border: 1px solid var(--border); font-size: 12px; }
.pill { display: inline-block; white-space: nowrap; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill-ok { background: var(--ok-bg); color: var(--ok); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-bad { background: var(--bad-bg); color: var(--bad); }
.pill-off { background: var(--off-bg); color: var(--off); }
.src { display: inline-block; padding: 0 7px; border-radius: 4px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; border: 1px solid var(--border); }
.src-manifest { color: var(--primary-700); background: var(--primary-50); }
.src-live { color: var(--live); background: var(--live-bg); }
.src-console { color: var(--warn); background: var(--warn-bg); }
.empty { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px dashed var(--border); border-radius: 8px; color: var(--muted); }
.empty p { margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--border); background: var(--card); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-600); }
.btn-small { padding: 5px 12px; }
.btn-block { width: 100%; }
.crumbs { margin: 0; color: var(--muted); }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; color: var(--text); }
.choice.active { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.choice:hover { text-decoration: none; border-color: var(--primary); }
.list { margin: 0; padding-left: 18px; }
.alert { background: var(--bad-bg); color: var(--bad); padding: 9px 12px; border-radius: 8px; }
.alert-ok { background: var(--ok-bg); color: var(--ok); }

/* sign in */
.no-shell .content { margin: 0 auto; }
.login-wrap { max-width: 400px; width: 100%; margin: 48px auto; display: flex; flex-direction: column; gap: 12px; }
.login-card { padding: 28px; }
.stack { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.stack label { font-weight: 500; }
.stack input, .stack select, .stack textarea { font: inherit; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--card); color: var(--text); }
.stack input:focus, .stack select:focus, .stack textarea:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: var(--primary); }
.stack .btn { margin-top: 10px; }
.login-links { margin: 18px 0 0; text-align: center; }

/* participant console */
.form-wide { max-width: 640px; }
.form-wide.stack { margin-top: 8px; }
.hint { margin: 0; color: var(--muted); font-size: 12.5px; }
.inline-form { display: inline; margin: 0; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.did { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.did code { word-break: break-all; }
.plan-list { margin: 6px 0 0; padding-left: 20px; }
.plan-list li { margin: 3px 0; }
.result-ok { border-left: 4px solid var(--ok); }
.result-waiting { border-left: 4px solid var(--warn); }
.result-failed { border-left: 4px solid var(--bad); }
.note { background: var(--primary-50); color: var(--text); padding: 9px 12px; border-radius: 8px; border: 1px solid var(--border); }
.hash { word-break: break-all; }

/* help */
.help .steps { padding-left: 20px; }
.help .steps li { margin: 4px 0; }
.figure { margin: 16px 0 0; }
.diagram { width: 100%; max-width: 720px; height: auto; }
.d-title { font-size: 15px; font-weight: 700; fill: var(--text); }
.d-box { fill: var(--card); stroke: var(--border); stroke-width: 1.5; }
.d-main { fill: var(--primary); }
.d-strong { font-size: 13px; font-weight: 600; fill: var(--text); }
.d-small { font-size: 12px; fill: var(--muted); }
.d-on { font-size: 15px; font-weight: 700; fill: #fff; }
.d-on-small { font-size: 12px; fill: #fff; }
.d-line { stroke: var(--muted); stroke-width: 1.5; fill: none; }
.shot { margin: 18px 0 0; }
.shot img { width: 100%; height: auto; border: 1px solid var(--border); border-radius: 8px; }
.shot figcaption { color: var(--muted); font-size: 13px; margin-top: 6px; }

/* small screens: icon bar by default, the toggle opens an overlay */
@media (max-width: 767px) {
  .with-shell .main, .collapsed.with-shell .main { margin-left: var(--sidebar-c); }
  .sidebar { width: var(--sidebar-c); }
  .sidebar .label { display: none; }
  .brand { justify-content: center; padding: 0; }
  .nav-item { justify-content: center; padding: 8px 0; }
  .open .sidebar { width: var(--sidebar-w); }
  .open .sidebar .label { display: inline; }
  .open .sidebar .context { display: block; }
  .open .brand { justify-content: flex-start; padding: 0 12px; }
  .open .nav-item { justify-content: flex-start; padding: 8px 10px; }
  .hide-sm, .who { display: none; }
  .content { padding: 12px; }
  .topbar { padding: 0 12px; }
}

/* File list of My Resources */
tr[data-href] { cursor: pointer; }
tr[data-href]:hover td { background: var(--raised); }
.tabs { display: flex; gap: 8px; margin: 0 0 12px; }
.tabs a { padding: 4px 12px; border: 1px solid var(--border); border-radius: 999px; text-decoration: none; }
.tabs a[aria-current="page"] { background: var(--raised); font-weight: 600; }
.storage-use progress { width: 100%; max-width: 420px; height: 10px; }
.search-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 12px; }
.pager { display: flex; gap: 12px; align-items: center; margin: 12px 0 0; }
.dl { display: inline-flex; align-items: center; }
.dl svg { width: 16px; height: 16px; }

/* A sha256 in a table: short, the full value behind a small arrow (macro sha). */
details.sha summary { cursor: pointer; white-space: nowrap; }
details.sha[open] > code.wrap { display: block; margin-top: .25rem; max-width: 18rem; word-break: break-all; }
