/* ============================================
   BenayaSoft Design System v1.0
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ---------- CSS Custom Properties ---------- */
:root {
  /* Brand Colors */
  --primary: #1f2937;
  --primary-light: #9ca3af;
  --primary-lighter: #f3f4f6;
  --primary-dark: #111827;
  --accent: #1f2937;
  --accent-hover: #374151;

  /* Semantic Colors */
  --success: #16a34a;
  --success-light: #f0fdf4;
  --success-border: #bbf7d0;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --warning-border: #fde68a;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --danger-border: #fecaca;
  --info: #0ea5e9;
  --info-light: #f0f9ff;
  --info-border: #bae6fd;

  /* Neutrals */
  --bg: #ffffff;
  --bg-card: #ffffff;
  --bg-sidebar: #ffffff;
  --bg-hover: #f3f4f6;
  --bg-active: #f3f4f6;
  --border: #e5e7eb;
  --border-light: #f0f0f0;
  --text: #111827;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --text-inverse: #ffffff;

  /* Cash/Bank Colors */
  --cash-color: #d97706;
  --cash-bg: #fffbeb;
  --bank-color: #2563eb;
  --bank-bg: #eff6ff;

  /* Typography */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --fs-xs: 11px;
  --fs-sm: 12px;
  --fs-base: 13px;
  --fs-md: 14px;
  --fs-lg: 16px;
  --fs-xl: 20px;
  --fs-2xl: 24px;
  --fs-3xl: 32px;

  /* Spacing */
  --sp-xs: 4px;
  --sp-sm: 8px;
  --sp-md: 12px;
  --sp-lg: 16px;
  --sp-xl: 24px;
  --sp-2xl: 32px;
  --sp-3xl: 48px;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 20px;
  --radius-lg: 40px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 10px 40px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 20px 60px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
  --shadow-xl: 0 16px 50px rgba(0, 0, 0, 0.16);

  /* Transitions */
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Reset & Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  font-size: var(--fs-base);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  height: 100vh;
}

/* RTL Specific Overrides */
[dir="rtl"] svg {
  transform: scaleX(1) !important; /* Prevent icons from flipping */
}

.force-ltr {
  direction: ltr !important;
  unicode-bidi: isolate !important;
  display: inline-block;
  text-align: left !important;
}

.top-bar-center {
  direction: ltr !important;
}

/* ---------- App Layout ---------- */
.app-container {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 10;
}

.sidebar-header {
  padding: var(--sp-xl);
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  font-size: var(--fs-xl);
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.5px;
}

.sidebar-logo span {
  color: var(--accent);
}

.sidebar-nav {
  flex: 1;
  padding: var(--sp-lg) var(--sp-md);
  overflow-y: auto;
}

.nav-section-label {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: var(--sp-lg) var(--sp-md) var(--sp-sm);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  padding: var(--sp-md) var(--sp-lg);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: var(--fs-md);
  font-weight: 500;
  color: var(--text-secondary);
  transition: var(--transition);
  margin-bottom: 2px;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.nav-item.active {
  background: #000;
  color: #fff;
  font-weight: 600;
}

.nav-item svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.nav-item .badge {
  margin-inline-start: auto;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.sidebar-footer {
  padding: var(--sp-lg);
  border-top: 1px solid var(--border);
}

.user-card {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  padding: var(--sp-sm);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
}

.user-card:hover {
  background: var(--bg-hover);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--primary-lighter);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--accent);
  font-size: var(--fs-sm);
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Top Bar */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-lg) var(--sp-xl);
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  flex-shrink: 0;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: var(--sp-lg);
}

.page-title {
  font-size: var(--fs-xl);
  font-weight: 700;
  color: var(--text);
}

.building-selector {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  padding: var(--sp-sm) var(--sp-lg);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.building-selector:hover {
  border-color: var(--accent);
}

.building-selector .code {
  background: var(--primary-lighter);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: 700;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
}

/* Content Area */
.content-area {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-xl);
}

