/* SecureFiles: document-custody look. The operator's brand colour (--brand) is the only accent. */
:root {
  --brand: #2563eb;
  --brand-ink: #ffffff;
  --paper: #eef2f5;
  --surface: #ffffff;
  --ink: #1b2530;
  --muted: #566372;
  --rule: #d3dae2;
  --danger: #b42318;
  --ok: #17703a;
  --focus: color-mix(in srgb, var(--brand) 55%, transparent);
  --serif: Charter, "Bitstream Charter", "Sitka Text", Cambria, "Iowan Old Style", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --spine: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #161c23; --surface: #1e252e; --ink: #e6ebf0; --muted: #9aa7b5; --rule: #2f3843;
    --danger: #f08b80; --ok: #6fd08f; color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; background: var(--paper); color: var(--ink);
  font: 16px/1.5 var(--sans);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* The folder spine: a solid band of the brand colour down the left edge. */
.spine { position: fixed; inset: 0 auto 0 0; width: var(--spine); background: var(--brand); }
.app { margin-left: var(--spine); min-height: 100dvh; display: flex; flex-direction: column; }
.boot { padding: 2rem; color: var(--muted); }

.topbar {
  display: flex; align-items: center; gap: 1rem; padding: .75rem clamp(1rem, 4vw, 2.5rem);
  border-bottom: 1px solid var(--rule); background: var(--surface);
}
.brandmark { display: flex; align-items: center; gap: .6rem; color: inherit; text-decoration: none; min-width: 0; }
.brandmark img { height: 32px; width: auto; max-width: 180px; object-fit: contain; }
.brandmark span { font: 600 1.15rem/1.1 var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topnav { margin-left: auto; display: flex; gap: .25rem; flex-wrap: wrap; }
.topnav a, .topnav button {
  font: 500 .92rem var(--sans); color: var(--muted); text-decoration: none; background: none; border: 0;
  padding: .45rem .65rem; border-radius: 6px; cursor: pointer;
}
.topnav a[aria-current="page"] { color: var(--ink); background: var(--paper); }
.topnav a:hover, .topnav button:hover { color: var(--ink); }

main { width: 100%; max-width: 820px; margin: 0 auto; padding: clamp(1.25rem, 4vw, 2.5rem) clamp(1rem, 4vw, 2.5rem) 4rem; flex: 1; }
main.narrow { max-width: 460px; }
footer.site { padding: 1rem clamp(1rem, 4vw, 2.5rem); color: var(--muted); font-size: .85rem; border-top: 1px solid var(--rule); }
footer.site a { color: inherit; }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: clamp(1.6rem, 4vw, 2.1rem); letter-spacing: -.01em; }
h2 { font-size: 1.3rem; margin-top: 2rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1rem; max-width: 68ch; }
.lede { color: var(--muted); font-size: 1.05rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: clamp(1rem, 3vw, 1.5rem); margin: 1rem 0; }
.stack > * + * { margin-top: .9rem; }
.row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.grow { flex: 1; min-width: 0; }

label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .3rem; }
.hint { font-weight: 400; color: var(--muted); font-size: .85rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--rule); border-radius: 6px; padding: .6rem .7rem;
}
input[type=color] { width: 3rem; height: 2.4rem; padding: 0; border: 1px solid var(--rule); border-radius: 6px; background: none; }
.check { display: flex; align-items: center; gap: .5rem; font-weight: 400; }
.check input { width: 1.1rem; height: 1.1rem; accent-color: var(--brand); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  font: 600 .95rem var(--sans); padding: .62rem 1rem; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--rule); background: var(--surface); color: var(--ink); text-decoration: none;
}
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.danger { color: var(--danger); }
.btn.link { border: 0; background: none; padding: .3rem 0; color: var(--brand); font-weight: 500; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: progress; }

.notice { border-left: 4px solid var(--brand); background: var(--surface); padding: .75rem 1rem; border-radius: 0 6px 6px 0; margin: 1rem 0; }
.notice.error { border-color: var(--danger); }
.notice.ok { border-color: var(--ok); }
.divider { display: flex; align-items: center; gap: .75rem; color: var(--muted); font-size: .85rem; margin: 1.25rem 0; }
.divider::before, .divider::after { content: ""; height: 1px; background: var(--rule); flex: 1; }

/* File list: ledger rows, not cards */
.ledger { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.ledger li { display: flex; align-items: center; gap: .75rem; padding: .7rem .25rem; border-bottom: 1px solid var(--rule); }
.ledger .name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.ledger .name a { color: inherit; font-weight: 600; }
.ledger .meta { color: var(--muted); font-size: .85rem; }
.icon { width: 1.25rem; height: 1.25rem; flex: none; color: var(--muted); }
.crumbs { display: flex; flex-wrap: wrap; gap: .25rem; align-items: center; margin-bottom: 1rem; color: var(--muted); }
.crumbs button { background: none; border: 0; color: var(--brand); font: inherit; cursor: pointer; padding: 0; }

/* MFA */
.big-number { font: 700 clamp(3.5rem, 18vw, 5.5rem)/1 var(--serif); color: var(--brand); text-align: center; margin: .5rem 0 1rem; font-variant-numeric: tabular-nums; }
.numbers { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; }
.numbers .btn { font: 700 2rem/1 var(--serif); padding: 1.2rem 0; }
.qr { display: block; width: 220px; max-width: 100%; background: #fff; border-radius: 8px; padding: 6px; }
.codes { font: 1rem/1.8 var(--mono); columns: 2; padding: 1rem; background: var(--paper); border-radius: 6px; list-style: none; margin: 0; }
.secret { font-family: var(--mono); overflow-wrap: anywhere; }

/* Admin */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--rule); margin: 1rem 0; overflow-x: auto; }
.tabs button { background: none; border: 0; border-bottom: 3px solid transparent; padding: .6rem .8rem; font: 600 .95rem var(--sans); color: var(--muted); cursor: pointer; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--ink); border-color: var(--brand); }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.asset { display: flex; gap: 1rem; align-items: center; padding: .75rem 0; border-bottom: 1px solid var(--rule); }
.asset img { width: 96px; height: 48px; object-fit: contain; background: var(--paper); border-radius: 6px; }
.asset.icon img { width: 48px; height: 48px; }
.report { font-size: .9rem; }
.report ul { margin: .25rem 0 .75rem; padding-left: 1.25rem; }
table.simple { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.simple th, table.simple td { text-align: left; padding: .5rem .4rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
.scroll { overflow-x: auto; }

dialog { border: 1px solid var(--rule); border-radius: 10px; padding: 1.5rem; width: min(480px, 92vw); background: var(--surface); color: var(--ink); box-shadow: 0 20px 50px rgba(15, 25, 40, .25); }
dialog::backdrop { background: rgba(20, 28, 38, .45); }
progress { width: 100%; accent-color: var(--brand); }

@media (max-width: 560px) {
  .topbar { flex-wrap: wrap; }
  .topnav { margin-left: 0; width: 100%; }
}
@media (prefers-reduced-motion: no-preference) {
  .reveal { animation: reveal .35s ease-out both; }
  @keyframes reveal { from { opacity: 0; transform: translateY(6px); } }
}
.hidden { display: none !important; }
