/* Ben.M Café — the back office's look: espresso, cream and ivory; one system for the till, the board, the menu. */
:root {
  --brown: #3B2416; --brown-dark: #1C100A; --brown-mid: #5A3A26; --cream: #E8C9A0; --cream-dark: #C9A071; --ivory: #F6EFE4; --paper: #FFFDF8;
  --ink: #2A1A10; --muted: #7A6A5C; --line: #E6DCCB; --line-strong: #D5C7B2;
  --ok: #2E7D5B; --ok-soft: #DDF1E6; --warn: #B7791F; --warn-soft: #FBEFD6; --info: #2F6DB5; --info-soft: #DEEBFA; --bad: #B33A3A; --bad-soft: #F8DEDE;
  --radius: 10px; --shadow: 0 10px 30px rgba(28, 16, 10, .10); --shadow-sm: 0 2px 8px rgba(28, 16, 10, .08);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Arabic", "Noto Naskh Arabic", sans-serif; --serif: Georgia, "Times New Roman", "Noto Naskh Arabic", serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--ivory); color: var(--ink); font: 15px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
body.has-modal { overflow: hidden; }
h1, h2, h3 { font-family: var(--serif); font-weight: normal; margin: 0; }
h1 { font-size: 26px; } h2 { font-size: 20px; } h3 { font-size: 17px; }
a { color: var(--brown-mid); }
small { color: var(--muted); }
button, input, select, textarea { font: inherit; color: inherit; }
.ic { width: 20px; height: 20px; flex: none; }
.ic.rot90 { transform: rotate(90deg); }
.loading { padding: 40px; color: var(--muted); text-align: center; }
.money-other { color: var(--muted); font-weight: normal; font-size: .92em; }
.muted { color: var(--muted); }
.right { text-align: end; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* ── layout ─────────────────────────────────────────────────── */
.app { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { background: var(--brown-dark); color: var(--ivory); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.side__brand { display: flex; align-items: center; gap: 12px; padding: 18px 18px 14px; border-bottom: 1px solid rgba(232, 201, 160, .14); }
.side__brand b { display: block; font-family: var(--serif); font-size: 19px; line-height: 1.15; }
.side__brand small { color: rgba(246, 239, 228, .55); font-size: 12px; }
.side__logo { width: 38px; height: 38px; border-radius: 10px; background: var(--cream); color: var(--brown-dark); display: grid; place-items: center; }
.side__logo .ic { width: 22px; height: 22px; }
.side__nav { display: flex; flex-direction: column; padding: 10px; gap: 2px; }
.side__nav a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 8px; color: rgba(246, 239, 228, .78); text-decoration: none; font-weight: 500; }
.side__nav a:hover { background: rgba(232, 201, 160, .10); color: var(--ivory); }
.side__nav a.is-on { background: var(--cream); color: var(--brown-dark); }
.side__today { margin: auto 14px 10px; padding: 12px 14px; border-radius: 8px; background: rgba(232, 201, 160, .10); display: grid; gap: 2px; }
.side__today b { font-size: 18px; } .side__today small { color: rgba(246, 239, 228, .6); }
.side__foot { padding: 12px 14px 16px; border-top: 1px solid rgba(232, 201, 160, .14); display: grid; gap: 10px; }
.side__switch { width: 100%; padding: 8px 10px; border-radius: 6px; border: 1px solid rgba(232, 201, 160, .3); background: rgba(246, 239, 228, .08); color: var(--ivory); }
.side__user { display: flex; align-items: center; gap: 10px; font-size: 13px; color: rgba(246, 239, 228, .85); word-break: break-all; }
.side__user small { color: rgba(246, 239, 228, .55); }
.side__lang { display: flex; align-items: center; gap: 12px; }
.side__lang a { color: rgba(246, 239, 228, .7); text-decoration: none; font-size: 13px; }
.side__lang a.is-on { color: var(--cream); border-bottom: 1px solid var(--cream); }
.side__lang a:last-child { margin-inline-start: auto; }
.main { padding: 22px 24px 40px; min-width: 0; }
.main--pos { padding: 16px 18px; height: 100vh; overflow: hidden; }
.topbar { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.topbar h1 { margin-inline-end: auto; }
.topbar .tabs { margin: 0; }

/* ── components ─────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--paper); color: var(--ink); cursor: pointer; font-weight: 500; line-height: 1.2; white-space: nowrap; transition: background .15s, transform .05s; }
.btn:hover { background: #fff; } .btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .55; cursor: default; }
.btn--primary { background: var(--brown); border-color: var(--brown); color: var(--ivory); } .btn--primary:hover { background: var(--brown-mid); }
.btn--accent { background: linear-gradient(135deg, #f1dcbb, #e8c9a0 55%, #c9a071); border-color: var(--cream-dark); color: var(--brown-dark); } .btn--accent:hover { filter: brightness(1.03); }
.btn--ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn--danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn--ghost { background: transparent; border-color: transparent; } .btn--ghost:hover { background: rgba(28, 16, 10, .06); }
.btn--sm { padding: 6px 10px; font-size: 13px; border-radius: 6px; }
.btn--lg { padding: 14px 20px; font-size: 16px; }
.btn--icon { padding: 8px; } .btn--block { width: 100%; }
.btn.is-busy { position: relative; color: transparent !important; } .btn.is-busy::after { content: ''; position: absolute; width: 16px; height: 16px; border: 2px solid rgba(255, 255, 255, .6); border-top-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.btn--ghost.is-busy::after, .btn:not(.btn--primary):not(.btn--ok):not(.btn--danger).is-busy::after { border-color: rgba(28, 16, 10, .4); border-top-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow-sm); }
.card + .card { margin-top: 16px; }
.card__head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; } .card__head h2, .card__head h3 { margin-inline-end: auto; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.field { display: grid; gap: 5px; margin-bottom: 12px; }
.field > span { font-size: 12.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
[dir="rtl"] .field > span { letter-spacing: 0; text-transform: none; }
.field input, .field select, .field textarea, .input { width: 100%; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; outline: none; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { border-color: var(--cream-dark); box-shadow: 0 0 0 3px rgba(201, 160, 113, .25); }
.field textarea { min-height: 80px; resize: vertical; }
.field--inline { display: flex; align-items: center; gap: 10px; } .field--inline input[type="checkbox"] { width: 18px; height: 18px; }
.check { display: flex; align-items: center; gap: 10px; padding: 8px 0; cursor: pointer; } .check input { width: 18px; height: 18px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row--end { justify-content: flex-end; }
.tabs { display: flex; gap: 4px; padding: 4px; background: rgba(28, 16, 10, .06); border-radius: 10px; margin-bottom: 16px; width: max-content; max-width: 100%; overflow: auto; }
.tabs button { padding: 8px 14px; border: 0; border-radius: 7px; background: transparent; cursor: pointer; font-weight: 500; color: var(--muted); white-space: nowrap; }
.tabs button.is-on { background: var(--paper); color: var(--ink); box-shadow: var(--shadow-sm); }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: rgba(28, 16, 10, .07); color: var(--muted); white-space: nowrap; }
.badge--open { background: var(--warn-soft); color: var(--warn); } .badge--preparing { background: var(--info-soft); color: var(--info); } .badge--ready { background: var(--ok-soft); color: var(--ok); }
.badge--completed { background: rgba(28, 16, 10, .07); color: var(--muted); } .badge--cancelled { background: var(--bad-soft); color: var(--bad); }
.badge--paid { background: var(--ok-soft); color: var(--ok); } .badge--unpaid { background: var(--bad-soft); color: var(--bad); }
.badge--takeaway { background: #EFE6D6; color: var(--brown-mid); }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 10px; border-bottom: 1px solid var(--line); text-align: start; vertical-align: middle; }
.table th { font-size: 12px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
[dir="rtl"] .table th { letter-spacing: 0; text-transform: none; }
.table tr:hover td { background: rgba(232, 201, 160, .12); }
.table .num { text-align: end; font-variant-numeric: tabular-nums; }
.table-wrap { overflow: auto; }
.empty { padding: 30px; text-align: center; color: var(--muted); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi small { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 4px; }
[dir="rtl"] .kpi small { letter-spacing: 0; text-transform: none; }
.kpi b { font-size: 22px; font-family: var(--serif); font-weight: normal; }
.kpi .money-other { display: block; font-size: 13px; }
.bars { display: grid; gap: 6px; }
.bar { display: grid; grid-template-columns: 70px 1fr auto; align-items: center; gap: 10px; font-size: 13px; }
.bar i { display: block; height: 14px; border-radius: 4px; background: linear-gradient(90deg, var(--cream-dark), var(--cream)); min-width: 2px; }
.bar b { font-variant-numeric: tabular-nums; font-weight: 500; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; background: #fff; }
.stepper button { width: 34px; height: 34px; border: 0; background: transparent; cursor: pointer; display: grid; place-items: center; }
.stepper button:hover { background: rgba(28, 16, 10, .06); }
.stepper span { min-width: 30px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: #fff; cursor: pointer; font-weight: 500; }
.chip.is-on { background: var(--brown); border-color: var(--brown); color: var(--ivory); }
.chip--sm { padding: 5px 11px; font-size: 13px; }
.chip small { color: inherit; opacity: .75; margin-inline-start: 4px; }
.note { padding: 10px 12px; background: var(--warn-soft); color: #6a4a12; border-radius: 8px; font-size: 13.5px; }
.note--ok { background: var(--ok-soft); color: var(--ok); } .note--info { background: var(--info-soft); color: var(--info); }
.toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 60; pointer-events: none; }
.toast { padding: 11px 18px; border-radius: 10px; background: var(--brown-dark); color: var(--ivory); box-shadow: var(--shadow); opacity: 0; transform: translateY(8px); transition: .25s; max-width: 90vw; }
.toast.is-in { opacity: 1; transform: none; } .toast--error { background: var(--bad); } .toast--ok { background: var(--ok); }
.modal { position: fixed; inset: 0; background: rgba(28, 16, 10, .45); display: grid; place-items: center; padding: 16px; z-index: 50; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal__box { width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--paper); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; animation: pop .18s; }
.modal--wide .modal__box { width: min(860px, 100%); }
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0; } }
.modal__head { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); } .modal__head h2 { margin-inline-end: auto; }
.modal__body { padding: 18px 20px; overflow: auto; }
.modal__foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--ivory); flex-wrap: wrap; }

/* ── the till ───────────────────────────────────────────────── */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 16px; height: 100%; }
.pos__left { display: flex; flex-direction: column; min-height: 0; }
.pos__top { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.pos__search { position: relative; flex: 1; max-width: 360px; } .pos__search .ic { position: absolute; inset-inline-start: 12px; top: 11px; color: var(--muted); } .pos__search input { padding-inline-start: 40px; }
.pos__cats { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 6px; scrollbar-width: thin; }
.pos__items { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: 10px; align-content: start; padding: 2px 2px 20px; }
.tile { position: relative; text-align: start; padding: 12px 12px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); cursor: pointer; display: flex; flex-direction: column; gap: 6px; min-height: 108px; box-shadow: var(--shadow-sm); transition: transform .08s, box-shadow .15s; }
.tile:hover { transform: translateY(-1px); box-shadow: var(--shadow); } .tile:active { transform: scale(.98); }
.tile.is-off { opacity: .55; } .tile.is-off::after { content: attr(data-off); position: absolute; top: 10px; inset-inline-end: 10px; font-size: 11px; font-weight: 700; color: var(--bad); background: var(--bad-soft); padding: 2px 7px; border-radius: 999px; }
.tile__photo { width: 100%; aspect-ratio: 4 / 3; border-radius: 8px; object-fit: cover; background: var(--ivory); }
.tile__name { font-weight: 600; line-height: 1.25; }
.tile__price { margin-top: auto; font-size: 14px; color: var(--brown-mid); font-weight: 600; } .tile__price .money-other { display: block; font-weight: normal; }
.tile__tag { position: absolute; top: 10px; inset-inline-end: 10px; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--warn); background: var(--warn-soft); padding: 2px 7px; border-radius: 999px; }
.ticket { display: flex; flex-direction: column; min-height: 0; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-sm); overflow: hidden; }
.ticket__head { padding: 14px 16px 10px; border-bottom: 1px solid var(--line); display: grid; gap: 10px; }
.ticket__title { display: flex; align-items: center; gap: 10px; } .ticket__title h2 { margin-inline-end: auto; }
.ticket__meta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; } .ticket__meta input { padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 7px; min-width: 0; }
.ticket__lines { flex: 1; overflow-y: auto; padding: 6px 0; }
.ticket__empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.line { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 10px 16px; border-bottom: 1px dashed var(--line); align-items: start; }
.line__name { font-weight: 600; } .line__detail { font-size: 12.5px; color: var(--muted); grid-column: 1; }
.line__total { font-weight: 600; text-align: end; font-variant-numeric: tabular-nums; }
.line__tools { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.line__tools .unit { margin-inline-start: auto; font-size: 12.5px; color: var(--muted); }
.ticket__totals { padding: 10px 16px; border-top: 1px solid var(--line); background: var(--ivory); display: grid; gap: 4px; font-size: 14px; }
.ticket__totals .tr { display: flex; justify-content: space-between; gap: 10px; } .ticket__totals .tr b { font-size: 20px; font-family: var(--serif); font-weight: normal; }
.ticket__totals .tr--total { margin-top: 4px; padding-top: 6px; border-top: 1px solid var(--line-strong); align-items: baseline; }
.ticket__totals .tr--total .money-other { display: block; text-align: end; font-size: 13px; }
.ticket__actions { padding: 12px 16px 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; background: var(--ivory); }
.ticket__actions .btn--lg { grid-column: 1 / -1; }
.opt-group { margin-bottom: 14px; } .opt-group > b { display: block; margin-bottom: 8px; } .opt-group small { font-weight: normal; }
.size-row, .opt-row { display: flex; flex-wrap: wrap; gap: 8px; }
.pay-methods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.pay-methods .chip { text-align: center; justify-content: center; display: flex; gap: 8px; padding: 12px; }
.pay-due { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.pay-due b { font-family: var(--serif); font-size: 26px; font-weight: normal; }
.pay-quick { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
.pay-change { display: flex; justify-content: space-between; padding: 12px 14px; border-radius: 8px; background: var(--ok-soft); color: var(--ok); font-weight: 600; }
.pay-change.is-short { background: var(--bad-soft); color: var(--bad); }
.pay-big { font-size: 24px; text-align: end; }

/* ── the board ──────────────────────────────────────────────── */
.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }
.col { background: rgba(28, 16, 10, .04); border-radius: 12px; padding: 10px; min-height: 200px; }
.col__head { display: flex; align-items: center; gap: 8px; padding: 4px 6px 10px; font-weight: 600; } .col__head .badge { margin-inline-start: auto; }
.ocard { background: var(--paper); border: 1px solid var(--line); border-inline-start: 4px solid var(--warn); border-radius: 10px; padding: 12px 12px 10px; margin-bottom: 10px; box-shadow: var(--shadow-sm); }
.ocard--preparing { border-inline-start-color: var(--info); } .ocard--ready { border-inline-start-color: var(--ok); }
.ocard__head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; } .ocard__head b { font-size: 18px; font-family: var(--serif); font-weight: normal; } .ocard__head small { margin-inline-start: auto; }
.ocard__lines { font-size: 13.5px; margin: 6px 0 8px; } .ocard__lines div { display: flex; gap: 8px; } .ocard__lines .q { font-weight: 700; min-width: 22px; } .ocard__lines small { display: block; }
.ocard__foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; } .ocard__foot .total { margin-inline-end: auto; font-weight: 600; }
.ocard__actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.ocard__actions .btn--icon { margin-inline-start: auto; } .ocard__actions .btn--icon ~ .btn--icon { margin-inline-start: 0; }
.ocard.is-late .ocard__head small { color: var(--bad); font-weight: 700; }
.recent { margin-top: 18px; }
.events { list-style: none; padding: 0; margin: 0; font-size: 13.5px; } .events li { display: flex; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--line); } .events time { color: var(--muted); min-width: 44px; }

