/* ============================================================
   APP.CSS — Admin dashboard
   Colors: docs/BRAND-COLORS.md (Mint, Slate, Lemon, Fresh Blue, Off White)
   Bordas: rgba(0,0,0,0.1) | Sombras sutis | Border-radius: 10px
   ============================================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: clip;
}

body {
    font-family: var(--font-sans);
    color: var(--color-primary);
    background: var(--color-bg, #F8F6F3);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: clip;
    max-width: 100vw;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; }

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

.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin var(--transition);
}

.app-content {
    flex: 1;
    padding: 28px 32px;
    max-width: 1400px;
    width: 100%;
}

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    background: #FFFFFF;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: transform var(--transition);
    overflow: hidden;
}

.sidebar-header {
    padding: 20px 20px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-search {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px 12px 4px;
    padding: 0 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: #fafafa;
}

.sidebar-search:focus-within {
    border-color: #c5c5c5;
    background: #fff;
}

.sidebar-search-icon {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    color: var(--color-muted);
    stroke-width: 2;
}

.sidebar-search-input {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    padding: 9px 0;
    font-size: 0.88rem;
    color: var(--color-text);
    outline: none;
}

.sidebar-search-input::placeholder {
    color: var(--color-muted);
}

.sidebar-search-input::-webkit-search-cancel-button {
    display: none;
}

.sidebar-search-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--color-muted);
    cursor: pointer;
    flex-shrink: 0;
}

.sidebar-search-clear[hidden] {
    display: none !important;
}

.sidebar-search-clear:hover {
    background: rgba(0, 0, 0, 0.06);
    color: var(--color-text);
}

.sidebar-search-clear i {
    width: 14px;
    height: 14px;
}

.sidebar-search-empty {
    margin: 8px 4px 0;
    padding: 10px 12px;
    font-size: 0.82rem;
    color: var(--color-muted);
    text-align: center;
}

.sidebar-search-empty[hidden] {
    display: none !important;
}

.sidebar-nav.is-filtering .nav-section-toggle,
.sidebar-nav.is-filtering .nav-subgroup-toggle {
    pointer-events: none;
}

.sidebar-nav .nav-item.is-nav-hidden,
.sidebar-nav .nav-section.is-nav-hidden,
.sidebar-nav .nav-section-label.is-nav-hidden,
.sidebar-nav .nav-subgroup.is-nav-hidden {
    display: none !important;
}

.sidebar-logo img {
    height: 27px;
    width: auto;
}

.sidebar-logo-text {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.sidebar-close {
    display: none;
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--color-muted);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 12px;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}
.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.1);
    border-radius: 4px;
}

.nav-section {
    margin-bottom: 8px;
}

/* --- Collapsible nav layers (sections + subgroups) --- */
.nav-section-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    padding: 9px 12px;
    font: inherit;
    color: #3F3F46;
    border-radius: var(--radius-sm);
    transition: background var(--transition), color var(--transition);
}

.nav-section-toggle .nav-section-title {
    padding: 0;
    flex: 1;
    text-align: left;
    font-size: 0.9rem;
    font-weight: 450;
    text-transform: none;
    letter-spacing: 0;
    color: inherit;
}

.nav-section-toggle:hover {
    background: rgba(0,0,0,0.04);
    color: var(--color-primary);
}

.nav-section-toggle:focus-visible,
.nav-item:focus-visible {
    outline: 2px solid var(--nav-accent);
    outline-offset: 2px;
}

.nav-section-icon,
.nav-section-toggle .nav-section-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: var(--nav-accent);
    opacity: 0.9;
}

.nav-section.has-active > .nav-section-toggle,
.nav-section.is-flyout-open > .nav-section-toggle {
    background: rgba(0,0,0,0.06);
    color: var(--color-primary);
    font-weight: 550;
}

.nav-section.has-active > .nav-section-toggle .nav-section-title,
.nav-section.is-flyout-open > .nav-section-toggle .nav-section-title {
    font-weight: 550;
}

.nav-flyout-kicker {
    display: none;
}

.nav-flyout-scrim {
    display: none;
}

.nav-section-caret {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    color: var(--color-muted);
    opacity: 0.7;
    transition: transform 0.25s ease;
}

.nav-collapsed > .nav-section-toggle .nav-section-caret,
.nav-collapsed > .nav-subgroup-toggle .nav-section-caret {
    transform: rotate(-90deg);
}

/* Smooth expand/collapse without hardcoded heights */
.nav-section-items {
    display: grid;
    grid-template-rows: 1fr;
    transition: grid-template-rows 0.25s ease;
}

.nav-no-anim .nav-section-items,
.nav-no-anim .nav-section-caret {
    transition: none;
}

.nav-section-items-inner {
    overflow: hidden;
    min-height: 0;
}

.nav-collapsed > .nav-section-items {
    grid-template-rows: 0fr;
}

/* Aggregated badge shown on a group header while it's collapsed */
.nav-group-badge {
    display: none;
}

.nav-collapsed > .nav-section-toggle .nav-group-badge,
.nav-collapsed > .nav-subgroup-toggle .nav-group-badge {
    display: flex;
}

/* Subgroup (2nd layer) — a nav-item that expands children */
.nav-subgroup-toggle {
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    font: inherit;
    text-align: left;
}

.nav-subgroup-toggle .nav-section-caret {
    margin-left: 0;
}

.nav-subgroup.has-active > .nav-subgroup-toggle {
    color: var(--color-primary);
    font-weight: 550;
}

/* Child items — indented, slightly smaller, with a guide line */
.nav-item-sub {
    margin-left: 22px;
    padding: 7px 12px 7px 18px;
    font-size: 0.85rem;
    border-left: 1px solid var(--border-color);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.nav-item-sub.active {
    border-left-color: var(--color-primary);
}

/* Desktop: compact section rail + horizontal flyout panel */
@media (min-width: 769px) {
    .sidebar {
        overflow: visible;
    }

    .sidebar-nav:not(.is-filtering) {
        overflow: visible;
    }

    .nav-flyout-scrim:not([hidden]) {
        display: block;
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        left: var(--sidebar-width);
        z-index: 90;
        background: rgba(18, 28, 26, 0.18);
    }

    .sidebar-nav:not(.is-filtering) .nav-collapsible > .nav-flyout-panel {
        position: fixed;
        top: 0;
        left: var(--sidebar-width);
        z-index: 101;
        width: min(440px, calc(100vw - var(--sidebar-width) - 16px));
        height: 100vh;
        height: 100dvh;
        margin: 0;
        padding: 28px 22px 32px;
        overflow-y: auto;
        display: block;
        grid-template-rows: none;
        background: #fff;
        border-right: 1px solid var(--border-color);
        box-shadow: 16px 0 40px rgba(44, 62, 80, 0.12);
        visibility: hidden;
        opacity: 0;
        transform: translateX(-10px);
        pointer-events: none;
        transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
    }

    .sidebar-nav:not(.is-filtering) .nav-collapsible.is-flyout-open > .nav-flyout-panel {
        visibility: visible;
        opacity: 1;
        transform: translateX(0);
        pointer-events: auto;
    }

    .sidebar-nav:not(.is-filtering) .nav-collapsible.nav-collapsed > .nav-flyout-panel {
        grid-template-rows: none;
    }

    .sidebar-nav:not(.is-filtering) .nav-collapsible.is-flyout-open > .nav-section-toggle .nav-group-badge {
        display: none;
    }

    .sidebar-nav:not(.is-filtering) .nav-collapsible.is-flyout-open > .nav-section-toggle .nav-section-caret {
        transform: rotate(90deg);
    }

    .sidebar-nav:not(.is-filtering) .nav-flyout-kicker {
        display: flex;
        align-items: center;
        gap: 10px;
        margin: 0 0 18px;
        font-size: 0.7rem;
        font-weight: 650;
        letter-spacing: 0.1em;
        text-transform: uppercase;
        color: var(--color-muted);
    }

    .sidebar-nav:not(.is-filtering) .nav-flyout-kicker::before {
        content: '';
        width: 7px;
        height: 7px;
        flex-shrink: 0;
        background: var(--nav-accent);
    }

    .sidebar-nav:not(.is-filtering) .nav-flyout-kicker::after {
        content: '';
        flex: 1;
        height: 1px;
        background: var(--border-color);
    }

    .sidebar-nav:not(.is-filtering) .nav-collapsible > .nav-flyout-panel .nav-flyout-grid {
        display: block;
        column-count: 2;
        column-gap: 8px;
        overflow: visible;
        min-height: 0;
    }

    .sidebar-nav:not(.is-filtering) .nav-collapsible > .nav-flyout-panel .nav-flyout-grid > .nav-item {
        min-height: 44px;
        margin-bottom: 2px;
        break-inside: avoid;
    }

    .sidebar-nav:not(.is-filtering) .nav-collapsible > .nav-flyout-panel .nav-subgroup {
        column-span: all;
        margin-top: 8px;
        padding-top: 12px;
        border-top: 1px solid var(--border-color);
    }

    .sidebar-nav:not(.is-filtering) .nav-collapsible > .nav-flyout-panel .nav-subgroup-toggle {
        pointer-events: none;
        min-height: 0;
        padding: 2px 12px 8px;
        font-size: 0.7rem;
        font-weight: 650;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: var(--color-muted);
        background: none;
    }

    .sidebar-nav:not(.is-filtering) .nav-collapsible > .nav-flyout-panel .nav-subgroup-toggle:hover {
        background: none;
        color: var(--color-muted);
        transform: none;
    }

    .sidebar-nav:not(.is-filtering) .nav-collapsible > .nav-flyout-panel .nav-subgroup-toggle .nav-section-caret {
        display: none;
    }

    .sidebar-nav:not(.is-filtering) .nav-collapsible > .nav-flyout-panel .nav-subgroup-toggle i,
    .sidebar-nav:not(.is-filtering) .nav-collapsible > .nav-flyout-panel .nav-subgroup-toggle svg {
        width: 14px;
        height: 14px;
        transform: none;
    }

    .sidebar-nav:not(.is-filtering) .nav-collapsible > .nav-flyout-panel .nav-subgroup > .nav-section-items {
        display: block;
        grid-template-rows: none;
    }

    .sidebar-nav:not(.is-filtering) .nav-collapsible > .nav-flyout-panel .nav-subgroup.nav-collapsed > .nav-section-items {
        grid-template-rows: none;
    }

    .sidebar-nav:not(.is-filtering) .nav-collapsible > .nav-flyout-panel .nav-subgroup > .nav-section-items > .nav-section-items-inner {
        display: block;
        column-count: 2;
        column-gap: 8px;
        overflow: visible;
    }

    .sidebar-nav:not(.is-filtering) .nav-collapsible > .nav-flyout-panel .nav-item-sub {
        margin-bottom: 2px;
        break-inside: avoid;
        margin-left: 0;
        border-left: none;
        border-radius: var(--radius-sm);
        padding: 9px 12px;
        font-size: 0.9rem;
        min-height: 44px;
    }

    .sidebar-nav:not(.is-filtering) .nav-collapsible > .nav-flyout-panel .nav-item-sub.active {
        background: rgba(0,0,0,0.06);
    }
}

@media (min-width: 769px) and (prefers-reduced-motion: reduce) {
    .sidebar-nav:not(.is-filtering) .nav-collapsible > .nav-flyout-panel {
        transition: none;
        transform: none;
    }
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 450;
    color: #3F3F46;
    transition: all var(--transition);
    position: relative;
}

/* Rows toggled with the hidden attribute (Reset to default outside edit mode) stay hidden despite display:flex. */
.nav-item[hidden] {
    display: none !important;
}

.nav-item:hover {
    background: rgba(0,0,0,0.04);
    color: var(--color-primary);
}

.nav-item.active {
    background: rgba(0,0,0,0.06);
    color: var(--color-primary);
    font-weight: 550;
}

.nav-item > i:first-child,
.nav-item > svg:first-child {
    font-size: 1.1rem;
    width: 20px;
    height: 20px;
    text-align: center;
    opacity: 0.85;
    color: var(--nav-accent);
    flex-shrink: 0;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.2s ease;
}

.nav-item:hover > i:first-child,
.nav-item:hover > svg:first-child {
    transform: rotate(15deg) scale(1.1);
    color: var(--nav-accent-hover);
}

.nav-item.active > i:first-child,
.nav-item.active > svg:first-child {
    opacity: 1;
    transform: rotate(0);
    color: var(--nav-accent);
}

.nav-badge {
    background: var(--color-danger);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    min-width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    padding: 0 6px;
}

/* The label absorbs the slack so badges, carets and markers sit flush right. */
.nav-item > span:first-of-type:not(.nav-badge) {
    flex: 1 1 auto;
    min-width: 0;
}

/* Secondary glyphs inside a row keep their own size and colour. */
.nav-item .nav-section-caret {
    width: 14px;
    height: 14px;
    color: var(--color-muted);
    opacity: 0.7;
}

.inv-lock,
.nav-item-ext {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    color: currentColor;
    opacity: 0.6;
}

/* Hairline between the top rows and the first group (not while searching). */
.sidebar-nav > .nav-section:not(.nav-collapsible):not(.nav-pins-section) + .nav-collapsible {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

.sidebar-nav.is-filtering .nav-collapsible {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

/* Small uppercase label with a trailing rule, used above the pinned shortcuts. */
.nav-section-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 12px 0 6px;
    padding: 0 12px;
    font-size: 0.7rem;
    font-weight: 650;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-muted);
}

.nav-section-label i,
.nav-section-label svg {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    color: var(--nav-accent);
}

.nav-section-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.sidebar-footer {
    border-top: 1px solid var(--border-color);
    padding: 12px;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    flex-shrink: 0;
}

.user-avatar-sm {
    width: 32px;
    height: 32px;
    font-size: 0.75rem;
}

.user-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 550;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.72rem;
    color: var(--color-muted);
}

.nav-item-logout {
    color: var(--color-muted);
    margin-top: 4px;
}
.nav-item-logout:hover {
    color: var(--color-danger);
    background: rgba(220,38,38,0.06);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    z-index: 99;
    backdrop-filter: blur(2px);
}

/* --- Superadmin pin shortcuts / edit layout (overlay only) --- */
.nav-pins-section.is-empty {
    display: none;
}

.sidebar.nav-edit-mode .nav-pins-section,
.sidebar.nav-edit-mode .nav-pins-section.is-empty {
    display: block;
}

.nav-pins-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar.nav-edit-mode .nav-pins-list {
    min-height: 52px;
    padding: 4px;
    border: 1px dashed rgba(var(--nav-accent-rgb), 0.45);
    border-radius: var(--radius-sm);
}

.nav-pins-hint {
    margin: 6px 4px 0;
    padding: 0 4px;
    font-size: 0.75rem;
    color: var(--color-muted);
    text-align: center;
}

.sidebar.nav-edit-mode a.nav-item[data-nav-id]:not(.nav-item-pin) {
    cursor: grab;
}

.sidebar.nav-edit-mode .nav-item-pin {
    outline: 1px dashed rgba(var(--nav-accent-rgb), 0.45);
}

.nav-pin-remove {
    display: none;
    width: 22px;
    height: 22px;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--color-muted);
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
}

.sidebar.nav-edit-mode .nav-pin-remove {
    display: inline-flex;
}

.nav-pin-remove:hover {
    background: rgba(220, 38, 38, 0.08);
    color: var(--color-danger);
}

.nav-pin-remove i,
.nav-pin-remove svg {
    width: 14px;
    height: 14px;
}

.nav-edit-layout[aria-pressed="true"] {
    background: rgba(var(--nav-accent-rgb), 0.12);
    color: var(--color-primary);
}

.nav-pin-ghost {
    opacity: 0.4;
}

.nav-pin-chosen {
    cursor: grabbing;
}