/* ---------- Cards ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-xl);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-lg);
}

.card-title {
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--text);
}

/* ---------- Tab System ---------- */
.tabs {
  display: flex;
  gap: clamp(16px, 4vw, 40px);
  background: transparent;
  border-bottom: 1px solid var(--border-light);
  padding: 0;
  margin-bottom: var(--sp-xl);
  overflow-x: auto;
  flex-shrink: 0;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  padding: 12px 4px;
  border-radius: 0;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: var(--transition);
  border: none;
  background: transparent;
  position: relative;
}

.tab:hover {
  color: var(--text);
  background: transparent;
}

.tab.active {
  background: transparent;
  color: var(--accent);
  font-weight: 700;
  box-shadow: none;
}

.tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-sm);
  padding: var(--sp-sm) var(--sp-lg);
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--bg-hover);
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-success:hover {
  background: #15803d;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: #b91c1c;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--accent);
  font-weight: 600;
}

.btn-outline:hover {
  background: var(--accent);
  color: #fff;
}

.btn-sm {
  padding: 4px 10px;
  font-size: var(--fs-xs);
}

.btn-lg {
  padding: var(--sp-md) var(--sp-xl);
  font-size: var(--fs-md);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-md);
  background: transparent;
  border: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: var(--transition);
}

.btn-icon:hover {
  background: var(--bg-hover);
  color: var(--text);
}

/* ---------- Form Elements ---------- */
.form-group {
  margin-bottom: var(--sp-lg);
}

.form-label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--sp-xs);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--sp-md) var(--sp-lg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: var(--fs-md);
  color: var(--text);
  background: var(--bg-card);
  transition: var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(75, 85, 99, 0.1);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

.form-hint {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-top: var(--sp-xs);
}

.form-error {
  font-size: var(--fs-xs);
  color: var(--danger);
  margin-top: var(--sp-xs);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-lg);
}

/* Force date inputs to display yyyy-mm-dd */
input[type="date"] {
  font-family: var(--font);
}

input[type="date"]::-webkit-datetime-edit-fields-wrapper {
  font-family: var(--font);
}

input[type="date"]::-webkit-datetime-edit {
  padding: 0;
}

input[type="date"]::-webkit-datetime-edit-year-field,
input[type="date"]::-webkit-datetime-edit-month-field,
input[type="date"]::-webkit-datetime-edit-day-field {
  font-family: var(--font);
  font-size: var(--fs-md);
}

/* Toggle */
.toggle-group {
  display: flex;
  background: var(--bg);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 2px;
}

.toggle-option {
  padding: var(--sp-sm) var(--sp-lg);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  font-weight: 500;
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition);
  border: none;
  background: none;
}

.toggle-option.active {
  background: #000;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* ---------- Tables ---------- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}

.data-table thead {
  background: var(--bg);
}

.data-table th {
  padding: var(--sp-md) var(--sp-lg);
  text-align: start;
  font-weight: 600;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border);
}

.data-table td {
  padding: var(--sp-md) var(--sp-lg);
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.data-table tr:hover td {
  background: var(--bg-hover);
}

.data-table tr:last-child td {
  border-bottom: none;
}

/* ---------- Status Badges ---------- */
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--fs-xs);
  font-weight: 600;
}

.status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.status-active {
  background: var(--success-light);
  color: var(--success);
}

.status-active::before {
  background: var(--success);
}

.status-inactive {
  background: #f3f4f6;
  color: var(--text-muted);
}

.status-inactive::before {
  background: var(--text-muted);
}

.status-pending {
  background: var(--warning-light);
  color: var(--warning);
}

.status-pending::before {
  background: var(--warning);
}

/* ---------- Payment Progress ---------- */
.payment-bar {
  height: 8px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin: var(--sp-sm) 0;
}

.payment-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--success), #4ade80);
  transition: width 0.5s ease;
}

.payment-labels {
  display: flex;
  justify-content: space-between;
  font-size: var(--fs-xs);
}

.payment-paid {
  color: var(--success);
  font-weight: 600;
}

.payment-remaining {
  color: var(--warning);
  font-weight: 600;
}

.payment-total {
  color: var(--text-secondary);
  font-weight: 600;
}

/* ---------- Booking Card (finance/generic) ---------- */
.booking-card {
  background: #fff;
  border: 1px solid #f1f5f9;
  border-radius: 24px;
  padding: 16px 20px;
  margin-bottom: 16px;
  position: relative;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.08);
  transition: var(--transition);
  cursor: default;
}

