/* ================================================================
   Allsorts Hardware ERP — main.css
   Designed for tablet-first use, works on desktop browsers too.
   Brand colours: navy #1B2C5C + orange #E67829 (Mars palette)
   ================================================================ */

/* ── Reset & base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* === Mars palette: navy primary + orange accent === */
  --primary:        #1B2C5C;  /* deep navy - sidebar, headers, primary buttons */
  --primary-dark:   #101F45;  /* hover/pressed */
  --primary-light:  #2F4380;  /* nav hover */
  --primary-bg:     #EEF1F8;  /* page tint, hover backgrounds */

  --accent:         #E67829;  /* orange - CTAs, badges, accents */
  --accent-dark:    #C25E1A;
  --accent-light:   #F08D45;
  --accent-bg:      #FCE7D5;

  /* === Legacy aliases (kept for templates that still reference them) === */
  --navy:           #1B2C5C;  /* maps to primary */
  --navy-dark:      #101F45;
  --navy-light:     #2F4380;
  --teal:           #E67829;  /* maps to accent (orange) */
  --teal-light:     #FCE7D5;
  --amber:          #854F0B;
  --amber-light:    #FFF3CD;
  --danger:         #C0392B;
  --danger-light:   #F8D7DA;
  --success:        #155724;
  --success-light:  #D4EDDA;
  --info-light:     #D1ECF1;
  --info:           #0C5460;
  --bg:             #F7F8FA;
  --surface:        #FFFFFF;
  --surface-alt:    #ECF0F4;
  --border:         #D4DAE2;
  --text:           #1F2A3A;
  --text-muted:     #6B7280;
  --text-light:     #9CA3AF;
  --sidebar-w:      240px;
  --header-h:       56px;
  --radius:         8px;
  --radius-sm:      4px;
  --shadow:         0 1px 3px rgba(27, 44, 92, .12);
  --shadow-md:      0 4px 12px rgba(27, 44, 92, .15);
}

html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
a { color: var(--navy-light); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* ── Layout shell ─────────────────────────────────────────────── */
.shell { display: flex; min-height: 100vh; }

/* ── Sidebar ──────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
  transition: transform .25s ease;
}
.sidebar-brand {
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar-brand h1 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: .01em;
}
.sidebar-brand p {
  font-size: .72rem;
  color: #A9C8E0;
  margin-top: 2px;
}

.sidebar-user {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem;
  flex-shrink: 0;
}
.sidebar-user-info { min-width: 0; }
.sidebar-user-name { font-size: .85rem; color: #fff; font-weight: 600; }
.sidebar-user-role { font-size: .72rem; color: #A9C8E0; }

.sidebar-section {
  padding: 8px 12px 2px;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #6A88AA;
}
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  color: #CBD5E1;
  font-size: .88rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: background .15s, color .15s;
  text-decoration: none;
}
.sidebar-nav a:hover {
  background: rgba(255,255,255,.07);
  color: #fff;
}
.sidebar-nav a.active {
  background: rgba(255,255,255,.10);
  color: #fff;
  border-left-color: var(--teal);
}
.sidebar-nav a .nav-icon { font-size: 1rem; flex-shrink: 0; }
.sidebar-footer {
  margin-top: auto;
  padding: 12px 0;
  border-top: 1px solid rgba(255,255,255,.1);
}

/* ── Main content ─────────────────────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 24px;
  gap: 12px;
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow);
}
.topbar-title { font-size: 1.1rem; font-weight: 600; flex: 1; }
.topbar-btn {
  display: none;  /* mobile hamburger — shown via media query */
}

/* ── Back button in topbar ────────────────────────────────────── */
.topbar-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: .88rem;
  font-weight: 500;
  color: var(--navy);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .15s, border-color .15s;
  text-decoration: none;
}
.topbar-back:hover {
  background: var(--surface-alt);
  border-color: var(--navy-light);
}
.topbar-back:active {
  background: var(--border);
}
.topbar-back > span[aria-hidden="true"] {
  font-size: 1.05rem;
  line-height: 1;
}

/* ── Auto-refresh indicator (in topbar) ───────────────────────── */
#auto-refresh-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: .78rem;
  color: var(--text-muted);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 999px;    /* pill */
  user-select: none;
}
#auto-refresh-indicator .ar-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #22C55E;     /* green = ticking */
  flex-shrink: 0;
  animation: ar-pulse 1.6s ease-in-out infinite;
}
#auto-refresh-indicator.paused .ar-dot {
  background: #F59E0B;     /* amber = paused */
  animation: none;
}
#auto-refresh-indicator.refreshing .ar-dot {
  background: var(--navy);
  animation: ar-spin .8s linear infinite;
}
#auto-refresh-indicator .ar-text {
  white-space: nowrap;
}
#auto-refresh-indicator .ar-toggle {
  background: transparent;
  border: 0;
  padding: 0 2px;
  cursor: pointer;
  font-size: .85rem;
  color: var(--text-muted);
  line-height: 1;
}
#auto-refresh-indicator .ar-toggle:hover {
  color: var(--navy);
}

