/* ====== RESET & BASE ====== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #2563EB;
  --primary-dark: #1D4ED8;
  --primary-light: #DBEAFE;
  --success: #059669;
  --success-light: #D1FAE5;
  --warning: #D97706;
  --warning-light: #FEF3C7;
  --danger: #DC2626;
  --danger-light: #FEE2E2;
  --gray-50: #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-600: #4B5563;
  --gray-700: #374151;
  --gray-800: #1F2937;
  --gray-900: #111827;
  --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 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);
  --shadow-lg: 0 10px 25px -3px rgba(0,0,0,.1),0 4px 10px -4px rgba(0,0,0,.1);
  --sidebar-w: 240px;
  --header-h: 0px;
}
html { font-size: 15px; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
}
a { text-decoration: none; color: inherit; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }
button { cursor: pointer; border: none; background: none; }
table { width: 100%; border-collapse: collapse; }
img { max-width: 100%; display: block; }

/* ====== SCREENS ====== */
.screen { display: none; height: 100vh; }
.screen.active { display: flex; }

/* ====== LOGIN ====== */
.login-bg {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, #1E3A5F 0%, #2563EB 50%, #1D4ED8 100%);
  z-index: -1;
}
.login-container {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 100vh; padding: 2rem;
  width: 100%; max-width: 420px; margin: 0 auto;
}
.login-brand { text-align: center; margin-bottom: 2rem; }
.login-logo { margin-bottom: 1rem; }
.login-brand h1 {
  color: #fff; font-size: 2rem; font-weight: 800;
  letter-spacing: -0.5px;
}
.login-subtitle { color: rgba(255,255,255,.7); font-size: .9rem; }
.login-form {
  background: #fff; border-radius: var(--radius);
  padding: 2rem; width: 100%;
  box-shadow: var(--shadow-lg);
}
.login-form .form-group { margin-bottom: 1rem; }
.login-form label {
  display: block; font-size: .85rem; font-weight: 500;
  color: var(--gray-700); margin-bottom: .35rem;
}
.login-form input, .login-form select {
  width: 100%; padding: .7rem .85rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: .9rem; transition: border .2s;
  background: #fff;
}
.login-form input:focus, .login-form select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.login-hint {
  text-align: center; font-size: .8rem;
  color: var(--gray-400); margin-top: .75rem;
}

/* ====== BUTTONS ====== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: .5rem; padding: .65rem 1.25rem;
  border-radius: var(--radius-sm); font-weight: 600;
  font-size: .85rem; transition: all .2s;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #047857; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #B91C1C; }
.btn-outline {
  background: transparent; border: 1.5px solid var(--gray-300);
  color: var(--gray-700);
}
.btn-outline:hover { border-color: var(--gray-400); background: var(--gray-50); }
.btn-ghost { color: var(--gray-600); }
.btn-ghost:hover { background: var(--gray-100); }
.btn-sm { padding: .4rem .8rem; font-size: .8rem; }
.btn-xs { padding: .25rem .5rem; font-size: .75rem; }
.btn-block { width: 100%; }
.btn-icon {
  width: 36px; height: 36px; display: inline-flex;
  align-items: center; justify-content: center;
  border-radius: var(--radius-sm); color: var(--gray-500);
}
.btn-icon:hover { background: var(--gray-100); color: var(--gray-700); }
.btn-icon-sm { width: 32px; height: 32px; }

/* ====== SIDEBAR ====== */
.sidebar {
  width: var(--sidebar-w); min-width: var(--sidebar-w);
  background: #fff; border-right: 1px solid var(--gray-200);
  display: flex; flex-direction: column;
  height: 100vh; position: relative; z-index: 10;
}
.sidebar-header {
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--gray-100);
}
.sidebar-logo { display: flex; align-items: center; gap: .6rem; }
.sidebar-brand {
  font-weight: 800; font-size: 1.2rem;
  color: var(--gray-900); letter-spacing: -.5px;
}
.sidebar-store {
  padding: .5rem .65rem .35rem;
  display: flex; align-items: center; gap: .3rem;
  border-bottom: 1px solid var(--gray-100);
}
.sidebar-store select {
  flex: 1; padding: .3rem .4rem;
  border: 1px solid var(--gray-200);
  border-radius: 6px; font-size: .78rem;
  background: #fff; cursor: pointer;
  color: var(--gray-800); font-weight: 500;
}
.sidebar-store .btn-ghost {
  width: 24px; height: 24px; padding: 0;
  font-size: 1rem; line-height: 1;
  border-radius: 4px; flex-shrink: 0;
}
.sidebar-nav { flex: 1; padding: .75rem .65rem; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: .7rem;
  padding: .6rem .75rem; margin-bottom: 2px;
  border-radius: var(--radius-sm);
  color: var(--gray-600); font-weight: 500; font-size: .85rem;
  transition: all .15s;
}
.nav-item:hover { background: var(--gray-100); color: var(--gray-900); }
.nav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.sidebar-footer {
  padding: .75rem; border-top: 1px solid var(--gray-100);
  display: flex; align-items: center; justify-content: space-between;
}
.sidebar-user { display: flex; align-items: center; gap: .6rem; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem; flex-shrink: 0;
}
.user-name { font-size: .85rem; font-weight: 600; color: var(--gray-800); }
.user-role { font-size: .75rem; color: var(--gray-500); }

