/* ==================================================================
   Universal Billing System — core stylesheet
   ================================================================== */

:root {
  --ubs-primary: #d97706;
  --ubs-primary-dark: #b45309;
  --ubs-primary-light: #fef3c7;
  --ubs-primary-rgb: 217, 119, 6;
  --ubs-success: #16a34a;
  --ubs-warning: #d97706;
  --ubs-danger: #dc2626;
  --ubs-info: #0891b2;

  --ubs-bg: #f4f6fb;
  --ubs-surface: #ffffff;
  --ubs-surface-alt: #f8f9fc;
  --ubs-border: #e6e9f2;
  --ubs-text: #1e2233;
  --ubs-text-muted: #6b7280;
  --ubs-sidebar-bg: #0f1222;
  --ubs-sidebar-text: #b7bacb;
  --ubs-sidebar-active: #d97706;
  --ubs-topbar-bg: #0f1222;
  --ubs-topbar-text: #e5e7eb;
  --ubs-shadow: 0 2px 10px rgba(24, 28, 60, 0.06);
  --ubs-radius: 14px;
}

[data-bs-theme="dark"] {
  --ubs-bg: #11131f;
  --ubs-surface: #181b2c;
  --ubs-surface-alt: #1f2337;
  --ubs-border: #2a2e46;
  --ubs-text: #e7e9f5;
  --ubs-text-muted: #9296b0;
  --ubs-sidebar-bg: #0d0e19;
  --ubs-sidebar-text: #9296b0;
  --ubs-topbar-bg: #0d0e19;
  --ubs-topbar-text: #e7e9f5;
  --ubs-shadow: 0 2px 14px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

body {
  background: var(--ubs-bg);
  color: var(--ubs-text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 0.925rem;
  transition: background .25s ease, color .25s ease;
}

a { text-decoration: none; }

/* ---------------- Layout shell ---------------- */

.ubs-app {
  display: flex;
  min-height: 100vh;
}

.ubs-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--ubs-sidebar-bg);
  color: var(--ubs-sidebar-text);
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 1040;
  display: flex;
  flex-direction: column;
  transition: transform .25s ease, width .25s ease;
}

.ubs-sidebar-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: 1.15rem 1.25rem;
  color: #fff;
  font-weight: 700;
  font-size: 1.05rem;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.ubs-sidebar-brand .logo-badge {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--ubs-primary), #fbbf24);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: #fff; flex-shrink: 0;
}

/* Shared brand mark: uploaded business logo, or a generic badge fallback.
   Used in the sidebar, mobile topbar, and pre-login screens. */
.brand-logo-img {
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  background: #fff;
}
.brand-logo-badge {
  border-radius: 10px;
  background: linear-gradient(135deg, var(--ubs-primary), #fbbf24);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; color: #fff; flex-shrink: 0;
}
.ubs-topbar-logo {
  display: flex; align-items: center; text-decoration: none;
}

.ubs-sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: .75rem .6rem;
}

.ubs-nav-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .62rem .85rem;
  border-radius: 10px;
  color: var(--ubs-sidebar-text);
  font-size: .875rem;
  font-weight: 500;
  margin-bottom: .15rem;
  cursor: pointer;
  white-space: nowrap;
}
.ubs-nav-link i { width: 18px; text-align: center; font-size: 1rem; }
.ubs-nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.ubs-nav-link.active {
  background: var(--ubs-sidebar-active);
  color: #fff;
  box-shadow: 0 4px 12px rgba(var(--ubs-primary-rgb), .35);
}
.ubs-nav-section-title {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #565a75;
  padding: .9rem .85rem .3rem;
  font-weight: 700;
}

/* Collapsible sidebar groups (Catalog, Parties, Finance, etc.) — click the
   header to open/close. State is .expanded (JS, saved to localStorage in
   app.js) so the choice survives normal page navigation. */
