/* Restaurant design system (phase 3.11 S3). Loaded before brand.css on every shell: login, desk, /pos, /ury/serve, /mosaic.
   One place for: local fonts, tokens derived from the Brand Settings colour (--rb-color, set by brand.js / inject.py), shared components.
   Fonts: Geist (Latin) + Almarai (Arabic), both SIL OFL 1.1, bundled as woff2 in ../fonts (no CDN: the Android app blocks cross-origin fonts). */

@font-face { font-family: "Geist"; font-weight: 400; font-style: normal; font-display: swap; src: url("/assets/restaurant_brand/fonts/geist-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Geist"; font-weight: 500; font-style: normal; font-display: swap; src: url("/assets/restaurant_brand/fonts/geist-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Geist"; font-weight: 600; font-style: normal; font-display: swap; src: url("/assets/restaurant_brand/fonts/geist-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Geist"; font-weight: 700; font-style: normal; font-display: swap; src: url("/assets/restaurant_brand/fonts/geist-sans-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Almarai"; font-weight: 400; font-style: normal; font-display: swap; src: url("/assets/restaurant_brand/fonts/almarai-400.woff2") format("woff2"); }
@font-face { font-family: "Almarai"; font-weight: 700; font-style: normal; font-display: swap; src: url("/assets/restaurant_brand/fonts/almarai-700.woff2") format("woff2"); }

:root {
  /* type: Latin text uses Geist and falls back to Almarai for Arabic glyphs; RTL pages lead with Almarai (Latin letters and digits stay Western) */
  --rb-font: "Geist", "Almarai", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  --rb-font-ar: "Almarai", "Geist", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  --rb-fs-xs: 12px; --rb-fs-sm: 14px; --rb-fs-md: 16px; --rb-fs-lg: 18px; --rb-fs-xl: 22px; --rb-fs-2xl: 28px;
  --rb-fw-regular: 400; --rb-fw-medium: 500; --rb-fw-bold: 700;
  --rb-lh: 1.5; --rb-lh-ar: 1.75;

  /* colour: everything derives from the brand colour; fallbacks first for old WebViews without color-mix */
  --rb-color: #b8431a;
  --rb-primary: var(--rb-color);
  --rb-primary-hover: #9b3816;
  --rb-primary-soft: #f5e2d6;
  --rb-primary-ink: #ffffff;
  --rb-bg: #faf1e7;           /* cream */
  --rb-surface: #fefaf6;
  --rb-panel: #fbeee2; --rb-primary-tint: #f9ede3; --rb-line-soft: #c3b4a9; --rb-ink-faint: #897b71; --rb-tile-ink: #4a1f0e;
  --rb-line: #573625;           /* dark warm brown borders (direction A) */
  --rb-ink: #352014;           /* warm near-black */
  --rb-ink-soft: #69584e;      /* AA on cream */
  --rb-danger: #b42318; --rb-danger-soft: #fdecea;
  --rb-ok: #1a7f4b; --rb-ok-soft: #e7f6ee;
  --rb-warn: #92580a; --rb-warn-soft: #fdf3e1;

  /* spacing / radii / shadows / motion */
  --rb-s1: 4px; --rb-s2: 8px; --rb-s3: 12px; --rb-s4: 16px; --rb-s5: 24px; --rb-s6: 32px;
  --rb-r-sm: 10px; --rb-r-md: 14px; --rb-r-lg: 14px; --rb-r-pill: 999px;
  --rb-shadow-1: 0 1px 2px rgba(31, 41, 51, .06), 0 1px 3px rgba(31, 41, 51, .08);
  --rb-shadow-2: 0 4px 12px rgba(31, 41, 51, .10), 0 2px 4px rgba(31, 41, 51, .06);
  --rb-t: 160ms cubic-bezier(.2, .7, .3, 1);
  --rb-touch: 44px;
}
@supports (color: color-mix(in srgb, red 10%, white)) {
  :root {
    --rb-primary-hover: color-mix(in srgb, var(--rb-color) 82%, black);
    --rb-primary-soft: color-mix(in srgb, var(--rb-color) 10%, white);
  }
}
@media (min-width: 768px) { :root { --rb-touch: 48px; } }   /* tablet and wider: >= 48px targets */

/* ---- one typeface everywhere (POS, waiter, kitchen, desk, login, quick cards, tours, hints) ---- */
html, body, button, input, select, textarea, .btn, .form-control, .modal, .popover, .tooltip, .shepherd-element, #rb-strip, #rb-hints .rb-hint, #rb-hints .rb-hint-pop {
  font-family: var(--rb-font) !important;
}
html[dir="rtl"], html[dir="rtl"] body, html[dir="rtl"] button, html[dir="rtl"] input, html[dir="rtl"] select, html[dir="rtl"] textarea,
html[dir="rtl"] .btn, html[dir="rtl"] .form-control, html[dir="rtl"] .modal, html[dir="rtl"] .popover, html[dir="rtl"] .tooltip, html[dir="rtl"] .shepherd-element,
html[dir="rtl"] #rb-strip, html[dir="rtl"] #rb-hints .rb-hint, html[dir="rtl"] #rb-hints .rb-hint-pop {
  font-family: var(--rb-font-ar) !important;
}
:root { --font-stack: var(--rb-font); }                 /* Frappe desk variable */
html[dir="rtl"] { --font-stack: var(--rb-font-ar); }
html[dir="rtl"] body { line-height: var(--rb-lh-ar); }
html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; font-variant-numeric: lining-nums; }
/* digits are always Western (0-9), never Arabic-Indic, and tabular where money is aligned */
.rb-num, [data-money], td.text-right, .text-right { font-variant-numeric: tabular-nums lining-nums; }
code, kbd, pre { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace !important; }

/* ---- shared components for our own pages (owner home, quick cards, tours) ---- */
.rb-card { background: var(--rb-surface); border: 2px solid var(--rb-line); border-radius: var(--rb-r-lg); box-shadow: 0 2px 0 rgba(74, 52, 38, .10), 0 6px 14px rgba(74, 52, 38, .10); padding: var(--rb-s4); }
.rb-btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--rb-s2); min-height: var(--rb-touch); padding: 0 var(--rb-s5);
  border-radius: var(--rb-r-md); border: 2px solid var(--rb-line); background: var(--rb-surface); color: var(--rb-ink); font-size: var(--rb-fs-md); font-weight: 700;
  cursor: pointer; transition: background var(--rb-t), box-shadow var(--rb-t), transform var(--rb-t), border-color var(--rb-t); }
