/* صفوف — staff / owner / admin app */
.shell { min-height: 100dvh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 12px; height: 62px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; text-decoration: none !important; color: inherit; }
.brand .logo-mark { width: 36px; height: 36px; }
.brand b { display: block; font-size: 15px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.brand small { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); }
.venue-switch { border: 0; background: none; padding: 4px 6px; border-radius: var(--r-sm); cursor: pointer; text-align: start; }
.venue-switch:hover { background: var(--surface-2); }
.nav { display: flex; gap: 2px; margin-inline-start: 12px; }
.nav a { display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 12px; border-radius: var(--r); color: var(--ink-2); font-weight: 600; font-size: 14px; text-decoration: none !important; position: relative; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.on { background: var(--brand-soft); color: var(--brand-2); }
.nav a .count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--bad); color: #fff; font-size: 11.5px; display: inline-grid; place-items: center; font-family: var(--num); }
.top-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 6px; }
.clock { font-family: var(--num); font-weight: 700; font-size: 15px; color: var(--ink-2); padding: 0 6px; }
.content { flex: 1; width: 100%; max-width: 1480px; margin: 0 auto; padding: 18px; }
.page-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-h h1 { font-size: 22px; margin: 0; }
.bottom-nav { display: none; }
@media (max-width: 960px) {
  .nav { display: none; }
  .clock { display: none; }
  .bottom-nav { display: flex; position: sticky; bottom: 0; z-index: 50; background: var(--surface); border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); justify-content: space-around; }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; font-size: 11px; font-weight: 600; color: var(--ink-3); text-decoration: none !important; border-radius: var(--r-sm); position: relative; }
  .bottom-nav a.on { color: var(--brand-2); }
  .bottom-nav a .count { position: absolute; top: 2px; inset-inline-end: calc(50% - 22px); min-width: 18px; height: 18px; border-radius: 99px; background: var(--bad); color: #fff; font-size: 11px; display: grid; place-items: center; font-family: var(--num); }
  .content { padding: 12px; }
  .brand b { max-width: 150px; }
}

.banner { display: flex; align-items: center; gap: 12px; padding: 10px 16px; font-weight: 600; font-size: 14px; }
.banner.warn { background: var(--warn-soft); }
.banner.bad { background: var(--bad); color: #fff; }
.banner.info { background: var(--info-soft); }
.banner .btn { margin-inline-start: auto; }

/* ---------- orders board ---------- */
.board-layout { display: grid; grid-template-columns: 360px 1fr; gap: 18px; align-items: start; }
.board-layout.no-entry { grid-template-columns: 1fr; }
@media (max-width: 1100px) { .board-layout { grid-template-columns: 320px 1fr; } }
@media (max-width: 820px) { .board-layout { grid-template-columns: 1fr; } }

.entry { position: sticky; top: 80px; padding: 18px; }
@media (max-width: 820px) { .entry { position: static; } }
.entry h2 { font-size: 16px; margin: 0 0 12px; display: flex; align-items: center; justify-content: space-between; }
.num-row { display: flex; align-items: stretch; gap: 8px; margin-bottom: 8px; }
.num-row .btn { width: 56px; min-height: 76px; font-size: 26px; border-radius: var(--r-lg); padding: 0; }
.num-field { flex: 1; min-width: 0; position: relative; }
.num-field input { width: 100%; height: 76px; border-radius: var(--r-lg); border: 2px solid var(--line); background: var(--surface-2); text-align: center; font-family: var(--num); font-size: 42px; font-weight: 800; letter-spacing: .04em; direction: ltr; outline: none; transition: border-color .15s, background .15s, box-shadow .15s; color: var(--ink); }
.num-field input:focus { border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 5px color-mix(in srgb, var(--brand) 15%, transparent); }
.num-field .prefix { position: absolute; inset-inline-start: 14px; top: 50%; transform: translateY(-50%); font-family: var(--num); font-weight: 700; font-size: 22px; color: var(--ink-3); pointer-events: none; }
.num-field .sugg { position: absolute; bottom: -19px; inset-inline: 0; text-align: center; font-size: 11px; color: var(--ink-3); pointer-events: none; }
.minutes { display: flex; flex-wrap: wrap; gap: 6px; }
.minutes .chip { height: 40px; min-width: 52px; justify-content: center; font-family: var(--num); }
.entry .sublabel { font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 14px 0 8px; display: flex; align-items: center; justify-content: space-between; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; direction: ltr; }
.keypad button { min-height: 56px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); font-family: var(--num); font-size: 24px; font-weight: 700; cursor: pointer; }
.keypad button:active { background: var(--surface-2); transform: scale(.97); }
.pending-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pending-chips .chip { height: 32px; font-family: var(--num); border-style: dashed; border-color: var(--warn); background: var(--warn-soft); }

