/* ============================================================
   Bookara Shared Components — v1.0
   All values reference tokens.css. No hardcoded colors/sizes.
   Import order: tokens.css → components.css → responsive.css → page-specific CSS
   Note: responsive.css provides grid system, form layouts, visibility helpers
   ============================================================ */

/* ── 1. Layout ─────────────────────────────────────────────── */
.main-component {
  display: flex;
  min-height: 100vh;
  padding-top: 52px; /* offset for fixed header */
}
.main-content {
  flex: 1;
  padding: var(--sp-6);
  background: var(--surface);
  overflow-x: auto;
  min-width: 0;
}
.main-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 52px;
  background: var(--ink-900);
  color: var(--ink-200);
  display: flex;
  align-items: center;
  padding: 0 var(--sp-5);
  gap: var(--sp-4);
  z-index: 1000;
  box-shadow: var(--shadow-sm);
}
.main-header .project-name {
  color: var(--ink-200);
  font-size: var(--text-sm);
  font-weight: 600;
  margin: 0;
  white-space: nowrap;
}
.main-header .auth-links {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.main-header .auth-links a { color: var(--ink-200); text-decoration: none; }

/* ── 2. Sidebar ────────────────────────────────────────────── */
.sidebar {
  width: 250px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  padding-top: 52px;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  transition: transform var(--base);
  z-index: 999;
}
.sidebar-logo { text-align: center; padding: var(--sp-4) var(--sp-3) 0; }
.sidebar-logo img { max-height: 120px; max-width: 140px; object-fit: contain; }
.sidebar-info { text-align: center; padding: 0 var(--sp-3); margin-bottom: var(--sp-3); }
.sidebar-info p { font-size: var(--text-xs); font-weight: 500; margin: 2px 0; color: var(--sidebar-text); opacity: 0.8; }
.sidebar-buttons {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  padding: 0 var(--sp-3);
  flex: 1;
}
.sidebar-buttons button {
  width: 100%;
  background: rgba(255,255,255,0.06);
  color: var(--sidebar-text);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--text-xs);
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all var(--fast);
}
.sidebar-buttons button:hover {
  background: var(--accent);
  color: var(--ink-900);
  border-color: var(--accent);
}
.sidebar-buttons .res-btn { border-color: var(--accent); color: var(--accent); }
.sidebar-buttons .res-btn:hover { background: var(--accent); color: var(--ink-900); }
.sidebar-header { padding: var(--sp-3); text-align: center; }
.sidebar-header h1 { font-size: var(--text-xs); font-weight: 500; opacity: 0.6; }

/* ── 3. Cards ──────────────────────────────────────────────── */
.card {
  background: var(--card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--ink-200);
  padding: var(--sp-6);
  transition: box-shadow var(--base);
}
.card:hover { box-shadow: var(--shadow-md); }
.card--kpi {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
}
.card--kpi .kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}
.card--kpi .kpi-value {
  font-size: var(--text-2xl);
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--ink-950);
}
.card--kpi .kpi-label {
  font-size: var(--text-sm);
  color: var(--ink-500);
}

/* ── 4. Tables ─────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.data-table th {
  text-align: left;
  color: var(--ink-500);
  font-weight: 600;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 2px solid var(--ink-200);
  background: var(--card);
  position: sticky;
  top: 0;
  z-index: 1;
}
.data-table td {
  padding: var(--sp-3) var(--sp-4);
  color: var(--ink-700);
  border-bottom: 1px solid var(--ink-200);
  vertical-align: middle;
}
.data-table tr:hover td { background: var(--ink-100); }
.data-table .empty-row td {
  text-align: center;
  padding: var(--sp-10) var(--sp-4);
  color: var(--ink-500);
}

/* ── 5. Forms ──────────────────────────────────────────────── */
.form-group { margin-bottom: var(--sp-5); }
.form-label {
  display: block;
  font-weight: 500;
  font-size: var(--text-sm);
  color: var(--ink-700);
  margin-bottom: var(--sp-1);
}
.form-control {
  width: 100%;
  height: 42px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--ink-300);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--ink-700);
  background: var(--card);
  transition: border-color var(--fast), box-shadow var(--fast);
  outline: none;
}
.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}
textarea.form-control { height: auto; min-height: 80px; resize: vertical; }
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
}

