:root {
  --bg-obsidian: #161213;
  --bg-sidebar: #1D1719;
  --burgundy: #6E0D10;
  --crimson: #93161B;
  --gold: #C69C53;
  --surface: #FFFFFF;
  --canvas: #F4F2F0;
  --border: #E2DDD9;
  --text: #1B1918;
  --muted: #696461;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', system-ui, -apple-system, sans-serif; background: var(--canvas); color: var(--text); min-height: 100vh; }

/* Login Gate */
.login-screen {
  min-height: 100vh;
  background: radial-gradient(circle at top, #3A0E11 0%, #161213 70%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  background: #fff;
  width: 100%;
  max-width: 430px;
  border-radius: 16px;
  padding: 34px;
  box-shadow: 0 25px 60px rgba(0,0,0,0.45);
  text-align: center;
}
.login-card img { width: 78px; height: 78px; object-fit: contain; margin-bottom: 12px; }

/* App Shell */
.admin-shell {
  display: grid;
  grid-template-columns: 270px 1fr;
  min-height: 100vh;
}
.sidebar {
  background: var(--bg-obsidian);
  color: #EAE5E3;
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 16px;
}
.sidebar-brand img {
  width: 46px;
  height: 46px;
  background: #fff;
  border-radius: 50%;
  padding: 2px;
}
.nav-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: #CFC9C6;
  padding: 11px 13px;
  border-radius: 9px;
  font-size: 0.87rem;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.18s;
}
.nav-item:hover { background: rgba(255,255,255,0.07); color: #fff; }
.nav-item.active { background: var(--burgundy); color: #fff; font-weight: 600; }

.main-area {
  padding: 26px 32px;
  overflow-x: auto;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.kpi-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
}
.kpi-card span { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; font-weight: 600; letter-spacing: 0.04em; }
.kpi-card strong { display: block; font-size: 1.5rem; margin-top: 6px; color: var(--bg-obsidian); font-variant-numeric: tabular-nums; }
.kpi-card small { color: var(--burgundy); font-size: 0.78rem; font-weight: 600; }

.panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  margin-bottom: 22px;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}
.panel-head h3 { font-size: 1.08rem; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.form-grid .full { grid-column: 1 / -1; }
label.lbl { display: block; font-size: 0.8rem; font-weight: 600; margin-bottom: 5px; color: #3A3634; }
.inp, .sel, textarea.inp {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #D3CEC9;
  border-radius: 8px;
  font-size: 0.88rem;
  font-family: inherit;
}
.btn {
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-primary { background: var(--burgundy); color: #fff; }
.btn-primary:hover { background: var(--crimson); }
.btn-outline { background: #fff; border-color: var(--border); color: var(--text); }
.btn-outline:hover { background: #F7F5F3; }
.btn-danger { background: #FEE2E2; color: #991B1B; }

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
table.data-table th, table.data-table td {
  text-align: left;
  padding: 11px 10px;
  border-bottom: 1px solid #EFECE9;
  vertical-align: middle;
}
table.data-table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: #FAF8F6;
}
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.73rem;
  font-weight: 700;
}
.badge-pub { background: #DCFCE7; color: #166534; }
.badge-hid { background: #F3F4F6; color: #4B5563; }
.badge-warn { background: #FEF3C7; color: #92400E; }

pre.code-box {
  background: #161213;
  color: #F4E6C8;
  padding: 14px;
  border-radius: 10px;
  font-size: 0.78rem;
  overflow-x: auto;
  line-height: 1.5;
}

@media (max-width: 900px) {
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar { height: auto; position: static; }
  .form-grid { grid-template-columns: 1fr; }
}
