:root {
  color-scheme: dark;
  --bg: #050811;
  --sidebar: #080d1a;
  --surface: #0c1324;
  --surface-2: #111b31;
  --border: rgba(148, 163, 184, 0.14);
  --text: #f8fafc;
  --muted: #94a3b8;
  --subtle: #64748b;
  --brand: #489bd4;
  --brand-bright: #67b8f0;
  --brand-deep: #1d3b78;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 12px;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.admin-shell {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 15px;
}

.sidebar-brand img {
  height: 28px;
  width: auto;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 9px;
  color: var(--muted);
  font-weight: 500;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.nav-item.active {
  background: rgba(72, 155, 212, 0.15);
  color: #ffffff;
  border: 1px solid rgba(72, 155, 212, 0.25);
}

.nav-pill {
  background: var(--brand);
  color: #050811;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

.sidebar-footer {
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Main */
.admin-main {
  padding: 28px 34px;
  max-width: 1240px;
  width: 100%;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.topbar h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 24px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
}

/* Cards & Grids */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}

.card-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.kpi-label {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.kpi-val {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 30px;
  font-weight: 700;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}

.kpi-sub {
  font-size: 12px;
  color: var(--brand-bright);
  margin-top: 4px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-deep));
  color: #fff;
  border-color: rgba(103, 184, 240, 0.35);
}

.btn-primary:hover { filter: brightness(1.1); }

.btn-ghost {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border);
  color: var(--text);
}

.btn-ghost:hover { background: rgba(255, 255, 255, 0.08); }

.btn-danger {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

.btn-danger:hover { background: rgba(239, 68, 68, 0.22); }

.btn-sm { padding: 6px 11px; font-size: 12px; }

/* Forms */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 6px;
}

.input, .select, .textarea {
  width: 100%;
  background: #060b16;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
}

.select { background-color: #060b16; color: #f8fafc; }

.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--brand);
}

.textarea { min-height: 110px; resize: vertical; }

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13.5px;
}

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
th {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--subtle);
  font-weight: 600;
}

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
}

.badge-new { background: rgba(72, 155, 212, 0.18); color: #7dd3fc; }
.badge-contacted { background: rgba(245, 158, 11, 0.16); color: #fcd34d; }
.badge-qualified, .badge-published, .badge-ok { background: rgba(34, 197, 94, 0.16); color: #86efac; }
.badge-archived, .badge-draft { background: rgba(148, 163, 184, 0.14); color: #94a3b8; }
.badge-err { background: rgba(239, 68, 68, 0.16); color: #fca5a5; }

.alert {
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 18px;
  font-size: 13.5px;
}
.alert-success { background: rgba(34, 197, 94, 0.12); border: 1px solid rgba(34, 197, 94, 0.35); color: #86efac; }
.alert-error { background: rgba(239, 68, 68, 0.12); border: 1px solid rgba(239, 68, 68, 0.35); color: #fca5a5; }

.thumb-sm {
  width: 60px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #060b16;
}

.preview-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 18px;
  background: #060b16;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 10px;
}

.preview-box img { max-height: 48px; width: auto; }

/* Login screen */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(50% 50% at 50% 0%, rgba(72, 155, 212, 0.18), transparent 70%),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
}

@media (max-width: 900px) {
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    padding: 14px 16px;
  }
  .sidebar-brand {
    padding: 2px 0 12px;
    margin-bottom: 10px;
  }
  .nav-menu {
    flex-direction: row;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 6px;
    padding-bottom: 4px;
  }
  .nav-menu::-webkit-scrollbar { display: none; }
  .nav-item {
    white-space: nowrap;
    flex-shrink: 0;
    padding: 8px 12px;
    gap: 6px;
  }
  .sidebar-footer {
    flex-direction: row;
    padding-top: 10px;
    margin-top: 8px;
  }
  .sidebar-footer > * { flex: 1; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .admin-main { padding: 18px 16px; }
  .input, .select, .textarea { font-size: 16px; }
}
