:root {
  color-scheme: dark;
  --bg: #071421;
  --panel: #102136;
  --panel-2: #15283f;
  --line: #2f4965;
  --muted: #8fa3bb;
  --text: #f6f8fc;
  --green: #54e2ad;
  --green-dark: #123c33;
  --red: #ff7e86;
  --amber: #ffcb6b;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body { min-height: 100vh; background: radial-gradient(circle at 90% -10%, #153d46 0, transparent 38%), var(--bg); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; color: var(--muted); gap: 14px; }
.spinner { width: 34px; height: 34px; border: 3px solid #284158; border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; }
.auth-brand { padding: clamp(38px, 7vw, 100px); display: flex; flex-direction: column; justify-content: space-between; background: linear-gradient(150deg, rgba(7,20,33,.65), rgba(7,20,33,.98)), url('/gritup-splash.png') center/cover; }
.brand { display: flex; align-items: center; gap: 12px; letter-spacing: .28em; font-weight: 900; color: var(--green); }
.brand img { width: 54px; height: 54px; border-radius: 15px; }
.hero-copy { max-width: 640px; }
.eyebrow { margin: 0 0 10px; color: var(--green); font-size: 12px; font-weight: 900; letter-spacing: .22em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(42px, 6vw, 82px); line-height: .98; letter-spacing: -.055em; }
.lead { color: #b3c3d5; font-size: clamp(17px, 2vw, 22px); line-height: 1.55; max-width: 560px; }
.security-note { color: #8499b1; font-size: 13px; }
.auth-side { display: grid; place-items: center; padding: 28px; }
.auth-card { width: min(460px, 100%); background: rgba(16,33,54,.94); border: 1px solid var(--line); border-radius: 26px; padding: clamp(26px, 4vw, 42px); box-shadow: 0 32px 90px rgba(0,0,0,.35); }
.auth-card h2 { margin: 0; font-size: 31px; }
.subcopy { color: var(--muted); line-height: 1.55; margin: 10px 0 24px; }
label { display: block; color: #b8c9da; font-size: 12px; font-weight: 800; margin: 16px 0 7px; }
input, select, textarea { width: 100%; border: 1px solid #3a536e; background: #1b2d45; color: var(--text); border-radius: 13px; padding: 14px 15px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(84,226,173,.12); }
.primary, .outline, .danger, .small-btn { border: 0; border-radius: 13px; font-weight: 900; padding: 14px 18px; }
.primary { width: 100%; background: var(--green); color: #061421; margin-top: 18px; }
.primary:hover { filter: brightness(1.06); }
.outline { background: transparent; color: var(--green); border: 1px solid var(--green); }
.danger { background: transparent; color: var(--red); border: 1px solid var(--red); }
.small-btn { padding: 10px 13px; background: var(--green); color: #061421; font-size: 12px; }
.message { margin: 14px 0 0; padding: 12px; border-radius: 10px; color: #ffd3d6; background: #42232d; font-size: 13px; line-height: 1.45; }
.qr { display: block; width: 220px; height: 220px; object-fit: contain; margin: 18px auto; background: white; padding: 10px; border-radius: 16px; }
.secret { background: #0b1929; border: 1px solid var(--line); padding: 12px; border-radius: 10px; word-break: break-all; text-align: center; font-size: 12px; }
.dashboard { min-height: 100vh; display: grid; grid-template-columns: 250px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 24px 18px; border-right: 1px solid #20384e; background: rgba(7,20,33,.94); display: flex; flex-direction: column; }
.sidebar .brand { padding: 3px 7px 24px; }
.sidebar .brand img { width: 42px; height: 42px; border-radius: 11px; }
.nav { display: grid; gap: 6px; }
.nav button { border: 1px solid transparent; background: transparent; color: #91a5bb; text-align: left; padding: 12px 13px; border-radius: 11px; font-weight: 800; }
.nav button:hover { color: var(--text); background: #102136; }
.nav button.active { color: #061421; background: var(--green); }
.sidebar-foot { margin-top: auto; display: grid; gap: 10px; }
.admin-email { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; }
.main { min-width: 0; padding: 30px clamp(18px, 4vw, 52px) 60px; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 28px; }
.topbar h1 { font-size: clamp(34px, 5vw, 58px); }
.top-actions { display: flex; gap: 9px; }
.status { display: inline-flex; align-items: center; gap: 8px; color: var(--green); font-size: 11px; font-weight: 900; letter-spacing: .08em; }
.status::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 18px var(--green); }
.grid { display: grid; gap: 14px; }
.metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card { background: rgba(16,33,54,.94); border: 1px solid var(--line); border-radius: 18px; padding: 18px; }
.metric .value { font-size: 36px; font-weight: 950; margin: 10px 0 2px; }
.metric .label, .meta { color: var(--muted); font-size: 12px; }
.section-title { margin: 30px 0 12px; color: var(--green); font-size: 11px; font-weight: 950; letter-spacing: .18em; text-transform: uppercase; }
.row { display: flex; align-items: center; gap: 12px; }
.spread { justify-content: space-between; }
.list { padding: 0; overflow: hidden; }
.list-item { padding: 16px 18px; border-bottom: 1px solid #294158; }
.list-item:last-child { border-bottom: 0; }
.title { font-weight: 900; line-height: 1.35; }
.pill { display: inline-flex; padding: 6px 9px; border-radius: 999px; background: #193e37; color: var(--green); font-size: 10px; font-weight: 900; }
.pill.red { background: #49252e; color: #ffabb0; }
.pill.amber { background: #46371f; color: var(--amber); }
.search { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-bottom: 14px; }
.entity-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.entity { min-width: 0; }
.entity .title { font-size: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip { color: #bed0e3; background: #213750; border-radius: 999px; padding: 6px 9px; font-size: 10px; }
.empty { color: var(--muted); padding: 22px; text-align: center; }
.loading { opacity: .55; pointer-events: none; }
.form-grid { display: grid; grid-template-columns: 1.2fr .8fr .8fr; gap: 10px; align-items: end; }
.form-grid label { margin-top: 0; }
.note { color: #9eb0c4; line-height: 1.55; font-size: 13px; }
.warning { border-color: #725b2b; background: #2c251c; }
.mobile-menu { display: none; }
@media (max-width: 960px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand { min-height: 42vh; gap: 60px; }
  .dashboard { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 20; width: 250px; transform: translateX(-100%); transition: .2s ease; }
  .dashboard.menu-open .sidebar { transform: translateX(0); }
  .mobile-menu { display: inline-flex; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 620px) {
  .auth-brand { display: none; }
  .auth-side { min-height: 100vh; padding: 18px; }
  .main { padding-top: 20px; }
  .metrics, .entity-grid, .form-grid { grid-template-columns: 1fr; }
  .topbar { align-items: center; }
  .topbar h1 { font-size: 34px; }
  .top-actions .status { display: none; }
}
