/* Cloffy café dashboards — brown + white */
:root {
    --coffee-900: #2b1d14;
    --coffee-800: #3b271a;
    --coffee-700: #4e3524;
    --coffee-500: #8b5e3c;
    --coffee-300: #c9a37a;
    --cream-50:   #ffffff;
    --cream-100:  #f7f1e8;
    --cream-200:  #efe4d4;
    --accent:     #8b5e3c;
    --accent-hover:#6f4a2f;
    --success-bg: #f3ebe3;
    --danger-bg:  #fbecec;
    --info-bg:    #e8f1fb;
    --warn-bg:    #fff5e0;
    --border:     #e3d8c4;
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body {
    margin: 0; padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--cream-50);
    color: var(--coffee-900);
    font-size: 1rem;       /* 16px base */
    line-height: 1.5;
}
.small, small { font-size: 0.85rem; }   /* ~13.6px */

/* ============= GLOBAL THIN SCROLLBARS ============= */
/* Applies to page body, modals, tables, and any overflowing element */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(139, 94, 60, 0.35) transparent;
}
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: rgba(0,0,0,0.04); }
*::-webkit-scrollbar-thumb {
    background: rgba(139, 94, 60, 0.35);
    border-radius: 4px;
}
*::-webkit-scrollbar-thumb:hover { background: rgba(139, 94, 60, 0.6); }

.app-shell {
    display: flex;
    min-height: 100vh;
}

/* ============= SIDEBAR ============= */
.sidebar {
    width: 240px;
    background: var(--coffee-800);
    color: #f4e7d6;
    padding: 20px 0 0;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Brand at top */
.sidebar .brand {
    flex-shrink: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #fff;
    padding: 0 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar .brand i { color: var(--accent); }
.sidebar .brand img.brand-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 10px;
    background: #fff;
    flex-shrink: 0;
}
.sidebar .brand .brand-sub {
    display: block;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: rgba(255,255,255,0.65);
    margin-top: 2px;
}

/* Scrollable nav area in the middle.
   IMPORTANT: plain block layout, NOT flex. Bootstrap's .nav class was
   forcing horizontal layout on some browsers / cached states. */
.sidebar-nav {
    flex: 1 1 auto;
    display: block;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 0 12px;
    margin: 0;
    min-height: 0;
    /* Firefox thin scrollbar */
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.2) transparent;
}
/* Chrome / Edge / Safari thin scrollbar */
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
}
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.4); }

/* Section labels inside nav */
.sidebar .side-section {
    display: block;
    width: 100%;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.5);
    padding: 16px 20px 6px;
}

/* Nav links inside nav — full-width blocks, never wrap */
.sidebar .side-link {
    display: block;
    width: 100%;
    padding: 10px 20px;
    color: #e9d9be;
    font-size: 1rem;
    text-decoration: none;
    border-left: 3px solid transparent;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar .side-link i {
    display: inline-block;
    width: 18px;
    margin-right: 8px;
    text-align: center;
}
.sidebar .side-link:hover {
    background: rgba(255,255,255,0.05);
    color: #fff;
}
.sidebar .side-link.active {
    background: var(--coffee-900);
    color: #fff;
    border-left-color: var(--accent);
    font-weight: 500;
}

/* Footer pinned at the bottom */
.sidebar-footer {
    flex-shrink: 0;
    border-top: 1px solid rgba(255,255,255,0.1);
    padding: 12px 16px 14px;
    background: var(--coffee-900);
}
.sidebar-footer .user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 4px 10px;
}
.sidebar-footer .user-info i {
    font-size: 1.7rem;
    color: var(--accent);
    flex-shrink: 0;
}
.sidebar-footer .user-meta { line-height: 1.2; min-width: 0; }
.sidebar-footer .user-name {
    font-weight: 600;
    color: #fff;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-footer .user-role {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.55);
    text-transform: capitalize;
    letter-spacing: 0.3px;
}
.sidebar-footer .logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 9px 12px;
    background: rgba(214,70,58,0.15);
    color: #ffb3ad;
    border: 1px solid rgba(214,70,58,0.3);
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s;
}
.sidebar-footer .logout-btn:hover {
    background: #d6463a;
    color: #fff;
    border-color: #d6463a;
}
.sidebar-footer .logout-btn i { font-size: 1rem; }

