:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-soft: #eef4ff;
  --text: #101828;
  --muted: #667085;
  --line: #d9e2ec;
  --brand: #155eef;
  --brand-dark: #0f3fa8;
  --accent: #12b76a;
  --danger: #c84630;
  --danger-dark: #8d2a1b;
  --shadow: 0 12px 30px rgba(16, 32, 28, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overflow-x: clip;
}

body {
  margin: 0;
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overflow-x: clip;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.anonymous {
  background:
    radial-gradient(circle at 10% 18%, rgba(21, 94, 239, 0.22), transparent 28%),
    radial-gradient(circle at 78% 12%, rgba(18, 183, 106, 0.16), transparent 24%),
    linear-gradient(135deg, #101828 0%, #1d2939 44%, #eef4ff 44.2%, #f8fbff 100%);
}

body.anonymous .app-shell {
  display: none;
}

body.authenticated .auth-screen {
  display: none;
}

.auth-screen {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) 440px;
  align-items: center;
  width: min(100%, 1080px);
  min-height: 100vh;
  gap: 56px;
  margin: 0 auto;
  padding: 40px 28px;
}

.auth-hero {
  color: white;
  padding: 24px 0;
}

.auth-hero h1 {
  max-width: 620px;
  margin: 28px 0 14px;
  font-size: 52px;
  line-height: 1.02;
}

.auth-hero p {
  max-width: 560px;
  margin: 0;
  color: #c5d8d3;
  font-size: 18px;
  line-height: 1.55;
}

.auth-proof {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}

.auth-proof span {
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 9px 12px;
  background: rgba(255, 255, 255, 0.08);
  color: #e6f2ef;
  font-size: 13px;
  font-weight: 800;
}

.auth-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(9, 24, 21, 0.24);
}

.auth-brand {
  margin-bottom: 0;
  color: white;
}

.auth-card-head {
  margin-bottom: 20px;
}

.auth-card-head h2 {
  margin: 14px 0 6px;
  font-size: 28px;
}

.auth-card-head p {
  margin: 0;
  color: var(--muted);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.auth-tab,
.link-button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  color: var(--text);
  font-weight: 800;
}

.auth-tab.active {
  border-color: var(--brand);
  background: var(--panel-soft);
  color: var(--brand-dark);
}

.auth-form {
  display: none;
  gap: 12px;
}

.auth-form.active {
  display: grid;
}

.link-button {
  border: 0;
  color: var(--brand-dark);
}

.auth-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  overflow-x: clip;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
  height: 100vh;
  padding: 20px 14px;
  background: #101828;
  color: white;
  overflow: hidden;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 0;
}

.brand-mark {
  display: grid;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--brand), var(--accent));
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: #cfd8e3;
  font-size: 13px;
}

.nav {
  display: grid;
  gap: 6px;
  min-height: 0;
  overflow-y: auto;
}

.nav-item {
  width: 100%;
  border: 0;
  border-radius: var(--radius);
  padding: 11px 12px;
  background: transparent;
  color: #dbe7e3;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.11);
  color: white;
}

