:root {
  color-scheme: dark;
  --bg: #070c16;
  --bg-soft: #0b1423;
  --panel: rgba(13, 24, 39, .78);
  --panel-strong: rgba(17, 31, 50, .92);
  --stroke: rgba(202, 214, 233, .14);
  --stroke-strong: rgba(231, 193, 111, .3);
  --text: #f4f7fb;
  --muted: #9aa8ba;
  --gold: #d8b46a;
  --champagne: #f0d99b;
  --emerald: #3bd29f;
  --blue: #5ba7ff;
  --cyan: #6ce5ff;
  --amber: #e5ac45;
  --red: #e05f68;
  --radius: 8px;
  --shadow: 0 24px 80px rgba(0, 0, 0, .38);
  --ease: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; }

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% -8%, rgba(216, 180, 106, .16), transparent 34rem),
    radial-gradient(circle at 94% 4%, rgba(91, 167, 255, .12), transparent 31rem),
    linear-gradient(135deg, #050811 0%, #081323 48%, #101219 100%);
  letter-spacing: 0;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.028) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.55), transparent 72%);
}

a { color: var(--champagne); text-decoration: none; transition: color .22s var(--ease); }
a:hover { color: #fff2c3; }

button, input, select, textarea { font: inherit; }

.admin-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  border-right: 1px solid var(--stroke);
  background: linear-gradient(180deg, rgba(10, 18, 31, .92), rgba(8, 13, 22, .74));
  backdrop-filter: blur(24px);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 10px 28px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(240, 217, 155, .34);
  border-radius: 10px;
  background: linear-gradient(145deg, rgba(216, 180, 106, .32), rgba(91, 167, 255, .12));
  box-shadow: 0 12px 38px rgba(216, 180, 106, .16);
  color: var(--champagne);
  font-weight: 800;
}

.brand-title { margin: 0; font-size: 15px; font-weight: 760; }
.brand-subtitle { margin: 3px 0 0; color: var(--muted); font-size: 12px; }

.nav-list { display: grid; gap: 8px; }
.nav-link {
  position: relative;
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: #c6d0df;
  overflow: hidden;
}
.nav-link::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  background: linear-gradient(90deg, rgba(216,180,106,.18), rgba(91,167,255,.08));
  transition: opacity .24s var(--ease);
}
.nav-link span { position: relative; }
.nav-link:hover, .nav-link.active {
  color: #fff;
  border-color: rgba(240, 217, 155, .18);
  transform: translateX(2px);
}
.nav-link:hover::before, .nav-link.active::before { opacity: 1; }
.nav-icon { width: 22px; text-align: center; color: var(--champagne); }

.admin-main { min-width: 0; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 20px 32px;
  border-bottom: 1px solid var(--stroke);
  background: rgba(7, 12, 22, .72);
  backdrop-filter: blur(22px);
}
.breadcrumb { color: var(--muted); font-size: 13px; }
.topbar-title { margin: 4px 0 0; font-size: 24px; font-weight: 760; }
.admin-pill { color: var(--text); padding: 8px 12px; border: 1px solid var(--stroke); border-radius: 999px; background: rgba(255,255,255,.04); }

.content { width: min(1540px, 100%); margin: 0 auto; padding: 32px; animation: pageIn .58s var(--ease) both; }
.page-header { display: flex; justify-content: space-between; gap: 18px; align-items: flex-end; margin-bottom: 22px; }
.eyebrow { color: var(--champagne); text-transform: uppercase; font-size: 11px; letter-spacing: .12em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(28px, 3vw, 42px); line-height: 1.04; }
h2 { font-size: 20px; }
.lead, .muted { color: var(--muted); }

.grid { display: grid; gap: 16px; }
.stats-grid { grid-template-columns: repeat(7, minmax(150px, 1fr)); }
.detail-grid { grid-template-columns: 1.15fr .85fr; align-items: start; }
.settings-grid { grid-template-columns: minmax(0, 1.15fr) minmax(280px, .85fr); align-items: start; }