/* ── 6. Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  height: 40px;
  padding: 0 var(--sp-5);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all var(--fast);
  text-decoration: none;
  line-height: 1;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-outline {
  background: transparent;
  border: 1px solid var(--ink-300);
  color: var(--ink-700);
}
.btn-outline:hover { background: var(--ink-100); }
.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { background: #a82222; }
.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-success:hover { background: #156b35; }

/* Warning button */
.btn-warning {
    background: var(--warning);
    color: #fff;
    border-color: var(--warning);
}
.btn-warning:hover,
.btn-warning:focus {
    background: var(--warning-hover, #8a4d00);
    border-color: var(--warning-hover, #8a4d00);
    color: #fff;
}

/* Info button */
.btn-info {
    background: var(--info);
    color: #fff;
    border-color: var(--info);
}
.btn-info:hover,
.btn-info:focus {
    background: var(--info-hover, #1a4f8a);
    border-color: var(--info-hover, #1a4f8a);
    color: #fff;
}

.btn-sm { height: 32px; padding: 0 var(--sp-3); font-size: var(--text-xs); }
.btn-icon {
  width: 40px;
  padding: 0;
  text-align: center;
}

/* ── 7. Status pills ───────────────────────────────────────── */
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: capitalize;
}
.status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.status--confirmed { background: var(--success-soft); color: var(--success); }
.status--completed { background: var(--info-soft);    color: var(--info); }
.status--pending   { background: var(--warning-soft); color: var(--warning); }
.status--cancelled { background: var(--danger-soft);  color: var(--danger); }
.status--active    { background: var(--success-soft); color: var(--success); }

/* ── 8. Empty states ───────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: var(--sp-10) var(--sp-6);
  color: var(--ink-500);
}
.empty-state i {
  font-size: 3rem;
  margin-bottom: var(--sp-4);
  opacity: 0.35;
  display: block;
}
.empty-state h3 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  color: var(--ink-700);
  margin-bottom: var(--sp-2);
}
.empty-state p {
  font-size: var(--text-sm);
  max-width: 360px;
  margin: 0 auto;
}

/* ── 9. Toast notifications ────────────────────────────────── */
.toast {
  background: var(--card);
  color: var(--ink-700);
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-sm);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  border-left: 4px solid var(--info);
  pointer-events: auto;
  animation: toastIn var(--base) ease;
}
.toast--success { border-left-color: var(--success); }
.toast--error   { border-left-color: var(--danger); }
.toast--warning { border-left-color: var(--warning); }
@keyframes toastIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── 10. Page loader ───────────────────────────────────────── */
#page-loader {
  position: fixed;
  inset: 0;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 11000;
  transition: opacity 0.4s;
}
#page-loader.fade-out { opacity: 0; pointer-events: none; }

/* ── 11. Language / theme toggle ───────────────────────────── */
.toggle-row {
  position: fixed;
  top: var(--sp-2);
  right: var(--sp-3);
  z-index: 1001;
  display: flex;
  gap: var(--sp-1);
}
.toggle-row a,
.toggle-row button {
  font-size: var(--text-xs);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--ink-300);
  background: var(--card);
  color: var(--ink-700);
  cursor: pointer;
  text-decoration: none;
  transition: all var(--fast);
}
.toggle-row a:hover,
.toggle-row button:hover {
  background: var(--ink-100);
}

/* ── 12. Mobile responsive ─────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); }
  .main-content {
    padding: var(--sp-4);
    margin-top: 52px;
  }
  .main-header .project-name { font-size: var(--text-xs); }
  .main-header .auth-links .username { display: none; }
  .card--kpi { flex-direction: column; text-align: center; }
  .form-row { grid-template-columns: 1fr; }

  /* Responsive tables with horizontal scroll */
  .data-table {
    font-size: var(--text-xs);
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  .data-table thead,
  .data-table tbody,
  .data-table tr {
    display: table;
    width: 100%;
    table-layout: auto;
  }
  .data-table th,
  .data-table td {
    padding: var(--sp-2) var(--sp-1);
    font-size: 11px;
    min-width: 80px;
  }

  /* Buttons need to be touch-friendly */
  .btn {
    min-height: 44px;
    padding: 0 var(--sp-4);
  }
  .btn-sm {
    min-height: 38px;
    padding: 0 var(--sp-3);
  }
  .btn-icon {
    min-width: 44px;
    min-height: 44px;
  }

  /* Report filters stack on mobile */
  .report-filters .form-row {
    grid-template-columns: 1fr;
    gap: var(--sp-3);
  }
  .quick-date-row {
    flex-direction: column;
  }
  .quick-date-row .btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .main-content {
    padding: var(--sp-3);
  }
  .card {
    padding: var(--sp-4);
  }
  .data-table th,
  .data-table td {
    font-size: 10px;
    padding: var(--sp-1);
    min-width: 70px;
  }
}