.nav-pin-fallback {
    opacity: 0.92;
    z-index: 10050 !important;
    pointer-events: none !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* --- Topbar --- */
.topbar {
    height: var(--topbar-height);
    background: #FFFFFF;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-menu-btn {
    display: none;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--color-muted);
}
.topbar-menu-btn:hover { background: rgba(0,0,0,0.04); }

.topbar-title {
    font-size: 1.15rem;
    font-weight: 650;
    letter-spacing: -0.02em;
    color: var(--brand-slate, #2C3E50);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-search {
    position: relative;
    display: flex;
    align-items: center;
}

/* Direct children only — otherwise the rule leaks into the search-results
   dropdown and breaks every nested <i>/<svg> there. */
.topbar-search > i,
.topbar-search > svg {
    position: absolute;
    left: 12px;
    width: 18px;
    height: 18px;
    color: var(--color-muted);
    pointer-events: none;
}

.topbar-search input {
    width: 240px;
    height: 38px;
    padding: 0 14px 0 36px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--color-bg, #F8F6F3);
    font-size: 0.85rem;
    color: var(--color-primary);
    transition: all var(--transition);
    outline: none;
}

.topbar-search input:focus {
    border-color: rgba(0,0,0,0.2);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(0,0,0,0.04);
}

.topbar-search input::placeholder {
    color: var(--color-muted);
}

.topbar-icon-btn {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--color-muted);
    position: relative;
    transition: all var(--transition);
}
.topbar-icon-btn:hover {
    background: rgba(0,0,0,0.04);
    color: var(--color-primary);
}

.notification-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: var(--color-danger);
    border-radius: 50%;
    border: 2px solid #fff;
}

/* --- Cards --- */
.card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--brand-slate, #2C3E50);
}

.card-body {
    padding: 22px;
}

.card-body-flush {
    padding: 0;
}

.card-footer {
    padding: 14px 22px;
    border-top: 1px solid var(--border-color);
}

/* --- Stat Cards --- */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 22px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: box-shadow var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.stat-icon-primary { background: rgba(0,0,0,0.06); color: #000; }
.stat-icon-success { background: rgba(22,163,74,0.08); color: var(--color-success); }
.stat-icon-warning { background: rgba(245,158,11,0.08); color: var(--color-warning); }
.stat-icon-accent  { background: rgba(37,99,235,0.08); color: var(--color-accent); }
.stat-icon-danger  { background: rgba(220,38,38,0.08); color: var(--color-danger); }

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.78rem;
    color: var(--color-muted);
    margin-top: 2px;
}

/* --- Dashboard Components --- */
.stats-row-6 {
    grid-template-columns: repeat(3, 1fr);
}

.stat-card-link {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    animation: dashFadeIn 0.4s ease both;
    animation-delay: calc(var(--anim-delay, 0) * 0.08s);
}

.stat-card-link:hover {
    border-color: rgba(0,0,0,0.15);
}

.stat-card-alert {
    border-color: rgba(245, 158, 11, 0.45);
}

@keyframes dashFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.stat-trend {
    display: inline-flex;
    align-items: center;
    margin-left: 4px;
    vertical-align: middle;
}

.stat-trend i,
.stat-trend svg {
    width: 16px;
    height: 16px;
}

.stat-trend-up { color: var(--color-success); }
.stat-trend-down { color: var(--color-danger); }

.stat-icon-completed { background: rgba(22,163,74,0.08); color: var(--color-success); }
.stat-icon-muted { background: rgba(0,0,0,0.04); color: var(--color-muted); }

