/* ── Reset & Tokens ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:   #003958;
  --accent:    #0E7FC0;
  --bg:        #F0F4F8;
  --surface:   #FFFFFF;
  --border:    #E2E8F0;
  --text:      #0F172A;
  --text-2:    #64748B;
  --text-3:    #94A3B8;
  --blue:      #3B82F6;
  --green:     #22C55E;
  --orange:    #F59E0B;
  --red:       #EF4444;
  --purple:    #8B5CF6;
  --teal:      #14B8A6;
  --sidebar-w: 240px;
  --topbar-h:  60px;
  --radius:    10px;
}

body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
a { text-decoration: none; color: inherit; cursor: pointer; }
button { cursor: pointer; font-family: inherit; border: none; outline: none; }
input, select { font-family: inherit; }

/* ── Login ──────────────────────────────────────────────────────── */
.login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #003958 0%, #0E5A80 50%, #1a7aa8 100%);
}
.login-card {
  background: var(--surface); border-radius: 20px; padding: 40px;
  width: 100%; max-width: 400px; box-shadow: 0 24px 60px rgba(0,0,0,.2);
}
.login-logo { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.login-logo img { width: 52px; height: 52px; border-radius: 14px; }
.login-logo h1 { font-size: 22px; font-weight: 800; color: var(--primary); }
.login-logo span { font-size: 12px; color: var(--text-2); font-weight: 500; }
.login-sub { color: var(--text-2); font-size: 13px; margin-bottom: 24px; }
.login-error { background: #FEF2F2; border: 1px solid #FECACA; color: var(--red);
  padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; }
.btn-google {
  width: 100%; padding: 12px; border-radius: 10px; border: 1.5px solid var(--border);
  background: var(--surface); display: flex; align-items: center; justify-content: center;
  gap: 10px; font-size: 14px; font-weight: 500; color: var(--text);
  transition: border-color .2s, box-shadow .2s; margin-bottom: 16px;
}
.btn-google:hover { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(14,127,192,.08); }
.login-divider { text-align: center; position: relative; margin: 16px 0; }
.login-divider::before { content: ''; position: absolute; top: 50%; left: 0; right: 0; height: 1px; background: var(--border); }
.login-divider span { background: var(--surface); padding: 0 10px; color: var(--text-3); font-size: 12px; position: relative; }
.form-group { margin-bottom: 12px; }
.form-input {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 14px; background: #F8FAFC; transition: border-color .2s;
}
.form-input:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.btn-primary {
  width: 100%; padding: 12px; background: var(--primary); color: #fff;
  border-radius: 10px; font-size: 14px; font-weight: 600;
  transition: background .2s; margin-top: 4px;
}
.btn-primary:hover { background: var(--accent); }

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

/* ── Sidebar ────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w); background: var(--primary); color: #fff;
  display: flex; flex-direction: column; position: fixed;
  top: 0; left: 0; height: 100vh; z-index: 100;
  transition: transform .3s;
}
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px; border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-logo img { width: 36px; height: 36px; border-radius: 10px; background: #fff; padding: 2px; }
.sidebar-logo-title { display: block; font-size: 15px; font-weight: 800; }
.sidebar-logo-sub { display: block; font-size: 10px; color: rgba(255,255,255,.5); font-weight: 500; letter-spacing: .5px; text-transform: uppercase; }

.sidebar-nav { flex: 1; padding: 12px 8px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 8px; color: rgba(255,255,255,.65); font-size: 13.5px; font-weight: 500;
  transition: all .15s; margin-bottom: 2px; position: relative;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.15); color: #fff; }
.nav-item .badge {
  margin-left: auto; background: var(--red); color: #fff;
  font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 20px; min-width: 18px; text-align: center;
}

.sidebar-user {
  display: flex; align-items: center; gap: 8px; padding: 14px 12px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-info span:first-child { display: block; font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

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

/* ── Topbar ─────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h); background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; padding: 0 20px;
  position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-size: 16px; font-weight: 700; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.topbar-time { font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }

/* ── Toast ──────────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 24px; right: 24px; padding: 12px 18px;
  border-radius: 10px; font-size: 13.5px; font-weight: 500; z-index: 9999;
  box-shadow: 0 4px 20px rgba(0,0,0,.15);
}
.toast--info    { background: var(--primary); color: #fff; }
.toast--success { background: var(--green); color: #fff; }
.toast--error   { background: var(--red); color: #fff; }

/* ── Pages ──────────────────────────────────────────────────────── */
.page { display: none; padding: 24px; }
.page.active { display: block; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.page-header h2 { font-size: 20px; font-weight: 700; }
.page-sub { font-size: 12px; color: var(--text-2); }
.page-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ── Stats ──────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px,1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card {
  background: var(--surface); border-radius: var(--radius); padding: 18px;
  display: flex; align-items: center; gap: 14px;
  border: 1px solid var(--border); box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.stat-card-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.stat-card-icon.blue   { background:#EFF6FF; color:var(--blue); }
.stat-card-icon.green  { background:#F0FDF4; color:var(--green); }
.stat-card-icon.orange { background:#FFFBEB; color:var(--orange); }
.stat-card-icon.red    { background:#FEF2F2; color:var(--red); }
.stat-card-icon.purple { background:#F5F3FF; color:var(--purple); }
.stat-card-icon.teal   { background:#F0FDFA; color:var(--teal); }
.stat-val   { font-size: 22px; font-weight: 800; line-height: 1; }
.stat-label { font-size: 11px; color: var(--text-2); margin-top: 3px; font-weight: 500; text-transform: uppercase; letter-spacing: .4px; }

/* ── Cards ──────────────────────────────────────────────────────── */
.card {
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border); overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,.04); margin-bottom: 16px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.card-header h3 { font-size: 15px; font-weight: 700; }
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ── Data list ──────────────────────────────────────────────────── */
.data-list { padding: 8px 0; }
.list-row { display: flex; align-items: center; gap: 10px; padding: 10px 16px; }
.list-row:hover { background: var(--bg); }
.list-row-info { flex: 1; min-width: 0; }
.list-row-info strong { display: block; font-size: 13px; }
.list-row-info span { font-size: 12px; color: var(--text-2); }

/* ── Table ──────────────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  background: #F8FAFC; padding: 11px 16px; text-align: left;
  font-size: 11px; font-weight: 600; color: var(--text-2); text-transform: uppercase;
  letter-spacing: .5px; border-bottom: 1px solid var(--border);
}
.data-table td { padding: 12px 16px; border-bottom: 1px solid #F1F5F9; font-size: 13px; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #FAFBFC; }
.table-footer { padding: 10px 16px; font-size: 12px; color: var(--text-2); border-top: 1px solid var(--border); }
.cell-user { display: flex; align-items: center; gap: 8px; }

/* ── Badges ─────────────────────────────────────────────────────── */
.role-badge {
  font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 20px; display: inline-block;
}
.badge--red    { background: #FEF2F2; color: var(--red); }
.badge--orange { background: #FFFBEB; color: var(--orange); }
.badge--blue   { background: #EFF6FF; color: var(--blue); }

.role-chip { font-size: 10px; background: rgba(255,255,255,.2); color: #fff; padding: 2px 7px; border-radius: 20px; font-weight: 600; }

.status-badge { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 20px; display: inline-block; }
.status--active   { background: #F0FDF4; color: var(--green); }
.status--banned   { background: #FEF2F2; color: var(--red); }
.status--resolved { background: #F1F5F9; color: var(--text-2); }
.status--expired  { background: #FEF2F2; color: var(--red); }

.plan-badge { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 20px; }
.plan--monthly { background: #EFF6FF; color: var(--blue); }
.plan--annual  { background: #FFFBEB; color: var(--orange); }

/* ── Buttons ────────────────────────────────────────────────────── */
.icon-btn {
  width: 36px; height: 36px; border-radius: 8px; background: transparent;
  color: var(--text-2); display: flex; align-items: center; justify-content: center;
  font-size: 16px; transition: all .15s;
}
.icon-btn:hover { background: var(--bg); color: var(--text); }
.sidebar .icon-btn { color: rgba(255,255,255,.6); }
.sidebar .icon-btn:hover { background: rgba(255,255,255,.1); color: #fff; }

.btn-sm { padding: 6px 12px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; font-size: 12px; font-weight: 500; }
.btn-sm:hover { background: var(--border); }

.btn-xs { padding: 4px 8px; border-radius: 6px; font-size: 12px; font-weight: 500; display: inline-flex; align-items: center; gap: 4px; }
.btn-xs.btn-primary { background: var(--primary); color: #fff; width: auto; margin-top: 0; padding: 5px 10px; border-radius: 6px; }
.btn-xs.btn-danger  { background: #FEF2F2; color: var(--red); }
.btn-xs.btn-danger:hover { background: var(--red); color: #fff; }

.btn-outline { padding: 10px 20px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 14px; font-weight: 500; background: transparent; }
.btn-outline:hover { background: var(--bg); }
.btn-danger { padding: 10px 16px; background: #FEF2F2; color: var(--red); border-radius: 8px; font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.btn-danger:hover { background: var(--red); color: #fff; }

.action-btns { display: flex; gap: 6px; }

/* ── Search ─────────────────────────────────────────────────────── */
.search-box { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1.5px solid var(--border); border-radius: 8px; padding: 7px 12px; }
.search-box input { border: none; outline: none; font-size: 13px; background: transparent; width: 200px; }
.search-box i { color: var(--text-3); }
.form-select { padding: 8px 12px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 13px; background: var(--surface); }

/* ── Avatars ────────────────────────────────────────────────────── */
.avatar-sm { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.avatar-lg { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; }

/* ── Modal ──────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center; z-index: 200; padding: 20px;
}
.modal {
  background: var(--surface); border-radius: 16px; width: 100%; max-width: 480px;
  box-shadow: 0 24px 60px rgba(0,0,0,.2); overflow: hidden;
}
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 16px; font-weight: 700; }
.modal-body { padding: 20px; }
.modal-footer { display: flex; gap: 10px; padding: 16px 20px; border-top: 1px solid var(--border); justify-content: flex-end; }
.modal-profile { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.modal-profile-info h3 { font-size: 16px; font-weight: 700; }
.modal-profile-info p { color: var(--text-2); font-size: 13px; margin: 2px 0 6px; }
.modal-fields { display: flex; flex-direction: column; gap: 12px; }
.modal-field { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid #F1F5F9; }
.modal-field:last-child { border-bottom: none; }
.modal-field label { font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .4px; }

/* ── Settings ───────────────────────────────────────────────────── */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.settings-body { padding: 16px 20px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid #F1F5F9; }
.setting-row:last-child { border-bottom: none; }
.setting-label { font-size: 14px; font-weight: 600; }
.setting-sub   { font-size: 12px; color: var(--text-2); margin-top: 2px; }

/* Toggle */
.toggle { position: relative; display: inline-block; width: 42px; height: 24px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute; inset: 0; background: var(--border); border-radius: 24px;
  transition: background .2s; cursor: pointer;
}
.toggle-track::after {
  content: ''; position: absolute; left: 3px; top: 3px;
  width: 18px; height: 18px; background: #fff; border-radius: 50%;
  transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle input:checked + .toggle-track { background: var(--green); }
.toggle input:checked + .toggle-track::after { transform: translateX(18px); }

/* ── States ─────────────────────────────────────────────────────── */
.loading { color: var(--text-2); padding: 20px; text-align: center; font-size: 13px; }
.empty   { color: var(--text-3); padding: 24px; text-align: center; font-size: 13px; }
.error   { color: var(--red);    padding: 20px; text-align: center; font-size: 13px; }
.hidden  { display: none !important; }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .dash-grid     { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .data-table th:nth-child(n+4),
  .data-table td:nth-child(n+4) { display: none; }
}
