:root {
  --navy: #080d16;
  --navy-2: #0c1320;
  --gold: #c9a227;
  --gold-2: #e4c878;
  --panel: #121a2a;
  --line: rgba(201, 162, 39, .16);
  --ink: #ece7dc;
  --muted: #9a9488;
}
* { box-sizing: border-box; }
body.admin-body {
  margin: 0;
  background:
    radial-gradient(1200px 400px at 80% -10%, rgba(201,162,39,.08), transparent 50%),
    var(--navy-2);
  color: var(--ink);
  font-family: Outfit, system-ui, sans-serif;
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
  width: 100%;
  max-width: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
.row > * { min-width: 0; }
a { color: var(--gold-2); text-decoration: none; }
a:hover { color: #fff; }

.sidebar {
  width: 268px;
  background: #090f1a;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 30;
}
.sidebar .brand {
  padding: 22px 18px 18px;
  border-bottom: 1px solid var(--line);
  display: block;
}
.sidebar .brand img { height: 40px; width: auto; max-width: 100%; }
.sidebar .brand small {
  display: block;
  color: var(--gold);
  font-style: italic;
  font-size: 11px;
  margin-top: 6px;
}
.side-nav { padding: 10px 10px 18px; overflow: auto; flex: 1; }
.nav-label {
  font-size: 10px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: #6f6a62;
  padding: 14px 12px 6px;
  font-weight: 600;
}
.side-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #cfc8ba;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 500;
  position: relative;
}
.side-nav a span { flex: 1; }
.side-nav a i { width: 18px; color: var(--gold); font-size: 15px; }
.side-nav a:hover { background: rgba(201,162,39,.1); color: #fff; }
.side-nav a.active {
  background: linear-gradient(90deg, rgba(201,162,39,.2), rgba(201,162,39,.06));
  color: #fff;
}
.side-nav a.active::before {
  content: "";
  position: absolute;
  left: 0; top: 8px; bottom: 8px; width: 3px;
  border-radius: 99px;
  background: var(--gold);
}
.nav-badge {
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 99px;
  background: var(--gold);
  color: #1a1408;
  font-size: 11px;
  font-weight: 700;
  display: inline-grid;
  place-items: center;
}
.side-foot { padding: 12px 14px 16px; border-top: 1px solid var(--line); font-size: 13px; }
.side-foot a { display: flex; align-items: center; gap: 8px; color: #cfc8ba; }
.side-foot a:hover { color: var(--gold-2); }

.admin-main { flex: 1; min-width: 0; }
.admin-top {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 19, 34, .92);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.admin-top h1 {
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(18px, 2.4vw, 26px);
  margin: 0;
  line-height: 1.1;
  overflow-wrap: anywhere;
}
.top-title { min-width: 0; flex: 1; }
.top-title small { color: var(--muted); font-size: 12px; display: block; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.btn-icon {
  width: 40px; height: 40px;
  border: 1px solid var(--line);
  background: transparent;
  color: #fff;
  border-radius: 10px;
}
.top-ico {
  width: 40px; height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  display: grid; place-items: center;
  color: #ddd6c8;
  position: relative;
  background: rgba(255,255,255,.03);
}
.top-ico:hover { color: var(--gold-2); border-color: var(--gold); }
.top-ico span {
  position: absolute; top: -4px; right: -4px;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 99px;
  background: #c0392b;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: grid; place-items: center;
}
.user-chip { display: flex; gap: 10px; align-items: center; font-size: 13px; }
.user-chip small { color: var(--muted); }
.user-ava {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(180deg, var(--gold-2), #9a7b32);
  color: #1a1408;
  font-weight: 700;
}
.admin-content { padding: 24px; }
.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 25;
}

.card, .table { --bs-table-bg: transparent; }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 18px 12px;
  height: 100%;
  box-shadow: 0 12px 32px rgba(0,0,0,.12);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
}
.panel-head h5, .panel h5 {
  font-family: Outfit, sans-serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .04em;
  margin: 0 0 10px;
}
.panel-head h5 { margin: 0; }
.panel-head a { font-size: 12px; color: var(--gold); }
.kpi {
  display: block;
  background: linear-gradient(180deg, #151e30, #101827);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 16px 14px;
  height: 100%;
  color: inherit;
  transition: transform .2s, border-color .2s;
}
a.kpi:hover { transform: translateY(-3px); border-color: var(--gold); color: inherit; }
.kpi .n { font-size: 26px; font-weight: 600; color: var(--gold); line-height: 1.15; }
.kpi .l { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-top: 4px; }
.kpi-ico {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: rgba(201,162,39,.12);
  color: var(--gold);
  margin-bottom: 10px;
}
.kpi-ok .kpi-ico { background: rgba(46, 204, 113, .12); color: #6fdc9a; }
.kpi-info .kpi-ico { background: rgba(90, 170, 220, .12); color: #8ec8ea; }
.kpi-warn .kpi-ico { background: rgba(230, 176, 70, .12); color: #f0c36a; }
.kpi-wide .n { font-size: 22px; }
.kpi-hint { display: block; font-size: 11px; color: var(--muted); margin-top: 6px; }

.dash-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
  padding: 8px 2px 4px;
}
.dash-hero h2 {
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(26px, 3vw, 36px);
  margin: 4px 0 6px;
}
.dash-hero .eyebrow {
  color: var(--gold);
  letter-spacing: .18em;
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 600;
}
.dash-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.stat-tile {
  display: flex; align-items: center; gap: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 18px;
  height: 100%;
  color: inherit;
}
.stat-tile:hover { border-color: var(--gold); color: inherit; }
.stat-tile i { font-size: 22px; color: var(--gold); }
.stat-tile strong { display: block; font-size: 22px; line-height: 1.1; }
.stat-tile span { font-size: 12px; color: var(--muted); }
.stat-tile.is-warn i, .stat-tile.is-warn strong { color: #f0c36a; }
.alert-row {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,.05);
  color: #ddd6c8;
  font-size: 13px;
}
.alert-row:last-child { border-bottom: 0; }
.empty-cell { color: var(--muted) !important; padding: 16px 8px !important; }

.table { color: var(--ink); }
.table > :not(caption) > * > * { background: transparent; color: var(--ink); border-color: #243044; }
.table thead th {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-weight: 600;
  border-bottom-color: var(--line) !important;
}
.table tbody tr:hover td { background: rgba(255,255,255,.02); }
.form-control, .form-select {
  background: #0e1624; border-color: #2a3548; color: #f4efe4; border-radius: 10px; min-height: 42px;
}
.form-control:focus, .form-select:focus {
  background: #0e1624; color: #fff; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,162,39,.15);
}
.form-label { font-size: 12px; color: var(--muted); }
.btn-gold {
  background: linear-gradient(180deg, #e4c878, #9a7b32);
  color: #1a1408 !important;
  border: 0;
  font-weight: 600;
  border-radius: 999px;
  padding: .55rem 1.1rem;
}
.btn-gold:hover { filter: brightness(1.06); color: #1a1408 !important; }
.btn-outline-gold { border: 1px solid var(--gold); color: var(--gold); border-radius: 999px; background: transparent; }
.btn-outline-gold:hover { background: rgba(201,162,39,.12); color: var(--gold-2); }
.btn-ghost-admin {
  border: 1px solid var(--line);
  color: #ddd6c8;
  border-radius: 999px;
  background: transparent;
  padding: .55rem 1.1rem;
  font-weight: 600;
  font-size: 13px;
}
.btn-ghost-admin:hover { border-color: var(--gold); color: var(--gold-2); }
.gold { color: var(--gold) !important; }
.page-link { background: #121a2a; border-color: #2a3548; color: #ddd; }
.page-item.active .page-link { background: var(--gold); border-color: var(--gold); color: #1a1408; }
.alert { border-radius: 12px; border: 0; }
.alert-success { background: rgba(46,204,113,.12); color: #b7f0cc; }
.alert-danger { background: rgba(192,57,43,.16); color: #f5c6c2; }
.badge { font-weight: 600; }

.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}
.table-responsive .table,
.panel > table {
  min-width: 640px;
}
.table img { max-width: 64px; height: auto; }
.admin-content img, .admin-content canvas { max-width: 100%; }
.chart-wrap { position: relative; width: 100%; max-width: 100%; overflow: hidden; }
.alert-row { flex-wrap: wrap; }
.fc { max-width: 100%; overflow: hidden; }
.fc .fc-toolbar { flex-wrap: wrap; gap: 8px; }
.fc .fc-toolbar-title { font-size: clamp(1rem, 3vw, 1.4rem); }
.fc .fc-scrollgrid, .fc table { width: 100% !important; }
.btn, .btn-icon { touch-action: manipulation; }

.auth-body { min-height: 100vh; display: grid; place-items: center; background:
  linear-gradient(160deg, rgba(11,18,32,.92), rgba(11,18,32,.75)),
  url('https://images.unsplash.com/photo-1492144534655-ae79c964c9d7?auto=format&fit=crop&w=1600&q=80') center/cover;
  padding: 24px 16px;
}
.auth-card { width: min(420px, 100%); background: rgba(10,16,28,.94); border: 1px solid rgba(201,162,39,.28); padding: 40px; border-radius: 18px; box-shadow: 0 24px 60px rgba(0,0,0,.35); }
.auth-card h1 { font-family: "Cormorant Garamond", serif; letter-spacing: .1em; }

@media (max-width: 1199.98px) {
  .kpi .n { font-size: 22px; }
}

@media (max-width: 991px) {
  body.admin-body { display: block; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: min(280px, 86vw);
    height: 100dvh;
    z-index: 40;
    transform: translateX(-105%);
    transition: transform .22s ease;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .sidebar.open { transform: translateX(0); left: 0; }
  body.sidebar-open { overflow: hidden; }
  body.sidebar-open .sidebar-backdrop { display: block; }
  .admin-top { padding: 12px 14px; flex-wrap: nowrap; gap: 10px; }
  .admin-content { padding: 16px 12px; }
  .user-chip span:last-child { display: none; }
  .dash-hero h2 { font-size: 22px; }
  .panel { padding: 14px 12px 10px; }
  .form-control, .form-select, textarea.form-control { font-size: 16px; min-height: 44px; }
  .admin-logout { padding: .3rem .7rem; }
}

@media (max-width: 575.98px) {
  .admin-top { padding: 10px 10px; }
  .top-title small { display: none; }
  .admin-top h1 { font-size: 17px; }
  .top-ico, .btn-icon { width: 36px; height: 36px; }
  .user-chip { display: none; }
  .dash-hero { margin-bottom: 16px; }
  .dash-actions { width: 100%; }
  .dash-actions .btn { flex: 1 1 100%; text-align: center; }
  .kpi { padding: 12px 10px 10px; }
  .kpi .n { font-size: 20px; }
  .kpi-wide .n { font-size: 18px; word-break: break-word; }
  .stat-tile { padding: 12px; }
  .auth-card { padding: 28px 20px; }
  .fc .fc-button { padding: .25em .45em; font-size: .8em; }
  .top-actions { gap: 6px; }
}

@media (max-width: 399.98px) {
  .admin-content { padding: 12px 8px; }
  .kpi .l { font-size: 10px; letter-spacing: .04em; }
}
