:root {
  color-scheme: light;
  --novaro-primary: #2456E0;
  --novaro-navy: #0E1E38;
  --novaro-accent: #2BB8D9;
  --novaro-success: #1FA971;
  --novaro-warning: #D98A1F;
  --novaro-danger: #D9463E;
  --novaro-slate: #5A6B80;
  --novaro-bg: #F6F8FB;
  --novaro-bg-dark: #0B1526;
  --ink: #0E1E38;
  --muted: #5A6B80;
  --line: #dbe2ef;
  --paper: #F6F8FB;
  --panel: #ffffff;
  --teal: #2BB8D9;
  --teal-dark: #2456E0;
  --amber: #D98A1F;
  --red: #D9463E;
  --blue: #2456E0;
  --shadow: 0 16px 42px rgba(31, 42, 68, .12);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
.boot, .login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--novaro-bg-dark);
}
.boot section, .login-card {
  width: min(460px, 100%);
  background: var(--panel);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 28px;
}
.boot b, .brand b { font-size: 22px; }
.boot span { display: block; margin-top: 8px; color: var(--muted); }
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.brand-logo {
  display: block;
  width: auto;
  height: 32px;
}
.boot img {
  display: block;
  width: auto;
  height: 40px;
  margin-bottom: 10px;
}
.login-brand {
  display: grid;
  justify-items: start;
  gap: 8px;
}
.login-brand span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--novaro-primary);
  color: white;
  font-weight: 900;
}
.login-card h1 { margin: 0 0 18px; font-size: 28px; }
.form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
label { font-size: 11px; color: var(--muted); font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
input, select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  padding: 12px 13px;
  outline: none;
}
input:focus, select:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(15, 143, 134, .14); }
.error { margin: 12px 0 0; color: var(--red); font-weight: 700; }
.pos-shell { min-height: 100vh; display: grid; grid-template-rows: auto 1fr; }
.topbar {
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 5;
}
.topbar .brand { margin: 0; min-width: 142px; }
.register { width: min(220px, 22vw); }
.search { flex: 1; min-width: 220px; }
.cashier { color: var(--muted); white-space: nowrap; }
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  background: #fff7ed;
  color: var(--amber);
  border: 1px solid #f4d6aa;
  font-size: 12px;
  font-weight: 800;
}
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 410px;
  gap: 16px;
  padding: 16px;
}
.catalog, .cart-panel, .sales-panel, .scanner-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(31, 42, 68, .06);
}
.catalog { min-width: 0; padding: 14px; }
.scanner-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  margin-bottom: 12px;
  border-left: 5px solid var(--blue);
}
.scanner-panel span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.scanner-panel b { display: block; margin-top: 3px; font-size: 17px; }
.scanner-panel small { color: var(--muted); text-align: right; }
.scanner-panel.scan-ok { border-left-color: var(--teal); background: #eefbf7; }
.scanner-panel.scan-error { border-left-color: var(--red); background: #fff1f2; }
.cart-panel { position: sticky; top: 80px; align-self: start; padding: 14px; }
.section-head, .cart-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.section-head h1, .cart-head h2, .sales-panel h2 { margin: 0; font-size: 20px; }
.muted { color: var(--muted); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; }
.chip, .btn, .icon-btn {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  min-height: 38px;
  padding: 0 12px;
  font-weight: 800;
}
.chip.active { border-color: var(--teal); color: var(--teal-dark); background: #e9fbf8; }
.btn.primary { background: var(--novaro-primary); border-color: var(--novaro-primary); color: #fff; }
.btn.primary:hover { background: var(--teal-dark); }
.btn.danger { color: var(--red); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.icon-btn { width: 34px; padding: 0; display: inline-grid; place-items: center; }
.products {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.product {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 10px;
  min-height: 210px;
}
.product-top { display: grid; grid-template-columns: 54px 1fr; gap: 10px; align-items: center; min-width: 0; }
.product img {
  width: 54px;
  height: 54px;
  border-radius: 8px;
  object-fit: cover;
  background: #edf1f7;
}
.product b, .line-main b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.product small, .line-main small { display: block; color: var(--muted); margin-top: 3px; }
.product-badges { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 7px; }
.product-badges span {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  border-radius: 8px;
  background: #eef4ff;
  color: var(--blue);
  font-size: 10px;
  font-weight: 900;
}
.weight-product { border-color: #bddfd7; background: #fbfffd; }
.weighted-line { border-color: #bddfd7; background: #f6fffc; }
.unit-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.unit-actions button {
  border: 1px solid #c9d8e8;
  background: #f8fbff;
  color: var(--blue);
  border-radius: 8px;
  padding: 8px 9px;
  font-weight: 900;
}
.stock {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  font-size: 12px;
}
.stock span { padding: 8px; border-radius: 8px; background: #f4f6fa; color: var(--muted); }
.cart-lines { display: grid; gap: 8px; margin: 12px 0; max-height: 36vh; overflow: auto; }
.cart-line {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}
.qty { display: flex; align-items: center; gap: 6px; }
.qty b { min-width: 26px; text-align: center; }
.totals { display: grid; gap: 7px; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.total-row { display: flex; justify-content: space-between; gap: 10px; }
.grand { font-size: 24px; font-weight: 900; color: var(--novaro-primary); }
table, .grand, .total-row b, .sale-row b, .stock span, input {
  font-feature-settings: "tnum";
}
.pay-box { display: grid; gap: 10px; margin-top: 12px; }
.segmented { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.segmented button.active { border-color: var(--teal); background: #e9fbf8; color: var(--teal-dark); }
.checkout { width: 100%; min-height: 50px; margin-top: 4px; }
.sales-panel { margin-top: 16px; padding: 14px; }
.sales-list { display: grid; gap: 8px; max-height: 260px; overflow: auto; }
.sale-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}
.empty { padding: 18px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 8px; }
#toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: grid;
  gap: 8px;
  z-index: 20;
}
.toast {
  background: #172033;
  color: #fff;
  padding: 12px 14px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  max-width: min(360px, calc(100vw - 36px));
}
.toast.error { background: var(--red); color: #fff; }

@media (max-width: 980px) {
  .topbar { flex-wrap: wrap; }
  .register, .search { width: auto; flex: 1 1 240px; }
  .workspace { grid-template-columns: 1fr; }
  .cart-panel { position: static; }
  .scanner-panel { align-items: flex-start; flex-direction: column; }
  .scanner-panel small { text-align: left; }
}

@media print {
  body { background: #fff; }
}