.columns { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 1200px) { .board-layout:not(.no-entry) .columns { grid-template-columns: 1fr; } }
@media (max-width: 680px) { .columns { grid-template-columns: 1fr; } }
.col-h { display: flex; align-items: center; gap: 8px; margin: 0 4px 10px; font-weight: 700; font-size: 15px; }
.col-h .n { font-family: var(--num); min-width: 26px; height: 26px; padding: 0 8px; border-radius: 99px; display: inline-grid; place-items: center; background: var(--surface-3); font-size: 13px; }
.col-h.prep .n { background: var(--warn-soft); color: var(--warn); }
.col-h.ready .n { background: var(--ok-soft); color: var(--ok); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }

.ocard { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 14px 12px; box-shadow: var(--sh-1); display: flex; flex-direction: column; gap: 10px; transition: box-shadow .2s, border-color .2s; animation: cardIn .3s var(--ease); }
@keyframes cardIn { from { transform: translateY(6px); opacity: 0; } }
.ocard::before { content: ""; position: absolute; inset-block: 12px; inset-inline-start: 0; width: 4px; border-radius: 0 4px 4px 0; background: var(--warn); }
.ocard.ready::before { background: var(--ok); }
.ocard.late { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
.ocard.late::before { background: var(--bad); }
.ocard.flash { animation: flashCard 1s 2; }
@keyframes flashCard { 50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 40%, transparent); } }
.ocard .top { display: flex; align-items: flex-start; gap: 10px; }
.olabel { font-family: var(--num); font-weight: 800; font-size: 34px; line-height: 1; letter-spacing: .02em; direction: ltr; }
.otimer { margin-inline-start: auto; text-align: end; }
.otimer .t { font-family: var(--num); font-weight: 800; font-size: 24px; line-height: 1.1; direction: ltr; font-variant-numeric: tabular-nums; }
.otimer .l { font-size: 11.5px; color: var(--ink-3); font-weight: 600; }
.ocard.late .otimer .t { color: var(--bad); }
.ocard.ready .otimer .t { color: var(--ok); }
.otimer.paused .t { color: var(--info); }
.onote { font-size: 13.5px; padding: 6px 10px; border-radius: var(--r-sm); background: var(--warn-soft); }
.ometa { display: flex; flex-wrap: wrap; gap: 6px; }
.oactions { display: flex; gap: 6px; align-items: center; }
.oactions .tbtn { min-width: 44px; padding: 0 8px; font-family: var(--num); }
.oactions .main { margin-inline-start: auto; }
.kitchen .olabel { font-size: 44px; }
.kitchen .oactions .main { min-height: 52px; font-size: 17px; padding: 0 20px; }

.help-bar { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.hcard { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border-radius: var(--r-lg); background: var(--surface); border: 2px solid var(--bad); box-shadow: var(--sh-2); animation: cardIn .3s var(--ease); }
.hcard.answered { border-color: var(--line); opacity: .85; }
.hcard .hl { font-family: var(--num); font-weight: 800; font-size: 24px; padding: 2px 12px; border-radius: var(--r); background: var(--bad-soft); color: var(--bad); }
.hcard.answered .hl { background: var(--surface-2); color: var(--ink-2); }
.hcard .ht { flex: 1; min-width: 180px; }
.hcard .ht b { display: block; }
.hcard .replies { display: flex; flex-wrap: wrap; gap: 6px; }

.recent { margin-top: 22px; }
.recent summary { cursor: pointer; font-weight: 700; color: var(--ink-2); padding: 6px 4px; list-style: none; display: flex; align-items: center; gap: 6px; }
.recent summary::-webkit-details-marker { display: none; }
.recent-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.rchip { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 6px 0 12px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); font-family: var(--num); font-weight: 700; }
.rchip.cancelled { text-decoration: line-through; color: var(--ink-3); }