.booking-card:hover {
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.14);
  transform: translateY(-2px);
}

/* Notes toggle chevron button */
.notes-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  border-radius: 6px;
  transition: transform 0.3s ease, background 0.2s ease;
  color: var(--text-secondary);
}

.notes-toggle-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

.notes-toggle-btn.expanded {
  transform: rotate(180deg);
}

/* Collapsible notes container */
.notes-collapsible {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease, opacity 0.3s ease;
  opacity: 0;
}

.notes-collapsible.open {
  max-height: 200px;
  opacity: 1;
}

/* ---------- Booking Card v2 ---------- */
.bk-card {
  background: #fff;
  border: 1px solid #f1f5f9;
  border-radius: 40px;
  padding: 16px 20px 20px;
  margin-bottom: 24px;
  position: relative;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.12);
  transition: var(--transition);
}

.bk-card:hover {
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.18);
  transform: translateY(-2px);
}

.bk-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.bk-top .bk-icons-left,
.bk-top .bk-icons-right {
  display: flex;
  gap: 16px;
  align-items: center;
  color: #1a1a1a;
}

.bk-top .bk-code {
  font-weight: 600;
  font-size: 16px;
  color: #1a1a1a;
}

.bk-icon-btn {
  cursor: pointer;
  color: inherit;
  display: inline-flex;
  transition: 0.2s opacity;
  background: none;
  border: none;
  padding: 0;
  outline: none;
}

.bk-icon-btn:hover {
  opacity: 0.6;
}

.bk-icon-btn.danger {
  color: #ef4444;
}

.bk-user {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.bk-avatar {
  width: 56px;
  height: 56px;
  background: #cbd5e1;
  border-radius: 50%;
  flex-shrink: 0;
}

.bk-user-info {
  flex: 1;
}

.bk-user-name {
  font-size: 18px;
  font-weight: 500;
  color: #0f172a;
  margin-bottom: 2px;
}

.bk-user-phone {
  font-size: 15px;
  color: #64748b;
}

.bk-user-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  border-left: 1px solid #e2e8f0;
  padding-left: 16px;
  color: #0f172a;
}

.bk-divider {
  border-top: 1px solid #f1f5f9;
  margin: 12px 0;
}

.bk-details {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  font-size: 14px;
  color: #475569;
}

.bk-details-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bk-details-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bk-v-divider {
  width: 1px;
  height: 100%;
  min-height: 70px;
  background: #e2e8f0;
}

.bk-payment-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-weight: 500;
  font-size: 16px;
  color: #000;
}

.bk-progress-wrap {
  position: relative;
  height: 4px;
  background: #cbd5e1;
  border-radius: 2px;
  margin-bottom: 8px;
}

.bk-progress-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: #1f2937;
  border-radius: 2px;
}

.bk-progress-thumb {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  background: #1f2937;
  border-radius: 50%;
}

.bk-payment-bot {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: -10px;
}

.bk-paid {
  color: #10b981;
}

.bk-rem {
  color: #f43f5e;
}

.bk-btn-receive {
  display: block;
  width: 140px;
  margin: 20px auto 0;
  background: #1f2937;
  color: #fff;
  border: none;
  padding: 10px 0;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: 0.2s;
}

.bk-btn-receive:hover {
  background: #333;
}


/* ---------- Balance Table ---------- */
.balance-table {
  width: 100%;
  border-collapse: collapse;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin: var(--sp-lg) 0;
}

.balance-table th {
  padding: var(--sp-md) var(--sp-lg);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
  text-align: center;
  background: var(--primary);
  color: #fff;
}

.balance-table td {
  padding: var(--sp-md) var(--sp-lg);
  text-align: center;
  font-weight: 600;
  font-size: var(--fs-md);
  border-bottom: 1px solid var(--border-light);
}

.balance-table .row-label {
  text-align: left;
  font-weight: 700;
  color: var(--text);
}

.balance-table .cash-row td {
  background: var(--cash-bg);
}

.balance-table .bank-row td {
  background: var(--bank-bg);
}