.card, .table-shell, .metric {
  position: relative;
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(18, 31, 50, .78), rgba(9, 16, 28, .7));
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card::before, .table-shell::before, .metric::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(255,255,255,.09), transparent 32%, rgba(216,180,106,.06));
  opacity: .72;
}
.card { padding: 22px; }
.metric { min-height: 164px; padding: 20px; transition: transform .28s var(--ease), border-color .28s var(--ease), box-shadow .28s var(--ease); }
.metric:hover, .card.interactive:hover { transform: translateY(-4px); border-color: var(--stroke-strong); box-shadow: 0 30px 92px rgba(0,0,0,.45); }
.metric-value { position: relative; display: block; margin: 18px 0 8px; font-size: 38px; line-height: 1; font-weight: 800; color: #fff; }
.metric-label { position: relative; display: block; font-weight: 700; }
.metric-hint { position: relative; display: block; margin-top: 8px; color: var(--muted); font-size: 13px; line-height: 1.35; }
.metric-accent { position: absolute; right: 16px; top: 16px; width: 46px; height: 3px; border-radius: 999px; background: linear-gradient(90deg, var(--gold), var(--cyan)); }

.toolbar, .actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.filters { display: grid; grid-template-columns: 1.5fr repeat(3, minmax(160px, 1fr)) auto; gap: 12px; align-items: end; margin-bottom: 16px; }
label { display: block; margin-bottom: 7px; color: #d5ddeb; font-size: 13px; font-weight: 650; }
input, select, textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(202, 214, 233, .16);
  border-radius: var(--radius);
  padding: 10px 12px;
  color: var(--text);
  background: rgba(5, 10, 18, .58);
  outline: none;
  transition: border-color .22s var(--ease), box-shadow .22s var(--ease), background .22s var(--ease);
}
textarea { min-height: 150px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: rgba(216,180,106,.72); box-shadow: 0 0 0 4px rgba(216,180,106,.12); background: rgba(9, 16, 28, .86); }

.button, button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid rgba(240, 217, 155, .28);
  border-radius: var(--radius);
  padding: 10px 14px;
  color: #0d1118;
  background: linear-gradient(135deg, #f0d99b, #c99b45);
  cursor: pointer;
  font-weight: 760;
  transition: transform .2s var(--ease), filter .2s var(--ease), border-color .2s var(--ease);
}
.button:hover, button:hover { transform: translateY(-1px); filter: brightness(1.05); color: #0d1118; }
.button.secondary, button.secondary { color: var(--text); background: rgba(255,255,255,.06); border-color: var(--stroke); }
.button.ghost, button.ghost { color: #d7e3f2; background: transparent; border-color: var(--stroke); }
.button.success, button.success { background: linear-gradient(135deg, #66e8bb, #229b74); }
.button.warning, button.warning { background: linear-gradient(135deg, #f3c56c, #bb7925); }
.button.danger, button.danger, .danger.button { background: linear-gradient(135deg, #ff848b, #b62e3b); color: #fff; border-color: rgba(255, 132, 139, .3); }
.button.info, button.info { background: linear-gradient(135deg, #8be9ff, #347dd9); }

.table-shell { overflow: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 920px; }
th, td { position: relative; padding: 14px 15px; border-bottom: 1px solid rgba(202, 214, 233, .09); text-align: left; vertical-align: middle; font-size: 14px; }
th { position: sticky; top: 0; z-index: 1; color: #dbe5f2; background: rgba(11, 20, 35, .96); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
tr { transition: background .2s var(--ease); }
tbody tr:hover { background: rgba(255,255,255,.045); }
.nowrap { white-space: nowrap; }

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  color: #dce6f5;
  background: rgba(255,255,255,.055);
  font-size: 12px;
  font-weight: 760;
  white-space: nowrap;
}
.badge.success { color: #baf6df; border-color: rgba(59,210,159,.35); background: rgba(59,210,159,.12); }
.badge.danger { color: #ffd1d4; border-color: rgba(224,95,104,.38); background: rgba(224,95,104,.12); }
.badge.warning { color: #ffe4b0; border-color: rgba(229,172,69,.36); background: rgba(229,172,69,.12); }
.badge.info { color: #c8f6ff; border-color: rgba(108,229,255,.34); background: rgba(108,229,255,.11); }
.badge.muted { color: #c3cad5; background: rgba(154,168,186,.1); }

.info-list { display: grid; gap: 12px; }
.info-row { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 16px; padding-bottom: 12px; border-bottom: 1px solid rgba(202,214,233,.09); }
.info-row:last-child { border-bottom: 0; padding-bottom: 0; }
.info-row dt { color: var(--muted); }
.info-row dd { margin: 0; overflow-wrap: anywhere; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 16px; }
.stack { display: grid; gap: 16px; }
.warning-panel {
  border-color: rgba(229, 172, 69, .34);
  background: linear-gradient(135deg, rgba(229,172,69,.14), rgba(18,31,50,.72));
}
.empty-state { padding: 46px 20px; text-align: center; color: var(--muted); }
.login-shell { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.login { width: min(430px, 100%); }

.reveal { animation: blockIn .58s var(--ease) both; animation-delay: calc(var(--i, 0) * 70ms); }

@keyframes pageIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes blockIn {
  from { opacity: 0; transform: translateY(18px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
  .filters, .detail-grid, .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .admin-layout { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; }
  .nav-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar { position: relative; padding: 18px; align-items: flex-start; flex-direction: column; }
  .content { padding: 20px; }
  .page-header { align-items: flex-start; flex-direction: column; }
}
