/* ============================================================
   POS System — Square-inspired design
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --border: #e1e4e8;
  --text: #1a1d23;
  --text-muted: #6b7280;
  --text-light: #9ca3af;

  /* Mobile Inc — deep blue */
  --mi: #2563eb;
  --mi-dark: #1d4ed8;
  --mi-light: #eff6ff;

  /* Repair Bench — orange */
  --rb: #ea580c;
  --rb-dark: #c2410c;
  --rb-light: #fff7ed;

  /* Sidebar */
  --sidebar-bg: #1a1d23;
  --sidebar-text: #e5e7eb;
  --sidebar-muted: #6b7280;
  --sidebar-hover: #2d3139;
  --sidebar-active: #2563eb;
  --sidebar-w: 220px;

  /* Status colours */
  --green: #16a34a;
  --green-bg: #dcfce7;
  --red: #dc2626;
  --red-bg: #fee2e2;
  --amber: #d97706;
  --amber-bg: #fef3c7;
  --purple: #7c3aed;
  --purple-bg: #ede9fe;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,.10);
  --shadow-lg: 0 10px 40px rgba(0,0,0,.14);

  font-size: 16px;
}

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

/* ---- App shell ------------------------------------------- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ---- Sidebar --------------------------------------------- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  flex-shrink: 0;
}

.sidebar-logo {
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.sidebar-logo-text {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.01em;
}
.sidebar-logo-sub {
  font-size: 11px;
  color: var(--sidebar-muted);
  margin-top: 2px;
}

.sidebar-section {
  padding: 16px 8px 4px;
}
.sidebar-section-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--sidebar-muted);
  padding: 0 8px;
  margin-bottom: 4px;
}
.sidebar-section-mi .sidebar-section-label { color: #60a5fa; }
.sidebar-section-rb .sidebar-section-label { color: #fb923c; }

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background .15s, color .15s;
  touch-action: manipulation;
  min-height: 44px;
}
.sidebar-link:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar-link.active { background: var(--sidebar-active); color: #fff; }
.sidebar-link-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.sidebar-section-rb .sidebar-link.active { background: var(--rb); }

.sidebar-footer {
  margin-top: auto;
  padding: 12px 8px;
  border-top: 1px solid rgba(255,255,255,.07);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--sidebar-muted);
}
.sidebar-user-avatar {
  width: 28px; height: 28px;
  background: var(--sidebar-hover);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.sidebar-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  background: none;
  border: none;
  color: var(--sidebar-muted);
  font-size: 13px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  touch-action: manipulation;
  text-align: left;
}
.sidebar-logout:hover { background: var(--sidebar-hover); color: #fff; }

/* ---- Main content ---------------------------------------- */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page-body {
  flex: 1;
  padding: 28px 28px;
  max-width: 1200px;
}

.page-body.full-width {
  max-width: none;
  padding: 0;
}

/* ---- Page header ----------------------------------------- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 12px;
  flex-wrap: wrap;
}
.page-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--text);
}
.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ---- Buttons --------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  min-height: 44px;
  touch-action: manipulation;
  transition: all .15s;
  letter-spacing: -.01em;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary  { background: var(--mi); color: #fff; }
.btn-primary:hover  { background: var(--mi-dark); }
.btn-orange   { background: var(--rb); color: #fff; }
.btn-orange:hover   { background: var(--rb-dark); }
.btn-success  { background: #16a34a; color: #fff; }
.btn-success:hover  { background: #15803d; }
.btn-danger   { background: var(--red); color: #fff; }
.btn-danger:hover   { background: #b91c1c; }
.btn-secondary { background: var(--surface); color: var(--text); border: 1.5px solid var(--border); box-shadow: var(--shadow); }
.btn-secondary:hover { background: var(--bg); }
.btn-ghost    { background: transparent; color: var(--text-muted); }
.btn-ghost:hover    { background: var(--border); color: var(--text); }
.btn-full     { width: 100%; }
.btn-lg       { font-size: 16px; padding: 14px 24px; min-height: 52px; border-radius: var(--radius); }
.btn-xl       { font-size: 18px; padding: 18px 28px; min-height: 60px; border-radius: var(--radius); }
.btn-sm       { font-size: 12px; padding: 6px 12px; min-height: 34px; font-weight: 500; }

/* ---- Forms ----------------------------------------------- */
.form-group  { display: flex; flex-direction: column; gap: 6px; }
.form-label  { font-size: 13px; font-weight: 600; color: var(--text); }
.form-label small { font-weight: 400; color: var(--text-muted); }
.form-input {
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 16px;
  color: var(--text);
  background: var(--surface);
  width: 100%;
  min-height: 44px;
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
  font-family: inherit;
}
.form-input:focus { outline: none; border-color: var(--mi); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.form-input::placeholder { color: var(--text-light); }
.form-textarea { min-height: 90px; resize: vertical; }
.form-row { display: flex; gap: 14px; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 140px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.form-section { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border); }
.form-section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-bottom: 16px; }