.session-box {
  margin-top: auto;
  display: grid;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.session-box span {
  color: #cfd8e3;
  font-size: 13px;
}

.session-box strong,
.session-box small {
  display: block;
}

.session-box small {
  color: #cfd8e3;
  word-break: break-word;
}

.content {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  padding: 24px;
  overflow-x: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.topbar h1,
.panel h2 {
  margin: 0;
}

.topbar h1 {
  font-size: 30px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.topbar-actions,
.button-row,
.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.business-switcher {
  display: grid;
  gap: 4px;
  min-width: 190px;
}

.business-switcher span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.business-switcher select {
  min-height: 40px;
  background: white;
  font-weight: 800;
}

.sync-pill,
.mode-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border-radius: 999px;
  padding: 0 12px;
  background: var(--panel-soft);
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 700;
}

.view {
  display: none;
  min-width: 0;
}

.view.active {
  display: grid;
  gap: 18px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 14px;
}

.metric,
.panel {
  min-width: 0;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metric *,
.panel *,
.topbar *,
.sidebar * {
  min-width: 0;
}

.metric {
  padding: 18px;
}

.metric span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.metric strong {
  font-size: 28px;
  overflow-wrap: anywhere;
}

.metric.warning {
  border-color: rgba(232, 163, 23, 0.4);
  background: #fff9eb;
}

.panel {
  padding: 18px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.table-tools {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(150px, 210px);
  gap: 10px;
  align-items: center;
}

.search-control {
  position: relative;
  display: block;
}

.search-control span {
  position: absolute;
  left: 12px;
  top: 50%;
  color: var(--muted);
  font-size: 14px;
  transform: translateY(-50%);
  pointer-events: none;
}

.search-control input {
  padding-left: 36px;
}

.panel-head h2,
.list-item,
.cart-item,
.product-card {
  overflow-wrap: anywhere;
}

.split,
.sales-layout {
  display: grid;
  gap: 18px;
}

.split {
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.85fr);
}

.sales-layout {
  grid-template-columns: minmax(0, 1fr) 360px;
}

.scanner-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-bottom: 12px;
}

.notice-card {
  grid-column: 1 / -1;
  display: grid;
  gap: 4px;
  border: 1px solid #f5c451;
  border-radius: var(--radius);
  padding: 12px;
  background: #fff7df;
  color: #6f4b00;
}

.notice-card strong {
  font-size: 14px;
}

.notice-card span {
  font-size: 13px;
  line-height: 1.35;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: white;
  color: var(--text);
}

input:focus,
select:focus {
  border-color: var(--brand);
  outline: 3px solid rgba(13, 143, 114, 0.14);
}

.primary-button,
.ghost-button,
.danger-button,
.file-button,
.scanner-strip button {
  min-height: 42px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  padding: 10px 14px;
  font-weight: 800;
}

.primary-button,
.scanner-strip button {
  background: var(--brand);
  color: white;
}

.primary-button:hover,
.scanner-strip button:hover {
  background: var(--brand-dark);
}

.primary-button:disabled,
.ghost-button:disabled,
.icon-button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.ghost-button {
  border-color: var(--line);
  background: white;
  color: var(--text);
}

.danger-button {
  background: var(--danger);
  color: white;
}

.danger-button:hover {
  background: var(--danger-dark);
}

.full {
  width: 100%;
}

.form-grid > .full {
  grid-column: 1 / -1;
}

.hidden {
  display: none !important;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 16px;
  color: var(--muted);
  background: #fbfcfd;
}

.list {
  display: grid;
  gap: 10px;
}

.admin-product-list {
  max-height: 650px;
  overflow-y: auto;
  padding-right: 6px;
  overscroll-behavior: contain;
}

.list-item,
.cart-item,
.product-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: white;
}

.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sales-day-group {
  display: grid;
  gap: 10px;
}

.sales-day-group + .sales-day-group {
  margin-top: 12px;
}

.sales-day-header {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--ink);
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
  font-weight: 900;
}

.sales-day-header small {
  color: var(--muted);
  font-weight: 800;
  white-space: nowrap;
}

.sales-day-items {
  display: grid;
  gap: 10px;
}