/* Orders list totals bar */
.orders-header-total {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    color: var(--color-primary, #111);
}
.orders-header-total.is-refund {
    color: #b91c1c;
}
.orders-header-people {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    color: var(--brand-slate, #2C3E50);
}

.orders-totals-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 28px;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-top: 1px solid var(--color-border, #e5e7eb);
    background: #fff;
    position: sticky;
    bottom: 0;
    z-index: 5;
    box-shadow: 0 -8px 18px rgba(15, 15, 15, 0.05);
}
.orders-totals-filtered,
.orders-totals-selected {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px 12px;
}
.orders-totals-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--color-muted);
}
.orders-totals-amount {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--color-primary, #111);
    font-variant-numeric: tabular-nums;
}
.orders-totals-meta {
    font-size: 0.82rem;
    color: var(--color-muted);
}
.orders-pay-split {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.orders-pay-chip {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 650;
    text-decoration: none;
    color: inherit;
    border: 1px solid rgba(0,0,0,0.08);
    background: #fafafa;
    font-variant-numeric: tabular-nums;
}
.orders-pay-chip:hover {
    border-color: rgba(0,0,0,0.16);
    background: #fff;
}
.orders-pay-chip.is-active {
    border-color: rgba(0,0,0,0.22);
    background: #fff;
    box-shadow: 0 0 0 2px rgba(128, 212, 197, 0.45);
}
.orders-pay-chip strong {
    font-weight: 720;
}
.orders-pay-cash { color: #0F2D2D; }
.orders-pay-card { color: #2C3E50; }
.orders-pay-wallet { color: #9A4F12; }
.orders-pay-other { color: #464646; }
.orders-app-doordash { color: #E67E22; }
.orders-app-grubhub { color: #2C3E50; }
.orders-app-ubereats { color: #567DFF; }
.orders-app-other { color: #464646; }
.orders-change-cancelled { color: #b91c1c; }
.orders-change-refunded { color: #9A4F12; }
.orders-change-edited { color: #92400e; }

.badge-edited {
    background: #FEF3C7;
    color: #92400e;
}

.order-row-cancelled td {
    opacity: 0.82;
}
.font-medium.is-voided {
    text-decoration: line-through;
}
.order-refund-amt {
    display: block;
    margin-top: 2px;
    color: #b91c1c;
    font-weight: 650;
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
}
.orders-totals-amount.is-refund {
    color: #b91c1c;
}
tr.order-row-changed,
tr.order-row-cancelled {
    box-shadow: inset 3px 0 0 #E67E22;
}

.badge-pay-cash {
    background: #E7F8F4;
    color: #0F2D2D;
}
.badge-pay-card {
    background: #EEF2F6;
    color: #2C3E50;
}
.badge-pay-wallet {
    background: #FDECDC;
    color: #9A4F12;
}
.pay-split-badges {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

.orders-total-row td {
    background: #fafafa;
    border-top: 1px solid var(--color-border, #e5e7eb);
    font-weight: 600;
    padding-top: 14px;
    padding-bottom: 14px;
}
.orders-total-row .orders-totals-label {
    margin-right: 8px;
}

/* Dashboard Header */
.dash-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
}

.dash-greeting {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 4px;
    color: var(--brand-slate, #2C3E50);
}

.dash-mantra {
    margin: 2px 0 10px;
    max-width: 36rem;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.05rem;
    font-style: italic;
    font-weight: 400;
    line-height: 1.35;
    letter-spacing: -0.01em;
    color: var(--brand-slate, #2C3E50);
    opacity: 0.88;
}

.dash-meta {
    display: flex;
    align-items: center;
    gap: 12px;
}

.dash-date {
    font-size: 0.85rem;
    color: var(--color-muted);
}

.dash-store-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
}

.dash-store-badge i,
.dash-store-badge svg {
    width: 14px;
    height: 14px;
}

.dash-store-open {
    background: rgba(22,163,74,0.1);
    color: var(--color-success);
}

.dash-store-closed {
    background: rgba(220,38,38,0.1);
    color: var(--color-danger);
}

/* --- Dashboard: Today / Needs you --- */
.dash-kicker {
    font-size: 0.7rem;
    font-weight: 650;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-muted);
    margin: 0 0 10px;
}

.dash-today {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 22px 18px;
    margin-bottom: 20px;
}

.dash-today-top {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 20px 28px;
    align-items: start;
}

.dash-today-figures {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 28px;
    align-items: flex-start;
}

.dash-today-figure {
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-decoration: none;
    color: inherit;
    min-width: 0;
}

.dash-today-figure-label {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--color-muted);
}

.dash-today-revenue {
    display: block;
    font-size: 2.4rem;
    font-weight: 720;
    letter-spacing: -0.04em;
    line-height: 1.05;
    color: var(--brand-slate, #2C3E50);
    font-variant-numeric: tabular-nums;
    text-decoration: none;
}

.dash-today-orders-quiet {
    color: inherit;
    text-decoration: none;
    font-weight: 600;
}
.dash-today-orders-quiet:hover {
    color: var(--brand-slate, #2C3E50);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.dash-today-revenue:hover {
    color: var(--brand-black, #0F0F0F);
}

.dash-today-sub {
    margin-top: 6px;
    font-size: 0.88rem;
    color: var(--color-muted);
    font-variant-numeric: tabular-nums;
}

.dash-today-pace {
    margin: 6px 0 0;
    font-size: 0.8rem;
    color: #7a7a84;
}

.dash-today-pace a {
    color: inherit;
    text-decoration: none;
}

.dash-today-pace a:hover {
    color: var(--brand-slate, #2C3E50);
    text-decoration: underline;
}

.dash-today-figure-hero .dash-today-revenue {
    font-size: 2.15rem;
}

.dash-today-revenue-secondary {
    font-size: 1.55rem;
}

.dash-today-sales {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.dash-today-later {
    display: flex;
    flex-direction: column;
    gap: 1px;
    text-decoration: none;
    color: inherit;
}

.dash-today-later-value {
    font-size: 1.05rem;
    font-weight: 650;
    letter-spacing: -0.02em;
    line-height: 1.15;
    color: var(--brand-slate, #2C3E50);
    font-variant-numeric: tabular-nums;
}

.dash-today-later-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-muted);
}

.dash-today-later:hover .dash-today-later-value {
    color: var(--brand-black, #0F0F0F);
}

.dash-today-later:hover .dash-today-later-label {
    text-decoration: underline;
    text-underline-offset: 2px;
}

.dash-week-figures {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 36px;
    align-items: flex-start;
    margin-bottom: 18px;
}

.dash-kicker-today {
    margin-top: 2px;
}

.dash-today-ops {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.dash-chip {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #F6F6F8;
    color: inherit;
    text-decoration: none;
    min-width: 0;
}

.dash-chip:hover {
    background: #EFEFF3;
}

.dash-chip-value {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    line-height: 1.15;
}

.dash-chip-label {
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--color-muted);
}

.dash-chip-warn {
    background: var(--brand-lemon, #FFED90);
}

.dash-chip-warn .dash-chip-value {
    color: var(--brand-slate, #2C3E50);
}

.dash-chip-hot {
    background: #FEF3C7;
}

.dash-channels {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid rgba(0,0,0,0.06);
}

.dash-channels-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.dash-channels-head span {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--color-muted);
}

.dash-mix {
    display: flex;
    height: 8px;
    border-radius: 999px;
    overflow: hidden;
    background: #EEEFF3;
    margin-bottom: 14px;
}

.dash-mix-seg {
    min-width: 0;
    height: 100%;
}

.dash-mix-pickup { background: var(--brand-slate, #2C3E50); }
.dash-mix-inhouse { background: var(--brand-gray, #464646); }
.dash-mix-retail { background: var(--brand-slate, #2C3E50); }
.dash-mix-catering { background: var(--brand-blue, #567DFF); }
.dash-mix-ezcater { background: var(--brand-orange, #E67E22); }
.dash-mix-ezcater_pickup { background: var(--brand-black, #0F0F0F); }
.dash-mix-meal_program { background: var(--brand-mint, #80D4C5); }
.dash-mix-third_party { background: var(--brand-teal, #5EC3B2); }
.dash-mix-ours { background: var(--brand-slate, #2C3E50); }
.dash-mix-others { background: var(--brand-teal, #5EC3B2); }

.dash-control {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid rgba(0,0,0,0.06);
}

.dash-mix-control {
    margin-bottom: 12px;
}

.dash-control-detail {
    color: #7a7a84;
    text-decoration: none;
    font-size: 0.78rem;
    font-weight: 600;
}

.dash-control-detail:hover {
    color: var(--brand-slate, #2C3E50);
    text-decoration: underline;
}

.dash-control-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.dash-control-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 14px 12px;
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,0.06);
    min-width: 0;
    background: #fff;
}

.dash-control-ours {
    background: #f7f8fa;
    border-color: rgba(44, 62, 80, 0.12);
}

.dash-control-others {
    background: #f5fbfa;
    border-color: rgba(94, 195, 178, 0.28);
}

.dash-control-main {
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-decoration: none;
    color: inherit;
    min-width: 0;
}

.dash-control-main:hover .dash-control-value {
    color: var(--brand-black, #0F0F0F);
}

.dash-control-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.72rem;
    font-weight: 720;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #7a7a84;
}

.dash-control-value {
    font-size: 1.55rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    color: var(--brand-slate, #2C3E50);
    line-height: 1.15;
}

.dash-control-meta {
    font-size: 0.8rem;
    color: #7a7a84;
    font-variant-numeric: tabular-nums;
}

.dash-control-parts {
    margin: 4px 0 0;
    font-size: 0.78rem;
    color: #7a7a84;
    line-height: 1.35;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 0;
}

.dash-control-parts a {
    color: inherit;
    text-decoration: none;
}

.dash-control-parts a:hover {
    color: var(--brand-slate, #2C3E50);
    text-decoration: underline;
}

.dash-control-dot {
    margin: 0 6px;
    opacity: 0.55;
}

@media (max-width: 640px) {
    .dash-control-grid {
        grid-template-columns: 1fr;
    }
}

.dash-channel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
}

.dash-channel {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 14px 13px;
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,0.06);
    text-decoration: none;
    color: inherit;
    min-width: 0;
}

.dash-channel:hover {
    border-color: rgba(0,0,0,0.14);
    background: #FAFAFB;
}

.dash-channel-label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.88rem;
    font-weight: 650;
    color: #4b4b55;
}

.dash-channel-swatch {
    width: 8px;
    height: 8px;
    border-radius: 99px;
    flex-shrink: 0;
}

.dash-channel-value {
    font-size: 1.55rem;
    font-weight: 720;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    color: #1a1a1a;
    line-height: 1.15;
}

.dash-channel-value-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.dash-channel-share {
    font-size: 1.2rem;
    font-weight: 720;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    color: #5c5c66;
    line-height: 1.15;
}

.dash-channel-pct {
    font-size: 0.9rem;
    font-weight: 600;
    color: #5c5c66;
    font-variant-numeric: tabular-nums;
}

.dash-channel-pay {
    font-size: 0.78rem;
    font-weight: 600;
    color: #7a7a84;
    font-variant-numeric: tabular-nums;
    line-height: 1.3;
}

.dash-tenders {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid rgba(0,0,0,0.06);
}

.dash-tender-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
}

.dash-tender-grid-single {
    grid-template-columns: minmax(220px, 360px);
}

.dash-tender-walkin {
    background: #f4f8f7;
    border-color: rgba(15, 45, 45, 0.12);
}

.dash-tender-walkin .dash-channel-value {
    color: #0F2D2D;
}

.dash-collapse {
    margin-top: 10px;
}

.dash-collapse > summary {
    cursor: pointer;
    list-style: none;
    font-size: 0.78rem;
    font-weight: 650;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #7a7a84;
}

.dash-collapse > summary::-webkit-details-marker {
    display: none;
}

.dash-leading {
    margin: 0 0 20px;
    padding: 10px 0;
    border-top: 2px solid #80D4C5;
    border-bottom: 1px solid var(--color-border, #ddd);
}

.dash-leading summary {
    display: flex;
    gap: 12px;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    list-style: none;
}

.dash-leading summary::-webkit-details-marker {
    display: none;
}

.dash-leading summary h2 {
    font-size: 15px;
    margin: 0;
}

.dash-leading summary span {
    display: flex;
    align-items: center;
    gap: 10px;
}

.dash-leading summary svg {
    width: 18px;
    height: 18px;
    transition: transform .15s;
}

.dash-leading[open] summary svg {
    transform: rotate(180deg);
}

.dash-tender {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 14px 13px;
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,0.06);
    text-decoration: none;
    color: inherit;
    min-width: 0;
}

.dash-tender:hover {
    border-color: rgba(0,0,0,0.14);
    background: #FAFAFB;
}

.dash-tender-kicker {
    font-size: 0.68rem;
    font-weight: 720;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #7a7a84;
}

.dash-tender-focus.dash-tender-cash {
    background: #f4fbf8;
    border-color: rgba(15, 45, 45, 0.12);
}

.dash-tender-focus.dash-tender-card {
    background: #f5f7fa;
    border-color: rgba(44, 62, 80, 0.12);
}

.dash-tender-focus:hover {
    background: #fff;
}

.dash-tender-cash .dash-channel-value {
    color: #0F2D2D;
}

.dash-tender-card .dash-channel-value {
    color: #2C3E50;
}

.dash-tender-extra {
    margin-top: 10px;
    margin-bottom: 0;
}

.dash-snapshot {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.dash-snapshot-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px 18px 14px;
    min-width: 0;
}

.dash-snapshot-figure {
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-decoration: none;
    color: inherit;
}

.dash-snapshot-value {
    display: block;
    font-size: 1.85rem;
    font-weight: 720;
    letter-spacing: -0.04em;
    line-height: 1.1;
    color: var(--brand-slate, #2C3E50);
    font-variant-numeric: tabular-nums;
}

.dash-snapshot-label,
.dash-snapshot-sub {
    font-size: 0.88rem;
    color: var(--color-muted);
}

.dash-snapshot-sub {
    margin: 8px 0 0;
    font-variant-numeric: tabular-nums;
}

.dash-snapshot-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
}

.dash-snapshot-empty {
    margin: 12px 0 0;
    font-size: 0.88rem;
    color: var(--color-muted);
}

.dash-people {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
}

.dash-people li a {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 0;
    border-top: 1px solid var(--border-color);
    text-decoration: none;
    color: inherit;
    min-width: 0;
}

.dash-people li a:hover .dash-people-name {
    color: var(--brand-black, #0F0F0F);
}

.dash-people-name {
    font-size: 0.88rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.dash-people-meta {
    flex-shrink: 0;
    font-size: 0.75rem;
    color: var(--color-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.dash-needs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.dash-needs > .card,
.dash-needs > .dash-snapshot-card {
    margin-bottom: 0;
    min-height: 0;
}

.dash-snapshot > .dash-alerts-card {
    margin-bottom: 0;
    height: auto;
    max-height: 320px;
}

.dash-needs .analytics-insights-card {
    margin-bottom: 0;
}

.dash-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.dash-toolbar .dash-action-card {
    flex: 1 1 140px;
    box-shadow: none;
}

/* Dashboard Rows */
.dash-row-2 {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.dash-chart-card {
    min-height: 300px;
}

.dash-chart-total {
    font-size: 0.82rem;
    color: var(--color-muted);
    margin-top: 2px;
}

.dash-row-4 {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 20px;
}

/* Quick Actions */
.dash-quick-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.dash-action-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.88rem;
    font-weight: 550;
    color: var(--color-primary);
    text-decoration: none;
    transition: all var(--transition);
    box-shadow: var(--shadow);
}

.dash-action-card:hover {
    border-color: rgba(0,0,0,0.15);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.dash-action-card i,
.dash-action-card svg {
    width: 20px;
    height: 20px;
    color: var(--color-accent);
    flex-shrink: 0;
}

/* Alerts */
.dash-alerts-card {
    height: 360px;
    max-height: 360px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.dash-alerts-card .card-header {
    flex-shrink: 0;
}

.dash-alerts-card .card-body {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.dash-alerts-list {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    height: 100%;
}

.dash-alert-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    text-decoration: none;
    color: var(--color-primary);
    border-bottom: 1px solid rgba(0,0,0,0.04);
    transition: background var(--transition);
}

.dash-alert-item:last-child { border-bottom: none; }
.dash-alert-item:hover { background: rgba(0,0,0,0.02); }

.dash-alert-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dash-alert-icon i,
.dash-alert-icon svg {
    width: 16px;
    height: 16px;
}

.dash-alert-warning .dash-alert-icon { background: rgba(245,158,11,0.1); color: var(--color-warning); }
.dash-alert-danger .dash-alert-icon { background: rgba(220,38,38,0.1); color: #DC2626; }
.dash-alert-success .dash-alert-icon { background: rgba(22,163,74,0.1); color: #16A34A; }
.dash-alert-info .dash-alert-icon { background: rgba(37,99,235,0.08); color: var(--color-accent); }
.dash-alert-accent .dash-alert-icon { background: rgba(139,92,246,0.08); color: #8B5CF6; }

.dash-alert-text {
    flex: 1;
    font-size: 0.84rem;
    line-height: 1.4;
}

.dash-alert-arrow {
    width: 14px;
    height: 14px;
    color: var(--color-muted);
    flex-shrink: 0;
}

.dash-pending-pay-card {
    border-color: #fcd34d;
}

.dash-pending-pay-copy {
    margin: 0 0 14px;
    font-size: 0.84rem;
    line-height: 1.5;
    color: #92400e;
}

.dash-pending-pay-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dash-pending-pay-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-top: 1px solid rgba(0,0,0,0.06);
}

.dash-pending-pay-row:first-child {
    border-top: none;
    padding-top: 0;
}

.dash-pending-pay-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    min-width: 0;
}

.dash-pending-pay-name {
    font-weight: 600;
}

.dash-pending-pay-form,
.dash-pending-pay-all {
    margin: 0;
    flex-shrink: 0;
}

.dash-pending-pay-all {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(0,0,0,0.06);
}

.sandbox-recovery-box {
    margin-bottom: 16px;
    padding: 14px 16px;
    border: 1px solid #fcd34d;
    border-radius: var(--radius);
    background: #fffbeb;
}

.sandbox-recovery-head {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    color: #92400e;
    margin-bottom: 12px;
}

.sandbox-recovery-head i,
.sandbox-recovery-head svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin-top: 2px;
}

.sandbox-recovery-head p {
    margin: 4px 0 0;
    font-size: 0.82rem;
    line-height: 1.45;
}

.sandbox-recovery-row {
    padding: 10px 0;
    border-top: 1px solid rgba(146, 64, 14, 0.12);
}

.sandbox-recovery-row.is-fail {
    color: #991b1b;
}

.sandbox-recovery-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    font-size: 0.84rem;
    margin-bottom: 8px;
}

.sandbox-recovery-error {
    color: #991b1b;
}

.sandbox-recovery-copy {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.sandbox-recovery-text {
    flex: 1;
    min-width: 0;
    font-size: 0.82rem;
    line-height: 1.4;
    padding: 8px 10px;
    border: 1px solid #fcd34d;
    border-radius: 6px;
    background: #fff;
    resize: vertical;
}

.sandbox-recovery-link {
    margin: 6px 0 0;
    font-size: 0.75rem;
    word-break: break-all;
}

@media (max-width: 720px) {
    .dash-pending-pay-row,
    .sandbox-recovery-copy {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Activity Timeline */
.dash-activity-list {
    display: flex;
    flex-direction: column;
}

.dash-activity-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid rgba(0,0,0,0.04);
}

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

.dash-activity-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0,0,0,0.04);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
}

.dash-activity-icon i,
.dash-activity-icon svg {
    width: 14px;
    height: 14px;
    color: var(--color-muted);
}

.dash-activity-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dash-activity-text {
    font-size: 0.84rem;
    line-height: 1.4;
}

.dash-activity-time {
    font-size: 0.75rem;
    color: var(--color-muted);
}

.dash-hide-mobile { /* shown by default */ }

/* --- Tables --- */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    text-align: left;
    font-size: 0.75rem;
    font-weight: 550;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-muted);
    padding: 12px 22px;
    border-bottom: 1px solid var(--border-color);
    background: #FAFAFA;
}

.table td {
    padding: 14px 22px;
    font-size: 0.88rem;
    border-bottom: 1px solid rgba(0,0,0,0.04);
    vertical-align: middle;
}

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

.table-row-link {
    cursor: pointer;
    transition: background var(--transition);
}
.table-row-link:hover {
    background: rgba(0,0,0,0.02);
}

/* --- Badges --- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 550;
    letter-spacing: 0.01em;
}

.badge-primary { background: rgba(86, 125, 255, 0.12); color: var(--brand-blue, #567DFF); }
.badge-success { background: rgba(22,163,74,0.1); color: #16A34A; }
.badge-warning { background: rgba(230, 126, 34, 0.12); color: var(--brand-orange, #E67E22); }
.badge-danger  { background: rgba(220,38,38,0.1); color: #DC2626; }
.badge-info    { background: rgba(6,182,212,0.1); color: #0891B2; }
.badge-muted   { background: rgba(0,0,0,0.05); color: var(--color-muted); }
.analytics-channel-badge {
    display: inline-flex;
    align-items: baseline;
    gap: 0.35em;
    flex-wrap: wrap;
    max-width: 100%;
    line-height: 1.25;
    white-space: normal;
    text-align: left;
}
.analytics-channel-host {
    font-weight: 500;
    font-size: 0.78em;
    opacity: 0.85;
    word-break: break-all;
}
.badge-outline { background: transparent; border: 1px solid var(--border-color); color: var(--color-muted); }

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 550;
    transition: all var(--transition);
    border: 1px solid transparent;
    white-space: nowrap;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
}

.btn-primary {
    background: var(--brand-mint, #80D4C5);
    color: var(--brand-slate, #2C3E50);
    border-color: var(--brand-mint, #80D4C5);
}
.btn-primary:hover {
    background: var(--brand-mint-hover, #5EC3B2);
    color: var(--brand-slate, #2C3E50);
    box-shadow: 0 2px 8px rgba(128, 212, 197, 0.25);
}

.btn-secondary {
    background: #fff;
    color: var(--color-primary);
    border-color: var(--border-color);
}
.btn-secondary:hover {
    background: var(--color-bg, #F8F6F3);
    border-color: rgba(0,0,0,0.2);
}

.btn-ghost {
    background: transparent;
    color: var(--color-muted);
}
.btn-ghost:hover {
    background: rgba(0,0,0,0.04);
    color: var(--color-primary);
}

.btn-danger {
    background: var(--color-danger);
    color: #fff;
    border-color: var(--color-danger);
}
.btn-danger:hover {
    background: #B91C1C;
}

.btn-full { width: 100%; }

.page-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* --- Forms --- */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.82rem;
    font-weight: 550;
    margin-bottom: 6px;
    color: #374151;
}

.form-label-link {
    font-size: 0.78rem;
    font-weight: 450;
    color: var(--color-accent);
}
.form-label-link:hover {
    text-decoration: underline;
}

.form-input {
    width: 100%;
    height: 42px;
    padding: 0 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: #fff;
    font-size: 0.9rem;
    color: var(--color-primary);
    transition: all var(--transition);
    outline: none;
}

.form-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0,0,0,0.06);
}

.form-input::placeholder {
    color: #A1A1AA;
}

.input-password-wrapper {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-muted);
    padding: 4px;
}
.password-toggle:hover { color: var(--color-primary); }

.form-check {
    margin-bottom: 24px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    font-size: 0.85rem;
    color: #4B5563;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    accent-color: var(--color-primary);
}

/* --- Alerts --- */
.alert {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 450;
    margin-bottom: 20px;
    animation: slideDown 0.3s ease;
}

.alert-success { background: rgba(22,163,74,0.08); color: #15803D; border: 1px solid rgba(22,163,74,0.15); }
.alert-error   { background: rgba(220,38,38,0.08); color: #B91C1C; border: 1px solid rgba(220,38,38,0.15); }
.alert-warning { background: rgba(245,158,11,0.08); color: #92400E; border: 1px solid rgba(245,158,11,0.15); }
.alert-info    { background: rgba(37,99,235,0.08); color: #1D4ED8; border: 1px solid rgba(37,99,235,0.15); }

.alert-close {
    font-size: 1.2rem;
    line-height: 1;
    color: inherit;
    opacity: 0.5;
}
.alert-close:hover { opacity: 1; }

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--color-muted);
}

.empty-state i {
    font-size: 2.5rem;
    opacity: 0.3;
    margin-bottom: 12px;
}

.empty-state p {
    font-size: 0.95rem;
    font-weight: 550;
    margin-bottom: 4px;
    color: #6B7280;
}

.empty-state span {
    font-size: 0.82rem;
}

/* --- Page Header --- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
}

.page-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.page-heading {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* --- Icon Button --- */
.btn-icon {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--color-muted);
    transition: all var(--transition);
    flex-shrink: 0;
}
.btn-icon:hover {
    background: rgba(0,0,0,0.05);
    color: var(--color-primary);
}
.btn-icon-danger:hover {
    background: rgba(220,38,38,0.06);
    color: var(--color-danger);
}

/* --- Filters Bar --- */
.filters-bar {
    margin-bottom: 20px;
    padding: 12px 16px;
}

.filters-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-item {
    position: relative;
    display: flex;
    align-items: center;
}

.filter-item-grow {
    flex: 1;
    min-width: 180px;
}

.filter-icon {
    position: absolute;
    left: 12px;
    font-size: 0.9rem;
    color: var(--color-muted);
    pointer-events: none;
}

.filter-input {
    height: 38px;
    padding: 0 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: #fff;
    font-size: 0.85rem;
    color: var(--color-primary);
    outline: none;
    transition: all var(--transition);
}

.filter-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0,0,0,0.04);
}

.filter-item-grow .filter-input {
    width: 100%;
    padding-left: 36px;
}

.filter-select {
    min-width: 140px;
    appearance: auto;
    cursor: pointer;
}

/* --- Table Responsive --- */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* --- Product Table Cells --- */
.product-thumb {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

.product-thumb-placeholder {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: #F3F4F6;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #D1D5DB;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.product-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.product-cell-name {
    font-weight: 550;
    font-size: 0.88rem;
    color: var(--color-primary);
}

.product-name-edit {
    display: block;
    max-width: 100%;
    margin: -2px -4px;
    padding: 2px 4px;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: text;
    transition: border-color 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
}

.product-name-edit:hover {
    border-color: var(--color-border, #e5e7eb);
    background: var(--color-surface, #fff);
}

.product-name-edit:focus-within {
    border-color: var(--color-primary, #0d9488);
    background: var(--color-surface, #fff);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

.product-name-input {
    display: block;
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
    outline: none;
    background: transparent;
    font: inherit;
    font-weight: 550;
    font-size: 0.88rem;
    line-height: 1.3;
    color: var(--color-primary);
}

.product-name-input.is-saving {
    opacity: 0.55;
}

.product-cell-desc {
    font-size: 0.78rem;
    color: var(--color-muted);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-price {
    font-weight: 600;
    font-size: 0.88rem;
}

.product-price-edit {
    display: inline-flex;
    align-items: center;
    gap: 1px;
    max-width: 100%;
    padding: 2px 6px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    cursor: text;
    transition: border-color 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
}

.product-price-edit:hover {
    border-color: var(--color-border, #e5e7eb);
    background: var(--color-surface, #fff);
}

.product-price-edit:focus-within {
    border-color: var(--color-primary, #0d9488);
    background: var(--color-surface, #fff);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

.product-price-prefix {
    font-weight: 600;
    font-size: 0.88rem;
    color: inherit;
    line-height: 1;
    pointer-events: none;
}

.product-price-input {
    width: 4.5rem;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
    outline: none;
    background: transparent;
    font: inherit;
    font-weight: 600;
    font-size: 0.88rem;
    line-height: 1.3;
    color: inherit;
    /* Hide spinner arrows so it reads like a price, not a form field */
    -moz-appearance: textfield;
    appearance: textfield;
}

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

.product-price-input.is-saving {
    opacity: 0.55;
}

.product-compare-price {
    display: block;
    text-decoration: line-through;
    color: var(--color-muted);
    font-size: 0.75rem;
    margin-top: 1px;
}

/* --- Dietary Tags Inline --- */
.dietary-tags-inline {
    display: flex;
    gap: 4px;
    margin-top: 3px;
    flex-wrap: wrap;
}

.dietary-tag {
    font-size: 0.62rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 10px;
    background: rgba(22,163,74,0.08);
    color: var(--color-success);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

/* --- Toggle Switch --- */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    cursor: pointer;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: #D1D5DB;
    border-radius: 22px;
    transition: background 0.25s ease;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.25s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--color-success);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(18px);
}

/* --- Status Toggle Items --- */
.status-toggles {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.status-toggle-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    cursor: default;
}

.status-toggle-item + .status-toggle-item {
    border-top: 1px solid rgba(0,0,0,0.04);
}

.status-toggle-label {
    font-size: 0.85rem;
    font-weight: 450;
    color: #374151;
}

/* --- Form Grid (Product Form) --- */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 24px;
    align-items: start;
    min-width: 0;
}

.form-grid-single {
    grid-template-columns: 1fr;
    max-width: 760px;
}

.form-column-main {
    min-width: 0;
    overflow: hidden;
}
/* form-column-side intentionally has no overflow:hidden — the Order
   Summary card uses position: sticky, which only works when none of
   its ancestors clip the overflow. */
.form-column-side {
    min-width: 0;
}

.form-column-main .card,
.form-column-side .card {
    margin-bottom: 20px;
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-col-2 {
    flex: 1;
    min-width: 0;
}

.form-textarea {
    height: auto;
    padding: 10px 14px;
    resize: vertical;
    min-height: 80px;
    line-height: 1.5;
}

.form-hint {
    font-size: 0.72rem;
    font-weight: 400;
    color: var(--color-muted);
}

.form-divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 18px 0;
}

.form-input-file {
    padding: 8px 14px;
    height: auto;
    font-size: 0.82rem;
}

/* --- Form Sticky Header --- */
.form-sticky-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* Wrap at every width — order detail can have 6+ action buttons, which
       overflowed the viewport on phones/tablets rendering above the 768px
       mobile breakpoint (e.g. Safari "Request Desktop Website"). */
    flex-wrap: wrap;
    gap: 10px 16px;
    margin-bottom: 24px;
    padding: 14px 20px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    position: sticky;
    top: var(--topbar-height);
    z-index: 40;
}

.form-sticky-left {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
    flex: 1;
}

.form-sticky-left .page-heading {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.form-sticky-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    flex-shrink: 1;
    min-width: 0;
}

/* Order detail packs an order number, several chips, and a long action
   row into one header. Let each side keep its content width and drop the
   buttons onto the next line instead of ellipsizing the number to "#.."
   and painting the chips over Start Preparing. */
.order-detail-sticky {
    align-items: flex-start;
}

.order-detail-sticky .form-sticky-left,
.order-detail-sticky .form-sticky-actions {
    flex: 1 1 auto;
    min-width: min(100%, max-content);
}

.order-detail-sticky .form-sticky-left .page-heading {
    flex: 0 0 auto;
    overflow: visible;
    text-overflow: unset;
}

.order-detail-sticky .form-sticky-left .badge {
    max-width: 100%;
    height: auto;
    white-space: normal;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

/* --- Image Upload --- */
.image-upload-area {
    position: relative;
    border: 2px dashed rgba(0,0,0,0.12);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all var(--transition);
    background: #FAFAFA;
}

.image-upload-area:hover {
    border-color: rgba(0,0,0,0.2);
}

.image-upload-area:focus {
    outline: none;
}

.image-upload-area:focus-visible,
.image-upload-area.drag-over {
    border-color: var(--color-accent);
    background: rgba(37,99,235,0.03);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.08);
}

.image-upload-placeholder {
    padding: 36px 20px;
    text-align: center;
    cursor: pointer;
    color: var(--color-muted);
}

.image-upload-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 12px;
    border-radius: 50%;
    background: rgba(0,0,0,0.04);
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-upload-icon i {
    font-size: 1.3rem;
    opacity: 0.4;
}

.image-upload-placeholder p {
    font-size: 0.85rem;
    font-weight: 500;
    color: #4B5563;
    margin-bottom: 4px;
}

.image-upload-placeholder span {
    font-size: 0.75rem;
    color: var(--color-muted);
}

.image-preview {
    position: relative;
}

.image-preview img {
    width: 100%;
    max-height: 240px;
    object-fit: cover;
    display: block;
}

.image-remove-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background: rgba(0,0,0,0.55);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: all var(--transition);
    backdrop-filter: blur(4px);
}
.image-remove-btn:hover {
    background: var(--color-danger);
    transform: scale(1.1);
}

.image-size-meta {
    margin: 8px 0 0;
    font-size: 0.75rem;
    color: var(--color-muted);
    line-height: 1.3;
    font-variant-numeric: tabular-nums;
}

.image-compress-btn {
    width: 100%;
    justify-content: center;
    margin-top: 10px;
}

.image-compress-btn:disabled {
    opacity: 0.7;
    cursor: wait;
}

.image-source-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.image-source-actions .btn {
    flex: 1;
    justify-content: center;
}

.product-image-picker-modal {
    max-width: 920px;
}

.product-image-picker-toolbar {
    padding: 12px 24px;
    border-bottom: 1px solid var(--border-color);
}

.product-image-picker-toolbar .filter-input {
    width: 100%;
}

.product-image-picker-body {
    max-height: 62vh;
    overflow-y: auto;
    padding: 16px 24px 24px;
}

.product-image-picker-section + .product-image-picker-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.product-image-picker-section-title {
    margin: 0 0 12px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.product-image-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

.product-image-picker-card {
    min-height: 190px;
}

.product-image-picker-loading,
.product-image-picker-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 48px 20px;
    color: var(--color-muted);
    text-align: center;
}

.product-image-picker-loading i,
.product-image-picker-empty i {
    width: 32px;
    height: 32px;
    opacity: 0.6;
}

/* --- Dietary Chips --- */
.chip-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: #fff;
    font-size: 0.78rem;
    font-weight: 500;
    color: #6B7280;
    cursor: pointer;
    transition: all var(--transition);
    user-select: none;
}

.chip input[type="checkbox"] {
    display: none;
}

.chip i {
    font-size: 0.85rem;
    opacity: 0.5;
}

.chip:hover {
    border-color: rgba(0,0,0,0.2);
    background: #F9FAFB;
}

.chip-active {
    border-color: var(--color-success);
    background: rgba(22,163,74,0.06);
    color: var(--color-success);
}

.chip-active i {
    opacity: 1;
}

/* --- Modifier Select List (form) --- */
.modifier-select-list {
    display: flex;
    flex-direction: column;
}

.modifier-select-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 22px;
    cursor: pointer;
    transition: background var(--transition);
    border-bottom: 1px solid rgba(0,0,0,0.04);
}

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

.modifier-select-item:hover {
    background: rgba(0,0,0,0.015);
}

.modifier-select-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--color-primary);
    flex-shrink: 0;
}

.modifier-select-info {
    flex: 1;
    min-width: 0;
}

.modifier-select-name {
    display: block;
    font-size: 0.88rem;
    font-weight: 550;
}

.modifier-select-meta {
    display: block;
    font-size: 0.75rem;
    color: var(--color-muted);
    margin-top: 1px;
}

.modifier-select-check {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0,0,0,0.04);
    display: flex;
    align-items: center;
    justify-content: center;
    color: transparent;
    transition: all var(--transition);
    flex-shrink: 0;
}
.modifier-select-check i {
    width: 12px;
    height: 12px;
}

.modifier-select-item input:checked ~ .modifier-select-check {
    background: var(--color-primary);
    color: #fff;
}

/* --- Category Cards Grid --- */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.category-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: box-shadow var(--transition);
}

.category-card:hover {
    box-shadow: var(--shadow-md);
}

.category-card-image {
    height: 120px;
    overflow: hidden;
    background: #F3F4F6;
}

.category-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.category-card-image-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #D1D5DB;
    font-size: 2rem;
}

.category-card-body {
    padding: 16px 18px;
    flex: 1;
}

.category-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}

.category-card-name {
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.category-card-desc {
    font-size: 0.78rem;
    color: var(--color-muted);
    line-height: 1.4;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.category-card-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.78rem;
    color: var(--color-muted);
}

.category-card-meta i {
    font-size: 0.85rem;
    vertical-align: -1px;
    margin-right: 2px;
}

.category-card-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    padding: 10px 14px;
    border-top: 1px solid var(--border-color);
    background: #FAFAFA;
}

/* --- Accordion Cards (Modifiers) --- */
.accordion-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.accordion-card {
    overflow: hidden;
}

.accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    cursor: pointer;
    transition: background var(--transition);
    user-select: none;
}

.accordion-header:hover {
    background: rgba(0,0,0,0.01);
}

.accordion-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.accordion-chevron {
    font-size: 1rem;
    color: var(--color-muted);
    transition: transform 0.25s ease;
    flex-shrink: 0;
}

.accordion-open .accordion-chevron {
    transform: rotate(90deg);
}

.accordion-title {
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.accordion-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    font-size: 0.75rem;
    flex-wrap: wrap;
}

.accordion-header-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.accordion-body {
    display: none;
    border-top: 1px solid var(--border-color);
}

.accordion-open .accordion-body {
    display: block;
}

/* --- Modifier Options List (display) --- */
.modifier-options-list {
    padding: 4px 0;
}

.modifier-options-hint {
    font-size: 0.74rem;
    margin: 0;
    padding: 2px 20px 6px 28px;
}

.modifier-option-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 10px 20px 10px 20px;
    font-size: 0.85rem;
    gap: 10px;
}

.modifier-option-item + .modifier-option-item {
    border-top: 1px solid rgba(0,0,0,0.03);
}

.modifier-option-drag {
    cursor: grab;
    color: var(--color-muted);
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    margin-top: 2px;
    padding: 2px;
    border-radius: 4px;
    user-select: none;
    touch-action: none;
}

.modifier-option-drag:hover {
    color: var(--color-primary);
    background: rgba(0, 0, 0, 0.04);
}

.modifier-option-drag:active {
    cursor: grabbing;
}

.modifier-option-drag i,
.modifier-option-drag svg {
    width: 16px;
    height: 16px;
}

.modifier-option-name {
    font-weight: 450;
}

.modifier-option-main {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1;
}

.modifier-option-short,
.modifier-option-desc {
    font-size: 0.75rem;
    line-height: 1.35;
    color: var(--color-muted);
}

.modifier-option-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.modifier-option-price {
    font-size: 0.82rem;
    white-space: nowrap;
    margin-top: 2px;
}

.price-add { color: var(--color-success); font-weight: 550; }
.price-sub { color: var(--color-danger); font-weight: 550; }

/* --- Modifiers Toolbar (search + filters + expand) --- */
.modifiers-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 0 0 16px;
}

.modifiers-filter-chips {
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: #fff;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--color-muted);
    cursor: pointer;
    transition: all var(--transition);
}

.filter-chip:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.filter-chip-active,
.filter-chip-active:hover {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}

.filter-chip-count {
    font-size: 0.68rem;
    font-weight: 600;
    background: rgba(0,0,0,0.06);
    border-radius: 999px;
    padding: 1px 7px;
}

.filter-chip-active .filter-chip-count {
    background: rgba(255,255,255,0.22);
}

.filter-chip-attention:not(.filter-chip-active) {
    border-color: #fcd34d;
    background: #fffbeb;
    color: #92400e;
}

.modifiers-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.modifiers-bulk-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin: 0 0 14px;
    padding: 10px 14px;
    background: #fafafa;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}

.modifiers-bulk-select-all {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    cursor: pointer;
    font-size: 0.88rem;
    color: var(--color-muted);
}

.modifier-group-select-wrap {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    padding: 4px;
}

.modifier-group-select {
    width: 16px;
    height: 16px;
    margin: 0;
    cursor: pointer;
}

/* --- Modifiers page: menu switcher + sections --- */
.modifiers-menu-switcher {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.modifiers-menu-switcher .menu-store-card {
    display: block;
    padding: 14px 16px;
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    border: 2px solid var(--border-color);
    background: var(--color-surface, #fff);
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.modifiers-menu-switcher .menu-store-card:hover {
    border-color: var(--color-primary, #2563eb);
}

.modifiers-menu-switcher .menu-store-card-active {
    border-color: var(--color-primary, #2563eb);
    background: rgba(37, 99, 235, 0.06);
    box-shadow: 0 1px 4px rgba(37, 99, 235, 0.12);
}

.modifiers-menu-switcher .menu-store-card-all {
    opacity: 0.95;
}

.modifiers-menu-switcher .menu-store-card-inner {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.modifiers-menu-switcher .menu-store-card-main {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.modifiers-menu-switcher .menu-store-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
}

.modifiers-menu-switcher .menu-store-card-icon i {
    width: 16px;
    height: 16px;
}

.modifiers-menu-switcher .menu-store-card-title {
    font-weight: 600;
    font-size: 0.95rem;
}

.modifiers-menu-switcher .menu-store-card-hint {
    font-size: 0.76rem;
    color: var(--color-muted);
    margin-top: 2px;
}

.modifiers-menu-switcher .menu-store-card-count {
    flex-shrink: 0;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.06);
    color: var(--color-muted);
}

.modifiers-menu-tabs {
    margin-bottom: 16px;
}

.modifiers-menu-section {
    margin-bottom: 28px;
}

.modifiers-menu-section-header {
    margin-bottom: 12px;
}

.modifiers-menu-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.modifiers-menu-section-title i {
    width: 18px;
    height: 18px;
    color: var(--color-muted);
}

.modifiers-menu-section-title h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 650;
}

.modifiers-menu-section-hint {
    margin: 6px 0 0;
    font-size: 0.82rem;
}

/* --- Accordion header count pills --- */
.accordion-header-stats {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.count-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: #fafafa;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--color-muted);
    white-space: nowrap;
}

.count-pill i, .count-pill svg {
    width: 12px;
    height: 12px;
}

.count-pill-products {
    border-color: color-mix(in srgb, var(--color-primary) 30%, var(--border-color) 70%);
    background: color-mix(in srgb, var(--color-primary) 6%, #ffffff 94%);
    color: var(--color-primary);
}

.count-pill-warning {
    border-color: #fcd34d;
    background: #fffbeb;
    color: #92400e;
}

/* --- Linked products section inside the accordion --- */
.modifier-no-options {
    padding: 14px 20px 14px 48px;
    font-size: 0.82rem;
    margin: 0;
}

.modifier-products-section {
    border-top: 1px dashed var(--border-color);
    background: #fafbfc;
    padding: 14px 20px 14px 48px;
}

.modifier-products-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--color-muted);
    margin-bottom: 10px;
}

.modifier-products-title i, .modifier-products-title svg {
    width: 13px;
    height: 13px;
}

.modifier-products-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.product-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: #fff;
    font-size: 0.78rem;
    font-weight: 500;
    color: inherit;
    text-decoration: none;
    transition: all var(--transition);
}

.product-chip:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
}

.product-chip-inactive {
    opacity: 0.55;
}

.product-chip-inactive:hover { opacity: 0.8; }

.product-chip-channel {
    font-size: 0.62rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: rgba(0,0,0,0.06);
    border-radius: 999px;
    padding: 1px 7px;
    color: var(--color-muted);
}

.modifier-products-hint {
    font-size: 0.72rem;
    margin: 10px 0 0;
}

.modifier-products-empty {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.8rem;
    line-height: 1.45;
    color: #92400e;
}

.modifier-products-empty i, .modifier-products-empty svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    margin-top: 2px;
}

.modifier-products-empty a {
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
}

/* --- "Used by products" panel in the edit modal --- */
.modal-linked-products {
    border: 1px solid var(--border-color);
    background: #fafbfc;
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 20px;
}

/* --- Modifier Option Rows (modal form) --- */
.modifier-option-row {
    display: grid;
    gap: 12px;
    margin-bottom: 10px;
    padding: 12px;
    border: 1px solid color-mix(in srgb, var(--border-color) 70%, #e6e9f5 30%);
    border-radius: 12px;
    background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
}

.modifier-option-row-top {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr) 120px 30px;
    align-items: center;
    gap: 10px;
}

.modifier-option-row .modifier-option-drag {
    justify-self: center;
}

#modifier-options {
    display: grid;
    gap: 8px;
}

.modifier-option-row-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px;
}

.modifier-option-price-input {
    position: relative;
    width: 100%;
    flex-shrink: 0;
}

.modifier-option-prefix {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.82rem;
    color: var(--color-muted);
    pointer-events: none;
}

.modifier-option-price-input .form-input {
    padding-left: 32px;
    font-weight: 560;
}

.modifier-option-textarea {
    min-height: 74px;
    resize: vertical;
    padding-top: 11px;
    line-height: 1.45;
}

.modifier-option-textarea::placeholder {
    color: color-mix(in srgb, var(--color-muted) 80%, #ffffff 20%);
    opacity: 1;
}

.modifier-option-field {
    display: grid;
    gap: 6px;
}

.modifier-plus-toggle-field {
    align-content: end;
}

.modifier-plus-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    margin: 0;
    font-size: 0.8rem;
    color: var(--color-text);
    border: 1px solid color-mix(in srgb, var(--border-color) 75%, #dce3f7 25%);
    background: #ffffff;
    border-radius: 10px;
    padding: 8px 10px;
}

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

.modifier-option-field-label {
    font-size: 0.72rem;
    font-weight: 520;
    color: var(--color-muted);
    line-height: 1.2;
    letter-spacing: .01em;
}

.modifier-dietary-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.modifier-dietary-pill {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: #fff;
    color: var(--color-muted);
    font-size: 0.72rem;
    font-weight: 520;
    line-height: 1;
    cursor: pointer;
    transition: all var(--transition);
}

.modifier-dietary-pill input[type="radio"] {
    display: none;
}

.modifier-dietary-pill span {
    display: inline-flex;
    padding: 6px 10px;
}

.modifier-dietary-pill:hover {
    border-color: rgba(0,0,0,0.2);
    background: #F9FAFB;
}

.modifier-dietary-pill.is-active {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: rgba(0,0,0,0.04);
}

.modifier-option-short,
.modifier-option-desc {
    overflow-wrap: anywhere;
}

/* --- Modal --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalIn 0.2s ease;
}

.modal-lg {
    max-width: 640px;
}

.modal > form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.96) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.modal-title {
    font-size: 1.05rem;
    font-weight: 650;
}

.modal-close {
    font-size: 1.4rem;
    color: var(--color-muted);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}
.modal-close:hover {
    background: rgba(0,0,0,0.04);
    color: var(--color-primary);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    overscroll-behavior: contain;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

/* --- Empty State (refined) --- */
.empty-state-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: rgba(0,0,0,0.03);
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-state-icon i {
    font-size: 1.6rem;
    color: var(--color-muted);
    opacity: 0.4;
    margin-bottom: 0;
}

.empty-state-title {
    font-size: 1rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

.empty-state-text {
    font-size: 0.85rem;
    color: var(--color-muted);
    max-width: 320px;
    margin: 0 auto;
    line-height: 1.5;
}

/* --- Badge Icons --- */
.badge-icon {
    width: 12px;
    height: 12px;
    vertical-align: -1px;
}

/* --- Detail Icons --- */
.detail-icon {
    width: 14px;
    height: 14px;
    vertical-align: -2px;
    margin-right: 2px;
    opacity: 0.5;
}

/* --- Card Title Icons --- */
.card-title i,
.card-title svg {
    width: 16px;
    height: 16px;
    vertical-align: -2px;
    margin-right: 4px;
    opacity: 0.5;
}

/* --- Order Timeline --- */
.order-timeline {
    display: flex;
    align-items: flex-start;
    gap: 0;
    position: relative;
    padding: 8px 0;
}

.timeline-step {
    flex: 1;
    text-align: center;
    position: relative;
}

.timeline-step::before {
    content: '';
    position: absolute;
    top: 10px;
    left: -50%;
    right: 50%;
    height: 2px;
    background: rgba(0,0,0,0.08);
}

.timeline-step:first-child::before {
    display: none;
}

.timeline-done::before {
    background: var(--color-success);
}

.timeline-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0,0,0,0.06);
    margin: 0 auto 8px;
    position: relative;
    z-index: 1;
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px rgba(0,0,0,0.06);
}

.timeline-done .timeline-dot {
    background: var(--color-success);
    box-shadow: 0 0 0 2px rgba(22,163,74,0.2);
}

.timeline-current .timeline-dot {
    box-shadow: 0 0 0 3px rgba(37,99,235,0.25);
    background: var(--color-accent);
}

.timeline-label {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--color-muted);
    letter-spacing: 0.01em;
}

.timeline-time {
    margin-top: 4px;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--color-text, #111);
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

.timeline-source {
    margin-top: 2px;
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-accent, #2563eb);
}

.timeline-done .timeline-label {
    color: var(--color-success);
}

.timeline-done .timeline-time {
    color: var(--color-success);
}

.timeline-current .timeline-label {
    color: var(--color-accent);
    font-weight: 600;
}

.timeline-current .timeline-time {
    color: var(--color-accent);
}

.timeline-cancelled .timeline-dot {
    background: rgba(0,0,0,0.06) !important;
    box-shadow: 0 0 0 2px rgba(0,0,0,0.06) !important;
}

.timeline-cancelled .timeline-label {
    color: var(--color-muted) !important;
}

.timeline-cancelled-step .timeline-dot {
    background: var(--color-danger) !important;
    box-shadow: 0 0 0 3px rgba(220,38,38,0.2) !important;
}

.timeline-cancelled-step .timeline-label {
    color: var(--color-danger) !important;
    font-weight: 600;
}

/* --- Order Items List --- */
.order-items-list {
    display: flex;
    flex-direction: column;
}

.order-items-section-label {
    padding: 10px 20px 4px;
    color: var(--color-muted);
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.order-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(0,0,0,0.04);
}

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

.order-item-qty {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-muted);
    min-width: 30px;
}

.order-item-qty-control {
    display: flex;
    align-items: center;
    gap: 4px;
}

.qty-input {
    width: 56px;
    height: 34px;
    text-align: center;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    background: #fff;
}

.qty-input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 2px rgba(37,99,235,0.1);
}

.order-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}

.order-item-name {
    font-size: 0.88rem;
    font-weight: 550;
    color: var(--color-primary);
    overflow-wrap: break-word;
    word-break: break-word;
}

.order-item-mods {
    font-size: 0.78rem;
    color: var(--color-muted);
}

/* Grouped modifier rows on the order detail Items card — one row per
   modifier group; each pick is its own chip so 2 proteins/dips scan fast. */
.order-item-mod-rows {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.order-item-mod-row {
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr);
    align-items: start;
    gap: 8px 10px;
    font-size: 0.8rem;
    line-height: 1.4;
}

.order-item-mod-row-multi {
    padding-bottom: 2px;
}

.mod-row-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding-top: 4px;
    color: var(--color-muted);
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1.2;
}

.mod-row-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: #E5E7EB;
    color: #4B5563;
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: none;
}

.mod-row-values {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    min-width: 0;
}

.mod-value-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: 100%;
    padding: 3px 9px;
    border-radius: 6px;
    background: #F3F4F6;
    border: 1px solid #E5E7EB;
    color: #1F2937;
    font-size: 0.78rem;
    font-weight: 500;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.mod-value-chip-popular {
    background: #FFFBEB;
    border-color: #FCD34D;
    color: #92400E;
}

.mod-qty-tag {
    flex-shrink: 0;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.mod-addon-price {
    flex-shrink: 0;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #047857;
    font-size: 0.74rem;
}

.mod-popular-tag {
    flex-shrink: 0;
    background: #FEF3C7;
    border: 1px solid #F59E0B;
    border-radius: 4px;
    padding: 0 4px;
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    white-space: nowrap;
}

.mod-popular-choice {
    flex-wrap: wrap;
    gap: 6px;
    padding: 4px 10px;
}

.mod-popular-request {
    font-weight: 700;
}

.mod-popular-arrow {
    color: #B45309;
    font-weight: 800;
}

.mod-popular-chose {
    font-weight: 700;
    color: #78350F;
}

.mod-popular-chose-label {
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.68em;
    margin-right: 4px;
    color: #92400E;
}

@media (max-width: 640px) {
    .order-item-mod-row {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .mod-row-label {
        padding-top: 0;
    }
}

/* ── Customer analytics dashboard ─────────────────────────────────── */
.analytics-funnel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 16px 16px;
}

.analytics-insights-card {
    margin-bottom: 16px;
}

.dash-support-card {
    margin-bottom: 16px;
}
.dash-support-card.is-hot {
    border-color: rgba(245, 158, 11, 0.4);
}

.analytics-insights-list {
    max-height: 220px;
}

.analytics-insights-empty {
    margin: 0;
    padding: 14px 16px;
    font-size: 0.84rem;
}

.analytics-funnel-step {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 14px;
    align-items: center;
}

.analytics-funnel-bar-wrap {
    grid-column: 1 / -1;
    height: 8px;
    background: #F3F4F6;
    border-radius: 999px;
    overflow: hidden;
}

.analytics-funnel-bar {
    height: 100%;
    background: linear-gradient(90deg, #2563EB, #3B82F6);
    border-radius: 999px;
    min-width: 4px;
}

.analytics-funnel-meta {
    display: flex;
    align-items: baseline;
    gap: 10px;
    min-width: 0;
}

.analytics-funnel-label {
    font-size: 0.84rem;
    font-weight: 550;
    color: #1F2937;
}

.analytics-funnel-count {
    font-size: 0.84rem;
    font-weight: 700;
    color: #111827;
    font-variant-numeric: tabular-nums;
}

.analytics-funnel-pct {
    font-size: 0.72rem;
    color: #6B7280;
    font-variant-numeric: tabular-nums;
}

.analytics-path {
    font-size: 0.78rem;
    word-break: break-all;
}

.analytics-abandon-list {
    max-height: 420px;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.analytics-abandon-card-wrap {
    position: relative;
}

.analytics-abandon-card {
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    padding: 10px 12px;
    background: #FAFAFA;
}

a.analytics-abandon-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}

a.analytics-abandon-card-link:hover {
    border-color: #93C5FD;
    box-shadow: 0 1px 4px rgba(37, 99, 235, 0.12);
    background: #fff;
}

.analytics-abandon-head {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 6px;
    padding-right: 28px;
}

.analytics-abandon-when {
    margin-left: auto;
    font-size: 0.76rem;
    white-space: nowrap;
}

.analytics-abandon-delete-form {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 2;
    margin: 0;
}

.analytics-abandon-delete-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: #9ca3af;
    cursor: pointer;
}

.analytics-abandon-delete-btn:hover {
    background: #fee2e2;
    border-color: #fecaca;
    color: #991b1b;
}

.analytics-abandon-delete-btn i,
.analytics-abandon-delete-btn svg {
    width: 14px;
    height: 14px;
}

.analytics-abandon-items {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.analytics-abandon-foot {
    margin-top: 6px;
    font-size: 0.76rem;
}

.analytics-abandon-list-full {
    max-height: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 10px;
    padding: 12px;
}

.analytics-row-current td {
    background: rgba(59, 130, 246, 0.06);
}

.analytics-row-link:hover td {
    background: #F8FAFC;
}

.analytics-contact-cell {
    font-size: 0.82rem;
    line-height: 1.35;
    max-width: 200px;
}

.analytics-cart-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.analytics-cart-line {
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    padding: 10px 12px;
    background: #fff;
}

.analytics-cart-line-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.analytics-cart-line-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.analytics-cart-line-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    font-size: 0.85rem;
    color: #6B7280;
}

.analytics-cart-line-price {
    font-weight: 600;
    color: #111827;
}

.analytics-cart-type {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.analytics-cart-sublist {
    margin: 8px 0 0;
    padding-left: 18px;
    font-size: 0.82rem;
    color: #374151;
}

.analytics-cart-sublist li + li {
    margin-top: 3px;
}

.analytics-cart-mods li {
    color: #4B5563;
}

.analytics-cart-note {
    margin: 8px 0 0;
    font-size: 0.8rem;
    line-height: 1.4;
}

.analytics-sessions-table .analytics-contact-cell {
    max-width: 220px;
}

.analytics-heatmap-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.analytics-heatmap-canvas {
    width: min(360px, 100%);
    height: auto;
    aspect-ratio: 9 / 16;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    background: #f8fafc;
    box-shadow: var(--theme-shadow);
}

.analytics-heatmap-note {
    font-size: 0.8rem;
    text-align: center;
    max-width: 420px;
}

.analytics-live-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(16, 185, 129, 0.1);
    color: #047857;
    font-size: 0.82rem;
    font-weight: 600;
    margin-right: 8px;
}

.analytics-live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5);
    animation: analytics-live-pulse 2s infinite;
}

@keyframes analytics-live-pulse {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.45); }
    70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.analytics-live-card {
    margin-bottom: 16px;
}

.analytics-live-updated {
    font-size: 0.78rem;
}

.analytics-live-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--color-border);
}

.analytics-live-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.analytics-live-stat strong {
    font-size: 1.35rem;
    line-height: 1.1;
}

.analytics-live-stat span {
    font-size: 0.78rem;
    color: var(--color-muted);
}

.analytics-live-grid {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 0;
}

.analytics-live-panel {
    padding: 16px;
}

.analytics-live-panel + .analytics-live-panel {
    border-left: 1px solid var(--color-border);
}

.analytics-live-heading {
    margin: 0 0 10px;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-muted);
}

.analytics-live-visitors,
.analytics-live-feed {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 220px;
    overflow: auto;
}

.analytics-live-visitors li,
.analytics-live-feed li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    font-size: 0.84rem;
    line-height: 1.35;
}

.analytics-live-visitor {
    padding: 0;
}

.analytics-live-visitor-link {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    padding: 8px 10px;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s ease;
}

.analytics-live-visitor-link:hover {
    background: var(--color-surface-2, rgba(0, 0, 0, 0.04));
}

.analytics-live-visitor-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    width: 100%;
}

.analytics-live-visitor-head .analytics-live-feed-time {
    margin-left: auto;
}

.analytics-live-visitor-meta {
    font-size: 0.78rem;
}

.analytics-live-stage {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.analytics-live-stage-browse {
    background: rgba(100, 116, 139, 0.12);
    color: #64748b;
}

.analytics-live-stage-cart {
    background: rgba(234, 179, 8, 0.15);
    color: #a16207;
}

.analytics-live-stage-checkout {
    background: rgba(59, 130, 246, 0.12);
    color: #2563eb;
}

.analytics-live-stage-ordered {
    background: rgba(34, 197, 94, 0.12);
    color: #15803d;
}

.analytics-live-feed-item {
    padding: 4px 0;
}

.analytics-live-feed-main {
    min-width: 0;
}

.analytics-live-feed-time {
    flex-shrink: 0;
    color: var(--color-muted);
    font-size: 0.76rem;
    white-space: nowrap;
}

@media (max-width: 900px) {
    .analytics-live-grid {
        grid-template-columns: 1fr;
    }
    .analytics-live-panel + .analytics-live-panel {
        border-left: none;
        border-top: 1px solid var(--color-border);
    }
    .analytics-live-stats {
        grid-template-columns: 1fr;
    }
}

.detail-dl {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 8px 16px;
    margin: 0;
    font-size: 0.88rem;
}

.detail-dl dt {
    margin: 0;
    color: var(--color-muted);
    font-weight: 600;
}

.detail-dl dd {
    margin: 0;
}

.order-item-note {
    font-size: 0.78rem;
    color: #92400E;
    display: flex;
    align-items: center;
    gap: 4px;
}

.order-item-note i {
    font-size: 0.72rem;
}

.order-item-label-for {
    display: block;
    margin-top: 6px;
    padding: 6px 10px;
    border-radius: 6px;
    background: #f3f4f6;
    color: #374151;
    font-size: 0.8rem;
    font-weight: 600;
}

.order-item-price {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--color-primary);
    white-space: nowrap;
}

/* --- Detail Rows --- */
.detail-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(0,0,0,0.04);
}

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

.detail-row-total {
    border-top: 1px solid var(--border-color);
    margin-top: 4px;
    padding-top: 12px;
    border-bottom: none;
}

.detail-label {
    font-size: 0.82rem;
    color: var(--color-muted);
    font-weight: 450;
}

.detail-value {
    font-size: 0.88rem;
    font-weight: 550;
    color: var(--color-primary);
}

.detail-row-total .detail-label,
.detail-row-total .detail-value {
    font-size: 0.95rem;
    font-weight: 650;
}

/* --- Customer Cell (table) --- */
.customer-cell {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.customer-name {
    font-weight: 550;
    font-size: 0.88rem;
}

.customer-phone {
    font-size: 0.78rem;
    color: var(--color-muted);
}

.phone-link {
    color: inherit;
    text-decoration: none;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
    white-space: nowrap;
}
a.phone-link:hover,
a.phone-link:focus-visible {
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* --- Order Number (table) --- */
.order-number {
    font-weight: 600;
    color: var(--color-accent);
    white-space: nowrap;
}

/* --- AF badge + status badge same width in status cell --- */
.status-cell-stack {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.status-cell-stack > * {
    width: 100%;
    box-sizing: border-box;
    justify-content: center;
}

.order-date {
    font-size: 0.78rem;
}

/* --- Product Picker --- */
.product-picker-list {
    overflow-y: auto;
    max-height: calc(60vh - 70px);
}

.picker-category-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-muted);
    padding: 12px 24px 6px;
    background: #FAFAFA;
    position: sticky;
    top: 0;
    z-index: 1;
}

.picker-product {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    cursor: pointer;
    transition: background var(--transition);
    border-bottom: 1px solid rgba(0,0,0,0.03);
}

.picker-product:hover {
    background: rgba(37,99,235,0.03);
}

.picker-product-info {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.picker-product-name {
    font-size: 0.88rem;
    font-weight: 500;
}

.picker-product-price {
    font-size: 0.82rem;
    color: var(--color-muted);
    font-weight: 500;
}

/* --- Order Summary (create form) --- */
.order-summary-card {
    position: sticky;
    top: calc(var(--topbar-height) + 80px);
}

.summary-items-list {
    margin-bottom: 12px;
}

.summary-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 0.82rem;
    color: #4B5563;
}

.summary-totals {
    border-top: 1px solid var(--border-color);
    padding-top: 8px;
}

/* --- Catering Detail Grid --- */
.catering-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.catering-detail-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.catering-detail-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(37,99,235,0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--color-accent);
}

.catering-detail-icon i {
    font-size: 1rem;
}

.catering-detail-item .detail-label {
    display: block;
    font-size: 0.72rem;
    margin-bottom: 1px;
}

.catering-detail-item .detail-value {
    display: block;
    font-size: 0.88rem;
}

.order-header-pickup {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1.05;
    margin-left: 4px;
    padding-left: 12px;
    border-left: 2px solid var(--border-color);
}

.order-header-pickup-kicker {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-muted);
}

.order-header-pickup-time {
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--color-text);
}

.order-pickup-kicker {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--color-muted);
}

.order-pickup-time {
    display: block;
    margin-top: 2px;
    font-size: 1.7rem;
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -0.03em;
    color: var(--color-text);
}

.order-pickup-date {
    display: block;
    margin-top: 2px;
    margin-bottom: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--color-text);
}

.order-scheduled-quiet {
    font-size: 0.78rem !important;
    font-weight: 500 !important;
    color: var(--color-muted);
}

.order-dropoff-quiet {
    display: block;
    margin-top: 2px;
    font-size: 0.68rem;
    font-weight: 500;
    line-height: 1.3;
    color: var(--color-muted);
}

/* --- Button icon danger variant --- */
.btn-icon-danger {
    color: var(--color-muted);
    transition: color var(--transition);
}

.btn-icon-danger:hover {
    color: var(--color-danger);
}

/* --- Utility Classes --- */
.text-muted { color: var(--color-muted); }
.font-medium { font-weight: 500; }
.font-mono { font-family: var(--font-mono); font-size: 0.85em; }

/* --- Responsive --- */
@media (max-width: 1024px) {
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .stats-row-6 {
        grid-template-columns: repeat(2, 1fr);
    }

    .topbar-search { display: none; }

    .form-grid {
        grid-template-columns: 1fr 300px;
    }

    .settings-grid-2col {
        grid-template-columns: 1fr;
    }

    .settings-pw-grid {
        grid-template-columns: 1fr 1fr;
    }

    .calendar-layout {
        grid-template-columns: 1fr;
    }

    .dash-today-top {
        grid-template-columns: 1fr;
    }

    .dash-row-2,
    .dash-row-4,
    .dash-snapshot {
        grid-template-columns: 1fr;
    }

    .dash-quick-actions {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* --- Always: keep main content from causing body-level scroll ---
   IMPORTANT: use overflow-x: clip (not hidden). hidden creates a new
   scrolling context that breaks position: sticky on descendants like
   .form-sticky-header and .topbar. clip behaves identically for the
   "block stray content" use case but doesn't establish a scroll
   container, so sticky keeps working. */
.app-main {
    min-width: 0;
    max-width: 100%;
    overflow-x: clip;
}
.app-content {
    max-width: 100%;
    overflow-x: clip;
}

@media (max-width: 768px) {
    /* --- GLOBAL: prevent horizontal scroll (clip preserves sticky) --- */
    html, body {
        overflow-x: clip;
        max-width: 100vw;
    }

    .app-main {
        margin-left: 0;
    }

    .app-content {
        padding: 16px;
    }

    /* --- Live filter row: stack and full-width on mobile --- */
    .filters-bar #menu-filters-count {
        display: block;
        text-align: right;
        margin-top: -4px;
    }

    /* --- Topbar fits in narrow widths --- */
    .topbar {
        padding: 0 12px;
    }
    .topbar-left {
        gap: 8px;
        min-width: 0;
        flex: 1;
    }
    .topbar-right {
        gap: 4px;
    }
    .topbar-profile-container > div {
        font-size: 0.75rem;
    }
    .topbar-icon-btn {
        width: 34px;
        height: 34px;
    }

    /* --- Action column in product table can host 2 buttons --- */
    .product-cell-name,
    .product-name-input,
    .product-cell-desc {
        max-width: 38vw;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* --- Sidebar drawer --- */
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-close {
        display: flex;
    }

    .sidebar-overlay.open {
        display: block;
    }

    .topbar-menu-btn {
        display: flex;
    }

    /* --- Stats --- */
    .stats-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .stat-card {
        width: 100%;
    }

    .stat-value {
        font-size: 1.25rem;
    }

    .stat-label {
        font-size: 0.72rem;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
    }

    .stat-icon i,
    .stat-icon svg {
        width: 18px;
        height: 18px;
    }

    /* --- Tables --- */
    .table th,
    .table td {
        padding: 10px 12px;
        font-size: 0.78rem;
    }

    .table-responsive {
        margin: 0 -4px;
    }

    .col-hide-sm {
        display: none;
    }

    .order-number {
        font-size: 0.75rem;
        letter-spacing: 0;
    }

    .status-cell-stack > .badge {
        font-size: 0.68rem;
    }

    /* --- Page Header --- */
    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .page-header-left {
        flex-wrap: wrap;
    }

    .page-header .btn,
    .page-header-right .btn {
        width: 100%;
        justify-content: center;
    }

    .page-heading {
        font-size: 1.25rem;
    }

    /* --- Cards --- */
    .card {
        border-radius: 8px;
    }

    .card-header {
        flex-wrap: wrap;
        gap: 8px;
    }

    /* --- Forms --- */
    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .form-col-2 {
        flex: auto;
        width: 100%;
    }

    .form-sticky-header {
        position: relative;
        top: auto;
        flex-wrap: wrap;
    }

    .form-sticky-actions {
        width: 100%;
        justify-content: flex-end;
    }

    /* --- Filters --- */
    .filters-row {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-item-grow {
        min-width: auto;
    }

    .filter-select {
        min-width: auto;
        width: 100%;
    }

    .filters-bar .btn {
        width: 100%;
        justify-content: center;
    }

    /* --- Modals fullscreen --- */
    .modal-overlay {
        align-items: flex-start;
        padding: 0;
    }

    .modal {
        width: 100%;
        max-width: 100%;
        border-radius: 0;
        min-height: 100dvh;
        max-height: 100dvh;
        margin: 0;
        overflow: hidden;
    }

    .modal-lg {
        max-width: 100%;
    }

    /* --- Settings grids --- */
    .settings-pw-grid {
        grid-template-columns: 1fr;
    }

    .settings-grid-2col {
        grid-template-columns: 1fr;
    }

    .settings-profile-fields {
        grid-template-columns: 1fr;
    }

    .mfa-method-grid {
        grid-template-columns: 1fr;
    }

    /* --- Sticky header wraps actions --- */
    .form-sticky-header {
        flex-wrap: wrap;
        row-gap: 10px;
    }

    .form-sticky-actions {
        flex-wrap: wrap;
        width: auto;
    }

    /* --- Order detail column layout (clip — keeps sticky alive) --- */
    .form-column-main,
    .form-column-side {
        overflow-x: clip;
    }

    /* Calendar --- */
    .calendar-grid {
        gap: 4px;
    }

    .calendar-cell {
        padding: 4px;
        aspect-ratio: auto;
        min-height: 40px;
    }

    .calendar-day-num {
        font-size: 0.75rem;
    }

    .closure-indicator {
        font-size: 0.55rem;
        padding: 1px 3px;
    }

    .calendar-header-day {
        font-size: 0.65rem;
    }

    /* --- Users: hide less-important columns --- */
    .users-hide-mobile {
        display: none;
    }

    /* --- Categories --- */
    .category-grid {
        grid-template-columns: 1fr;
    }

    /* --- Accordion (Modifiers) --- */
    .accordion-header {
        padding: 14px 16px;
        flex-wrap: wrap;
    }

    .accordion-header-stats {
        order: 3;
        width: 100%;
        padding-left: 28px;
    }

    .modifiers-toolbar-actions {
        margin-left: 0;
    }

    .modifier-products-section,
    .modifier-no-options {
        padding-left: 16px;
    }

    .modifier-option-item {
        padding-left: 16px;
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 6px;
    }

    .modifier-options-hint {
        padding-left: 16px;
    }

    .modifier-option-price {
        margin-top: 0;
        margin-left: auto;
    }

    .modifier-option-row-top {
        grid-template-columns: 22px minmax(0, 1fr) 98px 28px;
        align-items: center;
    }

    .modifier-option-row-grid {
        grid-template-columns: 1fr;
    }

    /* --- Order Timeline --- */
    .order-timeline {
        flex-wrap: wrap;
        gap: 4px;
    }

    .timeline-step {
        min-width: 60px;
    }

    .timeline-label {
        font-size: 0.68rem;
    }

    /* --- Order Items --- */
    .order-item {
        padding: 12px 16px;
        gap: 10px;
    }

    /* --- Catering Detail Grid --- */
    .catering-detail-grid {
        grid-template-columns: 1fr;
    }

    /* --- Order detail grid --- */
    .order-detail-grid {
        grid-template-columns: 1fr;
    }

    /* --- Dashboard mobile --- */
    .stats-row-6 {
        grid-template-columns: 1fr;
    }

    .dash-today-revenue {
        font-size: 2rem;
    }

    .dash-channel-value {
        font-size: 1.4rem;
    }

    .dash-header {
        flex-direction: column;
        align-items: stretch;
    }

    .dash-header .btn {
        width: 100%;
        justify-content: center;
    }

    .dash-greeting {
        font-size: 1.2rem;
    }

    .dash-meta {
        flex-wrap: wrap;
        gap: 8px;
    }

    .dash-row-2,
    .dash-row-4 {
        grid-template-columns: 1fr;
    }

    .dash-quick-actions {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .dash-action-card {
        padding: 12px 14px;
        font-size: 0.82rem;
    }

    .dash-hide-mobile {
        display: none;
    }

    .dash-chart-card {
        min-height: 240px;
    }
}

/* --- Extra Small (max-width: 480px) --- */
@media (max-width: 480px) {
    .col-hide-xs {
        display: none;
    }

    .app-content {
        padding: 12px;
    }

    .topbar-title {
        font-size: 1rem;
    }

    .stat-value {
        font-size: 1.1rem;
    }

    .stats-row {
        gap: 8px;
    }

    .stat-card {
        padding: 14px;
    }

    .card-body {
        padding: 16px;
    }

    .card-header {
        padding: 14px 16px;
    }

    .page-heading {
        font-size: 1.1rem;
    }

    .badge {
        font-size: 0.65rem;
        padding: 2px 6px;
    }

    .btn {
        padding: 10px 16px;
        font-size: 0.82rem;
    }

    .btn-sm {
        padding: 7px 12px;
        font-size: 0.75rem;
    }

    .form-input,
    .filter-input {
        font-size: 0.85rem;
    }

    .modal-body {
        padding: 16px;
    }

    .modal-footer {
        padding: 12px 16px;
        flex-direction: column;
    }

    .modal-footer .btn {
        width: 100%;
    }

    .dash-greeting {
        font-size: 1.1rem;
    }

    .dash-quick-actions {
        grid-template-columns: 1fr 1fr;
    }

    .dash-action-card {
        flex-direction: column;
        text-align: center;
        padding: 12px 8px;
        font-size: 0.78rem;
        gap: 6px;
    }
}



/* ============================================================
   PROFILE DROPDOWN (Topbar)
   ============================================================ */

.topbar-profile-container {
    position: relative;
    margin-left: 12px;
}

/* O gatilho que abre o menu */
.topbar-profile-trigger {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    border-radius: 50%;
    transition: all var(--transition);
}
.topbar-profile-trigger:hover {
    box-shadow: 0 0 0 4px rgba(0,0,0,0.05);
}

/* O container do dropdown */
.profile-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 260px;
    background: #fff;
    border-radius: 14px; /* Apple style radius */
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    border: 1px solid var(--border-color);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    overflow: hidden;
}

/* Estado ativo do dropdown */
.profile-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Cabeçalho do Dropdown (Info do Usuário) */
.profile-dropdown-header {
    padding: 16px;
    background: #FAFAFA;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.profile-dropdown-header .user-avatar {
    width: 60px;
    height: 60px;
    font-size: 1.25rem;
    margin-bottom: 10px;
}
.profile-dropdown-header img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 10px;
    border: 2px solid #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.profile-dropdown-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--color-primary);
    margin-bottom: 2px;
}
.profile-dropdown-email {
    font-size: 0.8rem;
    color: var(--color-muted);
    margin-bottom: 8px;
}

/* Badges de Role Coloridos (Briefing) */
.role-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.role-superadmin { background: #000; color: #fff; }
.role-admin { background: #1E3A8A; color: #fff; } /* Azul Escuro */
.role-angelfly { background: #7C3AED; color: #fff; } /* Roxo Angel Fly */
.role-manager { background: #2563EB; color: #fff; } /* Azul */
.role-staff { background: #E5E7EB; color: #374151; } /* Cinza */
.role-kitchen { background: #FBBF24; color: #000; } /* Amarelo */
.role-demo { background: #D1FAE5; color: #065F46; border: 1px solid #6EE7B7; } /* Verde claro demo */

/* Lista de Links do Menu */
.profile-dropdown-list {
    list-style: none;
    padding: 6px;
    margin: 0;
}

.profile-dropdown-item a, 
.profile-dropdown-item button {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 10px 12px;
    color: #374151;
    font-size: 0.85rem;
    text-decoration: none;
    border-radius: 8px;
    transition: background var(--transition);
    border: none;
    background: none;
    cursor: pointer;
    text-align: left;
}

.profile-dropdown-item a:hover, 
.profile-dropdown-item button:hover {
    background: #F3F4F6;
}

.profile-dropdown-item i, 
.profile-dropdown-item svg {
    width: 16px;
    height: 16px;
    margin-right: 12px;
    color: var(--color-muted);
}

.profile-dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 6px 0;
}

/* Item de Logout (Vermelho) */
.profile-dropdown-item-logout a,
.profile-dropdown-item-logout button {
    color: var(--color-danger);
}
.profile-dropdown-item-logout i,
.profile-dropdown-item-logout svg {
    color: var(--color-danger);
}
.profile-dropdown-item-logout a:hover,
.profile-dropdown-item-logout button:hover {
    background: rgba(220, 38, 38, 0.05);
}

/* ============================================================
   AVATAR PREVIEW (User Form)
   ============================================================ */
.avatar-preview {
    width: 100px;
    height: 100px;
    margin: 0 auto;
    border-radius: 50%;
    overflow: hidden;
    background: #F3F4F6;
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--color-muted);
}

.avatar-placeholder i,
.avatar-placeholder svg {
    width: 36px;
    height: 36px;
    opacity: 0.4;
}

/* ============================================================
   CLOSURE LIST (Calendar)
   ============================================================ */
.closure-list {
    display: flex;
    flex-direction: column;
}

.closure-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(0,0,0,0.04);
}

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

.closure-date-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 44px;
}

.closure-day {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.2;
}

.closure-month {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--color-muted);
}

.closure-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.closure-reason {
    font-size: 0.88rem;
    font-weight: 550;
}

.closure-meta {
    font-size: 0.78rem;
    color: var(--color-muted);
}

.closure-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ============================================================
   CALENDAR LAYOUT (two-column)
   ============================================================ */
.calendar-layout {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 20px;
    align-items: start;
}

/* ============================================================
   TABLE RESPONSIVE
   ============================================================ */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ============================================================
   SETTINGS GRIDS (named classes replace inline styles)
   ============================================================ */
.settings-profile-fields {
    flex: 1;
    min-width: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.settings-pw-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.settings-grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

/* ============================================================
   MFA METHOD SELECTOR
   ============================================================ */
.mfa-method-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.mfa-method-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px 12px;
    background: #FAFAFA;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition);
    text-align: center;
}

.mfa-method-option input[type="radio"] {
    display: none;
}

.mfa-method-option:hover {
    border-color: rgba(0,0,0,0.2);
}

.mfa-method-option.active {
    border-color: var(--color-accent);
    background: rgba(37,99,235,0.04);
}

.mfa-method-option i,
.mfa-method-option svg {
    width: 24px;
    height: 24px;
    color: var(--color-muted);
}

.mfa-method-option.active i,
.mfa-method-option.active svg {
    color: var(--color-accent);
}

.mfa-method-label {
    font-weight: 600;
    font-size: 0.88rem;
}

.mfa-method-desc {
    font-size: 0.75rem;
    color: var(--color-muted);
}

/* ============================================================
   UTILITIES
   ============================================================ */
/* --- Reports --- */
.stats-row-4 {
    grid-template-columns: repeat(4, 1fr);
}
.stats-row-2 {
    grid-template-columns: repeat(2, 1fr);
}
a.report-card-link {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}
a.report-card-link:hover {
    background: #F8F6F3;
}
.report-row-2 {
    display: grid;
    grid-template-columns: 1.8fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}
.report-trend {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 6px;
    vertical-align: middle;
}
.report-trend svg { width: 14px; height: 14px; }
.report-trend-up { color: var(--color-success); }
.report-trend-down { color: var(--color-danger); }
.stat-icon-muted { background: rgba(0,0,0,0.04); color: var(--color-muted); }
.filters-bar {
    padding: 16px 20px;
    margin-bottom: 20px;
}
.filters-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.filter-select {
    min-width: 140px;
}

@media (max-width: 1024px) {
    .report-row-2 { grid-template-columns: 1fr 1fr; }
    .stats-row-4, .stats-row-2 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    .report-row-2 { grid-template-columns: 1fr; }
    .stats-row-4, .stats-row-2 { grid-template-columns: 1fr 1fr; }
    .filters-row { flex-direction: column; align-items: stretch; }
}
@media (max-width: 480px) {
    .stats-row-4, .stats-row-2 { grid-template-columns: 1fr; }
}

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 20px; }
.mb-5 { margin-bottom: 32px; }
.mt-1 { margin-top: 4px; }
.mt-3 { margin-top: 12px; }
.text-center { text-align: center; }
.text-danger { color: var(--color-danger); }
.text-success { color: var(--color-success); }
.text-primary { color: var(--color-primary); }
.py-4 { padding-top: 20px; padding-bottom: 20px; }
.form-col-2 { flex: 1; min-width: 0; }
.form-divider { border: none; border-top: 1px solid var(--border-color); margin: 16px 0; }
.form-hint { font-size: 0.82rem; color: var(--color-muted); }
.form-textarea { min-height: 80px; resize: vertical; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 16px; border-top: 1px solid var(--border-color); }
.form-label-link {
    float: right;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--color-accent, #3B82F6);
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    transition: color var(--transition);
}
.form-label-link:hover { color: #1D4ED8; text-decoration: underline; }

/* ============================================================
   Additions for Bundles / Gift Cards / Catering modules
   ============================================================ */

/* --- Input Icon Wrapper (currency prefix etc.) --- */
.input-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}
.input-icon-wrapper .form-input {
    padding-left: 28px;
}
.input-icon-left {
    position: absolute;
    left: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-muted);
    pointer-events: none;
    z-index: 1;
    line-height: 1;
}

/* --- Toggle Row (label + toggle side-by-side) --- */
.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
}
.toggle-row + .toggle-row {
    border-top: 1px solid rgba(0,0,0,0.04);
}
.toggle-row-label {
    font-size: 0.88rem;
    font-weight: 500;
    color: #374151;
}

/* --- Image Upload Preview (bundles / products) --- */
.image-upload-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 160px;
    border: 2px dashed rgba(0,0,0,0.1);
    border-radius: var(--radius);
    background: #FAFAFA;
    overflow: hidden;
    transition: all var(--transition);
}
.image-upload-preview:hover {
    border-color: rgba(0,0,0,0.18);
}
.image-upload-preview img {
    width: 100%;
    max-height: 280px;
    object-fit: cover;
    display: block;
    border-radius: var(--radius);
}

/* --- Form Help text --- */
.form-help {
    display: block;
    font-size: 0.75rem;
    color: var(--color-muted);
    margin-top: 4px;
    line-height: 1.45;
}

/* --- Table Image Cell --- */
.table-img-cell {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}
.table-img-cell img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.table-img-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #F3F4F6;
    color: #D1D5DB;
}

/* --- Bundle Item Card (inside form) --- */
.bundle-item-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: #fff;
    transition: box-shadow var(--transition);
}
.bundle-item-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.bundle-item-qty {
    width: 64px;
    flex-shrink: 0;
}
.bundle-item-qty .form-input {
    text-align: center;
    padding: 4px 8px;
    height: 36px;
    font-weight: 600;
}
.bundle-item-name {
    flex: 1;
    min-width: 0;
    font-weight: 550;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.bundle-item-swap {
    width: 160px;
    flex-shrink: 0;
}
.bundle-item-swap select {
    width: 100%;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    background: #fff;
    color: var(--color-primary);
    cursor: pointer;
    appearance: auto;
}
.bundle-item-swap select:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}
.bundle-item-actions {
    flex-shrink: 0;
}

/* --- Summary Items (Quote/Order) --- */
.summary-items-list {
    font-size: 0.85rem;
    margin-bottom: 16px;
}
.summary-line {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    gap: 12px;
}
.summary-totals {
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
}

/* --- Product Picker Modal --- */
.product-picker-list {
    overflow-y: auto;
    max-height: 50vh;
}
.picker-category-title {
    padding: 8px 24px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-muted);
    background: #F9FAFB;
    border-bottom: 1px solid rgba(0,0,0,0.04);
    position: sticky;
    top: 0;
    z-index: 1;
}
.picker-product {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 24px;
    cursor: pointer;
    transition: background var(--transition);
    border-bottom: 1px solid rgba(0,0,0,0.03);
}
.picker-product:hover {
    background: rgba(0,0,0,0.02);
}
.picker-product-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.picker-product-name {
    font-weight: 500;
    font-size: 0.88rem;
}
.picker-product-price {
    font-size: 0.78rem;
    color: var(--color-muted);
}

/* --- Order Item Row (Catering / Order create) --- */
.order-items-list { list-style: none; }
.order-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    border-bottom: 1px solid rgba(0,0,0,0.04);
}
.order-item:last-child { border-bottom: none; }
.order-item-qty-control { width: 64px; flex-shrink: 0; }
.qty-input {
    width: 100%;
    height: 34px;
    text-align: center;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.88rem;
}
.order-item-info { flex: 1; min-width: 0; }
.order-item-name { font-weight: 550; font-size: 0.88rem; display: block; }
.order-item-mods { font-size: 0.78rem; color: var(--color-muted); }
.order-item-price { font-weight: 600; font-size: 0.88rem; white-space: nowrap; }

/* --- Detail Rows (order detail / giftcard detail) --- */
.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 0.88rem;
}
.detail-row-total {
    border-top: 2px solid var(--color-primary);
    margin-top: 8px;
    padding-top: 10px;
    font-weight: 700;
    font-size: 1rem;
}
.detail-label { color: var(--color-muted); }
.detail-value { font-weight: 600; }

/* --- Modal --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    backdrop-filter: blur(2px);
}
.modal {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 520px;
    overflow: hidden;
    animation: modalIn 0.2s ease;
}
.modal-lg { max-width: 640px; }
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-color);
}
.modal-title {
    font-size: 1rem;
    font-weight: 650;
}
.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 1.3rem;
    color: var(--color-muted);
    transition: all var(--transition);
}
.modal-close:hover { background: rgba(0,0,0,0.06); color: var(--color-primary); }
.modal-body { padding: 24px; overflow-y: auto; }
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 24px;
    border-top: 1px solid var(--border-color);
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* --- Searchable Select Dropdown --- */
.searchable-select {
    position: relative;
}
.searchable-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 42px;
    padding: 0 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: #fff;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition);
}
.searchable-select-trigger:hover {
    border-color: rgba(0,0,0,0.2);
}
.searchable-select-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    animation: modalIn 0.15s ease;
    overflow: hidden;
}
.searchable-select-search {
    position: relative;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
}
.searchable-select-search input {
    width: 100%;
    height: 34px;
    padding: 0 12px 0 32px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    outline: none;
    transition: border-color var(--transition);
}
.searchable-select-search input:focus {
    border-color: var(--color-primary);
}
.searchable-select-options {
    max-height: 240px;
    overflow-y: auto;
}
.searchable-select-option {
    padding: 10px 14px;
    cursor: pointer;
    transition: background var(--transition);
    border-bottom: 1px solid rgba(0,0,0,0.03);
}
.searchable-select-option:last-child { border-bottom: none; }
.searchable-select-option:hover {
    background: rgba(0,0,0,0.03);
}

/* --- Segmented Tabs --- */
.tabs-nav {
    display: inline-flex;
    background: rgba(0, 0, 0, 0.04);
    padding: 4px;
    border-radius: 8px;
    gap: 4px;
}

.tab-btn {
    background: transparent;
    border: none;
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-text-light);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    color: var(--color-text);
}

.tab-btn.active {
    background: #ffffff;
    color: var(--color-text);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    font-weight: 600;
}

/* --- Linked Modifier List (Product Form) --- */
.product-modifier-linked-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 12px;
}
.product-modifier-linked-item {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: #fff;
    overflow: hidden;
}
.product-modifier-linked-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: #FAFAFA;
}
.product-modifier-linked-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.product-modifier-linked-options {
    border-top: 1px solid var(--border-color);
    padding: 8px 14px;
    font-size: 0.82rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.product-modifier-linked-option {
    display: flex;
    justify-content: space-between;
    color: #374151;
}
.product-modifier-linked-info--clickable {
    cursor: pointer;
}
.product-modifier-linked-info--clickable:hover strong {
    color: var(--color-primary, #2563eb);
}
.product-modifier-linked-option--clickable {
    cursor: pointer;
    border-radius: 4px;
    padding: 2px 4px;
    margin: -2px -4px;
}
.product-modifier-linked-option--clickable:hover {
    background: rgba(0, 0, 0, 0.04);
}
.product-modifier-linked-option--clickable:focus-visible,
.product-modifier-linked-info--clickable:focus-visible {
    outline: 2px solid var(--color-primary, #2563eb);
    outline-offset: 2px;
}

.product-square-sync-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.product-square-sync-groups {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.product-square-sync-group-card {
    min-width: 0;
}

@media (max-width: 900px) {
    .product-square-sync-grid,
    .product-square-sync-groups {
        grid-template-columns: 1fr;
    }
}

/* Sortable JS */
.sortable-ghost {
    opacity: 0.4;
    background-color: #f9fafb;
    border: 1px dashed var(--c-border);
}

/* ============================================================
   Customer support detail layout
   ============================================================ */
.cs-detail {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
    margin-top: 16px;
}
.cs-detail > aside {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}
.cs-conversation {
    padding: 0;
}
.cs-conversation-header {
    padding: 18px 22px;
    border-bottom: 1px solid #e5e7eb;
}
.cs-conversation-list {
    padding: 18px 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.cs-msg {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 14px 16px;
    background: #f9fafb;
}
.cs-msg.is-staff {
    background: rgba(27, 58, 75, 0.06);
    border-color: rgba(27, 58, 75, 0.18);
}
.cs-msg.is-internal {
    background: #fef3c7;
    border-color: #facc15;
}
.cs-msg-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 13px;
    gap: 8px;
    flex-wrap: wrap;
}
.cs-msg-header strong {
    color: #111827;
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}
.cs-msg-header time {
    color: #6b7280;
}
.cs-msg-body {
    white-space: pre-wrap;
    line-height: 1.55;
    color: #111827;
    font-size: 14px;
    word-break: break-word;
    overflow-wrap: anywhere;
}
.cs-reply-form {
    border-top: 1px solid #e5e7eb;
    padding: 18px 22px;
}
.cs-reply-textarea {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 12px 14px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
}
.cs-reply-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    flex-wrap: wrap;
    gap: 10px;
}
.cs-side-card {
    padding: 18px 20px;
}
.cs-side-card h4 {
    margin: 0 0 10px;
    font-size: 14px;
    color: #111827;
}
.cs-inline-form {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.cs-inline-form select {
    flex: 1 1 160px;
    min-width: 0;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 8px 10px;
}

@media (max-width: 900px) {
    .cs-detail {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 768px) {
    .cs-conversation-header,
    .cs-conversation-list,
    .cs-reply-form,
    .cs-side-card {
        padding: 14px 16px;
    }
    .cs-msg {
        padding: 12px 14px;
    }
    .cs-msg-header {
        font-size: 12px;
    }
    .cs-reply-actions .btn {
        width: 100%;
    }
    .cs-inline-form .btn {
        width: 100%;
    }
}

/* ==================================================================== */
/* === Manual Order Builder (/orders/create) ========================== */
/* ==================================================================== */

/* Wider picker modal */
.modal-xl {
    max-width: 1080px;
    width: 100%;
    height: 88vh;
    max-height: 88vh;
}

/* Picker layout */
.manual-picker {
    display: flex;
    flex-direction: column;
}
.manual-picker-toolbar {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 14px 24px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}
.manual-picker-search {
    flex: 1;
    min-height: 38px;
}
.manual-picker-channel {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-muted);
    background: rgba(0,0,0,0.04);
    padding: 4px 10px;
    border-radius: 999px;
}

/* "N in order" pill shown next to the modal title once items have been
   added — keeps the admin oriented while they're still picking. */
.picker-count-badge {
    margin-left: 10px;
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--color-accent);
    background: rgba(86,125,255,0.1);
    padding: 4px 10px;
    border-radius: 999px;
}

/* Brief "Added: <name>" toast that fades in at the top of the picker
   after each item is added. */
.picker-toast {
    position: absolute;
    top: 14px;
    left: 50%;
    transform: translate(-50%, -10px);
    background: #1f2937;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 9px 16px;
    border-radius: 999px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    z-index: 60;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.18s ease, transform 0.18s ease;
    white-space: nowrap;
    max-width: 80vw;
    overflow: hidden;
    text-overflow: ellipsis;
}
.picker-toast.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}
.picker-toast i,
.picker-toast svg {
    width: 16px;
    height: 16px;
    color: #4ade80;
}
.manual-picker-body {
    display: grid;
    /* Sidebar removed by request — single grid column now. */
    grid-template-columns: 1fr;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}
.manual-picker-sidebar {
    border-right: 1px solid var(--border-color);
    background: #FAFAFA;
    overflow-y: auto;
    padding: 12px 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.picker-cat {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 16px;
    background: transparent;
    border: 0;
    border-left: 2px solid transparent;
    text-align: left;
    font-size: 0.82rem;
    color: var(--color-muted);
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}
.picker-cat:hover {
    background: rgba(0,0,0,0.04);
    color: var(--color-primary);
}
.picker-cat.is-active {
    background: #fff;
    color: var(--color-primary);
    border-left-color: var(--color-primary);
    font-weight: 600;
}
.picker-cat-count {
    font-size: 0.7rem;
    color: var(--color-muted);
    background: rgba(0,0,0,0.05);
    padding: 1px 7px;
    border-radius: 999px;
}
.picker-cat.is-active .picker-cat-count {
    background: rgba(0,0,0,0.08);
    color: var(--color-primary);
}

.manual-picker-grid {
    overflow-y: auto;
    padding: 16px 20px 24px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 12px;
    align-content: start;
}
.manual-picker-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--color-muted);
}
.manual-picker-empty i {
    width: 38px;
    height: 38px;
    margin-bottom: 8px;
    opacity: 0.6;
}

.picker-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    text-align: left;
    cursor: pointer;
    /* Explicit color/font so the card never inherits anything weird from
       a parent <button>, modal-body, or browser default that would make
       the name/price text invisible. */
    color: var(--color-primary);
    font-family: inherit;
    font-size: 0.86rem;
    /* Lock a min height so the body always has room even when aspect-ratio
       on the thumb fails to allocate space (older Chrome on Hostinger was
       collapsing the card to thumb-only). */
    min-height: 220px;
    user-select: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.picker-card:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}
.picker-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    border-color: rgba(0,0,0,0.2);
}
.picker-card-thumb {
    height: 120px;
    width: 100%;
    flex-shrink: 0;
    overflow: hidden;
    background-color: var(--color-bg, #F8F6F3);
}
.picker-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.picker-card-thumb-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-muted);
}
.picker-card-thumb-empty i {
    width: 32px;
    height: 32px;
}
.picker-card-body {
    padding: 10px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1 1 auto;
    min-height: 90px;
}
.picker-card-name {
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--color-primary);
    line-height: 1.25;
}
.picker-card-desc {
    font-size: 0.74rem;
    color: var(--color-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.picker-card-meta {
    margin-top: auto;
    padding-top: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.picker-card-price {
    font-weight: 600;
    font-size: 0.84rem;
    color: var(--color-primary);
}
.picker-card-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.66rem;
    font-weight: 600;
    color: var(--color-muted);
    background: rgba(0,0,0,0.05);
    border-radius: 999px;
    padding: 2px 7px;
}
.picker-card-chip i {
    width: 11px;
    height: 11px;
}

/* Modifier Modal */
.manual-modifier-modal {
    max-width: 600px;
    height: auto;
    max-height: 90vh;
}
.manual-modifier-body {
    padding: 0 24px 16px;
}
.manual-modifier-baseprice {
    padding: 14px 0;
    font-size: 0.85rem;
    color: var(--color-muted);
    border-bottom: 1px dashed var(--border-color);
    margin-bottom: 14px;
}
.manual-modifier-baseprice strong {
    color: var(--color-primary);
}
.manual-modifier-empty {
    padding: 24px;
    text-align: center;
    color: var(--color-muted);
}
.manual-modifier-footer {
    border-top: 1px solid var(--border-color);
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
    background: #fff;
}
.manual-modifier-total {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-primary);
}
.manual-modifier-actions {
    display: flex;
    gap: 8px;
}

.manual-mod-group {
    padding: 14px 0;
    border-bottom: 1px solid var(--border-color);
}
.manual-mod-group:last-of-type {
    border-bottom: 0;
}
.manual-mod-group-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}
.manual-mod-group-header h4 {
    margin: 0;
    font-size: 0.92rem;
    font-weight: 600;
}
.manual-mod-group-meta {
    font-size: 0.72rem;
    color: var(--color-muted);
    text-transform: lowercase;
}
.manual-mod-required {
    color: var(--color-danger);
    background: rgba(220,38,38,0.1);
    padding: 1px 7px;
    border-radius: 999px;
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-right: 4px;
}
.manual-mod-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.manual-mod-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: #fff;
}
.manual-mod-row-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.manual-mod-row-name {
    font-size: 0.86rem;
    font-weight: 500;
    color: var(--color-primary);
}
.manual-mod-row-price {
    font-size: 0.74rem;
    color: var(--color-muted);
}
.manual-mod-toggle {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: #fff;
    color: var(--color-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.12s ease;
}
.manual-mod-toggle i {
    width: 16px;
    height: 16px;
}
.manual-mod-toggle:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
}
.manual-mod-toggle.is-active {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: #fff;
}
.manual-mod-variants {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.manual-mod-variant {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: #fff;
    font-size: 0.78rem;
    color: var(--color-primary);
    cursor: pointer;
    transition: all 0.12s ease;
}
.manual-mod-variant span {
    color: var(--color-muted);
    font-size: 0.72rem;
}
.manual-mod-variant:hover {
    border-color: var(--color-accent);
}
.manual-mod-variant.is-active {
    background: var(--color-accent);
    color: #fff;
    border-color: var(--color-accent);
}
.manual-mod-variant.is-active span {
    color: rgba(255,255,255,0.85);
}
/* Add-on row with sized variants (Small / Medium / Large) + stepper:
   the variant <select> renders BELOW the option name (inside
   .manual-mod-row-info) so it can't collide with the stepper on
   narrow widths and is always visible regardless of flex pressure. */
.manual-mod-addon-variant {
    display: block;
    margin-top: 4px;
    width: 100%;
    max-width: 200px;
    height: 32px;
    padding: 4px 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: #fff;
    font-size: 0.84rem;
    color: var(--color-primary);
    cursor: pointer;
}

.manual-mod-stepper {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 2px 6px;
    background: #fff;
}
.manual-mod-stepper button {
    width: 26px;
    height: 26px;
    border: 0;
    background: transparent;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-primary);
    border-radius: 4px;
    transition: background var(--transition);
}
.manual-mod-stepper button:hover {
    background: rgba(0,0,0,0.05);
}
.manual-mod-stepper span {
    min-width: 24px;
    text-align: center;
    font-weight: 600;
    font-size: 0.86rem;
}
.manual-mod-qty {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 4px 0 0;
}
.manual-mod-qty-first {
    margin-bottom: 4px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}