/* ====== MAIN CONTENT ====== */
.main-content {
  flex: 1; overflow-y: auto; height: 100vh;
  padding: 1.5rem 2rem;
}

/* ====== VIEWS ====== */
.view { display: none; }
.view.active { display: block; }
.view-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.5rem;
}
.view-header h2 { font-size: 1.4rem; font-weight: 700; color: var(--gray-900); }
.view-header p { font-size: .85rem; color: var(--gray-500); margin-top: .2rem; }
.view-actions { display: flex; gap: .5rem; align-items: center; }

/* ====== CARDS ====== */
.card {
  background: #fff; border-radius: var(--radius);
  box-shadow: var(--shadow); border: 1px solid var(--gray-200);
  overflow: hidden;
}
.card-header {
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--gray-100);
  display: flex; align-items: center; justify-content: space-between;
}
.card-header h3 { font-size: .95rem; font-weight: 600; }
.card-body { padding: 1.25rem; }
.card-footer { padding: .75rem 1.25rem; border-top: 1px solid var(--gray-100); }

/* ====== KPI CARDS ====== */
.kpi-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 1rem; margin-bottom: 1.5rem;
}
.kpi-card {
  background: #fff; border-radius: var(--radius);
  padding: 1.25rem; border: 1px solid var(--gray-200);
  box-shadow: var(--shadow);
}
.kpi-card .kpi-label {
  font-size: .8rem; font-weight: 500; color: var(--gray-500);
  text-transform: uppercase; letter-spacing: .5px;
  margin-bottom: .35rem;
}
.kpi-card .kpi-value {
  font-size: 1.75rem; font-weight: 800; color: var(--gray-900);
  line-height: 1.2;
}
.kpi-card .kpi-change {
  font-size: .8rem; margin-top: .35rem;
  display: inline-flex; align-items: center; gap: .25rem;
}
.kpi-card .kpi-change.up { color: var(--success); }
.kpi-card .kpi-change.down { color: var(--danger); }
.kpi-card .kpi-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: .75rem;
}
.kpi-icon.blue { background: var(--primary-light); color: var(--primary); }
.kpi-icon.green { background: var(--success-light); color: var(--success); }
.kpi-icon.yellow { background: var(--warning-light); color: var(--warning); }
.kpi-icon.red { background: var(--danger-light); color: var(--danger); }
.kpi-icon.purple { background: #EDE9FE; color: #7C3AED; }

/* ====== GRID LAYOUTS ====== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1.25rem; }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 1.25rem; }

/* ====== FORMS ====== */
.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block; font-size: .85rem; font-weight: 500;
  color: var(--gray-700); margin-bottom: .35rem;
}
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: .6rem .8rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm); font-size: .9rem;
  transition: border .2s; background: #fff;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.form-row { display: flex; gap: 1rem; }