/* ---- Cards ----------------------------------------------- */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 16px;
}
.card-title { font-size: 15px; font-weight: 700; margin-bottom: 16px; letter-spacing: -.01em; }

/* ---- Alerts ---------------------------------------------- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}
.alert-success { background: var(--green-bg); color: var(--green); border: 1px solid #bbf7d0; }
.alert-error   { background: var(--red-bg);   color: var(--red); border: 1px solid #fecaca; }

/* ---- Tables ---------------------------------------------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--border); background: var(--surface); }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { padding: 11px 16px; text-align: left; font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); background: #f9fafb; border-bottom: 1px solid var(--border); }
.data-table td { padding: 13px 16px; border-bottom: 1px solid #f3f4f6; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #fafbfc; }
.text-right { text-align: right !important; }
.text-center { text-align: center !important; }
.mono { font-family: 'SF Mono', 'Fira Code', ui-monospace, monospace; font-size: 12px; }
.table-actions { white-space: nowrap; text-align: right; }
.table-actions .btn { margin-left: 4px; }

/* ---- Status badges --------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
  white-space: nowrap;
}
.badge-blue    { background: #dbeafe; color: #1e40af; }
.badge-amber   { background: var(--amber-bg); color: #92400e; }
.badge-purple  { background: var(--purple-bg); color: var(--purple); }
.badge-green   { background: var(--green-bg); color: var(--green); }
.badge-gray    { background: #f3f4f6; color: #374151; }
.badge-orange  { background: #fed7aa; color: #9a3412; }

/* ---- Filter bar ------------------------------------------ */
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; align-items: flex-end; }
.filter-bar .form-group { flex: 1; min-width: 180px; margin: 0; }
.filter-bar .form-input { min-height: 40px; font-size: 14px; }
.filter-bar .btn { min-height: 40px; font-size: 13px; align-self: flex-end; }

/* ---- Empty state ----------------------------------------- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 15px; margin-bottom: 20px; }

/* ---- Pagination ------------------------------------------ */
.pagination { display: flex; align-items: center; gap: 12px; justify-content: center; margin-top: 24px; }
.page-info { font-size: 13px; color: var(--text-muted); }

/* ---- Detail layout --------------------------------------- */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.detail-table { width: 100%; font-size: 14px; }
.detail-table th { font-weight: 500; color: var(--text-muted); width: 130px; padding: 7px 0; vertical-align: top; }
.detail-table td { padding: 7px 0; }

.action-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; align-items: center; padding: 16px 20px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--border); }
.inline-email-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-email-form .form-input { width: 240px; min-height: 40px; font-size: 14px; }

/* ---- Status (repair bench) ------------------------------- */
.status-row { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; padding: 14px 20px; background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); }
.status-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.status-select { min-width: 200px; min-height: 40px; font-size: 14px; }

