:root {
  color-scheme: dark;
  --bg: #070b14;
  --panel: #0e1626;
  --panel-2: #111d31;
  --line: #21314d;
  --text: #edf7ff;
  --muted: #8ea3ba;
  --cyan: #22d3ee;
  --blue: #3b82f6;
  --green: #34d399;
  --yellow: #fbbf24;
  --red: #fb7185;
  --shadow: 0 20px 55px rgba(0,0,0,.25);
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--text); background: radial-gradient(circle at 12% 0%, rgba(34,211,238,.10), transparent 30rem), radial-gradient(circle at 95% 10%, rgba(59,130,246,.10), transparent 34rem), var(--bg); }
a { color: #8be9f7; text-decoration: none; }
a:hover { color: white; }
button, input, select, textarea { font: inherit; }
.topbar { min-height: 76px; padding: 14px max(24px, calc((100vw - 1240px)/2)); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(142,163,186,.16); background: rgba(7,11,20,.78); backdrop-filter: blur(18px); position: sticky; top: 0; z-index: 10; }
.brand { color: var(--text); display: flex; align-items: center; gap: 12px; }
.brand:hover { color: var(--text); }
.brand strong, .brand small { display: block; }
.brand strong { font-size: .95rem; letter-spacing: .06em; }
.brand small { color: var(--muted); margin-top: 2px; font-size: .72rem; }
.brand-mark { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; color: #04131d; font-weight: 900; background: linear-gradient(135deg, var(--cyan), #67e8f9 55%, var(--blue)); box-shadow: 0 0 28px rgba(34,211,238,.22); }
.brand-mark.large { width: 58px; height: 58px; border-radius: 17px; margin-bottom: 16px; font-size: 1.2rem; }
.account { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .88rem; }
.role { padding: 4px 8px; border: 1px solid var(--line); border-radius: 999px; text-transform: capitalize; font-size: .72rem; }
.link-button { border: 0; background: none; color: #8be9f7; cursor: pointer; padding: 4px; }
.nav { padding: 0 max(24px, calc((100vw - 1240px)/2)); display: flex; gap: 4px; border-bottom: 1px solid rgba(142,163,186,.13); overflow-x: auto; }
.nav a { padding: 13px 15px 11px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; font-size: .9rem; }
.nav a:hover, .nav a.active { color: var(--text); border-bottom-color: var(--cyan); }
.container { width: min(1240px, calc(100% - 48px)); margin: 38px auto 80px; }
footer { width: min(1240px, calc(100% - 48px)); margin: 0 auto; padding: 26px 0 42px; color: #63778d; font-size: .78rem; border-top: 1px solid rgba(142,163,186,.12); }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(1.75rem, 3vw, 2.6rem); letter-spacing: -.035em; }
h2 { margin-bottom: 16px; font-size: 1.1rem; }
p { color: var(--muted); line-height: 1.65; }
.eyebrow { color: var(--cyan); text-transform: uppercase; letter-spacing: .16em; font-size: .7rem; font-weight: 800; margin-bottom: 9px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.page-heading p { margin-bottom: 0; }
.title-line, .toolbar, .actions, .form-actions, .card-heading { display: flex; align-items: center; gap: 10px; }
.title-line h1 { margin: 0; }
.toolbar { flex-wrap: wrap; justify-content: flex-end; }
.card, .auth-card { border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(150deg, rgba(17,29,49,.94), rgba(10,17,29,.96)); box-shadow: var(--shadow); }
.card { padding: 22px; margin-bottom: 20px; }
.card.compact { padding: 20px 22px; }
.card-heading { justify-content: space-between; margin-bottom: 14px; }
.card-heading h2 { margin: 0; }
.auth-card { width: min(460px, calc(100% - 32px)); margin: 7vh auto; padding: 34px; }
.auth-card.wide { width: min(760px, calc(100% - 32px)); }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.stat { min-height: 140px; padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: rgba(14,22,38,.82); }
.stat span, .stat small { display: block; color: var(--muted); }
.stat strong { display: block; font-size: 2.25rem; margin: 15px 0 5px; letter-spacing: -.04em; }
.stat small { font-size: .78rem; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 9px 15px; border: 1px solid #334764; border-radius: 10px; color: var(--text); background: #17243a; cursor: pointer; font-weight: 700; font-size: .86rem; }
.button:hover { color: white; background: #20314d; }
.button.primary { color: #04131d; border-color: transparent; background: linear-gradient(135deg, var(--cyan), #67e8f9); }
.button.primary:hover { filter: brightness(1.1); }
.button.danger { border-color: var(--red); background: rgba(251,113,133,.12); color: #fecdd3; }
.button.danger-ghost { color: #fda4af; border-color: rgba(251,113,133,.35); background: transparent; }
.button.small { min-height: 32px; padding: 6px 10px; font-size: .77rem; }
.button:disabled { opacity: .45; cursor: not-allowed; }
label { display: grid; gap: 7px; color: #bdd0e2; font-size: .83rem; font-weight: 700; }
label small, .hint { color: var(--muted); font-weight: 400; font-size: .74rem; }
input, select, textarea { width: 100%; border: 1px solid #2b3d5a; border-radius: 10px; padding: 11px 12px; color: var(--text); background: #09111e; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(34,211,238,.11); }
textarea { resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; line-height: 1.5; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.span-2 { grid-column: span 2; }
.stack { display: grid; gap: 16px; }
.inline-form { display: grid; grid-template-columns: minmax(220px,2fr) minmax(180px,1fr) auto; gap: 14px; align-items: end; }
.record-form { display: grid; grid-template-columns: 110px minmax(150px,1fr) minmax(260px,3fr) 110px 110px auto; gap: 12px; align-items: end; }
.checkbox { display: flex; align-items: center; gap: 10px; }
.checkbox input { width: auto; }
.form-actions { padding-top: 4px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 25px 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 680px; }
th, td { padding: 13px 12px; text-align: left; border-bottom: 1px solid rgba(142,163,186,.12); vertical-align: middle; }
th { color: #7790a9; font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; }
td { color: #d8e6f4; font-size: .86rem; }
td small { display: block; color: var(--muted); margin-top: 4px; }
tr:last-child td { border-bottom: 0; }
.strong-link { color: var(--text); font-weight: 800; }
.mono, code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.content-cell { max-width: 420px; word-break: break-word; }
.record-type { display: inline-block; min-width: 58px; color: #a5f3fc; font-size: .72rem; font-weight: 900; letter-spacing: .08em; }
.status { display: inline-flex; padding: 5px 9px; border: 1px solid; border-radius: 999px; font-size: .68rem; font-weight: 900; letter-spacing: .05em; text-transform: uppercase; }
.status-published, .status-connected { color: var(--green); border-color: rgba(52,211,153,.34); background: rgba(52,211,153,.08); }
.status-stored, .status-unknown { color: var(--yellow); border-color: rgba(251,191,36,.34); background: rgba(251,191,36,.08); }
.status-error { color: var(--red); border-color: rgba(251,113,133,.34); background: rgba(251,113,133,.08); }
.notice { padding: 14px 16px; margin-bottom: 20px; border: 1px solid; border-radius: 12px; line-height: 1.5; }
.notice.success { color: #a7f3d0; border-color: rgba(52,211,153,.38); background: rgba(52,211,153,.09); }
.notice.error { color: #fecdd3; border-color: rgba(251,113,133,.4); background: rgba(251,113,133,.09); }
.back { display: inline-block; margin-bottom: 14px; color: var(--muted); }
.empty { padding: 35px; text-align: center; color: var(--muted); }
.split-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.danger-zone { border-color: rgba(251,113,133,.35); }
.diagnostics > div { display: grid; grid-template-columns: 90px 1fr; gap: 12px; margin: 10px 0; }
.diagnostics span { color: var(--muted); }
.diagnostics code { overflow-wrap: anywhere; }
@media (max-width: 980px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .record-form { grid-template-columns: 1fr 1fr; }
  .record-form .wide-field { grid-column: span 2; }
  .inline-form { grid-template-columns: 1fr 1fr; }
  .inline-form .button { grid-column: span 2; }
}
@media (max-width: 680px) {
  .topbar { position: static; padding: 12px 16px; }
  .account > span { display: none; }
  .nav { padding: 0 10px; }
  .container { width: min(100% - 28px, 1240px); margin-top: 26px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .stat-grid, .split-grid, .form-grid, .inline-form, .record-form { grid-template-columns: 1fr; }
  .span-2, .record-form .wide-field, .inline-form .button { grid-column: auto; }
  .toolbar { justify-content: flex-start; }
  .auth-card { margin-top: 28px; padding: 25px; }
}
