:root {
  --blue: #1e7ab8;
  --blue-dark: #0d5a8a;
  --blue-light: #e8f4fc;
  --red: #d42b2b;
  --dark: #202531;
  --sidebar: #171b24;
  --mid: #6b7280;
  --border: #e5e7eb;
  --light: #f6f7f9;
  --white: #ffffff;
  --green: #1a7a3d;
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: 'Nunito Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--light); color: var(--dark); font-size: 14px;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Auth pages ---- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg,#0d5a8a,#1e7ab8); padding: 20px; }
.auth-card { background: white; border-radius: 16px; padding: 2.5rem; width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,0.25); }
.auth-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 1.5rem; justify-content: center; }
.auth-logo img { height: 32px; }
.auth-title { font-size: 1.3rem; font-weight: 800; text-align: center; margin-bottom: 0.4rem; }
.auth-sub { font-size: 0.85rem; color: var(--mid); text-align: center; margin-bottom: 1.75rem; }

/* ---- Layout ---- */
.admin-shell { display: flex; min-height: 100vh; }
.sidebar { width: 240px; background: var(--sidebar); color: #cbd2e0; flex-shrink: 0; padding: 1.25rem 0; }
.sidebar-logo { display: flex; align-items: center; gap: 10px; padding: 0 1.25rem 1.25rem; border-bottom: 1px solid #2a2f3d; margin-bottom: 0.75rem; }
.sidebar-logo img { height: 26px; }
.sidebar-logo-text { font-size: 0.95rem; font-weight: 800; color: white; }
.nav-group-label { font-size: 0.68rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: #6b7284; padding: 1rem 1.25rem 0.4rem; }
.sidebar a.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 0.55rem 1.25rem; color: #cbd2e0;
  font-size: 0.85rem; font-weight: 600; text-decoration: none; border-left: 3px solid transparent;
}
.sidebar a.nav-item:hover { background: #1f2532; color: white; text-decoration: none; }
.sidebar a.nav-item.active { background: #1f2532; color: white; border-left-color: var(--blue); }
.nav-item .dot { width: 6px; height: 6px; border-radius: 50%; background: #4b5468; flex-shrink: 0; }

.main { flex: 1; min-width: 0; }
.topbar { background: white; border-bottom: 1px solid var(--border); padding: 0 2rem; height: 60px; display: flex; align-items: center; justify-content: space-between; }
.topbar-title { font-size: 1.05rem; font-weight: 800; }
.topbar-user { display: flex; align-items: center; gap: 1rem; font-size: 0.85rem; color: var(--mid); }
.topbar-user a { color: var(--mid); }
.content { padding: 2rem; max-width: 1100px; }

/* ---- Cards / tables ---- */
.card { background: white; border: 1px solid var(--border); border-radius: 12px; padding: 1.5rem; margin-bottom: 1.5rem; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.card-header h2 { font-size: 1.05rem; font-weight: 800; margin: 0; }
.card-header p { font-size: 0.82rem; color: var(--mid); margin: 4px 0 0; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 0.55rem 1.1rem; border-radius: 8px; font-size: 0.85rem; font-weight: 700; border: none; cursor: pointer; font-family: inherit; text-decoration: none; }
.btn:hover { text-decoration: none; }
.btn-blue { background: var(--blue); color: white; }
.btn-blue:hover { background: var(--blue-dark); }
.btn-red { background: var(--red); color: white; }
.btn-red:hover { background: #b82222; }
.btn-ghost { background: var(--light); color: var(--dark); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--blue); color: var(--blue); }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.78rem; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1.25rem; }
.dash-card { background: white; border: 1px solid var(--border); border-radius: 12px; padding: 1.4rem; transition: box-shadow .15s, transform .15s; }
.dash-card:hover { box-shadow: 0 8px 24px rgba(0,0,0,0.06); transform: translateY(-2px); }
.dash-card .icon { font-size: 1.5rem; margin-bottom: 0.6rem; }
.dash-card h3 { font-size: 0.95rem; font-weight: 800; margin: 0 0 0.3rem; }
.dash-card p { font-size: 0.8rem; color: var(--mid); margin: 0 0 0.75rem; line-height: 1.5; }
.dash-card .count { font-size: 0.75rem; font-weight: 700; color: var(--blue); }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; color: var(--mid); padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--border); }
td { padding: 0.7rem 0.75rem; border-bottom: 1px solid #f0f1f3; vertical-align: middle; font-size: 0.85rem; }
tr:last-child td { border-bottom: none; }

/* ---- Sortable item list (drag & drop) ---- */
.item-list { list-style: none; margin: 0; padding: 0; }
.item-row {
  display: flex; align-items: center; gap: 0.9rem; padding: 0.85rem 0.9rem; border: 1px solid var(--border);
  border-radius: 10px; margin-bottom: 0.6rem; background: white;
}
.item-row.sortable-ghost { opacity: 0.4; }
.item-row.sortable-drag { box-shadow: 0 8px 20px rgba(0,0,0,0.12); }
.drag-handle { cursor: grab; color: #b7bcc7; font-size: 1.1rem; user-select: none; padding: 0 2px; }
.drag-handle:active { cursor: grabbing; }
.item-body { flex: 1; min-width: 0; }
.item-title { font-weight: 700; font-size: 0.9rem; margin-bottom: 2px; }
.item-sub { font-size: 0.8rem; color: var(--mid); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 520px; }
.item-actions { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }

/* Toggle switch */
.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; inset: 0; background-color: #d1d5db; transition: .2s; border-radius: 22px; }
.slider::before { position: absolute; content: ""; height: 16px; width: 16px; left: 3px; bottom: 3px; background-color: white; transition: .2s; border-radius: 50%; }
input:checked + .slider { background-color: var(--blue); }
input:checked + .slider::before { transform: translateX(18px); }
.item-row.is-hidden { opacity: 0.55; }
.visibility-label { font-size: 0.7rem; color: var(--mid); width: 46px; }

/* ---- Forms ---- */
.form-group { margin-bottom: 1.1rem; }
.form-group label { display: block; font-size: 0.82rem; font-weight: 700; margin-bottom: 0.4rem; }
.form-group .hint { font-size: 0.75rem; color: var(--mid); margin-top: 0.3rem; }
.form-group input[type=text], .form-group input[type=email], .form-group input[type=password], .form-group input[type=tel], .form-group input[type=number], .form-group textarea, .form-group select {
  width: 100%; padding: 0.65rem 0.85rem; border: 1.5px solid var(--border); border-radius: 8px; font-size: 0.88rem; font-family: inherit; outline: none; transition: border-color .2s;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { border-color: var(--blue); }
.form-group textarea { min-height: 90px; resize: vertical; }
.form-actions { display: flex; gap: 0.75rem; margin-top: 1.5rem; }

.settings-group-title { font-size: 0.78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--blue); margin: 2rem 0 1rem; }
.settings-group-title:first-child { margin-top: 0; }

.alert { padding: 0.85rem 1.1rem; border-radius: 8px; font-size: 0.85rem; margin-bottom: 1.25rem; font-weight: 600; }
.alert-success { background: #e7f8ec; color: var(--green); }
.alert-error { background: #fdecec; color: var(--red); }
.badge { display: inline-block; padding: 0.15rem 0.55rem; border-radius: 100px; font-size: 0.7rem; font-weight: 700; }
.badge-admin { background: var(--blue-light); color: var(--blue-dark); }
.badge-editor { background: #f1f1f1; color: var(--mid); }

.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--mid); font-size: 0.88rem; }

@media (max-width: 800px) {
  .admin-shell { flex-direction: column; }
  .sidebar { width: 100%; }
  .content { padding: 1.25rem; }
}
