/* ─── Inventory Management — inventory.css ─────────────────────────────────
   Mobile-first, responsive. Light mode default — dark via [data-theme="dark"].
──────────────────────────────────────────────────────────────────────────── */

/* ══ LIGHT MODE (default) ══════════════════════════════════════════════════ */
:root {
  --bg:            #f4f6fb;
  --bg2:           #ffffff;
  --bg3:           #eef1f8;
  --border:        #dde3ef;
  --primary:       #6366f1;
  --primary-h:     #4f52e0;
  --primary-light: rgba(99,102,241,.12);
  --green:         #16a34a;
  --green-light:   rgba(22,163,74,.12);
  --red:           #dc2626;
  --red-light:     rgba(220,38,38,.12);
  --yellow:        #d97706;
  --yellow-light:  rgba(217,119,6,.12);
  --cyan:          #0284c7;
  --cyan-light:    rgba(2,132,199,.12);
  --text:          #0f172a;
  --text2:         #64748b;
  --text3:         #94a3b8;
  --radius:        12px;
  --radius-sm:     8px;
  --shadow:        0 4px 24px rgba(0,0,0,.08);
  --shadow-sm:     0 2px 8px rgba(0,0,0,.05);
  --font:          'Inter', 'Segoe UI', system-ui, sans-serif;
  --transition:    .2s ease;
  --auth-grad:     radial-gradient(ellipse at top, #e0e7ff 0%, var(--bg) 60%);
}

/* ══ DARK MODE ══════════════════════════════════════════════════════════════ */
[data-theme="dark"] {
  --bg:            #0f0f13;
  --bg2:           #1a1a24;
  --bg3:           #23232f;
  --border:        #2e2e3f;
  --primary:       #6366f1;
  --primary-h:     #4f52e0;
  --primary-light: rgba(99,102,241,.15);
  --green:         #22c55e;
  --green-light:   rgba(34,197,94,.15);
  --red:           #ef4444;
  --red-light:     rgba(239,68,68,.15);
  --yellow:        #f59e0b;
  --yellow-light:  rgba(245,158,11,.15);
  --cyan:          #06b6d4;
  --cyan-light:    rgba(6,182,212,.15);
  --text:          #e8e8f0;
  --text2:         #9090a8;
  --text3:         #5a5a70;
  --shadow:        0 4px 24px rgba(0,0,0,.4);
  --shadow-sm:     0 2px 8px rgba(0,0,0,.3);
  --auth-grad:     radial-gradient(ellipse at top, #1e1b4b 0%, var(--bg) 60%);
}

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

html { font-size: 16px; scroll-behavior: smooth; }
html, html * { transition: background-color .25s ease, border-color .25s ease, color .2s ease; }
html *, html *::before, html *::after { transition: background-color .25s ease, border-color .25s ease; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Scrollbar ───────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg3); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* ── Typography ──────────────────────────────────────── */
h1,h2,h3,h4 { font-weight: 700; line-height: 1.25; }
a { color: var(--primary); text-decoration: none; }
p { color: var(--text2); font-size: .92rem; }

/* ── Utility ─────────────────────────────────────────── */
.hidden  { display: none !important; }
.text-center { text-align: center; }
.flex    { display: flex; }
.flex-col{ flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1   { gap: .5rem; }
.gap-2   { gap: 1rem; }
.gap-3   { gap: 1.5rem; }
.mt-1    { margin-top: .5rem; }
.mt-2    { margin-top: 1rem; }
.mt-3    { margin-top: 1.5rem; }
.w-full  { width: 100%; }

/* ── Buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .6rem 1.25rem; border-radius: var(--radius-sm);
  font-size: .9rem; font-weight: 600; cursor: pointer;
  border: none; transition: var(--transition); white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-h); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(99,102,241,.4); }
.btn-outline { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover:not(:disabled) { background: var(--primary-light); }
.btn-ghost   { background: transparent; color: var(--text2); border: 1.5px solid var(--border); }
.btn-ghost:hover:not(:disabled)   { background: var(--bg3); color: var(--text); }
.btn-danger  { background: var(--red); color: #fff; }
.btn-danger:hover:not(:disabled)  { background: #dc2626; }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover:not(:disabled) { background: #16a34a; }
.btn-sm { padding: .4rem .85rem; font-size: .82rem; }
.btn-icon { padding: .5rem; aspect-ratio: 1; border-radius: var(--radius-sm); }

/* ── Form Elements ───────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: .35rem; }
.form-group label { font-size: .82rem; font-weight: 600; color: var(--text2); text-transform: uppercase; letter-spacing: .05em; }
.form-control {
  background: var(--bg3); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  padding: .6rem .85rem; font-size: .9rem; width: 100%;
  transition: border-color var(--transition), box-shadow var(--transition);
  font-family: var(--font);
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.form-control::placeholder { color: var(--text3); }
select.form-control { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2364748b'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .7rem center; background-size: 1.1rem; padding-right: 2.2rem; }
[data-theme="dark"] select.form-control { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%239090a8'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z'/%3E%3C/svg%3E"); }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-row { display: grid; gap: 1rem; }
.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }

/* ── Cards ───────────────────────────────────────────── */
.card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem;
  transition: border-color var(--transition);
}
.card:hover { border-color: var(--primary); }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; gap: 1rem; }
.card-title  { font-size: 1rem; font-weight: 700; color: var(--text); }

/* ── Badges ──────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .2rem .6rem; border-radius: 20px;
  font-size: .75rem; font-weight: 600; white-space: nowrap;
}
.badge-green  { background: var(--green-light);  color: var(--green); }
.badge-red    { background: var(--red-light);    color: var(--red); }
.badge-yellow { background: var(--yellow-light); color: var(--yellow); }
.badge-blue   { background: var(--primary-light);color: var(--primary); }
.badge-cyan   { background: var(--cyan-light);   color: var(--cyan); }

/* ── Auth Page ───────────────────────────────────────── */
#auth-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 1rem; background: var(--auth-grad);
}
.auth-box {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 2rem;
  width: 100%; max-width: 460px; box-shadow: var(--shadow);
}
.auth-logo { text-align: center; margin-bottom: 2rem; }
.auth-logo .logo-icon {
  width: 56px; height: 56px; background: var(--primary);
  border-radius: 16px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.8rem; margin-bottom: .75rem;
}
.auth-logo h2 { font-size: 1.4rem; margin-bottom: .25rem; }
.auth-logo p  { font-size: .85rem; color: var(--text2); }
.auth-tabs    { display: flex; background: var(--bg3); border-radius: var(--radius-sm); padding: .3rem; margin-bottom: 1.5rem; }
.auth-tab     { flex: 1; text-align: center; padding: .5rem; border-radius: 6px; cursor: pointer; font-size: .88rem; font-weight: 600; color: var(--text2); transition: var(--transition); }
.auth-tab.active { background: var(--primary); color: #fff; }
.form-section-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text3); font-weight: 700; margin: 1.25rem 0 .75rem; border-bottom: 1px solid var(--border); padding-bottom: .4rem; }

