:root {
    --background-color: #f8f9fa;
    --surface-color: #ffffff;
    --primary-color: #e85d04;
    --primary-hover-color: #f48c06;
    --text-color: #343a40;
    --secondary-text-color: #6c757d;
    --border-color: #dee2e6;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    --status-pending: #ffc107;
    --status-cooking: #007bff;
    --status-ready: #28a745;
}

/* RPOS multi-theme POS shell -------------------------------------------------
   Layout themes only alter presentation. MenuColumn, OrderColumn and every
   callback continue to be the same components used by Classic RPOS. */
.pos-shell.app-container {
    --pos-cart-width: 420px;
    --pos-product-min: 210px;
    --pos-image-ratio: 4 / 3;
    grid-template-columns: minmax(0, 1fr) minmax(340px, var(--pos-cart-width));
    width: 100%;
    max-width: 1920px;
    min-width: 0;
    overflow: hidden;
}

.pos-shell.ai-enabled {
    grid-template-columns: minmax(0, 1fr) minmax(340px, var(--pos-cart-width)) minmax(280px, .75fr);
}

.pos-shell[data-pos-theme="quick_order"] .order-column { order: -1; }
.pos-shell[data-pos-theme="quick_order"] { grid-template-columns: minmax(340px, 35%) minmax(0, 65%); }
.pos-shell[data-pos-theme="quick_order"].ai-enabled { grid-template-columns: minmax(340px, 35%) minmax(0, 1fr) minmax(260px, .5fr); }

.pos-shell .menu-items-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--pos-product-min)), 1fr));
    grid-auto-rows: auto;
}

.pos-shell .menu-item-photo.compact {
    width: 100%;
    height: auto;
    aspect-ratio: var(--pos-image-ratio);
    object-fit: cover;
}

.pos-shell[data-category-orientation="horizontal"] .menu-layout { flex-direction: column; }
.pos-shell[data-category-orientation="horizontal"] .menu-category-sidebar {
    width: 100%;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
}
.pos-shell[data-category-orientation="horizontal"] .menu-category-pill { flex: 0 0 auto; min-height: 40px; }
.pos-shell[data-category-orientation="horizontal"] .menu-category-pill span:first-child { white-space: nowrap; }

.pos-shell[data-density="compact"] { gap: .75rem; padding: .75rem; }
.pos-shell[data-density="compact"] .column-header { padding: .8rem 1rem; font-size: 1.15rem; }
.pos-shell[data-density="compact"] .menu-layout,
.pos-shell[data-density="compact"] .column-content,
.pos-shell[data-density="compact"] .order-summary { padding: .75rem; }
.pos-shell[data-density="compact"] .menu-items-grid { gap: .65rem; }
.pos-shell[data-density="compact"] .menu-item-tile { padding: .55rem; min-height: 0; }
.pos-shell[data-density="compact"] .order-item { gap: .55rem; padding: .55rem 0; }

.pos-shell[data-density="dense"] { gap: .5rem; padding: .5rem; }
.pos-shell[data-density="dense"] .column { border-radius: 7px; }
.pos-shell[data-density="dense"] .column-header { padding: .55rem .75rem; font-size: 1rem; }
.pos-shell[data-density="dense"] .menu-search-container { padding: .45rem .65rem; }
.pos-shell[data-density="dense"] .menu-layout,
.pos-shell[data-density="dense"] .column-content,
.pos-shell[data-density="dense"] .order-summary { padding: .5rem; }
.pos-shell[data-density="dense"] .menu-category-sidebar { width: 145px; padding: .35rem; }
.pos-shell[data-density="dense"] .menu-category-pill { padding: .35rem .5rem; font-size: .78rem; }
.pos-shell[data-density="dense"] .menu-items-grid { gap: .4rem; }
.pos-shell[data-density="dense"] .menu-item-tile { padding: .4rem; gap: .3rem; min-height: 0; border-radius: 7px; }
.pos-shell[data-density="dense"] .menu-item-name,
.pos-shell[data-density="dense"] .menu-item-price { font-size: .78rem; }
.pos-shell[data-density="dense"] .add-btn { padding: .35rem .55rem; }
.pos-shell[data-density="dense"] .order-item { gap: .35rem; padding: .4rem 0; font-size: .8rem; }
.pos-shell[data-density="dense"] .summary-line { margin-bottom: .4rem; font-size: .9rem; }

.pos-shell[data-button-size="large"] button,
.pos-shell[data-pos-touchscreen="true"] button,
.pos-shell[data-pos-touchscreen="true"] select,
.pos-shell[data-pos-touchscreen="true"] input { min-height: 44px; }
.pos-shell[data-pos-touchscreen="true"] .quantity-btn { width: 46px; height: 46px; }
.pos-shell[data-pos-theme="quick_touch"] .quantity-btn { width: 48px; height: 48px; font-size: 1.45rem; }
.pos-shell[data-pos-theme="quick_touch"] .finalize-btn { min-height: 58px; font-size: 1.2rem; text-transform: uppercase; }
.pos-shell[data-pos-theme="touch_tiles"] .menu-item-tile,
.pos-shell[data-pos-theme="quick_touch"] .menu-item-tile { cursor: pointer; }
.pos-shell[data-pos-theme="touch_tiles"] .menu-item-tile:active,
.pos-shell[data-pos-theme="quick_touch"] .menu-item-tile:active { transform: scale(.97); }
.pos-shell[data-pos-theme="image_first"] .menu-item-photo.compact { aspect-ratio: 16 / 10; }
.pos-shell[data-pos-theme="clean_hospitality"] { gap: 1.25rem; padding: 1.25rem; }
.pos-shell[data-pos-theme="clean_hospitality"] .column { border: 1px solid #edf0f3; box-shadow: 0 8px 28px rgba(35, 45, 60, .06); }
.pos-shell[data-pos-theme="clean_hospitality"] .order-column { background: #fffdf9; }
.pos-shell[data-pos-theme="table_service"] .order-column { border-top: 4px solid var(--primary-color); }

.pos-shell[data-pos-appearance="dark"] {
    --surface-color: #171a1f;
    --background-color: #0f1115;
    --text-color: #f3f4f6;
    --secondary-text-color: #aeb6c2;
    --border-color: #343a43;
    color: var(--text-color);
    background: var(--background-color);
}
.pos-shell[data-pos-appearance="dark"] .column,
.pos-shell[data-pos-appearance="dark"] .menu-item-tile,
.pos-shell[data-pos-appearance="dark"] .menu-category-sidebar,
.pos-shell[data-pos-appearance="dark"] input,
.pos-shell[data-pos-appearance="dark"] select { color: var(--text-color); background: var(--surface-color); border-color: var(--border-color); }

@media (max-width: 1100px) {
    .pos-shell.app-container,
    .pos-shell[data-pos-theme="quick_order"],
    .pos-shell.ai-enabled,
    .pos-shell[data-pos-theme="quick_order"].ai-enabled {
        grid-template-columns: minmax(0, 1fr) minmax(320px, 40%);
        gap: .65rem;
        padding: .65rem;
    }
    .pos-shell.ai-enabled .ai-column { display: none; }
    .pos-shell .menu-layout { flex-direction: column; }
    .pos-shell .menu-category-sidebar { width: 100%; flex-direction: row; flex-wrap: nowrap; overflow-x: auto; }
    .pos-shell .menu-category-pill { flex: 0 0 auto; }
}

@media (max-width: 768px) {
    .pos-shell.app-container { display: flex; overflow: visible; padding: .5rem; }
    .pos-shell .column { width: 100%; }
    .pos-shell .menu-items-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pos-shell .menu-column:not(.active), .pos-shell .order-column:not(.active), .pos-shell .ai-column:not(.active) { display: none; }
}

/* Billing Theme settings and scaled, non-persistent previews */
.billing-theme-entry {
    width: 100%; margin: 0 0 1rem; padding: 1rem 1.2rem; display: grid;
    grid-template-columns: 76px minmax(0, 1fr) auto; align-items: center; gap: 1rem;
    text-align: left; border: 1px solid #fed7aa; border-radius: 14px; background: linear-gradient(135deg, #fff7ed, #fff);
    color: #1f2937; cursor: pointer;
}
.billing-theme-entry:hover { border-color: var(--primary-color); box-shadow: 0 8px 24px rgba(232, 93, 4, .12); }
.billing-theme-entry > span:nth-child(2) { display: grid; gap: .25rem; }
.billing-theme-entry small { color: #6b7280; line-height: 1.4; }
.billing-theme-entry-action { color: var(--primary-color); font-weight: 700; }
.billing-theme-entry-preview { height: 52px; padding: 5px; display: grid; grid-template-columns: 1fr .45fr; gap: 4px; background: #fff; border: 1px solid #fed7aa; border-radius: 8px; }
.billing-theme-entry-preview i { display: block; border-radius: 3px; background: #ffe8d4; }
.billing-theme-entry-preview i:first-child { grid-row: 1 / 3; background: linear-gradient(#f97316 25%, #ffedd5 25%); }

.billing-theme-page { max-width: 1680px; }
.billing-theme-page .settings-main-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.theme-branch-badge, .theme-selected-badge { display: inline-flex; align-items: center; white-space: nowrap; border-radius: 999px; font-weight: 700; }
.theme-branch-badge { padding: .45rem .8rem; background: #fff7ed; color: #c2410c; }
.theme-selected-badge { padding: .25rem .55rem; background: #ffedd5; color: #c2410c; font-size: .75rem; }
.theme-preferences { display: flex; align-items: center; flex-wrap: wrap; gap: 1rem 1.5rem; margin-bottom: 1.25rem; }
.theme-preferences > label, .theme-preview-toolbar label { display: flex; align-items: center; gap: .55rem; font-weight: 700; }
.theme-preferences select, .theme-preview-toolbar select { min-height: 42px; padding: .45rem .75rem; border: 1px solid #d1d5db; border-radius: 8px; background: #fff; }
.theme-touch-toggle { display: grid !important; grid-template-columns: auto auto; }
.theme-touch-toggle input { width: 20px; height: 20px; accent-color: var(--primary-color); }
.theme-touch-toggle small { grid-column: 2; color: #6b7280; font-weight: 400; }
.theme-status { margin-left: auto; color: #166534; font-weight: 600; }
.theme-gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(285px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.theme-card { overflow: hidden; border: 2px solid #e5e7eb; border-radius: 14px; background: #fff; box-shadow: 0 3px 12px rgba(15, 23, 42, .05); }
.theme-card.is-selected { border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(232, 93, 4, .1); }
.theme-card-body { padding: 1rem; }
.theme-card-title { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.theme-card h3 { margin: 0; font-size: 1.05rem; }
.theme-card p { min-height: 3.8em; margin: .55rem 0; color: #64748b; font-size: .88rem; line-height: 1.5; }
.theme-best-for { font-size: .78rem; color: #475569; }
.theme-light-only { margin: 0; font-size: .76rem; font-weight: 600; color: var(--primary-color); }
.theme-card-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-top: .9rem; }
.theme-card-actions button { min-height: 42px; border-radius: 8px; font-weight: 700; cursor: pointer; }
.theme-preview-btn { border: 1px solid #fdba74; color: #c2410c; background: #fff7ed; }
.theme-select-btn { border: 1px solid var(--primary-color); color: #fff; background: var(--primary-color); }
.theme-select-btn:disabled { color: #9a3412; background: #ffedd5; border-color: #fed7aa; cursor: default; }
.theme-live-preview { padding: 1rem; }
.theme-live-header { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.theme-live-header h3 { margin: 0; }.theme-live-header p { margin: .25rem 0 0; color: #64748b; }
.theme-live-header > strong { color: var(--primary-color); }
.theme-preview-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 1rem; margin: 1rem 0; }
.theme-keyboard-toggle input { width: 20px; height: 20px; accent-color: var(--primary-color); }

.pos-preview-viewport { position: relative; width: 100%; overflow: hidden; border: 1px solid #cbd5e1; border-radius: 12px; background: #dce2e8; }
.pos-preview-viewport.is-compact { border-width: 0 0 1px; border-radius: 0; aspect-ratio: 16 / 9 !important; }
.pos-preview-scaler { position: absolute; inset: 0 auto auto 0; transform-origin: top left; }
.pos-preview-stage { position: relative; width: 100%; height: 100%; display: flex; flex-direction: column; overflow: hidden; background: #f5f6f8; }
.pos-preview-topbar { height: 64px; flex: 0 0 64px; display: flex; align-items: center; gap: 28px; padding: 0 28px; color: #4b5563; background: #fff; border-bottom: 1px solid #ece5da; font-size: 18px; font-weight: 600; }
.pos-preview-topbar strong { color: #fb923c; font-size: 25px; }.pos-preview-branch { margin-left: auto; }
.pos-preview-shell { flex: 1; min-height: 0; margin: 0; padding: 18px; gap: 18px; }
.pos-preview-shell .column { min-width: 0; min-height: 0; }
.pos-preview-shell .menu-column { max-height: none; }.pos-preview-shell .menu-column-scroll { max-height: none; }
.pos-preview-shell .pos-preview-search { display: flex; align-items: center; color: #8a94a3; background: #fff; }
.pos-preview-mode, .pos-preview-table { color: #64748b; font-size: 14px; font-weight: 600; }
.pos-preview-table { display: none; }.pos-preview-shell[data-pos-theme="table_service"] .pos-preview-table { display: inline; }
.pos-preview-food { border: 0; background-size: cover !important; }
.pos-preview-food--gold { background: radial-gradient(circle at 35% 30%, #fff3b0, #d97706 70%); }
.pos-preview-food--red { background: radial-gradient(circle at 35% 30%, #fecaca, #b91c1c 70%); }
.pos-preview-food--green { background: radial-gradient(circle at 35% 30%, #dcfce7, #15803d 70%); }
.pos-preview-food--brown { background: radial-gradient(circle at 35% 30%, #fed7aa, #78350f 70%); }
.pos-preview-order { max-height: 100%; }.pos-preview-order .column-content { flex: 1; overflow: auto; }
.pos-preview-order small { display: block; color: #94a3b8; }.pos-preview-actions { display: grid; grid-template-columns: .7fr .7fr 1.6fr; gap: 10px; }
.pos-preview-actions button { min-height: 48px; border: 1px solid #fdba74; border-radius: 8px; color: #9a3412; background: #fff7ed; font-weight: 800; }
.pos-preview-actions .finalize-btn { color: #fff; background: var(--primary-color); }
.pos-preview-keyboard { position: absolute; z-index: 5; left: 50%; bottom: 0; transform: translateX(-50%); width: min(960px, 100%); padding: 10px; display: grid; gap: 7px; color: #fff; background: #20242a; box-shadow: 0 -8px 30px rgba(0,0,0,.35); }
.pos-preview-keyboard span { display: block; min-height: 48px; padding: 12px; text-align: center; border-radius: 7px; background: #3b424b; letter-spacing: 12px; }
.pos-preview-keyboard--numeric { left: auto; right: 12px; width: 330px; transform: none; grid-template-columns: repeat(3, 1fr); }
.pos-preview-keyboard--numeric span { letter-spacing: 0; }
.pos-preview-viewport.is-compact .pos-preview-topbar { height: 58px; flex-basis: 58px; }

@media (max-width: 720px) {
    .billing-theme-entry { grid-template-columns: 60px 1fr; }.billing-theme-entry-action { grid-column: 2; }
    .theme-gallery { grid-template-columns: 1fr; }.theme-status { width: 100%; margin-left: 0; }
    .theme-live-header { flex-direction: column; }.theme-preview-toolbar { align-items: stretch; flex-direction: column; }
    .theme-preview-toolbar label { justify-content: space-between; }.theme-preview-toolbar select { max-width: 55%; }
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Shared accessibility helpers and a consistent keyboard focus indicator. */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

:where(button, a, input, select, textarea, [tabindex]):focus-visible {
    outline: 3px solid #2563eb;
    outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

html,
body {
    height: auto;
    min-height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Disable scrolling only for admin pages if needed - but allow it for home page */
body:has(.admin-page) {
    overflow: auto;
}

/* Touch screens: no double-tap-zoom delay on taps */
html {
    touch-action: manipulation;
}

body {
    font-family: 'Outfit', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

#root {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
}

/* Ensure scrollbar is visible on homepage */
body:not(:has(.admin-page)) {
    overflow-y: auto !important;
    overflow-x: hidden;
}

/* Make scrollbar always visible when content overflows */
html {
    scrollbar-width: thin;
    scrollbar-color: #888 #f1f1f1;
}

html::-webkit-scrollbar {
    width: 12px;
}

html::-webkit-scrollbar-track {
    background: #f1f1f1;
}

html::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 6px;
}

html::-webkit-scrollbar-thumb:hover {
    background: #555;
}

body::-webkit-scrollbar {
    width: 12px;
}

body::-webkit-scrollbar-track {
    background: #f1f1f1;
}

body::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 6px;
}

body::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Header Styles */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background-color: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
}

.app-header h1 {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin: 0;
}

.header-logo {
    width: clamp(210px, 18vw, 300px);
    height: auto;
    max-height: 48px;
    object-fit: contain;
    object-position: left center;
}

.nav-buttons {
    display: flex;
    background-color: var(--background-color);
    border-radius: 8px;
    padding: 4px;
    border: 1px solid var(--border-color);
    /* Use auto margins to center it in the available space between logo and right section */
    margin: 0 auto;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    /* Shrinks before anything else so the header never overflows. */
    min-width: 0;
}

.header-logo,
.nav-buttons,
.header-right .user-info,
.header-account {
    flex-shrink: 0;
}

/* Branch / outlet pickers are what give way: they shrink and truncate long
   names ("Velachery Main Road Branch") instead of pushing Logout off-screen. */
.header-right .branch-selector,
.header-right .outlet-selector {
    min-width: 0;
}

.header-right .branch-selector-button,
.header-right .outlet-selector-button {
    max-width: 100%;
}

.header-right .branch-info-compact,
.header-right .outlet-selector-info {
    min-width: 0;
    overflow: hidden;
}

.header-right .branch-info-compact .branch-name,
.header-right .outlet-selector-name {
    display: block;
    max-width: 14rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-nav-btn {
    padding: 0.5rem 1.5rem;
    border: none;
    background-color: transparent;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: var(--secondary-text-color);
    border-radius: 6px;
    transition: all 0.2s ease-in-out;
    position: relative;
    white-space: nowrap;
}

.header-nav-btn.active {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Screen-tab count sits inside the tab next to its label, so 2–3 digit
   counts never cover the word. */
.header-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
}

.header-nav-btn .nav-badge {
    position: static;
    border: none;
    font-size: 0.7rem;
}

.nav-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #dc3545;
    color: white;
    /* Grows into a pill for 2–3 digit counts instead of clipping them. */
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    border: 2px solid var(--surface-color);
}


.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info span {
    color: var(--secondary-text-color);
}

.admin-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background-color: var(--primary-color);
    border-radius: 6px;
    padding: 0.5rem 1rem;
    color: #fff;
    font-weight: 600;
    font-size: 0.95rem;
    border: none;
    text-decoration: none;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.admin-nav-btn:hover {
    background-color: var(--primary-hover-color);
    transform: translateY(-1px);
}

.admin-nav-btn svg {
    font-size: 1rem;
}

.admin-nav-label {
    line-height: 1;
}

/* `.user-info span` greys out every span in the cluster — keep the Admin
   label white on its orange button. */
.admin-nav-btn .admin-nav-label {
    color: inherit;
}

.logout-btn {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--secondary-text-color);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
}

.logout-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Modern User Profile Card */
.user-profile-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.4rem 0.75rem 0.4rem 0.4rem;
    background: linear-gradient(135deg, rgba(232, 93, 4, 0.08), rgba(244, 140, 6, 0.05));
    border: 1px solid rgba(232, 93, 4, 0.2);
    border-radius: 999px;
    transition: all 0.2s ease;
}

.user-profile-card:hover {
    background: linear-gradient(135deg, rgba(232, 93, 4, 0.12), rgba(244, 140, 6, 0.08));
    border-color: rgba(232, 93, 4, 0.3);
    box-shadow: 0 2px 8px rgba(232, 93, 4, 0.15);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover-color));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(232, 93, 4, 0.3);
    flex-shrink: 0;
}

.user-details {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.user-details .user-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-color);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-details .user-role {
    font-weight: 500;
    font-size: 0.75rem;
    color: var(--primary-color);
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


.ai-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--secondary-text-color);
    white-space: nowrap;
}

/* ── Phone account menu (see the 768px block for when it shows) ─────────── */
.header-account {
    display: none;
    position: relative;
}

.header-account-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: none;
    cursor: pointer;
}

.header-account-trigger:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.header-account-fallback {
    font-size: 2.1rem;
    color: var(--secondary-text-color);
}

.header-account-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 1100;
    width: min(260px, calc(100vw - 2rem));
    padding: 0.4rem;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
}

.header-account-profile {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 0.3rem;
    padding: 0.55rem 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.header-account-identity {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.header-account-name {
    overflow: hidden;
    color: var(--text-color);
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-account-role {
    color: var(--primary-color);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.header-account-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    min-height: 44px;
    padding: 0.55rem 0.6rem;
    border: none;
    border-radius: 8px;
    background: none;
    color: var(--text-color);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}

.header-account-item > svg {
    flex-shrink: 0;
    color: var(--secondary-text-color);
    font-size: 1rem;
}

button.header-account-item:hover,
button.header-account-item:focus-visible {
    background: var(--background-color);
    outline: none;
}

.header-account-toggle label[for] {
    flex: 1;
    cursor: pointer;
}

.header-account-logout {
    position: relative;
    margin-top: 0.4rem;
    color: #b91c1c;
}

.header-account-logout::before {
    content: '';
    position: absolute;
    top: -0.25rem;
    left: 0.6rem;
    right: 0.6rem;
    border-top: 1px solid var(--border-color);
}

.header-account-item.header-account-logout > svg {
    color: #b91c1c;
}

/* Below 1440px the full cluster (Admin · AI · profile · Logout) no longer
   fits beside the tabs and pickers — the desktop app's minimum width is
   1024px — so it collapses into the account menu. Phones get their own
   two-row layout in the 768px block. */
@media (max-width: 1439px) {
    .header-right .user-info {
        display: none;
    }

    .header-account {
        display: block;
        margin-left: 1rem;
    }
}

@media (max-width: 1279px) {
    .header-right .branch-info-compact .branch-code {
        display: none;
    }
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    -webkit-transition: .4s;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    -webkit-transition: .4s;
    transition: .4s;
}

input:checked+.slider {
    background-color: var(--primary-color);
}

input:focus+.slider {
    box-shadow: 0 0 1px var(--primary-color);
}

input:checked+.slider:before {
    -webkit-transform: translateX(22px);
    -ms-transform: translateX(22px);
    transform: translateX(22px);
}

.slider.round {
    border-radius: 28px;
}

.slider.round:before {
    border-radius: 50%;
}


.app-container {
    display: grid;
    grid-template-columns: 1.4fr 1fr 0.9fr;
    gap: 1.5rem;
    padding: 1.5rem;
    flex-grow: 1;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
    min-height: 0;
}

.app-container.ai-disabled {
    grid-template-columns: 1.4fr 1fr;
    max-width: 1200px;
}

.column {
    background-color: var(--surface-color);
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.column-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.virtual-menu-header-select {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    font-weight: 600;
    background-color: var(--surface-color);
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 150px;
}

.virtual-menu-header-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(232, 93, 4, 0.1);
}

.virtual-menu-header-select:hover {
    border-color: var(--primary-color);
    background-color: var(--background-color);
}

.custom-sort-open-btn {
    border: none;
    border-radius: 999px;
    padding: 0.4rem 0.95rem;
    font-weight: 600;
    font-size: 0.9rem;
    background-color: rgba(232, 93, 4, 0.12);
    color: var(--primary-color);
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.custom-sort-open-btn:hover,
.custom-sort-open-btn:focus {
    background-color: rgba(232, 93, 4, 0.22);
    box-shadow: 0 0 0 3px rgba(232, 93, 4, 0.12);
    outline: none;
}

.custom-sort-open-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
}

.custom-sort-modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    z-index: 1000;
}

.custom-sort-modal {
    background-color: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.15);
    width: min(420px, 92vw);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.75rem;
}

.custom-sort-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.custom-sort-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--text-color);
}

.custom-sort-close-btn {
    border: none;
    background: transparent;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--secondary-text-color);
    cursor: pointer;
    transition: color 0.2s ease-in-out, transform 0.2s;
}

.custom-sort-close-btn:hover,
.custom-sort-close-btn:focus {
    color: var(--primary-color);
    transform: scale(1.1);
    outline: none;
}

.custom-sort-subtitle {
    margin: 0;
    font-size: 0.95rem;
    color: var(--secondary-text-color);
}

.custom-sort-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 320px;
    overflow-y: auto;
    padding: 0.25rem 0;
}

.custom-sort-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.6rem 0.85rem;
    border-radius: 12px;
    border: 1px dashed rgba(232, 93, 4, 0.35);
    background-color: rgba(232, 93, 4, 0.07);
    cursor: grab;
    transition: background-color 0.2s ease-in-out, border-color 0.2s;
}

.custom-sort-item:hover {
    background-color: rgba(232, 93, 4, 0.12);
    border-color: rgba(232, 93, 4, 0.6);
}

.custom-sort-item.dragging {
    opacity: 0.6;
    border-style: solid;
    background-color: rgba(232, 93, 4, 0.18);
    cursor: grabbing;
}

.custom-sort-grip {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    position: relative;
}

.custom-sort-grip::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: repeating-linear-gradient(to bottom,
            var(--primary-color),
            var(--primary-color) 2px,
            transparent 2px,
            transparent 4px);
    opacity: 0.6;
}

.custom-sort-name {
    flex: 1;
    font-weight: 600;
    color: var(--text-color);
}

.custom-sort-empty {
    padding: 1rem;
    border-radius: 12px;
    border: 1px dashed var(--border-color);
    text-align: center;
    color: var(--secondary-text-color);
    font-size: 0.95rem;
}

.custom-sort-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.custom-sort-btn {
    padding: 0.55rem 1.2rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.custom-sort-btn.secondary {
    background-color: rgba(52, 58, 64, 0.08);
    color: var(--text-color);
}

.custom-sort-btn.secondary:hover,
.custom-sort-btn.secondary:focus {
    background-color: rgba(52, 58, 64, 0.15);
    outline: none;
}

.custom-sort-btn.primary {
    background-color: var(--primary-color);
    color: #ffffff;
}

.custom-sort-btn.primary:hover,
.custom-sort-btn.primary:focus {
    background-color: var(--primary-hover-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(232, 93, 4, 0.18);
}

.custom-sort-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
}

.menu-category-order-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.menu-category-order-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.custom-sort-list-wrapper {
    border: 1px dashed rgba(232, 93, 4, 0.25);
    border-radius: 16px;
    padding: 1.25rem;
    background-color: rgba(232, 93, 4, 0.05);
}

.settings-error-banner,
.settings-success-banner {
    padding: 0.85rem 1.1rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95rem;
}

.settings-error-banner {
    background: rgba(220, 53, 69, 0.12);
    color: #dc3545;
    border: 1px solid rgba(220, 53, 69, 0.35);
}

.settings-success-banner {
    background: rgba(40, 167, 69, 0.12);
    color: #28a745;
    border: 1px solid rgba(40, 167, 69, 0.35);
}

/* Virtual Menu Settings Styles */
.menu-settings-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.virtual-menu-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.menu-settings-tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.menu-settings-tab {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--secondary-text-color);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: -2px;
}

.menu-settings-tab:hover {
    color: var(--text-color);
    background-color: rgba(232, 93, 4, 0.05);
}

.menu-settings-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.virtual-menu-actions {
    display: flex;
    justify-content: flex-start;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.virtual-menu-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.virtual-menu-item {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    transition: all 0.2s ease;
}

.virtual-menu-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
}

.virtual-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.virtual-menu-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.virtual-menu-info h4 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-color);
    font-weight: 600;
}

.virtual-menu-count {
    font-size: 0.9rem;
    color: var(--secondary-text-color);
}

.virtual-menu-actions-item {
    display: flex;
    gap: 0.5rem;
}

.custom-sort-btn.small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.95rem;
}

.form-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(232, 93, 4, 0.1);
}

.menu-items-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.select-all-btn {
    padding: 0.5rem 1rem;
    background-color: var(--background-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.select-all-btn:hover:not(:disabled) {
    background-color: var(--surface-color);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.select-all-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.menu-items-list {
    max-height: 450px;
    overflow-y: auto;
    border: 2px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    background-color: white;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.04);
}

.menu-items-list::-webkit-scrollbar {
    width: 8px;
}

.menu-items-list::-webkit-scrollbar-track {
    background: var(--surface-color);
    border-radius: 4px;
}

.menu-items-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.menu-items-list::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
    opacity: 0.6;
}

.menu-category-group {
    margin-bottom: 1.5rem;
    background-color: white;
    border-radius: 12px;
    padding: 1rem;
    border: 2px solid var(--border-color);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    transition: all 0.2s ease;
}

.menu-category-group:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-color: rgba(232, 93, 4, 0.3);
}

.menu-category-group:last-child {
    margin-bottom: 0;
}

.menu-category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    margin: -1rem -1rem 1rem -1rem;
    border-radius: 12px 12px 0 0;
    background: linear-gradient(135deg, rgba(232, 93, 4, 0.08) 0%, rgba(232, 93, 4, 0.03) 100%);
    border-bottom: 2px solid rgba(232, 93, 4, 0.2);
}

.menu-category-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
    font-weight: 600;
    color: var(--primary-color);
}

.select-category-btn {
    padding: 0.5rem 1rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(232, 93, 4, 0.2);
}

.select-category-btn:hover:not(:disabled) {
    background-color: var(--primary-hover-color);
    box-shadow: 0 2px 8px rgba(232, 93, 4, 0.3);
    transform: translateY(-1px);
}

.select-category-btn:active:not(:disabled) {
    transform: translateY(0);
}

.select-category-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.menu-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 0.875rem;
}

.menu-item-checkbox {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background-color: #fafafa;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.menu-item-checkbox:hover {
    border-color: var(--primary-color);
    background-color: rgba(232, 93, 4, 0.05);
    box-shadow: 0 2px 8px rgba(232, 93, 4, 0.15);
    transform: translateY(-1px);
}

.menu-item-checkbox input[type="checkbox"]:checked+.menu-item-name {
    color: var(--primary-color);
    font-weight: 600;
}

.menu-item-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.menu-item-checkbox input[type="checkbox"]:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.menu-item-name {
    font-size: 0.95rem;
    color: var(--text-color);
    font-weight: 500;
    flex: 1;
    line-height: 1.4;
}

.menu-item-base-price {
    font-size: 0.85rem;
    color: var(--secondary-text-color);
    font-weight: 500;
    margin-left: auto;
    padding: 0.25rem 0.5rem;
    background-color: rgba(232, 93, 4, 0.1);
    border-radius: 4px;
    white-space: nowrap;
}

.menu-item-with-price {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background-color: white;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 0.875rem;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.menu-item-with-price:hover {
    border-color: var(--primary-color);
    box-shadow: 0 3px 10px rgba(232, 93, 4, 0.12);
    transform: translateY(-1px);
}

.menu-item-price-input {
    margin-left: 0;
    padding: 0.75rem;
    background-color: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-top: 0.5rem;
}

.menu-item-price-input label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.menu-item-price-input .price-input {
    width: 100%;
    padding: 0.65rem;
    font-size: 0.95rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 0.5rem;
    transition: all 0.2s ease;
}

.menu-item-price-input .price-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(232, 93, 4, 0.1);
}

.menu-item-price-input .price-hint {
    display: block;
    font-size: 0.8rem;
    color: var(--secondary-text-color);
    font-style: italic;
    margin-top: 0.25rem;
}

.menu-item-price-inputs {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px dashed var(--border-color);
}

.menu-item-variations-prices {
    margin-top: 0.5rem;
    padding: 1rem;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

.menu-item-variations-prices .variations-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.variation-price-input {
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    background-color: white;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.variation-price-input:last-child {
    margin-bottom: 0;
}

.variation-price-input label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.variation-price-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.variation-base-price {
    font-size: 0.8rem;
    color: var(--secondary-text-color);
    min-width: 90px;
    padding: 0.25rem 0.5rem;
    background-color: rgba(232, 93, 4, 0.08);
    border-radius: 4px;
    font-weight: 500;
}

.variation-price-input .price-input.small {
    flex: 1;
    padding: 0.5rem;
    font-size: 0.9rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
}

.variation-price-input .price-input.small:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(232, 93, 4, 0.1);
}

.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--secondary-text-color);
    font-size: 0.95rem;
}

/* Menu Search Styles */
.menu-search-container {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--surface-color);
    position: sticky;
    top: 0;
    z-index: 10;
}

.menu-filters-row {
    display: flex;
    gap: 0.75rem;
    align-items: stretch;
}

.menu-search {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.menu-search:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(232, 93, 4, 0.1);
}

.menu-search::placeholder {
    color: var(--secondary-text-color);
}

.virtual-menu-select {
    min-width: 150px;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    background-color: var(--surface-color);
    color: var(--text-color);
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.virtual-menu-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(232, 93, 4, 0.1);
}

.virtual-menu-select:hover {
    border-color: var(--primary-color);
}

.search-results-count {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--secondary-text-color);
    font-weight: 500;
}

.column-content {
    padding: 1.25rem;
    overflow-y: auto;
    flex-grow: 1;
}

/* Thumbnail Styles */
.thumbnail {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s;
    border: 1px solid var(--border-color);
}

.thumbnail:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}


/* Menu Column */
.menu-category h3 {
    margin-top: 1rem;
    margin-bottom: 0.75rem;
    font-size: 1.2rem;
    color: var(--text-color);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.25rem;
    display: inline-block;
}

.menu-category:first-child h3 {
    margin-top: 0;
}

.menu-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.menu-item:last-child {
    border-bottom: none;
}

.menu-item-details {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    gap: 0.5rem;
}

.menu-item-name {
    font-weight: 600;
}

.menu-item-price {
    color: var(--secondary-text-color);
    font-size: 0.9rem;
}

.menu-column {
    display: flex;
    flex-direction: column;
    /* Top bar height (set by Header; 72px fallback = the old 7.5rem total) + page padding. */
    height: calc(100dvh - var(--app-topbar-h, 72px) - 48px);
    min-height: 0;
    max-height: calc(100dvh - var(--app-topbar-h, 72px) - 48px);
    align-self: start;
}

/* Strict booking mode indicator strip */
.menu-column--strict .column-header::after {
    content: '🔒 Strict Booking ON';
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
    background: #ef4444;
    padding: 2px 8px;
    border-radius: 6px;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.menu-column-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0.5rem;
    scrollbar-gutter: stable;
    max-height: none;
    position: relative;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
}

/* Ensure scrollbar is visible */
.menu-column-scroll::-webkit-scrollbar {
    width: 8px;
}

.menu-column-scroll::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.menu-column-scroll::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.menu-column-scroll::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.menu-layout {
    display: flex;
    gap: 0.9rem;
    padding: 0.9rem;
    flex: 1;
    min-height: 0;
}

.menu-category-sidebar {
    width: 180px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background-color: #fff7f0;
    padding: 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    overflow-y: auto;
}

.menu-category-pill {
    border: none;
    border-radius: 999px;
    padding: 0.5rem 0.7rem;
    background-color: transparent;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.45rem;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    color: var(--secondary-text-color);
    border: 1px solid transparent;
    transition: all 0.2s ease-in-out;
    text-align: left;
    line-height: 1.2;
}

.menu-category-pill span:first-child {
    flex: 1;
    text-align: left;
    white-space: normal;
}

.menu-category-pill:hover {
    border-color: rgba(232, 93, 4, 0.4);
    background-color: rgba(232, 93, 4, 0.08);
    color: var(--primary-color);
}

.menu-category-pill.active {
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
    box-shadow: 0 4px 10px rgba(232, 93, 4, 0.35);
}

.menu-category-count {
    font-size: 0.9rem;
    padding: 0.1rem 0.6rem;
    border-radius: 999px;
    background-color: rgba(255, 255, 255, 0.3);
}

.menu-category-pill:not(.active) .menu-category-count {
    background-color: rgba(232, 93, 4, 0.15);
    color: var(--primary-color);
}

.virtual-menu-dropdown-container {
    margin: 0.5rem 0;
    padding: 0.25rem 0;
}

.virtual-menu-category-select {
    width: 100%;
    padding: 0.5rem 0.7rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    background-color: var(--surface-color);
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    z-index: 10;
    -webkit-appearance: menulist;
    -moz-appearance: menulist;
    appearance: menulist;
}

.virtual-menu-category-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(232, 93, 4, 0.1);
}

.virtual-menu-category-select:hover:not(:disabled) {
    border-color: var(--primary-color);
    background-color: var(--background-color);
}

.virtual-menu-category-select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.virtual-menu-dropdown-container {
    margin: 0.5rem 0;
    padding: 0.25rem 0;
    position: relative;
    z-index: 10;
}

/* ── Sidebar section labels & dividers (outlet / category separation) ── */
.sidebar-section {
    display: contents; /* children flow directly into the parent flex column */
}

.sidebar-section-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #9ca3af;
    padding: 0.1rem 0.4rem;
    margin-top: 0.15rem;
}

.sidebar-section-divider {
    height: 1px;
    background: var(--border-color, #e5e7eb);
    margin: 0.35rem 0.2rem;
}

/* ── Outlet pill buttons (Main Outlet + virtual outlets) ── */
.outlet-pills-row {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.outlet-pill {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.845rem;
    font-weight: 500;
    color: var(--text-color);
    border-radius: 7px;
    transition: background 0.12s, color 0.12s;
}

.outlet-pill svg {
    flex-shrink: 0;
    opacity: 0.55;
}

.outlet-pill:hover {
    background: rgba(232, 93, 4, 0.07);
    color: var(--primary-color);
}

.outlet-pill:hover svg {
    opacity: 0.8;
}

.outlet-pill.active {
    background: rgba(232, 93, 4, 0.12);
    color: var(--primary-color);
    font-weight: 600;
}

.outlet-pill.active svg {
    opacity: 1;
}

/* Locked outlet pills — owner has pre-set the outlet */
.outlet-pills-locked .outlet-pill {
    cursor: not-allowed;
    opacity: 0.7;
    pointer-events: none;
}

.outlet-pills-locked .outlet-pill.active {
    opacity: 1;
}

/* ══════════════════════════════════════════════════════════════════════════════
   VirtualOutletSelector — custom dropdown (vos-*)
   ══════════════════════════════════════════════════════════════════════════════ */

/* Container */
.vos-wrap {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.vos-compact {
    /* compact = no outer label, used in sidebars */
}

/* Label row */
.vos-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 0;
}

/* Restricted tag inline with label */
.vos-restricted-tag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 20px;
    background: rgba(220, 38, 38, 0.08);
    color: #dc2626;
    border: 1px solid rgba(220, 38, 38, 0.2);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: help;
    white-space: nowrap;
}

/* ── Trigger button ── */
.vos-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding: 9px 12px;
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 500;
    color: #1e293b;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
    white-space: nowrap;
    min-width: 0;
}

.vos-trigger:hover {
    border-color: #94a3b8;
    background: #f8fafc;
}

.vos-trigger.vos-open {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
    background: #fff;
}

.vos-trigger.vos-locked {
    background: #f8fafc;
    border-color: #e2e8f0;
    cursor: not-allowed;
    color: #64748b;
}

.vos-trigger.vos-empty .vos-trigger-text {
    color: #94a3b8;
}

.vos-trigger-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.vos-trigger-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vos-trigger-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.vos-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #e85d04;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}

/* Chevron icon */
.vos-chevron {
    flex-shrink: 0;
    color: #94a3b8;
    transition: transform 0.2s ease, color 0.15s;
}

.vos-trigger.vos-open .vos-chevron,
.vos-chevron.rotated {
    transform: rotate(180deg);
    color: #2563eb;
}

/* ── Dropdown panel ── */
.vos-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 999;
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(15, 23, 42, 0.14), 0 2px 8px rgba(15, 23, 42, 0.08);
    overflow: hidden;
    animation: vos-drop-in 0.14s ease;
    min-width: 180px;
}

@keyframes vos-drop-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Assign dropdown header row */
.vos-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 13px;
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid #f1f5f9;
    background: #f8fafc;
}

.vos-clear-btn {
    background: none;
    border: none;
    font-size: 11px;
    font-weight: 700;
    color: #dc2626;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.vos-clear-btn:hover {
    text-decoration: underline;
}

/* ── Option rows ── */
.vos-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 13px;
    background: none;
    border: none;
    border-top: 1px solid #f1f5f9;
    font-size: 13.5px;
    font-weight: 500;
    color: #334155;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: background 0.12s, color 0.12s;
}

.vos-option:first-of-type {
    border-top: none;
}

.vos-option:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.vos-option.active {
    background: #eff6ff;
    color: #1d4ed8;
    font-weight: 600;
}

.vos-option.active:hover {
    background: #dbeafe;
}

.vos-option-icon {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    color: inherit;
    opacity: 0.7;
}

.vos-option-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vos-check {
    flex-shrink: 0;
    color: #2563eb;
}

/* ── Assign option: custom checkbox ── */
.vos-option-check.active {
    background: #eff6ff;
    color: #1d4ed8;
}

.vos-checkbox {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border-radius: 5px;
    border: 2px solid #d1d5db;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.12s, background 0.12s;
    color: #fff;
}

.vos-checkbox.checked {
    background: #2563eb;
    border-color: #2563eb;
}

/* ── Selected chips (assign mode, shown below trigger) ── */
.vos-selected-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding-top: 2px;
}

.vos-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px 3px 10px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: #1d4ed8;
}

.vos-chip-remove {
    background: none;
    border: none;
    color: #93c5fd;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    padding: 0 0 0 2px;
    font-family: inherit;
    display: flex;
    align-items: center;
    transition: color 0.12s;
}

.vos-chip-remove:hover {
    color: #2563eb;
}

/* Legacy classes kept for any leftover references */
.outlet-restriction-badge {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 0.15rem 0.45rem;
    border-radius: 20px;
    background: rgba(220, 38, 38, 0.1);
    color: #dc2626;
    border: 1px solid rgba(220, 38, 38, 0.25);
    white-space: nowrap;
}

.outlet-filter-locked {
    display: flex;
    align-items: center;
    padding: 0.45rem 0.75rem;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
    color: #374151;
    cursor: not-allowed;
    user-select: none;
}

.menu-items-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: visible;
    min-height: 0;
}

.menu-items-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: minmax(200px, auto);
    gap: 0.9rem;
    padding: 0 0.25rem 1rem 0;
    flex: 1;
    align-content: flex-start;
    width: 100%;
}

@media (max-width: 768px) {
    .menu-items-grid {
        grid-template-columns: 1fr;
    }
}

.menu-item-tile {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.65rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 0.5rem;
    background-color: #fff;
    min-height: 160px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.menu-item-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.menu-item-photo {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: #fafafa;
    cursor: pointer;
}

.menu-item-photo.compact {
    width: 75%;
    height: 55px;
    border-radius: 6px;
    margin: 0 auto;
    display: block;
}

.menu-item-tile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.menu-item-preview-btn {
    border: none;
    background: rgba(232, 93, 4, 0.12);
    color: var(--primary-color);
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.menu-item-preview-btn:hover {
    background: rgba(232, 93, 4, 0.2);
}

.menu-item-tile-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.menu-item-tile .menu-item-price {
    font-weight: 700;
    color: var(--primary-color);
}

.menu-item-tile .add-btn {
    margin-top: 0;
}

.loading-state.compact,
.empty-state.compact {
    min-height: auto;
    padding: 0.5rem;
    font-size: 0.9rem;
}

@media (max-width: 1024px) {
    .menu-layout {
        flex-direction: column;
    }

    .menu-category-sidebar {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        border-radius: 12px;
    }

    .menu-category-pill {
        flex: 1 0 calc(50% - 0.5rem);
    }
}

.add-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
    font-weight: 600;
    white-space: nowrap;
    align-self: flex-start;
    margin-top: 0.25rem;
}

.add-btn:hover {
    background-color: var(--primary-hover-color);
}

.add-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

.variation-selector {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    margin-top: 0.5rem;
}

.menu-item-tile .variation-selector {
    margin-top: 0.25rem;
}

.menu-item-tile .variation-dropdown {
    width: 100%;
    font-size: 0.9rem;
    padding: 0.4rem 0.5rem;
    border-radius: 8px;
}

.variation-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    width: 100%;
}

.variation-btn {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1.5px solid var(--border-color);
    border-radius: 20px;
    background-color: #fff;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
    white-space: nowrap;
}

.variation-btn:hover {
    border-color: var(--primary-color);
    background-color: rgba(232, 93, 4, 0.06);
}

.variation-btn.selected {
    border-color: var(--primary-color);
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 1px 6px rgba(232, 93, 4, 0.3);
}

.variation-size {
    font-weight: 600;
    font-size: 0.78rem;
    line-height: 1.2;
    color: var(--text-color);
}

.variation-btn.selected .variation-size {
    color: white;
}

.variation-price {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--primary-color);
    opacity: 1;
}

.variation-price::before {
    content: '·';
    margin-right: 3px;
    opacity: 0.5;
}

.variation-btn.selected .variation-price {
    color: rgba(255, 255, 255, 0.9);
}

.variation-hint {
    font-size: 0.85rem;
    color: var(--secondary-text-color);
    font-style: italic;
    margin-top: 0.25rem;
}


.variation-dropdown {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
    background-color: white;
    cursor: pointer;
    transition: border-color 0.2s;
    width: 100%;
}

.variation-dropdown:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(232, 93, 4, 0.1);
}

.variation-info {
    font-size: 0.85rem;
    color: var(--secondary-text-color);
    font-style: italic;
    margin-left: 0.5rem;
}

.order-variation-selector {
    margin-top: 0.25rem;
    margin-bottom: 0.25rem;
}

.order-variation-selector .variation-dropdown {
    font-size: 0.85rem;
    padding: 0.4rem;
}

/* Order Column */
.order-items {
    min-height: 0;
}

.order-column {
    align-self: flex-start;
    overflow: visible;
}

.order-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.order-header-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.order-mode-control {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--secondary-text-color);
}

.order-mode-select {
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 0.25rem 0.8rem;
    font-weight: 600;
    font-size: 0.9rem;
    background-color: rgba(232, 93, 4, 0.08);
    color: var(--primary-color);
    cursor: pointer;
}

.order-mode-select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(232, 93, 4, 0.2);
}

.order-mode-select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: rgba(232, 93, 4, 0.04);
}

.discount-lock-note {
    margin: -0.25rem 0 0.5rem 0;
    font-size: 0.85rem;
    color: var(--primary-color);
    font-weight: 600;
}

.order-column .column-content {
    flex-grow: 0;
    overflow: visible;
    max-height: none;
    padding-bottom: 0;
}

.order-column .order-summary {
    margin-top: 1.25rem;
}

.order-item {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.quantity-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.quantity-btn {
    background-color: #e9ecef;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--secondary-text-color);
    transition: background-color 0.2s, color 0.2s;
}

.quantity-btn:hover {
    background-color: var(--primary-color);
    color: white;
}

.order-item-total {
    font-weight: 600;
    text-align: right;
    width: 70px;
}

.order-summary {
    margin-top: auto;
    padding: 1.25rem;
    border-top: 1px solid var(--border-color);
}

.summary-line {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.summary-line.discount-line,
.summary-line.customer-name-line {
    align-items: center;
}

.discount-input {
    width: 70px;
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    text-align: right;
    font-size: 1rem;
    font-family: inherit;
    appearance: textfield;
    -moz-appearance: textfield;
    /* Firefox */
}

.customer-name-input {
    width: 150px;
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    text-align: right;
    font-size: 1rem;
    font-family: inherit;
}

.discount-input::-webkit-outer-spin-button,
.discount-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}


.summary-line.total {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-top: 1rem;
}

.print-options-summary {
    display: flex;
    justify-content: space-around;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    padding: 0.75rem 0;
    border-top: 1px solid var(--border-color);
}

.print-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.print-option label {
    font-weight: 600;
    color: var(--secondary-text-color);
    cursor: pointer;
}

.print-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
}


.finalize-btn {
    width: 100%;
    padding: 1rem;
    font-size: 1.2rem;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
    font-weight: 700;
}

.finalize-btn:hover {
    background-color: #218838;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-spinner {
    position: absolute;
    right: 8px;
    width: 18px;
    height: 18px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* AI Assistant Column */
.suggestion-card {
    background-color: #fff9f2;
    border: 1px solid #ffe8cc;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.suggestion-details {
    flex-grow: 1;
    margin-right: 1rem;
}

.suggestion-details p {
    margin: 0;
}

.suggestion-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.25rem;
}

.suggestion-name {
    font-weight: 600;
    color: var(--primary-color);
}

.suggestion-price {
    font-weight: 600;
    color: var(--text-color);
}

.suggestion-reason {
    font-style: italic;
    color: var(--secondary-text-color);
    font-size: 0.9rem;
}

.ai-suggestions-wrapper {
    position: relative;
    min-height: 220px;
}

.suggestions-list {
    display: flex;
    flex-direction: column;
}

.suggestions-list.dimmed {
    opacity: 0.45;
    pointer-events: none;
    filter: grayscale(0.2);
}

.ai-loading-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ai-loading-grid.overlay {
    position: absolute;
    inset: 0;
    padding: 1.25rem;
    background-color: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(2px);
    border-radius: 12px;
    pointer-events: none;
}

.suggestion-card.loading {
    border-color: #f0f0f0;
    background-color: #ffffff;
}

.shimmer-block {
    position: relative;
    overflow: hidden;
    background-color: #f2f2f2;
    border-radius: 8px;
}

.shimmer-block::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8), transparent);
    animation: shimmer 1.3s infinite;
}

.shimmer-line {
    height: 12px;
    border-radius: 999px;
    margin-bottom: 0.4rem;
}

.shimmer-line:last-child {
    margin-bottom: 0;
}

.shimmer-line.w-60 {
    width: 60%;
}

.shimmer-line.w-80 {
    width: 80%;
}

.shimmer-chip {
    width: 64px;
    height: 36px;
    border-radius: 999px;
    margin-left: auto;
}

@keyframes shimmer {
    100% {
        transform: translateX(100%);
    }
}

/* Kitchen & History Views */
.app-container.screen-mode {
    display: flex;
    max-width: 1000px;
    min-height: 0;
}

.kitchen-view,
.history-view {
    width: 100%;
}

.kitchen-toolbar,
.history-toolbar {
    padding: 1rem 1.25rem;
    background: linear-gradient(180deg, #fcfcfd, #f7f8fa);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.kitchen-search,
.history-search {
    flex-grow: 1;
    padding: 0.7rem 1rem 0.7rem 2.5rem;
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text-color);
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239aa3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 0.85rem center;
    border: 1px solid rgba(15, 23, 42, 0.1);
    border-radius: 10px;
    min-width: 150px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.kitchen-search:focus,
.history-search:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(232, 93, 4, 0.12);
}

.kitchen-search::placeholder,
.history-search::placeholder {
    color: #9aa3af;
}

.date-filters {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.date-filter {
    padding: 0.6rem 0.75rem;
    font-size: 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: inherit;
}

.clear-filters-btn {
    background-color: var(--secondary-text-color);
    color: white;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.2s;
}

.clear-filters-btn:hover {
    background-color: #5a6268;
}

.kitchen-order-card,
.history-order-card {
    position: relative;
    border: 1px solid rgba(15, 23, 42, 0.07);
    border-left: 4px solid #cbd5e1;
    border-radius: 14px;
    margin-bottom: 1rem;
    background-color: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 10px 24px -18px rgba(15, 23, 42, 0.35);
    overflow: hidden;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.kitchen-order-card:hover,
.history-order-card:hover {
    box-shadow: 0 2px 4px rgba(15, 23, 42, 0.05), 0 16px 32px -16px rgba(15, 23, 42, 0.28);
}

/* Colored left rail reflects the order's current status at a glance. */
.kitchen-order-card:has(.status-pending) { border-left-color: #f59e0b; }
.kitchen-order-card:has(.status-cooking) { border-left-color: #3b82f6; }
.kitchen-order-card:has(.status-ready-for-delivery) { border-left-color: #10b981; }
.kitchen-order-card:has(.status-delivered) { border-left-color: #94a3b8; }

.kitchen-order-card .card-header,
.history-order-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 1rem 1.15rem;
    background: linear-gradient(180deg, #fbfbfc, #f6f7f9);
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    gap: 1rem;
}

.card-header-left {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.order-source {
    font-size: 0.72rem;
    color: #475569;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background-color: #eef1f5;
    border: 1px solid rgba(15, 23, 42, 0.05);
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    display: inline-block;
    align-self: flex-start;
}

.order-customer {
    font-size: 0.85rem;
    color: var(--secondary-text-color);
    font-weight: 500;
}

.kitchen-order-card .card-header h3,
.history-order-card .card-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: #1e293b;
}

.kitchen-order-card .card-body,
.history-order-card .card-body {
    padding: 0.9rem 1.15rem;
}

.kitchen-order-card .card-body ul,
.history-order-card .card-body ul {
    list-style-type: none;
    padding-left: 0;
}

.kitchen-order-card .card-body li,
.history-order-card .card-body li {
    padding: 0.25rem 0;
}

.kitchen-order-card .card-footer,
.history-order-card .card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 1.15rem;
    background-color: #fcfcfd;
    border-top: 1px solid rgba(15, 23, 42, 0.06);
    gap: 1rem;
}

.card-footer-left,
.card-footer-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.order-total {
    font-weight: 700;
    white-space: nowrap;
    color: #1e293b;
    font-size: 1.05rem;
}

.order-total.big {
    font-size: 1.2rem;
    color: var(--primary-color);
}

.order-details {
    font-size: 0.9rem;
    color: var(--secondary-text-color);
}

.order-details strong {
    color: var(--text-color);
}

.card-action-btn {
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.1);
    color: #334155;
    padding: 0.6rem 0.9rem;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
    font-weight: 600;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 42px;
}

.card-action-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background-color: rgba(232, 93, 4, 0.04);
    transform: translateY(-1px);
    box-shadow: 0 8px 16px -8px rgba(230, 90, 12, 0.35);
}

.kitchen-order-card .card-footer-right {
    display: flex;
    width: 100%;
}

.order-action-row {
    display: flex;
    align-items: stretch;
    gap: 0.6rem;
    width: 100%;
}

.order-action-row>* {
    flex: 1;
}

.status-pill {
    background: #f1f4f8;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 10px;
    padding: 0.15rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 150px;
}

.status-select {
    width: 100%;
    padding: 0.6rem;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    font-size: 0.85rem;
    color: #334155;
    background-color: transparent;
    box-shadow: none;
    cursor: pointer;
}

/* Phone status changer — one tap per status instead of a dropdown. Hidden on
   wider screens, where the .status-select above stays. Styled through
   data-status, not status-* classes, because the card's coloured rail keys
   off .status-pending etc. and every card renders all four buttons. */
.status-segments {
    display: none;
}

.status-segment {
    min-height: 50px;
    padding: 0.5rem 0.4rem;
    border: 2px solid rgba(15, 23, 42, 0.12);
    border-radius: 10px;
    background: #fff;
    color: #475569;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.15;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.status-segment:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.status-segment.active[data-status="pending"] {
    border-color: #f59e0b;
    background: #fef3c7;
    color: #92400e;
}

.status-segment.active[data-status="cooking"] {
    border-color: #3b82f6;
    background: #dbeafe;
    color: #1e40af;
}

.status-segment.active[data-status="ready-for-delivery"] {
    border-color: #10b981;
    background: #d1fae5;
    color: #065f46;
}

.status-segment.active[data-status="delivered"] {
    border-color: #94a3b8;
    background: #e2e8f0;
    color: #334155;
}

@media (max-width: 768px) {
    /* Stack the footer: total → status → actions, so nothing runs off the
       right edge of the card. */
    .kitchen-order-card .card-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .kitchen-order-card .card-footer-left {
        order: 0;
    }

    .kitchen-order-card .status-segments {
        order: 1;
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 0.5rem;
    }

    .kitchen-order-card .card-footer-right {
        order: 2;
    }

    .kitchen-order-card .order-action-row {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
        gap: 0.5rem;
    }

    .kitchen-order-card .order-action-row .card-action-btn {
        min-height: 48px;
    }

    /* The dropdown is replaced by .status-segments on phones. */
    .kitchen-order-card .order-action-row .status-pill {
        display: none;
    }
}

@media (max-width: 420px) {
    .kitchen-order-card .status-segments {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.delete-btn {
    background: linear-gradient(135deg, #ff6b6b, #f63854);
    color: #fff;
    border-color: transparent;
}

.delete-btn:hover {
    color: #fff;
    border-color: transparent;
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 15px 30px rgba(246, 56, 84, 0.4);
}

/* Softer, less alarming treatment specifically for the order-card action row —
   the solid gradient above stays for destructive-confirmation modals elsewhere. */
.kitchen-order-card .delete-btn,
.history-order-card .delete-btn {
    background: #fff5f5;
    color: #dc2626;
    border-color: rgba(220, 38, 38, 0.25);
}

.kitchen-order-card .delete-btn:hover,
.history-order-card .delete-btn:hover {
    color: #fff;
    background: #ef4444;
    border-color: #ef4444;
    transform: translateY(-1px);
    box-shadow: 0 8px 16px -8px rgba(239, 68, 68, 0.5);
}

.refund-btn {
    background: #eff9ff;
    color: #0369a1;
    border-color: rgba(3, 105, 161, 0.25);
}

.refund-btn:hover {
    color: #fff;
    background: #0ea5e9;
    border-color: #0ea5e9;
    box-shadow: 0 8px 16px -8px rgba(14, 165, 233, 0.5);
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 700;
    color: white;
}

/* Refined pastel status pills — dot + label. Fully scoped to order cards (every
   property re-declared here) so the shared bare .status-badge class used
   elsewhere (e.g. the orders table) is completely unaffected. */
.kitchen-order-card .status-badge,
.history-order-card .status-badge {
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.kitchen-order-card .status-badge::before,
.history-order-card .status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

.kitchen-order-card .status-badge.status-pending,
.history-order-card .status-badge.status-pending {
    background-color: #fef3e2;
    color: #b45309;
}

.kitchen-order-card .status-badge.status-cooking,
.history-order-card .status-badge.status-cooking {
    background-color: #eaf2ff;
    color: #1d4ed8;
}

.kitchen-order-card .status-badge.status-ready-for-delivery,
.history-order-card .status-badge.status-ready-for-delivery {
    background-color: #e9fbf0;
    color: #047857;
}

.kitchen-order-card .status-badge.status-delivered,
.history-order-card .status-badge.status-delivered {
    background-color: #f1f2f6;
    color: #475569;
}

.refunded-badge {
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #dc2626;
    background-color: #fef2f2;
    border: 1px solid rgba(220, 38, 38, 0.2);
    display: inline-block;
    margin-right: 0.5rem;
}

.refunded-order {
    opacity: 0.85;
    border-left-color: #dc2626 !important;
}

.refunded-order .card-header {
    background: linear-gradient(180deg, #fff7f7, #fef6f6);
}

/* Utility classes */
.empty-state,
.loading-state {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    height: 100%;
    color: var(--secondary-text-color);
    text-align: center;
    font-size: 1.1rem;
}

/* Loading Icon Animation */
.orange-loading-icon {
    animation: spin 1.5s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Legacy spin animation - kept for compatibility */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Image Modal Styles */
.image-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.image-modal-content {
    position: relative;
    background-color: var(--surface-color);
    padding: 1rem;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    max-width: 90vw;
    max-height: 90vh;
    animation: zoomIn 0.3s ease;
}

.image-modal-content img {
    display: block;
    max-width: 100%;
    max-height: calc(90vh - 2rem);
    border-radius: 8px;
}

.image-modal-close-btn {
    position: absolute;
    top: -15px;
    right: -15px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 1.8rem;
    line-height: 36px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s, background-color 0.2s;
    z-index: 10;
}

.image-modal-close-btn:hover {
    background-color: var(--primary-hover-color);
    transform: scale(1.1);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes zoomIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Payment Modal Styles */
.payment-modal-content {
    background-color: var(--surface-color);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 450px;
    animation: zoomIn 0.3s ease;
    position: relative;
}

/* Keep the payment close control fully inside narrow phone screens. The
   generic image viewer deliberately hangs its close button over the corner,
   which gets clipped when this tall sheet scrolls on mobile. */
.payment-modal-content > .payment-modal-close-btn {
    top: 12px;
    right: 12px;
    width: 44px;
    height: 44px;
    padding: 0;
    display: grid;
    place-items: center;
    font-size: 2rem;
    line-height: 1;
}

/* A payment modal taller than the window (cash calculator on a 768px till)
   must stay reachable. The overlay scrolls instead of the modal, so the
   close button can keep hanging outside the corner; `safe center` centres
   exactly as before whenever the modal fits, and browsers without `safe`
   keep the plain `center` above. */
.image-modal-overlay:has(.payment-modal-content) {
    overflow-y: auto;
    padding: max(1.5rem, env(safe-area-inset-top)) max(0.75rem, env(safe-area-inset-right)) max(1.5rem, env(safe-area-inset-bottom)) max(0.75rem, env(safe-area-inset-left));
    align-items: safe center;
}

/* Cash calculator adds a panel; win back the space on the existing rows. */
.payment-modal-content:has(.cash-panel) h2 {
    margin-bottom: 1rem;
}

.payment-modal-content:has(.cash-panel) .payment-total-due {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
}

.payment-modal-content:has(.cash-panel) .split-payment-toggle {
    margin-bottom: 1rem;
}

.payment-modal-content:has(.cash-panel) .payment-actions {
    margin-top: 1rem;
    padding-top: 1rem;
}

.payment-modal-content h2 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 2rem;
}

.payment-total-due {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px dashed var(--border-color);
}

.payment-total-due strong {
    color: var(--primary-color);
    font-size: 2rem;
}

/* ── Payment Fee ─────────────────────────────────────────────────────────── */
.payment-fee-summary {
    margin: 0.75rem 0 1rem;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: grid;
    gap: 0.35rem;
    font-size: 0.95rem;
}

.payment-fee-line {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.payment-fee-total {
    margin-top: 0.25rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
    font-weight: 600;
}

.payment-fee-total strong {
    color: var(--primary-color);
    font-size: 1.15rem;
}

.payment-fee-ask {
    margin: 0.5rem 0 0.75rem;
    padding: 0.6rem 0.75rem;
    border: 1px dashed var(--border-color);
    border-radius: 8px;
}

.payment-fee-ask-label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.payment-fee-ask-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.payment-fee-ask-row .input-wrapper {
    flex: 1;
    min-width: 0;
}

.payment-fee-mode {
    display: inline-flex;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
}

.payment-fee-mode-btn {
    padding: 0.4rem 0.75rem;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.payment-fee-mode-btn + .payment-fee-mode-btn {
    border-left: 1px solid var(--border-color);
}

.payment-fee-mode-btn.selected {
    background: var(--primary-color);
    color: #fff;
}

.split-payment-toggle {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.payment-method-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: center;
}

.payment-select,
.payment-input {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: inherit;
}

.payment-input {
    padding-left: 2rem;
    appearance: textfield;
    -moz-appearance: textfield;
}

.payment-input::-webkit-outer-spin-button,
.payment-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.payment-input:read-only {
    background-color: var(--background-color);
    color: var(--secondary-text-color);
}

.payment-modal-content .input-wrapper .currency-symbol {
    position: absolute;
    left: 12px;
    color: var(--secondary-text-color);
    font-weight: 600;
}

/* ── Payment method quick-select ───────────────────────────────────────────
   Tender types come from the branch's Billing Settings. Common ones are
   tapped directly; the rest sit behind "More" so a busy till is one tap, not
   a dropdown, per bill. */
.payment-method-picker {
    margin-bottom: 1rem;
}

.payment-picker-label {
    margin: 0 0 0.6rem;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--secondary-text-color);
}

.payment-quick-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
}

.payment-quick-grid-overflow {
    margin-top: 0.6rem;
}

.payment-quick-btn {
    /* 56px keeps this comfortably tappable on a tablet till. */
    min-height: 56px;
    padding: 0.6rem 0.7rem;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    background: #fff;
    color: var(--text-color);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.12s ease, border-color 0.12s ease;
}

.payment-quick-btn:hover {
    border-color: var(--primary-color);
}

.payment-quick-btn.selected {
    border-color: #16a34a;
    background: #dcfce7;
    color: #14532d;
}

.payment-more-btn {
    width: 100%;
    min-height: 46px;
    margin-top: 0.6rem;
    padding: 0.5rem 0.7rem;
    border: 1px dashed var(--secondary-text-color);
    border-radius: 10px;
    background: #fff;
    color: var(--text-color);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
}

.payment-selected-name {
    font-weight: 600;
    color: var(--text-color);
}

@media (max-width: 480px) {
    .payment-quick-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Payment methods editor (Billing Settings) ──────────────────────────── */
.pm-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.pm-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.pm-fee {
    padding: 0.1rem 0.75rem 0.35rem 2.5rem;
    font-size: 0.85rem;
}

.pm-fee-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 600;
}

.pm-fee-toggle input[type="checkbox"] {
    accent-color: var(--primary-color);
}

.pm-fee-state {
    font-size: 0.75rem;
    color: #6b7280;
}

.pm-fee-fields {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.pm-fee-field {
    display: grid;
    gap: 0.25rem;
    font-weight: 600;
}

.pm-fee-field select,
.pm-fee-input {
    padding: 0.4rem 0.55rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    font: inherit;
    font-weight: 400;
}

.pm-fee-input {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.pm-fee-input input {
    width: 5.5rem;
    border: 0;
    outline: 0;
    font: inherit;
}

.pm-fee-hint {
    margin: 0;
    color: #6b7280;
    font-size: 0.8rem;
    align-self: center;
}

.pm-row {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) 130px 74px 92px;
    gap: 0.75rem;
    align-items: center;
    padding: 0.55rem 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
}

.pm-row-disabled {
    background: #f9fafb;
}

.pm-row-disabled .pm-name-input {
    color: #9ca3af;
}

.pm-toggle {
    display: flex;
    align-items: center;
}

.pm-toggle input[type="checkbox"] {
    width: 17px;
    height: 17px;
    accent-color: var(--primary-color);
    cursor: pointer;
}

.pm-name-input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.45rem 0.6rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
}

.pm-code {
    justify-self: start;
    padding: 0.25rem 0.5rem;
    border-radius: 5px;
    background: #f3f4f6;
    color: #6b7280;
    font-size: 0.75rem;
}

.pm-order-controls {
    display: flex;
    gap: 0.25rem;
}

.pm-order-btn {
    width: 32px;
    height: 30px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    color: #374151;
    font-size: 0.8rem;
    cursor: pointer;
}

.pm-order-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pm-system-badge {
    padding: 0.3rem 0.6rem;
    border-radius: 999px;
    background: #f3f4f6;
    color: #4b5563;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
}

.pm-remove-btn {
    padding: 0.35rem 0.6rem;
    border: 1px solid #fca5a5;
    border-radius: 6px;
    background: #fff;
    color: #b91c1c;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

.pm-add-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
}

.pm-add-select {
    padding: 0.5rem 0.6rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.9rem;
}

.pm-add-form .pm-name-input {
    width: auto;
    flex-grow: 1;
    min-width: 180px;
}

.pm-add-btn {
    padding: 0.55rem 1rem;
    border: 1px dashed #2563eb;
    border-radius: 8px;
    background: #eff6ff;
    color: #1d4ed8;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.pm-cancel-btn {
    padding: 0.55rem 0.9rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    color: #4b5563;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

@media (max-width: 720px) {
    .pm-row {
        grid-template-columns: 24px minmax(0, 1fr) auto;
        grid-template-areas:
            "toggle name name"
            "code   order action";
        row-gap: 0.5rem;
    }

    .pm-row .pm-toggle { grid-area: toggle; }
    .pm-row .pm-name-input { grid-area: name; }
    .pm-row .pm-code { grid-area: code; }
    .pm-row .pm-order-controls { grid-area: order; justify-self: end; }
    .pm-row .pm-system-badge,
    .pm-row .pm-remove-btn { grid-area: action; justify-self: end; }
}

/* ── Billing Settings live preview ─────────────────────────────────────────
   A sample bill drawn with the real OrderColumn / PaymentModal classes, so it
   tracks the POS styling automatically. Only layout and the annotations that
   do not exist on the real till are defined here. */
.billing-settings-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 1.75rem;
    align-items: start;
}

.bp-panel {
    position: sticky;
    top: 96px;
    display: grid;
    gap: 0.85rem;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--background-color);
}

.bp-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
}

.bp-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: #374151;
}

.bp-subtitle {
    margin: 0.1rem 0 0;
    font-size: 0.82rem;
    color: var(--secondary-text-color);
}

.bp-unsaved {
    flex-shrink: 0;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: #fef3c7;
    color: #92400e;
    font-size: 0.75rem;
    font-weight: 700;
}

.bp-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.25rem;
    padding: 0.25rem;
    border-radius: 10px;
    background: #e9ecef;
}

.bp-tab {
    border: none;
    border-radius: 8px;
    padding: 0.45rem 0.4rem;
    background: transparent;
    color: var(--secondary-text-color);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.bp-tab[aria-selected="true"] {
    background: var(--surface-color);
    color: var(--text-color);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.bp-screen {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.bp-screen .column-header {
    font-size: 1.25rem;
}

.bp-payment.payment-modal-content {
    max-width: none;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    animation: none;
}

.bp-payment.payment-modal-content h2 {
    margin-bottom: 1rem;
    font-size: 1.6rem;
}

/* Marks where something was removed from the till — not part of the real UI. */
.bp-hidden-note {
    margin: 0 0 0.75rem;
    padding: 0.45rem 0.65rem;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
    color: var(--secondary-text-color);
    font-size: 0.82rem;
    line-height: 1.4;
}

.payment-quick-btn.bp-just-added {
    animation: bpJustAdded 1.2s ease 2;
    box-shadow: 0 0 0 3px rgba(232, 93, 4, 0.35);
}

@keyframes bpJustAdded {
    0%, 100% { box-shadow: 0 0 0 3px rgba(232, 93, 4, 0.35); }
    50% { box-shadow: 0 0 0 6px rgba(232, 93, 4, 0.12); }
}

@media (prefers-reduced-motion: reduce) {
    .payment-quick-btn.bp-just-added {
        animation: none;
    }
}

.bp-done {
    padding: 1.25rem;
}

.bp-done-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--status-ready);
}

.bp-done-sub {
    margin: 0.2rem 0 0;
    color: var(--secondary-text-color);
    font-size: 0.92rem;
}

.bp-outcomes {
    display: grid;
    gap: 0.5rem;
    margin: 1rem 0;
    padding: 0;
    list-style: none;
}

.bp-outcomes li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.92rem;
    font-weight: 600;
}

.bp-outcome {
    flex-shrink: 0;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
}

.bp-outcome-on {
    background: #dcfce7;
    color: #14532d;
}

.bp-outcome-skip {
    background: #fef3c7;
    color: #92400e;
}

.bp-outcome-off {
    background: #e9ecef;
    color: #495057;
}

.bp-restart {
    padding: 0.55rem 0.9rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    color: #4b5563;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.bp-footnote {
    margin: 0;
    color: var(--secondary-text-color);
    font-size: 0.8rem;
    line-height: 1.45;
}

.bp-footnote-alert {
    color: #92400e;
}

.bp-hardware {
    display: grid;
    gap: 0.3rem;
    padding: 0.75rem 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--surface-color);
}

.bp-hardware-title {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--secondary-text-color);
}

.bp-hardware-line {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    min-width: 0;
    margin: 0;
    font-size: 0.85rem;
    color: var(--secondary-text-color);
}

/* Long printer names ("EPSON TM-T88V Receipt5 (USB001)") truncate, never overflow. */
.bp-hardware-value {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-color);
}

.bp-drawer-hint {
    margin: 0.6rem 0 0;
    text-align: center;
    color: #15803d;
    font-size: 0.85rem;
    font-weight: 600;
}

/* ── Cash Change Calculator ────────────────────────────────────────────────
   Shared by PaymentModal and the Billing Settings preview (CashChangePanel). */
.cash-panel {
    display: grid;
    gap: 0.6rem;
    margin-bottom: 1rem;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--background-color);
}

.cash-panel-title {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--secondary-text-color);
}

.cash-panel-label {
    font-weight: 700;
    color: var(--text-color);
}

.payment-input.cash-panel-input {
    min-height: 52px;
    padding-left: 2.6rem;
    font-size: 1.35rem;
    font-weight: 700;
}

.cash-panel .input-wrapper .currency-symbol {
    font-size: 1.2rem;
}

.cash-quick-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.cash-quick-btn {
    flex: 1 1 auto;
    min-height: 44px;
    padding: 0.5rem 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    background: #fff;
    color: var(--text-color);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.cash-quick-btn:hover {
    border-color: var(--primary-color);
}

.cash-panel-error {
    margin: 0;
    color: #dc3545;
    font-size: 0.9rem;
    font-weight: 600;
}

/* "Change to Give Back" is the number the cashier must act on — make it the
   loudest thing on the screen. */
.cash-change {
    display: grid;
    justify-items: center;
    gap: 0.15rem;
    padding: 0.85rem 1rem;
    border: 2px solid #16a34a;
    border-radius: 12px;
    background: #dcfce7;
    color: #14532d;
    text-align: center;
}

.cash-change-pending {
    border-color: var(--border-color);
    background: var(--surface-color);
    color: var(--secondary-text-color);
}

.cash-change-label {
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.cash-change-amount {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
}

.cash-change-detail {
    font-size: 0.9rem;
    font-weight: 600;
}

.cash-change-final {
    margin: 1rem 0;
}

.cash-change-final .cash-change-amount {
    font-size: 2.6rem;
}

/* ── Payment completed ─────────────────────────────────────────────────── */
.payment-complete {
    text-align: center;
}

.payment-complete-badge {
    margin: 0;
    color: #16a34a;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.payment-complete-meta {
    margin: 0.35rem 0 0;
    color: var(--secondary-text-color);
    font-size: 0.95rem;
}

.drawer-status {
    margin: 0.75rem 0 0;
    font-size: 0.92rem;
    font-weight: 600;
}

.drawer-status-pending {
    color: var(--secondary-text-color);
}

.drawer-status-ok {
    color: #15803d;
}

.drawer-status-failed {
    display: grid;
    gap: 0.35rem;
    padding: 0.85rem 1rem;
    border: 1px solid #fecaca;
    border-radius: 10px;
    background: #fef2f2;
    color: #991b1b;
    text-align: left;
}

.drawer-status-title {
    margin: 0;
    font-weight: 700;
}

.drawer-status-detail {
    margin: 0;
    color: #7f1d1d;
    font-size: 0.85rem;
    font-weight: 500;
}

.drawer-retry-btn {
    justify-self: start;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 8px;
    background: #dc2626;
    color: #fff;
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
}

/* ── Manual Open Cash Drawer (POS order header, desktop app only) ──────── */
.cash-drawer-btn {
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--surface-color);
    color: var(--text-color);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
}

.cash-drawer-btn:hover:not(:disabled) {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.cash-drawer-btn:disabled {
    opacity: 0.7;
    cursor: progress;
}

.cash-drawer-btn-failed {
    border-color: #fca5a5;
    background: #fef2f2;
    color: #b91c1c;
}

/* ── Billing Settings → Advanced Cash Handling ─────────────────────────── */
.ach-section {
    display: grid;
    gap: 1rem;
}

.ach-row {
    display: grid;
    gap: 0.75rem;
}

.ach-row-main {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.ach-row-text {
    flex: 1;
    min-width: 0;
}

.ach-row-title {
    font-weight: 600;
    color: #374151;
}

.ach-row-desc {
    margin: 0.25rem 0 0;
    color: #6b7280;
    font-size: 0.9rem;
    line-height: 1.5;
}

.ach-switch {
    flex-shrink: 0;
}

.ach-note {
    margin: 0;
    padding-top: 0.75rem;
    border-top: 1px dashed #e5e7eb;
    color: #6b7280;
    font-size: 0.85rem;
}

.ach-drawer {
    display: grid;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed #e5e7eb;
}

.ach-drawer-options {
    display: grid;
    gap: 1rem;
    padding-left: 1rem;
    border-left: 3px solid #e5e7eb;
}

.ach-field {
    display: grid;
    gap: 0.4rem;
    min-width: 0;
}

.ach-field-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
}

.ach-select {
    width: 100%;
    max-width: 420px;
    min-width: 0;
    padding: 0.55rem 0.7rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    font-family: inherit;
    font-size: 0.95rem;
    text-overflow: ellipsis;
}

.ach-nested {
    padding: 0.75rem;
    border-radius: 8px;
    background: #f9fafb;
}

.ach-roles {
    min-width: 0;
    margin: 0;
    border: 0;
}

.ach-roles legend {
    float: left;
    width: 100%;
    margin-bottom: 0.4rem;
    padding: 0;
}

.ach-roles-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    clear: both;
}

.ach-role {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
}

.ach-link-btn {
    padding: 0;
    border: none;
    background: none;
    color: #2563eb;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.ach-link-btn:disabled {
    color: #9ca3af;
    cursor: default;
}

.ach-error {
    margin: 0;
    color: #b91c1c;
    font-size: 0.85rem;
}

.ach-test {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
}

.ach-success {
    flex-basis: 100%;
    margin: 0;
    color: #15803d;
    font-size: 0.9rem;
    font-weight: 600;
}

.ach-failure {
    flex-basis: 100%;
    padding: 0.65rem 0.8rem;
    border: 1px solid #fecaca;
    border-radius: 8px;
    background: #fef2f2;
}

.ach-failure-title {
    margin: 0;
    color: #991b1b;
    font-weight: 700;
}

@media (max-width: 600px) {
    .ach-drawer-options {
        padding-left: 0.6rem;
    }

    .bp-tab {
        white-space: normal;
        line-height: 1.2;
    }

    .cash-change-final .cash-change-amount {
        font-size: 2.1rem;
    }
}

/* Below this the settings column gets too narrow for the payment-method rows;
   stack the preview underneath instead. */
@media (max-width: 1280px) {
    .billing-settings-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .bp-panel {
        position: static;
        max-width: 480px;
    }
}

.payment-error {
    color: #dc3545;
    text-align: center;
    margin-top: 1rem;
    font-weight: 600;
}

.payment-actions {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px dashed var(--border-color);
}

.confirm-payment-btn {
    width: 100%;
    padding: 1rem;
    font-size: 1.2rem;
    background-color: var(--status-ready);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.confirm-payment-btn:hover:not(:disabled) {
    background-color: #218838;
}

.confirm-payment-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.payment-btn-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: inline-block;
}

/* Refund Confirmation Modal */
.refund-modal-content {
    background-color: var(--surface-color);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 500px;
    animation: zoomIn 0.3s ease;
    position: relative;
}

.refund-modal-content h2 {
    text-align: center;
    color: #dc3545;
    margin-bottom: 1.5rem;
    font-size: 1.75rem;
}

.refund-order-details {
    background-color: var(--background-color);
    padding: 1.25rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
}

.refund-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.refund-detail-row:last-child {
    border-bottom: none;
}

.refund-label {
    color: var(--secondary-text-color);
    font-size: 0.95rem;
}

.refund-detail-row strong {
    color: var(--text-color);
    font-size: 1rem;
}

.refund-amount {
    color: #dc3545;
    font-size: 1.25rem;
}

.refund-warning {
    background-color: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.refund-warning p {
    margin: 0;
    color: #856404;
    font-size: 0.95rem;
    line-height: 1.5;
}

.refund-confirmation-input {
    margin-bottom: 1.5rem;
}

.refund-confirmation-input label {
    display: block;
    margin-bottom: 0.75rem;
    color: var(--text-color);
    font-weight: 600;
    font-size: 0.95rem;
}

.refund-confirmation-input label strong {
    color: #dc3545;
    font-size: 1.1rem;
}

.refund-confirmation-input input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    transition: all 0.2s;
    box-sizing: border-box;
}

.refund-confirmation-input input:focus {
    outline: none;
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

.refund-confirmation-input input.refund-input-error {
    border-color: #dc3545;
    background-color: #fff5f5;
}

.refund-modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.refund-cancel-btn,
.refund-confirm-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.refund-cancel-btn {
    background-color: var(--background-color);
    color: var(--secondary-text-color);
    border: 1px solid var(--border-color);
}

.refund-cancel-btn:hover {
    background-color: #f8f9fa;
    border-color: var(--secondary-text-color);
}

.refund-confirm-btn {
    background-color: #dc3545;
    color: white;
}

.refund-confirm-btn:hover:not(:disabled) {
    background-color: #c82333;
}

.refund-confirm-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Sales Analytics Modal */
.sales-analytics-modal-content {
    background-color: var(--surface-color);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    animation: zoomIn 0.3s ease;
    position: relative;
}

.sales-analytics-modal-content h2 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 1.75rem;
}

.analytics-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.date-shortcuts-group {
    grid-column: 1 / -1;
}

.date-shortcuts {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.date-shortcut-btn {
    padding: 0.5rem 1rem;
    background-color: var(--background-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.date-shortcut-btn:hover {
    background-color: var(--surface-color);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.date-shortcut-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.date-shortcut-btn.active:hover {
    background-color: #4a90e2;
}

.filter-group label {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.95rem;
}

.filter-input {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    background-color: var(--background-color);
    color: var(--text-color);
    transition: all 0.2s;
}

.filter-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.analytics-error {
    background-color: #fff5f5;
    border: 1px solid #dc3545;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    color: #dc3545;
    text-align: center;
    font-weight: 600;
}

.analytics-loading {
    text-align: center;
    padding: 2rem;
    color: var(--secondary-text-color);
    font-size: 1.1rem;
}

.analytics-results {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.analytics-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.summary-card {
    background-color: var(--background-color);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    text-align: center;
}

.summary-card h3 {
    margin: 0 0 0.75rem 0;
    color: var(--secondary-text-color);
    font-size: 0.95rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.summary-value {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.75rem;
    font-weight: 700;
}

.analytics-breakdown {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.breakdown-section {
    background-color: var(--background-color);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.breakdown-section h3 {
    margin: 0 0 1rem 0;
    color: var(--text-color);
    font-size: 1.1rem;
    font-weight: 600;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-color);
}

.breakdown-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background-color: var(--surface-color);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.breakdown-label {
    color: var(--text-color);
    font-weight: 500;
}

.breakdown-value {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 1.05rem;
}

.no-data {
    text-align: center;
    color: var(--secondary-text-color);
    padding: 1rem;
    font-style: italic;
}

/* Orders Table Section */
.orders-table-section {
    margin-top: 2rem;
    background-color: var(--background-color);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.orders-table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-color);
    width: 100%;
}

.orders-table-section h3 {
    margin: 0;
    color: var(--text-color);
    font-size: 1.3rem;
    font-weight: 600;
}

.export-excel-btn {
    padding: 0.75rem 1.5rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.export-excel-btn:hover {
    background-color: #4a90e2;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.export-excel-btn:active {
    transform: translateY(0);
}

.orders-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    display: flex;
    justify-content: center;
}

.orders-table {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
    margin: 0 auto;
}

.orders-table thead {
    background-color: var(--surface-color);
    position: sticky;
    top: 0;
    z-index: 10;
}

.orders-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-color);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

/* Align numeric columns to center/right in Menu Report */
.orders-table th:nth-child(3) {
    text-align: center;
}

.orders-table th:nth-child(4),
.orders-table th:nth-child(5) {
    text-align: right;
}

.orders-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-color);
    vertical-align: top;
}

.orders-table tbody tr:hover {
    background-color: var(--surface-color);
}

.orders-table tbody tr:last-child td {
    border-bottom: none;
}

.order-id-cell {
    font-weight: 600;
    color: var(--primary-color);
    white-space: nowrap;
}

.order-date-cell {
    white-space: nowrap;
    font-size: 0.9rem;
    color: var(--secondary-text-color);
}

.order-customer-cell {
    font-weight: 500;
}

.order-items-cell {
    min-width: 200px;
}

.order-items-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.order-item-entry {
    padding: 0.25rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.order-item-entry:last-child {
    border-bottom: none;
}

.item-name {
    font-weight: 500;
    color: var(--text-color);
}

.item-variation {
    color: var(--secondary-text-color);
    font-size: 0.9em;
    font-weight: normal;
}

.order-quantity-cell {
    text-align: center;
}

.order-quantities-list {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: center;
}

.order-quantities-list li {
    padding: 0.25rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.order-quantities-list li:last-child {
    border-bottom: none;
}

.order-status-cell {
    white-space: nowrap;
}

.status-badge {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: capitalize;
}

.status-pending {
    background-color: #fff3cd;
    color: #856404;
}

.status-cooking {
    background-color: #d1ecf1;
    color: #0c5460;
}

.status-ready-for-delivery {
    background-color: #d4edda;
    color: #155724;
}

.status-delivered {
    background-color: #cce5ff;
    color: #004085;
}

.status-refunded {
    background-color: #f8d7da;
    color: #721c24;
}

.order-total-cell {
    font-weight: 600;
    color: var(--primary-color);
    white-space: nowrap;
    text-align: right;
}

.no-items {
    color: var(--secondary-text-color);
    font-style: italic;
}

/* Sales Analytics Page */
.sales-analytics-page {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.sales-analytics-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.sales-analytics-header h1 {
    margin: 0;
    color: var(--primary-color);
    font-size: 2rem;
    flex: 1;
}

.back-button {
    padding: 0.75rem 1.5rem;
    background-color: var(--background-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.back-button:hover {
    background-color: var(--surface-color);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Mobile Navigation */
.mobile-nav {
    display: none;
    /* Hide on desktop */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background-color: var(--surface-color);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.05);
    z-index: 100;
}

.nav-btn {
    flex-grow: 1;
    background-color: transparent;
    border: none;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--secondary-text-color);
    cursor: pointer;
    transition: color 0.2s;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-btn.active {
    color: var(--primary-color);
}

.nav-btn:not(:last-child) {
    border-right: 1px solid var(--border-color);
}

.order-badge {
    position: absolute;
    top: 8px;
    right: 12px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    overflow-y: auto;
    background: linear-gradient(135deg, rgba(232, 93, 4, 0.08), rgba(255, 189, 89, 0.18));
}

.auth-card {
    width: min(420px, 100%);
    background: var(--surface-color);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12);
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    text-align: center;
    margin: auto;
}

.auth-brand img {
    width: min(340px, 100%);
    height: auto;
    max-height: 72px;
    object-fit: contain;
    margin-bottom: 1rem;
}

.auth-brand h1 {
    font-size: 1.75rem;
    margin-bottom: 0.25rem;
}

.auth-brand p {
    color: var(--secondary-text-color);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    text-align: left;
}

.auth-form label {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    font-weight: 600;
    color: var(--secondary-text-color);
}

.auth-form input {
    padding: 0.75rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.auth-form input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(232, 93, 4, 0.15);
}

.auth-form button {
    margin-top: 0.5rem;
    padding: 0.85rem;
    border-radius: 10px;
    border: none;
    background-color: var(--primary-color);
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.auth-form button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.auth-form button:not(:disabled):hover {
    background-color: var(--primary-hover-color);
    transform: translateY(-1px);
}

.saved-login-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: rgba(232, 93, 4, 0.035);
}

.auth-form .saved-login-toggle {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    align-items: start;
    gap: 0.7rem;
    cursor: pointer;
}

.auth-form .saved-login-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0.1rem 0 0;
    padding: 0;
    accent-color: var(--primary-color);
    cursor: pointer;
}

.saved-login-toggle span {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 0.25rem;
}

.saved-login-toggle strong {
    color: var(--text-color);
    font-size: 0.95rem;
    line-height: 1.3;
}

.saved-login-toggle small {
    color: var(--secondary-text-color);
    font-size: 0.78rem;
    font-weight: 400;
    line-height: 1.4;
}

.auth-form .saved-login-forget {
    align-self: flex-start;
    margin: 0 0 0 1.8rem;
    padding: 0.45rem 0.7rem;
    border: 1px solid rgba(232, 93, 4, 0.35);
    border-radius: 7px;
    background: transparent;
    color: var(--primary-color);
    font-size: 0.82rem;
    font-weight: 600;
}

.auth-form .saved-login-forget:not(:disabled):hover {
    background: rgba(232, 93, 4, 0.08);
    color: var(--primary-hover-color);
    transform: none;
}

@media (max-height: 760px), (max-width: 520px) {
    .auth-wrapper {
        align-items: flex-start;
        padding: 1rem;
    }

    .auth-card {
        padding: 1.5rem;
        gap: 1.15rem;
    }

    .auth-brand img {
        margin-bottom: 0.65rem;
    }
}

.auth-error {
    background-color: rgba(220, 53, 69, 0.1);
    border: 1px solid rgba(220, 53, 69, 0.4);
    color: #dc3545;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    font-size: 0.95rem;
}

.auth-hint {
    font-size: 0.9rem;
    color: var(--secondary-text-color);
}

.auth-loading-state {
    background: var(--background-color);
}

.auth-mode-toggle {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.auth-mode-toggle button {
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 0.45rem 1rem;
    background: transparent;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.auth-mode-toggle button.active {
    background-color: rgba(232, 93, 4, 0.12);
    border-color: var(--primary-color);
    color: var(--primary-color);
    box-shadow: 0 2px 6px rgba(232, 93, 4, 0.2);
}

.auth-info {
    background-color: rgba(25, 135, 84, 0.12);
    border: 1px solid rgba(25, 135, 84, 0.4);
    color: #198754;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    font-size: 0.95rem;
}

.auth-resend {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
}

.auth-resend button {
    border: none;
    background-color: transparent;
    color: var(--primary-color);
    font-weight: 600;
    cursor: pointer;
}

.auth-resend small {
    color: var(--secondary-text-color);
}

/* Access Revoked Page */
.access-revoked-card {
    border-top: 4px solid #e85d04;
}

.access-revoked-icon {
    font-size: 3rem;
    line-height: 1;
}

.access-revoked-message {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

.access-revoked-sub {
    font-size: 0.9rem;
    color: var(--secondary-text-color);
    margin: 0;
}

.access-revoked-hint {
    font-size: 0.85rem;
    color: var(--secondary-text-color);
    background: rgba(232, 93, 4, 0.07);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin: 0;
}

.access-revoked-signout {
    margin-top: 0.5rem;
}


/* Admin Page Styles */
.admin-page {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
    background-color: var(--background-color);
}

.admin-container {
    display: flex;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.admin-header {
    background-color: var(--surface-color);
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.admin-header h1 {
    margin: 0;
    font-size: 1.8rem;
    color: var(--primary-color);
}

.back-to-pos-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: background-color 0.2s;
}

.back-to-pos-btn:hover {
    background-color: var(--primary-hover-color);
}

.admin-sidebar {
    width: 250px;
    background-color: var(--surface-color);
    padding: 1rem;
    margin-top: 80px;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    overflow-x: hidden;
    transition: width 0.2s ease;
}

.admin-sidebar.collapsed {
    width: 64px;
    padding: 0.75rem 0.5rem;
}

.sidebar-collapse-btn {
    width: 100%;
    padding: 0.5rem;
    margin-bottom: 0.75rem;
    background-color: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-color);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.sidebar-collapse-btn:hover {
    background-color: var(--background-color);
    border-color: var(--primary-color);
}

.sidebar-btn {
    width: 100%;
    padding: 0.85rem 1rem;
    margin-bottom: 0.5rem;
    background-color: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    text-align: left;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-btn.collapsed {
    justify-content: center;
    padding: 0.85rem 0;
    gap: 0;
}

.sidebar-btn-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-btn:hover {
    background-color: var(--background-color);
    border-color: var(--primary-color);
}

.sidebar-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.admin-content {
    margin-left: 250px;
    margin-top: 80px;
    padding: 2rem;
    width: calc(100% - 250px);
    height: calc(100vh - 80px);
    height: calc(100dvh - 80px);
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    transition: margin-left 0.2s ease, width 0.2s ease;
}

.admin-content.sidebar-collapsed {
    margin-left: 64px;
    width: calc(100% - 64px);
}

.dashboard-section h2,
.menu-section h2,
.orders-section h2,
.inventory-section h2,
.analytics-section h1,
.settings-section h2 {
    margin-bottom: 2rem;
    font-size: 2rem;
    color: var(--primary-color);
}

.settings-options {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-top: 1.5rem;
}

.settings-option-card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1.5rem;
    border-radius: 14px;
    border: 1px solid rgba(232, 93, 4, 0.16);
    background: var(--surface-color);
    color: var(--text-color);
    text-align: left;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: var(--shadow);
}

.settings-option-card h3 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--primary-color);
}

.settings-option-card p {
    margin: 0;
    font-size: 0.95rem;
    color: var(--secondary-text-color);
}

.settings-option-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(232, 93, 4, 0.18);
    border-color: rgba(232, 93, 4, 0.36);
}

.settings-detail {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.5rem;
}

.settings-back-btn {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    border-radius: 999px;
    border: 1px solid rgba(232, 93, 4, 0.3);
    background: transparent;
    color: var(--primary-color);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
}

.settings-back-btn:hover {
    background: rgba(232, 93, 4, 0.08);
    border-color: rgba(232, 93, 4, 0.5);
}

.settings-detail-card {
    background: var(--surface-color);
    border-radius: 16px;
    padding: 2rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

/* Team filter controls */
.team-filter-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 249, 250, 0.95) 100%);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.team-filter-controls--ledger {
    align-items: stretch;
    flex-wrap: wrap;
    background: #fffdfc;
    border-color: #e8e2dc;
    border-left: 4px solid #e85d04;
    box-shadow: none;
}

.team-member-search {
    min-width: min(100%, 260px);
    flex: 1 1 280px;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0 0.85rem;
    border: 1px solid #d7d0ca;
    border-radius: 8px;
    background: #fff;
    color: #6b625b;
}

.team-member-search:focus-within {
    border-color: #e85d04;
    box-shadow: 0 0 0 3px rgba(232, 93, 4, 0.13);
}

.team-member-search input {
    width: 100%;
    min-height: 42px;
    border: 0;
    outline: 0;
    background: transparent;
    color: #171411;
    font: inherit;
}

.team-filter-label {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.95rem;
    white-space: nowrap;
}

.team-filter-select {
    flex: 1;
    max-width: 300px;
    padding: 0.65rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    background-color: var(--surface-color);
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.team-filter-select:hover {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(232, 93, 4, 0.1);
}

.team-filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(232, 93, 4, 0.15);
}

/* Team table */
.team-table-wrapper {
    width: 100%;
    overflow-x: auto;
    margin-top: 1.5rem;
}

.team-table-wrapper.bordered {
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background-color: var(--surface-color);
    box-shadow: var(--shadow);
}

.team-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 640px;
}

.team-table.bordered th,
.team-table.bordered td {
    border-bottom: 1px solid var(--border-color);
}

.team-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-weight: 600;
    color: var(--secondary-text-color);
    background-color: rgba(0, 0, 0, 0.02);
}

.team-table td {
    padding: 0.85rem 1rem;
    vertical-align: middle;
}

.team-table tbody tr:last-child td {
    border-bottom: none;
}

.team-table-name {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.team-table-plan {
    font-size: 0.85rem;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    background-color: rgba(232, 93, 4, 0.1);
    color: var(--primary-color);
    width: fit-content;
}

.team-table-actions {
    text-align: right;
    white-space: nowrap;
}

.team-actions-row {
    display: flex;
    justify-content: flex-end;
    margin-top: 1rem;
}

.team-actions-row.centered {
    justify-content: center;
}

.team-invite-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background-color: #e85d04;
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 0.65rem 1.4rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(232, 93, 4, 0.22);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.team-invite-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(232, 93, 4, 0.28);
}

.team-invite-icon {
    font-size: 1.1rem;
}

.team-invite-btn.small {
    padding: 0.5rem 1.1rem;
    font-size: 0.95rem;
}

.team-invite-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.team-invite-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.5rem;
    margin-left: 0.35rem;
    border-radius: 999px;
    background: rgba(124, 58, 237, 0.15);
    color: #7c3aed;
    font-size: 0.75rem;
    font-weight: 600;
}

.team-status-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 70px;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: capitalize;
}

.team-status-chip.status-pending {
    background: rgba(124, 58, 237, 0.12);
    color: #7c3aed;
}

.team-status-chip.status-active {
    background: rgba(16, 185, 129, 0.15);
    color: #059669;
}

.team-status-chip.status-suspended {
    background: rgba(239, 68, 68, 0.15);
    color: #b91c1c;
}

.team-status-chip.status-expired,
.team-status-chip.status-cancelled {
    background: #f2eeea;
    color: #6b625b;
}

.team-status-chip.status-delivery_failed {
    background: #fff0ee;
    color: #b42318;
}

.team-status-chip.status-accepted {
    background: rgba(16, 185, 129, 0.15);
    color: #059669;
}

.team-invite-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    padding: 1.5rem;
}

.team-invite-modal {
    width: 100%;
    max-width: 520px;
    background: var(--surface-color);
    border-radius: 18px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 90vh;
    overflow-y: auto;
}

.team-role-chip {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0.2rem 0.6rem;
    border: 1px solid #d7d0ca;
    border-radius: 7px;
    background: #fffdfc;
    color: #3f3934;
    font-size: 0.82rem;
    font-weight: 650;
}

.team-role-chip--warning {
    border-color: #f0b429;
    background: #fff8df;
    color: #765700;
}

.team-invite-scope {
    margin: 0.25rem 0 0;
    padding: 0.9rem;
    border: 1px solid #e8e2dc;
    border-radius: 10px;
    background: #fffdfc;
}

.team-invite-scope legend {
    padding: 0 0.35rem;
    color: #171411;
    font-weight: 700;
}

.team-invite-scope p {
    margin: 0 0 0.75rem;
    color: #6b625b;
    font-size: 0.84rem;
    line-height: 1.45;
}

.team-invite-branch-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
}

.team-invite-modal-body .team-invite-branch-option {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.55rem 0.65rem;
    border: 1px solid #e8e2dc;
    border-radius: 7px;
    background: #fff;
    color: #3f3934;
    font-size: 0.86rem;
    font-weight: 500;
}

.team-invite-branch-option input {
    accent-color: #e85d04;
}

@media (max-width: 680px) {
    .team-filter-label { display: none; }
    .team-filter-select { flex: 1 1 140px; max-width: none; }
    .team-invite-branch-grid { grid-template-columns: 1fr; }
}

.role-permission-ledger {
    border-top: 4px solid #171411;
}

.role-permission-ledger__intro {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 1.25rem;
}

.role-permission-ledger__intro h3 { margin: 0 0 0.4rem; }
.role-permission-ledger__intro p { margin: 0; max-width: 68ch; color: #6b625b; }

.role-owner-lock {
    flex: 0 0 auto;
    padding: 0.55rem 0.8rem;
    border: 1px solid #237a57;
    border-radius: 7px;
    background: #edf8f3;
    color: #185c41;
    font-size: 0.84rem;
    font-weight: 700;
}

.role-permission-table-wrap {
    overflow: auto;
    border: 1px solid #e8e2dc;
    border-radius: 10px;
}

.role-permission-table {
    width: 100%;
    min-width: 780px;
    border-collapse: collapse;
}

.role-permission-table th,
.role-permission-table td {
    padding: 0.72rem 0.85rem;
    border-bottom: 1px solid #eee9e4;
    text-align: center;
}

.role-permission-table th:first-child,
.role-permission-table td:first-child { text-align: left; }
.role-permission-table thead th { position: sticky; top: 0; z-index: 2; background: #171411; color: #fff; }
.role-permission-table td:first-child span { display: block; color: #171411; font-weight: 650; }
.role-permission-table td:first-child small { display: block; margin-top: 0.15rem; color: #83776e; }
.role-permission-table input { width: 18px; height: 18px; accent-color: #e85d04; }

.role-permission-table .role-permission-group th {
    background: #f2eeea;
    color: #3f3934;
    font-size: 0.88rem;
    letter-spacing: 0;
    text-align: left;
}

@media (max-width: 680px) {
    .role-permission-ledger__intro { flex-direction: column; }
}

.team-invite-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.team-invite-modal-header h4 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--text-color);
}

.team-invite-modal-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.team-invite-modal-body label {
    font-weight: 600;
    color: var(--secondary-text-color);
}

.team-invite-modal-body .form-input,
.team-invite-modal-body select.form-input {
    width: 100%;
}

.team-invite-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Team Delete List Styles */
.team-delete-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.5rem;
}

.team-delete-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem;
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
    border: 2px solid #e9ecef;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.team-delete-item:hover {
    border-color: #dc3545;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.15);
    transform: translateY(-2px);
}

.team-delete-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.team-delete-info strong {
    font-size: 1.1rem;
    color: var(--text-color);
    font-weight: 700;
}

.team-delete-meta {
    font-size: 0.9rem;
    color: var(--secondary-text-color);
}

.custom-sort-btn.danger {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    border: none;
    padding: 0.65rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

.custom-sort-btn.danger:hover:not(:disabled) {
    background: linear-gradient(135deg, #c82333 0%, #bd2130 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
}

.custom-sort-btn.danger:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.tax-settings-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.tax-country-selector {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    max-width: 340px;
}

.tax-country-selector label {
    font-weight: 600;
    color: var(--text-color);
}

.tax-country-selector select {
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    background-color: var(--surface-color);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tax-country-selector select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(232, 93, 4, 0.12);
}

.tax-country-selector .field-hint {
    font-size: 0.85rem;
    color: var(--secondary-text-color);
}

.tax-country-readonly {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 44px;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--surface-color);
}

.tax-country-readonly span {
    color: var(--secondary-text-color);
    font-size: 0.78rem;
}

.tax-model-guide {
    padding: 0.9rem 1rem;
    border: 1px solid #cfdcf7;
    border-radius: 12px;
    background: #f3f7ff;
    color: var(--text-color);
}

.tax-model-guide strong { color: #2457a6; }
.tax-model-guide p { margin: 0.35rem 0 0; color: var(--secondary-text-color); line-height: 1.5; }
.tax-model-guide--bill_level { border-color: rgba(232, 93, 4, 0.25); background: rgba(232, 93, 4, 0.06); }
.tax-model-guide--bill_level strong { color: var(--primary-color); }

.tax-fields-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
}

.tax-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 1rem;
    border: 1px solid rgba(232, 93, 4, 0.2);
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(248, 249, 250, 0.8));
    box-shadow: 0 6px 18px rgba(17, 24, 39, 0.04);
}

.tax-field span {
    font-weight: 600;
    color: var(--text-color);
}

.tax-field input {
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tax-field input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(232, 93, 4, 0.12);
}

.tax-field .field-hint {
    font-size: 0.8rem;
    color: var(--secondary-text-color);
    font-style: italic;
}

.tax-settings-status {
    padding: 0.85rem 1rem;
    border-radius: 10px;
    font-weight: 600;
}

.tax-settings-status.success {
    background: rgba(40, 167, 69, 0.12);
    color: #198754;
    border: 1px solid rgba(40, 167, 69, 0.35);
}

.tax-settings-status.error {
    background: rgba(220, 53, 69, 0.12);
    color: #dc3545;
    border: 1px solid rgba(220, 53, 69, 0.35);
}

.tax-settings-actions {
    display: flex;
    justify-content: flex-end;
}

.secondary-btn {
    background-color: var(--surface-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.secondary-btn:hover {
    background-color: var(--background-color);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.secondary-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.documents-section {
    margin-top: 2rem;
}

.documents-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.add-document-form {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
}

.document-form-field {
    margin-bottom: 1rem;
}

.document-form-field label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.95rem;
}

.document-form-field input[type="text"],
.document-form-field input[type="date"],
.document-form-field input[type="file"] {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.document-form-field input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(232, 93, 4, 0.1);
}

.documents-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.document-item {
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.document-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.document-item button {
    padding: 0.5rem;
    border: none;
    background: transparent;
    color: #dc3545;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    transition: all 0.2s ease;
}

.document-item button:hover {
    color: #c82333;
    transform: scale(1.1);
}

.billing-settings-panel {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.billing-settings-description {
    margin: 0;
    color: var(--secondary-text-color);
}

.billing-settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

.billing-settings-row:last-of-type {
    border-bottom: none;
}

.billing-settings-label {
    margin: 0;
    font-weight: 600;
}

.billing-settings-hint {
    margin: 0.25rem 0 0;
    color: var(--secondary-text-color);
    font-size: 0.9rem;
}

.billing-discount-input {
    width: 90px;
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    text-align: right;
}

.billing-settings-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.settings-save-btn {
    border: none;
    border-radius: 999px;
    padding: 0.5rem 1.25rem;
    font-weight: 600;
    color: #fff;
    background-color: var(--primary-color);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.settings-save-btn:hover {
    background-color: var(--primary-hover-color);
}

.settings-error {
    background-color: #ffe3e3;
    color: #721c24;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-weight: 600;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: var(--surface-color);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 1rem;
    border: 1px solid var(--border-color);
}

.stat-icon {
    font-size: 3rem;
}

.stat-info h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    color: var(--secondary-text-color);
    font-weight: 500;
}

.stat-value {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.dashboard-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
}

.chart-card {
    background-color: var(--surface-color);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.chart-card h3 {
    margin: 0 0 1.5rem 0;
    font-size: 1.3rem;
    color: var(--text-color);
}

.chart-placeholder {
    height: 250px;
    background-color: var(--background-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--border-color);
    color: var(--secondary-text-color);
    font-size: 1.1rem;
}

/* Recent Orders - single line layout */
.recent-orders-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.recent-order-line {
    display: grid;
    grid-template-columns: 120px 120px 1fr 140px auto auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.recent-order-line:hover {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border-color: var(--primary-color);
}

.rol-id {
    font-weight: 700;
    color: var(--text-color);
    font-size: 0.95rem;
}

.rol-customer {
    font-weight: 500;
    color: var(--text-color);
    font-size: 0.9rem;
}

.rol-items {
    color: var(--secondary-text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.9rem;
}

.rol-time {
    color: var(--secondary-text-color);
    font-size: 0.85rem;
    text-align: right;
}

.rol-total {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1rem;
}

.top-items-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 400px;
    overflow-y: auto;
}

.top-item-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background-color: var(--background-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.top-item-row:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.top-item-rank {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}

.top-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.top-item-name-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.top-item-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-color);
}

.trend-up-icon {
    color: #28a745;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.top-item-stats {
    display: flex;
    gap: 1.5rem;
    font-size: 0.9rem;
    color: var(--secondary-text-color);
}

.top-item-quantity,
.top-item-revenue {
    display: flex;
    align-items: center;
}

.top-item-revenue {
    font-weight: 600;
    color: var(--primary-color);
}

.stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon svg {
    width: 2rem;
    height: 2rem;
}

/* Variation Toggle Styles */
.variations-toggle-row {
    margin: 1rem 0;
}

.full-width {
    width: 100%;
}

.variation-toggle-wrapper {
    width: 100%;
}

.variation-toggle-card {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 1.25rem 1.75rem;
    border-radius: 16px;
    border: 2px solid var(--border-color);
    background: linear-gradient(120deg, rgba(232, 93, 4, 0.08), rgba(232, 93, 4, 0.01));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transition: all 0.2s ease;
}

.variation-toggle-card.active {
    border-color: var(--primary-color);
    background: linear-gradient(120deg, rgba(232, 93, 4, 0.12), rgba(232, 93, 4, 0.03));
    box-shadow: 0 10px 20px rgba(232, 93, 4, 0.15);
}

.variation-toggle-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(232, 93, 4, 0.18);
}

.variation-toggle-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    color: var(--text-color);
}

.variation-toggle-info h5 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-color);
}

.variation-toggle-info span {
    font-size: 0.95rem;
    color: var(--text-muted-color);
}

.variation-toggle-eyebrow {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--primary-color);
}

.variation-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    padding: 0.4rem;
}

.variation-toggle-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.variation-switch-track {
    width: 64px;
    height: 32px;
    background: var(--border-color);
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    padding: 0 4px;
    transition: background 0.25s ease, box-shadow 0.25s ease;
    box-shadow: inset 0 2px 4px rgba(15, 23, 42, 0.2);
}

.variation-switch-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 6px 12px rgba(15, 23, 42, 0.25);
    transition: transform 0.25s ease, background 0.25s ease;
}

.variation-switch.checked .variation-switch-track {
    background: linear-gradient(120deg, var(--primary-color), var(--primary-hover-color));
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15);
}

.variation-switch.checked .variation-switch-thumb {
    transform: translateX(32px);
    background: #fff;
}

.manage-variations-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.2s ease;
    margin-top: 0.5rem;
}

.manage-variations-btn:hover {
    background-color: var(--primary-hover-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Variations Preview */
.variations-preview {
    margin: 1.5rem 0;
    padding: 1rem;
    background-color: var(--background-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.variations-preview h4 {
    margin: 0 0 1rem 0;
    color: var(--text-color);
    font-size: 1rem;
}

.variations-preview-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.variation-preview-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    background-color: var(--surface-color);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.variation-preview-name {
    font-weight: 600;
    color: var(--text-color);
    flex: 1;
}

.variation-preview-details {
    color: var(--secondary-text-color);
    font-size: 0.9rem;
    margin: 0 1rem;
}

.variation-preview-price {
    font-weight: 700;
    color: var(--primary-color);
}

/* Variation Modal Styles */
.variation-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.variation-modal-content {
    background-color: white;
    border-radius: 20px;
    width: 100%;
    max-width: 900px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.35);
    animation: slideUp 0.3s ease;
    overflow: hidden;
    border: 1px solid rgba(232, 93, 4, 0.1);
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.variation-modal-header {
    padding: 2rem 2rem 1.5rem 2rem;
    border-bottom: 2px solid var(--border-color);
    position: relative;
    background: linear-gradient(135deg, rgba(232, 93, 4, 0.05) 0%, rgba(232, 93, 4, 0.02) 100%);
}

.variation-modal-header h3 {
    margin: 0;
    color: var(--text-color);
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.variation-modal-subtitle {
    margin: 0;
    color: var(--secondary-text-color);
    font-size: 0.9rem;
}

.modal-close-btn {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--secondary-text-color);
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.modal-close-btn:hover {
    background-color: var(--background-color);
    color: var(--text-color);
}

.variation-modal-body {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
    background-color: #fafafa;
}

.variation-modal-body .form-group {
    margin-bottom: 1.75rem;
}

.variation-modal-body .form-group:last-child {
    margin-bottom: 0;
}

.variation-modal-body .form-group label {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.75rem;
}

.pricing-toggle-group {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 2rem !important;
}

.pricing-toggle-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
}

.pricing-toggle-info {
    flex: 1;
}

.pricing-toggle-info label {
    display: block;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 0.25rem;
}

.pricing-toggle-hint {
    display: block;
    font-size: 0.85rem;
    color: var(--secondary-text-color);
    line-height: 1.4;
}

.pricing-switch {
    flex-shrink: 0;
}

/* ── Virtual Outlet Panel — 3-column workspace ─────────────────────── */
.virtual-outlet-panel {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.vop-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Existing outlet cards row */
.vop-outlet-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.vop-outlet-card {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--border-color);
    border-radius: 12px;
    background: var(--surface-color);
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
    min-width: 230px;
    box-shadow: inset 4px 0 0 0 transparent;
}

.vop-outlet-card:hover {
    border-color: #bbb;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08), inset 4px 0 0 0 rgba(232, 93, 4, 0.45);
}

.vop-outlet-card.editing {
    border-color: var(--primary-color);
    background: rgba(232, 93, 4, 0.03);
    box-shadow: 0 2px 12px rgba(232, 93, 4, 0.12), inset 4px 0 0 0 var(--primary-color);
}

/* Outlet icon container */
.vop-outlet-icon-wrap {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    background: rgba(232, 93, 4, 0.1);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}

.vop-outlet-card.editing .vop-outlet-icon-wrap {
    background: var(--primary-color);
    color: #fff;
}

.vop-outlet-card-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
    flex: 1;
}

.vop-outlet-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-color);
    white-space: nowrap;
}

.vop-outlet-meta {
    font-size: 0.75rem;
    color: var(--secondary-text-color);
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.vop-outlet-meta-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.08rem 0.45rem;
    border-radius: 20px;
    background: rgba(232, 93, 4, 0.1);
    color: var(--primary-color);
}

.vop-outlet-card.editing .vop-outlet-meta-badge {
    background: rgba(232, 93, 4, 0.18);
}

.vop-outlet-card-actions {
    display: flex;
    gap: 0.35rem;
    flex-shrink: 0;
    margin-left: auto;
}

/* Icon-only action buttons in outlet cards */
.vop-icon-btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1.5px solid var(--border-color);
    background: var(--surface-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--secondary-text-color);
    transition: border-color 0.15s, color 0.15s, background 0.15s;
    font-family: inherit;
    flex-shrink: 0;
}

.vop-icon-btn:hover:not(:disabled) {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(232, 93, 4, 0.06);
}

.vop-icon-btn-delete:hover:not(:disabled) {
    border-color: #dc2626;
    color: #dc2626;
    background: rgba(220, 38, 38, 0.06);
}

.vop-confirm-delete {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.vop-confirm-delete-label {
    font-size: 0.8rem;
    color: #dc2626;
    font-weight: 600;
    white-space: nowrap;
}
.vop-confirm-yes {
    padding: 0.25rem 0.6rem;
    font-size: 0.78rem;
    font-weight: 600;
    border: 1.5px solid #dc2626;
    border-radius: 6px;
    background: #dc2626;
    color: #fff;
    cursor: pointer;
}
.vop-confirm-yes:hover:not(:disabled) { background: #b91c1c; }
.vop-confirm-no {
    padding: 0.25rem 0.6rem;
    font-size: 0.78rem;
    font-weight: 600;
    border: 1.5px solid #d1d5db;
    border-radius: 6px;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
}
.vop-confirm-no:hover:not(:disabled) { border-color: #9ca3af; color: #374151; }

.vop-icon-btn:disabled {
    opacity: 0.38;
    cursor: not-allowed;
}

.vop-icon-btn-editing {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(232, 93, 4, 0.08);
}

/* Workspace context banner */
.vop-workspace-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.65rem 1.1rem;
    background: linear-gradient(to right, var(--surface-color), var(--background-color));
    border: 1.5px solid var(--border-color);
    border-bottom: none;
    border-radius: 12px 12px 0 0;
    gap: 1rem;
}

.vop-workspace-title {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.9rem;
    color: var(--text-color);
}

.vop-ws-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}

.vop-ws-dot-edit { background: var(--primary-color); }
.vop-ws-dot-new  { background: #22c55e; }

.vop-ws-count {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--primary-color);
    background: rgba(232, 93, 4, 0.1);
    padding: 0.25rem 0.65rem;
    border-radius: 20px;
    white-space: nowrap;
}

/* 3-column workspace */
.vop-workspace {
    display: grid;
    grid-template-columns: 270px 210px 1fr;
    gap: 0;
    border: 1.5px solid var(--border-color);
    border-radius: 0 0 12px 12px;
    overflow: hidden;
    min-height: 500px;
}

.vop-col {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.vop-col + .vop-col {
    border-left: 1.5px solid var(--border-color);
}

.vop-col-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 1rem;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--secondary-text-color);
    background: var(--surface-color);
    border-bottom: 1.5px solid var(--border-color);
    flex-shrink: 0;
}

.vop-col-heading-inner {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* Column 1 — Details */
.vop-col-details {
    padding: 1rem 1.1rem;
    gap: 0;
    background: var(--background-color);
    overflow-y: auto;
}

.vop-col-details .form-group {
    margin-bottom: 0.9rem;
}

.vop-col-details .form-group label {
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.vop-col-details .form-input {
    font-size: 0.88rem;
    padding: 0.55rem 0.7rem;
}

.vop-selection-summary {
    font-size: 0.85rem;
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.vop-col-actions {
    display: flex;
    gap: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.vop-col-actions .custom-sort-btn {
    flex: 1;
}

/* Column 2 — Categories */
.vop-col-categories {
    background: var(--background-color);
}

.vop-category-list {
    overflow-y: auto;
    flex: 1;
    padding: 0.4rem 0;
}

.vop-category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0.55rem 1rem;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.855rem;
    color: var(--text-color);
    transition: background 0.12s, box-shadow 0.12s;
    gap: 0.45rem;
}

.vop-category-item:hover {
    background: rgba(232, 93, 4, 0.06);
}

.vop-category-item.active {
    background: rgba(232, 93, 4, 0.09);
    color: var(--primary-color);
    font-weight: 600;
    box-shadow: inset 3px 0 0 0 var(--primary-color);
}

/* Category row icon */
.vop-cat-icon {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    opacity: 0.55;
    color: var(--secondary-text-color);
    transition: opacity 0.12s, color 0.12s;
}

.vop-category-item.active .vop-cat-icon {
    opacity: 1;
    color: var(--primary-color);
}

.vop-cat-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vop-cat-badge {
    font-size: 0.75rem;
    padding: 0.12rem 0.4rem;
    border-radius: 20px;
    background: var(--border-color);
    color: var(--secondary-text-color);
    font-weight: 600;
    flex-shrink: 0;
    white-space: nowrap;
}

.vop-cat-badge.has-selection {
    background: var(--primary-color);
    color: white;
}

/* Column 3 — Items */
.vop-col-items {
    background: #fff;
    padding: 0.75rem 0.9rem;
    gap: 0;
}

.vop-items-list {
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: 0.5rem;
}

.vop-item-row {
    border: 1.5px solid var(--border-color);
    border-radius: 9px;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.vop-item-row:hover {
    border-color: rgba(232, 93, 4, 0.5);
    background: rgba(232, 93, 4, 0.03);
}

.vop-item-row.selected {
    border-color: var(--primary-color);
    background: rgba(232, 93, 4, 0.05);
    box-shadow: 0 1px 5px rgba(232, 93, 4, 0.1);
}

.vop-item-row-main {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.vop-item-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    gap: 0.1rem;
}

.vop-item-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-color);
}

.vop-item-cat {
    font-size: 0.72rem;
    color: var(--secondary-text-color);
}

.vop-item-branch-badge {
    font-size: 0.7rem;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    background: rgba(99, 102, 241, 0.1);
    color: #4f46e5;
    font-weight: 600;
}

.vop-item-price {
    font-size: 0.82rem;
    color: var(--secondary-text-color);
    font-weight: 600;
    flex-shrink: 0;
    padding: 0.18rem 0.4rem;
    background: rgba(232, 93, 4, 0.08);
    border-radius: 4px;
}

.vop-item-pricing {
    margin-top: 0.55rem;
    padding-top: 0.55rem;
    border-top: 1px dashed var(--border-color);
}

/* Empty state */
.vop-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    padding: 3rem 1rem;
    color: var(--secondary-text-color);
    text-align: center;
}

.vop-empty-state svg {
    opacity: 0.3;
}

.vop-empty-state-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
}

.vop-empty-state-sub {
    font-size: 0.84rem;
    margin: 0;
}

/* New outlet button with icon */
.vop-new-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

/* Danger btn variant */
.custom-sort-btn.danger {
    background-color: transparent;
    color: #d32f2f;
    border: 1.5px solid #d32f2f;
}

.custom-sort-btn.danger:hover:not(:disabled) {
    background-color: #d32f2f;
    color: white;
}

@media (max-width: 900px) {
    .vop-workspace-header {
        border-radius: 12px 12px 0 0;
    }
    .vop-workspace {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto 1fr;
        border-radius: 0 0 12px 12px;
    }
    .vop-col + .vop-col {
        border-left: none;
        border-top: 1.5px solid var(--border-color);
    }
    .vop-col-categories { max-height: 200px; }
}

.variation-empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--secondary-text-color);
}

.variation-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

.variation-item-card {
    background-color: var(--background-color);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    transition: all 0.2s ease;
}

.variation-item-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.variation-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.variation-number {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 0.9rem;
}

.variation-remove-btn {
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.variation-remove-btn:hover {
    background-color: #c82333;
    transform: scale(1.1);
}

.variation-fields-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.variation-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.variation-field label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-color);
}

.variation-field input,
.variation-field select {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s ease;
}

.variation-field input:focus,
.variation-field select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(232, 93, 4, 0.1);
}

.add-variation-btn {
    width: 100%;
    padding: 1rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    margin-top: 1rem;
}

.add-variation-btn:hover {
    background-color: var(--primary-hover-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.variation-modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.add-item-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: background-color 0.2s;
}

.add-item-btn:hover {
    background-color: var(--primary-hover-color);
}

.menu-form-card {
    background-color: var(--surface-color);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.menu-tabs {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.menu-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.4rem;
    border-radius: 999px;
    border: 1px solid rgba(232, 93, 4, 0.2);
    background: transparent;
    color: var(--primary-color);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
}

.menu-tab-btn .menu-tab-icon {
    font-size: 1.1rem;
}

.menu-tab-btn:hover {
    background: rgba(232, 93, 4, 0.1);
    border-color: rgba(232, 93, 4, 0.35);
    box-shadow: 0 12px 22px rgba(232, 93, 4, 0.16);
}

.menu-tab-btn.active {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover-color));
    color: white;
    border-color: transparent;
    box-shadow: 0 18px 30px rgba(232, 93, 4, 0.26);
}

.menu-form-card.is-editing {
    border-color: rgba(232, 93, 4, 0.35);
    box-shadow: 0 20px 45px rgba(232, 93, 4, 0.18);
}

.form-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.form-card-header h3 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--primary-color);
}

.form-card-subtitle {
    margin: 0.35rem 0 0;
    font-size: 0.95rem;
    color: var(--secondary-text-color);
    max-width: 600px;
}

.status-badge.editing {
    background: linear-gradient(135deg, rgba(232, 93, 4, 0.18), rgba(244, 140, 6, 0.12));
    color: var(--primary-color);
    border-radius: 999px;
    padding: 0.4rem 0.9rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border: 1px solid rgba(232, 93, 4, 0.22);
}

.menu-edit-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.8fr) minmax(280px, 1fr);
    gap: 2rem;
    align-items: flex-start;
}

.menu-form-fields {
    display: flex;
    flex-direction: column;
}

.form-section {
    padding: 1.75rem;
    border-radius: 16px;
    border: 1px solid rgba(232, 93, 4, 0.12);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 249, 250, 0.82));
    box-shadow: 0 12px 30px rgba(17, 24, 39, 0.06);
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-section-header h4 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--text-color);
    font-weight: 700;
}

.form-section-header p {
    margin: 0.35rem 0 0;
    color: var(--secondary-text-color);
    font-size: 0.9rem;
}

.form-section-header {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.full-width-row {
    grid-template-columns: 1fr;
}

.menu-edit-preview {
    position: sticky;
    top: 110px;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding: 1.75rem;
    border-radius: 18px;
    border: 1px solid rgba(232, 93, 4, 0.18);
    background: linear-gradient(165deg, rgba(255, 255, 255, 0.95), rgba(248, 249, 250, 0.75));
    box-shadow: 0 16px 35px rgba(17, 24, 39, 0.08);
}

.preview-image-wrapper {
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid rgba(232, 93, 4, 0.18);
    box-shadow: 0 18px 30px rgba(232, 93, 4, 0.16);
}

.preview-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-details {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.preview-title {
    margin: 0;
    font-size: 1.3rem;
    color: var(--text-color);
    font-weight: 700;
}

.preview-category {
    margin: 0;
    font-size: 0.95rem;
    color: var(--secondary-text-color);
}

.preview-price-block {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    background: rgba(232, 93, 4, 0.08);
    border: 1px solid rgba(232, 93, 4, 0.16);
}

.preview-price-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--secondary-text-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.preview-price-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
}

.preview-variations {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.preview-variations-label {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--secondary-text-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.preview-variations ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.preview-variations li {
    display: flex;
    justify-content: space-between;
    padding: 0.6rem 0.75rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(232, 93, 4, 0.12);
    font-size: 0.9rem;
    color: var(--text-color);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.image-input-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
}

.image-input-wrapper input[type="url"] {
    flex: 1 1 260px;
    min-width: 220px;
}

.image-preview {
    width: 110px;
    height: 110px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 20px rgba(17, 24, 39, 0.08);
    background: linear-gradient(135deg, rgba(232, 93, 4, 0.1), rgba(244, 140, 6, 0.05));
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.image-preview-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.clear-image-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(0, 0, 0, 0.55);
    border: none;
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;
}

.clear-image-btn:hover {
    transform: scale(1.05);
    background: rgba(232, 93, 4, 0.75);
}

.input-hint {
    margin-top: 0.65rem;
    font-size: 0.85rem;
    color: var(--secondary-text-color);
}

.category-chip-row {
    margin-top: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.category-chip {
    border: 1px solid rgba(232, 93, 4, 0.25);
    background: rgba(232, 93, 4, 0.08);
    color: var(--primary-color);
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.category-chip.active,
.category-chip:hover {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover-color));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 10px 18px rgba(232, 93, 4, 0.24);
}

@media (max-width: 1024px) {
    .menu-edit-grid {
        grid-template-columns: 1fr;
    }

    .menu-edit-preview {
        position: static;
        order: -1;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-color);
}

.form-group input,
.form-group select {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(232, 93, 4, 0.1);
}

.create-category-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.create-category-input {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.create-category-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(232, 93, 4, 0.1);
}

.create-category-input:disabled {
    background-color: #f8f9fa;
    cursor: not-allowed;
}

.create-category-actions {
    display: flex;
    gap: 0.5rem;
}

.save-category-btn,
.cancel-category-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s;
}

.save-category-btn {
    background-color: var(--primary-color);
    color: white;
}

.save-category-btn:hover:not(:disabled) {
    background-color: var(--primary-hover-color);
}

.save-category-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.cancel-category-btn {
    background-color: var(--secondary-text-color);
    color: white;
}

.cancel-category-btn:hover:not(:disabled) {
    background-color: #5a6268;
}

.cancel-category-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* Custom Category Dropdown */
.custom-category-dropdown {
    position: relative;
}

.category-dropdown-trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    background-color: white;
    cursor: pointer;
    transition: border-color 0.2s;
}

.category-dropdown-trigger:hover {
    border-color: var(--primary-color);
}

.category-dropdown-trigger .placeholder-text {
    color: var(--secondary-text-color);
}

.dropdown-arrow {
    font-size: 0.75rem;
    color: var(--secondary-text-color);
    transition: transform 0.2s;
}

.category-dropdown-trigger.open .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 998;
}

.category-dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 999;
    max-height: 300px;
    overflow-y: auto;
    margin-top: 4px;
}

.dropdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
    border-bottom: 1px solid var(--border-color);
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background-color: #f8f9fa;
}

.dropdown-item.selected {
    background-color: rgba(232, 93, 4, 0.1);
    font-weight: 600;
}

.dropdown-item.empty {
    color: var(--secondary-text-color);
    cursor: default;
    justify-content: center;
}

.dropdown-item.empty:hover {
    background-color: transparent;
}

.dropdown-item.add-new {
    color: var(--primary-color);
    font-weight: 600;
    border-top: 2px solid var(--border-color);
}

.dropdown-item.add-new:hover {
    background-color: rgba(232, 93, 4, 0.1);
}

.category-name {
    flex: 1;
}

.category-delete-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.5rem;
    border: none;
    background-color: transparent;
    color: #dc3545;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    margin-left: 0.5rem;
}

.category-delete-btn:hover {
    background-color: #f8d7da;
    color: #721c24;
}

.category-delete-btn:active {
    transform: scale(0.95);
}

.category-delete-btn svg {
    width: 16px;
    height: 16px;
}

.form-actions {
    display: flex;
    gap: 1rem;
}

.save-btn,
.cancel-btn {
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.2s;
}

.save-btn {
    background-color: #28a745;
    color: white;
}

.save-btn:hover {
    background-color: #218838;
}

.cancel-btn {
    background-color: var(--secondary-text-color);
    color: white;
}

.cancel-btn:hover {
    background-color: #5a6268;
}

.menu-items-list {
    background-color: var(--surface-color);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.menu-items-list h3 {
    margin: 0 0 1.5rem 0;
    font-size: 1.5rem;
    color: var(--text-color);
}

.menu-items-search {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.menu-items-search input {
    flex: 1;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.menu-items-search input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(232, 93, 4, 0.15);
    outline: none;
}

.menu-items-search .clear-search-btn {
    border: none;
    background: rgba(232, 93, 4, 0.12);
    color: var(--primary-color);
    padding: 0.55rem 0.95rem;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.menu-items-search .clear-search-btn:hover {
    background: rgba(232, 93, 4, 0.2);
}

.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 2rem;
    padding: 0.5rem 0.25rem 0 0.25rem;
}

/* ── Menu Item Card ────────────────────────────────────────────────────────── */
.menu-item-card {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    background-color: var(--background-color);
    transition: transform 0.18s, box-shadow 0.18s;
    display: flex;
    flex-direction: column;
}

.menu-item-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.09);
}

.menu-item-card.card-hidden {
    opacity: 0.72;
}

.item-image {
    width: 100%;
    height: 140px;
    object-fit: cover;
    background-color: var(--border-color);
}

.item-details {
    padding: 0.75rem 0.875rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.item-details h4 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-color);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-category {
    margin: 0;
    font-size: 0.78rem;
    color: var(--secondary-text-color);
}

.item-price-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.35rem;
}

.item-price {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* Compact toggle */
.item-visibility-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

.item-visibility-switch input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.item-visibility-track {
    width: 40px;
    height: 22px;
    background: #cbd5e1;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    padding: 0 3px;
    transition: background 0.22s ease;
}

.item-visibility-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.22);
    transition: transform 0.22s ease;
}

.item-visibility-switch.checked .item-visibility-track {
    background: linear-gradient(120deg, var(--primary-color), var(--primary-hover-color));
}

.item-visibility-switch.checked .item-visibility-thumb {
    transform: translateX(18px);
}

.item-visibility-switch.disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* Card action buttons */
.item-actions {
    display: flex;
    gap: 0.375rem;
    padding: 0.6rem 0.75rem;
    border-top: 1px solid var(--border-color);
    background: var(--surface-color, #fafafa);
}

.item-view-btn,
.item-edit-btn,
.item-comp-btn,
.item-del-btn {
    padding: 0.4rem 0.65rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: background 0.15s, opacity 0.15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    border: 1px solid transparent;
    white-space: nowrap;
}

.item-edit-btn {
    flex: 1;
    background: #2563eb;
    color: #fff;
}

.item-edit-btn:hover {
    background: #1d4ed8;
}

.item-comp-btn {
    flex: 1;
    background: #f0fdf4;
    color: #15803d;
    border-color: #bbf7d0;
}

.item-comp-btn:hover {
    background: #dcfce7;
}

.item-view-btn {
    flex: 1;
    background: #f5f3ff;
    color: #6d28d9;
    border-color: #ddd6fe;
}

.item-view-btn:hover {
    background: #ede9fe;
}

.item-del-btn {
    flex: 0 0 auto;
    background: #fff1f2;
    color: #dc2626;
    border-color: #fecaca;
    padding: 0.4rem 0.55rem;
}

.item-del-btn:hover {
    background: #fee2e2;
}

.orders-filters {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.filter-btn {
    border: 1px solid var(--border-color);
    background-color: var(--surface-color);
    color: var(--text-color);
    padding: 0.5rem 1rem;
    border-radius: 999px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn.active,
.filter-btn:hover {
    border-color: var(--primary-color);
    color: #fff;
    background-color: var(--primary-color);
}

.custom-date-range {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.custom-date-range label {
    display: flex;
    flex-direction: column;
    font-weight: 600;
    color: var(--secondary-text-color);
    font-size: 0.9rem;
}

.custom-date-range input {
    margin-top: 0.25rem;
    padding: 0.45rem 0.65rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    font-size: 0.95rem;
}

.orders-error {
    padding: 0.75rem 1rem;
    background: #fff5f5;
    border: 1px solid #f5c2c7;
    border-radius: 8px;
    color: #842029;
    margin-bottom: 1rem;
}

.orders-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.order-stat-card {
    background-color: var(--surface-color);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    text-align: center;
}

.order-stat-card h3 {
    margin: 0 0 1rem 0;
    font-size: 1.2rem;
    color: var(--secondary-text-color);
    font-weight: 500;
}

.stat-number {
    margin: 0;
    font-size: 3rem;
    font-weight: 700;
}

.order-stat-card.pending .stat-number {
    color: var(--status-pending);
}

.order-stat-card.delivered .stat-number {
    color: var(--status-ready);
}

.order-stat-card.total .stat-number {
    color: var(--primary-color);
}

.recent-orders,
.orders-placeholder,
.inventory-features,
.report-cards {
    background-color: var(--surface-color);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.reports-empty-state {
    grid-column: 1 / -1;
    padding: 1rem;
    color: var(--secondary-text-color);
}

.recent-orders h3 {
    margin: 0 0 1.5rem 0;
    font-size: 1.5rem;
    color: var(--text-color);
}

.orders-placeholder {
    text-align: center;
    color: var(--secondary-text-color);
    font-size: 1.2rem;
}

.placeholder-note {
    font-size: 1rem;
    margin-top: 0.5rem;
}

.inventory-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.feature-card {
    position: relative;
    text-align: center;
    padding: 2rem;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.9), rgba(248, 249, 250, 0.7));
    border-radius: 18px;
    border: 1px solid rgba(232, 93, 4, 0.15);
    box-shadow: 0 20px 35px rgba(17, 24, 39, 0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    overflow: hidden;
    transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.feature-card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(232, 93, 4, 0.08) 0%, rgba(255, 255, 255, 0) 60%);
    opacity: 0;
    transition: opacity 0.35s ease;
}

.feature-card:hover {
    transform: translateY(-10px) scale(1.01);
    box-shadow: 0 28px 45px rgba(232, 93, 4, 0.18);
}

.feature-card:hover::after {
    opacity: 1;
}

.feature-icon {
    position: relative;
    width: 72px;
    height: 72px;
    border-radius: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--primary-color);
    background: linear-gradient(135deg, rgba(232, 93, 4, 0.18), rgba(244, 140, 6, 0.08));
    border: 1px solid rgba(232, 93, 4, 0.25);
    box-shadow: inset 0 2px 6px rgba(255, 255, 255, 0.6), 0 10px 18px rgba(232, 93, 4, 0.24);
    animation: iconPulse 2.6s ease-in-out infinite;
    z-index: 1;
}

@keyframes iconPulse {

    0%,
    100% {
        transform: scale(1);
        box-shadow: inset 0 2px 6px rgba(255, 255, 255, 0.6), 0 10px 18px rgba(232, 93, 4, 0.24);
    }

    50% {
        transform: scale(1.08);
        box-shadow: inset 0 2px 10px rgba(255, 255, 255, 0.8), 0 14px 24px rgba(232, 93, 4, 0.32);
    }
}

.feature-card h3 {
    margin: 0;
    font-size: 1.35rem;
    color: var(--text-color);
    font-weight: 700;
}

.feature-card p {
    margin: 0;
    color: var(--secondary-text-color);
}

.placeholder-box {
    width: 100%;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 14px;
    color: rgba(52, 58, 64, 0.75);
    border: 1px dashed rgba(232, 93, 4, 0.35);
    font-weight: 600;
}

.report-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 400px));
    gap: 1.75rem;
    justify-content: start;
    width: 100%;
    min-width: 0;
}

.report-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1.125rem;
    padding: 2rem 1.75rem;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.95), rgba(248, 249, 250, 0.75));
    border-radius: 20px;
    border: 1px solid rgba(232, 93, 4, 0.12);
    box-shadow: 0 18px 40px rgba(17, 24, 39, 0.08);
    transition: transform 0.35s ease, box-shadow 0.35s ease;
    overflow: hidden;
    min-width: 0;
}

.report-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top right, rgba(232, 93, 4, 0.12), transparent 55%);
    opacity: 0;
    transition: opacity 0.35s ease;
}

.report-card:hover {
    transform: translateY(-12px);
    box-shadow: 0 30px 48px rgba(232, 93, 4, 0.2);
}

.report-card:hover::before {
    opacity: 1;
}

.report-icon {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(232, 93, 4, 0.22), rgba(244, 140, 6, 0.1));
    color: var(--primary-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2.1rem;
    border: 1px solid rgba(232, 93, 4, 0.25);
    box-shadow: 0 12px 20px rgba(232, 93, 4, 0.22);
    z-index: 1;
}

.report-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 1;
}

.report-card-body h3 {
    margin: 0;
    font-size: 1.4rem;
    color: var(--text-color);
    font-weight: 700;
}

.report-card-body p {
    margin: 0;
    color: var(--secondary-text-color);
}

.generate-btn {
    align-self: flex-start;
    padding: 0.65rem 1.5rem;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover-color));
    border: none;
    color: #fff;
    font-weight: 600;
    letter-spacing: 0.01em;
    box-shadow: 0 12px 22px rgba(232, 93, 4, 0.26);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    z-index: 1;
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 30px rgba(232, 93, 4, 0.32);
}

/* EOD Report Preview Modal */
.eod-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    animation: fadeIn 0.25s ease;
}

.eod-modal {
    background: #fff;
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.25);
    animation: zoomIn 0.3s ease;
    overflow: hidden;
}

.eod-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.eod-modal-header h2 {
    margin: 0;
    font-size: 1.15rem;
    color: #1e293b;
    font-weight: 700;
}

.eod-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #94a3b8;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s;
}

.eod-modal-close:hover {
    background: #f1f5f9;
    color: #475569;
}

.eod-modal-actions {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #f1f5f9;
    background: #fafbfc;
}

.eod-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.1rem;
    border: none;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
    justify-content: center;
}

.eod-action-view {
    background: #eff6ff;
    color: #2563eb;
}

.eod-action-view:hover {
    background: #dbeafe;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.15);
}

.eod-action-pdf {
    background: #fef2f2;
    color: #dc2626;
}

.eod-action-pdf:hover {
    background: #fee2e2;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.15);
}

.eod-action-print {
    background: #f0fdf4;
    color: #16a34a;
}

.eod-action-print:hover {
    background: #dcfce7;
    box-shadow: 0 2px 8px rgba(22, 163, 74, 0.15);
}

.eod-modal-preview {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background: #f8fafc;
}

.eod-preview-content {
    background: #fff;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 11pt;
    color: #000;
}

.eod-preview-content h1 {
    font-size: 18pt;
    text-align: center;
    margin: 0 0 12px;
}

.eod-preview-content p {
    margin: 4px 0;
}

.eod-preview-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
}

.eod-preview-content th,
.eod-preview-content td {
    padding: 6px 8px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.eod-preview-content th {
    background: #f8fafc;
    font-weight: 600;
}

.eod-preview-content hr {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 12px 0;
}

.eod-preview-content .right {
    text-align: right;
}

.eod-preview-content .footer {
    text-align: center;
    font-style: italic;
    margin-top: 16px;
    color: #64748b;
}

@media (max-width: 640px) {
    .eod-modal {
        width: 100%;
        max-height: 100dvh;
        border-radius: 0;
    }

    .eod-modal-actions {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem;
        padding: 0.75rem;
    }

    .eod-action-btn {
        flex: 1 1 calc(50% - 0.5rem);
        min-height: 44px;
    }

    .eod-modal-preview { padding: 0.75rem; overflow-x: hidden; }
    .eod-preview-content { width: 100%; max-width: 100%; box-sizing: border-box; }
    .eod-preview-content table { table-layout: fixed; }
    .eod-preview-content :is(th, td) { overflow-wrap: anywhere; }
}

/* Settings Section */
.settings-description {
    margin-bottom: 2rem;
    color: var(--secondary-text-color);
    font-size: 1.1rem;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
}

.settings-category-card {
    background-color: var(--surface-color);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: all 0.2s ease;
}

.settings-category-card:hover {
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
}

.settings-category-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.settings-category-icon {
    font-size: 2rem;
    color: var(--primary-color);
    flex-shrink: 0;
}

.settings-category-info h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.3rem;
    color: var(--text-color);
}

.settings-category-info p {
    margin: 0;
    color: var(--secondary-text-color);
    font-size: 0.95rem;
    line-height: 1.5;
}

.settings-category-items {
    flex: 1;
    margin-bottom: 1.5rem;
}

.settings-category-items ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.settings-category-items li {
    padding: 0.5rem 0;
    color: var(--text-color);
    font-size: 0.95rem;
    border-bottom: 1px solid var(--border-color);
}

.settings-category-items li:last-child {
    border-bottom: none;
}

.settings-category-items li::before {
    content: '•';
    color: var(--primary-color);
    font-weight: bold;
    display: inline-block;
    width: 1em;
    margin-right: 0.5rem;
}

.settings-category-footer {
    margin-top: auto;
}

.settings-edit-btn {
    width: 100%;
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: background-color 0.2s;
}

.settings-edit-btn:hover {
    background-color: var(--primary-hover-color);
}

/* Settings Section */
.settings-main-header {
    margin-bottom: 2rem;
}

.settings-main-header h2 {
    margin-bottom: 0.5rem;
}

.settings-main-description {
    color: var(--secondary-text-color);
    font-size: 1.1rem;
}

/* Currency Management Section */
.currency-management-section {
    background-color: var(--surface-color);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.currency-section-content {
    min-height: 100px;
}

.currency-selector-wrapper {
    position: relative;
    max-width: 500px;
}

.currency-selector-wrapper label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.95rem;
}

.currency-dropdown-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background-color: var(--surface-color);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.currency-dropdown-trigger:hover {
    border-color: var(--primary-color);
    background-color: rgba(232, 93, 4, 0.05);
}

.currency-display {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.currency-symbol-display {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    min-width: 40px;
    text-align: center;
}

.currency-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.currency-name-display {
    font-weight: 600;
    color: var(--text-color);
    font-size: 1rem;
}

.currency-country-display {
    font-size: 0.85rem;
    color: var(--secondary-text-color);
}

.currency-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0.5rem;
    background-color: var(--surface-color);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-height: 400px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.currency-search-wrapper {
    position: relative;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.currency-search-wrapper .search-icon {
    position: absolute;
    left: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--secondary-text-color);
    width: 1.2rem;
    height: 1.2rem;
}

.currency-search-input {
    width: 100%;
    padding: 0.75rem 0.75rem 0.75rem 2.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.95rem;
    background-color: var(--background-color);
    color: var(--text-color);
}

.currency-search-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.currency-dropdown-list {
    max-height: 300px;
    overflow-y: auto;
    padding: 0.5rem;
}

.currency-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.currency-item:hover {
    background-color: rgba(232, 93, 4, 0.1);
    border-color: var(--primary-color);
}

.currency-item.selected {
    background-color: rgba(232, 93, 4, 0.15);
    border-color: var(--primary-color);
}

.currency-item-symbol {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
    min-width: 35px;
    text-align: center;
}

.currency-item-details {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
}

.currency-item-name {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.95rem;
}

.currency-item-country {
    font-size: 0.85rem;
    color: var(--secondary-text-color);
}

.currency-item-code {
    font-size: 0.85rem;
    color: var(--secondary-text-color);
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    background-color: var(--background-color);
    border-radius: 4px;
}

/* Variations Tab Wrapper + Sub-tabs */
.variations-tab-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.variations-sub-tabs {
    display: flex;
    gap: 4px;
    padding: 12px 0 0;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--border-color);
}

.variations-sub-tab-btn {
    padding: 8px 20px;
    border: none;
    background: transparent;
    border-radius: 6px 6px 0 0;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary, #6b7280);
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
    margin-bottom: -2px;
    border-bottom: 2px solid transparent;
}

.variations-sub-tab-btn:hover {
    color: var(--primary-color, #6366f1);
    background: rgba(99, 102, 241, 0.06);
}

.variations-sub-tab-btn.active {
    color: var(--primary-color, #6366f1);
    border-bottom: 2px solid var(--primary-color, #6366f1);
    font-weight: 600;
}

/* Variation Management Section */
.variation-management-section {
    background-color: var(--surface-color);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.variation-section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 2rem;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

.variation-section-title h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.5rem;
    color: var(--primary-color);
}

.variation-section-description {
    margin: 0;
    color: var(--secondary-text-color);
    line-height: 1.6;
    max-width: 600px;
}

.variation-section-content {
    min-height: 200px;
}

.add-variation-btn-header {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: background-color 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    flex-shrink: 0;
    height: fit-content;
}

.add-variation-btn-header:hover {
    background-color: var(--primary-hover-color);
}

.variations-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.variation-card {
    background-color: var(--surface-color);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.variation-card:hover {
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
}

.variation-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.variation-info h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
    color: var(--text-color);
    font-weight: 600;
}

.variation-details {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.variation-measurement {
    font-size: 0.9rem;
    color: var(--secondary-text-color);
}

.variation-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
}

.variation-actions {
    display: flex;
    gap: 0.5rem;
}

.edit-variation-btn,
.delete-variation-btn {
    background-color: transparent;
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-color);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.edit-variation-btn:hover {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.delete-variation-btn:hover {
    background-color: #dc3545;
    color: white;
    border-color: #dc3545;
}

/* ── Variation Group — Assign Items Panel ─────────── */
.vgp-assign-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: transparent;
    color: var(--text-color);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.vgp-assign-btn:hover,
.vgp-assign-btn--open {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.vgp-assign-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    background: rgba(255,255,255,0.25);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
}

.vgp-assign-btn--open .vgp-assign-count {
    background: rgba(255,255,255,0.3);
}

.vgp-assign-panel {
    border-top: 1px solid var(--border-color);
    margin-top: 1rem;
    padding-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.vgp-assign-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.vgp-assign-panel-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-color);
}

.vgp-loading-dot {
    font-weight: 400;
    color: var(--secondary-text-color);
}

.vgp-assigned-count-label {
    font-size: 0.8rem;
    color: var(--secondary-text-color);
    background: var(--background-color, #f3f4f6);
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
}

.vgp-assign-search {
    position: relative;
    display: flex;
    align-items: center;
}

.vgp-search-icon {
    position: absolute;
    left: 10px;
    color: var(--secondary-text-color);
    font-size: 14px;
    pointer-events: none;
}

.vgp-assign-search input {
    width: 100%;
    padding: 7px 10px 7px 32px;
    border: 1px solid var(--border-color);
    border-radius: 7px;
    font-size: 0.85rem;
    background: var(--surface-color);
    color: var(--text-color);
    outline: none;
    transition: border-color 0.15s;
}

.vgp-assign-search input:focus {
    border-color: var(--primary-color);
}

.vgp-items-list {
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--surface-color);
}

.vgp-no-items {
    padding: 16px;
    text-align: center;
    color: var(--secondary-text-color);
    font-size: 0.85rem;
    margin: 0;
}

.vgp-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 9px 12px;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.1s;
}

.vgp-item-row:last-child {
    border-bottom: none;
}

.vgp-item-row:hover {
    background: var(--background-color, #f9fafb);
}

.vgp-item-row--assigned {
    background: rgba(232, 93, 4, 0.04);
}

.vgp-item-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.vgp-item-name {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vgp-item-cat {
    font-size: 0.75rem;
    color: var(--secondary-text-color);
    margin-top: 2px;
}

/* Toggle switch */
.vgp-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    flex-shrink: 0;
}

.vgp-toggle input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.vgp-toggle-track {
    display: inline-block;
    width: 36px;
    height: 20px;
    background: #d1d5db;
    border-radius: 999px;
    position: relative;
    transition: background 0.2s;
}

.vgp-toggle input:checked + .vgp-toggle-track {
    background: var(--primary-color);
}

.vgp-toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.vgp-toggle input:checked + .vgp-toggle-track .vgp-toggle-thumb {
    transform: translateX(16px);
}

.vgp-toggle--loading {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.vgp-assign-note {
    font-size: 0.78rem;
    color: var(--secondary-text-color);
    margin: 0;
    font-style: italic;
}

/* Variation Dropdown in Menu Management */
.variation-dropdown-container {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.variation-dropdown-container label {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.95rem;
}

.variation-dropdown {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    background-color: var(--surface-color);
    color: var(--text-color);
    cursor: pointer;
    transition: border-color 0.2s;
}

.variation-dropdown:focus {
    outline: none;
    border-color: var(--primary-color);
}

.variation-dropdown-hint {
    font-size: 0.9rem;
    color: var(--secondary-text-color);
    margin: 0.5rem 0 0 0;
    font-style: italic;
}

/* Variation Prices Section */
.variation-prices-section {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background-color: var(--background-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.variation-prices-section h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
    color: var(--text-color);
}

.variation-prices-hint {
    margin: 0 0 1rem 0;
    font-size: 0.9rem;
    color: var(--secondary-text-color);
    font-style: italic;
}

.variation-prices-list {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.variation-price-input-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    background-color: var(--surface-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.variation-size-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
}

.variation-size-name {
    font-weight: 600;
    color: var(--text-color);
    font-size: 1rem;
}

.variation-size-type {
    font-size: 0.85rem;
    color: var(--secondary-text-color);
}

.variation-size-optional {
    font-size: 0.75rem;
    color: #9ca3af;
    font-style: italic;
    font-weight: 400;
    letter-spacing: 0.01em;
}

.variation-price-input-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 150px;
}

.variation-price-input-container label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-color);
}

.variation-price-input {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    width: 100%;
}

.variation-price-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.remove-variation-btn {
    background-color: transparent;
    border: none;
    color: var(--secondary-text-color);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-variation-btn:hover {
    background-color: #dc3545;
    color: white;
}

.variation-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.variation-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.variation-form label {
    font-weight: 600;
    color: var(--text-color);
}

.variation-form input,
.variation-form select {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
}

.variation-form input:focus,
.variation-form select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Variation Group Sizes Input */
.sizes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.add-size-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background-color 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.add-size-btn:hover {
    background-color: var(--primary-hover-color);
}

.sizes-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 300px;
    overflow-y: auto;
    padding: 0.5rem;
    background-color: var(--background-color);
    border-radius: 6px;
}

.size-input-row {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.size-name-input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
}

.size-option-select {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    min-width: 120px;
}

.remove-size-btn {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--secondary-text-color);
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-size-btn:hover {
    background-color: #dc3545;
    color: white;
    border-color: #dc3545;
}

.variation-sizes-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.size-badge {
    background-color: var(--background-color);
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.variation-sizes-count {
    font-size: 0.9rem;
    color: var(--secondary-text-color);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .admin-sidebar {
        position: static;
        width: 100%;
        margin-top: 0;
    }

    .admin-content {
        margin-left: 0;
        margin-top: 0;
        width: 100%;
    }

    .admin-container {
        flex-direction: column;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }

    .dashboard-charts {
        grid-template-columns: 1fr;
    }

    .items-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

@media (max-width: 768px) {
    .admin-header {
        padding: 1rem;
    }

    .admin-header h1 {
        font-size: 1.3rem;
    }

    .admin-content {
        padding: 1rem;
    }

    .settings-options {
        grid-template-columns: 1fr;
    }

    .settings-option-card {
        padding: 1.25rem;
    }

    .settings-detail {
        margin-top: 1rem;
    }

    .settings-detail-card {
        padding: 1.5rem;
    }

    .settings-detail {
        margin-top: 1rem;
    }

    .settings-detail-card {
        padding: 1.5rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .items-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1200px) {
    .app-container {
        grid-template-columns: 1fr 1fr;
    }

    .app-container.ai-disabled {
        grid-template-columns: 1fr 1fr;
    }

    .ai-column {
        grid-column: 1 / 3;
    }
}

@media (max-width: 768px) {
    .app-header h1 {
        font-size: 1.2rem;
    }

    /* Two rows: logo · branch/outlet · account, then full-width screen tabs. */
    .app-header {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto;
        grid-template-areas:
            "logo context account"
            "nav  nav     nav";
        align-items: center;
        gap: 0.65rem 0.75rem;
        padding: 0.65rem 1rem 0.75rem;
    }

    .header-logo {
        grid-area: logo;
        width: clamp(180px, 29vw, 240px);
        height: auto;
        max-height: 40px;
    }

    .nav-buttons {
        grid-area: nav;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        width: 100%;
        margin: 0;
    }

    .header-nav-btn {
        gap: 0.4rem;
        padding: 0.55rem 0.5rem;
        font-size: 0.92rem;
    }

    .header-right {
        grid-area: context;
        justify-content: flex-end;
        min-width: 0;
        gap: 0.5rem;
    }

    .header-account {
        grid-area: account;
        margin-left: 0;
    }

    /* Compact pickers (truncation itself is set globally). */
    .header-right .branch-selector-button,
    .header-right .outlet-selector-button {
        gap: 0.4rem;
        padding: 0.45rem 0.65rem;
        font-size: 0.875rem;
    }

    .header-right .branch-dropdown {
        left: auto;
        right: 0;
        min-width: min(280px, calc(100vw - 2rem));
    }

    .header-right .outlet-dropdown {
        min-width: min(220px, calc(100vw - 2rem));
    }
}

/* Narrow phones: show just the ChefPOS mark (left edge of the logo) when the
   branch name needs the room — always below 375px, and up to 440px (covers
   430px Pro Max phones) when an outlet picker shares the row. The mark is the first 24px of the 162×38
   image: 30px × 24/38 ≈ 19px. */
@media (max-width: 374px) {
    .header-logo {
        width: min(190px, 52vw);
        height: auto;
        object-fit: contain;
        object-position: center;
    }
}

@media (max-width: 440px) {
    .app-header:has(.outlet-selector) .header-logo {
        width: min(190px, 52vw);
        height: auto;
        object-fit: contain;
        object-position: center;
    }

    .variation-btn {
        min-width: 80px;
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    .variation-size {
        font-size: 1rem;
    }

    .variation-price {
        font-size: 0.9rem;
    }

    .app-container {
        display: block;
        padding: 0;
        padding-bottom: 60px;
        /* Space for mobile nav */
        height: 100%;
    }

    .column {
        display: none;
        border-radius: 0;
        box-shadow: none;
        height: 100%;
    }

    .column.active,
    .app-container.screen-mode .column {
        display: flex;
    }

    .column-header {
        font-size: 1.25rem;
    }

    .mobile-nav {
        display: flex;
    }

    .app-container.screen-mode {
        padding-bottom: 0;
    }

    .ai-column {
        grid-column: auto;
    }
}

/* Category Management Section */
.category-management-section {
    background-color: var(--surface-color);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.category-section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.category-section-title {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.category-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background-color: rgba(232, 93, 4, 0.12);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    font-size: 1.5rem;
    flex-shrink: 0;
}

.category-section-title h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.5rem;
    color: var(--primary-color);
}

.category-section-description {
    margin: 0;
    color: var(--secondary-text-color);
    max-width: 520px;
    line-height: 1.6;
}

.category-section-content {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1.5rem;
}

.category-form {
    background-color: var(--background-color);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px dashed var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.category-form-fields {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.category-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.category-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(232, 93, 4, 0.1);
}

.add-category-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 999px;
    border: none;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover-color));
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.add-category-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.add-category-btn:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(232, 93, 4, 0.3);
}

.category-hint {
    margin: 0;
    font-size: 0.9rem;
    color: var(--secondary-text-color);
}

.category-list-card {
    background-color: var(--background-color);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.category-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.category-list-header h4 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--text-color);
}

.category-search input {
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    font-size: 0.95rem;
    min-width: 180px;
}

.category-search input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(232, 93, 4, 0.1);
}

.category-empty-state {
    padding: 1rem;
    border-radius: 8px;
    background-color: rgba(232, 93, 4, 0.08);
    color: var(--secondary-text-color);
    text-align: center;
    font-weight: 600;
}

.category-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.category-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    background-color: #fff;
    border: 1px solid var(--border-color);
}

.category-name-text {
    font-weight: 600;
    color: var(--text-color);
}

.category-delete-button {
    border: none;
    background-color: transparent;
    color: #dc3545;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    transition: background-color 0.2s ease, color 0.2s ease;
    cursor: pointer;
}

.category-delete-button:hover {
    background-color: rgba(220, 53, 69, 0.12);
    color: #a71d2a;
}

/* Restaurant Print Settings Panel */
.restaurant-print-settings-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.restaurant-print-fields {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.restaurant-print-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.restaurant-print-field label {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.95rem;
}

.restaurant-print-field input,
.restaurant-print-field textarea {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.restaurant-print-field input:focus,
.restaurant-print-field textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(232, 93, 4, 0.1);
}

.restaurant-print-field textarea {
    resize: vertical;
    min-height: 100px;
}

.restaurant-print-field .field-hint {
    font-size: 0.85rem;
    color: var(--secondary-text-color);
    margin: 0;
}

.restaurant-print-field .toggle-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.95rem;
}

.restaurant-print-field .toggle-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.tax-field-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: flex-start;
}

.tax-field-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-color);
    font-size: 0.95rem;
}

.tax-field-checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-color);
    flex-shrink: 0;
}

.tax-field-checkbox-label span {
    user-select: none;
}

.restaurant-print-settings-status {
    padding: 0.85rem 1.1rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95rem;
}

.restaurant-print-settings-status.success {
    background: rgba(40, 167, 69, 0.12);
    color: #28a745;
    border: 1px solid rgba(40, 167, 69, 0.35);
}

.restaurant-print-settings-status.error {
    background: rgba(220, 53, 69, 0.12);
    color: #dc3545;
    border: 1px solid rgba(220, 53, 69, 0.35);
}

.restaurant-print-settings-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

@media (max-width: 1024px) {
    .category-section-content {
        grid-template-columns: 1fr;
    }
}

.menu-management-body {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-top: 1.5rem;
}

.menu-tab-nav {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-width: 220px;
    position: sticky;
    top: 120px;
}

.menu-tab-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.menu-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.4rem;
    border-radius: 999px;
    border: 1px solid rgba(232, 93, 4, 0.2);
    background: transparent;
    color: var(--primary-color);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
}

.menu-tab-btn .menu-tab-icon {
    font-size: 1.1rem;
}

.menu-tab-btn:hover {
    background: rgba(232, 93, 4, 0.1);
    border-color: rgba(232, 93, 4, 0.35);
    box-shadow: 0 12px 22px rgba(232, 93, 4, 0.16);
}

.menu-tab-btn.active {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover-color));
    color: white;
    border-color: transparent;
    box-shadow: 0 18px 30px rgba(232, 93, 4, 0.26);
}

@media (max-width: 1024px) {
    .menu-tabs {
        gap: 0.5rem;
    }
}

/* =========================================
   Sales Analytics Page Styles
   ========================================= */

.sales-analytics-page {
    padding: 2rem;
    max-width: 1600px;
    margin: 0 auto;
    font-family: 'Inter', system-ui, sans-serif;
    color: var(--text-color);
    animation: fadeIn 0.5s ease-out;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
}

.header-title h1 {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-color), #ff6b6b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
}

.header-subtitle {
    color: var(--secondary-text-color);
    font-size: 0.95rem;
    margin-top: 0.25rem;
}

.back-btn-modern {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: none;
    font-weight: 600;
    color: var(--secondary-text-color);
    cursor: pointer;
    transition: all 0.2s;
    padding: 0.5rem 1rem;
    border-radius: 8px;
}

.back-btn-modern:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--primary-color);
    transform: translateX(-4px);
}

.export-btn-modern {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-weight: 600;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.export-btn-modern:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(232, 93, 4, 0.15);
}

/* Glass Panels & Cards */
.glass-panel {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.05);
}

.filters-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.filter-row {
    display: flex;
    gap: 2rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.filter-group-modern {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-group-modern label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--secondary-text-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-group-modern .filter-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--secondary-text-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.toggle-group {
    display: flex;
    background-color: rgba(0, 0, 0, 0.04);
    padding: 4px;
    border-radius: 10px;
}

.toggle-btn {
    padding: 0.5rem 1.2rem;
    border: none;
    background: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--secondary-text-color);
    cursor: pointer;
    transition: all 0.2s;
}

.toggle-btn.active {
    background-color: #fff;
    color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.date-inputs-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.date-inputs-row input,
.filter-group-modern select {
    padding: 0.6rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: #fff;
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.2s;
}

.date-inputs-row input:focus,
.filter-group-modern select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(232, 93, 4, 0.1);
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.metric-card {
    padding: 1.5rem;
    border-radius: 16px;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    color: #fff;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: default;
}

.metric-card:hover {
    transform: translateY(-5px) scale(1.02);
}

.metric-card.gradient-1 {
    background: linear-gradient(135deg, #FF6B6B, #FF8E53);
    box-shadow: 0 10px 20px rgba(255, 107, 107, 0.3);
}

.metric-card.gradient-2 {
    background: linear-gradient(135deg, #4facfe, #00f2fe);
    box-shadow: 0 10px 20px rgba(79, 172, 254, 0.3);
}

.metric-card.gradient-3 {
    background: linear-gradient(135deg, #667eea, #764ba2);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.metric-card.glass-card {
    background: #fff;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
}

.metric-icon {
    font-size: 1.5rem;
    background: rgba(255, 255, 255, 0.2);
    padding: 0.75rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.metric-icon.secondary {
    background: rgba(232, 93, 4, 0.1);
    color: var(--primary-color);
}

.metric-info h3 {
    font-size: 0.85rem;
    opacity: 0.9;
    margin-bottom: 0.25rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-info p {
    font-size: 1.6rem;
    font-weight: 800;
    margin: 0;
    line-height: 1.2;
}

.metric-info .sub-text {
    display: block;
    font-size: 0.75rem;
    opacity: 0.7;
    margin-top: 0.5rem;
}

/* Charts Grid */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.chart-card {
    min-height: 380px;
    display: flex;
    flex-direction: column;
}

.chart-card h3 {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-color);
    border-left: 4px solid var(--primary-color);
    padding-left: 1rem;
}

/* Modern Table Styles */
.table-container {
    overflow: hidden;
}

.section-title {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    color: var(--text-color);
    font-weight: 700;
}

.custom-table-wrapper {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.custom-table th {
    background-color: #f8f9fa;
    padding: 1rem 1.5rem;
    text-align: left;
    font-weight: 600;
    color: var(--secondary-text-color);
    border-bottom: 1px solid var(--border-color);
}

.custom-table td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    vertical-align: middle;
}

.custom-table tr:last-child td {
    border-bottom: none;
}

.custom-table tr {
    transition: background-color 0.2s;
}

.custom-table tr:hover {
    background-color: rgba(232, 93, 4, 0.02);
}

.font-mono {
    font-family: 'DM Mono', monospace;
    color: var(--primary-color);
    font-weight: 600;
}

.date-time-cell {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.time-sub {
    font-size: 0.8rem;
    color: var(--secondary-text-color);
}

.items-preview {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.item-pill {
    background-color: #f1f3f5;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--text-color);
}

.status-pill {
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: capitalize;
}

.status-pill.pending {
    background: #fff3cd;
    color: #856404;
}

.status-pill.cooking {
    background: #cce5ff;
    color: #004085;
}

.status-pill.ready-for-delivery {
    background: #d4edda;
    color: #155724;
}

.status-pill.delivered {
    background: #d1e7dd;
    color: #0f5132;
}

.status-pill.refunded {
    background: #f8d7da;
    color: #721c24;
}

.text-right {
    text-align: right;
}

.text-primary {
    color: var(--primary-color);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.6s ease-out forwards;
}

.animate-slide-up {
    animation: slideUp 0.6s ease-out forwards;
    animation-delay: 0.1s;
    opacity: 0;
}

.animate-fade-in-delayed {
    animation: fadeIn 0.8s ease-out forwards;
    animation-delay: 0.2s;
    opacity: 0;
}

.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    gap: 1rem;
    color: var(--secondary-text-color);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(232, 93, 4, 0.1);
    border-left-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 768px) {
    .sales-analytics-page {
        width: 100%;
        min-width: 0;
        padding: 0;
        padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
    }

    .sales-analytics-page .glass-panel,
    .sales-analytics-page .table-container,
    .sales-analytics-page .chart-card {
        min-width: 0;
        max-width: 100%;
    }

    .filter-row {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .date-inputs-row {
        flex-direction: column;
        align-items: stretch;
    }

    .date-inputs-row input,
    .filter-group-modern select {
        width: 100%;
        min-height: 44px;
    }

    .toggle-group {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        width: 100%;
    }

    .toggle-btn {
        min-width: 0;
        min-height: 44px;
        padding-inline: 0.5rem;
    }

    .charts-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .chart-card {
        min-height: 340px;
        padding: 1rem;
    }

    .table-container {
        padding: 1rem;
        overflow: visible;
    }

    .custom-table-wrapper {
        max-width: 100%;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        -webkit-overflow-scrolling: touch;
    }

    .metric-card {
        padding: 1rem;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .metric-info {
        min-width: 0;
    }

    .metric-info p,
    .report-card-body h3,
    .report-card-body p {
        overflow-wrap: anywhere;
    }
}

/* Info Icon with Tooltip */
.info-icon-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: help;
}

.info-icon {
    font-size: 1.25rem;
    color: var(--primary-color);
    opacity: 0.7;
    transition: opacity 0.2s ease, transform 0.2s ease, color 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.info-icon-wrapper:hover .info-icon {
    opacity: 1;
    transform: scale(1.1);
}

.info-tooltip {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 0.5rem);
    transform: translateX(-50%);
    background-color: #2d3748;
    color: #ffffff;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    line-height: 1.5;
    white-space: normal;
    max-width: 320px;
    width: max-content;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
    pointer-events: none;
    z-index: 1000;
    text-align: left;
}

.info-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #2d3748;
}

.info-icon-wrapper:hover .info-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-4px);
}

/* Responsive tooltip positioning */
@media (max-width: 768px) {
    .info-tooltip {
        max-width: 250px;
        font-size: 0.8rem;
        padding: 0.6rem 0.85rem;
    }
}

/* =====================================================
   BRANCH MANAGEMENT STYLES
   ===================================================== */

/* Branch Selector Component */
.branch-selector {
    position: relative;
}

.branch-selector-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
}

.branch-selector-button {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1.2rem;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    font-size: 0.95rem;
}

.branch-selector-button:hover {
    background: var(--background-color);
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.branch-selector-button .branch-icon {
    color: var(--primary-color);
    font-size: 1.1rem;
    flex-shrink: 0;
}

.branch-info-compact {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.branch-info-compact .branch-name {
    font-weight: 600;
    color: var(--text-color);
}

.branch-info-compact .branch-code {
    font-size: 0.85rem;
    color: var(--secondary-text-color);
    font-weight: 500;
    /* BranchSettingsPage.css has a global .branch-code (monospace chip) that
       otherwise leaks into the header once that page has loaded. */
    font-family: inherit;
    background: none;
    padding: 0;
    border-radius: 0;
    display: inline;
}

.branch-selector-button .chevron {
    color: var(--secondary-text-color);
    font-size: 1rem;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.branch-selector-button .chevron.open {
    transform: rotate(180deg);
}

.branch-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 280px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 1000;
    overflow: hidden;
}

.branch-dropdown-header {
    padding: 0.85rem 1.1rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--background-color);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--secondary-text-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.branch-dropdown-list {
    max-height: 320px;
    overflow-y: auto;
}

.branch-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 1.1rem;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid var(--border-color);
}

.branch-option:last-child {
    border-bottom: none;
}

.branch-option:hover {
    background: var(--background-color);
}

.branch-option.active {
    background: rgba(232, 93, 4, 0.08);
}

.branch-option-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 1rem;
}

.branch-option-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.branch-option-name {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.95rem;
}

.branch-option-code {
    font-size: 0.8rem;
    color: var(--secondary-text-color);
    font-weight: 500;
}

.branch-option-badges {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.main-badge {
    background: rgba(40, 167, 69, 0.12);
    color: #28a745;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.branch-option .current-check {
    color: var(--primary-color);
    font-size: 1.2rem;
    flex-shrink: 0;
}

/* =====================================================
   OUTLET SELECTOR (header, mirrors branch-selector)
   ===================================================== */

.outlet-selector {
    position: relative;
}

/* Locked state — non-interactive badge */
.outlet-selector--locked {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.9rem;
    background: rgba(232, 93, 4, 0.07);
    border: 1px solid rgba(232, 93, 4, 0.3);
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 600;
    color: #c2440a;
    cursor: default;
    white-space: nowrap;
}

.outlet-selector--locked .outlet-selector-lock-icon {
    color: #c2440a;
    flex-shrink: 0;
}

/* Switchable button */
.outlet-selector-button {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 1rem;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    font-size: 0.875rem;
    white-space: nowrap;
}

.outlet-selector-button:hover {
    background: var(--background-color);
    border-color: #e85d04;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.outlet-selector-icon {
    color: #e85d04;
    flex-shrink: 0;
}

.outlet-selector-name {
    font-weight: 600;
    color: var(--text-color);
}

.outlet-chevron {
    color: var(--secondary-text-color);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.outlet-chevron.open {
    transform: rotate(180deg);
}

.outlet-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 1000;
    overflow: hidden;
}

.outlet-dropdown-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--background-color);
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--secondary-text-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.outlet-dropdown-list {
    max-height: 280px;
    overflow-y: auto;
}

.outlet-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-size: 0.875rem;
    transition: background 0.15s ease;
    border-bottom: 1px solid var(--border-color);
    font-family: inherit;
}

.outlet-option:last-child {
    border-bottom: none;
}

.outlet-option:hover {
    background: var(--background-color);
}

.outlet-option.active {
    background: rgba(232, 93, 4, 0.08);
}

.outlet-option-name {
    font-weight: 500;
    color: var(--text-color);
}

.outlet-option.active .outlet-option-name {
    font-weight: 700;
    color: #e85d04;
}

.outlet-current-check {
    color: #e85d04;
    flex-shrink: 0;
}

/* =====================================================
   TEAM SWITCHER STYLES
   ===================================================== */

/* Team Switcher Component - Blue theme to differentiate from Branch (Orange) */
.team-switcher {
    position: relative;
}

.team-switcher-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
}

.team-switcher-button {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1.2rem;
    background: var(--surface-color);
    border: 1px solid #3b82f6;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    font-size: 0.95rem;
}

.team-switcher-button:hover {
    background: #eff6ff;
    border-color: #2563eb;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
}

.team-switcher-button .team-icon {
    color: #3b82f6;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.team-info-compact {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.team-info-compact .team-name {
    font-weight: 600;
    color: var(--text-color);
}

.team-info-compact .team-role {
    font-size: 0.85rem;
    color: #3b82f6;
    font-weight: 600;
}

.team-switcher-button .chevron {
    color: var(--secondary-text-color);
    font-size: 1rem;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.team-switcher-button .chevron.open {
    transform: rotate(180deg);
}

.team-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 320px;
    background: var(--surface-color);
    border: 1px solid #3b82f6;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.2);
    z-index: 1000;
    overflow: hidden;
}

.team-dropdown-header {
    padding: 0.85rem 1.1rem;
    border-bottom: 1px solid #3b82f6;
    background: #eff6ff;
    font-weight: 600;
    font-size: 0.85rem;
    color: #1e40af;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.team-dropdown-list {
    max-height: 320px;
    overflow-y: auto;
}

.team-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 1.1rem;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid var(--border-color);
}

.team-option:last-child {
    border-bottom: none;
}

.team-option:hover {
    background: #eff6ff;
}

.team-option.active {
    background: rgba(59, 130, 246, 0.12);
}

.team-option-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 1rem;
}

.team-option-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.team-option-name {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.95rem;
}

.team-option-role {
    font-size: 0.8rem;
    color: #3b82f6;
    font-weight: 600;
}

.team-option-badges {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.owner-badge {
    background: rgba(59, 130, 246, 0.15);
    color: #1e40af;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.team-option .current-check {
    color: #3b82f6;
    font-size: 1.2rem;
    flex-shrink: 0;
}

/* Team Switching Loading Overlay */
.team-switching-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(8px);
    animation: fadeIn 0.3s ease;
}

.team-switching-content {
    background: white;
    padding: 3rem 4rem;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    animation: slideUp 0.4s ease;
    max-width: 400px;
}

.team-switching-spinner {
    width: 60px;
    height: 60px;
    border: 5px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1.5rem;
}

.team-switching-content h3 {
    font-size: 1.5rem;
    color: #1e293b;
    margin: 0 0 0.75rem 0;
    font-weight: 700;
}

.team-switching-content p {
    font-size: 1rem;
    color: #64748b;
    margin: 0;
    line-height: 1.5;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Branch Switching Loading Overlay (reuses team switching styles) */
.branch-switching-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(8px);
    animation: fadeIn 0.3s ease;
}

.branch-switching-content {
    background: white;
    padding: 3rem 4rem;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    animation: slideUp 0.4s ease;
    max-width: 400px;
}

.branch-switching-spinner {
    position: relative;
    width: 60px;
    height: 60px;
    margin: 0 auto 1.5rem;
}

/* Orange fruit for branch switching */
.branch-switching-spinner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #ff8c00, #ff6600);
    border-radius: 50%;
    box-shadow:
        inset -5px -5px 15px rgba(0, 0, 0, 0.2),
        inset 5px 5px 15px rgba(255, 255, 255, 0.3),
        0 0 25px rgba(255, 140, 0, 0.5);
    animation: orangeToLiquid 2s ease-in-out infinite;
}

/* Orange leaf for branch switching */
.branch-switching-spinner::after {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 15px;
    height: 10px;
    background: linear-gradient(135deg, #4CAF50, #45a049);
    border-radius: 50% 50% 0 0;
    animation: leafWiggle 2s ease-in-out infinite;
    z-index: 1;
}

.branch-switching-content h3 {
    font-size: 1.5rem;
    color: #1e293b;
    margin: 0 0 0.75rem 0;
    font-weight: 700;
}

.branch-switching-content p {
    font-size: 1rem;
    color: #64748b;
    margin: 0;
    line-height: 1.5;
}

/* Branch Settings Page */

.branch-settings-page {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.branch-settings-page .page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    gap: 2rem;
}

.branch-settings-page .page-header-content h1 {
    font-size: 2rem;
    color: var(--text-color);
    margin: 0 0 0.5rem 0;
    font-weight: 700;
}

.branch-settings-page .page-description {
    color: var(--secondary-text-color);
    font-size: 1rem;
    margin: 0;
}

.create-branch-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.create-branch-button:hover {
    background: var(--primary-hover-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(232, 93, 4, 0.25);
}

.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    gap: 1rem;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    gap: 1rem;
    background: var(--surface-color);
    border-radius: 16px;
    border: 2px dashed var(--border-color);
}

.empty-state .empty-icon {
    font-size: 4rem;
    color: var(--border-color);
}

.empty-state h3 {
    font-size: 1.5rem;
    color: var(--text-color);
    margin: 0;
}

.empty-state p {
    color: var(--secondary-text-color);
    margin: 0;
}

.branches-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.5rem;
}

.branch-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.branch-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
}

.branch-card-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    position: relative;
}

.branch-card-icon {
    width: 48px;
    height: 48px;
    background: rgba(232, 93, 4, 0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    font-size: 1.5rem;
    flex-shrink: 0;
}

.branch-card-title {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.branch-card-title h3 {
    font-size: 1.25rem;
    color: var(--text-color);
    margin: 0;
    font-weight: 700;
}

.branch-card-title .branch-code {
    font-size: 0.85rem;
    color: var(--secondary-text-color);
    font-weight: 600;
}

.branch-card-header .main-badge {
    position: absolute;
    top: 0;
    right: 0;
}

.branch-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.branch-detail {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.branch-detail strong {
    font-size: 0.8rem;
    color: var(--secondary-text-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.branch-detail span {
    font-size: 0.95rem;
    color: var(--text-color);
}

.access-badge {
    display: inline-block;
    background: rgba(232, 93, 4, 0.12);
    color: var(--primary-color);
    padding: 0.3rem 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: capitalize;
}

.current-branch-indicator {
    padding: 0.75rem;
    background: rgba(232, 93, 4, 0.08);
    border-radius: 8px;
    border: 1px solid rgba(232, 93, 4, 0.2);
}

.current-badge {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.current-badge::before {
    content: "✓";
    font-size: 1.1rem;
}

.branch-card-footer {
    display: flex;
    gap: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.edit-button {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1rem;
    background: var(--background-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.edit-button:hover:not(:disabled) {
    background: var(--surface-color);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.edit-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Branch Creation Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1.5rem;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--surface-color);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: min(540px, 100%);
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 1.5rem;
    color: var(--text-color);
    margin: 0;
    font-weight: 700;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--background-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--secondary-text-color);
    font-size: 1.2rem;
}

.modal-close:hover {
    background: var(--border-color);
    color: var(--text-color);
}

.modal-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.95rem;
}

.form-group .required {
    color: #dc3545;
    margin-left: 0.25rem;
}

.form-group input,
.form-group textarea {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s ease;
    background: var(--surface-color);
    color: var(--text-color);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(232, 93, 4, 0.1);
}

.form-group input:disabled,
.form-group textarea:disabled {
    background: var(--background-color);
    cursor: not-allowed;
    opacity: 0.6;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.cancel-button,
.submit-button {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.cancel-button {
    background: var(--background-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.cancel-button:hover:not(:disabled) {
    background: var(--border-color);
}

.submit-button {
    background: var(--primary-color);
    color: white;
}

.submit-button:hover:not(:disabled) {
    background: var(--primary-hover-color);
    box-shadow: 0 4px 12px rgba(232, 93, 4, 0.25);
}

.cancel-button:disabled,
.submit-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Responsive Design */
@media (max-width: 768px) {
    .branch-settings-page {
        padding: 1rem;
    }

    .branch-settings-page .page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .create-branch-button {
        width: 100%;
        justify-content: center;
    }

    .branches-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .branch-dropdown {
        min-width: 260px;
    }
}

/* Feature Action Button */
.feature-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 1rem;
    width: 100%;
}

.feature-action-btn.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.feature-action-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}


/* ========================================
   PRINTER SETTINGS STYLES
   ======================================== */

.printer-settings-panel {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.printer-hardware-section {
    background: linear-gradient(135deg, rgba(232, 93, 4, 0.03), rgba(244, 140, 6, 0.02));
    border: 1px solid rgba(232, 93, 4, 0.15);
    border-radius: 12px;
    padding: 1.5rem;
}

.printer-hardware-section h4 {
    color: var(--text-color);
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.restaurant-print-field {
    margin-bottom: 1.5rem;
}

.restaurant-print-field label {
    display: block;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.restaurant-print-field input[type="text"],
.restaurant-print-field input[type="number"],
.restaurant-print-field select,
.restaurant-print-field textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.2s ease;
    background-color: var(--surface-color);
}

.restaurant-print-field input[type="text"]:focus,
.restaurant-print-field input[type="number"]:focus,
.restaurant-print-field select:focus,
.restaurant-print-field textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(232, 93, 4, 0.1);
}

.restaurant-print-field input[type="number"] {
    max-width: 150px;
}

.restaurant-print-field textarea {
    resize: vertical;
    min-height: 100px;
}

.restaurant-print-field .checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.75rem;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.restaurant-print-field .checkbox-label:hover {
    background-color: rgba(232, 93, 4, 0.05);
}

.restaurant-print-field .checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.restaurant-print-field .checkbox-label span {
    font-weight: 600;
    color: var(--text-color);
}

.field-hint {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--secondary-text-color);
    line-height: 1.4;
}

.printer-options-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.printer-option-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    background-color: var(--surface-color);
}

.printer-option-card:hover {
    border-color: var(--primary-color);
    background-color: rgba(232, 93, 4, 0.03);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.printer-option-card.selected {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, rgba(232, 93, 4, 0.08), rgba(244, 140, 6, 0.05));
    box-shadow: 0 4px 12px rgba(232, 93, 4, 0.15);
}

.printer-option-card input[type="radio"] {
    margin-top: 0.25rem;
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.printer-option-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.printer-option-title {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text-color);
}

.printer-option-description {
    font-size: 0.9rem;
    color: var(--secondary-text-color);
    line-height: 1.5;
}

.tax-field-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.5rem 0;
}

.tax-field-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.tax-field-checkbox-label:hover {
    background-color: rgba(232, 93, 4, 0.05);
}

.tax-field-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.tax-field-checkbox-label span {
    font-weight: 500;
    color: var(--text-color);
}

.restaurant-print-settings-status {
    padding: 1rem 1.25rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.restaurant-print-settings-status.success {
    background: rgba(40, 167, 69, 0.12);
    color: #28a745;
    border: 1px solid rgba(40, 167, 69, 0.35);
}

.restaurant-print-settings-status.error {
    background: rgba(220, 53, 69, 0.12);
    color: #dc3545;
    border: 1px solid rgba(220, 53, 69, 0.35);
}

.printer-settings-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.secondary-btn {
    padding: 0.75rem 1.5rem;
    border: 2px solid var(--border-color);
    background-color: var(--surface-color);
    color: var(--text-color);
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.secondary-btn:hover:not(:disabled) {
    border-color: var(--primary-color);
    background-color: rgba(232, 93, 4, 0.05);
    color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.secondary-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Responsive Design for Printer Settings */
@media (max-width: 768px) {
    .printer-hardware-section {
        padding: 1rem;
    }

    .printer-option-card {
        padding: 1rem;
    }

    .printer-settings-actions {
        flex-direction: column;
    }

    .printer-settings-actions button {
        width: 100%;
    }

    .restaurant-print-field input[type="number"] {
        max-width: 100%;
    }
}

/* ===================== Receipt Template System ===================== */

.printer-settings-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.printer-settings-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border: none;
    background: transparent;
    color: var(--secondary-text-color);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s ease;
}

.printer-settings-tab:hover {
    color: var(--primary-color);
}

.printer-settings-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.receipt-paper-size-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1rem 0 1.5rem;
}

.receipt-paper-size-tab {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 20px;
    background: var(--surface-color);
    color: var(--text-color);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.receipt-paper-size-tab.active {
    border-color: var(--primary-color);
    background: rgba(232, 93, 4, 0.08);
    color: var(--primary-color);
}

.receipt-template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.5rem;
}

.receipt-template-card {
    position: relative;
    display: flex;
    flex-direction: column;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    background: var(--surface-color);
    overflow: hidden;
    transition: all 0.2s ease;
}

.receipt-template-card.active {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(232, 93, 4, 0.15);
}

.receipt-template-active-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--primary-color);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    z-index: 1;
}

.receipt-template-card-preview {
    background: #f0f0f0;
    display: flex;
    justify-content: center;
    padding: 0.75rem;
    height: 160px;
    overflow: hidden;
}

.receipt-template-card-body {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.receipt-template-card-body h4 {
    margin: 0;
    color: var(--text-color);
}

.receipt-template-card-meta {
    font-size: 0.8rem;
    color: var(--secondary-text-color);
    text-transform: capitalize;
}

.receipt-template-card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.receipt-template-create-card {
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    min-height: 240px;
    border-style: dashed;
    cursor: pointer;
    color: var(--secondary-text-color);
    font-weight: 600;
}

.receipt-template-create-card:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.receipt-template-editor-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.receipt-template-editor-header h3 {
    margin: 0;
    color: var(--text-color);
}

.receipt-template-editor-layout {
    display: grid;
    grid-template-columns: minmax(280px, 420px) 1fr;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 900px) {
    .receipt-template-editor-layout {
        grid-template-columns: 1fr;
    }
}

.receipt-template-editor-settings h4 {
    margin: 0.5rem 0;
    color: var(--text-color);
}

.receipt-section-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.receipt-section-row {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    background: var(--surface-color);
}

.receipt-section-row.disabled {
    opacity: 0.6;
}

.receipt-section-row-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.receipt-section-row-move {
    display: flex;
    gap: 0.25rem;
}

.receipt-section-row-move button {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border-color);
    background: var(--background-color);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.receipt-section-row-move button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.receipt-section-row-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px dashed var(--border-color);
}

.receipt-section-row-fields .tax-field-checkbox-label {
    padding: 0.25rem 0.5rem;
}

.receipt-logo-upload {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
}

.receipt-logo-current {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.receipt-logo-thumb {
    width: 48px;
    height: 48px;
    object-fit: contain;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 4px;
}

.receipt-logo-hint {
    color: #b45309 !important;
    background: #fef3e2;
    border: 1px solid #fcd34d;
    border-radius: 6px;
    padding: 0.5rem 0.65rem;
    margin: 0 !important;
}

.receipt-template-editor-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

.receipt-danger-btn:hover:not(:disabled) {
    border-color: #dc3545 !important;
    color: #dc3545 !important;
    background-color: rgba(220, 53, 69, 0.05) !important;
}

.receipt-template-editor-preview {
    position: sticky;
    top: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.receipt-template-editor-preview h4 {
    align-self: flex-start;
    color: var(--text-color);
}

.receipt-print-rule-group {
    margin-bottom: 1.75rem;
}

.receipt-print-rule-group h4 {
    margin-bottom: 0.25rem;
    color: var(--text-color);
}

.receipt-print-rule-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 0.75rem;
}

.receipt-print-rule-cell {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 160px;
}

.receipt-print-rule-cell label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--secondary-text-color);
    text-transform: uppercase;
}

.receipt-print-rule-cell select {
    padding: 0.6rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--surface-color);
}

@media (max-width: 768px) {
    .receipt-template-grid {
        grid-template-columns: 1fr;
    }
}
/* ── Phone header: centred brand logo on top (app-style template) ───────────
   Row 1: logo centred, account avatar at the right edge.
   Row 2: branch / outlet pickers.  Row 3: POS · Kitchen · History tabs.
   Always the FULL logo — the earlier narrow-phone rules that cropped it to a
   19px mark are overridden here. Respects the notch / status bar and the
   home-indicator via safe-area insets (needs viewport-fit=cover). */
@media (max-width: 768px) {
    .app-header,
    .app-header:has(.outlet-selector) {
        grid-template-columns: 2.75rem minmax(0, 1fr) 2.75rem;
        grid-template-areas:
            ".       logo    account"
            "context context context"
            "nav     nav     nav";
        padding: calc(0.6rem + env(safe-area-inset-top, 0px)) 1rem 0.75rem;
        gap: 0.6rem 0.5rem;
        border-bottom: 1px solid var(--border-color);
    }

    .app-header .header-logo,
    .app-header:has(.outlet-selector) .header-logo {
        grid-area: logo;
        justify-self: center;
        /* The wordmark is cropped tight, so size it by height; it never
           gets cropped and scales down on the narrowest phones. */
        width: min(230px, 66vw);
        max-width: 100%;
        height: auto;
        max-height: 44px;
        object-fit: contain;
        object-position: center;
    }

    .header-account {
        grid-area: account;
        justify-self: end;
    }

    /* Branch (and outlet, when present) centred under the logo. */
    .app-header .header-right {
        justify-content: center;
        width: 100%;
    }

    .app-header .header-right .branch-selector,
    .app-header .header-right .outlet-selector {
        flex: 0 1 auto;
        min-width: 0;
        max-width: 100%;
    }

    .mobile-nav {
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    .app-container {
        padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px));
    }
}

/* ── Mobile hardening (phones & small tablets, iOS + Android app) ───────────
   Global guards so nothing can push the page sideways, plus the admin shell,
   which was built for desktop (fixed header + fixed sidebar). */
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

@media (max-width: 1200px) {
    /* Admin header: normal flow, wraps instead of pushing "Back to POS" off-screen. */
    .admin-header.admin-header {
        position: sticky;
        top: 0;
        left: auto;
        right: auto;
        flex-wrap: wrap;
        justify-content: space-between;
        gap: 0.5rem 0.75rem;
        padding: calc(0.6rem + env(safe-area-inset-top, 0px)) 1rem 0.6rem;
    }

    .admin-header.admin-header h1 {
        flex: 1 1 auto;
        min-width: 0;
        font-size: 1.15rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Row 1: title + Back to POS.  Row 2: branch picker + notifications. */
    .admin-header .admin-header-actions {
        display: contents;
    }

    .admin-header.admin-header h1 {
        order: -2;
    }

    .admin-header .back-to-pos-btn {
        order: -1;
    }

    .back-to-pos-btn {
        padding: 0.5rem 0.9rem;
        font-size: 0.9rem;
        white-space: nowrap;
    }

    /* Sidebar becomes a swipeable tab strip. */
    .admin-sidebar,
    .admin-sidebar.collapsed {
        display: flex;
        flex-direction: row;
        gap: 0.5rem;
        width: 100%;
        padding: 0.6rem 1rem;
        margin: 0;
        overflow-x: auto;
        overflow-y: hidden;
        border-right: 0;
        border-bottom: 1px solid var(--border-color);
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .admin-sidebar::-webkit-scrollbar {
        display: none;
    }

    .admin-sidebar .sidebar-collapse-btn {
        display: none;
    }

    .admin-sidebar .sidebar-btn,
    .admin-sidebar .sidebar-btn.collapsed {
        width: auto;
        flex: 0 0 auto;
        margin: 0;
        padding: 0.6rem 0.9rem;
        font-size: 0.92rem;
    }

    .admin-content,
    .admin-content.sidebar-collapsed {
        flex: 1 1 0;
        margin: 0;
        width: 100%;
        height: 0;
        min-width: 0;
        max-width: 100%;
        min-height: 0;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior-y: contain;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y;
    }
}

@media (max-width: 768px) {
    html,
    body {
        max-width: 100%;
        overflow-x: hidden;
    }

    /* Only the root may stop the pull-to-refresh bounce. body is also a scroll
       container (overflow-y: auto) that never overflows, and overscroll-behavior
       on it blocked every touch swipe from reaching the page - menu locked. */
    html {
        overscroll-behavior-y: none;
    }

    img,
    video,
    canvas,
    svg {
        max-width: 100%;
    }

    /* Wide tables scroll inside themselves instead of widening the page. */
    table:not(.receipt table):not(.receipt-preview table) {
        display: block;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    pre,
    code {
        white-space: pre-wrap;
        word-break: break-word;
    }

    /* Layout children may shrink below their content width. */
    .admin-content > *,
    .settings-detail,
    .settings-detail-card,
    .column,
    .column-content {
        min-width: 0;
        max-width: 100%;
    }

    /* Modals never exceed the screen and scroll inside themselves. */
    [class*="modal-content"],
    [class*="-modal"] > [class*="content"] {
        max-width: calc(100vw - 1rem);
        max-height: calc(100dvh - 1rem);
        overflow-y: auto;
        box-sizing: border-box;
    }

    /* iOS zooms the page when a focused field is under 16px. */
    input:not([type="checkbox"]):not([type="radio"]),
    select,
    textarea {
        font-size: 16px;
    }

    .recent-order-line {
        grid-template-columns: 1fr 1fr;
    }

    .vop-workspace,
    .receipt-template-editor-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .team-table {
        min-width: 0;
    }
}

/* ── Admin on phones: ONE slim top bar + a slim sticky tab strip ────────────
   [←] Admin ........ [branch ▾] [🔔]
   Dashboard · Menu · Orders · Inventory · …   (swipe sideways)
   Overrides the earlier tablet/phone admin rules above. */
@media (max-width: 768px) {
    .admin-header.admin-header {
        flex-wrap: nowrap;
        align-items: center;
        gap: 0.5rem;
        padding: calc(0.4rem + env(safe-area-inset-top, 0px)) 0.75rem 0.4rem;
        min-height: 3rem;
        box-shadow: none;
        border-bottom: 1px solid var(--border-color);
    }

    .admin-header.admin-header h1 {
        order: -1;
        flex: 0 0 auto;
        font-size: 1.05rem;
        line-height: 1;
    }

    .admin-header .admin-title-extra {
        display: none;
    }

    /* Back to POS: arrow only, first in the row. */
    .admin-header .back-to-pos-btn {
        order: -2;
        flex: 0 0 auto;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 2.25rem;
        height: 2.25rem;
        padding: 0;
        border-radius: 50%;
    }

    .admin-header .back-to-pos-label {
        display: none;
    }

    .admin-header .back-to-pos-btn svg {
        width: 1.1rem;
        height: 1.1rem;
        margin: 0;
    }

    /* Branch / outlet pickers take the free space, truncated. */
    .admin-header .branch-selector,
    .admin-header .outlet-selector {
        flex: 1 1 0;
        min-width: 0;
        max-width: none;
    }

    .admin-header .branch-selector-button,
    .admin-header .outlet-selector-button {
        width: 100%;
        padding: 0.35rem 0.6rem;
        font-size: 0.82rem;
    }

    .admin-header .notification-container {
        flex: 0 0 auto;
        margin-left: auto;
    }

    /* Tab strip stays visible under the bar while the page scrolls. */
    .admin-sidebar,
    .admin-sidebar.collapsed {
        position: sticky;
        top: calc(3rem + env(safe-area-inset-top, 0px));
        z-index: 90;
        gap: 0.35rem;
        padding: 0.4rem 0.75rem;
        background: var(--surface-color);
    }

    .admin-sidebar .sidebar-btn,
    .admin-sidebar .sidebar-btn.collapsed {
        padding: 0.35rem 0.75rem;
        font-size: 0.82rem;
        gap: 0.35rem;
        border-radius: 999px;
    }

    .admin-sidebar .sidebar-btn svg {
        width: 15px;
        height: 15px;
    }

    .admin-content,
    .admin-content.sidebar-collapsed {
        flex: 1 1 0;
        height: 0;
        min-height: 0;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior-y: contain;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y;
        padding: 0.75rem 0.75rem calc(2rem + env(safe-area-inset-bottom, 0px));
    }

    .admin-page,
    .admin-container {
        height: 100vh;
        height: 100dvh;
        min-height: 0;
        overflow: hidden;
    }

    .analytics-section {
        width: 100%;
        min-width: 0;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    .analytics-section .report-cards {
        grid-template-columns: minmax(0, 1fr);
        gap: 1rem;
        padding: 0.75rem;
    }

    .analytics-section .report-card {
        width: 100%;
        padding: 1.25rem;
        border-radius: 14px;
    }

    .analytics-section .generate-btn {
        width: 100%;
        min-height: 44px;
        justify-content: center;
        cursor: pointer;
    }

    .eod-modal-overlay {
        align-items: stretch;
        padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px);
        overflow: hidden;
    }

    .eod-modal {
        width: 100%;
        max-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    }

    .eod-modal-close {
        width: 44px;
        height: 44px;
    }

    .eod-modal-preview,
    .eod-preview-content {
        min-width: 0;
    }

    .eod-preview-content {
        padding: 1rem;
        overflow-x: hidden;
    }

    .dashboard-section h2,
    .menu-section h2,
    .orders-section h2,
    .inventory-section h2,
    .analytics-section h1,
    .settings-section h2 {
        margin-bottom: 1rem;
        font-size: 1.35rem;
    }
}

/* Keep shell grid rules after the legacy .app-container declarations. */
.pos-shell.app-container.ai-disabled {
    grid-template-columns: minmax(0, 1fr) minmax(340px, var(--pos-cart-width));
    max-width: 1920px;
}
.pos-shell.app-container.ai-enabled {
    grid-template-columns: minmax(0, 1fr) minmax(340px, var(--pos-cart-width)) minmax(280px, .75fr);
    max-width: 1920px;
}
.pos-shell.app-container[data-pos-theme="quick_order"].ai-disabled {
    grid-template-columns: minmax(340px, 35%) minmax(0, 65%);
}
.pos-shell.app-container[data-pos-theme="quick_order"].ai-enabled {
    grid-template-columns: minmax(340px, 35%) minmax(0, 1fr) minmax(260px, .5fr);
}
@media (max-width: 1100px) {
    .pos-shell.app-container.ai-disabled,
    .pos-shell.app-container.ai-enabled,
    .pos-shell.app-container[data-pos-theme="quick_order"].ai-disabled,
    .pos-shell.app-container[data-pos-theme="quick_order"].ai-enabled {
        grid-template-columns: minmax(0, 1fr) minmax(320px, 40%);
    }
}
@media (max-width: 768px) {
    .pos-shell.app-container.ai-disabled,
    .pos-shell.app-container.ai-enabled,
    .pos-shell.app-container[data-pos-theme="quick_order"].ai-disabled,
    .pos-shell.app-container[data-pos-theme="quick_order"].ai-enabled {
        display: flex;
    }
}

/* ── Mobile: let the POS page scroll naturally ──────────────────────────────
   The menu column was capped at 100vh with overflow hidden and a second nested
   scroller inside it, which trapped touch scrolling. On phones the document
   itself scrolls; the fixed bottom nav is cleared by .app-container padding. */
@media (max-width: 768px) {
    html,
    body {
        height: auto;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y;
    }

    #root,
    .main-wrapper {
        min-height: 100dvh;
    }

    .app-container:not(.screen-mode) {
        height: auto;
        overflow: visible;
    }

    .column,
    .column.active {
        height: auto;
        max-height: none;
        overflow: visible;
    }

    .column-content,
    .menu-column,
    .menu-column-scroll,
    .menu-category-sidebar {
        max-height: none;
        height: auto;
        overflow: visible;
    }

    .menu-column-scroll {
        padding-right: 0;
        scrollbar-gutter: auto;
    }

    .menu-layout {
        min-height: auto;
    }

    /* Horizontal category strips keep their own sideways scroll only. */
    .pos-shell[data-category-orientation="horizontal"] .menu-category-sidebar {
        overflow-x: auto;
        overflow-y: hidden;
    }
}

/* Menu management: tab buttons collapse into a dropdown on phones. */
.menu-tabs-select {
    display: none;
}

@media (max-width: 768px) {
    .menu-tabs {
        display: none;
    }

    .menu-tabs-select {
        display: block;
        width: 100%;
        min-height: 48px;
        margin-bottom: 1rem;
        padding: 0.7rem 2.5rem 0.7rem 1rem;
        font-size: 16px;
        font-weight: 700;
        color: #fff;
        background-color: var(--primary-color);
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 1rem center;
        border: none;
        border-radius: 999px;
        appearance: none;
        -webkit-appearance: none;
    }

    .menu-tabs-select option {
        color: #111;
        background: #fff;
    }
}

/* Admin on phones: two-row header and a dropdown instead of the tab strip. */
.admin-sidebar-select {
    display: none;
}

@media (max-width: 768px) {
    .admin-header.admin-header h1 {
        flex: 1 1 calc(100% - 6.5rem);
    }

    .admin-header .branch-selector,
    .admin-header .outlet-selector {
        order: 1;
    }

    .admin-sidebar .sidebar-btn {
        display: none;
    }

    .admin-sidebar .admin-sidebar-select {
        display: block;
        width: 100%;
        min-height: 44px;
        padding: 0.5rem 2.5rem 0.5rem 1rem;
        font-size: 16px;
        font-weight: 700;
        color: #fff;
        background-color: var(--primary-color);
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 1rem center;
        border: none;
        border-radius: 999px;
        appearance: none;
        -webkit-appearance: none;
    }

    .admin-sidebar .admin-sidebar-select option {
        color: #111;
        background: #fff;
    }
}

@media (max-width: 768px) {
    .admin-header.admin-header {
        flex-wrap: wrap;
        row-gap: 0.4rem;
    }

    .admin-header .branch-selector,
    .admin-header .outlet-selector {
        flex: 1 1 calc(50% - 0.5rem);
        min-width: 0;
    }
}

/* ── Mobile: admin sub-pages that were locked to the screen height ──────────
   Recipe / Portion / Dish-composition managers and the manual stock allocation
   used `height: calc(100vh - …)` + overflow hidden, so on phones the content
   below the fold could never be reached. Stack the panes and let .admin-content
   (the single scroller) scroll them. Prefixed with .admin-content so these beat
   the per-page stylesheets that load after this file. */
@media (max-width: 768px) {
    .admin-content .rm-container,
    .admin-content .pm-container,
    .admin-content .dcm-root,
    .admin-content .recipe-manager-container,
    .admin-content .sa-manual-layout {
        display: flex;
        flex-direction: column;
        height: auto;
        min-height: 0;
        max-height: none;
        overflow: visible;
    }

    .admin-content .rm-container > *,
    .admin-content .pm-container > *,
    .admin-content .dcm-root > *,
    .admin-content .recipe-manager-container > *,
    .admin-content .sa-manual-layout > * {
        width: 100%;
        min-width: 0;
        max-width: 100%;
        flex-shrink: 0;
    }

    /* Main editing panes grow with their content instead of scrolling inside. */
    .admin-content .rm-main,
    .admin-content .pm-main,
    .admin-content .rm-editor,
    .admin-content .rm-editor-body {
        flex: none;
        height: auto;
        min-height: 0;
        max-height: none;
        overflow: visible;
    }

    /* Pick-lists stay short so the editor below is one swipe away. */
    .admin-content .rm-sidebar,
    .admin-content .pm-sidebar,
    .admin-content .dcm-menu-list {
        width: 100%;
        max-height: 260px;
        border-right: 0;
        border-bottom: 1px solid #e5e7eb;
    }

    .admin-content .rm-sidebar-list,
    .admin-content .pm-sidebar-list,
    .admin-content .dcm-menu-items {
        overscroll-behavior: auto;
        -webkit-overflow-scrolling: touch;
    }

    .admin-content .sa-stock-list-panel {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .admin-content .dcm-recipe-panel {
        display: none;
    }

    .admin-content .dcm-root--panel-open .dcm-recipe-panel {
        display: flex;
        width: 100%;
        min-width: 0;
        border-left: 0;
        border-top: 1px solid #e5e7eb;
        overflow: visible;
    }

    .admin-content .dcm-comp-table {
        overflow-x: auto;
    }
}
/* ==========================================================================
   Service Mode, dining setup, floor drawing and table billing
   Brand accent is the app's --primary-color (#e85d04). Neutral surfaces,
   subtle borders, restrained motion.
   ========================================================================== */

:root {
  --svc-surface: #ffffff;
  --svc-canvas: #f4f6f9;
  --svc-ink: #1d2330;
  --svc-ink-2: #4a5263;
  --svc-ink-3: #7b8394;
  --svc-line: #e3e7ee;
  --svc-line-strong: #cfd5df;
  --svc-accent: var(--primary-color, #e85d04);
  --svc-accent-ink: #b84a03;
  --svc-accent-tint: #fff5ee;
  --svc-accent-line: #fbd2b6;
  --svc-radius: 14px;
  --svc-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 14px rgba(16, 24, 40, .05);
  --svc-focus: 0 0 0 3px rgba(232, 93, 4, .28);

  /* Table states. Each family has its own hue; states inside a family
     differ by treatment (hatched, heavier line, solid fill). */
  --st-free: #a3adbb;
  --st-cleaning: #8792a2;
  --st-reserved: #3b6fe0;
  --st-soon: #c58a0b;
  --st-hold: #d92d20;
  --st-seated: #e8590c;
  --st-bill: #7a4fe0;
  --st-part-paid: #0f8f84;
}

/* Per-state colours, read by swatches, pills, cards and table drawings:
   --s line and dot, --s-tint table fill, --s-ink text, --s-soft taken chairs and borders. */
.st-available, .tg--available { --s: var(--st-free); --s-tint: #ffffff; --s-ink: #667085; --s-soft: #e4e8ee; }
.st-cleaning, .tg--cleaning { --s: var(--st-cleaning); --s-tint: #f3f5f8; --s-ink: #475467; --s-soft: #e1e5eb; }
.st-reserved, .tg--reserved { --s: var(--st-reserved); --s-tint: #f0f5ff; --s-ink: #2652b8; --s-soft: #cddcfb; }
.st-reservation_warning, .tg--reservation_warning { --s: var(--st-soon); --s-tint: #fefae8; --s-ink: #8a5d00; --s-soft: #f1dea0; }
.st-reservation_blocked, .tg--reservation_blocked,
.st-reservation_due, .tg--reservation_due,
.st-reservation_late, .tg--reservation_late { --s: var(--st-hold); --s-tint: #fff4f3; --s-ink: #b42318; --s-soft: #fbd0cb; }
.st-occupied, .tg--occupied { --s: var(--st-seated); --s-tint: #fff6ef; --s-ink: #b8460a; --s-soft: #fcc9a5; }
.st-bill_requested, .tg--bill_requested { --s: var(--st-bill); --s-tint: #f7f4ff; --s-ink: #5b34c2; --s-soft: #d7ccfb; }
.st-payment_pending, .tg--payment_pending { --s: var(--st-part-paid); --s-tint: #effbf9; --s-ink: #0b6b63; --s-soft: #b3e5dd; }

/* ── Buttons & small controls ─────────────────────────────────────────────── */
.svc-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: 40px; padding: 0 1rem; border-radius: 10px; border: 1px solid var(--svc-line-strong);
  background: var(--svc-surface); color: var(--svc-ink); font: inherit; font-weight: 600; font-size: .92rem;
  cursor: pointer; transition: background-color .15s, border-color .15s, box-shadow .15s, color .15s;
  white-space: nowrap;
}
.svc-btn:hover:not(:disabled) { border-color: var(--svc-ink-3); }
.svc-btn:focus-visible { outline: none; box-shadow: var(--svc-focus); }
.svc-btn:disabled { opacity: .5; cursor: not-allowed; }
.svc-btn--primary { background: var(--svc-accent); border-color: var(--svc-accent); color: #fff; }
.svc-btn--primary:hover:not(:disabled) { background: #d45403; border-color: #d45403; }
.svc-btn--ghost { background: transparent; }
.svc-btn--danger { color: #b42318; border-color: #f5c2bd; }
.svc-btn--danger:hover:not(:disabled) { background: #fef3f2; border-color: #e5948d; }
.svc-btn--lg { min-height: 46px; min-width: 160px; }
.svc-btn--sm { min-height: 32px; padding: 0 .7rem; font-size: .84rem; border-radius: 8px; }

.svc-icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none;
  border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--svc-ink-2);
  cursor: pointer; font-size: 1.05rem; transition: background-color .15s, color .15s, border-color .15s;
}
.svc-icon-btn:hover:not(:disabled) { background: #f1f3f7; color: var(--svc-ink); }
.svc-icon-btn:focus-visible { outline: none; box-shadow: var(--svc-focus); }
.svc-icon-btn:disabled { opacity: .4; cursor: not-allowed; }
.svc-icon-btn.is-on { background: var(--svc-accent-tint); color: var(--svc-accent-ink); border-color: var(--svc-accent-line); }

.svc-link-btn {
  display: inline-flex; align-items: center; gap: .3rem; border: 0; background: none; padding: .25rem 0;
  color: var(--svc-accent-ink); font: inherit; font-size: .86rem; font-weight: 600; cursor: pointer;
}
.svc-link-btn svg { transition: transform .15s; }
.svc-link-btn .is-flipped { transform: rotate(180deg); }
.svc-link-btn:focus-visible { outline: none; box-shadow: var(--svc-focus); border-radius: 6px; }

.svc-pill {
  display: inline-flex; align-items: center; padding: .16rem .55rem; border-radius: 999px;
  background: #ffedd5; color: #c2410c; font-size: .7rem; font-weight: 700; letter-spacing: .01em;
}

.svc-segmented {
  display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 11px; background: #f1f3f7;
}
.svc-segmented button {
  display: inline-flex; align-items: center; gap: .4rem; min-height: 34px; padding: 0 .75rem;
  border: 0; border-radius: 8px; background: transparent; color: var(--svc-ink-2);
  font: inherit; font-size: .86rem; font-weight: 600; cursor: pointer; transition: background-color .15s, color .15s, box-shadow .15s;
}
.svc-segmented button.is-on { background: var(--svc-surface); color: var(--svc-ink); box-shadow: 0 1px 3px rgba(16, 24, 40, .12); }
.svc-segmented button:focus-visible { outline: none; box-shadow: var(--svc-focus); }
.svc-segmented button:disabled { cursor: not-allowed; opacity: .6; }
.svc-segmented--compact button { min-height: 30px; font-size: .82rem; }
.svc-shape-icon { fill: none; stroke: currentColor; stroke-width: 1.8; }
.svc-segmented button.is-on .svc-shape-icon { stroke: var(--svc-accent); }

.svc-switch {
  appearance: none; -webkit-appearance: none; flex: none; position: relative; width: 42px; height: 24px; margin: 0;
  border-radius: 999px; background: #cfd5df; cursor: pointer; transition: background-color .15s;
}
.svc-switch::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform .15s;
}
.svc-switch:checked { background: var(--svc-accent); }
.svc-switch:checked::after { transform: translateX(18px); }
.svc-switch:focus-visible { outline: none; box-shadow: var(--svc-focus); }
.svc-switch:disabled { opacity: .5; cursor: not-allowed; }

/* ── Service mode cards ───────────────────────────────────────────────────── */
.svc-mode-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.svc-mode-card {
  display: flex; flex-direction: column; gap: .55rem; padding: 1.15rem 1.2rem 1.25rem; text-align: left;
  background: var(--svc-surface); color: var(--svc-ink); border: 1.5px solid var(--svc-line); border-radius: 16px;
  box-shadow: var(--svc-shadow); font: inherit; cursor: pointer;
  transition: border-color .15s, box-shadow .15s, background-color .15s, transform .15s;
}
.svc-mode-card:hover:not(:disabled) { border-color: var(--svc-line-strong); transform: translateY(-1px); }
.svc-mode-card:focus-visible { outline: none; box-shadow: var(--svc-focus), var(--svc-shadow); }
.svc-mode-card.is-selected { border-color: var(--svc-accent); background: linear-gradient(180deg, var(--svc-accent-tint), #fff 70%); box-shadow: 0 0 0 3px rgba(232, 93, 4, .1), var(--svc-shadow); }
.svc-mode-card:disabled { cursor: default; opacity: .75; }
.svc-mode-top { display: flex; align-items: center; gap: .5rem; }
.svc-mode-icon {
  display: inline-grid; place-items: center; width: 46px; height: 46px; border-radius: 12px;
  background: #f3f5f8; color: var(--svc-ink-2); font-size: 1.55rem; transition: background-color .15s, color .15s;
}
.svc-mode-card.is-selected .svc-mode-icon { background: var(--svc-accent); color: #fff; }
.svc-icon-pair { display: inline-flex; align-items: center; font-size: 1.15rem; gap: 1px; }
.svc-mode-check {
  margin-left: auto; display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  border: 1.5px solid var(--svc-line-strong); color: #fff; font-size: .85rem; transition: background-color .15s, border-color .15s;
}
.svc-mode-card.is-selected .svc-mode-check { background: var(--svc-accent); border-color: var(--svc-accent); }
.svc-mode-name { font-size: 1.12rem; font-weight: 700; letter-spacing: -.01em; margin-top: .25rem; }
.svc-mode-desc { color: var(--svc-ink-2); font-size: .9rem; line-height: 1.45; }
.svc-mode-points { list-style: none; margin: .1rem 0 0; padding: 0; display: grid; gap: .3rem; }
.svc-mode-points li { position: relative; padding-left: 1.2rem; font-size: .85rem; color: var(--svc-ink); }
.svc-mode-points li::before {
  content: ''; position: absolute; left: 0; top: .42em; width: 7px; height: 7px; border-radius: 50%; background: var(--svc-accent-line);
}
.svc-mode-card.is-selected .svc-mode-points li::before { background: var(--svc-accent); }
.svc-mode-best { margin-top: auto; padding-top: .5rem; color: var(--svc-ink-3); font-size: .8rem; }

/* ── Settings page ────────────────────────────────────────────────────────── */
.svc-page { max-width: 1120px; display: flex; flex-direction: column; gap: 1.1rem; }
.svc-page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.svc-banner {
  display: flex; gap: .75rem; align-items: flex-start; padding: .85rem 1rem; border-radius: 12px;
  background: #f5f7fa; border: 1px solid var(--svc-line); color: var(--svc-ink-2); font-size: .9rem; line-height: 1.5;
}
.svc-banner svg { flex: none; margin-top: .15rem; font-size: 1.1rem; }
.svc-banner--warn { background: #fffaeb; border-color: #fde6a8; color: #7a4a04; }
.svc-banner code { background: rgba(0, 0, 0, .06); padding: .05rem .35rem; border-radius: 5px; }
.svc-card {
  background: var(--svc-surface); border: 1px solid var(--svc-line); border-radius: var(--svc-radius);
  box-shadow: var(--svc-shadow); padding: 1.1rem 1.2rem; transition: opacity .15s;
}
.svc-card.is-muted { opacity: .65; }
.svc-card-head { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; }
.svc-card-head h3 { margin: 0; font-size: 1.02rem; }
.svc-card-head p { margin: .15rem 0 0; color: var(--svc-ink-3); font-size: .88rem; }
.svc-card-icon {
  display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 11px;
  background: var(--svc-accent-tint); color: var(--svc-accent); font-size: 1.35rem;
}
.svc-card-actions { margin-left: auto; display: flex; gap: .5rem; flex-wrap: wrap; }
.svc-card-note { margin: .75rem 0 0; color: var(--svc-ink-3); font-size: .86rem; }
.svc-pref-list { display: grid; margin-top: .6rem; }
.svc-pref {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem 0;
  border-top: 1px solid var(--svc-line); cursor: pointer;
}
.svc-pref > span { display: grid; gap: .15rem; }
.svc-pref strong { font-size: .93rem; font-weight: 600; }
.svc-pref small { color: var(--svc-ink-3); font-size: .82rem; line-height: 1.4; }
.svc-actions { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.svc-status { font-size: .9rem; }
.svc-status--ok { color: #067647; }
.svc-status--error, .svc-error { color: #b42318; font-size: .88rem; }
.billing-service-entry { margin-top: .75rem; }

/* ── Dining setup wizard ──────────────────────────────────────────────────── */
.svc-setup { display: grid; grid-template-columns: minmax(320px, 440px) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.svc-setup-form { display: grid; gap: .85rem; }
.svc-area-card {
  display: grid; gap: .75rem; padding: 1rem; border: 1px solid var(--svc-line); border-radius: 14px;
  background: var(--svc-surface); transition: border-color .15s, box-shadow .15s;
}
.svc-area-card.is-active { border-color: var(--svc-accent-line); box-shadow: 0 0 0 3px rgba(232, 93, 4, .07); }
.svc-area-head { display: flex; align-items: flex-end; gap: .5rem; }
.svc-area-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .6rem; }
.svc-field { display: grid; gap: .3rem; min-width: 0; }
.svc-field--grow { flex: 1; }
.svc-field label, .svc-field-label { font-size: .76rem; font-weight: 600; color: var(--svc-ink-3); text-transform: uppercase; letter-spacing: .04em; }
.svc-field input, .svc-name-grid input, .svc-input {
  width: 100%; min-height: 38px; padding: 0 .65rem; border: 1px solid var(--svc-line-strong); border-radius: 9px;
  background: #fff; color: var(--svc-ink); font: inherit; font-size: .92rem; box-sizing: border-box;
  transition: border-color .15s, box-shadow .15s;
}
.svc-field input:focus, .svc-name-grid input:focus, .svc-input:focus { outline: none; border-color: var(--svc-accent); box-shadow: var(--svc-focus); }
.svc-stepper { display: flex; align-items: stretch; border: 1px solid var(--svc-line-strong); border-radius: 9px; overflow: hidden; background: #fff; }
.svc-stepper:focus-within { border-color: var(--svc-accent); box-shadow: var(--svc-focus); }
.svc-stepper input { border: 0 !important; box-shadow: none !important; text-align: center; min-width: 0; padding: 0 .2rem; -moz-appearance: textfield; }
.svc-stepper input::-webkit-outer-spin-button, .svc-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.svc-stepper button { flex: none; width: 30px; border: 0; background: #f5f6f9; color: var(--svc-ink-2); cursor: pointer; display: grid; place-items: center; }
.svc-stepper button:hover:not(:disabled) { background: #eceff4; }
.svc-stepper button:disabled { opacity: .35; cursor: not-allowed; }
.svc-area-foot { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.svc-range { font-size: .85rem; color: var(--svc-ink-2); font-variant-numeric: tabular-nums; }
.svc-name-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: .4rem; max-height: 220px; overflow: auto; padding: 2px; }
.svc-name-grid input { min-height: 34px; font-size: .85rem; }
.svc-add-area { display: grid; gap: .45rem; }
.svc-chip-row { display: flex; flex-wrap: wrap; gap: .45rem; }
.svc-chip {
  display: inline-flex; align-items: center; gap: .3rem; min-height: 32px; padding: 0 .75rem; border-radius: 999px;
  border: 1px dashed var(--svc-line-strong); background: #fff; color: var(--svc-ink-2); font: inherit; font-size: .84rem;
  font-weight: 600; cursor: pointer; transition: border-color .15s, color .15s, background-color .15s;
}
.svc-chip:hover:not(:disabled) { border-color: var(--svc-accent); color: var(--svc-accent-ink); background: var(--svc-accent-tint); }
.svc-chip:focus-visible { outline: none; box-shadow: var(--svc-focus); }
.svc-chip--ghost { border-style: solid; }
.svc-setup-preview {
  position: sticky; top: 1rem; display: grid; gap: .7rem; padding: 1rem; border-radius: 16px;
  background: var(--svc-canvas); border: 1px solid var(--svc-line);
}
.svc-preview-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.svc-preview-total { font-size: .85rem; color: var(--svc-ink-3); font-variant-numeric: tabular-nums; }
.svc-tabs { display: flex; flex-wrap: wrap; gap: .3rem; }
.svc-tabs button {
  min-height: 32px; padding: 0 .8rem; border-radius: 999px; border: 1px solid transparent; background: transparent;
  color: var(--svc-ink-2); font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer;
}
.svc-tabs button.is-on { background: #fff; border-color: var(--svc-line); color: var(--svc-ink); box-shadow: 0 1px 2px rgba(16, 24, 40, .06); }
.svc-tabs button:focus-visible { outline: none; box-shadow: var(--svc-focus); }
.svc-problems { margin: 0; padding: .7rem .9rem .7rem 1.9rem; border-radius: 10px; background: #fef3f2; color: #b42318; font-size: .86rem; display: grid; gap: .25rem; }
.svc-empty { display: grid; place-items: center; min-height: 260px; color: var(--svc-ink-3); font-size: .9rem; text-align: center; padding: 1rem; }

/* ── Modal ────────────────────────────────────────────────────────────────── */
.svc-modal-overlay {
  position: fixed; inset: 0; z-index: 1200; display: grid; place-items: center; padding: 16px;
  background: rgba(15, 20, 30, .45); animation: svc-fade .15s ease-out;
}
.svc-modal {
  width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column;
  background: var(--svc-surface); color: var(--svc-ink); border-radius: 18px; box-shadow: 0 24px 60px rgba(15, 20, 30, .28);
  animation: svc-rise .18s ease-out;
}
.svc-modal--wide { width: min(1180px, 100%); }
.svc-modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1.2rem 1.35rem .9rem; border-bottom: 1px solid var(--svc-line); }
.svc-modal-head h2 { margin: 0; font-size: 1.2rem; }
.svc-modal-head p { margin: .3rem 0 0; color: var(--svc-ink-3); font-size: .9rem; }
.svc-modal-body { padding: 1.1rem 1.35rem; overflow: auto; }
.svc-modal-foot { display: flex; justify-content: flex-end; align-items: center; gap: .6rem; flex-wrap: wrap; padding: .9rem 1.35rem 1.1rem; border-top: 1px solid var(--svc-line); }
.svc-modal-foot .svc-error { margin-right: auto; }
@keyframes svc-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes svc-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ── Floor drawing (shared by wizard, designer and live floor) ────────────── */
.flr-preview { margin: 0; display: grid; gap: .5rem; }
.flr-preview svg { width: 100%; height: auto; max-height: 520px; display: block; }
.flr-preview figcaption { color: var(--svc-ink-3); font-size: .8rem; text-align: center; }
.flr-plate { fill: #ffffff; stroke: var(--svc-line); stroke-width: 1.5; }
.flr-grid-minor { fill: none; stroke: #eef1f5; stroke-width: 1; }
.flr-grid-major { fill: none; stroke: #e2e7ee; stroke-width: 1; }

.tg { transition: opacity .15s; }
/* The --s* colours come from the tg--<state> class; designer tables fall back to neutral. */
.tg-body { fill: var(--s-tint, #fff); stroke: var(--s, #a7b0be); stroke-width: 2; transition: fill .2s, stroke .2s, stroke-width .15s; }
.tg-chair rect { fill: #e7ebf1; stroke: #c3cad6; stroke-width: 1; }
.tg-chair .tg-chair-back { fill: #b9c1ce; stroke: none; }
.tg-bench { fill: #dfe4ec; stroke: #b9c1ce; stroke-width: 1; }
.tg-name { fill: var(--svc-ink); font-weight: 700; font-family: inherit; letter-spacing: -.01em; }
.tg-detail { fill: var(--svc-ink-3); font-weight: 500; font-family: inherit; font-variant-numeric: tabular-nums; }
.tg-detail--lead { fill: var(--s-ink, var(--svc-ink-3)); font-weight: 600; }
.tg-label { pointer-events: none; }
.tg-halo { fill: rgba(232, 93, 4, .06); stroke: var(--svc-accent); stroke-width: 1.5; stroke-dasharray: 6 5; }
.tg.is-selected .tg-body { stroke: var(--svc-accent); stroke-width: 2.5; }
.tg.is-invalid .tg-body { fill: #fef3f2; stroke: #d92d20; stroke-width: 2.5; }
.tg.is-invalid .tg-chair rect { fill: #fde2df; stroke: #f4a49c; }
.tg.is-dimmed { opacity: .35; }

/* State treatments (live floor, and the designer's preview mode) */
.tg-chair.is-seated rect { fill: var(--s-soft); stroke: var(--s); }
.tg-chair.is-seated .tg-chair-back { fill: var(--s); }
.tg-bench.is-seated { fill: var(--s-soft); stroke: var(--s); }
.tg-pattern { stroke: none; pointer-events: none; }
.tg--reservation_due .tg-body { stroke-width: 2.75; }
.tg--reservation_late .tg-body { fill: var(--s); stroke: var(--s-ink); }
.tg--reservation_late .tg-name, .tg--reservation_late .tg-detail, .tg--reservation_late .tg-detail--lead { fill: #fff; }
.tg--cleaning .tg-body { stroke-dasharray: 6 4; }

@media (max-width: 1100px) {
  .svc-setup { grid-template-columns: 1fr; }
  .svc-setup-preview { position: static; }
}
@media (max-width: 860px) {
  .svc-mode-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .svc-area-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .svc-card-actions { margin-left: 0; width: 100%; }
  .svc-card-actions .svc-btn { flex: 1; }
  .svc-modal-body, .svc-modal-head, .svc-modal-foot { padding-left: 1rem; padding-right: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  .svc-mode-card, .svc-modal, .svc-modal-overlay, .tg-body { transition: none; animation: none; }
}

/* Billing & Stock Settings entry card */
.billing-service-entry { margin-top: .75rem; }
.billing-service-entry .billing-theme-entry-preview { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.billing-service-entry .billing-theme-entry-preview i { border-radius: 50%; background: #ffe8d4; }
.billing-service-entry .billing-theme-entry-preview i:first-child { grid-row: auto; background: #f97316; }

/* Onboarding: the service and dining steps need more room than the form steps */
.onboarding-container.onboarding-container--wide { max-width: 1120px; }
.onboarding-container .svc-mode-grid { margin-top: 1.25rem; }
.onboarding-container .svc-setup { margin-top: 1.25rem; text-align: left; }
.onboarding-container .svc-field label, .onboarding-container .svc-field-label { margin: 0; }
.onboarding-container .svc-field input { margin: 0; }
.onboarding-later { margin-top: .9rem; }
@media (max-width: 640px) {
  .onboarding-container.onboarding-container--wide { padding: 1.5rem 1rem; }
}

/* ── Floor Designer ───────────────────────────────────────────────────────── */
.fd-page { max-width: none; display: flex; flex-direction: column; gap: .9rem; }
.fd-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.fd-head h2 { margin: 0; }
.fd-head-actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.fd-head-actions .svc-btn.is-on { background: #1d2330; border-color: #1d2330; color: #fff; }
.fd-chip {
  display: inline-flex; align-items: center; min-height: 30px; padding: 0 .75rem; border-radius: 999px;
  background: #ecfdf3; color: #067647; font-size: .8rem; font-weight: 600; font-variant-numeric: tabular-nums;
}
.fd-chip.is-dirty { background: #fffaeb; color: #93370d; }
.fd-notice {
  display: flex; align-items: center; gap: .75rem; padding: .6rem .6rem .6rem 1rem; border-radius: 12px; font-size: .9rem;
  background: #f5f7fa; border: 1px solid var(--svc-line); color: var(--svc-ink-2);
}
.fd-notice > span { flex: 1; }
.fd-notice--ok { background: #ecfdf3; border-color: #abefc6; color: #05603a; }
.fd-notice--warn { background: #fffaeb; border-color: #fde6a8; color: #7a4a04; }
.fd-notice--error { background: #fef3f2; border-color: #fecdca; color: #b42318; }
.fd-workspace { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1rem; align-items: stretch; }
.fd-stage {
  display: flex; flex-direction: column; min-width: 0; background: var(--svc-surface); border: 1px solid var(--svc-line);
  border-radius: 16px; box-shadow: var(--svc-shadow); overflow: hidden;
}
.fd-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: .6rem; flex-wrap: wrap;
  padding: .55rem .65rem; border-bottom: 1px solid var(--svc-line); background: #fbfcfd;
}
.fd-area-tabs { align-items: center; }
.fd-count { margin-left: .3rem; padding: 0 .4rem; border-radius: 999px; background: #eef1f5; color: var(--svc-ink-3); font-size: .72rem; }
.fd-add-area {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 999px; border: 1px dashed var(--svc-line-strong);
  background: #fff; color: var(--svc-ink-2); cursor: pointer;
}
.fd-add-area:hover { border-color: var(--svc-accent); color: var(--svc-accent); }
.fd-tool-group { display: flex; align-items: center; gap: .15rem; flex-wrap: wrap; }
.fd-tool-group .svc-btn.is-on { background: var(--svc-accent-tint); border-color: var(--svc-accent-line); color: var(--svc-accent-ink); }
.fd-sep { width: 1px; height: 22px; background: var(--svc-line); margin: 0 .3rem; }
.fd-zoom { min-width: 46px; text-align: center; font-size: .82rem; font-weight: 600; color: var(--svc-ink-2); font-variant-numeric: tabular-nums; }
.fd-canvas-wrap {
  position: relative; flex: 1; height: max(480px, calc(100vh - 330px)); background: var(--svc-canvas);
  outline: none; touch-action: none; user-select: none; -webkit-user-select: none; cursor: default;
}
.fd-canvas-wrap:focus-visible { box-shadow: inset 0 0 0 2px rgba(232, 93, 4, .35); }
.fd-canvas-wrap.is-panning, .fd-canvas-wrap.is-preview { cursor: grab; }
.fd-canvas-wrap.is-panning:active, .fd-canvas-wrap.is-preview:active { cursor: grabbing; }
.fd-canvas { display: block; }
.fd-table { cursor: move; }
.fd-canvas-wrap.is-panning .fd-table, .fd-canvas-wrap.is-preview .fd-table { cursor: inherit; }
.fd-handle { fill: #fff; stroke: var(--svc-accent); stroke-width: 1.5; vector-effect: non-scaling-stroke; cursor: nwse-resize; }
.fd-handle--rotate { cursor: grab; }
.fd-rotate-stem { stroke: var(--svc-accent); stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.fd-guide { stroke: #ef4444; vector-effect: non-scaling-stroke; pointer-events: none; }
.fd-guide--spacing { stroke: #2563eb; stroke-dasharray: 4 3; }
.fd-marquee { fill: rgba(232, 93, 4, .07); stroke: var(--svc-accent); vector-effect: non-scaling-stroke; stroke-dasharray: 5 4; pointer-events: none; }
.fd-join rect { fill: rgba(124, 58, 237, .04); stroke: #a78bfa; stroke-width: 1.5; stroke-dasharray: 8 6; }
.fd-join text { fill: #7c3aed; font-weight: 700; font-family: inherit; }
.fd-open-dot { fill: var(--st-occupied); stroke: #fff; stroke-width: 2; }
.fd-hint { margin: 0; padding: .5rem .8rem; color: var(--svc-ink-3); font-size: .76rem; border-top: 1px solid var(--svc-line); background: #fbfcfd; }
.fd-panel {
  display: flex; flex-direction: column; gap: .8rem; max-height: calc(100vh - 190px); overflow: auto;
}
.fd-section {
  display: grid; gap: .65rem; padding: 1rem; background: var(--svc-surface); border: 1px solid var(--svc-line);
  border-radius: 14px; box-shadow: var(--svc-shadow);
}
.fd-section h3 { margin: 0 0 .1rem; font-size: 1rem; }
.fd-row { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; }
.fd-shapes button { flex: 1; justify-content: center; }
.fd-shape-add { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
.fd-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.fd-icon-row { display: flex; flex-wrap: wrap; gap: .2rem; }
.fd-note { margin: 0; display: flex; align-items: center; gap: .35rem; font-size: .82rem; color: var(--svc-ink-3); line-height: 1.4; }
.fd-note--live { color: #9a3412; }
.fd-table-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .25rem; max-height: 280px; overflow: auto; }
.fd-table-list button {
  width: 100%; display: flex; align-items: center; gap: .5rem; padding: .45rem .6rem; border: 1px solid transparent; border-radius: 9px;
  background: #f7f8fa; color: var(--svc-ink); font: inherit; font-size: .86rem; cursor: pointer; text-align: left;
}
.fd-table-list button:hover { border-color: var(--svc-line-strong); }
.fd-table-list button:focus-visible { outline: none; box-shadow: var(--svc-focus); }
.fd-table-list button span { color: var(--svc-ink-3); font-size: .8rem; }
.fd-table-list button em { margin-left: auto; font-style: normal; font-size: .72rem; font-weight: 700; color: #9a3412; }
.fd-table-list button.is-invalid { border-color: #fecdca; background: #fef3f2; }
.fd-muted { color: var(--svc-ink-3); font-size: .85rem; padding: .3rem; }
.fd-issues-toggle {
  display: flex; align-items: center; gap: .45rem; border: 0; background: none; padding: 0; font: inherit; font-weight: 600;
  font-size: .9rem; color: var(--svc-ink); cursor: pointer; text-align: left;
}
.fd-issues ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .3rem; }
.fd-issue button { width: 100%; text-align: left; border: 0; border-radius: 8px; padding: .45rem .6rem; font: inherit; font-size: .82rem; cursor: pointer; }
.fd-issue--error button { background: #fef3f2; color: #b42318; }
.fd-issue--warning button { background: #fffaeb; color: #93370d; }
.fd-empty {
  display: grid; justify-items: center; gap: .6rem; text-align: center; padding: 3rem 1.5rem; border-radius: 18px;
  background: var(--svc-surface); border: 1px dashed var(--svc-line-strong);
}
.fd-empty h3 { margin: 0; font-size: 1.15rem; }
.fd-empty p { margin: 0; max-width: 460px; color: var(--svc-ink-3); }
.fd-empty-icon { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 18px; background: var(--svc-accent-tint); color: var(--svc-accent); font-size: 2rem; }
.fd-empty-actions { display: flex; gap: .6rem; flex-wrap: wrap; justify-content: center; margin-top: .4rem; }
@media (max-width: 1100px) {
  .fd-workspace { grid-template-columns: 1fr; }
  .fd-panel { max-height: none; }
  .fd-canvas-wrap { height: max(420px, 60vh); }
}
.fd-shapes { display: grid; grid-template-columns: 1fr 1fr; }
/* Designer notices float above the page so the canvas never jumps. */
.fd-notice {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 1100;
  width: max-content; max-width: min(680px, calc(100vw - 32px)); box-shadow: 0 12px 32px rgba(15, 20, 30, .18);
  animation: svc-rise .18s ease-out;
}

/* ── POS header: four workspace buttons on phones ─────────────────────────── */
@media (max-width: 768px) {
  .nav-buttons.nav-buttons--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ── Live table floor ─────────────────────────────────────────────────────── */
.app-container.screen-mode.lf-screen { max-width: 1600px; display: flex; flex-direction: column; gap: .75rem; }
.lf-root { width: 100%; display: flex; flex-direction: column; gap: .75rem; min-width: 0; }

/* Toolbar: areas and view controls on top, status filters below */
.lf-bar {
  display: grid; background: var(--svc-surface); border: 1px solid var(--svc-line); border-radius: 14px; box-shadow: var(--svc-shadow);
}
.lf-bar-top { display: flex; align-items: center; justify-content: space-between; gap: .6rem .75rem; flex-wrap: wrap; padding: .6rem .7rem; }
.lf-areas { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 11px; background: #f1f3f7; }
.lf-areas button {
  display: inline-flex; align-items: center; gap: .5rem; min-height: 32px; padding: 0 .8rem; border: 0; border-radius: 8px;
  background: transparent; color: var(--svc-ink-2); font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer;
  transition: background-color .15s, color .15s, box-shadow .15s;
}
.lf-areas button:hover:not(.is-on) { color: var(--svc-ink); }
.lf-areas button.is-on { background: var(--svc-surface); color: var(--svc-ink); box-shadow: 0 1px 3px rgba(16, 24, 40, .12); }
.lf-areas button:focus-visible { outline: none; box-shadow: var(--svc-focus); }
.lf-area-count { color: var(--svc-ink-3); font-size: .76rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.lf-area-title { display: flex; align-items: baseline; gap: .6rem; min-width: 0; padding-left: .2rem; }
.lf-area-title h2 { margin: 0; font-size: 1.1rem; font-weight: 700; letter-spacing: -.01em; color: var(--svc-ink); }
.lf-area-title span { color: var(--svc-ink-3); font-size: .84rem; font-variant-numeric: tabular-nums; }
.lf-bar-actions { display: flex; align-items: center; gap: .5rem; }

.lf-legend {
  display: flex; align-items: center; flex-wrap: wrap; gap: .3rem 1.25rem; padding: .45rem .55rem;
  border-top: 1px solid var(--svc-line);
}
.lf-legend-group { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; }
.lf-legend-label { margin: 0 .35rem 0 .2rem; color: var(--svc-ink-3); font-size: .74rem; font-weight: 600; white-space: nowrap; }
.lf-chip-x { flex: none; width: 10px; height: 10px; stroke-width: 3.5; }
.lf-chip {
  display: inline-flex; align-items: center; gap: .45rem; min-height: 30px; padding: 0 .55rem; border-radius: 8px;
  border: 1px solid transparent; background: transparent; color: var(--svc-ink-2);
  font: inherit; font-size: .8rem; font-weight: 600; white-space: nowrap; cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
}
.lf-chip b { min-width: .7em; color: var(--svc-ink); font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.lf-chip:hover:not(:disabled):not(.is-on) { background: #f3f5f8; }
.lf-chip:focus-visible { outline: none; box-shadow: var(--svc-focus); }
.lf-chip.is-on { background: var(--s-tint); border-color: var(--s); color: var(--s-ink); }
.lf-chip.is-on b { color: var(--s-ink); }
.lf-chip.is-zero { color: var(--svc-ink-3); }
.lf-chip.is-zero b { color: #b8bfca; font-weight: 600; }
.lf-chip.is-zero .lf-swatch { opacity: .4; }
.lf-chip:disabled { cursor: default; }

/* Legend dot. The three "hold" states share red and differ the way the
   floor draws them: hatched, outlined, solid. */
.lf-swatch {
  flex: none; display: inline-block; width: 10px; height: 10px; border-radius: 50%; box-sizing: border-box; background: var(--s);
}
.lf-swatch.st-available { background: transparent; border: 2px solid var(--s); }
.lf-swatch.st-cleaning { background: transparent; border: 1.5px dashed var(--s); }
.lf-swatch.st-reservation_blocked {
  border: 1.5px solid var(--s);
  background: repeating-linear-gradient(135deg, var(--s) 0 1.5px, transparent 1.5px 3.5px), var(--s-tint);
}
.lf-swatch.st-reservation_due { background: var(--s-tint); border: 2.5px solid var(--s); }

/* Floor */
.lf-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: .75rem; align-items: start; }
.lf-canvas {
  display: flex; height: max(440px, calc(100vh - 270px)); padding: .5rem;
  background: var(--svc-surface); border: 1px solid var(--svc-line); border-radius: 16px; box-shadow: var(--svc-shadow);
}
.lf-canvas svg { width: 100%; height: 100%; display: block; }
.lf-canvas .flr-plate { fill: #f5f6f8; stroke: #e7eaef; stroke-width: 1; }
.lf-canvas .tg-chair rect { fill: #ffffff; stroke: #cdd3dc; }
.lf-canvas .tg-chair .tg-chair-back { fill: #cdd3dc; }
.lf-canvas .tg-bench { fill: #ffffff; stroke: #cdd3dc; }
.lf-canvas .tg-chair.is-seated rect { fill: var(--s-soft); stroke: var(--s); }
.lf-canvas .tg-chair.is-seated .tg-chair-back { fill: var(--s); }
.lf-canvas .tg-bench.is-seated { fill: var(--s-soft); stroke: var(--s); }
.lf-canvas .tg-body { filter: drop-shadow(0 1px 1.5px rgba(16, 24, 40, .07)); }
.lf-canvas .tg.is-dimmed { opacity: .22; }
.lf-hatch { fill: var(--st-hold); opacity: .16; }
.lf-canvas svg { -webkit-user-select: none; user-select: none; }
.lf-table { cursor: pointer; outline: none; -webkit-tap-highlight-color: transparent; }
.lf-table.is-focus .tg-body { stroke: var(--s-ink); stroke-width: 2.75; filter: drop-shadow(0 4px 10px rgba(16, 24, 40, .13)); }
.lf-table:focus-visible .tg-body { stroke: var(--svc-ink); stroke-width: 3; }
.lf-table.is-busy { cursor: progress; }
.lf-table.is-busy .tg { opacity: .5; }

/* Side panel */
.lf-side { position: sticky; top: 1rem; display: grid; gap: .75rem; align-content: start; }
.lf-summary, .lf-detail {
  padding: 1rem; background: var(--svc-surface); border: 1px solid var(--svc-line); border-radius: 14px; box-shadow: var(--svc-shadow);
}
.lf-summary h3 { margin: 0 0 .65rem; color: var(--svc-ink-3); font-size: .8rem; font-weight: 600; }
.lf-stats { margin: 0; display: grid; grid-template-columns: 1fr 1fr 1.35fr; gap: .5rem; }
.lf-stats > div { display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: .15rem; min-width: 0; }
.lf-stats > div + div { padding-left: .6rem; border-left: 1px solid var(--svc-line); }
.lf-stats dt { color: var(--svc-ink-3); font-size: .74rem; white-space: nowrap; }
.lf-stats dd {
  margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--svc-ink); font-size: 1.3rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums;
}
.lf-stats dd small { color: var(--svc-ink-3); font-size: .82rem; font-weight: 600; letter-spacing: 0; }

.lf-detail { display: grid; gap: .85rem; animation: svc-rise .14s ease-out; }
.lf-detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; }
.lf-detail-title { min-width: 0; }
.lf-detail-title h3 { margin: 0; color: var(--svc-ink); font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.lf-detail-title p { margin: .25rem 0 0; color: var(--svc-ink-3); font-size: .84rem; }
.lf-status {
  display: inline-flex; align-items: center; gap: .4rem; flex: none; margin-top: .15rem; padding: .28rem .6rem; border-radius: 999px;
  background: var(--s-tint); color: var(--s-ink); box-shadow: inset 0 0 0 1px var(--s-soft);
  font-size: .76rem; font-weight: 700; white-space: nowrap;
}
.lf-status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--s); }
.st-available .lf-status { background: #f6f7f9; }
.st-available .lf-status::before { background: transparent; box-shadow: inset 0 0 0 1.5px var(--s); }
.st-reservation_late .lf-status { background: var(--s); color: #fff; box-shadow: none; }
.st-reservation_late .lf-status::before { background: #fff; }
.lf-detail-total { display: grid; gap: .1rem; padding: .7rem .85rem; border-radius: 11px; background: #f7f8fa; }
.lf-detail-total span { color: var(--svc-ink-3); font-size: .76rem; font-weight: 600; }
.lf-detail-total strong { color: var(--svc-ink); font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.lf-detail-total small { color: var(--st-part-paid); font-size: .78rem; font-weight: 600; }
.lf-detail-note { display: flex; align-items: center; gap: .4rem; margin: 0; color: var(--svc-ink-3); font-size: .85rem; line-height: 1.45; }
.lf-detail-action { width: 100%; min-height: 46px; }
.lf-booking { display: grid; gap: .3rem; padding: .7rem .85rem; border-radius: 11px; background: var(--s-tint); box-shadow: inset 0 0 0 1px var(--s-soft); }
.lf-booking-time { display: flex; align-items: center; gap: .45rem; color: var(--s-ink); }
.lf-booking-time strong { font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.lf-booking-time span { margin-left: auto; font-size: .8rem; font-weight: 600; }
.lf-booking-name { margin: 0; color: var(--svc-ink); font-size: .95rem; font-weight: 600; overflow-wrap: anywhere; }
.lf-booking .lf-detail-note { color: var(--svc-ink-2); }
.lf-facts { margin: 0; display: grid; }
.lf-facts > div { display: flex; justify-content: space-between; gap: .75rem; padding: .45rem 0; border-top: 1px solid var(--svc-line); font-size: .88rem; }
.lf-facts > div:first-child { border-top: 0; padding-top: 0; }
.lf-facts dt { display: inline-flex; align-items: center; gap: .4rem; color: var(--svc-ink-3); }
.lf-facts dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; overflow-wrap: anywhere; }
.lf-hint {
  display: grid; gap: .45rem; padding: .9rem 1rem; border: 1px dashed var(--svc-line-strong); border-radius: 14px;
  color: var(--svc-ink-3); font-size: .84rem; line-height: 1.45;
}
.lf-hint p { margin: 0; }
.lf-hint p:first-child { color: var(--svc-ink-2); }
.lf-side-detail { display: grid; gap: .75rem; align-content: start; }
.lf-edit-link { justify-self: start; padding-left: .2rem; }

/* List view */
.lf-list { display: grid; gap: 1rem; }
.lf-list h3 { margin: 0 0 .5rem; font-size: .95rem; color: var(--svc-ink-2); }
.lf-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .6rem; }
.lf-card {
  position: relative; display: grid; align-content: start; gap: .2rem; padding: .8rem .85rem .85rem 1.05rem; text-align: left; min-height: 104px;
  background: var(--svc-surface); border: 1px solid var(--svc-line); border-radius: 14px; box-shadow: var(--svc-shadow);
  font: inherit; color: var(--svc-ink); cursor: pointer; overflow: hidden; transition: border-color .15s, transform .15s, opacity .15s;
}
.lf-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--s); }
.lf-card:hover:not(:disabled) { border-color: var(--svc-line-strong); transform: translateY(-1px); }
.lf-card:focus-visible { outline: none; box-shadow: var(--svc-focus); }
.lf-card:disabled { cursor: progress; opacity: .6; }
.lf-card.is-dimmed { opacity: .3; }
.lf-card.st-reservation_late { background: var(--s-tint); }
.lf-card-name { font-size: 1.2rem; font-weight: 700; letter-spacing: -.01em; }
.lf-card-status { display: inline-flex; align-items: center; gap: .4rem; color: var(--s-ink); font-size: .76rem; font-weight: 600; line-height: 1.3; }
.lf-card-status .lf-swatch { width: 8px; height: 8px; }
.lf-card-total { margin-top: .3rem; font-size: 1.05rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.lf-card-meta { display: inline-flex; align-items: center; gap: .3rem; color: var(--svc-ink-3); font-size: .8rem; }

.lf-empty {
  display: grid; justify-items: center; gap: .6rem; text-align: center; padding: 3rem 1rem; background: var(--svc-surface);
  border: 1px dashed var(--svc-line-strong); border-radius: 18px; color: var(--svc-ink-2);
}
.lf-empty h3 { margin: 0; }
.lf-empty p { margin: 0; max-width: 420px; }
.lf-inline-error { padding: .55rem .8rem; border-radius: 10px; background: #fef3f2; color: #b42318; font-size: .86rem; }
.lf-notice { width: 100%; }
.svc-icon-btn.is-spinning svg { animation: svc-spin .8s linear infinite; }

/* Reservations */
.rv-root { display: grid; gap: .8rem; width: 100%; }
.rv-head { display: flex; align-items: center; gap: 1rem; padding: .85rem 1rem; background: #fff; border: 1px solid var(--svc-line); border-radius: 14px; }
.rv-head > div { flex: 1; }.rv-head h2 { margin: 0; font-size: 1.25rem; }.rv-head p { margin: .2rem 0 0; color: var(--svc-ink-3); font-size: .82rem; }
.rv-toolbar { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; }
.rv-toolbar label { display: flex; align-items: center; gap: .4rem; background: #fff; border: 1px solid var(--svc-line); border-radius: 10px; padding: .35rem .6rem; }
.rv-toolbar input { border: 0; outline: 0; font: inherit; background: transparent; }.rv-search { margin-left: auto; min-width: min(320px,100%); }.rv-search input { width: 100%; }
.rv-list { display: grid; gap: .55rem; }.rv-card { display: grid; grid-template-columns: 100px minmax(180px,1fr) auto auto; align-items: center; gap: 1rem; padding: .85rem 1rem; background: #fff; border: 1px solid var(--svc-line); border-left: 5px solid #3b82f6; border-radius: 13px; }
.rv-card--warning { border-left-color: #d97706; background: #fffcf3; }.rv-card--blocked,.rv-card--due,.rv-card--late { border-left-color: #dc2626; background: #fff8f8; }.rv-card--inactive { border-left-color: #94a3b8; opacity: .72; }
.rv-time { display: grid; }.rv-time strong { font-size: 1.05rem; }.rv-time span,.rv-main small { color: var(--svc-ink-3); font-size: .78rem; }.rv-main h3,.rv-main p { margin: 0; }.rv-main p { display: flex; align-items: center; gap: .25rem; margin-top: .2rem; color: var(--svc-ink-2); font-size: .86rem; }.rv-status { text-transform: capitalize; font-weight: 700; font-size: .8rem; }.rv-actions { display: flex; gap: .35rem; flex-wrap: wrap; justify-content: flex-end; }
.rv-modal { width: min(720px,calc(100vw - 2rem)); }.rv-form { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .8rem; }.rv-form label,.rv-setting { display: grid; gap: .3rem; color: var(--svc-ink-2); font-size: .82rem; font-weight: 600; }.rv-form input,.rv-form select,.rv-form textarea,.rv-setting input { min-height: 40px; border: 1px solid var(--svc-line-strong); border-radius: 9px; padding: .45rem .6rem; font: inherit; background: #fff; }.rv-form textarea { min-height: 72px; resize: vertical; }.rv-wide { grid-column: 1/-1; }
.rv-settings-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(190px,1fr)); gap: .8rem; margin: 1rem 0; }.rv-setting input { width: 100%; }
@media(max-width:760px){.rv-card{grid-template-columns:80px 1fr}.rv-status{grid-column:1}.rv-actions{grid-column:2;justify-content:flex-start}.rv-head{align-items:flex-start;flex-wrap:wrap}.rv-form{grid-template-columns:1fr}.rv-wide{grid-column:auto}.rv-search{margin-left:0;width:100%}}
@keyframes svc-spin { to { transform: rotate(360deg); } }
@media (max-width: 1000px) {
  /* Stacked: service summary first, then the floor, then the table details */
  .lf-body { grid-template-columns: minmax(0, 1fr); grid-template-areas: 'summary' 'main' 'detail'; }
  .lf-body > .lf-canvas, .lf-body > .lf-list { grid-area: main; }
  .lf-side { display: contents; }
  .lf-summary { grid-area: summary; }
  .lf-side-detail { grid-area: detail; }
  /* Let the room's own proportions set the height instead of letterboxing it */
  .lf-canvas { display: block; height: auto; }
  .lf-canvas svg { height: auto; max-height: 75vh; }
}
@media (hover: none) {
  .lf-hint p:first-child { display: none; }
}
@media (max-width: 720px) {
  /* One swipeable row of filters instead of five wrapped lines; the fade shows there is more */
  .lf-legend {
    flex-wrap: nowrap; overflow-x: auto; padding-right: 2rem; scrollbar-width: none; overscroll-behavior-x: contain;
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 2.5rem), transparent);
    mask-image: linear-gradient(90deg, #000 calc(100% - 2.5rem), transparent);
  }
  .lf-legend::-webkit-scrollbar { display: none; }
  .lf-legend-group { flex-wrap: nowrap; }
  .lf-bar-top { padding: .55rem; }
  .lf-bar-actions { width: 100%; }
  .lf-bar-actions .svc-segmented { margin-left: auto; }
  .lf-areas { max-width: 100%; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .lf-areas button { flex: none; }
  .lf-summary { padding: .8rem .9rem; }
  .lf-summary h3 { margin-bottom: .5rem; }
  .lf-stats dd { font-size: 1.2rem; }
  .lf-hint { display: none; }
  /* Keep tables legible on a phone: the floor keeps a readable size and pans sideways */
  .lf-canvas { overflow-x: auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
  .lf-canvas svg { width: max(100%, 720px); max-width: none; max-height: none; }
  .lf-cards { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .5rem; }
  .lf-card { min-height: 96px; padding: .7rem .75rem .75rem .95rem; }
}
@media (prefers-reduced-motion: reduce) {
  .lf-detail, .lf-chip, .lf-card, .lf-areas button { animation: none; transition: none; }
}

/* ── Table billing panel (sits where the counter's Current Order is) ──────── */
.tb-panel { position: relative; }
.tb-head { display: flex; align-items: center; gap: .6rem; }
.tb-back {
  display: inline-flex; align-items: center; gap: .3rem; min-height: 34px; padding: 0 .6rem; border-radius: 9px;
  border: 1px solid var(--svc-line); background: #fff; color: var(--svc-ink-2); font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer;
}
.tb-back:hover { border-color: var(--svc-line-strong); color: var(--svc-ink); }
.tb-title { display: grid; line-height: 1.15; min-width: 0; }
.tb-title strong { font-size: 1.2rem; letter-spacing: -.01em; }
.tb-title span { font-size: .78rem; color: var(--svc-ink-3); font-weight: 500; }
.tb-head-actions { position: relative; margin-left: auto; }
.tb-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 250px; padding: .35rem;
  background: #fff; border: 1px solid var(--svc-line); border-radius: 12px; box-shadow: 0 14px 34px rgba(15, 20, 30, .16);
  display: grid; animation: svc-rise .12s ease-out;
}
.tb-menu button {
  display: flex; align-items: center; gap: .55rem; padding: .6rem .65rem; border: 0; border-radius: 8px; background: none;
  color: var(--svc-ink); font: inherit; font-size: .88rem; text-align: left; cursor: pointer;
}
.tb-menu button:hover:not(:disabled) { background: #f4f6f9; }
.tb-menu button:disabled { opacity: .45; cursor: not-allowed; }
.tb-menu button.is-danger { color: #b42318; }
.tb-menu hr { border: 0; border-top: 1px solid var(--svc-line); margin: .25rem 0; }
.tb-facts { display: flex; flex-wrap: wrap; gap: .35rem; padding: .55rem .9rem; border-bottom: 1px solid var(--svc-line); }
.tb-fact {
  display: inline-flex; align-items: center; gap: .35rem; min-height: 28px; padding: 0 .6rem; border-radius: 999px;
  border: 1px solid var(--svc-line); background: #fafbfc; color: var(--svc-ink-2); font: inherit; font-size: .8rem; font-weight: 600;
}
button.tb-fact { cursor: pointer; }
button.tb-fact:hover:not(:disabled) { border-color: var(--svc-line-strong); color: var(--svc-ink); }
.tb-fact--bill { background: #f5f1ff; border-color: #ddd6fe; color: #5b21b6; }
.tb-checks { padding: .45rem .7rem; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; border-bottom: 1px solid var(--svc-line); }
.tb-checks button { flex: none; border-color: var(--svc-line); background: #f7f8fa; }
.tb-checks button.is-on { border-color: var(--svc-accent); background: var(--svc-accent); color: #fff; box-shadow: 0 2px 6px rgba(232, 93, 4, .24); }
.tb-checks button.is-paid { color: #067647; }
.tb-checks button.is-on.is-paid { color: #fff; }
.tb-message {
  display: flex; align-items: center; gap: .5rem; margin: .5rem .7rem 0; padding: .45rem .45rem .45rem .75rem; border-radius: 10px;
  font-size: .85rem; background: #f5f7fa; color: var(--svc-ink-2);
}
.tb-message > span { flex: 1; }
.tb-message--ok { background: #ecfdf3; color: #05603a; }
.tb-message--warn { background: #fffaeb; color: #7a4a04; }
.tb-message--error { background: #fef3f2; color: #b42318; }
.tb-lines { display: flex; flex-direction: column; gap: .7rem; }
.tb-kot, .tb-draft { display: grid; gap: .1rem; }
.tb-kot header, .tb-draft header {
  display: flex; align-items: center; gap: .5rem; padding: .25rem 0; font-size: .74rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em; color: var(--svc-ink-3); border-bottom: 1px solid var(--svc-line);
}
.tb-kot header span:nth-child(2) { margin-left: auto; text-transform: none; letter-spacing: 0; font-weight: 500; }
.tb-draft header span:last-child { margin-left: auto; text-transform: none; letter-spacing: 0; color: var(--svc-accent-ink); }
.tb-draft { padding: .5rem .6rem; border: 1px dashed var(--svc-accent-line); border-radius: 12px; background: var(--svc-accent-tint); }
.tb-draft header { color: var(--svc-accent-ink); border-bottom-color: var(--svc-accent-line); }
.tb-line { display: grid; grid-template-columns: 2.4rem minmax(0, 1fr) auto 28px; align-items: center; gap: .4rem; padding: .4rem 0; font-size: .92rem; }
.tb-line-qty { font-weight: 700; color: var(--svc-ink-2); font-variant-numeric: tabular-nums; }
.tb-line-name { min-width: 0; overflow-wrap: anywhere; }
.tb-line-name small { color: var(--svc-ink-3); }
.tb-line-note { display: block; font-style: italic; }
.tb-line-amount { font-variant-numeric: tabular-nums; font-weight: 600; }
.tb-line.is-void { opacity: .5; text-decoration: line-through; }
.tb-mini { width: 28px; height: 28px; font-size: .9rem; }
.tb-void-note { margin: 0; font-size: .78rem; color: var(--svc-ink-3); }
.tb-note {
  margin-top: .3rem; width: 100%; min-height: 28px; padding: 0 .5rem; border: 1px solid var(--svc-accent-line); border-radius: 7px;
  background: #fff; font: inherit; font-size: .8rem; box-sizing: border-box;
}
.tb-note:focus { outline: none; border-color: var(--svc-accent); box-shadow: var(--svc-focus); }
.tb-pending { margin: .1rem 0 .3rem; font-size: .8rem; color: var(--svc-accent-ink); }
.tb-customer { margin: .3rem 0; }
.tb-customer summary { cursor: pointer; font-size: .85rem; color: var(--svc-ink-2); padding: .25rem 0; }
.tb-actions { display: grid; gap: .5rem; margin-top: .4rem; }
.tb-action-row { display: grid; grid-template-columns: auto 1fr; gap: .5rem; }
.tb-action-row .svc-btn { min-height: 48px; }
.tb-send { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; background: #1d2330 !important; color: #fff !important; }
.tb-send:disabled { opacity: .45; cursor: not-allowed; }
.tb-settle:disabled { opacity: .55; cursor: not-allowed; }

/* Dialog contents */
.svc-modal--split { width: min(920px, 100%); }
.tb-field { margin-bottom: 1rem; display: grid; gap: .45rem; }
.tb-hint { color: var(--svc-ink-3); font-size: .84rem; margin: .3rem 0 0; }
.tb-guest-row { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.tb-guest-btn {
  width: 46px; height: 46px; border-radius: 12px; border: 1px solid var(--svc-line-strong); background: #fff; color: var(--svc-ink);
  font: inherit; font-size: 1rem; font-weight: 700; cursor: pointer; transition: background-color .12s, border-color .12s, color .12s;
}
.tb-guest-btn.is-on { background: var(--svc-accent); border-color: var(--svc-accent); color: #fff; }
.tb-guest-btn:focus-visible { outline: none; box-shadow: var(--svc-focus); }
.tb-guest-stepper, .tb-qty { width: 140px; min-height: 46px; }
.tb-pick-group { margin-bottom: .9rem; }
.tb-pick-group h3 { margin: 0 0 .45rem; font-size: .85rem; color: var(--svc-ink-3); text-transform: uppercase; letter-spacing: .04em; }
.tb-pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: .45rem; }
.tb-pick {
  display: grid; gap: .1rem; padding: .6rem; border-radius: 11px; border: 1px solid var(--svc-line-strong); background: #fff;
  font: inherit; color: var(--svc-ink); cursor: pointer; text-align: left;
}
.tb-pick strong { font-size: 1rem; }
.tb-pick span { font-size: .76rem; color: var(--svc-ink-3); }
.tb-pick.is-on { border-color: var(--svc-accent); background: var(--svc-accent-tint); box-shadow: 0 0 0 2px rgba(232, 93, 4, .15); }
.tb-pick:focus-visible { outline: none; box-shadow: var(--svc-focus); }
.tb-split-modes { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; margin-bottom: 1rem; }
.tb-split-modes button { display: grid; gap: .15rem; min-height: 68px; padding: .7rem .85rem; text-align: left; border: 1.5px solid var(--svc-line-strong); border-radius: 12px; background: #fff; color: var(--svc-ink); font: inherit; cursor: pointer; }
.tb-split-modes button span { color: var(--svc-ink-3); font-size: .8rem; }
.tb-split-modes button.is-on { border-color: var(--svc-accent); background: var(--svc-accent-tint); box-shadow: 0 0 0 2px rgba(232, 93, 4, .1); }
.tb-split-modes button.is-on strong { color: var(--svc-accent-ink); }
.tb-split-modes button:focus-visible { outline: none; box-shadow: var(--svc-focus); }
.tb-split-modes button:disabled { opacity: .5; cursor: not-allowed; }
.tb-split-checks { display: grid; gap: .6rem; padding: .75rem; margin-bottom: .5rem; border-radius: 13px; background: #f7f8fa; border: 1px solid var(--svc-line); }
.tb-split-section-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.tb-split-section-head > div { display: grid; gap: .12rem; }
.tb-split-section-head small { color: var(--svc-ink-3); font-size: .78rem; }
.tb-split-check-list { display: flex; gap: .45rem; overflow-x: auto; padding: 2px; scrollbar-width: thin; }
.tb-split-check-list > button { flex: 1 0 125px; display: flex; align-items: center; gap: .55rem; min-height: 54px; padding: .45rem .6rem; border: 1.5px solid var(--svc-line-strong); border-radius: 10px; background: #fff; color: var(--svc-ink); font: inherit; text-align: left; cursor: pointer; }
.tb-split-check-list > button > span:last-child { display: grid; min-width: 0; }
.tb-split-check-list > button small { color: var(--svc-ink-3); font-size: .78rem; font-variant-numeric: tabular-nums; }
.tb-split-check-list > button.is-on { border-color: var(--svc-accent); background: var(--svc-accent); color: #fff; box-shadow: 0 2px 6px rgba(232, 93, 4, .22); }
.tb-split-check-list > button.is-on small { color: rgba(255,255,255,.82); }
.tb-split-check-list > button:focus-visible { outline: none; box-shadow: var(--svc-focus); }
.tb-split-check-mark { display: grid; place-items: center; flex: none; width: 27px; height: 27px; border-radius: 50%; background: #eef1f5; color: var(--svc-ink-2); font-size: .8rem; font-weight: 700; }
.tb-split-check-list > button.is-on .tb-split-check-mark { background: #fff; color: var(--svc-accent); }
.tb-split-items { display: grid; }
.tb-split-item-row { display: grid; grid-template-columns: minmax(0, 1fr) 124px; gap: .8rem; align-items: center; padding: .65rem 0; border-top: 1px solid var(--svc-line); }
.tb-split-item { display: grid; }
.tb-split-item small { color: var(--svc-ink-3); }
.tb-split-assignments { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .3rem; }
.tb-split-assignments em { padding: .12rem .4rem; border-radius: 999px; background: #f1f3f7; color: var(--svc-ink-2); font-size: .7rem; font-style: normal; font-weight: 600; }
.tb-split-cell { min-height: 42px; }
.tb-split-cell button { width: 38px; }
.tb-split-cell input { width: 36px; }
.tb-split-equal-amount { justify-self: end; color: var(--svc-accent-ink); font-size: 1rem; font-variant-numeric: tabular-nums; }
.tb-flex { flex: 1; }
.tb-pick:disabled { cursor: not-allowed; opacity: .5; background: #f6f7f9; }

@media (max-width: 560px) {
  .tb-split-modes { grid-template-columns: 1fr; }
  .tb-split-item-row { grid-template-columns: minmax(0, 1fr) 118px; gap: .5rem; }
  .tb-split-cell button { width: 36px; }
  .svc-modal--split .svc-modal-foot .tb-flex { display: none; }
  .svc-modal--split .svc-modal-foot .svc-btn { flex: 1; }
}

/* ── Table dialog: Seat now / Reserve for later ───────────────────────────── */
.svc-modal { transition: width .22s ease; }
.svc-modal--reserve { width: min(700px, 100%); }
.svc-modal-head:has(+ .svc-modal-tabs) { border-bottom: 0; padding-bottom: .8rem; }
.svc-modal-tabs { padding: 0 1.35rem .9rem; border-bottom: 1px solid var(--svc-line); }
.svc-modal-tablist { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 12px; background: #f1f3f7; }
.svc-modal-tablist button {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 40px; border: 0; border-radius: 9px;
  background: transparent; color: var(--svc-ink-2); font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer;
  transition: background-color .15s, color .15s, box-shadow .15s;
}
.svc-modal-tablist button svg { font-size: 1.05rem; }
.svc-modal-tablist button.is-on { background: var(--svc-surface); color: var(--svc-ink); box-shadow: 0 1px 3px rgba(16, 24, 40, .12); }
.svc-modal-tablist button.is-on svg { color: var(--svc-accent); }
.svc-modal-tablist button:hover:not(.is-on):not(:disabled) { color: var(--svc-ink); }
.svc-modal-tablist button:focus-visible { outline: none; box-shadow: var(--svc-focus); }
.svc-modal-tablist button:disabled { cursor: not-allowed; opacity: .6; }
.svc-modal-pane { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.svc-modal-pane[hidden] { display: none; }
.tb-upcoming {
  display: flex; align-items: flex-start; gap: .55rem; margin: 0 0 1rem; padding: .65rem .8rem; border-radius: 11px;
  background: #f0f5ff; box-shadow: inset 0 0 0 1px #cddcfb; color: #2652b8; font-size: .86rem; line-height: 1.45;
}
.tb-upcoming svg { flex: none; margin-top: .2rem; }
.tb-ready { margin: 0; color: var(--svc-ink-2); font-size: .92rem; line-height: 1.5; }

/* Floor details panel */
.lf-detail-actions { display: grid; gap: .45rem; }
.lf-detail-reserve { width: 100%; min-height: 40px; color: var(--svc-ink-2); }
.lf-detail-reserve svg { color: var(--st-reserved); }
.lf-notice .svc-link-btn { flex: none; }
.rv-notice { margin: 0; }

/* ── Reservation form (table dialog and Reservations page) ───────────────── */
.rf-body { display: grid; gap: 1.25rem; align-content: start; }
.rf-section { display: grid; gap: .55rem; min-width: 0; }
.rf-section-head { display: flex; align-items: center; justify-content: space-between; gap: .3rem .75rem; flex-wrap: wrap; }
.rf-label { font-size: .76rem; font-weight: 600; color: var(--svc-ink-3); text-transform: uppercase; letter-spacing: .04em; }
.rf-aside { display: inline-flex; align-items: center; gap: .3rem; color: var(--svc-ink-3); font-size: .8rem; }
.rf-note { color: var(--svc-ink-3); font-size: .8rem; line-height: 1.4; }
.rf-field-error { color: #b42318; font-size: .8rem; line-height: 1.4; }
.rf-state { margin: 0; padding: .85rem 1rem; border-radius: 12px; background: #f7f8fa; color: var(--svc-ink-2); font-size: .88rem; line-height: 1.5; }
.rf-state--error { background: #fef3f2; color: #b42318; }

/* Date: a week of day cards, then a calendar for later dates */
.rf-days { position: relative; display: flex; gap: .4rem; overflow-x: auto; padding: 2px; margin: -2px; scrollbar-width: none; overscroll-behavior-x: contain; }
.rf-days::-webkit-scrollbar { display: none; }
.rf-day {
  flex: none; display: grid; justify-items: center; align-content: center; gap: .05rem; width: 62px; min-height: 68px; padding: .4rem .2rem;
  border: 1px solid var(--svc-line-strong); border-radius: 12px; background: #fff; color: var(--svc-ink); font: inherit; cursor: pointer;
  transition: background-color .12s, border-color .12s, color .12s;
}
.rf-day small { color: var(--svc-ink-3); font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; line-height: 1.2; }
.rf-day strong { font-size: 1.25rem; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.rf-day:hover:not(.is-on) { border-color: var(--svc-ink-3); }
.rf-day.is-on { background: var(--svc-accent); border-color: var(--svc-accent); color: #fff; }
.rf-day.is-on small { color: rgba(255, 255, 255, .85); }
.rf-day:focus-visible { outline: none; box-shadow: var(--svc-focus); }
.rf-day--more { gap: .3rem; border-style: dashed; color: var(--svc-ink-2); }
.rf-day--more svg { font-size: 1.15rem; }
.rf-day--more.is-on { border-style: solid; }
.rf-date-input { position: absolute; right: 0; bottom: 0; width: 1px; height: 1px; padding: 0; border: 0; opacity: 0; pointer-events: none; }

/* Time: slots grouped by part of the day; taken ones stay visible, crossed out */
.rf-slots { display: grid; gap: .7rem; }
.rf-slot-group { display: grid; grid-template-columns: 80px minmax(0, 1fr); gap: .6rem; align-items: start; }
.rf-slot-part { padding-top: .62rem; color: var(--svc-ink-3); font-size: .78rem; font-weight: 600; }
.rf-slot-grid, .rf-slots.is-loading { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: .35rem; }
.rf-slot {
  min-height: 38px; padding: 0 .4rem; border: 1px solid var(--svc-line-strong); border-radius: 10px; background: #fff; color: var(--svc-ink);
  font: inherit; font-size: .86rem; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; cursor: pointer;
  transition: background-color .12s, border-color .12s, color .12s, box-shadow .12s;
}
.rf-slot:hover:not(:disabled):not(.is-on) { border-color: var(--svc-accent); background: var(--svc-accent-tint); color: var(--svc-accent-ink); }
.rf-slot.is-on { background: var(--svc-accent); border-color: var(--svc-accent); color: #fff; box-shadow: 0 2px 8px rgba(232, 93, 4, .25); }
.rf-slot:disabled { border-color: transparent; background: #f4f5f8; color: #a9b1bd; text-decoration: line-through; cursor: not-allowed; }
.rf-slot:focus-visible { outline: none; box-shadow: var(--svc-focus); }
.rf-slots.is-loading span {
  height: 38px; border-radius: 10px; background: linear-gradient(90deg, #f1f3f7 25%, #e7eaf0 50%, #f1f3f7 75%);
  background-size: 200% 100%; animation: rf-shimmer 1.2s linear infinite;
}
@keyframes rf-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.rf-repeat { margin-top: .2rem; }

/* Length of stay */
.rf-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.rf-chip {
  display: inline-flex; align-items: center; gap: .4rem; min-height: 38px; padding: 0 .9rem; border: 1px solid var(--svc-line-strong);
  border-radius: 999px; background: #fff; color: var(--svc-ink); font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer;
  font-variant-numeric: tabular-nums; transition: background-color .12s, border-color .12s, color .12s;
}
.rf-chip small { color: var(--svc-ink-3); font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.rf-chip:hover:not(.is-on) { border-color: var(--svc-ink-3); }
.rf-chip.is-on { background: var(--svc-accent); border-color: var(--svc-accent); color: #fff; }
.rf-chip.is-on small { color: rgba(255, 255, 255, .85); }
.rf-chip:focus-visible { outline: none; box-shadow: var(--svc-focus); }

/* Table (only when the form is not opened from a table) */
.rf-any {
  display: flex; align-items: center; gap: .7rem; width: 100%; padding: .7rem .85rem; border: 1px solid var(--svc-line-strong);
  border-radius: 12px; background: #fff; color: var(--svc-ink); font: inherit; text-align: left; cursor: pointer;
}
.rf-any > span:last-child { display: grid; gap: .1rem; min-width: 0; }
.rf-any strong { font-size: .92rem; }
.rf-any small { color: var(--svc-ink-3); font-size: .8rem; }
.rf-any-check {
  flex: none; display: grid; place-items: center; width: 20px; height: 20px; border: 1.5px solid var(--svc-line-strong); border-radius: 50%;
  color: #fff; font-size: .75rem;
}
.rf-any.is-on { border-color: var(--svc-accent); background: var(--svc-accent-tint); box-shadow: 0 0 0 2px rgba(232, 93, 4, .15); }
.rf-any.is-on .rf-any-check { background: var(--svc-accent); border-color: var(--svc-accent); }
.rf-any:focus-visible { outline: none; box-shadow: var(--svc-focus); }
.rf-form .tb-pick-group { margin: .35rem 0 0; }
.rf-form .tb-pick-group h3 { font-size: .72rem; font-weight: 600; }
.rf-form .tb-pick-grid { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); }

/* Guest details */
.rf-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem; padding-top: 1.2rem; border-top: 1px solid var(--svc-line); }
.rf-wide { grid-column: 1 / -1; }
.rf-details .svc-field { gap: .4rem; }
.rf-details .svc-input { min-height: 42px; }
.rf-details .svc-input[aria-invalid="true"] { border-color: #f04438; }
.rf-notes { min-height: 64px; padding: .55rem .65rem; resize: vertical; line-height: 1.45; }
.rf-tag.is-on { border-color: var(--svc-accent); background: var(--svc-accent-tint); color: var(--svc-accent-ink); }

/* Footer: what will be booked, then the actions */
.rf-foot-error { flex-basis: 100%; margin: 0; }
.rf-summary { display: grid; gap: .1rem; min-width: 0; margin-right: auto; line-height: 1.3; }
.rf-summary strong { color: var(--svc-ink); font-size: .95rem; font-variant-numeric: tabular-nums; }
.rf-summary span { color: var(--svc-ink-3); font-size: .8rem; }
.rf-summary .rf-summary-hint { font-size: .86rem; }

@media (max-width: 560px) {
  .svc-modal-overlay {
    place-items: end center;
    padding: max(8px, env(safe-area-inset-top, 0px)) 0 0;
  }
  .svc-modal {
    width: 100%;
    max-height: calc(100dvh - max(8px, env(safe-area-inset-top, 0px)));
    border-radius: 18px 18px 0 0;
    overflow: hidden;
  }
  .svc-modal-head { padding-top: .9rem; }
  .svc-modal-body { min-width: 0; overscroll-behavior: contain; }
  .svc-modal-foot { padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px)); }
  .svc-modal-tabs { padding-left: 1rem; padding-right: 1rem; }
  .svc-modal-tablist button { min-width: 0; padding: 0 .45rem; font-size: .84rem; }
  .tb-guest-row { width: 100%; min-width: 0; }
  .tb-guest-btn { flex: 1 0 44px; max-width: 58px; }
  .tb-guest-stepper { flex: 1 1 132px; width: auto; max-width: 180px; }
  .rf-section-head { flex-wrap: nowrap; }
  .rf-aside { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .rf-slot-group { grid-template-columns: minmax(0, 1fr); gap: .35rem; }
  .rf-slot-part { padding-top: 0; }
  .rf-slot-grid, .rf-slots.is-loading { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); }
  .rf-details { grid-template-columns: minmax(0, 1fr); }
  .rf-summary { flex-basis: 100%; }
  .rf-foot .svc-btn { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .svc-modal, .rf-day, .rf-slot, .rf-chip { transition: none; }
  .rf-slots.is-loading span { animation: none; }
}
.desktop-security-loading, .pin-lock-overlay { position: fixed; inset: 0; display: grid; place-items: center; background: radial-gradient(circle at top, #fff7ed, #f7f7f7 55%, #ececec); z-index: 2147483600; }
.desktop-security-loading { color: #9a3412; font: 600 1rem system-ui, sans-serif; }
.pin-lock-card { width: min(430px, calc(100vw - 32px)); padding: 28px 34px 32px; border-radius: 24px; background: #fff; box-shadow: 0 24px 70px rgba(60, 30, 10, .18); text-align: center; }
.pin-lock-logo { width: min(320px, 92%); height: auto; max-height: 64px; object-fit: contain; margin-bottom: 16px; }
.pin-lock-eyebrow { margin: 0; color: #9a3412; font-size: .9rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.pin-lock-card h1 { margin: 6px 0 2px; color: #1f2937; font-size: 1.75rem; }
.pin-lock-role { margin: 0; color: #6b7280; text-transform: capitalize; }
.pin-dots { display: flex; justify-content: center; gap: 16px; margin: 24px 0 12px; }
.pin-dots span { width: 16px; height: 16px; border: 2px solid #fb923c; border-radius: 50%; background: #fff; transition: transform .12s, background .12s; }
.pin-dots span.filled { background: #f97316; transform: scale(1.08); }
.pin-lock-message { min-height: 42px; color: #6b7280; font-size: .92rem; }
.pin-lock-message.visible { color: #b91c1c; font-weight: 600; }
.pin-keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 8px auto 20px; max-width: 330px; }
.pin-keypad button { min-height: 64px; border: 1px solid #fed7aa; border-radius: 16px; background: #fff7ed; color: #431407; font-size: 1.5rem; font-weight: 700; cursor: pointer; touch-action: manipulation; }
.pin-keypad button:hover:not(:disabled), .pin-keypad button:focus-visible { background: #ffedd5; border-color: #fb923c; outline: 3px solid rgba(249,115,22,.2); }
.pin-keypad button:disabled { opacity: .45; cursor: default; }
.pin-keypad .pin-key-action { color: #6b7280; background: #f9fafb; border-color: #e5e7eb; }
.pin-keypad .pin-key-submit { color: white; background: #f97316; border-color: #ea580c; }
.pin-password-link { border: 0; background: transparent; color: #c2410c; font-weight: 700; font-size: 1rem; cursor: pointer; padding: 10px 18px; }
.pin-password-link:hover { text-decoration: underline; }
@media (max-height: 720px) { .pin-lock-card { padding: 16px 28px; } .pin-keypad button { min-height: 52px; } .pin-dots { margin: 14px 0 8px; } }
.quick-pin-panel { max-width: 760px; }
.quick-pin-heading { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.quick-pin-heading h3 { margin: 0 0 6px; font-size: 1.25rem; }
.quick-pin-heading p, .quick-pin-note { color: #6b7280; }
.quick-pin-state { border-radius: 999px; padding: 6px 12px; background: #e5e7eb; color: #4b5563; font-weight: 800; font-size: .8rem; }
.quick-pin-state.on { background: #dcfce7; color: #166534; }
.quick-pin-options, .quick-pin-form { display: grid; gap: 16px; margin-top: 22px; }
.quick-pin-options > label, .quick-pin-form > label { display: grid; gap: 7px; font-weight: 700; color: #374151; }
.quick-pin-options select, .quick-pin-form input { min-height: 44px; border: 1px solid #d1d5db; border-radius: 9px; padding: 0 12px; font-size: 1rem; max-width: 320px; }
.quick-pin-options fieldset { display: grid; gap: 12px; border: 1px solid #e5e7eb; border-radius: 12px; padding: 16px; }
.quick-pin-options fieldset label { display: flex; align-items: center; gap: 9px; }
.quick-pin-options input[type=checkbox], .pin-length-choice input { width: 20px; height: 20px; accent-color: #f97316; }
.pin-length-choice { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; }
.pin-length-choice > span { font-weight: 700; }
.pin-length-choice label { display: flex; gap: 7px; align-items: center; }
.quick-pin-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.quick-pin-actions button, .quick-pin-primary { min-height: 44px; padding: 0 18px; border: 1px solid #d1d5db; border-radius: 9px; background: white; font-weight: 700; cursor: pointer; }
.quick-pin-actions .quick-pin-primary, .quick-pin-primary { background: #f97316; border-color: #ea580c; color: white; }
.quick-pin-actions .danger { color: #b91c1c; border-color: #fecaca; background: #fff7f7; }
.quick-pin-form { border-top: 1px solid #e5e7eb; padding-top: 20px; }
.quick-pin-form h4 { margin: 0; }
.quick-pin-feedback { color: #9a3412; font-weight: 650; }
.quick-pin-note { border-top: 1px solid #e5e7eb; margin-top: 22px; padding-top: 16px; font-size: .9rem; }
.desktop-startup-panel { max-width: 760px; display: grid; gap: 18px; margin-bottom: 24px; }
.desktop-startup-heading h3 { margin: 0 0 6px; font-size: 1.25rem; }
.desktop-startup-heading p { margin: 0; color: #6b7280; }
.desktop-startup-panel .switch input:disabled + .slider { opacity: .5; cursor: not-allowed; }
.desktop-startup-status { margin: 0; padding-top: 14px; border-top: 1px solid #e5e7eb; color: #6b7280; font-weight: 650; }
.desktop-startup-status.on { color: #166534; }
/* Stock Allocation Modal */

.sam-overlay {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
    backdrop-filter: blur(3px);
    animation: sam-fadeIn 0.2s ease;
}

@keyframes sam-fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes sam-slideUp {
    from { opacity: 0; transform: translateY(20px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.sam-modal {
    background: white;
    border-radius: 16px;
    max-width: 780px;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.2);
    animation: sam-slideUp 0.3s ease;
}

/* Header */
.sam-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.04), rgba(245, 158, 11, 0.01));
}

.sam-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sam-header-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: #fef3c7;
    border-radius: 10px;
    color: #d97706;
    font-size: 1.1rem;
}

.sam-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.sam-subtitle {
    font-size: 0.8rem;
    color: #64748b;
    margin: 2px 0 0 0;
}

.sam-order-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #ede9fe;
    color: #6d28d9;
    font-weight: 700;
    font-size: 0.82rem;
    padding: 3px 10px;
    border-radius: 6px;
    margin-left: 8px;
}

.sam-close-btn {
    color: #94a3b8;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
}

.sam-close-btn:hover {
    color: #64748b;
    background: #f1f5f9;
}

/* Body */
.sam-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
}

/* Progress summary */
.sam-progress-summary {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    margin-bottom: 20px;
}

.sam-progress-text {
    font-size: 0.88rem;
    font-weight: 600;
    color: #475569;
}

.sam-progress-text strong {
    color: #16a34a;
}

.sam-progress-track {
    flex: 1;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
}

.sam-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #22c55e, #16a34a);
    border-radius: 3px;
    transition: width 0.4s ease;
}

/* Ingredient group card */
.sam-group {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 16px;
    overflow: visible;
    transition: border-color 0.2s;
}

.sam-group:hover {
    border-color: #cbd5e1;
}

.sam-group.sam-group-done {
    border-color: #bbf7d0;
    background: #f0fdf4;
}

.sam-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    border-radius: 12px 12px 0 0;
}

.sam-group-done .sam-group-header {
    background: #f0fdf4;
    border-bottom-color: #bbf7d0;
    border-radius: 12px 12px 0 0;
}

.sam-group-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sam-group-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sam-group-name svg {
    color: #d97706;
    width: 15px;
    height: 15px;
}

.sam-group-done .sam-group-name svg {
    color: #16a34a;
}

.sam-group-meta {
    font-size: 0.8rem;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sam-group-menu-item {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.sam-group-qty-badge {
    font-weight: 700;
    color: #d97706;
    background: #fef3c7;
    padding: 2px 8px;
    border-radius: 5px;
    font-size: 0.82rem;
}

.sam-group-done .sam-group-qty-badge {
    color: #16a34a;
    background: #dcfce7;
}

.sam-group-status {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #16a34a;
}

/* Group body */
.sam-group-body {
    padding: 16px 18px;
    border-radius: 0 0 12px 12px;
}

/* Balance bar */
.sam-balance {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    gap: 10px;
}

.sam-balance-need {
    font-size: 0.82rem;
    font-weight: 600;
    color: #475569;
}

.sam-balance-status {
    font-size: 0.78rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
}

.sam-balance-status.sam-status-partial {
    color: #d97706;
    background: #fef3c7;
}

.sam-balance-status.sam-status-full {
    color: #16a34a;
    background: #dcfce7;
}

.sam-balance-status.sam-status-over {
    color: #dc2626;
    background: #fee2e2;
}

.sam-balance-progress {
    width: 100%;
    height: 4px;
    background: #e2e8f0;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 14px;
}

.sam-balance-progress-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s ease;
    background: linear-gradient(90deg, #f59e0b, #d97706);
}

.sam-balance-progress-fill.sam-fill-full {
    background: linear-gradient(90deg, #22c55e, #16a34a);
}

.sam-balance-progress-fill.sam-fill-over {
    background: linear-gradient(90deg, #ef4444, #dc2626);
}

/* Recommendations */
.sam-recommendations {
    margin-bottom: 12px;
}

.sam-rec-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.sam-rec-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.sam-rec-btn {
    padding: 4px 10px;
    font-size: 0.78rem;
    font-weight: 500;
    color: #7c3aed;
    background: #f5f3ff;
    border: 1px solid #ddd6fe;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}

.sam-rec-btn:hover {
    background: #ede9fe;
    border-color: #c4b5fd;
}

/* Main ingredient badge — blue tint */
.sam-rec-btn--main {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #1d4ed8;
    background: #eff6ff;
    border-color: #bfdbfe;
    font-weight: 600;
}

.sam-rec-btn--main:hover {
    background: #dbeafe;
    border-color: #93c5fd;
}

/* Alternative badge — green tint */
.sam-rec-btn--alt {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #065f46;
    background: #ecfdf5;
    border-color: #a7f3d0;
}

.sam-rec-btn--alt:hover {
    background: #d1fae5;
    border-color: #6ee7b7;
}

.sam-rec-main-tag,
.sam-rec-alt-tag {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 999px;
}

.sam-rec-main-tag {
    background: #dbeafe;
    color: #1e40af;
}

.sam-rec-alt-tag {
    background: #d1fae5;
    color: #065f46;
}

/* Source rows */
.sam-sources {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sam-source {
    position: relative;
}

.sam-source-search-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sam-source-search-row .smart-ingredient-search {
    flex: 1;
}

.sam-source-remove {
    background: none;
    border: none;
    color: #cbd5e1;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.15s;
    flex-shrink: 0;
}

.sam-source-remove:hover {
    color: #ef4444;
    background: #fee2e2;
}

/* Filled source (selected stock) */
.sam-source-filled {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}

.sam-source-filled.sam-source-over {
    border-color: #fca5a5;
    background: #fef2f2;
}

.sam-source-stock-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.sam-source-stock-name {
    font-weight: 600;
    color: #1e293b;
    font-size: 0.88rem;
}

.sam-source-stock-avail {
    font-size: 0.75rem;
    color: #64748b;
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 4px;
}

.sam-source-clear {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.15s;
}

.sam-source-clear:hover {
    color: #ef4444;
    background: #fee2e2;
}

.sam-source-qty-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sam-qty-input {
    width: 100px;
    padding: 8px 10px;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e293b;
    text-align: center;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    background: white;
}

.sam-qty-input:focus {
    border-color: #d97706;
    box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.1);
}

.sam-qty-input.sam-input-over {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.sam-unit-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #64748b;
}

.sam-over-warn {
    font-size: 0.75rem;
    font-weight: 600;
    color: #ef4444;
    display: flex;
    align-items: center;
    gap: 3px;
}

/* Add source button */
.sam-add-source-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #6d28d9;
    background: #f5f3ff;
    border: 1px dashed #c4b5fd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    margin-top: 8px;
}

.sam-add-source-btn:hover {
    background: #ede9fe;
    border-color: #a78bfa;
}

/* Confirm button per group */
.sam-confirm-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 10px 16px;
    margin-top: 14px;
    font-size: 0.88rem;
    font-weight: 700;
    color: white;
    background: linear-gradient(135deg, #16a34a, #15803d);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(22, 163, 74, 0.2);
}

.sam-confirm-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
}

.sam-confirm-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.sam-confirm-btn.sam-confirm-disabled {
    background: #94a3b8;
    box-shadow: none;
}

.sam-confirm-partial {
    font-size: 0.72rem;
    background: rgba(255, 255, 255, 0.25);
    padding: 1px 7px;
    border-radius: 4px;
    margin-left: 4px;
}

/* Spinner */
.sam-btn-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: sam-spin 0.6s linear infinite;
}

@keyframes sam-spin {
    to { transform: rotate(360deg); }
}

/* Footer */
.sam-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-top: 1px solid #e2e8f0;
    flex-shrink: 0;
    background: #fafafa;
    border-radius: 0 0 16px 16px;
}

.sam-footer-status {
    font-size: 0.85rem;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sam-footer-status strong {
    color: #16a34a;
}

.sam-footer-actions {
    display: flex;
    gap: 10px;
}

.sam-cancel-btn {
    padding: 9px 20px;
    background: white;
    color: #475569;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sam-cancel-btn:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}

/* Loading state */
.sam-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 50px 20px;
    gap: 14px;
    color: #64748b;
    font-size: 0.9rem;
}

.sam-loading-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid #e2e8f0;
    border-top-color: #d97706;
    border-radius: 50%;
    animation: sam-spin 0.6s linear infinite;
}

/* Empty state */
.sam-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    gap: 10px;
    color: #64748b;
}

.sam-empty-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #dcfce7;
    border-radius: 50%;
    color: #16a34a;
    font-size: 1.3rem;
}

.sam-empty h3 {
    margin: 0;
    font-size: 1rem;
    color: #1e293b;
}

.sam-empty p {
    margin: 0;
    font-size: 0.85rem;
    color: #94a3b8;
    text-align: center;
}

/* Responsive */
@media (max-width: 768px) {
    .sam-modal {
        max-width: 100%;
        max-height: 95vh;
        border-radius: 12px;
    }

    .sam-header {
        padding: 16px 18px;
    }

    .sam-body {
        padding: 16px 18px;
    }

    .sam-group-body {
        padding: 14px 14px;
    }

    .sam-source-qty-row {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .sam-overlay {
        padding: 10px;
    }

    .sam-modal {
        max-height: 100vh;
        border-radius: 10px;
    }

    .sam-source-filled {
        padding: 10px;
    }

    .sam-source-stock-info {
        flex-wrap: wrap;
    }
}
.unit-select{position:relative;min-width:0}.unit-select-trigger{width:100%;min-height:38px;display:flex;align-items:center;justify-content:space-between;gap:8px;border:1px solid #d9d9d9;border-radius:8px;background:#fff;padding:8px 10px;color:#242424}.unit-select-popover{position:absolute;z-index:1200;top:calc(100% + 5px);left:0;width:min(330px,90vw);background:#fff;border:1px solid #e3e3e3;border-radius:10px;box-shadow:0 12px 34px rgba(0,0,0,.16);overflow:hidden}.unit-select-search{display:flex;align-items:center;gap:8px;padding:10px;border-bottom:1px solid #eee}.unit-select-search input{border:0!important;outline:0;min-width:0;width:100%;padding:2px!important}.unit-select-options{max-height:280px;overflow:auto;padding:6px}.unit-select-heading{margin:7px 8px 4px;color:#888;font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.04em}.unit-select-options button{width:100%;border:0;background:transparent;display:flex;align-items:center;justify-content:space-between;text-align:left;padding:8px;border-radius:7px}.unit-select-options button:hover,.unit-select-options button.is-selected{background:#fff3e8}.unit-select-options button span{display:flex;flex-direction:column}.unit-select-options small{font-size:11px;color:#777;font-weight:400}.unit-select-add{width:100%;display:flex;gap:6px;justify-content:center;align-items:center;border:0;border-top:1px solid #eee;background:#fff8f1;color:#d55b00;font-weight:700;padding:10px}.unit-select-empty{padding:16px;text-align:center;color:#777}.unit-dialog-backdrop{position:fixed;z-index:3000;inset:0;background:rgba(20,20,20,.42);display:grid;place-items:center;padding:18px}.unit-dialog{width:min(430px,100%);background:#fff;border-radius:14px;padding:20px;box-shadow:0 20px 60px rgba(0,0,0,.28)}.unit-dialog header{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:15px}.unit-dialog h2{margin:0;font-size:20px}.unit-dialog header p{margin:3px 0;color:#777}.unit-dialog header button{border:0;background:transparent;font-size:20px}.unit-dialog>label{display:block;font-weight:650;margin:12px 0}.unit-dialog>label small{font-weight:400;color:#777}.unit-dialog input,.unit-dialog select{display:block;width:100%;box-sizing:border-box;margin-top:5px;border:1px solid #d6d6d6;border-radius:8px;padding:9px}.unit-dialog-note{font-size:12px;color:#666;background:#f7f7f7;padding:9px;border-radius:7px}.unit-dialog-error{color:#b42318;font-size:13px}.unit-dialog footer{display:flex;justify-content:flex-end;gap:8px;margin-top:16px}.unit-dialog footer button{border:1px solid #ddd;background:#fff;border-radius:8px;padding:9px 14px}.unit-dialog footer .is-primary{border-color:#ed6c02;background:#ed6c02;color:#fff}
.unit-dialog-section { margin: 12px 0; padding: 12px; border: 1px solid #ececec; border-radius: 9px; }
.unit-dialog-section h3 { margin: 0 0 9px; font-size: 14px; }
.unit-dialog-search { display: flex !important; align-items: center; gap: 7px; margin: 0 !important; border: 1px solid #ddd; border-radius: 8px; padding: 0 8px; }
.unit-dialog-search input { border: 0 !important; margin: 0 !important; outline: 0; }
.unit-dialog-existing { max-height: 150px; overflow: auto; margin-top: 7px; }
.unit-dialog-existing > button { width: 100%; display: flex; align-items: center; justify-content: space-between; border: 0; background: #fff; padding: 8px; border-radius: 7px; text-align: left; }
.unit-dialog-existing > button:hover { background: #fff3e8; }
.unit-dialog-existing > button span { display: flex; flex-direction: column; }
.unit-dialog-existing small { color: #777; }
.unit-dialog-existing p { font-size: 12px; color: #777; text-align: center; }
.dpm-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(15, 23, 42, 0.5);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.dpm-card {
  width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto;
  background: #fff; color: #111827; border-radius: 14px; padding: 22px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}
.dpm-card h2 { margin: 0 0 4px; font-size: 20px; }
.dpm-sub { margin: 0 0 14px; color: #6b7280; font-size: 14px; }
.dpm-list { display: flex; flex-direction: column; gap: 10px; }
.dpm-row { padding: 12px; border: 1px solid #e5e7eb; border-radius: 10px; background: #f9fafb; }
.dpm-row strong { display: block; margin-bottom: 8px; font-size: 15px; }
.dpm-choices { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 14px; }
.dpm-choices label { display: flex; align-items: center; gap: 6px; cursor: pointer; min-height: 32px; }
.dpm-qty { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.dpm-qty input { width: 110px; padding: 9px 10px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 16px; }
.dpm-qty select { padding: 9px 10px; border: 1px solid #d1d5db; border-radius: 8px; background: #fff; font-size: 15px; }
.dpm-error { margin: 8px 0 0; color: #b91c1c; font-size: 13px; }
.dpm-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.dpm-actions button { padding: 10px 20px; border-radius: 9px; font-size: 15px; font-weight: 600; cursor: pointer; border: 1px solid transparent; }
.dpm-later { background: #fff; border-color: #d1d5db !important; color: #374151; }
.dpm-save { background: #ea580c; color: #fff; }
.dpm-actions button:disabled { opacity: 0.55; cursor: not-allowed; }
.aim-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.aim-modal {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  max-width: 560px;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.aim-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid #f3f4f6;
  background: linear-gradient(135deg, #fff7ed, #fffbeb);
}

.aim-header-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #f97316;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.aim-title {
  font-size: 15px;
  font-weight: 700;
  color: #92400e;
  margin: 0 0 3px;
}

.aim-subtitle {
  font-size: 12.5px;
  color: #6b7280;
  margin: 0;
}

.aim-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.aim-item {
  border: 1px solid #e5e7eb;
  border-radius: 9px;
  overflow: hidden;
}

.aim-item-hdr {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 9px 12px;
  background: #fafafa;
  border-bottom: 1px solid #f3f4f6;
}

.aim-item-name {
  font-size: 13px;
  font-weight: 600;
  color: #111827;
}

.aim-item-stock {
  font-size: 12px;
  color: #6b7280;
}

.aim-item-low {
  color: #dc2626;
}

.aim-item-note {
  font-size: 11.5px;
  color: #92400e;
  background: #fffbeb;
  border-bottom: 1px solid #fef3c7;
  padding: 6px 12px;
}

/* Badge grid for ingredient options */
.aim-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px;
}

.aim-badge {
  flex: 1 1 160px;
  min-width: 140px;
  max-width: 220px;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.aim-badge:hover {
  border-color: #a5b4fc;
  background: #f5f3ff;
}

.aim-badge--selected {
  border-color: #6366f1;
  background: #eff6ff;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

.aim-badge--ok {
  /* available stock — neutral border unless selected */
}

.aim-badge--low {
  /* insufficient stock — amber tint */
  background: #fffbeb;
  border-color: #fde68a;
}

.aim-badge--low:hover {
  border-color: #f59e0b;
  background: #fef3c7;
}

.aim-badge--selected.aim-badge--low {
  border-color: #f59e0b;
  background: #fef3c7;
  box-shadow: 0 0 0 3px rgba(245,158,11,0.15);
}

.aim-badge-top {
  display: flex;
  align-items: center;
  gap: 6px;
}

.aim-badge-name {
  font-size: 13px;
  font-weight: 700;
  color: #111827;
  flex: 1;
  line-height: 1.3;
}

.aim-badge-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}

.aim-badge-tag--main {
  background: #dbeafe;
  color: #1d4ed8;
}

.aim-badge-tag--alt {
  background: #d1fae5;
  color: #065f46;
}

.aim-badge-deduct {
  font-size: 11.5px;
  color: #4b5563;
}

.aim-badge-ratio {
  font-size: 10.5px;
  color: #9ca3af;
}

.aim-badge-avail {
  font-size: 11px;
  font-weight: 500;
}

.aim-badge-avail--ok {
  color: #059669;
}

.aim-badge-avail--low {
  color: #d97706;
}

.aim-no-option {
  font-size: 12px;
  color: #991b1b;
  background: #fef2f2;
  border-top: 1px solid #fee2e2;
  padding: 8px 12px;
}

.aim-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 20px;
  border-top: 1px solid #f3f4f6;
  background: #fafafa;
}

.aim-cancel-btn {
  padding: 8px 16px;
  font-size: 13px;
  border: 1px solid #e5e7eb;
  border-radius: 7px;
  background: #fff;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.12s;
}

.aim-cancel-btn:hover {
  background: #f3f4f6;
  color: #374151;
}

.aim-confirm-btn {
  padding: 8px 20px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: 7px;
  background: #2563eb;
  color: #fff;
  cursor: pointer;
  transition: background 0.12s;
}

.aim-confirm-btn:hover {
  background: #1d4ed8;
}

.aim-confirm-btn:disabled {
  background: #93c5fd;
  cursor: not-allowed;
}
/* ==========================================================================
   Kitchen Display (KDS) — live Kitchen screen and its settings previews.

   Every theme is built on the RPOS look used across the POS: warm off-white
   page, white rounded cards with warm borders, RPOS orange for actions and
   the active filter, cream highlights and the Outfit font. Green / amber /
   red are used only for how long an order has been waiting.

   1. Shell + tokens       5. Square Grid        9. Visual Tile
   2. Urgency tones        6. Classic Ticket    10. Station Board
   3. Top bar              7. Dark Pro          11. Details sheet, recall, toast
   4. Shared parts         8. Rush Hour         12. Motion + small screens

   Sizes are in em, so the Card size setting (data-kds-density) scales a whole
   theme from one font-size.
   ========================================================================== */

/* ── 1. Shell + tokens ──────────────────────────────────────────────────── */

.app-container.screen-mode.kds-mode {
    max-width: none;
    margin: 0;
    padding: 0;
    gap: 0;
    height: calc(100dvh - var(--app-topbar-h, 64px));
    min-height: 0;
    display: flex;
}

body.kds-focus .app-topbar,
body.kds-focus .mobile-nav { display: none !important; }
body.kds-focus .main-wrapper > .app-container.screen-mode.kds-mode,
body.kds-focus .app-container.screen-mode.kds-mode { height: 100dvh; padding-bottom: 0; }

.kds {
    --kds-scale: 1;

    /* RPOS brand (same values as the POS top bar and touch theme) */
    --kds-accent: #e85d04;
    --kds-accent-deep: #c2410c;
    --kds-cream: #fff7f0;
    --kds-track: #f6f1ea;
    --kds-ring: #f5c4a0;
    --kds-bg: #faf7f2;
    --kds-surface: #ffffff;
    --kds-bar-bg: #ffffff;
    --kds-ink: #1f2430;
    --kds-muted: #6b7280;
    --kds-line: #ece5da;
    --kds-shadow: 0 1px 2px rgba(31, 36, 48, .04), 0 10px 24px -18px rgba(31, 36, 48, .28);

    /* Waiting-time colours */
    --kds-ok: #16a34a;     --kds-ok-soft: #e7f6ec;    --kds-ok-ink: #166534;
    --kds-warn: #f2a20c;   --kds-warn-soft: #fff3d6;  --kds-warn-ink: #7a4a00;
    --kds-late: #dc2626;   --kds-late-soft: #fdeaea;  --kds-late-ink: #991b1b;
    --kds-ready: #78716c;  --kds-ready-soft: #f3f0eb; --kds-ready-ink: #44403c;

    position: relative;
    flex: 1;
    min-width: 0;
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    font-family: 'Outfit', system-ui, -apple-system, 'Segoe UI', sans-serif;
    font-size: calc(15px * var(--kds-scale));
    color: var(--kds-ink);
    background: var(--kds-bg);
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}
.kds[data-kds-density="compact"] { --kds-scale: .86; }
.kds[data-kds-density="large"] { --kds-scale: 1.2; }

.kds *, .kds *::before, .kds *::after { box-sizing: border-box; }
/* :where() keeps this reset at element weight so every themed button class wins. */
:where(.kds) button { min-height: 44px !important; font: inherit; color: inherit; cursor: pointer; -webkit-user-select: none; user-select: none; touch-action: manipulation; }
:where(.kds) button[aria-label] { min-width: 44px !important; }
:where(.kds) button:disabled { cursor: default; }
.kds :focus-visible { outline: .18em solid var(--kds-ring); outline-offset: .12em; }

.kds-board { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.kds-board-scroll { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #d9cfc2 transparent; }

.kds-empty {
    margin: 3em auto;
    max-width: 26em;
    padding: 2.2em 1.5em;
    display: grid;
    gap: .4em;
    text-align: center;
    color: var(--kds-muted);
    font-size: 1.05em;
    background: var(--kds-surface);
    border: .07em solid var(--kds-line);
    border-radius: 1.1em;
}
.kds-empty strong { color: var(--kds-ink); font-size: 1.3em; }

.kds-late-edge {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 5;
    box-shadow: inset 0 0 0 .22em rgba(220, 38, 38, .75), inset 0 0 2em rgba(220, 38, 38, .22);
    animation: kds-edge 1.8s ease-in-out infinite;
}

/* ── 2. Urgency tones ───────────────────────────────────────────────────── */

.kds [data-tone] { --tone: var(--kds-ok); --tone-soft: var(--kds-ok-soft); --tone-ink: var(--kds-ok-ink); --tone-on: #ffffff; }
.kds [data-tone="warning"] { --tone: var(--kds-warn); --tone-soft: var(--kds-warn-soft); --tone-ink: var(--kds-warn-ink); --tone-on: #2b1a00; }
.kds [data-tone="critical"] { --tone: var(--kds-late); --tone-soft: var(--kds-late-soft); --tone-ink: var(--kds-late-ink); --tone-on: #ffffff; }
.kds [data-tone="ready"] { --tone: var(--kds-ready); --tone-soft: var(--kds-ready-soft); --tone-ink: var(--kds-ready-ink); --tone-on: #ffffff; }

/* ── 3. Top bar (same pills and buttons as the POS menu) ────────────────── */

.kds-bar {
    flex: none;
    display: flex;
    flex-direction: column;
    gap: .55em;
    padding: .7em 1em;
    background: var(--kds-bar-bg);
    border-bottom: .07em solid var(--kds-line);
    position: relative;
    z-index: 6;
}
.kds-bar-main { display: flex; align-items: center; flex-wrap: wrap; gap: .6em 1em; }
.kds-bar-title { display: flex; align-items: center; gap: .6em; flex-wrap: wrap; }
.kds-bar-title h2 { display: inline-flex; align-items: center; gap: .4em; margin: 0; font-size: 1.3em; font-weight: 800; letter-spacing: -.01em; }
.kds-bar-title h2 svg { color: var(--kds-accent); font-size: 1.15em; }
.kds-bar-count { color: var(--kds-muted); font-weight: 600; }
.kds-bar-count strong { color: var(--kds-ink); font-size: 1.1em; }
.kds-bar-late {
    padding: .22em .75em;
    border-radius: 999px;
    background: var(--kds-late);
    color: #fff;
    font-weight: 800;
    font-size: .88em;
    animation: kds-badge-pulse 1.6s ease-in-out infinite;
}

.kds-live {
    display: inline-flex;
    align-items: center;
    gap: .42em;
    padding: .26em .7em;
    border-radius: 999px;
    font-size: .74em;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
    background: var(--kds-ok-soft);
    color: var(--kds-ok-ink);
}
.kds-live i { width: .6em; height: .6em; border-radius: 50%; background: var(--kds-ok); animation: kds-live 1.8s ease-out infinite; }
.kds-live[data-live="connecting"] { background: var(--kds-warn-soft); color: var(--kds-warn-ink); }
.kds-live[data-live="connecting"] i { background: var(--kds-warn); }
.kds-live[data-live="offline"] { background: var(--kds-late-soft); color: var(--kds-late-ink); }
.kds-live[data-live="offline"] i { background: var(--kds-late); animation: none; }

.kds-chips { display: flex; gap: .45em; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.kds-chips::-webkit-scrollbar { display: none; }
.kds-chip {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: .45em;
    min-height: 2.75em;
    padding: 0 1em;
    border-radius: 999px;
    border: .07em solid var(--kds-line);
    background: var(--kds-surface);
    color: var(--kds-ink);
    font-weight: 700;
    white-space: nowrap;
    transition: background .15s, border-color .15s, color .15s;
}
.kds-chip span { color: var(--kds-muted); font-size: .86em; font-weight: 700; font-variant-numeric: tabular-nums; }
.kds-chip:not(.is-active):hover { border-color: var(--kds-ring); }
.kds-chip.is-active { background: var(--kds-accent); border-color: var(--kds-accent); color: #fff; box-shadow: 0 .4em .9em -.5em rgba(232, 93, 4, .7); }
.kds-chip.is-active span { color: rgba(255, 255, 255, .85); }
.kds-chip--station i { width: .7em; height: .7em; border-radius: 50%; background: var(--chip-color); }
.kds-chip--station.is-active { background: var(--kds-ink); border-color: var(--kds-ink); box-shadow: none; }
.kds-chip--station.is-active i { box-shadow: 0 0 0 .15em #fff; }
/* A KOT device assigned to one station: its station, shown as a label, not a choice. */
.kds-chip.is-locked { cursor: default; }

.kds-bar-tools { margin-left: auto; display: flex; align-items: center; gap: .45em; }
.kds-search {
    display: flex;
    align-items: center;
    gap: .45em;
    min-height: 2.75em;
    padding: 0 .85em;
    border: .07em solid var(--kds-line);
    border-radius: .85em;
    background: var(--kds-surface);
    color: var(--kds-muted);
}
.kds-search:focus-within { border-color: var(--kds-ring); box-shadow: 0 0 0 .2em rgba(232, 93, 4, .1); }
.kds-search input { width: 13em; border: 0; outline: 0; background: transparent; font: inherit; color: var(--kds-ink); min-width: 0; }
.kds-tool {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4em;
    min-width: 2.75em;
    min-height: 2.75em;
    padding: 0 .9em;
    border-radius: .85em;
    border: .07em solid var(--kds-line);
    background: var(--kds-surface);
    color: var(--kds-ink);
    font-weight: 700;
}
.kds-tool--icon { padding: 0; }
.kds-tool svg { font-size: 1.1em; }
.kds-tool b { min-width: 1.5em; padding: 0 .4em; border-radius: 999px; background: var(--kds-accent); color: #fff; font-size: .8em; }
.kds-tool:disabled { opacity: .45; }
.kds-tool:not(:disabled):hover { border-color: var(--kds-ring); color: var(--kds-accent-deep); }

.kds-sound-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5em;
    min-height: 2.8em;
    width: 100%;
    border: .07em dashed var(--kds-ring);
    border-radius: .85em;
    background: var(--kds-cream);
    color: var(--kds-accent-deep) !important;
    font-weight: 700;
}

/* ── 4. Shared parts ────────────────────────────────────────────────────── */

.kds-card { position: relative; min-width: 0; }

.kds-number {
    padding: 0;
    border: 0;
    background: none;
    font-variant-numeric: tabular-nums;
    text-align: left;
    line-height: 1.05;
    color: inherit;
}
button.kds-number:hover { text-decoration: underline; text-decoration-thickness: .06em; text-underline-offset: .15em; }

.kds-timer { display: inline-flex; align-items: center; gap: .3em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kds-elapsed { font-variant-numeric: tabular-nums; }

.kds-kind { display: inline-flex; align-items: center; gap: .35em; font-weight: 700; white-space: nowrap; min-width: 0; }
.kds-kind svg { font-size: 1.2em; flex: none; }
.kds-kind strong { font-weight: 800; }
.kds-kind > span + strong::before { content: '·'; margin-right: .35em; font-weight: 400; opacity: .7; }

.kds-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .15em .5em; font-size: .84em; color: var(--kds-muted); }
.kds-meta-item { display: inline-flex; gap: .3em; min-width: 0; }
.kds-meta-label { font-weight: 500; }
.kds-meta-value { font-weight: 700; color: var(--kds-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 14em; }
.kds-meta-sep { opacity: .45; }

.kds-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.kds-item-main {
    display: flex;
    align-items: flex-start;
    gap: .6em;
    width: 100%;
    padding: .35em 0;
    border: 0;
    background: none;
    text-align: left;
    color: inherit;
}
button.kds-item-main { min-height: 2.75em; align-items: center; }
.kds-qty { flex: none; font-weight: 800; font-variant-numeric: tabular-nums; text-align: center; }
.kds-name { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.kds-name-text { font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
.kds-var { font-size: .8em; font-weight: 600; color: var(--kds-accent-deep); }
.kds-tick {
    flex: none;
    width: 1.45em;
    height: 1.45em;
    display: grid;
    place-items: center;
    border: .1em solid #d9cfc2;
    border-radius: .45em;
    background: var(--kds-surface);
    color: #fff;
}
.kds-item.is-done .kds-tick { background: var(--kds-ok); border-color: var(--kds-ok); }
.kds-item.is-done .kds-name-text,
.kds-item.is-done .kds-qty { text-decoration: line-through; text-decoration-thickness: .1em; opacity: .45; }
.kds-note {
    margin: .05em 0 .35em 2.55em;
    padding: .3em .6em;
    border-left: .22em solid var(--kds-accent);
    border-radius: .35em;
    background: var(--kds-cream);
    color: var(--kds-accent-deep);
    font-size: .88em;
    font-weight: 700;
    overflow-wrap: anywhere;
}
.kds-items-empty { margin: .5em 0; color: var(--kds-muted); font-style: italic; }

.kds-refunded {
    display: inline-block;
    padding: .15em .55em;
    border-radius: .35em;
    background: var(--kds-track);
    color: var(--kds-muted);
    font-size: .72em;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

/* Stage buttons: a cream track like the POS top-bar tabs; the current stage is solid orange. */
.kds-stages { display: flex; gap: .25em; padding: .25em; border-radius: .9em; background: var(--kds-track); }
.kds-stage {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .3em;
    min-height: 2.75em;
    padding: 0 .45em;
    border-radius: .7em;
    border: 0;
    background: transparent;
    color: var(--kds-muted);
    font-size: .86em;
    font-weight: 700;
    line-height: 1.1;
    text-align: center;
}
.kds-stages .kds-stage { flex: 1 1 auto; min-width: 0; white-space: nowrap; }
.kds-stage:not(.is-current):not(:disabled):hover { background: var(--kds-surface); color: var(--kds-ink); }
.kds-stage.is-current { background: var(--kds-accent); color: #fff; box-shadow: 0 .35em .8em -.45em rgba(232, 93, 4, .8); }
.kds-stage[data-stage="delivered"]:not(.is-current) { color: var(--kds-ok-ink); }
.kds-stage[data-stage="delivered"] svg { color: var(--kds-ok); }

.kds-next, .kds-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .35em;
    border: 0;
    font-weight: 700;
}
.kds-next:active, .kds-back:active, .kds-stage:active { transform: translateY(.06em); }

/* Smart KOT Routing: each station's progress on a card, and the "Needs a station" queue. */
.kds-st-strip { display: flex; flex-wrap: wrap; align-items: center; gap: .3em; padding: .35em .95em .1em; font-size: .78em; }
.kds-st-label { margin-right: .15em; color: var(--kds-muted); font-weight: 600; }
.kds-st-badge {
    display: inline-flex;
    align-items: center;
    gap: .35em;
    padding: .15em .55em;
    border: .07em solid var(--kds-line);
    border-radius: 999px;
    background: var(--kds-track);
    color: var(--kds-ink);
    font-weight: 700;
    white-space: nowrap;
}
.kds-st-badge i { width: .6em; height: .6em; border-radius: 50%; background: var(--st-color); }
.kds-st-badge b { color: var(--kds-muted); font-weight: 800; display: inline-flex; }
.kds-st-badge[data-state="cooking"] b { color: var(--kds-accent-deep); }
.kds-st-badge[data-state="ready-for-delivery"] { border-color: transparent; background: var(--kds-ok-soft); }
.kds-st-badge[data-state="ready-for-delivery"] b { color: var(--kds-ok-ink); }
.kds-st-strip--queue { margin: .4em .95em 0; padding: .45em .6em; border-radius: .7em; background: var(--kds-late-soft); }
.kds-st-warn { color: var(--kds-late-ink); font-weight: 800; }
.kds-st-send { margin-left: auto; display: inline-flex; gap: .3em; }
.kds-st-send select { min-height: 2.5em; padding: 0 .4em; border: .07em solid var(--kds-line); border-radius: .6em; background: var(--kds-surface); color: var(--kds-ink); font: inherit; }
.kds-st-send button { min-height: 2.5em; padding: 0 .85em; border: 0; border-radius: .6em; background: var(--kds-accent); color: #fff; font-weight: 700; }
.kds-st-send button:disabled { opacity: .5; }
.kds-tile-panel .kds-st-strip, .kds-strip-body .kds-st-strip, .kds-slip-head .kds-st-strip { padding-left: 0; padding-right: 0; }
.kds-tile-panel .kds-st-strip--queue, .kds-strip-body .kds-st-strip--queue, .kds-slip-head .kds-st-strip--queue { margin-left: 0; margin-right: 0; padding: .45em .6em; }
.kds-con .kds-st-strip { padding: .5em 1em 0; }
.kds-rush .kds-st-strip { padding: .25em .5em 0; }

.kds-notice { margin: 0; padding: .5em .85em; border: .07em solid var(--kds-ring); border-radius: .75em; background: var(--kds-cream); color: var(--kds-accent-deep); font-size: .86em; font-weight: 600; }
.kds-notice.is-warn { border-color: #f3b4b4; background: var(--kds-late-soft); color: var(--kds-late-ink); }

/* ── Classic RPOS: the original Kitchen screen (card styles live in index.css) ── */

.kds[data-kds-theme="classic_rpos"] { font-size: 15px; }
.kds-layout--classic-rpos { max-width: 1000px; margin: 0 auto; padding: 1rem 1rem 2rem; }
.kds-layout--classic-rpos .kitchen-order-card { margin-bottom: 1rem; }
.kds-classic .card-header-left h3 { display: inline-flex; align-items: center; gap: .55rem; flex-wrap: wrap; }
.kds-classic-num { font-size: inherit; font-weight: inherit; }
.kds-classic-timer {
    padding: .1rem .5rem;
    border-radius: 999px;
    background: var(--tone-soft);
    color: var(--tone-ink);
    font-size: .8rem;
    font-weight: 800;
}
.kds-classic[data-tone="critical"] .kds-classic-timer { background: var(--kds-late); color: #fff; }
.kds-classic .kds-st-strip { padding: .5rem 1.15rem 0; }

/* ── 5. Modern Square Grid ──────────────────────────────────────────────── */

.kds-layout--grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(18.5em, 100%), 1fr));
    gap: 1em;
    padding: 1em;
    align-content: start;
}
.kds-sq {
    container-type: inline-size;
    aspect-ratio: 1 / 1.08;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--kds-surface);
    border: .07em solid var(--kds-line);
    border-radius: 1.1em;
    box-shadow: var(--kds-shadow);
}
.kds-sq-head { flex: none; padding: .75em .95em .7em; background: var(--tone); color: var(--tone-on); }
.kds-sq-top { display: flex; align-items: center; justify-content: space-between; gap: .5em; }
.kds-sq-num { font-size: 1.9em; font-weight: 800; letter-spacing: -.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kds-sq-timer {
    flex: none;
    padding: .12em .55em;
    border-radius: 999px;
    background: rgba(255, 255, 255, .22);
    font-size: 1.45em;
    font-weight: 800;
}
.kds-sq[data-tone="warning"] .kds-sq-timer { background: rgba(255, 255, 255, .4); }
.kds-sq-timer svg { font-size: .72em; }
.kds-sq-sub { display: flex; align-items: center; justify-content: space-between; gap: .5em; margin-top: .3em; font-size: .9em; font-weight: 600; }
.kds-sq-sub .kds-kind { overflow: hidden; }
.kds-sq-sub .kds-urgency-text {
    flex: none;
    padding: .1em .6em;
    border-radius: 999px;
    background: rgba(255, 255, 255, .22);
    font-size: .8em;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.kds-sq[data-tone="fresh"] .kds-sq-sub .kds-urgency-text { background: #fff; color: var(--kds-ok-ink); animation: kds-badge-pulse 1.4s ease-in-out infinite; }
.kds-sq-meta { flex: none; padding: .5em .95em; border-bottom: .07em solid var(--kds-line); }
.kds-sq > .kds-refunded { margin: .5em .95em 0; align-self: flex-start; }
.kds-sq-body { flex: 1; min-height: 0; overflow-y: auto; padding: .3em .95em; scrollbar-width: thin; scrollbar-color: #d9cfc2 transparent; }
.kds-items--grid .kds-item + .kds-item { border-top: .07em solid #f3eee7; }
.kds-items--grid .kds-qty {
    min-width: 2em;
    height: 2em;
    display: grid;
    place-items: center;
    border-radius: .6em;
    background: var(--kds-cream);
    color: var(--kds-accent-deep);
    font-size: 1.02em;
}
.kds-items--grid .kds-name-text { font-size: 1.05em; }
.kds-sq-foot { flex: none; padding: .55em .6em .6em; border-top: .07em solid var(--kds-line); }
/* Narrow cards: smaller stage labels so "Picked up" stays on one line. */
@container (max-width: 300px) { .kds-sq .kds-stage { font-size: .76em; padding: 0 .3em; gap: .2em; } }

/* ── 6. Classic Ticket ──────────────────────────────────────────────────── */

.kds[data-kds-theme="classic_ticket"] {
    --kds-bg: #f1ebe2;
    --paper: #fffdf8;
}
.kds-layout--rail {
    display: flex;
    align-items: flex-start;
    gap: 1.15em;
    min-height: 100%;
    width: max-content;
    min-width: 100%;
    padding: 2.4em 1.3em 1.6em;
    /* The ticket rail: a steel bar the slips hang from, scrolling with them. */
    background:
        linear-gradient(#f8f6f2, #b9b2a8 40%, #ece7df 55%, #8f877c) 0 1.05em / 100% .8em no-repeat,
        linear-gradient(rgba(60, 45, 30, .14), transparent) 0 1.85em / 100% .5em no-repeat;
}
.kds[data-kds-theme="classic_ticket"] .kds-board-scroll { scroll-snap-type: x proximity; overflow-y: auto; }
.kds-slip {
    flex: 0 0 16.8em;
    display: flex;
    flex-direction: column;
    scroll-snap-align: start;
    color: #292524;
    font-family: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
    filter: drop-shadow(0 .35em .45em rgba(60, 45, 30, .18));
    transform-origin: top center;
}
.kds-slip-clip {
    position: absolute;
    top: -1.5em;
    left: 50%;
    z-index: 2;
    width: 3.4em;
    height: 2em;
    transform: translateX(-50%);
    border-radius: .35em .35em .2em .2em;
    background: linear-gradient(#fbfaf8, #a8a097);
    box-shadow: inset 0 -.25em 0 rgba(0, 0, 0, .15), 0 .1em .2em rgba(0, 0, 0, .2);
}
.kds-slip-paper { padding: 0 .95em .55em; background: var(--paper); }
.kds-slip[data-tone="warning"] .kds-slip-paper { background: #fffaee; }
.kds-slip[data-tone="critical"] .kds-slip-paper { background: #fff4f2; }
.kds-slip-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5em;
    margin: 0 -.95em .65em;
    padding: .5em .95em .45em;
    background: var(--tone);
    color: var(--tone-on);
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.kds-slip-strip .kds-urgency-text { font-size: .78em; }
.kds-slip-wait { font-size: 1.4em; letter-spacing: 0; }
.kds-slip-title { text-align: center; color: var(--kds-accent); font-size: .78em; font-weight: 700; letter-spacing: .3em; }
.kds-slip-num { display: block; width: 100%; margin: .1em 0 .2em; text-align: center; font-size: 1.9em; font-weight: 800; }
.kds-slip-row { display: flex; justify-content: space-between; gap: .6em; font-size: .82em; text-transform: uppercase; color: #57534e; }
.kds-slip-row span:last-child { text-align: right; overflow-wrap: anywhere; color: #292524; }
.kds-slip-row--type {
    align-items: center;
    margin: .35em 0 .3em;
    padding: .28em .5em;
    border: .12em solid #292524;
    color: #292524;
    font-size: .98em;
    font-weight: 800;
}
.kds-slip-row--type strong { font-size: 1.08em; }
.kds-slip-head .kds-refunded { margin-top: .3em; }
.kds-slip-cut { margin: .55em -.25em; border-top: .13em dashed #c4bab0; }
.kds-slip-cols { display: flex; gap: 1.6em; color: #a8a29e; font-size: .7em; letter-spacing: .12em; }
.kds-items--slip, .kds-items--slip .kds-item-main { text-transform: uppercase; }
.kds-items--slip .kds-item-main { padding: .3em 0; gap: .5em; }
.kds-items--slip .kds-qty { min-width: 2.4em; text-align: left; font-size: 1.05em; }
.kds-items--slip .kds-qty::after { content: ' x'; font-weight: 500; color: #a8a29e; }
.kds-items--slip .kds-name-text { font-weight: 800; }
.kds-items--slip .kds-var { color: #78716c; }
.kds-items--slip .kds-note {
    margin-left: 2.9em;
    border: .12em dashed var(--kds-accent);
    border-radius: 0;
    background: transparent;
    text-transform: uppercase;
}
.kds-items--slip .kds-note::before { content: '** '; }
.kds-items--slip .kds-note::after { content: ' **'; }
.kds-items--slip .kds-tick { border-radius: .15em; }
.kds-slip-total { display: flex; justify-content: space-between; gap: .5em; font-size: .78em; font-weight: 800; letter-spacing: .06em; color: #57534e; }
.kds-slip-stub {
    --zig: .7em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .35em;
    min-height: 3.6em;
    padding: .55em .8em calc(.55em + var(--zig) / 2);
    border: 0;
    border-top: .15em dashed #c4bab0;
    background: var(--paper);
    color: var(--kds-accent-deep);
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
    /* Torn bottom edge */
    -webkit-mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / var(--zig) 100%;
    mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / var(--zig) 100%;
}
.kds-slip[data-tone="warning"] .kds-slip-stub { background: #fffaee; }
.kds-slip[data-tone="critical"] .kds-slip-stub { background: #fff4f2; }
.kds-slip-stub span { font-size: .76em; color: #a8a29e; }
.kds-slip-stub strong { font-size: 1.02em; }
.kds-slip-stub:not(.kds-slip-stub--empty):hover { background: var(--kds-cream); }
.kds-slip-stub--empty { min-height: 1.4em; padding: 0; }

/* ── 7. Dark Pro Kitchen (warm charcoal + RPOS orange) ──────────────────── */

.kds[data-kds-theme="dark_pro"] {
    --kds-bg: #171412;
    --kds-bar-bg: #1d1a17;
    --kds-surface: #24201c;
    --kds-ink: #f6efe6;
    --kds-muted: #a8a097;
    --kds-line: #37312b;
    --kds-track: #2c2722;
    --kds-cream: #33281f;
    --kds-accent: #f97316;
    --kds-accent-deep: #fdba74;
    --kds-ring: #f97316;
    --kds-ok: #34c26b;   --kds-ok-soft: rgba(52, 194, 107, .16);  --kds-ok-ink: #86efac;
    --kds-warn: #f6b23c; --kds-warn-soft: rgba(246, 178, 60, .16); --kds-warn-ink: #fcd58a;
    --kds-late: #f0514d; --kds-late-soft: rgba(240, 81, 77, .18);  --kds-late-ink: #fca5a5;
    --kds-ready: #a8a097; --kds-ready-soft: rgba(168, 160, 151, .16); --kds-ready-ink: #d6d0c8;
    color-scheme: dark;
}
.kds[data-kds-theme="dark_pro"] [data-tone] { --tone-on: #0f1a12; }
.kds[data-kds-theme="dark_pro"] [data-tone="warning"] { --tone-on: #231600; }
.kds[data-kds-theme="dark_pro"] [data-tone="critical"] { --tone-on: #ffffff; }
.kds[data-kds-theme="dark_pro"] [data-tone="ready"] { --tone-on: #171412; }
.kds[data-kds-theme="dark_pro"] .kds-empty { background: var(--kds-surface); }
.kds[data-kds-theme="dark_pro"] .kds-tick { background: transparent; border-color: #4a423a; }
.kds[data-kds-theme="dark_pro"] .kds-board-scroll { scrollbar-color: #4a423a transparent; }

.kds-con-stats { flex: none; display: flex; gap: .6em; padding: .85em 1em 0; overflow-x: auto; }
.kds-con-stats > div { flex: 1 0 7em; padding: .55em .9em; border: .07em solid var(--kds-line); border-radius: .85em; background: var(--kds-surface); }
.kds-con-stats span { font-size: .7em; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--kds-muted); }
.kds-con-stats strong { display: block; font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 1.6em; color: var(--kds-ink); font-variant-numeric: tabular-nums; }
.kds-con-stats .is-late strong { color: var(--kds-late); }
.kds-con-stats .is-warn strong { color: var(--kds-warn); }

.kds-layout--console {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(20em, 100%), 1fr));
    gap: 1em;
    padding: 1em;
    align-items: start;
}
.kds-con {
    overflow: hidden;
    border: .07em solid var(--kds-line);
    border-top: .3em solid var(--tone);
    border-radius: 1em;
    background: var(--kds-surface);
    box-shadow: 0 1em 2em -1.4em rgba(0, 0, 0, .8);
}
.kds-con[data-tone="critical"] { border-color: var(--kds-late); box-shadow: 0 0 1.2em -.4em rgba(240, 81, 77, .7); }
.kds-con-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .8em; padding: .8em 1em .6em; }
.kds-con-id { min-width: 0; display: flex; flex-direction: column; gap: .2em; }
.kds-con-kind { color: var(--kds-muted); font-size: .78em; letter-spacing: .1em; text-transform: uppercase; }
.kds-con-num { color: var(--kds-ink); font-size: 2.05em; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kds-con-clock { flex: none; display: flex; flex-direction: column; align-items: flex-end; }
.kds-con-digits { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 2.45em; font-weight: 700; line-height: 1; color: var(--tone); }
.kds-con-clock .kds-urgency-text { margin-top: .3em; color: var(--tone); font-size: .74em; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.kds-progress { position: relative; height: .28em; margin: 0 1em; border-radius: 999px; background: var(--kds-track); }
.kds-progress i { display: block; height: 100%; border-radius: inherit; background: var(--tone); transition: width 1s linear; }
.kds-progress b { position: absolute; top: -.15em; bottom: -.15em; width: .14em; border-radius: 1px; background: var(--kds-warn); opacity: .7; }
.kds-con-tags { display: flex; flex-wrap: wrap; align-items: center; gap: .4em .55em; padding: .7em 1em 0; }
.kds-con-stage { padding: .18em .6em; border-radius: 999px; background: var(--kds-cream); color: var(--kds-accent-deep); font-size: .74em; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.kds-items--dark { gap: .3em; padding: .65em .75em; }
.kds-items--dark .kds-item { padding: 0 .55em; border-radius: .65em; background: #2b2621; }
.kds-items--dark .kds-qty {
    min-width: 2.1em;
    height: 2.1em;
    display: grid;
    place-items: center;
    border-radius: .55em;
    background: var(--kds-cream);
    color: var(--kds-accent-deep);
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 1.05em;
}
.kds-items--dark .kds-name-text { font-size: 1.1em; }
.kds-items--dark .kds-note { margin-left: 2.7em; background: rgba(249, 115, 22, .12); }
.kds-con-foot { display: flex; gap: .5em; padding: 0 .75em .75em; }
.kds-con-back { flex: none; width: 3.3em; min-height: 3.3em; border-radius: .8em; background: var(--kds-track); color: var(--kds-ink); font-size: 1.05em; }
.kds-con-next {
    flex: 1;
    min-height: 3.3em;
    border-radius: .8em;
    background: var(--kds-accent);
    color: #fff;
    font-size: 1em;
    letter-spacing: .04em;
    box-shadow: 0 .5em 1.1em -.6em rgba(249, 115, 22, .9);
}
.kds-con-next:hover { background: #ea580c; }

/* ── 8. Compact Rush Hour ───────────────────────────────────────────────── */

.kds[data-kds-theme="rush_hour"] { font-family: 'Manrope', 'Outfit', system-ui, sans-serif; }
.kds[data-kds-theme="rush_hour"] .kds-bar { padding: .5em .75em; }
.kds[data-kds-theme="rush_hour"] .kds-bar-title h2 { font-size: 1.12em; }
.kds[data-kds-theme="rush_hour"] .kds-chip,
.kds[data-kds-theme="rush_hour"] .kds-tool,
.kds[data-kds-theme="rush_hour"] .kds-search { min-height: 2.5em; }

.kds-allday {
    flex: none;
    display: flex;
    align-items: center;
    gap: .7em;
    padding: .45em .75em;
    overflow-x: auto;
    white-space: nowrap;
    background: var(--kds-ink);
    color: #fff;
    scrollbar-width: none;
}
.kds-allday-title { flex: none; color: #fdba74; font-size: .72em; letter-spacing: .16em; text-transform: uppercase; }
.kds-allday ul { display: flex; gap: .35em; margin: 0; padding: 0; list-style: none; }
.kds-allday li { display: inline-flex; align-items: baseline; gap: .35em; padding: .22em .6em; border-radius: 999px; background: rgba(255, 255, 255, .08); font-size: .86em; font-weight: 600; }
.kds-allday li b { color: #fdba74; font-size: 1.12em; font-weight: 800; font-variant-numeric: tabular-nums; }

.kds-layout--dense {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(12.6em, 100%), 1fr));
    gap: .5em;
    padding: .55em;
    align-items: start;
}
.kds-rush {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--kds-surface);
    border: .07em solid var(--kds-line);
    border-top: .35em solid var(--tone);
    border-radius: .55em;
    font-size: .88em;
}
.kds-rush-head { display: flex; align-items: center; gap: .35em; padding: .35em .5em; border-bottom: .07em solid #f3eee7; font-weight: 800; }
.kds-rush-num { font-size: 1.15em; font-weight: 800; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kds-rush-kind { display: inline-flex; color: var(--kds-muted); font-size: 1.05em; }
.kds-rush-table { padding: .05em .4em; border-radius: .35em; background: var(--kds-cream); color: var(--kds-accent-deep); font-size: .85em; }
.kds-rush-time { margin-left: auto; padding: .05em .45em; border-radius: .35em; background: var(--tone-soft); color: var(--tone-ink); font-weight: 800; font-variant-numeric: tabular-nums; }
.kds-rush-late { padding: .15em .5em; background: #7f1d1d; color: #fff; font-size: .72em; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.kds-rush-meta { padding: .25em .5em 0; font-size: .76em; }
.kds-rush > .kds-refunded { margin: .25em .5em 0; align-self: flex-start; }
.kds-items--rush { padding: .15em .5em; }
.kds-items--rush .kds-item-main { gap: .4em; padding: .12em 0; }
.kds-items--rush button.kds-item-main { min-height: 2.1em; }
.kds-items--rush .kds-qty { min-width: 1.4em; text-align: left; color: var(--kds-accent-deep); }
.kds-items--rush .kds-tick { width: 1.2em; height: 1.2em; }
.kds-items--rush .kds-note { margin: 0 0 .2em 1.8em; padding: .05em .4em; font-size: .82em; }
.kds-rush-foot { display: flex; align-items: center; gap: .4em; margin-top: auto; padding: .35em .4em .4em .5em; border-top: .07em solid #f3eee7; }
.kds-rush-stage { font-size: .7em; font-weight: 800; letter-spacing: .1em; color: var(--kds-muted); }
.kds-rush-count { font-size: .7em; color: var(--kds-muted); }
.kds-rush-bump { margin-left: auto; min-height: 2.35em; padding: 0 .75em; border-radius: .45em; background: var(--kds-accent); color: #fff; font-size: .86em; }
.kds-rush[data-tone="warning"] { background: #fffbf0; }
.kds-rush[data-tone="ready"] { background: var(--kds-ready-soft); }
/* Late tickets flip to solid red so they jump out of a dense screen. */
.kds-rush[data-tone="critical"] { background: #dc2626; border-color: #b91c1c; color: #fff; }
.kds-rush[data-tone="critical"] .kds-rush-head,
.kds-rush[data-tone="critical"] .kds-rush-foot { border-color: rgba(255, 255, 255, .22); }
.kds-rush[data-tone="critical"] .kds-rush-time { background: #fff; color: #b91c1c; }
.kds-rush[data-tone="critical"] :is(.kds-rush-kind, .kds-rush-stage, .kds-rush-count, .kds-var, .kds-meta, .kds-meta-value, .kds-qty) { color: #fee2e2; }
.kds-rush[data-tone="critical"] .kds-rush-table { background: rgba(255, 255, 255, .2); color: #fff; }
.kds-rush[data-tone="critical"] .kds-note { background: rgba(255, 255, 255, .15); border-left-color: #fff; color: #fff; }
.kds-rush[data-tone="critical"] .kds-tick { background: transparent; border-color: rgba(255, 255, 255, .6); }
.kds-rush[data-tone="critical"] .kds-rush-bump { background: #fff; color: #b91c1c; }

/* ── 9. Visual Tile ─────────────────────────────────────────────────────── */

.kds[data-kds-theme="visual_tile"] .kds-chip,
.kds[data-kds-theme="visual_tile"] .kds-tool,
.kds[data-kds-theme="visual_tile"] .kds-search { min-height: 3em; border-radius: 999px; }
.kds[data-kds-theme="visual_tile"] .kds-tool--icon { min-width: 3em; }

.kds-layout--tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(21.5em, 100%), 1fr));
    gap: 1.25em;
    padding: 1.25em;
    align-items: start;
}
.kds-tile {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 1.6em;
    border: .2em solid var(--tone);
    background: var(--tone-soft);
    box-shadow: var(--kds-shadow);
}
.kds-tile-head { display: flex; align-items: center; justify-content: space-between; gap: .7em; padding: 1em 1.05em .4em; }
.kds-tile-id { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: .25em; }
.kds-tile-kind { padding: .3em .75em; border-radius: 999px; background: var(--kds-surface); color: var(--kds-ink); font-size: .88em; max-width: 100%; overflow: hidden; }
.kds-tile-kind svg { color: var(--kds-accent); }
.kds-tile-num { font-family: 'Fraunces', 'Outfit', serif; font-size: 2.55em; font-weight: 700; color: var(--kds-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.kds-tile-id .kds-urgency-text { padding: .12em .65em; border-radius: 999px; background: var(--tone); color: var(--tone-on); font-size: .78em; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.kds-ring { position: relative; flex: none; color: var(--tone); }
.kds-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.kds-ring-track { fill: var(--kds-surface); stroke: rgba(31, 36, 48, .08); stroke-width: 9; }
.kds-ring-fill { fill: none; stroke: currentColor; stroke-width: 9; stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
.kds-ring-text { position: absolute; inset: 0; display: grid; place-items: center; color: var(--kds-ink); font-size: 1.3em; font-weight: 800; font-variant-numeric: tabular-nums; }
.kds-tile-steps { display: flex; gap: .45em; margin: .2em 0 .7em; padding: 0 1.05em; list-style: none; }
.kds-tile-steps li { flex: 1; display: flex; flex-direction: column; gap: .3em; color: var(--kds-muted); font-size: .76em; font-weight: 700; }
.kds-tile-steps li i { height: .45em; border-radius: 999px; background: rgba(31, 36, 48, .1); }
.kds-tile-steps li.is-past i { background: var(--kds-ring); }
.kds-tile-steps li.is-current i { background: var(--kds-accent); }
.kds-tile-steps li.is-current { color: var(--kds-ink); }
.kds-tile-panel { position: relative; margin: 0 .55em; padding: .6em .85em; border-radius: 1.15em; background: var(--kds-surface); display: flex; flex-direction: column; gap: .35em; }
.kds-tile-panel > .kds-refunded { align-self: flex-start; }
.kds-items--tile .kds-item + .kds-item { border-top: .07em dashed var(--kds-line); }
.kds-items--tile .kds-qty {
    width: 2.3em;
    height: 2.3em;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--kds-cream);
    color: var(--kds-accent-deep);
    font-size: 1.05em;
}
.kds-items--tile .kds-name-text { font-size: 1.12em; }
.kds-items--tile .kds-note { margin-left: 2.9em; border-radius: .7em; }
.kds-tile-go {
    min-height: 4em;
    margin: .55em;
    padding: 0 1em;
    border-radius: 1.15em;
    background: var(--kds-accent);
    color: #fff;
    font-size: 1.12em;
    box-shadow: 0 .6em 1.2em -.7em rgba(232, 93, 4, .9);
}
.kds-tile-go strong { text-transform: uppercase; letter-spacing: .04em; margin-left: .25em; }
.kds-tile-go:hover { background: var(--kds-accent-deep); }
.kds-tile-go:active { transform: translateY(.12em); }

/* ── 10. Station Board ──────────────────────────────────────────────────── */

.kds[data-kds-theme="station_board"] .kds-board-scroll { overflow: hidden; display: flex; }

.kds-lanes {
    flex: 1;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(min(19.5em, 86cqw), 1fr);
    gap: .9em;
    min-height: 0;
    padding: .9em;
    overflow-x: auto;
    scroll-snap-type: x proximity;
}
.kds-lane {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    scroll-snap-align: start;
    border: .07em solid var(--kds-line);
    border-radius: 1.1em;
    background: var(--kds-track);
}
.kds-lane-head { flex: none; padding: .75em .9em .65em; border-bottom: .07em solid var(--kds-line); background: var(--kds-surface); box-shadow: inset 0 .3em 0 var(--lane-color); }
.kds-lane-title { display: flex; align-items: center; gap: .5em; margin-top: .15em; }
.kds-lane-title i { width: .72em; height: .72em; border-radius: 50%; background: var(--lane-color); }
.kds-lane-title h3 { margin: 0; font-size: 1.1em; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.kds-lane-count { margin-left: auto; min-width: 1.9em; padding: .1em .55em; border-radius: 999px; background: var(--lane-color); color: #fff; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; }
.kds-lane-late { padding: .1em .55em; border-radius: 999px; background: var(--kds-late-soft); color: var(--kds-late-ink); font-size: .8em; font-weight: 800; }
.kds-cap { display: flex; align-items: center; gap: .55em; margin-top: .55em; }
.kds-cap-bar { flex: 1; height: .45em; overflow: hidden; border-radius: 999px; background: var(--kds-track); }
.kds-cap-bar i { display: block; height: 100%; border-radius: inherit; background: var(--kds-ok); transition: width .3s ease; }
.kds-cap[data-level="busy"] .kds-cap-bar i { background: var(--kds-warn); }
.kds-cap[data-level="over"] .kds-cap-bar i { background: var(--kds-late); }
.kds-cap small { color: var(--kds-muted); font-weight: 700; font-variant-numeric: tabular-nums; }
.kds-lane-body { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: .55em; padding: .6em; scrollbar-width: thin; scrollbar-color: #d9cfc2 transparent; }
.kds-lane-empty { margin: 1.5em 0; text-align: center; color: var(--kds-muted); font-weight: 600; }

.kds-strip { flex: none; display: flex; overflow: hidden; border-radius: .85em; border: .07em solid var(--kds-line); background: var(--kds-surface); }
.kds-strip-bar { flex: none; width: .45em; background: var(--tone); }
.kds-strip-body { flex: 1; min-width: 0; padding: .6em .75em .65em; }
.kds-strip-head { display: flex; align-items: center; gap: .5em; min-width: 0; }
.kds-strip-num { font-size: 1.2em; font-weight: 800; white-space: nowrap; }
.kds-strip-kind { min-width: 0; overflow: hidden; color: var(--kds-muted); font-size: .8em; }
.kds-strip-timer { flex: none; margin-left: auto; padding: .1em .5em; border-radius: 999px; background: var(--tone-soft); color: var(--tone-ink); font-weight: 800; }
.kds-strip-sub { display: flex; flex-wrap: wrap; align-items: center; gap: .3em .5em; margin: .2em 0; color: var(--tone-ink); font-size: .74em; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.kds-strip-partial { color: var(--kds-muted); letter-spacing: .02em; text-transform: none; font-weight: 600; }
.kds-strip-meta { font-size: .78em; }
.kds-items--strip .kds-item-main { padding: .14em 0; gap: .45em; }
.kds-items--strip button.kds-item-main { min-height: 2.2em; }
.kds-items--strip .kds-qty { min-width: 1.7em; padding: .05em .25em; border-radius: .4em; background: var(--kds-cream); color: var(--kds-accent-deep); }
.kds-items--strip .kds-note { margin-left: 2.15em; }
.kds-strip-foot { display: flex; gap: .4em; margin-top: .5em; }
.kds-strip-move { width: 2.9em; min-height: 2.7em; flex: none; border-radius: .7em; border: .07em solid var(--kds-line) !important; background: var(--kds-surface); color: var(--kds-ink); }
.kds-strip-move:hover { border-color: var(--kds-ring) !important; }
.kds-strip-next { flex: 1; min-height: 2.7em; border-radius: .7em; background: var(--kds-accent); color: #fff; }
.kds-strip-next:hover { background: var(--kds-accent-deep); }

/* ── 11. Details sheet, recall, toast ───────────────────────────────────── */

.kds-sheet-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    justify-content: flex-end;
    background: rgba(31, 36, 48, .45);
}
.kds-sheet {
    width: min(33rem, 100%);
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #fff;
    color: #1f2430;
    font-family: 'Outfit', system-ui, sans-serif;
    font-size: 15px;
    box-shadow: -1rem 0 2.4rem rgba(31, 36, 48, .2);
    animation: kds-sheet-in .2s ease-out;
}
.kds-sheet-head { display: flex; align-items: flex-start; gap: 1rem; padding: 1rem 1.1rem; border-top: .4rem solid var(--tone, #e85d04); border-bottom: 1px solid #ece5da; }
.kds-sheet-head h3 { margin: 0 0 .25rem; font-size: 1.6rem; font-weight: 800; }
.kds-sheet-head small { display: block; color: #6b7280; max-width: 22rem; line-height: 1.4; }
.kds-sheet-clock { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; }
.kds-sheet-clock strong { font-size: 1.6rem; color: var(--tone-ink); font-variant-numeric: tabular-nums; }
.kds-sheet-clock .kds-urgency-text { color: var(--tone-ink); font-size: .78rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.kds-sheet-close { flex: none; width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid #ece5da; border-radius: 12px; background: #fff; font-size: 1.2rem; }
.kds-recall .kds-sheet-close { margin-left: auto; }
.kds-sheet-body { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 1.2rem; padding: 1rem 1.1rem 2rem; }
.kds-sheet-body h4 { margin: 0 0 .55rem; color: #6b7280; font-size: .76rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.kds-sheet-info { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem 1rem; margin: 0; padding: .8rem .9rem; border-radius: 14px; background: #faf7f2; }
.kds-sheet-info dt { color: #6b7280; font-size: .76rem; }
.kds-sheet-info dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.kds-sheet-status { display: grid; grid-template-columns: repeat(auto-fit, minmax(7.2rem, 1fr)); gap: .3rem; padding: .3rem; border-radius: 14px; background: #f6f1ea; }
.kds-sheet-status .kds-stage { min-height: 44px; font-size: .92rem; }
.kds-sheet-items { list-style: none; margin: 0; padding: 0; }
.kds-sheet-items > li { padding: .45rem 0; border-bottom: 1px solid #f3eee7; }
.kds-sheet-item { display: flex; align-items: center; gap: .65rem; }
.kds-sheet-item .kds-qty { min-width: 2rem; height: 2rem; display: grid; place-items: center; border-radius: .55rem; background: #fff7f0; color: #c2410c; }
.kds-cat { font-size: .74rem; color: #9ca3af; }
.kds-sheet-items .kds-note { margin-left: 2.65rem; }
.kds-recipe-btn { flex: none; min-height: 36px; padding: 0 .8rem; border: 1px solid #f5c4a0; border-radius: 999px; background: #fff7f0; color: #c2410c; font-size: .8rem; font-weight: 700; }
.kds-comp { list-style: none; margin: .4rem 0 .2rem 2.65rem; padding: .4rem .6rem; border-left: 3px solid #e85d04; border-radius: 0 .5rem .5rem 0; background: #faf7f2; font-size: .85rem; }
.kds-comp-row { display: flex; align-items: center; gap: .4rem; width: 100%; padding: .25rem 0; border: 0; background: none; text-align: left; }
.kds-comp-row strong { margin-left: auto; white-space: nowrap; }
.kds-comp-row:disabled { cursor: default; opacity: 1; }
.kds-comp-src { padding: 0 .3rem; border: 1px solid #bae6fd; border-radius: 3px; background: #f0f9ff; color: #0284c7; font-size: .62rem; font-weight: 700; }
.kds-comp-src.is-recipe { border-color: #bbf7d0; background: #f0fdf4; color: #16a34a; }
.kds-comp-alt { display: inline-flex; padding: 0 .25rem; border: 1px solid #fcd34d; border-radius: 3px; background: #fffbeb; color: #d97706; font-size: .62rem; }
.kds-comp-caret { color: #9ca3af; font-size: .7rem; }
.kds-comp-raw { list-style: none; margin: .1rem 0 .3rem .8rem; padding: .25rem .5rem; border-left: 2px solid #e5ded4; color: #6b7280; font-size: .78rem; }
.kds-comp-raw li { display: flex; justify-content: space-between; gap: .5rem; padding: .1rem 0; }
.kds-sheet-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.kds-sheet-actions button { display: inline-flex; align-items: center; gap: .4rem; min-height: 44px; padding: 0 1rem; border: 1px solid #e85d04; border-radius: 12px; background: #fff; color: #c2410c; font-weight: 700; }
.kds-sheet-actions button:hover { background: #fff7f0; }
.kds-sheet-actions button.is-danger { border-color: #fecaca; color: #b91c1c; }
.kds-sheet-hint { color: #6b7280; font-size: .85rem; }

.kds-recall-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .55rem; }
.kds-recall-list li { display: flex; align-items: center; gap: .8rem; padding: .75rem .85rem; border: 1px solid #ece5da; border-radius: 14px; }
.kds-recall-list li > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .1rem; }
.kds-recall-list strong { font-size: 1.1rem; }
.kds-recall-list span { color: #6b7280; font-size: .85rem; }
.kds-recall-list small { color: #9ca3af; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kds-recall-list button { flex: none; display: inline-flex; align-items: center; gap: .35rem; min-height: 44px; padding: 0 .95rem; border: 0; border-radius: 12px; background: #e85d04; color: #fff; font-weight: 700; }

.kds-toast {
    position: fixed;
    left: 50%;
    bottom: calc(1.2rem + env(safe-area-inset-bottom, 0px));
    z-index: 1300;
    display: flex;
    align-items: center;
    gap: .9rem;
    padding: .5rem .55rem .5rem 1.1rem;
    border-radius: 999px;
    background: #1f2430;
    color: #fff;
    font-family: 'Outfit', system-ui, sans-serif;
    font-size: 15px;
    box-shadow: 0 .8rem 2rem rgba(31, 36, 48, .3);
    transform: translateX(-50%);
    animation: kds-toast-in .2s ease-out;
}
.kds-toast button { display: inline-flex; align-items: center; gap: .35rem; min-height: 42px; padding: 0 1rem; border: 0; border-radius: 999px; background: #e85d04; color: #fff; font-weight: 700; }

/* ── 12. Motion + small screens ─────────────────────────────────────────── */

.kds-card[data-arriving] { animation: kds-arrive .45s ease-out, kds-arrive-glow 1.1s ease-in-out .45s 3; }
.kds-board[data-flash-late] .kds-card[data-tone="critical"]:not([data-arriving]) { animation: kds-late-pulse 1.6s ease-in-out infinite; }
.kds-board[data-flash-late] .kds-slip[data-tone="critical"]:not([data-arriving]) { animation: kds-late-swing 1.6s ease-in-out infinite; }

@keyframes kds-arrive { from { opacity: 0; transform: translateY(-.8em) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes kds-arrive-glow { 0%, 100% { box-shadow: 0 0 0 0 rgba(232, 93, 4, 0); } 50% { box-shadow: 0 0 0 .35em rgba(232, 93, 4, .45); } }
@keyframes kds-late-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); } 50% { box-shadow: 0 0 0 .35em rgba(220, 38, 38, .4); } }
@keyframes kds-late-swing { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(.6deg); } 75% { transform: rotate(-.6deg); } }
@keyframes kds-edge { 0%, 100% { opacity: .5; } 50% { opacity: 1; } }
@keyframes kds-badge-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .7; } }
@keyframes kds-live { 0% { box-shadow: 0 0 0 0 rgba(22, 163, 74, .5); } 70%, 100% { box-shadow: 0 0 0 .45em rgba(22, 163, 74, 0); } }
@keyframes kds-sheet-in { from { transform: translateX(2rem); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes kds-toast-in { from { transform: translate(-50%, 1rem); opacity: 0; } to { transform: translateX(-50%); opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
    .kds *, .kds *::before, .kds *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition: none !important; }
    .kds-late-edge { animation: none; }
}

@media (min-width: 1800px) {
    .kds { font-size: calc(16px * var(--kds-scale)); }
}

/* Layout rules use a container query on .kds, so the settings preview at
   "Phone" size looks exactly like a real phone. */
.kds { container: kds / inline-size; }

@container kds (max-width: 768px) {
    .kds-bar { padding: .55em .75em; }
    .kds-bar-tools { margin-left: 0; width: 100%; }
    .kds-search { flex: 1; min-width: 0; }
    .kds-search input { width: 100%; }
    .kds-tool span { display: none; }
    .kds-sq { aspect-ratio: auto; }
    .kds-sq-body { overflow: visible; }
    .kds-layout--rail { padding-left: .9em; padding-right: .9em; }
    .kds-slip { flex-basis: min(17em, 82cqw); }
    .kds-con-stats > div { flex-basis: 5.5em; }
}

@media (max-width: 768px) {
    .main-wrapper > .app-container.screen-mode.kds-mode {
        padding: 0 0 calc(64px + env(safe-area-inset-bottom, 0px));
    }
    .kds-toast { bottom: calc(64px + 1rem + env(safe-area-inset-bottom, 0px)); }
    .kds-sheet-backdrop { align-items: flex-end; }
    .kds-sheet { height: 92dvh; border-radius: 1.2rem 1.2rem 0 0; animation-name: kds-sheet-up; }
    @keyframes kds-sheet-up { from { transform: translateY(2rem); opacity: 0; } to { transform: none; opacity: 1; } }
}
/* =====================================================
   NAVBAR VISIBILITY - SMOOTH LAYOUT ADJUSTMENTS
   ===================================================== */

/* 
   Add these styles to your main CSS file (App.css or index.css)
   to ensure smooth transitions when navbar items are hidden/shown
*/

/* Main POS Header - Smooth rearrangement */
.app-header .header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: gap 0.3s ease;
}

/* Smooth fade-in for header items */
.header-right>* {
    animation: fadeInItem 0.3s ease;
}

@keyframes fadeInItem {
    from {
        opacity: 0;
        transform: scale(0.95) translateX(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateX(0);
    }
}

/* User info section - flexible layout */
.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: gap 0.3s ease;
}

/* Ensure smooth transitions for all navbar elements */
.admin-nav-btn,
.ai-toggle,
.user-profile-card,
.logout-btn {
    transition: all 0.3s ease;
}

/* Admin Header Actions - Already updated in AdminHeader.css */
.admin-header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: gap 0.3s ease;
}

.admin-header-actions>* {
    animation: fadeInScale 0.3s ease;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Branch Selector - Smooth appearance */
.branch-selector-container {
    transition: all 0.3s ease;
}

/* Notification Container - Smooth appearance */
.notification-container {
    transition: all 0.3s ease;
}

/* Back to POS Button - Smooth appearance */
.back-to-pos-btn {
    transition: all 0.3s ease;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .header-right {
        gap: 0.5rem;
    }

    .user-info {
        gap: 0.5rem;
    }

    .admin-header-actions {
        gap: 0.5rem;
    }
}

/* Ensure no layout shift when items disappear */
.app-header,
.admin-header {
    min-height: 60px;
}

/* Flexbox will automatically adjust spacing when items are hidden */
/* No need for complex JavaScript - CSS Flexbox handles it! */

/* =====================================================
   ADDITIONAL ENHANCEMENTS
   ===================================================== */

/* Smooth hover effects */
.admin-nav-btn:hover,
.notification-bell-btn:hover,
.back-to-pos-btn:hover {
    transform: translateY(-1px);
}

/* Prevent layout shift on hover */
.admin-nav-btn,
.notification-bell-btn,
.back-to-pos-btn {
    will-change: transform;
}

/* Loading state for navbar visibility (optional) */
.navbar-loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Fade out animation when items are being removed */
@keyframes fadeOut {
    from {
        opacity: 1;
        transform: scale(1);
    }

    to {
        opacity: 0;
        transform: scale(0.95);
    }
}

/* Apply to items being removed (if needed) */
.navbar-item-removing {
    animation: fadeOut 0.2s ease forwards;
}.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    background: white;
    border-bottom: 1px solid #e0e0e0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.admin-header h1 {
    margin: 0;
    font-size: 1.5rem;
    color: #333;
}

.admin-header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: gap 0.3s ease;
}

/* Smooth fade-in animation for navbar items */
.admin-header-actions>* {
    animation: fadeInScale 0.3s ease;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Notification Bell */
.notification-container {
    position: relative;
}

.notification-bell-btn {
    position: relative;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-bell-btn:hover {
    background-color: #f0f0f0;
    color: #333;
}

.notification-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    background: #ff4444;
    color: white;
    border-radius: 10px;
    font-size: 11px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    border: 2px solid white;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

/* Notifications Dropdown */
.notifications-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    width: 380px;
    max-height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    animation: dropdownSlideIn 0.2s ease;
}

@keyframes dropdownSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.notifications-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e0e0e0;
}

.notifications-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: #333;
}

.unread-count {
    font-size: 0.85rem;
    color: #ff4444;
    font-weight: 600;
}

.notifications-list {
    flex: 1;
    overflow-y: auto;
    max-height: 400px;
}

.no-notifications {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    color: #999;
    text-align: center;
}

.no-notifications p {
    margin: 0.5rem 0 0 0;
    font-size: 0.95rem;
}

.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
    position: relative;
}

.notification-item:hover {
    background: #f8f9fa;
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-avatar {
    flex-shrink: 0;
}

.notification-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.avatar-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f48c06 0%, #e85d04 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.1rem;
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-sender {
    font-weight: 600;
    color: #333;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.notification-message {
    color: #666;
    font-size: 0.9rem;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin-bottom: 0.25rem;
}

.notification-time {
    font-size: 0.8rem;
    color: #999;
}

.notification-dot {
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    background: #ff4444;
    border-radius: 50%;
    margin-top: 0.5rem;
}

.notifications-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid #e0e0e0;
}

.view-all-btn {
    width: 100%;
    padding: 0.625rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.view-all-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(232, 93, 4, 0.3);
}

.back-to-pos-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.back-to-pos-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(232, 93, 4, 0.3);
}

/* Scrollbar Styling */
.notifications-list::-webkit-scrollbar {
    width: 6px;
}

.notifications-list::-webkit-scrollbar-track {
    background: transparent;
}

.notifications-list::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.notifications-list::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Responsive */
@media (max-width: 768px) {
    .admin-header {
        padding: 0.75rem 1rem;
    }

    .admin-header h1 {
        font-size: 1.25rem;
    }

    .notifications-dropdown {
        width: 320px;
        right: -1rem;
    }

    .admin-header-actions {
        gap: 0.5rem;
    }
}/* ── Backdrop ── */
.midp-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 1100;
  animation: midp-fade-in 0.18s ease;
}

/* ── Drawer ── */
.midp-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: 480px;
  max-width: 95vw;
  background: #fff;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
  z-index: 1101;
  display: flex;
  flex-direction: column;
  animation: midp-slide-in 0.22s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  overflow: hidden;
}

@keyframes midp-slide-in {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}

@keyframes midp-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Header ── */
.midp-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.25rem 0.9rem;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
}

.midp-header-info {
  flex: 1;
  min-width: 0;
}

.midp-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #111827;
  margin: 0 0 0.5rem;
  line-height: 1.3;
}

.midp-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.midp-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.25rem 0.55rem;
  border-radius: 9999px;
}

.midp-badge-icon {
  width: 12px;
  height: 12px;
}

.midp-badge-category {
  background: #eff6ff;
  color: #1d4ed8;
}

.midp-badge-outlet {
  background: #f0fdf4;
  color: #15803d;
}

.midp-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #6b7280;
  padding: 0.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  flex-shrink: 0;
  font-size: 1.1rem;
  transition: background 0.15s, color 0.15s;
}

.midp-close-btn:hover {
  background: #f3f4f6;
  color: #111827;
}

/* ── Body ── */
.midp-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.1rem 1.25rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* ── Overview ── */
.midp-overview {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.midp-image {
  width: 90px;
  height: 90px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  flex-shrink: 0;
}

.midp-overview-info {
  flex: 1;
  min-width: 0;
}

.midp-price-block {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.midp-price-label {
  font-size: 0.72rem;
  color: #6b7280;
}

.midp-price {
  font-size: 1.15rem;
  font-weight: 700;
  color: #111827;
}

.midp-description {
  font-size: 0.82rem;
  color: #6b7280;
  margin: 0 0 0.5rem;
  line-height: 1.45;
}

.midp-outlets-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.35rem;
}

.midp-section-label {
  font-size: 0.72rem;
  color: #6b7280;
  white-space: nowrap;
}

.midp-outlet-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.midp-outlet-chip {
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #d1d5db;
}

.midp-outlet-chip.active {
  background: #d1fae5;
  color: #065f46;
  border-color: #6ee7b7;
  font-weight: 600;
}

/* ── Loading / Empty ── */
.midp-loading {
  font-size: 0.85rem;
  color: #9ca3af;
  text-align: center;
  padding: 1.5rem 0;
}

.midp-empty {
  font-size: 0.85rem;
  color: #9ca3af;
  text-align: center;
  padding: 2rem 0;
  border: 1px dashed #e5e7eb;
  border-radius: 8px;
}

/* ── Section ── */
.midp-section {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.midp-section-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: #374151;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  border-bottom: 1px solid #f3f4f6;
  padding-bottom: 0.45rem;
}

.midp-sec-icon {
  color: #6366f1;
  width: 15px;
  height: 15px;
}

/* ── Variation group ── */
.midp-var-group {
  background: #fafafa;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 0.65rem 0.8rem;
}

.midp-var-group-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: #1d4ed8;
  margin-bottom: 0.45rem;
}

.midp-var-measure {
  font-weight: 400;
  font-size: 0.72rem;
  color: #6b7280;
}

/* ── Table ── */
.midp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.midp-table th {
  text-align: left;
  padding: 0.3rem 0.5rem;
  background: #f3f4f6;
  color: #6b7280;
  font-weight: 600;
  font-size: 0.72rem;
  border-bottom: 1px solid #e5e7eb;
}

.midp-table td {
  padding: 0.35rem 0.5rem;
  color: #374151;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: top;
}

.midp-table tr:last-child td {
  border-bottom: none;
}

.midp-source-badge {
  color: #6b7280;
  font-size: 0.72rem;
  font-style: italic;
}

/* ── Composition block ── */
.midp-comp-block {
  background: #fafafa;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 0.65rem 0.8rem;
}

.midp-comp-var-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.25rem;
}

.midp-comp-notes {
  font-size: 0.75rem;
  color: #6b7280;
  font-style: italic;
  margin-bottom: 0.35rem;
}

/* ── Recipe block ── */
.midp-recipe-block {
  background: #fafafa;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 0.65rem 0.8rem;
}

.midp-recipe-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.midp-recipe-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: #111827;
}

.midp-recipe-yield {
  font-size: 0.72rem;
  color: #6b7280;
}

.midp-recipe-cat {
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
  border-radius: 9999px;
  background: #ede9fe;
  color: #5b21b6;
}

/* ── Responsive ── */
@media (max-width: 520px) {
  .midp-drawer {
    width: 100vw;
  }
  .midp-overview {
    flex-direction: column;
  }
  .midp-image {
    width: 100%;
    height: 160px;
  }
}
/* Menu management (/admin/menu).
   Everything here is scoped to .mm-root (the page) or .mm-editor (the add/edit
   panel), so the shared admin form classes keep their look on other pages. */

.mm-root,
.mm-editor-layer {
    --mm-ink: #1d2025;
    --mm-text: #3b4048;
    --mm-muted: #6b7079;
    --mm-line: #e7e3dd;
    --mm-line-strong: #d3ccc2;
    --mm-surface: #ffffff;
    --mm-canvas: var(--background-color, #f8f9fa);
    --mm-sunken: #f4f2ef;
    --mm-brand: var(--primary-color, #e85d04);
    /* Deeper brand orange for filled buttons and orange text, so white or
       orange text keeps a 4.5:1 contrast ratio. */
    --mm-brand-strong: #c94c04;
    --mm-brand-strong-hover: #ad4103;
    --mm-brand-tint: #fff1e6;
    --mm-live: #16804a;
    --mm-live-tint: #e7f5ed;
    --mm-off: #c3c8cf;
    --mm-danger: #c42b2b;
    --mm-danger-tint: #fdeceb;
    --mm-gutter: 2rem;
    --mm-focus: 0 0 0 2px var(--mm-surface), 0 0 0 4px var(--mm-brand);
}

.mm-root {
    color: var(--mm-text);
}

.mm-root :where(button, input, select, textarea),
.mm-editor-layer :where(button, input, select, textarea) {
    font-family: inherit;
}

.mm-root :where(button):focus-visible,
.mm-editor-layer :where(button, a):focus-visible {
    outline: none;
    box-shadow: var(--mm-focus);
}

/* ── Page head ─────────────────────────────────────────────────────────── */

.mm-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem 2rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.mm-root .mm-title {
    margin: 0;
    font-size: 1.85rem;
    line-height: 1.15;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--mm-ink);
}

.mm-summary {
    margin: 0.35rem 0 0;
    font-size: 0.95rem;
    color: var(--mm-muted);
    max-width: 62ch;
}

.mm-summary strong {
    color: var(--mm-text);
    font-weight: 600;
}

/* ── Buttons ───────────────────────────────────────────────────────────── */

.mm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 40px;
    padding: 0 1.1rem;
    border-radius: 9px;
    border: 1px solid transparent;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.mm-btn svg {
    font-size: 1.05em;
    flex-shrink: 0;
}

.mm-btn-primary {
    background: var(--mm-brand-strong);
    color: #fff;
}

.mm-btn-primary:hover:not(:disabled) {
    background: var(--mm-brand-strong-hover);
}

.mm-btn-primary:disabled {
    opacity: 0.6;
    cursor: progress;
}

.mm-btn-ghost {
    background: var(--mm-surface);
    border-color: var(--mm-line-strong);
    color: var(--mm-text);
}

.mm-btn-ghost:hover {
    border-color: var(--mm-muted);
    color: var(--mm-ink);
}

.mm-btn-sm {
    min-height: 32px;
    padding: 0 0.7rem;
    font-size: 0.85rem;
    border-radius: 7px;
}

.mm-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: var(--mm-muted);
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.mm-icon-btn:hover {
    background: var(--mm-sunken);
    color: var(--mm-ink);
}

.mm-icon-btn.is-danger:hover {
    background: var(--mm-danger-tint);
    color: var(--mm-danger);
}

/* ── Section tabs ──────────────────────────────────────────────────────── */

.mm-tabs {
    display: flex;
    gap: 0.25rem;
    margin: 0 0 1.5rem;
    border-bottom: 1px solid var(--mm-line);
    overflow-x: auto;
    scrollbar-width: none;
}

.mm-tabs::-webkit-scrollbar {
    display: none;
}

.mm-tab {
    position: relative;
    flex: 0 0 auto;
    padding: 0.7rem 0.9rem 0.85rem;
    border: none;
    background: none;
    color: var(--mm-muted);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    transition: color 0.15s ease;
}

.mm-tab:hover {
    color: var(--mm-ink);
}

.mm-tab::after {
    content: '';
    position: absolute;
    left: 0.6rem;
    right: 0.6rem;
    bottom: -1px;
    height: 3px;
    border-radius: 3px 3px 0 0;
    background: transparent;
}

.mm-tab[aria-selected='true'] {
    color: var(--mm-ink);
}

.mm-tab[aria-selected='true']::after {
    background: var(--mm-brand);
}

.mm-back {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 1rem;
    padding: 0.35rem 0.1rem;
    border: none;
    background: none;
    color: var(--mm-brand-strong);
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
}

.mm-back:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ── Filter bar (sticks to the top while the list scrolls) ─────────────── */

.mm-filterbar {
    position: sticky;
    /* Sticky offsets count from inside the scroll area's padding, so pull
       back by that padding to sit flush with the top edge. */
    top: calc(var(--mm-gutter) * -1);
    z-index: 6;
    margin: 0 calc(var(--mm-gutter) * -1) 0.5rem;
    padding: 0.75rem var(--mm-gutter) 0.6rem;
    background: var(--mm-canvas);
    border-bottom: 1px solid transparent;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.mm-filterbar.is-stuck {
    border-bottom-color: var(--mm-line);
    box-shadow: 0 8px 16px -14px rgba(29, 32, 37, 0.35);
}

.mm-filter-sentinel {
    height: 1px;
    margin-bottom: -1px;
}

.mm-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.mm-search {
    position: relative;
    flex: 1 1 280px;
    min-width: 0;
    max-width: 520px;
}

.mm-search-icon {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--mm-muted);
    font-size: 1rem;
    pointer-events: none;
}

.mm-root .mm-search input {
    width: 100%;
    height: 42px;
    padding: 0 2.5rem 0 2.5rem;
    border: 1px solid var(--mm-line-strong);
    border-radius: 10px;
    background: var(--mm-surface);
    color: var(--mm-ink);
    font-size: 0.95rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.mm-root .mm-search input::placeholder {
    color: #8a9099;
}

.mm-root .mm-search input:focus {
    outline: none;
    border-color: var(--mm-brand);
    box-shadow: 0 0 0 3px rgba(232, 93, 4, 0.16);
}

.mm-root .mm-search input::-webkit-search-cancel-button {
    display: none;
}

.mm-search-clear {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
}

.mm-segment {
    display: inline-flex;
    align-items: center;
    padding: 3px;
    gap: 2px;
    border-radius: 10px;
    background: var(--mm-sunken);
    border: 1px solid var(--mm-line);
}

.mm-segment button {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    height: 34px;
    padding: 0 0.8rem;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: var(--mm-muted);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.mm-segment button:hover {
    color: var(--mm-ink);
}

.mm-segment button[aria-pressed='true'] {
    background: var(--mm-surface);
    color: var(--mm-ink);
    box-shadow: 0 1px 2px rgba(29, 32, 37, 0.12);
}

.mm-segment .mm-count {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--mm-muted);
    font-variant-numeric: tabular-nums;
}

.mm-view-toggle {
    margin-left: auto;
}

.mm-view-toggle button {
    width: 36px;
    padding: 0;
    justify-content: center;
    font-size: 1.05rem;
}

.mm-chips {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.75rem;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 2px;
}

.mm-chips::-webkit-scrollbar {
    display: none;
}

.mm-chip {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    height: 32px;
    padding: 0 0.8rem;
    border-radius: 999px;
    border: 1px solid var(--mm-line-strong);
    background: var(--mm-surface);
    color: var(--mm-text);
    font-size: 0.86rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.mm-chip:hover {
    border-color: var(--mm-muted);
}

.mm-chip .mm-count {
    font-size: 0.78rem;
    color: var(--mm-muted);
    font-variant-numeric: tabular-nums;
}

.mm-chip[aria-pressed='true'] {
    background: var(--mm-ink);
    border-color: var(--mm-ink);
    color: #fff;
}

.mm-chip[aria-pressed='true'] .mm-count {
    color: rgba(255, 255, 255, 0.72);
}

/* ── Category sections, set like a printed menu ────────────────────────── */

.mm-section + .mm-section {
    margin-top: 2.25rem;
}

.mm-section-head {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    margin: 0 0 0.9rem;
}

.mm-root .mm-section-head h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--mm-ink);
}

.mm-leader {
    flex: 1;
    min-width: 2rem;
    border-bottom: 2px dotted var(--mm-line-strong);
    transform: translateY(-0.3em);
}

.mm-section-count {
    font-size: 0.88rem;
    color: var(--mm-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* ── Grid view ─────────────────────────────────────────────────────────── */

.mm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 216px), 1fr));
    gap: 1rem;
}

.mm-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--mm-surface);
    border: 1px solid var(--mm-line);
    border-radius: 14px;
    overflow: hidden;
    transition: border-color 0.15s ease;
}

.mm-card:hover {
    border-color: var(--mm-line-strong);
}

.mm-card-media {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    padding: 0;
    border: none;
    background: var(--mm-sunken);
    cursor: zoom-in;
    overflow: hidden;
}

.mm-root .mm-card-media:focus-visible {
    box-shadow: inset 0 0 0 3px var(--mm-brand);
}

.mm-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.mm-card.is-hidden .mm-card-img,
.mm-row.is-hidden .mm-row-img {
    filter: grayscale(1);
    opacity: 0.55;
}

.mm-photo-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    width: 100%;
    height: 100%;
    background:
        repeating-linear-gradient(135deg, transparent 0 10px, rgba(29, 32, 37, 0.025) 10px 20px),
        var(--mm-sunken);
    color: #9a9fa7;
    font-size: 1.35rem;
}

.mm-photo-empty span {
    font-size: 0.8rem;
    font-weight: 600;
}

.mm-hidden-tag {
    position: absolute;
    left: 0.6rem;
    top: 0.6rem;
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
    background: rgba(29, 32, 37, 0.82);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
}

.mm-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    padding: 0.8rem 0.9rem 0.75rem;
}

.mm-root .mm-card-name {
    margin: 0;
    font-size: 0.98rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--mm-ink);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.6em;
}

.mm-card.is-hidden .mm-card-name {
    color: var(--mm-muted);
}

.mm-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: auto;
}

.mm-price {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--mm-ink);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.mm-price.is-sized {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--mm-muted);
}

.mm-card-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 0.6rem;
    border-top: 1px solid var(--mm-line);
}

.mm-card-actions .mm-edit {
    margin-right: auto;
}

/* ── Show-on-POS switch ────────────────────────────────────────────────── */

.mm-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    cursor: pointer;
    user-select: none;
}

.mm-switch input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

.mm-switch-track {
    position: relative;
    width: 34px;
    height: 20px;
    flex-shrink: 0;
    border-radius: 999px;
    background: var(--mm-off);
    transition: background-color 0.2s ease;
}

.mm-switch-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s ease;
}

.mm-switch-text {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--mm-muted);
    min-width: 3.6em;
}

.mm-switch.is-on .mm-switch-track {
    background: var(--mm-live);
}

.mm-switch.is-on .mm-switch-thumb {
    transform: translateX(14px);
}

.mm-switch.is-on .mm-switch-text {
    color: var(--mm-live);
}

.mm-switch input:focus-visible + .mm-switch-track {
    box-shadow: var(--mm-focus);
}

.mm-switch.is-busy {
    opacity: 0.55;
    cursor: progress;
}

/* ── List view ─────────────────────────────────────────────────────────── */

.mm-list {
    list-style: none;
    margin: 0;
    padding: 0;
    background: var(--mm-surface);
    border: 1px solid var(--mm-line);
    border-radius: 14px;
    overflow: hidden;
}

.mm-row {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) 7.5rem 7.5rem auto;
    align-items: center;
    gap: 1rem;
    padding: 0.6rem 0.75rem 0.6rem 0.75rem;
}

.mm-row + .mm-row {
    border-top: 1px solid var(--mm-line);
}

.mm-row:hover {
    background: #fcfbfa;
}

.mm-row-thumb {
    display: block;
    width: 52px;
    height: 52px;
    padding: 0;
    border: none;
    border-radius: 10px;
    overflow: hidden;
    background: var(--mm-sunken);
    cursor: zoom-in;
}

.mm-row-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.mm-row-thumb .mm-photo-empty {
    font-size: 1.05rem;
}

.mm-row-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.mm-row-name {
    font-size: 0.98rem;
    font-weight: 600;
    color: var(--mm-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mm-row.is-hidden .mm-row-name {
    color: var(--mm-muted);
}

.mm-row-desc {
    font-size: 0.84rem;
    color: var(--mm-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mm-row .mm-price {
    text-align: right;
}

.mm-row-actions {
    display: flex;
    align-items: center;
    gap: 0.15rem;
}

.mm-row-actions .mm-edit {
    margin-right: 0.35rem;
}

/* ── Loading, empty and placeholder states ─────────────────────────────── */

.mm-skeleton-card {
    border: 1px solid var(--mm-line);
    border-radius: 14px;
    overflow: hidden;
    background: var(--mm-surface);
}

.mm-skeleton-card > span {
    display: block;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--mm-sunken) 0%, #ebe8e4 40%, var(--mm-sunken) 80%);
    background-size: 200% 100%;
    animation: mm-shimmer 1.3s linear infinite;
}

.mm-skeleton-card > span:first-child {
    aspect-ratio: 4 / 3;
    border-radius: 0;
}

.mm-skeleton-card > span:nth-child(2) {
    height: 14px;
    margin: 0.9rem 0.9rem 0.5rem;
    width: 70%;
}

.mm-skeleton-card > span:nth-child(3) {
    height: 14px;
    margin: 0 0.9rem 1rem;
    width: 35%;
}

@keyframes mm-shimmer {
    to {
        background-position: -200% 0;
    }
}

.mm-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.5rem;
    padding: 3.5rem 1.5rem;
    border: 1px dashed var(--mm-line-strong);
    border-radius: 14px;
    background: var(--mm-surface);
}

.mm-root .mm-empty h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--mm-ink);
}

.mm-empty p {
    margin: 0 0 0.75rem;
    max-width: 46ch;
    color: var(--mm-muted);
    font-size: 0.95rem;
}

/* ── Add / edit panel ──────────────────────────────────────────────────── */

.mm-editor-layer {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    justify-content: flex-end;
}

.mm-editor-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(24, 26, 30, 0.42);
    animation: mm-fade 0.18s ease-out;
}

.mm-editor {
    position: relative;
    display: flex;
    flex-direction: column;
    width: min(1000px, 100%);
    height: 100%;
    background: var(--mm-canvas);
    box-shadow: -24px 0 48px rgba(24, 26, 30, 0.18);
    animation: mm-slide-in 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
    outline: none;
}

@keyframes mm-fade {
    from { opacity: 0; }
}

@keyframes mm-slide-in {
    from { transform: translateX(48px); opacity: 0; }
}

.mm-editor-form {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
}

.mm-editor-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.5rem 1rem;
    background: var(--mm-surface);
    border-bottom: 1px solid var(--mm-line);
}

.mm-editor .mm-editor-title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--mm-ink);
}

.mm-editor-sub {
    margin: 0.2rem 0 0;
    font-size: 0.9rem;
    color: var(--mm-muted);
}

.mm-editor-head .mm-icon-btn {
    width: 38px;
    height: 38px;
    font-size: 1.25rem;
}

.mm-editor-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 1.25rem 1.5rem 1.5rem;
}

.mm-editor-foot {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    padding: 0.85rem 1.5rem;
    background: var(--mm-surface);
    border-top: 1px solid var(--mm-line);
}

.mm-editor-foot .mm-btn {
    min-height: 44px;
    padding: 0 1.4rem;
}

/* Field layout inside the panel. These override the shared admin form styles
   for this panel only. */
.mm-editor .menu-edit-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 1.25rem;
    align-items: start;
}

.mm-editor .menu-form-fields {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.mm-editor .form-section {
    margin: 0;
    padding: 1.15rem 1.25rem 1.25rem;
    gap: 1rem;
    border: 1px solid var(--mm-line);
    border-radius: 12px;
    background: var(--mm-surface);
    box-shadow: none;
}

.mm-editor .form-section-header {
    gap: 0.15rem;
}

.mm-editor .form-section-header h4 {
    margin: 0;
    font-size: 1.02rem;
    font-weight: 700;
    color: var(--mm-ink);
}

.mm-editor .form-section-header p {
    margin: 0;
    font-size: 0.88rem;
    color: var(--mm-muted);
}

.mm-editor .form-row {
    gap: 1rem;
    margin: 0;
}

.mm-editor .form-row.full-width-row {
    grid-template-columns: 1fr;
}

.mm-editor .form-group {
    margin: 0;
}

.mm-editor .form-group label.variation-switch {
    margin: 0;
}

.mm-editor .form-group label {
    margin-bottom: 0.35rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--mm-text);
}

.mm-editor .form-group input,
.mm-editor .form-group select,
.mm-editor .mm-textarea,
.mm-editor .variation-dropdown,
.mm-editor .category-dropdown-trigger {
    min-height: 42px;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--mm-line-strong);
    border-radius: 9px;
    background: var(--mm-surface);
    color: var(--mm-ink);
    font-size: 0.95rem;
}

.mm-editor .mm-textarea {
    width: 100%;
    min-height: 96px;
    line-height: 1.5;
    resize: vertical;
    box-sizing: border-box;
}

.mm-editor .form-group input:focus,
.mm-editor .form-group select:focus,
.mm-editor .mm-textarea:focus,
.mm-editor .variation-dropdown:focus {
    outline: none;
    border-color: var(--mm-brand);
    box-shadow: 0 0 0 3px rgba(232, 93, 4, 0.16);
}

.mm-editor .category-dropdown-trigger:hover,
.mm-editor .category-dropdown-trigger.open {
    border-color: var(--mm-brand);
}

.mm-editor .input-hint,
.mm-editor .field-hint,
.mm-editor .variation-dropdown-hint {
    margin: 0.4rem 0 0;
    font-size: 0.82rem;
    color: var(--mm-muted);
}

/* Variation and tax toggles */
.mm-editor .variation-toggle-card {
    padding: 0.85rem 1rem;
    gap: 1rem;
    border: 1px solid var(--mm-line);
    border-radius: 10px;
    background: var(--mm-sunken);
    box-shadow: none;
}

.mm-editor .variation-toggle-card:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--mm-line-strong);
}

.mm-editor .variation-toggle-card.active {
    background: var(--mm-brand-tint);
    border-color: rgba(232, 93, 4, 0.35);
    box-shadow: none;
}

.mm-editor .variation-toggle-info h5 {
    font-size: 0.95rem;
    color: var(--mm-ink);
}

.mm-editor .variation-toggle-info span {
    font-size: 0.86rem;
    color: var(--mm-muted);
}

.mm-editor .variation-switch {
    padding: 0;
}

.mm-editor .variation-switch-track {
    width: 42px;
    height: 24px;
    padding: 0 3px;
    background: var(--mm-off);
    box-shadow: none;
}

.mm-editor .variation-switch-thumb {
    width: 18px;
    height: 18px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.mm-editor .variation-switch.checked .variation-switch-track {
    background: var(--mm-brand-strong);
    box-shadow: none;
}

.mm-editor .variation-switch.checked .variation-switch-thumb {
    transform: translateX(18px);
}

.mm-editor .variation-toggle-input:focus-visible + .variation-switch-track {
    box-shadow: var(--mm-focus);
}

.mm-editor .variation-dropdown-container {
    margin-top: 0.85rem;
    display: flex;
    flex-direction: column;
}

.mm-editor .variation-dropdown-container label {
    margin-bottom: 0.35rem;
    font-size: 0.88rem;
    font-weight: 600;
}

.mm-visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* Category picker */
.mm-editor .category-dropdown-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    text-align: left;
    cursor: pointer;
}

.mm-editor .category-dropdown-trigger:focus-visible {
    outline: none;
    border-color: var(--mm-brand);
    box-shadow: 0 0 0 3px rgba(232, 93, 4, 0.16);
}

.mm-editor .dropdown-item,
.mm-editor .dropdown-header-action {
    display: flex;
    width: 100%;
    border: none;
    text-align: left;
    font-size: 0.92rem;
    color: var(--mm-text);
    background: var(--mm-surface);
}

.mm-editor .dropdown-item {
    border-bottom: 1px solid var(--mm-line);
    cursor: pointer;
}

.mm-editor .dropdown-item:hover,
.mm-editor .dropdown-item:focus-visible {
    background: var(--mm-sunken);
    outline: none;
    box-shadow: none;
}

.mm-editor .category-dropdown-menu {
    border-color: var(--mm-line-strong);
    border-radius: 10px;
    box-shadow: 0 12px 28px rgba(24, 26, 30, 0.14);
    overflow: hidden;
}

.mm-editor .dropdown-item {
    padding: 0.6rem 0.9rem;
    border-bottom-color: var(--mm-line);
}

.mm-editor .dropdown-item.selected {
    background: var(--mm-brand-tint);
    color: var(--mm-brand-strong);
}

.mm-editor .dropdown-header-action {
    padding: 0.65rem 0.9rem;
    color: var(--mm-brand-strong);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border-bottom: 1px solid var(--mm-line);
    background: var(--mm-sunken);
}

.mm-editor .dropdown-header-action:hover {
    background: var(--mm-brand-tint);
}

.mm-editor .dropdown-create-category {
    display: flex;
    gap: 0.5rem;
    padding: 0.6rem;
    border-bottom: 1px solid var(--mm-line);
    background: var(--mm-surface);
}

.mm-editor .dropdown-create-category input {
    flex: 1;
    min-width: 0;
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--mm-line-strong);
    border-radius: 7px;
    font-size: 0.9rem;
}

.mm-editor .dropdown-create-category button {
    padding: 0.45rem 0.85rem;
    border: none;
    border-radius: 7px;
    background: var(--mm-brand-strong);
    color: #fff;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
}

.mm-editor .dropdown-list-scroll {
    max-height: 220px;
    overflow-y: auto;
}

.mm-editor .category-chip-row {
    margin-top: 0.6rem;
    gap: 0.35rem;
}

.mm-editor .category-chip {
    padding: 0.3rem 0.75rem;
    border: 1px solid var(--mm-line-strong);
    background: var(--mm-surface);
    color: var(--mm-text);
    font-size: 0.82rem;
    box-shadow: none;
}

.mm-editor .category-chip:hover {
    background: var(--mm-surface);
    border-color: var(--mm-muted);
    color: var(--mm-ink);
    box-shadow: none;
}

.mm-editor .category-chip.active {
    background: var(--mm-ink);
    border-color: var(--mm-ink);
    color: #fff;
    box-shadow: none;
}

/* Variation prices */
.mm-editor .variation-prices-section {
    margin: 0;
    padding: 1rem;
    border-radius: 10px;
    border: 1px solid var(--mm-line);
    background: var(--mm-sunken);
}

.mm-editor .variation-prices-section h4 {
    margin: 0 0 0.25rem;
    font-size: 0.95rem;
    color: var(--mm-ink);
}

.mm-editor .variation-prices-hint {
    margin: 0 0 0.75rem;
    font-size: 0.84rem;
    font-style: normal;
    color: var(--mm-muted);
}

.mm-editor .variation-prices-list {
    gap: 0.5rem;
}

.mm-editor .variation-price-input-row {
    gap: 1rem;
    padding: 0.5rem 0.5rem 0.5rem 0.85rem;
    border-color: var(--mm-line);
    border-radius: 9px;
}

.mm-editor .variation-size-info {
    flex-direction: row;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.mm-editor .variation-size-name {
    font-size: 0.95rem;
    color: var(--mm-ink);
}

.mm-editor .variation-size-type {
    font-size: 0.85rem;
    color: var(--mm-muted);
}

/* The hint above already says every size is optional. */
.mm-editor .variation-size-optional {
    display: none;
}

.mm-editor .variation-price-input-container {
    min-width: 0;
    width: 150px;
    gap: 0;
}

/* Each row is already named by its size, so the repeated "Price" label is
   kept for screen readers only. */
.mm-editor .variation-price-input-container label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.mm-editor .variation-price-input {
    min-height: 40px;
    padding: 0.45rem 0.7rem;
    border: 1px solid var(--mm-line-strong);
    border-radius: 8px;
    font-size: 0.95rem;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.mm-editor .variation-price-input:focus {
    border-color: var(--mm-brand);
    box-shadow: 0 0 0 3px rgba(232, 93, 4, 0.16);
}

/* Live POS preview */
.mm-editor .menu-edit-preview {
    position: sticky;
    top: 0;
    gap: 0.9rem;
    padding: 1rem;
    border: 1px solid var(--mm-line);
    border-radius: 12px;
    background: var(--mm-surface);
    box-shadow: none;
}

.mm-preview-label {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--mm-muted);
}

.mm-editor .preview-image-wrapper {
    border: none;
    border-radius: 10px;
    box-shadow: none;
    background: var(--mm-sunken);
}

.mm-editor .preview-details {
    gap: 0.35rem;
}

.mm-editor .preview-title {
    font-size: 1.1rem;
    color: var(--mm-ink);
    overflow-wrap: anywhere;
}

.mm-editor .preview-category {
    font-size: 0.88rem;
    color: var(--mm-muted);
}

.mm-editor .preview-price-block {
    margin-top: 0.4rem;
    padding: 0.6rem 0.75rem;
    border-radius: 9px;
    border: none;
    background: var(--mm-sunken);
}

.mm-editor .preview-price-label,
.mm-editor .preview-variations-label {
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.85rem;
    color: var(--mm-muted);
}

.mm-editor .preview-price-value {
    color: var(--mm-ink);
    font-variant-numeric: tabular-nums;
}

.mm-editor .preview-variations li {
    padding: 0.45rem 0.6rem;
    border-color: var(--mm-line);
    font-variant-numeric: tabular-nums;
}

/* ── Smaller screens ───────────────────────────────────────────────────── */

@media (max-width: 1100px) {
    .mm-row {
        grid-template-columns: 52px minmax(0, 1fr) auto auto;
    }

    .mm-row-actions {
        grid-column: 2 / -1;
        justify-content: flex-start;
        margin-top: -0.25rem;
    }
}

@media (max-width: 860px) {
    .mm-editor .menu-edit-grid {
        grid-template-columns: 1fr;
    }

    .mm-editor .menu-edit-preview {
        position: static;
        order: 2;
    }
}

@media (max-width: 768px) {
    /* Matches the 0.75rem padding .admin-content uses on phones. */
    .mm-root,
    .mm-editor-layer {
        --mm-gutter: 0.75rem;
    }

    .mm-toolbar {
        gap: 0.5rem;
    }

    .mm-segment button {
        padding: 0 0.6rem;
        gap: 0.3rem;
    }

    .mm-view-toggle button {
        width: 34px;
        padding: 0;
    }

    .mm-root .mm-title {
        font-size: 1.5rem;
    }

    .mm-head .mm-btn-primary {
        min-height: 44px;
    }

    .mm-tabs {
        margin-bottom: 1rem;
        margin-inline: calc(var(--mm-gutter) * -1);
        padding-inline: calc(var(--mm-gutter) - 0.5rem);
    }

    .mm-search {
        flex-basis: 100%;
        max-width: none;
    }

    .mm-view-toggle {
        margin-left: auto;
    }

    .mm-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.65rem;
    }

    .mm-card-body {
        padding: 0.65rem 0.7rem 0.6rem;
    }

    .mm-card-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.4rem;
    }

    .mm-card-actions {
        padding: 0.35rem 0.4rem;
        gap: 0;
        justify-content: space-between;
    }

    .mm-card-actions .mm-edit {
        margin-right: 0;
        padding: 0;
        width: 36px;
        border: none;
    }

    .mm-card-actions .mm-edit span {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    .mm-icon-btn {
        width: 36px;
        height: 36px;
    }

    .mm-row {
        grid-template-columns: 48px minmax(0, 1fr) auto;
        gap: 0.4rem 0.75rem;
        padding: 0.65rem 0.75rem;
    }

    .mm-row-thumb {
        width: 48px;
        height: 48px;
        grid-row: span 2;
        align-self: start;
    }

    .mm-row .mm-switch {
        grid-column: 2;
        grid-row: 2;
    }

    .mm-row-actions {
        grid-column: 3;
        grid-row: 2;
        margin-top: 0;
        justify-content: flex-end;
    }

    .mm-row-actions .mm-edit span {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    .mm-row-actions .mm-edit {
        margin-right: 0;
        width: 36px;
        padding: 0;
        border: none;
    }

    .mm-editor-head,
    .mm-editor-body,
    .mm-editor-foot {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .mm-editor .form-row {
        grid-template-columns: 1fr;
    }

    .mm-editor-foot .mm-btn {
        flex: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mm-editor,
    .mm-editor-backdrop,
    .mm-skeleton-card > span {
        animation: none;
    }

    .mm-switch-thumb,
    .mm-switch-track {
        transition: none;
    }
}
/* ─────────────────────────────────────────────────────────────────────────────
   Portion Manager Page — unified portion + recipe editor
   ───────────────────────────────────────────────────────────────────────────── */

/* Layout */
.pm-container {
  display: flex;
  height: calc(100vh - 120px);
  min-height: 500px;
  overflow: hidden;
  background: #f9fafb;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
}

/* ── LEFT SIDEBAR ──────────────────────────────────────────────────────────── */

.pm-sidebar {
  width: 220px;
  min-width: 180px;
  border-right: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  background: #fff;
}

.pm-sidebar-top {
  padding: 14px 12px 10px;
  border-bottom: 1px solid #f3f4f6;
}

.pm-sidebar-title {
  font-size: 12px;
  font-weight: 700;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 8px;
}

.pm-search-wrap {
  position: relative;
}
.pm-search-icon {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
}
.pm-search-input {
  width: 100%;
  padding: 6px 8px 6px 26px;
  font-size: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  outline: none;
  box-sizing: border-box;
  color: #374151;
}
.pm-search-input:focus { border-color: #6366f1; }

.pm-sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.pm-sidebar-loading,
.pm-sidebar-empty {
  font-size: 12px;
  color: #9ca3af;
  text-align: center;
  padding: 16px 12px;
}

.pm-cat-group { margin-bottom: 4px; }

.pm-cat-label {
  font-size: 10px;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 6px 12px 3px;
}

.pm-menu-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 7px 12px;
  font-size: 12.5px;
  color: #374151;
  background: none;
  border: none;
  cursor: pointer;
  transition: background 0.12s;
  line-height: 1.35;
}
.pm-menu-btn:hover { background: #f3f4f6; }
.pm-menu-btn--active {
  background: #eef2ff;
  color: #4f46e5;
  font-weight: 600;
}

/* ── MAIN AREA ─────────────────────────────────────────────────────────────── */

.pm-main {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.pm-loading-main {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  font-size: 13px;
  color: #9ca3af;
}

/* Placeholder */
.pm-placeholder {
  padding: 36px 40px;
  max-width: 640px;
}
.pm-placeholder-icon {
  font-size: 40px;
  margin-bottom: 14px;
}
.pm-placeholder h3 {
  font-size: 17px;
  font-weight: 600;
  color: #1f2937;
  margin: 0 0 8px;
}
.pm-placeholder > p {
  font-size: 13px;
  color: #6b7280;
  margin: 0 0 24px;
  line-height: 1.6;
}

.pm-how-it-works {
  background: #f8faff;
  border: 1px solid #e0e7ff;
  border-radius: 10px;
  padding: 18px 20px;
}
.pm-how-it-works h4 {
  font-size: 13px;
  font-weight: 600;
  color: #4f46e5;
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.pm-how-steps { display: flex; flex-direction: column; gap: 14px; }
.pm-how-step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.pm-how-num {
  width: 22px;
  height: 22px;
  min-width: 22px;
  border-radius: 50%;
  background: #6366f1;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 22px;
  margin-top: 1px;
}
.pm-how-step > div:not(.pm-how-num) { flex: 1; }
.pm-how-step strong { font-size: 13px; color: #1f2937; display: block; margin-bottom: 3px; }
.pm-how-step p { font-size: 12px; color: #6b7280; margin: 0 0 3px; line-height: 1.5; }
.pm-how-step em { font-size: 11.5px; color: #9ca3af; }

/* Item header */
.pm-item-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px 20px 12px;
  border-bottom: 1px solid #f3f4f6;
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
}
.pm-item-name { font-size: 16px; font-weight: 700; color: #1f2937; margin: 0 0 3px; }
.pm-item-subtitle { font-size: 12px; color: #9ca3af; margin: 0; }

/* Variation tabs */
.pm-var-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 20px 0;
  border-bottom: 2px solid #f3f4f6;
  background: #fff;
  flex-wrap: wrap;
}
.pm-var-tab {
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 500;
  color: #6b7280;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: all 0.15s;
}
.pm-var-tab:hover { color: #4f46e5; }
.pm-var-tab--active { color: #4f46e5; border-bottom-color: #4f46e5; font-weight: 600; }

/* ── Portion items section ─────────────────────────────────────────────────── */

.pm-portion-section {
  padding: 16px 20px;
  background: #fff;
  border-bottom: 1px solid #f0f0f0;
}

.pm-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}
.pm-section-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pm-section-title span:first-child {
  font-size: 13.5px;
  font-weight: 600;
  color: #1f2937;
}
.pm-section-hint {
  font-size: 11.5px !important;
  color: #9ca3af !important;
  font-weight: 400 !important;
}

.pm-empty-portion {
  text-align: center;
  padding: 24px;
  color: #9ca3af;
  font-size: 13px;
  background: #f9fafb;
  border-radius: 8px;
  border: 1px dashed #e5e7eb;
  line-height: 1.7;
}

/* Portion table */
.pm-portion-list {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: visible;
}

.pm-portion-hdr,
.pm-portion-row {
  display: grid;
  grid-template-columns: 2fr 90px 80px 150px 1fr 36px;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
}

.pm-portion-hdr {
  font-size: 11px;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid #f3f4f6;
  background: #f9fafb;
  border-radius: 8px 8px 0 0;
}

.pm-portion-row {
  border-bottom: 1px solid #f9fafb;
  background: #fff;
}
.pm-portion-row:last-child { border-bottom: none; }
.pm-portion-row:hover { background: #fafafa; }

.pm-pi-name {
  width: 100%;
  padding: 5px 8px;
  font-size: 12.5px;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  outline: none;
  color: #1f2937;
  box-sizing: border-box;
}
.pm-pi-name:focus { border-color: #6366f1; }

.pm-pi-qty {
  width: 100%;
  padding: 5px 6px;
  font-size: 12.5px;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  outline: none;
  color: #1f2937;
  box-sizing: border-box;
  text-align: right;
}
.pm-pi-qty:focus { border-color: #6366f1; }

.pm-pi-sel {
  width: 100%;
  padding: 5px 6px;
  font-size: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  outline: none;
  color: #374151;
  background: #fff;
  cursor: pointer;
  box-sizing: border-box;
}
.pm-pi-sel:focus { border-color: #6366f1; }

.pm-pi-na {
  font-size: 11px;
  color: #d1d5db;
  font-style: italic;
}

/* Stock link cell */
.pm-pi-link-cell { position: relative; }

.pm-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 9px;
  font-size: 11.5px;
  border: 1px solid #d1d5db;
  border-radius: 5px;
  background: #fff;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
}
.pm-link-btn:hover { border-color: #6366f1; color: #4f46e5; }
.pm-link-btn--linked {
  border-color: #10b981;
  color: #059669;
  background: #f0fdf4;
}

/* Delete button */
.pm-del-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 5px;
  background: none;
  color: #d1d5db;
  cursor: pointer;
  transition: all 0.12s;
}
.pm-del-btn:hover { background: #fef2f2; color: #ef4444; }

/* Recipe toggle row */
.pm-recipe-toggle-row {
  grid-column: 1 / -1;
  padding: 2px 10px 6px 10px;
  background: #fff;
  border-bottom: 1px solid #f3f4f6;
}
.pm-recipe-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  padding: 4px 10px;
  border-radius: 5px;
  border: 1px dashed #d1d5db;
  background: #f9fafb;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.12s;
}
.pm-recipe-toggle:hover { background: #eef2ff; border-color: #6366f1; color: #4f46e5; }
.pm-recipe-toggle--open { background: #eef2ff; border-color: #6366f1; color: #4f46e5; border-style: solid; }
.pm-recipe-toggle--has-recipe {
  border-color: #10b981;
  color: #059669;
  background: #f0fdf4;
  border-style: solid;
}
.pm-recipe-toggle--open.pm-recipe-toggle--has-recipe {
  background: #ecfdf5;
  border-color: #059669;
}

/* ── Dropdown (shared) ─────────────────────────────────────────────────────── */

.pm-dropdown {
  position: absolute;
  top: calc(100% + 3px);
  left: 0;
  min-width: 240px;
  max-width: 320px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 200;
  overflow: hidden;
}
.pm-dropdown-search {
  width: 100%;
  padding: 8px 12px;
  font-size: 12.5px;
  border: none;
  border-bottom: 1px solid #f3f4f6;
  outline: none;
  box-sizing: border-box;
  color: #374151;
}
.pm-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 12px;
  font-size: 12.5px;
  color: #374151;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
}
.pm-dropdown-item:hover { background: #f5f3ff; }
.pm-dropdown-empty { padding: 10px 12px; font-size: 12px; color: #9ca3af; }
.pm-dropdown-clear {
  display: block;
  width: 100%;
  padding: 7px 12px;
  font-size: 12px;
  color: #ef4444;
  background: none;
  border: none;
  border-top: 1px solid #fef2f2;
  cursor: pointer;
  text-align: left;
}
.pm-dropdown-clear:hover { background: #fef2f2; }

.pm-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
  flex-shrink: 0;
}
.pm-badge--custom { background: #ede9fe; color: #6d28d9; }
.pm-badge--global { background: #dbeafe; color: #1d4ed8; }

/* ── Type dropdown (coloured by type) ─────────────────────────────────────── */

.pm-pi-type-sel {
  width: 100%;
  padding: 5px 6px;
  font-size: 12.5px;
  border: 1.5px solid #e5e7eb;
  border-radius: 6px;
  outline: none;
  background: #fff;
  color: #374151;
  cursor: pointer;
  font-weight: 600;
  box-sizing: border-box;
}
.pm-pi-type-sel:focus { border-color: #6366f1; }
.pm-pi-type-sel--ingredient { border-color: #10b981; color: #065f46; background: #f0fdf4; }
.pm-pi-type-sel--recipe     { border-color: #6366f1; color: #3730a3; background: #eef2ff; }
.pm-pi-type-sel--commodity  { border-color: #d1d5db; color: #6b7280; background: #f9fafb; }

/* ── Status badges ─────────────────────────────────────────────────────────── */

.pm-pi-status { display: flex; align-items: center; min-width: 0; }

.pm-status {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 20px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}
.pm-status--linked   { background: #d1fae5; color: #065f46; }
.pm-status--auto     { background: #fef9c3; color: #92400e; }
.pm-status--recipe   { background: #ede9fe; color: #4c1d95; }
.pm-status--warn     { background: #fee2e2; color: #991b1b; }
.pm-status--commodity{ background: #f3f4f6; color: #6b7280; }

/* ── Save status message ─────────────────────────────────────────────────────*/

.pm-item-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.pm-save-status {
  font-size: 12px;
  color: #059669;
  font-weight: 500;
  background: #d1fae5;
  padding: 4px 12px;
  border-radius: 20px;
  white-space: nowrap;
}

/* ── Auto-register notice ────────────────────────────────────────────────────*/

.pm-auto-register-notice {
  font-size: 12px;
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 6px;
  padding: 8px 12px;
  margin-bottom: 10px;
  line-height: 1.5;
}

/* ── Recipe ing link status ─────────────────────────────────────────────────*/

.pm-link-status--auto { color: #b45309; font-size: 11.5px; }

/* ── Add / Save buttons ──────────────────────────────────────────────────────*/

.pm-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #fff;
  color: #374151;
  cursor: pointer;
  transition: all 0.12s;
}
.pm-add-btn:hover { border-color: #6366f1; color: #4f46e5; background: #f5f3ff; }

.pm-save-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 16px;
  font-size: 12.5px;
  font-weight: 600;
  border: none;
  border-radius: 7px;
  background: #4f46e5;
  color: #fff;
  cursor: pointer;
  transition: all 0.15s;
}
.pm-save-btn:hover { background: #4338ca; }
.pm-save-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.pm-save-btn--ok { background: #10b981; }
.pm-save-btn--ok:hover { background: #059669; }

.pm-ai-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid #c4b5fd;
  border-radius: 6px;
  background: #ede9fe;
  color: #6d28d9;
  cursor: pointer;
  transition: all 0.12s;
}
.pm-ai-btn:hover:not(:disabled) { background: #ddd6fe; border-color: #8b5cf6; }
.pm-ai-btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ── Recipe Editor ─────────────────────────────────────────────────────────── */

.pm-recipe-editor {
  margin: 0 20px 12px;
  background: #fff;
  border: 1.5px solid #c7d2fe;
  border-radius: 10px;
  overflow: hidden;
}

.pm-recipe-editor-hdr {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 14px 18px 10px;
  background: linear-gradient(135deg, #eef2ff, #f5f3ff);
  border-bottom: 1px solid #e0e7ff;
}
.pm-recipe-title {
  font-size: 14px;
  font-weight: 700;
  color: #3730a3;
  margin: 0 0 4px;
}
.pm-recipe-title em { font-style: normal; color: #4f46e5; }
.pm-recipe-subtitle {
  font-size: 12px;
  color: #6b7280;
  margin: 0;
  line-height: 1.5;
}
.pm-recipe-close {
  background: none;
  border: none;
  font-size: 15px;
  color: #9ca3af;
  cursor: pointer;
  padding: 0 4px;
  flex-shrink: 0;
}
.pm-recipe-close:hover { color: #374151; }

/* Yield row */
.pm-yield-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-bottom: 1px solid #f3f4f6;
  flex-wrap: wrap;
}
.pm-yield-label {
  font-size: 12.5px;
  font-weight: 600;
  color: #374151;
  white-space: nowrap;
}
.pm-yield-hint {
  font-size: 12px;
  color: #9ca3af;
  white-space: nowrap;
}
.pm-yield-input {
  width: 100px;
  padding: 5px 8px;
  font-size: 13px;
  font-weight: 600;
  border: 1.5px solid #c7d2fe;
  border-radius: 6px;
  outline: none;
  color: #1f2937;
  text-align: right;
}
.pm-yield-input:focus { border-color: #6366f1; }
.pm-yield-unit {
  padding: 5px 8px;
  font-size: 12.5px;
  border: 1.5px solid #c7d2fe;
  border-radius: 6px;
  outline: none;
  background: #fff;
  color: #374151;
  cursor: pointer;
}
.pm-yield-unit:focus { border-color: #6366f1; }
.pm-yield-scale {
  font-size: 12px;
  color: #4f46e5;
  background: #eef2ff;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 500;
  white-space: nowrap;
}

/* Warning */
.pm-warn {
  margin: 0;
  padding: 10px 18px;
  font-size: 12.5px;
  color: #b45309;
  background: #fffbeb;
  border-bottom: 1px solid #fef3c7;
}

/* Raw ingredients */
.pm-recipe-ings { padding: 14px 18px; }
.pm-recipe-ings-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.pm-recipe-ings-title {
  font-size: 12.5px;
  font-weight: 600;
  color: #374151;
}
.pm-recipe-ings-title em { font-style: normal; color: #9ca3af; font-weight: 400; }

.pm-recipe-empty {
  text-align: center;
  padding: 20px;
  color: #9ca3af;
  font-size: 12.5px;
  background: #f9fafb;
  border-radius: 7px;
  border: 1px dashed #e5e7eb;
}

.pm-recipe-ing-list { border: 1px solid #e5e7eb; border-radius: 7px; overflow: visible; }

.pm-recipe-ing-hdr,
.pm-recipe-ing-row {
  display: grid;
  grid-template-columns: 2fr 130px 80px 1fr 36px;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
}
.pm-recipe-ing-hdr {
  font-size: 11px;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid #f3f4f6;
  background: #f9fafb;
  border-radius: 7px 7px 0 0;
}
.pm-recipe-ing-row {
  border-bottom: 1px solid #f9fafb;
}
.pm-recipe-ing-row:last-child { border-bottom: none; }
.pm-recipe-ing-row:hover { background: #fafafa; }

.pm-recipe-ing-name-wrap { position: relative; }

.pm-recipe-ing-name {
  width: 100%;
  padding: 5px 8px;
  font-size: 12.5px;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  outline: none;
  color: #1f2937;
  box-sizing: border-box;
}
.pm-recipe-ing-name:focus { border-color: #6366f1; }
.pm-recipe-ing-name--linked {
  border-color: #10b981;
  background: #f0fdf4;
  color: #065f46;
}

.pm-recipe-ing-qty {
  width: 100%;
  padding: 5px 8px;
  font-size: 12.5px;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  outline: none;
  color: #1f2937;
  text-align: right;
  box-sizing: border-box;
}
.pm-recipe-ing-qty:focus { border-color: #6366f1; }

.pm-link-status { font-size: 11.5px; white-space: nowrap; }
.pm-link-status--linked { color: #059669; }
.pm-link-status--auto  { color: #b45309; font-size: 11px; }
.pm-link-status--none { color: #d1d5db; }
.pm-link-status--none em { font-style: italic; }

/* Stock status + alternatives toggle cell */
.pm-ing-status-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
}

/* Alt toggle button (inside status cell) */
.pm-alt-toggle-btn {
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px dashed #d1d5db;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
}
.pm-alt-toggle-btn:hover { background: #f3f4f6; border-color: #9ca3af; color: #374151; }
.pm-alt-toggle-btn--open { border-style: solid; background: #eff6ff; border-color: #6366f1; color: #4338ca; }
.pm-alt-toggle-btn--has  { border-color: #6366f1; color: #4338ca; background: #eff6ff; }

/* ── Alternatives panel ──────────────────────────────────────────────────── */

.pm-alt-panel {
  grid-column: 1 / -1;
  background: #faf5ff;
  border-top: 1px solid #e9d5ff;
  border-bottom: 1px solid #e9d5ff;
  padding: 10px 14px 12px;
}

.pm-alt-panel-hdr {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.pm-alt-panel-title {
  font-size: 12px;
  color: #4b5563;
}
.pm-alt-panel-title strong { color: #1f2937; }

.pm-alt-panel-note {
  font-size: 11px;
  color: #7c3aed;
  background: #f3e8ff;
  border-radius: 5px;
  padding: 5px 9px;
  margin-bottom: 8px;
  line-height: 1.5;
}
.pm-alt-panel-note em { font-style: normal; font-weight: 600; }

.pm-alt-empty {
  font-size: 12px;
  color: #9ca3af;
  padding: 6px 0;
  font-style: italic;
}

.pm-alt-row {
  display: grid;
  grid-template-columns: 1fr 80px 170px 32px;
  align-items: center;
  gap: 6px;
  padding: 5px 0;
  border-bottom: 1px solid #f3e8ff;
}
.pm-alt-row:last-child { border-bottom: none; }

.pm-alt-name-wrap { position: relative; }

.pm-alt-name {
  width: 100%;
  padding: 5px 8px;
  font-size: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  outline: none;
  color: #1f2937;
  box-sizing: border-box;
  background: #fff;
}
.pm-alt-name:focus { border-color: #7c3aed; }
.pm-alt-name--linked { border-color: #7c3aed; background: #faf5ff; color: #4c1d95; }

.pm-alt-unit-sel { width: 100%; }

.pm-alt-ratio-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  padding: 3px 7px;
}
.pm-alt-ratio-lbl  { font-size: 11px; color: #6b7280; white-space: nowrap; }
.pm-alt-ratio-input {
  width: 54px;
  border: none;
  outline: none;
  font-size: 12px;
  font-weight: 600;
  color: #4c1d95;
  text-align: center;
  background: transparent;
}
.pm-alt-ratio-unit { font-size: 11px; color: #6b7280; white-space: nowrap; }

/* Recipe footer */
.pm-recipe-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-top: 1px solid #f3f4f6;
  background: #fafafa;
}
.pm-unsaved {
  font-size: 11.5px;
  color: #f59e0b;
  font-style: italic;
}

/* ── Deduction Preview ─────────────────────────────────────────────────────── */

.pm-preview {
  margin: 16px 20px 20px;
  background: #fff;
  border: 1.5px solid #d1fae5;
  border-radius: 10px;
  overflow: hidden;
}

.pm-preview-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #064e3b;
  margin: 0;
  padding: 12px 16px;
  background: linear-gradient(135deg, #ecfdf5, #f0fdf4);
  border-bottom: 1px solid #d1fae5;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.pm-preview-subtitle {
  font-size: 12px;
  font-weight: 400;
  color: #6b7280;
}
.pm-preview-subtitle em { font-style: normal; color: #374151; font-weight: 500; }

.pm-preview-component {
  padding: 10px 16px;
  border-bottom: 1px solid #f3f4f6;
}
.pm-preview-component:last-child { border-bottom: none; }
.pm-preview-component--direct { border-left: 3px solid #10b981; }
.pm-preview-component--recipe { border-left: 3px solid #6366f1; }
.pm-preview-component--purchased { border-left: 3px solid #f59e0b; }
.pm-preview-component--no_recipe { border-left: 3px solid #ef4444; background: #fff7f7; }
.pm-preview-component--commodity { border-left: 3px solid #d1d5db; background: #f9fafb; }
.pm-preview-component--loading { border-left: 3px solid #e5e7eb; }

.pm-preview-comp-hdr {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.pm-preview-comp-name { font-size: 13px; color: #1f2937; }
.pm-preview-comp-qty {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  background: #f3f4f6;
  padding: 2px 8px;
  border-radius: 4px;
}
.pm-preview-comp-method { font-size: 12px; color: #6b7280; margin-left: auto; }

.pm-preview-warn {
  font-size: 12px;
  color: #b45309;
  background: #fffbeb;
  padding: 5px 10px;
  border-radius: 5px;
  margin-bottom: 6px;
}

.pm-preview-lines { padding-left: 8px; }
.pm-preview-line {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  font-size: 12.5px;
}
.pm-preview-arrow { color: #9ca3af; font-size: 11px; flex-shrink: 0; }
.pm-preview-ing { color: #374151; min-width: 120px; }
.pm-preview-calc { color: #6b7280; font-size: 12px; }
.pm-preview-calc strong { color: #1f2937; }

.pm-preview-action {
  font-size: 12px;
  color: #ef4444;
  margin-top: 4px;
  font-style: italic;
}

/* ── Missing-recipe banner ───────────────────────────────────────────────────*/

.pm-missing-recipe-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 10px 14px;
  margin: 0 16px 12px;
  flex-shrink: 0;
}

.pm-missing-recipe-text {
  font-size: 13px;
  color: #92400e;
  line-height: 1.4;
}

.pm-missing-recipe-names {
  font-size: 11px;
  color: #b45309;
  margin-left: 6px;
}

.pm-register-missing-btn {
  flex-shrink: 0;
  padding: 6px 14px;
  background: #f59e0b;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.pm-register-missing-btn:hover:not(:disabled) { background: #d97706; }
.pm-register-missing-btn:disabled { opacity: 0.6; cursor: not-allowed; }
/* ─────────────────────────────────────────────────────────────────────────────
   Recipe Manager Page
   ───────────────────────────────────────────────────────────────────────────── */

/* ── Layout ──────────────────────────────────────────────────────────────── */

.rm-container {
  display: flex;
  height: calc(100vh - 120px);
  min-height: 500px;
  overflow: hidden;
  background: #f9fafb;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
}

/* ── LEFT SIDEBAR ─────────────────────────────────────────────────────────── */

.rm-sidebar {
  width: 220px;
  min-width: 180px;
  border-right: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  background: #fff;
}

.rm-sidebar-top {
  padding: 14px 12px 10px;
  border-bottom: 1px solid #f3f4f6;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rm-sidebar-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.rm-sidebar-title {
  font-size: 12px;
  font-weight: 700;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0;
}

.rm-sidebar-count {
  font-size: 11px;
  font-weight: 600;
  background: #e0e7ff;
  color: #4338ca;
  border-radius: 10px;
  padding: 1px 7px;
}

.rm-search-wrap {
  position: relative;
}

.rm-search-icon {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  pointer-events: none;
}

.rm-search-input {
  width: 100%;
  padding: 6px 8px 6px 26px;
  font-size: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  outline: none;
  box-sizing: border-box;
  color: #374151;
}
.rm-search-input:focus { border-color: #6366f1; }

.rm-sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.rm-sidebar-bottom {
  padding: 10px 12px;
  border-top: 1px solid #f3f4f6;
  background: #fff;
}

.rm-new-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 9px 10px;
  font-size: 12.5px;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #fff;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}
.rm-new-btn:hover {
  background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.45);
  transform: translateY(-1px);
}

.rm-sidebar-loading,
.rm-sidebar-empty {
  font-size: 12px;
  color: #9ca3af;
  text-align: center;
  padding: 16px 12px;
  white-space: pre-line;
  line-height: 1.6;
}

.rm-recipe-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  padding: 8px 12px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.1s;
  gap: 2px;
}
.rm-recipe-btn:hover { background: #f3f4f6; }
.rm-recipe-btn--active { background: #eef2ff; }

.rm-recipe-btn-name {
  font-size: 12.5px;
  color: #374151;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.rm-recipe-btn--active .rm-recipe-btn-name { color: #4f46e5; font-weight: 600; }

.rm-recipe-btn-meta {
  font-size: 11px;
  color: #9ca3af;
  display: flex;
  align-items: center;
  gap: 5px;
}

.rm-ing-count-badge {
  font-size: 10px;
  font-weight: 600;
  background: #e0e7ff;
  color: #4338ca;
  border-radius: 10px;
  padding: 1px 6px;
}

/* ── MAIN AREA ────────────────────────────────────────────────────────────── */

.rm-main {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* ── Placeholder ─────────────────────────────────────────────────────────── */

.rm-placeholder {
  padding: 36px 40px;
  max-width: 620px;
}

.rm-placeholder-icon {
  font-size: 40px;
  margin-bottom: 14px;
}

.rm-placeholder h3 {
  font-size: 17px;
  font-weight: 600;
  color: #1f2937;
  margin: 0 0 8px;
}

.rm-placeholder > p {
  font-size: 13px;
  color: #6b7280;
  margin: 0 0 24px;
  line-height: 1.6;
}

.rm-how-it-works {
  background: #f8faff;
  border: 1px solid #e0e7ff;
  border-radius: 10px;
  padding: 18px 20px;
}

.rm-how-it-works h4 {
  font-size: 13px;
  font-weight: 600;
  color: #4f46e5;
  margin: 0 0 14px;
}

.rm-how-steps { display: flex; flex-direction: column; gap: 14px; }

.rm-how-step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.rm-how-num {
  width: 22px;
  height: 22px;
  min-width: 22px;
  border-radius: 50%;
  background: #6366f1;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 22px;
  margin-top: 1px;
}

.rm-how-step > div:not(.rm-how-num) { flex: 1; }
.rm-how-step strong { font-size: 13px; color: #1f2937; display: block; margin-bottom: 3px; }
.rm-how-step p { font-size: 12px; color: #6b7280; margin: 0; line-height: 1.5; }

/* ── Recipe header ───────────────────────────────────────────────────────── */

.rm-item-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px 12px;
  border-bottom: 1px solid #f3f4f6;
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
  flex-wrap: wrap;
}

.rm-header-left {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.rm-recipe-name-input {
  font-size: 17px;
  font-weight: 700;
  color: #1f2937;
  border: none;
  border-bottom: 2px solid #e5e7eb;
  outline: none;
  padding: 2px 0 4px;
  background: transparent;
  width: 100%;
  max-width: 380px;
  transition: border-color 0.15s;
}
.rm-recipe-name-input:focus { border-bottom-color: #6366f1; }
.rm-recipe-name-input::placeholder { color: #d1d5db; font-weight: 400; font-size: 15px; }

.rm-yield-row {
  display: flex;
  align-items: center;
  gap: 7px;
}

.rm-yield-label {
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  white-space: nowrap;
}

.rm-yield-input {
  width: 80px;
  padding: 4px 7px;
  font-size: 13px;
  font-weight: 600;
  border: 1.5px solid #c7d2fe;
  border-radius: 6px;
  outline: none;
  color: #1f2937;
  text-align: right;
}
.rm-yield-input:focus { border-color: #6366f1; }

.rm-yield-unit {
  padding: 4px 7px;
  font-size: 12.5px;
  border: 1.5px solid #c7d2fe;
  border-radius: 6px;
  outline: none;
  background: #fff;
  color: #374151;
  cursor: pointer;
}
.rm-yield-unit:focus { border-color: #6366f1; }

.rm-yield-hint {
  font-size: 11px;
  color: #6366f1;
  font-style: italic;
  margin-top: 3px;
  display: block;
}

.rm-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding-top: 4px;
}

.rm-save-msg {
  font-size: 12px;
  color: #059669;
  font-weight: 500;
  background: #d1fae5;
  padding: 4px 12px;
  border-radius: 20px;
  white-space: nowrap;
}

.rm-ai-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 13px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid #c4b5fd;
  border-radius: 7px;
  background: #ede9fe;
  color: #6d28d9;
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
}
.rm-ai-btn:hover:not(:disabled) { background: #ddd6fe; border-color: #8b5cf6; }
.rm-ai-btn:disabled { opacity: 0.55; cursor: not-allowed; }

.rm-save-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 16px;
  font-size: 12.5px;
  font-weight: 600;
  border: none;
  border-radius: 7px;
  background: #4f46e5;
  color: #fff;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.rm-save-btn:hover:not(:disabled) { background: #4338ca; }
.rm-save-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ── Instructions ────────────────────────────────────────────────────────── */

.rm-instructions-wrap {
  padding: 10px 20px;
  background: #fff;
  border-bottom: 1px solid #f3f4f6;
}

.rm-instructions {
  width: 100%;
  padding: 8px 10px;
  font-size: 12.5px;
  color: #374151;
  border: 1px solid #e5e7eb;
  border-radius: 7px;
  outline: none;
  resize: vertical;
  box-sizing: border-box;
  font-family: inherit;
  line-height: 1.5;
  background: #fafafa;
}
.rm-instructions:focus { border-color: #6366f1; background: #fff; }

/* ── Ingredients section ─────────────────────────────────────────────────── */

.rm-ings-section {
  padding: 14px 20px 20px;
  background: #fff;
  flex: 1;
}

.rm-section-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.rm-section-title {
  font-size: 13.5px;
  font-weight: 600;
  color: #1f2937;
}

.rm-section-hint {
  font-size: 12px;
  color: #9ca3af;
}

.rm-loading,
.rm-empty {
  text-align: center;
  padding: 28px 20px;
  font-size: 13px;
  color: #9ca3af;
  background: #f9fafb;
  border-radius: 8px;
  border: 1px dashed #e5e7eb;
  line-height: 1.7;
}

.rm-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #fff;
  color: #374151;
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
}
.rm-add-btn:hover { border-color: #6366f1; color: #4f46e5; background: #f5f3ff; }

/* ── Ingredient table ────────────────────────────────────────────────────── */

.rm-ing-list {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: visible;
}

.rm-ing-hdr,
.rm-ing-row {
  display: grid;
  grid-template-columns: 22px 1fr 80px 80px 90px 100px 44px 30px;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
}

.rm-ing-hdr {
  font-size: 11px;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid #f3f4f6;
  background: #f9fafb;
  border-radius: 8px 8px 0 0;
}

.rm-ing-row {
  border-bottom: 1px solid #f9fafb;
  background: #fff;
}
.rm-ing-row:last-child { border-bottom: none; }
.rm-ing-row:hover { background: #fafafa; }

.rm-ing-num {
  font-size: 11px;
  color: #d1d5db;
  text-align: center;
  font-weight: 500;
}

/* Name + dropdown */
.rm-ing-name-wrap { position: relative; }

.rm-ing-name {
  width: 100%;
  padding: 5px 8px;
  font-size: 12.5px;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  outline: none;
  color: #1f2937;
  box-sizing: border-box;
  transition: border-color 0.12s;
}
.rm-ing-name:focus { border-color: #6366f1; }
.rm-ing-name--linked { border-color: #10b981; background: #f0fdf4; color: #065f46; }

.rm-dropdown {
  position: absolute;
  top: calc(100% + 3px);
  left: 0;
  min-width: 240px;
  max-width: 320px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 200;
  overflow: hidden;
}

.rm-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 12px;
  font-size: 12.5px;
  color: #374151;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  gap: 8px;
}
.rm-dropdown-item:hover { background: #f5f3ff; }

.rm-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
  flex-shrink: 0;
}
.rm-badge--custom { background: #ede9fe; color: #6d28d9; }
.rm-badge--global { background: #dbeafe; color: #1d4ed8; }

/* Qty */
.rm-ing-qty {
  width: 100%;
  padding: 5px 6px;
  font-size: 12.5px;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  outline: none;
  color: #1f2937;
  text-align: right;
  box-sizing: border-box;
}
.rm-ing-qty:focus { border-color: #6366f1; }

/* Unit */
.rm-ing-unit {
  width: 100%;
  padding: 5px 4px;
  font-size: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  outline: none;
  color: #374151;
  background: #fff;
  cursor: pointer;
  box-sizing: border-box;
}
.rm-ing-unit:focus { border-color: #6366f1; }

/* Per serving column */
.rm-per-serving-col {
  font-size: 11px;
  color: #6366f1;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rm-ing-hdr .rm-per-serving-col {
  color: #9ca3af;
  font-weight: 600;
  font-size: 11px;
}
.rm-per-serving-val {
  font-size: 11.5px;
  color: #4f46e5;
  background: #eef2ff;
  border-radius: 4px;
  padding: 2px 6px;
  text-align: center;
}

/* Stock link status */
.rm-link-status {
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rm-link-status--linked { color: #059669; }
.rm-link-status--none { color: #d1d5db; }
.rm-link-status--none em { font-style: italic; }

/* Delete */
.rm-del-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 5px;
  background: none;
  color: #d1d5db;
  cursor: pointer;
  transition: all 0.12s;
}
.rm-del-btn:hover { background: #fef2f2; color: #ef4444; }

/* ── Alts toggle button ───────────────────────────────────────────────────── */

.rm-alts-btn {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 600;
  border: 1.5px solid #e5e7eb;
  border-radius: 5px;
  background: #fff;
  color: #9ca3af;
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
}
.rm-alts-btn:hover:not(:disabled) { border-color: #a78bfa; color: #7c3aed; background: #f5f3ff; }
.rm-alts-btn--has  { border-color: #a78bfa; color: #6d28d9; background: #ede9fe; }
.rm-alts-btn--open { border-color: #7c3aed; background: #ede9fe; color: #5b21b6; }
.rm-alts-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Alternatives panel ───────────────────────────────────────────────────── */

.rm-alt-panel {
  grid-column: 1 / -1;
  background: #f8f5ff;
  border-top: 1px solid #ede9fe;
  border-bottom: 1px solid #ede9fe;
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rm-alt-panel-hdr {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.rm-alt-panel-title {
  font-size: 12.5px;
  font-weight: 600;
  color: #5b21b6;
}

.rm-alt-panel-hint {
  font-size: 11.5px;
  color: #7c3aed;
  opacity: 0.75;
  line-height: 1.5;
}

.rm-alt-empty {
  font-size: 12px;
  color: #9ca3af;
  margin: 0;
  font-style: italic;
}

.rm-alt-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid #e9d5ff;
  border-radius: 7px;
  overflow: visible;
  background: #fff;
}

.rm-alt-hdr {
  display: grid;
  grid-template-columns: 1fr 80px 1fr 28px;
  gap: 6px;
  padding: 5px 10px;
  font-size: 10.5px;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #faf5ff;
  border-radius: 7px 7px 0 0;
  border-bottom: 1px solid #e9d5ff;
}

.rm-alt-hdr em { font-style: normal; font-weight: 400; }

.rm-alt-row {
  display: grid;
  grid-template-columns: 1fr 80px 1fr 28px;
  gap: 6px;
  padding: 6px 10px;
  align-items: center;
  border-bottom: 1px solid #f3e8ff;
}
.rm-alt-row:last-child { border-bottom: none; }

.rm-alt-name-wrap { position: relative; }

.rm-alt-name-input {
  width: 100%;
  padding: 5px 8px;
  font-size: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  outline: none;
  box-sizing: border-box;
  color: #1f2937;
  transition: border-color 0.12s;
}
.rm-alt-name-input:focus { border-color: #8b5cf6; }
.rm-alt-name--linked { border-color: #10b981; background: #f0fdf4; color: #065f46; }

.rm-alt-dropdown { min-width: 220px; }

.rm-alt-unit-select {
  width: 100%;
  padding: 5px 4px;
  font-size: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  outline: none;
  background: #fff;
  color: #374151;
  box-sizing: border-box;
}
.rm-alt-unit-select:focus { border-color: #8b5cf6; }

.rm-alt-ratio-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rm-alt-ratio-input {
  width: 80px;
  padding: 5px 6px;
  font-size: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  outline: none;
  text-align: right;
  box-sizing: border-box;
}
.rm-alt-ratio-input:focus { border-color: #8b5cf6; }

.rm-alt-ratio-eg {
  font-size: 10px;
  color: #9ca3af;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rm-alt-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  border: 1.5px dashed #c4b5fd;
  border-radius: 6px;
  background: #faf5ff;
  color: #7c3aed;
  cursor: pointer;
  transition: all 0.12s;
  align-self: flex-start;
}
.rm-alt-add-btn:hover { background: #ede9fe; border-color: #8b5cf6; }

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 700px) {
  .rm-sidebar { width: 170px; min-width: 140px; }

  .rm-ing-hdr,
  .rm-ing-row {
    grid-template-columns: 18px 1fr 64px 68px 80px 80px 36px 26px;
    gap: 4px;
    padding: 5px 8px;
  }

  .rm-alt-hdr,
  .rm-alt-row {
    grid-template-columns: 1fr 68px 1fr 26px;
    gap: 4px;
    padding: 5px 8px;
  }
}

/* --------------------------------------------------------------------------
   Simple Recipe Manager
   -------------------------------------------------------------------------- */

.rm-container.rm-simple {
  position: relative;
  min-height: 620px;
  background: #f6f7f9;
  color: #1f2937;
}

.rm-simple .rm-sidebar {
  width: 250px;
  min-width: 220px;
}

.rm-simple .rm-sidebar-top {
  gap: 10px;
  padding: 16px 14px 12px;
}

.rm-simple .rm-new-btn,
.rm-simple .rm-save-btn,
.rm-drawer-done {
  background: #f97316;
  box-shadow: none;
}

.rm-simple .rm-new-btn:hover,
.rm-simple .rm-save-btn:hover:not(:disabled),
.rm-drawer-done:hover {
  background: #ea580c;
  box-shadow: none;
  transform: none;
}

.rm-simple .rm-search-input:focus,
.rm-simple .rm-recipe-name-input:focus,
.rm-simple input:focus,
.rm-simple textarea:focus {
  border-color: #fb923c;
}

.rm-simple .rm-recipe-btn {
  padding: 11px 14px;
  gap: 4px;
  border-left: 3px solid transparent;
}

.rm-simple .rm-recipe-btn--active {
  background: #fff7ed;
  border-left-color: #f97316;
}

.rm-simple .rm-recipe-btn--active .rm-recipe-btn-name {
  color: #c2410c;
}

.rm-simple .rm-main {
  background: #f6f7f9;
}

.rm-simple-welcome {
  margin: auto;
  text-align: center;
  color: #6b7280;
  padding: 40px;
}

.rm-simple-welcome h3 {
  margin: 0 0 6px;
  color: #1f2937;
}

.rm-simple-welcome p {
  margin: 0;
  font-size: 13px;
}

.rm-editor {
  min-height: 100%;
}

.rm-simple-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 22px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid #e5e7eb;
  backdrop-filter: blur(8px);
}

.rm-simple-header .rm-recipe-name-input {
  max-width: 520px;
  font-size: 20px;
  border-bottom-color: transparent;
}

.rm-editor-body {
  width: min(920px, calc(100% - 32px));
  margin: 18px auto 40px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.rm-simple-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.rm-advanced-settings {
  overflow: hidden;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.rm-advanced-settings > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 18px;
  color: #374151;
  cursor: pointer;
  list-style: none;
}

.rm-advanced-settings > summary::-webkit-details-marker {
  display: none;
}

.rm-advanced-settings > summary span {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.rm-advanced-settings > summary strong {
  color: #111827;
  font-size: 14px;
}

.rm-advanced-settings > summary small {
  color: #6b7280;
  font-size: 12px;
  font-weight: 400;
}

.rm-advanced-settings > summary::after {
  content: '';
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-right: 1.5px solid #6b7280;
  border-bottom: 1.5px solid #6b7280;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 160ms ease;
}

.rm-advanced-settings[open] > summary::after {
  transform: rotate(225deg) translate(-2px, -2px);
}

.rm-advanced-settings[open] > summary {
  border-bottom: 1px solid #e5e7eb;
}

.rm-advanced-settings-body {
  display: grid;
  gap: 12px;
  padding: 14px;
  background: #f8fafc;
}

.rm-advanced-settings-body .rm-simple-card {
  box-shadow: none;
}

.rm-simple-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.rm-simple-section-heading h3 {
  margin: 0;
  font-size: 15px;
  color: #111827;
}

.rm-simple-section-heading p {
  margin: 4px 0 0;
  color: #6b7280;
  font-size: 12px;
}

.rm-simple .rm-add-btn {
  border-color: #fed7aa;
  background: #fff7ed;
  color: #c2410c;
  white-space: nowrap;
}

.rm-mode-toggle {
  display: inline-flex;
  padding: 3px;
  border-radius: 9px;
  background: #f3f4f6;
}

.rm-mode-toggle button {
  min-width: 112px;
  padding: 8px 14px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #6b7280;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.rm-mode-toggle button.is-active {
  color: #c2410c;
  background: #fff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12);
}

.rm-makes-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0 0;
  font-size: 13px;
  color: #4b5563;
}

.rm-makes-line input {
  width: 82px;
  padding: 7px 9px;
  border: 1px solid #d1d5db;
  border-radius: 7px;
  font: inherit;
  font-weight: 600;
  text-align: right;
  outline: none;
}

.rm-simple-yield-unit {
  min-width: 92px;
  padding: 7px 9px;
  border-color: #d1d5db;
  font-size: 13px;
}

.rm-simple-ingredient-head,
.rm-simple-ingredient-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 110px 118px 34px;
  gap: 10px;
  align-items: start;
}

.rm-simple-ingredient-head {
  align-items: center;
  padding: 0 10px 7px;
  color: #9ca3af;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.rm-simple-ingredient-row {
  padding: 10px;
  border-top: 1px solid #f1f5f9;
}

.rm-simple-ingredient-row:hover {
  background: #fafafa;
  border-radius: 8px;
}

.rm-simple-name-input,
.rm-simple-qty-input,
.rm-drawer-alt input,
.rm-special-rule > input {
  width: 100%;
  box-sizing: border-box;
  height: 38px;
  padding: 0 11px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  color: #1f2937;
  font: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.rm-simple-name-input:focus,
.rm-simple-qty-input:focus,
.rm-drawer-alt input:focus,
.rm-special-rule > input:focus {
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

.rm-simple-qty-input {
  text-align: right;
}

.rm-simple-ingredient-row .rm-unit-trigger {
  height: 38px;
  min-height: 38px;
  border-radius: 8px;
}

.rm-simple-ingredient-row .rm-more-btn {
  height: 38px;
}

.rm-simple-name-input.is-linked {
  border-color: #bbf7d0;
}

.rm-per-serving-help {
  display: block;
  margin: 4px 2px 0;
  color: #9ca3af;
  font-size: 10.5px;
  line-height: 1.3;
}

.rm-per-serving-help:empty {
  display: none;
}

.rm-more-btn,
.rm-component-row > button,
.rm-drawer-header > button,
.rm-icon-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  border-radius: 7px;
}

.rm-more-btn {
  width: 32px;
  height: 32px;
}

.rm-more-btn:hover {
  background: #f3f4f6;
  color: #111827;
}

.rm-result-type {
  color: #9ca3af;
  font-size: 10px;
}

.rm-simple-empty {
  padding: 18px;
  border: 1px dashed #d1d5db;
  border-radius: 9px;
  color: #9ca3af;
  font-size: 12px;
  text-align: center;
}

.rm-simple-notes {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  color: #374151;
  font: inherit;
  font-size: 13px;
  line-height: 1.5;
  outline: none;
}

.rm-recipe-picker {
  margin: -2px 0 12px;
  padding: 10px;
  border: 1px solid #fed7aa;
  border-radius: 9px;
  background: #fffaf5;
}

.rm-recipe-picker-list {
  max-height: 190px;
  overflow: auto;
  margin-top: 8px;
}

.rm-recipe-picker-list > button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #374151;
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
  text-align: left;
}

.rm-recipe-picker-list > button:hover {
  background: #ffedd5;
}

.rm-recipe-picker-list small {
  color: #9ca3af;
}

.rm-recipe-picker-list > p {
  margin: 12px;
  color: #9ca3af;
  font-size: 12px;
  text-align: center;
}

.rm-inline-warning {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  padding: 8px 10px;
  border-radius: 7px;
  background: #fff7ed;
  color: #c2410c;
  font-size: 12px;
}

.rm-component-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.rm-component-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto 30px;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 8px;
  background: #f8fafc;
  font-size: 12.5px;
}

.rm-component-row label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #6b7280;
}

/* Name + "linked to the saved recipe" line */
.rm-component-name {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.rm-component-name small {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  color: #6b7280;
  font-size: 11.5px;
  line-height: 1.35;
}

.rm-recipe-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 999px;
  background: #fff1e6;
  color: #c2410c;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

/* Saved recipes offered in the ingredient search list */
.rm-dropdown-item.is-recipe {
  background: #fff7f0;
}

.rm-dropdown-item.is-recipe .rm-result-type {
  color: #c2410c;
  font-weight: 600;
}

.rm-dropdown-item.is-recipe:hover {
  background: #ffedd5;
}

.rm-recipe-picker-list button:disabled {
  cursor: default;
  opacity: .55;
}

.rm-component-row input {
  width: 76px;
  padding: 6px 7px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  text-align: right;
}

/* Searchable unit selector */
.rm-unit-select {
  position: relative;
  min-width: 0;
}

.rm-unit-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
  min-height: 34px;
  padding: 7px 8px;
  border: 1px solid #d1d5db;
  border-radius: 7px;
  background: #fff;
  color: #374151;
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
}

.rm-unit-popover {
  position: absolute;
  z-index: 80;
  top: calc(100% + 5px);
  right: 0;
  width: 230px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 14px 35px rgba(15, 23, 42, 0.18);
  overflow: hidden;
}

.rm-unit-search {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px;
  border-bottom: 1px solid #f1f5f9;
  color: #9ca3af;
}

.rm-unit-search input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  font: inherit;
  font-size: 12px;
}

.rm-unit-options {
  max-height: 270px;
  overflow-y: auto;
  padding: 5px;
}

.rm-unit-group > p {
  margin: 8px 7px 3px;
  color: #9ca3af;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.rm-unit-group > button {
  display: flex;
  justify-content: space-between;
  width: 100%;
  padding: 7px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #374151;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  text-align: left;
}

.rm-unit-group > button:hover,
.rm-unit-group > button.is-selected {
  background: #fff7ed;
  color: #c2410c;
}

.rm-unit-empty {
  padding: 14px;
  color: #9ca3af;
  font-size: 12px;
  text-align: center;
}

/* Ingredient details drawer */
.rm-drawer-backdrop {
  position: absolute;
  z-index: 90;
  inset: 0;
  border: 0;
  background: rgba(15, 23, 42, 0.3);
  cursor: default;
}

.rm-detail-drawer {
  position: absolute;
  z-index: 100;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  width: min(430px, 94%);
  background: #fff;
  box-shadow: -12px 0 35px rgba(15, 23, 42, 0.18);
}

.rm-drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid #e5e7eb;
}

.rm-drawer-header p,
.rm-drawer-header h3 {
  margin: 0;
}

.rm-drawer-header p {
  color: #9ca3af;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.rm-drawer-header h3 {
  margin-top: 4px;
  font-size: 18px;
}

.rm-drawer-header > button {
  width: 34px;
  height: 34px;
}

.rm-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 20px;
}

.rm-drawer-body > section {
  padding: 18px 0;
  border-bottom: 1px solid #f1f5f9;
}

.rm-drawer-body h4 {
  margin: 0;
  color: #374151;
  font-size: 13px;
}

.rm-drawer-value {
  margin: 7px 0 0;
  font-size: 15px;
  font-weight: 600;
}

.rm-drawer-help,
.rm-drawer-section-title p {
  margin: 5px 0 0;
  color: #9ca3af;
  font-size: 11.5px;
  line-height: 1.4;
}

.rm-stock-ok {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  color: #047857;
  font-size: 13px;
  font-weight: 600;
}

.rm-stock-warning {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  padding: 9px 10px;
  border-radius: 8px;
  background: #fffbeb;
  color: #b45309;
  font-size: 12px;
}

.rm-stock-warning span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.rm-stock-warning button,
.rm-drawer-section-title > button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  background: transparent;
  color: #c2410c;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.rm-drawer-section-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.rm-drawer-alt {
  padding: 10px;
  border: 1px solid #e5e7eb;
  border-radius: 9px;
  margin-top: 8px;
}

.rm-conversion-line,
.rm-special-rule {
  display: grid;
  grid-template-columns: auto 70px 108px 28px;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  color: #6b7280;
  font-size: 11px;
}

.rm-conversion-line > input,
.rm-special-rule > input {
  min-width: 0;
}

.rm-icon-danger {
  width: 28px;
  height: 30px;
  color: #dc2626;
}

.rm-special-rule {
  grid-template-columns: 54px 88px 12px 54px 88px 28px;
  margin-top: 9px;
}

.rm-drawer-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-top: 1px solid #e5e7eb;
  background: #fff;
}

.rm-delete-ingredient,
.rm-drawer-done {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 13px;
  border-radius: 7px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.rm-delete-ingredient {
  border: 1px solid #fecaca;
  background: #fff;
  color: #dc2626;
}

.rm-drawer-done {
  border: 0;
  color: #fff;
}

@media (max-width: 850px) {
  .rm-container.rm-simple {
    height: auto;
    min-height: calc(100vh - 110px);
    overflow: visible;
  }

  .rm-simple .rm-sidebar {
    width: 210px;
    min-width: 190px;
  }

  .rm-simple-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .rm-simple-ingredient-head {
    display: none;
  }

  .rm-simple-ingredient-row {
    grid-template-columns: minmax(160px, 1fr) 90px 100px 32px;
  }
}

@media (max-width: 650px) {
  .rm-container.rm-simple {
    display: block;
  }

  .rm-simple .rm-sidebar {
    width: 100%;
    max-height: 280px;
    border-right: 0;
    border-bottom: 1px solid #e5e7eb;
  }

  .rm-simple .rm-main {
    min-height: 520px;
  }

  .rm-editor-body {
    width: calc(100% - 20px);
    margin-top: 10px;
  }

  .rm-simple-header .rm-header-actions {
    width: 100%;
  }

  .rm-simple-ingredient-row {
    grid-template-columns: 1fr 72px 92px 30px;
    gap: 6px;
    padding-inline: 3px;
  }

  .rm-component-row {
    grid-template-columns: 1fr auto;
  }

  .rm-component-row > button {
    grid-column: 2;
  }
}

.rm-component-row select {
  padding: 6px 7px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  font-size: 12.5px;
}

.rm-production-options { display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: 13.5px; }
.rm-production-options label,
.rm-production-daily { display: flex; align-items: center; gap: 7px; cursor: pointer; }
.rm-production-daily { margin-top: 10px; font-size: 13.5px; }
.ss-page{display:grid;grid-template-columns:280px minmax(0,1fr);min-height:680px;background:#f8fafc;color:#172033;border:1px solid #e5e7eb;border-radius:14px;overflow:hidden}.ss-sidebar{background:#fff;border-right:1px solid #e5e7eb;padding:22px 16px}.ss-sidebar h2{margin:0 0 5px;font-size:21px}.ss-sidebar>p{margin:0 0 18px;color:#64748b;font-size:13px;line-height:1.45}.ss-search{display:flex;align-items:center;gap:8px;border:1px solid #d7dde7;background:#fff;border-radius:9px;padding:0 10px;color:#94a3b8}.ss-search input{width:100%;border:0;outline:0;padding:10px 0;background:transparent;color:#172033}.ss-menu-list{display:flex;flex-direction:column;gap:5px;margin-top:12px;max-height:550px;overflow:auto}.ss-menu-list button{border:0;background:transparent;border-radius:9px;padding:10px 11px;text-align:left;color:#334155;cursor:pointer}.ss-menu-list button:hover{background:#f1f5f9}.ss-menu-list button.active{background:#fff1e8;color:#c2410c}.ss-menu-list small{display:block;color:#94a3b8;margin-top:2px}.ss-main{padding:28px;min-width:0}.ss-item-header{display:flex;align-items:center;gap:15px;margin-bottom:20px}.ss-item-header img{width:72px;height:72px;object-fit:cover;border-radius:13px;background:#e2e8f0}.ss-item-header span{font-size:12px;text-transform:uppercase;letter-spacing:.06em;color:#f97316;font-weight:700}.ss-item-header h2{margin:4px 0 0;font-size:25px}.ss-variations{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-bottom:16px}.ss-variations>span{font-weight:700;margin-right:5px}.ss-variations button,.ss-default{border:1px solid #d7dde7;background:#fff;border-radius:999px;padding:8px 14px;color:#475569}.ss-variations button{cursor:pointer}.ss-variations button.active{background:#ea580c;border-color:#ea580c;color:#fff}.ss-default{display:inline-block;margin-bottom:16px;font-weight:700}.ss-card{background:#fff;border:1px solid #e2e8f0;border-radius:13px;padding:20px}.ss-card-title h3{margin:0;font-size:18px}.ss-card-title p{margin:5px 0 18px;color:#64748b;font-size:13px}.ss-grid{display:grid;grid-template-columns:minmax(180px,2fr) 120px 150px 40px;gap:10px;align-items:center}.ss-grid-head{color:#64748b;font-size:12px;font-weight:700;text-transform:uppercase;padding:8px}.ss-row{padding:9px 8px;border-top:1px solid #eef2f7}.ss-row input,.ss-row select{width:100%;box-sizing:border-box;border:1px solid #d7dde7;border-radius:8px;padding:9px 10px;background:#fff}.ss-picked{min-width:0}.ss-picked b{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ss-delete{border:0;background:transparent;color:#ef4444;padding:8px;cursor:pointer}.ss-actions{display:flex;justify-content:space-between;gap:12px;margin-top:18px}.ss-add,.ss-save{display:inline-flex;align-items:center;gap:7px;border-radius:9px;padding:10px 16px;font-weight:700;cursor:pointer}.ss-add{background:#fff;border:1px solid #fdba74;color:#c2410c}.ss-save{background:#ea580c;border:1px solid #ea580c;color:#fff}.ss-save:disabled{opacity:.6}.ss-empty{padding:18px;color:#64748b;text-align:center}.ss-empty-card{border-top:1px solid #eef2f7}.ss-error,.ss-success{margin-top:12px;padding:10px 12px;border-radius:8px;font-size:13px}.ss-error{background:#fef2f2;color:#b91c1c}.ss-success{background:#ecfdf5;color:#047857}.ss-overlay{position:fixed;inset:0;background:rgba(15,23,42,.48);display:flex;align-items:center;justify-content:center;padding:18px;z-index:1200}.ss-picker{width:min(520px,100%);max-height:80vh;display:flex;flex-direction:column;background:#fff;border-radius:14px;padding:20px;box-shadow:0 24px 60px rgba(15,23,42,.25)}.ss-picker-head{display:flex;justify-content:space-between;gap:12px;margin-bottom:14px}.ss-picker-head h3{margin:0}.ss-picker-head p{margin:4px 0 0;color:#64748b;font-size:13px}.ss-picker-head button{border:0;background:transparent;font-size:18px;cursor:pointer}.ss-picker-list{overflow:auto;margin-top:12px;display:flex;flex-direction:column;gap:4px}.ss-picker-list button{display:flex;justify-content:space-between;align-items:center;gap:15px;border:0;background:#fff;border-radius:8px;padding:11px;text-align:left;cursor:pointer}.ss-picker-list button:hover{background:#fff7ed}.ss-picker-list small{color:#64748b}@media(max-width:850px){.ss-page{grid-template-columns:1fr}.ss-sidebar{border-right:0;border-bottom:1px solid #e5e7eb}.ss-menu-list{max-height:190px}.ss-main{padding:16px}.ss-grid{grid-template-columns:minmax(130px,1.5fr) 90px 110px 34px}.ss-grid-head{display:none}}
/* ─────────────────────────────────────────────────────────────────────────────
   DishCompositionManager — 3-panel layout
   Layer 1: Menu item list (left)
   Layer 2: Dish Composition (centre)
   Layer 3: Recipe panel (right, slides in)
───────────────────────────────────────────────────────────────────────────── */

/* ── Root ───────────────────────────────────────────────────────────────────── */

.dcm-root {
  display: flex;
  height: calc(100vh - 172px);
  min-height: 460px;
  overflow: hidden;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
}

/* ── Layer 1: Menu list ─────────────────────────────────────────────────────── */

.dcm-menu-list {
  width: 220px;
  min-width: 200px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #e5e7eb;
  background: #f8fafc;
}

.dcm-menu-list-top {
  padding: 12px 10px 8px;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
}

.dcm-list-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b7280;
  margin: 0 0 8px;
}

.dcm-search-wrap {
  position: relative;
}

.dcm-search-icon {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  pointer-events: none;
}

.dcm-search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 5px 8px 5px 26px;
  font-size: 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  color: #111;
  outline: none;
}

.dcm-search-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.dcm-menu-items {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}

.dcm-menu-item-btn {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 7px 12px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s;
  gap: 1px;
}

.dcm-menu-item-btn:hover {
  background: #eff6ff;
}

.dcm-menu-item-btn--active {
  background: #dbeafe;
  border-right: 2px solid #3b82f6;
}

.dcm-mi-name {
  font-size: 12.5px;
  font-weight: 500;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 190px;
}

.dcm-mi-cat {
  font-size: 10.5px;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 190px;
}

.dcm-menu-item-btn--active .dcm-mi-name {
  color: #1d4ed8;
}

/* ── Layer 2: Dish Composition ──────────────────────────────────────────────── */

.dcm-composition {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* Placeholder (no item selected) */
.dcm-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  padding: 40px 24px;
  text-align: center;
  gap: 8px;
}

.dcm-ph-icon {
  font-size: 48px;
  margin-bottom: 4px;
}

.dcm-placeholder h3 {
  font-size: 16px;
  font-weight: 600;
  color: #374151;
  margin: 0 0 4px;
}

.dcm-placeholder p {
  font-size: 13px;
  color: #6b7280;
  margin: 0 0 16px;
}

.dcm-how {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 14px 18px;
}

.dcm-how-step {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  color: #374151;
}

.dcm-how-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background: #3b82f6;
  color: #fff;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

/* Composition header */
.dcm-comp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 10px;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
  gap: 10px;
  flex-wrap: wrap;
}

.dcm-comp-title {
  font-size: 15px;
  font-weight: 700;
  color: #111827;
  margin: 0 0 1px;
}

.dcm-comp-subtitle {
  font-size: 11px;
  color: #6b7280;
}

.dcm-comp-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.dcm-save-msg {
  font-size: 12px;
  color: #16a34a;
  font-weight: 500;
}

/* ── Commodities toggle ──────────────────────────────────────────────────── */

.dcm-commodity-wrap {
  position: relative;
}

.dcm-commodity-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: #f1f5f9;
  color: #64748b;
  border: 1.5px solid #cbd5e1;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.dcm-commodity-btn:hover {
  background: #e2e8f0;
  color: #475569;
}

.dcm-commodity-btn--on {
  background: #fff7ed;
  color: #c2410c;
  border-color: #fb923c;
}

.dcm-commodity-btn--on:hover {
  background: #ffedd5;
}

.dcm-ai-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  background: #7c3aed;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.dcm-ai-btn:hover:not(:disabled) {
  background: #6d28d9;
}

.dcm-ai-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.dcm-save-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.dcm-save-btn:hover:not(:disabled) {
  background: #1d4ed8;
}

.dcm-save-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Variation tabs */
.dcm-var-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 16px;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
  overflow-x: auto;
}

.dcm-var-tab {
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid #d1d5db;
  border-radius: 20px;
  background: #fff;
  color: #374151;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.12s;
}

.dcm-var-tab:hover {
  background: #eff6ff;
  border-color: #93c5fd;
}

.dcm-var-tab--active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

/* Copy & Scale bar */
.dcm-copy-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.dcm-copy-label,
.dcm-copy-at {
  font-size: 12px;
  color: #6b7280;
  white-space: nowrap;
}
.dcm-copy-select {
  font-size: 12px;
  padding: 3px 6px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  background: #fff;
  color: #374151;
  cursor: pointer;
}
.dcm-copy-btn {
  font-size: 12px;
  padding: 3px 10px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
}
.dcm-copy-btn:hover { background: #1d4ed8; }

/* Variation usage preview inside recipe panel */
.dcm-rp-var-preview {
  margin: 8px 0 4px;
  padding: 8px 10px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 6px;
}
.dcm-rp-var-preview-title {
  font-size: 11px;
  font-weight: 600;
  color: #166534;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.dcm-rp-var-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
.dcm-rp-var-table th {
  text-align: left;
  padding: 3px 8px;
  background: #dcfce7;
  color: #166534;
  font-weight: 600;
  white-space: nowrap;
}
.dcm-rp-var-table td {
  padding: 3px 8px;
  border-bottom: 1px solid #d1fae5;
  color: #374151;
  white-space: nowrap;
}
.dcm-rp-var-table tr:last-child td { border-bottom: none; }

/* Loading */
.dcm-loading {
  padding: 20px 16px;
  font-size: 13px;
  color: #6b7280;
  text-align: center;
}

/* Composition table */
.dcm-comp-table {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0 16px;
}

/* Table header */
.dcm-comp-hdr {
  display: grid;
  grid-template-columns: 28px 1fr 106px 64px 90px 120px 30px;
  gap: 6px;
  padding: 4px 14px 6px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #9ca3af;
  border-bottom: 1px solid #f3f4f6;
}

/* Composition rows */
.dcm-comp-row {
  display: grid;
  grid-template-columns: 28px 1fr 106px 64px 90px 120px 30px;
  gap: 6px;
  padding: 5px 14px;
  align-items: center;
  border-bottom: 1px solid #f9fafb;
}

.dcm-comp-row:hover {
  background: #fafafa;
}

.dcm-row-num {
  font-size: 11px;
  color: #9ca3af;
  text-align: center;
}

/* Name input + dropdown */
.dcm-name-wrap {
  position: relative;
}

.dcm-name-input {
  width: 100%;
  box-sizing: border-box;
  padding: 5px 8px;
  font-size: 12.5px;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  outline: none;
  background: #fff;
  color: #111;
}

.dcm-name-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.12);
}

/* Shared dropdown */
.dcm-dropdown {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  z-index: 100;
  max-height: 180px;
  overflow-y: auto;
}

.dcm-drop-item {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 7px 10px;
  font-size: 12px;
  background: transparent;
  border: none;
  border-bottom: 1px solid #f3f4f6;
  cursor: pointer;
  text-align: left;
  color: #111;
}

.dcm-drop-item:last-child {
  border-bottom: none;
}

.dcm-drop-item:hover {
  background: #eff6ff;
}

.dcm-drop-badge {
  margin-left: auto;
  font-size: 10px;
  padding: 1px 6px;
  background: #f3f4f6;
  border-radius: 10px;
  color: #6b7280;
  white-space: nowrap;
}

/* Type toggle */
.dcm-type-wrap {
  display: flex;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  overflow: hidden;
}

.dcm-type-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 4px 5px;
  font-size: 10.5px;
  font-weight: 600;
  background: #fff;
  border: none;
  cursor: pointer;
  color: #9ca3af;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
}

.dcm-type-btn + .dcm-type-btn {
  border-left: 1px solid #e5e7eb;
}

.dcm-type-btn--active {
  background: #eff6ff;
  color: #2563eb;
}

.dcm-type-btn:nth-child(2).dcm-type-btn--active {
  background: #fffbeb;
  color: #d97706;
}

/* Qty / Unit */
.dcm-qty-input {
  width: 100%;
  box-sizing: border-box;
  padding: 5px 6px;
  font-size: 12.5px;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  outline: none;
  text-align: right;
}

.dcm-qty-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.12);
}

.dcm-unit-select {
  width: 100%;
  padding: 5px 4px;
  font-size: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  background: #fff;
  outline: none;
  color: #374151;
}

.dcm-unit-select:focus {
  border-color: #3b82f6;
}

/* Recipe "Existing" badge variant */
.dcm-drop-badge--recipe {
  background: #fef3c7;
  color: #92400e;
}

/* Recipe link button */
.dcm-recipe-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  color: #d97706;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 5px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s;
}

.dcm-recipe-link-btn:hover {
  background: #fef3c7;
}

/* Linked recipe button — already has a DB record */
.dcm-recipe-link-btn--linked {
  color: #059669;
  background: #f0fdf4;
  border-color: #86efac;
}

.dcm-recipe-link-btn--linked:hover {
  background: #dcfce7;
}

/* Delete button (shared) */
.dcm-del-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: transparent;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  cursor: pointer;
  color: #9ca3af;
  transition: color 0.12s, border-color 0.12s;
}

.dcm-del-btn:hover {
  color: #ef4444;
  border-color: #fca5a5;
  background: #fff5f5;
}

/* Add row button (shared) */
.dcm-add-row-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  margin: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  color: #2563eb;
  background: #eff6ff;
  border: 1px dashed #93c5fd;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s;
}

.dcm-add-row-btn:hover {
  background: #dbeafe;
}

/* Empty hint */
.dcm-empty-hint {
  font-size: 12.5px;
  color: #9ca3af;
  margin: 0;
}

/* ── Layer 3: Recipe panel ───────────────────────────────────────────────────── */

.dcm-recipe-panel {
  width: 0;
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-left: 1px solid #e5e7eb;
  background: #fff;
  transition: width 0.22s ease;
}

.dcm-root--panel-open .dcm-recipe-panel {
  width: 500px;
  min-width: 460px;
  overflow-y: auto;
}

/* Recipe panel header */
.dcm-rp-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 12px 14px 10px;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
  background: #fffbeb;
  gap: 8px;
}

.dcm-rp-title {
  font-size: 14px;
  font-weight: 700;
  color: #92400e;
  margin: 0 0 2px;
}

.dcm-rp-subtitle {
  font-size: 11px;
  color: #b45309;
  margin: 0;
}

.dcm-rp-close {
  background: transparent;
  border: none;
  cursor: pointer;
  color: #9ca3af;
  padding: 2px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  border-radius: 4px;
}

.dcm-rp-close:hover {
  color: #374151;
  background: #f3f4f6;
}

/* Yield section */
.dcm-rp-yield {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 14px;
  border-bottom: 1px solid #f3f4f6;
  flex-shrink: 0;
  background: #fffbeb;
}

.dcm-rp-yield-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.dcm-rp-yield-label {
  font-size: 11.5px;
  font-weight: 600;
  color: #6b7280;
  white-space: nowrap;
}

.dcm-rp-yield-qty {
  width: 64px;
  padding: 5px 6px;
  font-size: 12.5px;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  text-align: right;
  outline: none;
  background: #fff;
}

.dcm-rp-yield-qty:focus {
  border-color: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.15);
}

.dcm-rp-yield-unit {
  padding: 5px 6px;
  font-size: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  background: #fff;
  outline: none;
  min-width: 56px;
}

.dcm-rp-yield-unit:focus {
  border-color: #f59e0b;
}

.dcm-rp-yield-for {
  font-size: 11.5px;
  color: #9ca3af;
  white-space: nowrap;
  padding: 0 2px;
}

.dcm-rp-yield-serves {
  width: 52px;
  padding: 5px 6px;
  font-size: 12.5px;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  text-align: center;
  outline: none;
  background: #fff;
}

.dcm-rp-yield-serves:focus {
  border-color: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.15);
}

.dcm-rp-yield-serves-label {
  font-size: 11.5px;
  color: #6b7280;
  white-space: nowrap;
}

/* Fixed unit label next to per-plate input (shows "g", "ml", or "piece") */
.dcm-rp-yield-unit-fixed {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  padding: 4px 8px;
  white-space: nowrap;
  min-width: 32px;
  text-align: center;
}

/* "= 4 servings" green badge */
.dcm-rp-yield-servings-badge {
  font-size: 11.5px;
  font-weight: 700;
  color: #059669;
  background: #d1fae5;
  border: 1px solid #6ee7b7;
  border-radius: 10px;
  padding: 3px 8px;
  white-space: nowrap;
}

.dcm-rp-per-serving {
  font-size: 11px;
  color: #d97706;
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: 4px;
  padding: 4px 8px;
  line-height: 1.4;
}

.dcm-rp-per-serving strong {
  font-weight: 700;
}

/* Ingredients section */
.dcm-rp-ings {
  display: flex;
  flex-direction: column;
  padding: 0 0 6px;
}

.dcm-rp-ings-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 8px;
  border-bottom: 1px solid #f3f4f6;
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 6px;
}

.dcm-rp-ings-title {
  font-size: 11.5px;
  font-weight: 700;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.dcm-rp-ings-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.dcm-rp-ai-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 600;
  background: #7c3aed;
  color: #fff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.15s;
}

.dcm-rp-ai-btn:hover:not(:disabled) {
  background: #6d28d9;
}

.dcm-rp-ai-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* AI Wastage button — amber/orange to match wastage theme */
.dcm-rp-ai-waste-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 600;
  background: #d97706;
  color: #fff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.15s;
}

.dcm-rp-ai-waste-btn:hover:not(:disabled) {
  background: #b45309;
}

.dcm-rp-ai-waste-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.dcm-rp-save-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 600;
  background: #16a34a;
  color: #fff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.15s;
}

.dcm-rp-save-btn:hover:not(:disabled) {
  background: #15803d;
}

.dcm-rp-save-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Save All button — saves composition + recipe in one click */
.dcm-save-all-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 600;
  background: #7c3aed;
  color: #fff;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s;
}
.dcm-save-all-btn:hover:not(:disabled) { background: #6d28d9; }
.dcm-save-all-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.dcm-save-all-btn--sm {
  padding: 5px 9px;
  font-size: 11.5px;
  border-radius: 6px;
}

/* Ingredient list header */
.dcm-rp-ing-hdr {
  display: grid;
  /* name | qty | unit | waste% | per-1 | alts | del */
  grid-template-columns: 1fr 52px 62px 66px 52px 32px 24px;
  gap: 4px;
  padding: 4px 14px 5px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #9ca3af;
  border-bottom: 1px solid #f3f4f6;
}

/* Ingredient rows */
.dcm-rp-ing-row {
  display: grid;
  /* name | qty | unit | waste% | per-1 | alts | del */
  grid-template-columns: 1fr 52px 62px 66px 52px 32px 24px;
  gap: 4px;
  padding: 5px 14px;
  align-items: center;
  border-bottom: 1px solid #f9fafb;
}

.dcm-rp-per1 {
  font-size: 11px;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dcm-rp-ing-row:hover {
  background: #fafafa;
}

.dcm-rp-ing-name {
  width: 100%;
  box-sizing: border-box;
  padding: 4px 7px;
  font-size: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  outline: none;
  background: #fff;
}

.dcm-rp-ing-name:focus {
  border-color: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.12);
}

.dcm-rp-ing-name--linked {
  border-color: #86efac;
  background: #f0fdf4;
}

.dcm-rp-ing-qty {
  width: 100%;
  box-sizing: border-box;
  padding: 4px 6px;
  font-size: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  text-align: right;
  outline: none;
}

.dcm-rp-ing-qty:focus {
  border-color: #f59e0b;
}

.dcm-rp-ing-unit {
  width: 100%;
  padding: 4px 4px;
  font-size: 11px;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  background: #fff;
  outline: none;
  color: #374151;
}

.dcm-rp-ing-unit:focus {
  border-color: #f59e0b;
}

/* Waste % input (production shrinkage) */
.dcm-waste-wrap {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  overflow: hidden;
}

.dcm-waste-input {
  flex: 1;
  min-width: 0;
  padding: 4px 4px;
  font-size: 12px;
  text-align: right;
  border: 1px solid #fcd34d;
  border-radius: 5px;
  background: #fffbeb;
  color: #92400e;
  outline: none;
  -moz-appearance: textfield;
}

.dcm-waste-input::-webkit-outer-spin-button,
.dcm-waste-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.dcm-waste-input:focus {
  border-color: #f59e0b;
  background: #fef3c7;
}

.dcm-waste-label {
  font-size: 11px;
  color: #b45309;
  font-weight: 700;
  flex-shrink: 0;
}

/* Instructions textarea */
.dcm-rp-instructions {
  margin: 8px 14px 4px;
  padding: 8px;
  font-size: 12px;
  font-family: inherit;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  resize: vertical;
  outline: none;
  color: #374151;
  background: #fafafa;
}

.dcm-rp-instructions:focus {
  border-color: #f59e0b;
  background: #fff;
}

/* ── ⚡ Alts toggle button ────────────────────────────────────────────────────── */

.dcm-rp-alts-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 26px;
  font-size: 11px;
  font-weight: 700;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  cursor: pointer;
  color: #9ca3af;
  transition: all 0.12s;
  white-space: nowrap;
}

.dcm-rp-alts-btn:hover:not(:disabled) {
  background: #fef9c3;
  border-color: #fde68a;
  color: #92400e;
}

.dcm-rp-alts-btn--has {
  background: #fffbeb;
  border-color: #fde68a;
  color: #d97706;
}

.dcm-rp-alts-btn--open {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #92400e;
}

.dcm-rp-alts-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ── Alternative ingredient panel ──────────────────────────────────────────── */

.dcm-alt-panel {
  background: #fffdf0;
  border-left: 3px solid #f59e0b;
  border-bottom: 1px solid #fde68a;
  padding: 8px 14px 10px 16px;
  margin: 0;
}

.dcm-alt-hdr {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 6px;
  gap: 8px;
}

.dcm-alt-hdr-title {
  font-size: 12px;
  color: #374151;
  margin: 0 0 2px;
}

.dcm-alt-hdr-sub {
  font-size: 10.5px;
  color: #9ca3af;
  margin: 0;
}

/* Column header for alt rows */
.dcm-alt-col-hdr {
  display: grid;
  grid-template-columns: 1fr 72px 64px 26px;
  gap: 5px;
  padding: 3px 0 4px;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #b45309;
  border-bottom: 1px solid #fde68a;
  margin-bottom: 3px;
}

.dcm-alt-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  background: #fff;
  border: 1px solid #f59e0b;
  border-radius: 5px;
  color: #d97706;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.dcm-alt-add-btn:hover {
  background: #fef3c7;
}

.dcm-alt-empty {
  font-size: 11.5px;
  color: #9ca3af;
  margin: 0;
  padding: 4px 0 2px;
}

/* Alt row — name | qty-needed | unit | "for X unit" | del */
.dcm-alt-row {
  display: grid;
  grid-template-columns: 1fr 72px 64px auto 26px;
  gap: 5px;
  align-items: center;
  padding: 5px 0;
  border-bottom: 1px solid #fef3c7;
}

.dcm-alt-row:last-child {
  border-bottom: none;
}

.dcm-alt-name-col {
  /* the name search wrapper inside the grid */
}

.dcm-alt-name-input {
  width: 100%;
  box-sizing: border-box;
  padding: 4px 7px;
  font-size: 11.5px;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  outline: none;
  background: #fff;
}

.dcm-alt-name-input:focus {
  border-color: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.12);
}

/* Concrete qty input (how much of the alt to use for this batch) */
.dcm-alt-qty-input {
  width: 100%;
  box-sizing: border-box;
  padding: 4px 6px;
  font-size: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  text-align: right;
  outline: none;
  background: #fff;
}

.dcm-alt-qty-input:focus {
  border-color: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.12);
}

.dcm-alt-unit {
  width: 100%;
  box-sizing: border-box;
  padding: 4px 3px;
  font-size: 11px;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  background: #fff;
  outline: none;
  color: #374151;
}

.dcm-alt-unit:focus {
  border-color: #f59e0b;
}

/* "for X unit" contextual label */
.dcm-alt-for-label {
  font-size: 10.5px;
  color: #b45309;
  white-space: nowrap;
  font-style: italic;
}

/* Empty ingredients card */
.dcm-rp-empty-card {
  margin: 14px 14px 4px;
  padding: 14px 16px;
  background: #fffbeb;
  border: 1px dashed #fbbf24;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dcm-rp-empty-title {
  font-size: 12.5px;
  font-weight: 700;
  color: #92400e;
  margin: 0;
}

.dcm-rp-empty-body {
  font-size: 12px;
  color: #78350f;
  margin: 0;
  line-height: 1.55;
}

.dcm-rp-empty-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.dcm-rp-empty-close-btn {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  font-size: 11.5px;
  font-weight: 600;
  background: #fff;
  color: #d97706;
  border: 1.5px solid #f59e0b;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s;
  white-space: nowrap;
}

.dcm-rp-empty-close-btn:hover {
  background: #fef3c7;
}

.dcm-rp-empty-or {
  font-size: 11px;
  color: #9ca3af;
}

.dcm-rp-empty-ai-hint {
  font-size: 11.5px;
  color: #78350f;
}

/* No-result hint dropdown */
.dcm-dropdown--hint {
  padding: 10px 12px;
  pointer-events: none;
}

.dcm-drop-noresult {
  font-size: 12px;
  color: #374151;
  margin: 0 0 4px;
}

.dcm-drop-noresult-sub {
  font-size: 11.5px;
  color: #6b7280;
  margin: 0;
  line-height: 1.5;
}

/* ── Scrollbar styling ────────────────────────────────────────────────────────── */

.dcm-menu-items::-webkit-scrollbar,
.dcm-comp-table::-webkit-scrollbar,
.dcm-rp-ings::-webkit-scrollbar,
.dcm-recipe-panel::-webkit-scrollbar {
  width: 4px;
}

.dcm-menu-items::-webkit-scrollbar-track,
.dcm-comp-table::-webkit-scrollbar-track,
.dcm-rp-ings::-webkit-scrollbar-track,
.dcm-recipe-panel::-webkit-scrollbar-track {
  background: transparent;
}

.dcm-menu-items::-webkit-scrollbar-thumb,
.dcm-comp-table::-webkit-scrollbar-thumb,
.dcm-rp-ings::-webkit-scrollbar-thumb,
.dcm-recipe-panel::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 2px;
}

/* ── Save-confirmation modal ──────────────────────────────────────────────── */

.dcm-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(2px);
}

.dcm-modal {
  background: #fff;
  border-radius: 14px;
  padding: 2rem 2rem 1.75rem;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
  text-align: center;
}

.dcm-modal-icon {
  font-size: 2.25rem;
  margin-bottom: 0.75rem;
  line-height: 1;
}

.dcm-modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #111827;
  margin: 0 0 0.75rem;
}

.dcm-modal-body {
  font-size: 0.92rem;
  color: #4b5563;
  line-height: 1.6;
  margin: 0 0 1.5rem;
}

.dcm-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.dcm-modal-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.25rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.15s, opacity 0.15s;
}

.dcm-modal-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.dcm-modal-btn--primary {
  background: #2563eb;
  color: #fff;
}

.dcm-modal-btn--primary:hover:not(:disabled) {
  background: #1d4ed8;
}

.dcm-modal-btn--secondary {
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #d1d5db;
}

.dcm-modal-btn--secondary:hover {
  background: #e5e7eb;
}

.dcm-modal-btn--ghost {
  background: transparent;
  color: #9ca3af;
  font-weight: 400;
  font-size: 0.85rem;
}

.dcm-modal-btn--ghost:hover {
  color: #6b7280;
}
.pexels-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.pexels-modal-content {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 1200px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.pexels-modal-header {
    padding: 24px 28px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.pexels-modal-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 10px;
}

.pexels-subtitle {
    margin: 4px 0 0 0;
    font-size: 0.875rem;
    color: #6b7280;
}

.pexels-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6b7280;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pexels-close-btn:hover {
    background: #f3f4f6;
    color: #111827;
}

.pexels-search-form {
    padding: 20px 28px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    gap: 12px;
}

.pexels-search-input-wrapper {
    flex: 1;
    position: relative;
}

.pexels-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 1.1rem;
}

.pexels-search-input {
    width: 100%;
    padding: 12px 14px 12px 42px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.pexels-search-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.pexels-search-btn {
    padding: 12px 28px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.pexels-search-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.pexels-search-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.pexels-error-message {
    padding: 16px 28px;
    background: #fef2f2;
    border-left: 4px solid #ef4444;
    margin: 0 28px;
    border-radius: 8px;
}

.pexels-error-message p {
    margin: 0;
    color: #991b1b;
    font-size: 0.9rem;
}

.pexels-images-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px 28px;
    min-height: 400px;
}

.pexels-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #6b7280;
}

.pexels-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.pexels-images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.pexels-image-card {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
    border: 3px solid transparent;
    aspect-ratio: 4/3;
}

.pexels-image-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s;
}

.pexels-image-card:hover img {
    transform: scale(1.05);
}

.pexels-image-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.pexels-image-card.selected {
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}

.pexels-image-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
    padding: 12px;
    opacity: 0;
    transition: opacity 0.3s;
}

.pexels-image-card:hover .pexels-image-overlay {
    opacity: 1;
}

.pexels-photographer {
    margin: 0;
    color: white;
    font-size: 0.75rem;
    font-weight: 500;
}

.pexels-selected-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #3b82f6;
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.pexels-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #9ca3af;
    text-align: center;
}

.pexels-empty-state p {
    margin: 12px 0 0 0;
    font-size: 1rem;
}

.pexels-hint {
    font-size: 0.875rem !important;
    color: #d1d5db !important;
}

.pexels-modal-footer {
    padding: 20px 28px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.pexels-cancel-btn,
.pexels-select-btn {
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.pexels-cancel-btn {
    background: #f3f4f6;
    color: #374151;
}

.pexels-cancel-btn:hover {
    background: #e5e7eb;
}

.pexels-select-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.pexels-select-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.pexels-attribution {
    padding: 12px 28px;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
    text-align: center;
}

.pexels-attribution p {
    margin: 0;
    font-size: 0.8rem;
    color: #6b7280;
}

.pexels-attribution a {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 600;
}

.pexels-attribution a:hover {
    text-decoration: underline;
}

/* Scrollbar styling */
.pexels-images-container::-webkit-scrollbar {
    width: 8px;
}

.pexels-images-container::-webkit-scrollbar-track {
    background: #f3f4f6;
}

.pexels-images-container::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

.pexels-images-container::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Responsive */
@media (max-width: 768px) {
    .pexels-modal-content {
        max-height: 95vh;
    }

    .pexels-images-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }

    .pexels-search-form {
        flex-direction: column;
    }

    .pexels-search-btn {
        width: 100%;
    }
}/* Photo uploader used by the menu item editor. */

.iu {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.iu-drop {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 168px;
    padding: 1.25rem;
    border: 1.5px dashed #d3ccc2;
    border-radius: 12px;
    background: #f7f5f2;
    color: #1d2025;
    text-align: center;
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.iu-drop:hover {
    border-color: #a8a096;
}

.iu-drop:focus-visible {
    outline: none;
    border-color: var(--primary-color, #e85d04);
    box-shadow: 0 0 0 3px rgba(232, 93, 4, 0.16);
}

.iu-drop.is-dragging {
    border-color: var(--primary-color, #e85d04);
    background: #fff1e6;
}

.iu-drop.is-busy {
    opacity: 0.6;
    cursor: progress;
}

.iu-drop.has-image {
    padding: 0;
    border-style: solid;
    border-color: #e7e3dd;
    background: #f4f2ef;
}

.iu-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    pointer-events: none;
}

.iu-prompt svg {
    font-size: 1.6rem;
    color: #6b7079;
    margin-bottom: 0.2rem;
}

.iu-prompt strong {
    font-size: 0.95rem;
    font-weight: 600;
}

.iu-prompt span {
    font-size: 0.84rem;
    color: #6b7079;
}

.iu-preview {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.iu-preview-actions {
    position: absolute;
    right: 0.6rem;
    bottom: 0.6rem;
    display: flex;
    gap: 0.4rem;
}

.iu-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    height: 30px;
    padding: 0 0.7rem;
    border: none;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.94);
    color: #1d2025;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.iu-chip:hover {
    background: #fff;
}

.iu-chip.is-danger:hover {
    color: #c42b2b;
}

.iu-chip:focus-visible,
.iu-stock-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--primary-color, #e85d04);
}

.iu-stock-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    width: 100%;
    min-height: 40px;
    border: 1px solid #d3ccc2;
    border-radius: 9px;
    background: #fff;
    color: #3b4048;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease;
}

.iu-stock-btn:hover {
    border-color: #6b7079;
    color: #1d2025;
}

.iu-helper {
    font-size: 0.82rem;
    color: #6b7079;
}

.iu-error {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.65rem;
    border-radius: 8px;
    background: #fdeceb;
    color: #b42323;
    font-size: 0.84rem;
}
/* Copy Order Number Button Styles */
.payment-confirm-section {
  margin: 20px 0;
}

.payment-confirm-section label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  color: #333;
}

.order-number-with-copy {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 4px;
}

.copy-order-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
  margin-left: 4px;
}

.copy-order-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.copy-order-btn:active {
  transform: translateY(0);
}

.copy-order-btn.copied {
  background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
  box-shadow: 0 2px 8px rgba(56, 239, 125, 0.3);
}

.copy-order-btn svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.5;
}

.copy-order-btn span {
  font-size: 13px;
  font-weight: 600;
}

/* Animation for copied state */
@keyframes checkmark {
  0% {
    transform: scale(0.8);
    opacity: 0;
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.copy-order-btn.copied svg {
  animation: checkmark 0.3s ease;
}

/* Payment edit order info styles */
.payment-edit-order-info {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 24px;
  border: 2px solid #e9ecef;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.payment-edit-order-info p {
  margin: 0;
  font-size: 15px;
  color: #495057;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.payment-edit-order-info strong {
  color: #212529;
  font-weight: 700;
  font-size: 16px;
}

.payment-edit-order-info .order-number-with-copy {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-left: 8px;
}

.order-id-value {
  font-family: 'Courier New', monospace;
  font-size: 16px;
  font-weight: 700;
  color: #e8852a;
  letter-spacing: 0.5px;
  background: white;
  padding: 6px 12px;
  border-radius: 6px;
  border: 2px solid #e8852a;
  display: inline-block;
}

/* Edit payment button in orders list */
.rol-edit-payment-btn {
  padding: 8px 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
}

.rol-edit-payment-btn:hover {
  background: linear-gradient(135deg, #5568d3 0%, #654391 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.rol-edit-payment-btn:active {
  transform: translateY(0);
}

.rol-payment {
  font-weight: 500;
  color: #495057;
  font-size: 0.85rem;
  white-space: nowrap;
  text-align: center;
}

/* Verification Modal Actions */
.verification-modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e9ecef;
}

.verification-cancel-btn {
  padding: 12px 28px;
  background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(108, 117, 125, 0.3);
  min-width: 120px;
}

.verification-cancel-btn:hover {
  background: linear-gradient(135deg, #5a6268 0%, #495057 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(108, 117, 125, 0.4);
}

.verification-cancel-btn:active {
  transform: translateY(0);
}

.verification-confirm-btn {
  padding: 12px 28px;
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
  min-width: 160px;
}

.verification-confirm-btn:hover {
  background: linear-gradient(135deg, #218838 0%, #1da088 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

.verification-confirm-btn:active {
  transform: translateY(0);
}

.verification-confirm-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}
.units-page{min-height:100%;background:#f7f7f8;padding:24px;color:#242424}.units-head{display:flex;align-items:center;gap:14px;max-width:1180px;margin:0 auto 18px}.units-head h1{margin:0;font-size:27px}.units-head p{margin:3px 0;color:#666}.units-back{display:grid;place-items:center;width:38px;height:38px;border:1px solid #ddd;border-radius:9px;background:#fff}.units-primary{margin-left:auto;display:flex;align-items:center;gap:6px;border:0;border-radius:9px;background:#ed6c02;color:#fff;padding:10px 14px;font-weight:700}.units-summary,.units-panel,.units-footnote{max-width:1180px;margin-left:auto;margin-right:auto}.units-summary{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;margin-bottom:14px}.units-summary div{background:#fff;border:1px solid #e7e7e7;border-radius:10px;padding:14px;display:flex;flex-direction:column}.units-summary strong{font-size:22px;color:#d55b00}.units-summary span{font-size:12px;color:#666}.units-panel{background:#fff;border:1px solid #e4e4e4;border-radius:12px;overflow:hidden}.units-toolbar{display:flex;gap:10px;padding:14px;border-bottom:1px solid #eee}.units-toolbar label{display:flex;align-items:center;gap:7px;flex:1;border:1px solid #ddd;border-radius:8px;padding:0 10px}.units-toolbar input{width:100%;border:0;outline:0;padding:9px}.units-toolbar select{border:1px solid #ddd;border-radius:8px;padding:8px}.units-table-wrap{overflow:auto}.units-table{width:100%;border-collapse:collapse}.units-table th,.units-table td{text-align:left;padding:12px 14px;border-bottom:1px solid #eee}.units-table th{font-size:11px;text-transform:uppercase;color:#777;background:#fafafa}.units-table td{font-size:13px}.units-table td:first-child{display:flex;flex-direction:column}.units-table small{color:#777}.units-table em{font-style:normal;margin-left:7px;font-size:12px}.units-table tr.is-inactive{opacity:.58}.units-toggle{vertical-align:middle;width:36px;height:20px;padding:2px;border:0;border-radius:20px;background:#bbb}.units-toggle span{display:block;width:16px;height:16px;border-radius:50%;background:#fff;transition:.15s}.units-toggle.is-on{background:#ed6c02}.units-toggle.is-on span{transform:translateX(16px)}.units-error{margin:10px 14px;color:#b42318}.units-empty,.units-footnote{text-align:center;color:#666;padding:16px}.units-footnote{font-size:12px}@media(max-width:700px){.units-page{padding:14px}.units-summary{grid-template-columns:1fr}.units-head{align-items:flex-start}.units-head p{display:none}.units-toolbar{flex-direction:column}.units-table th:nth-child(3),.units-table td:nth-child(3){display:none}}
.units-summary { grid-template-columns: repeat(4, 1fr); }
.units-head-buttons { margin-left: auto; display: flex; gap: 8px; }
.units-head-buttons > button { display: flex; align-items: center; gap: 6px; border: 1px solid #ddd; border-radius: 9px; background: #fff; padding: 10px 14px; font-weight: 700; }
.units-head-buttons > .units-primary { margin-left: 0; border-color: #ed6c02; background: #ed6c02; color: #fff; }
@media (max-width: 700px) { .units-summary { grid-template-columns: 1fr 1fr; } .units-head-buttons { flex-direction: column; } }
/* Inventory workspace.
   Cool steel store-room neutrals; the app's orange is kept for actions only.
   Figures (quantities, money, dates) use Space Grotesk with tabular numerals so columns line up. */

.inv-scope {
  --inv-ink: #1f2a30;
  --inv-ink-2: #3f4c54;
  --inv-steel: #5f6c74;
  --inv-line: #dfe5e8;
  --inv-line-soft: #ebeff1;
  --inv-line-strong: #c8d1d6;
  --inv-surface: #ffffff;
  --inv-sunken: #f4f6f7;
  --inv-action: #c94f03;
  --inv-action-press: #a94202;
  --inv-link: #ad4703;
  --inv-ok: #2f7d50;
  --inv-low: #d39a2c;
  --inv-low-ink: #8a5a0c;
  --inv-low-tint: #fbf2df;
  --inv-out: #c2361b;
  --inv-out-ink: #a52c15;
  --inv-out-tint: #fcebe7;
  --inv-idle: #9aa6ad;
  --inv-focus: #2563eb;
  --inv-figure: 'Space Grotesk', 'Outfit', system-ui, sans-serif;
  font-family: 'Outfit', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: var(--inv-ink);
}

.inv-scope .inv-fig {
  font-family: var(--inv-figure);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.inv-scope .inv-fig em {
  font-family: 'Outfit', system-ui, sans-serif;
  font-style: normal;
  font-size: 0.88em;
  color: var(--inv-steel);
  letter-spacing: 0;
}

/* ── Page frame ───────────────────────────────────────────────────────────── */
.inv {
  max-width: 1320px;
  min-width: 0;
}

.inv .inv-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 16px;
  margin-bottom: 10px;
}
.inv .inv-title h1 {
  margin: 0;
  font: 600 30px/1.15 'Outfit', system-ui, sans-serif;
  letter-spacing: -0.015em;
  color: var(--inv-ink);
}
.inv .inv-title p {
  margin-top: 4px;
  color: var(--inv-steel);
  font-size: 15px;
}
.inv .inv-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.inv .inv-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--inv-line);
  overflow-x: auto;
  scrollbar-width: none;
}
.inv .inv-tabs::-webkit-scrollbar { display: none; }
.inv .inv-tabs button {
  position: relative;
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 12px 14px 13px;
  border: 0;
  background: none;
  color: var(--inv-steel);
  font: 500 15px/1.2 'Outfit', system-ui, sans-serif;
  white-space: nowrap;
  cursor: pointer;
}
.inv .inv-tabs button:hover { color: var(--inv-ink); }
.inv .inv-tabs button.is-on {
  color: var(--inv-ink);
  font-weight: 600;
}
.inv .inv-tabs button.is-on::after {
  content: '';
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -1px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: #e85d04;
}
.inv .inv-tabs button:focus-visible { outline-offset: -3px; }
.inv .inv-tab-flag {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--inv-low-tint);
  color: var(--inv-low-ink);
  font: 600 12px/1 var(--inv-figure);
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.inv-scope .inv-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 16px;
  border: 1px solid var(--inv-line-strong);
  border-radius: 8px;
  background: var(--inv-surface);
  color: var(--inv-ink);
  font: 600 15px/1 'Outfit', system-ui, sans-serif;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.inv-scope .inv-btn svg { font-size: 17px; flex: none; }
.inv-scope .inv-btn:hover:not(:disabled) { background: var(--inv-sunken); border-color: #b4bfc5; }
.inv-scope .inv-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.inv-scope .inv-btn.is-primary {
  background: var(--inv-action);
  border-color: var(--inv-action);
  color: #fff;
}
.inv-scope .inv-btn.is-primary:hover:not(:disabled) { background: var(--inv-action-press); border-color: var(--inv-action-press); }
.inv-scope .inv-btn.is-quiet { background: transparent; border-color: transparent; color: var(--inv-ink-2); }
.inv-scope .inv-btn.is-quiet:hover:not(:disabled) { background: var(--inv-sunken); border-color: transparent; }
.inv-scope .inv-btn.is-danger { color: var(--inv-out-ink); border-color: #e9c3ba; }
.inv-scope .inv-btn.is-danger:hover:not(:disabled) { background: var(--inv-out-tint); border-color: #dfa697; }
.inv-scope .inv-btn.is-dashed {
  width: 100%;
  border-style: dashed;
  background: transparent;
  color: var(--inv-ink-2);
}

.inv-scope .inv-icon-btn {
  width: 40px;
  height: 40px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--inv-ink-2);
  font-size: 19px;
  cursor: pointer;
}
.inv-scope .inv-icon-btn:hover:not(:disabled) { background: var(--inv-sunken); color: var(--inv-ink); }
.inv-scope .inv-icon-btn:disabled { opacity: 0.5; cursor: default; }
.inv-scope .inv-icon-btn.is-small { width: 32px; height: 32px; font-size: 16px; }

.inv-scope .inv-text-btn {
  padding: 2px 0;
  border: 0;
  background: none;
  color: var(--inv-link);
  font: 600 14px/1.3 'Outfit', system-ui, sans-serif;
  cursor: pointer;
}
.inv-scope .inv-text-btn:hover { text-decoration: underline; text-underline-offset: 3px; }

.inv-scope .is-spinning { animation: inv-spin 0.9s linear infinite; }
@keyframes inv-spin { to { transform: rotate(360deg); } }

/* ── Readout band: the counts that matter, in one instrument strip ───────── */
.inv .inv-readout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin-bottom: 20px;
  overflow: hidden;
  border: 1px solid var(--inv-line);
  border-radius: 12px;
  background: var(--inv-surface);
}
.inv .inv-readout-cell {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 16px 20px 18px;
  border: 0;
  background: transparent;
  box-shadow: -1px 0 0 var(--inv-line), 0 -1px 0 var(--inv-line);
  color: inherit;
  font: inherit;
  text-align: left;
}
.inv button.inv-readout-cell { cursor: pointer; }
.inv button.inv-readout-cell:hover { background: var(--inv-sunken); }
.inv button.inv-readout-cell:focus-visible { outline-offset: -3px; }
.inv .inv-readout-label {
  color: var(--inv-steel);
  font-size: 14px;
  font-weight: 500;
}
.inv .inv-readout-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--inv-ink);
  font: 600 28px/1.1 var(--inv-figure);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.inv .inv-readout-cell.is-low .inv-readout-value { color: var(--inv-low-ink); }
.inv .inv-readout-cell.is-out .inv-readout-value { color: var(--inv-out-ink); }
.inv .inv-readout-note {
  color: var(--inv-steel);
  font-size: 12px;
  line-height: 1.3;
}

/* ── Stock gauge: ten-segment level meter, tick marks the reorder level ──── */
.inv-scope .inv-gauge {
  position: relative;
  display: block;
  width: 100%;
  max-width: 150px;
  height: 10px;
  border-radius: 2px;
  background: #e3e8eb;
}
.inv-scope .inv-gauge-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 2px;
  background: var(--inv-ok);
}
.inv-scope .inv-gauge.is-low .inv-gauge-fill { background: var(--inv-low); }
.inv-scope .inv-gauge.is-out .inv-gauge-fill { background: var(--inv-out); }
/* Gaps between the ten segments. */
.inv-scope .inv-gauge::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 2px), var(--inv-surface) calc(10% - 2px) 10%);
  pointer-events: none;
}
.inv-scope .inv-gauge-mark {
  position: absolute;
  z-index: 1;
  top: -4px;
  bottom: -4px;
  left: calc(50% - 2px);
  width: 2px;
  border-radius: 1px;
  background: var(--inv-ink);
}
.inv-scope .inv-gauge-unset {
  color: var(--inv-steel);
  font-size: 13.5px;
}

/* ── Status: a dot and a word ─────────────────────────────────────────────── */
.inv-scope .inv-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--inv-ink-2);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}
.inv-scope .inv-state i {
  width: 9px;
  height: 9px;
  flex: none;
  border-radius: 50%;
  background: var(--inv-idle);
}
.inv-scope .inv-state.is-ok i { background: var(--inv-ok); }
.inv-scope .inv-state.is-low i { background: var(--inv-low); }
.inv-scope .inv-state.is-low { color: var(--inv-low-ink); }
.inv-scope .inv-state.is-out i { background: var(--inv-out); }
.inv-scope .inv-state.is-out { color: var(--inv-out-ink); }

/* ── Panels and lists ─────────────────────────────────────────────────────── */
.inv .inv-split {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  margin-bottom: 20px;
}
.inv .inv-split > .inv-panel { margin-bottom: 0; }
.inv .inv-stack {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.inv .inv-stack > .inv-panel { margin-bottom: 0; }

.inv .inv-panel {
  min-width: 0;
  margin-bottom: 20px;
  border: 1px solid var(--inv-line);
  border-radius: 12px;
  background: var(--inv-surface);
}
.inv .inv-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
  padding: 16px 20px 12px;
}
.inv .inv-panel-head h2 {
  margin: 0;
  color: var(--inv-ink);
  font: 600 17px/1.3 'Outfit', system-ui, sans-serif;
}
.inv .inv-panel-head p {
  flex: 0 0 100%;
  color: var(--inv-steel);
  font-size: 14px;
}
.inv .inv-panel-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  padding: 0 20px 20px;
}

.inv .inv-list { list-style: none; }
.inv .inv-list > li { border-top: 1px solid var(--inv-line-soft); }
.inv .inv-list-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.inv .inv-list-row:hover { background: var(--inv-sunken); }
.inv .inv-list-row:focus-visible { outline-offset: -3px; }
.inv .inv-list > li:last-child .inv-list-row { border-radius: 0 0 11px 11px; }
.inv .inv-list-row.is-static { cursor: default; }
.inv .inv-list-row.is-static:hover { background: none; }
.inv .inv-list-main { flex: 1; min-width: 0; }
.inv .inv-list-main strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--inv-ink);
  font-weight: 600;
}
.inv .inv-list-main small {
  display: block;
  margin-top: 1px;
  color: var(--inv-steel);
  font-size: 13.5px;
}
.inv .inv-list-gauge { flex: 0 0 120px; }
.inv .inv-list-end {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  text-align: right;
}
.inv .inv-list-end .inv-fig { color: var(--inv-ink); font-weight: 600; }

.inv .inv-tools { margin-top: 8px; }
.inv .inv-tools h2 {
  margin: 0 0 10px;
  color: var(--inv-ink-2);
  font: 600 15px/1.3 'Outfit', system-ui, sans-serif;
}
.inv .inv-tools ul {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  column-gap: 24px;
  list-style: none;
  border-top: 1px solid var(--inv-line);
}
.inv .inv-tools li { border-bottom: 1px solid var(--inv-line); }
.inv .inv-tools button {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 11px 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.inv .inv-tools button strong { color: var(--inv-link); font-weight: 600; }
.inv .inv-tools button span { color: var(--inv-steel); font-size: 13.5px; }
.inv .inv-tools button:hover strong { text-decoration: underline; text-underline-offset: 3px; }

.inv .inv-link-list {
  list-style: none;
  max-width: 860px;
  border: 1px solid var(--inv-line);
  border-radius: 12px;
  background: var(--inv-surface);
}
.inv .inv-link-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
}
.inv .inv-link-list li + li { border-top: 1px solid var(--inv-line-soft); }
.inv .inv-link-list strong { display: block; color: var(--inv-ink); font-size: 15.5px; font-weight: 600; }
.inv .inv-link-list span { display: block; color: var(--inv-steel); font-size: 14px; }

/* ── Toolbar: search + filter chips ───────────────────────────────────────── */
.inv .inv-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.inv .inv-search {
  flex: 0 1 340px;
  min-width: 220px;
  height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 6px 0 12px;
  border: 1px solid var(--inv-line-strong);
  border-radius: 8px;
  background: var(--inv-surface);
  color: var(--inv-steel);
}
.inv .inv-search:focus-within { border-color: var(--inv-focus); box-shadow: 0 0 0 1px var(--inv-focus); }
.inv .inv-search > svg { flex: none; font-size: 17px; }
.inv .inv-search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--inv-ink);
  font: 400 15px 'Outfit', system-ui, sans-serif;
}
.inv .inv-search input::-webkit-search-cancel-button { display: none; }
.inv .inv-search button {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--inv-steel);
  cursor: pointer;
}
.inv .inv-search button:hover { background: var(--inv-sunken); }

.inv-scope .inv-chips,
.inv-scope .inv-choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.inv-scope .inv-chip {
  position: relative;
  height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid var(--inv-line-strong);
  border-radius: 18px;
  background: var(--inv-surface);
  color: var(--inv-ink-2);
  font: 500 14px/1 'Outfit', system-ui, sans-serif;
  white-space: nowrap;
  cursor: pointer;
}
.inv-scope .inv-chip:hover { border-color: #aab6bc; }
.inv-scope .inv-chip.is-on {
  border-color: var(--inv-ink);
  background: var(--inv-ink);
  color: #fff;
}
.inv-scope .inv-chip-count {
  color: var(--inv-steel);
  font: 500 13px/1 var(--inv-figure);
  font-variant-numeric: tabular-nums;
}
.inv-scope .inv-chip.is-on .inv-chip-count { color: rgba(255, 255, 255, 0.72); }
.inv-scope .inv-chip input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.inv-scope .inv-chip:has(input:focus-visible) { outline: 3px solid var(--inv-focus); outline-offset: 2px; }

/* ── Tables ───────────────────────────────────────────────────────────────── */
.inv .inv-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--inv-line);
  border-radius: 12px;
  background: var(--inv-surface);
}
.inv .inv-table-wrap.is-flush {
  border: 0;
  border-top: 1px solid var(--inv-line);
  border-radius: 0 0 12px 12px;
}
.inv .inv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
}
.inv .inv-table th {
  padding: 11px 16px;
  border-bottom: 1px solid var(--inv-line);
  background: var(--inv-sunken);
  color: var(--inv-steel);
  font: 500 13.5px/1.3 'Outfit', system-ui, sans-serif;
  text-align: left;
  white-space: nowrap;
}
.inv .inv-table-wrap:not(.is-flush) th:first-child { border-top-left-radius: 11px; }
.inv .inv-table-wrap:not(.is-flush) th:last-child { border-top-right-radius: 11px; }
.inv .inv-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--inv-line-soft);
  color: var(--inv-ink-2);
  vertical-align: middle;
  white-space: nowrap;
}
.inv .inv-table tbody tr:last-child td { border-bottom: 0; }
.inv .inv-table .is-num { text-align: right; }
.inv .inv-table td.is-wrap { min-width: 180px; white-space: normal; }
.inv .inv-table td.is-muted { color: var(--inv-steel); font-size: 13.5px; }
.inv .inv-table td.is-in { color: var(--inv-ok); font-weight: 600; }
.inv .inv-table td.is-out { color: var(--inv-out-ink); font-weight: 600; }
.inv .inv-table .is-primary-cell strong {
  display: block;
  color: var(--inv-ink);
  font-size: 15px;
  font-weight: 600;
}
.inv .inv-table .is-primary-cell small {
  display: block;
  margin-top: 1px;
  color: var(--inv-steel);
  font-size: 13.5px;
}
.inv .inv-table tr.is-clickable { cursor: pointer; }
.inv .inv-table tr.is-clickable:hover td { background: #f9fafb; }
.inv .inv-table tr.is-clickable:focus-visible { outline: 3px solid var(--inv-focus); outline-offset: -3px; }
.inv .inv-table td .inv-gauge { width: 140px; }
.inv .inv-table-note {
  padding: 12px 16px;
  border-top: 1px solid var(--inv-line-soft);
  color: var(--inv-steel);
  font-size: 14px;
}

/* ── Empty, loading, banners, toast ───────────────────────────────────────── */
.inv-scope .inv-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 40px 24px 44px;
  color: var(--inv-steel);
  text-align: center;
}
.inv .inv-panel .inv-empty { padding: 24px 20px 28px; }
.inv > .inv-body > .inv-empty {
  border: 1px dashed var(--inv-line-strong);
  border-radius: 12px;
}
.inv-scope .inv-empty p { max-width: 46ch; }
.inv-scope .inv-empty .inv-empty-title { color: var(--inv-ink); font-size: 16px; font-weight: 600; }
.inv-scope .inv-empty .inv-btn { margin-top: 12px; }
.inv-scope .inv-empty-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  color: var(--inv-ink-2);
}

.inv-scope.inv-state-page {
  min-height: 50vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 48px 16px;
  color: var(--inv-steel);
  text-align: center;
}
.inv-scope.inv-state-page > svg { font-size: 28px; color: var(--inv-low); }
.inv-scope.inv-state-page h2 { color: var(--inv-ink); font: 600 20px/1.3 'Outfit', system-ui, sans-serif; }
.inv-scope .inv-spinner {
  width: 22px;
  height: 22px;
  border: 2.5px solid var(--inv-line);
  border-top-color: #e85d04;
  border-radius: 50%;
  animation: inv-spin 0.8s linear infinite;
}

.inv .inv-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  padding: 12px 14px 12px 16px;
  border: 1px solid #efc7bd;
  border-radius: 10px;
  background: var(--inv-out-tint);
  color: var(--inv-out-ink);
  font-weight: 500;
}

.inv .inv-toast {
  position: fixed;
  z-index: 2100;
  right: 24px;
  bottom: calc(24px + var(--inv-toast-footer-offset, 0px));
  max-width: min(440px, calc(100vw - 32px));
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 10px 12px 16px;
  border-radius: 10px;
  background: var(--inv-ink);
  color: #fff;
  box-shadow: 0 12px 32px rgba(24, 33, 38, 0.24);
  font-size: 15px;
  animation: inv-toast-in 0.2s ease-out;
  pointer-events: none;
  transition: bottom 0.16s ease-out;
}
.inv .inv-toast.is-error { background: var(--inv-out-ink); }
.inv .inv-toast span { padding-top: 3px; }
.inv .inv-toast button {
  width: 28px;
  height: 28px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  pointer-events: auto;
}
.inv .inv-toast button:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
@keyframes inv-toast-in { from { transform: translateY(8px); opacity: 0; } }

/* ── Settings ─────────────────────────────────────────────────────────────── */
.inv .inv-settings { max-width: 820px; }
.inv .inv-stock-control .inv-panel-body { align-items: stretch; }
.inv .inv-setting-group { margin: 0; padding: 0; border: 0; }
.inv .inv-setting-group legend { margin-bottom: 9px; color: var(--inv-ink); font-size: 14px; font-weight: 600; }
.inv .inv-setting-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.inv .inv-setting-options label {
  display: flex; align-items: flex-start; gap: 10px; min-height: 92px; padding: 14px;
  border: 1px solid var(--inv-line-strong); border-radius: 10px; background: var(--inv-surface); cursor: pointer;
}
.inv .inv-setting-options label.is-selected { border-color: var(--inv-action); box-shadow: 0 0 0 1px var(--inv-action); background: var(--inv-sunken); }
.inv .inv-setting-options input { margin-top: 3px; accent-color: var(--inv-action); }
.inv .inv-setting-options strong, .inv .inv-setting-options small { display: block; }
.inv .inv-setting-options strong { color: var(--inv-ink); font-weight: 600; }
.inv .inv-setting-options small { margin-top: 4px; color: var(--inv-steel); font-size: 13px; line-height: 1.4; }
.inv .inv-setting-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 16px 0; border-top: 1px solid var(--inv-line-soft); }
.inv .inv-setting-row > div { min-width: 0; }
.inv .inv-setting-row strong, .inv .inv-setting-row small { display: block; }
.inv .inv-setting-row strong { color: var(--inv-ink); font-weight: 600; }
.inv .inv-setting-row small { max-width: 62ch; margin-top: 3px; color: var(--inv-steel); font-size: 13px; line-height: 1.4; }
.inv .inv-setting-row.is-disabled { opacity: .55; }
.inv .inv-switch { display: flex; align-items: center; gap: 8px; flex: none; cursor: pointer; }
.inv .inv-switch input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.inv .inv-switch span { position: relative; width: 44px; height: 24px; border-radius: 12px; background: var(--inv-line-strong); transition: background .15s ease; }
.inv .inv-switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(24,33,38,.25); transition: transform .15s ease; }
.inv .inv-switch input:checked + span { background: var(--inv-action); }
.inv .inv-switch input:checked + span::after { transform: translateX(20px); }
.inv .inv-switch input:focus-visible + span { outline: 3px solid var(--inv-focus); outline-offset: 2px; }
.inv .inv-switch em { min-width: 26px; color: var(--inv-steel); font-size: 12px; font-style: normal; font-weight: 700; }
.inv .inv-locked-check { display: flex; align-items: center; gap: 7px; flex: none; color: var(--inv-ok); font-size: 13px; font-weight: 600; }
.inv .inv-locked-check input { width: 18px; height: 18px; accent-color: var(--inv-action); }
.inv .inv-setting-actions { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding-top: 2px; }
.inv .inv-setting-actions .inv-note { margin: 0; }
.inv .inv-shortage-panel { margin-bottom: 20px; }
.inv .inv-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
}
.inv .inv-tags li {
  height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 6px 0 12px;
  border: 1px solid var(--inv-line-strong);
  border-radius: 17px;
  color: var(--inv-ink-2);
  font-size: 14px;
  font-weight: 500;
}
.inv .inv-tags li:not(:has(button)) { padding-right: 12px; }
.inv .inv-tag-count { color: var(--inv-steel); font: 500 13px/1 var(--inv-figure); }
.inv .inv-tags button {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--inv-steel);
  cursor: pointer;
}
.inv .inv-tags button:hover { background: var(--inv-out-tint); color: var(--inv-out-ink); }
.inv .inv-inline-form {
  width: 100%;
  max-width: 440px;
  display: flex;
  gap: 8px;
}
.inv .inv-inline-form input {
  flex: 1;
  min-width: 0;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--inv-line-strong);
  border-radius: 8px;
  color: var(--inv-ink);
  font: 400 15px 'Outfit', system-ui, sans-serif;
}
.inv .inv-inline-form input:focus-visible { outline: 2px solid var(--inv-focus); outline-offset: 0; border-color: var(--inv-focus); }

.inv-scope .inv-muted { color: var(--inv-steel); font-size: 14px; }

/* ── Drawer ───────────────────────────────────────────────────────────────── */
.inv-layer {
  position: fixed;
  z-index: 2000;
  inset: 0;
  display: flex;
  justify-content: flex-end;
  background: rgba(24, 33, 38, 0.45);
  overflow: hidden;
}
.inv-layer .inv-drawer {
  width: min(620px, 100%);
  height: 100%;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--inv-surface);
  box-shadow: -16px 0 48px rgba(24, 33, 38, 0.2);
  outline: none;
  animation: inv-drawer-in 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
  min-width: 0;
  max-width: 100%;
}
@keyframes inv-drawer-in { from { transform: translateX(32px); opacity: 0; } }
.inv-layer .inv-drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 20px 16px 24px;
  border-bottom: 1px solid var(--inv-line);
}
.inv-layer .inv-drawer-head h2 {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--inv-ink);
  font: 600 22px/1.25 'Outfit', system-ui, sans-serif;
  letter-spacing: -0.01em;
}
.inv-layer .inv-drawer-head p {
  margin-top: 4px;
  color: var(--inv-steel);
  font-size: 14.5px;
}
.inv-layer .inv-drawer-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px 24px 28px;
  overflow-x: hidden;
}
.inv-layer .inv-drawer-foot {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 24px calc(14px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--inv-line);
  background: var(--inv-surface);
}
.inv-layer .inv-foot-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.inv-layer .inv-foot-actions .is-left { margin-right: auto; }
.inv-layer .inv-confirm-text { margin-right: auto; color: var(--inv-ink); font-weight: 600; }

.inv-layer .inv-totals {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px 28px;
}
.inv-layer .inv-totals div {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.inv-layer .inv-totals dt { color: var(--inv-steel); font-size: 13px; }
.inv-layer .inv-totals dd {
  color: var(--inv-ink-2);
  font: 600 15px/1.3 var(--inv-figure);
  font-variant-numeric: tabular-nums;
}
.inv-layer .inv-totals .is-grand dt { color: var(--inv-ink-2); font-weight: 600; }
.inv-layer .inv-totals .is-grand dd { color: var(--inv-ink); font-size: 22px; letter-spacing: -0.02em; }

/* ── Forms ────────────────────────────────────────────────────────────────── */
.inv-layer .inv-form {
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.inv-layer .inv-form-grid,
.inv-layer .inv-line-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 16px 14px;
}
.inv-layer .inv-line-grid { gap: 12px; }
.inv-layer .span-full { grid-column: 1 / -1; }
.inv-layer .span-half { grid-column: span 3; }
.inv-layer .span-third { grid-column: span 2; }

.inv-layer .inv-field {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.inv-layer .inv-field-label {
  display: block;
  color: var(--inv-ink-2);
  font: 500 13.5px/1.3 'Outfit', system-ui, sans-serif;
}
.inv-layer .inv-field-hint { color: var(--inv-steel); font-size: 12.5px; }
.inv-layer .inv-field :is(input, select, textarea) {
  width: 100%;
  min-width: 0;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--inv-line-strong);
  border-radius: 8px;
  background: var(--inv-surface);
  color: var(--inv-ink);
  font: 400 15px/1.3 'Outfit', system-ui, sans-serif;
}
.inv-layer .inv-field select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%235f6c74' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  text-overflow: ellipsis;
}
.inv-layer .inv-field textarea {
  height: auto;
  min-height: 72px;
  padding: 10px 12px;
  line-height: 1.45;
  resize: vertical;
}
.inv-layer .inv-field input[type='number'] { -moz-appearance: textfield; font-family: var(--inv-figure); font-variant-numeric: tabular-nums; }
.inv-layer .inv-field input[type='number']::-webkit-inner-spin-button,
.inv-layer .inv-field input[type='number']::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.inv-layer .inv-field :is(input, select, textarea)::placeholder { color: #98a3a9; }
.inv-layer .inv-field :is(input, select, textarea):focus-visible {
  border-color: var(--inv-focus);
  outline: 2px solid var(--inv-focus);
  outline-offset: -1px;
}
.inv-layer .inv-field :is(input, select):disabled { background-color: var(--inv-sunken); color: var(--inv-steel); cursor: not-allowed; }

.inv-layer .inv-form-section {
  margin: 0 0 10px;
  color: var(--inv-ink);
  font: 600 15.5px/1.3 'Outfit', system-ui, sans-serif;
}
.inv-layer .inv-lines {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.inv-layer .inv-lines .inv-form-section { margin-bottom: 0; }
.inv-layer .inv-line {
  padding: 10px 14px 16px;
  border: 1px solid var(--inv-line);
  border-radius: 10px;
  background: var(--inv-sunken);
}
.inv-layer .inv-line-head {
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  color: var(--inv-ink-2);
  font-size: 14px;
  font-weight: 600;
}
.inv-layer .inv-line-total {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.inv-layer .inv-line-total strong {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  overflow: hidden;
  color: var(--inv-ink);
  font: 600 17px/1 var(--inv-figure);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.inv-layer .inv-line-total .inv-field-label { text-align: right; }

.inv-layer fieldset.inv-choice {
  min-width: 0;
  border: 0;
}
.inv-layer fieldset.inv-choice legend {
  margin-bottom: 8px;
  padding: 0;
}
.inv-layer .inv-segment {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--inv-line-strong);
  border-radius: 10px;
  background: var(--inv-sunken);
}
.inv-layer .inv-segment label {
  position: relative;
  height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 0 16px;
  border-radius: 7px;
  color: var(--inv-ink-2);
  font-size: 14.5px;
  font-weight: 500;
  cursor: pointer;
}
.inv-layer .inv-segment label.is-on {
  background: var(--inv-surface);
  box-shadow: 0 1px 2px rgba(24, 33, 38, 0.14), 0 0 0 1px var(--inv-line);
  color: var(--inv-ink);
  font-weight: 600;
}
.inv-layer .inv-segment input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.inv-layer .inv-segment label:has(input:focus-visible) { outline: 3px solid var(--inv-focus); outline-offset: 1px; }

.inv-layer .inv-check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
}
.inv-layer .inv-check input {
  width: 20px;
  height: 20px;
  flex: none;
  margin-top: 1px;
  accent-color: var(--inv-action);
}
.inv-layer .inv-check strong { display: block; color: var(--inv-ink); font-weight: 600; }
.inv-layer .inv-check small { display: block; color: var(--inv-steel); font-size: 13.5px; }

.inv-layer .inv-note {
  max-width: 62ch;
  color: var(--inv-steel);
  font-size: 13.5px;
}
.inv-layer .inv-form-error {
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--inv-out-tint);
  color: var(--inv-out-ink);
  font-size: 14.5px;
  font-weight: 500;
}
.inv-layer .inv-prose { color: var(--inv-ink-2); white-space: pre-wrap; }

.inv-layer .inv-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 20px;
  margin-bottom: 24px;
}
.inv-layer .inv-facts dt { color: var(--inv-steel); font-size: 13px; }
.inv-layer .inv-facts dd { color: var(--inv-ink); font-size: 15px; font-weight: 500; overflow-wrap: anywhere; }

/* Bill-style list: dashed rules like a supplier receipt. */
.inv-layer .inv-receipt {
  list-style: none;
  margin-bottom: 18px;
  border-top: 1px solid var(--inv-line);
}
.inv-layer .inv-receipt li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px dashed var(--inv-line-strong);
}
.inv-layer .inv-receipt li > div { min-width: 0; }
.inv-layer .inv-receipt strong { display: block; color: var(--inv-ink); font-weight: 600; }
.inv-layer .inv-receipt li > div > span { display: block; color: var(--inv-steel); font-size: 13.5px; }
.inv-layer .inv-receipt .inv-fig { flex: none; color: var(--inv-ink); font-weight: 600; }

.inv-layer .inv-batches { margin-top: 4px; }
.inv-layer .inv-archive {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--inv-line);
}
.inv-layer .inv-archive > span { flex-basis: 100%; color: var(--inv-ink-2); }

/* ── Purchase orders ──────────────────────────────────────────────────────── */
.inv-layer .inv-drawer.is-wide { width: min(780px, 100%); }
.inv-scope .po-states { display: inline-flex; flex-wrap: wrap; gap: 4px 14px; }

/* Vendor picker: a search field with a short list under it. */
.inv-layer .po-vendor { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.inv-layer .po-vendor-row { display: flex; gap: 8px; }
.inv-layer .po-combo { position: relative; flex: 1; min-width: 0; }
.inv-layer .po-combo input {
  width: 100%;
  height: 44px;
  padding: 0 36px 0 12px;
  border: 1px solid var(--inv-line-strong);
  border-radius: 8px;
  background: var(--inv-surface);
  color: var(--inv-ink);
  font: 400 15px/1.3 'Outfit', system-ui, sans-serif;
}
.inv-layer .po-combo input::placeholder { color: #98a3a9; }
.inv-layer .po-combo input:focus-visible { border-color: var(--inv-focus); outline: 2px solid var(--inv-focus); outline-offset: -1px; }
.inv-layer .po-combo-caret { position: absolute; top: 50%; right: 12px; transform: translateY(-50%); color: var(--inv-steel); pointer-events: none; }
.inv-layer .po-combo-list {
  position: absolute;
  z-index: 5;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 264px;
  overflow-y: auto;
  padding: 4px;
  list-style: none;
  border: 1px solid var(--inv-line-strong);
  border-radius: 10px;
  background: var(--inv-surface);
  box-shadow: 0 12px 32px rgba(24, 33, 38, 0.16);
}
.inv-layer .po-combo-list li {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 7px;
  color: var(--inv-ink);
  cursor: pointer;
}
.inv-layer .po-combo-list li span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.inv-layer .po-combo-list li small { color: var(--inv-steel); font-size: 13px; }
.inv-layer .po-combo-list li.is-active { background: var(--inv-sunken); }
.inv-layer .po-combo-list li.is-add { color: var(--inv-link); font-weight: 600; }

/* Vendor form: optional fields behind "More details". */
.inv-layer .po-more { display: flex; flex-direction: column; gap: 14px; }
.inv-layer .po-more-toggle {
  align-self: flex-start;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 4px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--inv-ink-2);
  font: 600 14.5px 'Outfit', system-ui, sans-serif;
  cursor: pointer;
}
.inv-layer .po-more-toggle svg { transition: transform 0.15s ease; }
.inv-layer .po-more-toggle svg.is-open { transform: rotate(180deg); }
.inv-layer .po-more-toggle:focus-visible { outline: 2px solid var(--inv-focus); outline-offset: 2px; }

/* Items: one row per raw material. */
/* Columns: material, qty, unit, amount paid, unit price (worked out), [tax, discount], remove. */
.inv-layer .po-items {
  --po-cols: minmax(0, 2.4fr) minmax(64px, 0.8fr) minmax(72px, 0.8fr) minmax(92px, 1fr) minmax(92px, 1fr) 36px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--inv-line);
  border-radius: 10px;
  overflow: hidden;
}
.inv-layer .po-items.has-adjust {
  --po-cols: minmax(0, 2fr) minmax(60px, 0.7fr) minmax(68px, 0.7fr) minmax(84px, 0.9fr) minmax(84px, 0.9fr) minmax(68px, 0.8fr) minmax(68px, 0.8fr) 36px;
}
.inv-layer .po-items-head,
.inv-layer .po-item {
  display: grid;
  grid-template-columns: var(--po-cols);
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
}
.inv-layer .po-items-head { background: var(--inv-sunken); color: var(--inv-steel); font: 500 12.5px/1.3 'Outfit', system-ui, sans-serif; }
.inv-layer .po-items-head .is-num { text-align: right; }
.inv-layer .po-item + .po-item { border-top: 1px solid var(--inv-line-soft); }
.inv-layer .po-cell { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.inv-layer .po-cell-label { display: none; color: var(--inv-steel); font-size: 12.5px; }
.inv-layer .po-cell :is(input, select) {
  width: 100%;
  min-width: 0;
  height: 40px;
  padding: 0 8px;
  border: 1px solid var(--inv-line-strong);
  border-radius: 7px;
  background-color: var(--inv-surface);
  color: var(--inv-ink);
  font: 400 15px/1.3 'Outfit', system-ui, sans-serif;
}
.inv-layer .po-cell select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 26px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%235f6c74' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  text-overflow: ellipsis;
}
.inv-layer .po-cell select:disabled { background-color: var(--inv-sunken); color: var(--inv-steel); }
.inv-layer .po-cell input[type='number'] { -moz-appearance: textfield; font-family: var(--inv-figure); font-variant-numeric: tabular-nums; }
.inv-layer .po-cell input[type='number']::-webkit-inner-spin-button,
.inv-layer .po-cell input[type='number']::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.inv-layer .po-cell :is(input, select):focus-visible { border-color: var(--inv-focus); outline: 2px solid var(--inv-focus); outline-offset: -1px; }
.inv-layer .po-cell.is-amount input { text-align: right; font-weight: 600; }
.inv-layer .po-cell.is-unit-price { align-items: flex-end; color: var(--inv-steel); font-size: 14px; white-space: nowrap; }
.inv-layer .po-cell.is-remove { align-items: center; }
.inv-layer .po-items-note { margin-top: 8px; }
.inv-layer .po-items-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 10px; }
.inv-layer .po-items-actions .inv-btn.is-dashed { width: auto; flex: 1 1 220px; }

/* Receiving: one row per item still to come. */
.inv-layer .po-receive { list-style: none; border-top: 1px solid var(--inv-line); }
.inv-layer .po-receive li {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(110px, 0.8fr) minmax(150px, 1fr);
  align-items: end;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px dashed var(--inv-line-strong);
}
.inv-layer .po-receive-name { align-self: center; min-width: 0; }
.inv-layer .po-receive-name strong { display: block; color: var(--inv-ink); font-weight: 600; }
.inv-layer .po-receive-name span { display: block; color: var(--inv-steel); font-size: 13.5px; }

/* Order details */
.inv-layer .po-sums { display: grid; grid-template-columns: auto auto; justify-content: end; gap: 6px 28px; margin: -6px 0 22px; }
.inv-layer .po-sums div { display: contents; }
.inv-layer .po-sums dt { color: var(--inv-steel); font-size: 14px; text-align: right; }
.inv-layer .po-sums dd { color: var(--inv-ink-2); font: 600 15px/1.35 var(--inv-figure); font-variant-numeric: tabular-nums; text-align: right; }
.inv-layer .po-sums .is-strong dt { color: var(--inv-ink); font-weight: 600; }
.inv-layer .po-sums .is-strong dd { color: var(--inv-ink); font-size: 17px; }
.inv-layer .inv-receipt .po-to-come { color: var(--inv-low-ink); }
.inv-layer .inv-receipt .po-done { color: var(--inv-ok); }
.inv-layer .inv-receipt .po-reversed { color: var(--inv-out-ink); }
.inv-layer .inv-receipt li.is-reversed > div > strong { color: var(--inv-steel); text-decoration: line-through; }

@media (max-width: 640px) {
  .inv-layer .po-items-head { display: none; }
  .inv-layer .po-item,
  .inv-layer .po-items.has-adjust .po-item { grid-template-columns: repeat(6, minmax(0, 1fr)); row-gap: 10px; padding: 12px; }
  .inv-layer .po-cell { grid-column: span 2; }
  .inv-layer .po-cell.is-material { grid-column: 1 / -1; }
  .inv-layer .po-cell-label { display: block; }
  .inv-layer .po-cell.is-amount input { text-align: left; }
  .inv-layer .po-cell.is-unit-price { align-items: flex-start; }
  .inv-layer .po-cell.is-remove { grid-column: span 2; align-items: flex-end; justify-content: flex-end; }
  .inv-layer .po-vendor-row { flex-wrap: wrap; }
  .inv-layer .po-vendor-row .po-combo { flex-basis: 100%; }
  .inv-layer .po-receive li { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inv-layer .po-receive-name { grid-column: 1 / -1; }
  .inv-layer :is(.inv-form, .inv-form-grid, .po-items, .po-item, .po-cell) { max-width: 100%; min-width: 0; }
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .inv .inv-split { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 760px) {
  .inv .inv-title h1 { font-size: 26px; }
  .inv .inv-readout { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inv .inv-readout-cell:first-child { grid-column: 1 / -1; }
  .inv .inv-readout-value { font-size: 24px; }
  .inv .inv-search { flex: 1 1 100%; }

  /* Tables become stacked records. */
  .inv .inv-table-wrap { overflow: visible; }
  .inv .inv-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  .inv .inv-table,
  .inv .inv-table tbody,
  .inv .inv-table tr,
  .inv .inv-table td { display: block; width: 100%; }
  .inv .inv-table tr {
    padding: 12px 16px;
    border-bottom: 1px solid var(--inv-line-soft);
  }
  .inv .inv-table tbody tr:last-child { border-bottom: 0; }
  /* Label floats left, value sits right; keeps "16 L" together as one run of text. */
  .inv .inv-table td {
    display: flow-root;
    padding: 4px 0;
    border: 0;
    white-space: normal;
    text-align: right;
  }
  .inv .inv-table td::before {
    content: attr(data-label);
    float: left;
    margin-right: 16px;
    color: var(--inv-steel);
    font: 500 13.5px/1.6 'Outfit', system-ui, sans-serif;
    text-align: left;
  }
  .inv .inv-table td .inv-gauge { margin: 6px 0 6px auto; }
  .inv .inv-table td.is-primary-cell {
    display: block;
    padding: 0 0 6px;
    text-align: left;
  }
  .inv .inv-table td.is-primary-cell::before { content: none; }
  .inv .inv-table td.is-wrap { min-width: 0; }
  .inv .inv-table td .inv-gauge { width: 140px; }
  .inv .inv-table tr.is-clickable:hover td { background: none; }
  .inv .inv-table tr.is-clickable:hover { background: #f9fafb; }
}

@media (max-width: 560px) {
  .inv .inv-setting-options { grid-template-columns: minmax(0, 1fr); }
  .inv .inv-setting-row, .inv .inv-setting-actions { align-items: flex-start; flex-direction: column; gap: 12px; }
  .inv .inv-head { align-items: flex-start; }
  .inv .inv-head-actions { width: 100%; }
  .inv .inv-head-actions .inv-btn { flex: 1; }
  .inv .inv-list-gauge { display: none; }
  .inv .inv-list-row { padding: 12px 16px; }
  .inv .inv-panel-head { padding: 14px 16px 10px; }
  .inv .inv-panel-body { padding: 0 16px 16px; }
  .inv .inv-link-list li { padding: 14px 16px; }
  .inv .inv-toast {
    left: 16px;
    right: 16px;
    bottom: calc(16px + var(--inv-toast-footer-offset, 0px));
    max-width: none;
  }
  .inv .inv-toast button { width: 44px; height: 44px; margin: -8px -6px -8px 0; }

  .inv-layer .inv-drawer { width: 100%; box-shadow: none; }
  .inv-layer .inv-drawer-head { padding: calc(12px + env(safe-area-inset-top, 0px)) 12px 12px 16px; }
  .inv-layer .inv-drawer-body { padding: 16px 16px 24px; }
  .inv-layer .inv-drawer-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); }
  .inv-layer .inv-form-grid .span-half { grid-column: 1 / -1; }
  .inv-layer .inv-foot-actions .inv-btn { flex: 1 1 auto; }
  .inv-layer .inv-foot-actions .is-left { flex-basis: 100%; margin-right: 0; }
  .inv-layer .inv-totals { justify-content: space-between; }
  .inv-layer .inv-totals div { align-items: flex-start; }
}

@media (max-width: 420px) {
  .inv-layer .po-item,
  .inv-layer .po-items.has-adjust .po-item { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inv-layer .po-cell { grid-column: span 1; }
  .inv-layer .po-cell.is-material { grid-column: 1 / -1; }
  .inv-layer .po-cell.is-remove { grid-column: 1 / -1; }
  .inv-layer .inv-foot-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .inv-layer .inv-foot-actions .inv-btn.is-primary:last-child { grid-column: 1 / -1; }
  .inv-layer .inv-line-grid .span-third { grid-column: span 3; }
  .inv-layer .inv-facts { grid-template-columns: minmax(0, 1fr); }
}

/* Touch screens (tablet POS): larger targets. */
@media (pointer: coarse) {
  .inv-scope .inv-btn { height: 46px; }
  .inv-layer .inv-field :is(input, select) { height: 48px; }
  .inv-scope .inv-chip { height: 40px; }
  .inv .inv-tabs button { padding: 14px 16px 15px; }
}

@media (prefers-reduced-motion: reduce) {
  .inv-layer .inv-drawer,
  .inv .inv-toast { animation: none; }
  .inv-scope .is-spinning,
  .inv-scope .inv-spinner { animation-duration: 2.4s; }
}
/* Status banners shared by the report pages (errors, partial data, notices). */
.report-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 12px 0;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid;
  font-size: 14px;
  line-height: 1.45;
}

.report-status__text {
  flex: 1 1 260px;
}

.report-status button {
  flex: 0 0 auto;
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
  font-weight: 600;
  cursor: pointer;
}

.report-status--error {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #991b1b;
}

.report-status--warning {
  background: #fffbeb;
  border-color: #fcd34d;
  color: #92400e;
}

.report-status--info {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1e3a8a;
}

.report-value-unavailable {
  color: #64748b;
  font-style: italic;
}
/* ================================================
   SALES ANALYTICS PAGE - EXPORT BUTTONS
   ================================================ */

/* Export buttons group container */
.export-buttons-group {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* Modern export button base styles */
.export-btn-modern {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Primary export button (Export Details) */
.export-btn-modern:not(.secondary) {
    background: linear-gradient(135deg, #f48c06 0%, #e85d04 100%);
    color: white;
}

.export-btn-modern:not(.secondary):hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(232, 93, 4, 0.4);
}

/* Secondary export button (Export Summary) */
.export-btn-modern.secondary {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.export-btn-modern.secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(240, 147, 251, 0.4);
}

.export-btn-modern:active {
    transform: translateY(0);
}

.export-btn-modern svg {
    font-size: 1.1rem;
}

/* Page header layout for sales analytics */
.sales-analytics-page .page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.5rem;
    background: white;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-bottom: 1.5rem;
}

.sales-analytics-page .back-btn-modern {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: #f3f4f6;
    border: none;
    border-radius: 10px;
    color: #374151;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sales-analytics-page .back-btn-modern:hover {
    background: #e5e7eb;
    transform: translateX(-4px);
}

.sales-analytics-page .header-title {
    flex: 1;
}

.sales-analytics-page .header-title h1 {
    margin: 0;
    font-size: 1.75rem;
    color: #111827;
}

.sales-analytics-page .header-subtitle {
    margin: 0.25rem 0 0 0;
    font-size: 0.9rem;
    color: #6b7280;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .sales-analytics-page .page-header {
        flex-wrap: wrap;
    }

    .export-buttons-group {
        order: 3;
        width: 100%;
        margin-top: 0.5rem;
    }
}

@media (max-width: 768px) {
    .sales-analytics-page .page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .sales-analytics-page .back-btn-modern {
        align-self: flex-start;
    }

    .export-buttons-group {
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
    }

    .export-btn-modern {
        width: 100%;
        justify-content: center;
        padding: 0.65rem 1.25rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .sales-analytics-page .page-header {
        padding: 1rem;
    }

    .sales-analytics-page .header-title h1 {
        font-size: 1.5rem;
    }

    .export-btn-modern {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }

    .export-btn-modern svg {
        font-size: 1rem;
    }
}/* Sales Comparison Report - Robust Styles */

.profit-loss-page {
    padding: 32px;
    background-color: #f8fafc;
    min-height: 100vh;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

/* Page Header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 800;
    color: #0f172a;
    margin: 0;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    background-color: white;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    color: #475569;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.back-btn:hover {
    background-color: #f1f5f9;
}

/* Filters */
.filters-section {
    background-color: white;
    padding: 24px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    margin-bottom: 32px;
    display: flex;
    gap: 24px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-group label {
    font-size: 13px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
}

.date-presets {
    display: flex;
    gap: 8px;
    background-color: #f1f5f9;
    padding: 4px;
    border-radius: 8px;
}

.preset-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    border-radius: 6px;
    color: #64748b;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.preset-btn.active {
    background-color: white;
    color: #4f46e5;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.date-inputs {
    display: flex;
    gap: 16px;
}

.input-field input {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
}

/* --- Comparison Card Layout (Replacing Tailwind) --- */
.report-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.comparison-card {
    background-color: white;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    margin-bottom: 24px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.comparison-grid {
    display: grid;
    grid-template-columns: 25% 25% 30% 20%;
    /* Fixed Proportions */
    width: 100%;
}

@media (max-width: 768px) {
    .comparison-grid {
        grid-template-columns: 1fr;
        /* Stack on mobile */
    }
}

.metric-col {
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-right: 1px solid #f1f5f9;
}

.metric-col:last-child {
    border-right: none;
}

/* Col 1: Title */
.metric-col.col-title {
    background-color: #f8fafc;
    flex-direction: row;
    /* Icon + Text */
    align-items: center;
    justify-content: flex-start;
    gap: 16px;
}

.metric-icon-box {
    padding: 12px;
    background-color: white;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #475569;
}

.metric-title {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
}

/* Table Typography */
.trigger-table td.font-medium {
    font-weight: 600;
    color: #1e293b;
    text-transform: capitalize;
}

/* Col 2 & 3 & 4: Data Columns */
.metric-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: #94a3b8;
    margin-bottom: 8px;
    display: block;
    /* Ensure block display to prevent inline merging */
}

.metric-date {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 8px;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.metric-value {
    font-size: 24px;
    font-weight: 700;
    color: #334155;
    display: block;
}

/* Current Period Highlight */
.metric-col.col-current {
    background-color: #eff6ff;
    /* Indigo-50 ish */
    border-left: 2px solid #6366f1;
    /* Indigo-500 indicator */
}

.metric-col.col-current .metric-label {
    color: #6366f1;
}

.metric-col.col-current .metric-value {
    color: #1e1b4b;
    /* Indigo-950 */
    font-size: 28px;
    /* Slightly larger */
}

/* Change Column */
.metric-col.col-change {
    align-items: center;
    text-align: center;
}

.change-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 8px;
}

.text-green {
    color: #059669;
}

.bg-green {
    background-color: #d1fae5;
}

.text-red {
    color: #e11d48;
}

.bg-red {
    background-color: #ffe4e6;
}

.text-gray {
    color: #64748b;
}

.bg-gray {
    background-color: #f1f5f9;
}

.change-value {
    font-size: 13px;
    font-weight: 600;
}

/* Detailed Table Styles */
.detail-card {
    background-color: white;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    margin-top: 32px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.table-header-box {
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
    background-color: #f8fafc;
}

.table-title {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Detailed Ingredient Table */
.comparison-table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    table-layout: fixed;
}

/* Column Widths */
.comparison-table th:nth-child(1) {
    width: 40%;
}

.comparison-table th:nth-child(2) {
    width: 20%;
}

.comparison-table th:nth-child(3) {
    width: 20%;
}

.comparison-table th:nth-child(4) {
    width: 20%;
}

/* Header Formatting */
.comparison-table thead th {
    background-color: #f8fafc;
    color: #475569;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 16px 24px;
    border-bottom: 2px solid #e2e8f0;
    text-align: left;
    vertical-align: middle;
}

.comparison-table thead th.right {
    text-align: right;
}

/* Row & Cell Formatting */
.comparison-table tbody tr {
    background-color: white;
    transition: background-color 0.15s ease;
}

.comparison-table tbody tr:hover {
    background-color: #f8fafc;
}

.comparison-table tbody tr:not(:last-child) td {
    border-bottom: 1px solid #f1f5f9;
}

.comparison-table td {
    padding: 16px 24px;
    color: #334155;
    font-size: 14px;
    vertical-align: middle;
    text-align: left;
}

.comparison-table td.right {
    text-align: right;
}

.comparison-table td.font-medium {
    font-weight: 600;
    color: #1e293b;
    text-transform: capitalize;
}

/* Difference Colors */
.diff-positive {
    color: #059669;
    font-weight: 700;
}

.diff-negative {
    color: #e11d48;
    font-weight: 700;
}

.diff-neutral {
    color: #cbd5e1;
}

/* Unit Badge */
.unit-badge {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 600;
    text-transform: uppercase;
}

/* Toggle Switch */
.toggle-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.toggle-checkbox {
    position: relative;
    width: 48px;
    height: 24px;
    appearance: none;
    background-color: #cbd5e1;
    border-radius: 12px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.toggle-checkbox:checked {
    background-color: #4f46e5;
}

.toggle-checkbox::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: white;
    top: 2px;
    left: 2px;
    transition: transform 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-checkbox:checked::before {
    transform: translateX(24px);
}

.toggle-text {
    font-size: 14px;
    font-weight: 600;
    color: #334155;
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.status-wastage {
    background-color: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.status-normal {
    background-color: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

.status-not-tracked {
    background-color: #f8fafc;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

/* Center alignment for table cells */
.comparison-table td.center,
.comparison-table th.center {
    text-align: center;
}

/* AI Report Modal */
.report-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

.report-modal {
    background-color: white;
    border-radius: 16px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.report-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 32px;
    border-bottom: 1px solid #e2e8f0;
}

.report-modal-header h2 {
    font-size: 22px;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
    display: flex;
    align-items: center;
}

.close-modal-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: #64748b;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-modal-btn:hover {
    color: #0f172a;
}

.report-modal-content {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    line-height: 1.8;
}

.report-modal-footer {
    padding: 20px 32px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.close-btn {
    padding: 10px 24px;
    background-color: #f1f5f9;
    border: none;
    border-radius: 8px;
    color: #475569;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.close-btn:hover {
    background-color: #e2e8f0;
}

/* Loading State */
.loading-state {
    text-align: center;
    padding: 64px 32px;
    color: #64748b;
    font-size: 16px;
    font-weight: 500;
}/* Profit & Loss Report Specific Styles */
.gradient-loss {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.text-success {
  color: #10b981 !important;
}

.text-danger {
  color: #ef4444 !important;
}

.warning-banner {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background-color: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  color: #92400e;
  transition: all 0.2s ease;
}

.warning-banner.clickable:hover {
  background-color: #fde68a;
  border-color: #d97706;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2);
}

.warning-banner svg {
  flex-shrink: 0;
  margin-top: 0.2rem;
  font-size: 1.2rem;
  color: #f59e0b;
}

.warning-banner strong {
  color: #78350f;
}

.error-banner {
  background-color: #fee2e2;
  border: 1px solid #ef4444;
  border-radius: 8px;
  padding: 1rem 1.5rem;
  margin-bottom: 1.5rem;
  color: #991b1b;
  text-align: center;
  font-weight: 600;
}

/* Recipe status indicators */
.status-pill.delivered {
  background-color: #d1fae5;
  color: #065f46;
}

.status-pill.refunded {
  background-color: #fee2e2;
  color: #991b1b;
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal-content {
  background: white;
  border-radius: 12px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(50px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid #e5e7eb;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
  color: #111827;
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #6b7280;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: all 0.2s;
}

.modal-close-btn:hover {
  background-color: #f3f4f6;
  color: #111827;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.modal-description {
  margin: 0 0 1.5rem 0;
  color: #6b7280;
  font-size: 0.95rem;
  line-height: 1.6;
}

.missing-items-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.missing-item-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background-color: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  transition: all 0.2s;
}

.missing-item-card:hover {
  background-color: #fef3c7;
  border-color: #fbbf24;
  transform: translateX(4px);
}

.missing-item-name {
  font-weight: 600;
  color: #92400e;
  font-size: 1rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  padding: 1.5rem;
  border-top: 1px solid #e5e7eb;
}

.btn-primary,
.btn-secondary {
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

.btn-primary {
  background-color: #3b82f6;
  color: white;
}

.btn-primary:hover {
  background-color: #2563eb;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
  background-color: #f3f4f6;
  color: #374151;
}

.btn-secondary:hover {
  background-color: #e5e7eb;
}

/* Responsive */
@media (max-width: 640px) {
  .modal-content {
    width: 95%;
    max-height: 90vh;
  }

  .modal-header h2 {
    font-size: 1.25rem;
  }

  .modal-footer {
    flex-direction: column;
  }

  .btn-primary,
  .btn-secondary {
    width: 100%;
  }
}/* Inventory Report Page Styles */

.inventory-report-page {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.report-header {
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.report-type-toggle {
    display: flex;
    background: #f0f0f0;
    padding: 0.35rem;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
}

.toggle-btn {
    padding: 0.6rem 1.25rem;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toggle-btn.active {
    background: white;
    color: #eb5939;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.export-actions {
    display: flex;
    gap: 0.75rem;
}

.export-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    color: white;
}

.export-btn.excel {
    background: linear-gradient(135deg, #1d6f42 0%, #185c37 100%);
    box-shadow: 0 4px 8px rgba(24, 92, 55, 0.2);
}

.export-btn.excel:hover:not(:disabled) {
    background: linear-gradient(135deg, #185c37 0%, #144b2d 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(24, 92, 55, 0.3);
}

.export-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #ccc;
    box-shadow: none;
}

.header-content h1 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 2rem;
    color: #1a1a1a;
    margin-bottom: 0.5rem;
}

.header-icon {
    color: #eb5939;
}

.header-description {
    color: #666;
    font-size: 1rem;
}

/* Duplicate Warning Banner */
.duplicate-warning-banner {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border: 2px solid #ffc107;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.2);
}

.warning-content {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.warning-icon {
    font-size: 2rem;
    color: #f57c00;
    flex-shrink: 0;
    margin-top: 0.25rem;
}

.warning-text h3 {
    margin: 0 0 0.5rem 0;
    color: #e65100;
    font-size: 1.25rem;
}

.warning-text p {
    margin: 0;
    color: #5d4037;
    line-height: 1.6;
}

.normalize-btn {
    width: 100%;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #eb5939 0%, #d84315 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(235, 89, 57, 0.3);
}

.normalize-btn:hover {
    background: linear-gradient(135deg, #d84315 0%, #bf360c 100%);
    box-shadow: 0 6px 12px rgba(235, 89, 57, 0.4);
    transform: translateY(-2px);
}

.normalize-btn:active {
    transform: translateY(0);
}


/* Filter Section */
.filter-section {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.date-filter-group {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.filter-btn {
    padding: 0.75rem 1.5rem;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.filter-btn:hover {
    border-color: #eb5939;
    color: #eb5939;
}

.filter-btn.active {
    background: #eb5939;
    color: white;
    border-color: #eb5939;
}

.custom-date-range {
    display: flex;
    gap: 1.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e0e0e0;
}

.date-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.date-input-group label {
    font-weight: 500;
    color: #333;
    font-size: 0.9rem;
}

.date-input-group input[type="date"] {
    padding: 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
}

/* Summary Cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.summary-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.card-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.card-icon.ingredient {
    background: #e3f2fd;
    color: #1976d2;
}

.card-icon.commodity {
    background: #fff3e0;
    color: #f57c00;
}

.card-icon.cost {
    background: #fce4ec;
    color: #c2185b;
}

.card-content h3 {
    font-size: 1.75rem;
    margin: 0;
    color: #1a1a1a;
}

.card-content p {
    margin: 0.25rem 0 0 0;
    color: #666;
    font-size: 0.9rem;
}

/* Search and Filter */
.search-filter-section {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 250px;
    padding: 0.75rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
}

.search-input:focus {
    outline: none;
    border-color: #eb5939;
}

.category-filter {
    display: flex;
    gap: 0.5rem;
}

.category-btn {
    padding: 0.75rem 1.25rem;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.category-btn:hover {
    border-color: #eb5939;
    color: #eb5939;
}

.category-btn.active {
    background: #eb5939;
    color: white;
    border-color: #eb5939;
}

/* Table */
.consumption-table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.consumption-table {
    width: 100%;
    border-collapse: collapse;
}

.consumption-table thead {
    background: #f5f5f5;
}

.consumption-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #e0e0e0;
}

.consumption-table tbody tr {
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
}

.consumption-table tbody tr:hover {
    background: #fafafa;
}

.usage-count {
    color: #666;
    font-size: 0.85rem;
    background: #f5f5f5;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    border: 1px solid #e0e0e0;
}

.consumption-table td {
    padding: 1rem;
    color: #333;
}

.ingredient-name {
    font-weight: 500;
    color: #1a1a1a;
}

.category-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
}

.category-badge.ingredient {
    background: #e3f2fd;
    color: #1976d2;
}

.category-badge.commodity {
    background: #fff3e0;
    color: #f57c00;
}

.quantity-cell {
    font-family: 'Courier New', monospace;
}

.cost-cell {
    font-weight: 600;
    color: #c2185b;
}

.used-in-cell {
    max-width: 300px;
}

.usage-details summary {
    cursor: pointer;
    color: #eb5939;
    font-weight: 500;
    user-select: none;
}

.usage-details summary:hover {
    text-decoration: underline;
}

.usage-list {
    list-style: none;
    padding: 0.75rem 0 0 0;
    margin: 0;
}

.usage-list li {
    padding: 0.5rem 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f0f0f0;
}

.usage-list li:last-child {
    border-bottom: none;
}

.usage-stats {
    color: #666;
    font-size: 0.9rem;
}

/* Unit Selector */
.unit-selector {
    padding: 0.5rem 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    background: white;
    font-size: 0.9rem;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 80px;
}

.unit-selector:hover {
    border-color: #eb5939;
}

.unit-selector:focus {
    outline: none;
    border-color: #eb5939;
    box-shadow: 0 0 0 3px rgba(235, 89, 57, 0.1);
}

.unit-selector optgroup {
    font-weight: bold;
    font-style: normal;
    color: #eb5939;
    background: #fff3e0;
    padding: 0.5rem 0;
}

.unit-selector option {
    padding: 0.5rem;
    font-weight: normal;
    color: #333;
    background: white;
}

/* Loading and Empty States */
.loading-state {
    text-align: center;
    padding: 4rem 2rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #eb5939;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.loading-state p {
    color: #666;
    font-size: 1.1rem;
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.empty-icon {
    font-size: 4rem;
    color: #ccc;
    margin-bottom: 1rem;
}

.empty-state h3 {
    color: #333;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: #666;
    margin-bottom: 0.5rem;
}

.empty-state .help-text {
    color: #999;
    font-size: 0.9rem;
    margin-top: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .inventory-report-page {
        padding: 1rem;
    }

    .header-content h1 {
        font-size: 1.5rem;
    }

    .duplicate-warning-banner {
        padding: 1rem;
    }

    .warning-content {
        flex-direction: column;
        gap: 0.75rem;
    }

    .warning-icon {
        font-size: 1.5rem;
    }

    .warning-text h3 {
        font-size: 1.1rem;
    }

    .warning-text p {
        font-size: 0.9rem;
    }

    .normalize-btn {
        padding: 0.875rem 1.5rem;
        font-size: 0.95rem;
    }

    .summary-cards {
        grid-template-columns: 1fr;
    }

    .search-filter-section {
        flex-direction: column;
        align-items: stretch;
    }

    .search-input {
        width: 100%;
    }

    .category-filter {
        width: 100%;
        justify-content: stretch;
    }

    .category-btn {
        flex: 1;
    }

    .consumption-table-container {
        overflow-x: auto;
    }

    .consumption-table {
        min-width: 800px;
    }

    .custom-date-range {
        flex-direction: column;
    }
}

/* Generate Report Button */
.generate-report-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(76, 175, 80, 0.3);
    white-space: nowrap;
}

.generate-report-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #45a049 0%, #388e3c 100%);
    box-shadow: 0 6px 12px rgba(76, 175, 80, 0.4);
    transform: translateY(-2px);
}

.generate-report-btn:active:not(:disabled) {
    transform: translateY(0);
}

.generate-report-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    box-shadow: none;
}

.generate-report-btn svg {
    font-size: 1.25rem;
}

/* AI Report Modal */
.report-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.report-modal {
    background: white;
    border-radius: 16px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.report-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 2px solid #f0f0f0;
}

.report-modal-header h2 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0;
    font-size: 1.5rem;
    color: #1a1a1a;
}

.report-modal-header h2 svg {
    color: #4CAF50;
    font-size: 1.75rem;
}

.close-modal-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #666;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-modal-btn:hover {
    background: #f5f5f5;
    color: #333;
}

.report-modal-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
}

.ai-report-text {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 0.95rem;
    line-height: 1.8;
    color: #333;
    white-space: pre-wrap;
    word-wrap: break-word;
    margin: 0;
}

.report-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1.5rem 2rem;
    border-top: 2px solid #f0f0f0;
}

.download-report-btn,
.download-pdf-btn,
.close-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.download-pdf-btn {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    box-shadow: 0 2px 6px rgba(231, 76, 60, 0.3);
}

.download-pdf-btn:hover {
    background: linear-gradient(135deg, #c0392b 0%, #a93226 100%);
    box-shadow: 0 4px 10px rgba(231, 76, 60, 0.4);
    transform: translateY(-2px);
}

.download-report-btn {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    box-shadow: 0 2px 6px rgba(76, 175, 80, 0.3);
}

.download-report-btn:hover {
    background: linear-gradient(135deg, #45a049 0%, #388e3c 100%);
    box-shadow: 0 4px 10px rgba(76, 175, 80, 0.4);
    transform: translateY(-2px);
}

.close-btn {
    background: #f5f5f5;
    color: #333;
}

.close-btn:hover {
    background: #e0e0e0;
}

/* Responsive Modal */
@media (max-width: 768px) {
    .report-modal {
        max-height: 95vh;
        margin: 0.5rem;
    }

    .report-modal-header {
        padding: 1rem 1.5rem;
    }

    .report-modal-header h2 {
        font-size: 1.25rem;
    }

    .report-modal-content {
        padding: 1.5rem;
    }

    .ai-report-text {
        font-size: 0.9rem;
    }

    .report-modal-footer {
        padding: 1rem 1.5rem;
        flex-direction: column;
    }

    .download-report-btn,
    .close-btn {
        width: 100%;
    }

    .generate-report-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Charts Section */
.charts-section {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    margin-bottom: 2rem;
    animation: fadeInUp 0.5s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.charts-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 1.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
}

.chart-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
}

.chart-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    transform: translateY(-4px);
}

.chart-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
    margin: 0 0 1rem 0;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #4CAF50;
}

.chart-container {
    position: relative;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-container canvas {
    max-height: 100%;
    max-width: 100%;
}

/* Responsive Charts */
@media (max-width: 1024px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }

    .chart-container {
        height: 280px;
    }
}

@media (max-width: 768px) {
    .charts-section {
        padding: 1.5rem;
    }

    .charts-title {
        font-size: 1.5rem;
    }

    .chart-card {
        padding: 1rem;
    }

    .chart-title {
        font-size: 1rem;
    }

    .chart-container {
        height: 250px;
    }
}

@media (max-width: 480px) {
    .charts-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .chart-container {
        height: 220px;
    }
}
/* Authoritative Inventory Stock & Usage report */
.isr-page {
    --isr-accent: #ea580c;
    --isr-accent-ink: #c2410c;
    --isr-accent-soft: #fff7ed;
    --isr-accent-line: #fed7aa;
    --isr-ink: #0f172a;
    --isr-text: #334155;
    --isr-muted: #64748b;
    --isr-faint: #94a3b8;
    --isr-line: #e2e8f0;
    --isr-line-soft: #f1f5f9;
    --isr-surface: #ffffff;
    --isr-sunken: #f8fafc;
    --isr-hover: #fffaf5;
    --isr-warn: #b45309;
    --isr-warn-soft: #fffbeb;
    --isr-warn-line: #fde68a;
    --isr-bad: #b91c1c;
    --isr-bad-soft: #fef2f2;
    --isr-bad-line: #fecaca;
    --isr-good: #15803d;
    --isr-under: #1d4ed8;
    --isr-radius: 12px;
    max-width: 1500px;
    margin: 0 auto;
    padding: 0 0 40px;
    color: var(--isr-text);
}
.isr-page *, .isr-page *::before, .isr-page *::after { box-sizing: border-box; }
.isr-page button, .isr-page input { font-family: inherit; }
.isr-page button:focus-visible, .isr-page input:focus-visible, .isr-drawer button:focus-visible {
    outline: 2px solid var(--isr-accent);
    outline-offset: 2px;
}

/* Header */
.isr-head { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 16px 24px; margin-bottom: 18px; }
.isr-title { min-width: 0; }
.isr-title h1 { margin: 0; font-size: 26px; line-height: 1.2; font-weight: 800; letter-spacing: -0.01em; color: var(--isr-ink); }
.isr-title p { margin: 6px 0 10px; font-size: 14px; color: var(--isr-muted); }
.isr-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.isr-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--isr-line); border-radius: 999px; background: var(--isr-surface); font-size: 12.5px; font-weight: 600; color: var(--isr-text); }
.isr-chip svg { color: var(--isr-faint); }
.isr-chip.is-accent { background: var(--isr-accent-soft); border-color: var(--isr-accent-line); color: var(--isr-accent-ink); }
.isr-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.isr-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 14px; border: 1px solid var(--isr-line); border-radius: 9px; background: var(--isr-surface); color: var(--isr-text); font-size: 13.5px; font-weight: 600; white-space: nowrap; cursor: pointer; transition: border-color .15s, color .15s, background-color .15s; }
.isr-btn:hover:not(:disabled) { border-color: var(--isr-accent); color: var(--isr-accent-ink); }
.isr-btn:disabled { opacity: .5; cursor: not-allowed; }
.isr-btn svg { flex-shrink: 0; }
.isr-export { display: inline-flex; border: 1px solid var(--isr-line); border-radius: 9px; background: var(--isr-surface); overflow: hidden; }
.isr-export .isr-btn { height: 36px; border: 0; border-radius: 0; }
.isr-export .isr-btn + .isr-btn { border-left: 1px solid var(--isr-line); }
.isr-export .isr-btn:hover:not(:disabled) { background: var(--isr-accent-soft); }
.isr-icon-btn { display: grid; place-items: center; flex-shrink: 0; width: 34px; height: 34px; border: 1px solid var(--isr-line); border-radius: 8px; background: var(--isr-surface); color: var(--isr-muted); cursor: pointer; }
.isr-icon-btn:hover { border-color: var(--isr-accent); color: var(--isr-accent-ink); }
.isr-spin { animation: isr-spin .8s linear infinite; }
@keyframes isr-spin { to { transform: rotate(360deg); } }

/* Filters */
.isr-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 10px; border: 1px solid var(--isr-line); border-radius: var(--isr-radius); background: var(--isr-surface); }
.isr-segment { display: inline-flex; gap: 2px; max-width: 100%; padding: 3px; border-radius: 10px; background: var(--isr-line-soft); overflow-x: auto; scrollbar-width: none; }
.isr-segment::-webkit-scrollbar { display: none; }
.isr-segment button { padding: 7px 13px; border: 0; border-radius: 8px; background: transparent; font-size: 13px; font-weight: 600; color: var(--isr-muted); white-space: nowrap; cursor: pointer; transition: color .15s, background-color .15s; }
.isr-segment button:hover { color: var(--isr-ink); }
.isr-segment button[aria-pressed="true"] { background: var(--isr-surface); color: var(--isr-accent-ink); box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }
.isr-dates { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.isr-dates label { display: flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--isr-muted); }
.isr-dates input { height: 36px; padding: 0 10px; border: 1px solid var(--isr-line); border-radius: 8px; background: var(--isr-surface); font-size: 13.5px; letter-spacing: 0; text-transform: none; color: var(--isr-ink); }
.isr-dates input:focus { outline: none; border-color: var(--isr-accent); box-shadow: 0 0 0 3px rgba(234, 88, 12, .12); }
.isr-search { position: relative; flex: 0 1 300px; min-width: 200px; margin-left: auto; }
.isr-search-icon { position: absolute; top: 50%; left: 11px; transform: translateY(-50%); color: var(--isr-faint); pointer-events: none; }
.isr-search input { width: 100%; height: 38px; padding: 0 34px; border: 1px solid var(--isr-line); border-radius: 9px; background: var(--isr-sunken); font-size: 13.5px; color: var(--isr-ink); -webkit-appearance: none; appearance: none; }
.isr-search input::-webkit-search-cancel-button { display: none; }
.isr-search input:focus { outline: none; border-color: var(--isr-accent); background: var(--isr-surface); box-shadow: 0 0 0 3px rgba(234, 88, 12, .12); }
.isr-search-clear { position: absolute; top: 50%; right: 6px; transform: translateY(-50%); display: grid; place-items: center; width: 26px; height: 26px; border: 0; border-radius: 6px; background: transparent; color: var(--isr-muted); cursor: pointer; }
.isr-search-clear:hover { background: var(--isr-line-soft); color: var(--isr-ink); }

/* Alerts */
.isr-alert { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 10px 12px 10px 14px; border: 1px solid; border-radius: 10px; font-size: 13.5px; line-height: 1.45; }
.isr-alert > svg { flex-shrink: 0; }
.isr-alert > span { flex: 1; min-width: 0; }
.isr-alert .isr-btn { height: 32px; }
.isr-alert.is-error { background: var(--isr-bad-soft); border-color: var(--isr-bad-line); color: var(--isr-bad); }
.isr-alert.is-warn { background: var(--isr-warn-soft); border-color: var(--isr-warn-line); color: var(--isr-warn); }
.isr-alert .isr-icon-btn { width: 30px; height: 30px; background: transparent; border-color: transparent; color: inherit; }

/* Summary cards */
.isr-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 16px 0 18px; }
.isr-card { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 14px 16px; border: 1px solid var(--isr-line); border-radius: var(--isr-radius); background: var(--isr-surface); }
.isr-card-label { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--isr-muted); }
.isr-card-scope { padding: 1px 7px; border-radius: 999px; background: var(--isr-line-soft); font-size: 10.5px; color: var(--isr-faint); }
.isr-card-value { font-size: 24px; font-weight: 800; line-height: 1.15; font-variant-numeric: tabular-nums; color: var(--isr-ink); overflow-wrap: anywhere; }
.isr-card-value.is-empty { color: var(--isr-faint); }
.isr-card-sub { display: flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--isr-muted); }
.isr-card-sub.is-warn { color: var(--isr-warn); }
.isr-card.is-alert { border-color: var(--isr-bad-line); }
.isr-card.is-alert .isr-card-value { color: var(--isr-bad); }

/* Tabs */
.isr-tabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--isr-line); overflow-x: auto; scrollbar-width: none; }
.isr-tabs::-webkit-scrollbar { display: none; }
.isr-tabs button { display: inline-flex; align-items: center; gap: 8px; margin-bottom: -1px; padding: 11px 12px; border: 0; border-bottom: 2px solid transparent; background: transparent; font-size: 14px; font-weight: 700; color: var(--isr-muted); white-space: nowrap; cursor: pointer; }
.isr-tabs button:hover { color: var(--isr-ink); }
.isr-tabs button[aria-selected="true"] { color: var(--isr-accent-ink); border-bottom-color: var(--isr-accent); }
.isr-count { min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--isr-line-soft); font-size: 11.5px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; color: var(--isr-muted); }
.isr-tabs button[aria-selected="true"] .isr-count { background: var(--isr-accent-soft); color: var(--isr-accent-ink); }

/* Tables */
.isr-table-wrap { position: relative; overflow-x: auto; border: 1px solid var(--isr-line); border-radius: var(--isr-radius); background: var(--isr-surface); transition: opacity .2s; }
.isr-table-wrap.is-busy { opacity: .55; pointer-events: none; }
.isr-table { width: 100%; min-width: var(--isr-min, 860px); border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.isr-table th { padding: 11px 14px; border-bottom: 1px solid var(--isr-line); background: var(--isr-sunken); font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-align: left; text-transform: uppercase; white-space: nowrap; vertical-align: bottom; color: var(--isr-muted); }
.isr-table td { padding: 10px 14px; border-bottom: 1px solid var(--isr-line-soft); vertical-align: middle; color: var(--isr-text); }
.isr-table tbody tr:last-child td { border-bottom: 0; }
.isr-table tbody tr.is-clickable { cursor: pointer; }
.isr-table tbody tr:hover td { background: var(--isr-hover); }
.isr-table .is-right { text-align: right; }
.isr-table .is-material { position: sticky; left: 0; z-index: 1; min-width: 190px; max-width: 280px; background: var(--isr-surface); box-shadow: inset -1px 0 0 var(--isr-line-soft); }
.isr-table th.is-material { z-index: 2; background: var(--isr-sunken); }
.isr-table tfoot td { border-top: 1px solid var(--isr-line); border-bottom: 0; background: var(--isr-sunken); font-weight: 700; color: var(--isr-ink); }
.isr-table tbody tr:hover td.is-material { background: var(--isr-hover); }
.isr-table tfoot td.is-material { background: var(--isr-sunken); }

.isr-material { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.isr-link { padding: 0; border: 0; background: none; font-weight: 700; text-align: left; color: var(--isr-ink); overflow-wrap: anywhere; cursor: pointer; }
.isr-link:hover { color: var(--isr-accent-ink); text-decoration: underline; text-underline-offset: 3px; }
.isr-material-name { font-weight: 700; color: var(--isr-ink); overflow-wrap: anywhere; }
.isr-material-meta { font-size: 12px; color: var(--isr-faint); }
.isr-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.isr-num.is-zero { color: var(--isr-faint); }
.isr-num.is-muted { color: var(--isr-muted); }
.isr-num.is-strong { font-weight: 700; color: var(--isr-ink); }
.isr-num.is-neg, .isr-num.is-over { font-weight: 700; color: var(--isr-bad); }
.isr-num.is-under { font-weight: 700; color: var(--isr-under); }
.isr-cell-stack { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.isr-tag { display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.isr-tag.is-warn { border: 1px solid var(--isr-warn-line); background: var(--isr-warn-soft); color: var(--isr-warn); }
.isr-note { display: inline-block; max-width: 300px; font-size: 12.5px; line-height: 1.4; color: var(--isr-muted); }

.isr-footnote { display: flex; align-items: flex-start; gap: 8px; margin: 12px 2px 0; font-size: 12.5px; line-height: 1.55; color: var(--isr-muted); }
.isr-footnote svg { flex-shrink: 0; margin-top: 3px; color: var(--isr-faint); }

/* Empty, loading and progress */
.isr-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 44px 20px; border: 1px dashed var(--isr-line); border-radius: var(--isr-radius); background: var(--isr-surface); text-align: center; }
.isr-empty strong { font-size: 15px; color: var(--isr-ink); }
.isr-empty p { max-width: 460px; margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--isr-muted); }
.isr-empty .isr-btn { margin-top: 8px; }
.isr-empty-icon { display: grid; place-items: center; width: 40px; height: 40px; margin-bottom: 4px; border-radius: 50%; background: var(--isr-accent-soft); font-size: 18px; color: var(--isr-accent-ink); }
.isr-progress { width: min(320px, 100%); height: 6px; margin-top: 10px; border-radius: 999px; background: var(--isr-line-soft); overflow: hidden; }
.isr-progress span { display: block; height: 100%; border-radius: inherit; background: var(--isr-accent); transition: width .3s ease; }
.isr-skel { display: block; height: 12px; border-radius: 6px; background: linear-gradient(90deg, #edf1f5 25%, #f6f8fa 50%, #edf1f5 75%); background-size: 200% 100%; animation: isr-shimmer 1.2s ease-in-out infinite; }
.isr-skel.is-value { width: 60%; height: 26px; margin: 2px 0; }
.isr-skel.is-sub { width: 45%; }
.isr-skeleton-row { display: grid; grid-template-columns: 2fr repeat(6, 1fr); align-items: center; gap: 20px; padding: 17px 16px; border-top: 1px solid var(--isr-line-soft); }
.isr-skeleton-row.is-head { border-top: 0; background: var(--isr-sunken); }
@keyframes isr-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* Material drawer */
.isr-overlay { position: fixed; inset: 0; z-index: 2100; display: flex; justify-content: flex-end; background: rgba(15, 23, 42, .45); animation: isr-fade .15s ease; }
.isr-drawer { display: flex; flex-direction: column; width: min(480px, 100%); height: 100%; background: var(--isr-surface); box-shadow: -12px 0 32px rgba(15, 23, 42, .18); animation: isr-slide .2s ease; color: var(--isr-text); }
.isr-drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px 20px 14px; border-bottom: 1px solid var(--isr-line); }
.isr-drawer-head h2 { margin: 0; font-size: 18px; line-height: 1.3; color: var(--isr-ink); overflow-wrap: anywhere; }
.isr-drawer-head p { margin: 4px 0 0; font-size: 13px; color: var(--isr-muted); }
.isr-drawer-body { flex: 1; padding: 16px 20px 24px; overflow-y: auto; }
.isr-breakdown { margin: 0 0 22px; border: 1px solid var(--isr-line); border-radius: 10px; overflow: hidden; }
.isr-breakdown div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 14px; border-top: 1px solid var(--isr-line-soft); font-size: 13.5px; }
.isr-breakdown div:first-child { border-top: 0; }
.isr-breakdown dt { color: var(--isr-muted); }
.isr-breakdown dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--isr-ink); }
.isr-breakdown .is-total { border-top-color: var(--isr-accent-line); background: var(--isr-accent-soft); }
.isr-breakdown .is-total dt, .isr-breakdown .is-total dd { font-weight: 800; color: var(--isr-accent-ink); }
.isr-breakdown .is-now { background: var(--isr-sunken); }
.isr-section-title { display: flex; align-items: center; gap: 8px; margin: 0 0 4px; font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--isr-muted); }
.isr-movement { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--isr-line-soft); }
.isr-movement:first-of-type { border-top: 0; }
.isr-movement-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.isr-movement-text strong { font-size: 13.5px; font-weight: 600; color: var(--isr-ink); overflow-wrap: anywhere; }
.isr-movement-text span { font-size: 12px; color: var(--isr-muted); }
.isr-movement b { font-size: 13.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.isr-movement b.is-in { color: var(--isr-good); }
.isr-movement b.is-out { color: var(--isr-bad); }
.isr-movement-skeleton { display: grid; gap: 14px; padding: 10px 0; }
.isr-movement-skeleton .isr-skel { height: 30px; }
.isr-drawer-empty { margin: 10px 0 0; font-size: 13px; color: var(--isr-muted); }
.isr-drawer-foot { padding: 14px 20px; border-top: 1px solid var(--isr-line); }
.isr-drawer-foot .isr-btn { width: 100%; }
@keyframes isr-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes isr-slide { from { transform: translateX(24px); opacity: .6; } to { transform: none; opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
    .isr-spin, .isr-skel, .isr-overlay, .isr-drawer { animation: none; }
}

@media (max-width: 1100px) {
    .isr-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Phones: tables turn into cards */
@media (max-width: 760px) {
    .isr-title h1 { font-size: 21px; }
    .isr-title p { font-size: 13.5px; }
    .isr-actions { width: 100%; }
    .isr-export { flex: 1; }
    .isr-export .isr-btn { flex: 1; padding: 0 8px; }
    .isr-segment { flex-wrap: wrap; width: 100%; overflow: visible; }
    .isr-segment button { flex: 1 0 auto; padding: 7px 10px; }
    .isr-dates { width: 100%; }
    .isr-dates label { flex: 1 1 140px; }
    .isr-dates input { flex: 1; min-width: 0; }
    .isr-search { flex: 1 1 100%; margin-left: 0; }
    .isr-cards { gap: 8px; margin: 12px 0 14px; }
    .isr-card { padding: 12px; }
    .isr-card-label { font-size: 11px; }
    .isr-card-scope { display: none; }
    .isr-card-value { font-size: 20px; }
    .isr-card-sub { font-size: 12px; }

    .isr-table-wrap { overflow: visible; border: 0; background: transparent; }
    .isr-table { min-width: 0; font-size: 13px; }
    .isr-table thead { display: none; }
    .isr-table, .isr-table tbody, .isr-table tfoot { display: block; }
    .isr-table tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; margin-bottom: 10px; padding: 12px 14px; border: 1px solid var(--isr-line); border-radius: 12px; background: var(--isr-surface); }
    .isr-table tbody tr:hover td, .isr-table tbody tr:hover td.is-material { background: transparent; }
    .isr-table td, .isr-table tfoot td { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; min-width: 0; max-width: none; padding: 0; border: 0; background: transparent; box-shadow: none; position: static; text-align: left; }
    .isr-table td::before { content: attr(data-label); font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--isr-faint); }
    .isr-table td.is-material { position: static; grid-column: 1 / -1; max-width: none; padding-bottom: 8px; border-bottom: 1px solid var(--isr-line-soft); background: transparent; box-shadow: none; }
    .isr-table td.is-material::before { content: none; }
    .isr-table td.is-wide { grid-column: 1 / -1; }
    .isr-table td.is-wide:has(> .is-zero) { display: none; }
    .isr-table tfoot tr { background: var(--isr-sunken); }
    .isr-table tfoot td.is-blank { display: none; }
    .isr-cell-stack { align-items: flex-start; }
    .isr-note { max-width: none; }
    .isr-skeleton-row { grid-template-columns: 2fr repeat(2, 1fr); }
    .isr-skeleton-row .isr-skel:nth-child(n + 4) { display: none; }
}
/* Production Report Page Styles */

.production-report-page {
    padding: 32px;
    background-color: #f8fafc;
    min-height: 100vh;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

/* ── Header ── */
.pr-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 16px;
}

.pr-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.pr-back-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background-color: white;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    color: #475569;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.pr-back-btn:hover {
    background-color: #f1f5f9;
    border-color: #94a3b8;
}

.pr-title-block h1 {
    font-size: 26px;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 2px 0;
    line-height: 1.2;
}

.pr-title-block .pr-branch-name {
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
}

.pr-header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.pr-export-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background-color: #e85d04;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.pr-export-btn:hover {
    background-color: #c94f03;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(232, 93, 4, 0.3);
}

.pr-export-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ── Filters ── */
.pr-filters {
    background-color: white;
    padding: 20px 24px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    margin-bottom: 24px;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
}

.pr-filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pr-filter-group label {
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.pr-date-presets {
    display: flex;
    gap: 6px;
    background-color: #f1f5f9;
    padding: 4px;
    border-radius: 8px;
}

.pr-preset-btn {
    padding: 7px 14px;
    border: none;
    background: transparent;
    border-radius: 6px;
    color: #64748b;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.pr-preset-btn.active {
    background-color: white;
    color: #e85d04;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.pr-date-inputs {
    display: flex;
    gap: 10px;
    align-items: center;
}

.pr-date-inputs input[type="date"] {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    color: #334155;
    background: white;
    outline: none;
    transition: border-color 0.15s;
}

.pr-date-inputs input[type="date"]:focus {
    border-color: #e85d04;
    box-shadow: 0 0 0 3px rgba(232, 93, 4, 0.1);
}

.pr-date-sep {
    color: #94a3b8;
    font-size: 14px;
    font-weight: 500;
}

.pr-generate-btn {
    padding: 9px 22px;
    background-color: #0f172a;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.pr-generate-btn:hover {
    background-color: #1e293b;
    transform: translateY(-1px);
}

.pr-generate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ── Summary Cards ── */
.pr-summary-cards {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.pr-summary-card {
    flex: 1;
    min-width: 160px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px 24px;
    transition: box-shadow 0.2s;
}

.pr-summary-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.pr-summary-card .pr-card-value {
    font-size: 32px;
    font-weight: 800;
    color: #e85d04;
    line-height: 1;
    margin-bottom: 6px;
}

.pr-summary-card .pr-card-label {
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.pr-summary-card .pr-card-sub {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 4px;
}

/* ── Tabs ── */
.pr-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 0;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 10px;
    width: fit-content;
}

.pr-tabs-row {
    margin-bottom: 20px;
}

.pr-tab {
    padding: 9px 22px;
    border: none;
    background: transparent;
    border-radius: 7px;
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s;
}

.pr-tab.active {
    background: white;
    color: #e85d04;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

/* ── Search Bar ── */
.pr-search-bar {
    margin-bottom: 16px;
}

.pr-search-bar input {
    width: 100%;
    max-width: 340px;
    padding: 9px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    color: #334155;
    outline: none;
    background: white;
    transition: border-color 0.15s;
    box-sizing: border-box;
}

.pr-search-bar input:focus {
    border-color: #e85d04;
    box-shadow: 0 0 0 3px rgba(232, 93, 4, 0.1);
}

/* ── Table ── */
.pr-table-container {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
}

.pr-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.pr-table thead th {
    padding: 14px 16px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.pr-table thead th.right {
    text-align: right;
}

.pr-table tbody td {
    padding: 13px 16px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    vertical-align: middle;
}

.pr-table tbody td.right {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.pr-table tbody tr:last-child td {
    border-bottom: none;
}

/* ── Dish Rows (accordion) ── */
.pr-dish-row {
    cursor: pointer;
    transition: background-color 0.15s;
}

.pr-dish-row:hover {
    background-color: #f8fafc;
}

.pr-dish-row.expanded {
    background-color: #fff7f0;
}

.pr-dish-row td:first-child {
    font-weight: 600;
    color: #0f172a;
}

.pr-expand-icon {
    display: inline-flex;
    align-items: center;
    margin-right: 8px;
    color: #94a3b8;
    transition: transform 0.2s;
    font-size: 12px;
    vertical-align: middle;
}

.pr-dish-row.expanded .pr-expand-icon {
    transform: rotate(90deg);
    color: #e85d04;
}

.pr-qty-sold-badge {
    display: inline-block;
    padding: 2px 10px;
    background: #e0f2fe;
    color: #0369a1;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
}

/* ── Ingredient Expansion Rows ── */
.pr-ingredient-header-row td {
    background: #f1f5f9;
    padding: 8px 16px 8px 36px;
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #e2e8f0;
}

.pr-ingredient-row td {
    background: #fafafa;
    padding: 10px 16px 10px 36px;
    border-bottom: 1px solid #f1f5f9;
    color: #475569;
    font-size: 13px;
}

.pr-ingredient-row:last-child td {
    border-bottom: 1px solid #e2e8f0;
}

.pr-ingredient-row .ing-name {
    font-weight: 500;
    color: #334155;
}

.pr-ingredient-row .ing-qty {
    font-variant-numeric: tabular-nums;
    color: #0f172a;
    font-weight: 600;
}

.pr-ingredient-row .ing-unit {
    color: #64748b;
    font-size: 12px;
}

/* ── Badges ── */
.pr-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.pr-badge.no-recipe {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.pr-badge.has-recipe {
    background-color: #d1fae5;
    color: #065f46;
}

/* ── Dishes without recipes section ── */
.pr-no-recipe-section {
    margin-top: 24px;
    background: white;
    border: 1px solid #fde68a;
    border-radius: 12px;
    overflow: hidden;
}

.pr-no-recipe-section-header {
    padding: 14px 20px;
    background: #fffbeb;
    border-bottom: 1px solid #fde68a;
    font-size: 14px;
    font-weight: 700;
    color: #92400e;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pr-no-recipe-list {
    padding: 16px 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pr-no-recipe-chip {
    padding: 5px 14px;
    background: #fef3c7;
    border: 1px solid #fde68a;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: #78350f;
}

/* ── Empty / Loading States ── */
.pr-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 64px 32px;
    gap: 16px;
    color: #64748b;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
}

.pr-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e2e8f0;
    border-top-color: #e85d04;
    border-radius: 50%;
    animation: pr-spin 0.8s linear infinite;
}

@keyframes pr-spin {
    to { transform: rotate(360deg); }
}

.pr-loading p {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
    color: #475569;
}

.pr-no-data {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 64px 32px;
    gap: 12px;
    color: #94a3b8;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    text-align: center;
}

.pr-no-data svg {
    opacity: 0.4;
}

.pr-no-data h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #475569;
}

.pr-no-data p {
    margin: 0;
    font-size: 14px;
    color: #94a3b8;
}

.pr-initial-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 32px;
    gap: 14px;
    background: white;
    border: 2px dashed #e2e8f0;
    border-radius: 12px;
    text-align: center;
}

.pr-initial-state svg {
    opacity: 0.3;
    color: #e85d04;
}

.pr-initial-state h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #475569;
}

.pr-initial-state p {
    margin: 0;
    font-size: 14px;
    color: #94a3b8;
    max-width: 300px;
}

/* ── Used-in chips ── */
.pr-dish-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.pr-dish-chip {
    padding: 2px 8px;
    background: #f1f5f9;
    border-radius: 12px;
    font-size: 11px;
    color: #475569;
    font-weight: 500;
    white-space: nowrap;
}

/* ── Dish Card (composition view) ── */
.pr-dish-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pr-dish-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.pr-dish-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* Static header — no click expand, production totals always shown below */
.pr-dish-header-static {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 18px;
    gap: 12px;
    border-bottom: 1px solid #f1f5f9;
}

/* Keep old class for any fallback reference */
.pr-dish-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s;
    gap: 12px;
}

.pr-dish-header:hover { background-color: #f8fafc; }
.pr-dish-header.expanded { background-color: #fff7f0; border-bottom: 1px solid #fed7aa; }

.pr-dish-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.pr-expand-chevron {
    display: flex;
    align-items: center;
    color: #94a3b8;
    flex-shrink: 0;
    transition: color 0.15s;
}

.pr-dish-header.expanded .pr-expand-chevron {
    color: #e85d04;
}

.pr-dish-name {
    font-weight: 700;
    font-size: 15px;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pr-composition-badge {
    flex-shrink: 0;
    padding: 2px 9px;
    background: #eff6ff;
    color: #1d4ed8;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.pr-qty-sold-badge {
    flex-shrink: 0;
    display: inline-block;
    padding: 4px 12px;
    background: #e0f2fe;
    color: #0369a1;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
}

/* ── Dish body (expanded) ── */
.pr-dish-body {
    padding: 12px 18px 16px;
    background: #fafafa;
}

.pr-no-portions-msg {
    font-size: 13px;
    color: #94a3b8;
    font-style: italic;
    padding: 8px 0;
    margin: 0;
}

/* ── Portions list ── */
.pr-portions-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pr-portion-row {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    background: white;
}

.pr-portion-row.pr-portion-recipe {
    border-color: #bfdbfe;
}

.pr-portion-row.pr-portion-stock {
    border-color: #bbf7d0;
}

/* Portion production row — always visible, shows the math */
.pr-portion-production {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    gap: 12px;
    flex-wrap: wrap;
}

.pr-portion-production-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.pr-portion-production-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

/* Calculation: "500g × 10" */
.pr-portion-calc {
    color: #64748b;
    font-size: 13px;
}

/* Equals sign */
.pr-portion-equals {
    color: #94a3b8;
    font-size: 13px;
}

/* Total in bold orange */
.pr-portion-total-val {
    font-weight: 700;
    font-size: 15px;
    color: #e85d04;
    font-variant-numeric: tabular-nums;
}

/* "Ingredients ▶" toggle button on recipe portions */
.pr-ing-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border: 1.5px solid #bfdbfe;
    border-radius: 20px;
    background: #eff6ff;
    color: #2563eb;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.12s, border-color 0.12s;
    white-space: nowrap;
}

.pr-ing-toggle:hover {
    background: #dbeafe;
    border-color: #93c5fd;
}

.pr-ing-toggle.open {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
}

/* Legacy portion header (kept for backward compat) */
.pr-portion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    gap: 12px;
    flex-wrap: wrap;
}

.pr-portion-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.pr-expand-chevron-sm {
    display: flex;
    align-items: center;
    color: #94a3b8;
    flex-shrink: 0;
}

.pr-portion-type-badge {
    flex-shrink: 0;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.pr-type-recipe {
    background: #eff6ff;
    color: #1d4ed8;
}

.pr-type-stock {
    background: #f0fdf4;
    color: #15803d;
}

.pr-portion-name {
    font-weight: 600;
    font-size: 14px;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pr-portion-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    font-size: 13px;
}

.pr-portion-qty {
    color: #475569;
    font-variant-numeric: tabular-nums;
}

.pr-portion-per {
    font-size: 11px;
    color: #94a3b8;
}

.pr-portion-total {
    color: #e85d04;
    font-weight: 700;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

/* ── Raw ingredients for recipe portions ── */
.pr-raw-ings {
    border-top: 1px solid #e2e8f0;
    padding: 10px 14px 12px;
    background: #f8fafc;
}

.pr-raw-ings-label {
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.pr-raw-ing-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 5px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13px;
    flex-wrap: wrap;
}

.pr-raw-ing-row:last-child {
    border-bottom: none;
}

.pr-raw-ing-name {
    font-weight: 600;
    color: #334155;
    flex: 1;
    min-width: 120px;
}

.pr-raw-ing-qty {
    color: #475569;
    font-variant-numeric: tabular-nums;
}

.pr-ing-unit {
    color: #94a3b8;
    font-size: 11px;
}

.pr-raw-ing-total {
    color: #e85d04;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.pr-no-ing-hint {
    padding: 8px 14px;
    font-size: 12px;
    color: #94a3b8;
    font-style: italic;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}

/* ── Legacy ingredient list (non-composition dishes) ── */
.pr-legacy-ings {
    padding: 4px 0;
}

/* ── Tabs row + wastage toggle ── */
.pr-tabs-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 4px;
}

.pr-wastage-toggle {
    display: flex;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}

.pr-wastage-btn {
    padding: 5px 14px;
    font-size: 12px;
    font-weight: 600;
    background: white;
    color: #64748b;
    border: none;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.pr-wastage-btn:first-child {
    border-right: 1px solid #e2e8f0;
}

.pr-wastage-btn.active {
    background: #fef3c7;
    color: #92400e;
}

.pr-wastage-btn:hover:not(.active) {
    background: #f8fafc;
}

/* Wastage badge on ingredient row (By Dish expanded view) */
.pr-wastage-actual {
    font-size: 11px;
    color: #b45309;
    font-weight: 600;
    white-space: nowrap;
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: 10px;
    padding: 1px 7px;
    margin-left: 2px;
}

.pr-wastage-actual strong {
    color: #92400e;
}

/* Sub-line showing recipe (theoretical) qty in By Ingredient table */
.pr-ing-theoretical {
    font-size: 10px;
    color: #94a3b8;
    font-weight: 400;
    margin-top: 2px;
    font-variant-numeric: tabular-nums;
}

/* ── Variation blocks (multi-size dishes) ── */
.pr-variation-block {
    border-top: 1px solid #f1f5f9;
}

.pr-variation-block:first-child {
    border-top: none;
}

.pr-variation-block--multi .pr-variation-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px 4px;
    font-size: 12px;
    font-weight: 700;
    color: #7c3aed;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: #faf5ff;
    border-bottom: 1px dashed #e9d5ff;
}

.pr-variation-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px 4px;
    font-size: 12px;
    font-weight: 700;
    color: #7c3aed;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: #faf5ff;
    border-bottom: 1px dashed #e9d5ff;
}

.pr-variation-orders {
    font-weight: 500;
    color: #9333ea;
    text-transform: none;
    letter-spacing: 0;
}

.pr-variation-count-badge {
    flex-shrink: 0;
    padding: 2px 9px;
    background: #f3e8ff;
    color: #7c3aed;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

/* ── Total row across all variations ── */
.pr-variation-total-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 18px 12px;
    background: linear-gradient(135deg, #fff7ed 0%, #fef3c7 100%);
    border-top: 2px solid #fed7aa;
    flex-wrap: wrap;
}

.pr-variation-total-label {
    font-size: 12px;
    font-weight: 700;
    color: #92400e;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    padding-top: 1px;
}

.pr-variation-total-items {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1;
}

.pr-variation-total-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    background: white;
    border: 1px solid #fcd34d;
    border-radius: 20px;
    font-size: 13px;
    color: #b45309;
    font-variant-numeric: tabular-nums;
}

.pr-variation-total-item strong {
    color: #e85d04;
    font-weight: 700;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .production-report-page {
        padding: 16px;
    }

    .pr-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .pr-summary-cards {
        flex-direction: column;
    }

    .pr-summary-card {
        min-width: unset;
    }

    .pr-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .pr-date-inputs {
        flex-wrap: wrap;
    }

    .pr-table-container {
        overflow-x: auto;
    }
}
/* Expected Usage report */
.eu-page { padding: 32px; background: #f8fafc; min-height: 100vh; font-family: 'Inter', system-ui, -apple-system, sans-serif; color: #0f172a; }
.eu-header { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.eu-header h1 { margin: 0 0 4px; font-size: 26px; font-weight: 800; }
.eu-logo { width: clamp(210px, 22vw, 300px); height: auto; max-height: 52px; object-fit: contain; object-position: left center; margin: 4px 10px 0 2px; flex: none; }
.eu-sub { margin: 0 0 4px; color: #64748b; font-size: 14px; max-width: 60ch; }
.eu-branch { font-size: 13px; color: #64748b; font-weight: 500; }
.eu-back { display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; background: #fff; border: 1px solid #cbd5e1; border-radius: 8px; color: #475569; font-weight: 600; font-size: 14px; cursor: pointer; }
.eu-back:hover { background: #f1f5f9; }

.eu-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.eu-view-tabs { display: inline-flex; padding: 3px; border: 1px solid #cbd5e1; border-radius: 9px; background: #fff; }
.eu-view-tabs button { border: 0; border-radius: 6px; padding: 7px 12px; background: transparent; color: #475569; font-weight: 700; cursor: pointer; }
.eu-view-tabs button.active { background: #ea580c; color: #fff; }
.eu-date { padding: 9px 12px; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 14px; background: #fff; }
.eu-chip { padding: 9px 16px; border: 1px solid #cbd5e1; border-radius: 999px; background: #fff; color: #475569; font-weight: 600; font-size: 13px; cursor: pointer; }
.eu-chip.active { background: #ea580c; border-color: #ea580c; color: #fff; }
.eu-search { flex: 1; min-width: 200px; max-width: 360px; display: flex; align-items: center; gap: 8px; padding: 0 12px; background: #fff; border: 1px solid #cbd5e1; border-radius: 8px; color: #94a3b8; }
.eu-search input { flex: 1; border: none; outline: none; padding: 10px 0; font-size: 14px; background: transparent; color: #0f172a; }
.eu-export-actions { display: inline-flex; gap: 8px; margin-left: auto; }
.eu-export { display: inline-flex; align-items: center; gap: 6px; padding: 9px 13px; border: 1px solid #fdba74; border-radius: 8px; background: #fff7ed; color: #c2410c; font-size: 13px; font-weight: 700; cursor: pointer; }
.eu-export:hover:not(:disabled) { background: #ffedd5; }
.eu-export:disabled { opacity: .5; cursor: not-allowed; }

.eu-error { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; padding: 10px 12px; border-radius: 9px; font-size: 14px; margin-bottom: 14px; }
.eu-empty { color: #64748b; font-size: 15px; padding: 24px 0; text-align: center; }
.eu-muted { color: #64748b; font-size: 13px; }

.eu-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.eu-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.eu-card-label { font-size: 13px; color: #64748b; font-weight: 600; }
.eu-card strong { font-size: 26px; font-weight: 800; color: #ea580c; line-height: 1.15; }
.eu-card small { color: #64748b; font-size: 12px; }

.eu-table { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; overflow: hidden; }
.eu-row { display: grid; grid-template-columns: minmax(180px, 2.2fr) 1fr 1.3fr 1.4fr minmax(190px, 1.4fr); gap: 12px; align-items: center; padding: 14px 18px; }
.eu-head { background: #f1f5f9; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: #475569; padding-top: 11px; padding-bottom: 11px; }
.eu-item { border-top: 1px solid #e2e8f0; }
.eu-row > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.eu-row small { color: #64748b; font-size: 12px; }
.eu-warn { color: #b45309 !important; font-weight: 600; }
.eu-menu { flex-direction: row !important; align-items: center; gap: 12px !important; }
.eu-img { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; background: #f1f5f9; flex: none; }
.eu-actions { flex-direction: row !important; align-items: center; gap: 8px !important; }
.eu-btn { padding: 8px 14px; background: #fff7ed; border: 1px solid #fed7aa; color: #c2410c; border-radius: 8px; font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; }
.eu-btn:hover { background: #ffedd5; }
.eu-icon { display: inline-flex; padding: 7px; background: #fff; border: 1px solid #cbd5e1; border-radius: 8px; color: #475569; cursor: pointer; }
.eu-link { background: none; border: none; padding: 0; color: #c2410c; font-weight: 600; font-size: 13px; cursor: pointer; text-align: left; }

.eu-detail { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 20px; padding: 6px 18px 20px; background: #fffaf5; }
.eu-detail h3 { margin: 12px 0 8px; font-size: 14px; }
.eu-detail h4 { margin: 14px 0 6px; font-size: 13px; color: #475569; }
.eu-detail table, .eu-orders { width: 100%; border-collapse: collapse; font-size: 14px; }
.eu-detail th, .eu-orders th { text-align: left; font-size: 12px; color: #64748b; font-weight: 700; padding: 6px 8px; border-bottom: 1px solid #e2e8f0; }
.eu-detail td, .eu-orders td { padding: 8px; border-bottom: 1px solid #f1f5f9; }
.eu-comes { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.eu-comes li { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid #f1f5f9; }

.eu-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 1000; }
.eu-overlay-top { z-index: 1100; }
.eu-modal { background: #fff; border-radius: 14px; padding: 20px; width: min(680px, 100%); max-height: 85vh; overflow: auto; }
.eu-modal-sm { width: min(440px, 100%); }
.eu-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.eu-modal-head h2 { margin: 0; font-size: 18px; }
.eu-total { display: flex; justify-content: space-between; margin: 12px 0 0; font-size: 15px; }

.eu-menu-cards { display: flex; flex-direction: column; gap: 14px; }
.eu-menu-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 13px; overflow: hidden; }
.eu-menu-card-head { display: grid; grid-template-columns: 50px minmax(0, 1fr) auto; align-items: center; gap: 13px; padding: 16px 18px; }
.eu-menu-card-head h2 { margin: 0; font-size: 18px; }
.eu-menu-card-head h2 small { color: #64748b; font-size: 14px; font-weight: 600; }
.eu-menu-card-head p { margin: 4px 0 0; color: #64748b; font-size: 13px; }
.eu-section { padding: 14px 18px 18px; border-top: 1px solid #eef2f7; }
.eu-section h3 { margin: 0 0 9px; font-size: 14px; }
.eu-usage-list { display: flex; flex-direction: column; }
.eu-usage-line { display: flex; justify-content: space-between; align-items: baseline; gap: 18px; padding: 8px 0; border-bottom: 1px solid #f1f5f9; font-size: 14px; }
.eu-usage-line:last-child { border-bottom: 0; }
.eu-usage-line b { white-space: nowrap; }
.eu-usage-line > span { display: flex; flex-direction: column; gap: 2px; }
.eu-usage-line small { color: #b45309; font-size: 11px; }
.eu-ingredient-toggle { display: flex; align-items: center; gap: 6px; width: 100%; border: 0; border-top: 1px solid #eef2f7; background: #fffaf5; padding: 11px 18px; color: #c2410c; font-weight: 700; cursor: pointer; }
.eu-raw-section { background: #fffaf5; padding-top: 4px; }
.eu-setup-missing { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 14px 18px; border-top: 1px solid #fee2e2; background: #fff7ed; color: #9a3412; }
.eu-setup-missing button { border: 1px solid #fdba74; background: #fff; color: #c2410c; border-radius: 8px; padding: 8px 12px; font-weight: 700; cursor: pointer; }
.eu-total-panel { background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; overflow: hidden; }
.eu-total-title { padding: 20px; background: linear-gradient(135deg,#fff7ed,#fff); border-bottom: 1px solid #fed7aa; }
.eu-total-title > span { color: #ea580c; font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.eu-total-title h2 { margin: 4px 0; font-size: 22px; }
.eu-total-title p { margin: 0; color: #64748b; font-size: 13px; }
.eu-total-section { padding: 18px 20px; border-bottom: 1px solid #e2e8f0; }
.eu-total-section h3 { margin: 0 0 8px; font-size: 16px; }
.eu-total-note { margin: 14px 20px; padding: 11px 13px; border-radius: 8px; background: #fffbeb; color: #92400e; font-size: 13px; }
.eu-order-items { list-style: none; margin: 0; padding: 0; }
.eu-order-items li { display: flex; justify-content: space-between; gap: 15px; padding: 8px 0; border-bottom: 1px solid #f1f5f9; }

@media (max-width: 960px) {
  .eu-page { padding: 16px; }
  .eu-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .eu-head { display: none; }
  .eu-row { grid-template-columns: 1fr 1fr; }
  .eu-menu, .eu-actions { grid-column: 1 / -1; }
  .eu-row > span[data-label]::before { content: attr(data-label); font-size: 11px; font-weight: 700; text-transform: uppercase; color: #94a3b8; }
  .eu-detail { grid-template-columns: 1fr; }
  .eu-menu-card-head { grid-template-columns: 50px 1fr; }
  .eu-menu-card-head .eu-btn { grid-column: 1 / -1; }
}
/* Ingredient Combination Modal Styles */

.ingredient-combination-modal {
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: #1a1a1a;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.close-btn:hover {
    background: #f5f5f5;
    color: #1a1a1a;
}

.modal-body {
    padding: 1.5rem;
}

.error-banner {
    background: #ffebee;
    color: #c62828;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.instruction-text {
    color: #666;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

/* Duplicate Groups */
.duplicate-groups {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.group-card {
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.2s;
}

.group-card:hover {
    border-color: #eb5939;
    box-shadow: 0 4px 12px rgba(235, 89, 57, 0.1);
}

.group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.group-header h4 {
    margin: 0;
    color: #1a1a1a;
    font-size: 1.1rem;
}

.usage-badge {
    background: #e3f2fd;
    color: #1976d2;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
}

.variant-list {
    list-style: none;
    padding: 0;
    margin: 0.75rem 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.variant-list li {
    background: #f5f5f5;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #333;
}

.usage-info {
    color: #999;
    font-size: 0.85rem;
    margin-top: 0.75rem;
}

/* Combination Form */
.combination-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.back-btn {
    align-self: flex-start;
    background: none;
    border: none;
    color: #eb5939;
    cursor: pointer;
    font-size: 0.95rem;
    padding: 0.5rem 0;
    transition: opacity 0.2s;
}

.back-btn:hover {
    opacity: 0.8;
}

.selected-group-info {
    background: #f9f9f9;
    padding: 1.25rem;
    border-radius: 8px;
}

.selected-group-info h3 {
    margin: 0 0 1rem 0;
    color: #1a1a1a;
}

.name-selection {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.name-selection label {
    font-weight: 500;
    color: #333;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.radio-option:hover {
    border-color: #eb5939;
    background: #fff5f3;
}

.radio-option input[type="radio"] {
    cursor: pointer;
}

.radio-option input[type="radio"]:checked+span {
    color: #eb5939;
    font-weight: 600;
}

/* Checkbox Group */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin: 1rem 0;
}

.checkbox-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.checkbox-option:hover {
    border-color: #eb5939;
    background: #fff5f3;
}

.checkbox-option input[type="checkbox"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
}

.checkbox-option input[type="checkbox"]:checked+span {
    color: #eb5939;
    font-weight: 600;
}

.custom-name-input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    margin-top: 0.5rem;
}

.custom-name-input:focus {
    outline: none;
    border-color: #eb5939;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* Confirmation Dialog */
.confirmation-dialog {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.confirmation-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.warning-icon {
    font-size: 2rem;
    color: #ff9800;
}

.confirmation-header h3 {
    margin: 0;
    color: #1a1a1a;
}

.confirmation-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.warning-text {
    color: #666;
    margin: 0;
}

.affected-items {
    list-style: none;
    padding: 1rem;
    background: #f9f9f9;
    border-radius: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.affected-items li {
    padding: 0.5rem 0;
    border-bottom: 1px solid #e0e0e0;
}

.affected-items li:last-child {
    border-bottom: none;
}

.affected-items .more-items {
    color: #999;
    font-style: italic;
}

.name-change-summary {
    background: #fff3e0;
    padding: 1.25rem;
    border-radius: 8px;
    text-align: center;
}

.name-change-summary p {
    margin: 0.5rem 0;
    color: #666;
    font-size: 0.9rem;
}

.old-names {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.old-names li {
    background: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #666;
}

.arrow {
    font-size: 1.5rem;
    color: #eb5939;
    margin: 0.5rem 0;
}

.new-name {
    background: #eb5939;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1.1rem;
    display: inline-block;
}

.note {
    background: #fff9c4;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #fbc02d;
    color: #666;
    font-size: 0.9rem;
}

.confirmation-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-danger {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
}

.btn-primary {
    background: #eb5939;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #d94d2f;
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: #f5f5f5;
    color: #333;
}

.btn-secondary:hover:not(:disabled) {
    background: #e0e0e0;
}

.btn-danger {
    background: #d32f2f;
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #b71c1c;
}

.btn-danger:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Loading and Empty States */
.loading-state {
    text-align: center;
    padding: 3rem 2rem;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #eb5939;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.loading-state p {
    color: #666;
    font-size: 1rem;
}

.empty-state {
    text-align: center;
    padding: 3rem 2rem;
}

.success-icon {
    font-size: 4rem;
    color: #4caf50;
    margin-bottom: 1rem;
}

.empty-state h3 {
    color: #333;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: #666;
    margin-bottom: 0.5rem;
}

.empty-state .help-text {
    color: #999;
    font-size: 0.9rem;
    margin-top: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .ingredient-combination-modal {
        max-width: 95vw;
        margin: 1rem;
    }

    .modal-header {
        padding: 1rem;
    }

    .modal-body {
        padding: 1rem;
    }

    .form-actions,
    .confirmation-actions {
        flex-direction: column;
    }

    .btn-primary,
    .btn-secondary,
    .btn-danger {
        width: 100%;
    }
}/* Ingredient Management Page Styles */

.ingredient-management-page {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.page-header {
    margin-bottom: 2rem;
}

.back-btn {
    background: none;
    border: none;
    color: #eb5939;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    margin-bottom: 1rem;
    transition: opacity 0.2s;
}

.back-btn:hover {
    opacity: 0.8;
}

.header-content h1 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 2rem;
    color: #1a1a1a;
    margin-bottom: 0.5rem;
}

.header-icon {
    color: #eb5939;
}

.header-description {
    color: #666;
    font-size: 1rem;
    line-height: 1.6;
}

/* Management Cards */
.management-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

.management-card {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
}

.management-card:not(.disabled):hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.management-card.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.card-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #eb5939 0%, #ff7659 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    color: white;
    margin-bottom: 1.5rem;
}

.card-content h3 {
    font-size: 1.5rem;
    color: #1a1a1a;
    margin-bottom: 1rem;
}

.card-content p {
    color: #666;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.feature-list {
    list-style: none;
    padding: 0;
    margin: 1.5rem 0;
}

.feature-list li {
    color: #333;
    padding: 0.5rem 0;
    font-size: 0.95rem;
}

.action-btn {
    width: 100%;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.action-btn.primary {
    background: #eb5939;
    color: white;
}

.action-btn.primary:hover {
    background: #d94d2f;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(235, 89, 57, 0.3);
}

.coming-soon-badge {
    display: inline-block;
    background: #f5f5f5;
    color: #999;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    margin-top: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .ingredient-management-page {
        padding: 1rem;
    }

    .header-content h1 {
        font-size: 1.5rem;
    }

    .management-cards {
        grid-template-columns: 1fr;
    }

    .management-card {
        padding: 1.5rem;
    }
}/* Printer Settings page: printer, receipt designs, receipt details, rules and test print.
   Uses the app's tokens (--primary-color, --surface-color, ...) and the warm accents of the
   Billing Theme page, so both "choose a look" pages feel like one product. */

.printer-settings-page {
    --ps-accent: var(--primary-color, #e85d04);
    --ps-accent-ink: #c2410c;
    --ps-accent-soft: #fff7ed;
    --ps-accent-line: #fed7aa;
    --ps-ink: var(--text-color, #1f2937);
    --ps-muted: var(--secondary-text-color, #64748b);
    --ps-line: var(--border-color, #e5e7eb);
    --ps-surface: var(--surface-color, #fff);
    --ps-sunken: #f6f7f9;
    --ps-ok: #15803d;
    --ps-ok-soft: #f0fdf4;
    --ps-error: #b91c1c;
    --ps-error-soft: #fef2f2;
    --ps-radius: 14px;
    max-width: 1320px;
}

.ps-page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}
.ps-branch-badge {
    flex-shrink: 0;
    padding: .45rem .8rem;
    border-radius: 999px;
    background: var(--ps-accent-soft);
    color: var(--ps-accent-ink);
    font-weight: 700;
    font-size: .85rem;
    white-space: nowrap;
}

.ps-panel {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding-bottom: 5rem; /* room for the save bar */
    color: var(--ps-ink);
}

/* ── Tabs ─────────────────────────────────────────────────────────────────── */
.ps-tabs {
    display: flex;
    gap: .35rem;
    padding: .35rem;
    overflow-x: auto;
    border: 1px solid var(--ps-line);
    border-radius: 12px;
    background: var(--ps-surface);
    scrollbar-width: none;
}
.ps-tabs::-webkit-scrollbar { display: none; }
.ps-tabs button {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    flex-shrink: 0;
    min-height: 42px;
    padding: .5rem 1rem;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--ps-muted);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}
.ps-tabs button:hover { background: var(--ps-sunken); color: var(--ps-ink); }
.ps-tabs button.is-on { background: var(--ps-accent-soft); color: var(--ps-accent-ink); box-shadow: inset 0 0 0 1px var(--ps-accent-line); }
.ps-tabs button:focus-visible { outline: 2px solid var(--ps-accent); outline-offset: 2px; }
.ps-tab-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ps-accent);
}

/* ── Cards and layout ─────────────────────────────────────────────────────── */
.ps-stack { display: grid; gap: 1rem; max-width: 900px; }
.ps-card {
    padding: 1.25rem 1.4rem;
    border: 1px solid var(--ps-line);
    border-radius: var(--ps-radius);
    background: var(--ps-surface);
    box-shadow: 0 2px 10px rgba(15, 23, 42, .04);
}
.ps-card-head { margin-bottom: 1rem; }
.ps-card-head h3 { margin: 0; font-size: 1.05rem; font-weight: 700; color: var(--ps-ink); }
.ps-card-head p { margin: .3rem 0 0; color: var(--ps-muted); font-size: .9rem; line-height: 1.45; }
.ps-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }
.ps-muted { color: var(--ps-muted); font-size: .9rem; line-height: 1.5; margin: 0; }
.ps-note {
    display: flex;
    align-items: flex-start;
    gap: .45rem;
    margin: .9rem 0 0;
    color: var(--ps-muted);
    font-size: .85rem;
    line-height: 1.45;
}
.ps-note svg { flex-shrink: 0; margin-top: .15rem; color: var(--ps-ok); }
.ps-error { margin: 0; color: var(--ps-error); font-size: .85rem; }

/* ── Fields ───────────────────────────────────────────────────────────────── */
.ps-field { display: grid; gap: .35rem; margin-bottom: 1rem; min-width: 0; }
.ps-field:last-child { margin-bottom: 0; }
.ps-field label, .ps-label { font-weight: 600; font-size: .9rem; color: var(--ps-ink); }
.ps-field input[type="text"],
.ps-field input[type="number"],
.ps-field select,
.ps-field textarea {
    width: 100%;
    min-height: 42px;
    padding: .55rem .75rem;
    border: 1px solid #d1d5db;
    border-radius: 9px;
    background: var(--ps-surface);
    color: var(--ps-ink);
    font: inherit;
    font-size: .95rem;
    box-sizing: border-box;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.ps-field textarea { resize: vertical; line-height: 1.45; }
.ps-field input:focus, .ps-field select:focus, .ps-field textarea:focus {
    outline: none;
    border-color: var(--ps-accent);
    box-shadow: 0 0 0 3px rgba(232, 93, 4, .15);
}
.ps-field-hint { color: var(--ps-muted); font-size: .8rem; line-height: 1.4; }
.ps-field.is-highlight label::after {
    content: 'This design';
    margin-left: .5rem;
    padding: .1rem .45rem;
    border-radius: 999px;
    background: var(--ps-accent-soft);
    color: var(--ps-accent-ink);
    font-size: .7rem;
    font-weight: 700;
    vertical-align: middle;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.ps-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    min-height: 40px;
    padding: .5rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 9px;
    background: var(--ps-surface);
    color: var(--ps-ink);
    font: inherit;
    font-weight: 600;
    font-size: .9rem;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s ease, border-color .15s ease;
}
.ps-btn:hover:not(:disabled) { background: var(--ps-sunken); }
.ps-btn:disabled { opacity: .55; cursor: default; }
.ps-btn.is-primary { border-color: var(--ps-accent); background: var(--ps-accent); color: #fff; }
.ps-btn.is-primary:hover:not(:disabled) { background: var(--primary-hover-color, #f48c06); border-color: var(--primary-hover-color, #f48c06); }
.ps-btn.is-soft { border-color: var(--ps-accent-line); background: var(--ps-accent-soft); color: var(--ps-accent-ink); }
.ps-btn.is-soft:hover:not(:disabled) { background: #ffedd5; }
.ps-btn:focus-visible, .ps-icon-btn:focus-visible, .ps-link:focus-visible, .ps-chip:focus-within, .ps-design-thumb:focus-visible {
    outline: 2px solid var(--ps-accent);
    outline-offset: 2px;
}
.ps-icon-btn {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border: 1px solid var(--ps-line);
    border-radius: 9px;
    background: var(--ps-surface);
    color: var(--ps-muted);
    cursor: pointer;
    font-size: 1.05rem;
}
.ps-icon-btn:hover:not(:disabled) { color: var(--ps-ink); background: var(--ps-sunken); }
.ps-link {
    padding: 0;
    border: 0;
    background: none;
    color: var(--ps-accent-ink);
    font: inherit;
    font-weight: 600;
    font-size: .88rem;
    cursor: pointer;
    text-align: left;
}
.ps-link:hover { text-decoration: underline; }
.is-spinning { animation: ps-spin 1s linear infinite; }

/* ── Printer tab ──────────────────────────────────────────────────────────── */
.ps-printer-row { display: flex; align-items: flex-start; gap: .75rem; }
.ps-printer-row .ps-field { flex: 1; margin: 0; }
.ps-printer-row .ps-btn { margin-top: 1.65rem; }

.ps-paper-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .65rem; }
.ps-paper {
    position: relative;
    display: grid;
    justify-items: center;
    align-content: start;
    gap: .2rem;
    padding: .9rem .5rem .8rem;
    border: 2px solid var(--ps-line);
    border-radius: 12px;
    background: var(--ps-surface);
    text-align: center;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}
.ps-paper:hover { border-color: var(--ps-accent-line); }
.ps-paper.is-on { border-color: var(--ps-accent); background: var(--ps-accent-soft); }
.ps-paper:focus-within { outline: 2px solid var(--ps-accent); outline-offset: 2px; }
.ps-paper input { position: absolute; opacity: 0; pointer-events: none; }
.ps-paper strong { font-size: .92rem; }
.ps-paper small { color: var(--ps-muted); font-size: .75rem; line-height: 1.3; }
/* A tiny drawing of the paper, its width to scale. */
.ps-paper-glyph {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    height: 54px;
    margin-bottom: .35rem;
    padding: 0 6px;
    border: 1.5px solid #9ca3af;
    border-bottom-style: dashed;
    border-radius: 3px 3px 0 0;
    background: #fff;
    box-sizing: border-box;
}
.ps-paper-glyph i { display: block; height: 3px; border-radius: 2px; background: #cbd5e1; }
.ps-paper-glyph i:nth-child(2) { width: 70%; }
.ps-paper-glyph i:nth-child(3) { width: 45%; }
.ps-paper-glyph.is-80 { width: 34px; }
.ps-paper-glyph.is-58 { width: 25px; }
.ps-paper-glyph.is-a4, .ps-paper-glyph.is-letter { width: 42px; border-bottom-style: solid; border-radius: 3px; }
.ps-paper-glyph.is-letter { width: 45px; }
.ps-paper-glyph.is-custom { width: 38px; border-style: dashed; }
.ps-paper.is-on .ps-paper-glyph { border-color: var(--ps-accent); }
.ps-paper.is-on .ps-paper-glyph i { background: #fdba74; }
.ps-inline-choice { margin: 1rem 0 0; }

.ps-rows { display: grid; }
.ps-toggle-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .85rem 0;
    border-top: 1px solid var(--ps-line);
    cursor: pointer;
}
.ps-rows > .ps-toggle-row:first-child { border-top: 0; padding-top: 0; }
div.ps-toggle-row { cursor: default; }
.ps-toggle-text { display: grid; gap: .15rem; flex: 1; min-width: 0; }
.ps-toggle-text strong { font-size: .95rem; font-weight: 600; }
.ps-toggle-text small { color: var(--ps-muted); font-size: .83rem; line-height: 1.4; }
.ps-toggle-row input[role="switch"] { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ps-switch {
    position: relative;
    flex-shrink: 0;
    width: 44px;
    height: 26px;
    border-radius: 999px;
    background: #d1d5db;
    transition: background .15s ease;
}
.ps-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
    transition: transform .15s ease;
}
.ps-toggle-row input:checked + .ps-switch { background: var(--ps-accent); }
.ps-toggle-row input:checked + .ps-switch::after { transform: translateX(18px); }
.ps-toggle-row input:focus-visible + .ps-switch { outline: 2px solid var(--ps-accent); outline-offset: 2px; }

.ps-stepper {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    border: 1px solid #d1d5db;
    border-radius: 9px;
    overflow: hidden;
}
.ps-stepper button {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 0;
    background: var(--ps-sunken);
    color: var(--ps-ink);
    cursor: pointer;
}
.ps-stepper button:disabled { color: #cbd5e1; cursor: default; }
.ps-stepper input {
    width: 48px;
    height: 38px;
    border: 0;
    border-inline: 1px solid #d1d5db;
    text-align: center;
    font: inherit;
    font-weight: 700;
    -moz-appearance: textfield;
}
.ps-stepper input::-webkit-inner-spin-button, .ps-stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

.ps-advanced { padding: 0; }
.ps-advanced summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem 1.4rem;
    cursor: pointer;
    list-style: none;
}
.ps-advanced summary::-webkit-details-marker { display: none; }
.ps-advanced summary span { display: grid; gap: .2rem; }
.ps-advanced summary small { color: var(--ps-muted); font-size: .85rem; }
.ps-advanced summary::after { content: '▾'; color: var(--ps-muted); transition: transform .15s ease; }
.ps-advanced[open] summary::after { transform: rotate(180deg); }
.ps-advanced[open] summary { border-bottom: 1px solid var(--ps-line); }
.ps-advanced > :not(summary) { margin: 1rem 1.4rem; }
.ps-advanced > .ps-rows { margin-bottom: 1.2rem; }

/* ── Chips and segmented control ──────────────────────────────────────────── */
.ps-chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.ps-chip {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    min-height: 36px;
    padding: .35rem .85rem;
    border: 1px solid var(--ps-line);
    border-radius: 999px;
    background: var(--ps-surface);
    color: var(--ps-ink);
    font: inherit;
    font-size: .87rem;
    font-weight: 600;
    cursor: pointer;
}
.ps-chip:hover { border-color: var(--ps-accent-line); }
.ps-chip.is-on { border-color: var(--ps-accent); background: var(--ps-accent-soft); color: var(--ps-accent-ink); }
.ps-chip.is-check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ps-chip.is-check::before {
    content: '';
    width: 14px;
    height: 14px;
    border: 1.5px solid #9ca3af;
    border-radius: 4px;
    box-sizing: border-box;
}
.ps-chip.is-check.is-on::before {
    border-color: var(--ps-accent);
    background: var(--ps-accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2l2.2 2.2 4.8-5' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 11px no-repeat;
}

.ps-segmented {
    display: inline-flex;
    flex-wrap: wrap;
    gap: .25rem;
    padding: .25rem;
    border: 1px solid var(--ps-line);
    border-radius: 11px;
    background: var(--ps-sunken);
}
.ps-segmented button {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    min-height: 36px;
    padding: .35rem .9rem;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--ps-muted);
    font: inherit;
    font-weight: 600;
    font-size: .88rem;
    cursor: pointer;
}
.ps-segmented button.is-on { background: var(--ps-surface); color: var(--ps-ink); box-shadow: 0 1px 4px rgba(15, 23, 42, .12); }
.ps-segmented-tag {
    padding: .05rem .4rem;
    border-radius: 999px;
    background: var(--ps-accent-soft);
    color: var(--ps-accent-ink);
    font-size: .68rem;
    font-weight: 700;
}

/* ── Status ───────────────────────────────────────────────────────────────── */
.ps-toast {
    padding: .7rem 1rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: .9rem;
}
.ps-toast.is-success { background: var(--ps-ok-soft); color: var(--ps-ok); border: 1px solid #bbf7d0; }
.ps-toast.is-error { background: var(--ps-error-soft); color: var(--ps-error); border: 1px solid #fecaca; }
.ps-loading { display: flex; align-items: center; gap: .6rem; padding: 2rem 0; color: var(--ps-muted); }
.ps-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--ps-accent-line);
    border-top-color: var(--ps-accent);
    border-radius: 50%;
    animation: ps-spin .8s linear infinite;
}
@keyframes ps-spin { to { transform: rotate(360deg); } }

.ps-savebar {
    position: sticky;
    bottom: 1rem;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: .5rem;
    padding: .75rem .75rem .75rem 1.2rem;
    border: 1px solid #fdba74;
    border-radius: 12px;
    background: #fffbf5;
    box-shadow: 0 10px 30px rgba(15, 23, 42, .14);
    font-weight: 600;
}
.ps-savebar > div { display: flex; gap: .5rem; }

/* ── Receipt design gallery ───────────────────────────────────────────────── */
.ps-gallery { display: grid; gap: 1rem; }
.ps-gallery-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; }
.ps-design-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.ps-design-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 2px solid #e5e7eb;
    border-radius: var(--ps-radius);
    background: var(--ps-surface);
    box-shadow: 0 3px 12px rgba(15, 23, 42, .05);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.ps-design-card:hover { box-shadow: 0 8px 24px rgba(15, 23, 42, .09); }
.ps-design-card.is-active { border-color: var(--ps-accent); box-shadow: 0 0 0 3px rgba(232, 93, 4, .12); }
.ps-design-thumb {
    position: relative;
    display: flex;
    justify-content: center;
    height: 250px;
    padding: 1rem .5rem 0;
    overflow: hidden;
    border: 0;
    border-bottom: 1px solid var(--ps-line);
    background: linear-gradient(180deg, #eef0f3, #e4e7eb);
    color: #000;
    font: inherit;
    text-align: left; /* a button centres text by default; the receipt sets its own alignment */
    cursor: zoom-in;
}
.ps-design-thumb::after {
    content: '';
    position: absolute;
    inset: auto 0 0 0;
    height: 56px;
    background: linear-gradient(180deg, rgba(228, 231, 235, 0), #e4e7eb);
    pointer-events: none;
}
.ps-design-thumb .receipt-preview-frame { transform-origin: top center !important; flex-shrink: 0; }
.ps-design-thumb .receipt-preview-frame--80mm { transform: scale(.62) !important; }
.ps-design-thumb .receipt-preview-frame--58mm { transform: scale(.8) !important; }
.ps-design-thumb .receipt-preview-frame--a4,
.ps-design-thumb .receipt-preview-frame--letter { transform: scale(.44) !important; }
.ps-design-thumb-cta {
    position: absolute;
    bottom: .7rem;
    left: 50%;
    z-index: 1;
    padding: .3rem .8rem;
    border-radius: 999px;
    background: rgba(17, 24, 39, .82);
    color: #fff;
    font-size: .78rem;
    font-weight: 700;
    opacity: 0;
    transform: translate(-50%, 4px);
    transition: opacity .15s ease, transform .15s ease;
}
.ps-design-thumb:hover .ps-design-thumb-cta, .ps-design-thumb:focus-visible .ps-design-thumb-cta { opacity: 1; transform: translate(-50%, 0); }
.ps-design-body { display: flex; flex-direction: column; gap: .5rem; flex: 1; padding: 1rem; }
.ps-design-title { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.ps-design-title h4 { margin: 0; font-size: 1.02rem; }
.ps-badge {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    flex-shrink: 0;
    padding: .2rem .55rem;
    border-radius: 999px;
    background: var(--ps-sunken);
    color: var(--ps-muted);
    font-size: .74rem;
    font-weight: 700;
}
.ps-badge.is-active { background: #ffedd5; color: var(--ps-accent-ink); }
.ps-design-desc { margin: 0; color: var(--ps-muted); font-size: .87rem; line-height: 1.5; }
.ps-design-best { margin: 0; color: #475569; font-size: .78rem; }
.ps-design-best strong { margin-right: .3rem; }
.ps-asks { display: flex; flex-wrap: wrap; gap: .35rem; margin: .1rem 0 0; padding: 0; list-style: none; }
.ps-asks li {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .2rem .55rem;
    border: 1px dashed #fdba74;
    border-radius: 999px;
    color: var(--ps-accent-ink);
    font-size: .75rem;
    font-weight: 600;
}
.ps-asks li.is-filled { border: 1px solid #bbf7d0; background: var(--ps-ok-soft); color: var(--ps-ok); }
.ps-design-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-top: auto; padding-top: .5rem; }
.ps-design-create {
    align-items: center;
    justify-content: center;
    gap: .5rem;
    min-height: 300px;
    padding: 1.5rem;
    border-style: dashed;
    color: var(--ps-muted);
    font: inherit;
    text-align: center;
    cursor: pointer;
}
.ps-design-create svg { font-size: 1.7rem; color: var(--ps-accent); }
.ps-design-create strong { color: var(--ps-ink); font-size: 1rem; }
.ps-design-create span { font-size: .85rem; line-height: 1.45; max-width: 220px; }
.ps-design-create:hover { border-color: var(--ps-accent); background: var(--ps-accent-soft); }

/* ── Design dialog ────────────────────────────────────────────────────────── */
.ps-dialog-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: rgba(15, 23, 42, .45);
}
.ps-dialog {
    display: flex;
    flex-direction: column;
    width: min(980px, 100%);
    max-height: calc(100vh - 2rem);
    overflow: hidden;
    border-radius: 16px;
    background: var(--surface-color, #fff);
    color: var(--text-color, #1f2937);
    box-shadow: 0 24px 60px rgba(15, 23, 42, .3);
}
.ps-dialog:focus { outline: none; }
.ps-dialog-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem 1.4rem;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
}
.ps-dialog-head h3 { margin: 0; font-size: 1.15rem; }
.ps-dialog-head p { margin: .3rem 0 0; color: var(--secondary-text-color, #64748b); font-size: .9rem; line-height: 1.45; }
.ps-dialog-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
    min-height: 0;
    overflow: hidden;
}
.ps-dialog-form { padding: 1.25rem 1.4rem; overflow-y: auto; }
.ps-dialog-form h4 { margin: 0 0 .25rem; font-size: .98rem; }
.ps-dialog-form > .ps-muted { margin-bottom: 1rem; }
.ps-more { display: grid; gap: .9rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border-color, #e5e7eb); }
.ps-more .ps-field { margin: 0; }
.ps-dialog-preview {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 1.5rem 1rem;
    overflow: auto;
    background: linear-gradient(180deg, #eef0f3, #e4e7eb);
}
.ps-dialog-preview .receipt-preview-frame--a4,
.ps-dialog-preview .receipt-preview-frame--letter { zoom: .85; }
.ps-dialog-foot {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .5rem;
    padding: .85rem 1.4rem;
    border-top: 1px solid var(--border-color, #e5e7eb);
}
.ps-dialog-foot .ps-error { margin-right: auto; }
/* Keeps the dialog's main button themed even if the dialog is rendered outside the page. */
.ps-dialog .ps-btn.is-primary { border-color: var(--primary-color, #e85d04); background: var(--primary-color, #e85d04); color: #fff; }

/* ── Receipt details tab ──────────────────────────────────────────────────── */
.ps-details { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 1.25rem; align-items: start; }
.ps-details-form { display: grid; gap: 1rem; min-width: 0; }
.ps-group { display: grid; gap: .9rem; padding-top: 1rem; margin-top: 1rem; border-top: 1px solid var(--ps-line); }
.ps-group:first-of-type { padding-top: 0; margin-top: 0; border-top: 0; }
.ps-group h4 { margin: 0; font-size: .82rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ps-muted); }
.ps-group .ps-field { margin: 0; }
.ps-logo-row {
    display: flex;
    align-items: center;
    gap: .9rem;
    padding: .9rem;
    border: 1px dashed #d1d5db;
    border-radius: 12px;
    background: var(--ps-sunken);
}
.ps-logo-box {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    overflow: hidden;
    border: 1px solid var(--ps-line);
    border-radius: 10px;
    background: #fff;
    color: #9ca3af;
    font-size: 1.4rem;
}
.ps-logo-box img { max-width: 100%; max-height: 100%; object-fit: contain; }
.ps-logo-text { display: grid; gap: .15rem; flex: 1; min-width: 0; }
.ps-logo-text span { color: var(--ps-muted); font-size: .8rem; line-height: 1.4; }
.ps-logo-actions { display: flex; gap: .4rem; }
.ps-details-preview {
    position: sticky;
    top: 1rem;
    display: grid;
    gap: .75rem;
    max-height: calc(100vh - 2rem);
    padding: 1rem;
    overflow: auto;
    border: 1px solid var(--ps-line);
    border-radius: var(--ps-radius);
    background: var(--ps-surface);
}
.ps-preview-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.ps-preview-head > div { display: grid; gap: .1rem; min-width: 0; }
.ps-eyebrow { color: var(--ps-muted); font-size: .72rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.ps-preview-paper {
    display: flex;
    justify-content: center;
    padding: 1.25rem .5rem;
    overflow: hidden;
    border-radius: 10px;
    background: linear-gradient(180deg, #eef0f3, #e4e7eb);
}
.ps-preview-paper .receipt-preview-frame--a4,
.ps-preview-paper .receipt-preview-frame--letter { zoom: .68; }
.ps-details-preview .ps-note { margin: 0; }

/* ── Print rules and test print (older markup inside the new cards) ──────── */
.ps-legacy .variation-section-header { margin-bottom: 1rem; }
.ps-legacy .variation-section-title h3 { margin: 0; font-size: 1.05rem; }
.ps-legacy .receipt-print-rule-group { padding: 1rem 0; border-top: 1px solid var(--ps-line); }
.ps-legacy .receipt-print-rule-group h4 { margin: 0 0 .5rem; }
.ps-legacy .receipt-print-rule-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem; }
.ps-legacy .receipt-print-rule-cell { display: grid; gap: .3rem; }
.ps-legacy .receipt-print-rule-cell label { font-weight: 600; font-size: .85rem; text-transform: uppercase; color: var(--ps-muted); }
.ps-legacy select { min-height: 40px; padding: .45rem .65rem; border: 1px solid #d1d5db; border-radius: 9px; background: #fff; font: inherit; }
.ps-legacy .restaurant-print-field { padding: 1rem 0; border-top: 1px solid var(--ps-line); }

/* ── Smaller screens ──────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
    .ps-details { grid-template-columns: minmax(0, 1fr); }
    .ps-details-preview { position: static; max-height: none; }
}
@media (max-width: 760px) {
    .ps-page-header { flex-direction: column; }
    .ps-paper-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ps-grid-2 { grid-template-columns: minmax(0, 1fr); }
    .ps-card { padding: 1rem; }
    .ps-advanced summary { padding: 1rem; }
    .ps-advanced > :not(summary) { margin: 1rem; }
    .ps-printer-row { flex-direction: column; align-items: stretch; }
    .ps-printer-row .ps-btn { margin-top: 0; }
    .ps-dialog-body { grid-template-columns: minmax(0, 1fr); overflow-y: auto; }
    .ps-dialog-form { overflow: visible; }
    .ps-dialog-preview { overflow: visible; }
    .ps-savebar { flex-direction: column; align-items: stretch; text-align: center; }
    .ps-savebar > div { justify-content: stretch; }
    .ps-savebar .ps-btn { flex: 1; }
    .ps-tabs button span { white-space: nowrap; }
    .ps-design-grid { grid-template-columns: minmax(0, 1fr); }
}
/* Settings Visibility Container */
.settings-visibility-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

.settings-visibility-header {
  margin-bottom: 2rem;
}

.settings-visibility-header h2 {
  font-size: 1.75rem;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 0.5rem;
}

.settings-visibility-description {
  font-size: 0.95rem;
  color: #666;
  line-height: 1.5;
}

/* Message Banner */
.message-banner {
  padding: 1rem 1.5rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  font-weight: 500;
  animation: slideDown 0.3s ease-out;
}

.message-banner.success {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.message-banner.error {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Table Container */
.settings-visibility-table-container {
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  margin-bottom: 2rem;
}

/* Table Styles */
.settings-visibility-table {
  width: 100%;
  border-collapse: collapse;
}

.settings-visibility-table thead {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.settings-visibility-table th {
  padding: 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.settings-visibility-table th:nth-child(3),
.settings-visibility-table th:nth-child(4),
.settings-visibility-table th:nth-child(5),
.settings-visibility-table th:nth-child(6) {
  text-align: center;
  width: 100px;
}

.settings-visibility-table tbody tr {
  border-bottom: 1px solid #e5e7eb;
  transition: background-color 0.2s ease;
}

.settings-visibility-table tbody tr:hover {
  background-color: #f9fafb;
}

.settings-visibility-table tbody tr.inactive-row {
  opacity: 0.5;
}

.settings-visibility-table td {
  padding: 1.25rem 1rem;
  font-size: 0.9rem;
  color: #374151;
}

.settings-visibility-table td:nth-child(3),
.settings-visibility-table td:nth-child(4),
.settings-visibility-table td:nth-child(5),
.settings-visibility-table td:nth-child(6) {
  text-align: center;
}

.description-cell {
  color: #6b7280;
  font-size: 0.85rem;
  line-height: 1.4;
  max-width: 400px;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 24px;
  cursor: pointer;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  border-radius: 24px;
  transition: all 0.3s ease;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(24px);
}

.toggle-switch input:disabled + .toggle-slider {
  opacity: 0.5;
  cursor: not-allowed;
}

.toggle-switch input:disabled + .toggle-slider:before {
  cursor: not-allowed;
}

/* Legend */
.settings-visibility-legend {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1.5rem;
}

.settings-visibility-legend h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 1rem;
}

.settings-visibility-legend ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.settings-visibility-legend li {
  padding: 0.5rem 0;
  color: #4b5563;
  font-size: 0.9rem;
  line-height: 1.5;
}

.settings-visibility-legend li strong {
  color: #1a1a1a;
  font-weight: 600;
}

/* Loading and Access Denied States */
.loading-state,
.access-denied {
  text-align: center;
  padding: 3rem 2rem;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.access-denied h2 {
  font-size: 1.5rem;
  color: #dc2626;
  margin-bottom: 0.5rem;
}

.access-denied p {
  color: #6b7280;
  font-size: 1rem;
}

.loading-state {
  color: #6b7280;
  font-size: 1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
  .settings-visibility-container {
    padding: 1rem;
  }

  .settings-visibility-table-container {
    overflow-x: auto;
  }

  .settings-visibility-table {
    min-width: 700px;
  }

  .settings-visibility-header h2 {
    font-size: 1.5rem;
  }

  .description-cell {
    max-width: 250px;
  }
}
.restaurant-settings-page {
    padding: 2rem;
    max-width: 900px;
    margin: 0 auto;
}

.settings-header {
    margin-bottom: 2rem;
}

.settings-header h2 {
    font-size: 2rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.settings-header p {
    color: #6b7280;
    font-size: 1rem;
}

.loading-state {
    text-align: center;
    padding: 3rem;
    color: #6b7280;
}

.message-banner {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.message-banner.success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #10b981;
}

.message-banner.error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #ef4444;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.settings-section {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 1.5rem;
}

.settings-section h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #f3f4f6;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group textarea {
    resize: vertical;
    font-family: inherit;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
}

.btn-primary {
    background-color: #3b82f6;
    color: white;
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover:not(:disabled) {
    background-color: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Team Switcher Section */
.team-switcher-section {
    margin-bottom: 2rem;
}

.team-switcher-section .section-description {
    color: #6b7280;
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

.team-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.team-card {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    width: 100%;
}

.team-card:hover:not(:disabled) {
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
    transform: translateY(-2px);
}

.team-card.active {
    border-color: #3b82f6;
    background: #eff6ff;
}

.team-card:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.team-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
}

.team-card-title {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.team-card-header h4 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

.team-subtitle {
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 500;
}

.current-badge {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: #3b82f6;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.team-card-details {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.detail-label {
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 500;
}

.detail-value {
    font-size: 0.875rem;
    color: #1f2937;
    font-weight: 600;
}

.role-badge {
    background: #f3f4f6;
    padding: 0.25rem 0.75rem;
    border-radius: 0.375rem;
    text-transform: capitalize;
    color: #3b82f6;
    font-weight: 700;
}

/* Tab Navigation Styles */
.team-settings-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid #e5e7eb;
    overflow-x: auto;
    scrollbar-width: thin;
}

.team-settings-tab {
    padding: 0.875rem 1.5rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: #6b7280;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    position: relative;
    margin-bottom: -2px;
}

.team-settings-tab:hover {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.05);
}

.team-settings-tab.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
    background: rgba(59, 130, 246, 0.08);
}

.team-settings-tab-content {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .restaurant-settings-page {
        padding: 1rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .settings-header h2 {
        font-size: 1.5rem;
    }

    .team-cards-grid {
        grid-template-columns: 1fr;
    }

    .team-settings-tab {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }

    .team-settings-tabs {
        gap: 0.25rem;
    }
}.branch-visibility-settings {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.visibility-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid #f0f0f0;
}

.visibility-header h2 {
    margin: 0;
    font-size: 1.75rem;
    color: #1a1a1a;
}

.branch-name-subtitle {
    margin: 0.5rem 0 0 0;
    font-size: 0.95rem;
    color: #666;
    font-weight: 500;
}

.visibility-actions {
    display: flex;
    gap: 1rem;
}

.refresh-button,
.save-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.refresh-button {
    background: #f5f5f5;
    color: #333;
}

.refresh-button:hover:not(:disabled) {
    background: #e8e8e8;
}

.save-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.save-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.save-button:disabled,
.refresh-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.visibility-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid #f0f0f0;
}

.tab-button {
    padding: 1rem 1.5rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 0.95rem;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-button:hover {
    color: #667eea;
    background: #f8f9ff;
}

.tab-button.active {
    color: #667eea;
    border-bottom-color: #667eea;
    background: #f8f9ff;
}

.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    color: #666;
}

.loading-state .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f0f0f0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.visibility-table-container {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #e8e8e8;
}

.visibility-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.visibility-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.visibility-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.visibility-table th:nth-child(3),
.visibility-table th:nth-child(4),
.visibility-table th:nth-child(5),
.visibility-table th:nth-child(6),
.visibility-table th:nth-child(7) {
    text-align: center;
}

.visibility-table tbody tr {
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s;
}

.visibility-table tbody tr:hover {
    background-color: #f8f9ff;
}

.visibility-table tbody tr.inactive-row {
    opacity: 0.5;
    background-color: #fafafa;
}

.visibility-table td {
    padding: 1rem;
}

.item-name {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.item-name strong {
    color: #1a1a1a;
    font-size: 0.95rem;
}

.item-key {
    font-size: 0.8rem;
    color: #999;
    font-family: 'Courier New', monospace;
}

.item-description {
    color: #666;
    font-size: 0.85rem;
    max-width: 300px;
}

.active-cell {
    text-align: center;
}

.toggle-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1.1rem;
}

.toggle-button.active {
    background: #e8f5e9;
    color: #4caf50;
}

.toggle-button.inactive {
    background: #ffebee;
    color: #f44336;
}

.toggle-button:hover {
    transform: scale(1.1);
}

.role-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #667eea;
}

.visibility-table td:nth-child(3),
.visibility-table td:nth-child(4),
.visibility-table td:nth-child(5),
.visibility-table td:nth-child(6),
.visibility-table td:nth-child(7) {
    text-align: center;
}

.empty-state {
    padding: 3rem;
    text-align: center;
    color: #999;
}

.visibility-footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px solid #f0f0f0;
    display: flex;
    justify-content: flex-end;
}

.close-button {
    padding: 0.75rem 2rem;
    background: #f5f5f5;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    transition: all 0.2s;
}

.close-button:hover {
    background: #e8e8e8;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .visibility-table {
        font-size: 0.85rem;
    }

    .visibility-table th,
    .visibility-table td {
        padding: 0.75rem 0.5rem;
    }
}

@media (max-width: 768px) {
    .branch-visibility-settings {
        padding: 1rem;
    }

    .visibility-header {
        flex-direction: column;
        gap: 1rem;
    }

    .visibility-actions {
        width: 100%;
        flex-direction: column;
    }

    .refresh-button,
    .save-button {
        width: 100%;
        justify-content: center;
    }

    .visibility-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
    }

    .tab-button {
        white-space: nowrap;
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
    }

    .visibility-table-container {
        overflow-x: scroll;
    }

    .visibility-table {
        min-width: 800px;
    }
}/* ============================================================
   Branch Settings Page
   ============================================================ */

.branch-settings-page {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* ---- Page Header ---- */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid #f0f0f0;
    gap: 1rem;
}

.page-header-content h1 {
    margin: 0 0 0.3rem 0;
    font-size: 1.6rem;
    color: #1a1a1a;
    font-weight: 700;
}

.page-description {
    margin: 0 0 0.6rem 0;
    color: #888;
    font-size: 0.9rem;
}

.branches-count-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: #f0f0ff;
    color: #667eea;
    border: 1px solid #d4d4ff;
    padding: 0.25rem 0.7rem;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 700;
}

.create-branch-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 9px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.create-branch-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 16px rgba(102, 126, 234, 0.45);
}

/* ---- Error Banner ---- */

.error-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.1rem;
    margin-bottom: 1.5rem;
    background: #fff5f5;
    border: 1px solid #fed7d7;
    border-left: 4px solid #f56565;
    border-radius: 8px;
    color: #c53030;
    font-size: 0.88rem;
}

/* ---- Branches Grid ---- */

.branches-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(370px, 1fr));
    gap: 1.25rem;
}

/* ---- Branch Card ---- */

.branch-card {
    background: #fff;
    border: 1.5px solid #e8e8f0;
    border-radius: 14px;
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s;
    display: flex;
    flex-direction: column;
}

.branch-card:hover {
    box-shadow: 0 8px 28px rgba(102, 126, 234, 0.13);
    transform: translateY(-2px);
}

.branch-card.is-current {
    border-color: #667eea;
}

/* Accent bar */
.branch-card-accent {
    height: 4px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    flex-shrink: 0;
}

.branch-card.is-current .branch-card-accent {
    background: linear-gradient(90deg, #43e97b 0%, #38f9d7 100%);
}

/* Header */
.branch-card-header {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 1.1rem 1.25rem 0.85rem;
}

.branch-card-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.15rem;
    flex-shrink: 0;
}

.branch-card-title {
    flex: 1;
    min-width: 0;
}

.branch-card-title h3 {
    margin: 0 0 0.2rem 0;
    font-size: 1.05rem;
    color: #1a1a1a;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.branch-code {
    font-size: 0.75rem;
    color: #aaa;
    font-family: 'Courier New', monospace;
    background: #f5f5f8;
    padding: 0.1rem 0.45rem;
    border-radius: 4px;
    display: inline-block;
}

.branch-badges {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    align-items: flex-end;
    flex-shrink: 0;
}

.main-badge {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    padding: 0.18rem 0.55rem;
    border-radius: 20px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.current-badge {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    color: #065f46;
    padding: 0.18rem 0.55rem;
    border-radius: 20px;
    font-size: 0.68rem;
    font-weight: 700;
    white-space: nowrap;
}

/* Card Body – Detail Grid */

.branch-card-body {
    padding: 0 1.25rem 1.1rem;
    flex: 1;
}

.branch-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border: 1.5px solid #f0f0f5;
    border-radius: 10px;
    overflow: hidden;
}

.branch-detail-item {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid #f0f0f5;
    border-right: 1px solid #f0f0f5;
}

.branch-detail-item:nth-child(even) {
    border-right: none;
}

/* Remove bottom border from last row */
.branch-detail-item:nth-last-child(-n+2):not(.full-width),
.branch-detail-item.full-width:last-child {
    border-bottom: none;
}

.branch-detail-item.full-width {
    grid-column: 1 / -1;
    border-right: none;
}

.detail-icon {
    color: #a78bfa;
    font-size: 0.88rem;
    margin-top: 0.18rem;
    flex-shrink: 0;
}

.detail-content {
    min-width: 0;
    flex: 1;
}

.detail-label {
    display: block;
    font-size: 0.68rem;
    color: #bbb;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.08rem;
}

.detail-value {
    display: block;
    font-size: 0.86rem;
    color: #222;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.detail-value.wrap {
    white-space: normal;
}

/* Status */
.status-active {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    color: #059669;
    font-size: 0.86rem;
    font-weight: 600;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #059669;
    display: inline-block;
}

/* Access badge */
.access-badge {
    background: #ede9fe;
    color: #6d28d9;
    padding: 0.1rem 0.5rem;
    border-radius: 10px;
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: capitalize;
}

/* Card Footer */

.branch-card-footer {
    padding: 0.85rem 1.25rem;
    border-top: 1.5px solid #f0f0f5;
    display: flex;
    gap: 0.5rem;
    background: #fafafa;
}

.btn-card {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.55rem 0.6rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    border: 1.5px solid transparent;
}

.btn-card-secondary {
    background: #fff7ed;
    border-color: #fdba74;
    color: #c2410c;
    font-weight: 600;
}

.btn-card-secondary:hover:not(:disabled) {
    background: #ffedd5;
    border-color: #ea580c;
}

.tz-change-link {
    margin-left: 0.4rem;
    padding: 0;
    border: 0;
    background: none;
    color: #ea580c;
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
}

.btn-card-secondary:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.btn-card-amber {
    background: #fffbeb;
    border-color: #fcd34d;
    color: #b45309;
}

.btn-card-amber:hover:not(:disabled) {
    background: #fef3c7;
    border-color: #f59e0b;
}

.btn-card-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
}

.btn-card-primary:hover:not(:disabled) {
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.4);
    transform: translateY(-1px);
}

/* ---- Empty State ---- */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 5rem 2rem;
}

.empty-state-icon {
    width: 68px;
    height: 68px;
    background: #f5f3ff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.2rem;
    font-size: 1.85rem;
    color: #a78bfa;
}

.empty-state h3 {
    margin: 0 0 0.45rem 0;
    font-size: 1.1rem;
    color: #555;
    font-weight: 600;
}

.empty-state p {
    margin: 0;
    color: #aaa;
    font-size: 0.88rem;
}

/* ---- Loading ---- */

.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 5rem 2rem;
}

.loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #f0f0f0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---- Access Denied ---- */

.access-denied-card {
    max-width: 460px;
    margin: 4rem auto;
    text-align: center;
    background: #fff;
    border: 1.5px solid #e8e8e8;
    border-radius: 14px;
    padding: 3rem 2rem;
}

.access-denied-icon {
    width: 60px;
    height: 60px;
    background: #fff5f5;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.6rem;
    color: #f56565;
}

.access-denied-card h2 {
    margin: 0 0 0.65rem 0;
    font-size: 1.2rem;
    color: #1a1a1a;
}

.access-denied-card p {
    color: #888;
    font-size: 0.88rem;
    margin: 0;
    line-height: 1.6;
}

/* ============================================================
   Modals
   ============================================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
    backdrop-filter: blur(2px);
}

.modal-content {
    background: white;
    border-radius: 14px;
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.2);
}

.modal-content-large {
    max-width: 1400px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 1.5rem;
    border-bottom: 1.5px solid #f0f0f0;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 1;
    gap: 1rem;
}

.modal-header-inner {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.modal-header h2 {
    margin: 0 0 0.15rem 0;
    font-size: 1.15rem;
    color: #1a1a1a;
    font-weight: 700;
}

.modal-header-subtitle {
    font-size: 0.8rem;
    color: #aaa;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: #f5f5f5;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 1rem;
    color: #666;
    flex-shrink: 0;
}

.modal-close:hover {
    background: #e8e8e8;
}

.modal-body {
    padding: 1.5rem;
}

/* ---- Create Branch Form ---- */

.form-section {
    margin-bottom: 1.5rem;
}

.form-section:last-child {
    margin-bottom: 0;
}

.form-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: #667eea;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin: 0 0 0.85rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #f0f0ff;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem;
    margin-bottom: 0.85rem;
}

.form-row:last-child {
    margin-bottom: 0;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-group label {
    font-size: 0.83rem;
    font-weight: 600;
    color: #444;
}

.required {
    color: #f44336;
}

.form-group input,
.form-group textarea {
    padding: 0.6rem 0.85rem;
    border: 1.5px solid #e0e0e8;
    border-radius: 8px;
    font-size: 0.88rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
    color: #1a1a1a;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.12);
}

.form-group input:disabled,
.form-group textarea:disabled {
    background: #f8f8fa;
    cursor: not-allowed;
    color: #aaa;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    padding: 1.1rem 1.5rem;
    border-top: 1.5px solid #f0f0f0;
    justify-content: flex-end;
}

.cancel-button {
    padding: 0.6rem 1.2rem;
    border: 1.5px solid #e0e0e8;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
    color: #555;
}

.cancel-button:hover:not(:disabled) {
    background: #f5f5f5;
    border-color: #ccc;
}

.submit-button {
    padding: 0.6rem 1.4rem;
    border: none;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.submit-button:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.cancel-button:disabled,
.submit-button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

/* ---- Stock Setting Card Icon & Status Pill ---- */

.stock-setting-icon-wrap {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.stock-setting-icon-wrap.strict {
    background: #fff3cd;
    color: #b45309;
}

.stock-setting-card.enabled .stock-setting-icon-wrap.strict {
    background: #fee2e2;
    color: #dc2626;
}

.stock-setting-icon-wrap.popup {
    background: #ede9fe;
    color: #7c3aed;
}

.setting-status-pill {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.08rem 0.45rem;
    border-radius: 10px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    vertical-align: middle;
}

.setting-status-pill.on {
    background: #dcfce7;
    color: #15803d;
}

.setting-status-pill.off {
    background: #f3f4f6;
    color: #9ca3af;
}

/* ---- Stock Settings Cards ---- */

.stock-setting-card {
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    padding: 1rem 1.1rem;
    margin-bottom: 0.75rem;
    transition: border-color 0.2s, background 0.2s;
}

.stock-setting-card:last-child {
    margin-bottom: 0;
}

.stock-setting-card.enabled {
    border-color: #a5b4fc;
    background: #fafbff;
}

.stock-setting-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.stock-setting-info {
    flex: 1;
    min-width: 0;
}

.stock-setting-info h4 {
    margin: 0 0 0.25rem 0;
    font-size: 0.92rem;
    color: #1a1a1a;
    font-weight: 700;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.stock-setting-info p {
    margin: 0;
    font-size: 0.82rem;
    color: #888;
    line-height: 1.55;
}

/* Toggle Switch */

.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #d1d5db;
    border-radius: 24px;
    transition: 0.25s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.25s;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

/* ============================================================
   Strict Mode Confirmation Modal
   ============================================================ */

.strict-confirm-overlay {
    z-index: 1100; /* above the stock settings modal */
}

.strict-confirm-modal {
    border-radius: 14px;
    overflow: hidden;
}

/* Coloured header band */
.strict-confirm-header {
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1.5px solid transparent;
}

.strict-confirm-header.enabling {
    background: #fff7ed;
    border-bottom-color: #fed7aa;
}

.strict-confirm-header.disabling {
    background: #f0fdf4;
    border-bottom-color: #bbf7d0;
}

.strict-confirm-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.enabling .strict-confirm-icon {
    background: #fed7aa;
    color: #c2410c;
}

.disabling .strict-confirm-icon {
    background: #bbf7d0;
    color: #15803d;
}

.strict-confirm-header h3 {
    margin: 0 0 0.2rem 0;
    font-size: 1.05rem;
    font-weight: 700;
}

.enabling .strict-confirm-header h3 { color: #9a3412; }
.disabling .strict-confirm-header h3 { color: #14532d; }

.strict-confirm-header p {
    margin: 0;
    font-size: 0.82rem;
    line-height: 1.5;
}

.enabling .strict-confirm-header p { color: #c2410c; }
.disabling .strict-confirm-header p { color: #15803d; }

.strict-confirm-header > div:last-of-type {
    flex: 1;
    min-width: 0;
}

/* Body */
.strict-confirm-body {
    padding: 1.25rem 1.5rem;
}

.strict-confirm-lead {
    margin: 0 0 1rem 0;
    font-size: 0.88rem;
    color: #444;
    line-height: 1.6;
}

/* Impact list */
.strict-impact-list {
    list-style: none;
    margin: 0 0 1rem 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.strict-impact-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    font-size: 0.86rem;
    color: #333;
    line-height: 1.55;
}

.impact-icon {
    flex-shrink: 0;
    margin-top: 0.18rem;
    font-size: 0.9rem;
}

.impact-icon.block { color: #dc2626; }
.impact-icon.warn  { color: #d97706; }
.impact-icon.safe  { color: #16a34a; }

/* Bottom note */
.strict-confirm-note {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    padding: 0.7rem 0.9rem;
    border-radius: 8px;
    font-size: 0.82rem;
    line-height: 1.5;
}

.strict-confirm-note.warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.strict-confirm-note.info {
    background: #ede9fe;
    color: #4c1d95;
    border: 1px solid #ddd6fe;
}

.strict-confirm-note svg {
    flex-shrink: 0;
    margin-top: 0.15rem;
    font-size: 0.88rem;
}

/* Confirm action button variants */
.strict-confirm-btn {
    display: inline-flex;
    align-items: center;
}

.strict-confirm-btn.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: none;
}

.strict-confirm-btn.btn-danger:hover:not(:disabled) {
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
    transform: translateY(-1px);
}

.strict-confirm-btn.btn-success {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    box-shadow: none;
}

.strict-confirm-btn.btn-success:hover:not(:disabled) {
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.4);
    transform: translateY(-1px);
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 768px) {
    .branch-settings-page {
        padding: 1rem;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .create-branch-button {
        width: 100%;
        justify-content: center;
    }

    .branches-grid {
        grid-template-columns: 1fr;
    }

    .branch-details-grid {
        grid-template-columns: 1fr;
    }

    .branch-detail-item {
        border-right: none !important;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .branch-card-footer {
        flex-wrap: wrap;
    }

    .btn-card {
        flex: 1 1 calc(50% - 0.25rem);
        min-width: 0;
    }
}
/* ============================================================
   Branch Management — dedicated, scoped stylesheet
   Loaded AFTER BranchSettingsPage.css; every rule is scoped to
   `.branch-settings-page.bm-page` so it wins over both the old
   page stylesheet and the duplicate branch rules in index.css,
   and cannot leak into other pages.
   ============================================================ */

.branch-settings-page.bm-page {
    --bm-orange: #ea580c;
    --bm-orange-dark: #c2410c;
    --bm-orange-soft: #fff7ed;
    --bm-orange-line: #fed7aa;
    --bm-ink: #111827;
    --bm-text: #374151;
    --bm-muted: #6b7280;
    --bm-faint: #9ca3af;
    --bm-line: #e5e7eb;
    --bm-surface: #ffffff;
    --bm-bg: #f9fafb;
    --bm-green: #047857;
    --bm-green-soft: #ecfdf5;
    --bm-radius: 16px;

    max-width: 1280px;
    margin: 0 auto;
    padding: 1.5rem 1.5rem 3rem;
    color: var(--bm-text);
}

/* ---------- Page header ---------- */
.branch-settings-page.bm-page .page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 1rem 0 1.5rem;
    padding: 1.4rem 1.6rem;
    background: var(--bm-surface);
    border: 1px solid var(--bm-line);
    border-radius: var(--bm-radius);
    box-shadow: 0 1px 2px rgba(17, 24, 39, 0.04);
}

.branch-settings-page.bm-page .page-header-content h1 {
    margin: 0 0 0.25rem;
    font-size: 1.65rem;
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--bm-ink);
}

.branch-settings-page.bm-page .page-description {
    margin: 0 0 0.7rem;
    font-size: 0.92rem;
    color: var(--bm-muted);
}

.branch-settings-page.bm-page .branches-count-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    border: 1px solid var(--bm-orange-line);
    background: var(--bm-orange-soft);
    color: var(--bm-orange-dark);
    font-size: 0.78rem;
    font-weight: 600;
}

.branch-settings-page.bm-page .create-branch-button {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    height: 42px;
    padding: 0 1.2rem;
    border: 0;
    border-radius: 10px;
    background: var(--bm-orange);
    color: #fff;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(234, 88, 12, 0.3);
    transition: background 0.15s ease, box-shadow 0.15s ease;
}

.branch-settings-page.bm-page .create-branch-button:hover {
    background: var(--bm-orange-dark);
    transform: none;
    box-shadow: 0 4px 12px rgba(234, 88, 12, 0.25);
}

/* ---------- Error / empty / loading ---------- */
.branch-settings-page.bm-page .error-banner {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1rem;
    padding: 0.8rem 1rem;
    border: 1px solid #fecaca;
    border-radius: 12px;
    background: #fef2f2;
    color: #b91c1c;
    font-size: 0.9rem;
}

.branch-settings-page.bm-page .empty-state {
    padding: 3rem 1rem;
    text-align: center;
    background: var(--bm-surface);
    border: 1px dashed var(--bm-line);
    border-radius: var(--bm-radius);
}

.branch-settings-page.bm-page .empty-state-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin-bottom: 0.8rem;
    border-radius: 16px;
    background: var(--bm-orange-soft);
    color: var(--bm-orange);
    font-size: 1.5rem;
}

/* ---------- Cards grid ---------- */
.branch-settings-page.bm-page .branches-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr));
    gap: 1.25rem;
    align-items: stretch;
}

.branch-settings-page.bm-page .branch-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    background: var(--bm-surface);
    border: 1px solid var(--bm-line);
    border-radius: var(--bm-radius);
    box-shadow: 0 1px 2px rgba(17, 24, 39, 0.04);
    transition: box-shadow 0.18s ease, border-color 0.18s ease;
}

.branch-settings-page.bm-page .branch-card:hover {
    transform: none;
    border-color: #d1d5db;
    box-shadow: 0 8px 24px rgba(17, 24, 39, 0.08);
}

.branch-settings-page.bm-page .branch-card.is-current {
    border-color: var(--bm-orange-line);
    box-shadow: 0 0 0 1px var(--bm-orange-line), 0 4px 16px rgba(234, 88, 12, 0.08);
}

.branch-settings-page.bm-page .branch-card-accent {
    height: 4px;
    margin: 0;
    border-radius: 0;
    background: #e5e7eb;
}

.branch-settings-page.bm-page .branch-card.is-current .branch-card-accent {
    background: linear-gradient(90deg, #fb923c, var(--bm-orange));
}

/* header: icon | title | badges (no absolute positioning, so nothing overlaps) */
.branch-settings-page.bm-page .branch-card-header {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 1.1rem 1.25rem 0.9rem;
}

.branch-settings-page.bm-page .branch-card-icon {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--bm-orange-soft);
    color: var(--bm-orange);
    font-size: 1.2rem;
    box-shadow: none;
}

.branch-settings-page.bm-page .branch-card-title {
    flex: 1;
    min-width: 0;
}

.branch-settings-page.bm-page .branch-card-title h3 {
    margin: 0 0 0.25rem;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.25;
    color: var(--bm-ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.branch-settings-page.bm-page .branch-code {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    border-radius: 6px;
    background: #f3f4f6;
    color: var(--bm-muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.74rem;
    letter-spacing: 0.02em;
}

.branch-settings-page.bm-page .branch-badges {
    position: static;
    flex-shrink: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.35rem;
}

.branch-settings-page.bm-page .main-badge,
.branch-settings-page.bm-page .current-badge {
    position: static;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin: 0;
    padding: 0.2rem 0.6rem;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    line-height: 1.3;
    box-shadow: none;
}

.branch-settings-page.bm-page .main-badge {
    background: var(--bm-orange-soft);
    border-color: var(--bm-orange-line);
    color: var(--bm-orange-dark);
}

.branch-settings-page.bm-page .current-badge {
    background: var(--bm-green-soft);
    border-color: #a7f3d0;
    color: var(--bm-green);
}

/* details: clean 2-column table, equal cells */
.branch-settings-page.bm-page .branch-card-body {
    flex: 1;
    padding: 0 1.25rem 1.1rem;
}

.branch-settings-page.bm-page .branch-details-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border: 1px solid var(--bm-line);
    border-radius: 12px;
    background: var(--bm-surface);
    overflow: hidden;
}

.branch-settings-page.bm-page .branch-detail-item {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    min-width: 0;
    padding: 0.75rem 0.9rem;
    border: 0;
    border-right: 1px solid var(--bm-line);
    border-bottom: 1px solid var(--bm-line);
    background: transparent;
}

.branch-settings-page.bm-page .branch-detail-item:nth-child(even) {
    border-right: 0;
}

.branch-settings-page.bm-page .branch-detail-item.full-width {
    grid-column: 1 / -1;
    border-right: 0;
}

/* remove the bottom line on the last row, whatever its shape */
.branch-settings-page.bm-page .branch-detail-item:last-child {
    border-bottom: 0;
}

.branch-settings-page.bm-page .branch-detail-item:nth-last-child(2):nth-child(odd):not(.full-width) {
    border-bottom: 0;
}

.branch-settings-page.bm-page .detail-icon {
    flex-shrink: 0;
    margin-top: 0.15rem;
    width: 15px;
    height: 15px;
    color: var(--bm-orange);
    opacity: 0.85;
}

.branch-settings-page.bm-page .detail-content {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.branch-settings-page.bm-page .detail-label {
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--bm-faint);
}

.branch-settings-page.bm-page .detail-value {
    font-size: 0.88rem;
    font-weight: 500;
    line-height: 1.35;
    color: var(--bm-ink);
    overflow-wrap: anywhere;
    word-break: break-word;
}

.branch-settings-page.bm-page .detail-value.wrap {
    white-space: normal;
}

.branch-settings-page.bm-page .status-active {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--bm-green);
    font-weight: 600;
}

.branch-settings-page.bm-page .status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10b981;
}

.branch-settings-page.bm-page .tz-change-link {
    margin-left: 0.5rem;
    padding: 0;
    border: 0;
    background: none;
    color: var(--bm-orange);
    font-size: 0.76rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.branch-settings-page.bm-page .tz-change-link:hover {
    color: var(--bm-orange-dark);
    text-decoration: underline;
}

/* footer actions: always at the bottom, equal width */
.branch-settings-page.bm-page .branch-card-footer {
    display: flex;
    gap: 0.6rem;
    margin-top: auto;
    padding: 0.9rem 1.25rem 1.1rem;
    border-top: 1px solid var(--bm-line);
    background: var(--bm-bg);
}

.branch-settings-page.bm-page .btn-card {
    flex: 1 1 0;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    height: 38px;
    padding: 0 0.6rem;
    border: 1px solid var(--bm-line);
    border-radius: 10px;
    background: var(--bm-surface);
    color: var(--bm-text);
    font-size: 0.84rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.branch-settings-page.bm-page .btn-card:hover:not(:disabled) {
    background: #f3f4f6;
    border-color: #d1d5db;
}

/* Edit = the main action */
.branch-settings-page.bm-page .btn-card-secondary {
    background: var(--bm-orange);
    border-color: var(--bm-orange);
    color: #fff;
}

.branch-settings-page.bm-page .btn-card-secondary:hover:not(:disabled) {
    background: var(--bm-orange-dark);
    border-color: var(--bm-orange-dark);
}

.branch-settings-page.bm-page .btn-card-amber,
.branch-settings-page.bm-page .btn-card-primary {
    background: var(--bm-surface);
    border-color: var(--bm-line);
    color: var(--bm-text);
}

.branch-settings-page.bm-page .btn-card-amber:hover:not(:disabled),
.branch-settings-page.bm-page .btn-card-primary:hover:not(:disabled) {
    background: var(--bm-orange-soft);
    border-color: var(--bm-orange-line);
    color: var(--bm-orange-dark);
}

/* ---------- Modals ---------- */
.branch-settings-page.bm-page .modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(17, 24, 39, 0.5);
    backdrop-filter: blur(2px);
}

.branch-settings-page.bm-page .modal-content {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 680px;
    max-height: calc(100vh - 2rem);
    overflow: hidden;
    background: var(--bm-surface);
    border: 0;
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(17, 24, 39, 0.3);
}

.branch-settings-page.bm-page .modal-content-large {
    max-width: 920px;
}

.branch-settings-page.bm-page .modal-content > form {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1;
}

.branch-settings-page.bm-page .modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.5rem 1rem;
    border-bottom: 1px solid var(--bm-line);
    background: var(--bm-surface);
}

.branch-settings-page.bm-page .modal-header h2 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--bm-ink);
}

.branch-settings-page.bm-page .modal-header-subtitle {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.84rem;
    color: var(--bm-muted);
}

.branch-settings-page.bm-page .modal-close {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 9px;
    background: #f3f4f6;
    color: var(--bm-muted);
    font-size: 1.1rem;
    cursor: pointer;
}

.branch-settings-page.bm-page .modal-close:hover {
    background: #e5e7eb;
    color: var(--bm-ink);
}

.branch-settings-page.bm-page .modal-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 1.1rem 1.5rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.branch-settings-page.bm-page .form-section {
    margin: 0;
    padding: 0;
    border: 0;
}

.branch-settings-page.bm-page .form-section-title {
    margin: 0 0 0.7rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--bm-line);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--bm-orange-dark);
}

.branch-settings-page.bm-page .form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
    margin-bottom: 0.85rem;
}

.branch-settings-page.bm-page .form-row:last-child {
    margin-bottom: 0;
}

.branch-settings-page.bm-page .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
    margin: 0;
}

.branch-settings-page.bm-page .form-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--bm-text);
}

.branch-settings-page.bm-page .form-group .required {
    color: #dc2626;
}

.branch-settings-page.bm-page .form-group input,
.branch-settings-page.bm-page .form-group textarea,
.branch-settings-page.bm-page .form-group select {
    width: 100%;
    box-sizing: border-box;
    min-height: 42px;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: var(--bm-surface);
    color: var(--bm-ink);
    font-family: inherit;
    font-size: 0.92rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.branch-settings-page.bm-page .form-group textarea {
    resize: vertical;
}

.branch-settings-page.bm-page .form-group input:focus,
.branch-settings-page.bm-page .form-group textarea:focus,
.branch-settings-page.bm-page .form-group select:focus {
    outline: 0;
    border-color: var(--bm-orange);
    box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.15);
}

.branch-settings-page.bm-page .form-group input:disabled,
.branch-settings-page.bm-page .form-group textarea:disabled {
    background: #f9fafb;
    color: var(--bm-faint);
    cursor: not-allowed;
}

.branch-settings-page.bm-page .form-group small {
    font-size: 0.75rem;
    color: var(--bm-muted);
}

.branch-settings-page.bm-page .modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    padding: 0.9rem 1.5rem;
    border-top: 1px solid var(--bm-line);
    background: var(--bm-bg);
}

.branch-settings-page.bm-page .cancel-button,
.branch-settings-page.bm-page .submit-button {
    height: 40px;
    padding: 0 1.3rem;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.branch-settings-page.bm-page .cancel-button {
    border: 1px solid #d1d5db;
    background: var(--bm-surface);
    color: var(--bm-text);
}

.branch-settings-page.bm-page .cancel-button:hover:not(:disabled) {
    background: #f3f4f6;
}

.branch-settings-page.bm-page .submit-button {
    border: 1px solid var(--bm-orange);
    background: var(--bm-orange);
    color: #fff;
}

.branch-settings-page.bm-page .submit-button:hover:not(:disabled) {
    background: var(--bm-orange-dark);
    border-color: var(--bm-orange-dark);
}

.branch-settings-page.bm-page .cancel-button:disabled,
.branch-settings-page.bm-page .submit-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* stock-policy modal rows */
.branch-settings-page.bm-page .stock-setting-card {
    border: 1px solid var(--bm-line);
    border-radius: 12px;
    background: var(--bm-surface);
}

.branch-settings-page.bm-page .stock-setting-card.enabled {
    border-color: var(--bm-orange-line);
    background: var(--bm-orange-soft);
}

.branch-settings-page.bm-page .toggle-switch input:checked + .toggle-slider {
    background: var(--bm-orange);
}

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
    .branch-settings-page.bm-page {
        padding: 1rem 0.9rem 2rem;
    }

    .branch-settings-page.bm-page .page-header {
        flex-direction: column;
        align-items: stretch;
        padding: 1.1rem;
    }

    .branch-settings-page.bm-page .create-branch-button {
        justify-content: center;
    }

    .branch-settings-page.bm-page .branch-details-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .branch-settings-page.bm-page .branch-detail-item,
    .branch-settings-page.bm-page .branch-detail-item:nth-child(even) {
        border-right: 0;
    }

    .branch-settings-page.bm-page .branch-detail-item:nth-last-child(2):nth-child(odd):not(.full-width) {
        border-bottom: 1px solid var(--bm-line);
    }

    .branch-settings-page.bm-page .branch-card-footer {
        flex-wrap: wrap;
    }

    .branch-settings-page.bm-page .btn-card {
        flex: 1 1 calc(50% - 0.3rem);
    }

    .branch-settings-page.bm-page .form-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .branch-settings-page.bm-page .modal-content {
        max-height: 100vh;
        border-radius: 14px;
    }
}
/* Expenses — scoped to .expenses-page, orange theme only */
.expenses-page { --exp-orange: #ea580c; --exp-orange-dark: #c2410c; --exp-tint: #fff7ed; --exp-border: #fed7aa;
  min-height: 100%; background: #fff; padding: 1rem; box-sizing: border-box; }
.expenses-container { max-width: 1480px; margin: 0 auto; }
.expenses-header { display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.exp-title { flex: 1; }
.expenses-header h1 { margin: 0; font-size: 1.7rem; letter-spacing: -.025em; color: #1f2937; }
.exp-title p { margin: .18rem 0 0; color: #6b7280; font-size: .92rem; }
.exp-back { background: none; border: 1px solid var(--exp-border); color: var(--exp-orange); border-radius: 10px; width: 40px; height: 40px; cursor: pointer; font-size: 1.1rem; }
.exp-btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 44px; padding: 0 1.1rem; border-radius: 10px;
  border: 1px solid #d1d5db; background: #fff; color: #374151; font-weight: 600; cursor: pointer; font-size: 1rem; }
.exp-btn.primary { background: linear-gradient(135deg, #f97316, var(--exp-orange)); border-color: var(--exp-orange); color: #fff; }
.exp-btn.outline { border-color: var(--exp-orange); color: var(--exp-orange); background: var(--exp-tint); }
.exp-btn:disabled { opacity: .6; cursor: default; }

.exp-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.exp-card { border: 1px solid var(--exp-border); background: var(--exp-tint); border-radius: 14px; padding: .9rem 1rem; display: flex; flex-direction: column; gap: .2rem; }
.exp-card span { color: #6b7280; font-size: .9rem; }
.exp-card strong { color: var(--exp-orange-dark); font-size: 1.5rem; }
.exp-card.small { background: #fff; }
.exp-card.small strong { font-size: 1.1rem; }
.exp-card small { color: #9a3412; }
.exp-card.key { background: #fff7ed; }
.exp-card.incoming { background: #f0fdf4; border-color: #bbf7d0; }
.exp-card.incoming strong { color: #15803d; }
.exp-card.incoming small { color: #166534; }

.exp-tabs { display: flex; gap: 1.5rem; border-bottom: 1px solid #e5e7eb; margin: .25rem 0 1rem; }
.exp-tabs button { border: 0; border-bottom: 3px solid transparent; background: none; padding: .75rem .15rem; color: #6b7280; font-weight: 700; cursor: pointer; }
.exp-tabs button.on { color: var(--exp-orange-dark); border-bottom-color: var(--exp-orange); }

.exp-toolbar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-bottom: 1rem; }
.exp-reset { border: 0; background: none; color: var(--exp-orange-dark); font-weight: 700; cursor: pointer; padding: .6rem; }
.exp-inline-dates { display: flex; align-items: center; gap: .5rem; }
.exp-inline-dates label { display: flex; align-items: center; gap: .35rem; color: #6b7280; font-size: .78rem; font-weight: 700; }
.exp-search { min-height: 42px; display: flex; align-items: center; gap: .4rem; padding: 0 .7rem; border: 1px solid #d1d5db; border-radius: 10px; background: #fff; color: #9ca3af; }
.exp-search input[type="text"] { border: 0; padding: 0; min-height: 38px; width: 180px; }
.exp-search input:focus { outline: 0; }
.exp-report-tools { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem 1rem; margin-bottom: 1rem; border: 1px solid #e5e7eb; border-radius: 14px; background: #fff; }
.exp-report-tools > div:first-child { display: flex; flex-direction: column; gap: .1rem; }
.exp-report-tools span { color: #9ca3af; font-size: .7rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.exp-report-tools strong { color: #1f2937; font-size: .95rem; }
.exp-report-tools small { color: #6b7280; font-size: .76rem; }
.exp-export-actions { display: flex; gap: .5rem; }
.exp-spin { animation: exp-spin .8s linear infinite; }
@keyframes exp-spin { to { transform: rotate(360deg); } }
.expenses-page select, .expenses-page input[type="text"], .expenses-page input[type="date"], .expenses-page input[type="number"] {
  min-height: 42px; padding: 0 .7rem; border: 1px solid #d1d5db; border-radius: 10px; font-size: 1rem; background: #fff; box-sizing: border-box; }
.expenses-page select:focus, .expenses-page input:focus { outline: 2px solid var(--exp-border); border-color: var(--exp-orange); }
.exp-strict { margin-left: auto; display: flex; align-items: center; gap: .4rem; font-size: .9rem; color: #374151; }
.exp-strict input { accent-color: var(--exp-orange); width: 18px; height: 18px; }
.exp-muted { color: #6b7280; }
.exp-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; border-radius: 10px; padding: .6rem .8rem; margin: .5rem 0; }

.exp-list { border: 1px solid #e5e7eb; border-radius: 14px; overflow: hidden; }
.exp-row { display: grid; grid-template-columns: 84px 1.5fr 120px 1fr 1fr 1fr 72px; gap: .65rem; padding: .75rem 1rem; align-items: center; border-top: 1px solid #f3f4f6; }
.exp-row.head { background: var(--exp-tint); color: var(--exp-orange-dark); font-weight: 700; font-size: .85rem; border-top: 0; }
.exp-row:not(.head):hover { background: #fffaf5; }
.exp-row .r { text-align: right; }
.exp-row .amt { font-weight: 700; }
.exp-row.expense .amt { color: #b45309; }
.exp-row.add_money .amt { color: #15803d; }
.exp-row small { display: block; color: #6b7280; font-size: .78rem; }
.exp-row .acts { display: flex; gap: .3rem; justify-content: flex-end; }
.exp-row .acts button { background: none; border: 0; color: var(--exp-orange); cursor: pointer; padding: .4rem; font-size: 1rem; }
.exp-type { display: inline-flex; align-items: center; gap: .3rem; width: fit-content; border-radius: 999px; padding: .28rem .5rem; background: #fff7ed; color: #9a3412; font-size: .78rem; font-weight: 700; }
.exp-type.add_money { background: #f0fdf4; color: #166534; }

.exp-report-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.exp-cash-card { margin-bottom: 1rem; border: 1px solid #fdba74; border-radius: 16px; padding: 1rem 1.1rem; background: linear-gradient(135deg, #fffaf5, #fff); }
.exp-cash-equation { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .55rem; }
.exp-cash-equation > div { display: flex; flex-direction: column; gap: .2rem; padding: .7rem .8rem; border: 1px solid #fed7aa; border-radius: 10px; background: #fff; }
.exp-cash-equation span { color: #6b7280; font-size: .76rem; }
.exp-cash-equation strong { color: #374151; font-size: .93rem; }
.exp-cash-equation .plus strong { color: #15803d; }
.exp-cash-equation .minus strong { color: #b45309; }
.exp-cash-equation .total { background: #fff7ed; border-color: #fb923c; }
.exp-cash-equation .total strong { color: #9a3412; font-size: 1.05rem; }
.exp-cash-note { margin: .65rem 0 0; color: #b45309; font-size: .78rem; font-weight: 600; }
.exp-report-card { border: 1px solid #e5e7eb; border-radius: 16px; padding: 1rem 1.1rem; min-width: 0; }
.exp-report-card.wide { grid-column: 1 / -1; }
.exp-section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: .75rem; }
.exp-section-head h2 { margin: 0; color: #1f2937; font-size: 1rem; }
.exp-section-head > strong { color: var(--exp-orange-dark); font-size: 1.1rem; }
.eyebrow { display: block; margin-bottom: .15rem; color: var(--exp-orange-dark); font-size: .68rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.eyebrow.green { color: #15803d; }
.exp-breakdown { display: grid; grid-template-columns: minmax(130px, .7fr) minmax(160px, 2fr) minmax(90px, auto); align-items: center; gap: 1rem; padding: .65rem 0; border-top: 1px solid #f3f4f6; }
.exp-breakdown b, .exp-simple-row b { color: #374151; font-size: .88rem; }
.exp-breakdown small, .exp-simple-row small { display: block; margin-top: .1rem; color: #9ca3af; font-size: .75rem; }
.exp-breakdown > strong, .exp-simple-row > strong { color: #374151; text-align: right; }
.exp-bar { height: 8px; border-radius: 999px; overflow: hidden; background: #ffedd5; }
.exp-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #fb923c, #ea580c); }
.exp-simple-row { display: flex; justify-content: space-between; gap: 1rem; padding: .65rem 0; border-top: 1px solid #f3f4f6; }
.exp-transaction-summary { display: grid; grid-template-columns: repeat(3, minmax(130px, 1fr)) auto; align-items: end; gap: .75rem; margin-bottom: .75rem; }
.exp-transaction-summary > div { display: flex; flex-direction: column; gap: .15rem; padding: .7rem .8rem; border: 1px solid #e5e7eb; border-radius: 10px; }
.exp-transaction-summary span { color: #6b7280; font-size: .75rem; }
.exp-transaction-summary strong { color: #9a3412; }
.exp-transaction-summary .incoming strong { color: #15803d; }
.exp-pagination { display: flex; justify-content: center; align-items: center; gap: .8rem; margin-top: 1rem; color: #6b7280; font-size: .85rem; }

.exp-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); display: flex; align-items: center; justify-content: center; z-index: 2000; padding: 1rem; }
.exp-modal { background: #fff; border-radius: 16px; width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto; padding: 1.2rem; display: flex; flex-direction: column; gap: .35rem; box-sizing: border-box; }
.exp-modal-head { display: flex; justify-content: space-between; align-items: center; }
.exp-modal-head h2 { margin: 0; color: #1f2937; }
.exp-modal-head button { background: none; border: 0; font-size: 1.3rem; cursor: pointer; color: #6b7280; }
.exp-mode { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; margin: .7rem 0 .25rem; }
.exp-mode button { display: grid; grid-template-columns: auto 1fr; column-gap: .4rem; align-items: center; text-align: left; border: 1px solid #d1d5db; border-radius: 12px; background: #fff; color: #374151; padding: .65rem .75rem; font-weight: 750; cursor: pointer; }
.exp-mode button svg { grid-row: 1 / 3; font-size: 1.15rem; }
.exp-mode button small { color: #9ca3af; font-size: .72rem; font-weight: 500; }
.exp-mode button.on { border-color: var(--exp-orange); background: var(--exp-tint); color: var(--exp-orange-dark); box-shadow: 0 0 0 1px var(--exp-orange); }
.exp-mode button.on.incoming { border-color: #22c55e; background: #f0fdf4; color: #166534; box-shadow: 0 0 0 1px #22c55e; }
.exp-mode button:disabled { cursor: default; opacity: .8; }
.exp-label { margin-top: .6rem; font-weight: 600; font-size: .9rem; color: #374151; }
.exp-chips { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.chip { min-height: 44px; padding: 0 1rem; border-radius: 12px; border: 1px solid #d1d5db; background: #fff; color: #374151; font-size: 1rem; cursor: pointer; }
.chip:hover { border-color: var(--exp-orange); background: var(--exp-tint); }
.chip.on { background: var(--exp-orange); border-color: var(--exp-orange); color: #fff; font-weight: 600; }
.chip.more { border-style: dashed; color: var(--exp-orange); }
.exp-hint { color: var(--exp-orange-dark); }
.exp-amount { display: flex; align-items: center; gap: .5rem; }
.exp-amount span { font-size: 1.3rem; color: var(--exp-orange-dark); font-weight: 700; min-width: 1.5rem; }
.exp-amount input { flex: 1; font-size: 1.4rem; font-weight: 700; min-height: 52px; }
.exp-actions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-end; margin-top: 1rem; }

@media (max-width: 640px) {
  .expenses-page { padding: .75rem; }
  .expenses-header { align-items: flex-start; flex-wrap: wrap; }
  .exp-title { min-width: calc(100% - 56px); }
  .expenses-header .primary { margin-left: 52px; }
  .exp-report-grid { grid-template-columns: 1fr; }
  .exp-report-tools { align-items: stretch; flex-direction: column; }
  .exp-export-actions .exp-btn { flex: 1; }
  .exp-inline-dates { width: 100%; flex-wrap: wrap; }
  .exp-inline-dates label { flex: 1; }
  .exp-inline-dates input { width: 100%; }
  .exp-cash-equation { grid-template-columns: 1fr; }
  .exp-transaction-summary { grid-template-columns: 1fr 1fr; }
  .exp-transaction-summary select { grid-column: 1 / -1; }
  .exp-report-card.wide { grid-column: auto; }
  .exp-breakdown { grid-template-columns: 1fr auto; gap: .35rem .75rem; }
  .exp-breakdown .exp-bar { grid-column: 1 / -1; grid-row: 2; }
  .exp-row.head { display: none; }
  .exp-row { grid-template-columns: 1fr auto; row-gap: .15rem; }
  .exp-row > span { grid-column: 1; }
  .exp-row .amt { grid-column: 2; grid-row: 1; font-size: 1.1rem; }
  .exp-row .acts { grid-column: 2; grid-row: 2; }
  .exp-row [data-label="Date"]::before, .exp-row [data-label="Paid By"]::before, .exp-row [data-label="Vendor"]::before {
    content: attr(data-label) ": "; color: #9ca3af; font-size: .78rem; }
  .exp-strict { margin-left: 0; }
  .exp-actions .exp-btn { flex: 1; }
}

.exp-modal select { width: 100%; }
.exp-add { display: flex; gap: .5rem; }
.exp-add input { flex: 1; }
.exp-tags { display: flex; flex-wrap: wrap; gap: .4rem; }
.tag { display: inline-flex; align-items: center; border: 1px solid #d1d5db; border-radius: 999px; overflow: hidden; background: #fff; }
.tag.on { border-color: var(--exp-orange); background: var(--exp-tint); }
.tag.blocked { background: #f3f4f6; color: #6b7280; }
.tag button { background: none; border: 0; padding: .35rem .6rem; cursor: pointer; font-size: .9rem; color: inherit; display: inline-flex; align-items: center; }
.tag button + button { padding-left: .2rem; color: var(--exp-orange); }
.tag button.txt { font-size: .8rem; text-decoration: underline; }

/* variables for modals rendered outside .expenses-page (e.g. in Settings) */
.exp-overlay { --exp-orange: #ea580c; --exp-orange-dark: #c2410c; --exp-tint: #fff7ed; --exp-border: #fed7aa; }
/* Kitchen Display (KOT) settings — same look as the rest of RPOS:
   warm off-white page, white rounded cards, warm borders, RPOS orange. */

.kdss-page {
    --kdss-accent: #e85d04;
    --kdss-accent-deep: #c2410c;
    --kdss-cream: #fff7f0;
    --kdss-track: #f6f1ea;
    --kdss-ring: #f5c4a0;
    --kdss-ink: #1f2430;
    --kdss-muted: #6b7280;
    --kdss-line: #ece5da;
    --kdss-ok: #16a34a;
    --kdss-warn: #f2a20c;
    --kdss-late: #dc2626;
    max-width: 1640px;
    padding-bottom: 6rem;
    color: var(--kdss-ink);
    font-family: 'Outfit', system-ui, sans-serif;
}

/* Header */
.kdss-hero { display: flex; align-items: center; gap: 1rem; margin: .25rem 0 1.25rem; }
.kdss-hero-icon { flex: none; width: 52px; height: 52px; display: grid; place-items: center; border-radius: 16px; background: var(--kdss-cream); color: var(--kdss-accent); font-size: 1.8rem; border: 1px solid #fde3cf; }
.kdss-hero h2 { margin: 0 0 .2rem; font-size: 1.6rem; font-weight: 800; color: var(--kdss-ink); }
.kdss-hero p { margin: 0; color: var(--kdss-muted); }
.kdss-branch { margin-left: auto; padding: .45rem .9rem; border-radius: 999px; background: var(--kdss-cream); color: var(--kdss-accent-deep); font-weight: 700; white-space: nowrap; border: 1px solid #fde3cf; }

/* Two columns: steps + sticky preview */
.kdss-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(380px, 46%); gap: 1.25rem; align-items: start; }
.kdss-steps { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }

.kdss-step { padding: 1.15rem 1.2rem 1.25rem; border: 1px solid var(--kdss-line); border-radius: 18px; background: #fff; scroll-margin-top: 1rem; }
.kdss-step-head { display: flex; align-items: flex-start; gap: .8rem; margin-bottom: 1rem; }
.kdss-step-n { flex: none; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: var(--kdss-accent); color: #fff; font-weight: 800; }
.kdss-step-head h3 { margin: .2rem 0 .2rem; font-size: 1.12rem; font-weight: 800; }
.kdss-step-head p { margin: 0; color: var(--kdss-muted); font-size: .92rem; line-height: 1.45; }
.kdss-muted { margin: .5rem 0 0; color: var(--kdss-muted); font-size: .86rem; line-height: 1.45; }

/* Step 1 — looks */
.kdss-looks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; }
.kdss-look {
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 2px solid var(--kdss-line);
    border-radius: 16px;
    background: #fff;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s, transform .15s;
}
.kdss-look:hover { border-color: var(--kdss-ring); transform: translateY(-1px); }
.kdss-look:focus-visible { outline: 3px solid var(--kdss-ring); outline-offset: 2px; }
.kdss-look.is-selected { border-color: var(--kdss-accent); box-shadow: 0 0 0 4px rgba(232, 93, 4, .12); }
.kdss-look-thumb { border-bottom: 1px solid var(--kdss-line); }
.kdss-look-text { display: flex; flex-direction: column; gap: .15rem; padding: .6rem .75rem .7rem; }
.kdss-look-text strong { font-size: .95rem; }
.kdss-look-text small { color: var(--kdss-muted); font-size: .8rem; line-height: 1.35; }
.kdss-look-check { position: absolute; top: .5rem; right: .5rem; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--kdss-accent); color: #fff; box-shadow: 0 2px 6px rgba(232, 93, 4, .4); }
.kdss-look-best { margin: .85rem 0 0; padding: .75rem .9rem; border-radius: 12px; background: var(--kdss-cream); color: #57534e; font-size: .9rem; line-height: 1.45; }
.kdss-look-best strong { color: var(--kdss-ink); }
.kdss-look-best em { font-style: normal; color: var(--kdss-accent-deep); font-weight: 600; }

/* Step 2 — timer colours */
.kdss-speeds { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
.kdss-speed {
    display: flex;
    flex-direction: column;
    gap: .4rem;
    padding: .85rem .95rem;
    border: 2px solid var(--kdss-line);
    border-radius: 14px;
    background: #fff;
    color: var(--kdss-ink);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
}
.kdss-speed:hover { border-color: var(--kdss-ring); }
.kdss-speed.is-selected { border-color: var(--kdss-accent); background: var(--kdss-cream); box-shadow: 0 0 0 4px rgba(232, 93, 4, .1); }
.kdss-speed-top { display: flex; align-items: center; justify-content: space-between; }
.kdss-speed-top strong { font-size: 1rem; }
.kdss-speed-top svg { color: var(--kdss-accent); }
.kdss-speed small { color: var(--kdss-muted); font-size: .84rem; }
.kdss-speed-times { display: flex; flex-wrap: wrap; gap: .25rem .9rem; font-size: .84rem; font-weight: 600; color: #57534e; }
.kdss-speed-times span { display: inline-flex; align-items: center; gap: .35rem; }
.kdss-speed-times i, .kdss-stepper-label i { width: .7rem; height: .7rem; border-radius: 50%; }
.kdss-speed-times i.is-warn { background: var(--kdss-warn); }
.kdss-speed-times i.is-late { background: var(--kdss-late); }
.kdss-bar { display: flex; height: 12px; overflow: hidden; border-radius: 999px; margin: .15rem 0; }
.kdss-bar span { display: block; }
.kdss-bar .is-ok { background: var(--kdss-ok); }
.kdss-bar .is-warn { background: var(--kdss-warn); }
.kdss-bar .is-late { background: var(--kdss-late); }
.kdss-custom { display: flex; flex-wrap: wrap; gap: 1rem 1.5rem; margin-top: .9rem; padding: .9rem 1rem; border-radius: 14px; background: var(--kdss-track); }

/* Stepper */
.kdss-stepper { display: flex; flex-direction: column; gap: .4rem; min-width: 0; }
.kdss-stepper-label { display: inline-flex; align-items: center; gap: .45rem; font-weight: 700; font-size: .92rem; }
.kdss-stepper-label i { display: none; }
.kdss-stepper[data-tone] .kdss-stepper-label i { display: inline-block; }
.kdss-stepper[data-tone="fresh"] .kdss-stepper-label i { background: var(--kdss-ok); }
.kdss-stepper[data-tone="warning"] .kdss-stepper-label i { background: var(--kdss-warn); }
.kdss-stepper[data-tone="critical"] .kdss-stepper-label i { background: var(--kdss-late); }
.kdss-stepper-control { display: inline-flex; align-items: center; width: fit-content; border: 1px solid var(--kdss-line); border-radius: 12px; overflow: hidden; background: #fff; }
.kdss-stepper-control button { width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: var(--kdss-cream); color: var(--kdss-accent-deep); cursor: pointer; font-size: 1rem; }
.kdss-stepper-control button:hover:not(:disabled) { background: #ffe8d6; }
.kdss-stepper-control button:disabled { opacity: .35; cursor: default; }
.kdss-stepper-control input { width: 3.4rem; height: 44px; border: 0; text-align: center; font: inherit; font-size: 1.15rem; font-weight: 800; color: var(--kdss-ink); -moz-appearance: textfield; }
.kdss-stepper-control input::-webkit-outer-spin-button, .kdss-stepper-control input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.kdss-stepper-unit { padding-right: .55rem; color: var(--kdss-muted); font-size: .85rem; font-weight: 600; }

/* Toggles */
.kdss-toggles { display: flex; flex-direction: column; }
.kdss-toggle { position: relative; display: flex; align-items: center; gap: 1rem; padding: .7rem 0; cursor: pointer; }
.kdss-toggles .kdss-toggle + .kdss-toggle { border-top: 1px solid #f3eee7; }
.kdss-toggle-text { flex: 1; display: flex; flex-direction: column; gap: .1rem; }
.kdss-toggle-text strong { font-weight: 700; }
.kdss-toggle-text small { color: var(--kdss-muted); line-height: 1.4; }
.kdss-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.kdss-switch { flex: none; position: relative; width: 50px; height: 30px; border-radius: 999px; background: #e2dcd3; transition: background .15s; }
.kdss-switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: transform .15s; }
.kdss-toggle input:checked + .kdss-switch { background: var(--kdss-accent); }
.kdss-toggle input:checked + .kdss-switch::after { transform: translateX(20px); }
.kdss-toggle input:focus-visible + .kdss-switch { outline: 3px solid var(--kdss-ring); outline-offset: 2px; }

/* Step 3 — sounds */
.kdss-tones { display: flex; flex-wrap: wrap; gap: .5rem; margin: .1rem 0 .6rem; }
.kdss-tone {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    min-height: 44px;
    padding: 0 1.1rem;
    border: 1px solid var(--kdss-line);
    border-radius: 999px;
    background: #fff;
    color: var(--kdss-ink);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}
.kdss-tone svg { color: var(--kdss-accent); font-size: .85rem; }
.kdss-tone:hover { border-color: var(--kdss-ring); }
.kdss-tone.is-selected { border-color: var(--kdss-accent); background: var(--kdss-accent); color: #fff; }
.kdss-tone.is-selected svg { color: #fff; }
.kdss-volume { display: flex; align-items: center; gap: .7rem; margin-top: .4rem; padding: .7rem .9rem; border-radius: 12px; background: var(--kdss-track); font-weight: 700; }
.kdss-volume svg { color: var(--kdss-accent); }
.kdss-volume input { flex: 1; accent-color: var(--kdss-accent); }
.kdss-volume strong { min-width: 3rem; text-align: right; font-variant-numeric: tabular-nums; }

/* Step 4 — size */
.kdss-sizes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .65rem; }
.kdss-size {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .2rem;
    padding: .85rem .95rem;
    border: 2px solid var(--kdss-line);
    border-radius: 14px;
    background: #fff;
    color: var(--kdss-ink);
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.kdss-size:hover { border-color: var(--kdss-ring); }
.kdss-size.is-selected { border-color: var(--kdss-accent); background: var(--kdss-cream); }
.kdss-size-aa { height: 2.2rem; display: flex; align-items: flex-end; font-weight: 800; line-height: 1; color: var(--kdss-accent); }
.kdss-size small { color: var(--kdss-muted); font-size: .82rem; line-height: 1.35; }

/* More options */
.kdss-more { border: 1px solid var(--kdss-line); border-radius: 18px; background: #fff; overflow: hidden; }
.kdss-more-toggle { display: flex; align-items: center; justify-content: space-between; gap: 1rem; width: 100%; padding: 1rem 1.2rem; border: 0; background: transparent; color: var(--kdss-ink); font: inherit; text-align: left; cursor: pointer; }
.kdss-more-toggle span { display: flex; flex-direction: column; gap: .15rem; }
.kdss-more-toggle strong { font-size: 1.05rem; }
.kdss-more-toggle small { color: var(--kdss-muted); }
.kdss-more-toggle svg { flex: none; font-size: 1.3rem; color: var(--kdss-accent); transition: transform .2s; }
.kdss-more.is-open .kdss-more-toggle svg { transform: rotate(180deg); }
.kdss-more-body { display: flex; flex-direction: column; gap: 1.1rem; padding: 0 1.2rem 1.3rem; border-top: 1px solid var(--kdss-line); }
.kdss-group { padding-top: 1.1rem; }
.kdss-group + .kdss-group { border-top: 1px dashed var(--kdss-line); }
.kdss-group h4 { margin: 0 0 .3rem; font-size: 1rem; font-weight: 800; }
.kdss-group > .kdss-stepper { margin-top: .6rem; }
.kdss-toggle-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.5rem; margin-top: .3rem; }
.kdss-toggle-grid .kdss-toggle { border-top: 1px solid #f3eee7; }
.kdss-select { width: 100%; max-width: 100%; min-height: 46px; padding: 0 .8rem; border: 1px solid var(--kdss-line); border-radius: 12px; background: #fff; color: var(--kdss-ink); font: inherit; font-weight: 600; }
.kdss-field { display: flex; flex-direction: column; gap: .4rem; margin-top: .7rem; font-weight: 700; font-size: .92rem; }
.kdss-input { min-height: 46px; padding: 0 .85rem; border: 1px solid var(--kdss-line); border-radius: 12px; background: #fff; color: var(--kdss-ink); font: inherit; font-weight: 700; }
.kdss-input:focus, .kdss-select:focus { outline: none; border-color: var(--kdss-accent); box-shadow: 0 0 0 3px rgba(232, 93, 4, .12); }

/* Stations */
.kdss-stations { display: flex; flex-direction: column; gap: .7rem; margin-top: .7rem; }
.kdss-station { padding: .85rem .9rem; border: 1px solid var(--kdss-line); border-left: 6px solid var(--station); border-radius: 14px; background: #fffdfa; }
.kdss-station-head { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; }
.kdss-station-name { flex: 1 1 200px; }
.kdss-station-colors { display: flex; gap: 5px; flex-wrap: wrap; }
.kdss-station-colors button { width: 24px; height: 24px; padding: 0; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px #ddd5ca; cursor: pointer; }
.kdss-station-colors button.is-selected { box-shadow: 0 0 0 2px var(--kdss-ink); }
.kdss-station-label { margin: .75rem 0 .45rem; color: var(--kdss-muted); font-size: .84rem; font-weight: 600; }
.kdss-cat-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.kdss-cat { display: inline-flex; align-items: center; gap: .3rem; min-height: 38px; padding: 0 .85rem; border: 1px solid var(--kdss-line); border-radius: 999px; background: #fff; color: var(--kdss-ink); font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer; }
.kdss-cat:hover { border-color: var(--kdss-ring); }
.kdss-cat.is-on { border-color: var(--kdss-accent); background: var(--kdss-accent); color: #fff; }
.kdss-cat.is-taken { color: #a8a29e; }
.kdss-cat small { color: #a8a29e; font-size: .75rem; }
.kdss-station-cap { margin-top: .8rem; }
.kdss-add { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 48px; border: 2px dashed var(--kdss-ring); border-radius: 14px; background: var(--kdss-cream); color: var(--kdss-accent-deep); font: inherit; font-weight: 800; cursor: pointer; }
.kdss-add:hover { border-color: var(--kdss-accent); }
.kdss-icon-btn { flex: none; width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid var(--kdss-line); border-radius: 12px; background: #fff; color: var(--kdss-muted); cursor: pointer; }
.kdss-icon-btn:hover { color: var(--kdss-accent-deep); border-color: var(--kdss-ring); }

/* Preview panel */
.kdss-preview {
    position: sticky;
    top: 1rem;
    display: flex;
    flex-direction: column;
    gap: .75rem;
    padding: 1rem;
    border: 1px solid var(--kdss-line);
    border-radius: 18px;
    background: #fff;
    min-width: 0;
}
.kdss-preview-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.kdss-preview-head strong { display: block; font-size: 1.08rem; }
.kdss-eyebrow { display: block; color: var(--kdss-accent); font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.kdss-preview-foot { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; color: var(--kdss-muted); font-size: .85rem; }
.kdss-seg { display: inline-flex; gap: 3px; padding: 4px; border-radius: 12px; background: var(--kdss-track); }
.kdss-seg button { display: inline-flex; align-items: center; gap: .35rem; min-height: 38px; padding: 0 .8rem; border: 0; border-radius: 9px; background: transparent; color: var(--kdss-muted); font: inherit; font-size: .88rem; font-weight: 700; cursor: pointer; }
.kdss-seg button.is-on { background: #fff; color: var(--kdss-accent-deep); box-shadow: 0 1px 3px rgba(31, 36, 48, .12); }

/* Buttons */
.kdss-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    min-height: 44px;
    padding: 0 1.1rem;
    border: 1px solid var(--kdss-accent);
    border-radius: 12px;
    background: #fff;
    color: var(--kdss-accent-deep);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}
.kdss-btn:hover:not(:disabled) { background: var(--kdss-cream); }
.kdss-btn.is-primary { min-width: 120px; background: var(--kdss-accent); color: #fff; box-shadow: 0 6px 14px -8px rgba(232, 93, 4, .8); }
.kdss-btn.is-primary:hover:not(:disabled) { background: var(--kdss-accent-deep); }
.kdss-btn:disabled { opacity: .45; cursor: default; box-shadow: none; }

/* Save bar */
.kdss-savebar {
    position: sticky;
    bottom: 1rem;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1.25rem;
    padding: .65rem .7rem .65rem 1.15rem;
    border: 1px solid var(--kdss-line);
    border-radius: 16px;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 14px 34px -18px rgba(31, 36, 48, .35);
    backdrop-filter: blur(6px);
}
.kdss-savebar.is-dirty { border-color: var(--kdss-ring); background: #fff9f4; }
.kdss-savebar-text { color: var(--kdss-muted); font-weight: 600; }
.kdss-savebar.is-dirty .kdss-savebar-text { color: var(--kdss-accent-deep); }
.kdss-savebar-actions { display: flex; gap: .5rem; }
.kdss-status.is-ok { color: #166534; }
.kdss-status.is-error { color: #b91c1c; }

/* Full-screen preview */
.kdss-full { position: fixed; inset: 0; z-index: 1400; display: flex; align-items: center; justify-content: center; padding: 1.5rem; background: rgba(31, 36, 48, .55); }
.kdss-full-panel { display: flex; flex-direction: column; gap: .8rem; width: min(100%, 1700px); max-height: 100%; padding: 1rem; border-radius: 20px; background: #fff; box-shadow: 0 2rem 4rem rgba(0, 0, 0, .3); }
.kdss-full-tools { display: flex; align-items: center; gap: .6rem; }
.kdss-full-stage { flex: 1; min-height: 0; display: flex; justify-content: center; }
.kdss-full-stage > .kds-preview { width: min(100%, calc((100dvh - 10rem) * var(--ratio))); }

/* Preview frame (every KDS preview on this page) */
.kds-preview { display: flex; flex-direction: column; gap: .5rem; min-width: 0; }
.kds-preview-viewport { position: relative; width: 100%; margin: 0 auto; overflow: hidden; border-radius: 12px; background: #faf7f2; box-shadow: inset 0 0 0 1px rgba(31, 36, 48, .08); }
.kds-preview.is-thumbnail .kds-preview-viewport { border-radius: 0; box-shadow: none; pointer-events: none; }
.kds-preview-scaler { position: absolute; top: 0; left: 0; transform-origin: top left; }
.kds-preview-scaler > .kds { height: 100%; }
.kds-preview-reset { align-self: flex-start; min-height: 36px; padding: 0 .9rem; border: 1px solid #e85d04; border-radius: 10px; background: #fff; color: #c2410c; font: inherit; font-weight: 700; font-size: .85rem; cursor: pointer; }

/* Entry card on Billing Settings */
.billing-kds-entry { margin-top: .75rem; }
.billing-kds-entry .billing-theme-entry-preview { grid-template-columns: repeat(3, 1fr); grid-template-rows: 1fr; }
.billing-kds-entry .billing-theme-entry-preview i { grid-row: auto !important; border-radius: 3px; }
.billing-kds-entry .billing-theme-entry-preview i:nth-child(1) { background: linear-gradient(#16a34a 30%, #e7f6ec 30%) !important; }
.billing-kds-entry .billing-theme-entry-preview i:nth-child(2) { background: linear-gradient(#f2a20c 30%, #fff3d6 30%); }
.billing-kds-entry .billing-theme-entry-preview i:nth-child(3) { background: linear-gradient(#dc2626 30%, #fdeaea 30%); }

@media (max-width: 1280px) {
    .kdss-looks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
    .kdss-layout { grid-template-columns: minmax(0, 1fr); }
    .kdss-preview { position: static; order: -1; }
}
@media (max-width: 768px) {
    .kdss-page { padding-bottom: 7rem; }
    .kdss-hero { flex-wrap: wrap; }
    .kdss-branch { margin-left: 0; }
    .kdss-step { padding: 1rem; }
    .kdss-speeds, .kdss-toggle-grid { grid-template-columns: minmax(0, 1fr); }
    .kdss-sizes { gap: .4rem; }
    .kdss-size { padding: .7rem; }
    .kdss-size small { display: none; }
    .kdss-seg span { display: none; }
    .kdss-savebar { bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
    .kdss-savebar-actions { width: 100%; }
    .kdss-savebar-actions .kdss-btn { flex: 1; }
    .kdss-full { padding: .5rem; }
}
@media (max-width: 480px) {
    .kdss-looks { gap: .5rem; }
    .kdss-look-text small { display: none; }
}

/* ── Stations & Smart KOT Routing page ─────────────────────────────────── */
.kdss-stack { display: flex; flex-direction: column; gap: 1rem; max-width: 1100px; }
.kdss-empty { margin: .25rem 0 .75rem; padding: .9rem 1rem; border: 1px dashed var(--kdss-line); border-radius: 12px; color: var(--kdss-muted); }
.kdss-footnote { margin-top: 1rem; }
.kdss-text-btn { padding: 0; border: 0; background: none; color: var(--kdss-accent-deep); font: inherit; font-weight: 700; cursor: pointer; text-decoration: underline; }

.kdss-st-list { display: flex; flex-direction: column; gap: .6rem; margin-bottom: .75rem; }
.kdss-st-row {
    display: grid;
    grid-template-columns: auto minmax(160px, 1fr) auto auto auto auto auto;
    align-items: center;
    gap: .7rem;
    padding: .7rem .85rem;
    border: 1px solid var(--kdss-line);
    border-left: 6px solid var(--station);
    border-radius: 14px;
    background: #fffdfa;
}
.kdss-st-row.is-off { background: #f8f6f3; }
.kdss-st-row .kdss-stepper-label { display: none; }
.kdss-st-row .kdss-toggle { padding: 0; gap: .5rem; }
.kdss-st-row .kdss-toggle-text strong { font-size: .85rem; color: var(--kdss-muted); }
.kdss-st-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--station); }
.kdss-st-count { color: var(--kdss-muted); font-size: .85rem; font-weight: 600; white-space: nowrap; }
.kdss-st-note { grid-column: 1 / -1; display: flex; gap: .45rem; align-items: flex-start; margin: 0; padding: .55rem .75rem; border-radius: 10px; background: #fff4e5; color: #8a4b00; font-size: .86rem; line-height: 1.4; }
.kdss-st-note svg { flex: none; margin-top: .15rem; }

.kdss-select--sm { width: auto; min-width: 180px; min-height: 42px; }
.kdss-warnings { display: flex; flex-direction: column; gap: .35rem; margin: .8rem 0 0; padding: 0; list-style: none; }
.kdss-warnings li { display: flex; gap: .45rem; align-items: flex-start; padding: .55rem .75rem; border-radius: 10px; background: #fff4e5; color: #8a4b00; font-size: .88rem; }
.kdss-warnings li.is-error { background: #fdeaea; color: #991b1b; }
.kdss-warnings svg { flex: none; margin-top: .15rem; }

.kdss-ct-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-bottom: .75rem; }
.kdss-search-box { display: flex; align-items: center; gap: .45rem; min-height: 44px; padding: 0 .8rem; border: 1px solid var(--kdss-line); border-radius: 12px; background: #fff; color: var(--kdss-muted); flex: 1 1 220px; max-width: 340px; }
.kdss-search-box:focus-within { border-color: var(--kdss-accent); box-shadow: 0 0 0 3px rgba(232, 93, 4, .1); }
.kdss-search-box input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; color: var(--kdss-ink); }
.kdss-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.kdss-chips button { display: inline-flex; align-items: center; gap: .4rem; min-height: 38px; padding: 0 .85rem; border: 1px solid var(--kdss-line); border-radius: 999px; background: #fff; color: var(--kdss-ink); font: inherit; font-size: .88rem; font-weight: 700; cursor: pointer; }
.kdss-chips button i { width: .6rem; height: .6rem; border-radius: 50%; background: var(--station, #78716c); }
.kdss-chips button b { color: var(--kdss-muted); font-weight: 700; }
.kdss-chips button.is-warn b { color: #b45309; }
.kdss-chips button.is-on { border-color: var(--kdss-accent); background: var(--kdss-accent); color: #fff; }
.kdss-chips button.is-on b { color: rgba(255, 255, 255, .85); }

.kdss-bulk { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-bottom: .75rem; padding: .6rem .8rem; border: 1px solid var(--kdss-ring); border-radius: 12px; background: var(--kdss-cream); }
.kdss-bulk strong { color: var(--kdss-accent-deep); }

.kdss-ct { border: 1px solid var(--kdss-line); border-radius: 14px; overflow: hidden; }
.kdss-ct-head, .kdss-ct-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) minmax(220px, 1.1fr); align-items: center; gap: .5rem; padding: .5rem .85rem; }
.kdss-ct--test .kdss-ct-head, .kdss-ct--test .kdss-ct-row { grid-template-columns: minmax(0, 1fr) minmax(0, .8fr) minmax(0, 1.4fr); }
.kdss-ct-head { background: var(--kdss-track); color: var(--kdss-muted); font-size: .78rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.kdss-ct-row { border-top: 1px solid #f3eee7; background: #fff; }
.kdss-ct-row.is-selected { background: var(--kdss-cream); }
.kdss-ct-row.is-problem { background: #fff8f3; }
.kdss-ct input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--kdss-accent); }
.kdss-ct-name { display: flex; flex-direction: column; min-width: 0; }
.kdss-ct-name small { color: var(--kdss-muted); font-size: .8rem; }
.kdss-ct-station { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.kdss-ct-dest { display: flex; flex-direction: column; align-items: flex-start; gap: .2rem; }
.kdss-ct-dest small { color: var(--kdss-muted); font-size: .8rem; }
.kdss-tag { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .55rem; border-radius: 999px; background: var(--kdss-track); color: var(--kdss-muted); font-size: .76rem; font-style: normal; font-weight: 700; }
.kdss-tag.is-warn { background: #fff4e5; color: #8a4b00; }

.kdss-details summary { list-style: none; }
.kdss-details summary::-webkit-details-marker { display: none; }
.kdss-details[open] summary { border-bottom: 1px solid var(--kdss-line); }
.kdss-pick { display: flex; flex-direction: column; gap: .4rem; margin: .7rem 0 0; padding: 0; list-style: none; }
.kdss-pick li { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; padding: .55rem .75rem; border: 1px solid var(--kdss-line); border-radius: 12px; background: #fff; }
.kdss-pick li > span { flex: 1; display: flex; flex-direction: column; min-width: 160px; }
.kdss-pick small { color: var(--kdss-muted); font-size: .8rem; }

/* Link card on the main Kitchen Display page */
.kdss-link-card { display: flex; align-items: center; gap: .9rem; width: 100%; padding: 1rem 1.1rem; border: 1px solid #fde3cf; border-radius: 18px; background: linear-gradient(135deg, #fff7f0, #fff); color: var(--kdss-ink); font: inherit; text-align: left; cursor: pointer; }
.kdss-link-card:hover { border-color: var(--kdss-accent); box-shadow: 0 10px 24px rgba(232, 93, 4, .1); }
.kdss-link-card > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; gap: .15rem; }
.kdss-link-card small { color: var(--kdss-muted); }
.kdss-link-icon { flex: none; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; background: #fff; border: 1px solid #fde3cf; color: var(--kdss-accent); font-size: 1.4rem; }
.kdss-link-go { color: var(--kdss-accent-deep); font-weight: 800; white-space: nowrap; }

@media (max-width: 900px) {
    .kdss-st-row { grid-template-columns: auto minmax(0, 1fr) auto; }
    .kdss-st-row .kdss-station-colors, .kdss-st-row .kdss-st-count { grid-column: 2 / -1; }
    .kdss-ct-head, .kdss-ct-row { grid-template-columns: 36px minmax(0, 1fr); }
    .kdss-ct-head > :last-child { display: none; }
    .kdss-ct-station { grid-column: 2; }
    .kdss-ct--test .kdss-ct-head, .kdss-ct--test .kdss-ct-row { grid-template-columns: minmax(0, 1fr); }
    .kdss-select--sm { min-width: 0; width: 100%; }
}
.order-workflow-page { max-width: 1100px; }
.workflow-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.workflow-card {
    display: flex; flex-direction: column; gap: .6rem; text-align: left; padding: 1.1rem 1.15rem 1.2rem;
    background: #fff; color: var(--text-color); border: 2px solid var(--border-color); border-radius: 16px; cursor: pointer;
    font-family: inherit; box-shadow: 0 2px 10px rgba(15, 23, 42, .05); transition: border-color .15s, box-shadow .15s, transform .15s;
}
.workflow-card:hover:not(:disabled) { border-color: var(--primary-color); transform: translateY(-2px); }
.workflow-card:focus-visible { outline: 3px solid rgba(232, 93, 4, .35); outline-offset: 2px; }
.workflow-card.is-selected { border-color: var(--primary-color); background: #fff7f0; box-shadow: 0 0 0 4px rgba(232, 93, 4, .12); }
.workflow-card-title { display: flex; justify-content: space-between; align-items: center; font-size: 1.15rem; font-weight: 700; }
.workflow-card-title em { font-style: normal; font-size: .72rem; font-weight: 700; color: #c2410c; background: #ffedd5; padding: .2rem .55rem; border-radius: 999px; }
.workflow-card-desc { color: var(--secondary-text-color); font-size: .88rem; line-height: 1.45; min-height: 2.6em; }
.workflow-steps { list-style: none; margin: .2rem 0 0; padding: 0; display: grid; gap: .15rem; }
.workflow-steps li { position: relative; padding: .38rem .7rem; font-size: .84rem; font-weight: 600; border-radius: 8px; background: #f1f3f5; color: #495057; }
.workflow-steps li + li { margin-top: .55rem; }
.workflow-steps li + li::before { content: '↓'; position: absolute; left: 50%; top: -.8rem; transform: translateX(-50%); color: var(--primary-color); font-weight: 700; }
.workflow-steps li.is-final { background: var(--primary-color); color: #fff; }
.workflow-custom { margin-bottom: 1.25rem; }
.workflow-custom h3 { margin: 0 0 .25rem; }
.workflow-hint { margin: 0 0 .9rem; color: var(--secondary-text-color); font-size: .9rem; }
.workflow-stage { display: flex; align-items: center; gap: .75rem; padding: .7rem .2rem; border-top: 1px solid var(--border-color); cursor: pointer; flex-wrap: wrap; }
.workflow-stage input { width: 22px; height: 22px; accent-color: var(--primary-color); }
.workflow-stage-name { font-weight: 600; }
.workflow-stage small { color: var(--secondary-text-color); }
.workflow-stage.is-locked { cursor: not-allowed; opacity: .8; }
.workflow-note { padding: .9rem 1.1rem; border-radius: 12px; background: #fff7f0; border: 1px solid #fed7aa; color: #7c2d12; font-size: .9rem; line-height: 1.5; margin-bottom: 1.25rem; }
.workflow-actions { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.workflow-actions .theme-select-btn { min-width: 160px; min-height: 46px; border-radius: 10px; font-weight: 700; cursor: pointer; }
.workflow-actions .theme-select-btn:disabled { cursor: default; }
.billing-workflow-entry { margin-top: .75rem; }
.billing-workflow-entry .billing-theme-entry-preview { grid-template-columns: repeat(4, 1fr); }
.kd-page{max-width:1200px;margin:0 auto;padding:clamp(18px,3vw,38px);color:#27211d}.kd-page>header{display:flex;justify-content:space-between;align-items:flex-start;gap:20px;margin-bottom:24px}.kd-page header p{margin:0;color:#c2410c;font-size:.78rem;font-weight:800;text-transform:uppercase;letter-spacing:.1em}.kd-page h1{margin:5px 0;font-size:2rem}.kd-page header span,.kd-page section>p{color:#71645b}.kd-page button{min-height:42px;display:inline-flex;align-items:center;justify-content:center;gap:7px;padding:0 14px;border:1px solid #e7d8cc;border-radius:10px;background:white;color:#573d2d;font-weight:750}.kd-page button:hover{border-color:#e85d04}.kd-page button:disabled{opacity:.45}.kd-page button.danger,.kd-row-actions button.danger{color:#b91c1c}.kd-message{display:flex;justify-content:space-between;align-items:center;margin-bottom:18px;padding:12px 14px;border-radius:10px;background:#fff7ed;color:#9a3412}.kd-message button{min-height:32px;border:0;background:none}.kd-add{display:flex;align-items:center;justify-content:space-between;gap:24px;padding:22px;border:1px solid #f0d8c4;border-radius:18px;background:linear-gradient(135deg,#fff8f1,#fff)}.kd-add>div:first-child{display:grid;grid-template-columns:auto 1fr;column-gap:12px}.kd-add>div:first-child>svg{grid-row:1/3;margin-top:4px;color:#e85d04;font-size:1.5rem}.kd-add h2,.kd-add p{margin:0}.kd-add p{grid-column:2;color:#76665b}.kd-add-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:8px}.kd-add-actions input{width:145px;min-height:44px;padding:0 12px;border:1px solid #dfd0c5;border-radius:10px;font:800 1.15rem ui-monospace,monospace;letter-spacing:.08em}.kd-add-actions>button:not(.secondary),.kd-actions>button:first-child{border-color:#e85d04;background:#e85d04;color:white}.kd-page section{margin-top:28px}.kd-grid{display:grid;gap:12px}.kd-request{display:grid;grid-template-columns:auto minmax(160px,1fr) auto auto;align-items:center;gap:16px;padding:18px;border:1px solid #eaded5;border-radius:16px;background:white}.kd-request h3,.kd-request p{margin:0}.kd-request small,.kd-request p,.kd-page td small{display:block;color:#7c6c61}.kd-device-icon{width:48px;height:48px;display:grid;place-items:center;border-radius:12px;background:#fff0e4;color:#c2410c;font-size:1.3rem}.kd-verify{text-align:center}.kd-verify span{display:block;color:#76665b;font-size:.74rem;text-transform:uppercase}.kd-verify strong{font:900 1.7rem ui-monospace,monospace;letter-spacing:.1em;color:#b45309}.kd-actions{display:flex;gap:8px}.kd-table-wrap{overflow-x:auto;border:1px solid #eaded5;border-radius:16px;background:white}.kd-page table{width:100%;border-collapse:collapse}.kd-page th,.kd-page td{padding:14px;text-align:left;border-bottom:1px solid #f0e9e4;white-space:nowrap}.kd-page th{background:#fbf7f4;color:#7c6c61;font-size:.72rem;text-transform:uppercase;letter-spacing:.07em}.kd-page td strong,.kd-page td span{display:block}.kd-page select{min-height:34px;margin-top:4px;border:1px solid #ddd0c6;border-radius:8px;background:white}.kd-status{width:max-content;padding:3px 8px;border-radius:999px;background:#f1f5f9;text-transform:capitalize;font-size:.78rem;font-weight:800}.kd-status.is-active{background:#dcfce7;color:#166534}.kd-status.is-revoked{background:#fee2e2;color:#991b1b}.kd-row-actions{display:flex;gap:6px}.kd-row-actions button{min-width:40px;padding:0}.kd-empty{padding:50px;text-align:center;border:1px dashed #dacabc;border-radius:16px;color:#7c6c61}.kd-empty svg{font-size:2rem}.kd-empty h3{color:#332a24}.kd-admin-qr,.kd-scanner{position:fixed;inset:0;z-index:2000;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:24px;background:rgba(28,21,17,.92);color:white;text-align:center}.kd-admin-qr>button{position:absolute;top:20px;right:20px}.kd-admin-qr img{width:min(360px,85vw);border-radius:16px}.kd-scanner video{width:min(620px,100%);max-height:75dvh;border:3px solid #fb923c;border-radius:18px}.kd-scanner button{margin-top:14px}@media(max-width:800px){.kd-add{align-items:stretch;flex-direction:column}.kd-add-actions{justify-content:flex-start}.kd-request{grid-template-columns:auto 1fr}.kd-verify,.kd-actions{grid-column:1/-1}.kd-actions button{flex:1}.kd-page>header{flex-direction:column}}@media(max-width:480px){.kd-page{padding:14px}.kd-add-actions>*{width:100%!important}.kd-request{grid-template-columns:1fr}.kd-device-icon{display:none}}

.kd-status.is-waiting{background:#fff4e5;color:#8a4b00}
.kd-page td small{white-space:normal;max-width:260px}

/* Confirm-it's-you dialog before approving a device */
.kd-reauth{position:fixed;inset:0;z-index:2100;display:grid;place-items:center;padding:20px;background:rgba(31,36,48,.5)}
.kd-reauth-card{width:min(420px,100%);display:flex;flex-direction:column;gap:12px;padding:24px;border-radius:20px;background:#fff;box-shadow:0 24px 60px rgba(31,36,48,.3);color:#27211d}
.kd-reauth-icon{width:48px;height:48px;display:grid;place-items:center;border-radius:14px;background:#fff0e4;color:#e85d04;font-size:1.4rem}
.kd-reauth-card h2{margin:0;font-size:1.35rem}
.kd-reauth-card p{margin:0;color:#71645b;line-height:1.45}
.kd-reauth-card label{display:flex;flex-direction:column;gap:6px;font-weight:700;font-size:.9rem}
.kd-reauth-card input{min-height:46px;padding:0 12px;border:1px solid #e7d8cc;border-radius:12px;font:inherit;font-weight:500}
.kd-reauth-card input[readonly]{background:#faf7f2;color:#71645b}
.kd-reauth-card input:focus{outline:none;border-color:#e85d04;box-shadow:0 0 0 3px rgba(232,93,4,.12)}
.kd-reauth-error{padding:10px 12px;border-radius:10px;background:#fdeaea;color:#991b1b!important;font-weight:600}
.kd-reauth-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:4px}
.kd-reauth-actions button{min-height:44px;padding:0 16px;border:1px solid #e7d8cc;border-radius:12px;background:#fff;color:#573d2d;font-weight:750;cursor:pointer}
.kd-reauth-actions button.primary{border-color:#e85d04;background:#e85d04;color:#fff}
.kd-reauth-actions button:disabled{opacity:.5;cursor:default}
:root { color-scheme: light; }
.kp-shell { min-height: 100dvh; display:grid; place-items:center; padding:clamp(16px,4vw,48px); background:radial-gradient(circle at 15% 10%,#ffd7b5 0,transparent 30%),radial-gradient(circle at 90% 80%,#ffe8b6 0,transparent 28%),#fff8f1; color:#241c16; font-family:Inter,system-ui,sans-serif; }
.kp-panel { width:min(980px,100%); padding:clamp(20px,4vw,48px); border:1px solid #f0d9c6; border-radius:32px; background:rgba(255,255,255,.94); box-shadow:0 30px 80px rgba(80,45,20,.15); }
.kp-brand { display:flex; align-items:center; gap:12px; }.kp-brand>div{display:flex;flex-direction:column}.kp-brand strong{font-size:1.1rem}.kp-brand small{color:#7a6759}.kp-logo{width:52px;height:52px;padding:4px;box-sizing:border-box;border-radius:14px;background:#fff;border:1px solid #f0d9c6;object-fit:contain}
.kp-copy{text-align:center;max-width:650px;margin:30px auto 22px}.kp-copy h1{margin:8px 0;font-size:clamp(2rem,5vw,3.6rem);line-height:1}.kp-copy p{color:#6f5e52;line-height:1.6}.kp-kicker{display:inline-flex;align-items:center;gap:7px!important;margin:0!important;color:#c2410c!important;font-weight:800;text-transform:uppercase;letter-spacing:.1em;font-size:.78rem}
.kp-name{display:flex;flex-direction:column;gap:6px;max-width:420px;margin:0 auto 24px;color:#6f5e52;font-size:.78rem;font-weight:800;text-transform:uppercase;letter-spacing:.08em}.kp-name input{min-height:48px;padding:0 14px;border:1px solid #e4d5c9;border-radius:12px;background:white;color:#241c16;font:600 1rem inherit;text-transform:none;letter-spacing:0}
.kp-methods{display:grid;grid-template-columns:1fr auto 1fr;align-items:stretch;gap:22px}.kp-methods article{position:relative;min-width:0;padding:22px;border:1px solid #eee2d8;border-radius:22px;background:#fffaf6;text-align:center}.kp-methods h2{margin:3px 0;font-size:1.25rem}.kp-methods p{min-height:40px;margin:4px 0 14px;color:#7a6759;font-size:.9rem}.kp-step{position:absolute;top:14px;left:14px;width:28px;height:28px;display:grid;place-items:center;border-radius:50%;background:#ffedd5;color:#c2410c;font-weight:900}.kp-qr img,.kp-qr-placeholder{width:min(240px,100%);aspect-ratio:1;border-radius:12px;background:#fff}.kp-code{display:flex;flex-direction:column;align-items:center;justify-content:center}.kp-code output{display:block;margin:24px 0 14px;font:900 clamp(2rem,6vw,3.4rem)/1 ui-monospace,monospace;letter-spacing:.12em;color:#c2410c}.kp-code button,.kp-retry{min-height:44px;display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:0 18px;border:1px solid #f1b482;border-radius:12px;background:#fff;color:#c2410c;font-weight:800}.kp-or{display:grid;place-items:center}.kp-or span{width:38px;height:38px;display:grid;place-items:center;border-radius:50%;background:#f4ebe4;color:#8a7667;font-size:.78rem;font-weight:800;text-transform:uppercase}
.kp-state{min-height:54px;display:flex;align-items:center;justify-content:center;gap:9px;margin-top:22px;padding:12px 16px;border-radius:14px;background:#fff1e7;color:#9a3412;text-align:center;font-weight:700}.kp-state--pending{background:#fff7d6;color:#854d0e}.kp-state--approved{background:#dcfce7;color:#166534}.kp-state--offline,.kp-state--error{background:#fee2e2;color:#991b1b}.kp-state strong{font:900 1.45rem ui-monospace,monospace;letter-spacing:.1em}.kp-retry{display:flex;margin:14px auto 0}.kp-panel footer{display:flex;align-items:center;justify-content:center;gap:8px;margin-top:18px;color:#8a7667;font-size:.82rem}.kp-panel footer button{border:0;background:none;color:#c2410c;font-weight:800;text-decoration:underline}.kp-scanner{position:fixed;inset:0;z-index:10;display:grid;place-items:center;padding:20px;background:rgba(20,15,12,.9)}.kp-scanner video{width:min(560px,100%);max-height:70dvh;border:3px solid #fb923c;border-radius:20px}.kp-scanner button{position:absolute;bottom:30px;min-height:48px;padding:0 22px;border:0;border-radius:999px;background:white;color:#9a3412;font-weight:800}.kp-camera-error{text-align:center;color:#991b1b;font-size:.82rem}.is-spin{animation:kp-spin 1s linear infinite}@keyframes kp-spin{to{transform:rotate(360deg)}}
@media(max-width:700px){.kp-shell{padding:0}.kp-panel{min-height:100dvh;border:0;border-radius:0}.kp-methods{grid-template-columns:1fr}.kp-or{margin:-12px 0}.kp-copy{margin-top:22px}.kp-methods article{padding:18px}.kp-code output{margin:14px 0}.kp-panel footer{align-items:flex-start;text-align:center}}
@media(prefers-reduced-motion:reduce){.is-spin{animation:none}}
.kds-device-signout{position:fixed;right:max(10px,env(safe-area-inset-right));bottom:max(10px,env(safe-area-inset-bottom));z-index:1100;min-width:48px;min-height:48px;display:flex;align-items:center;justify-content:center;gap:7px;padding:0 13px;border:1px solid rgba(255,255,255,.35);border-radius:999px;background:rgba(36,28,22,.82);color:white;backdrop-filter:blur(8px);font-weight:800}.main-wrapper--kds-only>.app-container.kds-mode{padding:0;height:100dvh}.main-wrapper--kds-only{height:100dvh;overflow:hidden}
@media(max-width:600px){.kds-device-signout span{display:none}.kds-device-signout{right:8px;bottom:8px;padding:0}}
/* Paired display that could not check in: shown on top, retried automatically. */
.kds-device-problem{position:fixed;top:0;left:0;right:0;z-index:1150;padding:8px 14px;background:#fff4e5;color:#8a4b00;font-weight:700;font-size:.9rem;text-align:center;border-bottom:1px solid #f5c4a0}
.kp-help{max-width:620px;margin:10px auto 0;color:#7c2d12;font-size:.88rem;line-height:1.5;text-align:center}
.onboarding-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.onboarding-container {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 700px;
    width: 100%;
    padding: 3rem;
}

.onboarding-header {
    text-align: center;
    margin-bottom: 2rem;
}

.onboarding-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 1.5rem;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s ease;
}

.step-indicator {
    color: #6b7280;
    font-size: 0.875rem;
    font-weight: 500;
}

/* Choice Step Styles */
.choice-step {
    text-align: center;
}

.choice-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

.choice-card {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 1rem;
    padding: 2rem;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.choice-card:hover {
    border-color: #667eea;
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.2);
}

.choice-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.choice-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.choice-card p {
    color: #6b7280;
    margin-bottom: 1.5rem;
}

.choice-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.choice-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(102, 126, 234, 0.3);
}

.choice-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.invite-input-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.invite-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
}

.invite-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}


.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: #6b7280;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
    font-weight: 500;
}

.checkbox-label:hover {
    border-color: #667eea;
    background: #f9fafb;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin: 0;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"]:checked+span,
.checkbox-label:has(input[type="checkbox"]:checked) {
    color: #667eea;
}

.onboarding-actions {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
}

.btn-primary,
.btn-secondary {
    padding: 0.75rem 2rem;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    flex: 1;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background: white;
    color: #374151;
    border: 1px solid #d1d5db;
}

.btn-secondary:hover:not(:disabled) {
    background: #f9fafb;
    border-color: #9ca3af;
}

/* Responsive */
@media (max-width: 768px) {
    .onboarding-page {
        padding: 1rem;
    }

    .onboarding-container {
        padding: 2rem 1.5rem;
    }

    .onboarding-header h1 {
        font-size: 1.5rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .checkbox-grid {
        grid-template-columns: 1fr;
    }

    .onboarding-actions {
        flex-direction: column-reverse;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
    }
}/* Glassmorphism Widget */
.sales-widget {
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    border-radius: 16px;
    animation: fadeIn 0.5s ease;
}

.glass {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Widget Header */
.widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.widget-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.widget-icon {
    font-size: 1.5rem;
    color: #667eea;
}

.widget-title h3 {
    margin: 0;
    font-size: 1.25rem;
    color: #333;
    font-weight: 600;
}

.view-dashboard-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.view-dashboard-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

/* Sales Stats */
.sales-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(31, 38, 135, 0.1);
}

.stat-card:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 24px rgba(31, 38, 135, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.stat-card.highlight {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(102, 126, 234, 0.5);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.stat-label {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stat-value.positive {
    color: #4CAF50;
}

.stat-value.negative {
    color: #f44336;
}

.stat-meta {
    font-size: 0.8rem;
    color: #999;
}

/* Mini Chart */
.mini-chart {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
}

.chart-label {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 1rem;
    font-weight: 600;
}

.chart-bars {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    height: 120px;
    padding: 0.5rem 0;
}

.chart-bar-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.chart-bar {
    width: 100%;
    min-height: 20px;
    background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
    border-radius: 6px 6px 0 0;
    position: relative;
    transition: all 0.3s ease;
    cursor: pointer;
}

.chart-bar:hover {
    opacity: 0.8;
    transform: scaleY(1.05);
}

.bar-value {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7rem;
    font-weight: 600;
    color: #667eea;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.chart-bar:hover .bar-value {
    opacity: 1;
}

.chart-label-x {
    font-size: 0.7rem;
    color: #999;
    text-align: center;
    white-space: nowrap;
}

/* Loading State */
.widget-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    gap: 1rem;
}

.loading-spinner-small {
    width: 32px;
    height: 32px;
    border: 3px solid #f0f0f0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.widget-loading p {
    color: #999;
    font-size: 0.9rem;
    margin: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .sales-widget {
        padding: 1rem;
    }

    .widget-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .view-dashboard-btn {
        width: 100%;
        justify-content: center;
    }

    .sales-stats {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .chart-bars {
        height: 100px;
    }

    .chart-label-x {
        font-size: 0.65rem;
    }
}

@media (max-width: 480px) {
    .widget-title h3 {
        font-size: 1.1rem;
    }

    .stat-value {
        font-size: 1.25rem;
    }

    .chart-bars {
        height: 80px;
        gap: 0.25rem;
    }
}.messaging-page {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

/* Header */
.messaging-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: white;
    border-bottom: 1px solid #e0e0e0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    z-index: 10;
}

.back-button {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.back-button:hover {
    background-color: #f0f0f0;
    color: #333;
}

.header-user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.user-avatar-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.1rem;
}

.user-details h2 {
    margin: 0;
    font-size: 1.1rem;
    color: #333;
}

.status-indicator {
    font-size: 0.85rem;
    color: #999;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.status-indicator.online {
    color: #4CAF50;
}

.status-indicator.online::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #4CAF50;
    border-radius: 50%;
    display: inline-block;
}

.more-button {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: #666;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.more-button:hover {
    background-color: #f0f0f0;
    color: #333;
}

/* Toggle Widget Button */
.toggle-widget-button {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: #667eea;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-widget-button:hover {
    background-color: rgba(102, 126, 234, 0.1);
    color: #764ba2;
    transform: scale(1.1);
}

/* Content Wrapper for Sales Widget */
.messaging-content-wrapper {
    padding: 1.5rem;
    background: transparent;
}

/* Messages Container */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background: transparent;
}

.messages-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.no-messages {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: #999;
}

.no-messages-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.no-messages p {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #666;
}

.no-messages span {
    font-size: 0.95rem;
    color: #999;
}

/* Message Bubbles */
.message-bubble {
    display: flex;
    flex-direction: column;
    max-width: 70%;
    animation: messageSlideIn 0.3s ease;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-bubble.sent {
    align-self: flex-end;
}

.message-bubble.received {
    align-self: flex-start;
}

.message-content {
    padding: 0.75rem 1rem;
    border-radius: 18px;
    word-wrap: break-word;
}

.message-bubble.sent .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.message-bubble.received .message-content {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.message-content p {
    margin: 0;
    line-height: 1.4;
    font-size: 0.95rem;
}

.message-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.25rem;
    padding: 0 0.5rem;
    font-size: 0.75rem;
    color: #999;
}

.message-bubble.sent .message-meta {
    justify-content: flex-end;
}

.message-bubble.received .message-meta {
    justify-content: flex-start;
}

.message-status {
    display: flex;
    align-items: center;
}

.read-icon {
    color: #4CAF50;
}

.sent-icon {
    color: #999;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.75rem 1rem;
    background: white;
    border-radius: 18px;
    width: fit-content;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-10px);
    }
}

/* Message Input */
.message-input-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background: white;
    border-top: 1px solid #e0e0e0;
}

.message-input {
    flex: 1;
    padding: 0.875rem 1.25rem;
    border: 1px solid #e0e0e0;
    border-radius: 24px;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.2s ease;
    background: #f8f9fa;
}

.message-input:focus {
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.message-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.send-button {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.send-button:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.send-button:active:not(:disabled) {
    transform: scale(0.95);
}

.send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Loading State */
.messaging-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: calc(100vh - 80px);
    gap: 1rem;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #f0f0f0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.messaging-loading p {
    color: #999;
    font-size: 1rem;
}

/* Error State */
.messaging-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: calc(100vh - 80px);
    gap: 1.5rem;
    text-align: center;
    padding: 2rem;
}

.messaging-error p {
    color: #e74c3c;
    font-size: 1.1rem;
    max-width: 400px;
}

.messaging-error button {
    padding: 0.75rem 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.messaging-error button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

/* Responsive */
@media (max-width: 768px) {
    .messaging-header {
        padding: 0.75rem 1rem;
    }

    .user-details h2 {
        font-size: 1rem;
    }

    .status-indicator {
        font-size: 0.75rem;
    }

    .messages-container {
        padding: 1rem;
    }

    .message-bubble {
        max-width: 85%;
    }

    .message-content {
        padding: 0.625rem 0.875rem;
    }

    .message-input-container {
        padding: 0.75rem 1rem;
    }

    .send-button {
        width: 44px;
        height: 44px;
    }
}

/* Scrollbar Styling */
.messages-container::-webkit-scrollbar {
    width: 6px;
}

.messages-container::-webkit-scrollbar-track {
    background: transparent;
}

.messages-container::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.messages-container::-webkit-scrollbar-thumb:hover {
    background: #999;
}.stock-management-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    padding: 2rem;
}

.stock-management-container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Header */
.page-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.back-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.back-button:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateX(-4px);
}

.back-button svg {
    font-size: 1.25rem;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.header-icon {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    color: white;
    margin: 0;
}

.page-subtitle {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.9);
    margin: 0.25rem 0 0 0;
}

/* Form Card */
.stock-form-card {
    background: white;
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    margin-bottom: 2rem;
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f3f4f6;
}

.form-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
}

.form-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

/* Form Grid */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 600;
    color: #374151;
    font-size: 0.95rem;
}

.required {
    color: #ef4444;
}

.form-input,
.form-textarea,
.form-select {
    padding: 0.75rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    font-family: inherit;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: #f97316;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 45px;
}

.form-select {
    cursor: pointer;
    background-color: white;
}

.form-select optgroup {
    font-weight: bold;
    font-style: normal;
    color: #f97316;
    background: #fff3e0;
    padding: 0.5rem 0;
}

.form-select option {
    font-weight: normal;
    color: #374151;
    background: white;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.btn-submit,
.btn-cancel {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 2rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-submit {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(249, 115, 22, 0.4);
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(249, 115, 22, 0.6);
}

.btn-cancel {
    background: #f3f4f6;
    color: #374151;
}

.btn-cancel:hover {
    background: #e5e7eb;
}

/* Stock List Card */
.stock-list-card {
    background: white;
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: fadeInUp 0.7s ease-out;
}

.list-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f3f4f6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.list-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    margin: 0;
}

/* Text Alignment Utilities */
.text-right {
    text-align: right;
}

.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

/* Table */
.stock-table-wrapper {
    overflow-x: auto;
}

.stock-table {
    width: 100%;
    border-collapse: collapse;
}

.stock-table thead {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
}

.stock-table th {
    padding: 0.85rem 1rem;
    text-align: left;
    color: white;
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

/* Allow utility classes to override th alignment */
.stock-table th.text-right { text-align: right; }
.stock-table th.text-center { text-align: center; }
.stock-table th.text-left  { text-align: left; }

.stock-table th:first-child {
    border-top-left-radius: 12px;
}

.stock-table th:last-child {
    border-top-right-radius: 12px;
}

.stock-table tbody tr {
    border-bottom: 1px solid #f3f4f6;
    transition: all 0.3s ease;
}

.stock-table tbody tr:hover {
    background: rgba(249, 115, 22, 0.05);
}

.stock-table td {
    padding: 0.85rem 1rem;
    color: #374151;
    font-size: 0.9rem;
    vertical-align: middle;
}

.stock-table .item-name {
    font-weight: 600;
    color: #111827;
}

.stock-table .quantity,
.stock-table .unit {
    font-weight: 500;
}

.stock-table .price {
    font-weight: 600;
    color: #059669;
}

.stock-table .actions {
    display: flex;
    gap: 0.5rem;
}

.btn-edit,
.btn-delete {
    padding: 0.5rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-edit {
    background: #dbeafe;
    color: #1e40af;
}

.btn-edit:hover {
    background: #bfdbfe;
    transform: scale(1.1);
}

.btn-delete {
    background: #fee2e2;
    color: #991b1b;
}

.btn-delete:hover {
    background: #fecaca;
    transform: scale(1.1);
}

/* Empty State */
.empty-state {
    background: white;
    border-radius: 20px;
    padding: 4rem 2rem;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: fadeInUp 0.7s ease-out;
}

.empty-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 3rem;
}

.empty-state h3 {
    font-size: 1.5rem;
    color: #111827;
    margin: 0 0 0.5rem 0;
}

.empty-state p {
    color: #6b7280;
    font-size: 1rem;
    margin: 0;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .form-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .stock-management-page {
        padding: 1rem;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .header-content {
        width: 100%;
    }

    .page-title {
        font-size: 1.75rem;
    }

    .stock-form-card,
    .stock-list-card {
        padding: 1.5rem;
    }

    .form-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .form-actions {
        flex-direction: column-reverse;
    }

    .btn-submit,
    .btn-cancel {
        width: 100%;
        justify-content: center;
    }

    .stock-table-wrapper {
        overflow-x: scroll;
    }

    .stock-table {
        min-width: 800px;
    }
}

@media (max-width: 480px) {
    .page-title {
        font-size: 1.5rem;
    }

    .header-icon {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }

    .stock-form-card,
    .stock-list-card,
    .empty-state {
        padding: 1.25rem;
    }

    .form-header h2 {
        font-size: 1.25rem;
    }

    .form-icon {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }
}.combobox-container {
    position: relative;
    width: 100%;
}

.combobox-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.combobox-input-container {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
}

.combobox-input {
    width: 100%;
    padding: 10px 12px;
    padding-right: 35px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
    background: white;
}

.btn-input-add {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    background: #10b981;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-input-add:hover {
    background: #059669;
    transform: translateY(-1px);
}

.btn-input-add:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    transform: none;
}

.combobox-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.combobox-arrow {
    position: absolute;
    right: 12px;
    color: #64748b;
    pointer-events: none;
    transition: transform 0.2s ease;
}

.combobox-container.is-open .combobox-arrow {
    transform: rotate(180deg);
}

.combobox-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    margin-top: 4px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    max-height: 250px;
    overflow-y: auto;
}

.combobox-list {
    list-style: none;
    padding: 4px 0;
    margin: 0;
}

.combobox-item {
    padding: 10px 12px;
    font-size: 14px;
    color: #1e293b;
    cursor: pointer;
    transition: background 0.1s ease;
}

.combobox-item:hover,
.combobox-item.is-selected {
    background-color: #f1f5f9;
}

.combobox-item.is-active {
    background-color: #eff6ff;
    color: #1d4ed8;
}

.combobox-no-results {
    padding: 12px;
    font-size: 14px;
    color: #64748b;
    text-align: center;
}

.combobox-add-new {
    border-top: 1px solid #e2e8f0;
    padding: 8px;
    background: #f8fafc;
}

.btn-add-new {
    width: 100%;
    padding: 8px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background 0.2s ease;
}

.btn-add-new:hover {
    background: #2563eb;
}

/* Custom scrollbar for dropdown */
.combobox-dropdown::-webkit-scrollbar {
    width: 6px;
}

.combobox-dropdown::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.combobox-dropdown::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.combobox-dropdown::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}/* Autocomplete Styles */
.autocomplete-wrapper {
    position: relative;
}

.search-input-wrapper {
    position: relative;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 1.1rem;
    pointer-events: none;
}

.search-input {
    padding-left: 3rem !important;
}

.searching-indicator {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.85rem;
    color: #f97316;
    font-weight: 500;
}

.suggestions-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #f97316;
    border-top: none;
    border-radius: 0 0 10px 10px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    margin: 0;
    padding: 0;
    list-style: none;
}

.suggestion-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid #f3f4f6;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: rgba(249, 115, 22, 0.1);
}

.suggestion-name {
    font-weight: 600;
    color: #111827;
    margin-bottom: 0.25rem;
}

.suggestion-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
}

.suggestion-category {
    color: #6b7280;
    background: #f3f4f6;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
}

.suggestion-unit {
    color: #f97316;
    font-weight: 500;
}

.no-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #e5e7eb;
    border-top: none;
    border-radius: 0 0 10px 10px;
    padding: 1rem;
    color: #6b7280;
    text-align: center;
    font-size: 0.9rem;
    z-index: 1000;
}

.no-suggestions--nav {
    text-align: left;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.no-suggestions-title {
    font-size: 12.5px;
    color: #374151;
    margin: 0;
}

.no-suggestions-body {
    font-size: 12px;
    color: #6b7280;
    margin: 0;
    line-height: 1.5;
}

.no-suggestions-nav-btn {
    align-self: flex-start;
    margin-top: 2px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 600;
    background: #eff6ff;
    color: #2563eb;
    border: 1.5px solid #93c5fd;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.12s;
    white-space: nowrap;
}

.no-suggestions-nav-btn:hover {
    background: #dbeafe;
}

/* Loading State */
.loading-state {
    text-align: center;
    padding: 4rem 2rem;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 1rem;
    border: 4px solid #f3f4f6;
    border-top-color: #f97316;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-state p {
    color: #6b7280;
    font-size: 1rem;
    margin: 0;
}/* Stock Batches Page Styles */
.stock-batches-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    padding: 2rem;
}

.stock-batches-container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Header */
.page-header {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.back-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: #f5f5f5;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    color: #333;
    cursor: pointer;
    transition: all 0.2s;
}

.back-button:hover {
    background: #e0e0e0;
    transform: translateX(-4px);
}

.header-content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.header-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.8rem;
}

.page-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0;
}

.page-subtitle {
    font-size: 0.95rem;
    color: #666;
    margin: 0.25rem 0 0 0;
}

.refresh-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.refresh-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.4);
}

.refresh-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.spinning {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.2s;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.stat-content h3 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0;
}

.stat-content p {
    font-size: 0.9rem;
    color: #666;
    margin: 0.25rem 0 0 0;
}

/* Controls Section */
.controls-section {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.view-toggle {
    display: flex;
    gap: 0.5rem;
    background: #f5f5f5;
    padding: 0.25rem;
    border-radius: 8px;
}

.view-toggle button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.view-toggle button.active {
    background: white;
    color: #f97316;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.filters {
    display: flex;
    gap: 1rem;
    flex: 1;
    justify-content: flex-end;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #f5f5f5;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    flex: 1;
    max-width: 400px;
}

.search-box svg {
    color: #999;
    font-size: 1.2rem;
}

.search-box input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 0.95rem;
    color: #333;
    outline: none;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #f5f5f5;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
}

.filter-group svg {
    color: #999;
    font-size: 1.2rem;
}

.filter-group select {
    border: none;
    background: transparent;
    font-size: 0.95rem;
    color: #333;
    outline: none;
    cursor: pointer;
    font-weight: 500;
}

/* Tables */
.summary-table-card,
.batches-table-card {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.summary-table-card h2,
.batches-table-card h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 1.5rem 0;
}

.table-wrapper {
    overflow-x: auto;
}

.summary-table,
.batches-table {
    width: 100%;
    border-collapse: collapse;
}

.summary-table thead,
.batches-table thead {
    background: #f8f9fa;
}

.summary-table th,
.batches-table th {
    padding: 1rem;
    text-align: left;
    font-size: 0.85rem;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e0e0e0;
}

.summary-table td,
.batches-table td {
    padding: 1rem;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.95rem;
    color: #333;
}

.summary-table tbody tr:hover,
.batches-table tbody tr:hover {
    background: #f8f9fa;
}

.ingredient-name {
    font-weight: 600;
    color: #1a1a1a;
}

.quantity,
.value,
.total-cost {
    font-weight: 600;
    color: #f97316;
}

.batch-count {
    background: #e3f2fd;
    color: #1976d2;
    padding: 4px 12px;
    border-radius: 12px;
    display: inline-block;
    font-weight: 500;
    font-size: 0.85rem;
}

.expiry-date {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #666;
}

.batch-number {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: #f97316;
}

.remaining {
    position: relative;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
    margin-top: 0.5rem;
    overflow: hidden;
}

.progress {
    height: 100%;
    background: linear-gradient(90deg, #4caf50 0%, #45a049 100%);
    border-radius: 2px;
    transition: width 0.3s;
}

.expiry-cell {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.expiry-warning {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.batches-table tr.depleted {
    opacity: 0.6;
}

.batches-table tr.expired {
    background: #ffebee;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem !important;
    color: #999;
}

.empty-state svg {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state p {
    font-size: 1rem;
    margin: 0;
}

/* Loading State */
.loading-state {
    text-align: center;
    padding: 4rem 2rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #f0f0f0;
    border-top-color: #f97316;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

.loading-state p {
    color: #666;
    font-size: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .stock-batches-page {
        padding: 1rem;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .controls-section {
        flex-direction: column;
        align-items: stretch;
    }

    .filters {
        flex-direction: column;
    }

    .search-box {
        max-width: none;
    }

    .table-wrapper {
        overflow-x: scroll;
    }
}/* ============================================
   STOCK ALLOCATION PAGE — Production CSS
   ============================================ */

/* --- Page Layout --- */
.stock-allocation-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 50%, #5b21b6 100%);
    padding: 2rem;
    font-family: 'Inter', 'Segoe UI', -apple-system, sans-serif;
}

.stock-allocation-container {
    max-width: 1440px;
    margin: 0 auto;
}

/* --- Header --- */
.sa-header {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.sa-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1.2rem;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
}

.sa-back-btn:hover {
    background: rgba(255, 255, 255, 0.22);
    transform: translateX(-3px);
}

.sa-header-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    min-width: 0;
}

.sa-header-icon {
    width: 52px;
    height: 52px;
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(12px);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.6rem;
    flex-shrink: 0;
}

.sa-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: white;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.sa-pending-badge {
    font-size: 0.7rem;
    font-weight: 700;
    background: #f59e0b;
    color: #1e293b;
    padding: 0.2rem 0.7rem;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    animation: sa-pulse 2s ease-in-out infinite;
}

@keyframes sa-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.65;
    }
}

.sa-subtitle {
    font-size: 0.88rem;
    color: rgba(255, 255, 255, 0.8);
    margin: 0.2rem 0 0 0;
}

.sa-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sa-date-picker {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    padding: 0.45rem 0.9rem;
    color: white;
}

.sa-date-picker label {
    font-weight: 500;
    font-size: 0.85rem;
}

.sa-date-picker input {
    background: transparent;
    border: none;
    color: white;
    font-size: 0.88rem;
    outline: none;
    cursor: pointer;
}

.sa-date-picker input::-webkit-calendar-picker-indicator {
    filter: invert(1);
}

.sa-refresh-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.25s ease;
}

.sa-refresh-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.22);
    transform: rotate(90deg);
}

.sa-refresh-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.sa-spinning svg {
    animation: sa-spin 0.8s linear infinite;
}

/* --- Stats Bar --- */
.sa-stats-bar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.sa-stat {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-radius: 12px;
    font-size: 0.82rem;
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    white-space: nowrap;
}

.sa-stat-warning {
    background: rgba(245, 158, 11, 0.2);
    color: #fef3c7;
}

.sa-stat-ok {
    background: rgba(34, 197, 94, 0.15);
    color: #dcfce7;
}

.sa-stat-info {
    background: rgba(99, 102, 241, 0.15);
    color: #e0e7ff;
}

.sa-stat-muted {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.75rem;
}

/* --- Loading --- */
.sa-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 5rem;
    color: white;
    font-size: 1.05rem;
}

.sa-spinner {
    width: 22px;
    height: 22px;
    border: 3px solid rgba(255, 255, 255, 0.25);
    border-top-color: white;
    border-radius: 50%;
    animation: sa-spin 0.7s linear infinite;
}

@keyframes sa-spin {
    to {
        transform: rotate(360deg);
    }
}

/* --- Sections --- */
.sa-section {
    background: white;
    border-radius: 18px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
    animation: sa-cardIn 0.3s ease;
}

@keyframes sa-cardIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sa-section-completed {
    background: #fafff8;
    border: 1px solid #e6f4e0;
}

.sa-section-header {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.sa-section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.sa-section-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem 0;
    width: 100%;
    margin-bottom: 0.5rem;
    color: #64748b;
    font-size: 1rem;
    transition: color 0.2s;
}

.sa-section-toggle:hover {
    color: #1e293b;
}

.sa-section-toggle .sa-section-title {
    pointer-events: none;
}

.sa-count-badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.15rem 0.55rem;
    border-radius: 20px;
    margin-left: 0.25rem;
}

.sa-count-warning {
    background: #fef3c7;
    color: #92400e;
}

.sa-count-ok {
    background: #dcfce7;
    color: #166534;
}

/* --- Filter Bar --- */
.sa-filter-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sa-filter-input-wrap {
    position: relative;
    flex: 1;
    max-width: 420px;
}

.sa-filter-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    width: 15px;
    height: 15px;
    pointer-events: none;
}

.sa-filter-input {
    width: 100%;
    padding: 0.5rem 2rem 0.5rem 2rem;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.82rem;
    background: #f8fafc;
    color: #334155;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.sa-filter-input:focus {
    border-color: #7c3aed;
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.08);
    background: white;
}

.sa-filter-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 2px;
    display: flex;
    align-items: center;
}

.sa-filter-clear:hover {
    color: #ef4444;
}

/* --- Empty State --- */
.sa-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 3rem 2rem;
    text-align: center;
}

.sa-empty-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #22c55e;
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.sa-empty h3 {
    margin: 0;
    font-size: 1.1rem;
    color: #1e293b;
    font-weight: 600;
}

.sa-empty p {
    margin: 0;
    font-size: 0.9rem;
    color: #94a3b8;
}

.sa-today-btn {
    margin-top: 0.5rem;
    padding: 0.5rem 1.2rem;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    color: #6d28d9;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.sa-today-btn:hover {
    background: #ede9fe;
    border-color: #c4b5fd;
}

/* --- Table --- */
.sa-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.sa-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.88rem;
}

.sa-table thead th {
    text-align: left;
    padding: 0.65rem 0.75rem;
    background: #f8fafc;
    color: #64748b;
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}

.sa-table thead th:first-child {
    border-radius: 8px 0 0 0;
}

.sa-table thead th:last-child {
    border-radius: 0 8px 0 0;
}

.sa-table tbody td {
    padding: 0.7rem 0.75rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.sa-table tfoot td {
    padding: 0.75rem;
    border-top: 2px solid #e2e8f0;
    background: #f8fafc;
}

.sa-table-row {
    transition: background 0.2s, opacity 0.3s;
}

.sa-table-row:hover {
    background: #faf5ff;
}

.sa-row-processing {
    opacity: 0.6;
    pointer-events: none;
}

/* --- Ingredient cell --- */
.sa-ingredient-cell {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.sa-ingredient-cell strong {
    font-size: 0.92rem;
    color: #1e293b;
}

.sa-meta {
    font-size: 0.75rem;
    color: #94a3b8;
}

.sa-meta-time {
    font-size: 0.7rem;
    color: #c084fc;
    font-weight: 500;
}

/* --- Required qty --- */
.sa-required-qty {
    font-weight: 600;
    color: #6d28d9;
    font-size: 0.9rem;
    white-space: nowrap;
}

.sa-completed-qty {
    font-weight: 500;
    color: #475569;
    font-size: 0.85rem;
}

/* --- Search cell --- */
.sa-search-cell {
    min-width: 200px;
    position: relative;
}

.sa-stock-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    margin-top: 4px;
    padding: 3px 8px;
    border-radius: 6px;
    font-weight: 500;
    animation: sa-fadeIn 0.2s ease;
}

@keyframes sa-fadeIn {
    from {
        opacity: 0;
        transform: translateY(-2px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sa-stock-ok {
    background: #f0fdf4;
    color: #166534;
}

.sa-stock-low {
    background: #fef2f2;
    color: #991b1b;
}

/* --- Qty input --- */
.sa-qty-input {
    width: 75px;
    padding: 0.45rem 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.88rem;
    background: white;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.sa-qty-input:focus {
    border-color: #7c3aed;
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.08);
}

.sa-qty-input:disabled {
    background: #f8fafc;
    cursor: not-allowed;
}

/* --- Unit select --- */
.sa-unit-select {
    padding: 0.45rem 0.35rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.82rem;
    background: white;
    outline: none;
    transition: border-color 0.2s;
    width: 100%;
}

.sa-unit-select:focus {
    border-color: #7c3aed;
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.08);
}

.sa-unit-select:disabled {
    background: #f8fafc;
    cursor: not-allowed;
}

/* --- Deduct button --- */
.sa-deduct-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 0.85rem;
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(109, 40, 217, 0.15);
}

.sa-deduct-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(109, 40, 217, 0.3);
}

.sa-deduct-btn:active:not(:disabled) {
    transform: translateY(0);
}

.sa-deduct-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.sa-btn-loading {
    min-width: 80px;
    justify-content: center;
}

.sa-btn-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: sa-spin 0.6s linear infinite;
}

/* --- Completed table --- */
.sa-table-completed tbody td {
    background: #fafff8;
}

.sa-table-completed tbody tr:hover td {
    background: #f0fdf4;
}

.sa-detail-line {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
    color: #475569;
    padding: 2px 0;
}

.sa-detail-qty {
    font-size: 0.72rem;
    color: #94a3b8;
    margin-left: auto;
}

.sa-no-detail {
    color: #cbd5e1;
}

.sa-cost {
    color: #166534;
    font-weight: 600;
    font-size: 0.85rem;
}

/* --- Warning rows --- */
.sa-row-warning {
    background: #fffbeb !important;
}

.sa-row-warning:hover {
    background: #fef3c7 !important;
}

/* --- Selected row --- */
.sa-row-selected {
    background: #f5f3ff !important;
    border-left: 3px solid #7c3aed;
}

.sa-row-selected:hover {
    background: #ede9fe !important;
}

/* --- Deduction Form --- */
.sa-deduct-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.sa-deduct-selected {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    background: linear-gradient(135deg, #f5f3ff, #ede9fe);
    border: 1px solid #ddd6fe;
    border-radius: 12px;
    padding: 1rem 1.25rem;
}

.sa-deduct-selected-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.sa-deduct-selected-info strong {
    font-size: 1.05rem;
    color: #1e293b;
}

.sa-deduct-clear {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    color: #94a3b8;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s;
}

.sa-deduct-clear:hover {
    color: #ef4444;
    border-color: #fecaca;
    background: #fef2f2;
}

.sa-deduct-fields {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.75rem;
}

.sa-deduct-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.sa-deduct-field label {
    font-size: 0.78rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.sa-deduct-field-full {
    grid-column: 1 / -1;
}

.sa-deduct-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    padding-top: 0.5rem;
    border-top: 1px solid #f1f5f9;
}

/* =============================================
   DIALOGS (Confirm + Insufficient)
   ============================================= */
.sa-dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 1rem;
    animation: sa-overlayIn 0.2s ease;
}

@keyframes sa-overlayIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.sa-dialog {
    background: white;
    border-radius: 20px;
    padding: 2rem 2.25rem;
    max-width: 440px;
    width: 100%;
    text-align: center;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18);
    animation: sa-dialogIn 0.25s ease;
}

@keyframes sa-dialogIn {
    from {
        transform: scale(0.95) translateY(12px);
        opacity: 0;
    }

    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.sa-dialog-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
}

.sa-dialog-icon-warning {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #d97706;
}

.sa-dialog-icon-confirm {
    background: linear-gradient(135deg, #ede9fe, #ddd6fe);
    color: #7c3aed;
}

.sa-dialog-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 0.4rem 0;
}

.sa-dialog-message {
    font-size: 0.88rem;
    color: #64748b;
    margin: 0 0 1.25rem 0;
    line-height: 1.5;
}

.sa-dialog-details {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 0.85rem 1rem;
    text-align: left;
    margin-bottom: 1rem;
}

.sa-dialog-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0;
    font-size: 0.85rem;
    color: #475569;
}

.sa-dialog-row+.sa-dialog-row {
    border-top: 1px solid #f1f5f9;
}

.sa-dialog-required {
    color: #6d28d9;
}

.sa-dialog-available {
    color: #dc2626;
}

.sa-dialog-deficit {
    background: #fef2f2;
    margin: 0.5rem -1rem -0.85rem;
    padding: 0.6rem 1rem !important;
    border-radius: 0 0 12px 12px;
    font-weight: 600;
    color: #991b1b !important;
}

.sa-dialog-deficit strong {
    color: #dc2626;
}

.sa-dialog-help {
    font-size: 0.8rem;
    color: #94a3b8;
    margin: 0 0 1.25rem 0;
    line-height: 1.5;
}

.sa-dialog-actions {
    display: flex;
    gap: 0.75rem;
}

.sa-dialog-btn {
    flex: 1;
    padding: 0.7rem 1rem;
    border: none;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}

.sa-dialog-btn-full {
    width: 100%;
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: white;
}

.sa-dialog-btn-full:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(109, 40, 217, 0.3);
}

.sa-dialog-btn-cancel {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.sa-dialog-btn-cancel:hover {
    background: #e2e8f0;
}

.sa-dialog-btn-confirm {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: white;
}

.sa-dialog-btn-confirm:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(109, 40, 217, 0.3);
}

/* =============================================
   TOAST NOTIFICATIONS
   ============================================= */
.sa-toast-container {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 11000;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    max-width: 400px;
    width: 100%;
    pointer-events: none;
}

.sa-toast {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-radius: 14px;
    background: white;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.06);
    pointer-events: auto;
    animation: sa-toastIn 0.35s ease;
    border-left: 4px solid transparent;
}

@keyframes sa-toastIn {
    from {
        opacity: 0;
        transform: translateX(30px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

.sa-toast-success {
    border-left-color: #22c55e;
}

.sa-toast-error {
    border-left-color: #ef4444;
}

.sa-toast-warning {
    border-left-color: #f59e0b;
}

.sa-toast-info {
    border-left-color: #6366f1;
}

.sa-toast-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.85rem;
}

.sa-toast-success .sa-toast-icon {
    background: #f0fdf4;
    color: #22c55e;
}

.sa-toast-error .sa-toast-icon {
    background: #fef2f2;
    color: #ef4444;
}

.sa-toast-warning .sa-toast-icon {
    background: #fffbeb;
    color: #f59e0b;
}

.sa-toast-info .sa-toast-icon {
    background: #eef2ff;
    color: #6366f1;
}

.sa-toast-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.sa-toast-content strong {
    font-size: 0.82rem;
    color: #1e293b;
}

.sa-toast-content span {
    font-size: 0.78rem;
    color: #64748b;
    line-height: 1.4;
}

.sa-toast-close {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 2px;
    display: flex;
    font-size: 0.9rem;
    transition: color 0.15s;
    flex-shrink: 0;
}

.sa-toast-close:hover {
    color: #ef4444;
}

/* =============================================
   MOBILE RESPONSIVE
   ============================================= */
@media (max-width: 1024px) {
    .sa-search-cell {
        min-width: 180px;
    }
}

@media (max-width: 768px) {
    .sa-deduct-fields {
        grid-template-columns: 1fr;
    }

    .stock-allocation-page {
        padding: 1rem 0.75rem;
    }

    .sa-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .sa-header-actions {
        width: 100%;
        justify-content: space-between;
    }

    .sa-title {
        font-size: 1.35rem;
    }

    .sa-stats-bar {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .sa-stat {
        font-size: 0.75rem;
        padding: 0.4rem 0.7rem;
    }

    .sa-section {
        padding: 1rem;
        border-radius: 14px;
    }

    .sa-filter-input-wrap {
        max-width: 100%;
    }

    /* Mobile card view for table */
    .sa-table thead {
        display: none;
    }

    .sa-table,
    .sa-table tbody,
    .sa-table tr,
    .sa-table td {
        display: block;
        width: 100%;
    }

    .sa-table tbody tr {
        background: white;
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        padding: 0.75rem;
        margin-bottom: 0.75rem;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    }

    .sa-table tbody tr:hover {
        border-color: #c4b5fd;
    }

    .sa-table tbody td {
        padding: 0.35rem 0;
        border-bottom: none;
    }

    .sa-table tbody td:before {
        content: attr(data-label);
        font-size: 0.7rem;
        font-weight: 600;
        color: #94a3b8;
        text-transform: uppercase;
        letter-spacing: 0.3px;
        display: block;
        margin-bottom: 2px;
    }

    .sa-search-cell {
        min-width: unset;
    }

    .sa-qty-input {
        width: 100%;
    }

    .sa-unit-select {
        width: 100%;
    }

    .sa-deduct-btn {
        width: 100%;
        justify-content: center;
        padding: 0.65rem;
    }

    /* Completed table mobile */
    .sa-table-completed tbody tr {
        background: #fafff8;
    }

    .sa-table tfoot {
        display: block;
    }

    .sa-table tfoot tr {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.75rem;
        background: #f8fafc;
        border-radius: 10px;
        border: 1px solid #e2e8f0;
    }

    .sa-table tfoot td {
        padding: 0;
        border: none;
    }

    .sa-dialog {
        padding: 1.5rem;
        max-width: 95vw;
    }

    .sa-dialog-actions {
        flex-direction: column;
    }

    .sa-toast-container {
        top: auto;
        bottom: 1rem;
        right: 0.75rem;
        left: 0.75rem;
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .stock-allocation-page {
        padding: 0.75rem 0.5rem;
    }

    .sa-title {
        font-size: 1.15rem;
    }

    .sa-header-icon {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
        border-radius: 10px;
    }

    .sa-back-btn {
        padding: 0.45rem 0.8rem;
        font-size: 0.82rem;
    }
}

/* --- NEW CSS for Allocation System --- */
.sa-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.sa-tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    backdrop-filter: blur(8px);
    white-space: nowrap;
}

.sa-tab:hover {
    background: rgba(255, 255, 255, 0.25);
    color: white;
}

.sa-tab.active {
    background: white;
    color: #6d28d9;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.sa-badge-count {
    background: #ef4444;
    color: white;
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
}

/* --- CARD GRID --- */
.sa-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.sa-allocation-card {
    background: white;
    border-radius: 16px;
    padding: 1.25rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid #e2e8f0;
}

.sa-allocation-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 20px rgba(0, 0, 0, 0.1);
}

.sa-card-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.sa-order-badge {
    background: #ede9fe;
    color: #6d28d9;
    font-weight: 700;
    font-size: 0.8rem;
    padding: 0.25rem 0.6rem;
    border-radius: 8px;
}

.sa-time-badge {
    font-size: 0.75rem;
    color: #94a3b8;
}

.sa-card-body h4 {
    margin: 0 0 0.25rem 0;
    font-size: 1.1rem;
    color: #1e293b;
}

.sa-menu-usage {
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: 1rem;
}

.sa-req-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.sa-allocate-btn {
    width: 100%;
    padding: 0.75rem;
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.sa-allocate-btn:hover {
    opacity: 0.9;
}

/* --- MODAL --- */
.sa-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: sa-fadeIn 0.2s;
}

.sa-modal {
    background: white;
    width: 90%;
    max-width: 550px;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    animation: sa-slideUp 0.3s;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.sa-modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sa-modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
    color: #1e293b;
}

.sa-close-btn {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: #94a3b8;
}

.sa-modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

.sa-allocation-info {
    background: #f8fafc;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.sa-info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: #475569;
}

.sa-info-row:last-child {
    margin-bottom: 0;
}

.sa-text-danger {
    color: #dc2626;
}

.sa-source-selection h3 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
    color: #1e293b;
}

.sa-alt-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.sa-alt-option {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.sa-alt-option:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.sa-alt-option.selected {
    background: #f5f3ff;
    border-color: #7c3aed;
    box-shadow: 0 0 0 1px #7c3aed inset;
}

.sa-alt-details {
    flex: 1;
}

.sa-alt-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: #1e293b;
}

.sa-alt-meta {
    font-size: 0.8rem;
    color: #64748b;
}

.sa-modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #f1f5f9;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.sa-btn-text {
    background: none;
    border: none;
    color: #64748b;
    font-weight: 600;
    cursor: pointer;
}

.sa-btn-primary {
    background: #7c3aed;
    color: white;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
}

.sa-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* --- Manual --- */
.sa-manual-layout {
    display: flex;
    gap: 1.5rem;
    height: calc(100vh - 200px);
}

.sa-manual-form {
    flex: 1;
    background: white;
    padding: 1.5rem;
    border-radius: 16px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.sa-stock-list-panel {
    width: 350px;
    background: white;
    display: flex;
    flex-direction: column;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.sa-search-bar {
    padding: 1rem;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sa-search-bar input {
    border: none;
    outline: none;
    width: 100%;
    font-size: 0.9rem;
}

.sa-stock-list {
    flex: 1;
    overflow-y: auto;
}

.sa-stock-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
}

.sa-stock-item:hover {
    background: #f8fafc;
}

@keyframes sa-fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes sa-slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =============================================
   3-COLUMN ALLOCATION LAYOUT
   ============================================= */

.sa-alloc-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.sa-alloc-header-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1.5fr;
    gap: 1rem;
    padding: 0.65rem 1rem;
    background: #f8fafc;
    border-radius: 10px 10px 0 0;
    border-bottom: 2px solid #e2e8f0;
}

.sa-alloc-header-row .sa-alloc-col {
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #64748b;
}

.sa-alloc-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1.5fr;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.2s;
    align-items: flex-start;
}

.sa-alloc-row:hover {
    background: #faf5ff;
}

.sa-alloc-row:last-child {
    border-bottom: none;
}

/* Column 1: Ingredient */
.sa-alloc-ing-name {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.25rem;
}

.sa-alloc-ing-name strong {
    font-size: 0.92rem;
    color: #1e293b;
}

.sa-alloc-ing-icon {
    color: #7c3aed;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.sa-alloc-ing-qty {
    font-size: 0.8rem;
    font-weight: 600;
    color: #6d28d9;
    margin-bottom: 0.3rem;
}

.sa-alloc-alt-list {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.sa-alloc-alt-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.68rem;
    font-weight: 500;
    border-radius: 8px;
    background: #fff7ed;
    color: #9a3412;
    width: fit-content;
}

/* Column 2: Recipe / Food Item */
.sa-alloc-recipe-name {
    font-size: 0.92rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.2rem;
}

.sa-alloc-menu-item {
    font-size: 0.78rem;
    color: #64748b;
    margin-bottom: 0.2rem;
}

.sa-alloc-recipe-qty {
    font-size: 0.78rem;
    color: #94a3b8;
}

.sa-alloc-recipe-qty strong {
    color: #6d28d9;
}

/* Column 3: Stock search + deduction */
.sa-alloc-search-wrap {
    width: 100%;
    position: relative;
}

.sa-alloc-deduct-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
}

.sa-alloc-selected-stock {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    padding: 0.45rem 0.65rem;
    flex-wrap: wrap;
}

.sa-alloc-stock-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: #166534;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sa-alloc-stock-avail {
    font-size: 0.7rem;
    color: #15803d;
    font-weight: 500;
    white-space: nowrap;
}

.sa-alloc-clear-btn {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    color: #94a3b8;
    cursor: pointer;
    flex-shrink: 0;
    font-size: 0.75rem;
    transition: all 0.2s;
}

.sa-alloc-clear-btn:hover {
    color: #ef4444;
    border-color: #fecaca;
    background: #fef2f2;
}

.sa-alloc-deduct-inputs {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.sa-alloc-qty-input {
    width: 70px;
    padding: 0.4rem 0.45rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.82rem;
    background: white;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.sa-alloc-qty-input:focus {
    border-color: #7c3aed;
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.08);
}

.sa-alloc-qty-input:disabled {
    background: #f8fafc;
    cursor: not-allowed;
}

.sa-alloc-unit-select {
    padding: 0.4rem 0.3rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.78rem;
    background: white;
    outline: none;
    transition: border-color 0.2s;
    min-width: 60px;
}

.sa-alloc-unit-select:focus {
    border-color: #7c3aed;
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.08);
}

.sa-alloc-unit-select:disabled {
    background: #f8fafc;
    cursor: not-allowed;
}

.sa-alloc-deduct-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.4rem 0.75rem;
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(109, 40, 217, 0.15);
}

.sa-alloc-deduct-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(109, 40, 217, 0.3);
}

.sa-alloc-deduct-btn:active:not(:disabled) {
    transform: translateY(0);
}

.sa-alloc-deduct-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* =============================================
   RESPONSIVE OVERRIDES
   ============================================= */
@media (max-width: 1024px) {

    .sa-alloc-header-row,
    .sa-alloc-row {
        grid-template-columns: 1fr 1fr;
    }

    .sa-alloc-col-deduct {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {
    .sa-manual-layout {
        flex-direction: column;
        height: auto;
    }

    .sa-stock-list-panel {
        width: 100%;
        max-height: 400px;
    }

    .sa-alloc-header-row {
        display: none;
    }

    .sa-alloc-row {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        padding: 1rem;
        border: 1px solid #f1f5f9;
        border-radius: 12px;
        margin-bottom: 0.5rem;
        background: white;
    }

    .sa-alloc-row:hover {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    }

    .sa-alloc-col-ingredient::before {
        content: 'Alternative Ingredient';
        display: block;
        font-size: 0.68rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        color: #94a3b8;
        font-weight: 600;
        margin-bottom: 0.3rem;
    }

    .sa-alloc-col-recipe::before {
        content: 'Used In';
        display: block;
        font-size: 0.68rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        color: #94a3b8;
        font-weight: 600;
        margin-bottom: 0.3rem;
    }

    .sa-alloc-col-deduct::before {
        content: 'Deduct from Stock';
        display: block;
        font-size: 0.68rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        color: #94a3b8;
        font-weight: 600;
        margin-bottom: 0.3rem;
    }

    .stock-allocation-page {
        padding: 1rem;
    }

    .sa-alloc-deduct-inputs {
        flex-wrap: wrap;
    }
}

/* ============================================
   ALTERNATIVE INGREDIENT RECOMMENDATIONS
   ============================================ */

.sa-alloc-recommendations {
    margin-bottom: 0.5rem;
}

.sa-alloc-rec-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 0.35rem;
}

.sa-alloc-rec-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-bottom: 0.4rem;
}

.sa-alloc-rec-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.7rem;
    background: #ede9fe;
    border: 1px solid #ddd6fe;
    border-radius: 8px;
    color: #6d28d9;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.sa-alloc-rec-btn:hover {
    background: #ddd6fe;
    border-color: #c4b5fd;
    transform: translateY(-1px);
}

/* Alt buttons with quantity badge */
.sa-alloc-rec-btn--alt {
    background: #fef3c7;
    border-color: #fbbf24;
    color: #92400e;
}
.sa-alloc-rec-btn--alt:hover {
    background: #fde68a;
    border-color: #f59e0b;
}

.sa-alt-qty-badge {
    display: inline-block;
    background: #f59e0b;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 4px;
    margin-left: 2px;
}

.sa-alloc-rec-ratio {
    font-size: 0.68rem;
    color: #8b5cf6;
    font-weight: 400;
}

/* Read-only quantity/unit styles */
.sa-alloc-qty-input[readonly],
.sa-alloc-qty-input:disabled {
    background: #f5f3ff;
    border-color: #ede9fe;
    color: #6d28d9;
    font-weight: 600;
    cursor: default;
    opacity: 1;
}

.sa-alloc-unit-select:disabled {
    background: #f5f3ff;
    border-color: #ede9fe;
    color: #6d28d9;
    font-weight: 600;
    cursor: default;
    opacity: 1;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* =============================================
   MULTI-SOURCE ALLOCATION — NEW CLASSES
   ============================================= */

/* Balance bar */
.sa-alloc-balance-bar {
    margin-bottom: 0.6rem;
}

.sa-alloc-balance-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.3rem;
}

.sa-alloc-balance-required {
    font-size: 0.72rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.sa-alloc-balance-remaining {
    font-size: 0.72rem;
    font-weight: 700;
    border-radius: 6px;
    padding: 0.15rem 0.5rem;
}

.sa-balance-partial {
    background: #fffbeb;
    color: #b45309;
}

.sa-balance-full {
    background: #f0fdf4;
    color: #15803d;
}

.sa-balance-over {
    background: #fef2f2;
    color: #dc2626;
}

.sa-alloc-progress-track {
    height: 5px;
    background: #f1f5f9;
    border-radius: 10px;
    overflow: hidden;
}

.sa-alloc-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #7c3aed, #a78bfa);
    border-radius: 10px;
    transition: width 0.3s ease;
}

.sa-alloc-progress-fill.sa-progress-full {
    background: linear-gradient(90deg, #16a34a, #4ade80);
}

.sa-alloc-progress-fill.sa-progress-over {
    background: linear-gradient(90deg, #dc2626, #f87171);
}

/* Sources list */
.sa-alloc-sources-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.sa-alloc-source-item {
    /* container per source */
}

/* Search state (no stock selected yet) */
.sa-alloc-source-search-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.sa-alloc-source-search-row {
    display: flex;
    align-items: stretch;
    gap: 0.35rem;
}

.sa-alloc-source-search-row > :first-child {
    flex: 1;
    min-width: 0;
}

.sa-alloc-source-remove-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 7px;
    color: #ef4444;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s;
    align-self: center;
}

.sa-alloc-source-remove-btn:hover {
    background: #fee2e2;
    border-color: #f87171;
    color: #dc2626;
}

/* Filled state (stock selected) */
.sa-alloc-source-filled {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.5rem 0.6rem;
    transition: border-color 0.2s;
}

.sa-alloc-source-filled.sa-source-over {
    border-color: #fca5a5;
    background: #fef2f2;
}

.sa-alloc-source-qty-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.sa-alloc-source-qty-row .sa-alloc-qty-input {
    width: 80px;
    background: white;
    cursor: text;
    opacity: 1;
}

.sa-alloc-qty-input.sa-input-over {
    border-color: #fca5a5 !important;
    background: #fef2f2 !important;
    color: #dc2626;
}

.sa-source-unit-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #475569;
    white-space: nowrap;
}

.sa-source-over-warn {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.68rem;
    font-weight: 600;
    color: #dc2626;
    white-space: nowrap;
}

/* Add another source button */
.sa-alloc-add-source-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    background: #f5f3ff;
    border: 1px dashed #c4b5fd;
    border-radius: 8px;
    color: #7c3aed;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    justify-content: center;
    margin-bottom: 0.4rem;
}

.sa-alloc-add-source-btn:hover {
    background: #ede9fe;
    border-color: #a78bfa;
    border-style: solid;
}

/* Confirm allocation button */
.sa-alloc-confirm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #16a34a, #15803d);
    color: white;
    border: none;
    border-radius: 9px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s;
    width: 100%;
    box-shadow: 0 2px 8px rgba(22, 163, 74, 0.25);
    letter-spacing: 0.2px;
}

.sa-alloc-confirm-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(22, 163, 74, 0.35);
}

.sa-alloc-confirm-btn:disabled,
.sa-alloc-confirm-btn.sa-confirm-btn-disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.sa-confirm-partial-tag {
    font-size: 0.65rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 5px;
    padding: 0.1rem 0.35rem;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}.prod-page { max-width: 760px; margin: 0 auto; padding: 18px 16px 40px; color: #111827; }
.prod-header { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.prod-header h1 { flex: 1; margin: 0; font-size: 22px; }
.prod-back { border: none; background: transparent; cursor: pointer; font-size: 20px; padding: 6px; color: inherit; display: inline-flex; }
.prod-add { display: inline-flex; align-items: center; gap: 6px; background: #ea580c; color: #fff; border: none; padding: 10px 16px; border-radius: 9px; font-weight: 600; cursor: pointer; font-size: 14px; }
.prod-add:disabled { opacity: 0.5; cursor: not-allowed; }
.prod-day { font-size: 16px; margin: 18px 0 10px; }
.prod-day small { color: #6b7280; font-weight: 400; margin-left: 6px; }
.prod-note { background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; padding: 10px 12px; border-radius: 9px; font-size: 14px; margin-bottom: 12px; }
.prod-note-error { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.prod-toast { background: #ecfdf5; border: 1px solid #a7f3d0; color: #047857; padding: 10px 12px; border-radius: 9px; font-size: 14px; margin-bottom: 12px; }
.prod-empty { color: #6b7280; font-size: 14px; }
.prod-list { display: flex; flex-direction: column; gap: 10px; }
.prod-card { border: 1px solid #e5e7eb; border-radius: 11px; padding: 12px 14px; background: #fff; }
.prod-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.prod-badge { font-size: 13px; padding: 4px 10px; border-radius: 999px; font-weight: 600; }
.prod-badge.ok { background: #dcfce7; color: #166534; }
.prod-badge.no { background: #f3f4f6; color: #4b5563; }
.prod-badge.wait { background: #fef3c7; color: #92400e; }
.prod-link { background: none; border: none; color: #c2410c; cursor: pointer; font-size: 13px; padding: 4px 0; margin-left: 8px; }
.prod-toggle { margin: 6px 0 0; display: inline-flex; align-items: center; gap: 4px; }
.prod-entries { list-style: none; margin: 8px 0 0; padding: 0; font-size: 14px; }
.prod-entries li { display: flex; justify-content: space-between; padding: 5px 0; border-top: 1px solid #f3f4f6; }
.prod-modal-head { display: flex; align-items: center; justify-content: space-between; }
.prod-modal-head h2 { margin: 0; }
.prod-field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; margin-top: 14px; font-weight: 600; }
.prod-field select { padding: 9px 10px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 15px; background: #fff; font-weight: 400; }
.prod-details { background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 9px; padding: 10px 12px; margin-top: 8px; font-size: 14px; }
.prod-details h4 { margin: 0 0 6px; font-size: 14px; }
.prod-details ul { list-style: none; margin: 0 0 6px; padding: 0; }
.prod-details li { display: flex; justify-content: space-between; padding: 3px 0; }
.prod-details small { color: #6b7280; }
.sm-page { max-width: 1440px; margin: 0 auto; padding: 18px 16px 40px; color: #111827; }
.sm-header { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.sm-header h1 { flex: 1; margin: 0; font-size: 22px; }
.sm-header > div { flex: 1; }
.sm-subtitle { margin: 3px 0 0; color: #6b7280; font-size: 13px; }
.sm-icon { border: none; background: transparent; cursor: pointer; font-size: 20px; padding: 6px; color: inherit; display: inline-flex; }
.sm-add { display: inline-flex; align-items: center; gap: 6px; background: #ea580c; color: #fff; border: none; padding: 10px 16px; border-radius: 9px; font-weight: 600; cursor: pointer; font-size: 14px; }
.sm-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.sm-filters select, .sm-filters input[type="date"] { padding: 9px 10px; border: 1px solid #d1d5db; border-radius: 8px; background: #fff; font-size: 14px; }
.sm-search { flex: 1; min-width: 160px; display: flex; align-items: center; gap: 6px; border: 1px solid #d1d5db; border-radius: 8px; padding: 0 10px; background: #fff; }
.sm-search input { border: none; outline: none; padding: 9px 0; width: 100%; font-size: 14px; background: transparent; }
.sm-day { font-size: 14px; color: #6b7280; margin: 18px 0 8px; font-weight: 600; }
.sm-list { display: flex; flex-direction: column; gap: 6px; }
.sm-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: left; width: 100%; border: 1px solid #e5e7eb; background: #fff; border-radius: 10px; padding: 11px 14px; cursor: pointer; color: inherit; }
.sm-row:hover { border-color: #fdba74; }
.sm-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sm-source { font-size: 13px; color: #6b7280; }
.sm-side { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 12px; color: #6b7280; white-space: nowrap; }
.sm-side b { font-size: 15px; }
.sm-side b.in { color: #15803d; }
.sm-side b.out { color: #b91c1c; }
.sm-empty { color: #6b7280; font-size: 14px; }
.sm-table-wrap { overflow-x: auto; margin-top: 14px; border: 1px solid #e5e7eb; border-radius: 10px; background: #fff; }
.sm-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sm-table th { padding: 10px 12px; text-align: left; color: #6b7280; background: #f9fafb; white-space: nowrap; }
.sm-table td { padding: 11px 12px; border-top: 1px solid #f0f1f3; vertical-align: top; }
.sm-table tbody tr { cursor: pointer; }
.sm-table tbody tr:hover { background: #fff7ed; }
.sm-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sm-table .in { color: #15803d; font-weight: 700; }
.sm-table .out { color: #b91c1c; font-weight: 700; }
.sm-unavailable { color: #9ca3af; font-size: 12px; }
.sm-pagination { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 12px; font-size: 13px; color: #6b7280; }
.sm-pagination button { border: 1px solid #d1d5db; border-radius: 7px; background: #fff; padding: 7px 11px; cursor: pointer; }
.sm-pagination button:disabled { opacity: .45; cursor: default; }
.sm-event-id { overflow-wrap: anywhere; font-family: ui-monospace, monospace; font-size: 12px; }
.sm-source-link { border: 0; background: none; color: #c2410c; padding: 0; font-weight: 700; cursor: pointer; text-align: left; }
.sm-note { background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; padding: 10px 12px; border-radius: 9px; font-size: 14px; margin-bottom: 12px; }
.sm-error { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.sm-toast { background: #ecfdf5; border: 1px solid #a7f3d0; color: #047857; padding: 10px 12px; border-radius: 9px; font-size: 14px; margin-bottom: 12px; }
.sm-overlay { position: fixed; inset: 0; z-index: 2000; background: rgba(15, 23, 42, 0.45); display: flex; justify-content: flex-end; align-items: stretch; }
.sm-drawer { width: 100%; max-width: 380px; background: #fff; padding: 20px; overflow-y: auto; }
.sm-drawer dl { margin: 0; display: grid; grid-template-columns: 120px 1fr; gap: 10px 12px; font-size: 14px; }
.sm-drawer dt { color: #6b7280; }
.sm-drawer dd { margin: 0; font-weight: 600; }
.sm-drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.sm-drawer-head h2 { margin: 0; font-size: 18px; }
.sm-modal { margin: auto; width: calc(100% - 32px); max-width: 440px; background: #fff; border-radius: 14px; padding: 20px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.sm-field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; margin-top: 12px; }
.sm-field select, .sm-field input { padding: 9px 10px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 15px; font-weight: 400; background: #fff; }
.sm-qty { display: flex; gap: 8px; }
.sm-qty input { flex: 1; min-width: 0; }
.sm-error-text { color: #b91c1c; font-size: 13px; margin: 10px 0 0; }
.sm-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.sm-actions button { padding: 10px 20px; border-radius: 9px; font-size: 15px; font-weight: 600; cursor: pointer; border: 1px solid transparent; }
.sm-cancel { background: #fff; border-color: #d1d5db !important; color: #374151; }
.sm-save { background: #ea580c; color: #fff; }
.sm-actions button:disabled { opacity: .55; cursor: not-allowed; }

@media (max-width: 760px) {
  .sm-table thead { display: none; }
  .sm-table, .sm-table tbody, .sm-table tr, .sm-table td { display: block; width: 100%; }
  .sm-table tr { padding: 10px 12px; border-top: 1px solid #e5e7eb; }
  .sm-table td { border: 0; padding: 3px 0; text-align: left !important; }
  .sm-table td::before { content: attr(data-label) ': '; color: #6b7280; font-weight: 400; }
  .sm-table td:nth-child(2), .sm-table td:nth-child(5) { display: none; }
  .sm-table td:nth-child(1)::before, .sm-table td:nth-child(3)::before, .sm-table td:nth-child(4)::before { content: ''; }
  .sm-table td:nth-child(1), .sm-table td:nth-child(3), .sm-table td:nth-child(4) { font-size: 15px; }
}
.sc-page { max-width: 820px; margin: 0 auto; padding: 18px 16px 90px; color: #111827; }
.sc-header { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.sc-header h1 { margin: 0; font-size: 22px; }
.sc-icon { border: none; background: transparent; cursor: pointer; font-size: 20px; padding: 6px; color: inherit; display: inline-flex; }
.sc-primary { background: #ea580c; color: #fff; border: none; padding: 11px 20px; border-radius: 9px; font-weight: 600; font-size: 15px; cursor: pointer; }
.sc-secondary { background: #fff; color: #374151; border: 1px solid #d1d5db; padding: 11px 20px; border-radius: 9px; font-weight: 600; font-size: 15px; cursor: pointer; }
.sc-primary:disabled, .sc-secondary:disabled { opacity: .55; cursor: not-allowed; }
.sc-sub { font-size: 15px; color: #6b7280; margin: 20px 0 8px; font-weight: 600; }
.sc-empty { color: #6b7280; font-size: 14px; }
.sc-note { background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; padding: 10px 12px; border-radius: 9px; font-size: 14px; margin: 10px 0; }
.sc-error { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.sc-toast { background: #ecfdf5; border: 1px solid #a7f3d0; color: #047857; padding: 10px 12px; border-radius: 9px; font-size: 14px; margin-bottom: 12px; }
.sc-stale { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 8px; }
.sc-stale button { background: #fff; border: 1px solid #b91c1c; color: #b91c1c; border-radius: 8px; padding: 6px 14px; font-weight: 600; cursor: pointer; }
.sc-list { display: flex; flex-direction: column; gap: 8px; }
.sc-history { display: grid; grid-template-columns: 110px 1fr 1fr 1fr; gap: 8px; text-align: left; align-items: center; background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 12px 14px; cursor: pointer; color: inherit; font-size: 14px; }
.sc-history span { color: #6b7280; }
.sc-filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 12px; font-size: 14px; }
.sc-filters label { display: inline-flex; align-items: center; gap: 6px; }
.sc-search { flex: 1; min-width: 160px; border: 1px solid #d1d5db; border-radius: 8px; padding: 0 10px; background: #fff; }
.sc-search input { border: none; outline: none; padding: 9px 0; width: 100%; font-size: 14px; background: transparent; }
.sc-row { display: grid; grid-template-columns: 1fr auto 130px; gap: 12px; align-items: center; background: #fff; border: 1px solid #e5e7eb; border-left-width: 4px; border-radius: 10px; padding: 11px 14px; }
.sc-row.short { border-left-color: #dc2626; } .sc-row.extra { border-left-color: #2563eb; } .sc-row.match { border-left-color: #16a34a; }
.sc-name { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sc-name span { font-size: 13px; color: #6b7280; }
.sc-actual { display: flex; gap: 6px; }
.sc-actual input { width: 96px; padding: 9px 10px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 16px; }
.sc-actual select { padding: 9px 8px; border: 1px solid #d1d5db; border-radius: 8px; background: #fff; font-size: 14px; }
.sc-diff { text-align: right; font-weight: 600; font-size: 14px; color: #6b7280; }
.sc-diff.short, .sc-sum-row.short b, .sc-tr.short span:last-child { color: #b91c1c; }
.sc-diff.extra, .sc-sum-row.extra b, .sc-tr.extra span:last-child { color: #1d4ed8; }
.sc-diff.match, .sc-tr.match span:last-child { color: #15803d; }
.sc-row-error { grid-column: 1 / -1; margin: 0; color: #b91c1c; font-size: 13px; }
.sc-bar { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 20px; background: #fff; border-top: 1px solid #e5e7eb; z-index: 20; }
.sc-table { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.sc-th, .sc-tr { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 8px; padding: 8px 10px; }
.sc-th { color: #6b7280; font-weight: 600; }
.sc-tr { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; }
.sc-overlay { position: fixed; inset: 0; z-index: 2000; background: rgba(15, 23, 42, .5); display: flex; align-items: center; justify-content: center; padding: 16px; }
.sc-modal { width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; background: #fff; border-radius: 14px; padding: 20px; }
.sc-modal-head { display: flex; justify-content: space-between; align-items: center; }
.sc-modal h2 { margin: 0; font-size: 20px; } .sc-modal h3 { font-size: 15px; margin: 16px 0 8px; }
.sc-sum { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-size: 15px; margin: 14px 0 0; }
.sc-sum dt { color: #6b7280; } .sc-sum dd { margin: 0; font-weight: 600; text-align: right; }
.sc-sum-row { display: grid; gap: 2px; padding: 8px 0; border-top: 1px solid #f3f4f6; font-size: 14px; }
.sc-sum-row span { color: #6b7280; font-size: 13px; }
.sc-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
@media (max-width: 560px) {
  .sc-row { grid-template-columns: 1fr; }
  .sc-diff { text-align: left; }
  .sc-history { grid-template-columns: 1fr 1fr; }
}
.tk-root {
    position: fixed;
    z-index: 2147483000;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
    background: #1f2328;
    border: 1px solid #3a4048;
    box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.35);
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

.tk-root.tk-bottom { bottom: 0; border-radius: 12px 12px 0 0; }
.tk-root.tk-top { top: 0; border-radius: 0 0 12px 12px; }

.tk-text { left: 0; right: 0; margin: 0 auto; width: min(100vw, 960px); }
.tk-number { width: 340px; max-width: 100vw; }
.tk-number.tk-side-right { right: 8px; }
.tk-number.tk-side-left { left: 8px; }

.tk-bar { display: flex; justify-content: space-between; }

.tk-bar-btn {
    background: transparent;
    color: #aab2bd;
    border: 0;
    padding: 6px 12px;
    font: inherit;
    font-size: 14px;
    cursor: pointer;
}

.tk-row { display: flex; gap: 6px; }

.tk-key {
    flex: 1 1 0;
    min-width: 0;
    height: 56px;
    border: 0;
    border-radius: 8px;
    background: #3b424b;
    color: #f1f3f5;
    font: inherit;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tk-key:active { background: #59626e; }
.tk-wide { flex: 1.6 1 0; font-size: 18px; }
.tk-space { flex: 5 1 0; font-size: 16px; }
.tk-active { background: #e85d04; }
.tk-accent { background: #e85d04; }
.tk-accent:active { background: #f48c06; }
.tk-blank { background: transparent; cursor: default; }

.tk-number .tk-key { height: 64px; font-size: 26px; }

@media (max-height: 800px) {
    .tk-key { height: 48px; }
    .tk-number .tk-key { height: 54px; }
}
/* RPOS premium billing themes ------------------------------------------------
   Each theme is a token set (palette, type, radius, elevation) plus a few
   structural treatments. Tokens are mapped onto the app's existing variables so
   MenuColumn / OrderColumn markup is unchanged. Presentation only. */

.pos-shell.app-container {
    --p-bg: #f6f3ee;
    --p-surface: #ffffff;
    --p-surface-2: #faf7f2;
    --p-text: #1f2430;
    --p-muted: #6b7280;
    --p-border: #e7e2d9;
    --p-accent: #e85d04;
    --p-accent-2: #f48c06;
    --p-accent-ink: #ffffff;
    --p-soft: rgba(232, 93, 4, .10);
    --p-radius: 14px;
    --p-radius-sm: 9px;
    --p-shadow: 0 1px 2px rgba(20, 24, 32, .05), 0 8px 24px rgba(20, 24, 32, .06);
    --p-font: 'Outfit', system-ui, sans-serif;
    --p-display: var(--p-font);
    --p-num: var(--p-font);

    --background-color: var(--p-bg);
    --surface-color: var(--p-surface);
    --text-color: var(--p-text);
    --secondary-text-color: var(--p-muted);
    --border-color: var(--p-border);
    --primary-color: var(--p-accent);
    --primary-hover-color: var(--p-accent-2);
    --shadow: var(--p-shadow);

    background: var(--p-bg);
    color: var(--p-text);
    font-family: var(--p-font);
}

/* ---- shared component skin ------------------------------------------------ */
.pos-shell .column { border-radius: var(--p-radius); border: 1px solid var(--p-border); box-shadow: var(--p-shadow); background: var(--p-surface); }
.pos-shell .column-header { font-family: var(--p-display); color: var(--p-text); letter-spacing: .01em; background: transparent; border-bottom: 1px solid var(--p-border); }
.pos-shell .menu-search { background: var(--p-surface-2); color: var(--p-text); border: 1px solid var(--p-border); border-radius: var(--p-radius-sm); }
.pos-shell .menu-search:focus { border-color: var(--p-accent); box-shadow: 0 0 0 3px var(--p-soft); outline: none; }

.pos-shell .menu-category-sidebar { background: var(--p-surface-2); border-color: var(--p-border); border-radius: var(--p-radius); }
.pos-shell .menu-category-pill { color: var(--p-muted); border-radius: var(--p-radius-sm); font-family: var(--p-font); }
.pos-shell .menu-category-pill:hover { background: var(--p-soft); border-color: transparent; color: var(--p-accent); }
.pos-shell .menu-category-pill.active { background: linear-gradient(135deg, var(--p-accent), var(--p-accent-2)); color: var(--p-accent-ink); border-color: transparent; box-shadow: 0 6px 16px var(--p-soft); }
.pos-shell .menu-category-count { background: rgba(255, 255, 255, .28); font-variant-numeric: tabular-nums; }
.pos-shell .menu-category-pill:not(.active) .menu-category-count { background: var(--p-soft); color: var(--p-accent); }

.pos-shell .menu-item-tile { background: var(--p-surface); border: 1px solid var(--p-border); border-radius: var(--p-radius); box-shadow: var(--p-shadow); overflow: hidden; }
.pos-shell .menu-item-tile:hover { box-shadow: 0 12px 28px rgba(20, 24, 32, .12); border-color: var(--p-accent); }
.pos-shell .menu-item-photo { border-radius: calc(var(--p-radius) - 4px); border: 0; }
.pos-shell .menu-item-name { font-family: var(--p-display); font-weight: 600; color: var(--p-text); }
.pos-shell .menu-item-tile .menu-item-price { font-family: var(--p-num); color: var(--p-accent); font-variant-numeric: tabular-nums; }
.pos-shell .add-btn { background: linear-gradient(135deg, var(--p-accent), var(--p-accent-2)); color: var(--p-accent-ink); border-radius: var(--p-radius-sm); font-family: var(--p-font); box-shadow: 0 4px 12px var(--p-soft); }
.pos-shell .add-btn:hover { filter: brightness(1.06); }

.pos-shell .order-item { border-bottom: 1px dashed var(--p-border); }
.pos-shell .quantity-btn { background: var(--p-surface-2); color: var(--p-text); border: 1px solid var(--p-border); }
.pos-shell .quantity-btn:hover { background: var(--p-accent); border-color: var(--p-accent); color: var(--p-accent-ink); }
.pos-shell .order-item-total, .pos-shell .summary-line span:last-child { font-family: var(--p-num); font-variant-numeric: tabular-nums; }
.pos-shell .order-summary { background: var(--p-surface-2); border-top: 1px solid var(--p-border); }
.pos-shell .summary-line.total { color: var(--p-text); }
.pos-shell .summary-line.total span:last-child { color: var(--p-accent); }
.pos-shell .finalize-btn { background: linear-gradient(135deg, var(--p-accent), var(--p-accent-2)); color: var(--p-accent-ink); border-radius: var(--p-radius-sm); letter-spacing: .08em; box-shadow: 0 8px 20px var(--p-soft); }
.pos-shell .finalize-btn:hover { filter: brightness(1.07); }

/* horizontal category strip: never let it collapse */
.pos-shell[data-category-orientation="horizontal"] .menu-layout { flex-direction: column; align-items: stretch; }
.pos-shell[data-category-orientation="horizontal"] .menu-category-sidebar {
    width: 100%; flex: 0 0 auto; min-width: 0; padding: .4rem; gap: .4rem;
    background: transparent; border: 0; border-bottom: 1px solid var(--p-border); border-radius: 0;
}
.pos-shell[data-category-orientation="horizontal"] .menu-category-pill { align-items: center; border: 1px solid var(--p-border); background: var(--p-surface); padding: .45rem .9rem; border-radius: 999px; }
.pos-shell[data-category-orientation="horizontal"] .menu-category-pill.active { background: linear-gradient(135deg, var(--p-accent), var(--p-accent-2)); color: var(--p-accent-ink); border-color: transparent; }
.pos-shell[data-category-orientation="horizontal"] .menu-items-panel { flex: 1; min-height: 0; }

/* Palette is fixed to the main site: white surfaces + RPOS orange. Themes differ
   by layout, shape, typography and how much orange they use. */

/* 1. CLASSIC RPOS - the familiar site look */
.pos-shell[data-pos-theme="classic"] { --p-bg: #f8f9fa; --p-surface-2: #fff7f0; }

/* 2. RESTAURANT DENSE - solid orange headers, square, left-stripe tiles */
.pos-shell[data-pos-theme="restaurant_dense"] {
    --p-bg: #f1f3f5; --p-radius: 6px; --p-radius-sm: 4px; --p-shadow: 0 1px 2px rgba(0, 0, 0, .08);
    --p-font: 'Manrope', system-ui, sans-serif; --p-num: 'JetBrains Mono', ui-monospace, monospace;
}
.pos-shell[data-pos-theme="restaurant_dense"] .column-header { background: var(--p-accent); color: #fff; border: 0; }
.pos-shell[data-pos-theme="restaurant_dense"] .column-header span { color: inherit; }
.pos-shell[data-pos-theme="restaurant_dense"] .menu-item-tile { border-left: 4px solid var(--p-accent); }
.pos-shell[data-pos-theme="restaurant_dense"] .menu-category-sidebar { background: #fff; }

/* 3. QUICK ORDER - big rounded, cart panel with solid orange header on cream */
.pos-shell[data-pos-theme="quick_order"] {
    --p-bg: #fff7f0; --p-surface-2: #fff1e6; --p-radius: 18px; --p-radius-sm: 12px; --p-font: 'Space Grotesk', system-ui, sans-serif;
}
.pos-shell[data-pos-theme="quick_order"] .order-column { background: #fff7f0; border: 2px solid var(--p-accent); }
.pos-shell[data-pos-theme="quick_order"] .order-column .column-header { background: linear-gradient(135deg, var(--p-accent), var(--p-accent-2)); color: #fff; border: 0; }
.pos-shell[data-pos-theme="quick_order"] .order-column .column-header span { color: inherit; }
.pos-shell[data-pos-theme="quick_order"] .order-column .summary-line.total { font-size: 1.7rem; }

/* 4. IMAGE FIRST - gallery cards, photo with name overlay, serif headings */
.pos-shell[data-pos-theme="image_first"] {
    --p-radius: 20px; --p-radius-sm: 12px; --p-font: 'Manrope', system-ui, sans-serif; --p-display: 'Fraunces', Georgia, serif;
}
.pos-shell[data-pos-theme="image_first"] .menu-item-tile { padding: 0; gap: 0; display: grid; grid-template-rows: auto auto; justify-content: stretch; }
.pos-shell[data-pos-theme="image_first"] .menu-item-photo { grid-area: 1 / 1; border-radius: 0; aspect-ratio: 4 / 3.2; }
.pos-shell[data-pos-theme="image_first"] .menu-item-tile-header { grid-area: 1 / 1; align-self: end; padding: 2.2rem .85rem .75rem; pointer-events: none; z-index: 1;
    background: linear-gradient(to top, rgba(0, 0, 0, .72), transparent); }
.pos-shell[data-pos-theme="image_first"] .menu-item-name { color: #fff; font-size: 1.05rem; text-shadow: 0 1px 8px rgba(0,0,0,.4); }
.pos-shell[data-pos-theme="image_first"] .menu-item-tile-footer { grid-area: 2 / 1; padding: .6rem .85rem .85rem; }

/* 5. TOUCH TILES - chunky orange-outlined tiles that press down */
.pos-shell[data-pos-theme="touch_tiles"] {
    --p-bg: #fff7f0; --p-surface-2: #fff1e6; --p-radius: 22px; --p-radius-sm: 14px; --p-font: 'Space Grotesk', system-ui, sans-serif;
    --p-shadow: 0 4px 0 rgba(232, 93, 4, .18);
}
.pos-shell[data-pos-theme="touch_tiles"] .menu-item-tile { border: 2px solid var(--p-accent); background: #fff; box-shadow: 0 6px 0 rgba(232, 93, 4, .28); }
.pos-shell[data-pos-theme="touch_tiles"] .menu-item-tile:active { transform: translateY(4px) scale(.98); box-shadow: 0 2px 0 rgba(232, 93, 4, .28); }
.pos-shell[data-pos-theme="touch_tiles"] .menu-item-name { font-size: 1.1rem; }
.pos-shell[data-pos-theme="touch_tiles"] .menu-item-tile .menu-item-price { font-size: 1.15rem; }
.pos-shell[data-pos-theme="touch_tiles"] .menu-item-photo { border-radius: 16px; }
.pos-shell[data-pos-theme="touch_tiles"] .menu-item-tile-footer .add-btn { min-width: 72px; }

/* 6. CLEAN HOSPITALITY - white, serif, hairlines, outlined orange actions */
.pos-shell[data-pos-theme="clean_hospitality"] {
    --p-bg: #ffffff; --p-surface-2: #fffaf5; --p-border: #f0e0d0; --p-radius: 4px; --p-radius-sm: 3px; --p-shadow: none;
    --p-font: 'Manrope', system-ui, sans-serif; --p-display: 'Fraunces', Georgia, serif; --p-num: 'Fraunces', Georgia, serif;
}
.pos-shell[data-pos-theme="clean_hospitality"] .column { border: 1px solid #f0e0d0; box-shadow: inset 0 0 0 4px #fff, inset 0 0 0 5px #f6e6d6; }
.pos-shell[data-pos-theme="clean_hospitality"] .column-header { font-style: italic; font-weight: 500; text-align: center; justify-content: center; }
.pos-shell[data-pos-theme="clean_hospitality"] .menu-item-tile { box-shadow: none; border: 0; border-bottom: 1px solid #f0e0d0; border-radius: 0; background: transparent; }
.pos-shell[data-pos-theme="clean_hospitality"] .menu-item-tile:hover { box-shadow: none; background: var(--p-surface-2); }
.pos-shell[data-pos-theme="clean_hospitality"] .menu-category-pill { border-radius: 0; border: 0; border-bottom: 2px solid transparent; background: transparent; padding: .5rem .3rem; margin-right: .9rem; font-family: var(--p-display); }
.pos-shell[data-pos-theme="clean_hospitality"] .menu-category-pill.active { background: transparent; color: var(--p-accent); border-bottom-color: var(--p-accent); box-shadow: none; }
.pos-shell[data-pos-theme="clean_hospitality"] .menu-category-pill:not(.active) .menu-category-count { display: none; }
.pos-shell[data-pos-theme="clean_hospitality"] .add-btn,
.pos-shell[data-pos-theme="clean_hospitality"] .finalize-btn { background: transparent; color: var(--p-accent); border: 1px solid var(--p-accent); box-shadow: none; text-transform: uppercase; letter-spacing: .14em; font-size: .82rem; }
.pos-shell[data-pos-theme="clean_hospitality"] .add-btn:hover,
.pos-shell[data-pos-theme="clean_hospitality"] .finalize-btn:hover { background: var(--p-accent); color: #fff; filter: none; }
.pos-shell[data-pos-theme="clean_hospitality"] .order-column { background: #fff; }

/* 7. TABLE SERVICE - orange banner on the order, orange rule on the menu */
.pos-shell[data-pos-theme="table_service"] { --p-bg: #f8f9fa; --p-radius: 12px; --p-font: 'Manrope', system-ui, sans-serif; }
.pos-shell[data-pos-theme="table_service"] .order-column { border-top: 0; }
.pos-shell[data-pos-theme="table_service"] .order-column .column-header { background: linear-gradient(135deg, var(--p-accent), var(--p-accent-2)); color: #fff; border: 0; padding: 1.1rem 1.25rem; }
.pos-shell[data-pos-theme="table_service"] .order-column .column-header span { color: inherit; }
.pos-shell[data-pos-theme="table_service"] .order-column .column-header span:last-child { background: rgba(255,255,255,.22); padding: .25rem .7rem; border-radius: 999px; font-size: .8rem; }
.pos-shell[data-pos-theme="table_service"] .menu-column .column-header { border-bottom: 3px solid var(--p-accent); }

/* 8. DENSE TERMINAL - monospaced, square, thin rules, uppercase labels */
.pos-shell[data-pos-theme="dense_terminal"] {
    --p-bg: #ffffff; --p-surface-2: #fafafa; --p-border: #cfd4d9; --p-radius: 2px; --p-radius-sm: 2px; --p-shadow: none;
    --p-font: 'JetBrains Mono', ui-monospace, Consolas, monospace;
}
.pos-shell[data-pos-theme="dense_terminal"] .column { border: 1px solid #343a40; }
.pos-shell[data-pos-theme="dense_terminal"] .column-header { text-transform: uppercase; letter-spacing: .18em; font-size: .85rem; color: var(--p-accent); background: #fafafa; }
.pos-shell[data-pos-theme="dense_terminal"] .column-header::before { content: '> '; }
.pos-shell[data-pos-theme="dense_terminal"] .menu-item-tile { box-shadow: none; border-color: #cfd4d9; }
.pos-shell[data-pos-theme="dense_terminal"] .menu-item-tile:hover { box-shadow: none; transform: none; border-color: var(--p-accent); }
.pos-shell[data-pos-theme="dense_terminal"] .menu-category-pill { border-radius: 2px; text-transform: uppercase; letter-spacing: .06em; font-size: .72rem; }
.pos-shell[data-pos-theme="dense_terminal"] .add-btn,
.pos-shell[data-pos-theme="dense_terminal"] .finalize-btn { background: var(--p-accent); box-shadow: none; text-transform: uppercase; }

/* 9. RPOS COMPACT - list rows with small thumbnails, underlined headers */
.pos-shell[data-pos-theme="compact"] {
    --p-bg: #f1f3f5; --p-radius: 6px; --p-radius-sm: 5px; --p-shadow: none; --p-font: 'Outfit', system-ui, sans-serif;
}
.pos-shell[data-pos-theme="compact"] .menu-items-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); grid-auto-rows: auto; align-items: stretch; gap: .6rem; }
.pos-shell[data-pos-theme="compact"] .variation-buttons { grid-area: vb; margin-top: .45rem; }
.pos-shell[data-pos-theme="compact"] .variation-btn { min-height: 30px; padding: .2rem .6rem; }
.pos-shell[data-pos-theme="compact"] .menu-item-tile .add-btn { min-height: 34px; }
.pos-shell[data-pos-theme="compact"] .menu-item-tile { display: grid; grid-template-columns: 64px 1fr auto; grid-template-areas: "ph nm ad" "ph pr ad" "vb vb vb"; align-self: stretch; align-content: center; align-items: center; column-gap: .65rem; row-gap: 0; padding: .45rem; min-height: 0; box-shadow: none; }
.pos-shell[data-pos-theme="compact"] .menu-item-photo { grid-area: ph; width: 64px; height: 64px; aspect-ratio: 1; }
.pos-shell[data-pos-theme="compact"] .menu-item-tile-header { grid-area: nm; align-self: end; }
.pos-shell[data-pos-theme="compact"] .menu-item-tile-footer { display: contents; }
.pos-shell[data-pos-theme="compact"] .menu-item-tile .menu-item-price { grid-area: pr; align-self: start; font-size: .9rem; }
.pos-shell[data-pos-theme="compact"] .menu-item-tile .add-btn { grid-area: ad; align-self: center; justify-self: end; margin: 0; padding: .4rem .8rem; }
.pos-shell[data-pos-theme="compact"] .menu-item-name { font-size: .9rem; }
.pos-shell[data-pos-theme="compact"] .column-header { border-bottom: 2px solid var(--p-accent); font-size: 1rem; text-transform: uppercase; letter-spacing: .08em; }

/* 10. QUICK TOUCH - flagship: large radii, orange glow, big controls */
.pos-shell[data-pos-theme="quick_touch"] {
    --p-bg: #fff7f0; --p-surface-2: #fff1e6; --p-radius: 22px; --p-radius-sm: 16px; --p-shadow: 0 10px 30px rgba(232, 93, 4, .12);
    --p-font: 'Manrope', system-ui, sans-serif; --p-display: 'Space Grotesk', system-ui, sans-serif; --p-num: 'Space Grotesk', system-ui, sans-serif;
}
.pos-shell[data-pos-theme="quick_touch"] .menu-item-tile { border-bottom: 5px solid var(--p-accent); }
.pos-shell[data-pos-theme="quick_touch"] .menu-item-tile:hover { box-shadow: 0 14px 34px rgba(232, 93, 4, .28); }
.pos-shell[data-pos-theme="quick_touch"] .menu-item-name { font-size: 1.02rem; }
.pos-shell[data-pos-theme="quick_touch"] .menu-item-tile .menu-item-price { font-size: 1.2rem; font-weight: 700; }
.pos-shell[data-pos-theme="quick_touch"] .menu-category-pill.active,
.pos-shell[data-pos-theme="quick_touch"] .finalize-btn { box-shadow: 0 8px 24px rgba(232, 93, 4, .45); }
.pos-shell[data-pos-theme="quick_touch"] .finalize-btn { min-height: 60px; font-size: 1.25rem; text-transform: uppercase; }
.pos-shell[data-pos-theme="quick_touch"] .quantity-btn { width: 48px; height: 48px; border-radius: 16px; font-size: 1.45rem; }

/* ---- dark appearance (optional user setting): same orange, deeper surfaces -- */
.pos-shell[data-pos-appearance="dark"] {
    --p-bg: #0e1116; --p-surface: #171b22; --p-surface-2: #1d222b; --p-text: #eef0f4; --p-muted: #9aa3b2; --p-border: #2a303b;
    --p-shadow: 0 10px 30px rgba(0, 0, 0, .35);
}
.pos-shell[data-pos-appearance="dark"][data-pos-theme="quick_order"] .order-column { background: var(--p-surface); }
.pos-shell[data-pos-appearance="dark"][data-pos-theme="clean_hospitality"] .column { box-shadow: inset 0 0 0 4px var(--p-surface), inset 0 0 0 5px #3a2a1c; border-color: #3a2a1c; }
.pos-shell[data-pos-appearance="dark"][data-pos-theme="dense_terminal"] .column { border-color: #4a525c; }
.pos-shell[data-pos-appearance="dark"] .column-header { background: transparent; }
.pos-shell[data-pos-appearance="dark"][data-pos-theme="restaurant_dense"] .column-header,
.pos-shell[data-pos-appearance="dark"][data-pos-theme="table_service"] .order-column .column-header,
.pos-shell[data-pos-appearance="dark"][data-pos-theme="quick_order"] .order-column .column-header { background: var(--p-accent); }
.pos-shell[data-pos-appearance="dark"] .column,
.pos-shell[data-pos-appearance="dark"] .menu-item-tile,
.pos-shell[data-pos-appearance="dark"] .menu-category-sidebar,
.pos-shell[data-pos-appearance="dark"] input,
.pos-shell[data-pos-appearance="dark"] select { background-color: var(--p-surface); color: var(--p-text); border-color: var(--p-border); }

/* ---- touch mode: oversized hit areas ------------------------------------- */
.pos-shell[data-pos-touchscreen="true"] .menu-category-pill { min-height: 48px; }
.pos-shell[data-pos-touchscreen="true"] .add-btn { min-width: 64px; }

/* ---- keyboard preview (real key caps) ------------------------------------- */
.pos-preview-keyboard { background: linear-gradient(180deg, #2a2f3a, #1a1d25) !important; border-top: 1px solid rgba(255,255,255,.12); border-radius: 18px 18px 0 0; padding: 14px 16px 18px !important; gap: 9px !important; }
.pos-preview-keyboard .pk-row { display: flex; justify-content: center; gap: 8px; }
.pos-preview-keyboard .pk-key {
    flex: 1 1 0; max-width: 78px; min-height: 52px; padding: 0; display: flex; align-items: center; justify-content: center;
    border-radius: 10px; background: #3d4452; color: #f3f4f6; font: 600 20px/1 'Manrope', system-ui, sans-serif; letter-spacing: 0;
    box-shadow: 0 2px 0 #14171d, inset 0 1px 0 rgba(255,255,255,.08);
}
.pos-preview-keyboard .pk-key.is-wide { flex: 1.6 1 0; max-width: 118px; background: #2f3541; color: #cbd2de; }
.pos-preview-keyboard .pk-key.is-space { flex: 6 1 0; max-width: 460px; font-size: 14px; letter-spacing: .2em; color: #9aa3b2; }
.pos-preview-keyboard .pk-key.is-action { background: var(--p-accent, #e85d04); color: #fff; }
.pos-preview-keyboard--numeric { border-radius: 18px !important; }
.pos-preview-keyboard--numeric .pk-row { gap: 8px; }
.pos-preview-keyboard--numeric .pk-key { max-width: none; min-height: 58px; font-size: 24px; }
.pos-preview-keyboard--numeric { grid-template-columns: 1fr !important; }

/* secondary order actions follow the theme instead of fixed cream/orange */
.pos-shell .pos-preview-actions button:not(.finalize-btn) { background: var(--p-surface); color: var(--p-accent); border: 1px solid var(--p-border); border-radius: var(--p-radius-sm); }

/* size-variation pills + disabled Add, shared by every theme */
.pos-shell .variation-buttons { gap: .4rem; }
.pos-shell .variation-btn { background: var(--p-surface); border: 1.5px solid var(--p-border); color: var(--p-text); border-radius: var(--p-radius-sm); font-family: var(--p-font); box-shadow: none; }
.pos-shell .variation-btn .variation-price { color: var(--p-accent); font-weight: 700; font-family: var(--p-num); }
.pos-shell .variation-btn:hover { border-color: var(--p-accent); }
.pos-shell .variation-btn.selected { background: var(--p-accent); border-color: var(--p-accent); color: var(--p-accent-ink); }
.pos-shell .variation-btn.selected .variation-price { color: var(--p-accent-ink); }
.pos-shell .add-btn:disabled { background: var(--p-surface-2); color: var(--p-muted); border: 1px solid var(--p-border); box-shadow: none; filter: none; cursor: not-allowed; }

/* tiles in a row can differ in height (size variations): name on top, price + Add pinned to the bottom */
.pos-shell .menu-item-tile { justify-content: flex-start; }
.pos-shell .menu-item-tile-footer { margin-top: auto; }

/* ---- phones: 3 items per row, small stacked cards (all themes) ------------- */
@media (max-width: 768px) {
    .pos-shell .menu-items-grid,
    .pos-shell[data-pos-theme] .menu-items-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .45rem; padding-right: 0; align-items: stretch; }
    .pos-shell .menu-item-tile,
    .pos-shell[data-pos-theme] .menu-item-tile {
        display: flex; flex-direction: column; justify-content: flex-start; align-items: stretch; align-self: stretch;
        gap: .3rem; padding: .35rem; min-height: 0; border-radius: 10px; text-align: left;
    }
    .pos-shell .menu-item-photo,
    .pos-shell[data-pos-theme] .menu-item-photo { width: 100%; height: auto; aspect-ratio: 1 / 1; border-radius: 8px; margin: 0; }
    .pos-shell[data-pos-theme] .menu-item-tile-header { position: static; padding: 0; background: none; pointer-events: auto; justify-content: flex-start; align-self: stretch; }
    .pos-shell .menu-item-name,
    .pos-shell[data-pos-theme] .menu-item-name { color: var(--p-text); font-size: .74rem; line-height: 1.2; text-shadow: none;
        display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.4em; }
    .pos-shell .menu-item-tile-footer,
    .pos-shell[data-pos-theme] .menu-item-tile-footer { display: flex; flex-direction: column; align-items: stretch; gap: .25rem; padding: 0; margin-top: auto; }
    .pos-shell .menu-item-tile .menu-item-price { font-size: .8rem; }
    .pos-shell .menu-item-tile .add-btn,
    .pos-shell[data-pos-theme] .menu-item-tile .add-btn { width: 100%; min-width: 0; min-height: 34px; padding: .25rem; font-size: .78rem; margin: 0; }
    .pos-shell .variation-buttons { gap: .25rem; }
    .pos-shell .variation-btn { min-height: 28px; padding: .15rem .35rem; font-size: .68rem; flex: 1 1 auto; justify-content: center; }
    .pos-shell .variation-btn .variation-size { font-size: .68rem; }
    .pos-shell .variation-btn .variation-price { font-size: .72rem; }
    .pos-shell[data-pos-theme="touch_tiles"] .menu-item-tile { border-width: 1.5px; box-shadow: 0 3px 0 rgba(232, 93, 4, .28); }
}

/* ---- Menu header: title on the left, search attached on the right (one row) --- */
.pos-shell .menu-header { padding: .6rem 1rem; gap: .9rem; flex-wrap: nowrap; }
.pos-shell .menu-header-title { flex: 0 0 auto; font-size: 1.15rem; letter-spacing: .06em; text-transform: uppercase; }
.pos-shell .menu-search-container.menu-search-inline {
    position: relative; flex: 1 1 auto; max-width: 460px; margin-left: auto; min-width: 0;
    display: flex; align-items: center; gap: .5rem; padding: 0; border: 0; background: transparent; z-index: 1;
}
.pos-shell .menu-search-inline .menu-search {
    display: block; width: 100%; min-width: 0; height: 42px; padding: 0 2.4rem 0 2.5rem; font-size: .95rem; font-weight: 500;
    border-width: 1.5px; border-radius: 999px; line-height: 42px;
}
.pos-shell .menu-search-inline .menu-search-icon { position: absolute; left: .95rem; top: 50%; transform: translateY(-50%); color: var(--p-muted); font-size: 1.05rem; pointer-events: none; }
.pos-shell .menu-search-inline .search-results-count {
    position: absolute; right: 2.4rem; top: 50%; transform: translateY(-50%); margin: 0; padding: .1rem .5rem;
    font-size: .72rem; font-weight: 700; color: var(--p-accent); background: var(--p-soft); border-radius: 999px; pointer-events: none;
}
.pos-shell .menu-search-inline .menu-search-clear {
    position: absolute; right: .4rem; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; min-height: 0; padding: 0;
    display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 50%; cursor: pointer;
    background: var(--p-surface-2); color: var(--p-muted);
}
.pos-shell .menu-search-inline .menu-search-clear:hover { background: var(--p-accent); color: var(--p-accent-ink); }
.pos-shell .menu-search-inline .menu-search:not(:placeholder-shown) { padding-right: 6.2rem; }
.pos-shell .menu-header .menu-search-inline input { color: var(--p-text); }
.pos-shell[data-pos-theme="restaurant_dense"] .menu-header .menu-search { background: #fff; border-color: transparent; }
.pos-shell[data-pos-theme="restaurant_dense"] .menu-header .pos-preview-search { color: var(--p-muted); }
.pos-shell[data-pos-theme="clean_hospitality"] .menu-header .menu-header-title { flex: 0 0 auto; }
.pos-shell[data-pos-theme="clean_hospitality"] .menu-header { justify-content: space-between; text-align: left; font-style: normal; }
.pos-shell[data-pos-theme="dense_terminal"] .menu-header .menu-search { border-radius: 2px; }

/* tighter category strip so the item grid starts higher */
.pos-shell .menu-layout { padding: .55rem .75rem; gap: .6rem; }
.pos-shell[data-category-orientation="horizontal"] .menu-category-sidebar { padding: .2rem .1rem .45rem; scrollbar-width: thin; }
.pos-shell[data-category-orientation="horizontal"] .menu-category-pill { min-height: 38px; padding: .3rem .85rem; }

@media (max-width: 768px) {
    .pos-shell .menu-header { padding: .5rem .65rem; gap: .5rem; }
    .pos-shell .menu-header-title { font-size: .95rem; }
    .pos-shell .menu-search-container.menu-search-inline { max-width: none; }
    .pos-shell .menu-search-inline .menu-search { height: 40px; }
}
/* POS top bar -----------------------------------------------------------------
   A balanced three-column grid:  logo (left) · screen tabs (centred) ·
   branch + account (right). Admin, AI Assistant, Lock and Log out are in the
   account menu. White surface, RPOS orange accents, no dark fills.
   Phones: the tabs move to the bottom bar (mobile-shell.css), the branch /
   outlet pickers into the account menu, and the logo sits in the middle. */

.app-topbar {
    --tb-accent: #e85d04;
    --tb-accent-deep: #c2410c;
    --tb-ink: #1f2430;
    --tb-muted: #6b7280;
    --tb-line: #ece5da;
    --tb-cream: #fff7f0;
    --tb-track: #f6f1ea;

    position: relative;
    z-index: 200;
    flex-shrink: 0;
    display: grid;
    /* Equal side columns keep the tabs exactly in the middle of the screen. */
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    grid-template-areas: "logo tabs end";
    align-items: center;
    column-gap: 16px;
    height: 64px;
    padding: 0 20px;
    background: #ffffff;
    border-bottom: 1px solid var(--tb-line);
    font-family: 'Outfit', system-ui, sans-serif;
}

.topbar-logo {
    grid-area: logo;
    justify-self: start;
    display: block;
    height: 26px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    object-position: left center;
}

/* ── Screen tabs ─────────────────────────────────────────────────────────── */
.topbar-tabs {
    grid-area: tabs;
    justify-self: center;
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 4px;
    border-radius: 14px;
    background: var(--tb-track);
}

.topbar-tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 14px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #4b5563;
    font: 600 .92rem/1 'Outfit', system-ui, sans-serif;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 140ms ease, color 140ms ease, box-shadow 140ms ease;
}
.topbar-tab-icon { display: inline-grid; place-items: center; font-size: 1.15rem; color: var(--tb-muted); transition: color 140ms ease; }
.topbar-tab:hover { color: var(--tb-ink); background: rgba(255, 255, 255, .75); }
.topbar-tab.is-active { color: var(--tb-accent); background: #ffffff; box-shadow: 0 1px 2px rgba(31, 36, 48, .08), 0 0 0 1px #f3dcc8; }
.topbar-tab.is-active .topbar-tab-icon { color: var(--tb-accent); }
.topbar-tab:focus-visible { outline: 2px solid var(--tb-accent); outline-offset: 2px; }

.topbar-badge {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--tb-accent);
    color: #ffffff;
    font: 800 .7rem/20px 'Outfit', system-ui, sans-serif;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* ── Right side: branch / outlet pickers + account ───────────────────────── */
.topbar-end {
    grid-area: end;
    justify-self: end;
    min-width: 0;
    max-width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-context {
    flex: 0 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Flex wrappers so the picker buttons can shrink (name gets "…") instead of overlapping. */
.app-topbar .branch-selector,
.app-topbar .outlet-selector { display: flex; min-width: 0; }

.app-topbar .branch-selector-button,
.app-topbar .outlet-selector-button {
    height: 40px;
    min-width: 0;
    max-width: 240px;
    padding: 0 12px;
    gap: 8px;
    border: 1px solid var(--tb-line);
    border-radius: 12px;
    background: #ffffff;
    color: var(--tb-ink);
    font: 600 .9rem/1 'Outfit', system-ui, sans-serif;
    box-shadow: none;
}
.app-topbar .branch-selector-button:hover,
.app-topbar .outlet-selector-button:hover { background: var(--tb-cream); border-color: #f3c9a8; box-shadow: none; }
.app-topbar .branch-info-compact,
.app-topbar .outlet-selector-info { min-width: 0; overflow: hidden; }
.app-topbar .branch-info-compact .branch-name,
.app-topbar .outlet-selector-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The branch code is in the switch-branch list; the bar shows the name only. */
.app-topbar .branch-info-compact .branch-code { display: none; }
.app-topbar .branch-dropdown { left: auto; right: 0; min-width: min(280px, calc(100vw - 24px)); }
.app-topbar .outlet-dropdown { min-width: min(220px, calc(100vw - 24px)); }
.app-topbar .outlet-selector--locked { height: 40px; border-radius: 12px; }

/* ── Account menu ────────────────────────────────────────────────────────── */
.topbar-account { position: relative; flex: 0 0 auto; }

.topbar-account-trigger {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 44px;
    padding: 2px 8px 2px 2px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    cursor: pointer;
    transition: background-color 140ms ease, border-color 140ms ease;
}
.topbar-account-trigger:hover,
.topbar-account-trigger.is-open { background: var(--tb-cream); border-color: #f3dcc8; }
.topbar-account-trigger:focus-visible { outline: 2px solid var(--tb-accent); outline-offset: 2px; }
.topbar-account-chevron { color: var(--tb-muted); font-size: 1rem; transition: transform 160ms ease; }
.topbar-account-trigger.is-open .topbar-account-chevron { transform: rotate(180deg); }

.topbar-avatar {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--tb-accent);
    color: #ffffff;
    font: 700 .85rem/1 'Outfit', system-ui, sans-serif;
    letter-spacing: .02em;
}
.topbar-avatar.is-large { width: 44px; height: 44px; font-size: .95rem; }

.topbar-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 1100;
    width: min(270px, calc(100vw - 24px));
    padding: 6px;
    background: #ffffff;
    border: 1px solid var(--tb-line);
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(31, 36, 48, .12), 0 2px 6px rgba(31, 36, 48, .06);
    transform-origin: top right;
    animation: topbar-menu-in 140ms ease-out;
}

.topbar-menu-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 4px;
    padding: 10px 10px 12px;
    border-bottom: 1px solid #f2ece3;
}
.topbar-menu-identity { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.topbar-menu-identity strong {
    overflow: hidden;
    color: var(--tb-ink);
    font: 700 .95rem/1.2 'Outfit', system-ui, sans-serif;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.topbar-role {
    align-self: flex-start;
    padding: 2px 8px;
    border-radius: 999px;
    background: #fff1e6;
    color: var(--tb-accent-deep);
    font: 700 .68rem/1.4 'Outfit', system-ui, sans-serif;
    letter-spacing: .06em;
    text-transform: uppercase;
}

/* Phones: branch / outlet pickers inside the menu. Their lists open in place. */
.topbar-menu-context {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 4px;
    padding: 4px 4px 10px;
    border-bottom: 1px solid #f2ece3;
}
.topbar-menu-label {
    padding: 2px 6px 0;
    color: var(--tb-muted);
    font: 700 .68rem/1.4 'Outfit', system-ui, sans-serif;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.topbar-menu .topbar-menu-context .branch-selector,
.topbar-menu .topbar-menu-context .outlet-selector { display: block; width: 100%; }
.topbar-menu .topbar-menu-context .branch-selector-button,
.topbar-menu .topbar-menu-context .outlet-selector-button,
.topbar-menu .topbar-menu-context .outlet-selector--locked {
    width: 100%;
    max-width: none;
    height: 44px;
    justify-content: flex-start;
    border-color: #f3dcc8;
    background: var(--tb-cream);
}
.topbar-menu .topbar-menu-context .branch-info-compact,
.topbar-menu .topbar-menu-context .outlet-selector-info { flex: 1 1 auto; text-align: left; }
.topbar-menu .topbar-menu-context :is(.branch-option, .outlet-option) { font-family: inherit; }
.topbar-menu .topbar-menu-context .branch-dropdown,
.topbar-menu .topbar-menu-context .outlet-dropdown {
    font-family: 'Outfit', system-ui, sans-serif;
    position: static;
    width: 100%;
    min-width: 0;
    max-height: 45vh;
    margin-top: 6px;
    overflow-y: auto;
    border: 1px solid var(--tb-line);
    border-radius: 12px;
    box-shadow: none;
}

.topbar-menu-item {
    width: 100%;
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 10px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--tb-ink);
    font: 600 .92rem/1.2 'Outfit', system-ui, sans-serif;
    text-align: left;
    cursor: pointer;
}
.topbar-menu-item svg { flex: 0 0 auto; color: var(--tb-muted); font-size: 1.1rem; }
.topbar-menu-item:hover { background: var(--tb-cream); }
.topbar-menu-item:focus-visible { outline: none; background: var(--tb-cream); box-shadow: inset 0 0 0 2px var(--tb-accent); }
.topbar-menu-item:disabled { opacity: .5; cursor: not-allowed; }
.topbar-menu-item.is-logout,
.topbar-menu-item.is-logout svg { color: var(--tb-accent-deep); }
.topbar-menu-divider { height: 1px; margin: 4px 6px; background: #f2ece3; }

.topbar-switch {
    position: relative;
    flex: 0 0 auto;
    width: 38px;
    height: 22px;
    margin-left: auto;
    border-radius: 999px;
    background: #e5e1db;
    transition: background-color 160ms ease;
}
.topbar-switch span {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(31, 36, 48, .2);
    transition: transform 160ms ease;
}
.topbar-switch.is-on { background: var(--tb-accent); }
.topbar-switch.is-on span { transform: translateX(16px); }

@keyframes topbar-menu-in {
    from { opacity: 0; transform: translateY(-4px) scale(.98); }
    to { opacity: 1; transform: none; }
}

/* ── Narrower desktops / tablets ─────────────────────────────────────────── */
@media (max-width: 1180px) {
    .app-topbar { column-gap: 12px; padding: 0 16px; }
    .topbar-tab { padding: 0 12px; }
    .app-topbar .branch-selector-button,
    .app-topbar .outlet-selector-button { max-width: 200px; }
}

@media (max-width: 1024px) {
    .topbar-logo { height: 22px; }
    .topbar-tab-icon { display: none; }
    .app-topbar .branch-selector-button,
    .app-topbar .outlet-selector-button { max-width: 170px; }
}

/* Not enough width for one row (small tablets, or mid-size screens that also
   show an outlet picker): logo left and pickers + account right on top, the
   screen tabs as a full-width row underneath. */
@media (min-width: 769px) and (max-width: 900px) {
    .app-topbar { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "logo end" "tabs tabs"; height: auto; row-gap: 8px; padding: 8px 16px; }
    .app-topbar .topbar-tabs { justify-self: stretch; }
    .app-topbar .topbar-tab { flex: 1 1 0; justify-content: center; }
    .app-topbar .topbar-tab-icon { display: inline-grid; }
}
@media (min-width: 769px) and (max-width: 1180px) {
    .app-topbar:has(.outlet-selector) { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "logo end" "tabs tabs"; height: auto; row-gap: 8px; padding: 8px 16px; }
    .app-topbar:has(.outlet-selector) .topbar-tabs { justify-self: stretch; }
    .app-topbar:has(.outlet-selector) .topbar-tab { flex: 1 1 0; justify-content: center; }
    .app-topbar:has(.outlet-selector) .topbar-tab-icon { display: inline-grid; }
}

/* ── Phones: tabs are in the bottom bar ──────────────────────────────────── */
@media (max-width: 768px) {
    /* Logo in the middle, account on the right. The tabs are in the bottom
       bar and the branch / outlet pickers are in the account menu. Equal
       side columns keep the logo truly centred. */
    .app-topbar {
        grid-template-columns: minmax(40px, 1fr) auto minmax(40px, 1fr);
        grid-template-areas: ". logo end";
        height: auto;
        min-height: 56px;
        column-gap: 10px;
        padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 8px;
    }

    .topbar-tabs { display: none; }
    .topbar-logo { justify-self: center; height: 22px; object-position: center; }

    .topbar-account-trigger { height: 40px; padding: 1px; }
    .topbar-account-chevron { display: none; }
    .topbar-avatar { width: 36px; height: 36px; font-size: .8rem; }

    .topbar-menu { width: min(300px, calc(100vw - 24px)); }
}

@media (max-width: 374px) {
    .topbar-logo { height: 18px; }
}

@media (prefers-reduced-motion: reduce) {
    .topbar-tab,
    .topbar-account-chevron,
    .topbar-switch,
    .topbar-switch span { transition: none; }
    .topbar-menu { animation: none; }
}
/* Phone navigation for every POS theme ---------------------------------------
   One bottom tab bar (Counter · Tables · Kitchen · History) on every screen,
   so staff can always get back; the top bar hides its tabs on phones.
   Selling screens that can't show menu and bill
   together get a Menu / Order switch at the top. Phones only (≤ 768px). */

.mobile-view-switch { display: none; }

@media (max-width: 768px) {
    /* The page (html) is what scrolls on a phone. index.css also makes <body>
       a scroll box, which silently stops every sticky bar (search, Menu/Order
       switch) from sticking. Keep body plain; clip still blocks sideways scroll. */
    html body:has(.main-wrapper):not(:has(.admin-page)) {
        overflow-y: visible !important;
        overflow-x: hidden;
        overflow-x: clip;
    }

    /* Bottom tab bar (the top bar's own phone layout is in app-topbar.css) */
    .mobile-nav.app-tabbar {
        display: flex;
        align-items: stretch;
        height: calc(64px + env(safe-area-inset-bottom, 0px));
        padding: 0 6px env(safe-area-inset-bottom, 0px);
        background: #ffffff;
        border-top: 1px solid #ece5da;
        box-shadow: 0 -4px 16px rgba(31, 36, 48, .05);
        z-index: 120;
    }

    .app-tab {
        flex: 1 1 0;
        min-width: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        padding: 6px 0 4px;
        border: 0;
        background: transparent;
        color: #6b7280;
        font: 600 .72rem/1.1 'Outfit', system-ui, sans-serif;
        letter-spacing: .01em;
        cursor: pointer;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    .app-tab-icon {
        position: relative;
        display: grid;
        place-items: center;
        width: 56px;
        height: 30px;
        border-radius: 999px;
        font-size: 1.4rem;
        transition: background-color 160ms ease, color 160ms ease;
    }

    .app-tab-label {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .app-tab.is-active { color: #e85d04; }
    .app-tab.is-active .app-tab-icon { background: rgba(232, 93, 4, .12); }
    .app-tab:focus-visible { outline: none; }
    .app-tab:focus-visible .app-tab-icon { box-shadow: 0 0 0 2px #e85d04; }

    .app-tab-badge {
        position: absolute;
        top: -4px;
        right: 4px;
        min-width: 18px;
        height: 18px;
        padding: 0 5px;
        display: grid;
        place-items: center;
        border-radius: 999px;
        background: #e85d04;
        color: #ffffff;
        font-size: .66rem;
        font-weight: 800;
        line-height: 1;
        font-variant-numeric: tabular-nums;
        box-shadow: 0 0 0 2px #ffffff;
    }

    /* Tables floor + reservations: index.css removes page padding on phones and
       this screen has none of its own, so it sat flush on the left edge and a
       wide child (status legend, floor plan) could nudge the page sideways.
       Even gutters on both sides, and nothing may push the page wider. */
    .main-wrapper > .app-container.screen-mode.lf-screen {
        padding-top: 12px;
        padding-left: 12px;
        padding-right: 12px;
        overflow-x: hidden;
        overflow-x: clip;
    }

    .lf-screen :is(.lf-root, .lf-bar, .lf-bar-top, .lf-areas, .lf-legend, .lf-body, .lf-body > *) { min-width: 0; max-width: 100%; }

    .lf-screen .lf-areas { width: 100%; }
    .lf-screen .lf-legend { width: 100%; box-sizing: border-box; }

    /* Floor toolbar: Reservations · Floor/List · Refresh stay on one tidy row. */
    .lf-screen .lf-bar-actions { flex-wrap: nowrap; min-width: 0; }
    .lf-screen .lf-bar-actions .svc-segmented { flex: 0 0 auto; flex-wrap: nowrap; }
    .lf-screen .lf-bar-actions svg { flex-shrink: 0; }

    .lf-screen :is(.lf-areas, .lf-legend) {
        overflow-x: auto;
        overscroll-behavior-x: contain;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 420px) {
    /* Narrow phones: the Floor / List switch shows its icons only (the words
       stay for screen readers), so nothing stacks or squeezes. */
    .lf-screen .lf-bar-actions .svc-btn { flex: 1 1 auto; min-width: 0; justify-content: center; white-space: nowrap; }
    .lf-screen .lf-bar-actions .svc-segmented button { font-size: 0; min-width: 44px; min-height: 36px; padding: 0 12px; justify-content: center; }
    .lf-screen .lf-bar-actions .svc-segmented button svg { width: 18px; height: 18px; }
    /* Two table cards per row even on 320px phones. */
    .lf-screen .lf-cards { grid-template-columns: repeat(auto-fill, minmax(min(130px, 100%), 1fr)); }
}

@media (max-width: 768px) {

    /* Every screen leaves room for the bar, so its last buttons stay reachable. */
    .main-wrapper > .app-container,
    .main-wrapper > .app-container.screen-mode {
        padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px) + 16px);
    }

    /* Menu / Order (/ AI) switch, kept in view while the menu scrolls. */
    .mobile-view-switch {
        display: flex;
        gap: 4px;
        position: sticky;
        top: 0;
        z-index: 40;
        margin: 8px 12px 4px;
        padding: 4px;
        background: #ffffff;
        border: 1px solid #ece5da;
        border-radius: 14px;
        box-shadow: 0 4px 14px rgba(31, 36, 48, .05);
    }

    .mvs-tab {
        flex: 1 1 0;
        min-width: 0;
        height: 40px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        border: 0;
        border-radius: 10px;
        background: transparent;
        color: #6b7280;
        font: 700 .9rem/1 'Outfit', system-ui, sans-serif;
        cursor: pointer;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        transition: background-color 160ms ease, color 160ms ease;
    }

    .mvs-tab.is-active { background: #e85d04; color: #ffffff; }
    .mvs-tab:focus-visible { outline: 2px solid #e85d04; outline-offset: 2px; }

    .mvs-badge {
        min-width: 20px;
        height: 20px;
        padding: 0 6px;
        display: inline-grid;
        place-items: center;
        border-radius: 999px;
        background: rgba(232, 93, 4, .14);
        color: #e85d04;
        font-size: .72rem;
        font-weight: 800;
        font-variant-numeric: tabular-nums;
    }

    .mvs-tab.is-active .mvs-badge { background: #ffffff; color: #e85d04; }
}

@media (prefers-reduced-motion: reduce) {
    .app-tab-icon,
    .mvs-tab { transition: none; }
}
/* RPOS Mobile Touch -----------------------------------------------------------
   Billing theme for phones and tablets. Same palette as every RPOS billing
   theme — white surfaces, warm cream neutrals, RPOS orange, dark ink — and
   always light. Layout comes from data-touch-layout on the shell:
     phone → one column, sticky search + categories, bill bar + bottom sheets
     split → product grid beside a permanent bill panel (tablets, desktops) */

.pos-shell[data-pos-theme="mobile_touch"] {
    --p-bg: #faf7f2;
    --p-surface: #ffffff;
    --p-surface-2: #fff7f0;
    --p-text: #1f2430;
    --p-muted: #6b7280;
    --p-border: #ece5da;
    --p-accent: #e85d04;
    --p-accent-2: #f48c06;
    --p-accent-ink: #ffffff;
    --p-soft: rgba(232, 93, 4, .10);
    --p-radius: 16px;
    --p-radius-sm: 12px;
    --p-shadow: none;
    --p-font: 'Outfit', system-ui, sans-serif;
    --tm-gutter: clamp(10px, 3.6vw, 16px);
    --tm-gap: 10px;
    --tm-tabbar: calc(64px + env(safe-area-inset-bottom, 0px));
    --tm-bill-bar: 60px;
    --tm-ring: #f5c4a0;
    -webkit-tap-highlight-color: transparent;
}

/* ── Phone layout ─────────────────────────────────────────────────────────── */
.pos-shell[data-pos-theme="mobile_touch"][data-touch-layout="phone"] {
    display: block;
    height: auto;
    max-width: none;
    padding: 0 0 calc(var(--tm-tabbar) + var(--tm-bill-bar) + 28px);
    overflow: visible;
    background: var(--p-bg);
}

.pos-shell[data-pos-theme="mobile_touch"][data-touch-layout="phone"] .touch-menu {
    display: flex;
    flex-direction: column;
    height: auto;
    overflow: visible;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.pos-shell[data-pos-theme="mobile_touch"][data-touch-layout="phone"] .touch-menu:not(.active) { display: none; }

/* AI suggestions view on phones (only when AI is switched on) */
.pos-shell[data-pos-theme="mobile_touch"][data-touch-layout="phone"] .ai-column:not(.active) { display: none; }
.pos-shell[data-pos-theme="mobile_touch"][data-touch-layout="phone"] .ai-column.active { display: flex; margin: 8px var(--tm-gutter); border-radius: var(--p-radius); }

.pos-shell[data-pos-theme="mobile_touch"][data-touch-layout="phone"] .tm-top {
    position: sticky;
    top: 0;
    z-index: 30;
    padding: 10px var(--tm-gutter) 8px;
    background: var(--p-bg);
    box-shadow: 0 1px 0 var(--p-border);
}

.main-wrapper--touch .mobile-view-switch { position: static; margin-bottom: 0; }

/* ── Split layout (tablets landscape, desktops) ──────────────────────────── */
.pos-shell[data-pos-theme="mobile_touch"][data-touch-layout="split"] {
    gap: 14px;
    padding: 14px;
    background: var(--p-bg);
}

.pos-shell[data-pos-theme="mobile_touch"][data-touch-layout="split"] .touch-menu {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    background: transparent;
    border: 0;
    box-shadow: none;
}

.pos-shell[data-pos-theme="mobile_touch"][data-touch-layout="split"] .tm-top { padding: 2px 2px 10px; }
.pos-shell[data-pos-theme="mobile_touch"][data-touch-layout="split"] .tm-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 2px 4px 16px 2px;
    overscroll-behavior: contain;
    scrollbar-width: thin;
}
.pos-shell[data-pos-theme="mobile_touch"][data-touch-layout="split"] .tm-grid {
    grid-template-columns: repeat(auto-fill, minmax(var(--pos-product-min, 160px), 1fr));
    padding: 0;
}
.pos-shell[data-pos-theme="mobile_touch"] .touch-dock.is-split { display: contents; }
/* Menu and bill fill the screen under the top bar exactly (14px shell padding top + bottom),
   so checkout stays on screen and the lines scroll. */
.pos-shell[data-pos-theme="mobile_touch"][data-touch-layout="split"] .touch-menu,
.pos-shell[data-pos-theme="mobile_touch"][data-touch-layout="split"] .to-panel {
    align-self: start;
    height: calc(100dvh - var(--app-topbar-h, 64px) - 28px);
    max-height: calc(100dvh - var(--app-topbar-h, 64px) - 28px);
}

/* ── Search + density toggle ─────────────────────────────────────────────── */
.pos-shell[data-pos-theme="mobile_touch"] .tm-top { display: flex; flex-direction: column; gap: 10px; }
.pos-shell[data-pos-theme="mobile_touch"] .tm-toolbar { display: flex; align-items: center; gap: 8px; }
.pos-shell[data-pos-theme="mobile_touch"] .tm-search { position: relative; flex: 1 1 auto; min-width: 0; }

.pos-shell[data-pos-theme="mobile_touch"] .tm-search-icon {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    color: var(--p-muted); font-size: 1.1rem; pointer-events: none;
}

.pos-shell[data-pos-theme="mobile_touch"] .tm-search-input {
    display: block;
    width: 100%;
    height: 48px;
    margin: 0;
    padding: 0 46px 0 42px;
    border: 1.5px solid var(--p-border);
    border-radius: 14px;
    background: var(--p-surface);
    color: var(--p-text);
    font: 500 16px/1 var(--p-font); /* 16px stops iOS zooming in on focus */
    -webkit-appearance: none;
    appearance: none;
    transition: border-color 140ms ease, box-shadow 140ms ease;
}
.pos-shell[data-pos-theme="mobile_touch"] .tm-search-input::placeholder { color: #9aa0aa; }
.pos-shell[data-pos-theme="mobile_touch"] .tm-search-input:focus { outline: none; border-color: var(--p-accent); box-shadow: 0 0 0 4px var(--p-soft); }
.pos-shell[data-pos-theme="mobile_touch"] .tm-search-input::-webkit-search-cancel-button,
.pos-shell[data-pos-theme="mobile_touch"] .tm-search-input::-webkit-search-decoration { -webkit-appearance: none; display: none; }

.pos-shell[data-pos-theme="mobile_touch"] .tm-search-clear {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    width: 36px; height: 36px; padding: 0; display: grid; place-items: center;
    border: 0; border-radius: 50%; background: var(--p-surface-2); color: var(--p-muted);
    font-size: 1.05rem; cursor: pointer; touch-action: manipulation;
}
.pos-shell[data-pos-theme="mobile_touch"] .tm-search-clear:active { background: var(--p-accent); color: var(--p-accent-ink); }

.pos-shell[data-pos-theme="mobile_touch"] .touch-icon-btn {
    flex: 0 0 48px; width: 48px; height: 48px; padding: 0;
    display: grid; place-items: center;
    border: 1.5px solid var(--p-border); border-radius: 14px;
    background: var(--p-surface); color: var(--p-text);
    font-size: 1.2rem; cursor: pointer; touch-action: manipulation;
    transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}
.pos-shell[data-pos-theme="mobile_touch"] .touch-icon-btn[aria-pressed="true"] { color: var(--p-accent); border-color: var(--p-accent); background: var(--p-surface-2); }
.pos-shell[data-pos-theme="mobile_touch"] .touch-icon-btn:active { background: var(--p-surface-2); }
.pos-shell[data-pos-theme="mobile_touch"] :is(.touch-icon-btn, .tm-search-clear, .tm-chip):focus-visible { outline: 2px solid var(--p-accent); outline-offset: 2px; }

/* ── Category chips ──────────────────────────────────────────────────────── */
.pos-shell[data-pos-theme="mobile_touch"] .tm-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    margin: 0 calc(-1 * var(--tm-gutter));
    padding: 0 var(--tm-gutter) 2px;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
}
.pos-shell[data-pos-theme="mobile_touch"][data-touch-layout="split"] .tm-chips { margin: 0; padding: 0 0 2px; }
.pos-shell[data-pos-theme="mobile_touch"] .tm-chips::-webkit-scrollbar { display: none; }

.pos-shell[data-pos-theme="mobile_touch"] .tm-chip {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 44px;
    padding: 0 16px;
    border: 1.5px solid var(--p-border);
    border-radius: 999px;
    background: var(--p-surface);
    color: var(--p-text);
    font: 600 .9rem/1 var(--p-font);
    white-space: nowrap;
    cursor: pointer;
    touch-action: manipulation;
    transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}
.pos-shell[data-pos-theme="mobile_touch"] .tm-chip svg { color: var(--p-accent); font-size: .95rem; }
.pos-shell[data-pos-theme="mobile_touch"] .tm-chip-count { font-size: .75rem; font-weight: 700; color: var(--p-muted); font-variant-numeric: tabular-nums; }
.pos-shell[data-pos-theme="mobile_touch"] .tm-chip.is-active { background: var(--p-accent); border-color: var(--p-accent); color: var(--p-accent-ink); }
.pos-shell[data-pos-theme="mobile_touch"] .tm-chip.is-active svg,
.pos-shell[data-pos-theme="mobile_touch"] .tm-chip.is-active .tm-chip-count { color: rgba(255, 255, 255, .9); }

/* ── Product grid + cards ────────────────────────────────────────────────── */
.pos-shell[data-pos-theme="mobile_touch"] .tm-results { margin: 2px var(--tm-gutter) 8px; font-size: .82rem; font-weight: 600; color: var(--p-muted); }
.pos-shell[data-pos-theme="mobile_touch"][data-touch-layout="split"] .tm-results { margin: 0 0 8px; }

.pos-shell[data-pos-theme="mobile_touch"] .tm-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--tm-gap);
    padding: 10px var(--tm-gutter) 0;
    align-items: stretch;
}
.pos-shell[data-pos-theme="mobile_touch"] [data-card-density="compact"] .tm-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }

/* Wider phones / small tablets in phone layout: let the grid fill the width. */
@media (min-width: 560px) {
    .pos-shell[data-pos-theme="mobile_touch"][data-touch-layout="phone"] .tm-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
    .pos-shell[data-pos-theme="mobile_touch"][data-touch-layout="phone"] [data-card-density="compact"] .tm-grid { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); }
}
/* 320px phones: three across is too small to read or hit. */
@media (max-width: 359px) {
    .pos-shell[data-pos-theme="mobile_touch"] [data-card-density="compact"] .tm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--tm-gap); }
    .pos-shell[data-pos-theme="mobile_touch"] .tm-density { display: none; }
}

.pos-shell[data-pos-theme="mobile_touch"] .tp-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--p-border);
    border-radius: var(--p-radius);
    background: var(--p-surface);
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    touch-action: manipulation;
    transition: transform 110ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
.pos-shell[data-pos-theme="mobile_touch"] .tp-card:active { transform: scale(.965); }
.pos-shell[data-pos-theme="mobile_touch"] .tp-card:focus-visible { outline: 3px solid var(--p-accent); outline-offset: 2px; }
.pos-shell[data-pos-theme="mobile_touch"] .tp-card.is-on-bill { border-color: var(--p-accent); box-shadow: 0 0 0 1px var(--p-accent); }
@media (hover: hover) {
    .pos-shell[data-pos-theme="mobile_touch"] .tp-card:hover { border-color: var(--tm-ring); box-shadow: 0 6px 18px rgba(232, 93, 4, .10); }
    .pos-shell[data-pos-theme="mobile_touch"] .tp-card.is-on-bill:hover { border-color: var(--p-accent); box-shadow: 0 0 0 1px var(--p-accent), 0 6px 18px rgba(232, 93, 4, .12); }
}

.pos-shell[data-pos-theme="mobile_touch"] .tp-media {
    position: relative;
    display: block;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: var(--p-surface-2);
}
.pos-shell[data-pos-theme="mobile_touch"] [data-card-density="compact"] .tp-media { aspect-ratio: 1 / 1; }
.pos-shell[data-pos-theme="mobile_touch"] .tp-photo { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }

/* No photo: the item's initials on cream, in RPOS orange. */
.pos-shell[data-pos-theme="mobile_touch"] .tp-fallback {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: #fff3e8;
    box-shadow: inset 0 -1px 0 var(--p-border);
}
.pos-shell[data-pos-theme="mobile_touch"] .tp-initials {
    display: grid;
    place-items: center;
    width: 3.1em;
    height: 3.1em;
    border-radius: 50%;
    background: var(--p-surface);
    color: var(--p-accent);
    font: 700 clamp(.95rem, 4.2vw, 1.2rem)/1 var(--p-font);
    letter-spacing: .04em;
    box-shadow: 0 0 0 1px #f6dcc6;
}

.pos-shell[data-pos-theme="mobile_touch"] .tp-qty {
    position: absolute;
    top: 8px;
    right: 8px;
    min-width: 30px;
    height: 30px;
    padding: 0 8px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: var(--p-accent);
    color: var(--p-accent-ink);
    font: 800 .92rem/1 var(--p-font);
    font-variant-numeric: tabular-nums;
    box-shadow: 0 0 0 2px var(--p-surface), 0 4px 10px rgba(232, 93, 4, .35);
}
.pos-shell[data-pos-theme="mobile_touch"] .tp-qty.is-bumped { animation: tm-pop 260ms cubic-bezier(.2, .9, .3, 1.35); }

.pos-shell[data-pos-theme="mobile_touch"] .tp-sizes {
    position: absolute;
    left: 8px;
    bottom: 8px;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .95);
    color: var(--p-accent);
    font: 700 .7rem/1 var(--p-font);
    letter-spacing: .02em;
    box-shadow: 0 1px 4px rgba(31, 36, 48, .08);
}

.pos-shell[data-pos-theme="mobile_touch"] .tp-body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 10px 10px;
}
.pos-shell[data-pos-theme="mobile_touch"] .tp-name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.5em;
    color: var(--p-text);
    font: 600 .9rem/1.25 var(--p-font);
    overflow-wrap: anywhere;
}
.pos-shell[data-pos-theme="mobile_touch"] .tp-price {
    margin-top: auto;
    color: var(--p-accent);
    font: 700 .95rem/1.2 var(--p-font);
    font-variant-numeric: tabular-nums;
}
.pos-shell[data-pos-theme="mobile_touch"] [data-card-density="compact"] .tp-body { padding: 6px 8px 8px; gap: 3px; }
.pos-shell[data-pos-theme="mobile_touch"] [data-card-density="compact"] .tp-name { font-size: .8rem; }
.pos-shell[data-pos-theme="mobile_touch"] [data-card-density="compact"] .tp-price { font-size: .84rem; }
.pos-shell[data-pos-theme="mobile_touch"] [data-card-density="compact"] .tp-qty { top: 6px; right: 6px; min-width: 26px; height: 26px; font-size: .82rem; }
.pos-shell[data-pos-theme="mobile_touch"] [data-card-density="compact"] .tp-sizes { left: 6px; bottom: 6px; font-size: .64rem; padding: 3px 6px; }

/* Tap feedback: a quick orange wash over the card. */
.pos-shell[data-pos-theme="mobile_touch"] .tp-flash {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: rgba(232, 93, 4, .14);
    pointer-events: none;
    animation: tm-flash 420ms ease-out forwards;
}

/* Loading */
.pos-shell[data-pos-theme="mobile_touch"] .tp-card.is-skeleton { cursor: default; }
.pos-shell[data-pos-theme="mobile_touch"] .tp-card.is-skeleton .tp-media,
.pos-shell[data-pos-theme="mobile_touch"] .tm-skel-line {
    background: linear-gradient(90deg, #f4ede3 0%, #fbf7f1 50%, #f4ede3 100%);
    background-size: 200% 100%;
    animation: tm-shimmer 1.2s ease-in-out infinite;
}
.pos-shell[data-pos-theme="mobile_touch"] .tm-skel-line { display: block; height: 12px; border-radius: 6px; }
.pos-shell[data-pos-theme="mobile_touch"] .tm-skel-line.is-short { width: 45%; }

/* Empty / no results */
.pos-shell[data-pos-theme="mobile_touch"] .tm-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin: 24px var(--tm-gutter);
    padding: 32px 20px;
    border: 1.5px dashed #e6d8c7;
    border-radius: var(--p-radius);
    background: var(--p-surface);
    color: var(--p-muted);
    text-align: center;
    font-size: .9rem;
}
.pos-shell[data-pos-theme="mobile_touch"] .tm-empty strong { color: var(--p-text); font-size: 1rem; }
.pos-shell[data-pos-theme="mobile_touch"] .tm-empty-action {
    margin-top: 8px; height: 44px; padding: 0 18px; border: 1.5px solid var(--p-accent); border-radius: 12px;
    background: var(--p-surface); color: var(--p-accent); font: 700 .9rem/1 var(--p-font); cursor: pointer;
}

/* ── Bill bar (phones) ───────────────────────────────────────────────────── */
.pos-shell[data-pos-theme="mobile_touch"] .touch-bill-bar {
    position: fixed;
    left: var(--tm-gutter);
    right: var(--tm-gutter);
    bottom: calc(var(--tm-tabbar) + 10px);
    z-index: 130;
    max-width: 640px;
    height: var(--tm-bill-bar);
    margin: 0 auto;
    padding: 0 16px 0 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 0;
    border-radius: 18px;
    background: var(--p-accent);
    color: var(--p-accent-ink);
    font: inherit;
    text-align: left;
    cursor: pointer;
    box-shadow: 0 10px 28px rgba(232, 93, 4, .32);
    touch-action: manipulation;
    transition: background-color 160ms ease, transform 110ms ease;
}
.pos-shell[data-pos-theme="mobile_touch"] .touch-bill-bar:active { transform: scale(.985); }
.pos-shell[data-pos-theme="mobile_touch"] .touch-bill-bar:focus-visible { outline: 3px solid var(--p-text); outline-offset: 2px; }
.pos-shell[data-pos-theme="mobile_touch"] .touch-bill-bar.is-quiet {
    background: var(--p-surface);
    color: var(--p-text);
    box-shadow: 0 0 0 1.5px var(--p-border), 0 8px 20px rgba(31, 36, 48, .07);
}

.pos-shell[data-pos-theme="mobile_touch"] .tbb-count {
    flex: 0 0 auto;
    min-width: 40px;
    height: 40px;
    padding: 0 6px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: var(--p-surface);
    color: var(--p-accent);
    font: 800 1.05rem/1 var(--p-font);
    font-variant-numeric: tabular-nums;
    animation: tm-pop 260ms cubic-bezier(.2, .9, .3, 1.35);
}
.pos-shell[data-pos-theme="mobile_touch"] .tbb-count.is-empty { background: var(--p-surface-2); font-size: 1.2rem; animation: none; }
.pos-shell[data-pos-theme="mobile_touch"] .tbb-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; line-height: 1.15; }
.pos-shell[data-pos-theme="mobile_touch"] .tbb-text strong { font: 700 .98rem/1.15 var(--p-font); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pos-shell[data-pos-theme="mobile_touch"] .tbb-text small { font-size: .78rem; opacity: .88; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pos-shell[data-pos-theme="mobile_touch"] .touch-bill-bar.is-quiet .tbb-text small { color: var(--p-muted); opacity: 1; }
.pos-shell[data-pos-theme="mobile_touch"] .tbb-total { flex: 0 0 auto; font: 800 1.15rem/1 var(--p-font); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pos-shell[data-pos-theme="mobile_touch"] .tbb-total--label { font-size: .95rem; font-weight: 700; }
.pos-shell[data-pos-theme="mobile_touch"] .touch-bill-bar.is-quiet .tbb-total { color: var(--p-muted); }
.pos-shell[data-pos-theme="mobile_touch"] .tbb-chevron { flex: 0 0 auto; font-size: 1.25rem; }

/* ── Sheets (bill on phones, sizes everywhere) ───────────────────────────── */
.pos-shell[data-pos-theme="mobile_touch"] .touch-scrim {
    position: fixed;
    inset: 0;
    z-index: 940;
    background: rgba(90, 52, 24, .22);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    animation: tm-fade 200ms ease-out;
}

/* The bill sheet is never transformed while open: the table bill's payment
   dialog lives inside it and must stay fixed to the screen. */
.pos-shell[data-pos-theme="mobile_touch"] .touch-dock.is-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 950;
    max-width: 640px;
    max-height: calc(100dvh - 40px - env(safe-area-inset-top, 0px));
    margin: 0 auto;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    display: flex;
    flex-direction: column;
    background: var(--p-surface);
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -1px 0 var(--p-border), 0 -14px 40px rgba(232, 93, 4, .14);
    outline: none;
    transform: translateY(105%);
    visibility: hidden;
    transition: transform 260ms cubic-bezier(.2, .8, .2, 1), visibility 0s linear 260ms;
}
.pos-shell[data-pos-theme="mobile_touch"] .touch-dock.is-sheet.is-open {
    transform: none;
    visibility: visible;
    transition: transform 300ms cubic-bezier(.2, .8, .2, 1), visibility 0s;
}
.pos-shell[data-pos-theme="mobile_touch"] .touch-dock.is-sheet > .column { display: flex; }

.pos-shell[data-pos-theme="mobile_touch"] .touch-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 960;
    max-width: 560px;
    max-height: calc(100dvh - 56px - env(safe-area-inset-top, 0px));
    margin: 0 auto;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    display: flex;
    flex-direction: column;
    background: var(--p-surface);
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -1px 0 var(--p-border), 0 -14px 40px rgba(232, 93, 4, .14);
    outline: none;
    animation: tm-sheet-in 260ms cubic-bezier(.2, .8, .2, 1);
    transition: transform 220ms cubic-bezier(.2, .8, .2, 1);
}
/* Tablets / desktops: the size picker is a centred card instead. */
.pos-shell[data-pos-theme="mobile_touch"][data-touch-layout="split"] .touch-sheet {
    top: 0;
    width: min(520px, calc(100vw - 48px));
    height: fit-content;
    max-height: 80vh;
    margin: auto;
    padding-bottom: 6px;
    border-radius: 24px;
    animation: tm-fade 180ms ease-out;
}
.pos-shell[data-pos-theme="mobile_touch"][data-touch-layout="split"] .touch-sheet .touch-sheet-grip { display: none; }

.pos-shell[data-pos-theme="mobile_touch"] .touch-sheet-grip {
    flex: 0 0 auto;
    height: 24px;
    display: grid;
    place-items: center;
    cursor: grab;
    touch-action: none;
}
.pos-shell[data-pos-theme="mobile_touch"] .touch-sheet-grip span { width: 42px; height: 5px; border-radius: 999px; background: #e3d8ca; }

/* Size picker */
.pos-shell[data-pos-theme="mobile_touch"] .vs-head { display: flex; align-items: center; gap: 12px; padding: 4px 16px 14px; border-bottom: 1px solid var(--p-border); }
.pos-shell[data-pos-theme="mobile_touch"][data-touch-layout="split"] .vs-head { padding-top: 18px; }
.pos-shell[data-pos-theme="mobile_touch"] .vs-thumb {
    flex: 0 0 56px; width: 56px; height: 56px; overflow: hidden;
    display: grid; place-items: center; border-radius: 14px; background: #fff3e8;
}
.pos-shell[data-pos-theme="mobile_touch"] .vs-thumb-photo { width: 100%; height: 100%; object-fit: cover; }
.pos-shell[data-pos-theme="mobile_touch"] .vs-thumb-initials { color: var(--p-accent); font: 800 1rem/1 var(--p-font); }
.pos-shell[data-pos-theme="mobile_touch"] .vs-title { flex: 1 1 auto; min-width: 0; }
.pos-shell[data-pos-theme="mobile_touch"] .vs-title h2 { margin: 0; color: var(--p-text); font: 700 1.1rem/1.25 var(--p-font); overflow-wrap: anywhere; }
.pos-shell[data-pos-theme="mobile_touch"] .vs-title p { margin: 3px 0 0; color: var(--p-muted); font-size: .8rem; line-height: 1.3; }

.pos-shell[data-pos-theme="mobile_touch"] .vs-options {
    list-style: none;
    margin: 0;
    padding: 12px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.pos-shell[data-pos-theme="mobile_touch"] .vs-option {
    width: 100%;
    min-height: 60px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border: 1.5px solid var(--p-border);
    border-radius: 16px;
    background: var(--p-surface);
    color: var(--p-text);
    font: inherit;
    text-align: left;
    cursor: pointer;
    touch-action: manipulation;
    transition: transform 110ms ease, background-color 140ms ease, border-color 140ms ease;
}
.pos-shell[data-pos-theme="mobile_touch"] .vs-option:active { transform: scale(.98); background: var(--p-surface-2); border-color: var(--p-accent); }
.pos-shell[data-pos-theme="mobile_touch"] .vs-option:focus-visible { outline: 2px solid var(--p-accent); outline-offset: 2px; }
.pos-shell[data-pos-theme="mobile_touch"] .vs-option.is-on-bill { border-color: var(--tm-ring); background: #fffaf5; }
@media (hover: hover) {
    .pos-shell[data-pos-theme="mobile_touch"] .vs-option:hover { border-color: var(--p-accent); }
}
.pos-shell[data-pos-theme="mobile_touch"] .vs-option-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pos-shell[data-pos-theme="mobile_touch"] .vs-option-name { font: 700 1rem/1.2 var(--p-font); overflow-wrap: anywhere; }
.pos-shell[data-pos-theme="mobile_touch"] .vs-option-detail { color: var(--p-muted); font-size: .8rem; }
.pos-shell[data-pos-theme="mobile_touch"] .vs-option-qty {
    flex: 0 0 auto; padding: 5px 9px; border-radius: 999px;
    background: var(--p-soft); color: var(--p-accent); font: 700 .74rem/1 var(--p-font); white-space: nowrap;
}
.pos-shell[data-pos-theme="mobile_touch"] .vs-option-price { flex: 0 0 auto; color: var(--p-accent); font: 800 1.05rem/1 var(--p-font); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ── Bill panel ──────────────────────────────────────────────────────────── */
.pos-shell[data-pos-theme="mobile_touch"] .to-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    background: var(--p-surface);
    border: 1px solid var(--p-border);
    border-radius: 20px;
    box-shadow: none;
}
.pos-shell[data-pos-theme="mobile_touch"] .touch-dock.is-sheet > .to-panel {
    flex: 0 1 auto;
    height: auto;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.pos-shell[data-pos-theme="mobile_touch"] .to-head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 16px 12px;
    border-bottom: 1px solid var(--p-border);
}
.pos-shell[data-pos-theme="mobile_touch"] .touch-dock.is-sheet .to-head { padding-top: 2px; }
.pos-shell[data-pos-theme="mobile_touch"] .to-title { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pos-shell[data-pos-theme="mobile_touch"] .to-title h2 { margin: 0; color: var(--p-text); font: 700 1.12rem/1.2 var(--p-font); }
.pos-shell[data-pos-theme="mobile_touch"] .to-count { color: var(--p-muted); font-size: .8rem; font-weight: 600; }
.pos-shell[data-pos-theme="mobile_touch"] .to-head-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.pos-shell[data-pos-theme="mobile_touch"] .to-mode select {
    height: 40px; max-width: 150px; padding: 0 10px; border: 1.5px solid var(--p-border); border-radius: 12px;
    background: var(--p-surface); color: var(--p-text); font: 600 .85rem/1 var(--p-font);
}

.pos-shell[data-pos-theme="mobile_touch"] .to-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 0 16px 16px;
}

.pos-shell[data-pos-theme="mobile_touch"] .to-empty {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: 40px 12px; color: var(--p-muted); text-align: center; font-size: .88rem; line-height: 1.4;
}
.pos-shell[data-pos-theme="mobile_touch"] .to-empty strong { color: var(--p-text); font-size: 1rem; }
.pos-shell[data-pos-theme="mobile_touch"] .to-empty-icon {
    width: 56px; height: 56px; margin-bottom: 6px; display: grid; place-items: center;
    border-radius: 18px; background: var(--p-surface-2); color: var(--p-accent); font-size: 1.5rem;
}

/* Lines */
.pos-shell[data-pos-theme="mobile_touch"] .to-lines { list-style: none; margin: 0; padding: 0; }
.pos-shell[data-pos-theme="mobile_touch"] .to-line {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "info total" "bottom bottom";
    align-items: start;
    gap: 6px 12px;
    padding: 12px 0 10px;
    border-bottom: 1px solid #f2ece3;
}
.pos-shell[data-pos-theme="mobile_touch"] .to-line-info { grid-area: info; min-width: 0; }
.pos-shell[data-pos-theme="mobile_touch"] .to-line-name { color: var(--p-text); font: 650 .98rem/1.25 var(--p-font); overflow-wrap: anywhere; }
.pos-shell[data-pos-theme="mobile_touch"] .to-line-bottom { grid-area: bottom; display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.pos-shell[data-pos-theme="mobile_touch"] .to-line-meta { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; color: var(--p-muted); font-size: .8rem; }
.pos-shell[data-pos-theme="mobile_touch"] .to-line-unit { font-variant-numeric: tabular-nums; }
.pos-shell[data-pos-theme="mobile_touch"] .to-line-total { grid-area: total; align-self: start; text-align: right; color: var(--p-text); font: 700 1rem/1.25 var(--p-font); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pos-shell[data-pos-theme="mobile_touch"] .to-line-actions { flex: 0 0 auto; display: flex; align-items: center; justify-content: flex-end; gap: 2px; }

.pos-shell[data-pos-theme="mobile_touch"] .to-size { position: relative; display: inline-flex; }
.pos-shell[data-pos-theme="mobile_touch"] .to-size select {
    position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; font-size: 16px;
}
.pos-shell[data-pos-theme="mobile_touch"] .to-size-label {
    display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 10px; border-radius: 999px;
    background: var(--p-soft); color: var(--p-accent); font: 700 .78rem/1 var(--p-font); white-space: nowrap;
}
.pos-shell[data-pos-theme="mobile_touch"] .to-size:focus-within .to-size-label { outline: 2px solid var(--p-accent); outline-offset: 2px; }

.pos-shell[data-pos-theme="mobile_touch"] .to-remove {
    width: 44px; height: 44px; padding: 0; display: grid; place-items: center;
    border: 0; border-radius: 12px; background: transparent; color: var(--p-muted); font-size: 1.1rem;
    cursor: pointer; touch-action: manipulation;
}
.pos-shell[data-pos-theme="mobile_touch"] .to-remove:active { background: var(--p-soft); color: var(--p-accent); }
@media (hover: hover) {
    .pos-shell[data-pos-theme="mobile_touch"] .to-remove:hover { color: var(--p-accent); background: var(--p-soft); }
}

.pos-shell[data-pos-theme="mobile_touch"] .to-stepper { display: inline-flex; align-items: center; padding: 3px; border-radius: 15px; background: var(--p-surface-2); }
.pos-shell[data-pos-theme="mobile_touch"] .to-stepper button {
    width: 44px; height: 44px; padding: 0; display: grid; place-items: center;
    border: 0; border-radius: 12px; background: var(--p-surface); color: var(--p-accent); font-size: 1.15rem;
    box-shadow: 0 1px 2px rgba(31, 36, 48, .08); cursor: pointer; touch-action: manipulation;
    transition: background-color 120ms ease, color 120ms ease;
}
.pos-shell[data-pos-theme="mobile_touch"] .to-stepper button:active { background: var(--p-accent); color: var(--p-accent-ink); }
.pos-shell[data-pos-theme="mobile_touch"] .to-qty { min-width: 40px; text-align: center; color: var(--p-text); font: 800 1.05rem/1 var(--p-font); font-variant-numeric: tabular-nums; }
.pos-shell[data-pos-theme="mobile_touch"] :is(.to-remove, .to-stepper button, .to-ebill, .to-charge):focus-visible { outline: 2px solid var(--p-accent); outline-offset: 2px; }

/* Discount, parcel, customer */
.pos-shell[data-pos-theme="mobile_touch"] .to-adjust { display: flex; flex-direction: column; gap: 6px; padding: 12px 0 4px; }
.pos-shell[data-pos-theme="mobile_touch"] .to-field {
    min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
    color: var(--p-text); font: 600 .92rem/1.2 var(--p-font);
}
.pos-shell[data-pos-theme="mobile_touch"] .to-field.is-stacked { min-height: 0; flex-direction: column; align-items: stretch; gap: 6px; }
.pos-shell[data-pos-theme="mobile_touch"] .to-field.is-stacked > span:first-child { color: var(--p-muted); font-size: .78rem; }
.pos-shell[data-pos-theme="mobile_touch"] .to-input-wrap { position: relative; display: inline-flex; align-items: center; }
.pos-shell[data-pos-theme="mobile_touch"] .to-panel :is(input[type="number"], input[type="text"], input[type="tel"], input[type="email"]) {
    width: 100%;
    height: 44px;
    margin: 0;
    padding: 0 12px;
    border: 1.5px solid var(--p-border);
    border-radius: 12px;
    background: var(--p-surface);
    color: var(--p-text);
    font: 600 16px/1 var(--p-font);
    box-shadow: none;
}
.pos-shell[data-pos-theme="mobile_touch"] .to-panel input:focus { outline: none; border-color: var(--p-accent); box-shadow: 0 0 0 4px var(--p-soft); }
.pos-shell[data-pos-theme="mobile_touch"] .to-panel input:disabled { background: var(--p-surface-2); color: var(--p-muted); }
.pos-shell[data-pos-theme="mobile_touch"] .to-customer input { text-align: left; }
.pos-shell[data-pos-theme="mobile_touch"] .to-adjust input[type="number"] { width: 112px; text-align: right; font-variant-numeric: tabular-nums; }
.pos-shell[data-pos-theme="mobile_touch"] .to-adjust input.discount-input { padding-right: 32px; }
.pos-shell[data-pos-theme="mobile_touch"] .to-input-unit { position: absolute; right: 12px; color: var(--p-muted); font-weight: 700; pointer-events: none; }
.pos-shell[data-pos-theme="mobile_touch"] .to-switch { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.pos-shell[data-pos-theme="mobile_touch"] .to-switch input { width: 22px; height: 22px; margin: 0; accent-color: var(--p-accent); }
.pos-shell[data-pos-theme="mobile_touch"] .to-note { margin: 0; color: var(--p-accent); font-size: .78rem; font-weight: 600; }

.pos-shell[data-pos-theme="mobile_touch"] .to-customer {
    margin-top: 6px; padding: 0 14px; border: 1px solid var(--p-border); border-radius: 14px; background: var(--p-surface);
}
.pos-shell[data-pos-theme="mobile_touch"] .to-customer[open] { padding-bottom: 14px; }
.pos-shell[data-pos-theme="mobile_touch"] .to-customer summary {
    min-height: 50px; display: flex; align-items: center; gap: 10px; list-style: none; cursor: pointer;
    color: var(--p-text); font: 600 .92rem/1.2 var(--p-font);
}
.pos-shell[data-pos-theme="mobile_touch"] .to-customer summary::-webkit-details-marker { display: none; }
.pos-shell[data-pos-theme="mobile_touch"] .to-customer summary small {
    margin-left: auto; max-width: 50%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    color: var(--p-muted); font-weight: 500;
}
.pos-shell[data-pos-theme="mobile_touch"] .to-customer summary::after {
    content: ''; flex: 0 0 auto; width: 8px; height: 8px; margin: 0 2px 3px 0;
    border-right: 2px solid var(--p-muted); border-bottom: 2px solid var(--p-muted); transform: rotate(45deg);
    transition: transform 160ms ease;
}
.pos-shell[data-pos-theme="mobile_touch"] .to-customer[open] summary::after { transform: rotate(-135deg); margin-bottom: -3px; }
.pos-shell[data-pos-theme="mobile_touch"] .to-customer summary:focus-visible { outline: 2px solid var(--p-accent); outline-offset: 4px; border-radius: 8px; }
.pos-shell[data-pos-theme="mobile_touch"] .to-customer .to-field + .to-field { margin-top: 10px; }
.pos-shell[data-pos-theme="mobile_touch"] .to-customer .input-wrapper { position: relative; display: block; }

/* Totals */
.pos-shell[data-pos-theme="mobile_touch"] .to-breakdown { margin: 14px 0 0; display: flex; flex-direction: column; gap: 8px; }
.pos-shell[data-pos-theme="mobile_touch"] .to-breakdown > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; color: var(--p-muted); font-size: .9rem; }
.pos-shell[data-pos-theme="mobile_touch"] .to-breakdown dt small { display: block; margin-top: 2px; font-size: .72rem; opacity: .85; }
.pos-shell[data-pos-theme="mobile_touch"] .to-breakdown dd { margin: 0; color: var(--p-text); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pos-shell[data-pos-theme="mobile_touch"] .to-breakdown .is-saving dd { color: var(--p-accent); }

/* Checkout */
.pos-shell[data-pos-theme="mobile_touch"] .to-footer {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 16px 14px;
    border-top: 1px solid var(--p-border);
    background: var(--p-surface);
}
.pos-shell[data-pos-theme="mobile_touch"] .to-print { display: flex; gap: 8px; }
.pos-shell[data-pos-theme="mobile_touch"] .to-print-chip {
    position: relative; flex: 1 1 0; height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border: 1.5px solid var(--p-border); border-radius: 12px; color: var(--p-muted);
    font: 600 .85rem/1 var(--p-font); cursor: pointer; user-select: none;
}
.pos-shell[data-pos-theme="mobile_touch"] .to-print-chip input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.pos-shell[data-pos-theme="mobile_touch"] .to-print-chip::before {
    content: ''; width: 16px; height: 16px; border: 2px solid currentColor; border-radius: 5px; box-sizing: border-box;
}
.pos-shell[data-pos-theme="mobile_touch"] .to-print-chip.is-on { border-color: var(--p-accent); background: var(--p-surface-2); color: var(--p-accent); }
.pos-shell[data-pos-theme="mobile_touch"] .to-print-chip.is-on::before {
    border-color: var(--p-accent);
    background: var(--p-accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='white' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 8.5l3 3 6-7'/%3E%3C/svg%3E") center / 12px no-repeat;
}
.pos-shell[data-pos-theme="mobile_touch"] .to-print-chip:focus-within { outline: 2px solid var(--p-accent); outline-offset: 2px; }

.pos-shell[data-pos-theme="mobile_touch"] .to-footer { container-type: inline-size; }
.pos-shell[data-pos-theme="mobile_touch"] .to-actions { display: flex; gap: 10px; }
/* Narrow bill (small phones, slim tablet panel): E-Bill above Finalize, both full width. */
@container (max-width: 340px) {
    .pos-shell[data-pos-theme="mobile_touch"] .to-actions { flex-direction: column; }
    .pos-shell[data-pos-theme="mobile_touch"] .to-ebill { height: 44px; }
}
.pos-shell[data-pos-theme="mobile_touch"] .to-ebill {
    flex: 0 0 auto; height: 56px; padding: 0 16px; border: 1.5px solid var(--p-accent); border-radius: 16px;
    background: var(--p-surface); color: var(--p-accent); font: 700 .9rem/1.1 var(--p-font); cursor: pointer; touch-action: manipulation;
}
.pos-shell[data-pos-theme="mobile_touch"] .to-charge {
    flex: 1 1 auto; min-width: 0; height: 56px; padding: 0 20px;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    border: 0; border-radius: 16px; background: var(--p-accent); color: var(--p-accent-ink);
    font: 700 1.05rem/1 var(--p-font); cursor: pointer; touch-action: manipulation;
    box-shadow: 0 8px 20px rgba(232, 93, 4, .28);
    transition: transform 110ms ease, filter 140ms ease;
}
.pos-shell[data-pos-theme="mobile_touch"] .to-charge span { white-space: nowrap; }
.pos-shell[data-pos-theme="mobile_touch"] .to-charge strong { font: 800 1.2rem/1 var(--p-font); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pos-shell[data-pos-theme="mobile_touch"] .to-charge:active { transform: scale(.98); }
@media (hover: hover) {
    .pos-shell[data-pos-theme="mobile_touch"] .to-charge:hover { filter: brightness(1.05); }
}
@media (max-width: 374px) {
    .pos-shell[data-pos-theme="mobile_touch"] .to-actions { flex-direction: column; }
    .pos-shell[data-pos-theme="mobile_touch"] .to-ebill { height: 44px; }
}

/* ── Table Billing inside the dock ───────────────────────────────────────── */
.pos-shell[data-pos-theme="mobile_touch"] .touch-dock--table.is-sheet > .tb-panel {
    flex: 0 1 auto;
    min-height: 0;
    height: auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}
.pos-shell[data-pos-theme="mobile_touch"][data-touch-layout="split"] .tb-panel { border-radius: 20px; box-shadow: none; }
/* Same RPOS palette as the counter: Send KOT in deep brand orange, not near-black. */
.pos-shell[data-pos-theme="mobile_touch"] .tb-send { background: #c2410c !important; border-color: #c2410c; color: #ffffff !important; }

/* Visually hidden text for screen readers */
.pos-shell[data-pos-theme="mobile_touch"] .sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ── Motion ──────────────────────────────────────────────────────────────── */
@keyframes tm-pop { 0% { transform: scale(.6); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }
@keyframes tm-flash { from { opacity: 1; } to { opacity: 0; } }
@keyframes tm-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes tm-sheet-in { from { transform: translateY(100%); } to { transform: none; } }
@keyframes tm-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

@media (prefers-reduced-motion: reduce) {
    .pos-shell[data-pos-theme="mobile_touch"] *,
    .pos-shell[data-pos-theme="mobile_touch"] *::before,
    .pos-shell[data-pos-theme="mobile_touch"] *::after {
        animation: none !important;
        transition: none !important;
    }
    .pos-shell[data-pos-theme="mobile_touch"] .tp-flash { display: none; }
}

/* ── Billing Theme settings preview (scaled frame, demo data) ─────────────── */
.pos-preview-shell.pos-shell[data-pos-theme="mobile_touch"][data-touch-layout="split"] .touch-menu,
.pos-preview-shell.pos-shell[data-pos-theme="mobile_touch"][data-touch-layout="split"] .to-panel {
    align-self: stretch;
    height: auto;
    max-height: 100%;
}
.pos-preview-shell.pos-shell[data-pos-theme="mobile_touch"] .tm-search-input { display: flex; align-items: center; color: #9aa0aa; }
.pos-preview-topbar.is-phone { height: 56px; flex-basis: 56px; gap: 12px; padding: 0 16px; font-size: 15px; }
.pos-preview-topbar.is-phone strong { font-size: 21px; }
.pos-preview-tabbar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 140;
    height: 64px;
    display: flex;
    padding: 0 6px;
    background: #ffffff;
    border-top: 1px solid #ece5da;
}
.pos-preview-tab {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: #6b7280;
    font: 600 11.5px/1.1 'Outfit', system-ui, sans-serif;
}
.pos-preview-tab-icon { width: 56px; height: 30px; display: grid; place-items: center; border-radius: 999px; font-size: 22px; }
.pos-preview-tab.is-active { color: #e85d04; }
.pos-preview-tab.is-active .pos-preview-tab-icon { background: rgba(232, 93, 4, .12); }
/* iPhone / iPad only: places where iOS draws the app differently from Android.
   Imported last from index.tsx. -webkit-touch-callout exists only in iOS WebKit,
   so the @supports block never applies on Android, Windows or desktop browsers.
   The viewport (no auto-zoom on tapped text boxes) is set by public/ios-viewport.js. */

@supports (-webkit-touch-callout: none) {
    /* On iOS this old property turns a scroll area into its own layer, so pop-ups
       opened inside it (End of Day report, forms, sheets) slide UNDER sticky headers.
       Android ignores it, and iOS 13+ scrolls smoothly without it. */
    *,
    *::before,
    *::after {
        -webkit-overflow-scrolling: auto !important;
    }

    /* Date and time boxes: iOS draws them as centred grey pills with their own
       minimum width, which can push a form sideways. Draw them like the other
       text boxes, left-aligned, as on Android. */
    input:is([type="date"], [type="time"], [type="datetime-local"], [type="month"], [type="week"]) {
        -webkit-appearance: none;
        appearance: none;
        min-width: 0;
        max-width: 100%;
        text-align: left;
    }

    /* Keeps an empty date box from collapsing to a sliver once its iOS look is removed. */
    input:is([type="date"], [type="time"], [type="datetime-local"], [type="month"], [type="week"])::-webkit-date-and-time-value {
        min-height: 1.5em;
        margin: 0;
        text-align: left;
    }

    /* Search boxes: iOS forces rounded grey fields and ignores some padding. */
    input[type="search"] {
        -webkit-appearance: none;
        appearance: none;
    }
}

/* Inside the iOS app only (class set by public/ios-viewport.js). */
html.is-ios-app {
    /* No rubber-band bounce when a page is pulled past its top or bottom. */
    overscroll-behavior-y: none;
    /* No link-preview pop-up when a button or picture is pressed and held. */
    -webkit-touch-callout: none;
}

html.is-ios-app :is(input, textarea, [contenteditable="true"]) {
    -webkit-touch-callout: default;
}
