:root {
  --bg: #0f110e;
  --bg-2: #171b16;
  --bg-3: #20261f;
  --bg-4: #2a312a;
  --ink: #f4f1e9;
  --muted: #a9b0a4;
  --faint: #717a6d;
  --line: rgba(244, 241, 233, 0.1);
  --line-strong: rgba(244, 241, 233, 0.18);
  --brass: #e2a85a;
  --brass-soft: rgba(226, 168, 90, 0.14);
  --brass-ink: #2a1d0c;
  --sea: #9dcec2;
  --sea-soft: rgba(157, 206, 194, 0.12);
  --danger: #e36b5c;
  --danger-soft: rgba(227, 107, 92, 0.14);
  --warn: #f0c27a;
  --radius: 14px;
  --radius-sm: 9px;
  --serif: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  --sans: "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --mono: "SF Mono", ui-monospace, "Cascadia Code", Menlo, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  background-color: var(--bg);
  background-image:
    radial-gradient(1100px 520px at -10% -20%, rgba(226, 168, 90, 0.14), transparent 55%),
    radial-gradient(800px 420px at 110% -10%, rgba(157, 206, 194, 0.09), transparent 48%);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

button, input, select { font: inherit; color: inherit; }

::selection { background: var(--brass); color: var(--brass-ink); }

.loading { padding: 48px; color: var(--muted); }

.shell {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 22px 14px;
  border-right: 1px solid var(--line);
  background: rgba(15, 17, 14, 0.82);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  text-decoration: none;
  padding: 4px 10px 22px;
}

.brand svg { width: 34px; height: 34px; flex: none; }

.brand strong {
  display: block;
  font-family: var(--serif);
  font-size: 1.65rem;
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1;
}

.brand small {
  display: block;
  margin-top: 4px;
  color: var(--faint);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.66rem;
}

.nav { display: grid; gap: 2px; }

.nav-label {
  padding: 0 10px 8px;
  color: var(--faint);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  transition: background 120ms ease, color 120ms ease;
}

.nav a:hover { color: var(--ink); background: rgba(244, 241, 233, 0.04); }

.nav a svg { width: 16px; height: 16px; flex: none; opacity: 0.7; }

.nav a[aria-current="page"] {
  color: var(--ink);
  background: var(--bg-3);
  box-shadow: inset 2px 0 0 var(--brass);
}

.nav a[aria-current="page"] svg { opacity: 1; color: var(--brass); }

.side-foot {
  margin-top: auto;
  display: grid;
  gap: 10px;
  padding: 14px 6px 4px;
  border-top: 1px solid var(--line);
}

.who {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.avatar {
  flex: none;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--brass-soft);
  color: var(--brass);
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
}

.who-name { font-family: var(--mono); font-size: 0.82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.who-role { display: block; color: var(--faint); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; }

main { padding: 36px 44px 72px; max-width: 1200px; width: 100%; }

.page-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-end;
  margin-bottom: 26px;
}

h1, h2, h3 { font-weight: 560; letter-spacing: -0.03em; margin: 0; }

h1 { font-size: 2.1rem; line-height: 1.1; }

h2 { font-size: 1.15rem; }

h3 { font-size: 0.78rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); margin: 16px 0 8px; }

.lede, .muted { color: var(--muted); }

.lede { margin: 6px 0 0; max-width: 64ch; }

.crumbs { display: flex; gap: 8px; align-items: center; margin: 0 0 14px; font-size: 0.9rem; }

.crumb { color: var(--faint); text-decoration: none; }

.crumb:hover { color: var(--ink); }

.crumbs span { color: var(--faint); }

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 26px;
}

.stat, .card, .terminal, .table-wrap, form.card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.stat { padding: 18px 20px; position: relative; overflow: hidden; }

.stat::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 2px;
  background: var(--line);
}

.stat.accent::after { background: var(--brass); }

.stat span { display: block; color: var(--faint); font-size: 0.74rem; letter-spacing: 0.1em; text-transform: uppercase; }

.stat strong {
  display: block;
  margin-top: 8px;
  font-family: var(--serif);
  font-size: 2.2rem;
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.stat small { display: block; margin-top: 8px; color: var(--muted); font-size: 0.82rem; }

.home {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 22px;
  align-items: start;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.toolbar h2 { font-size: 0.78rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); }

input, select {
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  transition: border-color 120ms ease;
}

input::placeholder { color: var(--faint); }

input:hover, select:hover { border-color: rgba(244, 241, 233, 0.28); }

input:focus, select:focus, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}