/* ── App Layout ──────────────────────────────────────── */
#app {
  display: flex; min-height: 100vh;
}

/* Sidebar */
#sidebar {
  width: 250px; flex-shrink: 0;
  background: var(--bg2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; left: 0; top: 0; bottom: 0; z-index: 100;
  transition: transform var(--transition);
}
.sidebar-brand {
  padding: 1.25rem 1rem; display: flex; align-items: center; gap: .75rem;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand .brand-icon {
  width: 38px; height: 38px; background: var(--primary); border-radius: 10px;
  display: flex; align-items: center; justify-content: center; font-size: 1.2rem; flex-shrink: 0;
}
.sidebar-brand .brand-text { overflow: hidden; }
.sidebar-brand .brand-name  { font-size: .9rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-brand .brand-type  { font-size: .7rem; color: var(--text2); }
.sidebar-nav { flex: 1; overflow-y: auto; padding: .75rem .5rem; }
.nav-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .65rem .85rem; border-radius: var(--radius-sm);
  cursor: pointer; transition: var(--transition);
  font-size: .88rem; font-weight: 500; color: var(--text2);
  margin-bottom: 2px;
}
.nav-item:hover  { background: var(--bg3); color: var(--text); }
.nav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 700; }
.nav-item .nav-icon { font-size: 1.1rem; width: 22px; text-align: center; flex-shrink: 0; }
.nav-item .nav-badge {
  margin-left: auto; background: var(--red); color: #fff;
  font-size: .68rem; font-weight: 700; padding: .1rem .4rem; border-radius: 20px; min-width: 18px; text-align: center;
}
.sidebar-footer {
  padding: .75rem .5rem; border-top: 1px solid var(--border);
}

/* Main Area */
#main {
  flex: 1; margin-left: 250px; display: flex; flex-direction: column; min-height: 100vh;
}
.topbar {
  background: var(--bg2); border-bottom: 1px solid var(--border);
  padding: .85rem 1.5rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  position: sticky; top: 0; z-index: 50;
}
.topbar-left  { display: flex; align-items: center; gap: 1rem; }
.topbar-right { display: flex; align-items: center; gap: .75rem; }
.topbar h1    { font-size: 1.2rem; font-weight: 700; }
.hamburger    { display: none; background: transparent; border: none; color: var(--text); font-size: 1.4rem; cursor: pointer; padding: .3rem; }
#page-title   { font-size: 1.1rem; font-weight: 700; }
.owner-chip   {
  display: flex; align-items: center; gap: .5rem;
  background: var(--bg3); border-radius: 20px; padding: .35rem .85rem .35rem .5rem;
  font-size: .82rem; font-weight: 600;
}
.owner-avatar {
  width: 28px; height: 28px; border-radius: 50%; background: var(--primary);
  display: flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 700; color: #fff; overflow: hidden;
}
.owner-avatar img { width: 100%; height: 100%; object-fit: cover; }
.content { flex: 1; padding: 1.5rem; overflow-x: hidden; }