.manual-mod-stepper-lg {
    min-width: 140px;
}
.manual-mod-stepper-lg button {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
}
.manual-mod-stepper-lg span {
    min-width: 36px;
    font-size: 1.05rem;
}
.manual-mod-stepper-lg .manual-mod-qty-input {
    width: 58px;
    height: 36px;
    padding: 0 4px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: #fff;
    color: var(--color-primary);
    font-size: 1.05rem;
    font-weight: 600;
    text-align: center;
}
.manual-mod-stepper-lg .manual-mod-qty-input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 2px rgba(37,99,235,0.1);
}

/* Items list — new qty button + chips */
.order-item-qty-control {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 2px;
    background: #fff;
}
.order-item-qty-control .qty-btn {
    width: 26px;
    height: 26px;
    border: 0;
    background: transparent;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-primary);
    border-radius: 4px;
}
.order-item-qty-control .qty-btn:hover {
    background: rgba(0,0,0,0.05);
}
.order-item-qty-control .qty-input {
    width: 32px;
    height: 26px;
    border: 0;
    background: transparent;
    text-align: center;
    font-weight: 600;
    font-size: 0.86rem;
    pointer-events: none;
}
.order-item-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}
.order-item-chip {
    background: #f3f4f6;
    border-radius: 4px;
    padding: 1px 7px;
    font-size: 0.74rem;
    color: #374151;
}
.order-item-actions {
    display: flex;
    align-items: center;
    gap: 2px;
}