#filter { width: min(320px, 100%); }

.table-wrap { overflow-x: auto; }
.spaced { margin-top: 16px; }

table { width: 100%; border-collapse: collapse; }

th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }

td { font-variant-numeric: tabular-nums; }

td:not(:first-child) { white-space: nowrap; }

td .muted { font-size: 0.78rem; margin-top: 2px; }

th {
  color: var(--faint);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  background: rgba(244, 241, 233, 0.025);
}

tr:last-child td { border-bottom: 0; }

tbody tr { transition: background 120ms ease; }

tbody tr:hover td { background: rgba(244, 241, 233, 0.025); }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.repo-link { font-weight: 600; text-decoration: none; }

.repo-link:hover { color: var(--brass); }

.mono, code, pre { font-family: var(--mono); }

code { font-size: 0.9em; padding: 1px 5px; border-radius: 5px; background: rgba(244, 241, 233, 0.07); }

.digest { color: var(--sea); font-size: 0.86rem; font-family: var(--mono); }

p.digest { word-break: break-all; margin: 0 0 18px; }

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 9px;
  background: var(--sea-soft);
  color: var(--sea);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
}

.pill.admin { background: var(--brass-soft); color: var(--brass); }
.pill.writer { background: var(--sea-soft); color: var(--sea); }
.pill.reader { background: rgba(244, 241, 233, 0.07); color: var(--muted); }

.actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

button, .button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  background: var(--brass);
  color: var(--brass-ink);
  text-decoration: none;
  cursor: pointer;
  font-weight: 650;
  line-height: 1.2;
  transition: filter 120ms ease, background 120ms ease, border-color 120ms ease;
}

button:hover { filter: brightness(1.06); }

button.ghost, .button.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line-strong);
}

button.ghost:hover { border-color: rgba(244, 241, 233, 0.32); background: rgba(244, 241, 233, 0.03); filter: none; }

