/* =========================================================
   The Best Bite - Restaurant ERP Theme
   ========================================================= */
:root {
  --primary: #c8385a;        /* Tandoori rose */
  --primary-dark: #9e1f3f;
  --primary-soft: #fde7ec;
  --secondary: #f4a259;      /* Saffron */
  --accent: #2a9d8f;         /* Mint */
  --bg: #f6f4ef;             /* Warm parchment */
  --bg-card: #ffffff;
  --ink: #1f2733;
  --ink-soft: #5b6473;
  --line: #ece6da;
  --success: #2a9d8f;
  --warning: #e8a93a;
  --danger: #d6314c;
  --info: #4f86c6;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(31,39,51,.05);
  --shadow: 0 10px 30px -12px rgba(31,39,51,.18);
  --sidebar-w: 260px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  margin: 0;
  font-size: 14px;
  letter-spacing: -0.005em;
}

h1, h2, h3, .display-font { font-family: 'Fraunces', Georgia, serif; letter-spacing: -0.02em; }
.text-muted { color: var(--ink-soft) !important; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-w);
  background: linear-gradient(180deg, #1e1b1a 0%, #2a2422 100%);
  color: #e7d9c4; overflow-y: auto; z-index: 1000;
  border-right: 1px solid rgba(255,255,255,.04);
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius:3px; }