/* Responsive */
@media (max-width: 900px) {
    .modal-xl {
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
    .manual-picker-body {
        grid-template-columns: 1fr;
    }
    .manual-picker-sidebar {
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        border-right: 0;
        border-bottom: 1px solid var(--border-color);
        padding: 8px 12px;
        gap: 6px;
    }
    .picker-cat {
        border-left: 0;
        border-bottom: 3px solid transparent;
        padding: 7px 12px;
        white-space: nowrap;
        flex-shrink: 0;
    }
    .picker-cat.is-active {
        border-left: 0;
        border-bottom-color: var(--color-accent);
    }
    .manual-picker-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
}
@media (max-width: 600px) {
    .manual-picker-grid {
        grid-template-columns: 1fr 1fr;
        padding: 12px;
        gap: 10px;
    }
    .manual-modifier-footer {
        flex-direction: column-reverse;
        align-items: stretch;
    }
    .manual-modifier-actions {
        justify-content: space-between;
    }
    .manual-modifier-actions .btn {
        flex: 1;
    }
    .order-item {
        flex-wrap: wrap;
    }
    .order-item-info {
        flex-basis: 100%;
        order: 3;
    }
    .order-item-actions {
        order: 4;
        margin-left: auto;
    }
}

/* ==================================================================== */
/* === Clients module ================================================= */
/* ==================================================================== */

/* Generic table cell utilities reused on /clients and /clients/{id} */
.table-wrap { width: 100%; overflow-x: auto; }
.table .num  { text-align: right; font-variant-numeric: tabular-nums; }
.table th.num { text-align: right; }
.cell-strong { font-weight: 600; color: var(--color-primary); }
.cell-muted  { color: var(--color-muted); }
.cell-badge  { margin-left: 6px; vertical-align: middle; }
.cell-actions { text-align: right; width: 1%; white-space: nowrap; }

/* Address + card lists on /clients/{id} */
.client-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.client-list-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 22px;
    border-bottom: 1px solid rgba(0,0,0,0.04);
}
.client-list-item:last-child { border-bottom: 0; }
.client-list-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    flex: 1;
}
.client-list-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--color-primary);
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
}
.client-list-sub {
    font-size: 0.82rem;
    color: var(--color-muted);
    line-height: 1.4;
}
.client-list-note {
    font-size: 0.78rem;
    color: #92400E;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
}
.client-list-note i { width: 12px; height: 12px; }

