:root {
  --bg: #0a1712;
  --bg-2: #0d1c16;
  --panel: #11211a;
  --panel-2: #16291f;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --mint: #34e89e;
  --mint-dim: #2bbf83;
  --mint-glow: rgba(52, 232, 158, 0.16);
  --text: #f1f7f4;
  --muted: #8ea89c;
  --muted-2: #6f8a7e;
  --danger: #ff6b6b;
  --warn: #ffcf66;
  --radius: 14px;
  --display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --body: "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background:
    radial-gradient(1100px 600px at 80% -10%, rgba(52, 232, 158, 0.06), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(52, 232, 158, 0.04), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
.boot { padding: 80px; text-align: center; color: var(--muted); }

a { color: var(--mint); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: var(--body); cursor: pointer; }
:focus-visible { outline: 2px solid var(--mint); outline-offset: 2px; border-radius: 6px; }

/* ---------- wordmark ---------- */
.wordmark { font-family: var(--display); font-weight: 700; letter-spacing: -0.02em; font-size: 22px; color: var(--text); }
.wordmark .sec { color: var(--mint); }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: rgba(10, 23, 18, 0.82);
  backdrop-filter: blur(10px); z-index: 20;
}
.topbar nav { display: flex; gap: 4px; align-items: center; }
.navlink {
  color: var(--muted); padding: 8px 14px; border-radius: 9px; font-weight: 500; font-size: 14px;
  border: 1px solid transparent;
}
.navlink:hover { color: var(--text); text-decoration: none; background: var(--panel); }
.navlink.active { color: var(--text); background: var(--panel-2); border-color: var(--line); }
.topbar .who { color: var(--muted); font-size: 13px; display: flex; gap: 12px; align-items: center; }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); padding: 8px 14px; border-radius: 9px; font-size: 13px; }
.btn-ghost:hover { color: var(--text); border-color: var(--line-strong); }

/* ---------- layout ---------- */
.shell { max-width: 1080px; margin: 0 auto; padding: 36px 28px 80px; }
.page-head { margin-bottom: 26px; }
.eyebrow { font-family: var(--display); text-transform: uppercase; letter-spacing: 0.18em; font-size: 11px; color: var(--mint); font-weight: 600; }
h1.title { font-family: var(--display); font-weight: 700; letter-spacing: -0.02em; font-size: clamp(28px, 4vw, 40px); margin: 8px 0 6px; }
.sub { color: var(--muted); margin: 0; }

