/* ─── Reset & Base ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --red: #dc2626;
  --red-dark: #b91c1c;
  --green: #16a34a;
  --green-light: #dcfce7;
  --bg: #f1f5f9;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --sidebar-bg: #0f172a;
  --sidebar-text: #cbd5e1;
  --sidebar-active: #1e293b;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.06);
}
html { font-size: 14px; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
}

/* ─── Sidebar ──────────────────────────────────────────── */
.sidebar {
  width: 240px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform .2s;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px;
  font-weight: 700;
  font-size: 16px;
  color: #fff;
}
.brand-icon {
  width: 36px; height: 36px;
  background: var(--red);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  color: #fff;
}
.brand-icon.small { width: 30px; height: 30px; font-size: 15px; border-radius: 8px; }
.sidebar-nav { flex: 1; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.12); color: #fff; }
.sidebar-footer { padding: 10px; border-top: 1px solid rgba(255,255,255,.08); }

/* ─── Mobile Header ────────────────────────────────────── */
.mobile-header {
  display: none;
  position: fixed; top: 0; left: 0; right: 0;
  height: 56px;
  background: var(--sidebar-bg);
  color: #fff;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  z-index: 101;
}
.menu-toggle {
  background: none; border: none; color: #fff; cursor: pointer;
  padding: 4px; display: flex;
}
.mobile-title { font-weight: 700; font-size: 15px; }

/* ─── Main Content ─────────────────────────────────────── */
.main-content {
  flex: 1;
  margin-left: 240px;
  padding: 28px 32px;
  min-height: 100vh;
}

/* ─── Views ────────────────────────────────────────────── */
.view { display: none; }
.view.active { display: block; }
.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.view-header h1 { font-size: 24px; font-weight: 800; }
.view-date { color: var(--text-muted); font-size: 13px; }

/* ─── KPI Cards ────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.kpi-grid.small { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.kpi-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.kpi-card.accent { border-left: 4px solid var(--red); }
.kpi-card.green { border-left: 4px solid var(--green); }
.kpi-label { font-size: 12px; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.kpi-value { font-size: 28px; font-weight: 800; color: var(--text); }

/* ─── Charts ───────────────────────────────────────────── */
.charts-row { display: flex; gap: 14px; margin-bottom: 14px; }
.chart-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  flex: 1;
  min-width: 0;
}
.chart-card.wide { flex: 2; }
.chart-card h3 { font-size: 14px; font-weight: 700; margin-bottom: 16px; }
.chart-subtitle { font-weight: 400; color: var(--text-muted); }