/* ── Stat Cards ──────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem; margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.1rem;
  display: flex; flex-direction: column; gap: .35rem;
  transition: var(--transition);
}
.stat-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.stat-label { font-size: .78rem; font-weight: 600; color: var(--text2); text-transform: uppercase; letter-spacing: .05em; }
.stat-val   { font-size: 1.6rem; font-weight: 800; line-height: 1; }
.stat-sub   { font-size: .78rem; color: var(--text2); }
.stat-icon  { font-size: 1.5rem; margin-bottom: .25rem; }

/* ── Tables ──────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
th {
  background: var(--bg3); text-align: left;
  padding: .7rem 1rem; font-size: .78rem; font-weight: 700;
  color: var(--text2); text-transform: uppercase; letter-spacing: .05em;
  white-space: nowrap;
}
td {
  padding: .75rem 1rem; border-bottom: 1px solid var(--border);
  font-size: .875rem; vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg3); }
.item-thumb {
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  object-fit: cover; background: var(--bg3);
  display: flex; align-items: center; justify-content: center; font-size: 1.2rem;
  overflow: hidden; flex-shrink: 0;
}
.item-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ── Search / Filter bar ─────────────────────────────── */
.toolbar {
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
  margin-bottom: 1rem;
}
/* filters-row: transparent on desktop — just acts as a flex group */
.filters-row { display: contents; }
.search-box {
  position: relative; flex: 1; min-width: 180px;
}
.search-box input {
  background: var(--bg2); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  padding: .58rem .85rem .58rem 2.4rem; font-size: .9rem; width: 100%;
  transition: border-color var(--transition);
}
.search-box input:focus { outline: none; border-color: var(--primary); }
.search-box .search-icon {
  position: absolute; left: .75rem; top: 50%; transform: translateY(-50%);
  color: var(--text3); font-size: 1rem; pointer-events: none;
}
select.filter { background: var(--bg2); border: 1.5px solid var(--border); border-radius: var(--radius-sm); color: var(--text2); padding: .55rem .85rem; font-size: .86rem; cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2364748b'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .6rem center; background-size: 1rem; padding-right: 2rem;
}
[data-theme="dark"] select.filter { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%239090a8'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z'/%3E%3C/svg%3E"); }
select.filter:focus { outline: none; border-color: var(--primary); }

/* Date / month inputs in filter bar */
input[type="date"].filter,
input[type="month"].filter {
  background: var(--bg2); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  padding: .52rem .85rem; font-size: .86rem; cursor: pointer;
  font-family: var(--font); -webkit-appearance: none; appearance: none;
  transition: border-color var(--transition);
}
input[type="date"].filter:focus,
input[type="month"].filter:focus { outline: none; border-color: var(--primary); }
[data-theme="dark"] input[type="date"].filter,
[data-theme="dark"] input[type="month"].filter { color-scheme: dark; }

/* ── Modals ──────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.65); backdrop-filter: blur(4px);
  display: flex; align-items: flex-start; justify-content: center;
  z-index: 999; padding: 1rem; overflow-y: auto;
}
.modal {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); width: 100%; max-width: 680px;
  animation: slideUp .25s ease; box-shadow: var(--shadow); margin: auto;
}
.modal-lg { max-width: 860px; }
.modal-sm { max-width: 420px; }
.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.05rem; font-weight: 700; }
.modal-close { background: transparent; border: none; color: var(--text2); font-size: 1.4rem; cursor: pointer; line-height: 1; padding: .2rem; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 1.5rem; }
.modal-footer {
  padding: 1rem 1.5rem; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: .75rem;
}

/* ── Toast ───────────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 2000;
  display: flex; flex-direction: column; gap: .5rem; pointer-events: none;
}
.toast {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: .75rem 1.1rem;
  font-size: .88rem; font-weight: 600; color: var(--text);
  box-shadow: var(--shadow); min-width: 220px; max-width: 320px;
  display: flex; align-items: center; gap: .6rem;
  animation: slideRight .25s ease;
}
.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red); }
.toast.info    { border-left: 3px solid var(--primary); }
.toast.warning { border-left: 3px solid var(--yellow); }

/* ── Loading ─────────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2.5px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; animation: spin .6s linear infinite; display: inline-block;
}
.loading-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; z-index: 9999;
  flex-direction: column; gap: 1rem;
}
.loading-overlay .spinner { width: 40px; height: 40px; border-width: 4px; }
.empty-state {
  text-align: center; padding: 3rem 1rem; color: var(--text2);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: .75rem; opacity: .5; }
.empty-state h3 { color: var(--text); margin-bottom: .5rem; }

/* ── Pagination ──────────────────────────────────────── */
.pagination { display: flex; align-items: center; gap: .5rem; justify-content: center; margin-top: 1.5rem; }
.page-btn {
  background: var(--bg3); border: 1px solid var(--border); color: var(--text2);
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem; cursor: pointer; transition: var(--transition);
}
.page-btn:hover,
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── Stock Indicator ─────────────────────────────────── */
.stock-bar { display: flex; flex-direction: column; gap: .2rem; min-width: 80px; }
.stock-bar-track { height: 4px; background: var(--bg3); border-radius: 2px; overflow: hidden; }
.stock-bar-fill  { height: 100%; border-radius: 2px; transition: width .4s; }
.stock-num { font-size: .8rem; font-weight: 700; }

/* ── Tabs inside pages ───────────────────────────────── */
.page-tabs {
  display: flex; gap: .5rem; border-bottom: 2px solid var(--border);
  margin-bottom: 1.5rem; overflow-x: auto;
}
.page-tab {
  padding: .6rem 1.1rem; white-space: nowrap; font-size: .88rem; font-weight: 600;
  color: var(--text2); cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: var(--transition);
}
.page-tab:hover  { color: var(--text); }
.page-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ── Image grid in item form ─────────────────────────── */
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: .5rem; margin-top: .5rem; }
.img-thumb-wrap { position: relative; aspect-ratio: 1; border-radius: var(--radius-sm); overflow: hidden; border: 1.5px solid var(--border); }
.img-thumb-wrap img { width: 100%; height: 100%; object-fit: cover; }
.img-remove { position: absolute; top: 3px; right: 3px; background: rgba(239,68,68,.85); border: none; color: #fff; border-radius: 4px; width: 20px; height: 20px; font-size: .7rem; cursor: pointer; display: flex; align-items: center; justify-content: center; }

/* ── Charts container ────────────────────────────────── */
.chart-box {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem;
  position: relative;
}
.chart-box canvas { height: 240px !important; width: 100% !important; display: block; }

/* ── Transaction Combobox Dropdown ───────────────────── */
.txn-combo-dd {
  position: absolute; top: calc(100% + 3px); left: 0; right: 0;
  background: var(--bg2); border: 1.5px solid var(--primary);
  border-radius: var(--radius-sm); z-index: 800;
  max-height: 210px; overflow-y: auto;
  box-shadow: var(--shadow);
  animation: slideUp .15s ease;
}
.txn-combo-item {
  padding: .6rem .9rem; cursor: pointer;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: .5rem;
  transition: background var(--transition); font-size: .87rem;
}
.txn-combo-item:hover { background: var(--primary-light); }
.txn-combo-item:last-child { border-bottom: none; }
.txn-combo-item strong { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.txn-combo-meta { font-size: .74rem; color: var(--text3); font-family: monospace; flex-shrink: 0; }
.txn-combo-stock { font-size: .76rem; font-weight: 700; flex-shrink: 0; }
.txn-combo-new   { color: var(--primary); font-weight: 600; }
.txn-combo-walkin{ color: var(--text2); }
/* Selected value chip */
.txn-chip {
  margin-top: .4rem; padding: .38rem .75rem;
  background: var(--primary-light); color: var(--primary);
  border-radius: var(--radius-sm); font-size: .82rem; font-weight: 600;
  display: flex; align-items: center; gap: .5rem;
}
.txn-chip-clear {
  margin-left: auto; cursor: pointer; opacity: .7; font-size: .9rem;
  background: none; border: none; color: var(--primary); padding: 0; line-height: 1;
}
.txn-chip-clear:hover { opacity: 1; }

/* ── Language Toggle ─────────────────────────────────── */
.lang-toggle {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text2);
  border-radius: 20px;
  padding: .28rem .72rem;
  font-size: .78rem;
  font-weight: 800;
  cursor: pointer;
  transition: var(--transition);
  letter-spacing: .05em;
  font-family: var(--font);
  line-height: 1.6;
  flex-shrink: 0;
}
.lang-toggle:hover { border-color: var(--primary); color: var(--primary); }

/* ── Theme Toggle ────────────────────────────────────── */
.theme-toggle {
  background: var(--bg3);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: .28rem .6rem;
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition);
  line-height: 1.5;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.theme-toggle:hover { border-color: var(--primary); background: var(--primary-light); }

/* ── Sidebar overlay (desktop helper only) ───────────── */
.sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5);
  z-index: 99; backdrop-filter: blur(2px);
}