.client-add-collapse {
    border-top: 1px solid var(--border-color);
    background: #FAFAFA;
}
.client-add-collapse summary {
    list-style: none;
    cursor: pointer;
    padding: 12px 22px;
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--color-primary);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.client-add-collapse summary::-webkit-details-marker { display: none; }
.client-add-collapse summary i { width: 14px; height: 14px; }
.client-add-collapse[open] summary {
    border-bottom: 1px solid var(--border-color);
}
.client-add-form {
    padding: 16px 22px 20px;
    background: #fff;
}

/* Customer autocomplete dropdown used inside /orders/create/* */
.customer-suggest {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 30;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    max-height: 280px;
    overflow-y: auto;
    display: none;
}
.customer-suggest.is-open { display: block; }
.customer-suggest-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid rgba(0,0,0,0.04);
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.customer-suggest-item:last-child { border-bottom: 0; }
.customer-suggest-item:hover,
.customer-suggest-item.is-focused {
    background: rgba(0,0,0,0.04);
}
.customer-suggest-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--color-primary);
}
.customer-suggest-meta {
    font-size: 0.74rem;
    color: var(--color-muted);
}
.customer-suggest-empty {
    padding: 14px;
    text-align: center;
    color: var(--color-muted);
    font-size: 0.82rem;
}
.customer-suggest-create {
    background: rgba(86,125,255,0.05);
    border-top: 1px dashed rgba(0,0,0,0.08);
}
.customer-suggest-create .customer-suggest-name {
    color: var(--color-accent);
}

