:root {
  --navy: #0a1628;
  --navy-2: #12233a;
  --teal: #0f766e;
  --teal-2: #0d9488;
  --teal-soft: #ccfbf1;
  --bg: #eef2f6;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --ok: #059669;
  --ok-soft: #ecfdf5;
  --warn: #d97706;
  --warn-soft: #fffbeb;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.06);
  --radius: 14px;
  --sidebar-w: 260px;
  --font: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--teal); text-decoration: none; }
a:hover { color: var(--teal-2); }

/* —— App shell —— */
.admin-app {
  display: flex;
  min-height: 100vh;
  background:
    radial-gradient(900px 420px at 100% -10%, rgba(15, 118, 110, 0.08), transparent 55%),
    radial-gradient(700px 360px at 0% 100%, rgba(10, 22, 40, 0.05), transparent 50%),
    var(--bg);
}

.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--navy) 0%, #07111f 100%);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  box-shadow: 8px 0 30px rgba(10, 22, 40, 0.18);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 10px 22px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 18px;
}
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, var(--teal-2), #115e59);
  color: #fff;
  box-shadow: 0 8px 20px rgba(13, 148, 136, 0.35);
}
.brand-name { font-weight: 700; font-size: 16px; color: #fff; }
.brand-sub { font-size: 11px; color: #94a3b8; margin-top: 2px; letter-spacing: 0.04em; text-transform: uppercase; }

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 10px;
  color: #cbd5e1;
  font-weight: 500;
  font-size: 14px;
  transition: background .15s ease, color .15s ease;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-item.is-active {
  background: rgba(13, 148, 136, 0.22);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--teal-2);
}
.nav-ico {
  width: 20px;
  height: 20px;
  display: inline-flex;
  flex-shrink: 0;
}
.nav-ico svg { width: 20px; height: 20px; }

.sidebar-foot {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
}
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(13, 148, 136, 0.25);
  color: #99f6e4;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
}
.user-name { font-size: 13px; font-weight: 600; color: #fff; }
.user-role { font-size: 11px; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.04em; }
.nav-item.logout { color: #94a3b8; }

.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 28px;
  background: rgba(238, 242, 246, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
}
.topbar-title h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.topbar-actions { margin-left: auto; display: flex; gap: 8px; }
.icon-btn {
  display: none;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 10px;
  width: 40px;
  height: 40px;
  cursor: pointer;
  font-size: 18px;
}
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 22, 40, 0.45);
  z-index: 35;
}

.content {
  padding: 8px 28px 36px;
}

/* —— Cards / stats —— */
.page-intro {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.page-intro .lede {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  max-width: 520px;
}
.page-intro .meta {
  font-size: 13px;
  color: var(--muted);
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.stat::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--teal);
}
.stat .n {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.stat .l {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}
.stat .hint {
  margin-top: 10px;
  font-size: 12px;
  color: var(--teal);
  font-weight: 600;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.card-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.card-head .muted { margin: 0; }

.panel-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

.quick-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.quick-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #f8fafc;
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  transition: border-color .15s ease, background .15s ease;
}
.quick-action:hover {
  border-color: #99f6e4;
  background: var(--teal-soft);
  color: var(--navy);
}
.quick-action span {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.status-pill.ok { background: var(--ok-soft); color: var(--ok); }
.status-pill.warn { background: var(--warn-soft); color: var(--warn); }
.status-pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

/* —— Forms / buttons —— */
.muted { color: var(--muted); font-size: 14px; }
label { display: block; margin: 14px 0 6px; font-size: 13px; font-weight: 600; color: #334155; }
input, textarea, select {
  width: 100%;
  padding: 11px 13px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font: inherit;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: #5eead4;
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}
textarea { min-height: 180px; resize: vertical; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 10px;
  padding: 11px 16px;
  background: var(--teal);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s ease, transform .1s ease;
}
.btn:hover { background: var(--teal-2); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn.secondary {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn.secondary:hover { background: #f8fafc; color: var(--text); }
.btn.danger { background: var(--danger); }
.btn.btn-sm { padding: 8px 12px; font-size: 13px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

.alert {
  padding: 12px 14px;
  border-radius: 10px;
  margin: 0 0 16px;
  font-size: 14px;
}
.alert.error { background: var(--danger-soft); color: #991b1b; border: 1px solid #fecaca; }
.alert.ok { background: var(--ok-soft); color: #065f46; border: 1px solid #a7f3d0; }

/* —— Tables —— */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
th, td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
th {
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #f8fafc;
}
tbody tr:hover td { background: #f8fafc; }
.row-meta {
  color: var(--muted);
  font-size: 12px;
  padding-top: 0 !important;
  border-bottom-color: var(--border);
}
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: #e2e8f0;
  color: #334155;
}
.badge.published { background: var(--ok-soft); color: var(--ok); }
.badge.draft { background: var(--warn-soft); color: var(--warn); }
.badge.admin { background: #ecfeff; color: #0e7490; }
.badge.editor { background: #eff6ff; color: #1d4ed8; }
.badge.yes { background: var(--ok-soft); color: var(--ok); }
.badge.no { background: #f1f5f9; color: #64748b; }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.empty-state {
  text-align: center;
  padding: 36px 16px;
  color: var(--muted);
}

/* —— Login —— */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(145deg, #0a1628 0%, #12233a 45%, #0f766e 140%);
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 18px;
  padding: 28px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.35);
}
.login-card h1 {
  margin: 0 0 6px;
  font-size: 24px;
  letter-spacing: -0.02em;
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.login-brand .brand-mark { width: 44px; height: 44px; }

/* Legacy wrap for any leftover pages */
.wrap { max-width: 1100px; margin: 0 auto; padding: 24px; }
.nav { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }

@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .sidebar {
    transform: translateX(-105%);
    transition: transform .2s ease;
  }
  .sidebar.is-open { transform: translateX(0); }
  .main { margin-left: 0; }
  .icon-btn { display: inline-grid; place-items: center; }
  .content { padding: 8px 16px 28px; }
  .topbar { padding: 14px 16px; }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .stats { grid-template-columns: 1fr; }
}