/* ── menu editor ────────────────────────────────────────────── */
.mlist { display: grid; gap: 8px; }
.mrow { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; }
.mrow__photo { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: var(--ivory); flex: none; }
.mrow__name { font-weight: 600; } .mrow__sub { font-size: 12.5px; color: var(--muted); }
.mrow__main { flex: 1; min-width: 0; } .mrow__tools { display: flex; gap: 4px; flex: none; }
.mrow.is-off { opacity: .6; }
.rows { display: grid; gap: 8px; } .rows .row input { flex: 1; min-width: 80px; }
.photo-box { display: flex; align-items: center; gap: 12px; } .photo-box img { width: 72px; height: 72px; border-radius: 10px; object-fit: cover; background: var(--ivory); }
.qr-box { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; } .qr-box img { width: 180px; height: 180px; border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 8px; }
.qr-box code { display: block; padding: 8px 10px; background: var(--ivory); border-radius: 6px; font-size: 13px; word-break: break-all; margin-bottom: 10px; }

/* ── small screens ──────────────────────────────────────────── */
@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; }
  .side__nav { flex-direction: row; overflow-x: auto; }
  .side__nav a span { display: none; }
  .side__today { display: none; }
  .side__foot { display: flex; align-items: center; flex-wrap: wrap; } .side__user { flex: 1; }
  .main { padding: 14px; } .main--pos { height: auto; overflow: visible; }
  .pos { grid-template-columns: 1fr; height: auto; } .pos__items { max-height: 50vh; } .ticket { max-height: none; }
  .board { grid-template-columns: 1fr; } .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
@media print { .side, .toasts, .modal { display: none !important; } .app { display: block; } }