.form-row .form-group { flex: 1; }

/* ====== TABLES ====== */
.table-container { overflow-x: auto; }
table th, table td {
  text-align: left; padding: .65rem .85rem;
  font-size: .85rem; border-bottom: 1px solid var(--gray-100);
}
table th {
  font-weight: 600; color: var(--gray-600);
  font-size: .8rem; text-transform: uppercase;
  letter-spacing: .5px; background: var(--gray-50);
  white-space: nowrap;
}
table tr:hover td { background: var(--gray-50); }
table .badge {
  display: inline-block; padding: .15rem .5rem;
  border-radius: 20px; font-size: .75rem; font-weight: 600;
}
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-blue { background: var(--primary-light); color: var(--primary); }
.badge-info { background: #DBEAFE; color: #1D4ED8; }
.badge-gray { background: var(--gray-100); color: var(--gray-600); }

/* ====== PAYMENT METHODS ====== */
.payment-methods { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-bottom: 1rem; }
.payment-method {
  display: flex; align-items: center; gap: .5rem;
  padding: .75rem; border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm); cursor: pointer;
  transition: all .15s; font-weight: 500; font-size: .85rem;
}
.payment-method:hover { border-color: var(--gray-300); }
.payment-method.active { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }
.payment-method input[type="radio"] { display: none; }
.payment-total { font-size: 1.1rem; font-weight: 800; margin-bottom: 1rem; text-align: center; }

/* ====== MODAL ====== */
.modal { display: none; position: fixed; inset: 0; z-index: 1000; align-items: center; justify-content: center; }
.modal.open { display: flex; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.4); }
.modal-content {
  position: relative; background: #fff; border-radius: var(--radius);
  width: 90%; max-width: 560px; max-height: 85vh;
  overflow-y: auto; box-shadow: var(--shadow-lg);
}
.modal-sm { max-width: 440px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--gray-100);
  position: sticky; top: 0; background: #fff; z-index: 1;
}
.modal-header h3 { font-size: 1rem; font-weight: 700; }
.modal-close { font-size: 1.5rem; color: var(--gray-400); line-height: 1; }
.modal-close:hover { color: var(--gray-600); }
.modal-body { padding: 1.25rem; }
.modal-footer {
  display: flex; gap: .5rem; justify-content: flex-end;
  padding: .75rem 1.25rem; border-top: 1px solid var(--gray-100);
}

