:root {
  --cream: #FBF6EC;
  --paper: #FFFFFF;
  --crust: #8B4A1F;
  --crust-dark: #5E2F12;
  --gold: #E9A23B;
  --ink: #2B2118;
  --muted: #7A6A5A;
  --line: #EADFCB;
  --ok: #3E7C4A;
  --off: #A39584;
  --danger: #B3362B;
  --r: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--cream); }
button, input, select { font: inherit; color: inherit; }

.top { display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 20px; background: var(--crust-dark); color: #fff; }
.brand { display: flex; align-items: center; gap: 10px; }
.logo { width: 40px; height: 40px; }
.brand .name { font-size: 22px; font-weight: 800; letter-spacing: .2px; }
.brand .name span { color: var(--gold); }
.brand .tag { font-size: 12.5px; opacity: .8; }
.top .right { display: flex; align-items: center; gap: 14px; }
.bakery { font-size: 13px; opacity: .85; }
.lang { display: flex; border: 1px solid rgba(255,255,255,.35); border-radius: 8px; overflow: hidden; }
.lang button { background: none; border: 0; padding: 5px 10px; cursor: pointer; color: #fff; font-weight: 600; font-size: 13px; }
.lang button.on { background: var(--gold); color: var(--crust-dark); }

.tabs { display: flex; gap: 4px; padding: 0 20px; background: var(--crust); }
.tabs button { background: none; border: 0; color: #F3D9A4; padding: 11px 14px; cursor: pointer; font-weight: 600;
  border-bottom: 3px solid transparent; }
.tabs button.on { color: #fff; border-bottom-color: var(--gold); }

main { max-width: 1180px; margin: 0 auto; padding: 18px 20px 60px; }
h2 { margin: 6px 0 14px; font-size: 19px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar input[type=search] { flex: 1 1 240px; }
input, select { border: 1px solid var(--line); background: var(--paper); border-radius: 8px; padding: 8px 10px; min-height: 38px; }
input:focus, select:focus { outline: 2px solid var(--gold); outline-offset: 0; border-color: var(--gold); }
.chk { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; }
.chk input { min-height: 0; width: 17px; height: 17px; accent-color: var(--crust); }
.count { color: var(--muted); font-size: 13px; margin-left: auto; }

button { border: 1px solid var(--line); background: var(--paper); border-radius: 8px; padding: 8px 14px; cursor: pointer; min-height: 38px; }
button:hover { border-color: var(--crust); }
button.primary { background: var(--crust); border-color: var(--crust); color: #fff; font-weight: 600; }
button.primary:hover { background: var(--crust-dark); }
button.danger { background: var(--danger); border-color: var(--danger); color: #fff; font-weight: 600; }
button.link { border: 0; background: none; padding: 4px 6px; min-height: 0; color: var(--crust); font-weight: 600; }
button.link.red { color: var(--danger); }

/* Terméktáblázat */
table { width: 100%; border-collapse: collapse; background: var(--paper); border-radius: var(--r); overflow: hidden;
  box-shadow: 0 1px 0 var(--line), 0 0 0 1px var(--line); }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); background: #FDF9F1; }
tr.cat-row td { background: #F6EBD6; font-weight: 700; color: var(--crust-dark); font-size: 13px; padding: 7px 12px; }
tr.inactive td { color: var(--off); }
td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
th.num { text-align: right; }
.sku { font-family: ui-monospace, Consolas, monospace; font-size: 13px; color: var(--muted); }
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; }
.pill.on { background: #E3F0E4; color: var(--ok); }
.pill.off { background: #EEE8E0; color: var(--off); }
.pill.sl { background: #FCEBCB; color: var(--crust); }
td.acts { white-space: nowrap; text-align: right; }
.empty { padding: 30px; text-align: center; color: var(--muted); background: var(--paper); border-radius: var(--r); }

/* Egyszerű listák */
.simple { max-width: 560px; background: var(--paper); border-radius: var(--r); box-shadow: 0 0 0 1px var(--line); }
.simple .row { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.simple .row input { flex: 1; }
.simple .row .meta { font-size: 12px; color: var(--muted); white-space: nowrap; }
.simple .row.add { border-bottom: 0; background: #FDF9F1; border-radius: 0 0 var(--r) var(--r); }

/* Dialógus */
dialog { border: 0; border-radius: 14px; padding: 22px; width: min(560px, 94vw); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(43,33,24,.45); }
dialog h3 { margin: 0 0 16px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.grid label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.grid label.chk { flex-direction: row; color: var(--ink); font-size: 14px; }
.grid .wide { grid-column: 1 / -1; }
.grid input, .grid select { color: var(--ink); }
.grid .err input, .grid .err select { border-color: var(--danger); outline-color: var(--danger); }
.formerr { color: var(--danger); min-height: 1.2em; margin: 10px 0 0; font-size: 13px; }
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

#toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(20px); opacity: 0;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; transition: .2s; pointer-events: none; }
#toast.show { opacity: 1; transform: translateX(-50%); }
#toast.err { background: var(--danger); }

/* Mobil: kártyás lista */
@media (max-width: 720px) {
  .top { padding: 10px 14px; }
  .bakery { display: none; }
  .tabs { padding: 0 8px; overflow-x: auto; }
  main { padding: 14px 12px 60px; }
  .count { margin-left: 0; }
  .toolbar #btnAdd { width: 100%; }
  .toolbar select { flex: 1; }
  table, thead, tbody, tr, td { display: block; }
  thead { display: none; }
  table { background: none; box-shadow: none; }
  tr.cat-row td { background: none; padding: 14px 2px 6px; border: 0; }
  tr.prod { background: var(--paper); border-radius: var(--r); box-shadow: 0 0 0 1px var(--line); margin-bottom: 8px;
    display: grid; grid-template-columns: 1fr auto; padding: 10px 12px; gap: 2px 10px; }
  tr.prod td { border: 0; padding: 0; }
  tr.prod td.c-name { font-weight: 700; font-size: 15.5px; }
  tr.prod td.c-price { grid-column: 2; grid-row: 1; font-weight: 700; }
  tr.prod td.c-sku, tr.prod td.c-pack, tr.prod td.c-weight, tr.prod td.c-sliced { display: inline; font-size: 13px; color: var(--muted); }
  tr.prod td.c-info { grid-column: 1 / -1; font-size: 13px; color: var(--muted); }
  tr.prod td.c-status { grid-column: 1; }
  tr.prod td.acts { grid-column: 2; text-align: right; }
  .hide-m { display: none !important; }
  .grid { grid-template-columns: 1fr; }
}
@media (min-width: 721px) { .show-m { display: none !important; } }

/* Ügyfelek */
.inline { display: flex; gap: 8px; }
.inline input { flex: 1; }
.note { margin: -4px 0 0; font-size: 13px; min-height: 1em; color: var(--muted); }
.note.ok { color: var(--ok); } .note.warn { color: #9A5B00; font-weight: 600; } .note.bad { color: var(--danger); }
fieldset { border: 1px solid var(--line); border-radius: var(--r); margin: 16px 0 0; padding: 10px 14px 14px; }
legend { font-weight: 700; font-size: 13px; padding: 0 6px; color: var(--crust-dark); }
.subhead { display: flex; justify-content: space-between; align-items: center; margin: 18px 0 6px; }
.shoprows .srow { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 8px; margin-bottom: 6px; cursor: pointer; background: #FFFDF8; }
.shoprows .srow:hover { border-color: var(--crust); }
.srow .sname { font-weight: 600; } .srow .saddr { font-size: 12.5px; color: var(--muted); }
.srow .grow { flex: 1; min-width: 0; }
.chip { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 99px; background: #F3E6CF;
  color: var(--crust-dark); margin: 2px 4px 2px 0; white-space: nowrap; }
.chip.none { background: #F6DCD8; color: var(--danger); }
.sub { display: block; font-size: 12.5px; color: var(--muted); }
#cdlg { width: min(680px, 96vw); }

/* Útvonal tábla */
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; align-items: start; }
.rcard { background: var(--paper); border-radius: var(--r); box-shadow: 0 0 0 1px var(--line); overflow: hidden; }
.rcard.unas { box-shadow: 0 0 0 1px #E8C4BE; }
.rhead { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; background: #F6EBD6; }
.rcard.unas .rhead { background: #FBEDEA; }
.rhead .rnum { width: 30px; height: 30px; border-radius: 50%; background: var(--crust); color: #fff; font-weight: 800;
  display: grid; place-items: center; flex: none; }
.rhead .grow { flex: 1; min-width: 0; }
.rhead .rname { font-weight: 700; }
.rhead .rdrv { font-size: 12.5px; color: var(--muted); }
.stops { list-style: none; margin: 0; padding: 6px 0; }
.stops li { display: flex; align-items: center; gap: 8px; padding: 7px 10px 7px 14px; border-bottom: 1px dashed var(--line); }
.stops li:last-child { border-bottom: 0; }
.stops .n { width: 22px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; flex: none; }
.stops .grow { flex: 1; min-width: 0; }
.stops .s1 { font-weight: 600; font-size: 14px; }
.stops .s2 { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ib { border: 1px solid var(--line); background: #fff; width: 28px; height: 28px; min-height: 0; padding: 0; border-radius: 6px;
  font-size: 13px; line-height: 1; color: var(--crust-dark); }
.ib:disabled { opacity: .3; cursor: default; }
.rfoot { padding: 8px 12px 12px; }
.rfoot select { width: 100%; }
.rempty { padding: 12px 14px; color: var(--muted); font-size: 13px; }

/* Nézetváltó (demo) */
.viewas { display: flex; align-items: center; gap: 6px; font-size: 12.5px; opacity: .95; }
.viewas select { min-height: 32px; padding: 4px 8px; font-size: 13px; max-width: 220px; background: #fff; color: var(--ink); }

/* Napválasztó */
.daychips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.dchip { display: flex; flex-direction: column; align-items: center; min-width: 64px; padding: 6px 10px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--paper); cursor: pointer; min-height: 0; line-height: 1.2; }
.dchip .d1 { font-weight: 700; font-size: 13px; }
.dchip .d2 { font-size: 12px; color: var(--muted); }
.dchip .d3 { font-size: 11px; margin-top: 3px; font-weight: 600; }
.dchip.open .d3 { color: var(--ok); }
.dchip.closed .d3 { color: var(--off); }
.dchip.on { border-color: var(--crust); background: var(--crust); color: #fff; }
.dchip.on .d2, .dchip.on .d3 { color: #F3D9A4; }
.banner { padding: 10px 14px; border-radius: var(--r); margin: 0 0 14px; font-size: 14px; font-weight: 600; }
.banner.open { background: #E3F0E4; color: #285A33; }
.banner.closed { background: #EEE8E0; color: #5E5245; }
.banner.late { background: #FFF0D6; color: #8A4B00; }

/* Rendelés szerkesztő */
.oeditor .ohead { display: flex; justify-content: space-between; gap: 10px; align-items: flex-end; margin-bottom: 10px; flex-wrap: wrap; }
.oeditor .ohead h2 { margin: 0; }
.oeditor .ohead .sub { margin-top: 2px; }
.olist { background: var(--paper); border-radius: var(--r); box-shadow: 0 0 0 1px var(--line); overflow: hidden; }
.olist .ocat { background: #F6EBD6; font-weight: 700; color: var(--crust-dark); font-size: 13px; padding: 7px 14px; }
.orow { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; padding: 9px 14px; border-bottom: 1px solid var(--line); }
.orow:last-child { border-bottom: 0; }
.orow.has { background: #FFFBF2; }
.orow .pn { font-weight: 600; }
.orow .pm { font-size: 12.5px; color: var(--muted); }
.orow .st { font-size: 12px; color: var(--crust); font-weight: 600; }
.orow .lt { font-size: 12px; color: #8A4B00; font-weight: 700; }
.step { display: flex; align-items: center; }
.step button { width: 40px; height: 40px; min-height: 0; padding: 0; font-size: 20px; font-weight: 700; color: var(--crust-dark); }
.step button:first-child { border-radius: 8px 0 0 8px; }
.step button:last-child { border-radius: 0 8px 8px 0; }
.step input { width: 58px; height: 40px; min-height: 0; text-align: center; border-radius: 0; border-left: 0; border-right: 0;
  font-weight: 700; font-size: 16px; -moz-appearance: textfield; }
.step input::-webkit-inner-spin-button { -webkit-appearance: none; }
.step input:disabled, .step button:disabled { background: #F5F1EA; color: var(--off); cursor: default; }
.everyday { display: flex; flex-direction: column; align-items: center; font-size: 11px; color: var(--muted); gap: 2px; min-width: 64px; }
.everyday input { width: 20px; height: 20px; min-height: 0; accent-color: var(--crust); }
.ofoot { position: sticky; bottom: 0; display: flex; align-items: center; gap: 14px; padding: 12px 14px; margin-top: 12px;
  background: var(--crust-dark); color: #fff; border-radius: var(--r); box-shadow: 0 -4px 16px rgba(0,0,0,.12); flex-wrap: wrap; }
.ofoot .tot { font-size: 18px; font-weight: 800; }
.ofoot .sm { font-size: 12.5px; opacity: .8; }
.ofoot .dirty { color: var(--gold); font-weight: 700; font-size: 13px; }
.ofoot button.primary { margin-left: auto; background: var(--gold); border-color: var(--gold); color: var(--crust-dark); }
.ofoot button.primary:disabled { opacity: .5; cursor: default; }
.olog { margin-top: 14px; font-size: 13px; }
.olog summary { cursor: pointer; font-weight: 700; color: var(--crust-dark); }
.olog ul { list-style: none; padding: 0; margin: 8px 0 0; }
.olog li { padding: 4px 0; border-bottom: 1px dashed var(--line); color: var(--muted); }
.olog li b { color: var(--ink); }
.olog li.late { color: #8A4B00; }

/* Pékség áttekintés */
.ovgrid { display: grid; grid-template-columns: 3fr 2fr; gap: 18px; align-items: start; }
.ovgrid h2 { font-size: 16px; margin: 0 0 8px; }
.ovgrid table td, .ovgrid table th { padding: 8px 10px; }
.src { font-size: 11.5px; font-weight: 600; padding: 2px 7px; border-radius: 99px; white-space: nowrap; }
.src.shop { background: #E3F0E4; color: var(--ok); }
.src.bakery { background: #E6ECF7; color: #2D4F8A; }
.src.standing { background: #F3E6CF; color: var(--crust-dark); }
.src.none { background: #F6DCD8; color: var(--danger); }
.lateb { font-size: 11.5px; font-weight: 700; color: #8A4B00; background: #FFF0D6; padding: 2px 7px; border-radius: 99px; }
tr.click { cursor: pointer; } tr.click:hover td { background: #FFFBF2; }
.wide-dlg { width: min(820px, 96vw); }
.dlg-head { display: flex; justify-content: space-between; align-items: center; }
.dlg-head h3 { margin: 0; }
#staffOrder { margin-top: 10px; }
.wdpick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.wdpick label { flex-direction: row !important; align-items: center; gap: 5px; border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 10px; color: var(--ink) !important; font-size: 14px !important; cursor: pointer; }
.lbl { font-size: 13px; color: var(--muted); }
@media (max-width: 900px) { .ovgrid { grid-template-columns: 1fr; } }
@media (max-width: 720px) {
  .top { flex-wrap: wrap; row-gap: 8px; }
  .brand .tag { display: none; }
  .top .right { flex: 1; justify-content: flex-end; }
  .viewas { order: 2; flex: 1 0 100%; }
  .viewas span { display: none; }
  .viewas select { max-width: none; width: 100%; }
  .top { position: relative; }
  .top .right { flex-wrap: wrap; }
  .orow { grid-template-columns: 1fr auto; padding: 10px 12px; }
  .orow .info { grid-column: 1 / -1; }
  .orow .everyday { flex-direction: row; gap: 6px; justify-self: start; }
  .orow .step { justify-self: end; }
  .ofoot { border-radius: 0; margin: 12px -12px 0; }
  .wide-dlg { padding: 14px; }
}

/* GPS, sofőr */
.btnlike { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px;
  color: var(--crust); font-weight: 600; text-decoration: none; background: #fff; white-space: nowrap; font-size: 14px; }
.btnlike[aria-disabled=true] { opacity: .4; pointer-events: none; }
.hint { font-size: 12px; color: var(--muted); }
.rhead .rgeo { font-size: 12px; margin-top: 3px; }
.rhead .rgeo .warn { color: #9A5B00; font-weight: 600; }
.nogeo { font-size: 11px; color: #9A5B00; font-weight: 700; margin-left: 4px; }
.rtools { display: flex; gap: 6px; padding: 8px 12px 0; }
.rtools button { min-height: 32px; padding: 4px 10px; font-size: 13px; }

.driver .dsum { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin: 4px 0 12px; font-size: 14px; color: var(--muted); }
.driver .dsum b { color: var(--ink); }
.driver .dtools { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.dstop { background: var(--paper); border-radius: var(--r); box-shadow: 0 0 0 1px var(--line); margin-bottom: 10px; overflow: hidden; }
.dstop .dh { display: flex; gap: 10px; align-items: flex-start; padding: 12px 12px 8px; }
.dstop .dn { width: 34px; height: 34px; border-radius: 50%; background: var(--crust); color: #fff; font-weight: 800;
  display: grid; place-items: center; flex: none; font-size: 16px; }
.dstop .grow { flex: 1; min-width: 0; }
.dstop .t1 { font-weight: 700; font-size: 16px; }
.dstop .t2 { font-size: 13px; color: var(--muted); }
.dstop .t3 { font-size: 13px; color: #8A4B00; font-weight: 600; margin-top: 2px; }
.dstop .ld { font-size: 11px; font-weight: 700; color: var(--crust); background: #F6EBD6; border-radius: 6px; padding: 3px 7px; white-space: nowrap; }
.dstop .ditems { padding: 0 12px 8px 56px; font-size: 14px; }
.dstop .ditems span { display: inline-block; background: #FBF6EC; border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; margin: 2px 4px 2px 0; }
.dstop .ditems b { color: var(--crust-dark); }
.dstop .da { display: flex; gap: 6px; padding: 8px 12px 12px; flex-wrap: wrap; border-top: 1px dashed var(--line); }
.dstop .da .grow { flex: 1; }
.dstop .da a, .dstop .da button { min-height: 40px; }
.dstop.skipped { opacity: .6; }
.dstop.skipped .dn { background: var(--off); }
.dstop.skipped .t1 { text-decoration: line-through; }
.skipb { font-size: 11px; font-weight: 800; color: #fff; background: var(--danger); border-radius: 6px; padding: 3px 7px; }
.dtot { background: var(--paper); border-radius: var(--r); box-shadow: 0 0 0 1px var(--line); padding: 10px 14px; margin-top: 14px; }
.dtot h3 { margin: 0 0 6px; font-size: 15px; }
.dtot .row { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px dashed var(--line); }
.dtot .row:last-child { border-bottom: 0; }

/* Bejelentkezés */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(ellipse at top, #8B4A1F 0%, #5E2F12 55%, #3d1d0a 100%); }
.loginbox { width: min(380px, 100%); background: var(--paper); border-radius: 16px; padding: 26px 24px 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35); display: flex; flex-direction: column; gap: 12px; }
.loginbox .lb { color: var(--crust-dark); margin-bottom: 4px; }
.loginbox .lb .tag { color: var(--muted); }
.loginbox h2 { margin: 4px 0 0; font-size: 18px; }
.loginbox label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.loginbox input { font-size: 16px; }
.loginbox button.primary { min-height: 44px; font-size: 16px; }
.loginbox .formerr { margin: 0; }
.lang-login { align-self: center; border-color: var(--line); margin-top: 4px; }
.lang-login button { color: var(--crust-dark); }
.usermenu { position: relative; }
.umbtn { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.3); color: #fff; min-height: 32px; padding: 4px 10px; font-size: 13px; font-weight: 600; }
.umdrop { position: absolute; right: 0; top: calc(100% + 6px); background: var(--paper); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.25);
  display: flex; flex-direction: column; min-width: 180px; overflow: hidden; z-index: 20; }
.umdrop button { border: 0; border-radius: 0; text-align: left; min-height: 42px; }
.umdrop button:hover { background: #FBF6EC; }
.role-pill { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 99px; }
.role-pill.admin { background: #E6ECF7; color: #2D4F8A; } .role-pill.shop { background: #E3F0E4; color: var(--ok); } .role-pill.driver { background: #F3E6CF; color: var(--crust-dark); }
[hidden] { display: none !important; }
