:root {
  color-scheme: light;
  font: 16px/1.5 "Segoe UI", system-ui, sans-serif;
  color: #131922;
  background: #fff;
  --blue: #184dc6;
  --pale: #f0f6ff;
  --line: #dbe5f3;
  --muted: #506078;
}
*, *::before, *::after { box-sizing: border-box; }
body, h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); letter-spacing: -.045em; line-height: 1.12; }
h2 { font-size: 1.125rem; letter-spacing: -.015em; }
button, input, select { font: inherit; }
button, input, select { border: 1px solid #cbd9ed; border-radius: 8px; padding: .55rem .75rem; }
input, select { background: white; color: inherit; min-width: 0; }
button { cursor: pointer; font-weight: 600; background: white; color: inherit; }
button:hover:not(:disabled) { border-color: var(--blue); }
button:disabled { opacity: .48; cursor: not-allowed; }
:focus-visible { outline: 3px solid #477bef; outline-offset: 2px; }
.primary { background: var(--blue); border-color: var(--blue); color: white; }
.danger, .loss, .form-error, #login-error { color: #a91b28; }
.profit { color: #107044; }
.muted, small { color: var(--muted); }
.login { display: grid; min-height: 100dvh; place-items: center; padding: 1rem; background: var(--pale); }
.login-card { width: min(100%, 420px); padding: clamp(1.25rem, 5vw, 2.5rem); background: white; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 12px 40px #183d7810; }
.login h1 { margin: 2rem 0 1.25rem; }
.login button { width: 100%; }
.brand { display: flex; align-items: center; gap: .7rem; font-size: 1.25rem; font-weight: 750; letter-spacing: -.035em; }
.brand span { display: grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: 9px; background: var(--blue); color: white; }
.shell { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: 100dvh; }
aside { display: flex; flex-direction: column; gap: 2rem; background: #f7faff; border-right: 1px solid var(--line); padding: 1.4rem 1rem; }
aside .brand { padding-inline: .35rem; }
nav { display: grid; gap: .25rem; }
nav button { text-align: left; background: transparent; border-color: transparent; }
nav button span { display: inline-block; width: 1.5rem; color: #285dc7; }
nav .active { background: #e1ecff; color: #123e9f; }
.nav-group { margin: .8rem .75rem .15rem; font-size: .875rem; color: var(--muted); font-weight: 650; }
.profile { display: grid; justify-items: start; gap: .25rem; border-top: 1px solid var(--line); padding: 1rem .35rem 0; margin-top: auto; }
.profile button { margin-top: .5rem; }
.workspace { padding: clamp(1rem, 3vw, 2.5rem); min-width: 0; }
header, .toolbar, .pagination, .cart-line, .total { display: flex; justify-content: space-between; align-items: center; gap: .75rem; }
header { margin-bottom: 1.5rem; }
.eyebrow { font-size: .875rem; font-weight: 700; color: #335690; letter-spacing: .065em; margin-bottom: .25rem; }
.date { background: var(--pale); border: 1px solid var(--line); border-radius: 8px; padding: .45rem .7rem; white-space: nowrap; }
.metrics, .dashboard-grid, .sell-grid { display: grid; gap: 1rem; margin-bottom: 1rem; }
.metrics { grid-template-columns: repeat(auto-fit, minmax(min(100%, 245px), 1fr)); }
.dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sell-grid { grid-template-columns: minmax(0, 1fr) minmax(265px, 320px); align-items: start; }
.panel, .metric { border: 1px solid var(--line); border-radius: 12px; padding: 1rem; min-width: 0; }
.metric { background: var(--pale); display: grid; gap: .4rem; }
.metric strong { font-size: clamp(1.25rem, 2vw, 1.7rem); letter-spacing: -.03em; overflow-wrap: anywhere; }
.metric p, .pagination { font-size: .875rem; color: var(--muted); }
.bar { display: grid; grid-template-columns: 1fr auto; margin-top: .75rem; gap: .1rem .75rem; }
meter { grid-column: span 2; width: 100%; height: 1rem; }
meter::-webkit-meter-optimum-value { background: #3975de; }
meter::-moz-meter-bar { background: #3975de; }
.toolbar { flex-wrap: wrap; margin-bottom: 1rem; }
.toolbar input { flex: 1; min-width: min(100%, 180px); max-width: 350px; }
.table-scroll { overflow-x: auto; margin-top: .55rem; }
table { border-collapse: collapse; width: 100%; text-align: left; }
th, td { padding: .62rem .55rem; border-bottom: 1px solid var(--line); }
th { background: var(--pale); font-size: .875rem; white-space: nowrap; }
.empty { color: var(--muted); text-align: center; padding: 1.5rem .5rem; }
.product { width: 38px; height: 38px; border-radius: 6px; object-fit: cover; vertical-align: middle; }
.placeholder { display: inline-grid; place-items: center; background: var(--pale); color: #526a91; }
.icon-button { padding: .3rem .55rem; }
.pagination { justify-content: center; margin-top: 1rem; flex-wrap: wrap; }
.cart { background: var(--pale); position: sticky; top: 1rem; }
.cart h2 { margin-bottom: .65rem; }
.cart-line { border-bottom: 1px solid var(--line); padding: .65rem 0; }
.cart-line small { display: block; }
.quantity, .actions, .methods { display: flex; align-items: center; gap: .5rem; }
.quantity button { padding: .25rem .5rem; }
.total { padding-top: .6rem; margin-top: .6rem; border-top: 1px solid var(--line); }
form, label, fieldset { display: grid; gap: .6rem; }
label { gap: .25rem; font-weight: 600; }
form { gap: .8rem; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { padding: .6rem 0 .3rem; font-weight: 650; }
.methods label, .check { display: flex; align-items: center; gap: .3rem; }
.cash { background: #141922; color: white; width: 100%; }
dialog { border: 1px solid var(--line); border-radius: 12px; width: min(calc(100% - 2rem), 525px); padding: 1.4rem; color: inherit; }
dialog h2 { margin-bottom: .8rem; }
dialog::backdrop { background: #0d234e60; }
dialog .actions { justify-content: flex-end; flex-wrap: wrap; }
#receipt dl { display: grid; grid-template-columns: 1fr auto; gap: .3rem; font-weight: 650; }
#receipt dd { margin: 0; text-align: right; }
#notice { position: fixed; right: 1rem; bottom: 1rem; display: none; max-width: min(420px, calc(100% - 2rem)); border-radius: 8px; padding: .75rem 1rem; background: #183567; color: white; }
#notice.shown { display: block; }
#notice.error { background: #a91b28; }
@media (max-width: 940px) {
  .sell-grid { grid-template-columns: minmax(0, 1fr); }
  .cart { position: static; }
}
@media (max-width: 670px) {
  .shell, .dashboard-grid { grid-template-columns: minmax(0, 1fr); }
  aside { gap: .65rem; border-right: 0; border-bottom: 1px solid var(--line); }
  nav { display: flex; flex-wrap: wrap; }
  .nav-group { display: none; }
  .profile { display: flex; align-items: center; gap: .65rem; flex-wrap: wrap; }
  .profile button { margin-top: 0; }
}
@media print {
  #app, #notice, .receipt-actions { display: none !important; }
  dialog[open] { position: static; border: 0; width: 100%; max-width: none; padding: 0; margin: 0; overflow: visible; }
  dialog::backdrop { background: transparent; }
  #receipt .table-scroll { overflow: visible; }
}
