:root {
  --bg:        #0a0a0b;
  --bg1:       #111113;
  --bg2:       #17171a;
  --bg3:       #1e1e22;
  --border:    #26262b;
  --text:      #e4e4e7;
  --muted:     #71717a;
  --red:       #e50914;
  --red-mid:   #ff1a24;
  --red-lo:    rgba(229,9,20,.12);
  --green:     #22c55e;
  --green-lo:  rgba(34,197,94,.12);
  --yellow:    #f59e0b;
  --yellow-lo: rgba(245,158,11,.12);
  --blue:      #3b82f6;
  --blue-lo:   rgba(59,130,246,.12);
  --radius:    10px;
  --radius-sm: 6px;
  --font:      'Inter', system-ui, -apple-system, sans-serif;
  --sidebar-w: 232px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }

/* ── Layout ─────────────────────────────── */
.admin-layout { display: flex; min-height: 100vh; }

/* ── Sidebar ─────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg1);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
}
.sidebar-brand { padding: 20px 18px 16px; border-bottom: 1px solid var(--border); }
.sidebar-brand-name { font-size: 19px; font-weight: 800; letter-spacing: -.3px; }
.sidebar-brand-name span { color: var(--red); }
.sidebar-brand-sub { font-size: 10px; color: var(--muted); margin-top: 3px; text-transform: uppercase; letter-spacing: 1.2px; }

.sidebar-nav { padding: 10px 8px; flex: 1; }
.sidebar-section { font-size: 10px; text-transform: uppercase; letter-spacing: 1.4px; color: var(--muted); padding: 14px 10px 5px; }
.sidebar-link {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--muted); text-decoration: none;
  font-size: 13px; font-weight: 500;
  margin-bottom: 1px;
  transition: background .12s, color .12s;
}
.sidebar-link svg { width: 15px; height: 15px; flex-shrink: 0; }
.sidebar-link:hover { background: var(--bg2); color: var(--text); }
.sidebar-link.active { background: var(--red-lo); color: var(--red); }

.sidebar-footer { padding: 10px 8px; border-top: 1px solid var(--border); }
.sidebar-user { padding: 8px 10px; margin-bottom: 4px; }
.sidebar-user-name { font-size: 13px; font-weight: 600; }
.sidebar-user-role { font-size: 11px; color: var(--muted); margin-top: 1px; }
.sidebar-logout {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--muted); cursor: pointer;
  background: none; border: none; width: 100%;
  font-family: var(--font); font-size: 13px; font-weight: 500;
  transition: background .12s, color .12s;
}
.sidebar-logout svg { width: 15px; height: 15px; }
.sidebar-logout:hover { background: var(--red-lo); color: var(--red); }

/* ── Main ─────────────────────────────── */
.admin-main { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

.admin-topbar {
  background: var(--bg1); border-bottom: 1px solid var(--border);
  padding: 0 24px; height: 54px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
}
.admin-topbar-title { font-size: 14px; font-weight: 700; }
.admin-topbar-actions { display: flex; align-items: center; gap: 8px; }

.admin-content { padding: 24px; flex: 1; max-width: 1400px; }

/* ── Stat cards ─────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card { background: var(--bg1); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.stat-card-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .7px; margin-bottom: 8px; }
.stat-card-value { font-size: 30px; font-weight: 800; line-height: 1; }
.stat-card-sub { font-size: 12px; color: var(--muted); margin-top: 5px; }
.stat-card.red    .stat-card-value { color: var(--red); }
.stat-card.green  .stat-card-value { color: var(--green); }
.stat-card.blue   .stat-card-value { color: var(--blue); }
.stat-card.yellow .stat-card-value { color: var(--yellow); }

/* ── Table card ─────────────────────────────── */
.table-card { background: var(--bg1); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.table-card-head {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.table-card-title { font-size: 13px; font-weight: 700; }
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }
thead th {
  padding: 9px 14px;
  text-align: left; font-size: 10px;
  text-transform: uppercase; letter-spacing: .7px;
  color: var(--muted); font-weight: 600;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td { padding: 11px 14px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg2); }
.td-thumb { width: 44px; height: 30px; object-fit: cover; border-radius: 4px; display: block; }
.td-muted { color: var(--muted); font-size: 12px; }

/* ── Badges ─────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 7px; border-radius: 20px;
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px;
  white-space: nowrap;
}
.badge-green  { background: var(--green-lo);  color: var(--green); }
.badge-red    { background: var(--red-lo);    color: var(--red); }
.badge-yellow { background: var(--yellow-lo); color: var(--yellow); }
.badge-blue   { background: var(--blue-lo);   color: var(--blue); }
.badge-gray   { background: var(--bg3);       color: var(--muted); }

/* ── Buttons ─────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 13px; font-weight: 600;
  cursor: pointer; text-decoration: none; border: none;
  transition: opacity .12s, background .12s;
  white-space: nowrap;
}
.btn:hover { opacity: .85; }
.btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.btn-primary { background: var(--red); color: #fff; }
.btn-ghost   { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg2); opacity: 1; }
.btn-danger  { background: var(--red-lo); color: var(--red); border: 1px solid transparent; }
.btn-danger:hover { opacity: 1; background: rgba(229,9,20,.2); }
.btn-sm  { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 6px; }

/* ── Forms ─────────────────────────────── */
.form-card { background: var(--bg1); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.form-card-head { padding: 16px 22px; border-bottom: 1px solid var(--border); }
.form-card-title { font-size: 14px; font-weight: 700; }
.form-card-sub   { font-size: 12px; color: var(--muted); margin-top: 2px; }
.form-body { padding: 20px 22px; }
.form-grid   { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-full   { grid-column: 1 / -1; }
.form-actions { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.field input,
.field select,
.field textarea {
  background: var(--bg2); border: 1px solid var(--border);
  color: var(--text); font-family: var(--font); font-size: 13px;
  padding: 9px 11px; border-radius: var(--radius-sm); width: 100%;
  transition: border-color .12s;
}
.field input:focus,
.field select:focus,
.field textarea:focus { outline: none; border-color: var(--red); }
.field textarea { resize: vertical; min-height: 90px; }
.field select option { background: var(--bg2); }
.field-hint  { font-size: 11px; color: var(--muted); line-height: 1.4; }
.field-preview { width: 100%; max-height: 140px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--border); margin-top: 6px; }

/* ── Toggle ─────────────────────────────── */
.toggle-field { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); }
.toggle-field:last-child { border-bottom: none; }
.toggle-field-label { font-size: 13px; font-weight: 500; }
.toggle-field-sub   { font-size: 12px; color: var(--muted); margin-top: 1px; }
.toggle { position: relative; width: 38px; height: 21px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: var(--bg3); border-radius: 21px; cursor: pointer; transition: background .18s; border: 1px solid var(--border); }
.toggle-slider::before { content: ''; position: absolute; width: 15px; height: 15px; background: var(--muted); border-radius: 50%; top: 2px; left: 2px; transition: transform .18s, background .18s; }
.toggle input:checked + .toggle-slider { background: var(--red-lo); border-color: var(--red); }
.toggle input:checked + .toggle-slider::before { transform: translateX(17px); background: var(--red); }

/* ── Upload area ─────────────────────────────── */
.upload-area {
  border: 2px dashed var(--border); border-radius: var(--radius-sm);
  padding: 20px; text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s;
  display: block;
}
.upload-area:hover, .upload-area.dragover { border-color: var(--red); background: var(--red-lo); }
.upload-area input[type="file"] { display: none; }
.upload-area-icon { width: 28px; height: 28px; margin: 0 auto 8px; color: var(--muted); display: block; }
.upload-area-label { font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.upload-area-sub   { font-size: 11px; color: var(--muted); }

/* ── Alerts ─────────────────────────────── */
.alert { padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 18px; font-weight: 500; }
.alert-error   { background: var(--red-lo);   border: 1px solid rgba(229,9,20,.4);  color: var(--red); }
.alert-success { background: var(--green-lo); border: 1px solid rgba(34,197,94,.4); color: var(--green); }

/* ── Pagination ─────────────────────────────── */
.pagination { display: flex; align-items: center; gap: 3px; padding: 14px 18px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.page-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 30px; padding: 0 6px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 600; text-decoration: none; color: var(--muted); border: 1px solid transparent; transition: all .12s; }
.page-btn:hover { background: var(--bg2); color: var(--text); }
.page-btn.active { background: var(--red); color: #fff; }

/* ── Empty state ─────────────────────────────── */
.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-state svg { width: 36px; height: 36px; margin: 0 auto 10px; display: block; opacity: .35; }
.empty-state-title { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.empty-state-sub   { font-size: 12px; }

/* ── Auth ─────────────────────────────── */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 20px; }
.auth-card { width: 100%; max-width: 360px; background: var(--bg1); border: 1px solid var(--border); border-radius: var(--radius); padding: 36px; }
.auth-brand { text-align: center; margin-bottom: 4px; }
.auth-brand-name { font-size: 22px; font-weight: 800; }
.auth-brand-name span { color: var(--red); }
.auth-brand-sub { text-align: center; font-size: 11px; color: var(--muted); margin-bottom: 28px; text-transform: uppercase; letter-spacing: 1.2px; }
.auth-field { margin-bottom: 14px; }
.auth-field label { display: block; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; margin-bottom: 6px; }
.auth-field input { width: 100%; background: var(--bg2); border: 1px solid var(--border); color: var(--text); font-family: var(--font); font-size: 14px; padding: 10px 12px; border-radius: var(--radius-sm); transition: border-color .12s; }
.auth-field input:focus { outline: none; border-color: var(--red); }
.auth-submit { width: 100%; background: var(--red); color: #fff; border: none; height: 42px; border-radius: var(--radius-sm); font-family: var(--font); font-weight: 700; font-size: 14px; cursor: pointer; margin-top: 6px; transition: background .15s; }
.auth-submit:hover { background: #c40812; }