.monthly-products {
  display: grid;
  gap: 14px;
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.closeout-tools {
  display: flex;
  align-items: end;
  justify-content: end;
  gap: 12px;
  flex-wrap: wrap;
}

.month-filter {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.month-filter input {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  background: #fff;
}

.top-product-summary {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.top-product-summary span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.top-product-summary strong {
  color: var(--ink);
  font-size: 22px;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.top-product-summary small {
  color: var(--muted);
  font-weight: 800;
  line-height: 1.35;
}

.product-rank-chart {
  display: grid;
  gap: 10px;
  padding-top: 2px;
}

.product-bar {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(120px, 2fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.product-bar-value {
  color: var(--ink);
  font-size: 13px;
  text-align: right;
  white-space: nowrap;
}

.product-bar-value small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.25;
}

.product-bar-meter {
  position: relative;
  display: flex;
  align-items: stretch;
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #eef2f6;
  overflow: hidden;
}

.product-bar-meter::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(16, 24, 40, 0.08) 1px, transparent 1px) 0 0 / 25% 100%;
  pointer-events: none;
}

.product-bar-fill {
  position: relative;
  z-index: 1;
  display: block;
  flex: 0 0 auto;
  height: 100%;
  max-width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #155eef, #4e8cff);
}

.product-bar.top .product-bar-fill {
  background: linear-gradient(90deg, #067647, #12b76a);
}

.product-bar-label {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.product-bar-label strong {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.product-bar-label strong span {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #edf4ff;
  color: #155eef;
  font-size: 11px;
  font-weight: 900;
}

.product-bar.top .product-bar-label strong span {
  background: #e7f8ef;
  color: #067647;
}

.product-bar-label small {
  display: block;
  padding-left: 30px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.rank-height-0 {
  height: 0;
}

.rank-height-1 {
  height: 10%;
}

.rank-height-2 {
  height: 20%;
}

.rank-height-3 {
  height: 30%;
}

.rank-height-4 {
  height: 40%;
}

.rank-height-5 {
  height: 50%;
}

.rank-height-6 {
  height: 60%;
}

.rank-height-7 {
  height: 70%;
}

.rank-height-8 {
  height: 80%;
}

.rank-height-9 {
  height: 90%;
}

.rank-height-10 {
  height: 100%;
}

.sale-actions {
  display: grid;
  justify-items: end;
  gap: 8px;
  min-width: 132px;
}

.voided-sale {
  background: #f8fafc;
}

.voided-sale strong {
  color: var(--muted);
}

.list-item small,
.product-card small {
  display: block;
  color: var(--muted);
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.product-card {
  display: grid;
  gap: 10px;
}

.category-folder {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  padding: 16px;
  display: grid;
  gap: 8px;
  text-align: left;
  color: var(--ink);
}

.category-folder span {
  font-size: 18px;
  font-weight: 900;
}

.category-folder small {
  color: var(--muted);
  font-weight: 800;
}

.category-folder:hover {
  border-color: var(--brand);
  background: #f7faff;
}

.back-folder {
  background: var(--panel-soft);
}

.product-card strong {
  line-height: 1.25;
}

.stock-badge {
  justify-self: start;
  border-radius: 999px;
  padding: 4px 8px;
  background: var(--panel-soft);
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 800;
}

.stock-badge.low {
  background: #fff0d1;
  color: #8a5b00;
}

.cart-panel {
  position: sticky;
  top: 18px;
  align-self: start;
}

.cart-list {
  display: grid;
  gap: 10px;
  min-height: 120px;
}

.cart-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.qty-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.qty-controls button {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
}

.cart-total {
  display: flex;
  justify-content: space-between;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.cart-total strong {
  font-size: 24px;
}

.cart-total.small {
  margin-top: 0;
  padding-top: 8px;
  border-top: 0;
}

.cart-total.small strong {
  font-size: 18px;
}

.floating-cart {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 15;
  display: grid;
  justify-items: end;
  gap: 10px;
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}

.floating-cart.hidden,
.floating-cart.on-sales {
  display: none !important;
}

.floating-cart-toggle,
.floating-cart-drawer {
  pointer-events: auto;
  box-shadow: 0 18px 48px rgba(16, 24, 40, 0.22);
}

.floating-cart-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  max-width: 100%;
  border: 1px solid rgba(21, 94, 239, 0.24);
  border-radius: 999px;
  padding: 9px 16px 9px 9px;
  background: #101828;
  color: white;
}

.floating-cart-toggle:hover {
  background: #1d2939;
}

.floating-cart-toggle strong,
.floating-cart-toggle small {
  display: block;
  text-align: left;
  line-height: 1.15;
}

.floating-cart-toggle small {
  margin-top: 3px;
  color: #d5e4ff;
  font-weight: 800;
}

.floating-cart-icon {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 999px;
  background: var(--accent);
  color: #052e1a;
}

.floating-cart-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.floating-cart.empty .floating-cart-icon {
  background: #d9e2ec;
  color: #344054;
}

.floating-cart-drawer {
  display: none;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: white;
}

.floating-cart.open .floating-cart-drawer {
  display: grid;
  gap: 12px;
}

.floating-cart-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.floating-cart-head strong,
.floating-cart-head small {
  display: block;
}

.floating-cart-head small {
  margin-top: 3px;
  color: var(--muted);
}

.floating-cart-items {
  display: grid;
  gap: 8px;
  max-height: min(320px, calc(100vh - 280px));
  overflow-y: auto;
}

.floating-cart-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  background: #fbfcfd;
}

.floating-cart-item strong,
.floating-cart-item small {
  display: block;
}

.floating-cart-item strong {
  line-height: 1.25;
}

.floating-cart-item small {
  color: var(--muted);
}

.floating-cart-summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.floating-cart-summary strong {
  font-size: 22px;
}

.floating-cart-actions {
  display: grid;
  grid-template-columns: minmax(96px, 0.7fr) minmax(0, 1fr);
  gap: 10px;
}

.floating-cart-actions button {
  min-width: 0;
}

.payment-box {
  display: grid;
  gap: 8px;
  margin: 16px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
}

.payment-box legend {
  padding: 0 6px;
  color: var(--muted);
  font-weight: 800;
}

.payment-option {
  position: relative;
  display: block;
  color: var(--text);
  font-size: 14px;
}

.payment-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.payment-option span {
  display: grid;
  min-height: 46px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  font-weight: 900;
}

.payment-option input:checked + span {
  border-color: var(--brand);
  background: var(--panel-soft);
  color: var(--brand-dark);
  box-shadow: inset 0 0 0 2px rgba(21, 94, 239, 0.08);
}

.payment-option input:focus-visible + span {
  outline: 3px solid rgba(21, 94, 239, 0.16);
}

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

.form-grid.compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.profit-preview {
  display: grid;
  gap: 4px;
  border-radius: var(--radius);
  padding: 12px;
  background: var(--panel-soft);
}

.profit-preview span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.table-panel {
  margin-top: 18px;
}

.table-wrap {
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

td.actions {
  text-align: right;
  white-space: nowrap;
}

.icon-button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  padding: 7px 9px;
}

.icon-button[data-delete],
.icon-button[data-delete-account] {
  border-color: #f0b7ad;
  background: #fff7f5;
  color: var(--danger-dark);
  font-weight: 800;
}

.icon-button[data-delete]:hover,
.icon-button[data-delete-account]:hover {
  border-color: var(--danger);
  background: #fff0ed;
}

.backup-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.backup-panel p {
  max-width: 680px;
  color: var(--muted);
}

.muted-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.admin-detail {
  display: grid;
  gap: 18px;
}

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

.admin-columns h3 {
  margin: 0 0 10px;
}

.file-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  overflow: hidden;
  border-color: var(--line);
  background: white;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: min(420px, calc(100vw - 40px));
  transform: translateY(20px);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: #10231f;
  color: white;
  box-shadow: var(--shadow);
  opacity: 0;
  transition: 160ms ease;
  pointer-events: none;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(16, 24, 40, 0.58);
}

.modal-card {
  width: min(100%, 460px);
  max-height: calc(100vh - 48px);
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  padding: 24px;
  background: white;
  box-shadow: 0 30px 90px rgba(16, 24, 40, 0.32);
}

.modal-card.large {
  width: min(100%, 880px);
}

.product-modal-card {
  width: min(100%, 720px);
}

.confirm-card {
  width: min(100%, 420px);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.modal-head h2 {
  margin: 12px 0 6px;
}

.modal-head p,
.legal-grid p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.modal-actions button {
  min-width: 112px;
}

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

.legal-grid section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: #fbfdff;
}

.legal-grid h3 {
  margin: 0 0 8px;
}

.legal-grid a {
  color: var(--brand-dark);
  font-weight: 800;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 200px minmax(0, 1fr);
  }

  .sidebar {
    padding: 18px 12px;
  }

  .brand {
    gap: 10px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
  }

  .brand strong {
    font-size: 15px;
  }

  .brand span,
  .session-box span,
  .session-box small {
    font-size: 12px;
  }

  .nav-item {
    padding: 10px 11px;
    font-size: 14px;
  }

  .content {
    padding: 22px;
  }

  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .split,
  .sales-layout,
  .closeout-grid,
  .admin-columns {
    grid-template-columns: 1fr;
  }

  .cart-panel {
    position: static;
  }

  .floating-cart {
    right: 12px;
    bottom: 12px;
    width: calc(100vw - 24px);
  }

  .floating-cart-toggle {
    width: 100%;
  }

  .floating-cart-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  body.authenticated {
    position: relative;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    overflow-x: clip;
  }

  .auth-screen {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .auth-hero h1 {
    font-size: 40px;
  }

  .app-shell {
    grid-template-columns: 1fr;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    overflow-x: clip;
  }

  .sidebar {
    position: static;
    height: auto;
    overflow: visible;
    width: 100%;
    max-width: 100vw;
  }

  .nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .monthly-products .panel-head {
    grid-template-columns: 1fr;
  }

  .closeout-tools {
    justify-content: stretch;
  }

  .month-filter,
  .month-filter input {
    width: 100%;
  }

  .product-rank-chart {
    gap: 6px;
  }

  .product-bar {
    position: relative;
    grid-template-columns: 1fr auto;
    gap: 6px 10px;
    padding: 10px 12px 10px 14px;
    overflow: hidden;
  }

  .product-bar::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: #155eef;
  }

  .product-bar.top::before {
    background: #12b76a;
  }

  .product-bar-meter {
    display: none;
  }

  .product-bar-value {
    align-self: start;
  }

  .product-bar-label strong {
    font-size: 14px;
  }

  .product-bar-label small {
    padding-left: 30px;
    font-size: 12px;
  }

  .session-box {
    margin-top: 18px;
  }

  .split,
  .sales-layout,
  .metrics-grid,
  .closeout-grid,
  .legal-grid,
  .admin-columns {
    grid-template-columns: 1fr;
  }

}

@media (max-width: 640px) {
  .content {
    width: 100%;
    max-width: 100vw;
    padding: 14px;
  }

  .panel,
  .metric {
    width: 100%;
    max-width: calc(100vw - 28px);
    padding: 14px;
  }

  .topbar,
  .backup-panel,
  .panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .scanner-strip,
  .table-tools,
  .form-grid,
  .form-grid.compact,
  .inventory-grid {
    grid-template-columns: 1fr;
  }

  .primary-button,
  .ghost-button,
  .danger-button,
  .file-button,
  .scanner-strip button {
    width: 100%;
    max-width: 100%;
  }

  .sales-day-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .sales-day-header small {
    white-space: normal;
  }

  .modal {
    align-items: stretch;
    padding: 10px;
  }

  .modal-card {
    width: 100%;
    max-height: calc(100dvh - 20px);
    padding: 18px;
  }

  .table-panel {
    overflow: hidden;
  }

  .table-wrap {
    width: 100%;
    max-width: 100%;
  }

  table {
    min-width: 680px;
  }
}