.customer-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: rgba(22,163,74,0.08);
    color: #16A34A;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
}
.customer-pill button {
    background: transparent;
    border: 0;
    color: inherit;
    cursor: pointer;
    line-height: 1;
    font-size: 1rem;
}

/* ==================================================================== */
/* === FAQ admin list ================================================== */
/* ==================================================================== */
.faq-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.faq-row {
    border-bottom: 1px solid rgba(0,0,0,0.04);
}
.faq-row:last-child {
    border-bottom: 0;
}
.faq-row-inner {
    background: #fff;
    transition: background 0.12s ease;
}
.faq-row-inner[open] {
    background: #FAFAFA;
}
.faq-row-head {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    user-select: none;
}
.faq-row-head::-webkit-details-marker { display: none; }
.faq-drag {
    cursor: grab;
    color: var(--color-muted);
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}
.faq-drag:hover { color: var(--color-primary); }
.faq-drag i,
.faq-drag svg {
    width: 16px;
    height: 16px;
}
.faq-scope-pill {
    flex-shrink: 0;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 3px 9px;
    border-radius: 999px;
}
.faq-scope-both     { background: rgba(0,0,0,0.06);       color: var(--color-primary); }
.faq-scope-pickup   { background: rgba(86,125,255,0.1);   color: var(--color-accent); }
.faq-scope-catering { background: rgba(22,163,74,0.1);    color: var(--color-success); }
.faq-q-text {
    flex: 1;
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--color-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.faq-row-chev {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--color-muted);
    transition: transform 0.18s ease;
}
.faq-row-inner[open] .faq-row-chev {
    transform: rotate(180deg);
}
.faq-row-body {
    padding: 6px 20px 18px 46px;
    border-top: 1px dashed rgba(0,0,0,0.05);
    margin-top: 4px;
}
.faq-row-ghost {
    opacity: 0.5;
}