.balance-table .total-row td {
  background: var(--primary-lighter);
  font-weight: 800;
}

.money-in {
  color: var(--success);
}

.money-out {
  color: var(--danger);
}

/* ---------- Stats Cards ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--sp-lg);
  margin-bottom: var(--sp-xl);
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-xl);
  transition: var(--transition);
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.stat-label {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--sp-sm);
}

.stat-value {
  font-size: var(--fs-2xl);
  font-weight: 800;
  color: var(--text);
}

.stat-sub {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  margin-top: var(--sp-xs);
}

/* ---------- Modal / Dialog ---------- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  transform: scale(0.95) translateY(10px);
  transition: var(--transition-slow);
}

.modal-overlay.open .modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-xl) var(--sp-xl) var(--sp-lg);
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: var(--fs-lg);
  font-weight: 700;
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg);
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--text-secondary);
  transition: var(--transition);
}

.modal-close:hover {
  background: var(--danger-light);
  color: var(--danger);
}

.modal-body {
  padding: var(--sp-xl);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-md);
  padding: var(--sp-lg) var(--sp-xl);
  border-top: 1px solid var(--border);
}

/* ---------- Toast Notification ---------- */
.toast-container {
  position: fixed;
  top: var(--sp-xl);
  right: var(--sp-xl);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--sp-md) var(--sp-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  min-width: 300px;
  animation: slideIn 0.3s ease;
  font-size: var(--fs-sm);
}

.toast.success {
  border-left: 4px solid var(--success);
}

.toast.error {
  border-left: 4px solid var(--danger);
}

.toast.info {
  border-left: 4px solid var(--info);
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ---------- Empty State ---------- */
.empty-state {
  text-align: center;
  padding: var(--sp-3xl);
  color: var(--text-muted);
}

.empty-state svg {
  width: 64px;
  height: 64px;
  margin-bottom: var(--sp-lg);
  color: var(--border);
}

.empty-state h3 {
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--sp-sm);
}

.empty-state p {
  font-size: var(--fs-sm);
}

/* ---------- Loading ---------- */
.loading-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: var(--sp-xl) auto;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- FAB (Floating Action Button) ---------- */
.fab {
  position: fixed;
  bottom: var(--sp-xl);
  right: var(--sp-xl);
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  font-size: 24px;
  transition: var(--transition);
  z-index: 100;
}

.fab:hover {
  background: var(--accent-hover);
  transform: scale(1.05);
}

.fab:active {
  transform: scale(0.95);
}

/* ---------- Chip/Tag ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--fs-xs);
  font-weight: 600;
}

.chip-owner {
  background: var(--primary-lighter);
  color: var(--accent);
}

.chip-receptionist {
  background: #fce7f3;
  color: #be185d;
}

.chip-cash {
  background: var(--cash-bg);
  color: var(--cash-color);
}

.chip-bank {
  background: var(--bank-bg);
  color: var(--bank-color);
}

.chip-daily {
  background: #ecfdf5;
  color: var(--success);
}

.chip-weekly {
  background: #f0f9ff;
  color: var(--info);
}

.chip-monthly {
  background: var(--primary-lighter);
  color: var(--accent);
}

/* ---------- Utility Classes ---------- */
.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-sm {
  gap: var(--sp-sm);
}

.gap-md {
  gap: var(--sp-md);
}

.gap-lg {
  gap: var(--sp-lg);
}

.mt-sm {
  margin-top: var(--sp-sm);
}

.mt-md {
  margin-top: var(--sp-md);
}

.mt-lg {
  margin-top: var(--sp-lg);
}

.mb-md {
  margin-bottom: var(--sp-md);
}

.mb-lg {
  margin-bottom: var(--sp-lg);
}

.text-muted {
  color: var(--text-muted);
}

.text-sm {
  font-size: var(--fs-sm);
}

.text-xs {
  font-size: var(--fs-xs);
}

.fw-600 {
  font-weight: 600;
}

.fw-700 {
  font-weight: 700;
}

.hidden {
  display: none !important;
}

/* ---------- Login Page ---------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  padding: var(--sp-xl);
  position: relative; /* For absolutely positioned bottom items */
}

