:root {
  --color-navy: #1e293b;
  --color-navy-dark: #0f172a;
  --color-teal: #2563eb;
  --color-teal-dark: #1d4ed8;
  --color-light: #f1f5f9;
  --color-grey: #475569;
  --color-amber: #b45309;
  --color-danger: #dc2626;
  --color-success: #059669;
  --color-white: #ffffff;
  --color-border: #e2e8f0;
  --color-muted: #64748b;
  --color-brass: #2563eb;
  --color-cream: #f1f5f9;
  --color-paper: #ffffff;
  --font-base: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --radius-base: 8px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-btn: none;
  --sidebar-w: 220px;
  --sidebar-collapsed-w: 68px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --ease: 160ms ease;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { height: 100%; overflow-x: clip; }
body {
  font-family: var(--font-base);
  background-color: var(--color-cream);
  color: var(--color-navy);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100%;
  overflow-x: clip;
}
.app-shell, .auth-wrap { position: relative; }

a { color: var(--color-teal); text-decoration: none; }
a:hover { color: var(--color-teal-dark); }
img { max-width: 100%; display: block; }

.app-shell { display: flex; min-height: 100vh; width: 100%; max-width: 100%; overflow-x: clip; }
.sidebar {
  width: var(--sidebar-w);
  background: #1e293b;
  color: #e2e8f0;
  border-right: 1px solid #334155;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
  transition: width var(--ease);
  z-index: 30;
}
.sidebar-brand {
  padding: 14px 12px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 6px;
}
.sidebar-brand .mark {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  min-width: 0;
  flex: 1;
}
.sidebar-brand .mark:hover { color: #fff; }
.brand-logo {
  height: 36px;
  width: auto;
  max-width: 154px;
  object-fit: contain;
  background: #ffffff;
  border-radius: 6px;
  padding: 4px 6px;
}
.brand-text {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0;
  font-size: 14px;
  line-height: 1.15;
}
.brand-text small { display: block; color: #b7b09f; font-weight: 400; margin-top: 3px; font-size: 11px; font-family: var(--font-base); }
.sidebar nav { padding: 10px 8px 16px; overflow: auto; flex: 1; }
.nav-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #8ea0b0;
  padding: 10px 8px 4px;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: #e8f1fb;
  margin-bottom: 2px;
  transition: background var(--ease), color var(--ease), transform var(--ease);
}
.nav-link:hover { background: rgba(255,255,255,0.12); color: #ffffff; }
.nav-link.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-weight: 600;
}
.nav-ico { flex-shrink: 0; }
.nav-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.nav-group { margin-bottom: 2px; }
.nav-group-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: #e8f1fb;
  font: inherit;
  cursor: pointer;
  text-align: left;
  transition: background var(--ease), color var(--ease);
}
.nav-group-toggle:hover { background: rgba(255,255,255,0.12); color: #ffffff; }
.nav-group.is-current > .nav-group-toggle { color: #fff; }
.nav-caret { margin-left: auto; flex-shrink: 0; transition: transform var(--ease); opacity: 0.7; }
.nav-group.is-open > .nav-group-toggle .nav-caret { transform: rotate(180deg); }
.nav-group-items {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows var(--ease);
}
.nav-group.is-open > .nav-group-items { grid-template-rows: 1fr; }
.nav-group-inner { overflow: hidden; padding: 2px 0 4px 10px; }
.nav-group-inner .nav-link { padding-left: 10px; }

html.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed-w); }
html.sidebar-collapsed .brand-text,
html.sidebar-collapsed .nav-group-toggle .nav-text,
html.sidebar-collapsed > body .sidebar > nav > .nav-link .nav-text,
html.sidebar-collapsed .nav-caret,
html.sidebar-collapsed .nav-label { display: none; }
html.sidebar-collapsed .sidebar-brand {
  justify-content: center;
  flex-direction: column;
  align-items: center;
  padding: 12px 8px 8px;
}
html.sidebar-collapsed .brand-logo {
  max-width: 40px;
  height: 40px;
  width: 40px;
  object-fit: cover;
  object-position: 12% center;
  padding: 2px;
}
html.sidebar-collapsed .sidebar-brand .mark { justify-content: center; }
html.sidebar-collapsed .sidebar-collapse { transform: rotate(180deg); }
html.sidebar-collapsed .sidebar > nav > .nav-link,
html.sidebar-collapsed .nav-group-toggle { justify-content: center; padding: 9px 0; }
html.sidebar-collapsed .sidebar nav { padding: 8px 6px; overflow: visible; }
html.sidebar-collapsed .nav-group { position: relative; }
html.sidebar-collapsed .nav-group-items {
  position: absolute;
  left: calc(100% + 4px);
  top: 0;
  width: 210px;
  background: #334155;
  border: 1px solid #475569;
  border-radius: var(--radius-base);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.28);
  z-index: 40;
  grid-template-rows: 0fr;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--ease), visibility var(--ease), grid-template-rows var(--ease);
}
html.sidebar-collapsed .nav-group-items::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 0;
  bottom: 0;
  width: 8px;
}
html.sidebar-collapsed .nav-group:hover > .nav-group-items,
html.sidebar-collapsed .nav-group:focus-within > .nav-group-items {
  grid-template-rows: 1fr;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
html.sidebar-collapsed .nav-group-inner { padding: 6px; }
html.sidebar-collapsed .nav-group-inner .nav-link { justify-content: flex-start; padding: 7px 8px; }
html.sidebar-collapsed .nav-group-inner .nav-text { display: inline; }

.sidebar-collapse { color: #c5d4de; margin-top: 2px; }
.sidebar-collapse:hover { color: #fff; background: rgba(255,255,255,0.08); }

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 28, 42, 0.45);
  z-index: 25;
  opacity: 0;
  transition: opacity var(--ease);
}

.main { flex: 1; min-width: 0; max-width: 100%; display: flex; flex-direction: column; overflow-x: clip; }
.navbar {
  background: #ffffff;
  border-bottom: 1px solid var(--color-border);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.navbar-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.navbar h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}
.navbar-meta { display: flex; align-items: center; gap: 8px; color: var(--color-grey); }
.signout-form { margin: 0; }
.branch-chip {
  font-size: 12px;
  color: var(--color-grey);
  background: var(--color-light);
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--color-border);
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--color-light);
  padding: 3px 10px 3px 3px;
  border-radius: 6px;
  border: 1px solid var(--color-border);
}
.avatar {
  width: 26px; height: 26px; border-radius: 6px;
  background: var(--color-teal); color: #fff;
  display: grid; place-items: center; font-size: 11px; font-weight: 600;
}
.content {
  padding: 16px 20px 24px;
  flex: 1;
  max-width: 1200px;
  width: 100%;
  min-width: 0;
  margin: 0 auto;
  box-sizing: border-box;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 0;
}
.eyebrow {
  margin: 0 0 4px;
  color: var(--color-muted);
  font-size: 13px;
  font-weight: 500;
}
.page-head h2 {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.25;
}
.page-head p { margin: 0; color: var(--color-muted); font-size: 14px; max-width: 52ch; }