.faq-new-card summary {
    list-style: none;
}
.faq-new-card summary::-webkit-details-marker { display: none; }

@media (max-width: 720px) {
    .faq-row-head { padding: 12px 14px; gap: 8px; }
    .faq-q-text { font-size: 0.88rem; }
    .faq-row-body { padding: 8px 14px 16px 14px; }
}

/* Tip presets in /orders/create */
.tip-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.tip-preset {
    flex: 1;
    min-width: 64px;
    padding: 9px 12px;
    border: 1px solid var(--border-color);
    background: #fff;
    border-radius: var(--radius-sm);
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--color-primary);
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.tip-preset:hover {
    border-color: rgba(0,0,0,0.2);
    background: #FAFAFA;
}
.tip-preset.is-active {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

/* ==================================================================== */
/* === Tooltip (data-tooltip, see initTooltips in app.js) ============== */
/* ==================================================================== */
[data-tooltip] { cursor: help; }
th[data-tooltip] { text-decoration: underline dotted; text-underline-offset: 3px; }
.tooltip {
    position: fixed;
    z-index: 10000;
    max-width: min(280px, calc(100vw - 16px));
    padding: 8px 10px;
    border-radius: 6px;
    background: #1f2937;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 400;
    line-height: 1.45;
    letter-spacing: normal;
    text-transform: none;
    text-align: left;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
    pointer-events: none;
}
.tooltip[hidden] { display: none; }
