/* Admin UI: boot screen, login, app shell (topbar + sidebar + main). */

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  background: var(--bg-deep);
  color: var(--paper);
  font-family: var(--font-sans);
  font-weight: 300;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--gold-400); text-decoration: none; }
a:hover { color: var(--gold-500); }
button { font-family: inherit; }
code { font-family: var(--font-mono); font-size: 0.85em; color: var(--gold-400); }

/* ---------- boot screen ---------- */
.boot-screen {
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 1.5rem;
}
.brand-mark {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.8rem;
  letter-spacing: 0.02em;
}
.brand-mark .dot { color: var(--gold-500); margin: 0 0.4rem; }
.boot-spinner {
  width: 32px; height: 32px;
  border: 2px solid var(--line);
  border-top-color: var(--gold-500);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- login ---------- */
.login {
  min-height: 100vh;
  display: grid; place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(ellipse 50% 40% at 50% 30%, rgba(201,168,76,0.10), transparent 70%),
    var(--bg-deep);
}
.login-card {
  width: 100%; max-width: 380px;
  background: var(--navy-900);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 2rem 1.8rem;
  display: flex; flex-direction: column; gap: 1.1rem;
}
.login-card h1 {
  font-family: var(--font-serif);
  font-weight: 700; font-size: 1.5rem;
}
.login-card .sub {
  color: var(--paper-dim); font-size: 0.88rem;
}
.field {
  display: flex; flex-direction: column; gap: 0.35rem;
}
.field label {
  font-size: 0.78rem; color: var(--paper-dim);
  text-transform: uppercase; letter-spacing: 0.12em;
}
.field input {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--paper);
  padding: 0.65rem 0.8rem;
  font: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.field input:focus { border-color: var(--gold-500); }
.btn {
  background: var(--gold-500);
  color: var(--bg-deep);
  border: none;
  border-radius: 6px;
  font-weight: 600;
  padding: 0.7rem 1rem;
  cursor: pointer;
  transition: background 0.15s;
}
.btn:hover { background: var(--gold-400); }
.btn:disabled { background: rgba(201,168,76,0.4); cursor: not-allowed; }
.btn.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--paper);
}
.btn.btn-ghost:hover { background: rgba(255,255,255,0.04); border-color: var(--gold-500); }
.errmsg {
  color: var(--red); font-size: 0.85rem;
  background: rgba(248,113,113,0.07);
  border-left: 3px solid var(--red);
  padding: 0.55rem 0.7rem;
  border-radius: 0 4px 4px 0;
}

/* ---------- app shell: topbar + sidebar + main ---------- */
.shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  grid-template-rows: 56px 1fr;
  grid-template-areas: "topbar topbar" "sidebar main";
  min-height: 100vh;
}
.topbar {
  grid-area: topbar;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.4rem;
  background: rgba(5,8,24,0.85);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}
.topbar .brand {
  font-family: var(--font-serif); font-weight: 700; font-size: 1.1rem;
}
.topbar .brand .dot { color: var(--gold-500); margin: 0 0.3rem; }
.topbar .brand .scope { color: var(--paper-dim); font-weight: 400; font-size: 0.9rem; margin-left: 0.5rem; }
.user-chip {
  display: flex; align-items: center; gap: 0.7rem;
  font-size: 0.85rem; color: var(--paper-dim);
}
.user-chip .email { color: var(--paper); }

.sidebar {
  grid-area: sidebar;
  border-right: 1px solid var(--line);
  background: rgba(10,14,42,0.5);
  padding: 1.4rem 0.8rem;
  display: flex; flex-direction: column; gap: 0.2rem;
}
.sidebar a.nav {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.55rem 0.8rem;
  border-radius: 6px;
  font-size: 0.92rem;
  color: var(--paper-dim);
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}
.sidebar a.nav:hover { background: rgba(255,255,255,0.04); color: var(--paper); }
.sidebar a.nav.active {
  background: rgba(201,168,76,0.08);
  color: var(--gold-400);
  border: 1px solid var(--line);
  padding: calc(0.55rem - 1px) calc(0.8rem - 1px);
}
.sidebar .nav-section {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--paper-dim);
  padding: 1.1rem 0.8rem 0.4rem;
}

.main {
  grid-area: main;
  padding: 1.8rem 2rem;
  overflow-y: auto;
}

/* ---------- headings + content ---------- */
.page-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 1.6rem; gap: 1rem;
}
.page-title {
  font-family: var(--font-serif);
  font-weight: 700; font-size: 1.7rem;
  letter-spacing: -0.005em;
}
.page-sub { color: var(--paper-dim); font-size: 0.92rem; }

/* ---------- KPI cards ---------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0.9rem;
  margin-bottom: 1.8rem;
}
.kpi {
  background: var(--navy-900);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.1rem 1.2rem;
}
.kpi .label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--paper-dim);
  margin-bottom: 0.5rem;
}
.kpi .value {
  font-family: var(--font-serif); font-weight: 700;
  font-size: 2rem; color: var(--gold-500);
  font-variant-numeric: tabular-nums; line-height: 1;
}
.kpi .meta { color: var(--paper-dim); font-size: 0.78rem; margin-top: 0.5rem; }

/* ---------- table ---------- */
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  background: rgba(10,14,42,0.45);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.tbl thead th {
  background: rgba(10,14,42,0.85);
  color: var(--paper-dim);
  font-weight: 500;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
}
.tbl tbody td {
  padding: 0.85rem 1rem;
  border-top: 1px dashed rgba(255,255,255,0.05);
  font-variant-numeric: tabular-nums;
}
.tbl tbody tr:first-child td { border-top: none; }
.tbl tbody tr:hover { background: rgba(255,255,255,0.02); }
.tbl .num { text-align: right; }
.tbl .code-cell { font-family: var(--font-mono); color: var(--gold-400); }

/* ---------- pill / chip ---------- */
.chip {
  display: inline-block;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 500;
  border: 1px solid var(--line);
}
.chip.ok { color: var(--green); border-color: rgba(74,222,128,0.4); background: rgba(74,222,128,0.05); }
.chip.warn { color: var(--red); border-color: rgba(248,113,113,0.4); background: rgba(248,113,113,0.05); }
.chip.muted { color: var(--paper-dim); }

/* ---------- empty / loading ---------- */
.empty {
  padding: 3rem 2rem;
  text-align: center;
  color: var(--paper-dim);
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.loading {
  display: flex; align-items: center; gap: 0.6rem;
  color: var(--paper-dim);
  font-size: 0.88rem;
}
.loading::before {
  content: '';
  width: 14px; height: 14px;
  border: 2px solid var(--line);
  border-top-color: var(--gold-500);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  .shell { grid-template-columns: 1fr; grid-template-areas: "topbar" "main"; }
  .sidebar { display: none; }
  .main { padding: 1rem; }
}
