:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #dc2626;
  --success: #15803d;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
}

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

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0 0 0.5rem; font-weight: 650; letter-spacing: -0.015em; }
h1 { font-size: 1.4rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.hidden { display: none !important; }

/* Auth & Installer Shell */
.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 2rem;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.auth-brand {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary);
}

.auth-card form { display: flex; flex-direction: column; gap: 0.9rem; }
.auth-footer { text-align: center; padding-top: 0.5rem; }
.link-muted { color: var(--muted); text-decoration: none; font-size: 0.9rem; }
.link-muted:hover { color: var(--text); }

.check-list {
  list-style: none;
  padding: 0.75rem 1rem;
  margin: 0;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: grid;
  gap: 0.35rem;
  font-size: 0.9rem;
}
.check-list .pass { color: var(--success); font-weight: 600; }
.check-list .fail { color: var(--danger); font-weight: 600; }

.alert {
  padding: 0.75rem 0.95rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
}
.alert.error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert.success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }

/* Dashboard Layout */
.admin-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 250px 1fr;
}

.sidebar {
  background: #0f172a;
  color: #e2e8f0;
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.sidebar-head {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0 0.5rem;
}

.brand-badge {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #93c5fd;
  font-weight: 700;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}

.nav-item {
  appearance: none;
  border: 0;
  background: transparent;
  color: #cbd5e1;
  padding: 0.7rem 0.85rem;
  border-radius: 8px;
  font-size: 0.93rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.08); color: #ffffff; }
.nav-item.active { background: var(--primary); color: #ffffff; }

.pill {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
}

.sidebar-foot {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.sidebar-foot .btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}
.sidebar-foot .btn-ghost { color: #94a3b8; }
.sidebar-foot .btn-ghost:hover { color: #ffffff; background: rgba(255, 255, 255, 0.08); }

.workspace { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1.1rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.topbar-actions { display: flex; align-items: center; gap: 0.75rem; }

.status-pill {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
}

.content-area { padding: 1.5rem 1.75rem 3rem; max-width: 1180px; width: 100%; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Cards & Grids */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem;
  box-shadow: var(--shadow);
}
.subcard {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.stack { display: flex; flex-direction: column; gap: 1rem; }
.stack-sm { display: flex; flex-direction: column; gap: 0.55rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.grid-2-uneven { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; align-items: start; }
.divider { border: 0; border-top: 1px solid var(--border); margin: 0.35rem 0; }

/* Forms */
label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  font-weight: 400;
  color: var(--text);
  background: #ffffff;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(37, 99, 235, 0.25);
  border-color: var(--primary);
}
textarea { resize: vertical; }

.checkbox-row {
  flex-direction: row;
  align-items: center;
  gap: 0.6rem;
  font-weight: 500;
  padding-top: 0.35rem;
}
.checkbox-row input { width: auto; }

.color-row { display: flex; gap: 0.5rem; align-items: center; }
.color-row input[type="color"] {
  width: 44px;
  height: 38px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}

.upload-field {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding: 0.35rem;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: var(--surface-alt);
}
.upload-field.drag-over { border-color: var(--primary); background: #eff6ff; }
.upload-field input[type="text"] { flex: 1; border: 0; background: transparent; padding: 0.35rem 0.45rem; }
.upload-thumb {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-danger, .btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}
.btn-primary { background: var(--primary); color: #ffffff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-secondary:hover { background: var(--surface-alt); }
.btn-danger { background: #fef2f2; border-color: #fecaca; color: var(--danger); }
.btn-danger:hover { background: #fee2e2; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-alt); color: var(--text); }
.btn-sm { padding: 0.42rem 0.75rem; font-size: 0.82rem; }
.btn-full { width: 100%; }
.form-actions { display: flex; gap: 0.6rem; justify-content: flex-end; }

/* Filters & Subtabs */
.toolbar { margin-bottom: 1rem; display: flex; justify-content: space-between; align-items: center; }
.filter-group, .subtabs { display: flex; gap: 0.45rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filter-btn, .subtab {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.filter-btn.active, .subtab.active {
  background: var(--text);
  border-color: var(--text);
  color: #ffffff;
}

/* Booking & Item Rows */
.booking-card, .item-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.booking-head, .item-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.booking-meta { display: flex; gap: 1rem; flex-wrap: wrap; font-size: 0.86rem; color: var(--muted); }
.badge {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
}
.badge-new { background: #dbeafe; color: #1e40af; }
.badge-confirmed { background: #dcfce7; color: #166534; }
.badge-archived { background: #f1f5f9; color: #475569; }

.item-thumb {
  width: 64px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.item-media { display: flex; gap: 0.85rem; align-items: flex-start; }

/* Theme Picker */
.theme-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.theme-card {
  position: relative;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem;
  cursor: pointer;
  background: var(--surface);
  gap: 0.45rem;
}
.theme-card:has(input:checked) { border-color: var(--primary); background: #eff6ff; }
.theme-card input { position: absolute; top: 0.85rem; right: 0.85rem; }
.theme-swatch {
  display: block;
  height: 54px;
  border-radius: 6px;
  border: 1px solid rgba(15, 23, 42, 0.1);
}
.swatch-minimal { background: linear-gradient(135deg, #ffffff 60%, #e2e8f0 100%); }
.swatch-editorial { background: linear-gradient(135deg, #f5f0e8 60%, #d6c7b2 100%); }
.swatch-dark { background: linear-gradient(135deg, #0f172a 60%, #1e293b 100%); }

/* Toast */
.toast {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  background: #0f172a;
  color: #ffffff;
  padding: 0.75rem 1.1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.25);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 999;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--danger); }

@media (max-width: 900px) {
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar { padding: 1rem; gap: 0.9rem; }
  .sidebar-nav { flex-direction: row; overflow-x: auto; }
  .sidebar-foot { flex-direction: row; }
  .grid-2, .grid-2-uneven, .theme-grid { grid-template-columns: 1fr; }
  .content-area { padding: 1rem; }
}