.login-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: var(--sp-3xl) var(--sp-2xl);
  width: 100%;
  max-width: 400px;
  text-align: center;
  box-shadow: var(--shadow-xl);
}

.login-card h1 {
  font-size: var(--fs-3xl);
  font-weight: 800;
  color: var(--primary);
  margin-bottom: var(--sp-sm);
}

.login-card h1 span {
  color: var(--accent);
}

.login-card p {
  color: var(--text-muted);
  font-size: var(--fs-sm);
  margin-bottom: var(--sp-2xl);
}

.sso-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-md);
  padding: var(--sp-md) var(--sp-xl);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  font-family: var(--font);
  font-size: var(--fs-md);
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  margin-bottom: var(--sp-md);
  transition: var(--transition);
}

.sso-btn:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
}

.sso-btn svg {
  width: 20px;
  height: 20px;
}

/* ---- DEV LOGIN ---- */
.dev-login {
  margin-top: var(--sp-xl);
  padding-top: var(--sp-xl);
  border-top: 1px solid var(--border);
}

.fab:active {
  transform: scale(0.95);
}

/* ---------- Chip/Tag ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--fs-xs);
  font-weight: 600;
}

.chip-owner {
  background: var(--primary-lighter);
  color: var(--accent);
}

.chip-receptionist {
  background: #fce7f3;
  color: #be185d;
}

.chip-cash {
  background: var(--cash-bg);
  color: var(--cash-color);
}

.chip-bank {
  background: var(--bank-bg);
  color: var(--bank-color);
}

.chip-daily {
  background: #ecfdf5;
  color: var(--success);
}

.chip-weekly {
  background: #f0f9ff;
  color: var(--info);
}

.chip-monthly {
  background: var(--primary-lighter);
  color: var(--accent);
}

/* ---------- Utility Classes ---------- */
.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-sm {
  gap: var(--sp-sm);
}

.gap-md {
  gap: var(--sp-md);
}

.gap-lg {
  gap: var(--sp-lg);
}

.mt-sm {
  margin-top: var(--sp-sm);
}

.mt-md {
  margin-top: var(--sp-md);
}

.mt-lg {
  margin-top: var(--sp-lg);
}

.mb-md {
  margin-bottom: var(--sp-md);
}

.mb-lg {
  margin-bottom: var(--sp-lg);
}

.text-muted {
  color: var(--text-muted);
}

.text-sm {
  font-size: var(--fs-sm);
}

.text-xs {
  font-size: var(--fs-xs);
}

.fw-600 {
  font-weight: 600;
}

.fw-700 {
  font-weight: 700;
}

.hidden {
  display: none !important;
}

/* ---------- Login Page ---------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  padding: var(--sp-xl);
  position: relative;
}

.login-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: var(--sp-3xl) var(--sp-2xl);
  width: 100%;
  max-width: 400px;
  text-align: center;
  box-shadow: var(--shadow-xl);
}

.login-card h1 {
  font-size: var(--fs-3xl);
  font-weight: 800;
  color: var(--primary);
  margin-bottom: var(--sp-sm);
}

.login-card h1 span {
  color: var(--accent);
}

.login-card p {
  color: var(--text-muted);
  font-size: var(--fs-sm);
  margin-bottom: var(--sp-2xl);
}

.sso-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-md);
  padding: var(--sp-md) var(--sp-xl);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  font-family: var(--font);
  font-size: var(--fs-md);
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  margin-bottom: var(--sp-md);
  transition: var(--transition);
}

.sso-btn:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
}

.sso-btn svg {
  width: 20px;
  height: 20px;
}

/* ---- DEV LOGIN ---- */
.dev-login {
  margin-top: var(--sp-xl);
  padding-top: var(--sp-xl);
  border-top: 1px solid var(--border);
}

.dev-login p {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-bottom: var(--sp-md);
}

/* intl-tel-input overrides */
.iti {
  width: 100%;
  display: block;
}