.dashboard-home { display: flex; flex-direction: column; gap: 16px; }
.dashboard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.dashboard-panels { display: grid; gap: 16px; }

.grid { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.card {
  background: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-base);
  box-shadow: var(--shadow);
  min-width: 0;
  max-width: 100%;
}
.card-body { padding: 16px; }
.card-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 14px;
}
.card-head-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-teal);
}
.card-head-link:hover { color: var(--color-teal-dark); }

.stat {
  padding: 14px 16px;
  display: block;
  color: inherit;
  text-decoration: none;
  transition: border-color var(--ease), box-shadow var(--ease);
}
a.stat:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
}
.stat .label { color: var(--color-muted); font-size: 13px; font-weight: 500; }
.stat .value {
  font-size: 24px;
  font-weight: 600;
  margin-top: 4px;
  line-height: 1.2;
}
.stat .hint { color: var(--color-muted); font-size: 12px; margin-top: 4px; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0;
  transition: background var(--ease), border-color var(--ease), transform var(--ease);
}
.icon-btn:hover { background: var(--color-light); }
.icon-btn.is-active {
  background: var(--color-teal);
  color: #fff;
}
.nav-burger { display: none; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-family: inherit;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  background: var(--color-teal);
  color: #fff;
  text-decoration: none;
  transition: background var(--ease), border-color var(--ease);
}
.btn:hover { background: var(--color-teal-dark); color: #fff; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-navy { background: var(--color-navy); }
.btn-navy:hover { background: var(--color-navy-dark); }
.btn-outline { background: #fff; color: var(--color-navy); border-color: var(--color-border); }
.btn-outline:hover { background: var(--color-light); color: var(--color-navy); }
.btn-amber { background: var(--color-amber); }
.btn-danger { background: var(--color-danger); box-shadow: none; }
.btn-sm { padding: 4px 9px; font-size: 12px; }
.btn-lg { padding: 10px 16px; font-size: 14px; }
.btn-block { width: 100%; }

.table-wrap {
  overflow-x: auto;
  overflow-y: visible;
  max-width: 100%;
  width: 100%;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}
table.data th {
  font-size: 12px;
  color: var(--color-muted);
  font-weight: 600;
  background: #f8fafc;
}
table.data tr:hover td { background: #f8fafc; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.badge-teal { background: #dbeafe; color: var(--color-teal-dark); }
.badge-navy { background: #e2e8f0; color: var(--color-navy); }
.badge-amber { background: #f6e6cf; color: var(--color-amber); }
.badge-danger { background: #f6ddd8; color: var(--color-danger); }
.badge-success { background: #d1fae5; color: #047857; }
.badge-grey { background: #e2e8f0; color: var(--color-grey); }

.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.form-row { display: flex; flex-direction: column; gap: 5px; }
.form-row.full { grid-column: 1 / -1; }
label { font-weight: 600; font-size: 12px; }
input, select, textarea {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font: inherit;
  color: var(--color-navy);
  background: #ffffff;
  transition: border-color var(--ease), box-shadow var(--ease);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--color-teal);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.help { color: var(--color-danger); font-size: 12px; }
.searchbar { display: flex; gap: 8px; flex: 1; min-width: 0; }
.searchbar input { flex: 1; }
.searchbar select { min-width: 140px; }

.flash {
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
  font-weight: 500;
  animation: rise 0.28s var(--ease) both;
}
.flash-success { background: #dcf5e8; color: var(--color-success); }
.flash-error { background: #fde8e6; color: var(--color-danger); }
.flash-warning { background: #f8e8d2; color: var(--color-amber); }
.flash-info { background: #e4ebf3; color: var(--color-navy); }

.app-footer {
  padding: 12px 16px 18px;
  color: var(--color-muted);
  font-size: 12px;
  text-align: center;
  letter-spacing: 0.02em;
}
.app-footer a { font-weight: 600; }

.auth-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(900px 480px at 12% 18%, rgba(21, 101, 192, 0.12), transparent 55%),
    radial-gradient(800px 420px at 88% 82%, rgba(21, 101, 192, 0.08), transparent 50%),
    #f5f8fc;
}
@media (min-width: 901px) {
  .auth-wrap { height: 100vh; }
}
.auth-field {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
}
.auth-stage,
.auth-wrap > .auth-card,
.auth-wrap > .app-footer {
  position: relative;
  z-index: 1;
}
.auth-stage {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 36px;
  align-items: center;
  padding: 32px 40px 16px;
  min-height: 0;
}
.auth-intro {
  display: grid;
  grid-template-columns: minmax(180px, 280px) minmax(0, 1fr);
  gap: 28px;
  align-items: center;
  animation: rise 0.5s var(--ease) both;
}
.auth-portrait {
  margin: 0;
  aspect-ratio: 3 / 4;
  width: 100%;
  max-height: min(68vh, 520px);
  border-radius: 24px;
  overflow: hidden;
  background: #0d47a1;
  box-shadow: 0 22px 50px rgba(13, 33, 55, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.45);
}
.auth-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 12%;
  display: block;
}
.auth-copy { max-width: 440px; }
.auth-copy .eyebrow { color: var(--color-brass); }
.auth-hero-logo {
  width: min(210px, 80%);
  background: #ffffff;
  border-radius: 14px;
  padding: 8px 10px;
  margin-bottom: 18px;
  box-shadow: 0 10px 24px rgba(44, 38, 28, 0.08);
}
.auth-copy h1 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: clamp(28px, 3.6vw, 42px);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0;
  color: var(--color-navy);
}
.auth-copy p {
  margin: 0;
  color: var(--color-grey);
  font-size: 15px;
  max-width: 42ch;
}
.auth-card {
  width: min(420px, 100%);
  margin: 0 auto;
  background: linear-gradient(180deg, rgba(255,254,251,0.94), rgba(248,243,233,0.94));
  border: 1px solid #e4dccb;
  border-radius: 22px;
  padding: 30px 28px;
  box-shadow: 0 18px 50px rgba(44, 38, 28, 0.1);
  backdrop-filter: blur(10px);
  animation: rise 0.45s 0.1s var(--ease) both;
}
.auth-card-logo {
  height: 42px;
  width: auto;
  margin-bottom: 16px;
}
.auth-card h2,
.auth-card h1 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: 0;
}
.auth-card p.lead { color: var(--color-grey); margin: 0 0 18px; }
.auth-hint { margin: 16px 0 0; color: var(--color-muted); font-size: 12px; }
.auth-wrap > .auth-card { margin: auto; }
.auth-wrap > .app-footer { padding-bottom: 18px; }

.pos-layout { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.85fr); gap: 12px; align-items: start; }
.pos-toolbar { display: flex; align-items: center; gap: 8px; }
.view-toggle {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  background: var(--color-light);
  border-radius: 9px;
  flex-shrink: 0;
}
.pos-products { margin-top: 12px; }
.pos-products.is-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 8px;
}
.pos-products.is-list { display: grid; gap: 6px; }
.pos-product {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  cursor: pointer;
  background: linear-gradient(180deg, #fffefb, #f7f2e8);
  color: inherit;
  font: inherit;
  text-align: left;
  transition: border-color var(--ease), transform var(--ease), box-shadow var(--ease), background var(--ease);
}
.pos-product-main { display: grid; gap: 3px; min-width: 0; }
.pos-product-meta,
.pos-product-stock { color: var(--color-grey); font-size: 11px; }
.pos-product-side { text-align: right; flex-shrink: 0; }
.pos-product-price { font-family: var(--font-display); font-weight: 600; font-size: 15px; }
.pos-products.is-grid .pos-product {
  flex-direction: column;
  min-height: 118px;
  justify-content: space-between;
}
.pos-products.is-grid .pos-product-side { text-align: left; display: flex; justify-content: space-between; align-items: baseline; }
.pos-product:hover {
  border-color: #b9d4c2;
  box-shadow: 0 12px 24px rgba(21, 101, 192, 0.12);
  transform: translateY(-2px);
}
.pos-product:active { transform: scale(0.99); }
.pos-product:focus-visible { outline: 2px solid var(--color-teal); outline-offset: 2px; }
.pos-cart-card { position: sticky; top: 60px; }
.cart-line { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--color-border); animation: rise 0.22s var(--ease) both; }
.totals { display: grid; gap: 5px; margin-top: 10px; }
.totals div { display: flex; justify-content: space-between; }
.totals .grand { font-family: var(--font-display); font-size: 20px; font-weight: 600; }

.pagination { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px; }
.pagination a, .pagination span {
  padding: 5px 9px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  color: var(--color-navy);
}
.empty { padding: 22px; text-align: center; color: var(--color-grey); }
.table-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.table-actions-nowrap { flex-wrap: nowrap; justify-content: flex-end; gap: 4px; }
.btn-xs {
  padding: 3px 8px;
  font-size: 11px;
  line-height: 1.35;
  border-radius: 5px;
}
.wholesale-board .wholesale-panel .card-head {
  padding: 10px 14px;
  font-size: 13px;
}
.data.data-compact th,
.data.data-compact td {
  padding: 5px 8px;
  font-size: 13px;
  vertical-align: middle;
}

.wholesale-table.data-compact th,
.wholesale-table.data-compact td {
  padding: 5px 8px;
  font-size: 13px;
  vertical-align: middle;
}
.wholesale-table .col-num { text-align: right; white-space: nowrap; }
.wholesale-table .col-status { white-space: nowrap; }
.wholesale-table .col-actions { width: 1%; white-space: nowrap; padding-left: 4px; }
.wholesale-table .col-customer { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wholesale-table .col-id a { font-weight: 600; font-size: 12px; }
.wholesale-table .badge { font-size: 10px; padding: 2px 6px; }
.detail-meta-compact p { margin: 0 0 6px; font-size: 13px; line-height: 1.45; }
.modal-form-actions-nowrap {
  flex-wrap: nowrap;
  gap: 6px;
  justify-content: flex-end;
}
.muted { color: var(--color-muted); }
.line-editor { margin-top: 18px; }
.line-table td { white-space: normal; vertical-align: middle; }
.line-table th.col-qty,
.line-table th.col-cost,
.line-table th.col-num,
.line-table td.col-qty,
.line-table td.col-cost,
.line-table td.col-num { width: 112px; }
.line-table th.col-action,
.line-table td.col-action { width: 88px; text-align: right; }
.line-table select,
.line-table input { width: 100%; min-width: 0; }
.product-picker { position: relative; width: 100%; min-width: 160px; }
.product-picker-search {
  width: 100%;
  min-width: 0;
}
.product-picker-native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.product-picker-list {
  position: absolute;
  z-index: 50;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: 220px;
  overflow: auto;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  background: #fff;
  border: 1px solid var(--color-border, #d8cfc0);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(22, 40, 63, 0.12);
}
.product-picker-list li {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
}
.product-picker-list li:hover,
.product-picker-list li.is-active {
  background: #eef4fc;
}
.product-picker-list li.is-empty {
  cursor: default;
  color: var(--color-muted);
}
.line-table tfoot td {
  font-weight: 600;
  background: #f8fafc;
  border-bottom: 0;
}
.line-editor-actions { padding: 10px 0 0; }
.line-table-compact th,
.line-table-compact td {
  padding: 6px 8px;
  font-size: 13px;
  white-space: nowrap;
}
.line-table-compact th.col-stock,
.line-table-compact td.col-stock { width: 72px; text-align: right; }
.line-table-compact th.col-qty,
.line-table-compact td.col-qty { width: 80px; }
.line-table-compact th.col-price,
.line-table-compact td.col-price,
.line-table-compact td.col-amount { width: 100px; text-align: right; }
.line-table-compact th.col-action,
.line-table-compact td.col-action { width: 44px; text-align: center; padding: 4px; }
.line-table-compact input[type="number"] { padding: 4px 6px; font-size: 13px; }
.line-table-compact td:first-child { white-space: normal; min-width: 160px; }
.btn-with-icon { display: inline-flex; align-items: center; gap: 6px; }
.btn-icon {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--color-muted);
  cursor: pointer;
}
.btn-icon:hover { background: var(--color-light); color: var(--color-navy); }
.btn-icon-danger:hover { background: #fef2f2; color: var(--color-danger); border-color: #fecaca; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-modal-overlay[hidden] { display: none !important; }
.app-modal-overlay {
  position: fixed !important;
  inset: 0;
  z-index: 2000 !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  overflow: hidden;
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.52);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.app-modal-overlay:not([hidden]) .modal-backdrop {
  opacity: 1;
}
.modal-dialog {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(520px, 100%);
  max-height: min(90vh, 880px);
  margin: 0;
  overflow: hidden;
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow:
    0 24px 48px rgba(15, 23, 42, 0.18),
    0 4px 12px rgba(15, 23, 42, 0.08);
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.modal-dialog.is-open {
  opacity: 1;
  transform: none;
}
.modal-dialog.wide { width: min(920px, 100%); }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  padding: 14px 18px;
  border-bottom: 1px solid var(--color-border);
  background: linear-gradient(180deg, #f8fafc, #fff);
}
.modal-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--color-navy);
  line-height: 1.3;
  padding-right: 8px;
}
.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid var(--color-border);
  background: #fff;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--color-muted);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.modal-close:hover {
  color: var(--color-navy);
  background: var(--color-light);
  border-color: #cbd5e1;
}
.modal-close:focus-visible {
  outline: 2px solid var(--color-teal, #0d9488);
  outline-offset: 2px;
}
.modal-body {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 16px 18px 18px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.modal-body .page-head { display: none; }
.modal-body .card { box-shadow: none; border: 0; animation: none; }
.modal-body .card-body { padding: 0; }
.modal-body .data th,
.modal-body .data td {
  padding: 6px 8px;
  font-size: 13px;
}
.modal-body .table-wrap {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: auto;
}
.modal-body .totals {
  margin-top: 12px;
}
.modal-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: min-content;
}
.modal-form-intro {
  margin: 0;
  color: var(--color-muted);
  font-size: 13px;
  line-height: 1.5;
}
.modal-form-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px -18px -18px;
  padding: 12px 18px 14px;
  border-top: 1px solid var(--color-border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.85), #fff 35%);
  position: sticky;
  bottom: 0;
  z-index: 3;
}
.modal-form-confirm {
  padding-bottom: 4px;
}
.modal-form-confirm .modal-form-intro {
  margin-bottom: 4px;
  font-size: 14px;
  color: var(--color-navy);
}
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 0; }
.modal-loading-state {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 28px 8px;
  color: var(--color-muted);
  font-size: 14px;
}
.modal-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid #e2e8f0;
  border-top-color: #1e293b;
  border-radius: 50%;
  animation: modal-spin 0.65s linear infinite;
  flex-shrink: 0;
}
@keyframes modal-spin {
  to { transform: rotate(360deg); }
}
@media (max-width: 640px) {
  .app-modal-overlay {
    padding: 0;
    align-items: stretch;
  }
  .modal-dialog {
    width: 100%;
    max-height: 100vh;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }
  .modal-dialog.wide {
    width: 100%;
  }
}
.form-row-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
}
.form-row-inline select { flex: 1; min-width: 200px; }
.form-hint { margin: 6px 0 0; color: var(--color-muted); font-size: 13px; }
.detail-meta p { margin: 0 0 6px; color: var(--color-grey); font-size: 14px; }
.detail-meta p:last-child { margin-bottom: 0; }

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px 20px;
  margin: 0;
}
.detail-grid dt {
  margin: 0;
  font-size: 12px;
  color: var(--color-grey);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.detail-grid dd {
  margin: 4px 0 0;
  font-size: 14px;
}
.modal-body .line-editor { margin-top: 0; }
.modal-body .line-editor .table-wrap { overflow: visible; }
.modal-body .product-picker-list { z-index: 15; }
.modal-loading { margin: 0; color: var(--color-muted); font-size: 14px; }
body.modal-open { overflow: hidden; }

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes kenburns {
  from { transform: scale(1.04) translateY(0); }
  to { transform: scale(1.1) translateY(-1.5%); }
}

@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: 1fr; }
  .auth-stage { grid-template-columns: 1fr 0.9fr; padding: 24px; }
  .auth-intro { grid-template-columns: minmax(150px, 220px) 1fr; }
}
@media (max-width: 900px) {
  .content { padding: 12px 12px 20px; max-width: none; }
  .page-head {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .page-head-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .page-head h2 { font-size: 18px; }
  .navbar { padding: 10px 12px; }
  table.data th,
  table.data td {
    padding: 7px 8px;
    font-size: 12px;
  }
  table.data.data-compact th,
  table.data.data-compact td {
    padding: 5px 6px;
    font-size: 11px;
  }
  .table-actions-nowrap {
    white-space: normal;
  }
  .table-actions-nowrap .btn-xs {
    margin-bottom: 2px;
  }
  .nav-burger { display: inline-grid; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-102%);
    width: min(var(--sidebar-w), 86vw);
    box-shadow: 12px 0 40px rgba(15, 28, 42, 0.2);
  }
  html.sidebar-open .sidebar { transform: none; }
  html.sidebar-open .sidebar-backdrop { display: block; opacity: 1; }
  html.sidebar-collapsed .sidebar { width: min(var(--sidebar-w), 86vw); }
  html.sidebar-collapsed .brand-text,
  html.sidebar-collapsed .nav-group-toggle .nav-text,
  html.sidebar-collapsed > body .sidebar > nav > .nav-link .nav-text,
  html.sidebar-collapsed .nav-caret,
  html.sidebar-collapsed .nav-label { display: revert; }
  html.sidebar-collapsed .nav-link,
  html.sidebar-collapsed .nav-group-toggle { justify-content: flex-start; padding: 7px 8px; }
  html.sidebar-collapsed .sidebar nav { overflow: auto; }
  html.sidebar-collapsed .nav-group-items {
    position: static;
    width: auto;
    background: none;
    border: 0;
    box-shadow: none;
  }
  html.sidebar-collapsed .brand-logo { width: auto; height: 36px; max-width: 148px; object-fit: contain; }
  .pos-layout { grid-template-columns: 1fr; }
  .pos-cart-card { position: static; }
  .grid-2, .grid-4 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .user-name { display: none; }
  .navbar-meta { flex-wrap: wrap; justify-content: flex-end; }
  .auth-wrap { height: auto; overflow: auto; }
  .auth-stage { grid-template-columns: 1fr; padding: 20px 18px 8px; }
  .auth-intro { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .auth-portrait { max-width: 220px; max-height: 280px; }
  .auth-copy { display: flex; flex-direction: column; align-items: center; }
  .auth-card { width: min(440px, 100%); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

.help-toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.help-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}
.help-toc a {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  color: var(--color-navy);
  font-size: 12px;
  font-weight: 600;
}
.help-toc a:hover { border-color: var(--color-teal); color: var(--color-teal-dark); }
.help-acc {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  scroll-margin-top: 16px;
}
.help-acc > summary {
  cursor: pointer;
  list-style: none;
  padding: 12px 16px;
  font-weight: 600;
  color: var(--color-navy);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.help-acc > summary::-webkit-details-marker { display: none; }
.help-acc > summary::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--color-muted);
  border-bottom: 2px solid var(--color-muted);
  transform: rotate(45deg);
  transition: transform var(--ease);
  flex-shrink: 0;
}
.help-acc[open] > summary { border-bottom: 1px solid var(--color-border); }
.help-acc[open] > summary::after { transform: rotate(225deg); margin-bottom: 4px; }
.help-acc-body { padding: 12px 16px 16px; color: var(--color-grey); }
.help-acc-body h3 { color: var(--color-navy); font-size: 14px; margin: 14px 0 6px; }
.help-acc-body h3:first-child { margin-top: 0; }
.help-acc-body ul, .help-acc-body ol { padding-left: 18px; margin: 6px 0; }
.help-acc-body p { margin: 6px 0; }
.help-acc-body code {
  font-size: 12px;
  background: var(--color-cream);
  padding: 1px 5px;
  border-radius: 4px;
}
.help-jump { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.help-public { min-height: 100vh; display: flex; flex-direction: column; background: var(--color-cream); }
.help-public-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: var(--color-navy);
}
.help-public-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-weight: 600;
}
.help-public-brand img { height: 32px; width: auto; }
.help-public-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.help-public-bar .btn { background: var(--color-teal); color: #fff; }
.help-public-bar .btn-outline {
  background: transparent;
  color: #fff;
  border-color: rgba(255,255,255,0.35);
}
.help-public-body { max-width: 920px; width: 100%; margin: 0 auto; padding: 24px 16px 40px; }
.install-login { margin-top: 12px; }
.install-sheet {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 16px;
}
.install-sheet[hidden] { display: none; }
.install-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 28, 42, 0.45);
}
.install-sheet-card {
  position: relative;
  width: min(440px, 100%);
  background: var(--color-paper);
  border-radius: var(--radius-base);
  padding: 20px;
  box-shadow: var(--shadow);
}
.install-sheet-card h3 { margin: 0 0 8px; font-size: 18px; }
.install-sheet-card p,
.install-sheet-card li { color: var(--color-grey); }
.install-sheet-card ol { margin: 0 0 16px; padding-left: 18px; }
@media (display-mode: standalone) {
  [data-install-app] { display: none !important; }
}