/* ============= MAIN ============= */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.topbar {
    background: #fff;
    padding: 14px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.page-title {
    font-size: 1.5rem;        /* 24px */
    margin: 0;
    color: var(--coffee-900);
    font-weight: 600;
}
.page-body {
    padding: 24px;
}

/* ============= CARDS ============= */
.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 18px;
    border: 1px solid var(--border);
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
    height: 100%;
}
.stat-card .label {
    font-size: 0.85rem;       /* 13.6px */
    color: #7a6a55;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}
.stat-card .value {
    font-size: 2rem;          /* 32px */
    font-weight: 700;
    color: var(--coffee-900);
    line-height: 1.1;
}
.value-suffix {
    font-size: 0.45em;        /* relative — sits at ~14.4px when value is 32px */
    font-weight: 500;
    color: var(--coffee-500);
    margin-left: 6px;
    text-transform: lowercase;
    letter-spacing: 0.3px;
    vertical-align: 0.25em;
}
.stat-card .sub {
    font-size: 0.85rem;       /* 13.6px */
    color: #9b8a73;
    margin-top: 6px;
}
.stat-card.input  { border-top: 3px solid #2e9e57; }
.stat-card.output { border-top: 3px solid #2e6cd6; }
.stat-card.sale    { border-top: 3px solid #2e6cd6; }
.stat-card.consumption { border-top: 3px solid #18a2b8; }
.stat-card.wastage { border-top: 3px solid #d6463a; }
.stat-card.adjustment { border-top: 3px solid #d6a000; }
.stat-card.remaining { border-top: 3px solid var(--accent); }

/* Clickable summary cards (Daily Movement filter) */
.stat-card.clickable { cursor: pointer; transition: box-shadow .15s ease, transform .15s ease; }
.stat-card.clickable:hover { box-shadow: 0 4px 14px rgba(0,0,0,.12); transform: translateY(-1px); }
.stat-card.clickable:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.stat-card.clickable.active { box-shadow: 0 0 0 2px var(--accent) inset, 0 4px 14px rgba(0,0,0,.10); }

/* Quantity + money dual display */
.qty-money-cell { min-width: 5.5rem; white-space: nowrap; }
.qty-money-cell .qty-money-qty { line-height: 1.35; }
.qty-money-cell .qty-money-value { line-height: 1.3; font-weight: 600; color: var(--coffee-700); }
.kpi-metric-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    font-size: 0.9rem;
    margin-top: 4px;
}
.kpi-metric-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #9b8a73;
}
.kpi-metric-value { font-weight: 700; color: var(--coffee-900); }
.kpi-metric-value.kpi-money { color: var(--coffee-800); }
.kpi-metric-sub { font-size: 0.8rem; color: #9b8a73; }
.qty-money-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px; }
.qty-money-line-money { font-weight: 600; color: var(--coffee-800); }
.stock-tracking-legend {
    background: var(--cream-100);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.85rem;
    color: var(--coffee-700);
}
.stock-tracking-legend strong { color: var(--coffee-900); }

.content-card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.content-card .card-title-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.content-card h2 {
    font-size: 1.15rem;       /* 18.4px */
    margin: 0;
    font-weight: 600;
    color: var(--coffee-800);
}

/* ============= TABLES ============= */
.table {
    font-size: 0.95rem;       /* 15.2px - readable but slightly tighter than body */
    margin-bottom: 0;
}
.table thead th {
    background: var(--cream-100);
    color: var(--coffee-800);
    font-size: 0.8rem;        /* 12.8px - headers stay small */
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border-bottom: 2px solid var(--border) !important;
    padding: 12px;
    font-weight: 600;
}
.table tbody td { padding: 12px; vertical-align: middle; }
.table tbody tr:hover { background: var(--cream-50); }
.table tbody tr.cat-row { cursor: pointer; }
.table tbody tr.cat-row:hover { background: var(--cream-100); }
.table tbody tr.cat-row .action-cell { cursor: default; }

/* Pagination bar */
.pagination-bar select.form-select-sm { padding: 4px 26px 4px 10px; }
.pagination-bar button:disabled { opacity: 0.5; }

/* Sortable column headers */
.table thead th.sortable {
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
    padding-right: 22px;
    position: relative;
}
.table thead th.sortable:hover { background: var(--cream-200); }
.table thead th .sort-arrow {
    margin-left: 4px;
    opacity: 0.4;
    font-size: 0.85em;
    display: inline-block;
    transition: opacity 0.15s;
}
.table thead th.sortable:hover .sort-arrow { opacity: 0.75; }
.table thead th.sort-asc, .table thead th.sort-desc { background: var(--cream-200); color: var(--coffee-900); }
.table thead th.sort-asc .sort-arrow, .table thead th.sort-desc .sort-arrow {
    opacity: 1;
    color: var(--accent);
}

/* Tom Select - cafe theme override */
.ts-wrapper .ts-control {
    border-color: var(--border) !important;
    font-size: 1rem;
    padding: 7px 12px;
    min-height: 40px;
}
.ts-wrapper.focus .ts-control,
.ts-wrapper .ts-control:focus-within {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 0.18rem rgba(201,122,60,0.18) !important;
}
.ts-dropdown { border-color: var(--border) !important; }
.ts-dropdown .active { background: var(--accent) !important; color: #fff !important; }
.ts-dropdown .option { padding: 8px 12px; font-size: 0.95rem; }
.ts-wrapper.single .ts-control { background: #fff !important; }
.stock-searchable-select-wrap { position: relative; }
.stock-select__control { border-radius: 0.375rem; }
.stock-select__menu { border-radius: 0.375rem; }
.stock-select__placeholder {
    color: #a89a88 !important;
    font-weight: 400;
}
/* Dull placeholder text on stock form inputs */
body.stock-portal-active .stock-matrix-cell input::placeholder,
body.stock-portal-active .decoction-flavour-editor input::placeholder,
body.stock-portal-active .category-ingredient-picker input::placeholder,
body.stock-portal-active .choice-stock-editor input::placeholder {
    color: #a89a88;
    opacity: 1;
}
.table-responsive {
    border: 1px solid var(--border);
    border-radius: 8px;
    /* Bootstrap's .table-responsive already sets overflow-x: auto; we just style the scrollbar */
    -webkit-overflow-scrolling: touch;
}
.table-responsive::-webkit-scrollbar { height: 8px; }
.table-responsive::-webkit-scrollbar-thumb { background: var(--coffee-300); border-radius: 4px; }
.table-responsive::-webkit-scrollbar-track  { background: var(--cream-100); }
/* Sticky first column on mobile so item name stays visible while scrolling */
@media (max-width: 768px) {
    .table-sticky-first thead th:first-child,
    .table-sticky-first tbody td:first-child {
        position: sticky;
        left: 0;
        background: #fff;
        z-index: 2;
        box-shadow: 2px 0 4px rgba(0,0,0,0.04);
        min-width: 130px;
    }
    .table-sticky-first thead th:first-child { background: var(--cream-100); }
    .table-sticky-first tbody tr:hover td:first-child { background: var(--cream-50); }
}

/* ============= BADGES / PILLS ============= */
.badge-type {
    padding: 4px 10px;
    font-size: 0.78rem;       /* 12.5px */
    border-radius: 12px;
    font-weight: 500;
    letter-spacing: 0.3px;
}
.badge-INPUT       { background: var(--success-bg); color: #1e7c43; }
.badge-OUTPUT      { background: var(--info-bg);    color: #1f55ab; }
.badge-SALE        { background: var(--info-bg);    color: #1f55ab; }
.badge-CONSUMPTION { background: #d8f0f3;           color: #0e7484; }
.badge-WASTAGE     { background: var(--danger-bg);  color: #a3322a; }
.badge-ADJUSTMENT  { background: var(--warn-bg);    color: #8a5b00; }

.stock-warn { color: #d6463a; font-weight: 600; }
.stock-ok   { color: #2e9e57; font-weight: 600; }

/* ============= FORMS ============= */
.form-label { font-weight: 500; color: var(--coffee-800); font-size: 0.95rem; margin-bottom: 6px; }
.form-control, .form-select {
    border-color: var(--border);
    font-size: 1rem;          /* 16px - prevents iOS Safari auto-zoom on focus */
    padding: 9px 12px;
}
.form-control:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 0.18rem rgba(201,122,60,0.18);
}
.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.btn-primary:hover, .btn-primary:focus {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: #fff;
}
.btn-success {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.btn-success:hover, .btn-success:focus, .btn-success:active {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: #fff;
}
.text-success { color: var(--coffee-500) !important; }
.bg-success-subtle { background-color: var(--success-bg) !important; }
.text-bg-success {
    background-color: var(--accent) !important;
    color: #fff !important;
}
.btn-outline-secondary { color: var(--coffee-700); border-color: var(--border); }
.btn-outline-secondary:hover { background: var(--cream-100); color: var(--coffee-900); border-color: var(--coffee-300); }

/* ============= MODALS ============= */
.modal-header { background: var(--cream-100); border-bottom: 1px solid var(--border); }
.modal-title { color: var(--coffee-900); font-weight: 600; }

/* ============= RESPONSIVE ============= */

/* Sidebar backdrop (mobile drawer overlay) */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1040;
}
.sidebar-backdrop.show { display: block; }

/* Tablet (≤1024px) */
@media (max-width: 1024px) {
    .page-title { font-size: 1.35rem; }       /* 21.6px */
    .stat-card .value { font-size: 1.75rem; } /* 28px */
    .table { font-size: 0.9rem; }             /* 14.4px */
    .page-body { padding: 18px; }
}

/* Mobile (≤768px) - keep base 16px to prevent iOS input auto-zoom */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -260px;
        width: 260px;
        transition: left 0.25s ease;
        z-index: 1050;
        box-shadow: 2px 0 12px rgba(0,0,0,0.15);
    }
    .sidebar.open { left: 0; }

    .topbar { padding: 12px 14px; gap: 10px; }
    .page-title { font-size: 1.2rem; }        /* 19.2px */
    .page-body { padding: 14px; }

    .stat-card { padding: 14px; }
    .stat-card .value { font-size: 1.5rem; }  /* 24px */
    .stat-card .label { font-size: 0.78rem; }

    .content-card { padding: 14px; }
    .content-card h2 { font-size: 1.05rem; }
    .card-title-bar { flex-wrap: wrap; gap: 8px; }

    .table { font-size: 0.9rem; }             /* 14.4px */
    .table thead th, .table tbody td { padding: 10px 8px; white-space: nowrap; }

    /* Keep form inputs at 16px - prevents iOS Safari auto-zoom */
    .form-control, .form-select { font-size: 1rem; }
}

/* Small phones (≤480px) */
@media (max-width: 480px) {
    .stat-card .value { font-size: 1.4rem; }
    .page-title { font-size: 1.1rem; }
    .page-body { padding: 10px; }
    .content-card { padding: 12px; }
    .topbar { padding: 10px 12px; }
}

/* Very small / min support: 360px */
@media (max-width: 380px) {
    html { font-size: 15px; }
    .stat-card { padding: 12px; }
    .stat-card .value { font-size: 1.25rem; }
    .stat-card .sub { font-size: 0.8rem; }
    .table thead th, .table tbody td { padding: 8px 6px; }
    .btn { padding: 6px 10px; }
}

/* Helpers */
.fade-in { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.empty-state {
    padding: 40px 20px;
    text-align: center;
    color: #9b8a73;
}
.empty-state i { font-size: 2.5rem; opacity: 0.4; display: block; margin-bottom: 10px; }

/* ============= CLOFFY: isolate from Tailwind preflight ============= */
body.stock-portal-active {
    background: var(--cream-50) !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--coffee-900);
}
/* Keep bootstrap-icons glyphs visible (Tailwind / body font must not override). */
body.stock-portal-active .bi::before {
    font-family: bootstrap-icons !important;
}
body.stock-portal-active #root {
    min-height: 100vh;
}
body.stock-portal-active.login-page #root {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.stock-login-page {
    flex: 1;
    width: 100%;
}
.stock-portal a { text-decoration: none; }
.stock-portal a.side-link { text-decoration: none; }

/* Login page (outside app-shell) */
body.stock-portal-active.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f5ecdc, #ecdfc8) !important;
}
.login-bg {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f5ecdc, #ecdfc8);
    width: 100%;
    padding: 1rem;
    box-sizing: border-box;
}
.login-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.08);
    box-sizing: border-box;
}
.login-brand { text-align: center; margin-bottom: 24px; }
.login-brand i { font-size: 2.5rem; color: var(--accent); }
.login-brand h1 {
    font-size: 1.4rem;
    margin: 8px 0 4px;
    color: var(--coffee-900);
    font-weight: 700;
}
.login-brand .tag { font-size: 0.9rem; color: #7a6a55; }
.login-logo {
    width: 72px;
    height: 72px;
    object-fit: contain;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 2px 12px rgba(43, 29, 20, 0.1);
}
.cafeadmin-login,
.owner-login,
.operator-login,
.stock-login,
.roi-login {
    background: linear-gradient(160deg, #ffffff 0%, var(--cream-100) 50%, var(--cream-200) 100%) !important;
}
.cafeadmin-login .card,
.owner-login .card,
.operator-login .card,
.stock-login .card,
.roi-login .card {
    background: #fff;
    border: 1px solid var(--border) !important;
}
.login-card .form-control { padding: 12px 14px; font-size: 1rem; }
.login-card .btn-primary {
    width: 100%;
    padding: 11px;
    font-weight: 600;
    font-size: 1rem;
    margin-top: 8px;
}
.login-error {
    background: #fbecec;
    color: #a3322a;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.recent-list .border-bottom:last-child { border-bottom: none !important; }

/* ============= MENU & STOCK PAGE ============= */
.menu-step-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--coffee-500);
    margin-bottom: 6px;
}
.menu-step-hint {
    font-size: 0.85rem;
    color: var(--coffee-500);
    margin: -4px 0 12px;
}
.menu-link-section {
    padding: 20px 0;
    border-bottom: 1px solid var(--border);
}
.menu-link-section:last-of-type { border-bottom: none; }
.menu-save-bar {
    margin-top: 8px;
    padding-top: 20px;
    border-top: 2px solid var(--border);
}
.menu-saved-view {
    background: var(--cream-100);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
}
.menu-saved-block { margin-top: 12px; }
.menu-saved-block:first-of-type { margin-top: 0; }
.menu-saved-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--coffee-700);
    margin-bottom: 6px;
}
.menu-saved-list {
    margin: 0;
    padding-left: 1.2rem;
    font-size: 0.9rem;
    color: var(--coffee-800);
}
.menu-saved-list li { margin-bottom: 4px; }
.menu-saved-empty {
    font-size: 0.85rem;
    color: var(--coffee-500);
    font-style: italic;
}
.menu-edit-panel {
    border: 1px solid var(--accent);
    border-radius: 12px;
    padding: 16px;
    background: #fff;
}
.menu-edit-title {
    font-weight: 700;
    color: var(--coffee-800);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.menu-edit-title i { color: var(--accent); margin-right: 6px; }
.menu-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.menu-status-dot.done { background: #22a55b; }
.menu-status-dot.partial { background: #eab308; }
.menu-product-item .flex-grow-1 { flex: 1; text-align: left; }
.menu-empty-addons {
    padding: 16px;
    background: var(--cream-100);
    border-radius: 10px;
    color: var(--coffee-500);
    font-size: 0.9rem;
    text-align: center;
}
.menu-addon-grid-head {
    display: grid;
    grid-template-columns: 100px 1fr 1.65fr 100px;
    gap: 12px;
    align-items: center;
}
.menu-addon-grid-row {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 10px;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.menu-addon-grid-row:last-child { border-bottom: none; }
.menu-addon-grid-head {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--coffee-500);
    margin-bottom: 8px;
    padding: 0 4px;
}
.menu-addon-name {
    font-weight: 600;
    color: var(--coffee-800);
}
.category-ingredient-picker {
    display: grid;
    grid-template-columns: 1fr 1.65fr 112px;
    gap: 12px;
    align-items: center;
    flex: 1;
    min-width: 0;
}
.menu-picker-head {
    display: grid;
    grid-template-columns: 1fr 1.65fr 112px 40px;
    gap: 12px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--coffee-500);
    margin-bottom: 8px;
}
.menu-ingredient-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}
.menu-ingredient-row .category-ingredient-picker { flex: 1; }
.menu-copy-inline {
    display: flex;
    gap: 8px;
    margin: 16px 0 8px;
    max-width: 320px;
}
.menu-dot-ready {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22a55b;
    flex-shrink: 0;
    margin-left: auto;
}
.menu-product-list {
    max-height: 62vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.menu-product-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    text-align: left;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.menu-product-item:hover {
    border-color: var(--coffee-300);
    background: var(--cream-50);
}
.menu-product-item.active {
    border-color: var(--accent);
    background: var(--warn-bg);
    box-shadow: 0 0 0 1px var(--accent);
}
.menu-product-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.menu-copy-row {
    background: var(--cream-100);
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 24px;
}
.menu-section { margin-bottom: 28px; }
.menu-section-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--coffee-800);
}
.menu-section-title i { color: var(--accent); margin-right: 6px; }
.menu-page-hint {
    font-size: 0.9rem;
    color: var(--coffee-600);
    background: var(--cream-100);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 16px;
}
.menu-page-hint a { font-weight: 600; }
.menu-view-table th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--coffee-500);
    border-bottom-width: 1px;
}
.menu-status-pill {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    border: 1px solid transparent;
}
.menu-status-pill--done {
    background: #d1fae5;
    color: #065f46;
    border-color: #6ee7b7;
}
.menu-status-pill--partial {
    background: #fef3c7;
    color: #92400e;
    border-color: #fcd34d;
}
.menu-status-pill--none {
    background: #f3f4f6;
    color: #374151;
    border-color: #d1d5db;
}
.menu-col-status { min-width: 110px; }
.menu-col-actions { min-width: 170px; }
.menu-row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
}
.menu-view-table-wrap { overflow-x: auto; }
.menu-stock-modal { z-index: 1060; }
.menu-stock-modal-content { border: none; box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2); }
.menu-modal-header-text { padding-right: 12px; }
.menu-modal-subtitle {
    font-size: 0.85rem;
    color: var(--coffee-500);
}
.menu-detail-summary {
    background: var(--cream-100);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
}
.menu-detail-table th {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--coffee-600);
    background: var(--cream-100);
}
.menu-detail-table td { font-size: 0.9rem; vertical-align: middle; }
.stat-card.clickable {
    background: #fff;
    width: 100%;
}
.menu-detail-tag {
    font-size: 0.8rem;
    color: var(--coffee-500);
    font-style: italic;
}

/* Customization stock editor */
.custom-stock-editor {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.custom-stock-group {
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
}
.custom-stock-group-header {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 16px 18px;
    background: linear-gradient(180deg, var(--cream-100) 0%, #fff 100%);
    border-bottom: 1px solid var(--border);
}
.custom-stock-group-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: var(--coffee-100, #f3ebe3);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}
.custom-stock-group-meta { flex: 1; min-width: 0; }
.custom-stock-group-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.custom-stock-group-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--coffee-800);
}
.custom-stock-group-progress {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--coffee-500);
    background: var(--cream-100);
    padding: 4px 10px;
    border-radius: 999px;
}
.custom-stock-group-desc {
    margin: 6px 0 0;
    font-size: 0.85rem;
    color: var(--coffee-500);
    line-height: 1.45;
}
.custom-stock-choices {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 14px;
    padding: 16px;
}
.custom-stock-choice-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    background: var(--cream-50, #faf8f6);
}
.custom-stock-choice-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px dashed var(--border);
}
.custom-stock-choice-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--coffee-800);
}
.custom-stock-choice-status {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 3px 8px;
    border-radius: 999px;
    white-space: nowrap;
}
.custom-stock-choice-status--none {
    background: #f3f4f6;
    color: #6b7280;
}
.custom-stock-choice-status--partial {
    background: #fef9c3;
    color: #a16207;
}
.custom-stock-choice-status--done {
    background: #dcfce7;
    color: #15803d;
}
.custom-stock-summary-group-head {
    font-size: 0.9rem;
    color: var(--coffee-700);
    margin-bottom: 8px;
}
.custom-stock-summary-group-head .bi {
    color: var(--accent);
}