.sidebar-brand {
  display: flex; align-items: center; gap: 12px; padding: 22px 20px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.brand-mark {
  width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  display: grid; place-items: center; color: #fff; font-size: 18px;
  box-shadow: 0 6px 16px -4px rgba(200,56,90,.5);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-family: 'Fraunces', serif; font-weight: 800; font-size: 17px; color: #fff; }
.brand-tag { font-size: 10.5px; color: #a8927b; letter-spacing: .12em; text-transform: uppercase; margin-top:2px; }
.sidebar-search {
  margin: 14px 12px 4px; position: relative;
}
.sidebar-search i {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  color: #9d8f79; font-size: 13px;
}
.sidebar-search input {
  width: 100%; border: 1px solid rgba(255,255,255,.08); border-radius: 10px;
  background: rgba(255,255,255,.06); color: #fff; padding: 10px 12px 10px 36px;
  outline: 0; font-size: 13px;
}
.sidebar-search input::placeholder { color: #9d8f79; }
.sidebar-search input:focus { border-color: rgba(244,162,89,.45); background: rgba(255,255,255,.09); }

.sidebar-section {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .14em;
  color: #8a7a64; padding: 16px 24px 6px;
}
.sidebar-nav { list-style: none; margin: 0; padding: 0 12px; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  color: #c8b89d; text-decoration: none; border-radius: 10px;
  font-weight: 500; font-size: 13.5px; margin-bottom: 2px;
  transition: background .15s ease, color .15s ease, transform .15s ease;
}
.sidebar-nav a i { width: 18px; text-align: center; opacity:.85; }
.sidebar-nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
.sidebar-nav a.active {
  background: linear-gradient(90deg, rgba(200,56,90,.18), rgba(244,162,89,.05));
  color: #fff; box-shadow: inset 3px 0 0 var(--primary);
}

/* ---------- Main ---------- */
.app-main { margin-left: var(--sidebar-w); min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(246,244,239,.85); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  padding: 14px 28px; display: flex; align-items: center; gap: 16px;
}
.topbar-search {
  flex: 1; max-width: 460px; position: relative;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 8px 12px 8px 38px; display: flex; align-items: center;
}
.topbar-search input { border: 0; outline: 0; flex: 1; background: transparent; font-size: 13.5px; }
.topbar-search i { position: absolute; left: 13px; color: var(--ink-soft); }
.topbar-search kbd { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; font-size: 11px; color: var(--ink-soft); }

.topbar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.btn-icon { background: #fff; border: 1px solid var(--line); border-radius: 10px; width: 38px; height: 38px; display: grid; place-items: center; color: var(--ink); }
.btn-icon:hover { background: var(--primary-soft); color: var(--primary); border-color: var(--primary-soft); }
.notif-dot { position: absolute; top: 9px; right: 10px; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); }
.user-chip {
  display: flex; align-items: center; gap: 10px; background: #fff;
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px 4px 4px; cursor: pointer;
}
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff; font-weight: 700; font-size: 13px;
}
.user-name { font-size: 13px; font-weight: 600; }
.user-role { font-size: 11px; color: var(--ink-soft); }

.content { padding: 28px; }
.content img, .content video, .content canvas { max-width: 100%; height: auto; }

/* ---------- Cards / Components ---------- */
.page-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 24px; flex-wrap: wrap; gap: 16px;
}
.page-title { font-family: 'Fraunces', serif; font-size: 30px; font-weight: 700; margin: 0; }
.page-subtitle { color: var(--ink-soft); font-size: 13.5px; margin-top: 4px; }

.card-tbb { background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-tbb .card-tbb-head { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.card-tbb .card-tbb-body { padding: 22px; }
.card-tbb .card-tbb-head h5 { margin: 0; font-size: 15px; font-weight: 700; }

/* ---------- KPI / Stat ---------- */
.stat-card {
  background: var(--bg-card); border-radius: var(--radius); padding: 22px;
  border: 1px solid var(--line); position: relative; overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-card .stat-icon {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  font-size: 18px; margin-bottom: 14px;
}
.stat-card .stat-label { color: var(--ink-soft); font-size: 12.5px; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.stat-card .stat-value { font-family: 'Fraunces', serif; font-size: 30px; font-weight: 700; margin-top: 4px; }
.stat-card .stat-delta { font-size: 12px; font-weight: 600; margin-top: 6px; }
.stat-card .stat-delta.up { color: var(--success); }
.stat-card .stat-delta.down { color: var(--danger); }
.stat-card.tone-rose .stat-icon { background: var(--primary-soft); color: var(--primary); }
.stat-card.tone-mint .stat-icon { background: #d6f3ee; color: var(--accent); }
.stat-card.tone-saffron .stat-icon { background: #fdedd6; color: #d18b3a; }
.stat-card.tone-blue .stat-icon { background: #dfeaf7; color: var(--info); }

/* ---------- Buttons / Forms ---------- */
.btn { border-radius: 10px; font-weight: 600; font-size: 13.5px; padding: 8px 14px; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-outline-primary { color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); border-color: var(--primary); }
.btn-success { background: var(--success); border-color: var(--success); }
.btn-warning { background: var(--warning); border-color: var(--warning); color: #fff; }
.form-control, .form-select { border-radius: 10px; border-color: var(--line); padding: 9px 12px; font-size: 13.5px; }
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 .15rem rgba(200,56,90,.12); }
.form-label { font-weight: 600; font-size: 13px; margin-bottom: 6px; color: var(--ink); }

/* ---------- Tables ---------- */
.table { font-size: 13.5px; }
.table thead th { background: #faf7f1; color: var(--ink-soft); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--line) !important; padding: 12px 14px; }
.table tbody td { padding: 12px 14px; vertical-align: middle; border-color: var(--line); }
.table tbody tr:hover { background: #faf7f1; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.bg-success { background: var(--success) !important; }
.bg-danger  { background: var(--danger)  !important; }
.bg-warning { background: var(--warning) !important; }
.bg-primary { background: var(--primary) !important; }
.bg-secondary{ background:#90a0b5 !important; }
.dataTables_wrapper { width: 100%; overflow-x: auto; }

/* ---------- POS specific ---------- */
.pos-layout { display: grid; grid-template-columns: 1fr 380px; gap: 22px; height: calc(100vh - 130px); }
.pos-menu { background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.pos-cart { background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; }
.pos-mobile-title, .pos-cart-mobile-head, .pos-mobile-cart-bar { display: none; }
.pos-menu, .pos-cart { contain: content; }
.pos-search-wrap {
  position: relative; margin: 16px 16px 0; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; display: flex; align-items: center;
}
.pos-search-wrap i { position: absolute; left: 13px; color: var(--ink-soft); }
.pos-search-wrap input {
  width: 100%; border: 0; outline: 0; background: transparent; padding: 10px 12px 10px 38px;
  font-size: 14px; color: var(--ink);
}
.pos-search-clear {
  width: 34px;
  height: 34px;
  margin-right: 5px;
  border: 0;
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink-soft);
  display: inline-grid;
  place-items: center;
}
.pos-search-clear[hidden] { display: none; }
.pos-filter-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px 16px 0;
}
.pos-category-select { display: none; }
.pos-voice-btn {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(42,157,143,.28);
  border-radius: 10px;
  background: rgba(42,157,143,.10);
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 7px;
  white-space: nowrap;
  touch-action: manipulation;
}
.pos-voice-btn:hover,
.pos-voice-btn.listening {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.pos-voice-btn.listening i {
  animation: voicePulse 1s ease-in-out infinite;
}
.pos-voice-status {
  margin: 8px 16px 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(42,157,143,.10);
  color: #1f766d;
  font-size: 12px;
  font-weight: 800;
}
.pos-voice-status.listening {
  background: rgba(200,56,90,.10);
  color: var(--primary);
}
@keyframes voicePulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.18); opacity: .75; }
}
.pos-result-count {
  font-size: 12px;
  font-weight: 800;
  color: var(--ink-soft);
  white-space: nowrap;
}
.pos-quick-results{
  margin: 10px 16px 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 8px;
}
.pos-quick-results[hidden]{ display:none; }
.pos-quick-results .qr-item{
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 10px 10px;
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 10px;
  text-align:left;
}
.pos-quick-results .qr-item.active{ border-color: var(--primary); box-shadow: 0 0 0 3px rgba(200,56,90,.10); }
.pos-quick-results .qr-item .n{ font-weight: 700; font-size: 12.5px; overflow:hidden; text-overflow: ellipsis; white-space: nowrap; }
.pos-quick-results .qr-item .p{ font-weight: 800; font-family: 'Fraunces', serif; color: var(--primary); font-size: 12.5px; flex: 0 0 auto; }

.pos-smart-tabs{
  display:flex;
  gap:8px;
  padding: 12px 16px 0;
  flex-wrap: wrap;
}
.pos-smart-chip{
  flex: 0 0 auto;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  font-weight: 800;
  font-size: 12px;
}
.pos-smart-chip.active{
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.pos-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  row-gap: 8px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  /* Two-line category navigation (no horizontal scroll) */
  max-height: 88px;
  overflow: hidden;
  touch-action: pan-y;
}
.pos-categories::-webkit-scrollbar { display: none; }
.pos-cat-chip {
  flex: 0 0 auto; padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line);
  background: #fff; cursor: pointer; font-weight: 600; font-size: 13px; white-space: nowrap;
  transition: all .15s ease;
  touch-action: manipulation;
}
.pos-cat-chip:hover { border-color: var(--primary); color: var(--primary); }
.pos-cat-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pos-items-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px;
  padding: 16px; overflow-y: auto; flex: 1;
}
.pos-item {
  border: 1px solid var(--line); border-radius: 12px; padding: 14px; cursor: pointer;
  background: linear-gradient(180deg, #fff, #fbfbfd);
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease, background .12s ease;
  position: relative;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: pan-y;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 110px;
}
.pos-item:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow); }
.pos-item:active { transform: scale(.99); }
.pos-item.added { border-color: var(--primary); background: var(--primary-soft); transform: scale(.98); }
.pos-item .veg-mark { width: 12px; height: 12px; border: 1.5px solid; display: inline-block; }
.pos-item .veg-mark.veg { border-color: var(--success); }
.pos-item .veg-mark.veg::after { content: ''; display: block; width: 6px; height: 6px; border-radius: 50%; background: var(--success); margin: 1.5px; }
.pos-item .veg-mark.non-veg { border-color: var(--danger); }
.pos-item .veg-mark.non-veg::after { content: ''; display: block; width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-bottom: 6px solid var(--danger); margin: 2px 1.5px; }
.pos-item .item-name { font-weight: 600; font-size: 13.5px; margin: 8px 0 4px; line-height: 1.25; }
.pos-item .item-price { font-weight: 700; color: var(--primary); font-size: 14.5px; font-family: 'Fraunces', serif; }
.pos-item .item-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.pos-item .item-add {
  width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center;
  background: var(--primary-soft); color: var(--primary); font-size: 12px; flex: 0 0 auto;
}
.pos-item .item-qty {
  position: absolute; top: 8px; right: 8px; min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 999px; display: inline-grid; place-items: center;
  background: var(--primary); color: #fff; font-size: 11px; font-weight: 800;
}
.pos-item.in-cart { border-color: rgba(200,56,90,.55); background: #fff8fa; }
.pos-item .item-fav{
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.92);
  display: inline-grid;
  place-items: center;
  color: #93a0b2;
}
.pos-item.is-fav .item-fav{ color: #f59e0b; border-color: rgba(245,158,11,.35); background: rgba(245,158,11,.08); }

.pos-cart-head { padding: 16px 18px; border-bottom: 1px solid var(--line); }
.pos-cart-body { flex: 1; overflow-y: auto; padding: 8px 0; }
.cart-row { padding: 10px 18px; display: flex; align-items: center; gap: 10px; border-bottom: 1px dashed var(--line); }
.cart-row .name { flex: 1; }
.qty-ctrl { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.qty-ctrl button { width: 26px; height: 26px; border: 0; background: #fff; }
.qty-ctrl button:hover { background: var(--primary-soft); color: var(--primary); }
.qty-ctrl span { padding: 0 10px; font-weight: 700; }
.pos-cart-foot {
  border-top: 1px solid var(--line);
  padding: 16px 18px;
  position: sticky;
  bottom: 0;
  z-index: 4;
  background: rgba(255,255,255,.98);
  box-shadow: 0 -10px 24px -20px rgba(31,39,51,.45);
}
.totals-line { display: flex; justify-content: space-between; padding: 4px 0; font-size: 13px; }
.totals-line.grand { font-size: 18px; font-weight: 700; font-family: 'Fraunces', serif; padding-top: 8px; border-top: 1px solid var(--line); margin-top: 8px; }
.pos-action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.pos-action-grid .btn {
  min-height: 44px;
  font-weight: 900;
  padding-left: 8px;
  padding-right: 8px;
}

@media (min-width: 992px) and (max-width: 1180px) {
  .pos-layout {
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 14px;
    height: calc(100vh - 118px);
  }
  .pos-search-wrap { margin: 12px 12px 0; }
  .pos-quick-results { margin: 8px 12px 0; grid-template-columns: 1fr; }
  .pos-smart-tabs { padding: 10px 12px 0; gap: 6px; }
  .pos-smart-chip { padding: 7px 10px; font-size: 11.5px; }
  .pos-categories { padding: 12px; gap: 6px; row-gap: 6px; max-height: 76px; }
  .pos-cat-chip { padding: 7px 11px; font-size: 12px; }
  .pos-items-grid {
    grid-template-columns: repeat(auto-fill, minmax(142px, 1fr));
    gap: 10px;
    padding: 12px;
  }
  .pos-item { min-height: 104px; padding: 12px; border-radius: 10px; }
  .pos-item .item-name { font-size: 13px; }
  .pos-cart-head, .pos-cart-foot { padding: 12px; }
  .cart-row { padding: 9px 12px; gap: 8px; }
}

@media (orientation: landscape) and (min-width: 768px) and (max-width: 1368px) {
  body.pos-page .sidebar,
  body.pos-page .topbar,
  body.pos-page .page-header {
    display: none !important;
  }
  body.pos-page .app-main {
    margin-left: 0;
  }
  body.pos-page .content {
    height: 100vh;
    padding: 8px;
    overflow: hidden;
  }
  body.pos-page .pos-layout {
    height: calc(100vh - 16px);
    grid-template-columns: minmax(0, 1fr) 350px;
    gap: 10px;
  }
  body.pos-page .pos-menu,
  body.pos-page .pos-cart {
    border-radius: 10px;
  }
  body.pos-page .pos-search-wrap {
    margin: 10px 10px 0;
  }
  body.pos-page .pos-filter-row {
    padding: 8px 10px 0;
  }
  body.pos-page .pos-category-select {
    display: block;
  }
  body.pos-page .pos-voice-btn {
    min-height: 36px;
    padding: 0 13px;
  }
  body.pos-page .pos-voice-status {
    margin: 7px 10px 0;
  }
  body.pos-page .pos-smart-tabs {
    padding: 8px 10px 0;
    gap: 6px;
  }
  body.pos-page .pos-smart-chip {
    padding: 7px 10px;
    font-size: 11.5px;
  }
  body.pos-page .pos-categories {
    padding: 8px 10px;
    gap: 6px;
    row-gap: 6px;
    max-height: 72px;
  }
  body.pos-page .pos-cat-chip {
    padding: 7px 10px;
    font-size: 12px;
  }
  body.pos-page .pos-items-grid {
    grid-template-columns: repeat(auto-fill, minmax(138px, 1fr));
    gap: 8px;
    padding: 10px;
  }
  body.pos-page .pos-item {
    min-height: 96px;
    padding: 10px;
    border-radius: 10px;
  }
  body.pos-page .pos-item .item-name {
    font-size: 12.5px;
  }
  body.pos-page .pos-cart-head,
  body.pos-page .pos-cart-foot {
    padding: 10px;
  }
  body.pos-page .pos-action-grid .btn {
    min-height: 42px;
    font-size: 12.5px;
  }
  body.pos-page .cart-row {
    padding: 8px 10px;
  }
}

/* ---------- KDS ---------- */
.kds-ring-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; border-radius: 12px; padding: 14px 16px; margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.kds-ring-banner[hidden] { display: none; }
.kds-grid .card-tbb-body ul { max-height: 280px; overflow-y: auto; }

/* ---------- Tables grid ---------- */
.tables-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }
.table-tile {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; text-align: center; cursor: pointer; transition: all .15s ease;
  position: relative; overflow: hidden;
}
.table-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.table-tile .tile-no { font-family: 'Fraunces', serif; font-size: 28px; font-weight: 700; }
.table-tile .tile-meta { color: var(--ink-soft); font-size: 12px; margin-top: 2px; }
.table-tile .tile-status { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: uppercase; margin-top: 8px; letter-spacing: .05em; }
.table-tile.free .tile-status { background: #d6f3ee; color: var(--success); }
.table-tile.occupied .tile-status { background: #fbe2e6; color: var(--danger); }
.table-tile.reserved .tile-status { background: #fdedd6; color: #d18b3a; }
.table-tile.cleaning .tile-status { background: #e3eaf3; color: var(--info); }

/* ---------- Auth ---------- */
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; }
.auth-hero {
  background:
    radial-gradient(circle at 20% 20%, rgba(244,162,89,.25), transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(200,56,90,.35), transparent 55%),
    #1e1b1a;
  color: #f6f4ef; padding: 60px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden;
}
.auth-hero::before { content: ''; position: absolute; inset: 0; background-image: radial-gradient(rgba(255,255,255,.04) 1px, transparent 1px); background-size: 22px 22px; opacity: .6; }
.auth-hero h1 { font-family: 'Fraunces', serif; font-size: 48px; font-weight: 800; line-height: 1.05; max-width: 480px; position: relative; }
.auth-hero h1 em { color: var(--secondary); font-style: italic; }
.auth-hero .hero-tag { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); border-radius: 999px; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; }
.auth-hero .hero-features { display: grid; grid-template-columns: repeat(2,1fr); gap: 14px; max-width: 440px; position: relative; }
.auth-hero .hero-feat { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); border-radius: 12px; padding: 14px; }
.auth-hero .hero-feat i { color: var(--secondary); }
.auth-form-wrap { display: grid; place-items: center; padding: 40px; }
.auth-form { width: 100%; max-width: 420px; }
.auth-form .brand-row { display: flex; align-items: center; gap: 12px; margin-bottom: 32px; }
.auth-form h2 { font-family: 'Fraunces', serif; font-size: 30px; font-weight: 700; }
.auth-credentials { background: var(--primary-soft); border: 1px dashed var(--primary); border-radius: 12px; padding: 14px; font-size: 12.5px; margin-top: 20px; }
.auth-credentials code { background: rgba(0,0,0,.06); padding: 1px 6px; border-radius: 4px; }

@media (max-width: 991px) {
  body { font-size: 13px; }
  .sidebar {
    width: min(86vw, 320px); transform: translateX(-100%); transition: transform .25s ease;
    box-shadow: 18px 0 45px -26px rgba(0,0,0,.65);
  }
  .sidebar.show { transform: translateX(0); }
  .sidebar-brand { padding: 16px 16px 10px; }
  .sidebar-section { padding: 14px 18px 6px; }
  .sidebar-nav { padding: 0 10px; }
  .sidebar-nav a { min-height: 42px; padding: 10px 12px; font-size: 13.5px; }
  .app-main { margin-left: 0; }
  .topbar {
    padding: 10px 12px; gap: 8px; align-items: stretch;
    display: grid; grid-template-columns: 42px minmax(0,1fr) auto;
  }
  .topbar .btn-icon { width: 42px; height: 42px; }
  .topbar-search {
    display: flex; max-width: none; min-width: 0; padding: 8px 8px 8px 36px;
    border-radius: 11px;
  }
  .topbar-search input { width: 100%; min-width: 0; font-size: 13px; }
  .topbar-search kbd { display: none; }
  .topbar-actions { gap: 6px; margin-left: 0; }
  .topbar-actions .btn-primary { display: none; }
  .topbar-actions .dropdown:first-child { display: none; }
  .user-chip {
    width: 42px; height: 42px; padding: 4px; border-radius: 11px; justify-content: center;
  }
  .user-chip .avatar { width: 32px; height: 32px; }
  .user-chip > i { display: none; }
  .content { padding: 14px 12px 86px; overflow-x: hidden; }
  .page-header { margin-bottom: 12px; }
  .page-title { font-size: 23px; line-height: 1.15; }
  .page-subtitle { display: none; }
  .card-tbb { border-radius: 12px; }
  .card-tbb .card-tbb-head { padding: 13px 14px; gap: 10px; }
  .card-tbb .card-tbb-body { padding: 14px; overflow-x: auto; }
  .stat-card { padding: 14px; border-radius: 12px; }
  .stat-card .stat-icon { width: 36px; height: 36px; margin-bottom: 9px; }
  .stat-card .stat-label { font-size: 10.5px; }
  .stat-card .stat-value { font-size: 22px; }
  .row.g-3, .row.g-2 { --bs-gutter-x: .65rem; --bs-gutter-y: .65rem; }
  .btn { min-height: 38px; white-space: nowrap; }
  .form-control, .form-select { min-height: 42px; font-size: 14px; }
  .table {
    min-width: 760px; font-size: 12.5px;
  }
  .table thead th, .table tbody td { padding: 10px; }
  .dataTables_wrapper .row { gap: 8px; }
  .dataTables_wrapper .dataTables_length,
  .dataTables_wrapper .dataTables_filter {
    width: 100%; text-align: left !important;
  }
  .dataTables_wrapper .dataTables_filter input {
    width: 100%; margin-left: 0; min-height: 40px;
  }
  .modal-dialog { margin: 10px; }
  .modal-content { border-radius: 14px; }
  .pos-layout { display: block; height: auto; }
  .pos-menu { border-radius: 12px; min-height: calc(100vh - 118px); }
  .pos-mobile-title {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 14px 14px 0;
  }
  .pos-search-wrap {
    margin: 12px 14px 0;
    position: sticky;
    top: 0;
    z-index: 15;
    background: rgba(255,255,255,.96);
    backdrop-filter: blur(10px);
    padding-top: 10px;
    padding-bottom: 10px;
  }
  .pos-filter-row { padding: 8px 14px 0; }
  .pos-category-select { display: block; }
  .pos-voice-btn { min-height: 38px; }
  .pos-voice-status { margin: 8px 14px 0; }
  .pos-quick-results{ margin: 8px 14px 0; grid-template-columns: 1fr; }
  .pos-smart-tabs{ padding: 10px 14px 0; }
  .pos-categories {
    padding: 8px 14px 10px; gap: 7px; position: sticky; top: 62px; z-index: 14;
    background: rgba(255,255,255,.94); backdrop-filter: blur(10px);
    flex-wrap: wrap;
    row-gap: 7px;
    max-height: 86px;
    overflow: hidden;
  }
  .pos-cat-chip { padding: 7px 12px; font-size: 12.5px; }
  .pos-items-grid {
    grid-template-columns: 1fr; gap: 8px; padding: 10px 12px 18px;
    overflow: visible;
  }
  .pos-item {
    min-height: 74px; padding: 10px 12px; border-radius: 10px;
    display: grid; grid-template-columns: 18px minmax(0,1fr) auto; column-gap: 9px; align-items: center;
  }
  .pos-item:hover { transform: none; box-shadow: none; }
  .pos-item > .d-flex { display: contents !important; }
  .pos-item .veg-mark { grid-column: 1; grid-row: 1 / span 2; align-self: start; margin-top: 3px; }
  .pos-item .badge.bg-warning { grid-column: 3; grid-row: 1; justify-self: end; margin-right: 36px; }
  .pos-item .item-name {
    grid-column: 2; grid-row: 1; font-size: 13px; line-height: 1.25; margin: 0; min-height: 0;
    display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .pos-item .item-bottom {
    grid-column: 2 / span 2; grid-row: 2; margin-top: 4px;
  }
  .pos-item .item-price { font-size: 14px; }
  .pos-item .item-add { width: 32px; height: 32px; background: var(--primary); color: #fff; }
  .pos-item .item-qty { top: 9px; right: 10px; }
  .pos-cart {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1200; max-height: 88vh;
    border-radius: 18px 18px 0 0; transform: translateY(calc(100% + 12px));
    transition: transform .22s ease; box-shadow: 0 -18px 45px -28px rgba(31,39,51,.55);
  }
  body.pos-has-cart .pos-cart { transform: translateY(calc(100% - 68px)); }
  body.pos-cart-open .pos-cart { transform: translateY(0); }
  .pos-cart-mobile-head {
    display: flex; align-items: center; gap: 12px; padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 2;
    background: rgba(255,255,255,.96); backdrop-filter: blur(10px);
  }
  .pos-cart-mobile-head::before { content:''; position:absolute; left:50%; top:7px; width:44px; height:4px; transform:translateX(-50%); border-radius:999px; background: rgba(0,0,0,.18); }
  .pos-cart-head { padding: 12px 14px; }
  .pos-cart-body { max-height: 28vh; flex: 0 1 auto; }
  .cart-row { padding: 9px 14px; gap: 8px; }
  .cart-row .name { min-width: 0; }
  .qty-ctrl button { width: 32px; height: 32px; }
  .qty-ctrl span { padding: 0 9px; }
  .pos-cart-foot { padding: 12px 14px 14px; }
  .pos-action-grid .btn { min-height: 42px; font-size: 12.5px; }
  .totals-line { padding: 2px 0; }
  .totals-line.grand { font-size: 17px; }
  .pos-mobile-cart-bar {
    display: block; position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 1100;
    transform: translateY(92px); transition: transform .2s ease;
  }
  body.pos-has-cart .pos-mobile-cart-bar { transform: translateY(0); }
  body.pos-cart-open .pos-mobile-cart-bar { transform: translateY(92px); }
  .pos-mobile-cart-bar button {
    width: 100%; min-height: 54px; border: 0; border-radius: 14px; padding: 0 16px;
    display: flex; align-items: center; justify-content: space-between; color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark)); box-shadow: var(--shadow);
    font-weight: 700;
  }
  .kds-page-header { align-items: stretch; }
  .kds-page-header > div:last-child { width: 100%; }
  .kds-page-header .btn { flex: 1 1 140px; }
  .kds-ring-banner {
    position: sticky; top: 62px; z-index: 40; margin-bottom: 12px;
    border-radius: 12px; padding: 12px;
  }
  .kds-grid { --bs-gutter-y: .75rem; }
  .kds-grid > [class*="col-"] { width: 100%; }
  .kds-grid .card-tbb { border-radius: 12px; overflow: hidden; }
  .kds-grid .card-tbb-head {
    padding: 12px 14px; align-items: center;
  }
  .kds-grid .card-tbb-body { padding: 13px 14px; }
  .kds-grid .card-tbb-body ul { max-height: none; }
  .kds-grid li { font-size: 14px; padding: 8px 0 !important; }
  .kds-grid form .btn { min-height: 44px; font-size: 14px; }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-hero { padding: 40px 28px; min-height: auto; }
}

@media (min-width: 640px) and (max-width: 991px) {
  .pos-menu { min-height: calc(100vh - 104px); }
  .pos-items-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding-bottom: 96px;
  }
  .pos-item { min-height: 86px; }
  .pos-cart { max-height: 82vh; }
  .pos-cart-body { max-height: 34vh; }
}

@media (max-width: 420px) {
  .pos-items-grid { grid-template-columns: 1fr; gap: 8px; padding-left: 10px; padding-right: 10px; }
  .pos-item { padding: 10px; }
  .pos-item .item-name { font-size: 12.5px; }
  .content { padding-left: 10px; padding-right: 10px; }
}

@media (orientation: landscape) and (min-width: 768px) and (max-width: 1368px) {
  body.pos-page .sidebar,
  body.pos-page .topbar,
  body.pos-page .page-header,
  body.pos-page .pos-mobile-title,
  body.pos-page .pos-mobile-cart-bar {
    display: none !important;
  }
  body.pos-page .app-main { margin-left: 0 !important; }
  body.pos-page .content {
    height: 100vh;
    padding: 8px;
    overflow: hidden;
  }
  body.pos-page .pos-layout {
    display: grid;
    height: calc(100vh - 16px);
    grid-template-columns: minmax(0, 1fr) 350px;
    gap: 10px;
  }
  body.pos-page .pos-menu {
    min-height: 0;
    height: 100%;
  }
  body.pos-page .pos-cart {
    position: static;
    max-height: none;
    height: 100%;
    transform: none !important;
    border-radius: 10px;
    box-shadow: none;
  }
  body.pos-page .pos-cart-mobile-head { display: none !important; }
  body.pos-page .pos-cart-body {
    flex: 1;
    max-height: none;
  }
  body.pos-page .pos-items-grid {
    overflow-y: auto;
    padding-bottom: 10px;
  }
}

/* ---------- Misc ---------- */
.badge { font-weight: 600; padding: 4px 9px; font-size: 11px; border-radius: 6px; letter-spacing:.03em; }
.dropdown-menu { border: 1px solid var(--line); border-radius: 12px; }
.alert { border-radius: 12px; }
hr { border-color: var(--line); }
.dataTables_wrapper .dataTables_filter input { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }
.dataTables_wrapper .dataTables_length select { border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; }
.page-link { color: var(--primary); }
.page-item.active .page-link { background: var(--primary); border-color: var(--primary); }

/* Print invoice */
@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .app-main { margin: 0; }
  .content { padding: 0; }
  body { background: #fff; }
}
.invoice-print { max-width: 320px; margin: 0 auto; font-family: 'Courier New', monospace; font-size: 12px; }
.invoice-print h2 { font-family: 'Fraunces', serif; text-align: center; }
.invoice-print table { width: 100%; }
.invoice-print .dashed { border-top: 1px dashed #000; margin: 6px 0; }
