:root {
  color-scheme: light;
  --ink: #102c3c;
  --ink-soft: #284553;
  --paper: #f3f6f4;
  --surface: #ffffff;
  --line: #d8e2df;
  --muted: #657a7d;
  --teal: #087b70;
  --teal-dark: #056359;
  --copper: #cf8948;
  --amber-wash: #fff4e1;
  --danger: #b83c35;
  --danger-wash: #fff0ed;
  --success: #176b4d;
  --success-wash: #e8f5ee;
  --shadow: 0 16px 40px rgb(16 44 60 / 8%);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--paper);
  color: var(--ink);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--paper); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 3px solid #e2a44e;
  outline-offset: 2px;
}
button:disabled { cursor: not-allowed; opacity: .48; }
.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-shell { min-height: 100vh; display: grid; grid-template-rows: 68px 1fr; }
.topbar { display: flex; align-items: center; gap: 18px; padding: 0 26px; background: var(--ink); color: #f8fbf8; box-shadow: 0 3px 14px rgb(10 35 46 / 15%); z-index: 2; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid #5bb5a4; border-radius: 10px 10px 10px 2px; color: #a9e2d4; font-size: 13px; font-weight: 800; letter-spacing: -.06em; }
.brand-name { font-weight: 750; letter-spacing: -.03em; font-size: 16px; }
.brand-caption { margin-top: 2px; color: #b4c8c9; font-size: 11px; letter-spacing: .09em; text-transform: uppercase; }
.topbar-spacer { flex: 1; }
.status-pill { display: inline-flex; align-items: center; gap: 8px; color: #d3e8df; font-size: 12px; white-space: nowrap; }
.status-dot { width: 8px; height: 8px; border-radius: 99px; background: #75d1a5; box-shadow: 0 0 0 3px rgb(117 209 165 / 15%); }
.status-pill.offline { color: #ffd6d1; }
.status-pill.offline .status-dot { background: #ef7a69; box-shadow: 0 0 0 3px rgb(239 122 105 / 18%); }
.demo-chip { border: 1px solid rgb(255 255 255 / 22%); border-radius: 999px; padding: 7px 11px; color: #ffe0a8; font-size: 10px; font-weight: 800; letter-spacing: .1em; white-space: nowrap; }
.user-chip { color: #d8e8e5; font-size: 12px; white-space: nowrap; }

.workspace { display: grid; grid-template-columns: 214px minmax(0, 1fr); min-height: 0; }
.sidebar { padding: 20px 13px; border-right: 1px solid var(--line); background: #ecf2ef; }
.store-card { padding: 12px; margin-bottom: 20px; border-radius: 12px; background: #e0ebe7; }
.eyebrow { color: var(--muted); text-transform: uppercase; font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.store-card strong { display: block; margin-top: 6px; font-size: 13px; line-height: 1.35; }
.nav-list { display: grid; gap: 5px; }
.nav-button { display: flex; align-items: center; gap: 11px; min-height: 43px; width: 100%; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: #52676d; text-align: left; font-size: 13px; font-weight: 650; }
.nav-button:hover { background: #e3ece8; color: var(--ink); }
.nav-button.active { color: #fff; background: var(--teal); box-shadow: 0 5px 12px rgb(8 123 112 / 18%); }
.sidebar-foot { position: sticky; top: calc(100vh - 70px); margin: 26px 4px 0; color: #7c8d8f; font-size: 11px; line-height: 1.45; }
.main-area { min-width: 0; padding: 22px 24px 32px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin: 0 0 18px; }
.page-heading h1 { margin: 0; font-size: clamp(22px, 2.5vw, 29px); letter-spacing: -.045em; line-height: 1.1; }
.page-heading p { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.heading-actions { display: flex; align-items: center; gap: 8px; }
.panel { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 13px; box-shadow: var(--shadow); }
.panel-pad { padding: 18px; }
.panel-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 14px; font-size: 14px; font-weight: 800; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-variant-numeric: tabular-nums; }

.button { display: inline-flex; justify-content: center; align-items: center; gap: 8px; min-height: 42px; padding: 0 15px; border: 1px solid transparent; border-radius: 8px; background: var(--teal); color: #fff; font-size: 13px; font-weight: 750; transition: background .15s ease, transform .15s ease; }
.button:hover:not(:disabled) { background: var(--teal-dark); transform: translateY(-1px); }
.button.secondary { color: var(--ink); background: #fff; border-color: var(--line); }
.button.secondary:hover:not(:disabled) { background: #f4f8f6; }
.button.danger { background: var(--danger); }
.button.ghost { background: transparent; color: var(--ink-soft); border-color: var(--line); }
.button.small-button { min-height: 34px; padding: 0 10px; font-size: 12px; }
.icon-button { display: inline-grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font-size: 17px; }

.field { display: grid; gap: 6px; min-width: 0; }
.field label { color: #415a61; font-size: 12px; font-weight: 750; }
.field input, .field select, .field textarea, .search-input { width: 100%; min-height: 42px; padding: 10px 12px; border: 1px solid #c9d7d3; border-radius: 8px; background: #fff; color: var(--ink); font-size: 14px; }
.field textarea { resize: vertical; min-height: 78px; }
.field-help { color: var(--muted); font-size: 11px; line-height: 1.45; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 8px; }
.form-note { margin: 0 0 10px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.csv-issues { display: grid; gap: 6px; margin: 0; padding-left: 22px; color: var(--danger); font-size: 12px; }
.purchase-line { padding: 12px 0; border-bottom: 1px solid var(--line); }

.pos-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(370px, .9fr); gap: 18px; align-items: start; }
.catalog-panel, .ticket-panel { min-width: 0; }
.scan-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 9px; margin: 12px 0 10px; }
.scan-input-wrap { position: relative; }
.scan-input { width: 100%; height: 52px; padding: 0 14px 0 44px; border: 1px solid #bfd4ce; border-radius: 10px; background: #fbfdfb; color: var(--ink); font-size: 15px; box-shadow: inset 0 1px 2px rgb(16 44 60 / 3%); }
.scan-icon { position: absolute; left: 15px; top: 16px; color: var(--teal); font-size: 17px; }
.scan-hint { margin: 0 2px 12px; color: var(--muted); font-size: 11px; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 9px; max-height: calc(100vh - 310px); overflow: auto; padding: 1px 2px 2px 1px; }
.product-card { min-height: 100px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); text-align: left; transition: border .12s ease, transform .12s ease; }
.product-card:hover { border-color: #6caea2; transform: translateY(-2px); }
.product-card-name { min-height: 34px; font-size: 13px; font-weight: 750; line-height: 1.3; }
.product-card-barcode { margin-top: 7px; color: var(--muted); font-size: 10px; }
.product-card-bottom { display: flex; align-items: end; justify-content: space-between; gap: 8px; margin-top: 11px; }
.product-card-price { color: var(--teal-dark); font-size: 16px; font-weight: 850; font-variant-numeric: tabular-nums; }
.stock-tag { color: #728386; font: 10px ui-monospace, SFMono-Regular, Consolas, monospace; }
.suggestion-list { position: absolute; z-index: 5; inset: 54px 0 auto; display: grid; gap: 2px; padding: 5px; border: 1px solid var(--line); border-radius: 9px; background: #fff; box-shadow: var(--shadow); }
.suggestion-list[hidden] { display: none; }
.suggestion { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 43px; padding: 7px 9px; border: 0; border-radius: 6px; background: #fff; text-align: left; }
.suggestion:hover { background: #edf6f2; }

.ticket-panel { overflow: hidden; }
.ticket-head { padding: 17px 18px; border-bottom: 1px solid var(--line); }
.ticket-head-row { display: flex; align-items: center; justify-content: space-between; }
.ticket-head h2 { margin: 0; font-size: 14px; }
.ticket-number { color: var(--muted); font: 11px ui-monospace, SFMono-Regular, Consolas, monospace; }
.ticket-body { padding: 10px 18px; }
.cart-empty { display: grid; place-items: center; min-height: 155px; color: var(--muted); text-align: center; font-size: 13px; }
.cart-empty-mark { display: grid; place-items: center; width: 42px; height: 42px; margin-bottom: 10px; border-radius: 12px; background: #e8f1ed; color: var(--teal); font-size: 18px; }
.cart-line { display: grid; grid-template-columns: minmax(0,1fr) 82px auto; gap: 8px; align-items: center; padding: 12px 0; border-bottom: 1px solid #edf1ef; }
.cart-line-name { font-size: 12px; font-weight: 750; }
.cart-line-meta { margin-top: 4px; color: var(--muted); font-size: 10px; }
.qty-control { display: flex; align-items: center; gap: 3px; }
.qty-control button { width: 26px; height: 30px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); }
.qty-value { min-width: 23px; text-align: center; font-size: 12px; font-weight: 700; }
.cart-line-total { text-align: right; font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; }
.cart-line-remove { grid-column: 1 / -1; justify-self: end; border: 0; padding: 2px 0; background: transparent; color: var(--danger); font-size: 10px; }
.ticket-totals { display: grid; gap: 9px; padding: 13px 18px; border-top: 1px solid var(--line); }
.total-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; color: var(--muted); font-size: 12px; }
.total-row strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.total-row.grand { margin-top: 3px; padding: 12px; border-radius: 8px; background: #edf7f3; color: var(--ink); font-weight: 800; }
.total-row.grand strong { color: var(--teal-dark); font-size: 24px; letter-spacing: -.04em; }
.payment-box { display: grid; gap: 11px; padding: 15px 18px 18px; border-top: 1px solid var(--line); background: #fbfcfb; }
.payment-grid { display: grid; grid-template-columns: minmax(0,1fr) 115px; gap: 10px; }
.checkout-note { padding: 9px 10px; border-radius: 7px; background: var(--amber-wash); color: #75501e; font-size: 11px; line-height: 1.4; }
.checkout-button { width: 100%; min-height: 50px; font-size: 15px; }
.external-payments { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 10px; }
.external-payments span { padding: 5px 8px; border: 1px dashed #cbd8d4; border-radius: 6px; }

.callout { display: flex; align-items: flex-start; gap: 11px; padding: 13px 14px; border: 1px solid #edd7ad; border-radius: 10px; background: var(--amber-wash); color: #6b4f27; font-size: 12px; line-height: 1.5; }
.callout.success { border-color: #c8e4d4; background: var(--success-wash); color: #285d43; }
.callout.danger { border-color: #efc4bf; background: var(--danger-wash); color: #7d2d2a; }
.stack { display: grid; gap: 14px; }
.stack > * { min-width: 0; }
.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
.metric { padding: 15px 16px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
.metric-label { color: var(--muted); font-size: 11px; font-weight: 700; }
.metric-value { margin-top: 9px; font-size: 22px; font-weight: 850; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { padding: 11px 12px; border-bottom: 1px solid var(--line); color: var(--muted); text-align: left; font-size: 10px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid #edf1ef; vertical-align: middle; }
tbody tr:hover { background: #fafcfb; }
.status-tag { display: inline-flex; padding: 4px 7px; border-radius: 999px; background: #e9f4ef; color: #1f674b; font-size: 10px; font-weight: 750; }
.empty-state { padding: 32px 14px; color: var(--muted); text-align: center; font-size: 13px; }
.cash-session-card { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 15px; padding: 15px 17px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.cash-session-card strong { display: block; margin-bottom: 4px; font-size: 13px; }
.cash-session-meta { color: var(--muted); font-size: 11px; }

.auth-screen { display: grid; min-height: 100vh; grid-template-columns: minmax(0,1fr) minmax(320px, .78fr); background: var(--paper); }
.auth-aside { display: flex; flex-direction: column; justify-content: space-between; min-height: 100vh; padding: clamp(28px, 5vw, 70px); background: var(--ink); color: #eff8f4; position: relative; overflow: hidden; }
.auth-aside::after { content: ""; position: absolute; right: -120px; bottom: -180px; width: 430px; height: 430px; border: 1px solid rgb(117 209 165 / 24%); border-radius: 50%; box-shadow: 0 0 0 36px rgb(117 209 165 / 4%), 0 0 0 84px rgb(117 209 165 / 3%); }
.auth-brand { display: flex; align-items: center; gap: 12px; }
.auth-thesis { position: relative; z-index: 1; max-width: 510px; margin: auto 0; }
.auth-thesis .eyebrow { color: #8dd2bf; }
.auth-thesis h1 { margin: 16px 0; font-size: clamp(36px, 5.3vw, 68px); line-height: .98; letter-spacing: -.065em; }
.auth-thesis p { max-width: 440px; color: #bfd1d0; font-size: 15px; line-height: 1.65; }
.auth-foot { position: relative; z-index: 1; color: #9fb8b9; font-size: 11px; }
.auth-panel { display: grid; place-items: center; padding: 28px; }
.auth-card { width: min(100%, 430px); padding: clamp(23px, 4vw, 40px); border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: var(--shadow); }
.auth-card h2 { margin: 0; font-size: 24px; letter-spacing: -.04em; }
.auth-card > p { margin: 8px 0 22px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.auth-form { display: grid; gap: 13px; }
.auth-form .button { margin-top: 5px; }
.app-footer-note { padding: 0 18px 14px; color: #89989b; font-size: 10px; text-align: center; }
.toast-region { position: fixed; right: 20px; bottom: 18px; z-index: 20; display: grid; gap: 8px; width: min(360px, calc(100vw - 40px)); }
.toast { padding: 12px 14px; border: 1px solid #d0e1da; border-radius: 9px; background: #fff; box-shadow: var(--shadow); color: var(--ink); font-size: 12px; }
.toast.error { border-color: #edc7c2; background: #fff8f6; color: #832e29; }
.modal-backdrop { position: fixed; inset: 0; z-index: 15; display: grid; place-items: center; padding: 18px; background: rgb(11 30 40 / 48%); }
.modal { width: min(100%, 490px); max-height: 90vh; overflow: auto; padding: 22px; border-radius: 14px; background: #fff; box-shadow: 0 24px 70px rgb(0 0 0 / 25%); }
.modal h2 { margin: 0 0 8px; font-size: 19px; }
.modal p { color: var(--muted); font-size: 12px; line-height: 1.5; }
.modal-form { display: grid; gap: 13px; margin-top: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 17px; }

@media (max-width: 1020px) {
  .workspace { grid-template-columns: 76px minmax(0,1fr); }
  .sidebar { padding: 14px 9px; }
  .store-card { padding: 9px 6px; text-align: center; }
  .store-card strong { display: none; }
  .nav-button { justify-content: flex-start; min-height: 39px; padding: 4px 6px; font-size: 10px; line-height: 1.2; white-space: normal; }
  .sidebar-foot { display: none; }
  .pos-grid { grid-template-columns: minmax(0,1fr) minmax(340px,.9fr); }
}
@media (max-width: 760px) {
  .app-shell { grid-template-rows: 60px 1fr; }
  .topbar { padding: 0 13px; gap: 10px; }
  .status-pill { display: none; }
  .demo-chip { padding: 6px 8px; font-size: 9px; }
  .user-chip { display: none; }
  .workspace { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .sidebar { order: 2; position: sticky; bottom: 0; z-index: 4; display: flex; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); border-right: 0; background: #fff; }
  .store-card, .sidebar-foot { display: none; }
  .nav-list { display: flex; width: 100%; justify-content: space-around; gap: 2px; }
  .nav-button { display: grid; justify-items: center; gap: 2px; min-height: 49px; padding: 4px; border-radius: 8px; font-size: 9px; }
  .main-area { order: 1; padding: 17px 12px 18px; }
  .page-heading { align-items: start; flex-direction: column; }
  .pos-grid { grid-template-columns: 1fr; }
  .ticket-panel { order: 1; }
  .catalog-panel { order: 2; }
  .product-grid { max-height: 45vh; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .metric-grid { grid-template-columns: 1fr; }
  .auth-screen { grid-template-columns: 1fr; }
  .auth-aside { min-height: 240px; padding: 22px; }
  .auth-thesis { margin: 48px 0 10px; }
  .auth-thesis h1 { font-size: 38px; }
  .auth-foot { display: none; }
  .auth-panel { align-items: start; padding: 18px 14px 28px; }
  .auth-card { margin-top: -40px; position: relative; z-index: 2; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
