/* Gramophone Operations System — Brand Theme */
:root {
  --green-dark: #1a3d32;
  --green: #2d5a4a;
  --green-light: #3d7562;
  --brown-dark: #1c1612;
  --brown: #3d2f24;
  --beige: #e8dcc8;
  --beige-dark: #d4c4a8;
  --cream: #f7f3eb;
  --gold: #b8956a;
  --gold-light: #d4b896;
  --white: #ffffff;
  --text: #2a221c;
  --text-muted: #6b5d4f;
  --border: #e5ddd0;
  --shadow: 0 4px 24px rgba(26, 61, 50, 0.08);
  --shadow-lg: 0 12px 40px rgba(26, 61, 50, 0.12);
  --radius: 12px;
  --radius-lg: 16px;
  --sidebar-width: 260px;
  --header-height: 64px;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-ar: 'Segoe UI', 'Traditional Arabic', serif;
}

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

html { font-size: 15px; scroll-behavior: smooth; overflow-x: hidden; }

body {
  font-family: var(--font);
  background: var(--cream);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: var(--green); text-decoration: none; }
a:hover { color: var(--green-light); }

/* ===== LOGIN ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--green-dark) 0%, var(--brown-dark) 50%, var(--green) 100%);
  padding: 2rem;
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.5;
}

.login-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
}

.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo img,
.login-logo-mark img,
.brand-logo {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 1rem;
  box-shadow: 0 4px 16px rgba(26, 61, 50, 0.2);
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.login-error {
  margin-top: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius);
  background: rgba(192, 57, 43, 0.1);
  color: #a93226;
  font-size: 0.875rem;
  text-align: center;
}

.login-logo h1 {
  font-size: 1.75rem;
  color: var(--green-dark);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.login-logo p {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

.login-logo .arabic {
  font-family: var(--font-ar);
  font-size: 1.25rem;
  color: var(--gold);
  margin-top: 0.5rem;
}

/* ===== LAYOUT ===== */
.app-layout {
  display: flex;
  min-height: 100vh;
  max-width: 100%;
  overflow-x: hidden;
}

.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, var(--green-dark) 0%, var(--brown-dark) 100%);
  color: var(--cream);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
}

.sidebar-brand {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-brand img,
.sidebar-logo img,
.sidebar-brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  display: block;
}

.sidebar-brand-text h2 {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
}

.sidebar-brand-text span {
  font-size: 0.7rem;
  opacity: 0.7;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  color: rgba(247, 243, 235, 0.75);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
  margin-bottom: 0.25rem;
}

.nav-item:hover {
  background: rgba(255,255,255,0.08);
  color: var(--cream);
}

.nav-item.active {
  background: rgba(184, 149, 106, 0.25);
  color: var(--gold-light);
}

.nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 0.75rem;
  opacity: 0.5;
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}

.topbar {
  height: var(--header-height);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 50;
  max-width: 100%;
  min-width: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
  padding: 0.5rem;
}

.topbar-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--green-dark);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.branch-select {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--cream);
  font-size: 0.875rem;
  color: var(--text);
  cursor: pointer;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--green);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
}

.user-info span { display: block; font-size: 0.875rem; font-weight: 600; }
.user-info small { font-size: 0.75rem; color: var(--text-muted); }

.page-content {
  padding: 1.5rem;
  max-width: min(1400px, 100%);
  min-width: 0;
  overflow-x: hidden;
}

/* ===== COMPONENTS ===== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
  max-width: 100%;
}

.page-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--green-dark);
}

.page-header p {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  white-space: nowrap;
}

.btn-primary {
  background: var(--green);
  color: var(--white);
}
.btn-primary:hover { background: var(--green-light); color: var(--white); }

.btn-gold {
  background: var(--gold);
  color: var(--white);
}
.btn-gold:hover { background: var(--gold-light); color: var(--white); }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--green); color: var(--green); }

.btn-danger {
  background: #c0392b;
  color: var(--white);
}
.btn-danger:hover { background: #e74c3c; }

.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8125rem; }
.btn-icon { padding: 0.5rem; }

.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  max-width: 100%;
  min-width: 0;
}

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--green-dark);
}

.card-body { padding: 1.5rem; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon.green { background: rgba(45, 90, 74, 0.12); color: var(--green); }
.stat-icon.gold { background: rgba(184, 149, 106, 0.15); color: var(--gold); }
.stat-icon.beige { background: rgba(232, 220, 200, 0.5); color: var(--brown); }

.stat-info label {
  font-size: 0.8125rem;
  color: var(--text-muted);
  display: block;
}

.stat-info .value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--green-dark);
  line-height: 1.2;
}

.stat-info .change {
  font-size: 0.75rem;
  margin-top: 0.25rem;
}

.change.up { color: #27ae60; }
.change.down { color: #c0392b; }

/* Forms */
.form-group { margin-bottom: 1.25rem; }