/* ── 13. Print styles ──────────────────────────────────────── */
@media print {
  .sidebar, .main-header, .toggle-row, #page-loader { display: none !important; }
  .main-component { display: block; }
  .main-content { padding: 0; margin: 0; }
  .card { box-shadow: none; border: 1px solid #ddd; }
  body { background: #fff; }
  .report-header__actions { display: none; }
  .data-table { font-size: 11px; }
  body { background: white; font-size: 12px; }
}

/* ── 14. Report components ──────────────────────────────────── */
.report-header { display: flex; justify-content: space-between; align-items: center; padding: var(--sp-4) var(--sp-5); margin-bottom: var(--sp-4); }
.report-header h2 { font-family: var(--font-display); font-size: var(--text-lg); color: var(--ink-950); margin: 0; }
.report-header__subtitle { font-size: var(--text-sm); color: var(--ink-500); margin: var(--sp-1) 0 0; }
.report-header__actions { display: flex; gap: var(--sp-2); }
.report-kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--sp-4); margin-bottom: var(--sp-4); }
.report-section { margin-bottom: var(--sp-4); }
.report-section h5 { font-family: var(--font-display); font-size: var(--text-md); color: var(--ink-950); margin: 0 0 var(--sp-3); }
.report-filters { padding: var(--sp-4) var(--sp-5); margin-bottom: var(--sp-4); }
.report-filters .form-row { margin-bottom: var(--sp-3); }
.report-filters .btn-group-row { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.quick-date-row { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin-bottom: var(--sp-4); }
.quick-date-row .btn { border-radius: var(--radius-pill); }
.mom-card { padding: var(--sp-4) var(--sp-5); border-left: 4px solid; }
.mom-card__row { display: flex; align-items: center; gap: var(--sp-4); }
.mom-card__label { font-size: var(--text-xs); color: var(--ink-500); text-transform: uppercase; font-weight: 600; }
.mom-card__value { font-size: var(--text-2xl); font-family: var(--font-display); font-weight: 700; }
.mom-card__meta { flex: 1; text-align: right; }
.mom-card__meta small { font-size: var(--text-xs); color: var(--ink-500); display: block; }
.mom-card__meta strong { font-size: var(--text-md); color: var(--ink-700); }
.mom-card__note { margin-top: var(--sp-2); font-size: var(--text-xs); font-weight: 600; }
.utilization-bar-bg { background: var(--ink-200); border-radius: var(--radius-sm); height: 24px; position: relative; overflow: hidden; }
.utilization-bar-fill { height: 100%; border-radius: var(--radius-sm); transition: width 0.6s ease; display: flex; align-items: center; justify-content: center; font-size: var(--text-xs); font-weight: 700; color: white; min-width: 40px; }
.bar-green { background: linear-gradient(90deg, var(--success), #20c997); }
.bar-yellow { background: linear-gradient(90deg, var(--warning), #fd7e14); }
.bar-red { background: linear-gradient(90deg, var(--danger), #e83e8c); }
.bar-no-data { background: var(--ink-300); }
.running-total-row { background: var(--ink-100) !important; font-weight: 700; }
.running-total-row td { border-top: 2px solid var(--ink-700) !important; padding: var(--sp-3) var(--sp-4) !important; }
.status-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: var(--radius-pill); font-size: var(--text-xs); font-weight: 600; text-transform: capitalize; }
.status-badge--overutilized { background: var(--danger-soft); color: var(--danger); }
.status-badge--good { background: var(--success-soft); color: var(--success); }
.status-badge--underutilized { background: var(--warning-soft); color: var(--warning); }
.status-badge--no-data { background: var(--ink-100); color: var(--ink-500); }
.data-table .scrollable {
  max-height: 66px;
  overflow-y: auto;
  word-wrap: break-word;
  white-space: normal;
  text-align: left;
}
/* KPI icon color variants */
.kpi-icon--success { background: var(--success-soft); color: var(--success); }
.kpi-icon--info    { background: var(--info-soft);    color: var(--info); }
.kpi-icon--warning { background: var(--warning-soft); color: var(--warning); }
.kpi-icon--danger  { background: var(--danger-soft);  color: var(--danger); }
.kpi-icon--accent  { background: var(--accent-soft);  color: var(--accent); }
/* Layout helpers */
.form-row--end { align-items: end; }
.btn-row { display: flex; gap: var(--sp-2); }
.btn-row--wrap { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.column-selection {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  align-items: center;
  padding: var(--sp-3) var(--sp-4);
  background: var(--ink-100);
  border-radius: var(--radius-sm);
}
.column-selection label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-xs);
  color: var(--ink-700);
  font-weight: 500;
}
.column-selection input[type="checkbox"] { accent-color: var(--accent); cursor: pointer; margin: 0; }
.margin-top-4 { margin-top: var(--sp-4); }
.margin-bottom-3 { margin-bottom: var(--sp-3); }
.margin-bottom-4 { margin-bottom: var(--sp-4); }
.overflow-x-auto { overflow-x: auto; }
.grid--charts { grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); }
.grid--payment { grid-template-columns: 2fr 1fr; }
.table-scroll { overflow-x: auto; }
.text-start { text-align: start; }
.text-end { text-align: right; }
.text-bold { font-weight: 700; }
/* Column min-width helpers for wide data tables */
.td-min-150 { min-width: 150px; }
.td-min-250 { min-width: 250px; }
.td-min-350 { min-width: 350px; }
.td-min-400 { min-width: 400px; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--ink-500); }
.text-info { color: var(--info); }
/* Month-over-month variants */
.mom-card--positive { border-left-color: var(--success); }
.mom-card--negative { border-left-color: var(--danger); }
.mom-card__value--positive { color: var(--success); }
.mom-card__value--negative { color: var(--danger); }
/* Buffet reservation highlight */
.buffet-row { background-color: var(--warning-soft) !important; }

/* ── Form validation states (M7) ─────────────────────────── */
.form-control.is-invalid {
  border-color: var(--danger, #dc2626);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}
.form-control.is-valid {
  border-color: var(--success, #16a34a);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.12);
}
.form-control.is-invalid:focus {
  border-color: var(--danger, #dc2626);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.25);
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-6px); }
  40%       { transform: translateX(6px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}
.shake { animation: shake 0.35s ease; }

/* ===== NAV/SIDEBAR ENHANCEMENT v6 ===== */

/* ── Nav Section Labels (sidebar groupings) ──────────────────── */
.nav-section-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.42);
  padding: 14px var(--sp-3) 4px;
  margin: 0;
  user-select: none;
  pointer-events: none;
}

/* ── Sidebar Brand Avatar (emoji fallback replacement) ────────── */
.sidebar-brand-avatar {
  height: 110px;
  width: 110px;
  border-radius: 12px;
  background: rgba(255,255,255,0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: -5px 0 -15px;
  border: 2px solid rgba(255,255,255,0.20);
}
.sidebar-brand-avatar .avatar-initials {
  font-size: 2rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1;
  letter-spacing: -1px;
}
.sidebar-brand-avatar .avatar-name {
  color: rgba(255,255,255,0.75);
  font-size: 10px;
  font-weight: 600;
  margin-top: 5px;
  text-align: center;
  padding: 0 6px;
  line-height: 1.3;
}

/* ── Role Badge Pill ──────────────────────────────────────────── */
.role-badge {
  display: inline-flex;
  align-items: center;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.18);
  color: #ffffff;
  border: 1px solid rgba(255,255,255,0.30);
  white-space: nowrap;
}

/* ── Header integrated controls ─────────────────────────────── */
.header-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.20);
  color: rgba(255,255,255,0.88) !important;
  text-decoration: none;
  transition: background 120ms;
  cursor: pointer;
  padding: 0;
  font-size: 13px;
}
.header-icon-btn:hover {
  background: rgba(255,255,255,0.22);
  color: #ffffff !important;
}
.header-user {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Header bottom separator ──────────────────────────────────── */
.main-header {
  border-bottom: 1px solid rgba(255,255,255,0.15);
}

/* ── Sidebar logo area separator ─────────────────────────────── */
.sidebar-logo-area {
  border-bottom: 1px solid rgba(255,255,255,0.12);
  padding-bottom: var(--sp-3);
  margin-bottom: var(--sp-2);
}

/* ── Content Footer (inside .main-content) ────────────────────── */
.content-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: var(--sp-8);
  padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--ink-200);
  font-size: 11px;
  color: var(--ink-500);
}
.content-footer span:last-child {
  text-align: right;
}

/* ── Sidebar Footer ───────────────────────────────────────────── */
.sidebar-footer {
  padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid rgba(255,255,255,0.12);
  text-align: center;
  font-size: 10px;
  color: rgba(255,255,255,0.45);
  font-weight: 500;
  line-height: 1.5;
  flex-shrink: 0;
}

/* ── Token Portal Footer ──────────────────────────────────────── */
.token-footer {
  margin-top: auto;
  padding: var(--sp-4) 0 var(--sp-2);
  text-align: center;
  font-size: 11px;
  color: var(--ink-500, #7a5c5f);
  border-top: 1px solid var(--ink-200, #e8dfe0);
}

/* ── Sidebar Buttons: flex + icon alignment ───────────────────── */
.sidebar-buttons button {
  text-align: left !important;
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
}

/* ── Sidebar active state ─────────────────────────────────────── */
.sidebar-buttons button.active {
  background: #ffffff !important;
  color: #8B0015 !important;
  border-left: 3px solid #ffffff !important;
  font-weight: 700 !important;
}

/* ── Sidebar hover: lift + highlight ─────────────────────────── */
.sidebar-buttons button:hover {
  background: rgba(255,255,255,0.13) !important;
  transform: translateX(2px);
  color: #ffffff !important;
  border-color: rgba(255,255,255,0.25) !important;
}

/* ===== END NAV/SIDEBAR ENHANCEMENT v6 ===== */

/* ── Active sidebar state (C2) ───────────────────────────── */
.sidebar .nav-btn.active,
.sidebar a.active > .nav-btn,
.sidebar .active {
  background: var(--red-500) !important;
  color: #ffffff !important;
  border-left: 3px solid #ffffff;
  padding-left: calc(var(--sp-3, 0.75rem) - 3px);
}

/* ── Dark mode transitions (M4) ─────────────────────────── */
body, .sidebar, .main-header {
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ── Desktop sidebar margin fix ─────────────────────────── */
@media (min-width: 769px) {
  .main-content {
    margin-left: 250px;
  }
  .main-content.full-width {
    margin-left: 0;
  }
}

/* ── Required field indicator ───────────────────────────── */
.form-label.required::after {
  content: " *";
  color: var(--danger);
  font-weight: 700;
}

/* ── Focus visible for sidebar buttons ──────────────────── */
.sidebar-buttons button:focus-visible {
  outline: 2px solid rgba(255,255,255,0.8);
  outline-offset: 2px;
}

/* ── Zebra striping for data tables ─────────────────────── */
.data-table tbody tr:nth-child(even) td {
  background: var(--ink-100);
}
.data-table tbody tr:hover td {
  background: var(--red-50) !important;
}

/* ── Centralized status row colors ──────────────────────── */
.status-row-confirmed td { background: rgba(27,127,66,0.06) !important; }
.status-row-pending td   { background: rgba(160,90,0,0.06) !important; }
.status-row-cancelled td { background: rgba(200,16,46,0.06) !important; }

/* ── Page Header ─────────────────────────────────────────────── */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--sp-6);
  flex-wrap: wrap;
  gap: var(--sp-3);
}
.page-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--ink-950);
  margin: 0;
}
.page-subtitle {
  font-size: var(--text-sm);
  color: var(--ink-500);
  margin: var(--sp-1) 0 0;
}
.page-actions {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  align-items: center;
}

/* ── Card Section Title ───────────────────────────────────────── */
.card-section-title {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--ink-950);
  border-bottom: 2px solid var(--ink-100);
  padding-bottom: var(--sp-3);
  margin-bottom: var(--sp-4);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  justify-content: space-between; /* allow title + action button on same row */
}
.card-section-title .section-action {
  margin-left: auto;
  font-size: var(--text-sm);
  font-weight: 500;
}

