:root {
  --navy: #0F172A;
  --navy-light: #1E293B;
  --slate: #64748B;
  --slate-light: #94A3B8;
  --ice: #E2E8F0;
  --snow: #F8FAFC;
  --white: #FFFFFF;
  --surface: #F1F5F9;
  --indigo: #6366F1;
  --indigo-rgb: 99, 102, 241;
  --emerald: #10B981;
  --emerald-dark: #059669;
  --amber: #F59E0B;
  --amber-dark: #D97706;
  --red: #EF4444;
  --red-light: #FEE2E2;
  --blue: #3B82F6;
  --font-heading: 'DM Sans', system-ui, -apple-system, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --radius: 16px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 6px rgba(0,0,0,.05), 0 2px 4px rgba(0,0,0,.03);
  --shadow-lg: 0 10px 25px rgba(0,0,0,.08);
  --transition: .2s ease;
}

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

html, body {
  height: 100%;
  font-family: var(--font-body);
  background: var(--snow);
  color: var(--navy);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

button { border: none; cursor: pointer; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; }

.screen { display: none; }
.screen.active { display: flex; }
.hidden { display: none !important; }

/* ═══════ LOGIN ═══════ */
#login-screen {
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  background: linear-gradient(135deg, var(--navy) 0%, #1a1a2e 50%, #16213e 100%);
  padding: 32px;
}

.login-container {
  background: var(--white);
  border-radius: 24px;
  padding: 48px;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.login-logo {
  width: 80px;
  height: 80px;
  margin: 0 auto 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 20px;
  background: rgba(var(--indigo-rgb), .1);
  color: var(--indigo);
}

.login-container h1 {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.login-subtitle {
  color: var(--slate);
  margin-bottom: 32px;
  font-size: .95rem;
}

.login-form { text-align: left; }

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--ice);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  color: var(--navy);
  background: var(--snow);
  transition: border-color var(--transition);
  outline: none;
}

.form-group input:focus {
  border-color: var(--indigo);
  background: var(--white);
}

.btn-primary {
  width: 100%;
  padding: 16px;
  border-radius: var(--radius-sm);
  background: var(--indigo);
  color: var(--white);
  font-size: 1rem;
  font-weight: 700;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-primary:hover { filter: brightness(1.1); }
.btn-primary:active { transform: scale(.98); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

.btn-link {
  display: block;
  margin: 16px auto 0;
  color: var(--slate);
  font-size: .9rem;
  transition: color var(--transition);
}
.btn-link:hover { color: var(--indigo); }

.code-instruction {
  text-align: center;
  margin-bottom: 24px;
  color: var(--slate);
  font-size: .95rem;
  line-height: 1.5;
}

.code-inputs {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 24px;
}

.code-digit {
  width: 52px;
  height: 64px;
  text-align: center;
  font-size: 1.6rem;
  font-weight: 700;
  font-family: var(--font-heading);
  border: 2px solid var(--ice);
  border-radius: var(--radius-sm);
  background: var(--snow);
  color: var(--navy);
  transition: all var(--transition);
  outline: none;
  caret-color: var(--indigo);
}

.code-digit:focus {
  border-color: var(--indigo);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(var(--indigo-rgb), .15);
}

.code-digit.filled {
  border-color: var(--indigo);
  background: rgba(var(--indigo-rgb), .05);
}

.spinner-sm {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════ DASHBOARD ═══════ */
#dashboard-screen {
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--white);
  border-bottom: 1px solid var(--ice);
  position: sticky;
  top: 0;
  z-index: 100;
}

.dash-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.dash-logo {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--indigo);
  color: var(--white);
}

.dash-header-left h1 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
}

.dash-date {
  font-size: .8rem;
  color: var(--slate);
  margin-top: 2px;
}

.dash-header-right {
  display: flex;
  gap: 8px;
}

.btn-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--surface);
  color: var(--slate);
  transition: all var(--transition);
}
.btn-icon:hover { background: var(--ice); color: var(--navy); }
.btn-icon:active { transform: scale(.92); }
.btn-icon--danger:hover { background: var(--red-light); color: var(--red); }

.btn-icon.spinning svg {
  animation: spin .8s linear infinite;
}

/* ═══════ STATS ═══════ */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 16px 24px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-number {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
}

.stat-label {
  font-size: .8rem;
  color: var(--slate);
  font-weight: 500;
}

.stat-pending .stat-number { color: var(--amber-dark); }
.stat-confirmed .stat-number { color: var(--emerald-dark); }
.stat-today .stat-number { color: var(--indigo); }
.stat-total .stat-number { color: var(--navy); }

