/* =====================================================================
   MaidaPro — Design System (Phase 1)
   Brand-first, RTL by default (LTR via [dir=ltr] / html[lang=en]).
   Uses CSS logical properties so one rule set serves both directions.
   ===================================================================== */

:root {
    /* Brand palette (locked) */
    --primary: #D97826;
    --primary-dark: #B65F18;
    --gold: #E8B04B;
    --ink: #241A14;
    --accent: #5E8C4F;
    --cream: #FBF6EE;
    --surface: #FFFFFF;
    --muted: #8A7A6C;

    /* Derived */
    --primary-soft: rgba(217, 120, 38, .10);
    --primary-soft-2: rgba(217, 120, 38, .16);
    --ring: rgba(217, 120, 38, .30);
    --accent-soft: rgba(94, 140, 79, .12);
    --danger: #C0432F;
    --danger-soft: rgba(192, 67, 47, .12);
    --logo-grad: linear-gradient(135deg, #F0A845 0%, #D97826 100%);
    --ink-grad: linear-gradient(180deg, #2C2017 0%, #1B130D 100%);

    --border: #ECE3D5;
    --border-strong: #E0D3C0;
    --text: #2C2118;
    --text-2: #6F6052;

    /* Fonts */
    --font-ar: 'Cairo', 'Segoe UI', Tahoma, system-ui, sans-serif;
    --font-en: 'Poppins', 'Cairo', 'Segoe UI', system-ui, sans-serif;

    /* Shape & depth */
    --radius: 16px;
    --radius-sm: 11px;
    --radius-pill: 999px;
    --shadow-sm: 0 1px 2px rgba(36, 26, 20, .06), 0 1px 3px rgba(36, 26, 20, .05);
    --shadow: 0 6px 18px rgba(36, 26, 20, .08);
    --shadow-lg: 0 18px 50px rgba(36, 26, 20, .18);

    /* Metrics */
    --sb-w: 266px;
    --sb-w-collapsed: 78px;
    --topbar-h: 66px;
    --transition: .22s cubic-bezier(.4, 0, .2, 1);
}

* { box-sizing: border-box; }

/* The mobile sidebar is an off-canvas fixed drawer parked just past the inline
   edge. A fixed element is positioned against the viewport, so it ignores body
   overflow — the horizontal scroll region is governed by the ROOT element.
   `overflow-x: hidden` here propagates root→viewport, killing the phantom
   horizontal scroll on narrow phones; overflow-y stays auto so vertical scroll
   and the sticky topbar/sidebar are unaffected. */
html { font-family: var(--font-ar); overflow-x: hidden; }
html[lang="en"] { font-family: var(--font-en); }

body {
    margin: 0;
    background: var(--cream);
    color: var(--text);
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6, .fw-head { font-weight: 700; letter-spacing: -.01em; }

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

::selection { background: var(--primary-soft-2); }

/* Scrollbar */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: rgba(138, 122, 108, .35); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: rgba(138, 122, 108, .55); background-clip: padding-box; }

/* =========================== App shell =========================== */
.app { display: flex; min-height: 100vh; }

.app-main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.content { padding: 26px clamp(16px, 3vw, 34px); flex: 1; }

/* =========================== Sidebar =========================== */
.sidebar {
    flex: 0 0 var(--sb-w);
    width: var(--sb-w);
    background: var(--ink-grad);
    color: #EADFD2;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    align-self: flex-start;
    height: 100vh;
    z-index: 40;
    transition: width var(--transition), transform var(--transition);
    box-shadow: 0 0 40px rgba(0, 0, 0, .12);
}

.sidebar__brand {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 11px;
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
    flex: 0 0 auto;
    direction: ltr;
}
.sidebar__brand .brand-mark { height: 48px; width: auto; display: block; border-radius: 12px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-word { font-family: 'Poppins', 'Segoe UI', sans-serif; font-weight: 700; font-size: 1.55rem; letter-spacing: -1px; }
.brand-word .a { color: #FBF6EE; }
.brand-word .b { color: #F0A845; }
.sidebar__brand .brand-fallback { font-weight: 700; font-size: 1.15rem; color: #fff; white-space: nowrap; }
.sidebar__tagline { font-size: .72rem; color: rgba(234, 223, 210, .72); white-space: nowrap; letter-spacing: .1px; }
/* Restaurant logo variant (uploaded logo shown in place of the MaidaPro wordmark) */
.sidebar__brand .brand-mark--logo { max-width: 130px; object-fit: contain; background: #fff; padding: 5px 8px; border-radius: 10px; }
.brand-name { font-weight: 700; font-size: 1.15rem; color: #fff; white-space: nowrap; }
.sidebar__brand .brand-name { max-width: 150px; overflow: hidden; text-overflow: ellipsis; }

.sidebar__nav { padding: 14px 12px; overflow-y: auto; overflow-x: hidden; flex: 1; }
.sidebar__nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .14); background-clip: padding-box; }

.nav-section {
    color: rgba(234, 223, 210, .5);
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    padding: 16px 14px 6px;
    white-space: nowrap;
}

.nav-link-x {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 11px 14px;
    margin-block: 2px;
    border-radius: var(--radius-sm);
    color: #DCCFBF;
    font-weight: 500;
    white-space: nowrap;
    position: relative;
    transition: background var(--transition), color var(--transition);
}
.nav-link-x .bi { font-size: 1.22rem; flex: 0 0 auto; width: 24px; text-align: center; }
.nav-link-x:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-link-x.active { background: var(--logo-grad); color: #2A1B0E; font-weight: 700; box-shadow: 0 6px 16px rgba(217, 120, 38, .35); }
.nav-link-x.active .bi { color: #2A1B0E; }
.nav-link-x.disabled { opacity: .45; pointer-events: none; }
.nav-link-x .soon {
    margin-inline-start: auto;
    font-size: .6rem;
    background: rgba(255, 255, 255, .12);
    color: #EADFD2;
    padding: 2px 7px;
    border-radius: 999px;
    font-weight: 600;
}

.sidebar__foot {
    padding: 14px 16px;
    border-top: 1px solid rgba(255, 255, 255, .07);
    font-size: .72rem;
    color: rgba(234, 223, 210, .55);
    white-space: nowrap;
    flex: 0 0 auto;
}
.sidebar__foot-brand { display: flex; align-items: center; gap: 7px; }
.foot-mark { height: 18px; width: auto; border-radius: 5px; flex: 0 0 auto; }
.sidebar__dev { margin-top: 4px; font-size: .7rem; }
.sidebar__dev a { color: var(--primary); text-decoration: none; font-weight: 600; }
.sidebar__dev a:hover { text-decoration: underline; }

/* Collapsed state (desktop) */
body.sb-collapsed .sidebar { width: var(--sb-w-collapsed); flex-basis: var(--sb-w-collapsed); }
body.sb-collapsed .sidebar .label,
body.sb-collapsed .sidebar .nav-section,
body.sb-collapsed .sidebar .soon,
body.sb-collapsed .sidebar__brand .brand-fallback,
body.sb-collapsed .brand-text,
body.sb-collapsed .sidebar__foot { display: none; }
body.sb-collapsed .sidebar__brand { padding: 14px 8px; }
body.sb-collapsed .sidebar__brand .brand-mark { height: 42px; }
body.sb-collapsed .sidebar__brand .brand-mark--logo { max-width: 46px; padding: 3px 4px; }
body.sb-collapsed .nav-link-x { justify-content: center; padding-inline: 0; }
body.sb-collapsed .nav-link-x .bi { width: auto; }

/* =========================== Topbar =========================== */
.topbar {
    height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
    padding-inline: clamp(12px, 2vw, 22px);
    position: sticky;
    top: 0;
    z-index: 30;
    box-shadow: var(--shadow-sm);
}

.icon-btn {
    width: 42px; height: 42px;
    display: inline-grid; place-items: center;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius-sm);
    color: var(--text-2);
    cursor: pointer;
    font-size: 1.2rem;
    transition: var(--transition);
}
.icon-btn:hover { background: var(--primary-soft); color: var(--primary); border-color: var(--ring); }

.topbar__title { font-weight: 700; font-size: 1.02rem; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__spacer { flex: 1; }

.shift-chip {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 7px 13px; border-radius: var(--radius-pill);
    background: var(--accent-soft); color: #3F6235;
    font-size: .8rem; font-weight: 600; white-space: nowrap;
}
.shift-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: #C0392B; box-shadow: 0 0 0 3px rgba(192, 57, 43, .15); }
.shift-chip.open .dot { background: var(--accent); box-shadow: 0 0 0 3px rgba(94, 140, 79, .2); }

/* Language toggle */
.lang-toggle {
    display: inline-flex; align-items: center; gap: 6px;
    border: 1px solid var(--border); border-radius: var(--radius-pill);
    padding: 6px 13px; background: var(--surface); color: var(--text-2);
    font-weight: 600; cursor: pointer; font-size: .82rem; transition: var(--transition);
}
.lang-toggle:hover { border-color: var(--ring); color: var(--primary); background: var(--primary-soft); }

/* User menu */
.user-btn { display: inline-flex; align-items: center; gap: 10px; border: 0; background: transparent; cursor: pointer; padding: 4px; border-radius: var(--radius-pill); }
.avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--logo-grad); color: #2A1B0E;
    display: grid; place-items: center; font-weight: 700; flex: 0 0 auto;
    box-shadow: 0 4px 10px rgba(217, 120, 38, .3);
}
.user-btn .who { text-align: start; line-height: 1.15; }
.user-btn .who b { font-size: .86rem; color: var(--ink); display: block; }
.user-btn .who span { font-size: .72rem; color: var(--muted); }

/* =========================== Cards =========================== */
.card-x {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.card-x__head { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.card-x__head h2, .card-x__head h3 { margin: 0; font-size: 1.05rem; }
.card-x__body { padding: 22px; }

.page-head { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 1.5rem; margin: 0; color: var(--ink); }
.page-head .sub { color: var(--muted); font-size: .9rem; margin-top: 2px; }
.page-head .spacer { flex: 1; }
.dash-logo { height: 54px; width: auto; max-width: 160px; object-fit: contain; border-radius: 12px; background: #fff; padding: 6px 10px; border: 1px solid rgba(0, 0, 0, .05); box-shadow: 0 4px 14px rgba(0, 0, 0, .06); flex: 0 0 auto; }
.dash-name { font-size: 1.5rem; margin: 0; color: var(--ink); }

/* Stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 18px; }
.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    display: flex; align-items: center; gap: 16px;
    position: relative; overflow: hidden;
    transition: var(--transition);
}
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.stat::after { content: ""; position: absolute; inset-block-start: -30px; inset-inline-end: -30px; width: 110px; height: 110px; border-radius: 50%; background: var(--primary-soft); }
.stat__icon { width: 54px; height: 54px; border-radius: 14px; display: grid; place-items: center; font-size: 1.6rem; color: #fff; flex: 0 0 auto; z-index: 1; }
.stat__icon.c1 { background: linear-gradient(135deg, #F0A845, #D97826); }
.stat__icon.c2 { background: linear-gradient(135deg, #6FA85C, #5E8C4F); }
.stat__icon.c3 { background: linear-gradient(135deg, #E8B04B, #CE9326); }
.stat__icon.c4 { background: linear-gradient(135deg, #7D6A58, #574636); }
.stat__meta { z-index: 1; }
.stat__num { font-size: 1.7rem; font-weight: 700; color: var(--ink); line-height: 1.1; }
.stat__label { color: var(--muted); font-size: .85rem; }

/* =========================== Buttons =========================== */
.btn-brand {
    background: var(--primary); color: #fff; border: 0;
    border-radius: var(--radius-sm); padding: 10px 20px; font-weight: 600;
    cursor: pointer; transition: var(--transition); box-shadow: 0 6px 16px rgba(217, 120, 38, .28);
    display: inline-flex; align-items: center; gap: 8px;
}
.btn-brand:hover { background: var(--primary-dark); color: #fff; transform: translateY(-1px); }
.btn-brand:active { transform: translateY(0); }
.btn-soft { background: var(--primary-soft); color: var(--primary); border: 1px solid transparent; border-radius: var(--radius-sm); padding: 9px 16px; font-weight: 600; cursor: pointer; transition: var(--transition); display: inline-flex; align-items: center; gap: 7px; }
.btn-soft:hover { background: var(--primary-soft-2); color: var(--primary-dark); }
.btn-ghost { background: transparent; color: var(--text-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 9px 16px; font-weight: 600; cursor: pointer; transition: var(--transition); display: inline-flex; align-items: center; gap: 7px; }
.btn-ghost:hover { border-color: var(--ring); color: var(--primary); background: var(--primary-soft); }
.btn-block { width: 100%; justify-content: center; }

/* =========================== Forms =========================== */
.form-label { font-weight: 600; color: var(--text); margin-bottom: 6px; font-size: .88rem; display: block; }
.form-control, .form-select {
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    padding: 10px 14px; background: var(--surface); color: var(--text); font-family: inherit; font-size: .95rem;
    transition: var(--transition); width: 100%;
}
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); outline: 0; }
.form-control::placeholder { color: #B6A795; }
.field { margin-bottom: 18px; }
.field-hint { color: var(--muted); font-size: .78rem; margin-top: 5px; }
.text-danger, .field-validation-error { color: var(--danger) !important; font-size: .8rem; }
.input-validation-error { border-color: var(--danger) !important; }

/* Switch */
.switch { position: relative; display: inline-flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 48px; height: 27px; border-radius: 999px; background: #D8CBBA; transition: var(--transition); flex: 0 0 auto; position: relative; }
.switch .track::after { content: ""; position: absolute; inset-block-start: 3px; inset-inline-start: 3px; width: 21px; height: 21px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: var(--transition); }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { inset-inline-start: 24px; }

/* =========================== Tables =========================== */
.table-wrap { overflow-x: auto; }
.table-x { width: 100%; border-collapse: separate; border-spacing: 0; }
.table-x thead th {
    text-align: start; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em;
    color: var(--muted); font-weight: 700; padding: 12px 16px; border-bottom: 2px solid var(--border);
    white-space: nowrap; background: #FCF8F1;
}
.table-x tbody td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table-x tbody tr { transition: background .15s; }
.table-x tbody tr:hover { background: var(--primary-soft); }
.table-x tbody tr:last-child td { border-bottom: 0; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; font-size: .76rem; font-weight: 600; }
.pill.ok { background: var(--accent-soft); color: #3F6235; }
.pill.off { background: rgba(138, 122, 108, .15); color: var(--muted); }
.pill.warn { background: rgba(232, 176, 75, .18); color: #8A6310; }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.row-actions { display: inline-flex; gap: 6px; }
.act-btn { width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); cursor: pointer; transition: var(--transition); font-size: 1rem; }
.act-btn:hover { border-color: var(--ring); color: var(--primary); background: var(--primary-soft); }
.act-btn.danger:hover { border-color: rgba(192, 67, 47, .4); color: var(--danger); background: var(--danger-soft); }

.empty-state { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty-state .bi { font-size: 3rem; color: var(--border-strong); display: block; margin-bottom: 12px; }

/* =========================== Tabs (settings) =========================== */
.tabs-x { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 24px; flex-wrap: wrap; }
.tab-x { padding: 11px 18px; border: 0; background: transparent; color: var(--text-2); font-weight: 600; cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px; transition: var(--transition); display: inline-flex; align-items: center; gap: 8px; border-radius: 8px 8px 0 0; }
.tab-x:hover { color: var(--primary); background: var(--primary-soft); }
.tab-x.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-pane-x { display: none; animation: fade .25s ease; }
.tab-pane-x.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* =========================== Login =========================== */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px;
    background: radial-gradient(1200px 600px at 80% -10%, #3A2A1D 0%, transparent 60%), var(--ink-grad); }
.auth-card { width: 100%; max-width: 410px; background: var(--surface); border-radius: 22px; box-shadow: var(--shadow-lg); overflow: hidden; }
.auth-card__top { background: var(--ink-grad); padding: 34px 30px 26px; text-align: center; position: relative; }
.auth-card__top::after { content: ""; position: absolute; inset-block-end: 0; inset-inline: 0; height: 4px; background: var(--logo-grad); }
.auth-brand { display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 13px; direction: ltr; }
.auth-brand .brand-mark { height: 60px; width: auto; display: block; border-radius: 14px; }
.auth-brand .brand-word { font-size: 1.85rem; }
.auth-brand .sidebar__tagline { color: rgba(234, 223, 210, .7); font-size: .82rem; }
.auth-brand .auth-logo { height: 64px; max-width: 190px; object-fit: contain; background: #fff; padding: 7px 11px; border-radius: 14px; }
.auth-brand .brand-name { font-size: 1.4rem; }
.auth-poweredby { display: flex; align-items: center; justify-content: center; gap: 7px; margin-top: 14px; font-size: .72rem; color: rgba(234, 223, 210, .7); direction: ltr; }
.auth-poweredby img { height: 18px; width: auto; border-radius: 5px; }
.auth-poweredby .brand-word { font-size: .95rem; }
.auth-card__body { padding: 30px; }
.auth-card__dev { padding: 0 30px 22px; text-align: center; font-size: .78rem; color: var(--muted); }
.auth-card__dev a { color: var(--primary); text-decoration: none; font-weight: 600; }
.auth-card__dev a:hover { text-decoration: underline; }
.auth-card__body h1 { font-size: 1.3rem; margin: 0 0 4px; color: var(--ink); }
.auth-card__body .lead { color: var(--muted); font-size: .88rem; margin-bottom: 22px; }
.auth-input { position: relative; }
.auth-input .bi { position: absolute; inset-inline-start: 14px; inset-block-start: 50%; transform: translateY(-50%); color: var(--muted); font-size: 1.05rem; }
.auth-input .form-control { padding-inline-start: 42px; }

/* =========================== Mobile / responsive =========================== */
.sb-backdrop { position: fixed; inset: 0; background: rgba(20, 14, 9, .5); backdrop-filter: blur(2px); z-index: 39; opacity: 0; visibility: hidden; transition: var(--transition); }

@media (max-width: 991px) {
    /* Closed drawer is display:none so it never contributes horizontal overflow
       (an off-canvas element parked via transform stays in the scroll region and
       bleeds in on narrow RTL phones). Open = on-screen fixed overlay, slid in. */
    .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; height: 100vh; }
    body:not(.sb-open) .sidebar { display: none; }
    body.sb-open .sidebar { transform: none; animation: sb-slide-in var(--transition); }
    [dir="ltr"] body.sb-open .sidebar { animation-name: sb-slide-in-ltr; }
    body.sb-open .sb-backdrop { opacity: 1; visibility: visible; }
    .topbar__title.long { display: none; }
}
@keyframes sb-slide-in { from { transform: translateX(100%); } to { transform: none; } }
@keyframes sb-slide-in-ltr { from { transform: translateX(-100%); } to { transform: none; } }

@media (min-width: 992px) {
    .sb-backdrop { display: none; }
    #sbOpen { display: none; }
}

/* Touch niceties */
@media (hover: none) {
    .btn-brand, .btn-soft, .btn-ghost, .act-btn, .icon-btn { -webkit-tap-highlight-color: transparent; }
    .act-btn, .icon-btn { width: 44px; height: 44px; }
}

.fade-up { animation: fade .3s ease both; }
.gap-wrap { display: flex; gap: 10px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }

/* Inline bilingual bits without a JSON key (placeholders, footers). */
.lang-en { display: none; }
html[lang="en"] .lang-ar { display: none; }
html[lang="en"] .lang-en { display: inline; }

@media (max-width: 991px) { #sbToggle { display: none; } }

/* ===================== Menu module (Phase 2) ===================== */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.cat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); transition: box-shadow var(--transition); }
.cat-card:hover { box-shadow: var(--shadow); }
.cat-card.sortable-ghost { opacity: .35; }
.cat-card.sortable-chosen { box-shadow: var(--shadow-lg); }
.cat-card__bar { height: 6px; background: var(--cat, #D97826); }
.cat-card__body { padding: 14px 16px; }
.cat-card__top { display: flex; align-items: center; gap: 10px; }
.cat-names { font-weight: 700; font-size: .98rem; color: var(--ink); }
.drag-handle { cursor: grab; color: var(--muted); font-size: 1.1rem; }
.cat-thumb { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; }
.cat-dot { width: 16px; height: 16px; border-radius: 50%; display: inline-block; }
.cat-card__meta { color: var(--muted); font-size: .84rem; margin: 12px 0; display: flex; gap: 14px; }
.cat-card__actions { display: flex; gap: 6px; }

.menu-thumb { width: 46px; height: 46px; border-radius: 10px; object-fit: cover; background: var(--cream); }
.menu-thumb.ph { display: inline-grid; place-items: center; color: var(--border-strong); font-size: 1.3rem; }
.type-badge { font-size: .7rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--primary-soft-2); color: var(--primary-dark); white-space: nowrap; }

.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.check-card { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 10px 12px; cursor: pointer; transition: var(--transition); }
.check-card:hover { border-color: var(--ring); }
.check-card input { width: 18px; height: 18px; accent-color: var(--primary); flex: 0 0 auto; }
.check-card small { color: var(--muted); }

.opt-row, .combo-opt { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.opt-row .form-control, .combo-opt .form-control, .combo-opt .form-select { margin: 0; }
.combo-group { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; margin-bottom: 14px; background: #FCF8F1; }
.combo-group__head { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.est-price { font-size: 1.15rem; font-weight: 700; color: var(--primary); }

.mp-cat { margin-bottom: 30px; }
.mp-cat__h { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.mp-cat__h .bar { width: 5px; height: 26px; border-radius: 3px; background: var(--cat, #D97826); }
.mp-cat__h h2 { margin: 0; font-size: 1.2rem; color: var(--ink); }
.mp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.mp-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); transition: var(--transition); position: relative; }
.mp-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.mp-card__img { height: 120px; width: 100%; object-fit: cover; display: block; background: var(--cream); }
.mp-card__img.ph { display: grid; place-items: center; color: var(--border-strong); font-size: 2rem; }
.mp-card__b { padding: 12px 14px; }
.mp-card__name { font-weight: 700; color: var(--ink); }
.mp-card__desc { color: var(--muted); font-size: .82rem; margin: 4px 0 8px; }
.mp-card__price { color: var(--primary); font-weight: 700; }
.mp-badge { position: absolute; inset-inline-start: 10px; inset-block-start: 10px; background: var(--gold); color: #3a2a12; font-size: .68rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; }
.soldout-badge { position: absolute; inset-inline-end: 10px; inset-block-start: 10px; background: var(--danger); color: #fff; font-size: .68rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; }
.mp-card.soldout { opacity: .55; }

/* ===================== Floor plan (Phase 3) ===================== */
.tbl-legend { display: inline-flex; align-items: center; gap: 7px; font-size: .82rem; color: var(--text-2); }
.tbl-legend .dot { width: 12px; height: 12px; border-radius: 4px; }
.tbl-legend.available .dot { background: var(--accent); }
.tbl-legend.occupied .dot { background: var(--primary); }
.tbl-legend.reserved .dot { background: var(--gold); }
.tbl-legend.cleaning .dot { background: var(--danger); }

.floor-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 14px; }
.tbl { border-radius: var(--radius); padding: 16px 12px; text-align: center; border: 2px solid var(--border); background: var(--surface); box-shadow: var(--shadow-sm); transition: var(--transition); display: flex; flex-direction: column; gap: 6px; min-height: 118px; justify-content: center; color: var(--text); }
a.tbl { cursor: pointer; }
a.tbl:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.tbl__name { font-size: 1.3rem; font-weight: 700; color: var(--ink); }
.tbl__cap { font-size: .8rem; color: var(--muted); }
.tbl__status { font-size: .76rem; font-weight: 600; }
.tbl__order { font-size: .82rem; font-weight: 700; color: var(--primary); background: var(--primary-soft); border-radius: 999px; padding: 2px 10px; display: inline-block; margin: 0 auto; }
.tbl__waiter { font-size: .76rem; font-weight: 600; color: var(--ink); display: flex; align-items: center; justify-content: center; gap: 4px; margin-top: 2px; }
.tbl__waiter i { color: var(--primary); }
.tbl.available { border-color: rgba(94, 140, 79, .5); background: var(--accent-soft); }
.tbl.available .tbl__status { color: #3F6235; }
.tbl.occupied { border-color: var(--primary); background: var(--primary-soft); }
.tbl.occupied .tbl__status { color: var(--primary-dark); }
.tbl.reserved { border-color: rgba(232, 176, 75, .6); background: rgba(232, 176, 75, .14); }
.tbl.reserved .tbl__status { color: #8A6310; }
.tbl.cleaning { border-color: rgba(192, 67, 47, .4); background: var(--danger-soft); }
.tbl.cleaning .tbl__status { color: var(--danger); }
.tbl__act { margin-top: 4px; }

/* ===================== POS (Phase 3) ===================== */
.pos { height: calc(100vh - var(--topbar-h)); display: flex; flex-direction: column; background: var(--cream); }
.pos__head { display: flex; align-items: center; gap: 14px; padding: 12px 18px; background: var(--surface); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.pos__types { display: inline-flex; gap: 6px; background: var(--cream); padding: 4px; border-radius: var(--radius-sm); }
.ptype { border: 0; background: transparent; padding: 9px 16px; border-radius: 9px; font-weight: 600; color: var(--text-2); cursor: pointer; display: inline-flex; align-items: center; gap: 7px; transition: var(--transition); }
.ptype.active { background: var(--primary); color: #fff; box-shadow: 0 4px 10px rgba(217, 120, 38, .3); }
.pos__hfields { display: flex; gap: 12px; flex-wrap: wrap; }
.pos__field { display: flex; flex-direction: column; gap: 2px; }
.pos__field label { font-size: .7rem; color: var(--muted); font-weight: 600; }
.pos__field label .req { color: #C0392B; font-weight: 700; }
.pos__field .form-select, .pos__field .form-control { padding: 7px 12px; min-width: 150px; }
.pos__ordno { margin-inline-start: auto; text-align: center; }
.pos__ordno #ordNo { font-weight: 700; color: var(--primary); font-size: 1.05rem; }

.pos__body { flex: 1; display: flex; min-height: 0; }
.pos__menu { flex: 1; display: flex; flex-direction: column; padding: 14px 18px; min-width: 0; overflow: hidden; }
.pos__menu #posSearch { margin-bottom: 12px; max-width: 360px; }
.pos__cats { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 12px; }
.pcat { border: 1px solid var(--border-strong); background: var(--surface); border-radius: 999px; padding: 7px 16px; font-weight: 600; color: var(--text-2); cursor: pointer; white-space: nowrap; transition: var(--transition); }
.pcat.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.pos__grid { flex: 1; overflow: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); grid-auto-rows: min-content; gap: 12px; align-content: start; }
.pitem { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; cursor: pointer; transition: var(--transition); text-align: start; display: flex; flex-direction: column; position: relative; }
.pitem:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.pitem.out { opacity: .5; pointer-events: none; }
.pitem__img { flex: 0 0 84px; height: 84px; background: var(--cream); width: 100%; object-fit: cover; }
.pitem__img.ph { display: grid; place-items: center; color: var(--border-strong); font-size: 1.5rem; }
.pitem__b { padding: 9px 11px; }
.pitem__n { font-weight: 600; font-size: .88rem; color: var(--ink); line-height: 1.25; }
.pitem__p { color: var(--primary); font-weight: 700; font-size: .85rem; margin-top: 3px; }
.pitem__badge { position: absolute; inset-inline-start: 6px; inset-block-start: 6px; font-size: .6rem; background: var(--gold); color: #3a2a12; padding: 1px 6px; border-radius: 999px; font-weight: 700; }

.pos__ticket { width: 380px; max-width: 42vw; background: var(--surface); border-inline-start: 1px solid var(--border); display: flex; flex-direction: column; }
.ticket__head { padding: 14px 16px; border-bottom: 1px solid var(--border); font-weight: 700; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.ticket__lines { flex: 1; overflow: auto; padding: 8px 12px; }
.tline { border-bottom: 1px solid var(--border); padding: 10px 4px; }
.tline__top { display: flex; align-items: flex-start; gap: 8px; }
.tline__name { font-weight: 600; flex: 1; color: var(--ink); font-size: .9rem; }
.tline__price { font-weight: 700; color: var(--primary); white-space: nowrap; }
.tline__mods { color: var(--muted); font-size: .76rem; margin-top: 3px; }
.tline__note { color: var(--accent); font-size: .74rem; margin-top: 2px; }
.tline__ctrl { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.qtybtn { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; font-weight: 700; color: var(--text-2); display: inline-grid; place-items: center; }
.qtybtn:hover { border-color: var(--ring); color: var(--primary); }
.tline__qty { min-width: 26px; text-align: center; font-weight: 700; }
.tline__del { margin-inline-start: auto; }
.ticket__empty { text-align: center; color: var(--muted); padding: 40px 16px; }
.ticket__totals { border-top: 1px solid var(--border); padding: 12px 16px; }
.trow { display: flex; justify-content: space-between; padding: 3px 0; color: var(--text-2); font-size: .9rem; }
.trow.grand { font-size: 1.15rem; font-weight: 700; color: var(--ink); border-top: 1px dashed var(--border-strong); margin-top: 6px; padding-top: 8px; }
.ticket__actions { padding: 12px 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; border-top: 1px solid var(--border); }
.ticket__actions button { justify-content: center; }
.ticket__actions #btnSend { grid-column: 1 / -1; }
.danger-btn { color: var(--danger); }
.danger-btn:hover { background: var(--danger-soft); border-color: rgba(192, 67, 47, .4); color: var(--danger); }

.pos-modal { position: fixed; inset: 0; background: rgba(20, 14, 9, .5); backdrop-filter: blur(2px); z-index: 60; display: grid; place-items: center; padding: 20px; }
.pos-modal[hidden] { display: none; }
.pos-modal__box { background: var(--surface); border-radius: var(--radius); width: 100%; max-width: 520px; max-height: 88vh; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); overflow: hidden; }
.pos-modal__head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.pos-modal__head h3 { margin: 0; font-size: 1.1rem; flex: 1; }
.pos-modal__body { padding: 18px 20px; overflow: auto; }
.pos-modal__foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: space-between; align-items: center; }
.mgroup { margin-bottom: 16px; }
.mgroup__h { font-weight: 700; margin-bottom: 8px; display: flex; gap: 8px; align-items: center; }
.mgroup__req { font-size: .66rem; background: var(--primary-soft-2); color: var(--primary-dark); padding: 1px 7px; border-radius: 999px; }
.mopt { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); margin-bottom: 7px; cursor: pointer; }
.mopt:hover { border-color: var(--ring); }
.mopt input { width: 18px; height: 18px; accent-color: var(--primary); }
.mopt__p { margin-inline-start: auto; color: var(--muted); font-size: .84rem; }
.modal-price { font-weight: 700; color: var(--primary); font-size: 1.1rem; }

@media (max-width: 991px) {
    .pos__body { flex-direction: column; }
    .pos__ticket { width: auto; max-width: none; border-inline-start: 0; border-top: 1px solid var(--border); max-height: 46vh; }
}

/* ===================== KDS — Kitchen display (Phase 4) ===================== */
.kds { height: calc(100vh - var(--topbar-h)); display: flex; flex-direction: column; background: #1b130d; }
.kds__bar { display: flex; align-items: center; gap: 10px; padding: 12px 18px; background: #2a1f17; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.kds__stations { display: inline-flex; gap: 6px; background: rgba(255, 255, 255, .06); padding: 4px; border-radius: 12px; }
.kstation { border: 0; background: transparent; color: #cbb9a6; padding: 10px 18px; border-radius: 9px; font-weight: 700; cursor: pointer; display: inline-flex; gap: 8px; align-items: center; font-size: 1rem; }
.kstation.active { background: var(--primary); color: #fff; }
.kds__spacer { flex: 1; }
.kds__conn { display: inline-flex; align-items: center; }
.kds__conn .dot { width: 12px; height: 12px; border-radius: 50%; background: #c0392b; box-shadow: 0 0 0 3px rgba(192, 57, 43, .2); }
.kds__conn.ok .dot { background: #5E8C4F; box-shadow: 0 0 0 3px rgba(94, 140, 79, .25); }
.kbtn-soft { border: 1px solid rgba(255, 255, 255, .15); background: transparent; color: #e8dccd; padding: 9px 14px; border-radius: 10px; cursor: pointer; font-weight: 600; display: inline-flex; gap: 7px; align-items: center; }
.kbtn-soft.off { opacity: .5; }
.kds__board { flex: 1; overflow: auto; padding: 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); grid-auto-rows: max-content; gap: 16px; align-content: start; align-items: start; }
.kds__empty { color: rgba(255, 255, 255, .5); text-align: center; grid-column: 1 / -1; padding: 80px 20px; font-size: 1.3rem; }
.kds__empty .bi { font-size: 3rem; display: block; margin-bottom: 12px; }

.kticket { background: #fff; border-radius: 14px; overflow: hidden; border-top: 8px solid var(--accent); box-shadow: 0 6px 18px rgba(0, 0, 0, .3); display: flex; flex-direction: column; }
.kticket.fresh { border-top-color: #5E8C4F; }
.kticket.warn { border-top-color: #E8B04B; }
.kticket.late { border-top-color: #C0392B; animation: kpulse 1.5s infinite; }
@keyframes kpulse { 0%, 100% { box-shadow: 0 6px 18px rgba(0, 0, 0, .3); } 50% { box-shadow: 0 6px 26px rgba(192, 57, 43, .5); } }
.kticket.ready { opacity: .82; }
.kticket__h { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.korder { font-size: 1.5rem; font-weight: 800; color: var(--ink); }
.ktype { background: var(--primary-soft-2); color: var(--primary-dark); font-weight: 700; font-size: .78rem; padding: 3px 9px; border-radius: 999px; }
.ktimer { margin-inline-start: auto; font-weight: 800; font-size: 1.1rem; color: var(--text-2); }
.kticket.late .ktimer { color: #C0392B; }
.kticket__meta { display: flex; gap: 14px; padding: 6px 14px; color: var(--muted); font-size: .9rem; }
.kitems { padding: 4px 14px; flex: 1; }
.kitem { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px dashed var(--border); }
.kitem:last-child { border-bottom: 0; }
.kitem.ready { opacity: .45; }
.kitem.preparing { background: rgba(232, 176, 75, .1); margin: 0 -14px; padding: 10px 14px; }
.kitem__l { flex: 1; font-size: 1.15rem; font-weight: 600; color: var(--ink); }
.kqty { font-weight: 800; color: var(--primary); }
.kmods { font-size: .9rem; color: var(--muted); font-weight: 400; margin-top: 2px; }
.knote { font-size: .9rem; color: #C0392B; font-weight: 700; margin-top: 2px; }
.kitem__b { display: flex; flex-direction: column; gap: 5px; }
.kib { border: 0; border-radius: 8px; padding: 8px 12px; font-weight: 700; cursor: pointer; font-size: .85rem; white-space: nowrap; }
.kib.start { background: var(--gold); color: #3a2a12; }
.kib.ready { background: var(--accent); color: #fff; }
.kib.recall { background: rgba(138, 122, 108, .2); color: var(--text-2); }
.kticket__f { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--border); }
.kof { flex: 1; border: 0; border-radius: 9px; padding: 11px; font-weight: 700; cursor: pointer; font-size: .95rem; }
.kof.start { background: var(--gold); color: #3a2a12; }
.kof.ready { background: var(--accent); color: #fff; }

/* POS "ready" banner (Phase 4) */
.pos-ready-banner { position: fixed; inset-block-start: calc(var(--topbar-h) + 10px); inset-inline: 0; margin: 0 auto; width: max-content; max-width: 90%; background: var(--accent); color: #fff; padding: 12px 26px; border-radius: var(--radius-pill); box-shadow: var(--shadow-lg); z-index: 50; font-weight: 700; display: flex; align-items: center; gap: 12px; animation: fade .3s ease; }
.pos-ready-banner button { background: rgba(255, 255, 255, .25); border: 0; color: #fff; padding: 6px 14px; border-radius: 999px; font-weight: 700; cursor: pointer; }

/* ===================== Shifts & Payments (Phase 5) ===================== */
.shift-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 16px; align-items: start; }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--border); color: var(--text-2); }
.kv:last-child { border-bottom: 0; }
.kv b { color: var(--ink); font-weight: 700; }
.kv.big { font-size: 1.15rem; } .kv.big b { color: var(--primary); }
.shift-actions { margin-top: 12px; display: flex; gap: 8px; }
.alert-x { display: flex; align-items: center; gap: 10px; background: var(--primary-soft-2); color: var(--primary-dark); border: 1px solid var(--primary-soft-2); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; font-weight: 600; }
.alert-x.warn { background: #fbeeda; color: #92591a; border-color: #f0d9b5; }
.alert-x .bi { font-size: 1.2rem; }
.btn-danger { display: inline-flex; align-items: center; gap: 8px; background: #c0392b; color: #fff; border: 0; border-radius: 12px; padding: 11px 18px; font-weight: 700; cursor: pointer; }
.btn-danger:disabled { opacity: .5; cursor: not-allowed; }
.text-danger { color: #c0392b; }

.pay-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.pay-items { max-height: 260px; overflow: auto; margin-bottom: 10px; }
.pay-line { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--border); font-size: .92rem; }
.pay-tot { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; color: var(--text-2); }
.pay-tot.grand { font-size: 1.25rem; font-weight: 800; color: var(--ink); border-top: 2px solid var(--border); margin-top: 6px; padding-top: 10px; }
.pay-remaining { display: flex; justify-content: space-between; align-items: center; background: var(--ink); color: #fff; border-radius: 12px; padding: 14px 18px; margin-bottom: 12px; }
.pay-remaining b { font-size: 1.6rem; font-weight: 800; }
.pay-paid { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.pay-paid-line { display: flex; justify-content: space-between; gap: 10px; background: var(--primary-soft-2); border-radius: 8px; padding: 7px 12px; font-size: .9rem; }
.pay-split { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; color: var(--text-2); font-size: .9rem; }
.pay-methods { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin-bottom: 12px; }
.pmethod { display: flex; flex-direction: column; align-items: center; gap: 4px; border: 2px solid var(--border); background: #fff; border-radius: 12px; padding: 12px 8px; cursor: pointer; font-weight: 700; color: var(--ink); }
.pmethod .bi { font-size: 1.4rem; color: var(--primary); }
.pmethod.active { border-color: var(--primary); background: var(--primary-soft-2); }
.pay-entry .field { margin-bottom: 10px; }
.pay-entry .btn-brand { width: 100%; justify-content: center; }
.pay-settled { max-width: 460px; margin: 24px auto; text-align: center; background: #fff; border: 1px solid var(--border); border-radius: 16px; padding: 30px; box-shadow: var(--shadow-lg); }
.pay-settled .bi { font-size: 3rem; color: var(--accent); }
.pay-settled > div { margin: 8px 0; font-size: 1.2rem; font-weight: 700; }
.pay-change { color: var(--primary); }
.pay-settled__actions { display: flex; gap: 10px; justify-content: center; margin-top: 16px; }
.act-btn.pay { color: var(--accent); }
.muted { color: var(--muted); }
@media (max-width: 860px) { .pay-grid { grid-template-columns: 1fr; } }

/* ===================== Customers & Delivery (Phase 6) ===================== */
.cust-grid { display: grid; grid-template-columns: 1fr 1.3fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .cust-grid { grid-template-columns: 1fr; } }
.addr-row { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--border); }
.addr-row:last-of-type { border-bottom: 0; }
.addr-add { margin-top: 12px; }
.addr-add > summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; color: var(--primary); font-weight: 700; list-style: none; }
.addr-add > summary::-webkit-details-marker { display: none; }

.pos__delivery { min-width: 260px; }
.pos__delrow { display: flex; gap: 6px; }
.pos__delrow .form-control, .pos__delrow .form-select { flex: 1; }

.del-board { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; align-items: start; }
@media (max-width: 1100px) { .del-board { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); overflow-x: auto; padding-bottom: 8px; } }
.dcol { background: #f4ece1; border: 1px solid var(--border); border-radius: 14px; display: flex; flex-direction: column; min-height: 120px; }
.dcol__h { display: flex; align-items: center; justify-content: space-between; padding: 11px 14px; font-weight: 800; color: var(--ink); border-bottom: 1px solid var(--border); }
.dcol__n { background: var(--ink); color: #fff; min-width: 22px; height: 22px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; font-size: .78rem; }
.dcol__b { padding: 10px; display: flex; flex-direction: column; gap: 10px; }
.dcol__empty { color: var(--muted); text-align: center; padding: 14px; }
.dcard { background: #fff; border: 1px solid var(--border); border-inline-start: 4px solid var(--primary); border-radius: 11px; padding: 11px 12px; box-shadow: 0 2px 6px rgba(0,0,0,.05); }
.dcard.ready { border-inline-start-color: var(--accent); box-shadow: 0 0 0 2px rgba(94,140,79,.18); }
.dcard.failed { border-inline-start-color: #c0392b; opacity: .8; }
.dcard__h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.dorder { font-weight: 800; color: var(--ink); }
.dtotal { font-weight: 800; color: var(--primary-dark); }
.dcard__cust { font-size: .9rem; }
.dcard__addr, .dcard__zone, .dcard__drv { font-size: .82rem; color: var(--muted); margin-top: 3px; }
.dcard__assign { display: flex; gap: 6px; margin-top: 9px; }
.dcard__assign .dsel { flex: 1; min-width: 0; }
.dcard__two { display: flex; gap: 6px; margin-top: 9px; }
.dbtn { border: 0; border-radius: 8px; padding: 8px 10px; font-weight: 700; cursor: pointer; font-size: .85rem; background: var(--primary); color: #fff; display: inline-flex; align-items: center; gap: 5px; justify-content: center; white-space: nowrap; text-decoration: none; }
.dbtn.full { width: 100%; margin-top: 9px; }
.dcard__two .dbtn { flex: 1; }
.dbtn.btn-danger { background: #c0392b; }
.dbadge { margin-top: 9px; text-align: center; padding: 7px; border-radius: 8px; font-weight: 700; font-size: .85rem; }
.dbadge.ok { background: rgba(94,140,79,.15); color: #2f6b3f; }
.dbadge.warn { background: #fbeeda; color: #92591a; }
.dbadge.fail { background: rgba(192,57,43,.12); color: #c0392b; }

/* ===================== Reports & Dashboard (Phase 7) ===================== */
.rep-bar { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; margin-bottom: 16px; display: flex; flex-direction: column; gap: 12px; }
.rep-tabs { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1px solid var(--border); padding-bottom: 10px; }
.rep-tab { padding: 8px 14px; border-radius: 9px; font-weight: 700; color: var(--text-2); text-decoration: none; }
.rep-tab.active { background: var(--primary); color: #fff; }
.rep-tab:hover:not(.active) { background: var(--primary-soft-2); }
.rep-controls { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.rep-presets { display: inline-flex; gap: 4px; background: var(--primary-soft-2); padding: 4px; border-radius: 10px; }
.rep-preset { padding: 6px 12px; border-radius: 7px; font-weight: 600; font-size: .86rem; color: var(--text-2); text-decoration: none; }
.rep-preset.active { background: var(--primary); color: #fff; }
.rep-custom { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); }
.rep-custom .form-control { width: 150px; }
.rep-actions { display: inline-flex; gap: 8px; margin-inline-start: auto; }
.rep-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--border); padding: 1px; border-radius: 0 0 14px 14px; overflow: hidden; }
.rep-summary > div { background: #fff; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.rep-summary > div span { color: var(--muted); font-size: .82rem; }
.rep-summary > div b { font-size: 1.05rem; color: var(--ink); }
.rep-summary > div.grand b { color: var(--primary); font-size: 1.25rem; }
.rep-charts { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 16px; margin-top: 16px; align-items: start; }
.rep-charts .card-x.wide { grid-column: span 3; }
.rep-tables { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; align-items: start; }
@media (max-width: 1000px) { .rep-charts { grid-template-columns: 1fr; } .rep-charts .card-x.wide { grid-column: auto; } .rep-tables { grid-template-columns: 1fr; } }
.rep-printhead { display: none; }
.dash-shift { display: inline-flex; align-items: center; gap: 10px; background: var(--ink); color: #fff; border-radius: 12px; padding: 10px 16px; text-decoration: none; }
.dash-shift .bi { font-size: 1.3rem; color: var(--gold); }
.dash-shift__n { font-weight: 700; }
.dash-shift__c { font-size: .85rem; opacity: .85; }

@media print {
    .sidebar, .topbar, .sb-backdrop, .noprint, .rep-bar { display: none !important; }
    .app-main { margin: 0 !important; }
    .content { padding: 0 !important; }
    .rep-printhead { display: flex !important; align-items: center; justify-content: space-between; border-bottom: 2px solid #000; padding-bottom: 10px; margin-bottom: 14px; }
    .rep-printhead img { height: 40px; }
    .card-x, .rep-summary > div { box-shadow: none !important; border-color: #ccc !important; break-inside: avoid; }
    .rep-charts, .rep-tables { display: block !important; }
    .rep-charts .card-x, .rep-tables .card-x { margin-bottom: 14px; }
    body { background: #fff !important; }
}

/* ===================== Help system (Phase 8) ===================== */
.help-btn { color: var(--primary); }
/* contextual offcanvas */
.help-oc { width: 440px; max-width: 92vw; }
.help-oc .offcanvas-header { border-bottom: 1px solid var(--border); }
.help-oc .offcanvas-title { font-weight: 800; color: var(--ink); }
.help-loading { display: flex; justify-content: center; padding: 40px 0; }
.help-empty { text-align: center; color: var(--muted); padding: 28px 14px; }
.help-empty i { font-size: 2.2rem; display: block; margin-bottom: 8px; color: var(--primary); opacity: .6; }
.help-empty p { margin-bottom: 14px; }
.help-content { line-height: 1.9; color: var(--ink); }
.help-content h1, .help-content h2, .help-content h3 { color: var(--ink); margin: 14px 0 8px; }
.help-content ul, .help-content ol { padding-inline-start: 22px; }
.help-content li { margin: 4px 0; }
.help-content a { color: var(--primary); }
.help-content blockquote { border-inline-start: 3px solid var(--primary); padding-inline-start: 12px; color: var(--text-2); margin: 10px 0; }
.help-oc-gallery, .help-gallery { display: grid; gap: 12px; margin-top: 16px; }
.help-oc-gallery { grid-template-columns: 1fr; }
.help-gallery { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.help-oc-gallery figure, .help-gallery figure { margin: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: #fff; }
.help-oc-gallery img, .help-gallery img { width: 100%; display: block; }
.help-oc-gallery figcaption, .help-gallery figcaption { padding: 8px 10px; font-size: .85rem; color: var(--text-2); background: var(--primary-soft-2); }
.help-oc-foot { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }

/* help center */
.help-center { display: grid; grid-template-columns: 290px 1fr; gap: 18px; align-items: start; }
.help-side { background: #fff; border: 1px solid var(--border); border-radius: 16px; padding: 14px; position: sticky; top: 84px; max-height: calc(100vh - 110px); overflow: auto; }
.help-search { position: relative; margin-bottom: 12px; }
.help-search i { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.help-search input { width: 100%; padding: 10px 12px; padding-inline-start: 34px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); }
.help-group { margin-bottom: 14px; }
.help-group__h { font-size: .78rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 4px 8px; }
.help-link { display: block; padding: 8px 10px; border-radius: 9px; color: var(--text-2); text-decoration: none; font-weight: 600; font-size: .92rem; }
.help-link:hover { background: var(--primary-soft-2); color: var(--ink); }
.help-link.active { background: var(--primary); color: #fff; }
.help-main { background: #fff; border: 1px solid var(--border); border-radius: 16px; padding: 26px 30px; min-height: 60vh; }
.help-art__mod { display: inline-block; font-size: .78rem; font-weight: 700; color: var(--primary); background: var(--primary-soft-2); padding: 3px 10px; border-radius: 20px; margin-bottom: 8px; }
.help-art h1 { font-size: 1.6rem; color: var(--ink); margin-bottom: 14px; }
.help-related { margin-top: 26px; padding-top: 16px; border-top: 1px dashed var(--border); }
.help-related h3 { font-size: 1rem; color: var(--ink); margin-bottom: 10px; }
.help-related__list { display: flex; flex-wrap: wrap; gap: 8px; }
.help-rel { padding: 6px 12px; border: 1px solid var(--border); border-radius: 20px; text-decoration: none; color: var(--text-2); font-size: .86rem; }
.help-rel:hover { border-color: var(--primary); color: var(--primary); }
@media (max-width: 900px) { .help-center { grid-template-columns: 1fr; } .help-side { position: static; max-height: none; } }

/* help admin */
.help-form__row { display: flex; flex-wrap: wrap; gap: 16px; align-items: end; }
.help-form__row .field { flex: 1; min-width: 200px; }
.help-form__row .field--sm { flex: 0 0 110px; min-width: 110px; }
.help-form__row .field--check { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; }
.help-form__editors { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.help-editor { height: 260px; background: #fff; }
.help-editor .ql-editor { font-family: inherit; }
@media (max-width: 900px) { .help-form__editors { grid-template-columns: 1fr; } }
.help-savefirst { display: flex; align-items: center; gap: 10px; color: var(--text-2); margin-top: 16px; }
.help-savefirst i { color: var(--primary); font-size: 1.3rem; }
.help-upload { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.help-upload .form-control { flex: 1; min-width: 160px; }
.help-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-top: 12px; }
.help-thumb { position: relative; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: #fff; cursor: grab; }
.help-thumb img { width: 100%; height: 120px; object-fit: cover; display: block; }
.help-thumb__cap { padding: 6px 8px; font-size: .8rem; color: var(--text-2); min-height: 28px; }
.help-thumb__del { position: absolute; top: 6px; inset-inline-end: 6px; border: 0; background: rgba(192,57,43,.92); color: #fff; width: 28px; height: 28px; border-radius: 8px; cursor: pointer; }

/* POS — require an open shift before selling */
.pos { position: relative; }
.pos-noshift { position: absolute; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(36, 26, 20, .5); backdrop-filter: blur(3px); }
.pos-noshift__card { background: #fff; border: 1px solid var(--border); border-radius: 18px; padding: 34px 38px; max-width: 440px; text-align: center; box-shadow: 0 24px 60px rgba(0, 0, 0, .28); }
.pos-noshift__card i { font-size: 2.8rem; color: var(--primary); }
.pos-noshift__card h2 { margin: 14px 0 8px; color: var(--ink); font-size: 1.4rem; }
.pos-noshift__card p { color: var(--text-2); margin-bottom: 18px; line-height: 1.7; }

/* floor plan — table with multiple orders + merge */
.tbl-wrap { display: flex; flex-direction: column; gap: 6px; }
.tbl.multi { outline: 2px solid var(--gold); outline-offset: 1px; }
.tbl-merge { margin: 0; }
.tbl-merge button { width: 100%; padding: 5px 8px; font-size: .74rem; }

/* shift page — sales-by-method + summary cards */
.shift-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; align-items: start; }
@media (max-width: 800px) { .shift-summary { grid-template-columns: 1fr; } }

/* ===================== Phone layer (≤640px) ===================== */
/* FAB + backdrop are POS-only and hidden on larger screens */
.pos__cartfab, .pos__cartbd { display: none; }

@media (max-width: 640px) {
    /* Topbar: the row can't wrap (fixed height), so it must fit the viewport
       or it overflows `visible` and balloons the layout viewport — which then
       stretches the fixed POS bottom-sheet/FAB to the inflated width. Drop the
       redundant restaurant-name title (the brand lives in the drawer), tighten
       gap/padding, and let the shift chip shrink with ellipsis. */
    .topbar { gap: 6px; padding-inline: 10px; }
    .topbar__title { display: none; }
    .shift-chip { min-width: 0; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

    /* Data tables: keep columns at natural width and scroll the wrap
       instead of squishing every cell into the viewport */
    .table-wrap { -webkit-overflow-scrolling: touch; }
    .table-x th, .table-x td { white-space: nowrap; }

    /* Page heads: filters/actions wrap to full width without bleeding */
    .page-head { flex-wrap: wrap; row-gap: 10px; }
    .page-head .gap-wrap, .page-head form { flex-wrap: wrap; width: 100%; }
    .page-head .gap-wrap .form-select, .page-head .gap-wrap .form-control,
    .page-head form .form-select, .page-head form .form-control { flex: 1 1 120px; width: auto !important; min-width: 0; }

    /* Reports: never bleed horizontally on a phone */
    .card-x canvas, .rep-charts canvas { max-width: 100% !important; }
    .rep-controls { width: 100%; }
    .rep-actions { margin-inline-start: 0; }
    .rep-custom { flex-wrap: wrap; }
    .rep-custom .form-control { width: auto; flex: 1 1 120px; }

    /* POS header: fields shrink and wrap instead of forcing 150px each */
    .pos__head { gap: 10px; padding: 10px 14px; }
    .pos__hfields { width: 100%; gap: 10px; }
    .pos__field { flex: 1 1 130px; min-width: 0; }
    .pos__field .form-select, .pos__field .form-control { min-width: 0; width: 100%; }
    .pos__ordno { margin-inline-start: 0; }
    .pos__menu { padding: 12px 14px; }
    .pos__menu #posSearch { max-width: none; }
    /* leave room so the cart FAB never covers the last grid row */
    .pos__grid { padding-bottom: 78px; }

    /* POS: the menu fills the screen; the cart becomes a bottom sheet */
    .pos__body { flex-direction: column; }
    .pos__ticket {
        position: fixed; inset-inline: 0; inset-block-end: 0;
        width: auto; max-width: none; height: auto; max-height: 84vh;
        border-inline-start: 0; border-top: 1px solid var(--border);
        border-radius: 18px 18px 0 0; box-shadow: 0 -10px 40px rgba(0, 0, 0, .3);
        transform: translateY(calc(100% + 30px)); transition: transform .28s ease;
        z-index: 55;
    }
    .pos--cart-open .pos__ticket { transform: translateY(0); }
    .pos__ticket .ticket__head { padding-block-start: 20px; }
    .pos__ticket .ticket__head::before {
        content: ""; position: absolute; inset-block-start: 8px; inset-inline: 0;
        margin: 0 auto; width: 42px; height: 4px; border-radius: 999px; background: var(--border-strong);
    }

    .pos__cartbd { display: block; position: fixed; inset: 0; z-index: 54;
        background: rgba(20, 14, 9, .42); opacity: 0; pointer-events: none; transition: opacity .28s; }
    .pos--cart-open .pos__cartbd { opacity: 1; pointer-events: auto; }

    .pos__cartfab {
        display: flex; align-items: center; gap: 10px;
        position: fixed; inset-block-end: 16px; inset-inline: 14px; z-index: 53;
        border: 0; border-radius: 14px; background: var(--primary); color: #fff;
        padding: 14px 18px; font-weight: 700; font-size: 1rem; cursor: pointer;
        box-shadow: 0 10px 30px rgba(217, 120, 38, .45);
    }
    .pos--cart-open .pos__cartfab { display: none; }
    .pos__cartfab .fab-count { background: #fff; color: var(--primary); border-radius: 999px;
        min-width: 24px; height: 24px; display: inline-grid; place-items: center; font-size: .85rem; padding: 0 7px; }
    .pos__cartfab .fab-total { margin-inline-start: auto; }
}
