@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --navy: #0B1C2C;
  --navy-light: #152840;
  --navy-border: #1e3a52;
  --green: #16a34a;
  --green-light: #dcfce7;
  --green-dark: #15803d;
  --white: #ffffff;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-400: #94a3b8;
  --gray-600: #475569;
  --gray-800: #1e293b;
  --amber: #f59e0b;
  --amber-light: #fef3c7;
  --red: #ef4444;
  --red-light: #fee2e2;
  --blue: #3b82f6;
  --blue-light: #dbeafe;
  --sidebar-width: 240px;
  --topbar-height: 60px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  min-height: 100vh;
}

/* ── AUTH PAGE ── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--navy);
}

.auth-card {
  background: var(--white);
  border-radius: 16px;
  padding: 48px 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 25px 60px rgba(0,0,0,0.3);
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
}

.auth-logo-mark {
  width: 36px;
  height: 36px;
  background: var(--green);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 16px;
}

.auth-logo-text {
  font-size: 20px;
  font-weight: 700;
  color: var(--navy);
}

.auth-logo-sub {
  font-size: 11px;
  color: var(--gray-400);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-title { font-size: 22px; font-weight: 700; color: var(--navy); margin-bottom: 6px; }
.auth-subtitle { font-size: 14px; color: var(--gray-600); margin-bottom: 28px; }

.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--gray-600); margin-bottom: 6px; }

.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  color: var(--gray-800);
  transition: border-color 0.15s;
  outline: none;
}
.form-input:focus { border-color: var(--green); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
}
.btn-primary { background: var(--green); color: white; width: 100%; padding: 12px; }
.btn-primary:hover { background: var(--green-dark); }
.btn-danger { background: var(--red-light); color: var(--red); }
.btn-danger:hover { background: #fca5a5; }
.btn-ghost { background: transparent; color: var(--gray-600); border: 1.5px solid var(--gray-200); }
.btn-ghost:hover { background: var(--gray-100); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.error-msg {
  background: var(--red-light);
  color: var(--red);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}
.error-msg.show { display: block; }

/* ── LAYOUT ── */
.layout { display: flex; min-height: 100vh; }

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--navy);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.sidebar-logo {
  padding: 20px 20px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--navy-border);
}

.logo-mark {
  width: 32px; height: 32px;
  background: var(--green);
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 14px; flex-shrink: 0;
}

.logo-text { color: white; font-weight: 700; font-size: 16px; }
.logo-badge {
  font-size: 9px; color: var(--green); font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  background: rgba(22,163,74,0.15);
  padding: 2px 6px; border-radius: 4px;
}

.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }

.nav-section-label {
  font-size: 10px; font-weight: 600; color: var(--gray-400);
  text-transform: uppercase; letter-spacing: 0.1em;
  padding: 0 8px; margin: 16px 0 6px;
}
.nav-section-label:first-child { margin-top: 0; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 8px;
  color: var(--gray-400); font-size: 13.5px; font-weight: 500;
  text-decoration: none; cursor: pointer;
  transition: all 0.15s; margin-bottom: 2px;
}
.nav-item:hover { background: var(--navy-light); color: white; }
.nav-item.active { background: rgba(22,163,74,0.15); color: var(--green); }
.nav-item svg { flex-shrink: 0; }

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--navy-border);
}

.admin-info {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px;
  margin-bottom: 8px;
}
.admin-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--green); display: flex; align-items: center;
  justify-content: center; color: white; font-weight: 700; font-size: 13px;
  flex-shrink: 0;
}
.admin-name { color: white; font-size: 13px; font-weight: 600; }
.admin-role { color: var(--gray-400); font-size: 11px; }

/* ── MAIN CONTENT ── */
.main {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--topbar-height);
  background: white;
  border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center;
  padding: 0 28px;
  position: sticky; top: 0; z-index: 50;
  gap: 16px;
}

.topbar-title { font-size: 16px; font-weight: 700; color: var(--navy); flex: 1; }
.topbar-subtitle { font-size: 13px; color: var(--gray-400); font-weight: 400; margin-left: 8px; }

.page-content { padding: 28px; flex: 1; }

