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

:root {
  --bg: #f1f5f9;
  --card: #ffffff;
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #e0e7ff;
  --success: #10b981;
  --danger: #ef4444;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --header: #0f172a;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.05);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

/* ── Auth pages ── */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.auth-card {
  background: var(--card);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 40px;
  width: 100%;
  max-width: 400px;
}

.auth-logo {
  height: 72px;
  width: auto;
  margin-bottom: 20px;
  display: block;
}

.auth-card h1 { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.auth-card > p { color: var(--text-muted); margin-bottom: 24px; line-height: 1.5; }

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

.admin-header {
  background: var(--header);
  color: white;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.admin-logo {
  font-size: 15px;
  font-weight: 700;
  color: white;
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.admin-logo img {
  height: 30px;
  width: auto;
}

.admin-nav { display: flex; gap: 4px; }

.admin-nav-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.65);
  padding: 7px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
}
.admin-nav-btn:hover { color: white; background: rgba(255,255,255,0.1); }
.admin-nav-btn.active { color: white; background: rgba(255,255,255,0.15); }

.admin-body { padding: 24px; flex: 1; max-width: 1100px; margin: 0 auto; width: 100%; }

/* ── Cards ── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  overflow: hidden;
}

.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title { font-size: 14px; font-weight: 600; }
.card-body { padding: 20px; }

/* ── Status bar ── */
.status-bar {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 11px 20px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--text-muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}
.status-dot.inactive { background: #cbd5e1; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
  line-height: 1;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover:not(:disabled) { background: #dc2626; }

.btn-secondary { background: #f1f5f9; color: var(--text); }
.btn-secondary:hover:not(:disabled) { background: #e2e8f0; }

.btn-success { background: var(--success); color: white; }
.btn-success:hover:not(:disabled) { background: #059669; }

.btn-ghost {
  background: none;
  color: rgba(255,255,255,0.65);
  border: 1px solid rgba(255,255,255,0.2);
}
.btn-ghost:hover:not(:disabled) { color: white; background: rgba(255,255,255,0.1); }

.btn-sm { padding: 5px 11px; font-size: 13px; }
.btn-full { width: 100%; justify-content: center; }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-weight: 500;
  margin-bottom: 6px;
  font-size: 13px;
}

.form-input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  color: var(--text);
  background: white;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}

/* ── Table ── */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

th {
  text-align: left;
  padding: 9px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
}

td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr.row-active { background: #f0fdf4; }
tr:hover:not(.row-active) td { background: #f8fafc; }

.file-name {
  font-family: 'SF Mono', 'Cascadia Code', 'Fira Mono', monospace;
  font-size: 13px;
  font-weight: 500;
}

.actions { display: flex; gap: 6px; align-items: center; }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}
.badge-success { background: #dcfce7; color: #15803d; }
.badge-muted { background: #f1f5f9; color: #94a3b8; }

/* ── Alerts ── */
.alert {
  padding: 11px 14px;
  border-radius: 6px;
  margin-bottom: 14px;
  font-size: 13px;
  line-height: 1.4;
}
.alert-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }

/* ── Toasts ── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 12px 18px;
  border-radius: 8px;
  color: white;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  animation: toast-in 0.25s ease;
}
.toast-success { background: #1e293b; }
.toast-error { background: var(--danger); }

@keyframes toast-in {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ── Settings grid ── */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 680px) { .settings-grid { grid-template-columns: 1fr; } }

.section-desc { color: var(--text-muted); font-size: 13px; margin-bottom: 16px; line-height: 1.5; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Misc ── */
/* ── Color picker ── */
.color-picker-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

input[type="color"] {
  width: 42px;
  height: 36px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  background: none;
  flex-shrink: 0;
}

.color-hex {
  font-family: 'SF Mono', 'Cascadia Code', 'Fira Mono', monospace;
  font-size: 13px;
  color: var(--text-muted);
}

.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.link { color: var(--primary); text-decoration: none; font-size: 13px; }
.link:hover { text-decoration: underline; }
.empty-row { text-align: center; color: var(--text-muted); padding: 48px 16px !important; font-size: 13px; }
.hidden { display: none !important; }
.mt-2 { margin-top: 8px; }