/* ====== POS REGISTER ====== */
.pos-layout { display: grid; grid-template-columns: 1fr 340px; gap: 1.25rem; height: calc(100vh - 140px); }
.pos-products { overflow-y: auto; }
.pos-search {
  position: relative; margin-bottom: 1rem;
}
.pos-search input {
  width: 100%; padding: .65rem .85rem .65rem 2.25rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm); font-size: .9rem;
}
.pos-search input:focus { outline: none; border-color: var(--primary); }
.pos-search .search-icon {
  position: absolute; left: .75rem; top: 50%; transform: translateY(-50%);
  color: var(--gray-400);
}
.pos-categories { display: flex; gap: .4rem; margin-bottom: 1rem; flex-wrap: wrap; }
.pos-cat-btn {
  padding: .35rem .7rem; border-radius: 20px; font-size: .8rem;
  font-weight: 500; background: var(--gray-100); color: var(--gray-600);
  transition: all .15s; cursor: pointer; border: none;
}
.pos-cat-btn:hover { background: var(--gray-200); }
.pos-cat-btn.active { background: var(--primary); color: #fff; }
.pos-product-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: .65rem;
}
.pos-product {
  background: #fff; border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm); padding: .75rem;
  text-align: center; cursor: pointer; transition: all .15s;
}
.pos-product:hover { border-color: var(--primary); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.pos-product .pp-name { font-size: .85rem; font-weight: 600; margin-bottom: .2rem; }
.pos-product .pp-price { font-size: .9rem; font-weight: 700; color: var(--primary); }
.pos-product .pp-stock { font-size: .7rem; color: var(--gray-400); }
.pos-cart {
  background: #fff; border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  display: flex; flex-direction: column; height: 100%;
}
.pos-cart-header {
  padding: .85rem 1rem; border-bottom: 1px solid var(--gray-100);
  font-weight: 700; font-size: .95rem;
  display: flex; justify-content: space-between; align-items: center;
}
.pos-cart-items { flex: 1; overflow-y: auto; padding: .5rem; }
.pos-cart-empty {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  height: 100%; color: var(--gray-400); font-size: .85rem;
  gap: .5rem;
}
.pos-cart-item {
  display: flex; align-items: center; gap: .5rem;
  padding: .5rem; border-radius: var(--radius-sm);
  border-bottom: 1px solid var(--gray-100);
}
.pos-cart-item .ci-details { flex: 1; }
.pos-cart-item .ci-name { font-size: .85rem; font-weight: 600; }
.pos-cart-item .ci-meta { font-size: .75rem; color: var(--gray-500); }
.pos-cart-item .ci-qty {
  display: flex; align-items: center; gap: .3rem;
}
.pos-cart-item .ci-qty button {
  width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; font-weight: 700; background: #fff;
  color: var(--gray-600);
}
.pos-cart-item .ci-qty button:hover { border-color: var(--primary); color: var(--primary); }
.pos-cart-item .ci-qty span { width: 24px; text-align: center; font-weight: 600; }
.pos-cart-item .ci-total { font-weight: 700; min-width: 60px; text-align: right; font-size: .85rem; }
.pos-cart-item .ci-remove { color: var(--gray-400); font-size: 1.1rem; }
.pos-cart-item .ci-remove:hover { color: var(--danger); }
.pos-cart-footer {
  padding: .85rem 1rem; border-top: 1px solid var(--gray-100);
}
.pos-cart-summary > div {
  display: flex; justify-content: space-between;
  font-size: .85rem; margin-bottom: .3rem;
}
.pos-cart-total {
  display: flex; justify-content: space-between;
  font-size: 1.1rem; font-weight: 800; padding-top: .5rem;
  border-top: 2px solid var(--gray-200); margin-top: .5rem;
}
.pos-actions { display: flex; gap: .5rem; margin-top: .75rem; }
.pos-actions .btn { flex: 1; }

/* ====== RECEIPT ====== */
.receipt {
  font-size: .8rem; font-family: 'Courier New', monospace;
  max-width: 280px; margin: 0 auto;
}
.receipt-header { text-align: center; margin-bottom: .75rem; }
.receipt-header h4 { font-size: 1rem; font-weight: 800; }
.receipt-line { border-top: 1px dashed var(--gray-400); margin: .5rem 0; }
.receipt-item { display: flex; justify-content: space-between; margin-bottom: .25rem; }
.receipt-total { display: flex; justify-content: space-between; font-weight: 800; font-size: .9rem; margin-top: .25rem; }

/* ====== CHARTS ====== */
.chart-container { position: relative; height: 200px; margin: .5rem 0; }
.bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 180px; padding: 10px 0; }
.bar-group { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bar { width: 100%; max-width: 32px; border-radius: 4px 4px 0 0; min-height: 4px; transition: height .3s; }
.bar-label { font-size: .65rem; color: var(--gray-500); text-align: center; }
.pie-chart { display: flex; align-items: center; gap: 2rem; justify-content: center; }
.pie-canvas { width: 140px; height: 140px; border-radius: 50%; position: relative; }
.pie-legend { display: flex; flex-direction: column; gap: .4rem; }
.pie-legend-item { display: flex; align-items: center; gap: .5rem; font-size: .8rem; }
.pie-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* ====== PRODUCT CARD IN INVENTORY ====== */
.inv-toolbar { display: flex; gap: .5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.inv-toolbar input { flex: 1; min-width: 200px; }
.inv-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}
.inv-item {
  background: #fff; border: 1px solid var(--gray-200);
  border-radius: var(--radius); padding: 1rem;
  box-shadow: var(--shadow);
}
.inv-item .inv-name { font-weight: 600; font-size: .9rem; }
.inv-item .inv-cat { font-size: .75rem; color: var(--gray-500); margin-bottom: .5rem; }
.inv-item .inv-meta { display: flex; justify-content: space-between; font-size: .8rem; }
.inv-item .inv-price { font-weight: 700; color: var(--primary); }
.inv-item .inv-stock { }
.inv-item .inv-actions { display: flex; gap: .3rem; margin-top: .5rem; justify-content: flex-end; }

/* ====== STAFF & CUSTOMER CARDS ====== */
.people-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}
.person-card {
  background: #fff; border: 1px solid var(--gray-200);
  border-radius: var(--radius); padding: 1rem;
  display: flex; align-items: center; gap: .85rem;
}
.person-card .pc-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1rem; color: #fff;
  flex-shrink: 0;
}
.person-card .pc-info { flex: 1; }
.person-card .pc-name { font-weight: 600; font-size: .9rem; }
.person-card .pc-meta { font-size: .8rem; color: var(--gray-500); }
.person-card .pc-status { font-size: .75rem; }