/* ── Empty State ──────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-12, 48px) var(--sp-6);
  text-align: center;
  color: var(--ink-500);
}
.empty-state i { font-size: 3rem; margin-bottom: var(--sp-4); opacity: 0.4; }
.empty-state h3 { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 600; color: var(--ink-700); margin: 0 0 var(--sp-2); }
.empty-state p { font-size: var(--text-sm); margin: 0 0 var(--sp-4); max-width: 340px; }

/* ── Status Badge (dot + label) ───────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}
.status-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.status-badge.pending    { background: #fef3c7; color: #92400e; }
.status-badge.confirmed  { background: #dbeafe; color: #1e40af; }
.status-badge.completed  { background: #dcfce7; color: #166534; }
.status-badge.cancelled  { background: #fee2e2; color: #991b1b; }
.status-badge.postponed  { background: #f3e8ff; color: #6b21a8; }
.status-badge.in-waiting { background: #ffedd5; color: #9a3412; }

/* ── Table Enhancements ───────────────────────────────────────── */
.data-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--sidebar-bg);
  color: #fff;
}
.data-table thead th {
  background: var(--sidebar-bg);
  color: #fff;
}
.data-table tbody tr:nth-child(even) { background: var(--surface); }
.data-table tbody tr:hover td { background: #fff5f5; }
.data-table td.num, .data-table th.num { text-align: right; }
.data-table .actions-col { white-space: nowrap; }

/* ── Icon Button ──────────────────────────────────────────────── */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--ink-200);
  background: var(--card);
  color: var(--ink-700);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  text-decoration: none;
  font-size: 13px;
}
.btn-icon:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-icon.danger:hover { background: #dc2626; border-color: #dc2626; color: #fff; }

/* ── Mobile sidebar smooth transition ────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transition: transform 0.25s cubic-bezier(.4,0,.2,1);
  }
  .sidebar-backdrop {
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
  }
}

/* ── Filter Form Responsive ───────────────────────────────────── */
.filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  align-items: flex-end;
  margin-bottom: var(--sp-5);
}
.filter-form .form-group {
  flex: 1 1 180px;
  min-width: 140px;
  margin-bottom: 0;
}
.filter-form .filter-actions {
  display: flex;
  gap: var(--sp-2);
  flex-shrink: 0;
  flex-wrap: wrap;
  align-items: center;
}
@media (max-width: 600px) {
  .filter-form .form-group { flex: 1 1 100%; }
  .filter-form .filter-actions { width: 100%; }
  .filter-form .filter-actions .btn { flex: 1; min-width: 0; }
}

