:root {
  --bg: #f6f7f9; --card: #fff; --text: #16181d; --muted: #6b7280; --line: #e3e6eb;
  --accent: #ff5a1f; --accent-text: #fff; --ok: #15803d; --bad: #b91c1c; --warn: #b45309; --info: #1d4ed8;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f1115; --card: #181b21; --text: #e8eaee; --muted: #9aa1ad; --line: #2a2f38;
    --ok: #4ade80; --bad: #f87171; --warn: #fbbf24; --info: #93c5fd; }
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--info); text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 24px; margin: 8px 0 16px; } h2 { font-size: 18px; margin: 28px 0 10px; } h3 { font-size: 15px; margin: 0 0 8px; }
code { font-size: 12px; background: var(--line); padding: 1px 5px; border-radius: 4px; word-break: break-all; }
.muted { color: var(--muted); } .small { font-size: 13px; } .warn { color: var(--warn); font-weight: 600; }

.top { display: flex; align-items: center; gap: 24px; padding: 12px 24px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 700; color: var(--text); } .brand span { color: var(--accent); font-weight: 600; }
#nav { display: flex; gap: 4px; } #nav[hidden], [hidden] { display: none !important; } #nav a { padding: 6px 12px; border-radius: 8px; color: var(--muted); }
#nav a.on { background: var(--bg); color: var(--text); font-weight: 600; } #nav a:hover { text-decoration: none; color: var(--text); }
#who { margin-left: auto; font-size: 13px; }
main { max-width: 1280px; margin: 0 auto; padding: 16px 24px 80px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px 20px; margin-bottom: 16px; }
.card.narrow { max-width: 420px; margin: 60px auto; }
.card h1 { margin-top: 0; } .card.role h2 { margin-top: 0; }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0; }
input, select, textarea { display: block; width: 100%; margin-top: 4px; padding: 8px 10px; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; }
input[type=checkbox] { display: inline; width: auto; margin: 0 8px 0 0; }
textarea { resize: vertical; }
button { font: inherit; padding: 7px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--text); cursor: pointer; }
button:hover:not(:disabled) { border-color: var(--muted); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
button.danger { color: var(--bad); }
button.link { border: 0; background: none; color: var(--info); padding: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.qr { display: block; width: 200px; height: 200px; margin: 8px auto; background: #fff; padding: 8px; border-radius: 8px; }

table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 14px; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
.filters { display: flex; gap: 10px; margin: 0 0 12px; } .filters select { width: 180px; } .filters input { max-width: 320px; }
.stats { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.stats > div { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; display: flex; align-items: center; gap: 8px; }
.stats b { font-size: 22px; }

.chip { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--line); color: var(--text); text-transform: capitalize; vertical-align: middle; }
.chip.s-approved { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.chip.s-rejected, .chip.s-suspended, .chip.s-expired { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }
.chip.s-pending, .chip.s-submitted, .chip.s-needs_info { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.chip.s-in_review { background: color-mix(in srgb, var(--info) 16%, transparent); color: var(--info); }

dl { display: grid; grid-template-columns: 120px 1fr; gap: 4px 12px; margin: 8px 0; font-size: 14px; }
dt { color: var(--muted); } dd { margin: 0; overflow-wrap: anywhere; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.sticky { position: sticky; top: 70px; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } .sticky { position: static; } }
.req { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 12px; }
.doc { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; }
.doc.s-replaced, .doc.s-rejected, .doc.s-expired { opacity: .7; }
.doc-head { display: flex; justify-content: space-between; align-items: center; }
.review { background: var(--bg); border-radius: 10px; padding: 10px 12px; margin-top: 8px; }
.checks .check { color: var(--text); margin: 6px 0; display: flex; align-items: flex-start; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 12px; }
details { margin-top: 10px; } summary { cursor: pointer; color: var(--bad); font-size: 14px; } details select { margin-bottom: 6px; }
.viewer { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.viewer img { max-width: 100%; display: block; border-radius: 8px; margin-bottom: 4px; }
.viewer iframe { width: 100%; height: 70vh; border: 0; border-radius: 8px; background: #fff; }

#toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px); opacity: 0; transition: .2s; background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; max-width: 90vw; pointer-events: none; z-index: 10; }
#toast.show { opacity: 1; transform: translate(-50%, 0); } #toast.bad { background: var(--bad); color: #fff; }