/* ====== SETTINGS ====== */
.settings-section { margin-bottom: 2rem; }
.settings-section h3 {
  font-size: 1rem; font-weight: 700; margin-bottom: 1rem;
  color: var(--gray-800);
}
.settings-card {
  background: #fff; border: 1px solid var(--gray-200);
  border-radius: var(--radius); padding: 1.25rem;
  box-shadow: var(--shadow);
}
.plan-card {
  border: 2px solid var(--gray-200); border-radius: var(--radius);
  padding: 1.25rem; text-align: center; flex: 1;
}
.plan-card.active { border-color: var(--primary); background: var(--primary-light); }
.plan-card h4 { font-size: 1rem; font-weight: 700; }
.plan-card .plan-price { font-size: 1.5rem; font-weight: 800; color: var(--primary); margin: .5rem 0; }
.plan-card .plan-price span { font-size: .8rem; font-weight: 400; color: var(--gray-500); }
.plan-card ul { list-style: none; font-size: .85rem; }
.plan-card ul li { padding: .25rem 0; color: var(--gray-600); }
.plan-card ul li::before { content: "✓ "; color: var(--success); font-weight: 700; }

/* ====== TABS ====== */
.tabs { display: flex; border-bottom: 1px solid var(--gray-200); margin-bottom: 1rem; }
.tab-btn {
  padding: .6rem 1.25rem; font-weight: 500; font-size: .85rem;
  color: var(--gray-500); border-bottom: 2px solid transparent;
  transition: all .15s;
}
.tab-btn:hover { color: var(--gray-700); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ====== UTILITY ====== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--gray-500); }
.text-sm { font-size: .8rem; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ====== SCROLLBAR ====== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ====== EMPTY STATE ====== */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--gray-400); }
.empty-state svg { margin-bottom: 1rem; }
.empty-state p { font-size: .9rem; }

/* ====== ALERT ====== */
.alert {
  padding: .75rem 1rem; border-radius: var(--radius-sm);
  font-size: .85rem; margin-bottom: 1rem;
}
.alert-success { background: var(--success-light); color: var(--success); }
.alert-danger { background: var(--danger-light); color: var(--danger); }
.alert-warning { background: var(--warning-light); color: var(--warning); }

