:root {
  --bg: #f3f5f8; --panel: #ffffff; --ink: #18202b; --muted: #6b7585; --line: #e3e7ed; --line2: #eef1f5;
  --side: #17202c; --side-ink: #c6cfdb; --side-act: #263345;
  --pri: #d9480f; --pri-2: #b83c0b; --pri-soft: #fff1ea;
  --ok: #2b8a3e; --ok-soft: #e9f7ec; --warn: #c77700; --warn-soft: #fff6e0; --err: #c92a2a; --err-soft: #ffeeee; --info: #1c63c7; --info-soft: #eaf2ff;
  --r: 10px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  font-size: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; background: var(--bg); color: var(--ink); }
.hidden { display: none !important; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
a { color: var(--info); }
.muted { color: var(--muted); }
small { color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.pos-c { color: var(--ok); } .neg-c { color: var(--err); }

/* Layout */
#app { display: flex; height: 100vh; }
#side { width: 238px; background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; flex-shrink: 0; overflow-y: auto; }
.brand { display: flex; gap: 10px; align-items: center; padding: 18px 16px; border-bottom: 1px solid #243042; }
.brand .logo { font-size: 26px; }
.brand b { color: #fff; display: block; font-size: 15px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand small { color: #8593a6; font-size: 11px; }
#nav { padding: 8px 8px 20px; }
.nav-g { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #6d7b8f; padding: 14px 10px 6px; }
.nav-a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--side-ink); text-decoration: none; margin: 1px 0; }
.nav-a:hover { background: #1f2a39; color: #fff; }
.nav-a.act { background: var(--side-act); color: #fff; box-shadow: inset 3px 0 0 var(--pri); }
.nav-a .ic { width: 20px; text-align: center; }
main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.top { display: flex; align-items: center; gap: 12px; padding: 0 20px; height: 56px; background: var(--panel); border-bottom: 1px solid var(--line); flex-shrink: 0; }
.top h1 { font-size: 18px; }
.sp { flex: 1; }
#view { flex: 1; overflow: auto; padding: 20px; }
#menuBtn { display: none; }
#userbox { display: flex; align-items: center; gap: 8px; }
.ubadge { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }
.ubadge small { font-size: 11px; }
#sideShade { display: none; }
@media (max-width: 900px) {
  #side { position: fixed; z-index: 40; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform .2s; }
  body.side-open #side { transform: none; }
  body.side-open #sideShade { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 39; }
  #menuBtn { display: inline-flex; }
  #view { padding: 12px; }
  .top { padding: 0 12px; }
  .ubadge { display: none; }
}

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 8px 14px; border-radius: 8px; font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover { background: #f7f8fa; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--pri); border-color: var(--pri); color: #fff; }
.btn.primary:hover { background: var(--pri-2); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { color: var(--err); border-color: #f1c7c7; }
.btn.danger:hover { background: var(--err-soft); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.lg { padding: 13px 20px; font-size: 16px; }
.btn.block { width: 100%; }
.icon-btn { border: 0; background: transparent; font-size: 20px; cursor: pointer; padding: 6px 8px; border-radius: 6px; color: inherit; }
.icon-btn:hover { background: var(--line2); }
.x-btn { border: 0; background: transparent; cursor: pointer; color: var(--muted); font-size: 16px; padding: 2px 6px; border-radius: 6px; }
.x-btn:hover { color: var(--err); background: var(--err-soft); }

/* Cards & toolbar */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px; }
.card h3 { font-size: 15px; margin-bottom: 12px; }
.card-h { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-h h3 { margin: 0; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-bottom: 14px; }
.toolbar .fld { margin: 0; }
.toolbar input, .toolbar select { min-width: 140px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); } }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi .l { color: var(--muted); font-size: 12.5px; }
.kpi .v { font-size: 22px; font-weight: 650; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tab { padding: 9px 14px; border: 0; background: transparent; cursor: pointer; font: inherit; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; text-decoration: none; }
.tab:hover { color: var(--ink); }
.tab.act { color: var(--pri); border-bottom-color: var(--pri); font-weight: 600; }

/* Forms */
.fld { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; min-width: 0; }
.fld label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.fld small { font-size: 11.5px; }
input, select, textarea { font: inherit; color: inherit; border: 1px solid #d4d9e1; border-radius: 8px; padding: 8px 10px; background: #fff; width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid #ffd8c6; border-color: var(--pri); }
textarea { min-height: 70px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 600px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.chk { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; cursor: pointer; }
.chk input { width: auto; }
.hint { background: var(--info-soft); color: #1a4c94; border-radius: 8px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px; line-height: 1.45; }
.warnbox { background: var(--warn-soft); color: #7a4a00; border-radius: 8px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px; }
.errbox { background: var(--err-soft); color: #8b1c1c; border-radius: 8px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px; white-space: pre-line; }

/* Tables */
.tbl-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-weight: 600; font-size: 12.5px; color: var(--muted); background: #f8f9fb; padding: 9px 10px; border-bottom: 1px solid var(--line); position: sticky; top: 0; white-space: nowrap; }
table.t td { padding: 8px 10px; border-bottom: 1px solid var(--line2); vertical-align: middle; }
table.t tbody tr:last-child td { border-bottom: 0; }
table.t th.num { text-align: right; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: #fbf7f4; }
table.t tfoot td { font-weight: 650; background: #f8f9fb; border-top: 1px solid var(--line); }
table.t tr.dim td { color: #9aa3b0; }
.t-empty { padding: 26px; text-align: center; color: var(--muted); }
.t-bar { display: flex; justify-content: flex-end; margin: -6px 0 6px; }
table.lines { width: 100%; border-collapse: collapse; }
table.lines th { font-size: 12px; color: var(--muted); text-align: left; padding: 4px 6px; font-weight: 600; }
table.lines th.num { text-align: right; padding-right: 8px; }
table.lines td { padding: 3px 4px; }
table.lines td.calc { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; padding-right: 8px; }
table.lines input, table.lines select { padding: 6px 8px; }
table.lines tfoot td { font-weight: 650; padding-top: 8px; }
.lines-wrap { overflow-x: auto; }
.lines-wrap table { min-width: 620px; }

/* Badges */
.b { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 600; background: var(--line2); color: var(--muted); white-space: nowrap; }
.b.ok { background: var(--ok-soft); color: var(--ok); }
.b.warn { background: var(--warn-soft); color: var(--warn); }
.b.err { background: var(--err-soft); color: var(--err); }
.b.info { background: var(--info-soft); color: var(--info); }
.b.pri { background: var(--pri-soft); color: var(--pri); }

/* Modal */
.modal-wrap { position: fixed; inset: 0; background: rgba(15, 20, 30, .45); display: flex; align-items: flex-start; justify-content: center; z-index: 100; padding: 40px 12px; overflow-y: auto; }
.modal { background: #fff; border-radius: 12px; width: 560px; max-width: 100%; box-shadow: 0 20px 50px rgba(0,0,0,.25); display: flex; flex-direction: column; }
.modal.wide { width: 980px; }
.modal.mid { width: 760px; }
.modal-h { display: flex; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); gap: 10px; }
.modal-h h3 { font-size: 16px; flex: 1; }
.modal-b { padding: 18px; }
.modal-f { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); background: #fafbfc; border-radius: 0 0 12px 12px; flex-wrap: wrap; }
.modal-f .left { margin-right: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* Toast */
#toasts { position: fixed; right: 16px; top: 64px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: 420px; }
.toast { background: #1d2733; color: #fff; padding: 11px 15px; border-radius: 9px; box-shadow: 0 8px 24px rgba(0,0,0,.2); white-space: pre-line; animation: tin .2s ease-out; font-size: 13.5px; }
.toast.err { background: #b42323; }
.toast.ok { background: #237a36; }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }

/* Login */
.login { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #17202c, #2c3b50); padding: 16px; }
.login-box { background: #fff; padding: 30px; border-radius: 14px; width: 360px; max-width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.login-box h2 { margin: 6px 0 2px; }
.login-logo { font-size: 40px; }
.login-err { color: var(--err); min-height: 18px; margin: 10px 0 0; font-size: 13px; }

.loading { padding: 40px; text-align: center; color: var(--muted); }
.list-plain { margin: 0; padding-left: 18px; line-height: 1.7; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 13.5px; }
.kv > :nth-child(odd) { color: var(--muted); }
.bar { height: 8px; background: var(--line2); border-radius: 9px; overflow: hidden; min-width: 60px; }
.bar > i { display: block; height: 100%; background: var(--pri); border-radius: 9px; }
.pl td:first-child { padding-left: 24px; }
.pl-total td { font-weight: 700; font-size: 15px; }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; margin-right: 6px; }

/* POS */
.shift-bar { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.shift-bar.off { background: var(--warn-soft); color: #7a4a00; }
.shift-bar.on { background: var(--ok-soft); color: #1d5e2a; }
.zone-h { font-size: 13px; font-weight: 600; color: var(--muted); margin: 16px 0 8px; text-transform: uppercase; letter-spacing: .05em; }
.tables { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.tbl { border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 14px 12px; cursor: pointer; min-height: 92px; display: flex; flex-direction: column; gap: 4px; text-align: left; font: inherit; color: inherit; box-shadow: var(--shadow); }
.tbl:hover { border-color: var(--pri); }
.tbl b { font-size: 15px; }
.tbl.busy { background: var(--pri-soft); border-color: #ffc9ad; }
.tbl.busy .amt { color: var(--pri); font-weight: 700; font-size: 16px; }
.tbl.billed { background: #fff6e0; border-color: #f5d48a; }
.tbl small { font-size: 12px; }
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 14px; height: calc(100vh - 96px); }
@media (max-width: 900px) { .pos { grid-template-columns: minmax(0, 1fr); height: auto; } }
.pos-menu { display: flex; flex-direction: column; min-height: 0; }
.pos-cats { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 7px 13px; cursor: pointer; font: inherit; font-size: 13.5px; }
.chip.act { background: var(--ink); color: #fff; border-color: var(--ink); }
.pos-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; overflow-y: auto; align-content: start; padding-bottom: 10px; flex: 1; }
.pi { border: 1px solid var(--line); border-left: 4px solid var(--c, #ccc); background: #fff; border-radius: 10px; padding: 11px 10px; cursor: pointer; text-align: left; font: inherit; color: inherit; min-height: 74px; display: flex; flex-direction: column; justify-content: space-between; gap: 6px; box-shadow: var(--shadow); }
.pi:hover { background: #fffaf7; }
.pi:active { transform: scale(.98); }
.pi b { font-weight: 600; font-size: 13.5px; line-height: 1.25; }
.pi span { color: var(--pri); font-weight: 700; }
.pos-order { background: #fff; border: 1px solid var(--line); border-radius: 12px; display: flex; flex-direction: column; min-height: 0; box-shadow: var(--shadow); }
.po-h { padding: 12px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; }
.po-h h3 { font-size: 16px; flex: 1; }
.po-lines { flex: 1; overflow-y: auto; min-height: 160px; }
.pl-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; padding: 9px 14px; border-bottom: 1px solid var(--line2); align-items: center; }
.pl-row .nm { cursor: pointer; }
.pl-row .nm b { font-weight: 500; display: block; }
.pl-row .nm small { display: block; }
.pl-row.sent .nm b::after { content: " ✓"; color: var(--ok); font-size: 12px; }
.qty { display: flex; align-items: center; gap: 4px; }
.qty button { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 16px; line-height: 1; }
.qty button:hover { background: var(--line2); }
.qty span { min-width: 26px; text-align: center; font-weight: 600; }
.po-tot { padding: 10px 14px; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.po-tot div { display: flex; justify-content: space-between; padding: 2px 0; }
.po-tot .grand { font-size: 20px; font-weight: 700; padding-top: 6px; }
.po-act { padding: 10px 14px 14px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.po-act .btn { padding: 9px 6px; font-size: 13px; }
.po-act .pay { grid-column: 1 / -1; }
.pay-row { display: grid; grid-template-columns: 1fr 150px auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.pay-big { font-size: 26px; font-weight: 700; text-align: center; margin-bottom: 14px; }
.pay-info { display: flex; justify-content: space-between; font-size: 15px; padding: 6px 0; }

/* --- v2: fast-food, əlavələr, tabel, dil --- */
.lang-sel { width: auto; padding: 5px 8px; font-size: 13px; }
.quick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 8px; }
.qbtn { border: 0; border-radius: 14px; padding: 20px 14px; cursor: pointer; font: inherit; color: #fff; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 26px; box-shadow: var(--shadow); }
.qbtn b { font-size: 17px; } .qbtn small { color: rgba(255,255,255,.85); font-size: 12.5px; }
.qbtn:active { transform: scale(.98); }
.q1 { background: linear-gradient(135deg, #d9480f, #f76707); } .q2 { background: linear-gradient(135deg, #2b8a3e, #40c057); } .q3 { background: linear-gradient(135deg, #1c63c7, #4dabf7); }
@media (max-width: 600px) { .quick { grid-template-columns: minmax(0, 1fr); } .qbtn { flex-direction: row; justify-content: center; padding: 14px; font-size: 20px; } }
.dno { background: var(--ink); color: #fff; border-radius: 8px; padding: 3px 9px; font-weight: 700; font-size: 15px; }
.pl-row.child { padding-top: 3px; padding-bottom: 5px; background: #fafbfc; }
.pl-row.child .nm { padding-left: 14px; cursor: default; }
.pl-row.child .nm b { font-size: 13px; color: var(--muted); }
.ad-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 6px; }
.ad-row.on { border-color: var(--ok); background: var(--ok-soft); }
.ad-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 14px; }
.tabel table.t th, .tabel table.t td { padding: 4px 3px; text-align: center; }
.tabel table.t td:first-child, .tabel table.t th:first-child { text-align: left; padding-left: 8px; position: sticky; left: 0; background: #fff; z-index: 1; }
.tabel th.dh { cursor: pointer; min-width: 30px; font-size: 12px; }
.tabel th.dh:hover { color: var(--pri); }
.tabel .we { background: #fff4ee; }
.tabel .tg { cursor: pointer; min-width: 30px; height: 34px; font-weight: 600; user-select: none; }
.tabel .tg:hover { background: #fdeee6; }
.tabel .tg.on { background: var(--ok-soft); color: var(--ok); }
.tabel .tc input { width: 38px; padding: 4px 2px; text-align: center; font-size: 12.5px; }
table.pr input.pl-in { width: 90px; text-align: right; padding: 5px 6px; }
table.pr .sig { display: none; }