.board-empty { padding: 48px 20px; text-align: center; color: var(--ink-3); border: 2px dashed var(--line); border-radius: var(--r-lg); }
.board-empty .big { font-size: 40px; margin-bottom: 6px; }

/* order details */
.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline li { display: flex; gap: 12px; padding: 8px 0; position: relative; }
.timeline li::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); margin-top: 7px; flex: none; box-shadow: 0 0 0 3px var(--brand-soft); }
.timeline .when { margin-inline-start: auto; color: var(--ink-3); font-size: 13px; font-family: var(--num); }
.qr-box { display: grid; place-items: center; padding: 12px; background: #fff; border-radius: var(--r-lg); border: 1px solid var(--line); }
.qr-box svg { width: 100%; max-width: 280px; height: auto; }

/* ---------- reports ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
@media (max-width: 900px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
.kpi { padding: 16px; }
.kpi .k { font-size: 13px; color: var(--ink-2); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.kpi .v { font-family: var(--num); font-size: 30px; font-weight: 800; line-height: 1.2; margin-top: 4px; }
.kpi .v small { font-size: 15px; color: var(--ink-3); font-weight: 600; margin-inline-start: 3px; }
.kpi .s { font-size: 12.5px; color: var(--ink-3); }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 16px; }
@media (max-width: 500px) { .charts { grid-template-columns: 1fr; } }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart .bar { fill: var(--brand); transition: opacity .15s; }
.chart .bar:hover { opacity: .8; }
.chart .axis { fill: var(--ink-3); font-size: 10px; font-family: var(--num); }
.chart .grid { stroke: var(--line); stroke-dasharray: 3 3; }
.chart .val { fill: var(--ink-2); font-size: 10px; font-family: var(--num); font-weight: 700; }
.hbar { display: flex; align-items: center; gap: 10px; margin: 8px 0; font-size: 14px; }
.hbar .lbl { width: 130px; flex: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .track { flex: 1; height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.hbar .fill { height: 100%; background: var(--brand); border-radius: 99px; }
.hbar .n { font-family: var(--num); font-weight: 700; width: 36px; text-align: end; }
.range-bar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.range-bar input[type=date] { min-height: 36px; padding: 4px 8px; width: auto; }

/* ---------- settings ---------- */
.settings-grid { display: grid; grid-template-columns: 220px 1fr; gap: 18px; align-items: start; }
.settings-nav { position: sticky; top: 80px; display: flex; flex-direction: column; gap: 2px; }
.settings-nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r); color: var(--ink-2); font-weight: 600; text-decoration: none !important; }
.settings-nav a:hover { background: var(--surface-2); }
.settings-nav a.on { background: var(--surface); color: var(--ink); box-shadow: var(--sh-1); }
@media (max-width: 820px) {
  .settings-grid { grid-template-columns: 1fr; }
  .settings-nav { position: static; flex-direction: row; overflow-x: auto; }
  .settings-nav a { white-space: nowrap; }
}
.section { margin-bottom: 16px; }
.section .card-b > .form-grid + .form-grid { margin-top: 14px; }
.save-bar { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.color-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 1.5px var(--line); cursor: pointer; padding: 0; }
.swatch.on { box-shadow: 0 0 0 2.5px var(--ink); }
input[type=color].swatch { -webkit-appearance: none; appearance: none; overflow: hidden; }
input[type=color].swatch::-webkit-color-swatch-wrapper { padding: 0; }
input[type=color].swatch::-webkit-color-swatch { border: 0; border-radius: 50%; }
.list-editor { display: flex; flex-direction: column; gap: 6px; }
.list-editor .item { display: flex; gap: 6px; }
.logo-edit { display: flex; align-items: center; gap: 14px; }
.logo-edit .logo-mark { width: 72px; height: 72px; border-radius: 18px; font-size: 28px; }
.preview-phone { width: 100%; max-width: 280px; border-radius: 28px; border: 8px solid var(--ink); background: var(--bg); padding: 14px; text-align: center; margin: 0 auto; }
.number-preview { font-family: var(--num); font-weight: 800; font-size: 22px; display: flex; gap: 6px; flex-wrap: wrap; direction: ltr; justify-content: flex-start; }
.number-preview span { padding: 2px 10px; border-radius: 8px; background: var(--surface-2); }