/* ====== TOAST ====== */
.toast-container { position: fixed; top: 1rem; right: 1rem; z-index: 9999; display: flex; flex-direction: column; gap: .5rem; }
.toast {
  padding: .75rem 1rem; border-radius: var(--radius-sm);
  font-size: .85rem; font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: slideIn .3s ease; min-width: 240px;
}
.toast-success { background: var(--success); color: #fff; }
.toast-error { background: var(--danger); color: #fff; }
.toast-info { background: var(--primary); color: #fff; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ====== RESPONSIVE ====== */
@media (max-width: 1024px) {
  .grid-2, .grid-2-1 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .pos-layout { grid-template-columns: 1fr; }
  .pos-cart { height: auto; max-height: 400px; }
}
@media (max-width: 768px) {
  .sidebar { width: 60px; min-width: 60px; }
  .sidebar-brand, .sidebar-user > div, .nav-item span { display: none; }
  .sidebar-nav .nav-item { justify-content: center; padding: .6rem; }
  .sidebar-footer { flex-direction: column; gap: .5rem; }
  .main-content { padding: 1rem; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .inv-grid { grid-template-columns: 1fr 1fr; }
}

/* ====== CUSTOMER DISPLAY ====== */
.cd-wrapper {
  display: flex; flex-direction: column;
  min-height: calc(100vh - 3rem);
  max-width: 520px; margin: 0 auto;
  font-family: 'Inter', sans-serif;
}
.cd-header {
  text-align: center; padding: 1.5rem .5rem .5rem;
  border-bottom: 2px solid var(--gray-900);
  margin-bottom: 1rem;
}
.cd-brand { font-size: 1.1rem; font-weight: 800; color: var(--gray-900); letter-spacing: -.3px; }
.cd-title { font-size: .85rem; color: var(--gray-500); margin-top: .15rem; }
.cd-items { flex: 1; overflow-y: auto; padding: 0 .5rem; }
.cd-empty {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: .5rem; padding: 4rem 1rem;
  text-align: center; color: var(--gray-400);
}
.cd-empty p { font-size: 1rem; font-weight: 500; }
.cd-hint { font-size: .85rem; font-weight: 400; color: var(--gray-400) !important; }
.cd-item {
  display: flex; align-items: center;
  padding: .75rem .5rem; gap: .5rem;
  border-bottom: 1px solid var(--gray-100);
}
.cd-item-striped { background: var(--gray-50); }
.cd-item-info { flex: 1; min-width: 0; }
.cd-item-name { font-weight: 600; font-size: .95rem; color: var(--gray-900); }
.cd-item-meta { font-size: .75rem; color: var(--gray-400); margin-top: .1rem; }
.cd-item-qty {
  font-size: 1rem; font-weight: 700;
  color: var(--primary); min-width: 40px;
  text-align: center;
}
.cd-item-total {
  font-size: 1rem; font-weight: 700;
  color: var(--gray-900); min-width: 80px;
  text-align: right;
}
.cd-footer {
  border-top: 2px solid var(--gray-900);
  padding: 1rem .5rem .5rem;
  position: sticky; bottom: 0;
  background: #fff;
}
.cd-summary { margin-bottom: .75rem; }
.cd-summary-row {
  display: flex; justify-content: space-between;
  font-size: .95rem; color: var(--gray-600);
}
.cd-total-bar {
  display: flex; justify-content: space-between;
  font-size: 1.4rem; font-weight: 800;
  color: var(--gray-900); padding: .5rem 0;
  border-top: 2px solid var(--gray-900);
  border-bottom: 2px solid var(--gray-900);
  margin-bottom: .75rem;
}
.cd-thankyou {
  font-size: .8rem;
  color: var(--gray-400);
  text-align: center;
  padding-top: .5rem;
}
.cd-transfer {
  margin: .75rem 0 0;
  padding: .6rem .75rem;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
}
.cd-transfer-title {
  font-size: .75rem;
  font-weight: 700;
  color: #166534;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: .35rem;
}
.cd-transfer-row {
  display: flex;
  justify-content: space-between;
  font-size: .8rem;
  padding: .1rem 0;
  color: var(--gray-700);
}
.cd-transfer-row span:first-child { color: var(--gray-500); }

/* hide sidebar in display mode */
body:has(.cd-wrapper) .sidebar,
body:has(.cd-wrapper) main { display: block; }
body:has(.cd-wrapper) .main-content { padding: 0; height: auto; }

/* display mode — hide sidebar for customer-facing screen */
.display-mode .sidebar { display: none; }
.display-mode .main-content { padding: 0; height: auto; }

/* ====== BARCODE SCANNER OVERLAY ====== */
#scanner-overlay {
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(0,0,0,.85);
  display: flex; align-items: center; justify-content: center;
}
#scanner-container {
  width: min(92vw, 400px);
  background: #fff; border-radius: 12px;
  overflow: hidden; box-shadow: 0 25px 50px rgba(0,0,0,.5);
}
.scanner-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--gray-100);
}
#scanner-view video { object-fit: cover; }
#scanner-view {
  position: relative;
  display: flex; align-items: center; justify-content: center;
}
#scanner-view::after {
  content: ''; position: absolute;
  width: 200px; height: 80px;
  border: 3px solid rgba(37,99,235,.7);
  border-radius: 12px;
  box-shadow: 0 0 0 400px rgba(0,0,0,.3);
  pointer-events: none;
}