/* ── Bottom Nav (mobile only) — hidden by default ────── */
#bottom-nav { display: none; }
#more-sheet-overlay { display: none; }

/* ── Animations ──────────────────────────────────────── */
@keyframes slideUp    { from { opacity: 0; transform: translateY(16px); }  to { opacity: 1; transform: none; } }
@keyframes slideRight { from { opacity: 0; transform: translateX(12px); }  to { opacity: 1; transform: none; } }
@keyframes spin       { to { transform: rotate(360deg); } }
@keyframes fadeIn     { from { opacity: 0; } to { opacity: 1; } }

/* ══════════════════ RESPONSIVE ═══════════════════════ */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row.cols-3 { grid-template-columns: 1fr 1fr; }
}

/* ─── MOBILE — Bottom-bar navigation ──────────────────── */
@media (max-width: 768px) {

  /* Hide sidebar completely on mobile */
  #sidebar         { display: none !important; }
  .hamburger       { display: none !important; }
  .sidebar-overlay { display: none !important; }
  #main            { margin-left: 0; min-width: 0; overflow-x: hidden; }

  /* Quick-add btn hidden; FAB replaces it */
  #quick-add-btn   { display: none; }

  /* Content clears bottom nav */
  .content {
    padding: .85rem .85rem calc(64px + env(safe-area-inset-bottom, 0px) + 1rem);
  }

  /* Topbar */
  .topbar      { padding: .6rem 1rem; }
  #page-title  { font-size: .98rem; }
  .owner-chip span { display: none; }

  /* Modals slide up from bottom */
  .modal        { max-width: 100%; margin: 0; border-radius: 20px 20px 0 0; 
                  display: flex; flex-direction: column; max-height: calc(100vh - 20px); }
  .modal-body   { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .modal-overlay{ align-items: flex-end; padding: 0; }

  /* Auth box */
  .auth-box { padding: 1.5rem 1.15rem; }

  /* Toast above bottom nav */
  #toast-container {
    left: .75rem; right: .75rem;
    bottom: calc(68px + env(safe-area-inset-bottom, 0px) + .4rem);
  }

  /* Layout */
  .toolbar      { gap: .5rem; }
  th, td        { padding: .5rem .65rem; }
  .stats-grid   { grid-template-columns: repeat(2, 1fr); }
  .form-row.cols-2,
  .form-row.cols-3 { grid-template-columns: 1fr; }
  .dash-charts-row,
  .dash-bottom-row,
  .reports-charts { grid-template-columns: 1fr !important; }
  .chart-box canvas { height: 190px !important; max-height: 190px; }
  .chart-box { padding: .85rem; }

  /* Mobile combobox adjustments */
  .txn-combo-dd { 
    max-height: 150px; 
  }
  .form-group[style*="position:relative"] { 
    overflow: visible !important;
  }

  /* ── Items page — mobile toolbar & table ─────────────── */
  #page-items .toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  #page-items .toolbar .search-box {
    width: 100%;
    min-width: 0;
    flex: none;
  }
  #page-items .toolbar .filters-row {
    display: flex;
    gap: .5rem;
  }
  #page-items .toolbar .filter {
    flex: 1;
    min-width: 0;
    font-size: .78rem;
  }
  #page-items .toolbar #add-item-btn {
    width: 100%;
    justify-content: center;
  }

  /* Hide non-essential table columns on items page */
  #items-table th:nth-child(2), #items-table td:nth-child(2), /* SKU */
  #items-table th:nth-child(5), #items-table td:nth-child(5), /* Cost */
  #items-table th:nth-child(6), #items-table td:nth-child(6), /* Selling */
  #items-table th:nth-child(7), #items-table td:nth-child(7)  /* Margin */
  { display: none; }

  /* Compact item thumbnail on mobile */
  #items-table .item-thumb { width: 32px; height: 32px; font-size: 1rem; }
  #items-table td:nth-child(1) > div { gap: .45rem; }

  /* ── Bottom Navigation Bar ─────────────────────────── */
  #bottom-nav {
    display: flex;
    position: fixed; bottom: 0; left: 0; right: 0;
    height: 60px;
    padding-bottom: env(safe-area-inset-bottom, 0);
    background: var(--bg2);
    border-top: 1px solid var(--border);
    z-index: 300;
    align-items: stretch;
    box-shadow: 0 -4px 24px rgba(0,0,0,.12);
  }
  [data-theme="dark"] #bottom-nav { box-shadow: 0 -4px 24px rgba(0,0,0,.4); }

  .bn-item {
    flex: 1;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 2px;
    cursor: pointer;
    color: var(--text3);
    font-size: .6rem; font-weight: 600;
    padding: .4rem .1rem .3rem;
    transition: color var(--transition);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    position: relative;
  }
  .bn-item.active            { color: var(--primary); }
  .bn-item.active .bn-icon   { transform: scale(1.15); }
  .bn-icon   { font-size: 1.28rem; line-height: 1; transition: transform .15s ease; }
  .bn-label  { line-height: 1; }

  /* Centre FAB */
  .bn-fab {
    flex: 0 0 62px;
    position: relative;
    margin-top: -18px;
    display: flex; align-items: center; justify-content: center;
  }
  .bn-fab-circle {
    width: 50px; height: 50px;
    background: linear-gradient(135deg, var(--primary), var(--primary-h));
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.55rem; line-height: 1;
    box-shadow: 0 4px 20px rgba(99,102,241,.6);
    border: 3px solid var(--bg);
    transition: transform .15s ease, box-shadow .15s ease;
  }
  .bn-fab:active .bn-fab-circle {
    transform: scale(.88);
    box-shadow: 0 2px 10px rgba(99,102,241,.35);
  }

  /* Alert badge on nav item */
  .bn-badge {
    position: absolute; top: 2px; right: 6px;
    background: var(--red); color: #fff;
    font-size: .56rem; font-weight: 800;
    min-width: 15px; height: 15px;
    border-radius: 8px; padding: 0 3px;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--bg2);
  }

  /* ── More Sheet ───────────────────────────────────── */
  #more-sheet-overlay {
    display: block;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 298;
    opacity: 0; pointer-events: none;
    transition: opacity .25s ease;
    backdrop-filter: blur(3px);
  }
  #more-sheet-overlay.visible { opacity: 1; pointer-events: auto; }

  #more-sheet {
    position: fixed;
    bottom: 60px; left: 0; right: 0;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: 20px 20px 0 0;
    z-index: 299;
    padding: .65rem 1rem 1rem;
    transform: translateY(calc(100% + 4px));
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    box-shadow: 0 -8px 30px rgba(0,0,0,.15);
  }
  [data-theme="dark"] #more-sheet { box-shadow: 0 -8px 30px rgba(0,0,0,.4); }
  #more-sheet.open { transform: translateY(0); }

  .more-sheet-grip {
    width: 36px; height: 4px;
    background: var(--border); border-radius: 2px;
    margin: 0 auto .75rem;
  }

  .more-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: .4rem;
  }

  .more-item {
    display: flex; flex-direction: column;
    align-items: center; gap: .4rem;
    padding: .8rem .2rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition);
    -webkit-tap-highlight-color: transparent;
  }
  .more-item:active { background: var(--bg3); }
  .more-item-icon {
    width: 46px; height: 46px;
    border-radius: 13px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.45rem;
  }
  .more-item-label { font-size: .7rem; font-weight: 600; color: var(--text2); text-align: center; }

  /* Logout row in more-sheet */
  .more-logout {
    display: flex; align-items: center; gap: .75rem;
    padding: .85rem 1rem;
    margin-top: .35rem;
    border-top: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer; color: var(--red);
    font-size: .88rem; font-weight: 600;
    -webkit-tap-highlight-color: transparent;
  }
  .more-logout:active { background: var(--red-light); }
}

