:root {
  --red: #e30613;
  --red-d: #b10510;
  --ink: #1c1917;
  --muted: #57534e;
  --line: #e7e5e4;
  --bg: #faf7f5;
  --card: #fff;
  --ok: #15803d;
  --soon: #c2410c;
  --wait: #b91c1c;
  --radius: 14px;
  --shadow: 0 8px 30px rgba(28, 25, 23, .06);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 18px/1.45 "Segoe UI", system-ui, sans-serif; }
a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .85rem 1.25rem; background: #fff; border-bottom: 3px solid var(--red);
}
.brand { display: flex; align-items: center; gap: .75rem; color: inherit; }
.brand:hover { text-decoration: none; }
.brand strong, .brand em { display: block; }
.brand strong { font-size: .95rem; }
.brand em { font-style: normal; color: var(--muted); font-size: .8rem; }
.nav { display: flex; align-items: center; gap: .85rem; font-size: .95rem; }
.who { color: var(--muted); }
.wrap { max-width: 720px; margin: 1.5rem auto 4rem; padding: 0 1rem; }
.wrap.wide { max-width: 1080px; }
h1 { font-size: 1.7rem; margin: 0 0 .4rem; letter-spacing: -.02em; }
h2 { font-size: 1.1rem; margin: 0 0 .8rem; }
.lead, .muted { color: var(--muted); }
.lead { margin-top: 0; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.25rem; margin: 1rem 0; box-shadow: var(--shadow);
}
.card.hot { border-color: var(--red); background: #fff5f5; }
.stack { display: grid; gap: .9rem; }
.stack label, .filters label { display: grid; gap: .35rem; font-weight: 600; font-size: .95rem; }
input, select, button, .btn {
  font: inherit; border-radius: 10px;
}
input, select {
  border: 1px solid #d6d3d1; padding: .7rem .8rem; background: #fff; width: 100%;
}
input:focus, select:focus { outline: 3px solid #fecaca; border-color: var(--red); }
.btn, button.btn {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--red); color: #fff; border: 0; padding: .85rem 1.2rem;
  font-weight: 700; cursor: pointer; min-height: 48px;
}
.btn:hover { background: var(--red-d); text-decoration: none; }
.btn.secondary { background: #fff; color: var(--red); border: 2px solid var(--red); }
.btn.ghost, .ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.compact { min-height: 40px; padding: .45rem .8rem; font-size: .95rem; }
button.link { background: none; border: 0; color: var(--red); cursor: pointer; font: inherit; padding: 0; }
.row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; }
.row.spread { justify-content: space-between; }
.hero input[type=search] {
  font-size: 1.35rem; padding: 1rem 1.1rem; border-radius: 16px; border: 2px solid #d6d3d1;
}
.results { margin: .6rem 0 1.2rem; }
.results ul { list-style: none; margin: 0; padding: 0; background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.results a { display: flex; justify-content: space-between; padding: .85rem 1rem; color: inherit; border-bottom: 1px solid var(--line); }
.results a:hover { background: #fff1f2; text-decoration: none; }
.flash { padding: .8rem 1rem; border-radius: 10px; margin: 0 0 1rem; }
.flash.ok { background: #dcfce7; }
.flash.error, .flash.warn { background: #ffedd5; }
.flash.error { background: #fee2e2; }
.auth { max-width: 420px; margin: 2rem auto; }
.auth .btn { width: 100%; }
.otp { letter-spacing: .4em; font-size: 1.6rem; text-align: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.tile { cursor: pointer; }
.tile input { position: absolute; opacity: 0; pointer-events: none; }
.tile span {
  display: flex; align-items: center; justify-content: center; text-align: center;
  min-height: 110px; padding: 1rem; border: 3px solid var(--line); border-radius: 16px;
  font-weight: 800; font-size: 1.15rem; background: #fff;
}
.tile input:focus-visible + span { outline: 3px solid #fecaca; }
.tile input:checked + span { border-color: var(--red); background: #fff1f2; color: var(--red); }
.lbl { font-weight: 600; margin: .2rem 0 0; }
.suffix { display: flex; align-items: center; gap: .5rem; }
.suffix em { color: var(--muted); font-style: normal; font-weight: 700; }
.hint { padding: .6rem .8rem; border-radius: 8px; background: #f5f5f4; }
.hint.warn { background: #ffedd5; }
.crumb { color: var(--muted); }
.person { margin-bottom: 1rem; }
.products { list-style: none; padding: 0; margin: 0; display: grid; gap: .8rem; }
.prod { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 1rem; }
.prod-head { display: flex; align-items: center; gap: .55rem; font-size: 1.15rem; }
.dot { width: 14px; height: 14px; border-radius: 50%; display: inline-block; background: var(--ok); box-shadow: 0 0 0 3px #dcfce7; }
.prod.soon .dot { background: var(--soon); box-shadow: 0 0 0 3px #ffedd5; }
.prod.wait .dot { background: var(--wait); box-shadow: 0 0 0 3px #fee2e2; }
.prod .ok { color: var(--ok); }
.prod .warn { color: var(--soon); }
.prod .error { color: var(--wait); }
.donate { display: flex; gap: .5rem; align-items: center; margin-top: .4rem; }
.donate input { width: 5.5rem; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: .55rem .4rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.edit { table-layout: fixed; }
table.edit:not(.accounts) th:nth-child(1), table.edit:not(.accounts) td:nth-child(1) { width: 22%; }
table.edit:not(.accounts) th:nth-child(2),
table.edit:not(.accounts) th:nth-child(3),
table.edit:not(.accounts) th:nth-child(4),
table.edit:not(.accounts) th:nth-child(5),
table.edit:not(.accounts) td:nth-child(2),
table.edit:not(.accounts) td:nth-child(3),
table.edit:not(.accounts) td:nth-child(4),
table.edit:not(.accounts) td:nth-child(5) { width: 12%; }
table.edit:not(.accounts) th:nth-child(6), table.edit:not(.accounts) td:nth-child(6) { width: 9%; }
table.edit:not(.accounts) th:nth-child(7), table.edit:not(.accounts) td:nth-child(7) { width: 11%; }
table.edit input:not([type=checkbox]), table.edit select { width: 100%; min-width: 0; max-width: none; }
table.edit.accounts th:nth-child(1), table.edit.accounts td:nth-child(1),
table.edit.accounts th:nth-child(2), table.edit.accounts td:nth-child(2) { width: 20%; }
table.edit.accounts th:nth-child(3), table.edit.accounts td:nth-child(3) { width: 16%; }
table.edit.accounts th:nth-child(4), table.edit.accounts td:nth-child(4) { width: 18%; }
table.edit.accounts th:nth-child(5), table.edit.accounts td:nth-child(5) { width: 10%; }
table.edit.accounts th:nth-child(6), table.edit.accounts td:nth-child(6) { width: 10%; }
tr.off { opacity: .55; }
.product-add {
  display: grid;
  grid-template-columns: 2fr repeat(3, minmax(0, 1fr)) auto;
  gap: 1rem 1.25rem;
  align-items: end;
}
.product-add label { min-width: 0; display: grid; gap: .35rem; font-weight: 600; font-size: .95rem; }
.subnav { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.subnav a { padding: .45rem .8rem; border-radius: 999px; color: var(--ink); background: #fff; border: 1px solid var(--line); }
.subnav a.on, .subnav a:hover { background: var(--red); color: #fff; text-decoration: none; border-color: var(--red); }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; margin: 1rem 0; }
.kpis article {
  display: flex; flex-direction: column; gap: .35rem;
  background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 1rem 1.1rem 1.15rem;
}
.kpis em { display: block; color: var(--muted); font-style: normal; font-size: .8rem; letter-spacing: .02em; }
.kpis strong { display: block; font-size: 2rem; line-height: 1.1; letter-spacing: -.03em; }
.kpis span { display: block; color: var(--muted); font-size: .9rem; }
.kpis .hot { border-color: var(--red); }
.bars { display: flex; align-items: flex-end; gap: .5rem; height: 140px; }
.bars > div { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: .25rem; height: 100%; }
.bars i { display: block; width: 100%; background: var(--red); border-radius: 6px 6px 0 0; min-height: 8px; }
.bars span, .bars b { font-size: .75rem; color: var(--muted); }
.legend { list-style: none; padding: 0; margin: 0; }
.legend li { display: flex; justify-content: space-between; padding: .4rem 0; border-bottom: 1px solid var(--line); }
.filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem 1.25rem;
  align-items: end;
  margin: 1rem 0 1.5rem;
}
.filters label { min-width: 0; }
.filters input, .filters select { min-width: 0; max-width: 100%; }
.filters .grow { grid-column: span 2; }
.filters-actions { min-width: 0; }
.filters-actions .btn { width: 100%; }
.inline { display: flex; gap: .4rem; align-items: center; }
.inline input { width: auto; max-width: 8rem; }
.inline.wrap { flex-wrap: wrap; }
.inline.wrap input { max-width: 9rem; }
tr.low { background: #fff1f2; }
.tag { background: #ffedd5; color: var(--soon); font-size: .75rem; padding: .1rem .4rem; border-radius: 6px; }
.mt { margin-top: 1rem; }
.chk { font-weight: 500; display: flex; align-items: center; gap: .3rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.sr-form { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
dialog.modal { border: 0; border-radius: 16px; padding: 1.4rem; width: min(420px, 92vw); box-shadow: var(--shadow); }
dialog.modal::backdrop { background: rgba(28, 25, 23, .45); }
@media (max-width: 900px) {
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters .grow { grid-column: span 2; }
  .product-add { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .grid2, .tiles, .kpis { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .nav .who { display: none; }
  .filters, .product-add { grid-template-columns: 1fr; }
  .filters .grow { grid-column: auto; }
}