@keyframes ar-pulse {
  0%, 100% { opacity: 1;   transform: scale(1);   }
  50%      { opacity: .55; transform: scale(.85); }
}
@keyframes ar-spin {
  to { transform: rotate(360deg); }
}

.content { padding: 24px; flex: 1; }

/* ── Notification bell ────────────────────────────────────────── */
.notif-bell {
  position: relative;
  padding: 8px;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  border: none; background: none;
}
.notif-badge {
  position: absolute; top: 4px; right: 4px;
  background: var(--danger);
  color: #fff;
  font-size: .65rem; font-weight: 700;
  min-width: 18px; height: 18px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
}

/* ── Flash messages ───────────────────────────────────────────── */
.flash-list { list-style: none; margin-bottom: 16px; }
.flash {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 8px;
  font-size: .9rem;
  font-weight: 500;
  display: flex; align-items: center; gap: 8px;
}
.flash-success { background: var(--success-light); color: var(--success); border: 1px solid #B2DFCC; }
.flash-danger  { background: var(--danger-light);  color: var(--danger);  border: 1px solid #F1AEB5; }
.flash-warning { background: var(--amber-light);   color: var(--amber);   border: 1px solid #FFDA6A; }
.flash-info    { background: var(--info-light);    color: var(--info);    border: 1px solid #9EEAF9; }

/* ── Stat cards ───────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 16px;
  box-shadow: var(--shadow);
}
.stat-card .stat-num {
  font-size: 2rem; font-weight: 700; line-height: 1;
  color: var(--navy);
}
.stat-card .stat-label {
  font-size: .78rem; color: var(--text-muted);
  margin-top: 4px;
}
.stat-card.danger  .stat-num { color: var(--danger); }
.stat-card.success .stat-num { color: var(--teal); }
.stat-card.amber   .stat-num { color: var(--amber); }

/* ── Cards ────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 16px;
}
.card-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.card-header h2 { font-size: 1rem; font-weight: 600; flex: 1; }
.card-body  { padding: 16px; }
.card-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface-alt);
  display: flex; gap: 8px; align-items: center;
}

/* ── Job / kanban cards ───────────────────────────────────────── */
.job-card {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 12px 14px;
  margin-bottom: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: box-shadow .15s;
}
.job-card:hover { box-shadow: var(--shadow-md); }
.job-card .job-title { font-weight: 600; font-size: .95rem; }
.job-card .job-meta  { font-size: .8rem; color: var(--text-muted); margin-top: 4px; }
.job-card .job-age   { font-size: .75rem; color: var(--text-light); margin-top: 2px; }
.job-card.overdue    { border-left: 4px solid var(--danger); }
.job-card.warning    { border-left: 4px solid #F59E0B; }
.job-card.ok         { border-left: 4px solid var(--teal); }

/* ── Kanban columns ───────────────────────────────────────────── */
.kanban {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  align-items: start;
}
.kanban-col { background: var(--surface-alt); border-radius: var(--radius); padding: 12px; }
.kanban-col-header {
  font-weight: 700; font-size: .82rem; text-transform: uppercase;
  letter-spacing: .05em; padding: 6px 8px;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  display: flex; align-items: center; justify-content: space-between;
}
.kanban-col-header .count {
  background: rgba(255,255,255,.6);
  border-radius: 10px; padding: 1px 8px;
  font-size: .75rem;
}
.col-pending  .kanban-col-header { background: var(--amber-light); color: var(--amber); }
.col-inprod   .kanban-col-header { background: var(--info-light);  color: var(--info); }
.col-ready    .kanban-col-header { background: var(--success-light); color: var(--success); }
.col-complete .kanban-col-header { background: #E2E3E5; color: #383D41; }

/* ── Tables ───────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
thead th {
  background: var(--navy);
  color: #fff;
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--border); }
tbody tr:last-child { border-bottom: none; }
tbody tr:nth-child(even) { background: var(--surface-alt); }
tbody tr:hover { background: #EEF4FA; }
td { padding: 10px 12px; vertical-align: middle; }

/* ── Badges / status pills ────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: .75rem; font-weight: 600;
  white-space: nowrap;
}
.badge-green  { background: var(--success-light); color: var(--success); }
.badge-red    { background: var(--danger-light);  color: var(--danger);  }
.badge-amber  { background: var(--amber-light);   color: var(--amber);   }
.badge-blue   { background: var(--info-light);    color: var(--info);    }
.badge-grey   { background: #E2E3E5; color: #383D41; }

/* Traffic-light row highlight ──────────────────────────────────── */
tr.tr-danger  { background: var(--danger-light) !important; }
tr.tr-warning { background: var(--amber-light)  !important; }
tr.tr-success { background: var(--success-light)!important; }

/* ── Buttons ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-size: .88rem; font-weight: 600;
  border: none; cursor: pointer;
  text-decoration: none;
  transition: filter .15s, transform .1s;
  white-space: nowrap;
}
.btn:hover    { filter: brightness(1.08); }
.btn:active   { transform: scale(.97); }
.btn-primary  { background: var(--navy); color: #fff; }
.btn-success  { background: var(--teal); color: #fff; }
.btn-danger   { background: var(--danger); color: #fff; }
.btn-amber    { background: #D97706; color: #fff; }
.btn-outline  { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--surface-alt); filter: none; }
.btn-sm       { padding: 6px 12px; font-size: .8rem; }
.btn-lg       { padding: 14px 24px; font-size: 1rem; }
.btn-block    { display: flex; width: 100%; justify-content: center; }

/* ── Forms ────────────────────────────────────────────────────── */
.form-group  { margin-bottom: 16px; }
.form-label  { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.form-hint   { font-size: .78rem; color: var(--text-muted); margin-top: 4px; }
.form-control {
  display: block; width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: .9rem; background: var(--surface);
  transition: border-color .15s;
  color: var(--text);
}
.form-control:focus {
  outline: none;
  border-color: var(--navy-light);
  box-shadow: 0 0 0 3px rgba(46,84,144,.15);
}
textarea.form-control { min-height: 80px; resize: vertical; }
select.form-control   { cursor: pointer; }
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

/* ── Quantity selector (big +/-) ──────────────────────────────── */
.qty-control {
  display: flex; align-items: center; gap: 12px;
}
.qty-btn {
  width: 44px; height: 44px;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  background: var(--surface-alt);
  font-size: 1.4rem; font-weight: 700;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.qty-btn:hover { background: var(--border); }
.qty-display {
  min-width: 80px; text-align: center;
  font-size: 2rem; font-weight: 700;
  color: var(--navy);
}
.qty-input {
  width: 100px; text-align: center;
  font-size: 1.4rem; font-weight: 700;
  border: 2px solid var(--navy-light);
  border-radius: var(--radius);
  padding: 8px;
}
.qty-unit {
  font-size: .9rem; color: var(--text-muted); font-weight: 500;
}

/* ── BOM table traffic lights ─────────────────────────────────── */
.stock-ok    { color: var(--teal); font-weight: 600; }
.stock-low   { color: var(--amber); font-weight: 600; }
.stock-none  { color: var(--danger); font-weight: 600; }

/* ── Info rows (label + value) ────────────────────────────────── */
.info-table { width: 100%; font-size: .9rem; }
.info-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); }
.info-table td:first-child { color: var(--text-muted); width: 40%; font-weight: 500; }
.info-table tr:last-child td { border-bottom: none; }
.info-table tr:nth-child(even) td { background: var(--surface-alt); }

/* ── Operation checklist ──────────────────────────────────────── */
.op-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  display: flex; align-items: center; gap: 14px;
}
.op-card.done   { background: var(--success-light); border-color: #B2DFCC; }
.op-seq {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff; font-weight: 700; font-size: .85rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.op-card.done .op-seq { background: var(--teal); }
.op-name { font-weight: 600; flex: 1; }
.op-meta { font-size: .78rem; color: var(--text-muted); }

/* ── Dispatch queue card ──────────────────────────────────────── */
.dispatch-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
  display: flex; gap: 14px; align-items: center;
  box-shadow: var(--shadow);
}
.dispatch-card.overdue { border-left: 5px solid var(--danger); }
.dispatch-card.stale   { border-left: 5px solid #F59E0B; }
.dispatch-card.fresh   { border-left: 5px solid var(--teal); }
.dispatch-card-body { flex: 1; min-width: 0; }
.dispatch-card-title { font-weight: 600; font-size: .95rem; }
.dispatch-card-meta  { font-size: .8rem; color: var(--text-muted); margin-top: 4px; }

/* ── Progress bar ─────────────────────────────────────────────── */
.progress { background: var(--border); border-radius: 8px; height: 8px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--teal); border-radius: 8px; transition: width .3s; }

/* ── Alerts ───────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: .9rem;
  margin-bottom: 16px;
  border: 1px solid transparent;
}
.alert-success { background: var(--success-light); color: var(--success); border-color: #B2DFCC; }
.alert-danger  { background: var(--danger-light);  color: var(--danger);  border-color: #F1AEB5; }
.alert-warning { background: var(--amber-light);   color: var(--amber);   border-color: #FFDA6A; }
.alert-info    { background: var(--info-light);    color: var(--info);    border-color: #9EEAF9; }

/* ── Section headings ─────────────────────────────────────────── */
.section-title {
  font-size: 1.1rem; font-weight: 700;
  color: var(--navy);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--teal);
  display: flex; align-items: center; gap: 8px;
}
.page-header {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 20px; flex-wrap: wrap;
}
.page-header h1 { font-size: 1.4rem; font-weight: 700; flex: 1; color: var(--navy); }

/* ── Login page ───────────────────────────────────────────────── */
.login-shell {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--navy);
  padding: 24px;
}
.login-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 40px 36px;
  width: 100%; max-width: 380px;
  box-shadow: 0 20px 40px rgba(0,0,0,.3);
}
.login-logo { text-align: center; margin-bottom: 24px; }
.login-logo h1 { font-size: 1.5rem; font-weight: 800; color: var(--navy); }
.login-logo p  { font-size: .82rem; color: var(--text-muted); margin-top: 4px; }

/* ── Utilities ────────────────────────────────────────────────── */
.d-flex   { display: flex; }
.gap-8    { gap: 8px; }
.gap-12   { gap: 12px; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.flex-1   { flex: 1; }
.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-muted { color: var(--text-muted); font-size: .85rem; }
.text-sm    { font-size: .82rem; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.w-100  { width: 100%; }
.hidden { display: none !important; }

/* ── Mobile responsive ────────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar {
    transform: translateX(-240px);
    width: 240px;
  }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .topbar-btn { display: flex; }
  .topbar-back-label { display: none; }  /* keep the arrow, drop the word */
  .topbar-back { padding: 6px 10px; }
  #auto-refresh-indicator .ar-text { display: none; }   /* dot + button only */
  #auto-refresh-indicator { padding: 4px 8px; }
  .content { padding: 16px; }
  .kanban { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
}

/* ── Print styles ─────────────────────────────────────────────── */
@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .main { margin-left: 0; }
  .content { padding: 0; }
  .card { box-shadow: none; border: 1px solid #ccc; }
}

/* ────────────────────────────────────────────────────────────────────
   Dashboard layout (v3.2)
   ────────────────────────────────────────────────────────────────── */

.dash-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.dash-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.dash-stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.dash-stat-value {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
  margin-bottom: 4px;
}
.dash-stat-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.dash-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
.dash-col { margin-bottom: 0; }

.trend-up   { color: #16a34a; font-weight: 600; }
.trend-down { color: #dc2626; font-weight: 600; }
.text-warn  { color: #dc2626; }

/* Severity row coloring */
tr.row-out      { background: #fef2f2; }
tr.row-critical { background: #fff5f5; }
tr.row-low      { background: #fffbeb; }

/* Activity feed */
.activity-list { list-style: none; padding: 0; margin: 0; }
.activity-item {
  display: flex;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }
.activity-icon { font-size: 1.2rem; flex-shrink: 0; }
.activity-content { flex: 1; min-width: 0; }
.activity-content > div:first-child {
  font-size: 0.92rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ────────────────────────────────────────────────────────────────────
   New-sale page: cart panel — sticky with internal scrolling (v3.2)
   The complete-sale button must always be visible without scrolling
   the whole page. Cart panel sticks to the viewport, items scroll
   within, total + button anchor at the bottom.
   ────────────────────────────────────────────────────────────────── */

.pos-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 16px;
  align-items: start;
}

@media (max-width: 900px) {
  .pos-grid { grid-template-columns: 1fr; }
}

.cart-panel {
  position: sticky;
  top: 70px;                    /* clears the topbar */
  max-height: calc(100vh - 90px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.cart-header {
  flex: 0 0 auto;
  padding: 12px 16px;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}

.cart-items {
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 80px;
}

.cart-total {
  flex: 0 0 auto;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface-alt, #f9fafb);
}
.total-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  margin-bottom: 4px;
}
.total-grand {
  font-size: 1.1rem;
  font-weight: 700;
  border-top: 1px solid var(--border);
  padding-top: 6px;
  margin-top: 4px;
}

.cart-actions {
  flex: 0 0 auto;
  padding: 10px 16px 14px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.cart-actions .btn-block {
  width: 100%;
}