/* ====== DARK MODE ====== */
[data-theme="dark"] {
  --primary: #3B82F6;
  --primary-dark: #2563EB;
  --primary-light: #1E3A5F;
  --success: #10B981;
  --success-light: #064E3B;
  --warning: #F59E0B;
  --warning-light: #5B3A00;
  --danger: #EF4444;
  --danger-light: #5C1A1A;
  --gray-50: #1F2937;
  --gray-100: #374151;
  --gray-200: #4B5563;
  --gray-300: #6B7280;
  --gray-400: #9CA3AF;
  --gray-500: #D1D5DB;
  --gray-600: #E5E7EB;
  --gray-700: #F3F4F6;
  --gray-800: #F9FAFB;
  --gray-900: #FFFFFF;
  --shadow: 0 1px 3px rgba(0,0,0,.3), 0 1px 2px rgba(0,0,0,.2);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.4),0 2px 4px -2px rgba(0,0,0,.3);
  --shadow-lg: 0 10px 25px -3px rgba(0,0,0,.5),0 4px 10px -4px rgba(0,0,0,.4);
}
[data-theme="dark"] body { background: #111827; }
[data-theme="dark"] .card,
[data-theme="dark"] .settings-card,
[data-theme="dark"] .plan-card { background: #1F2937; }
[data-theme="dark"] .sidebar { background: #111827; border-right-color: #374151; }
[data-theme="dark"] .nav-item { color: var(--gray-400); }
[data-theme="dark"] .nav-item:hover { background: #1F2937; color: var(--gray-100); }
[data-theme="dark"] .nav-item.active { background: #1E3A5F; color: #60A5FA; }
[data-theme="dark"] input, [data-theme="dark"] select, [data-theme="dark"] textarea { background: #374151; color: var(--gray-200); border-color: #4B5563; }
[data-theme="dark"] .modal-content { background: #1F2937; }
[data-theme="dark"] .modal-backdrop { background: rgba(0,0,0,.7); }
[data-theme="dark"] .kpi-card { background: #1F2937; }
[data-theme="dark"] table th { background: #374151; }
[data-theme="dark"] table td { border-color: #374151; }
[data-theme="dark"] .login-container { background: #1F2937; }
[data-theme="dark"] .login-bg { opacity: .15; }
[data-theme="dark"] .cd-wrapper { background: #111827; }
[data-theme="dark"] .cd-header { background: #1F2937; }
[data-theme="dark"] .cd-item-striped { background: #1F2937; }
[data-theme="dark"] .cd-transfer { background: #064E3B; border-color: #10B981; }
[data-theme="dark"] .cd-transfer-title { color: #6EE7B7; }
[data-theme="dark"] .kpi-icon.purple { background: #3B0764; color: #C084FC; }