.form-group label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.375rem;
}

.form-control {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-family: inherit;
  background: var(--white);
  color: var(--text);
  transition: border-color 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(45, 90, 74, 0.1);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

select.form-control { cursor: pointer; }

textarea.form-control { resize: vertical; min-height: 80px; }

.form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
}

.form-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

/* Tables */
.table-wrapper {
  overflow-x: auto;
  max-width: 100%;
  width: 100%;
  -webkit-overflow-scrolling: touch;
}

.table-wide {
  min-width: 960px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

thead th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tbody tr:hover { background: rgba(232, 220, 200, 0.2); }

.table-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-active { background: rgba(39, 174, 96, 0.12); color: #27ae60; }
.badge-pending { background: rgba(243, 156, 18, 0.12); color: #f39c12; }
.badge-preparing { background: rgba(52, 152, 219, 0.12); color: #3498db; }
.badge-served { background: rgba(39, 174, 96, 0.12); color: #27ae60; }
.badge-cancelled { background: rgba(192, 57, 43, 0.12); color: #c0392b; }
.badge-closed { background: rgba(107, 93, 79, 0.12); color: var(--text-muted); }
.badge-paid { background: rgba(39, 174, 96, 0.12); color: #27ae60; }
.badge-workspace { background: rgba(45, 90, 74, 0.12); color: var(--green); }
.badge-meeting { background: rgba(184, 149, 106, 0.15); color: var(--gold); }
.badge-study { background: rgba(52, 152, 219, 0.12); color: #3498db; }
.badge-event { background: rgba(155, 89, 182, 0.12); color: #9b59b6; }
.badge-cafe { background: rgba(230, 126, 34, 0.12); color: #e67e22; }
.badge-gold { background: rgba(184, 149, 106, 0.2); color: var(--gold); }
.badge-owner { background: rgba(184, 149, 106, 0.2); color: var(--gold); }
.badge-manager { background: rgba(45, 90, 74, 0.15); color: var(--green); }
.badge-cashier { background: rgba(52, 152, 219, 0.12); color: #3498db; }
.badge-waiter { background: rgba(230, 126, 34, 0.12); color: #e67e22; }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(28, 22, 18, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}

.modal-overlay.active { opacity: 1; visibility: visible; }

.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(20px);
  transition: transform 0.3s;
}

.modal-overlay.active .modal { transform: translateY(0); }

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 { font-size: 1.125rem; font-weight: 600; color: var(--green-dark); }

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.25rem;
}

.modal-body { padding: 1.5rem; }
.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Charts */
.chart-grid,
.report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  min-width: 0;
}

.chart-pie-layout {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  max-width: 100%;
}

.chart-pie-donut {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  flex-shrink: 0;
}

.chart-pie-legend {
  flex: 1 1 160px;
  min-width: 0;
}

.chart-pie-legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.8125rem;
}

.chart-pie-legend-row span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-container {
  position: relative;
  height: 280px;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}

.empty-state svg {
  width: 64px;
  height: 64px;
  margin-bottom: 1rem;
  opacity: 0.4;
}

.empty-state h3 {
  font-size: 1.125rem;
  color: var(--text);
  margin-bottom: 0.5rem;
}

/* Invoice */
.invoice-preview {
  background: var(--cream);
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
}

.invoice-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid var(--green);
}

.invoice-logo {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.invoice-logo img {
  width: 56px;
  height: 56px;
  border-radius: 50%;
}

.invoice-line {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  font-size: 0.875rem;
}

.invoice-line.total {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--green-dark);
  border-top: 2px solid var(--green);
  padding-top: 1rem;
  margin-top: 0.5rem;
}

.invoice-section { margin-bottom: 1.5rem; }
.invoice-totals {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--border);
}
.invoice-section h4 {
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

/* Session detail */
.session-timer {
  background: linear-gradient(135deg, var(--green-dark), var(--green));
  color: var(--white);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  margin-bottom: 1.5rem;
}

.session-timer .duration {
  font-size: 3rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.05em;
}

.session-timer label {
  font-size: 0.875rem;
  opacity: 0.8;
  display: block;
  margin-bottom: 0.5rem;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.info-row {
  display: flex;
  justify-content: space-between;
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

.info-row:last-child { border-bottom: none; }
.info-row .label { color: var(--text-muted); }
.info-row .value { font-weight: 600; }

/* Product grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.product-card {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.product-card .category {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.product-card .name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--green-dark);
}

.product-card .price {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--gold);
}

.product-card .actions {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
}

/* Filters bar */
.filters-bar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  align-items: center;
  max-width: 100%;
}

.filters-bar .form-control { width: auto; min-width: 160px; }

.filter-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-weight: 600;
}

.report-summary-banner { margin-bottom: 1.5rem; }

.report-filter-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem 1.25rem;
  font-size: 0.875rem;
}

.report-filter-summary strong { color: var(--green-dark); }

.revenue-breakdown-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: 1rem 1.5rem;
  min-width: 0;
}

.revenue-breakdown-item small {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.revenue-breakdown-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
  margin-bottom: 0.35rem;
}

.revenue-breakdown-bar {
  background: var(--border);
  border-radius: 6px;
  height: 8px;
  overflow: hidden;
  margin-bottom: 0.25rem;
}

.revenue-breakdown-bar > div {
  height: 100%;
  border-radius: 6px;
  transition: width 0.4s ease;
}

.revenue-breakdown-total {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1rem;
  margin-top: 0.5rem;
  border-top: 2px solid var(--border);
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--green-dark);
}

.stat-info small {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.role-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.role-card {
  padding: 1.25rem;
  border-left: 4px solid var(--green);
}

.role-card.owner { border-color: var(--gold); }
.role-card.manager { border-color: var(--green); }
.role-card.cashier { border-color: #3498db; }
.role-card.waiter { border-color: #e67e22; }

.role-card h4 { margin-bottom: 0.5rem; }
.role-card ul {
  list-style: none;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.role-card ul li {
  padding: 0.25rem 0;
  padding-left: 1rem;
  position: relative;
}

.role-card ul li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--gold);
}

/* Toast */
.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: var(--green-dark);
  color: var(--white);
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  animation: slideIn 0.3s ease;
  max-width: 360px;
}

.toast.success { background: #27ae60; }
.toast.error { background: #c0392b; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Print */
@media print {
  @page {
    size: A4 portrait;
    margin: 10mm 12mm;
  }

  html, body {
    background: white !important;
    overflow: visible !important;
    height: auto !important;
  }

  .sidebar, .topbar, .btn, .modal-overlay, .no-print,
  .toast-container, .checkout-layout > .card { display: none !important; }

  .main-content {
    margin: 0 !important;
    max-width: none !important;
    overflow: visible !important;
  }

  html[dir="rtl"] .main-content { margin-right: 0 !important; }

  .page-content {
    padding: 0 !important;
    max-width: none !important;
    overflow: visible !important;
  }

  .checkout-layout {
    display: block !important;
    gap: 0 !important;
  }

  .invoice-preview {
    page-break-inside: avoid;
    break-inside: avoid;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 auto !important;
    max-width: 100% !important;
    background: white !important;
  }

  .invoice-header {
    margin-bottom: 0.75rem !important;
    padding-bottom: 0.6rem !important;
    page-break-after: avoid;
    break-after: avoid;
  }

  .invoice-section {
    margin-bottom: 0.65rem !important;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .invoice-totals {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    page-break-before: avoid;
    break-before: avoid;
    margin-top: 0.35rem !important;
    padding-top: 0.35rem !important;
  }

  .invoice-line.total {
    page-break-before: avoid;
    break-before: avoid;
    margin-top: 0.35rem !important;
    padding-top: 0.5rem !important;
    font-size: 1.1rem !important;
  }

  .invoice-line,
  .info-row {
    padding: 0.2rem 0 !important;
    font-size: 0.8rem !important;
  }

  .invoice-section h4 {
    margin-bottom: 0.35rem !important;
    font-size: 0.72rem !important;
  }

  .invoice-logo img {
    width: 44px !important;
    height: 44px !important;
  }

  .card {
    break-inside: avoid;
    box-shadow: none !important;
  }
}

/* Responsive */
@media (max-width: 1024px) {
  .chart-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .menu-toggle { display: block; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .page-content { padding: 1rem; }
  .session-timer .duration { font-size: 2rem; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
  .topbar-right .user-info { display: none; }
}

/* ===== RTL / Arabic ===== */
body.rtl,
html[dir="rtl"] body {
  font-family: 'Tajawal', var(--font);
}

html[dir="rtl"] .sidebar {
  left: auto;
  right: 0;
}

html[dir="rtl"] .main-content {
  margin-left: 0;
  margin-right: var(--sidebar-width);
  min-width: 0;
  max-width: 100%;
}

html[dir="rtl"] thead th,
html[dir="rtl"] .info-row,
html[dir="rtl"] .invoice-line {
  text-align: right;
}

html[dir="rtl"] .role-card ul li {
  padding-left: 0;
  padding-right: 1rem;
}

html[dir="rtl"] .role-card ul li::before {
  left: auto;
  right: 0;
}

html[dir="rtl"] .toast-container {
  right: auto;
  left: 1rem;
}

html[dir="rtl"] .role-card {
  border-left: none;
  border-right: 4px solid var(--green);
}

html[dir="rtl"] .role-card.owner { border-right-color: var(--gold); }
html[dir="rtl"] .role-card.manager { border-right-color: var(--green); }
html[dir="rtl"] .role-card.cashier { border-right-color: #3498db; }
html[dir="rtl"] .role-card.waiter { border-right-color: #e67e22; }

.lang-toggle {
  min-width: 44px;
  font-weight: 700;
  font-family: inherit;
}

.login-lang {
  position: absolute;
  top: 1.5rem;
  inset-inline-end: 1.5rem;
  z-index: 2;
}

html[dir="rtl"] .login-lang {
  inset-inline-end: auto;
  inset-inline-start: 1.5rem;
}

@media (max-width: 768px) {
  html[dir="rtl"] .sidebar {
    transform: translateX(100%);
  }
  html[dir="rtl"] .sidebar.open {
    transform: translateX(0);
  }
  html[dir="rtl"] .main-content {
    margin-right: 0;
  }
}

/* ===== CUSTOMER BOOKING (Phase 3) ===== */
.booking-page .login-page {
  align-items: flex-start;
  padding-top: 1.5rem;
  padding-bottom: 3rem;
}

.booking-card {
  max-width: 560px;
  width: 100%;
}

.booking-card-wide {
  max-width: 720px;
  width: 100%;
}

.booking-hero {
  text-align: center;
  margin-bottom: 1.5rem;
}

.booking-hero h1 {
  font-size: 1.75rem;
  color: var(--green-dark);
  margin-bottom: 0.35rem;
}

.booking-hero p {
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.booking-options {
  display: grid;
  gap: 1rem;
  margin-top: 1.5rem;
}

.booking-option {
  display: block;
  padding: 1.25rem 1.5rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--cream);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.booking-option:hover {
  border-color: var(--green);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
  color: inherit;
}

.booking-option-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
}

.booking-option-icon.green { background: rgba(45, 90, 74, 0.12); }
.booking-option-icon.gold { background: rgba(184, 149, 106, 0.2); }
.booking-option-icon.beige { background: rgba(232, 220, 200, 0.8); }

.booking-option h3 {
  font-size: 1.0625rem;
  color: var(--green-dark);
  margin-bottom: 0.25rem;
}

.booking-option p {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: 0;
}

.booking-steps {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.booking-step {
  flex: 1;
  min-width: 70px;
  text-align: center;
  padding: 0.5rem;
  border-radius: var(--radius);
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--cream);
  color: var(--text-muted);
}

.booking-step.active {
  background: var(--green);
  color: var(--white);
}

.booking-step.done {
  background: var(--beige);
  color: var(--green-dark);
}

.booking-summary {
  background: var(--cream);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 1rem 0;
}

.booking-summary .info-row {
  display: flex;
  justify-content: space-between;
  padding: 0.35rem 0;
  font-size: 0.875rem;
}

.booking-summary .info-row.total {
  border-top: 1px solid var(--border);
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  font-weight: 700;
  font-size: 1rem;
  color: var(--green-dark);
}

.booking-footer-link {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.8125rem;
}

.booking-footer-link a {
  color: var(--gold);
  font-weight: 600;
}

.booking-success-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--green);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin: 0 auto 1rem;
}

.payment-methods {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.payment-method-btn {
  padding: 0.75rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  transition: border-color 0.2s;
}

.payment-method-btn.selected {
  border-color: var(--green);
  background: rgba(45, 90, 74, 0.06);
}

.booking-note {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 0.75rem;
}

.alert {
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.alert-info {
  background: rgba(45, 90, 74, 0.1);
  border: 1px solid rgba(45, 90, 74, 0.25);
  color: var(--primary-dark);
}

.booking-filter-notice .alert {
  font-size: 0.9rem;
}

.area-picker {
  display: grid;
  gap: 0.5rem;
  max-height: 220px;
  overflow-y: auto;
}

.area-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.2s;
}

.area-option.selected {
  border-color: var(--green);
  background: rgba(45, 90, 74, 0.05);
}

.area-option input {
  accent-color: var(--green);
}

@media (min-width: 640px) {
  .booking-options {
    grid-template-columns: 1fr;
  }
}
