/* Onus · Keeper of every gate. Black ground, white ink, one accent (emerald by default, tenant-branded on hosted pages). */
:root {
  --night: #050507;
  --raised: #0e0f13;
  --raised-2: #15171d;
  --line: #22252d;
  --white: #ffffff;
  --soft: #c7cbd6;
  --muted: #8c8f99;
  --danger: #ff5c6c;
  --ok: #1fcb8b;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --font: "Archivo", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--night); color: var(--white); font: 17px/1.55 var(--font); -webkit-font-smoothing: antialiased; min-height: 100vh; }
a { color: var(--white); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
code { font: 14px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--soft); word-break: break-all; }
.hint, .muted { color: var(--muted); font-size: 15px; margin: 6px 0 0; }
.lead { color: var(--soft); max-width: 60ch; margin: 0 0 24px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 22px; border: 0; border-radius: 999px;
  font: 600 16px/1 var(--font); text-decoration: none; cursor: pointer; color: var(--white);
  transition: transform 160ms var(--ease-out), background-color 200ms ease, opacity 200ms ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.97); }
.btn[disabled] { opacity: 0.55; cursor: progress; }
.btn-block { width: 100%; }
.btn-sm { min-height: 40px; padding: 0 16px; font-size: 14px; }
.btn-primary { background: var(--accent); color: var(--accent-ink, var(--night)); }
.btn-ghost { background: var(--raised-2); color: var(--white); }
.btn-social { background: var(--white); color: var(--night); }
.btn-danger { background: rgba(255, 92, 108, 0.14); color: var(--danger); }
@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover { background: color-mix(in srgb, var(--accent) 82%, #fff); }
  .btn-ghost:hover { background: #1d2028; }
  .btn-social:hover { background: #e6e8ee; }
  .btn-danger:hover { background: rgba(255, 92, 108, 0.24); }
}

/* ---------- Forms ---------- */
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-size: 15px; font-weight: 600; }
.input {
  width: 100%; min-height: 52px; padding: 0 18px; border-radius: 14px;
  border: 1px solid transparent; background: var(--raised-2); color: var(--white); font: 17px var(--font);
  transition: border-color 200ms ease, box-shadow 200ms ease;
}
textarea.input { padding: 14px 18px; line-height: 1.5; resize: vertical; }
select.input { appearance: none; cursor: pointer; }
.input[type="color"] { padding: 6px; height: 52px; }
.input:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.input::placeholder { color: #6b6e78; }
.check { display: flex; align-items: center; gap: 12px; padding: 8px 0; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.divider { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 14px; margin: 24px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.alert { margin: 0 0 20px; padding: 14px 16px; border-radius: 14px; font-size: 15px; }
.alert-error { background: rgba(255, 92, 108, 0.12); color: #ffb3bb; }
.alert-info { background: var(--raised-2); color: var(--soft); }
.alert-ok { background: rgba(31, 203, 139, 0.12); color: #9ef0cf; }
.tag { display: inline-block; margin-left: 8px; padding: 2px 10px; border-radius: 999px; background: var(--raised-2); color: var(--soft); font-size: 13px; font-weight: 500; vertical-align: middle; }

/* ---------- Hosted auth pages ---------- */
.surface-auth { display: flex; flex-direction: column; min-height: 100vh; position: relative; overflow-x: hidden; isolation: isolate; }
.auth-glow {
  position: fixed; left: 50%; bottom: -60vmax; width: 120vmax; height: 120vmax; margin-left: -60vmax; z-index: -1;
  border-radius: 50%; pointer-events: none; overflow: hidden;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 55%, transparent), color-mix(in srgb, var(--accent) 12%, transparent) 50%, transparent 72%);
  animation: glow-in 1400ms var(--ease-out) both;
}
.auth-glow::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; opacity: 0.3; mix-blend-mode: overlay;
  -webkit-mask-image: radial-gradient(closest-side, #000 15%, transparent 62%);
  mask-image: radial-gradient(closest-side, #000 15%, transparent 62%);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}
@keyframes glow-in { from { opacity: 0; transform: translateY(8%); } to { opacity: 1; transform: none; } }
.auth-main { flex: 1; display: flex; justify-content: center; align-items: center; padding: 64px 20px 40px; }
.auth-col { width: 100%; max-width: 420px; animation: rise 700ms var(--ease-out) 120ms both; }
.auth-main.wide .auth-col { max-width: 640px; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.auth-tenant { margin: 0 0 12px; color: color-mix(in srgb, var(--accent) 55%, #fff); font-weight: 600; font-size: 15px; }
.auth-title { margin: 0 0 12px; font-size: clamp(30px, 6vw, 40px); line-height: 1.05; letter-spacing: -0.03em; font-weight: 600; font-variation-settings: "wdth" 112; }
.auth-lead { margin: 0 0 28px; color: var(--soft); }
.auth-col > .stack-sm + .stack-sm { margin-top: 10px; }
.auth-foot { padding: 24px; text-align: center; font-size: 14px; }
.auth-foot a { display: inline-flex; align-items: center; gap: 8px; color: var(--soft); text-decoration: none; }
.auth-foot svg { color: var(--accent); }

.acct-section { margin-top: 40px; }
.acct-section h2 { font-size: 20px; margin: 0 0 12px; letter-spacing: -0.01em; }
.rows { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; border-radius: 14px; background: var(--raised); }
.row p { margin: 4px 0 0; }
details.danger { margin-top: 20px; }
details.danger summary { cursor: pointer; color: var(--danger); font-weight: 600; padding: 8px 0; }

/* ---------- Onus home ---------- */
.home { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 64px clamp(20px, 6vw, 96px); max-width: 980px; }
.home-mark { margin: 0 0 24px; color: var(--accent); animation: key-turn 1200ms var(--ease-out) 200ms both; transform-origin: 50% 30%; }
@keyframes key-turn { from { opacity: 0; transform: rotate(-90deg) scale(0.9); } to { opacity: 1; transform: none; } }
.home-title { margin: 0; font-size: clamp(64px, 14vw, 180px); line-height: 0.85; letter-spacing: -0.05em; font-weight: 700; }
.home-tag { margin: 16px 0 0; font-size: clamp(22px, 3vw, 32px); color: color-mix(in srgb, var(--accent) 80%, #fff); font-weight: 500; letter-spacing: -0.02em; }
.home-lead { margin: 24px 0 36px; max-width: 34em; color: var(--soft); font-size: 19px; }
.home-actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- Console / admin ---------- */
.surface-console, .surface-admin { --accent: #1fcb8b; }
.surface-admin { --accent: #3d8bff; }
.c-top { display: flex; align-items: center; gap: 16px; padding: 14px clamp(16px, 3vw, 32px); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.c-brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; text-decoration: none; color: var(--white); }
.c-brand svg { color: var(--accent); }
.c-crumb { color: var(--soft); }
.c-top-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.c-who { color: var(--muted); font-size: 14px; }
.c-body { display: flex; flex-wrap: wrap; }
.c-nav { flex: 1 1 220px; max-width: 260px; display: flex; flex-direction: column; gap: 2px; padding: 24px 16px; }
.c-nav a { padding: 10px 14px; border-radius: 10px; color: var(--soft); text-decoration: none; font-size: 15px; transition: background-color 160ms ease; }
.c-nav a[aria-current="page"] { background: var(--raised-2); color: var(--white); }
@media (hover: hover) and (pointer: fine) { .c-nav a:hover { background: var(--raised); } }
.c-main { flex: 999 1 560px; min-width: 0; padding: 32px clamp(16px, 3vw, 40px) 80px; max-width: 1100px; }
.c-h1 { margin: 0 0 16px; font-size: clamp(28px, 3vw, 38px); letter-spacing: -0.03em; font-weight: 600; font-variation-settings: "wdth" 112; }
.c-section { margin-top: 28px; padding: 24px; border-radius: 18px; background: var(--raised); }
.c-section h2 { margin: 0 0 12px; font-size: 19px; }
.c-form { display: flex; flex-direction: column; gap: 16px; max-width: 640px; }
.c-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.c-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.c-cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.c-card { display: flex; flex-direction: column; gap: 6px; padding: 20px; border-radius: 16px; background: var(--raised); text-decoration: none; transition: background-color 160ms ease; }
@media (hover: hover) and (pointer: fine) { .c-card:hover { background: var(--raised-2); } }
.c-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 0; }
.c-stats div { padding: 20px; border-radius: 16px; background: var(--raised); }
.c-stats dt { color: var(--muted); font-size: 14px; }
.c-stats dd { margin: 4px 0 0; font-size: 36px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.c-kv { margin: 0 0 16px; display: flex; flex-direction: column; gap: 10px; }
.c-kv div { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 12px; }
@media (max-width: 640px) { .c-kv div { grid-template-columns: minmax(0, 1fr); gap: 2px; } }
.c-kv dt { color: var(--muted); font-size: 14px; }
.c-kv dd { margin: 0; }
.secret { color: var(--accent); font-size: 15px; }
.code { margin: 16px 0 0; padding: 18px; border-radius: 14px; background: var(--night); overflow-x: auto; }
.code code { word-break: normal; white-space: pre; }
.c-search { display: flex; gap: 10px; margin-bottom: 16px; max-width: 520px; }
.c-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.c-table th { text-align: left; color: var(--muted); font-weight: 500; font-size: 13px; padding: 10px 12px; }
.c-table td { padding: 12px; border-top: 1px solid var(--line); vertical-align: top; }
.c-row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
@media (max-width: 760px) {
  .c-table, .c-table thead, .c-table tbody, .c-table tr, .c-table td, .c-table th { display: block; }
  .c-table thead { display: none; }
  .c-table tr { padding: 12px 0; border-top: 1px solid var(--line); }
  .c-table td { border: 0; padding: 4px 0; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-glow, .auth-col, .home-mark { animation: none; }
  .btn:active { transform: none; }
}