button.danger { background: var(--danger); color: #2a0d0a; }

button[data-armed="yes"] { background: var(--danger); color: #2a0d0a; border-color: transparent; }

button:disabled { opacity: 0.6; cursor: wait; }

.notice, .warn, .error {
  border-radius: 12px;
  padding: 12px 14px;
  margin: 0 0 18px;
  border: 1px solid transparent;
}

.notice { background: var(--sea-soft); color: var(--sea); border-color: rgba(157, 206, 194, 0.2); }
.warn { background: var(--brass-soft); color: var(--warn); border-color: rgba(226, 168, 90, 0.22); }
.error { background: var(--danger-soft); color: #ffc7c0; border-color: rgba(227, 107, 92, 0.22); }

.terminal {
  position: relative;
  margin: 0;
  padding: 18px 64px 18px 20px;
  overflow: auto;
  color: #efe7d6;
  line-height: 1.75;
  background: var(--bg);
  font-size: 0.86rem;
}

.terminal::before {
  content: "";
  position: absolute;
  top: 14px;
  right: 16px;
  width: 36px;
  height: 10px;
  border-radius: 99px;
  background: radial-gradient(circle at 5px 5px, var(--danger) 3px, transparent 3.5px),
    radial-gradient(circle at 18px 5px, var(--warn) 3px, transparent 3.5px),
    radial-gradient(circle at 31px 5px, var(--sea) 3px, transparent 3.5px);
}

.terminal .cmd { color: var(--brass); }

.card { padding: 20px; }

.card h2 { margin-bottom: 10px; }

.card > .muted:first-of-type { margin-top: 0; }

.card p { margin: 0 0 12px; }

.card p:last-child { margin-bottom: 0; }

.stack { display: grid; gap: 16px; }

.facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin: 22px 0 14px;
}

.fact { padding: 14px 0 0; border-top: 1px solid var(--line-strong); }
.fact span { display: block; color: var(--faint); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; }
.fact strong { display: block; margin-top: 6px; font-weight: 560; word-break: break-all; font-variant-numeric: tabular-nums; }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }

.kv { display: grid; gap: 8px; margin: 0; }
.kv div { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 10px; }
.kv dt { color: var(--faint); overflow-wrap: anywhere; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.kv.labels div { grid-template-columns: 1fr; gap: 2px; padding: 8px 0; border-top: 1px solid var(--line); }
.kv.labels dt { font-family: var(--mono); font-size: 0.8rem; }

.plain { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; font-size: 0.86rem; word-break: break-all; }

.bar-track { height: 6px; background: var(--bg); border-radius: 99px; overflow: hidden; min-width: 88px; border: 1px solid var(--line); }
.bar { display: block; height: 100%; background: var(--brass); }
.w0 { width: 2%; } .w1 { width: 10%; } .w2 { width: 20%; } .w3 { width: 30%; }
.w4 { width: 40%; } .w5 { width: 50%; } .w6 { width: 60%; } .w7 { width: 70%; }
.w8 { width: 80%; } .w9 { width: 90%; } .w10 { width: 100%; }

.activity { list-style: none; margin: 0; padding: 0; display: grid; }
.activity li {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.activity li:last-child { border-bottom: 0; }
.activity li::before {
  content: "";
  width: 8px;
  height: 8px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--sea);
}
.activity li.push::before { background: var(--brass); }
.activity li.delete::before, .activity li.delete-repository::before, .activity li.delete-user::before, .activity li.delete-api-key::before { background: var(--danger); }
.activity li.gc::before { background: var(--warn); }
.activity li.login::before, .activity li.create-user::before, .activity li.create-api-key::before { background: var(--sea); }
.activity time { display: block; color: var(--faint); font-size: 0.76rem; margin-top: 2px; }

details { margin-top: 20px; }
details summary { cursor: pointer; color: var(--muted); }
details summary:hover { color: var(--ink); }
details pre {
  overflow: auto;
  padding: 16px;
  margin-top: 10px;
  background: var(--bg);
  border-radius: 12px;
  border: 1px solid var(--line);
  font-size: 0.78rem;
}

.login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(340px, 480px);
}

.login-story { padding: 72px 64px; display: flex; flex-direction: column; justify-content: center; gap: 18px; }
.login-story .brand { padding: 0 0 22px; }
.eyebrow { letter-spacing: 0.16em; text-transform: uppercase; color: var(--brass); font-size: 0.74rem; margin: 0; }
.login-story h1 { font-family: var(--serif); font-size: clamp(2.6rem, 5vw, 4.4rem); font-weight: 500; line-height: 0.95; max-width: 11ch; }
.login-story .lede { max-width: 46ch; font-size: 1.05rem; margin: 0; }
.login-story .terminal { max-width: 560px; }

.login-pane {
  display: grid;
  align-content: center;
  padding: 24px;
  border-left: 1px solid var(--line);
  background: rgba(15, 17, 14, 0.55);
}

.login form { padding: 30px; display: grid; gap: 16px; }

.login form h2 { font-size: 1.5rem; }

.login form .muted { margin: -8px 0 0; font-size: 0.92rem; }

.login form button[type="submit"] { width: 100%; justify-content: center; padding: 12px 14px; margin-top: 4px; }

label { display: grid; gap: 6px; color: var(--muted); font-size: 0.9rem; }
label input, label select { width: 100%; color: var(--ink); }

form.card button[type="submit"] { justify-self: start; }

.form-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

.empty { padding: 30px; }
.empty h2 { font-size: 1.35rem; }
.empty .terminal { margin-top: 18px; }

.secret-box {
  border-color: rgba(226, 168, 90, 0.35);
  background: linear-gradient(0deg, var(--brass-soft), var(--brass-soft)), var(--bg-2);
}

.secret-box .digest { color: var(--ink); background: var(--bg); padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line); margin: 0 0 12px; }

@media (max-width: 980px) {
  .home, .split, .login { grid-template-columns: 1fr; }
  .stats, .facts { grid-template-columns: 1fr 1fr; }
  .login-story { padding: 40px 24px 12px; }
  .login-story h1 { max-width: none; }
  .login-pane { border-left: 0; border-top: 1px solid var(--line); }
}

@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 2;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    overflow: auto;
  }
  .brand { padding: 0; }
  .brand small { display: none; }
  .nav { display: flex; }
  .nav-label { display: none; }
  .nav a span { display: none; }
  .nav a { padding: 8px; }
  .side-foot { margin-top: 0; margin-left: auto; padding: 0; border-top: 0; display: flex; align-items: center; }
  .who-role, .who-name { display: none; }
  main { padding: 22px 16px 48px; }
  .page-head, .toolbar, .form-row { flex-direction: column; align-items: stretch; }
  .page-head .actions { justify-content: flex-start; }
  .kv div { grid-template-columns: 1fr; gap: 2px; }
  .stats, .facts { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .facts { grid-template-columns: 1fr; }
  .stat { padding: 14px 16px; }
  .stat strong { font-size: 1.8rem; }
}