/* ---------- Booking Grid Layout ---------- */
.bookings-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 1024px) {
  .bookings-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.bookings-grid .bk-card {
  margin-bottom: 0;
  height: 100%;
}

.bookings-grid .booking-card {
  margin-bottom: 0;
}

/* ---------- Search Styles ---------- */
.search-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-input-wrapper {
  position: relative;
  flex: 1;
  max-width: 400px;
}

.search-input-wrapper svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-input-wrapper input {
  padding-left: 44px !important;
  height: 44px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
  border-radius: 12px !important;
}

.search-input-wrapper input:focus {
  border-color: var(--accent);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

/* ============================================
   RESPONSIVE LAYOUT (MOBILE OPTIMIZATION)
   ============================================ */

/* Responsive Grid Utilities */
.responsive-grid {
  display: grid;
  gap: var(--sp-lg);
}

.grid-2-1 {
  grid-template-columns: 2fr 1fr;
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-2 {
  grid-template-columns: 1fr 1fr;
}

@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
    overflow: visible;
  }

  /* Transform Sidebar to Bottom Navbar */
  .sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 64px;
    z-index: 1000;
    flex-direction: row;
    border-right: none;
    border-top: 1px solid var(--border);
    background: var(--bg-card);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.06);
    padding: 0;
  }

  .sidebar-header {
    display: none;
    /* Hide logo on mobile */
  }

  .sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: row;
    padding: 0 4px;
    align-items: center;
    justify-content: space-around;
    overflow: visible;
    direction: ltr !important; /* Force icons to stay in English order */
  }

  .nav-section-label {
    display: none;
  }

  .nav-item {
    flex-direction: column;
    gap: 4px;
    padding: 6px 2px;
    margin-bottom: 0;
    border-radius: var(--radius-sm);
    flex: 1;
    justify-content: center;
    align-items: center;
    min-width: 0;
    font-size: 10px;
    color: var(--text-muted);
  }

  .nav-item svg {
    width: 20px;
    height: 20px;
  }

  .nav-item.active {
    background: transparent;
    color: var(--accent);
  }

  .sidebar-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 0;
    flex-shrink: 0;
    cursor: pointer;
    direction: ltr !important; /* Keep profile avatar on consistent side */
  }

  .user-card {
    padding: 4px;
    gap: 0;
  }

  .user-info {
    display: none;
    /* Only avatar on mobile bottom nav */
  }

  .user-avatar {
    width: 32px;
    height: 32px;
    font-size: 11px;
    border: 1.5px solid var(--border);
  }

  /* Main Content Adjustments */
  .main-content {
    flex: 1;
    height: auto;
    min-height: 100vh;
    padding-bottom: 80px;
    /* Space for bottom navbar + buffer */
    overflow-y: auto;
  }

  .top-bar {
    padding: var(--sp-md) var(--sp-lg);
    position: sticky;
    top: 0;
    z-index: 900;
  }

  .page-title {
    font-size: var(--fs-lg);
  }

  .content-area {
    padding: var(--sp-lg);
    overflow: visible;
  }

  /* Grid Adjustments */
  .bookings-grid {
    grid-template-columns: 1fr !important;
    gap: var(--sp-lg);
  }

  .form-row {
    grid-template-columns: 1fr !important;
    gap: 0 !important;
  }

  .grid-2-1,
  .grid-3,
  .grid-2 {
    grid-template-columns: 1fr !important;
    gap: var(--sp-md) !important;
  }

  .filter-bar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
  }

  .filter-bar .form-input {
    width: 100% !important;
  }

  .filter-divider {
    display: none;
  }

  /* Sticky Search Positioning on Mobile */
  .sticky-search {
    top: 64px !important;
  }

  /* Adjust FAB to sit well above bottom navbar and OS controls */
  .fab {
    bottom: 120px !important;
    right: 16px !important;
  }

  /* Force horizontal scroll for data-tables in wrappers */
  .table-wrapper .data-table {
    min-width: 800px;
    width: max-content;
  }
}

/* Sticky Search & Scroll Utilities */
.sticky-search {
  position: sticky;
  top: -24px;
  /* Default offset in content-area */
  z-index: 100;
  background: var(--bg);
  padding: 12px 0;
  margin-top: -12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}



.table-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: var(--sp-lg);
  border-radius: var(--radius-md);
}

.table-wrapper::-webkit-scrollbar {
  height: 6px;
}

.table-wrapper::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 10px;
}