/* ──────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .stats-grid   { grid-template-columns: 1fr 1fr; }
  .stat-val     { font-size: 1.2rem; }
  .page-tabs    { gap: 0; }
  .page-tab     { padding: .5rem .6rem; font-size: .8rem; }
  .auth-box     { border-radius: 0; min-height: 100dvh; padding: 1.25rem 1rem; }
  #auth-screen  { padding: 0; align-items: flex-start; }
}

/* ══════════════════════════════════════════════════════
   CUSTOMER MODULE
══════════════════════════════════════════════════════ */
.cust-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem; font-weight: 700; flex-shrink: 0;
}
.cust-detail-meta {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px; margin-bottom: 16px;
}
.cust-detail-meta > div { display: flex; flex-direction: column; gap: 2px; }
.cust-detail-meta label { font-size: .7rem; color: var(--text2); text-transform: uppercase; letter-spacing: .05em; }
.cust-detail-meta span  { font-size: .9rem; font-weight: 500; }
.cust-detail-stats {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px; margin-bottom: 18px;
}

/* Invoice status badges */
.inv-status-badge {
  display: inline-block; padding: 2px 10px; border-radius: 20px;
  font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
}
.inv-status-paid    { background: #dcfce7; color: #15803d; }
.inv-status-partial { background: #fef9c3; color: #a16207; }
.inv-status-unpaid  { background: #fee2e2; color: #b91c1c; }

/* ══════════════════════════════════════════════════════
   INVOICE BUILDER
══════════════════════════════════════════════════════ */
.inv-builder-top {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-bottom: 1.5rem;
}
@media (max-width: 680px) { .inv-builder-top { grid-template-columns: 1fr; } }

/* Item search dropdown */
.inv-item-dropdown {
  position: absolute; top: calc(100% + 2px); left: 0; right: 0;
  background: var(--bg2); border: 1.5px solid var(--primary);
  border-radius: var(--radius-sm); z-index: 200; max-height: 220px; overflow-y: auto;
  box-shadow: var(--shadow);
}
.inv-item-result {
  padding: .65rem 1rem; cursor: pointer; border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 2px;
  transition: background var(--transition);
}
.inv-item-result:hover { background: var(--primary-light); }
.inv-item-result:last-child { border-bottom: none; }

/* Line items table */
.inv-lines-table { display: flex; flex-direction: column; gap: 0; }
.inv-lines-header {
  display: grid;
  grid-template-columns: 2fr .6fr .8fr .5fr .5fr .7fr .3fr;
  gap: .4rem; padding: .4rem .6rem;
  background: var(--bg3); border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  font-size: .72rem; font-weight: 700; color: var(--text2); text-transform: uppercase;
}
.inv-line-row {
  display: grid;
  grid-template-columns: 2fr .6fr .8fr .5fr .5fr .7fr .3fr;
  gap: .4rem; padding: .5rem .6rem;
  border: 1px solid var(--border); border-top: none;
  align-items: start; background: var(--bg2);
}
.inv-line-row:last-child { border-radius: 0 0 var(--radius-sm) var(--radius-sm); }
.inv-line-row:hover { background: var(--bg3); }
.inv-line-input    { font-size: .85rem; padding: .4rem .6rem; }
.inv-line-input-sm { font-size: .82rem; padding: .35rem .5rem; }
.inv-line-total    { font-size: .88rem; font-weight: 700; color: var(--text); padding-top: .4rem; }
@media (max-width: 680px) {
  .inv-lines-header { display: none; }
  .inv-line-row { grid-template-columns: 1fr 1fr; gap: .5rem; }
}

/* Totals box */
.inv-builder-totals {
  background: var(--bg3); border-radius: var(--radius); padding: 1rem 1.25rem;
  margin-top: 1.25rem; max-width: 360px; margin-left: auto;
  border: 1px solid var(--border);
}
.inv-bt-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: .3rem 0; font-size: .9rem; border-bottom: 1px solid var(--border);
}
.inv-bt-row:last-child { border-bottom: none; }
.inv-bt-grand {
  font-size: 1.1rem; font-weight: 800; color: var(--primary);
  padding: .5rem 0; margin: .25rem 0;
}

/* ══════════════════════════════════════════════════════
   INVOICE DOCUMENT (preview on screen)
══════════════════════════════════════════════════════ */
.inv-doc {
  background: #fff; color: #1a1a2e;
  font-family: 'Inter', 'Segoe UI', sans-serif;
  padding: 2rem 2.5rem; max-width: 820px; margin: 0 auto;
  border-radius: 8px; box-shadow: 0 2px 16px rgba(0,0,0,.1);
  font-size: 13px; line-height: 1.5;
}
.inv-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 2rem; margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.inv-biz-block { display: flex; align-items: flex-start; gap: 1rem; }
.inv-logo { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; border: 1px solid #e5e7eb; }
.inv-logo-placeholder {
  width: 72px; height: 72px; border-radius: 10px;
  background: linear-gradient(135deg, #6366f1, #818cf8);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 2rem; font-weight: 800; flex-shrink: 0;
}
.inv-biz-name  { font-size: 1.3rem; font-weight: 800; color: #0f172a; margin-bottom: .15rem; }
.inv-biz-addr  { font-size: .8rem; color: #64748b; margin: 1px 0; }
.inv-title-block { text-align: right; }
.inv-title-text  {
  font-size: 1.6rem; font-weight: 900; color: #6366f1;
  letter-spacing: .08em; margin-bottom: .75rem;
}
.inv-meta-table  { border-collapse: collapse; margin-left: auto; }
.inv-meta-table td { padding: 3px 0 3px 12px; font-size: .82rem; color: #374151; }
.inv-meta-table td:first-child { color: #9ca3af; font-size: .76rem; text-transform: uppercase; }
.inv-divider     { border: none; border-top: 2px solid #e5e7eb; margin: 1.25rem 0; }
.inv-parties     { margin-bottom: 1.25rem; }
.inv-bill-to     { display: inline-block; }
.inv-section-label { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: #9ca3af; margin-bottom: .35rem; }
.inv-cust-name   { font-size: 1rem; font-weight: 700; color: #0f172a; }
.inv-cust-detail { font-size: .82rem; color: #4b5563; margin: 2px 0; }

/* Line items table */
.inv-items-table {
  width: 100%; border-collapse: collapse; margin-bottom: 1.5rem;
  font-size: .82rem;
}
.inv-items-table th {
  background: #4f46e5; color: #fff; padding: .5rem .75rem;
  text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .05em;
}
.inv-items-table th:last-child,
.inv-items-table td:last-child { text-align: right; }
.inv-items-table td { padding: .55rem .75rem; border-bottom: 1px solid #f1f5f9; color: #374151; }
.inv-items-table tbody tr:nth-child(even) td { background: #f8fafc; }
.inv-items-table tbody tr:last-child td { border-bottom: 2px solid #e5e7eb; }

/* Totals row */
.inv-totals-row { display: flex; gap: 1.5rem; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; }
.inv-notes-col  { flex: 1; min-width: 200px; }
.inv-notes-block { background: #f8fafc; border-radius: 6px; padding: .65rem .85rem; font-size: .81rem; color: #4b5563; margin-bottom: .4rem; }
.inv-words      { background: #eff6ff; border-left: 3px solid #6366f1; padding: .6rem .85rem; border-radius: 0 6px 6px 0; font-size: .78rem; color: #3730a3; margin-top: .75rem; font-style: italic; }
.inv-totals-table { border-collapse: collapse; min-width: 260px; }
.inv-totals-table td { padding: .4rem .75rem; font-size: .86rem; color: #374151; }
.inv-totals-table td:last-child { text-align: right; font-variant-numeric: tabular-nums; padding-left: 1.5rem; }
.inv-grand-row td { background: #4f46e5; color: #fff !important; font-size: 1rem; font-weight: 800; padding: .6rem .75rem; }

/* Footer */
.inv-footer    { display: flex; justify-content: space-between; margin-top: 2rem; padding-top: 1rem; border-top: 1px solid #e5e7eb; font-size: .82rem; color: #6b7280; align-items: flex-end; flex-wrap: wrap; gap: .75rem; }
.inv-footer-right { text-align: center; min-width: 140px; }

/* ── PRINT STYLES ────────────────────────────────────── */
@media print {
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  body > * { display: none !important; }
  #inv-print-window { display: block !important; }
}

/* Standalone print window */
.inv-print-standalone { padding: 12mm; background: #fff; }
.inv-print-standalone .inv-doc { box-shadow: none; padding: 0; border-radius: 0; }

[data-theme="dark"] .inv-doc { background: #fff; color: #1a1a2e; }
[data-theme="dark"] .inv-item-dropdown { border-color: var(--primary); }

/* ══════════════════════════════════════════════════════
   CUSTOMER DRAWER
══════════════════════════════════════════════════════ */
.inv-biz-drawer {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(0,0,0,.55); backdrop-filter: blur(4px);
  display: flex; justify-content: flex-end;
}
.inv-biz-drawer.hidden { display: none !important; }
.inv-biz-drawer-inner {
  background: var(--bg2); border-left: 1px solid var(--border);
  width: 100%; max-width: 520px;
  display: flex; flex-direction: column;
  animation: slideRight .25s ease;
}
.inv-biz-drawer-header {
  padding: 1.1rem 1.5rem; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.inv-biz-drawer-content { flex: 1; overflow-y: auto; padding: 1.25rem 1.5rem; }
.inv-drawer-close {
  background: transparent; border: none; color: var(--text2);
  font-size: 1.3rem; cursor: pointer; line-height: 1; padding: .2rem;
}
.inv-drawer-close:hover { color: var(--text); }
.im-ds-card {
  background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: .65rem .85rem; display: flex; flex-direction: column; gap: .2rem;
}
.im-ds-card strong { font-size: .95rem; font-weight: 700; }
.im-ds-card span   { font-size: .72rem; color: var(--text2); text-transform: uppercase; letter-spacing: .05em; }

@media (max-width: 768px) {
  .inv-biz-drawer-inner { max-width: 100%; border-left: none; border-top: 1px solid var(--border); border-radius: 20px 20px 0 0; }
  .inv-biz-drawer { align-items: flex-end; }
  .inv-biz-drawer-inner { max-height: 86vh; }
}

/* ═══════════════════════════════════════════════
   RESTAURANT / KITCHEN MANAGEMENT STYLES
   ═══════════════════════════════════════════════ */

/* ── Veg/Non-Veg Indicator ─────────────────────── */
.food-dot {
  width: 14px; height: 14px; border-radius: 3px;
  border: 1.5px solid currentColor; display: inline-flex;
  align-items: center; justify-content: center; flex-shrink: 0;
}
.food-dot::after {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}
.food-dot.veg     { color: #16a34a; }
.food-dot.non-veg { color: #dc2626; }
.food-dot.vegan   { color: #059669; }
.food-dot.egg     { color: #d97706; }

/* ── Menu Grid ─────────────────────────────────── */
.rest-menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem; margin-top: .25rem;
}
.rest-menu-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem;
  display: flex; flex-direction: column; gap: .5rem;
  transition: box-shadow var(--transition), border-color var(--transition);
  position: relative;
}
.rest-menu-card:hover { box-shadow: var(--shadow); border-color: var(--primary); }
.rest-menu-card.unavailable { opacity: .55; }
.rest-menu-header { display: flex; align-items: flex-start; gap: .5rem; }
.rest-menu-title  { font-weight: 700; font-size: .95rem; flex: 1; line-height: 1.3; }
.rest-menu-cat    { font-size: .72rem; color: var(--text2); text-transform: uppercase; letter-spacing: .04em; }
.rest-menu-price  { font-size: 1.05rem; font-weight: 800; color: var(--primary); white-space: nowrap; }
.rest-menu-desc   { font-size: .8rem; color: var(--text2); line-height: 1.4; }
.rest-menu-tags   { display: flex; flex-wrap: wrap; gap: .3rem; }
.rest-menu-tag    { font-size: .7rem; padding: .18rem .5rem; background: var(--primary-light); color: var(--primary); border-radius: 20px; }
.rest-menu-footer {
  display: flex; align-items: center; justify-content: space-between;
  border-top: 1px solid var(--border); margin-top: .25rem; padding-top: .5rem;
}
.rest-menu-actions { display: flex; gap: .4rem; }
.rest-avail-toggle {
  font-size: .74rem; font-weight: 600; padding: .22rem .6rem;
  border-radius: 20px; border: none; cursor: pointer;
  transition: var(--transition);
}
.rest-avail-toggle.on  { background: rgba(34,197,94,.15); color: #16a34a; }
.rest-avail-toggle.off { background: rgba(239,68,68,.12); color: var(--red); }
.rest-menu-cost { font-size: .74rem; color: var(--text2); }

/* ── Tables Grid ───────────────────────────────── */
.rest-tables-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem; margin-top: .25rem;
}
.rest-table-card {
  background: var(--bg2); border: 2px solid var(--border);
  border-radius: var(--radius); padding: 1rem 1.1rem;
  text-align: center; cursor: pointer;
  transition: box-shadow var(--transition), border-color var(--transition);
  position: relative; overflow: hidden;
}
.rest-table-card:hover { box-shadow: var(--shadow); }
.rest-table-card.available { border-color: #16a34a; }
.rest-table-card.occupied  { border-color: var(--red); background: rgba(239,68,68,.05); }
.rest-table-card.reserved  { border-color: var(--yellow); }
.rest-table-card.dirty     { border-color: #8b5cf6; }
.rest-table-card.out-of-service { opacity: .4; }
.rest-table-no   { font-size: 1.4rem; font-weight: 800; }
.rest-table-area { font-size: .72rem; color: var(--text2); margin-top: .1rem; }
.rest-table-seats{ font-size: .78rem; color: var(--text2); }
.rest-table-status-badge {
  position: absolute; top: 6px; right: 6px;
  font-size: .64rem; font-weight: 700; padding: .15rem .45rem;
  border-radius: 20px; text-transform: uppercase; letter-spacing: .05em;
}
.rest-table-card.available  .rest-table-status-badge { background: rgba(34,197,94,.15);  color: #16a34a; }
.rest-table-card.occupied   .rest-table-status-badge { background: rgba(239,68,68,.15);  color: var(--red); }
.rest-table-card.reserved   .rest-table-status-badge { background: rgba(245,158,11,.15); color: #b45309; }
.rest-table-card.dirty      .rest-table-status-badge { background: rgba(139,92,246,.15); color: #7c3aed; }
.rest-table-order-info { font-size: .75rem; color: var(--primary); margin-top: .4rem; font-weight: 600; }

/* ── Orders List ───────────────────────────────── */
.rest-orders-list { display: flex; flex-direction: column; gap: .65rem; margin-top: .25rem; }
.rest-order-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .85rem 1rem;
  cursor: pointer; transition: box-shadow var(--transition);
  display: flex; align-items: center; gap: 1rem;
}
.rest-order-card:hover { box-shadow: var(--shadow); border-color: var(--primary); }
.rest-order-badge {
  min-width: 52px; text-align: center;
}
.rest-order-num { font-size: .9rem; font-weight: 800; }
.rest-order-time { font-size: .72rem; color: var(--text2); }
.rest-order-info { flex: 1; min-width: 0; }
.rest-order-where { font-weight: 600; font-size: .93rem; }
.rest-order-items-preview { font-size: .78rem; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: .1rem; }
.rest-order-status-pill {
  font-size: .72rem; font-weight: 700; padding: .28rem .75rem;
  border-radius: 20px; text-transform: capitalize; white-space: nowrap;
}
.status-pill-open      { background: rgba(99,102,241,.12); color: var(--primary); }
.status-pill-preparing { background: rgba(245,158,11,.15); color: #b45309; }
.status-pill-ready     { background: rgba(34,197,94,.15);  color: #16a34a; }
.status-pill-billed    { background: rgba(34,197,94,.2);   color: #15803d; }
.status-pill-cancelled { background: rgba(239,68,68,.12);  color: var(--red); }
.rest-order-total { font-weight: 800; font-size: 1rem; white-space: nowrap; }

/* ── KDS Grid ──────────────────────────────────── */
.rest-kds-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .75rem; margin-top: .25rem;
  align-items: start;
}
.rest-kds-card {
  background: var(--bg2); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: .85rem;
  display: flex; flex-direction: column; gap: .4rem;
}
.rest-kds-card.pending  { border-left: 4px solid var(--red); }
.rest-kds-card.preparing{ border-left: 4px solid var(--yellow); }
.rest-kds-card.ready    { border-left: 4px solid var(--green); opacity: .7; }
.rest-kds-top { display: flex; align-items: center; justify-content: space-between; gap: .4rem; }
.rest-kds-name { font-weight: 700; font-size: .95rem; }
.rest-kds-qty  { font-size: .8rem; color: var(--text2); }
.rest-kds-table{ font-size: .78rem; font-weight: 600; color: var(--primary); }
.rest-kds-note { font-size: .74rem; color: #b45309; background: rgba(245,158,11,.12); padding: .2rem .5rem; border-radius: var(--radius-sm); }
.rest-kds-timer{ font-size: .72rem; color: var(--text3); }
.rest-kds-timer.urgent { color: var(--red); font-weight: 700; }
.rest-kds-actions { display: flex; gap: .4rem; margin-top: .25rem; }

/* ── Order Items in Detail Modal ───────────────── */
.rod-item-row {
  display: flex; align-items: center; gap: .75rem;
  padding: .55rem .65rem; border-radius: var(--radius-sm);
  background: var(--bg3); border: 1px solid var(--border);
}
.rod-item-name  { flex: 1; font-weight: 600; font-size: .88rem; }
.rod-item-price { font-size: .84rem; font-weight: 700; white-space: nowrap; }
.rod-item-status{ font-size: .7rem; font-weight: 700; padding: .18rem .5rem; border-radius: 20px; }
.rod-item-status.pending   { background: rgba(239,68,68,.12);  color: var(--red); }
.rod-item-status.preparing { background: rgba(245,158,11,.15); color: #b45309; }
.rod-item-status.ready     { background: rgba(34,197,94,.15);  color: #16a34a; }
.rod-item-status.served    { background: var(--bg3); color: var(--text3); }

/* ── Order Total Bar ───────────────────────────── */
.rest-order-total-bar {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: .65rem 1rem;
  display: flex; align-items: center; justify-content: space-between;
  margin-top: .5rem;
}

/* ── Bill Totals ───────────────────────────────── */
.rest-bill-totals {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: .75rem 1rem;
  display: flex; flex-direction: column; gap: .35rem;
  font-size: .86rem; margin-top: .75rem;
}
.rest-bill-totals .bill-row { display: flex; justify-content: space-between; align-items: center; }
.rest-bill-totals .bill-row.grand { font-weight: 800; font-size: 1.1rem; border-top: 1px solid var(--border); padding-top: .4rem; margin-top: .1rem; color: var(--primary); }

/* ── Recipe Ingredient Row ─────────────────────── */
.rm-ingredient-row {
  display: grid; grid-template-columns: 1fr 80px 70px 34px;
  gap: .4rem; align-items: center;
}
.rm-variant-row {
  display: grid; grid-template-columns: 1fr 100px 34px;
  gap: .4rem; align-items: center;
}

/* ── New Order Item Row ────────────────────────── */
.ro-item-row {
  display: flex; align-items: center; gap: .5rem;
  padding: .45rem .6rem; background: var(--bg3);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.ro-item-name  { flex: 1; font-size: .86rem; font-weight: 600; }
.ro-item-price { font-size: .84rem; font-weight: 700; white-space: nowrap; }

/* ── Responsive ────────────────────────────────── */
@media (max-width: 768px) {
  .rest-menu-grid    { grid-template-columns: 1fr; }
  .rest-tables-grid  { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .rest-kds-grid     { grid-template-columns: 1fr; }
  .rest-order-card   { flex-wrap: wrap; }
  .rm-ingredient-row { grid-template-columns: 1fr 70px 60px 30px; }
}