/* ═══════ TABS ═══════ */
.tabs {
  display: flex;
  gap: 4px;
  padding: 0 24px;
  border-bottom: 1px solid var(--ice);
  background: var(--white);
  position: sticky;
  top: 77px;
  z-index: 99;
}

.tab {
  padding: 12px 20px;
  font-size: .9rem;
  font-weight: 600;
  color: var(--slate);
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
}

.tab:hover { color: var(--navy); }
.tab.active {
  color: var(--indigo);
  border-bottom-color: var(--indigo);
}

.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 50px;
  background: var(--amber);
  color: var(--white);
  font-size: .75rem;
  font-weight: 700;
}

.tab.active .tab-badge { background: var(--indigo); }

/* ═══════ BOOKINGS ═══════ */
.bookings-container {
  flex: 1;
  padding: 16px 24px 32px;
  overflow-y: auto;
}

.booking-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 12px;
}

.booking-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--ice);
  transition: all var(--transition);
  position: relative;
}

.booking-card:hover { box-shadow: var(--shadow-md); }

.booking-card.status-pending { border-left-color: var(--amber); }
.booking-card.status-confirmed { border-left-color: var(--emerald); }
.booking-card.status-cancelled { border-left-color: var(--red); opacity: .6; }
.booking-card.status-no_show { border-left-color: var(--slate); opacity: .6; }

.booking-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.booking-guest-name {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
}

.booking-status {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 50px;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.booking-status.pending { background: rgba(245,158,11,.12); color: var(--amber-dark); }
.booking-status.confirmed { background: rgba(16,185,129,.12); color: var(--emerald-dark); }
.booking-status.cancelled { background: rgba(239,68,68,.1); color: var(--red); }
.booking-status.no_show { background: var(--surface); color: var(--slate); }

.booking-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.booking-detail {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .85rem;
  color: var(--slate);
}

.booking-detail svg { flex-shrink: 0; opacity: .6; }
.booking-detail strong { color: var(--navy); }

.booking-notes {
  font-size: .85rem;
  color: var(--slate);
  background: var(--snow);
  border-radius: var(--radius-xs);
  padding: 10px 12px;
  margin-bottom: 16px;
  border-left: 3px solid var(--ice);
  font-style: italic;
}

.booking-discount {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 50px;
  background: rgba(16,185,129,.1);
  color: var(--emerald-dark);
  font-size: .8rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.booking-actions {
  display: flex;
  gap: 8px;
}

.booking-actions button {
  flex: 1;
  padding: 10px 16px;
  border-radius: var(--radius-xs);
  font-size: .85rem;
  font-weight: 600;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-confirm {
  background: var(--emerald);
  color: var(--white);
}
.btn-confirm:hover { filter: brightness(1.1); }
.btn-confirm:active { transform: scale(.97); }

.btn-reject {
  background: var(--surface);
  color: var(--red);
}
.btn-reject:hover { background: var(--red-light); }
.btn-reject:active { transform: scale(.97); }

.btn-noshow {
  background: var(--surface);
  color: var(--slate);
}
.btn-noshow:hover { background: var(--ice); color: var(--navy); }

/* ═══════ EMPTY / LOADING ═══════ */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  color: var(--slate);
  gap: 16px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--ice);
  border-top-color: var(--indigo);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  color: var(--slate);
  gap: 16px;
  text-align: center;
}

.empty-state p {
  font-size: 1rem;
  font-weight: 500;
}

/* ═══════ TOAST ═══════ */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(120px);
  background: var(--navy);
  color: var(--white);
  padding: 14px 28px;
  border-radius: 50px;
  font-size: .9rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  transition: transform .3s ease;
  z-index: 1000;
  white-space: nowrap;
}

.toast.visible { transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--red); }
.toast.success { background: var(--emerald-dark); }

/* ═══════ RESPONSIVE ═══════ */
@media (max-width: 768px) {
  .stats-bar { grid-template-columns: repeat(2, 1fr); }
  .booking-cards { grid-template-columns: 1fr; }
  .booking-details { grid-template-columns: 1fr; }
  .dash-header { padding: 12px 16px; }
  .stats-bar { padding: 12px 16px; }
  .tabs { padding: 0 16px; }
  .bookings-container { padding: 12px 16px 24px; }
}

@media (min-width: 1200px) {
  .booking-cards { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1600px) {
  .booking-cards { grid-template-columns: repeat(4, 1fr); }
}