.stock-adjust-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px 20px;
  margin: 0 0 16px;
  padding: 12px 14px;
  background: var(--color-surface, #f8fafc);
  border-radius: var(--radius-base, 8px);
  border: 1px solid var(--color-border, #e2e8f0);
}
.stock-adjust-summary dt {
  margin: 0;
  font-size: 12px;
  color: var(--color-grey);
  font-weight: 500;
}
.stock-adjust-summary dd {
  margin: 4px 0 0;
  font-size: 16px;
}
.stock-adjust-mode {
  border: none;
  padding: 0;
  margin: 0 0 14px;
}
.stock-adjust-mode legend {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
}
.choice-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: 16px;
  font-size: 14px;
  cursor: pointer;
}
.stock-adjust-preview.is-error {
  color: var(--color-danger, #b91c1c);
}
.stock-adjust-preview {
  margin: 8px 0 0;
  font-size: 13px;
}

.invoice-card .invoice-doc-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}
.page-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.print-page-shell {
  max-width: 880px;
  margin: 0 auto;
  padding: 16px 20px 32px;
}

@media print {
  @page {
    margin: 12mm;
  }

  html,
  body {
    height: auto !important;
    background: #fff !important;
  }

  .sidebar,
  .navbar,
  .btn,
  .no-print,
  .app-modal-overlay,
  .sidebar-backdrop,
  .app-footer,
  .install-sheet,
  .flash {
    display: none !important;
  }

  .app-shell {
    display: block !important;
  }

  .main,
  .content,
  .print-page-shell {
    display: block !important;
    max-width: none !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .card,
  .receipt-card {
    box-shadow: none !important;
    border: none !important;
    animation: none !important;
  }

  .receipt-card .card-body {
    padding: 0 !important;
  }

  .receipt-card .data th,
  .receipt-card .data td {
    padding: 4px 6px;
    font-size: 12px;
  }

  .receipt-card h3 {
    margin: 0 0 8px;
    font-size: 16px;
  }
}