/* ── Mobile header: hide role badge + username on very small screens ── */
@media (max-width: 480px) {
  .main-header .role-badge { display: none; }
  .main-header .username { max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* ── Page header: stack on mobile ────────────────────────────── */
@media (max-width: 480px) {
  .page-header { flex-direction: column; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; justify-content: center; }
}

/* ── KPI grid: always at least 2-col on mobile ───────────────── */
.report-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-4);
}
@media (max-width: 400px) {
  .report-kpi-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Column selector responsive ──────────────────────────────── */
.col-selector {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}
.col-selector label {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  font-size: var(--text-xs);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--ink-200);
  cursor: pointer;
  white-space: nowrap;
  background: var(--card);
}
.col-selector label:hover { border-color: var(--accent); color: var(--accent); }

/* =============================================
   KPI card colored left border variants
   ============================================= */
.kpi-card-events  { border-left: 4px solid var(--accent, #C8102E); }
.kpi-card-revenue { border-left: 4px solid var(--success, #16a34a); }
.kpi-card-bookings{ border-left: 4px solid var(--info, #0284c7); }
.kpi-card-pending { border-left: 4px solid var(--warning, #d97706); }

/* Prominent pricing grand total row */
.pricing-grand-total td {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--accent);
  border-top: 2px solid var(--ink-200);
}

/* Action card grid (Quick Actions on dashboard) */
.action-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--sp-3);
}
.action-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-5);
  background: var(--card);
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--ink-900);
  transition: box-shadow 0.15s, border-color 0.15s, transform 0.15s;
  text-align: center;
}
.action-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
  transform: translateY(-2px);
  color: var(--ink-900);
  text-decoration: none;
}
.action-card i { font-size: 1.8rem; color: var(--accent); }
.action-card span { font-size: var(--text-sm); font-weight: 600; }
.action-card p { font-size: var(--text-xs, 0.75rem); color: var(--ink-500, #6b7280); margin: 0; }

/* Warning/danger card variants */
.card-warning {
  border-left: 4px solid var(--warning, #d97706);
  background: #fffbeb;
}
.card-danger {
  border-left: 4px solid var(--danger, #dc2626);
  background: #fff5f5;
}