/* ---------- cards / panels ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.grid { display: grid; gap: 16px; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }

.stat {
  padding: 22px; display: flex; flex-direction: column; gap: 6px; min-height: 132px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: var(--radius); position: relative; overflow: hidden;
}
.stat::after { content: ""; position: absolute; right: -30px; top: -30px; width: 120px; height: 120px; background: radial-gradient(circle, var(--mint-glow), transparent 70%); }
.stat .n { font-family: var(--display); font-size: 38px; font-weight: 700; line-height: 1; }
.stat .lbl { color: var(--muted); font-size: 13px; }
.stat .desc { color: var(--muted-2); font-size: 12px; margin-top: auto; }
.stat a.more { font-size: 13px; font-weight: 500; }

/* ---------- document list ---------- */
.toolbar { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.chip {
  background: var(--panel); border: 1px solid var(--line); color: var(--muted);
  padding: 8px 16px; border-radius: 999px; font-size: 13px; font-weight: 500;
}
.chip:hover { color: var(--text); border-color: var(--line-strong); }
.chip.active { background: var(--mint); color: #06231a; border-color: var(--mint); font-weight: 600; }

.doc {
  display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center;
  padding: 18px 20px; border-bottom: 1px solid var(--line);
}
.doc:last-child { border-bottom: none; }
.doc .ref { font-family: var(--display); font-weight: 600; font-size: 15px; }
.doc .meta { color: var(--muted); font-size: 13px; margin-top: 3px; }
.doc .right { display: flex; gap: 10px; align-items: center; }
.badge {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600;
  padding: 4px 9px; border-radius: 6px; border: 1px solid var(--line-strong); color: var(--muted);
}
.badge.cod { color: var(--mint); border-color: rgba(52,232,158,0.4); }
.badge.hwcn { color: #ffb86b; border-color: rgba(255,184,107,0.35); }
.badge.wtn { color: #7cc6ff; border-color: rgba(124,198,255,0.35); }
.badge.revoked { color: var(--danger); border-color: rgba(255,107,107,0.4); }

.btn {
  background: var(--mint); color: #06231a; border: none; padding: 9px 16px;
  border-radius: 9px; font-weight: 600; font-size: 14px;
}
.btn:hover { background: var(--mint-dim); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.small { padding: 7px 12px; font-size: 13px; }
.btn-outline { background: transparent; color: var(--mint); border: 1px solid rgba(52,232,158,0.4); }
.btn-outline:hover { background: var(--mint-glow); }

/* ---------- chain of custody (signature element) ---------- */
.custody { display: flex; align-items: center; gap: 0; margin: 4px 0; }
.custody .node { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 1; position: relative; }
.custody .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--panel); border: 2px solid var(--line-strong); z-index: 2; }
.custody .node.done .dot { background: var(--mint); border-color: var(--mint); box-shadow: 0 0 0 4px var(--mint-glow); }
.custody .node.current .dot { background: var(--bg); border-color: var(--mint); }
.custody .seg { position: absolute; top: 6px; left: -50%; width: 100%; height: 2px; background: var(--line); z-index: 1; }
.custody .node.done .seg { background: var(--mint); }
.custody .node:first-child .seg { display: none; }
.custody .cap { font-size: 11px; color: var(--muted-2); text-align: center; }
.custody .node.done .cap, .custody .node.current .cap { color: var(--text); }

/* ---------- detail ---------- */
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: 180px 1fr; gap: 10px 18px; padding: 22px; }
.kv dt { color: var(--muted); font-size: 13px; }
.kv dd { margin: 0; font-size: 14px; }
.mono { font-variant-numeric: tabular-nums; font-family: var(--display); }

/* ---------- forms ---------- */
.form { display: grid; gap: 16px; max-width: 640px; }
.field { display: grid; gap: 6px; }
.field label { font-size: 13px; color: var(--muted); font-weight: 500; }
.field .req { color: var(--mint); }
input, textarea, select {
  background: var(--bg-2); border: 1px solid var(--line-strong); color: var(--text);
  border-radius: 10px; padding: 11px 13px; font-size: 14px; font-family: var(--body); width: 100%;
}
input:focus, textarea:focus, select:focus { border-color: var(--mint); outline: none; }
textarea { resize: vertical; min-height: 88px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.check { display: flex; gap: 10px; align-items: center; }
.check input { width: auto; }

/* ---------- auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .panel { padding: 32px; }
.auth-card .wordmark { font-size: 26px; }
.auth-lede { color: var(--muted); margin: 6px 0 24px; }
.auth-card .form { gap: 14px; }
.auth-card .btn { width: 100%; padding: 12px; }
.auth-foot { margin-top: 18px; font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; }

/* ---------- misc ---------- */
.note { padding: 12px 14px; border-radius: 10px; font-size: 13px; border: 1px solid var(--line-strong); }
.note.err { color: var(--danger); border-color: rgba(255,107,107,0.4); background: rgba(255,107,107,0.06); }
.note.ok { color: var(--mint); border-color: rgba(52,232,158,0.4); background: var(--mint-glow); }
.note.info { color: var(--muted); }
.status-pill { font-size: 12px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--muted); }
.status-pill.scheduled, .status-pill.acknowledged { color: var(--mint); border-color: rgba(52,232,158,0.4); }
.status-pill.completed { color: #7cc6ff; border-color: rgba(124,198,255,0.4); }
.status-pill.cancelled { color: var(--danger); border-color: rgba(255,107,107,0.4); }
.empty { padding: 48px 24px; text-align: center; color: var(--muted); }
.empty h3 { font-family: var(--display); color: var(--text); margin: 0 0 6px; }
.section-title { font-family: var(--display); font-weight: 600; font-size: 18px; margin: 32px 0 14px; }
.muted { color: var(--muted); }
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--line-strong); border-top-color: var(--mint); border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 760px) {
  .grid.cols-3, .grid.cols-2, .row2 { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; gap: 4px 0; }
  .kv dt { margin-top: 10px; }
  .topbar { padding: 14px 16px; flex-wrap: wrap; gap: 10px; }
  .topbar nav { order: 3; width: 100%; overflow-x: auto; }
  .shell { padding: 24px 16px 64px; }
  .custody .cap { font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