/* ─── Tables ───────────────────────────────────────────── */
.table-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  margin-bottom: 14px;
  overflow: hidden;
}
.table-card h3 { font-size: 14px; font-weight: 700; padding: 16px 20px 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 16px; text-align: left; font-size: 13px; white-space: nowrap; }
th { background: #f8fafc; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; font-size: 11px; border-bottom: 1px solid var(--border); }
td { border-bottom: 1px solid #f1f5f9; }
tr:hover td { background: #f8fafc; }
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}
.badge-reservation { background: #dbeafe; color: #1d4ed8; }
.badge-contact { background: #fef3c7; color: #b45309; }
.btn-view {
  background: none; border: 1px solid var(--border); border-radius: 6px;
  padding: 4px 10px; font-size: 12px; cursor: pointer; color: var(--text-muted);
  font-family: inherit;
}
.btn-view:hover { border-color: var(--red); color: var(--red); }

/* ─── Filters ──────────────────────────────────────────── */
.filters-bar {
  display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px;
  align-items: center;
}
.filters-bar select, .filters-bar input {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  background: var(--card);
  color: var(--text);
}
.filters-bar input[type="date"] { min-width: 140px; }

/* ─── Buttons ──────────────────────────────────────────── */
.btn {
  background: var(--red); color: #fff; border: none; border-radius: 8px;
  padding: 8px 16px; font-size: 13px; font-weight: 600; cursor: pointer;
  font-family: inherit; transition: background .15s;
}
.btn:hover { background: var(--red-dark); }
.btn-outline {
  background: none; color: var(--text-muted); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 16px; font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: inherit;
}
.btn-outline:hover { border-color: var(--red); color: var(--red); }

/* ─── Pagination ───────────────────────────────────────── */
.pagination {
  display: flex; justify-content: center; align-items: center; gap: 8px;
  padding: 14px;
}
.pagination button {
  background: var(--card); border: 1px solid var(--border); border-radius: 6px;
  padding: 6px 12px; font-size: 12px; cursor: pointer; font-family: inherit;
}
.pagination button.active { background: var(--red); color: #fff; border-color: var(--red); }
.pagination button:disabled { opacity: .4; cursor: not-allowed; }

/* ─── Info Cards ───────────────────────────────────────── */
.info-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px 24px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.info-card h3 { font-size: 14px; font-weight: 700; margin-bottom: 14px; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.info-item { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #f1f5f9; }
.info-label { color: var(--text-muted); font-size: 13px; }
.info-value { font-weight: 600; font-size: 13px; }
.status-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px;
}
.status-dot.green { background: var(--green); }
.text-muted { color: var(--text-muted); font-size: 13px; line-height: 1.6; }

/* ─── Realtime Badge ──────────────────────────────────── */
.realtime-badge {
  display: flex; align-items: center; gap: 6px;
  background: var(--green-light); color: var(--green);
  padding: 6px 14px; border-radius: 20px;
  font-size: 13px; font-weight: 600;
}
/* ─── Change Indicators ───────────────────────────────── */
.change-up { color: var(--green); font-weight: 600; }
.change-down { color: var(--red); font-weight: 600; }
.change-neutral { color: var(--text-muted); font-weight: 600; }

/* ─── Stat List ────────────────────────────────────────── */
.stat-list { display: flex; flex-direction: column; gap: 8px; }
.stat-list-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px solid #f1f5f9;
}
.stat-list-label { font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.stat-list-count { font-size: 14px; font-weight: 700; color: var(--text); }

/* ─── Modal ────────────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5);
  z-index: 200; justify-content: center; align-items: center;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--card); border-radius: var(--radius);
  width: 90%; max-width: 560px; max-height: 80vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.15);
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 24px; border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 16px; font-weight: 700; }
.modal-close {
  background: none; border: none; font-size: 24px; color: var(--text-muted);
  cursor: pointer; line-height: 1;
}
.modal-body { padding: 20px 24px; }
.modal-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #f1f5f9; }
.modal-label { color: var(--text-muted); font-size: 13px; }
.modal-value { font-weight: 600; font-size: 13px; text-align: right; max-width: 60%; word-break: break-word; }

/* ─── Login Screen ─────────────────────────────────────── */
.login-screen {
  display: flex;
  position: fixed; inset: 0;
  background: var(--bg);
  z-index: 300;
  align-items: center;
  justify-content: center;
}
.login-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 40px 36px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 24px rgba(0,0,0,.08);
  width: 90%;
  max-width: 380px;
}

/* ─── Loading ──────────────────────────────────────────── */
.loading { text-align: center; padding: 40px; color: var(--text-muted); }

/* ─── Sidebar Overlay (mobile) ─────────────────────────── */
.sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4);
  z-index: 99;
}
.sidebar-overlay.active { display: block; }

/* ─── Responsive ───────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.active + .sidebar.open ~ .main-content { pointer-events: none; }
  .mobile-header { display: flex; }
  .main-content { margin-left: 0; padding: 72px 12px 24px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi-card { padding: 14px 16px; }
  .kpi-value { font-size: 22px; }
  .kpi-label { font-size: 11px; }
  .charts-row { flex-direction: column; }
  .chart-card { padding: 16px; }
  .chart-card h3 { font-size: 13px; margin-bottom: 12px; }
  .filters-bar { flex-direction: column; }
  .filters-bar select, .filters-bar input { width: 100%; }
  .view-header { flex-direction: column; gap: 8px; align-items: flex-start; }
  .view-header h1 { font-size: 20px; }
  .table-card h3 { font-size: 13px; padding: 12px 16px 0; }
  th, td { padding: 8px 12px; font-size: 12px; }
  .modal { width: 95%; max-height: 90vh; }
  .modal-header { padding: 14px 18px; }
  .modal-body { padding: 16px 18px; }
  .info-grid { grid-template-columns: 1fr; }
  .pagination button { padding: 6px 10px; font-size: 11px; }
}
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .main-content { padding: 64px 10px 20px; }
}