.status-badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 20px; font-size: 13px; font-weight: 600; }
.status-badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .7; }
.status-booked_in    { background: #dbeafe; color: #1e40af; }
.status-in_progress  { background: var(--amber-bg); color: #92400e; }
.status-awaiting_parts { background: var(--purple-bg); color: var(--purple); }
.status-ready        { background: var(--green-bg); color: var(--green); }
.status-completed    { background: #f3f4f6; color: #374151; }

/* ---- Kanban board ---------------------------------------- */
.kanban-board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; align-items: start; }
@media (max-width: 1100px) { .kanban-board { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .kanban-board { grid-template-columns: 1fr; } }

.kanban-col { background: var(--bg); border-radius: var(--radius); overflow: hidden; }
.kanban-col-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px;
  font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
  border-radius: var(--radius) var(--radius) 0 0;
}
.kanban-col-booked    { background: #dbeafe; color: #1e40af; }
.kanban-col-progress  { background: var(--amber-bg); color: #92400e; }
.kanban-col-parts     { background: var(--purple-bg); color: var(--purple); }
.kanban-col-ready     { background: var(--green-bg); color: var(--green); }

.kanban-count { background: rgba(0,0,0,.12); border-radius: 12px; padding: 2px 8px; font-size: 12px; }
.kanban-cards { padding: 8px; display: flex; flex-direction: column; gap: 8px; min-height: 80px; }
.kanban-empty { text-align: center; color: var(--text-light); font-size: 13px; padding: 16px; }

.job-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-decoration: none;
  color: var(--text);
  font-size: 13px;
  touch-action: manipulation;
  transition: box-shadow .15s, transform .1s;
  box-shadow: var(--shadow);
}
.job-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.job-card-ref { font-family: monospace; font-size: 11px; color: var(--text-muted); margin-bottom: 6px; }
.job-card-device { font-size: 14px; font-weight: 700; margin-bottom: 2px; letter-spacing: -.01em; }
.job-card-customer { color: var(--text-muted); margin-bottom: 2px; font-size: 13px; }
.job-card-phone { color: var(--text-muted); font-size: 12px; margin-bottom: 6px; }
.job-card-issue { font-size: 12px; color: #666; margin-bottom: 8px; line-height: 1.4; }
.job-card-footer { display: flex; justify-content: space-between; align-items: center; padding-top: 8px; border-top: 1px solid var(--border); }
.job-card-date { font-size: 11px; color: var(--text-light); }
.job-card-quote { font-weight: 700; font-size: 14px; color: var(--rb); }

/* ============================================================
   POS SCREEN — Square-style
   ============================================================ */
.pos-screen {
  display: grid;
  grid-template-columns: 1fr 380px;
  height: calc(100vh);
  overflow: hidden;
  margin-left: var(--sidebar-w);
}

.pos-left {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

/* Category bar */
.pos-cat-bar {
  display: flex;
  gap: 6px;
  padding: 14px 16px 10px;
  overflow-x: auto;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  -webkit-overflow-scrolling: touch;
}
.pos-cat-bar::-webkit-scrollbar { display: none; }
.cat-pill {
  padding: 8px 18px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  min-height: 38px;
  touch-action: manipulation;
  transition: all .15s;
  color: var(--text-muted);
  flex-shrink: 0;
}
.cat-pill:hover { border-color: var(--mi); color: var(--mi); }
.cat-pill.active { background: var(--mi); border-color: var(--mi); color: #fff; }

/* Search bar */
.pos-search-bar {
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.pos-search-input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") 12px center no-repeat;
  min-height: 44px;
  -webkit-appearance: none;
}
.pos-search-input:focus { outline: none; border-color: var(--mi); background-color: var(--surface); }

/* Product grid */
.pos-grid-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  -webkit-overflow-scrolling: touch;
}
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}

.product-tile {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 10px 12px;
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-height: 100px;
  touch-action: manipulation;
  transition: all .12s;
  position: relative;
  -webkit-user-select: none; user-select: none;
  box-shadow: var(--shadow);
}
.product-tile:hover { border-color: var(--mi); box-shadow: 0 4px 12px rgba(37,99,235,.15); transform: translateY(-1px); }
.product-tile:active { transform: scale(.96); background: var(--mi-light); border-color: var(--mi); }
.tile-name  { font-size: 13px; font-weight: 600; line-height: 1.3; color: var(--text); }
.tile-price { font-size: 17px; font-weight: 800; color: var(--mi); letter-spacing: -.02em; }
.tile-stock {
  position: absolute; top: 6px; right: 8px;
  font-size: 10px; color: var(--text-light); font-weight: 500;
}
.tile-stock.low { color: var(--amber); font-weight: 700; }

/* ---- Cart (right panel) ---------------------------------- */
.pos-cart {
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cart-header {
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cart-header h2 { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.cart-clear-btn {
  font-size: 12px;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  touch-action: manipulation;
}
.cart-clear-btn:hover { background: var(--bg); color: var(--red); }

.cart-items { flex: 1; overflow-y: auto; padding: 8px; -webkit-overflow-scrolling: touch; }

.cart-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  gap: 8px;
  padding: 20px;
}
.cart-empty-icon { font-size: 36px; opacity: .4; }
.cart-empty p { font-size: 14px; }

.cart-item {
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
  transition: background .1s;
}
.cart-item:hover { background: var(--bg); }
.cart-item-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.cart-item-name { font-size: 13px; font-weight: 600; line-height: 1.3; flex: 1; }
.cart-item-subtotal { font-size: 14px; font-weight: 700; color: var(--text); white-space: nowrap; }
.cart-item-bottom { display: flex; align-items: center; gap: 8px; }
.cart-item-price { font-size: 12px; color: var(--text-muted); flex: 1; }

.qty-controls { display: flex; align-items: center; gap: 0; border: 1.5px solid var(--border); border-radius: 20px; overflow: hidden; }
.qty-btn {
  width: 30px; height: 30px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
  touch-action: manipulation;
  transition: background .1s;
}
.qty-btn:hover { background: var(--bg); }
.qty-num { font-size: 13px; font-weight: 700; min-width: 24px; text-align: center; }
.cart-remove {
  background: none; border: none; cursor: pointer;
  color: var(--text-light); font-size: 14px;
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  touch-action: manipulation;
  margin-left: auto;
}
.cart-remove:hover { background: var(--red-bg); color: var(--red); }

/* Cart footer */
.cart-footer {
  border-top: 1px solid var(--border);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cart-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
}
.cart-total-label { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.cart-total-amount { font-size: 24px; font-weight: 800; color: var(--text); letter-spacing: -.03em; }

.payment-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.payment-toggle-btn {
  padding: 10px;
  background: var(--surface);
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  touch-action: manipulation;
  transition: all .15s;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.payment-toggle-btn + .payment-toggle-btn { border-left: 1.5px solid var(--border); }
.payment-toggle-btn.active { background: var(--mi); color: #fff; }

.cart-email-input {
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  width: 100%;
  min-height: 40px;
  -webkit-appearance: none;
}
.cart-email-input:focus { outline: none; border-color: var(--mi); }

.charge-btn {
  width: 100%;
  padding: 16px;
  border-radius: var(--radius);
  border: none;
  background: #16a34a;
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
  transition: all .15s;
  letter-spacing: -.02em;
  min-height: 56px;
}
.charge-btn:hover:not(:disabled) { background: #15803d; }
.charge-btn:disabled { opacity: .4; cursor: not-allowed; }
.charge-btn.loading { background: #15803d; }

/* Sale success overlay */
.sale-success {
  position: absolute;
  inset: 0;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
  z-index: 10;
}
.sale-success-icon {
  width: 72px; height: 72px;
  background: var(--green-bg);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 36px;
}
.sale-success-ref { font-size: 20px; font-weight: 800; font-family: monospace; }
.sale-success-sub { font-size: 14px; color: var(--text-muted); }

/* ---- Login page ------------------------------------------ */
body.login-body {
  background: linear-gradient(135deg, #1e293b 0%, #1e3a5f 50%, #1a1d23 100%);
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
}
.login-wrap { width: 100%; max-width: 400px; padding: 20px; }
.login-card { background: var(--surface); border-radius: 20px; padding: 40px; box-shadow: var(--shadow-lg); }
.login-brand { text-align: center; margin-bottom: 32px; }
.login-brand-badges { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 16px; }
.login-brand-badge {
  padding: 8px 16px; border-radius: 20px; font-size: 13px; font-weight: 700;
  display: flex; align-items: center; gap: 6px;
}
.login-brand-badge.mi { background: var(--mi-light); color: var(--mi); }
.login-brand-badge.rb { background: var(--rb-light); color: var(--rb); }
.login-brand-sep { color: var(--border); font-weight: 300; font-size: 20px; }
.login-title { font-size: 20px; font-weight: 800; color: var(--text); letter-spacing: -.02em; }
.login-sub { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-error { background: var(--red-bg); color: var(--red); border: 1px solid #fecaca; border-radius: var(--radius-sm); padding: 12px 14px; font-size: 14px; font-weight: 500; }

/* ---- Autocomplete ---------------------------------------- */
.autocomplete-wrap { position: relative; }
.autocomplete-results {
  position: absolute; top: 100%; left: 0; right: 0;
  z-index: 300;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  max-height: 220px;
  overflow-y: auto;
  margin-top: 4px;
}
.autocomplete-item {
  display: block; width: 100%;
  padding: 12px 14px;
  text-align: left; background: none; border: none;
  cursor: pointer; font-size: 14px;
  border-bottom: 1px solid #f3f4f6;
  touch-action: manipulation;
  font-family: inherit;
}
.autocomplete-item:hover { background: var(--bg); }
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item strong { display: block; font-weight: 600; }
.autocomplete-item span { font-size: 12px; color: var(--text-muted); }

/* ---- Responsive ------------------------------------------ */
@media (max-width: 900px) {
  .pos-screen { grid-template-columns: 1fr; margin-left: 0; }
  .pos-cart { border-left: none; border-top: 1px solid var(--border); height: auto; max-height: 50vh; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .pos-screen { margin-left: 0; }
  .page-body { padding: 16px; }
  .kanban-board { grid-template-columns: 1fr 1fr; }
}
