:root {
  --paper: #F1F4F1; --surface: #FFFFFF; --ink: #16212E; --muted: #58646F;
  --line: #D3D9D2; --seal: #1D6A57; --on-seal: #FFFFFF; --amber: #8A5200; --danger: #A33A2B;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --paper: #0F161D; --surface: #18222C; --ink: #E7ECEF; --muted: #97A4AF;
    --line: #2B3844; --seal: #57BFA3; --on-seal: #08130F; --amber: #E3AE55; --danger: #EA8A78;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.5 var(--sans); }
a { color: var(--seal); text-underline-offset: 3px; }
h1, h2 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0; }
h1 { font-size: 1.75rem; overflow-wrap: anywhere; }
h2 { font-size: 1.2rem; margin: 2.25rem 0 0.75rem; }
:focus-visible { outline: 3px solid var(--seal); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

.top { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.5rem; padding: 0.75rem 1.5rem;
  background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { font-family: var(--serif); font-weight: 600; font-size: 1.1rem; color: var(--ink); text-decoration: none; }
.top nav { display: flex; gap: 1.25rem; flex: 1; }
.top nav a { color: var(--ink); text-decoration: none; }
.top nav a:hover { text-decoration: underline; }
.who { display: flex; align-items: center; gap: 0.75rem; margin: 0; color: var(--muted); font-size: 0.9rem; }

main { max-width: 1120px; margin: 0 auto; padding: 1.5rem; }
.head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 1.5rem; margin-bottom: 0.75rem; }
.head h2 { margin: 0; }
section { margin-top: 2rem; }
.crumb { margin: 0 0 0.5rem; color: var(--muted); font-size: 0.9rem; overflow-wrap: anywhere; }
.fine { color: var(--muted); font-size: 0.875rem; margin: 0.25rem 0; }
.notice { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--seal);
  padding: 0.75rem 1rem; margin: 0 0 1.25rem; border-radius: 4px; }
.empty { color: var(--muted); background: var(--surface); border: 1px dashed var(--line); padding: 1.25rem; border-radius: 6px; max-width: 70ch; }

.row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin: 0; }
.stack { display: grid; gap: 0.5rem; margin: 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 0.85rem 1rem; margin: 1rem 0; }
input, select, button { font: inherit; color: inherit; }
input:not([type=checkbox]):not([type=file]), select { background: var(--surface); border: 1px solid var(--line);
  border-radius: 4px; padding: 0.5rem 0.65rem; min-width: 0; max-width: 100%; }
label { font-size: 0.9rem; font-weight: 600; }
.check { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 400; }
.btn { display: inline-block; background: var(--surface); border: 1px solid var(--ink); border-radius: 4px;
  padding: 0.5rem 0.9rem; cursor: pointer; text-decoration: none; color: var(--ink); font-weight: 600; }
.btn.primary { background: var(--seal); border-color: var(--seal); color: var(--on-seal); }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.wide { display: block; text-align: center; padding: 0.8rem; }
.link { background: none; border: 0; padding: 0; cursor: pointer; color: var(--seal); text-decoration: underline; text-underline-offset: 3px; }
.link.danger { color: var(--danger); }

.ledger { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); }
.ledger th { text-align: left; font-size: 0.8rem; font-weight: 600; color: var(--muted); padding: 0.6rem 0.9rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.ledger td { padding: 0.65rem 0.9rem; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
.ledger tr:last-child td { border-bottom: 0; }
.ledger .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.ledger .act { text-align: right; white-space: nowrap; }
.ledger .act form { margin: 0; }
.ledger tr.off td { color: var(--muted); }
.tag { display: inline-block; font-size: 0.8rem; border: 1px solid var(--line); border-radius: 3px; padding: 0.05rem 0.45rem; color: var(--muted); white-space: nowrap; }
.clock { display: inline-block; font-size: 0.85rem; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--amber);
  border: 1px solid currentColor; border-radius: 999px; padding: 0.1rem 0.6rem; white-space: nowrap; }

/* Folders shown as drawer fronts: a solid spine on the left, the label on the face. */
.drawers { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.6rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.drawers a { display: grid; grid-template-columns: 1fr auto; gap: 0.15rem 0.75rem; align-items: center; background: var(--surface);
  border: 1px solid var(--line); border-left: 10px solid var(--seal); border-radius: 4px; padding: 0.9rem 1rem; color: var(--ink); text-decoration: none; }
.drawers a:hover { border-color: var(--seal); }
.drawers strong { font-family: var(--serif); font-size: 1.1rem; overflow-wrap: anywhere; }
.drawers span:not(.tag) { grid-column: 1; color: var(--muted); font-size: 0.875rem; }
.drawers .tag { grid-column: 2; grid-row: 1 / span 2; }

/* Sign in and error screens */
.gate main { display: grid; place-items: center; min-height: 100vh; }
.door { max-width: 26rem; width: 100%; background: var(--surface); border: 1px solid var(--line); border-top: 10px solid var(--seal); border-radius: 6px; padding: 2rem; }
.door h1 { margin-bottom: 0.5rem; }
.door p { margin: 0 0 1.25rem; }
.door .fine { margin: 1.25rem 0 0; }
.dial { width: 56px; height: 56px; border: 3px solid var(--ink); border-radius: 50%; margin-bottom: 1.25rem; position: relative;
  background: repeating-conic-gradient(var(--ink) 0 2deg, transparent 2deg 30deg); }
.dial span { position: absolute; inset: 9px; border-radius: 50%; background: var(--surface); border: 3px solid var(--ink); }
.dial span::after { content: ""; position: absolute; left: 50%; top: 2px; width: 3px; height: 11px; margin-left: -1.5px; background: var(--seal); }
.dev { border-top: 1px dashed var(--line); margin-top: 1.25rem; padding-top: 1rem; display: grid; gap: 0.4rem; }
.dev input { flex: 1; }

/* Viewer */
.layout { display: grid; gap: 1.5rem; grid-template-columns: minmax(0, 1fr); margin-top: 1rem; }
@media (min-width: 900px) { .layout:has(aside) { grid-template-columns: minmax(0, 1fr) 19rem; } }
.pages { position: relative; display: grid; gap: 1rem; justify-items: center; background: var(--line); border-radius: 6px; padding: 1rem; min-height: 60vh;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.pages img { max-width: 100%; height: auto; min-height: 12rem; background: #fff; box-shadow: 0 1px 3px rgba(22, 33, 46, 0.35); pointer-events: none; }
.shade { display: none; position: absolute; inset: 0; background: var(--surface); border-radius: 6px; place-items: start center; padding: 4rem 1.5rem; text-align: center; cursor: pointer; }
.pages.hidden img { visibility: hidden; }
.pages.hidden .shade { display: grid; }
aside h2:first-child { margin-top: 0; }
aside select { width: 100%; }
.shares { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.shares li { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 0.6rem 0.75rem; }
.shares li div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.3rem 0.75rem; margin-bottom: 0.3rem; }
.shares strong { overflow-wrap: anywhere; font-weight: 600; }
.shares form { margin: 0; }
@media print { body * { display: none !important; } body::after { content: "Printing is switched off for vault documents."; } }