.rb-btn:hover { border-color: var(--rb-primary); }
.rb-btn:active { transform: scale(.98); }
.rb-btn:focus-visible { outline: 3px solid var(--rb-primary-soft); outline-offset: 1px; box-shadow: 0 0 0 2px var(--rb-primary); }
.rb-btn[disabled], .rb-btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.rb-btn.rb-primary { background: var(--rb-primary); border-color: var(--rb-primary-hover); color: var(--rb-primary-ink); }
.rb-btn.rb-primary:hover { background: var(--rb-primary-hover); }
.rb-btn.rb-loading { position: relative; color: transparent !important; pointer-events: none; }
.rb-btn.rb-loading::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-top-color: transparent; color: var(--rb-ink-soft); animation: rb-spin .8s linear infinite; }
.rb-btn.rb-primary.rb-loading::after { color: var(--rb-primary-ink); }
.rb-empty { text-align: center; color: var(--rb-ink-soft); padding: var(--rb-s6) var(--rb-s4); font-size: var(--rb-fs-md); }
.rb-empty .rb-empty-ico { font-size: 40px; line-height: 1; margin-bottom: var(--rb-s3); }
.rb-skeleton { display: block; border-radius: var(--rb-r-sm); min-height: 1em; background: linear-gradient(90deg, #ecebe6 25%, #f5f4f0 37%, #ecebe6 63%); background-size: 400% 100%; animation: rb-shimmer 1.4s ease infinite; }
.rb-toast { position: fixed; inset-inline: var(--rb-s4); bottom: calc(var(--rb-h, 26px) + var(--rb-s4)); margin-inline: auto; max-width: 420px; z-index: 2147483100;
  padding: var(--rb-s3) var(--rb-s4); border-radius: var(--rb-r-md); background: var(--rb-ink); color: #fff; box-shadow: var(--rb-shadow-2); font-size: var(--rb-fs-sm); animation: rb-rise 180ms ease-out; }
.rb-toast.rb-error { background: var(--rb-danger); }
.rb-toast.rb-ok { background: var(--rb-ok); }
@keyframes rb-spin { to { transform: rotate(360deg); } }
@keyframes rb-shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
@keyframes rb-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---- gentle motion on the apps' own controls; none for people who ask for less ---- */
button, a, [role="button"], input, select, textarea { transition: background-color var(--rb-t), border-color var(--rb-t), box-shadow var(--rb-t), color var(--rb-t), opacity var(--rb-t); }
button:disabled, [aria-disabled="true"] { cursor: not-allowed; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* ---- touch targets: >= 44px on phones, >= 48px from tablet width, on the cashier / waiter / kitchen screens ---- */
body[data-path="pos"] button:not(.rb-hint):not(.rb-lang):not(.rb-hints-switch), body[data-path="ury"] button:not(.rb-hint):not(.rb-lang):not(.rb-hints-switch),
body[data-path="mosaic"] button:not(.rb-hint):not(.rb-lang):not(.rb-hints-switch) { min-height: var(--rb-touch); min-width: var(--rb-touch); }

/* ---- kitchen (/mosaic): the fixed bottom strip used to cover the last "Ready" button at 390px.
   The app root is pinned to the viewport height by brand.css, so let the kitchen page grow and scroll as a document, with room for the strip. ---- */
body[data-path="mosaic"] #app, body[data-path="mosaic"] #root { height: auto !important; max-height: none !important; min-height: calc(100dvh - var(--rb-h)); }
body[data-path="mosaic"] { padding-bottom: calc(var(--rb-h) + var(--rb-s4)) !important; }

/* ---- waiter screen: the floating bell sits on the inline-end side, and the page keeps room under the last row of tables so it never covers a card ---- */
html[dir="rtl"] .fixed.right-4.z-40 { right: auto !important; left: 1rem !important; align-items: flex-start !important; }
body[data-path="ury"] #app, body[data-path="ury"] #root { box-sizing: border-box; height: auto !important; max-height: none !important; min-height: calc(100dvh - var(--rb-h, 40px)); }
/* room under the last row of cards for the fixed bottom strip AND the floating bell (strip + 48px bell + gaps) - phase 3.12 S5 */
body[data-path="ury"] { padding-bottom: calc(var(--rb-h, 40px) + 168px) !important; }
/* the bell floats above the sticky "Review Order" bar (it used to sit on its end) */
body[data-path="ury"] .fixed.right-4.z-40, html[dir="rtl"] body[data-path="ury"] .fixed.z-40.bottom-4 { bottom: calc(var(--rb-h, 56px) + 7.25rem) !important; } /* 3.14 P3: follows the real strip height (the PIN 'Switch user' button made the strip taller and the bell covered Total) */
/* table / area names wrap instead of being cut with "..." (the card has room for two lines) */
body[data-path="ury"] div[role="button"][aria-label] span.truncate { white-space: normal !important; overflow: visible !important; text-overflow: clip !important; overflow-wrap: anywhere; line-height: 1.2; }

/* ---- phase 3.12 shared components (direction A): chips, segmented tabs, badges, tiles, icon boxes ---- */
.rb-chip-btn { display: inline-flex; align-items: center; gap: var(--rb-s2); min-height: var(--rb-touch); padding: 0 var(--rb-s4); border: 2px solid var(--rb-line); border-radius: var(--rb-r-pill); background: var(--rb-surface); color: var(--rb-ink); font-weight: 600; cursor: pointer; }
.rb-chip-btn[aria-pressed="true"], .rb-chip-btn.rb-on { background: var(--rb-primary); border-color: var(--rb-primary-hover); color: var(--rb-primary-ink); }
.rb-seg { display: inline-flex; border: 2px solid var(--rb-line); border-radius: var(--rb-r-md); overflow: hidden; background: var(--rb-surface); }
.rb-seg > button { min-height: var(--rb-touch); padding: 0 var(--rb-s4); border: 0; background: transparent; color: var(--rb-ink); font-weight: 600; cursor: pointer; }
.rb-seg > button + button { border-inline-start: 2px solid var(--rb-line); }
.rb-seg > button[aria-selected="true"], .rb-seg > button.rb-on { background: var(--rb-primary); color: var(--rb-primary-ink); }
.rb-icon-btn { display: inline-flex; align-items: center; justify-content: center; width: var(--rb-touch); height: var(--rb-touch); border: 2px solid var(--rb-line); border-radius: var(--rb-r-md); background: var(--rb-surface); color: var(--rb-ink); cursor: pointer; }
.rb-badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: var(--rb-r-pill); border: 1.5px solid currentColor; font-size: var(--rb-fs-sm); font-weight: 700; }
.rb-badge.ok { color: var(--rb-ok); background: var(--rb-ok-soft); } .rb-badge.warn { color: var(--rb-warn); background: var(--rb-warn-soft); } .rb-badge.bad { color: var(--rb-danger); background: var(--rb-danger-soft); }
.rb-tile { display: flex; align-items: center; justify-content: center; height: 96px; font-size: 28px; font-weight: 700; color: var(--rb-tile-ink); background: var(--rb-tile-1, var(--rb-primary-soft)); border-radius: 12px 12px 0 0; }
.rb-tile[data-n="2"] { background: var(--rb-tile-2); } .rb-tile[data-n="3"] { background: var(--rb-tile-3); } .rb-tile[data-n="4"] { background: var(--rb-tile-4); } .rb-tile[data-n="5"] { background: var(--rb-tile-5); } .rb-tile[data-n="6"] { background: var(--rb-tile-6); }
.rb-btn.rb-danger { border-color: var(--rb-danger); color: var(--rb-danger); }
.rb-btn:disabled { border-style: dashed; }

/* ---- phase 3.12 S5: cashier POS on tablets (<1024px wide). URY's layout assumes 256px categories + 384px cart; at 768px that left the menu 24px wide.
   Narrower categories and cart under 1024px; the menu grid keeps >= 2 real columns. ---- */
@media (max-width: 1199px) {
  body[data-path="pos"] .w-96.fixed { width: 19rem; }
  body[data-path="pos"] .pe-96 { padding-inline-end: 19rem; }
  body[data-path="pos"] .md\:pe-96 { padding-inline-end: 19rem; }
  body[data-path="pos"] .md\:w-96 { width: 19rem; }
  body[data-path="pos"] .w-64.shrink-0 { width: 13rem; }
  body[data-path="pos"] .w-64.shrink-0 nav { padding: 0.75rem; }
}
@media (max-width: 899px) {
  body[data-path="pos"] .w-64.shrink-0 { width: 11rem; }
  body[data-path="pos"] .w-64.shrink-0 nav { padding: 0.5rem; }
  body[data-path="pos"] .w-64.shrink-0 nav button { padding-inline: 0.5rem; gap: 0.25rem; white-space: normal; height: auto; min-height: var(--rb-touch); justify-content: space-between; }
  body[data-path="pos"] .w-64.shrink-0 nav button svg { display: none; }
  body[data-path="pos"] .w-64.shrink-0 nav button > div { min-width: 0; margin-inline-start: 0; }
  body[data-path="pos"] .w-64.shrink-0 nav button > div > span { font-size: 0.8125rem; line-height: 1.15; }
}

/* ---- phase 3.12 S5: iPad / touch hardening ---- */
/* 100vh is taller than the visible area in Safari (address bar): use the dynamic viewport where the browser has it */
@supports (height: 100dvh) {
  html[data-rb-app] .h-screen { height: 100dvh; }
  html[data-rb-app] .h-\[calc\(100vh-4rem\)\] { height: calc(100dvh - 4rem); }
  html[data-rb-app] .min-h-screen { min-height: 100dvh; }
}
/* iOS zooms the page when a field under 16px gets focus */
@media (pointer: coarse) { html[data-rb-app] input, html[data-rb-app] select, html[data-rb-app] textarea { font-size: max(16px, 1em); } }
/* momentum scrolling, no rubber-band of the whole page behind the app, no grey tap flash, no accidental text selection on buttons */
html[data-rb-app] .overflow-y-auto, html[data-rb-app] .overflow-auto { -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
html[data-rb-app] { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }
html[data-rb-app] button, html[data-rb-app] [role="button"] { touch-action: manipulation; -webkit-user-select: none; user-select: none; }
/* home-screen app (no browser bars): keep clear of the notch / home bar */
html.rb-standalone body { padding-top: env(safe-area-inset-top); padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
html.rb-standalone #rb-strip { padding-bottom: env(safe-area-inset-bottom); }
/* never rely on hover: hover-only reveals are shown on touch screens (the apps have none today; this keeps it that way) */
@media (hover: none) { html[data-rb-app] .group-hover\:opacity-100 { opacity: 1; } html[data-rb-app] .group-hover\:visible { visibility: visible; } }

/* ---- 3.14 B: bottom navigation of the cashier / manager POS = bordered SQUARE tiles (icon above label), centred as a group.
   2px warm-brown border, 14px radius, >= 64px on tablet, 56px on phone, no page overflow (the row scrolls sideways when it must). ---- */
.rb-navbar { background: var(--rb-panel, #fbeee2) !important; }
.rb-navbar nav { padding-inline: var(--rb-s2); }
.rb-nav-row { display: flex; flex-wrap: nowrap; justify-content: safe center; align-items: center; gap: 4px; overflow-x: auto; overflow-y: visible; padding: 8px 6px 4px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.rb-nav-row::-webkit-scrollbar { display: none; }
.rb-nav-tile { position: relative; flex: 0 0 auto; box-sizing: border-box; width: 56px; height: 56px; min-width: 56px; padding: 2px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  border: 2px solid var(--rb-line, #573625); border-radius: 14px; background: var(--rb-surface, #fefaf6); color: var(--rb-ink, #352014); text-decoration: none !important; text-align: center;
  font-size: 10.5px; font-weight: 700; line-height: 1.1; overflow-wrap: anywhere; transition: background var(--rb-t), border-color var(--rb-t), color var(--rb-t); }
.rb-nav-tile:hover { border-color: var(--rb-primary); background: var(--rb-primary-soft); }
.rb-nav-tile.rb-nav-active, .rb-nav-tile.rb-nav-active:hover { background: var(--rb-primary); border-color: var(--rb-primary-hover); color: var(--rb-primary-ink); box-shadow: 0 2px 0 rgba(74, 52, 38, .25); }
.rb-nav-tile:focus-visible { outline: 3px solid var(--rb-primary-soft); outline-offset: 1px; box-shadow: 0 0 0 2px var(--rb-primary); }
.rb-nav-tile svg { width: 22px; height: 22px; }
.rb-nav-tile .rb-nav-label { display: block; max-width: 100%; }
@media (min-width: 600px) {
  .rb-nav-row { gap: 4px; }
  .rb-nav-tile { width: 64px; height: 64px; min-width: 64px; font-size: 12px; }
  .rb-nav-tile svg { width: 24px; height: 24px; }
}
@media (min-width: 1200px) {
  .rb-nav-row { gap: 10px; }
  .rb-nav-tile { width: 76px; height: 76px; font-size: 13px; }
  .rb-nav-tile svg { width: 26px; height: 26px; }
}
/* keep the rail clear of the order panel (fixed on the end side from 768px: 19rem under 1200px, 24rem above) */
@media (min-width: 768px) { body[data-path="pos"] .rb-navbar nav { padding-inline-end: 19rem !important; padding-inline-start: 0 !important; } }
@media (min-width: 1200px) { body[data-path="pos"] .rb-navbar nav { padding-inline-end: 24rem !important; } }
