:root {
  --primary: #0B1120;
  --accent: #0EA5E9;
  --bg: #F1F5F9;
  --white: #fff;
  --border: #E2E8F0;
  --text: #334155;
  --muted: #64748B;
  --danger: #DC2626;
  --danger-soft: #FEF2F2;
  --success: #059669;
  --success-soft: #ECFDF5;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', system-ui, sans-serif; background: var(--bg); color: var(--text); }
a { color: inherit; }
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 260px; background: var(--primary); color: white; padding: 1.5rem 0;
  position: fixed; top: 0; left: 0; bottom: 0; overflow-y: auto;
  z-index: 1000;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  box-shadow: 0 0 40px rgba(0,0,0,0.25);
}
.layout.sidebar-open .sidebar {
  transform: translateX(0);
}
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 15, 0.5);
  z-index: 999;
}
.layout.sidebar-open .sidebar-backdrop {
  display: block;
}
.sidebar-logo { padding: 0 1.5rem 1.5rem; font-weight: 800; font-size: 1.25rem; display: flex; align-items: center; gap: 0.6rem; border-bottom: 1px solid rgba(255,255,255,0.1); margin-bottom: 1rem; }
.sidebar-logo span { width: 32px; height: 32px; background: linear-gradient(135deg, #0EA5E9, #22D3EE); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 0.95rem; }
.nav-group-label { padding: 1rem 1.5rem 0.4rem; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: rgba(255,255,255,0.4); }
.nav-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.65rem 1.5rem; color: rgba(255,255,255,0.7); cursor: pointer; transition: all 0.2s; font-size: 0.92rem; text-decoration: none; }
.nav-item:hover, .nav-item.active { background: rgba(14,165,233,0.15); color: white; }
.nav-item i { width: 20px; text-align: center; }
.main { margin-left: 0; flex: 1; padding: 2rem 2rem 2rem 5.5rem; max-width: 1160px; width: 100%; }

.admin-topbar {
  position: fixed;
  top: 1rem;
  left: 1.25rem;
  z-index: 1001;
}
.sidebar-toggle-btn {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: white;
  border: 1px solid var(--border);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  transition: background 0.15s ease;
}
.sidebar-toggle-btn:hover {
  background: var(--bg);
}
.sidebar-toggle-btn .fa-xmark { display: none; }
.layout.sidebar-open .sidebar-toggle-btn .fa-bars { display: none; }
.layout.sidebar-open .sidebar-toggle-btn .fa-xmark { display: inline; }

/* On desktop, opening the menu slides the page content over instead of
   floating on top of it like it does on phone (no dimmed backdrop, no
   overlay — just a clean push, like a classic dashboard sidebar). */
@media (min-width: 769px) {
  .sidebar-backdrop { display: none !important; }
  .main { transition: margin-left 0.25s ease; }
  .layout.sidebar-open .main { margin-left: 260px; }
}

.header-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; flex-wrap: wrap; gap: 1rem; }
.header-bar h1 { font-size: 1.5rem; color: var(--primary); }
.header-bar .sub { color: var(--muted); font-size: 0.9rem; margin-top: 0.25rem; }
.btn { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.6rem 1.2rem; border-radius: 8px; border: none; font-weight: 600; font-size: 0.9rem; cursor: pointer; transition: all 0.2s; text-decoration: none; }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: #0284C7; }
.btn-outline { background: white; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: #F8FAFC; }
.btn-danger { background: var(--danger-soft); color: var(--danger); border: 1px solid #FCA5A5; }
.btn-danger:hover { background: #FEE2E2; }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.8rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1.25rem; margin-bottom: 2rem; }
.stat-card { background: white; border-radius: 12px; padding: 1.25rem; border: 1px solid var(--border); }
.stat-card a { text-decoration: none; }
.stat-card .label { font-size: 0.8rem; color: var(--muted); margin-bottom: 0.35rem; }
.stat-card .value { font-size: 1.75rem; font-weight: 700; color: var(--primary); }
.panel { background: white; border-radius: 12px; border: 1px solid var(--border); padding: 1.5rem; margin-bottom: 1.5rem; }
.panel h2 { font-size: 1.1rem; margin-bottom: 1rem; color: var(--primary); }
.panel h3 { font-size: 1rem; margin-bottom: 0.75rem; color: var(--primary); }
.form-group { margin-bottom: 1.1rem; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.35rem; }
.form-group .hint { font-weight: 400; color: var(--muted); font-size: 0.78rem; margin-top: 0.3rem; }
.form-group input[type=text], .form-group input[type=email], .form-group input[type=tel],
.form-group input[type=number], .form-group input[type=date], .form-group input[type=password],
.form-group input[type=url], .form-group textarea, .form-group select {
  width: 100%; padding: 0.65rem 0.85rem; border: 1px solid var(--border); border-radius: 8px; font-size: 0.95rem; font-family: inherit;
}
.form-group textarea { min-height: 100px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.25rem; }
.checkbox-row { display: flex; align-items: center; gap: 0.5rem; }
.checkbox-row input { width: auto; }
.color-input-row { display: flex; align-items: center; gap: 0.6rem; }
.color-input-row input[type=color] { width: 42px; height: 38px; padding: 2px; border: 1px solid var(--border); border-radius: 6px; }
.image-preview { max-width: 220px; max-height: 140px; border-radius: 8px; border: 1px solid var(--border); margin-bottom: 0.6rem; display: block; object-fit: cover; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 0.75rem; border-bottom: 1px solid var(--border); font-size: 0.9rem; vertical-align: middle; }
.table th { color: var(--muted); font-weight: 500; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
.table img.thumb { width: 48px; height: 36px; object-fit: cover; border-radius: 6px; }
.badge { display: inline-block; padding: 0.2rem 0.6rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 600; }
.badge-green { background: #D1FAE5; color: #065F46; }
.badge-yellow { background: #FEF3C7; color: #92400E; }
.badge-gray { background: #F1F5F9; color: #64748B; }
.badge-blue { background: #DBEAFE; color: #1E40AF; }
.alert { padding: 1rem 1.25rem; border-radius: 10px; margin-bottom: 1.5rem; font-size: 0.95rem; line-height: 1.6; }
.alert strong { display: block; margin-bottom: 0.35rem; }
.alert-info { background: #EFF6FF; border: 1px solid #BFDBFE; color: #1E40AF; }
.alert-success { background: var(--success-soft); border: 1px solid #A7F3D0; color: #065F46; }
.alert-error { background: var(--danger-soft); border: 1px solid #FCA5A5; color: #991B1B; }
.actions-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--primary); }
.login-box { background: white; border-radius: 16px; padding: 2.5rem; width: 100%; max-width: 380px; }
.login-box .sidebar-logo { color: var(--primary); border: none; padding: 0 0 1.5rem; justify-content: center; }
.text-muted { color: var(--muted); }
@media (max-width: 768px) {
  .sidebar { width: 82%; max-width: 300px; }
  .main { padding: 1.25rem 1.25rem 1.25rem 4.5rem; }
  .admin-topbar { top: 0.75rem; left: 0.75rem; }
  .form-grid { grid-template-columns: 1fr; }
  /* Let wide tables scroll horizontally instead of squashing/breaking the layout. */
  .panel { overflow-x: auto; padding: 1.1rem; }
  .table { min-width: 560px; }
  .header-bar { align-items: stretch; }
  .header-bar .btn { width: 100%; justify-content: center; }
}

.quickfill-select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
  background: white;
}

.sidebar-view-site-btn {
  width: 100%;
  justify-content: center;
  background: rgba(255,255,255,0.08);
  color: white;
  border: 1.5px solid rgba(255,255,255,0.35);
}
.sidebar-view-site-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