.decoction-flavour-editor {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.decoction-picker-pair {
    grid-template-columns: 1fr 1.75fr;
    gap: 12px;
}
.decoction-shot-qty-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.stock-matrix-wrap {
    margin-top: 4px;
}
.stock-matrix-scroll {
    overflow: visible;
}
.stock-matrix-table {
    table-layout: fixed;
    width: 100%;
}
.stock-matrix-table--cols-ingredient {
    min-width: 0;
}
.stock-matrix-table--with-choice {
    min-width: 0;
}
.stock-matrix-col-category {
    width: 34%;
}
.stock-matrix-col-ingredient {
    width: auto;
}
.stock-matrix-col-qty {
    width: 108px;
}
.stock-matrix-col-actions {
    width: 40px;
}
.stock-matrix-col-choice {
    width: 96px;
}
.stock-matrix-table--cols-size .stock-matrix-col-category {
    width: 26%;
}
.stock-matrix-table--cols-size .stock-matrix-col-ingredient {
    width: auto;
}
.stock-matrix-table th {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--coffee-500);
    white-space: nowrap;
    vertical-align: bottom;
}
.stock-matrix-table th.stock-matrix-cell--category,
.stock-matrix-cell--category {
    width: 34%;
    min-width: 200px;
}
.stock-matrix-table th.stock-matrix-cell--ingredient,
.stock-matrix-cell--ingredient {
    width: auto;
    min-width: 180px;
}
.stock-matrix-table--cols-size th.stock-matrix-cell--category,
.stock-matrix-table--cols-size .stock-matrix-cell--category {
    width: 26%;
    min-width: 170px;
}
.stock-matrix-cell--category .stock-searchable-select-wrap,
.stock-matrix-cell--ingredient .stock-searchable-select-wrap,
.decoction-picker-pair .stock-searchable-select-wrap,
.category-ingredient-picker .stock-searchable-select-wrap {
    width: 100%;
}
.stock-matrix-cell--category .stock-searchable-select-wrap {
    min-width: 0;
}
.stock-matrix-cell--category .stock-select__control {
    min-width: 0;
}
.stock-matrix-cell--ingredient .stock-searchable-select-wrap {
    min-width: 0;
}
.stock-matrix-cell {
    vertical-align: middle;
    overflow: visible;
}
.stock-matrix-qty {
    width: 108px;
    min-width: 108px;
    max-width: 108px;
    padding-left: 4px !important;
    padding-right: 4px !important;
}
/* Compact quantity fields in menu linkage — values must stay visible in narrow cells */
.stock-qty-input {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    padding: 0.2rem 0.35rem !important;
    font-size: 0.8125rem;
    line-height: 1.3;
    box-sizing: border-box;
    -moz-appearance: textfield;
}
.stock-qty-input::-webkit-outer-spin-button,
.stock-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.decoction-shot-qty-field .stock-qty-input {
    text-align: left;
}
.stock-matrix-actions {
    width: 40px;
    min-width: 40px;
    max-width: 40px;
    padding-left: 4px !important;
    padding-right: 4px !important;
    text-align: center;
}
.stock-matrix-choice {
    width: 96px;
    min-width: 96px;
    max-width: 110px;
    vertical-align: middle;
    font-size: 0.88rem;
}
.stock-matrix-table--with-choice .stock-matrix-cell--ingredient {
    min-width: 160px;
}
.menu-addon-matrix-group {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    background: var(--cream-50, #faf8f6);
}

.custom-stock-choices--grid {
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
}
.custom-stock-choice-card--grid {
    background: #fff;
}
.choice-stock-editor {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.choice-stock-ingredient-block {
    margin: 0;
}
.choice-stock-picker-row {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}
.choice-stock-picker-row .category-ingredient-picker {
    flex: 1;
    min-width: 0;
}
.choice-stock-remove {
    flex-shrink: 0;
    margin-top: 2px;
}
.decoction-flavour-editor,
.choice-stock-editor {
    width: 100%;
}
.custom-stock-choices--flavour {
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
}
.custom-stock-choice-card--flavour {
    background: #fff;
}
.custom-stock-group--info {
    border-style: dashed;
    background: var(--cream-50, #faf8f6);
}
.custom-stock-group--info .custom-stock-group-header {
    border-bottom: none;
}
.custom-stock-regular-note {
    color: var(--coffee-600, #6b5344);
    margin-top: 8px;
}
.custom-stock-group-empty {
    font-size: 0.85rem;
    color: var(--coffee-500);
    font-style: italic;
}
.addon-scope-toggle {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
}
.addon-scope-option {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    margin: 0;
    cursor: pointer;
}

@media (max-width: 768px) {
    .decoction-shot-qty-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .menu-addon-grid-head { display: none; }
    .menu-addon-grid-row { grid-template-columns: 1fr; }
    .category-ingredient-picker { grid-template-columns: 1fr; }
    .menu-picker-head { display: none !important; }
}