.ubs-nav-group { margin-top: .2rem; }
.ubs-nav-group-toggle {
  display: flex;
  align-items: center;
  gap: .75rem;
  width: 100%;
  border: none;
  background: none;
  padding: .62rem .85rem;
  border-radius: 10px;
  color: var(--ubs-sidebar-text);
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.ubs-nav-group-toggle i:first-child { width: 18px; text-align: center; font-size: 1rem; }
.ubs-nav-group-toggle span { flex: 1; text-align: left; }
.ubs-nav-group-toggle:hover { background: rgba(255,255,255,.06); color: #fff; }
.ubs-nav-group-caret { font-size: .72rem !important; width: auto !important; opacity: .6; transition: transform .2s ease; }
.ubs-nav-group.expanded .ubs-nav-group-caret { transform: rotate(180deg); }

.ubs-nav-group-items {
  max-height: 0;
  overflow: hidden;
  padding-left: 1.1rem;
  transition: max-height .25s ease;
}
.ubs-nav-group.expanded .ubs-nav-group-items {
  max-height: 32rem; /* generous cap, comfortably covers every group's item count */
}

.ubs-main {
  margin-left: 260px;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  transition: margin-left .25s ease;
}

.ubs-topbar {
  height: 64px;
  background: var(--ubs-topbar-bg);
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  position: sticky;
  top: 0;
  z-index: 1030;
  color: var(--ubs-topbar-text);
}
.ubs-topbar h5 { color: var(--ubs-topbar-text); }
.ubs-topbar .ubs-sidebar-toggle,
.ubs-topbar .ubs-mobile-toggle,
.ubs-topbar .btn-light {
  background: rgba(255,255,255,.08);
  color: var(--ubs-topbar-text);
  border-color: rgba(255,255,255,.12);
}
.ubs-topbar .ubs-sidebar-toggle:hover,
.ubs-topbar .ubs-mobile-toggle:hover,
.ubs-topbar .btn-light:hover {
  background: rgba(255,255,255,.16);
  color: #fff;
}

.ubs-content {
  padding: 1.5rem;
  flex: 1;
}

.ubs-sidebar-toggle, .ubs-mobile-toggle {
  border: none;
  background: var(--ubs-surface-alt);
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--ubs-text);
}

/* ---------------- Cards ---------------- */

.ubs-card {
  background: var(--ubs-surface);
  border: 1px solid var(--ubs-border);
  border-radius: var(--ubs-radius);
  box-shadow: var(--ubs-shadow);
}

.kpi-card {
  background: var(--ubs-surface);
  border: 1px solid var(--ubs-border);
  border-radius: var(--ubs-radius);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--ubs-shadow);
  position: relative;
  overflow: hidden;
}
.kpi-card .kpi-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  margin-bottom: .6rem;
}
.kpi-card .kpi-label { color: var(--ubs-text-muted); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.kpi-card .kpi-value { font-size: 1.55rem; font-weight: 800; margin-top: .15rem; }
.kpi-card .kpi-trend { font-size: .78rem; font-weight: 600; }

/* ---------------- Dashboard hero banner ---------------- */

.dash-hero {
  background: linear-gradient(135deg, #0f1222 0%, #1c2140 55%, #2d2f5c 100%);
  border-radius: var(--ubs-radius);
  padding: 1.5rem 1.75rem;
  box-shadow: 0 12px 30px rgba(15, 18, 34, .35);
  position: relative;
  overflow: hidden;
}
.dash-hero::after {
  content: "";
  position: absolute; top: -40%; right: -8%;
  width: 260px; height: 260px; border-radius: 50%;
  background: rgba(217,119,6,.12);
}
.dash-hero-inner { position: relative; z-index: 1; }
.dash-hero .brand-logo-img, .dash-hero .brand-logo-badge { box-shadow: 0 4px 14px rgba(0,0,0,.2); }
.dash-hero-sub { color: rgba(255,255,255,.85); display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.dash-hero #dateFilterGroup .btn-light { font-weight: 600; color: var(--ubs-primary-dark); }
.dash-hero #dateFilterGroup .btn-light.active { background: var(--ubs-primary); color: #fff; border-color: var(--ubs-primary); }

/* ---------------- Richer KPI cards ---------------- */

.kpi-card-rich { transition: transform .15s ease, box-shadow .15s ease; }
.kpi-card-rich:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(24,28,60,.1); }
.kpi-icon-grad {
  width: 42px; height: 42px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; font-size: 1.05rem;
  color: #fff; margin-bottom: 0;
}
.kpi-icon-grad.kpi-icon-primary { background: linear-gradient(135deg, #92400e, #d97706); }
.kpi-icon-grad.kpi-icon-info { background: linear-gradient(135deg, #0891b2, #22d3ee); }
.kpi-icon-grad.kpi-icon-success { background: linear-gradient(135deg, #16a34a, #4ade80); }
.kpi-icon-grad.kpi-icon-warning { background: linear-gradient(135deg, #d97706, #fbbf24); }
.kpi-icon-grad.kpi-icon-danger { background: linear-gradient(135deg, #dc2626, #f87171); }
.kpi-card-rich .kpi-trend { display: inline-flex; align-items: center; font-size: .78rem; font-weight: 700; }
.kpi-card-rich .kpi-trend i { font-size: 1rem; }

@media (max-width: 767.98px) {
  .dash-hero { padding: 1.25rem; }
  .dash-hero-inner { flex-direction: column; align-items: flex-start !important; }
  .dash-hero #dateFilterGroup { flex-wrap: wrap; }
}

/* ---------------- Import Wizard ---------------- */

#iwSteps { border-bottom: 1px solid var(--ubs-border); padding-bottom: 1rem; }
.iw-step { flex: 1; text-align: center; color: var(--ubs-text-muted); font-weight: 600; position: relative; }
.iw-step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--ubs-surface-alt); border: 1px solid var(--ubs-border);
  margin-right: .4rem; font-size: .75rem;
}
.iw-step.active { color: var(--ubs-primary); }
.iw-step.active .iw-step-num { background: var(--ubs-primary); border-color: var(--ubs-primary); color: #fff; }
.iw-step.done { color: var(--ubs-success, #16a34a); }
.iw-step.done .iw-step-num { background: #16a34a; border-color: #16a34a; color: #fff; }
@media (max-width: 575.98px) {
  .iw-step { font-size: .68rem; }
  .iw-step-num { width: 20px; height: 20px; margin-right: .15rem; }
}

/* ---------------- Product grid view ---------------- */

.product-grid-card {
  background: var(--ubs-surface);
  border: 1px solid var(--ubs-border);
  border-radius: var(--ubs-radius);
  overflow: hidden;
  transition: transform .15s ease, box-shadow .15s ease;
}
.product-grid-card:hover { transform: translateY(-3px); box-shadow: var(--ubs-shadow); border-color: var(--ubs-primary); }
.product-grid-img {
  aspect-ratio: 1.4 / 1;
  background: var(--ubs-surface-alt);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.product-grid-img img { width: 100%; height: 100%; object-fit: cover; }

/* ---------------- Responsive data list (table replacement) ----------------
   Desktop (>=768px): renders as a CSS-grid "table" — .data-list-head shows
   column labels once, each .data-list-row is one grid row.
   Mobile (<768px): grid collapses to a single column and every row becomes
   a stacked card; each cell prints its own label via data-label, so nothing
   needs horizontal scrolling. Column widths are set per-page with the
   --dl-cols custom property (a grid-template-columns value). */

.data-list { background: var(--ubs-surface); border-radius: var(--ubs-radius); overflow: hidden; }
.data-list-head { display: none; }
.data-list-row {
  display: grid;
  grid-template-columns: var(--dl-cols, 1fr);
  gap: .5rem;
  padding: .8rem 1rem;
  border-bottom: 1px solid var(--ubs-border);
  align-items: center;
}
.data-list-row:last-child { border-bottom: none; }
.data-list-row:hover { background: var(--ubs-surface-alt); }
.data-list-empty { padding: 2.5rem 1rem; text-align: center; color: var(--ubs-text-muted); }
.data-list-cell { min-width: 0; overflow-wrap: break-word; }
.data-list-cell.dl-actions { display: flex; gap: .35rem; flex-wrap: wrap; }

/* Reports have a variable, sometimes large, number of columns. On desktop only,
   allow this specific wrapper to scroll horizontally rather than the whole page —
   mobile always collapses to a single stacked column regardless, so it never scrolls. */
@media (min-width: 768px) {
  .data-list-scroll { overflow-x: auto; }
}

@media (min-width: 768px) {
  .data-list-head {
    display: grid;
    grid-template-columns: var(--dl-cols, 1fr);
    gap: .5rem;
    padding: .7rem 1rem;
    background: var(--ubs-surface-alt);
    color: var(--ubs-text-muted);
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    font-weight: 700;
    border-bottom: 1px solid var(--ubs-border);
  }
}

@media (max-width: 767.98px) {
  .data-list-row { grid-template-columns: 1fr !important; gap: .3rem; padding: .9rem 1rem; }
  .data-list-cell:not(.dl-primary):not(.dl-actions) {
    display: flex; justify-content: space-between; align-items: center; gap: .75rem; font-size: .85rem;
  }
  .data-list-cell[data-label]:not(.dl-primary):not(.dl-actions)::before {
    content: attr(data-label);
    font-size: .68rem; text-transform: uppercase; letter-spacing: .03em;
    color: var(--ubs-text-muted); font-weight: 700; flex-shrink: 0;
  }
  .data-list-cell.dl-primary { font-weight: 600; }
  .data-list-cell.dl-actions { justify-content: flex-end; margin-top: .25rem; }
}

/* ---------------- Tables (legacy — printable documents only) ---------------- */

.table-clean {
  background: var(--ubs-surface);
  border-radius: var(--ubs-radius);
  overflow: hidden;
}
.table-clean thead th {
  background: var(--ubs-surface-alt);
  color: var(--ubs-text-muted);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 700;
  border-bottom: 1px solid var(--ubs-border);
  white-space: nowrap;
}
.table-clean td, .table-clean th { vertical-align: middle; padding: .75rem .9rem; }
.table-clean tbody tr { border-bottom: 1px solid var(--ubs-border); }
.table-clean tbody tr:last-child { border-bottom: none; }
.table-clean tbody tr:hover { background: var(--ubs-surface-alt); }

/* ---------------- Forms & buttons ---------------- */

.form-control, .form-select {
  background: var(--ubs-surface);
  border: 1px solid var(--ubs-border);
  color: var(--ubs-text);
  border-radius: 10px;
}
.form-control:focus, .form-select:focus {
  border-color: var(--ubs-primary);
  box-shadow: 0 0 0 .2rem rgba(var(--ubs-primary-rgb),.15);
  background: var(--ubs-surface);
  color: var(--ubs-text);
}
.btn-primary { background: var(--ubs-primary); border-color: var(--ubs-primary); }
.btn-primary:hover { background: var(--ubs-primary-dark); border-color: var(--ubs-primary-dark); }
.btn { border-radius: 10px; font-weight: 600; font-size: .875rem; }
.btn-sm { border-radius: 8px; }
.rounded-pill-btn { border-radius: 50px; }

.modal-content { background: var(--ubs-surface); color: var(--ubs-text); border-radius: var(--ubs-radius); border: none; }
.modal-header, .modal-footer { border-color: var(--ubs-border); }

/* ---------------- Badges ---------------- */

.badge-soft-success { background: #dcfce7; color: #166534; }
.badge-soft-danger { background: #fee2e2; color: #991b1b; }
.badge-soft-warning { background: #fef3c7; color: #92400e; }
.badge-soft-info { background: #cffafe; color: #155e75; }
.badge-soft-primary { background: var(--ubs-primary-light); color: var(--ubs-primary-dark); }
.badge-soft-secondary { background: #e5e7eb; color: #374151; }
[data-bs-theme="dark"] .badge-soft-success { background: #14532d55; color: #86efac; }
[data-bs-theme="dark"] .badge-soft-danger { background: #7f1d1d55; color: #fca5a5; }
[data-bs-theme="dark"] .badge-soft-warning { background: #78350f55; color: #fcd34d; }
[data-bs-theme="dark"] .badge-soft-info { background: #164e6355; color: #67e8f9; }
[data-bs-theme="dark"] .badge-soft-primary { background: #d9770633; color: #fcd34d; }
[data-bs-theme="dark"] .badge-soft-secondary { background: #37415155; color: #d1d5db; }

/* ---------------- Toasts ---------------- */

.ubs-toast-container { position: fixed; top: 1rem; right: 1rem; z-index: 2000; display:flex; flex-direction:column; gap:.5rem; }

/* ---------------- Skeleton loading ---------------- */

.skeleton { position: relative; overflow: hidden; background: var(--ubs-surface-alt); border-radius: 8px; }
.skeleton::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent);
  animation: skeleton-shine 1.3s infinite;
}
[data-bs-theme="dark"] .skeleton::after { background: linear-gradient(90deg, transparent, rgba(255,255,255,.06), transparent); }
@keyframes skeleton-shine { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* ---------------- Loading overlay ---------------- */

.ubs-loading-overlay {
  position: fixed; inset: 0; background: rgba(17,19,31,.35);
  display: flex; align-items: center; justify-content: center; z-index: 3000;
}

/* ---------------- Login / setup screens ---------------- */

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top left, #2d2f5c 0%, #171a35 45%, #0a0b16 100%);
  padding: 1.5rem;
}
.auth-card {
  background: var(--ubs-surface);
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(20,20,50,.25);
  width: 100%;
  max-width: 420px;
  padding: 2.25rem 2rem;
}
.biz-type-card {
  border: 2px solid var(--ubs-border);
  border-radius: 14px;
  padding: 1rem;
  text-align: center;
  cursor: pointer;
  transition: all .15s ease;
  height: 100%;
}
.biz-type-card:hover { border-color: var(--ubs-primary); transform: translateY(-2px); }
.biz-type-card.selected { border-color: var(--ubs-primary); background: var(--ubs-primary-light); }
.biz-type-card i { font-size: 1.6rem; color: var(--ubs-primary); margin-bottom: .4rem; display: block; }
.biz-type-card .biz-type-emoji { font-size: 1.6rem; margin-bottom: .4rem; display: block; line-height: 1; }
[data-bs-theme="dark"] .biz-type-card.selected { background: #d9770622; }

/* ---------------- POS Billing ---------------- */

.pos-shell { display: flex; gap: 1rem; align-items: flex-start; }
.pos-catalog { flex: 1.4; min-width: 0; }
.pos-cart { flex: 1; min-width: 320px; position: sticky; top: 80px; }
.product-tile {
  background: var(--ubs-surface);
  border: 1px solid var(--ubs-border);
  border-radius: 16px;
  padding: .85rem;
  cursor: pointer;
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: .6rem;
  overflow: hidden; /* nothing (long titles included) can ever visually escape the card */
}
.product-tile:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px -8px rgba(var(--ubs-primary-rgb),.25);
  border-color: var(--ubs-primary);
}
.product-tile:active { transform: translateY(-1px); }
.product-tile.is-disabled { opacity: .55; cursor: not-allowed; }
.product-tile.is-disabled:hover { transform: none; box-shadow: none; border-color: var(--ubs-border); }
.p-tile-top { display: flex; align-items: flex-start; gap: .6rem; min-width: 0; }
.p-tile-img {
  width: 42px; height: 42px; min-width: 42px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--ubs-surface-alt);
  border: 1px solid var(--ubs-border);
}
.product-tile .p-name {
  font-weight: 700;
  font-size: .84rem;
  line-height: 1.3;
  min-width: 0;
  /* Clamp to 2 lines with an ellipsis instead of a hard single-line cutoff —
     keeps longer names readable while guaranteeing they stay inside the card. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.product-tile .p-price { color: var(--ubs-primary); font-weight: 800; font-size: .82rem; margin-top: 3px; }
.p-tile-foot { display: flex; justify-content: flex-end; }
.p-tile-badge {
  font-size: .66rem; font-weight: 700; padding: .18rem .5rem; border-radius: 99px;
  letter-spacing: .01em;
  white-space: nowrap;
}
.cart-item-row { border-bottom: 1px solid var(--ubs-border); padding: .55rem 0; }
.qty-stepper { display: flex; align-items: center; gap: .3rem; }
.qty-stepper button { width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--ubs-border); background: var(--ubs-surface-alt); }
.qty-stepper input { width: 42px; text-align: center; border: 1px solid var(--ubs-border); border-radius: 6px; }

/* ---------------- Kitchen KOT Dispatch Board ---------------- */

.kot-hero {
  background: linear-gradient(135deg, var(--ubs-topbar-bg, #0f1222), #1c2140);
  border-radius: var(--ubs-radius);
  padding: 1.25rem 1.5rem;
  color: #fff;
}
.kot-hero-sub { color: #b9bdd6; }
.kot-live-dot {
  width: 10px; height: 10px; border-radius: 50%; background: #22c55e; flex-shrink: 0;
  box-shadow: 0 0 0 0 rgba(34,197,94,.6);
  animation: kot-pulse 1.8s infinite;
}
@keyframes kot-pulse {
  0% { box-shadow: 0 0 0 0 rgba(34,197,94,.55); }
  70% { box-shadow: 0 0 0 8px rgba(34,197,94,0); }
  100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}
.kot-alert-toggle {
  background: rgba(255,255,255,.08); color: #cdd1ea; border: 1px solid rgba(255,255,255,.18);
  font-weight: 600; font-size: .78rem;
}
.kot-alert-toggle[data-on="1"] { background: rgba(34,197,94,.18); color: #86efac; border-color: rgba(34,197,94,.4); }

.kot-card {
  background: var(--ubs-surface);
  border: 1px solid var(--ubs-border);
  border-radius: var(--ubs-radius);
  overflow: hidden;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.kot-card-head {
  background: #dcfce7;
  padding: .75rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
[data-bs-theme="dark"] .kot-card-head { background: #14532d3a; }
.kot-location { font-weight: 800; font-size: .95rem; }
.kot-order-tag { font-size: .72rem; color: var(--ubs-text-muted); font-weight: 600; margin-left: .35rem; }
.kot-elapsed { color: var(--ubs-text-muted); white-space: nowrap; }
.kot-card-body { padding: .85rem 1rem; flex: 1; }
.kot-check-head { font-size: .68rem; font-weight: 700; letter-spacing: .04em; color: var(--ubs-text-muted); margin-bottom: .5rem; }
.kot-item-row { padding: .4rem 0; border-bottom: 1px dashed var(--ubs-border); font-size: .86rem; }
.kot-item-row:last-child { border-bottom: none; }
.kot-card-foot { padding: .75rem 1rem; border-top: 1px solid var(--ubs-border); }
.kot-status { font-size: .78rem; font-weight: 700; display: flex; align-items: center; gap: .4rem; }
.kot-status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.kot-dot-new { background: #3b82f6; }
.kot-dot-cooking { background: #d97706; }
.kot-dot-ready { background: #16a34a; }
.kot-action-btn { font-weight: 700; border: none; color: #fff; padding: .4rem 1rem; }
.kot-btn-cook { background: #d97706; }
.kot-btn-cook:hover { background: #b45309; color: #fff; }
.kot-btn-ready { background: #2563eb; }
.kot-btn-ready:hover { background: #1d4ed8; color: #fff; }
.kot-btn-deliver { background: #7c3aed; }
.kot-btn-deliver:hover { background: #6d28d9; color: #fff; }

/* ---------------- Invoice wizard stepper ---------------- */

.wizard-step {
  border: none; background: transparent; color: var(--ubs-text-muted); font-weight: 600; font-size: .8rem;
  border-radius: 8px; padding: .5rem .4rem;
}
.wizard-step.active { background: var(--ubs-primary-light); color: var(--ubs-primary-dark); }

/* ---------------- Sales Intelligence ---------------- */

.si-item-card { transition: transform .12s ease, box-shadow .12s ease; }
.si-item-card:hover { transform: translateY(-2px); box-shadow: var(--ubs-shadow); }
.si-item-img { width: 100%; height: 72px; object-fit: cover; border-radius: 8px; margin-bottom: .4rem; background: var(--ubs-surface-alt); }

/* ---------------- Orders Ledger ---------------- */

.ol-card { overflow: hidden; }
.ol-head { padding: 1rem 1.25rem; cursor: pointer; }
.ol-icon {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--ubs-primary-light); color: var(--ubs-primary);
  display: flex; align-items: center; justify-content: center; font-size: 1.05rem; flex-shrink: 0;
}
.ol-chevron { color: var(--ubs-text-muted); transition: transform .15s ease; }
.ol-expand { padding: 0 1.25rem 1.25rem; border-top: 1px solid var(--ubs-border); padding-top: 1rem; }

/* ---------------- Take Order card accents ---------------- */

.ubs-card-accent {
  display: inline-block; width: 4px; height: 16px; border-radius: 2px;
  background: var(--ubs-primary); vertical-align: -2px; margin-right: .3rem;
}
.ubs-card-accent-warning { background: #d97706; }

/* ---------------- Mobile ---------------- */

.ubs-bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--ubs-surface);
  border-top: 1px solid var(--ubs-border);
  z-index: 1050;
  padding: .3rem 0;
  box-shadow: 0 -4px 16px rgba(0,0,0,.06);
}
.ubs-bottom-nav a {
  flex: 1; text-align: center; color: var(--ubs-text-muted);
  font-size: .68rem; font-weight: 600; padding: .35rem 0;
}
.ubs-bottom-nav a i { display: block; font-size: 1.15rem; margin-bottom: .1rem; }
.ubs-bottom-nav a.active { color: var(--ubs-primary); }
.ubs-fab {
  position: fixed; bottom: 72px; right: 18px; z-index: 1060;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--ubs-primary); color: #fff; border: none;
  display: none; align-items: center; justify-content: center;
  font-size: 1.4rem; box-shadow: 0 8px 20px rgba(var(--ubs-primary-rgb),.45);
}

@media (max-width: 991.98px) {
  .ubs-sidebar { transform: translateX(-100%); width: 270px; }
  .ubs-sidebar.open { transform: translateX(0); }
  .ubs-main { margin-left: 0; }
  .ubs-bottom-nav { display: flex; }
  .ubs-fab { display: flex; }
  .ubs-content { padding: 1rem 1rem 5.5rem; }
  .pos-shell { flex-direction: column; }
  .pos-cart { position: static; width: 100%; }
}

.ubs-sidebar-backdrop {
  display: none;
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1035;
}
.ubs-sidebar-backdrop.show { display: block; }

/* ---------------- Print styles ---------------- */

@media print {
  .no-print { display: none !important; }
  body { background: #fff !important; }
  .ubs-content, .ubs-main { margin: 0 !important; padding: 0 !important; }
}

.invoice-print-area { background: #fff; color: #111; padding: 1.5rem; }
.thermal-receipt { width: 80mm; background: #fff; color: #000; font-family: 'Courier New', monospace; font-size: 12px; padding: 6px; margin: 0 auto; }
.thermal-receipt.w58 { width: 58mm; font-size: 11px; }
.thermal-receipt hr { border-top: 1px dashed #000; }
.thermal-receipt table { width: 100%; }

/* Utility */
.cursor-pointer { cursor: pointer; }
.text-primary-ubs { color: var(--ubs-primary); }
.fw-800 { font-weight: 800; }