/* ── KPI CARDS ── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.kpi-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  border: 1px solid var(--gray-200);
}

.kpi-label { font-size: 12px; font-weight: 500; color: var(--gray-400); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 8px; }
.kpi-value { font-size: 28px; font-weight: 700; color: var(--navy); font-family: 'JetBrains Mono', monospace; line-height: 1; margin-bottom: 6px; }
.kpi-sub { font-size: 12px; color: var(--gray-400); }
.kpi-card.accent { background: var(--navy); }
.kpi-card.accent .kpi-label { color: rgba(255,255,255,0.5); }
.kpi-card.accent .kpi-value { color: var(--green); }
.kpi-card.accent .kpi-sub { color: rgba(255,255,255,0.4); }

/* ── TABLES ── */
.card {
  background: white;
  border-radius: 12px;
  border: 1px solid var(--gray-200);
  overflow: hidden;
  margin-bottom: 24px;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap;
}

.card-title { font-size: 14px; font-weight: 600; color: var(--navy); }
.card-subtitle { font-size: 12px; color: var(--gray-400); margin-top: 2px; }

.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }
thead th {
  padding: 11px 16px;
  text-align: left;
  font-size: 11px; font-weight: 600; color: var(--gray-400);
  text-transform: uppercase; letter-spacing: 0.07em;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}
tbody td {
  padding: 13px 16px;
  font-size: 13.5px; color: var(--gray-800);
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--gray-50); }
tbody tr { cursor: pointer; }

/* ── BADGES ── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
}
.badge-green { background: var(--green-light); color: var(--green-dark); }
.badge-amber { background: var(--amber-light); color: #92400e; }
.badge-red { background: var(--red-light); color: #991b1b; }
.badge-blue { background: var(--blue-light); color: #1d4ed8; }
.badge-gray { background: var(--gray-100); color: var(--gray-600); }

/* ── SEARCH / FILTER ── */
.search-input {
  padding: 8px 12px 8px 34px;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  color: var(--gray-800);
  outline: none;
  width: 220px;
  background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") no-repeat 10px center;
}
.search-input:focus { border-color: var(--green); }

.select-filter {
  padding: 8px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  color: var(--gray-800);
  outline: none;
  background: white;
  cursor: pointer;
}
.select-filter:focus { border-color: var(--green); }

/* ── LOADING ── */
.loading-state {
  display: flex; align-items: center; justify-content: center;
  padding: 60px 20px; color: var(--gray-400); font-size: 14px; gap: 10px;
}
.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--gray-200);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  text-align: center; padding: 60px 20px; color: var(--gray-400);
}
.empty-state svg { margin-bottom: 12px; opacity: 0.4; }
.empty-state p { font-size: 14px; }

/* ── DETAIL PAGE ── */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }

.field-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--gray-100);
  font-size: 13.5px;
}
.field-row:last-child { border-bottom: none; }
.field-label { color: var(--gray-400); font-weight: 500; font-size: 12px; }
.field-value { color: var(--navy); font-weight: 600; }

.editable-field { display: flex; align-items: center; gap: 8px; }
.inline-select {
  padding: 5px 10px;
  border: 1.5px solid var(--gray-200);
  border-radius: 6px;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  color: var(--gray-800);
  background: white; cursor: pointer; outline: none;
}
.inline-select:focus { border-color: var(--green); }

.save-btn {
  padding: 5px 12px;
  background: var(--green);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
}
.save-btn:hover { background: var(--green-dark); }

/* ── TOAST ── */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--navy); color: white;
  padding: 12px 18px; border-radius: 10px;
  font-size: 13px; font-weight: 500;
  display: flex; align-items: center; gap: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  transform: translateY(80px); opacity: 0;
  transition: all 0.25s ease;
  z-index: 999;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success .toast-dot { background: var(--green); }
.toast.error .toast-dot { background: var(--red); }
.toast-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex-shrink: 0; }

/* ── BACK LINK ── */
.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--gray-400); font-weight: 500;
  text-decoration: none; margin-bottom: 20px;
  transition: color 0.15s;
}
.back-link:hover { color: var(--navy); }

/* ── MONO TEXT ── */
.mono { font-family: 'JetBrains Mono', monospace; font-size: 12px; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-200); border-radius: 3px; }