:root {
  --bg: #fffaf5; --surface: #ffffff; --text: #1f1a17; --muted: #6b625c; --line: #eadfd6;
  --brand: #e8590c; --brand-ink: #ffffff; --brand-soft: #fff0e6;
  --ok: #2b8a3e; --ok-soft: #ebfbee; --warn: #a15c00; --warn-soft: #fff4d6; --err: #c92a2a; --err-soft: #fff0f0;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17130f; --surface: #221c17; --text: #f3ece6; --muted: #b0a59c; --line: #3a312a;
    --brand: #ff7a33; --brand-ink: #1a0d05; --brand-soft: #3a2416;
    --ok: #69db7c; --ok-soft: #183021; --warn: #ffc046; --warn-soft: #3a2e10; --err: #ff8787; --err-soft: #3a1818;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--brand); }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { color: var(--text); text-decoration: none; font-size: 18px; }
.brand b { color: var(--brand); }
.me { position: relative; }
.me summary { cursor: pointer; list-style: none; padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: 14px; max-width: 50vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me summary::-webkit-details-marker { display: none; }
.me .menu { position: absolute; right: 0; top: 40px; min-width: 220px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; gap: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12); }
main { max-width: 560px; margin: 0 auto; padding: 16px 16px 40px; }
main.wide { max-width: 960px; }
h1 { font-size: 22px; margin: 4px 0 12px; }
h2 { font-size: 17px; margin: 24px 0 8px; }
footer { text-align: center; color: var(--muted); font-size: 12px; padding: 24px 16px; }
.back { display: inline-block; margin-bottom: 4px; text-decoration: none; font-size: 15px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin: 12px 0; }
.stack { display: grid; gap: 14px; }
.grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .grid { grid-template-columns: 1fr 1fr; } .grid .full { grid-column: 1 / -1; } }
.field { display: grid; gap: 6px; }
.field > span { font-weight: 600; font-size: 14px; }
.field small { color: var(--muted); font-size: 13px; }
.field.warn input, .field.warn select { border-color: var(--warn); background: var(--warn-soft); }
input, select, textarea { width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px; min-height: 46px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; padding: 10px 16px; font: inherit; font-weight: 600;
  border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); text-decoration: none; cursor: pointer; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
button.link { background: none; border: 0; padding: 0; color: var(--brand); font: inherit; cursor: pointer; text-align: left; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 12px; }
.filters { display: grid; gap: 8px; grid-template-columns: 1fr; margin-bottom: 8px; }
@media (min-width: 720px) { .filters { grid-template-columns: 2fr 1fr 1fr auto; } }
.flash { border-radius: 12px; padding: 12px 14px; margin: 10px 0; border: 1px solid transparent; }
.flash ul { margin: 6px 0 0; padding-left: 20px; }
.flash.ok { background: var(--ok-soft); border-color: var(--ok); }
.flash.warn { background: var(--warn-soft); border-color: var(--warn); }
.flash.error { background: var(--err-soft); border-color: var(--err); }
.pin { font-size: 22px; letter-spacing: 3px; }
.warn-text { color: var(--warn); }
.error-text { color: var(--err); }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--line); color: var(--muted); }
.list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface); }
.list li { border-top: 1px solid var(--line); padding: 12px 14px; }
.list li:first-child { border-top: 0; }
.list li a { display: block; color: inherit; text-decoration: none; margin: -12px -14px; padding: 12px 14px; }
.list li.inactive { opacity: .6; }
.row1 { overflow-wrap: anywhere; }
.row2 { font-size: 14px; margin-top: 2px; overflow-wrap: anywhere; }
.empty { padding: 20px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 14px; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { display: flex; flex-direction: column; justify-content: center; min-height: 92px; padding: 14px; border-radius: 14px; background: var(--surface);
  border: 1px solid var(--line); color: var(--text); text-decoration: none; font-weight: 600; }
a.tile { border-color: var(--brand); background: var(--brand-soft); }
.tile.soon { color: var(--muted); }
.tile small { font-weight: 400; font-size: 12px; margin-top: 4px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; }
.stats div { background: var(--bg); border-radius: 10px; padding: 10px; text-align: center; }
.stats b { display: block; font-size: 22px; }
.stats span { font-size: 13px; color: var(--muted); }
.ok-text { color: var(--ok); }
.small { font-size: 13px; }
.big { font-size: 24px; font-weight: 700; margin: 4px 0; }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
a.tile.hot { border-color: var(--warn); background: var(--warn-soft); }
.tiles.small .tile { min-height: 60px; font-weight: 500; }
.filters.one { grid-template-columns: 1fr; }
.lines { display: grid; gap: 10px; }
.line { display: grid; gap: 6px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.line-qty { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.line-qty input[name="price[]"] { grid-column: 1 / -1; }
.remove-line { justify-self: end; font-size: 14px; }
.with-unit { display: flex; align-items: center; gap: 8px; }
.with-unit input { flex: 1; min-width: 0; }
.with-unit > span { color: var(--muted); font-size: 14px; white-space: nowrap; }
select.mini { min-height: 40px; padding: 6px; width: auto; }
.count-row { display: grid; gap: 8px; }
@media (min-width: 560px) { .count-row { grid-template-columns: 1fr 200px; align-items: center; } }
.list li.needs { background: var(--warn-soft); }
.check { display: flex; gap: 10px; align-items: flex-start; }
.check input { width: 22px; min-height: 22px; margin-top: 2px; }
.plain { margin: 8px 0 0; padding-left: 18px; }
img.nota { max-width: 100%; border-radius: 10px; border: 1px solid var(--line); margin-top: 8px; }
.flow-list { margin: 8px 0; padding-left: 20px; display: grid; gap: 4px; }
.guide ol { padding-left: 20px; margin: 8px 0; }
.guide h2 { margin-top: 0; }