/* ---------- team ---------- */
.member { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.member:last-child { border-bottom: 0; }
.member.off { opacity: .55; }

/* ---------- QR page / poster ---------- */
.qr-layout { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.poster { width: 100%; aspect-ratio: 1 / 1.414; border-radius: var(--r-lg); background: #fff; color: #1E1A16; box-shadow: var(--sh-2); display: flex; flex-direction: column; align-items: center; padding: 7% 8%; text-align: center; overflow: hidden; position: relative; }
.poster .p-top { position: absolute; inset: 0 0 auto; height: 17%; background: var(--brand); border-radius: 0 0 50% 50% / 0 0 18% 18%; }
.poster .p-logo { position: relative; margin-top: 1%; width: 22%; aspect-ratio: 1; border-radius: 22%; background: #fff; display: grid; place-items: center; box-shadow: 0 6px 20px rgba(0,0,0,.15); object-fit: cover; font-weight: 800; font-size: 28px; color: var(--brand); }
.poster h2 { position: relative; margin: 4% 0 1%; font-size: clamp(16px, 4.4vw, 30px); }
.poster .p-sub { position: relative; font-size: clamp(11px, 2.2vw, 16px); color: #5C544C; margin: 0; }
.poster .p-qr { width: 56%; margin: 6% 0 6%; padding: 3%; border-radius: 8%; border: 3px solid var(--brand); }
.poster .p-qr svg { width: 100%; height: auto; }
.poster .p-steps { display: flex; justify-content: center; gap: 4%; font-size: clamp(10px, 1.9vw, 14px); font-weight: 600; width: 100%; }
.poster .p-steps div { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.poster .p-steps i { width: 2em; height: 2em; border-radius: 50%; background: var(--brand-soft); color: var(--brand-2); display: grid; place-items: center; font-style: normal; font-weight: 800; }
.poster .p-foot { margin-top: auto; font-size: clamp(9px, 1.6vw, 12px); color: #958B80; }

@media print {
  @page { size: A4; margin: 0; }
  body * { visibility: hidden !important; }
  .print-area, .print-area * { visibility: visible !important; }
  .print-area { position: fixed; inset: 0; width: 100vw; height: 100vh; box-shadow: none !important; border-radius: 0 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .print-area h2 { font-size: 34pt; } .print-area .p-sub { font-size: 16pt; } .print-area .p-steps { font-size: 14pt; } .print-area .p-foot { font-size: 11pt; }
}

/* ---------- auth page ---------- */
.auth-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1200px 600px at 100% -10%, var(--brand-soft), transparent), var(--bg); }
.auth-card { width: min(420px, 100%); padding: 28px; }
.auth-card .logo { width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 16px; }
.auth-card h1 { text-align: center; font-size: 22px; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.pw-wrap { position: relative; }
.pw-wrap .btn { position: absolute; inset-inline-end: 4px; top: 50%; transform: translateY(-50%); }

/* ---------- admin ---------- */
.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; }
.drawer-ov { position: fixed; inset: 0; z-index: 800; background: rgba(20,16,12,.35); animation: fadeIn .2s; }
.drawer { position: fixed; inset-block: 0; inset-inline-end: 0; width: min(640px, 100%); background: var(--bg); z-index: 801; overflow-y: auto; box-shadow: var(--sh-3); animation: drawerIn .3s var(--ease); }
@keyframes drawerIn { from { transform: translateX(-100%); } }
.drawer-h { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 12px; padding: 14px 18px; background: var(--surface); border-bottom: 1px solid var(--line); }
.drawer-b { padding: 18px; display: flex; flex-direction: column; gap: 16px; }
.search { position: relative; }
.search .ic { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); width: 18px; height: 18px; }
.search input { padding-inline-start: 38px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 10px 14px; font-weight: 600; color: var(--ink-2); border-bottom: 2.5px solid transparent; margin-bottom: -1px; text-decoration: none !important; white-space: nowrap; }
.tabs a.on { color: var(--brand-2); border-bottom-color: var(--brand); }
