/* ============================================================
   SilaOrder — Design System
   Restaurant Revenue Operating System
   ============================================================ */

:root {
    /* Brand palette — warm emerald + saffron, food-forward */
    --brand-900: #06281e;
    --brand-800: #0a3a2c;
    --brand-700: #0e4d3a;
    --brand-600: #12604a;
    --brand-500: #17795d;
    --brand-400: #2c9a78;
    --brand-300: #5fbd9d;
    --brand-100: #d9efe6;
    --brand-50:  #eef8f3;

    --accent-600: #d97706;
    --accent-500: #f59e0b;
    --accent-100: #fef3c7;

    --danger-600: #dc2626;
    --danger-100: #fee2e2;
    --warn-600: #d97706;
    --warn-100: #fef3c7;
    --ok-600: #059669;
    --ok-100: #d1fae5;
    --info-600: #2563eb;
    --info-100: #dbeafe;
    --purple-600: #7c3aed;
    --purple-100: #ede9fe;

    --ink-900: #111827;
    --ink-700: #374151;
    --ink-500: #6b7280;
    --ink-400: #9ca3af;
    --ink-200: #e5e7eb;
    --ink-100: #f3f4f6;
    --ink-50:  #f9fafb;

    --surface: #ffffff;
    --bg: #f4f6f5;

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 18px;

    --shadow-sm: 0 1px 2px rgba(17, 24, 39, .05);
    --shadow: 0 1px 3px rgba(17, 24, 39, .07), 0 4px 14px rgba(17, 24, 39, .05);
    --shadow-lg: 0 10px 34px rgba(17, 24, 39, .13);

    --sidebar-w: 264px;
    --font: 'Segoe UI', 'Inter', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--ink-900);
    font-size: 14.5px;
    line-height: 1.55;
}
a { color: var(--brand-600); text-decoration: none; }
a:hover { text-decoration: none; }
h1,h2,h3,h4 { margin: 0; font-weight: 700; letter-spacing: -.015em; }
img { max-width: 100%; }

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

.sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(178deg, var(--brand-900) 0%, var(--brand-800) 55%, #0c3527 100%);
    color: #cfe6db;
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    transition: transform .25s ease;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 11px;
    padding: 20px 22px 16px;
}
.sidebar-brand .logo-mark {
    width: 38px; height: 38px; border-radius: 11px;
    background: linear-gradient(135deg, var(--accent-500), #e8590c);
    display: grid; place-items: center;
    font-weight: 800; font-size: 19px; color: #fff;
    box-shadow: 0 4px 14px rgba(245, 158, 11, .35);
    flex-shrink: 0;
}
.sidebar-brand .brand-name { font-size: 17.5px; font-weight: 800; color: #fff; letter-spacing: -.02em; }
.sidebar-brand .brand-sub { font-size: 10.5px; color: #7fb5a0; letter-spacing: .06em; text-transform: uppercase; }

.sidebar-tenant {
    margin: 4px 16px 10px;
    padding: 10px 12px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    color: #e5f3ec;
    display: flex; align-items: center; gap: 9px;
    overflow: hidden;
}
.sidebar-tenant .dot { width: 8px; height: 8px; border-radius: 99px; background: #34d399; flex-shrink: 0; box-shadow: 0 0 0 3px rgba(52,211,153,.2); }
.sidebar-tenant span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 4px 12px 20px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.2) transparent; }
.nav-section { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: #6f9f8d; padding: 16px 12px 6px; font-weight: 700; }
.nav-link {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 12px;
    border-radius: 9px;
    color: #cfe6db;
    font-weight: 500;
    font-size: 13.5px;
    margin-bottom: 1px;
    transition: background .13s, color .13s;
}
.nav-link svg { width: 18px; height: 18px; opacity: .8; flex-shrink: 0; }
.nav-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-link.active { background: rgba(255,255,255,.12); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 var(--accent-500); }
.nav-link .nav-badge {
    margin-left: auto;
    background: var(--accent-500); color: #3b2503;
    font-size: 10.5px; font-weight: 700;
    border-radius: 99px; padding: 1px 7px;
}

.sidebar-foot { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12px; color: #7fb5a0; }

.main {
    flex: 1;
    margin-left: var(--sidebar-w);
    display: flex; flex-direction: column;
    min-width: 0;
}

/* ============ Topbar ============ */
.topbar {
    height: 62px;
    background: var(--surface);
    border-bottom: 1px solid var(--ink-200);
    display: flex; align-items: center; gap: 14px;
    padding: 0 22px;
    position: sticky; top: 0; z-index: 40;
}
.topbar .page-title { font-size: 16.5px; font-weight: 700; }
.topbar-spacer { flex: 1; }
.hamburger {
    display: none;
    background: none; border: 0; cursor: pointer; padding: 8px;
    border-radius: 8px; color: var(--ink-700);
}
.hamburger:hover { background: var(--ink-100); }

.lang-switch { display: flex; background: var(--ink-100); border-radius: 99px; padding: 3px; }
.lang-switch a {
    padding: 4px 12px; border-radius: 99px; font-size: 12px; font-weight: 700;
    color: var(--ink-500);
}
.lang-switch a.active { background: var(--surface); color: var(--brand-700); box-shadow: var(--shadow-sm); }

.user-chip { display: flex; align-items: center; gap: 10px; }
.user-chip .avatar {
    width: 34px; height: 34px; border-radius: 99px;
    background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
    color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px;
}
.user-chip .u-name { font-size: 13px; font-weight: 600; line-height: 1.15; }
.user-chip .u-role { font-size: 11px; color: var(--ink-500); }

/* ============ Content ============ */
.content { padding: 24px 24px 48px; max-width: 1480px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; }
.page-head .sub { color: var(--ink-500); font-size: 13.5px; margin-top: 3px; }
.page-head .head-actions { margin-left: auto; display: flex; gap: 9px; flex-wrap: wrap; }

/* ============ Cards & grids ============ */
.card {
    background: var(--surface);
    border: 1px solid var(--ink-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px; }
.card-head {
    padding: 15px 20px;
    border-bottom: 1px solid var(--ink-100);
    display: flex; align-items: center; gap: 10px;
}
.card-head h3 { font-size: 14.5px; }
.card-head .head-right { margin-left: auto; font-size: 12.5px; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-main-side { grid-template-columns: 2fr 1fr; }

/* KPI stat card */
.stat-card {
    background: var(--surface);
    border: 1px solid var(--ink-200);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow-sm);
    display: flex; gap: 14px; align-items: flex-start;
    position: relative; overflow: hidden;
}
.stat-card .stat-ico {
    width: 42px; height: 42px; border-radius: 11px;
    display: grid; place-items: center; flex-shrink: 0;
}
.stat-card .stat-ico svg { width: 21px; height: 21px; }
.stat-card .stat-label { font-size: 12px; color: var(--ink-500); font-weight: 600; letter-spacing: .01em; }
.stat-card .stat-value { font-size: 23px; font-weight: 800; letter-spacing: -.02em; margin-top: 1px; }
.stat-card .stat-sub { font-size: 11.5px; color: var(--ink-400); margin-top: 2px; }
.ico-green  { background: var(--brand-100); color: var(--brand-600); }
.ico-amber  { background: var(--accent-100); color: var(--accent-600); }
.ico-blue   { background: var(--info-100); color: var(--info-600); }
.ico-red    { background: var(--danger-100); color: var(--danger-600); }
.ico-purple { background: var(--purple-100); color: var(--purple-600); }
.ico-gray   { background: var(--ink-100); color: var(--ink-500); }

/* ============ Buttons ============ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 8px 16px;
    border-radius: 9px;
    font-size: 13.5px; font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all .13s;
    font-family: inherit;
    line-height: 1.4;
    white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--brand-600); color: #fff; box-shadow: 0 1px 2px rgba(14,77,58,.3); }
.btn-primary:hover { background: var(--brand-700); }
.btn-accent { background: var(--accent-500); color: #422006; }
.btn-accent:hover { background: var(--accent-600); color: #fff; }
.btn-outline { background: var(--surface); border-color: var(--ink-200); color: var(--ink-700); }
.btn-outline:hover { border-color: var(--ink-400); background: var(--ink-50); }
.btn-ghost { background: transparent; color: var(--ink-500); }
.btn-ghost:hover { background: var(--ink-100); color: var(--ink-900); }
.btn-danger { background: var(--danger-600); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-danger-soft { background: var(--danger-100); color: var(--danger-600); }
.btn-danger-soft:hover { background: #fecaca; }
.btn-success { background: var(--ok-600); color: #fff; }
.btn-success:hover { background: #047857; }
.btn-sm { padding: 5px 11px; font-size: 12.5px; border-radius: 8px; }
.btn-sm svg { width: 14px; height: 14px; }
.btn-lg { padding: 12px 22px; font-size: 15px; border-radius: 11px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ============ Badges ============ */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 11.5px; font-weight: 700;
    padding: 3px 9px;
    border-radius: 99px;
    line-height: 1.4;
    white-space: nowrap;
}
.badge .b-dot { width: 6px; height: 6px; border-radius: 99px; background: currentColor; }
.badge-green  { background: var(--ok-100); color: #065f46; }
.badge-amber  { background: var(--warn-100); color: #92400e; }
.badge-red    { background: var(--danger-100); color: #991b1b; }
.badge-blue   { background: var(--info-100); color: #1e40af; }
.badge-purple { background: var(--purple-100); color: #5b21b6; }
.badge-gray   { background: var(--ink-100); color: var(--ink-700); }
.badge-brand  { background: var(--brand-100); color: var(--brand-800); }

/* ============ Tables ============ */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl thead th {
    text-align: left;
    font-size: 11px; text-transform: uppercase; letter-spacing: .07em;
    color: var(--ink-500);
    padding: 11px 16px;
    background: var(--ink-50);
    border-bottom: 1px solid var(--ink-200);
    white-space: nowrap;
}
.tbl tbody td { padding: 12px 16px; border-bottom: 1px solid var(--ink-100); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background .1s; }
.tbl tbody tr:hover { background: var(--ink-50); }
.tbl .t-strong { font-weight: 600; }
.tbl .t-sub { font-size: 12px; color: var(--ink-500); }
.tbl .t-num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .t-actions { text-align: right; white-space: nowrap; }
.tbl .t-actions .btn { margin-left: 5px; }

/* ============ Forms ============ */
.form-grid { display: grid; gap: 16px; grid-template-columns: repeat(2, 1fr); }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-700); margin-bottom: 5px; }
.field .hint { font-size: 11.5px; color: var(--ink-400); margin-top: 4px; }
.input, .select, .textarea {
    width: 100%;
    padding: 9px 13px;
    border: 1.5px solid var(--ink-200);
    border-radius: 9px;
    font-size: 14px;
    font-family: inherit;
    background: var(--surface);
    color: var(--ink-900);
    transition: border-color .13s, box-shadow .13s;
}
.input:focus, .select:focus, .textarea:focus {
    outline: 0;
    border-color: var(--brand-500);
    box-shadow: 0 0 0 3px rgba(23,121,93,.13);
}
.textarea { min-height: 92px; resize: vertical; }
.field .err { color: var(--danger-600); font-size: 12px; margin-top: 4px; }
.input.invalid, .select.invalid { border-color: var(--danger-600); }

.check-row { display: flex; align-items: center; gap: 9px; font-size: 13.5px; }
.check-row input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--brand-600); }

.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
    position: absolute; inset: 0; background: var(--ink-200);
    border-radius: 99px; transition: .18s; cursor: pointer;
}
.switch .track:before {
    content: ""; position: absolute; width: 16px; height: 16px;
    left: 3px; top: 3px; background: #fff; border-radius: 99px; transition: .18s;
    box-shadow: var(--shadow-sm);
}
.switch input:checked + .track { background: var(--brand-500); }
.switch input:checked + .track:before { transform: translateX(18px); }

/* ============ Alerts / flash ============ */
.alert {
    padding: 12px 16px; border-radius: var(--radius-sm);
    font-size: 13.5px; font-weight: 500;
    display: flex; gap: 10px; align-items: flex-start;
    margin-bottom: 18px;
    border: 1px solid transparent;
}
.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: var(--ok-100); color: #065f46; border-color: #a7f3d0; }
.alert-danger  { background: var(--danger-100); color: #991b1b; border-color: #fecaca; }
.alert-info    { background: var(--info-100); color: #1e40af; border-color: #bfdbfe; }
.alert-warn    { background: var(--warn-100); color: #92400e; border-color: #fde68a; }

/* ============ Tabs ============ */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--ink-200); margin-bottom: 20px; overflow-x: auto; }
.tabs a {
    padding: 9px 15px; font-size: 13.5px; font-weight: 600; color: var(--ink-500);
    border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs a:hover { color: var(--ink-900); }
.tabs a.active { color: var(--brand-700); border-bottom-color: var(--brand-600); }

/* ============ Modal ============ */
.modal-backdrop {
    position: fixed; inset: 0; background: rgba(9, 24, 18, .55);
    z-index: 90; display: none; align-items: center; justify-content: center; padding: 18px;
    backdrop-filter: blur(2px);
}
.modal-backdrop.open { display: flex; }
.modal {
    background: var(--surface); border-radius: var(--radius-lg);
    max-width: 620px; width: 100%; max-height: 92vh; overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalIn .18s ease;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(9px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-head { padding: 18px 22px 0; display: flex; align-items: center; }
.modal-head h3 { font-size: 16.5px; }
.modal-head .x { margin-left: auto; background: none; border: 0; cursor: pointer; color: var(--ink-400); padding: 6px; border-radius: 8px; }
.modal-head .x:hover { background: var(--ink-100); color: var(--ink-900); }
.modal-body { padding: 18px 22px; }
.modal-foot { padding: 0 22px 20px; display: flex; justify-content: flex-end; gap: 9px; }

/* ============ Empty state ============ */
.empty {
    text-align: center; padding: 48px 20px; color: var(--ink-400);
}
.empty .empty-ico {
    width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 16px;
    background: var(--ink-100); display: grid; place-items: center; color: var(--ink-400);
}
.empty .empty-ico svg { width: 26px; height: 26px; }
.empty h4 { color: var(--ink-700); font-size: 15px; margin-bottom: 4px; }
.empty p { margin: 0; font-size: 13px; }

/* ============ Charts ============ */
.bar-chart { display: flex; align-items: flex-end; gap: 8px; height: 160px; padding-top: 10px; }
.bar-chart .bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar-chart .bar {
    width: 100%; max-width: 46px; border-radius: 7px 7px 3px 3px;
    background: linear-gradient(180deg, var(--brand-400), var(--brand-600));
    min-height: 3px;
    transition: opacity .13s;
    position: relative;
}
.bar-chart .bar:hover { opacity: .85; }
.bar-chart .bar-label { font-size: 10.5px; color: var(--ink-400); font-weight: 600; }
.bar-chart .bar-val { font-size: 10px; color: var(--ink-500); font-weight: 700; font-variant-numeric: tabular-nums; }

.donut-legend { display: flex; flex-direction: column; gap: 9px; }
.donut-legend .dl-row { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.donut-legend .dl-swatch { width: 11px; height: 11px; border-radius: 4px; }
.donut-legend .dl-val { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }

.progress { height: 7px; background: var(--ink-100); border-radius: 99px; overflow: hidden; }
.progress .fill { height: 100%; border-radius: 99px; background: var(--brand-500); }

/* ============ Order board ============ */
.status-pills { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.status-pill {
    padding: 7px 14px; border-radius: 99px; font-size: 12.5px; font-weight: 700;
    background: var(--surface); border: 1.5px solid var(--ink-200); color: var(--ink-500);
    cursor: pointer; display: inline-flex; gap: 7px; align-items: center;
}
.status-pill:hover { border-color: var(--ink-400); color: var(--ink-900); }
.status-pill.active { background: var(--brand-700); border-color: var(--brand-700); color: #fff; }
.status-pill .cnt { background: rgba(0,0,0,.09); padding: 0 7px; border-radius: 99px; font-size: 11px; }
.status-pill.active .cnt { background: rgba(255,255,255,.22); }

/* ============ POS screen ============ */
.pos-layout { display: grid; grid-template-columns: 1fr 384px; gap: 16px; align-items: start; }
.pos-menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.pos-item {
    background: var(--surface); border: 1.5px solid var(--ink-200); border-radius: var(--radius);
    padding: 12px 13px; cursor: pointer; transition: all .12s;
    display: flex; flex-direction: column; gap: 3px; text-align: left; font-family: inherit;
}
.pos-item:hover { border-color: var(--brand-400); box-shadow: var(--shadow); transform: translateY(-1px); }
.pos-item .pi-code { font-size: 10.5px; font-weight: 800; color: var(--brand-500); letter-spacing: .04em; }
.pos-item .pi-name { font-weight: 600; font-size: 13px; line-height: 1.3; }
.pos-item .pi-price { font-size: 13.5px; font-weight: 800; color: var(--ink-900); margin-top: auto; padding-top: 5px; }
.pos-item.unavailable { opacity: .45; pointer-events: none; }

.pos-cat-tabs { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; }
.pos-cat-tabs button {
    padding: 7px 15px; border-radius: 99px; border: 1.5px solid var(--ink-200);
    background: var(--surface); font-size: 12.5px; font-weight: 700; cursor: pointer;
    white-space: nowrap; color: var(--ink-500); font-family: inherit;
}
.pos-cat-tabs button.active { background: var(--brand-700); color: #fff; border-color: var(--brand-700); }

.pos-cart { position: sticky; top: 78px; }
.pos-cart-lines { max-height: 320px; overflow-y: auto; }
.cart-line { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--ink-200); align-items: center; }
.cart-line:last-child { border-bottom: 0; }
.cart-line .cl-qty {
    background: var(--brand-100); color: var(--brand-800); font-weight: 800; font-size: 12px;
    border-radius: 7px; padding: 3px 8px; flex-shrink: 0;
}
.cart-line .cl-name { font-size: 13px; font-weight: 600; flex: 1; min-width: 0; }
.cart-line .cl-addons { font-size: 11.5px; color: var(--ink-500); }
.cart-line .cl-amt { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 13px; }
.cart-line .cl-x { background: none; border: 0; color: var(--ink-400); cursor: pointer; padding: 4px; border-radius: 6px; }
.cart-line .cl-x:hover { color: var(--danger-600); background: var(--danger-100); }

.totals-rows { font-size: 13.5px; }
.totals-rows .tr-row { display: flex; justify-content: space-between; padding: 4px 0; color: var(--ink-700); }
.totals-rows .tr-row.grand { font-size: 18px; font-weight: 800; color: var(--ink-900); border-top: 1.5px solid var(--ink-200); margin-top: 7px; padding-top: 10px; }

/* ============ Kitchen display ============ */
.kds-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.kds-card { border-radius: var(--radius); overflow: hidden; background: var(--surface); border: 1px solid var(--ink-200); box-shadow: var(--shadow-sm); }
.kds-head { padding: 11px 15px; display: flex; align-items: center; gap: 9px; color: #fff; }
.kds-head.src-whatsapp { background: linear-gradient(120deg, #128c7e, #075e54); }
.kds-head.src-web { background: linear-gradient(120deg, var(--info-600), #1d4ed8); }
.kds-head.src-counter { background: linear-gradient(120deg, var(--ink-700), var(--ink-900)); }
.kds-head .kds-no { font-weight: 800; font-size: 14.5px; letter-spacing: .01em; }
.kds-head .kds-time { margin-left: auto; font-size: 11.5px; opacity: .9; font-weight: 600; }
.kds-items { padding: 6px 15px; }
.kds-items .ki-row { display: flex; gap: 9px; padding: 7px 0; border-bottom: 1px dashed var(--ink-100); font-size: 13.5px; }
.kds-items .ki-row:last-child { border-bottom: 0; }
.kds-items .ki-qty { font-weight: 800; color: var(--brand-600); }
.kds-items .ki-rm { font-size: 11.5px; color: var(--accent-600); font-style: italic; display: block; }
.kds-foot { padding: 11px 15px; display: flex; gap: 8px; border-top: 1px solid var(--ink-100); }
.kds-foot .btn { flex: 1; }
.kds-late .kds-time { color: #fecaca; }

/* ============ WhatsApp simulator ============ */
.wa-shell {
    max-width: 430px; border-radius: var(--radius-lg); overflow: hidden;
    border: 1px solid var(--ink-200); box-shadow: var(--shadow-lg);
    display: flex; flex-direction: column; height: 640px; background: #e5ddd5;
    background-image: radial-gradient(circle at 20% 30%, rgba(255,255,255,.35) 1px, transparent 1.5px), radial-gradient(circle at 70% 60%, rgba(255,255,255,.3) 1px, transparent 1.5px);
    background-size: 46px 46px, 34px 34px;
}
.wa-head { background: #075e54; color: #fff; padding: 13px 16px; display: flex; align-items: center; gap: 11px; }
.wa-head .wa-avatar { width: 36px; height: 36px; border-radius: 99px; background: var(--accent-500); display: grid; place-items: center; font-weight: 800; color: #3b2503; }
.wa-head .wa-name { font-weight: 700; font-size: 14px; }
.wa-head .wa-status { font-size: 11px; opacity: .85; }
.wa-body { flex: 1; overflow-y: auto; padding: 16px 13px; display: flex; flex-direction: column; gap: 7px; }
.wa-msg {
    max-width: 84%; padding: 8px 12px; border-radius: 10px; font-size: 13px;
    white-space: pre-wrap; box-shadow: 0 1px 1px rgba(0,0,0,.08); line-height: 1.45;
    word-break: break-word;
}
.wa-msg.in  { background: #fff; align-self: flex-start; border-top-left-radius: 3px; }
.wa-msg.out { background: #dcf8c6; align-self: flex-end; border-top-right-radius: 3px; }
.wa-msg .wa-time { display: block; font-size: 10px; color: rgba(0,0,0,.4); text-align: right; margin-top: 3px; }
.wa-foot { padding: 10px 12px; background: #f0f0f0; display: flex; gap: 9px; }
.wa-foot input {
    flex: 1; border: 0; border-radius: 99px; padding: 10px 17px; font-size: 13.5px; font-family: inherit;
    box-shadow: var(--shadow-sm);
}
.wa-foot input:focus { outline: 2px solid #128c7e33; }
.wa-foot button {
    width: 42px; height: 42px; border-radius: 99px; border: 0; background: #128c7e; color: #fff;
    cursor: pointer; display: grid; place-items: center; flex-shrink: 0;
}
.wa-foot button:hover { background: #075e54; }

/* ============ Public ordering page ============ */
.pub-wrap { max-width: 560px; margin: 0 auto; padding: 0 16px 120px; }
.pub-hero {
    background: linear-gradient(150deg, var(--brand-800), var(--brand-600));
    color: #fff; border-radius: 0 0 26px 26px;
    padding: 30px 22px 26px; margin: 0 -16px 20px;
    text-align: center;
}
.pub-hero .ph-logo {
    width: 62px; height: 62px; border-radius: 18px; background: linear-gradient(135deg, var(--accent-500), #e8590c);
    display: grid; place-items: center; margin: 0 auto 12px; font-size: 27px; font-weight: 800; color: #fff;
    box-shadow: 0 6px 20px rgba(0,0,0,.25);
}
.pub-hero h1 { font-size: 21px; }
.pub-hero .ph-sub { font-size: 12.5px; opacity: .85; margin-top: 4px; }
.pub-hero .ph-badges { display: flex; gap: 8px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }
.pub-hero .ph-badge { background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.2); padding: 4px 12px; border-radius: 99px; font-size: 11.5px; font-weight: 600; }

.pub-cat-nav { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; position: sticky; top: 0; background: var(--bg); z-index: 10; }
.pub-cat-nav a {
    padding: 7px 15px; border-radius: 99px; background: var(--surface); border: 1.5px solid var(--ink-200);
    font-size: 12.5px; font-weight: 700; color: var(--ink-500); white-space: nowrap;
}
.pub-cat-nav a.active, .pub-cat-nav a:hover { background: var(--brand-700); color: #fff; border-color: var(--brand-700); }

.menu-card {
    background: var(--surface); border: 1px solid var(--ink-200); border-radius: var(--radius);
    padding: 14px 16px; display: flex; gap: 13px; margin-bottom: 10px; align-items: center;
}
.menu-card .mc-img {
    width: 62px; height: 62px; border-radius: 12px; background: var(--brand-100); flex-shrink: 0;
    display: grid; place-items: center; font-size: 24px; overflow: hidden;
}
.menu-card .mc-img img { width: 100%; height: 100%; object-fit: cover; }
.menu-card .mc-body { flex: 1; min-width: 0; }
.menu-card .mc-name { font-weight: 700; font-size: 14px; }
.menu-card .mc-desc { font-size: 12px; color: var(--ink-500); margin-top: 1px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.menu-card .mc-price { font-weight: 800; font-size: 14px; margin-top: 4px; color: var(--brand-700); }
.menu-card .mc-add {
    width: 38px; height: 38px; border-radius: 11px; border: 0; background: var(--brand-600); color: #fff;
    font-size: 20px; font-weight: 700; cursor: pointer; flex-shrink: 0; display: grid; place-items: center;
}
.menu-card .mc-add:hover { background: var(--brand-700); }

.cart-fab {
    position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
    width: min(528px, calc(100vw - 32px));
    background: var(--brand-800); color: #fff;
    border-radius: 16px; padding: 14px 20px;
    display: flex; align-items: center; gap: 12px;
    box-shadow: var(--shadow-lg); cursor: pointer; z-index: 30;
    border: 0; font-family: inherit; font-size: 14.5px;
}
.cart-fab .cf-count { background: var(--accent-500); color: #3b2503; font-weight: 800; border-radius: 9px; padding: 3px 10px; font-size: 13px; }
.cart-fab .cf-total { margin-left: auto; font-weight: 800; font-size: 16px; }

/* ============ Receipt ============ */
.receipt { max-width: 340px; margin: 30px auto; background: #fff; padding: 26px 22px; font-family: 'Consolas', 'Courier New', monospace; font-size: 12.5px; color: #111; box-shadow: var(--shadow); }
.receipt .rc-center { text-align: center; }
.receipt .rc-line { border-top: 1.5px dashed #999; margin: 10px 0; }
.receipt table { width: 100%; border-collapse: collapse; }
.receipt td { padding: 2px 0; vertical-align: top; }
.receipt .rc-amt { text-align: right; white-space: nowrap; }
.receipt h2 { font-size: 16px; margin-bottom: 2px; }
@media print {
    body * { visibility: hidden; }
    .receipt, .receipt * { visibility: visible; }
    .receipt { position: absolute; left: 0; top: 0; box-shadow: none; margin: 0; }
}

/* ============ Auth pages ============ */
.auth-wrap {
    min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr;
}
.auth-side {
    background: linear-gradient(160deg, var(--brand-900), var(--brand-700) 70%, var(--brand-600));
    color: #fff; padding: 54px; display: flex; flex-direction: column;
    position: relative; overflow: hidden;
}
.auth-side::after {
    content: ""; position: absolute; width: 480px; height: 480px; border-radius: 99em;
    background: radial-gradient(circle, rgba(245,158,11,.22), transparent 65%);
    bottom: -160px; right: -120px;
}
.auth-side .as-brand { display: flex; align-items: center; gap: 12px; font-size: 21px; font-weight: 800; }
.auth-side .as-brand .logo-mark {
    width: 44px; height: 44px; border-radius: 13px; background: linear-gradient(135deg, var(--accent-500), #e8590c);
    display: grid; place-items: center; font-size: 22px;
}
.auth-side .as-body { margin: auto 0; position: relative; z-index: 2; }
.auth-side h2 { font-size: 31px; line-height: 1.25; letter-spacing: -.02em; }
.auth-side p { color: #b7dccc; font-size: 15px; max-width: 400px; }
.auth-side .as-points { display: flex; flex-direction: column; gap: 13px; margin-top: 26px; }
.auth-side .as-point { display: flex; gap: 11px; align-items: center; font-size: 14px; color: #dff0e8; }
.auth-side .as-point .pt-ico { width: 30px; height: 30px; border-radius: 9px; background: rgba(255,255,255,.1); display: grid; place-items: center; flex-shrink: 0; }
.auth-form-side { display: flex; align-items: center; justify-content: center; padding: 32px; background: var(--bg); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 23px; margin-bottom: 4px; }
.auth-card .ac-sub { color: var(--ink-500); font-size: 14px; margin-bottom: 24px; }

.demo-creds { margin-top: 22px; border-top: 1px dashed var(--ink-200); padding-top: 16px; }
.demo-creds .dc-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-400); margin-bottom: 9px; }
.demo-creds button {
    display: flex; width: 100%; text-align: left; gap: 10px; align-items: center;
    padding: 8px 11px; border-radius: 9px; border: 1px solid var(--ink-200); background: var(--surface);
    cursor: pointer; font-family: inherit; font-size: 12.5px; margin-bottom: 6px;
}
.demo-creds button:hover { border-color: var(--brand-400); background: var(--brand-50); }
.demo-creds .dc-role { font-weight: 700; color: var(--ink-900); }
.demo-creds .dc-email { color: var(--ink-500); margin-left: auto; font-size: 11.5px; }

/* ============ Misc ============ */
.mode-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.mode-card {
    border: 2px solid var(--ink-200); border-radius: var(--radius-lg); padding: 22px; cursor: pointer;
    background: var(--surface); transition: all .15s; position: relative;
}
.mode-card:hover { border-color: var(--brand-300); }
.mode-card.selected { border-color: var(--brand-600); background: var(--brand-50); box-shadow: 0 0 0 3px rgba(23,121,93,.1); }
.mode-card .mo-letter {
    width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center;
    font-weight: 800; font-size: 19px; margin-bottom: 13px;
}
.mode-card h4 { font-size: 15px; margin-bottom: 6px; }
.mode-card p { font-size: 12.5px; color: var(--ink-500); margin: 0; }
.mode-card .mo-check { position: absolute; top: 15px; right: 15px; color: var(--brand-600); display: none; }
.mode-card.selected .mo-check { display: block; }

.divider { border: 0; border-top: 1px solid var(--ink-200); margin: 20px 0; }
.text-muted { color: var(--ink-500); }
.text-sm { font-size: 12.5px; }
.text-xs { font-size: 11.5px; }
.text-right { text-align: right; }
.font-bold { font-weight: 700; }
.mono { font-variant-numeric: tabular-nums; font-family: 'Consolas', monospace; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 18px; } .mt-4 { margin-top: 24px; }
.mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 18px; }
.flex { display: flex; } .items-center { align-items: center; } .gap-2 { gap: 9px; } .gap-3 { gap: 14px; }
.flex-wrap { flex-wrap: wrap; } .ml-auto { margin-left: auto; }
.w-full { width: 100%; }

.avatar-sm {
    width: 34px; height: 34px; border-radius: 99px; display: grid; place-items: center;
    font-weight: 700; font-size: 12.5px; color: #fff; flex-shrink: 0;
    background: linear-gradient(135deg, var(--brand-400), var(--brand-700));
}

.rating-stars { color: var(--accent-500); letter-spacing: 1px; font-size: 15px; }
.rating-stars .off { color: var(--ink-200); }

.pagination { display: flex; gap: 6px; margin-top: 18px; flex-wrap: wrap; }
.pagination a, .pagination span {
    padding: 6px 12px; border-radius: 8px; font-size: 13px; font-weight: 600;
    border: 1px solid var(--ink-200); background: var(--surface); color: var(--ink-700);
}
.pagination .current { background: var(--brand-700); color: #fff; border-color: var(--brand-700); }
.pagination a:hover { border-color: var(--brand-400); }

.qr-box { background: #fff; padding: 18px; border-radius: var(--radius); display: inline-block; box-shadow: var(--shadow); }

/* Sidebar overlay for mobile */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 45; }

/* ============ Responsive ============ */
@media (max-width: 1180px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-main-side { grid-template-columns: 1fr; }
    .pos-layout { grid-template-columns: 1fr 330px; }
    .mode-cards { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
    .sidebar.open { transform: none; }
    .sidebar-overlay.open { display: block; }
    .main { margin-left: 0; }
    .hamburger { display: inline-flex; }
    .pos-layout { grid-template-columns: 1fr; }
    .pos-cart { position: static; }
    .auth-wrap { grid-template-columns: 1fr; }
    .auth-side { display: none; }
    .form-grid { grid-template-columns: 1fr; }
    .grid-3 { grid-template-columns: 1fr; }
    .grid-2 { grid-template-columns: 1fr; }
    .content { padding: 16px 14px 44px; }
    .topbar { padding: 0 14px; }
    .user-chip .u-meta { display: none; }
}
@media (max-width: 560px) {
    .grid-4 { grid-template-columns: 1fr 1fr; }
    .stat-card .stat-value { font-size: 19px; }
    .page-head h1 { font-size: 19px; }
    .pos-menu-grid { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); }
    .wa-shell { height: 560px; }
}
