:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --border: #cbd5e1;
  --text: #0f172a;
  --text-muted: #475569;
  --primary: #b91c1c;
  --primary-hover: #991b1b;
  --accent: #d97706;
  --success: #15803d;
  --warning: #b45309;
  --danger: #dc2626;
  --info: #0369a1;
  --radius: 10px;
  --shadow: 0 2px 8px rgba(15, 23, 42, 0.07);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Nastaliq Urdu', 'Jameel Noori Nastaleeq', sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

[dir="rtl"] {
  font-family: 'Noto Nastaliq Urdu', 'Jameel Noori Nastaleeq', Tahoma, system-ui, sans-serif;
}

button, input, select, textarea {
  font: inherit;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover { background: #e2e8f0; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-warning { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-sm { min-height: 36px; padding: 4px 11px; font-size: 13px; }
.btn-block { width: 100%; }

.input, select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}
textarea { min-height: 76px; }
label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 4px; color: var(--text-muted); }

.demo-ribbon {
  background: #7c2d12;
  color: #fef3c7;
  padding: 6px 16px;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.app-shell {
  display: grid;
  grid-template-columns: 245px 1fr;
  min-height: 100vh;
}
.sidebar {
  background: #0f172a;
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  padding: 14px 10px;
}
.brand-box {
  padding: 8px 10px 14px;
  border-bottom: 1px solid #1e293b;
  margin-bottom: 10px;
}
.brand-box h1 { margin: 0; font-size: 17px; color: #fff; }
.brand-box small { color: #94a3b8; font-size: 12px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  margin-bottom: 3px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #cbd5e1;
  text-align: start;
  font-weight: 600;
  cursor: pointer;
}
.nav-item:hover { background: #1e293b; color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }

.main-area {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 10px 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.topbar-right { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.content-pad { padding: 18px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.card h2, .card h3 { margin-top: 0; margin-bottom: 12px; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.kpi-label { font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; }
.kpi-value { font-size: 22px; font-weight: 800; margin-top: 4px; color: var(--text); }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 12px; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.badge-ok { background: #dcfce7; color: #166534; }
.badge-warn { background: #fef3c7; color: #92400e; }
.badge-err { background: #fee2e2; color: #991b1b; }
.badge-info { background: #e0f2fe; color: #075985; }

/* POS Layout */
.pos-layout {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 14px;
  align-items: start;
}
.cat-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.cat-tab {
  min-height: 44px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-weight: 700;
  cursor: pointer;
}
.cat-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.pos-products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
  gap: 10px;
}
.pos-prod-tile {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  min-height: 112px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  text-align: start;
}
.pos-prod-tile:hover { border-color: var(--primary); background: #fff5f5; }
.pos-prod-name { font-weight: 700; font-size: 14px; }
.pos-prod-ur { font-size: 13px; color: var(--text-muted); }
.pos-prod-price { font-weight: 800; color: var(--primary); margin-top: 6px; font-size: 15px; }

.pos-cart {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  position: sticky;
  top: 12px;
}
.cart-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
}
.qty-btn {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  font-weight: 800;
  font-size: 17px;
  cursor: pointer;
}

/* Floor Tables */
.tables-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 12px;
}
.table-card {
  border-radius: 12px;
  padding: 14px;
  border: 2px solid var(--border);
  background: var(--surface);
  cursor: pointer;
}
.table-card.status-available { border-color: #22c55e; background: #f0fdf4; }
.table-card.status-occupied { border-color: #ef4444; background: #fef2f2; }
.table-card.status-reserved { border-color: #f59e0b; background: #fffbeb; }
.table-card.status-cleaning { border-color: #3b82f6; background: #eff6ff; }
.table-card.status-out_of_service { border-color: #64748b; background: #f1f5f9; opacity: 0.75; }

/* KDS */
.kds-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}
.kds-card {
  background: #fff;
  border: 2px solid #334155;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.kds-card.overdue { border-color: #dc2626; }
.kds-header {
  background: #1e293b;
  color: #fff;
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.kds-card.overdue .kds-header { background: #b91c1c; }

/* Tables */
.data-table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data-table th, table.data-table td {
  padding: 9px 10px;
  border-bottom: 1px solid #e2e8f0;
  text-align: start;
}
table.data-table th { background: #f8fafc; font-weight: 700; color: var(--text-muted); }

/* Auth / Setup Center Card */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}
.auth-card {
  width: 100%;
  max-width: 620px;
  background: #fff;
  border-radius: 14px;
  padding: 26px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1000;
}
.modal-box {
  background: #fff;
  border-radius: 12px;
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px;
}

.toast {
  position: fixed;
  bottom: 18px;
  inset-inline-end: 18px;
  background: #0f172a;
  color: #fff;
  padding: 12px 18px;
  border-radius: 10px;
  font-weight: 600;
  z-index: 2000;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}
.toast.error { background: #b91c1c; }
.toast.success { background: #15803d; }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; overflow-x: auto; padding: 8px; gap: 6px; }
  .brand-box { display: none; }
  .nav-item { width: auto; white-space: nowrap; margin-bottom: 0; }
  .pos-layout { grid-template-columns: 1fr; }
  .pos-cart { position: static; }
}

/* RMS reporting theme: navy navigation, warm gold accents, responsive workspace */
:root { --bg:#f1f3f6; --surface:#fff; --surface-alt:#f7f8fa; --border:#e1e5eb; --text:#15253a; --text-muted:#657387; --primary:#f7b91e; --primary-hover:#e6a900; --accent:#f7b91e; --radius:6px; --shadow:0 3px 12px rgba(16,31,52,.05); }
.btn-primary, .btn-warning { color:#122033; }
.btn-primary:hover { color:#122033; }
.app-shell { grid-template-columns:240px minmax(0,1fr); }
.sidebar { background:#0b1c32; padding:0 12px 20px; min-height:100vh; }
.brand-box { padding:25px 8px 20px; margin:0 -12px 18px; border-color:#203148; }
.brand-box h1 { display:flex; align-items:center; gap:8px; font-size:24px; letter-spacing:-1px; }
.brand-mark { display:inline-grid; place-items:center; width:31px; height:31px; border-radius:6px; color:white; font-size:16px; background:#f6b51c; }
.brand-version { font-size:10px; font-weight:800; letter-spacing:0; background:#263449; color:#f9bd29; border-radius:20px; padding:3px 7px; }
.brand-box small { display:block; margin-top:7px; padding-left:39px; font-size:9px; letter-spacing:1.4px; }
.nav-item { min-height:40px; font-size:13px; font-weight:500; color:#b6c1cf; margin:2px 0; }
.nav-item span:first-child { filter:grayscale(1); opacity:.8; }
.nav-item.active { background:#32392f; color:#ffbe21; }
.nav-item:hover { background:#1a2d42; color:#fff; }
.report-nav { margin:2px 4px 10px 22px; padding:5px 0 5px 11px; border-left:1px solid #354455; }
.report-nav>span { display:block; color:#7e8ca0; font-size:9px; font-weight:800; letter-spacing:.08em; padding:5px 8px; }
.report-nav-item { width:100%; text-align:left; border:0; border-radius:5px; background:transparent; color:#afbac9; padding:8px; font-size:12px; cursor:pointer; }
.report-nav-item:hover { background:#1a2d42; color:white; }
.report-nav-item.active { color:#ffbd18; background:#31392f; font-weight:700; }
.topbar { min-height:72px; border-color:#e7e9ee; padding:12px 26px; }
.content-pad { padding:26px; max-width:1650px; width:100%; margin:0 auto; }
.page-heading { display:flex; justify-content:space-between; align-items:end; gap:12px; margin:3px 0 22px; }
.page-heading h2 { margin:2px 0 0; font-size:23px; letter-spacing:-.4px; }
.eyebrow { font-size:10px; letter-spacing:.08em; color:#667587; font-weight:800; }
.breadcrumb { color:#697789; font-size:12px; }
.card { border-color:#e3e6ea; box-shadow:var(--shadow); }
.card h3 { border-left:3px solid #f5b617; padding-left:10px; font-size:16px; }
.kpi-grid { grid-template-columns:repeat(auto-fit,minmax(180px,1fr)); }
.kpi-card { position:relative; min-height:122px; border-radius:3px; padding:17px 16px 24px; }
.kpi-card:after { position:absolute; content:""; left:16px; bottom:14px; width:45px; height:4px; background:#f8bb23; border-radius:10px; }
.kpi-label { text-transform:none; font-size:12px; color:#344357; }
.kpi-value { font-size:18px; margin-top:14px; overflow-wrap:anywhere; }
.dashboard-filter { display:grid; grid-template-columns:minmax(180px,1fr) minmax(120px,1fr) minmax(120px,1fr) auto; align-items:end; gap:12px; }
.section-title { display:flex; align-items:center; gap:12px; color:#132339; }
.section-title strong { display:block; font-size:14px; }
.section-title small { display:block; color:#748092; font-size:11px; margin-top:3px; }
.section-icon { display:grid; place-items:center; width:38px; height:38px; flex:none; color:#9a6d00; background:#fff8e5; border-left:3px solid #f3b517; font-size:17px; }
.report-hero { position:relative; padding:23px 25px; border-top:4px solid #f7b91e; color:#fff; background:#0b1c32; border-radius:3px; margin-bottom:20px; }
.report-hero .eyebrow { color:#f9bb22; }.report-hero h2 { margin:4px 0 5px; font-size:21px; }.report-hero p { color:#b9c4d1; font-size:12px; margin:0; padding-right:50px; }
.report-hero-icon { position:absolute; right:22px; top:32px; background:#f7b91e; color:#142238; padding:10px 13px; border-radius:7px; }
.report-filter { padding:20px; }.report-filter-row { margin:17px 0 0; grid-template-columns:minmax(160px,1.1fr) 1fr 1fr auto; }.filter-action { display:flex; align-items:end; }.filter-action button { width:100%; }
.report-result { padding:0; border-top:4px solid #f6b91d; overflow:hidden; }.report-result-head { padding:18px 20px; display:flex; justify-content:space-between; gap:12px; align-items:center; border-bottom:1px solid #e9edf1; }.report-actions { display:flex; flex-wrap:wrap; gap:6px; }
.report-tools { display:flex; gap:12px; align-items:center; padding:18px 20px; color:#7b8794; font-size:12px; }.report-tools input { max-width:420px; }
.report-note,.report-error { margin:0 20px 15px; color:#7b6641; font-size:12px; }.report-error { color:#ba2020; }
.report-result .data-table-wrap { margin:0 20px; }.data-table th { text-transform:uppercase; font-size:11px; white-space:nowrap; color:#22344b!important; background:#f4f6f9!important; }.data-table td { white-space:nowrap; font-size:12px; padding:14px 10px!important; }
.empty-report { display:grid; min-height:190px; place-content:center; text-align:center; color:#9ba4af; font-size:13px; }.empty-report span { font-size:26px; }
.report-pagination { display:flex; justify-content:space-between; align-items:center; padding:16px 20px; margin-top:14px; border-top:1px solid #ebedf1; color:#738094; font-size:12px; }.report-pagination strong { color:#0b1c32; padding:0 8px; }
.btn:disabled { opacity:.45; cursor:not-allowed; }
@media (max-width:980px) { .app-shell { grid-template-columns:1fr; }.sidebar { min-height:0; display:flex; flex-direction:row; align-items:center; overflow-x:auto; }.brand-box,.report-nav { display:none; }.nav-item { flex:none; }.content-pad { padding:18px; }.topbar { padding:10px 16px; }.dashboard-filter,.report-filter-row { grid-template-columns:repeat(2,minmax(0,1fr)); }.page-heading { align-items:start; }.breadcrumb { display:none; } }
@media (max-width:520px) { .report-filter-row,.dashboard-filter { grid-template-columns:1fr; }.report-result-head { align-items:start; flex-direction:column; }.report-tools { align-items:start; flex-direction:column; }.content-pad { padding:14px; }.kpi-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }.kpi-value { font-size:15px; } }
.daily-chart { display:flex; align-items:end; gap:7px; height:190px; padding:15px 4px 20px; overflow-x:auto; border-bottom:1px solid #e6eaf0; }
.chart-col { flex:1 0 18px; min-width:18px; height:100%; display:flex; flex-direction:column; justify-content:end; align-items:center; position:relative; }
.chart-bar { background:#f6ba21; width:min(22px,100%); border-radius:4px 4px 0 0; min-height:2px; }
.chart-col small { position:absolute; bottom:-20px; font-size:9px; color:#8691a0; }.chart-foot { display:block; color:#8995a3; margin-top:9px; }.chart-empty { margin:auto; color:#9ba4af; font-size:12px; }
