:root {
  --bg: #eef3f2; --card: #ffffff; --ink: #0f1f1e; --muted: #5d706e; --line: #d3dedc;
  --brand: #0f766e; --brand-d: #0b5a54; --brand-l: #d9f0ed; --danger: #b42318; --warn: #b54708; --ok: #067647;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0c1615; --card: #142120; --ink: #e8f2f0; --muted: #94aaa7; --line: #254240; --brand: #2dd4bf; --brand-d: #5eead4; --brand-l: #12403b; --danger: #f97066; --warn: #fdb022; --ok: #47cd89; }
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--ink); font-size: 15px; }
button, input, select { font: inherit; color: inherit; }
.hidden { display: none !important; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 400px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 24px; }
.login-card h1 { margin: 0 0 4px; font-size: 22px; }
.login-card p.sub { margin: 0 0 16px; color: var(--muted); }
.tabs2 { display: flex; gap: 8px; margin-bottom: 14px; }
.tabs2 button { flex: 1; }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
input, select { width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
input:focus, select:focus { outline: 2px solid var(--brand); outline-offset: 0; }
button { cursor: pointer; border: 1px solid var(--line); background: var(--card); padding: 8px 14px; border-radius: 8px; }
button.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
@media (prefers-color-scheme: dark) { button.primary { color: #04201c; } }
button.primary:hover { background: var(--brand-d); }
button.danger { color: var(--danger); border-color: var(--danger); }
button:disabled { opacity: .55; cursor: not-allowed; }
button.small { padding: 4px 10px; font-size: 13px; }
.err { color: var(--danger); margin-top: 10px; min-height: 18px; font-size: 14px; }
.layout { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
nav.side { background: var(--card); border-right: 1px solid var(--line); padding: 16px 10px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
nav.side .brand { font-weight: 700; font-size: 17px; padding: 4px 10px 14px; color: var(--brand); }
nav.side a { display: block; padding: 9px 12px; border-radius: 8px; color: var(--ink); text-decoration: none; margin-bottom: 2px; cursor: pointer; }
nav.side a:hover { background: var(--brand-l); }
nav.side a.on { background: var(--brand); color: #fff; }
@media (prefers-color-scheme: dark) { nav.side a.on { color: #04201c; } }
main { padding: 20px; max-width: 1100px; width: 100%; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 10px; flex-wrap: wrap; }
.topbar h2 { margin: 0; font-size: 22px; }
.who { color: var(--muted); font-size: 13px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.card h3 { margin: 0 0 10px; font-size: 16px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.stat .k { color: var(--muted); font-size: 13px; }
.stat .v { font-size: 22px; font-weight: 700; margin-top: 4px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1 1 140px; }
.row > button { flex: 0 0 auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 14px; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
.tablewrap { overflow-x: auto; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; background: var(--brand-l); color: var(--brand-d); }
.pill.warn { background: #fef0c7; color: var(--warn); }
.pill.bad { background: #fee4e2; color: var(--danger); }
.muted { color: var(--muted); }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; z-index: 50; max-width: 90vw; }
.toast.bad { background: var(--danger); color: #fff; }
.cart-total { font-size: 20px; font-weight: 700; text-align: right; margin: 8px 0; }
.menu-btn { display: none; }
@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; }
  nav.side { position: fixed; z-index: 20; left: -240px; width: 220px; transition: left .2s; }
  nav.side.open { left: 0; }
  .menu-btn { display: inline-block; }
  main { padding: 14px; }
}

/* ---------- printing ---------- */
#printArea { display: none; color: #000; background: #fff; }
.pr h1 { font-size: 1.3em; margin: 0; text-align: center; }
.pr .c { text-align: center; }
.pr table { width: 100%; border-collapse: collapse; margin: 6px 0; }
.pr th, .pr td { padding: 2px 0; border: 0; border-bottom: 1px dashed #666; font-size: inherit; text-transform: none; letter-spacing: 0; color: #000; }
.pr th { text-align: left; font-weight: 700; }
.pr td.n, .pr th.n { text-align: right; }
.pr .tot td { border: 0; padding: 1px 0; }
.pr .tot tr.big td { font-weight: 700; font-size: 1.15em; border-top: 1px solid #000; }
.pr.p80 { width: 72mm; font-family: "Courier New", monospace; font-size: 12px; }
.pr.pA4 { max-width: 190mm; margin: 0 auto; font-family: system-ui, Arial, sans-serif; font-size: 14px; }
.pr.pA4 th, .pr.pA4 td { border-bottom: 1px solid #bbb; padding: 5px 4px; }
@media print {
  body > *:not(#printArea) { display: none !important; }
  #printArea { display: block; }
  body { background: #fff; }
}

.planbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--brand-l); color: var(--brand-d); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin-bottom: 14px; }
.planbar.bad { background: #fee4e2; color: var(--danger); }
