/* =============================================================
   PPD Manager  -  Global Styles
   Clean, modern, professional UI for order tracking
   ============================================================= */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }

/* Environment badge */
.env-badge {
    display: block;
    text-align: center;
    background: #f0c000;
    color: #000;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 1.5px;
    padding: 3px 0;
    margin: 4px 16px 0;
    border-radius: 4px;
    pointer-events: none;
}
body.env-dev {
}
[data-theme="dark"] body.env-dev {
}

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

:root {
    color-scheme: light;
    --color-bg:         #f5f6fa;
    --color-sidebar:    #1a1f36;
    --color-sidebar-hover: #2d3561;
    --color-primary:    #4361ee;
    --color-primary-hover: #5a75f5;
    --color-primary-dark: #3451d1;
    --color-text:       #2d3748;
    --color-muted:      #718096;
    --color-border:     #e2e8f0;
    --color-white:      #ffffff;
    --color-card:       #ffffff;
    --color-success:    #38a169;
    --color-warning:    #d69e2e;
    --color-danger:     #e53e3e;
    --color-info:       #3182ce;
    --radius:           8px;
    --shadow:           0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md:        0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.05);
    --sidebar-width:    250px;
    --font:             'Inter', 'Segoe UI', system-ui, sans-serif;
    --color-table-header: #e8f0fe;
    --color-star-empty:  #cbd5e0;
    --color-star-filled: #ecc94b;
    --color-fav-row:       #fff5f5;
    --color-fav-row-hover: #fed7d7;
    --color-placeholder: #c4cdd8;
}

/* Address book cards */
.address-card {
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 8px;
    background: var(--color-bg);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.address-card:hover { border-color: var(--color-primary); box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.address-card.address-default {
    border-left: 3px solid var(--color-primary);
    background: color-mix(in srgb, var(--color-primary), transparent 95%);
}
.address-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    flex-wrap: wrap;
    gap: 6px;
}
.address-label { font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.addr-default-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--color-primary);
    color: #fff;
}
.address-actions { display: flex; gap: 4px; align-items: center; }
.addr-default-btn {
    background: color-mix(in srgb, var(--color-primary), transparent 88%) !important;
    color: var(--color-primary) !important;
    border: 1px solid color-mix(in srgb, var(--color-primary), transparent 70%) !important;
    font-size: 11px !important;
    padding: 3px 10px !important;
    border-radius: 12px !important;
    font-weight: 600 !important;
    transition: all 0.15s !important;
}
.addr-default-btn:hover {
    background: var(--color-primary) !important;
    color: #fff !important;
}
.address-card-body { font-size: 13px; color: var(--color-muted); line-height: 1.5; }


/* Dark mode variables */
[data-theme="dark"] {
    color-scheme: dark;
    --color-bg:         #0f172a;
    --color-sidebar:    #0c1222;
    --color-sidebar-hover: #1e293b;
    --color-primary:    #818cf8;
    --color-primary-hover: #9ba4fb;
    --color-primary-dark: #6366f1;
    --color-text:       #e2e8f0;
    --color-muted:      #94a3b8;
    --color-border:     #334155;
    --color-white:      #1e293b;
    --color-card:       #1e293b;
    --color-success:    #34d399;
    --color-warning:    #fbbf24;
    --color-danger:     #f87171;
    --color-info:       #60a5fa;
    --color-table-header: #1a2332;
    --color-star-empty:  #475569;
    --color-star-filled: #fbbf24;
    --color-fav-row:       #2a1215;
    --color-fav-row-hover: #3b1a1e;
    --color-placeholder: #4a5568;
    --shadow:           0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
    --shadow-md:        0 4px 6px rgba(0,0,0,0.3), 0 2px 4px rgba(0,0,0,0.2);
}


/* Dark mode specific overrides */
[data-theme="dark"] .top-nav,
[data-theme="dark"] .mobile-topbar {
    background: #0c1222;
    border-color: #334155;
}
[data-theme="dark"] .top-nav-search input {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}
[data-theme="dark"] .top-nav-search input::placeholder { color: var(--color-placeholder); }
[data-theme="dark"] .top-nav-search input:focus {
    border-color: #6366f1;
    background: #1e293b;
}
[data-theme="dark"] .top-nav-notif,
[data-theme="dark"] .top-nav-notif:hover { color: #e2e8f0 !important; }
[data-theme="dark"] .top-nav-notif:hover { background: #334155; }
[data-theme="dark"] .top-nav-user-btn:hover { background: #334155; }
[data-theme="dark"] .top-nav-user-name { color: #e2e8f0; }
[data-theme="dark"] .data-table td { border-color: #334155; }
[data-theme="dark"] .modal-overlay { background: rgba(0,0,0,0.7); }
[data-theme="dark"] .modal-box { background: #1e293b; }
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    background: #0f172a;
    color: #e2e8f0;
    border-color: #334155;
}
[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus {
    border-color: #6366f1;
}

/* Global placeholder styling */
input::placeholder,
textarea::placeholder,
select::placeholder {
    color: var(--color-placeholder);
    opacity: 1;
}

[data-theme="dark"] .btn-ghost { color: #e2e8f0; border-color: #475569; }
[data-theme="dark"] .btn-ghost:hover:not(:disabled) { background: #334155; border-color: #64748b; }
[data-theme="dark"] .btn-clear { background: #422006; color: #fbbf24; border-color: #92400e; }
[data-theme="dark"] .btn-clear:hover { background: #713f12; }
[data-theme="dark"] .btn-edit { background: #172554; color: #93c5fd; border-color: #1e40af; }
[data-theme="dark"] .btn-edit:hover { background: #1e3a5f; }
[data-theme="dark"] .btn-danger-text { color: #fda4af !important; }
[data-theme="dark"] .btn-danger-text:hover { background: #4c0519 !important; }
[data-theme="dark"] .btn-deactivate { background: #4c0519; color: #fda4af; border-color: #881337; }
[data-theme="dark"] .btn-deactivate:hover { background: #881337; }
[data-theme="dark"] .btn-export { background: #1e3a5f; color: #93c5fd; border-color: #1e40af; }
[data-theme="dark"] .btn-export:hover { background: #1e40af; }
[data-theme="dark"] .btn-send-po { background: #047857; border-color: #047857; }
[data-theme="dark"] .btn-send-po:hover { background: #065f46; }
[data-theme="dark"] .comment-bubble.incoming { background: #334155; }
[data-theme="dark"] .pipeline-stage { background: #1a2332; }
[data-theme="dark"] .pipeline-stage.active { background: #1e3a5f; border-color: #6366f1; }
[data-theme="dark"] .proof-file-card { background: #1a2332; border-color: #334155; }
[data-theme="dark"] .proof-file-card.status-approved { background: #052e16; border-color: #166534; }
[data-theme="dark"] .proof-file-card.status-revision_requested { background: #422006; border-color: #92400e; }
[data-theme="dark"] .proof-file-card.status-pending_review { background: #1e3a5f; border-color: #1e40af; }
[data-theme="dark"] .proof-feedback-item.action-approve { background: #052e16; }
[data-theme="dark"] .proof-feedback-item.action-request_revision { background: #422006; }
[data-theme="dark"] .proof-feedback-item.action-comment { background: #1a2332; }
[data-theme="dark"] .orders-summary-bar { background: #1a2332; border-color: #334155; }
[data-theme="dark"] .invoice-summary-group { background: #0f172a; border-color: #334155; }
[data-theme="dark"] .bulk-action-bar { background: #1e3a5f; border-color: #1e40af; color: #93c5fd; }
[data-theme="dark"] .announcement-banner { background: #1e3a5f; color: #93c5fd; border-color: #1e40af; }


html {
    overflow-y: scroll; /* Always reserve scrollbar space */
}

body {
    font-family:      var(--font);
    background-color: var(--color-bg);
    color:            var(--color-text);
    font-size:        14px;
    line-height:      1.6;
    /* Global guard: nothing in the app should ever produce horizontal
       page-level scroll on mobile. Specific scroll containers (tables,
       carousels, code blocks) opt in with their own overflow-x. */
    overflow-x:       hidden;
}
html { overflow-x: hidden; max-width: 100vw; }

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

/* ---- Layout ---- */
body:not(.login-page) {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
    background:  var(--color-sidebar);
    color:       #cbd5e0;
    display:     flex;
    flex-direction: column;
    padding:     0;
    position:    sticky;
    top:         0;
    height:      100vh;
    overflow-y:  auto;
    overflow-x:  hidden;
}

.sidebar-logo {
    padding:       20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-logo .logo-link {
    display:     flex;
    align-items: center;
    gap:         10px;
    padding:     0;
    text-decoration: none;
}
.sidebar-logo .logo-link,
.sidebar-logo .logo-link:hover,
.sidebar-logo .logo-link.active {
    background: transparent;
    opacity:    1;
}
.sidebar-logo .logo-link:hover {
    opacity: 0.85;
}
.sidebar-logo-img {
    width:         40px;
    height:        40px;
    border-radius: 9px;
    display:       block;
    flex-shrink:   0;
}
/* PPD logo variant: single wide image replacing the icon + wordmark when a
   PPD has uploaded their brand (stored 400x100 PNG). */
.sidebar-ppd-logo { max-width: 180px; max-height: 40px; object-fit: contain; display: block; }
/* Image cropper modal - shape switch (circle vs 4:1 rect). Only one overlay
   SVG is visible at a time, controlled by a class on #imageCropModal. */
#imageCropModal #cropOverlayCircle,
#imageCropModal #cropOverlayRect { display: none; }
#imageCropModal.crop-shape-circle #cropOverlayCircle { display: block; }
#imageCropModal.crop-shape-rect   #cropOverlayRect   { display: block; }
.sidebar-logo-name {
    color:          #fff;
    font-size:      15px;
    font-weight:    800;
    letter-spacing: -0.2px;
    white-space:    nowrap;
}

/* Notifications */
.notif-counter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    padding: 0 6px;
}
.notif-counter.zero {
    background: #64748b;
    color: #fff;
}
    display: inline-block;
}
.notification-list {
    overflow-y: auto;
}
.notification-item {
    display: block;
    padding: 10px 16px;
    border-bottom: 1px solid var(--color-border);
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
    color: inherit;
}
.notification-item:hover { background: var(--color-bg); }
.notification-item.unread { background: var(--color-bg); }
.notification-item.unread:hover { background: #dbeafe; }
.notification-item-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 2px;
}
.notification-item-message {
    font-size: 12px;
    color: var(--color-muted);
}
.notification-item-time {
    font-size: 11px;
    color: var(--color-muted);
    margin-top: 2px;
}
.notification-empty {
    padding: 24px 16px;
    text-align: center;
    color: var(--color-muted);
    font-size: 13px;
}

.sidebar-nav {
    padding: 12px 0;
    flex: 1;
}

.nav-group {
    padding: 8px 0;
}
/* Divider between adjacent *visible* nav groups only. Hidden groups
   (.hidden via role-scoping) are still DOM siblings, so we have to
   exclude them explicitly — otherwise the first visible group after a
   run of hidden groups gets a spurious border-top. */
.nav-group:not(.hidden) + .nav-group:not(.hidden) {
    margin-top: 4px;
    border-top: 1px solid rgba(255,255,255,0.18);
    padding-top: 12px;
}
.nav-group-label {
    display: none;
}
/* Inline divider inside a nav-group — matches the between-group rule
   above (1px subtle white). Used to chunk Shop links into related
   subgroups: Home | Categories+Gallery+Favorites+Themes | the rest. */
.nav-divider {
    height: 1px;
    background: rgba(255,255,255,0.12);
    margin: 8px 14px;
}

/* Sidebar footer CTA (anon-only "Request a Quote"). Sits above the
   theme toggle. Styled as a primary pill so it visually pops out of
   the muted nav links above. */
.sidebar-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 14px;
    border-radius: 8px;
    background: linear-gradient(135deg, #4338ca, #6366f1);
    color: #fff !important;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(99,102,241,0.35), inset 0 1px 0 rgba(255,255,255,0.18);
    transition: transform 0.12s, box-shadow 0.12s, filter 0.12s;
}
.sidebar-cta:hover {
    transform: translateY(-1px);
    filter: brightness(1.06);
    box-shadow: 0 6px 18px rgba(99,102,241,0.45), inset 0 1px 0 rgba(255,255,255,0.22);
}
.sidebar-cta-arrow {
    font-weight: 800;
    transition: transform 0.15s;
}
.sidebar-cta:hover .sidebar-cta-arrow { transform: translateX(2px); }

.nav-link {
    display:     block;
    padding:     10px 20px;
    color:       #a0aec0;
    text-decoration: none;
    font-size:   14px;
    font-weight: 500;
    border-radius: 0;
    transition:  background 0.15s, color 0.15s;
}

.nav-link:hover, .nav-link.active {
    background: var(--color-sidebar-hover);
    color:      #fff;
}

/* Nav submenu (popout) */
.nav-submenu { position: relative; }
.nav-submenu-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.nav-submenu-toggle.open {
    background: rgba(255,255,255,0.08);
    border-radius: 6px;
}
.nav-submenu-arrow {
    font-size: 14px;
    font-weight: 600;
    transition: transform 0.2s;
    opacity: 0.6;
}
.nav-submenu-toggle.open .nav-submenu-arrow {
    transform: rotate(90deg);
    opacity: 1;
}
.nav-submenu-popout {
    position: fixed;
    left: calc(var(--sidebar-width) + 6px);
    background: var(--color-sidebar);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 2px 8px rgba(0,0,0,0.25);
    padding: 6px;
    min-width: 190px;
    z-index: 9500;
    display: none;
    animation: submenuPop 0.15s ease;
}
.nav-submenu-popout.open { display: block; }
.nav-submenu-popout-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.35);
    padding: 6px 10px 4px;
}
.nav-submenu-popout .nav-link {
    color: #a0aec0;
    border-radius: 6px;
    padding: 7px 12px;
    font-size: 13px;
}
.nav-submenu-popout .nav-link:hover,
.nav-submenu-popout .nav-link.active {
    background: var(--color-sidebar-hover);
    color: #fff;
}
.nav-categories-popout {
    min-width: 220px;
    max-height: 80vh;
    overflow-y: auto;
}
.nav-categories-popout .nav-link {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nav-categories-inline {
    display: flex;
    flex-direction: column;
    padding-left: 12px;
}
.nav-categories-inline .nav-link {
    font-size: 12px;
    padding: 5px 10px;
    color: #a0aec0;
    border-radius: 4px;
}
.nav-categories-inline .nav-link:hover {
    background: var(--color-sidebar-hover);
    color: #fff;
}

@keyframes submenuPop {
    from { opacity: 0; transform: translateX(-6px); }
    to   { opacity: 1; transform: translateX(0); }
}

.nav-link-orders {
    display:        flex;
    flex-direction: row;
    align-items:    center;
    gap:            8px;
}
.nav-link-orders .nav-link-label {}

.open-orders-count {
    font-size: 11px;
    font-weight: 700;
    background: var(--color-primary);
    color: #fff;
    border-radius: 10px;
    padding: 1px 7px;
    min-width: 20px;
    text-align: center;
    line-height: 1.4;
}
.open-orders-count[data-zero="true"] {
    background: var(--color-muted);
    opacity: 0.5;
}
.open-orders-count.supplier-attention-badge,
[data-theme="dark"] .open-orders-count.supplier-attention-badge {
    background: #dc2626 !important;
}
.supplier-needs-attention {
    background: rgba(220, 38, 38, 0.04);
}
.supplier-needs-attention:hover {
    background: rgba(220, 38, 38, 0.08) !important;
}
.supplier-attention-dot {
    color: #dc2626;
    font-size: 8px;
    vertical-align: middle;
    margin-left: 4px;
}
.input-attention {
    border-color: #dc2626 !important;
    background: rgba(220, 38, 38, 0.05) !important;
    box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.15) !important;
}
.supplier-missing-field,
.detail-row .supplier-missing-field {
    font-size: 11px;
    color: #dc2626 !important;
    font-style: italic;
    font-weight: 500;
}

.order-nav-counts {
    display:   none;
}

.order-nav-pill {
    position:        relative;
    display:         inline-flex;
    align-items:     center;
    justify-content: center;
    min-width:       20px;
    height:          18px;
    padding:         0 5px;
    border-radius:   999px;
    font-size:       11px;
    font-weight:     700;
    line-height:     1;
    cursor:          pointer;
    transition:      opacity 0.2s, filter 0.15s;
}
.order-nav-pill:hover { filter: brightness(1.25); }

.order-nav-pill[data-zero="true"] { opacity: 0.3; }

/* Same hues as order status badges, adapted for dark sidebar */
.order-nav-pill[data-status="Needs Quoted"]   { background: rgba(229,62,62,0.3);   color: #fed7d7; border: 1px solid rgba(254,215,215,0.25); }
.order-nav-pill[data-status="Lead"]           { background: rgba(49,130,206,0.3);  color: #bee3f8; border: 1px solid rgba(190,227,248,0.25); }
.order-nav-pill[data-status="Quoted"]          { background: rgba(128,90,213,0.3);  color: #e9d8fd; border: 1px solid rgba(233,216,253,0.25); }
.order-nav-pill[data-status="Confirmed"]      { background: rgba(44,122,123,0.3);  color: #b2f5ea; border: 1px solid rgba(178,245,234,0.25); }
.order-nav-pill[data-status="Proof Approval"] { background: rgba(183,121,31,0.3);  color: #fef3c7; border: 1px solid rgba(254,243,199,0.25); }
.order-nav-pill[data-status="Proof Approved"] { background: rgba(5,150,105,0.3);   color: #a7f3d0; border: 1px solid rgba(167,243,208,0.25); }
.order-nav-pill[data-status="In Production"]  { background: rgba(133,100,4,0.3);   color: #fde68a; border: 1px solid rgba(253,230,138,0.25); }
.order-nav-pill[data-status="Shipped"]        { background: rgba(39,103,73,0.3);   color: #9ae6b4; border: 1px solid rgba(154,230,180,0.25); }
.order-nav-pill[data-status="Delivered"]      { background: rgba(34,84,61,0.3);    color: #c6f6d5; border: 1px solid rgba(198,246,213,0.25); }
.order-nav-pill[data-status="Canceled"]      { background: rgba(220,38,38,0.08); color: #f87171; border: 1px solid rgba(248,113,113,0.3); }

.nav-link-leads {
    display:        flex;
    flex-direction: row;
    align-items:    center;
    gap:            8px;
    overflow:       hidden;
}
.nav-link-leads .lead-nav-counts {
    flex-shrink: 1;
    min-width: 0;
}

.lead-nav-counts {
    display:   none;
}

.lead-nav-pill {
    position:      relative;
    display:       inline-flex;
    align-items:   center;
    justify-content: center;
    min-width:     20px;
    height:        18px;
    padding:       0 5px;
    border-radius: 999px;
    font-size:     11px;
    font-weight:   700;
    line-height:   1;
    cursor:        pointer;
    transition:    opacity 0.2s, filter 0.15s;
}
.lead-nav-pill:hover { filter: brightness(1.25); }

/* Tooltip */
.lead-nav-pill[data-tooltip]::after,
.order-nav-pill[data-tooltip]::after {
    content:        attr(data-tooltip);
    position:       absolute;
    left:           50%;
    top:            calc(100% + 8px);
    transform:      translateX(-50%) translateY(4px);
    padding:        5px 10px;
    border-radius:  6px;
    font-size:      11px;
    font-weight:    600;
    letter-spacing: 0.02em;
    white-space:    nowrap;
    color:          #fff;
    background:     rgba(15, 23, 42, 0.92);
    box-shadow:     0 4px 12px rgba(0,0,0,0.25);
    backdrop-filter: blur(6px);
    opacity:        0;
    pointer-events: none;
    transition:     opacity 0.15s ease, transform 0.15s ease;
    z-index:        1000;
}
.lead-nav-pill[data-tooltip]:hover::after,
.order-nav-pill[data-tooltip]:hover::after {
    opacity:   1;
    transform: translateX(-50%) translateY(0);
}

.order-count-pill {
    display:        inline-flex;
    align-items:    center;
    vertical-align: middle;
}

/* Floating tooltip for order count pills */
.pill-tooltip {
    position:       fixed;
    padding:        5px 10px;
    border-radius:  6px;
    font-size:      11px;
    font-weight:    600;
    letter-spacing: 0.02em;
    white-space:    nowrap;
    color:          #fff;
    background:     rgba(15, 23, 42, 0.92);
    box-shadow:     0 4px 12px rgba(0,0,0,0.25);
    backdrop-filter: blur(6px);
    pointer-events: none;
    z-index:        9999;
    opacity:        0;
    transition:     opacity 0.15s ease;
}
.pill-tooltip.visible {
    opacity: 1;
}

.lead-nav-pill[data-zero="true"] { opacity: 0.3; }

/* Colors mirror the lead status badges (.badge-lead-open/converted/lost)
   but adapted for the dark sidebar background */
.lead-nav-open      { background: rgba(29, 78, 216, 0.3);  color: #bfdbfe; border: 1px solid rgba(191,219,254,0.3); }
.lead-nav-converted { background: rgba(21, 128, 61, 0.3);  color: #bbf7d0; border: 1px solid rgba(187,247,208,0.3); }
.lead-nav-lost      { background: rgba(153, 27, 27, 0.35); color: #fecaca; border: 1px solid rgba(254,202,202,0.3); }


/* Sales team card (customer sidebar) */
.sidebar-sales-team {
    margin: 8px 14px;
    padding: 14px 16px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
}
.sidebar-sales-team.hidden { display: none; }
.sales-team-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #64748b;
    margin-bottom: 8px;
}
.sales-team-ppd {
    font-size: 14px;
    font-weight: 700;
    color: #e2e8f0;
    margin-bottom: 2px;
}
.sales-team-rep {
    font-size: 12px;
    color: #94a3b8;
    margin-bottom: 8px;
}
.sales-team-contact {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.sales-team-link {
    font-size: 12px;
    color: #93c5fd;
    text-decoration: none;
}
.sales-team-link:hover { text-decoration: underline; }
.sales-team-phone {
    font-size: 12px;
    color: #94a3b8;
}

/* Standard modal button row. Use at both the TOP (header) and BOTTOM (footer)
 * of every modal. Layout left→right:
 *   [Close]   ...   [Destructive]   [Secondary]   [Main Action]
 * Close hugs the far left; main action hugs the far right; destructive +
 * secondary sit together in the right cluster, just before the main action.
 * The title is NOT inside this row - it stays in its original position
 * above the row so titles never move when we add buttons. */
.modal-btn-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}
.modal-btn-row--top {
    margin: 0 0 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--color-border);
}
.modal-btn-row--bottom {
    margin-top: 20px;
    padding-top: 12px;
    border-top: 1px solid var(--color-border);
}
.modal-btn-row .modal-btn-spacer { flex: 1 1 auto; }
.modal-btn-row .modal-btn-cluster {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}
/* Force every button in a modal button row to the same size, regardless of
 * whatever variant classes (btn-edit, btn-deck-ghost, btn-customer, etc.)
 * it carries. Uniform sizing is a mandatory part of the modal layout rule. */
.modal-btn-row .btn,
.modal-btn-row .btn.btn-sm,
.modal-btn-row .btn.btn-xs {
    padding: 6px 12px !important;
    font-size: 13px !important;
    height: 32px !important;
    line-height: 1 !important;
}

/* Mobile: allow the button row to wrap only when content actually
   overflows the viewport. The spacer keeps its flex:1 1 auto so the
   right-side cluster still pushes flush-right. The cluster itself
   can wrap its inner buttons if one of them is too wide to share
   the line. */
@media (max-width: 640px) {
    .modal-btn-row { flex-wrap: wrap; gap: 6px; }
    .modal-btn-row .modal-btn-cluster {
        flex-wrap: wrap;
        justify-content: flex-end;
    }
}

/* Sidebar PPD branding pill (shown for PPD users/admins, above the theme toggle) */
.sidebar-ppd-brand {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 8px 14px 4px;
    padding: 6px 12px;
    background: color-mix(in srgb, var(--color-primary), transparent 85%);
    border: 1px solid color-mix(in srgb, var(--color-primary), transparent 55%);
    border-radius: 999px;
    color: color-mix(in srgb, var(--color-primary), white 10%);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    align-self: flex-start;
    max-width: calc(100% - 28px);
    overflow: hidden;
}
.sidebar-ppd-brand.hidden { display: none; }
.sidebar-ppd-brand-icon { display: inline-flex; align-items: center; flex: 0 0 auto; }
.sidebar-ppd-brand-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
[data-theme="dark"] .sidebar-ppd-brand {
    background: rgba(99, 102, 241, 0.18);
    border-color: rgba(99, 102, 241, 0.4);
    color: #c7d2fe;
}

/* Mobile sidebar user block - hidden on desktop, shown at <=768px via media query */
.sidebar-user-block {
    display: none;
    flex-direction: column;
    gap: 0;
    border-top: 1px solid rgba(255,255,255,0.08);
    padding: 10px 12px;
    position: relative;
}
.sidebar-user-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 8px;
    text-align: left;
    transition: background 0.15s;
}
.sidebar-user-toggle:hover { background: var(--color-sidebar-hover); }
.sidebar-user-toggle.open  { background: var(--color-sidebar-hover); }
.sidebar-user-toggle .avatar-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.sidebar-user-chevron {
    font-size: 18px;
    color: rgba(255,255,255,0.35);
    margin-left: auto;
    transition: transform 0.2s;
    line-height: 1;
}
.sidebar-user-toggle.open .sidebar-user-chevron {
    transform: rotate(90deg);
}
.sidebar-user-details {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    flex: 1;
}
.sidebar-user-name {
    font-size: 13px;
    font-weight: 700;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-user-role {
    display: none;
}
.sidebar-user-flyout {
    display: none;
    position: fixed;
    left: calc(var(--sidebar-width) + 6px);
    background: var(--color-sidebar);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 2px 8px rgba(0,0,0,0.25);
    padding: 6px 6px 2px;
    min-width: 190px;
    z-index: 9500;
    animation: submenuPop 0.15s ease;
}
.sidebar-user-flyout.open { display: block; }
.sidebar-user-flyout .nav-link {
    color: #a0aec0;
    border-radius: 6px;
    padding: 7px 12px;
    font-size: 13px;
    white-space: nowrap;
}
.sidebar-user-flyout .nav-link:hover {
    background: var(--color-sidebar-hover);
    color: #fff;
}
.sidebar-user-flyout-divider {
    height: 1px;
    background: rgba(255,255,255,0.08);
    margin: 4px 6px;
}
.sidebar-user-flyout-logout { color: rgba(239,68,68,0.75) !important; }
.sidebar-user-flyout-logout:hover { color: #f87171 !important; background: rgba(239,68,68,0.1) !important; }

.sidebar-footer {
    padding:        20px;
    border-top:     1px solid rgba(255,255,255,0.08);
    display:        flex;
    flex-direction: column;
    gap:            12px;
}
.sidebar-sub-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: 6px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    text-decoration: none;
    transition: background 0.15s;
    cursor: pointer;
}
.sidebar-sub-link:hover { background: rgba(255,255,255,0.1); }
.sidebar-sub-label {
    font-size: 12px;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 6px;
}
.sidebar-sub-plan {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 8px;
    border-radius: 8px;
    background: rgba(255,255,255,0.1);
    color: #e2e8f0;
}
.sidebar-sub-plan[data-plan="free"] { background: rgba(148,163,184,0.2); color: #94a3b8; }
.sidebar-sub-plan[data-plan="individual"] { background: rgba(99,179,237,0.2); color: #63b3ed; }
.sidebar-sub-plan[data-plan="team"] { background: rgba(183,148,244,0.2); color: #b794f4; }
.sidebar-sub-manage {
    font-size: 11px;
    color: #94a3b8;
    transition: color 0.15s;
}
.sidebar-sub-link:hover .sidebar-sub-manage { color: #e2e8f0; }

.theme-toggle {
    display: flex;
    gap: 4px;
    background: rgba(255,255,255,0.06);
    border-radius: 8px;
    padding: 3px;
}
.theme-btn {
    flex: 1;
    padding: 4px 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: rgba(255,255,255,0.5);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
}
.theme-btn:hover { color: rgba(255,255,255,0.8); }
.theme-btn.active {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

.user-avatar-btn {
    display:     flex;
    align-items: center;
    gap:         12px;
    width:       100%;
    background:  none;
    border:      none;
    padding:     4px 6px;
    border-radius: var(--radius);
    cursor:      pointer;
    text-align:  left;
    transition:  background 0.15s;
}
.user-avatar-btn:hover {
    background: rgba(255,255,255,0.06);
}
.avatar-circle {
    width:           42px;
    height:          42px;
    border-radius:   50%;
    display:         flex;
    align-items:     center;
    justify-content: center;
    font-size:       14px;
    font-weight:     700;
    color:           #fff;
    letter-spacing:  0.5px;
    flex-shrink:     0;
    user-select:     none;
}
.user-name-col {
    display:        flex;
    flex-direction: column;
    overflow:       hidden;
}
.user-name-text {
    font-size:     13px;
    font-weight:   600;
    color:         #e2e8f0;
    overflow:      hidden;
    text-overflow: ellipsis;
    white-space:   nowrap;
    line-height:   1.3;
}
.user-subtitle {
    font-size:      11px;
    font-weight:    600;
    color:          #a0aec0;
    letter-spacing: 0.03em;
}


.user-role-badge {
    display:         flex;
    align-items:     center;
    justify-content: center;
    gap:             5px;
    font-size:       10px;
    font-weight:     700;
    letter-spacing:  0.5px;
    text-transform:  uppercase;
    padding:         4px 10px;
    border-radius:   6px;
    width:           100%;
    overflow:        hidden;
    white-space:     nowrap;
}
.user-role-badge svg {
    flex-shrink: 0;
}
.role-badge-label {
    overflow:      hidden;
    text-overflow: ellipsis;
    white-space:   nowrap;
    min-width:     0;
}

/* Admin  -  amber/gold */
.user-role-badge.role-admin {
    background: rgba(217, 119, 6, 0.25);
    color:      #fcd34d;
    border:     1px solid rgba(252, 211, 77, 0.25);
}

/* PPD User  -  muted blue */
.user-role-badge.role-ppd-user {
    background: rgba(99, 102, 241, 0.2);
    color:      #a5b4fc;
    border:     1px solid rgba(165, 180, 252, 0.2);
}

/* ---- Top Nav Bar ---- */
.top-nav {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: 52px;
    background: #fff;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 100;
    gap: 16px;
}
.top-nav-search {
    position: relative;
    flex: 1;
    max-width: 480px;
}
.top-nav-search input[type="text"] {
    /* Right padding leaves room for the ⌘K hint badge. */
    padding: 9px 56px 9px 38px;
    border: 1.5px solid color-mix(in srgb, var(--color-primary), transparent 55%);
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    width: 100%;
    background: #fff;
    color: var(--color-text);
    box-shadow: 0 1px 2px rgba(15,23,42,0.04);
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.top-nav-search input[type="text"]:hover {
    border-color: var(--color-primary);
}
/* Keyboard shortcut badge on the right side of the input */
.top-nav-search-kbd {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    padding: 3px 9px;
    font-size: 12px;
    font-weight: 700;
    color: var(--color-text);
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-bottom-width: 2px;
    border-radius: 6px;
    pointer-events: none;
    user-select: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    letter-spacing: 0.2px;
    z-index: 2;
    box-shadow: 0 1px 0 rgba(0,0,0,0.05);
}
[data-theme="dark"] .top-nav-search-kbd {
    color: #f1f5f9;
    background: rgba(255,255,255,0.10);
    border-color: rgba(255,255,255,0.22);
    border-bottom-color: rgba(255,255,255,0.32);
    box-shadow: 0 1px 0 rgba(0,0,0,0.25);
}
.top-nav-search::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    background: var(--color-primary);
    opacity: 0.9;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='M21 21l-4.35-4.35'/%3E%3C/svg%3E") no-repeat center;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='M21 21l-4.35-4.35'/%3E%3C/svg%3E") no-repeat center;
    pointer-events: none;
    z-index: 1;
}
.top-nav-search input[type="text"]::placeholder {
    color: var(--color-placeholder);
}
.top-nav-search input[type="text"]:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(129,140,248,0.15);
    outline: none;
    background: var(--color-card);
}

/* Global search results dropdown */
.global-search-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 100%;
    width: 640px;
    max-width: 90vw;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.15);
    max-height: 420px;
    overflow-y: auto;
    z-index: 999;
}
.global-search-results.hidden { display: none; }
.search-category {
    padding: 8px 14px 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--color-muted);
}
.search-result {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.1s;
}
.search-result:hover,
.search-result.active {
    background: color-mix(in srgb, var(--color-primary), transparent 92%);
}
.search-result:last-child {
    border-radius: 0 0 12px 12px;
}
.search-result-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}
.search-result-icon.type-order { background: var(--color-primary); }
.search-result-icon.type-company { background: #0891b2; }
.search-result-icon.type-customer { background: #059669; }
.search-result-icon.type-lead { background: #d97706; }
.search-result-icon.type-project { background: #7c3aed; }
.search-result-icon.type-supplier { background: #dc2626; }
.search-result-icon.type-supplier-item { background: #be185d; }
.search-result-icon.type-design-team { background: #0891b2; }
.search-result-icon.type-gallery-item { background: #be185d; }
.search-result-icon.type-gallery-category { background: #6366f1; }
/* Super-admin platform result types */
.search-result-icon.type-ppd { background: #4338ca; }
.search-result-icon.type-user { background: #475569; }
.search-result-icon.type-master-product { background: #dc2626; }
.search-result-icon.type-master-supplier { background: #b91c1c; }
.search-result-icon.type-invited-user { background: #f59e0b; }
.search-result-body { flex: 1; min-width: 0; }
.search-result-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.search-result-subtitle {
    font-size: 11px;
    color: var(--color-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.search-result-meta {
    font-size: 11px;
    color: var(--color-muted);
    flex-shrink: 0;
}
.search-result-thumb {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    object-fit: contain;
    border: 1px solid var(--color-border);
    background: var(--color-bg);
    flex-shrink: 0;
    margin-left: auto;
}
.search-no-results {
    padding: 20px 14px;
    text-align: center;
    color: var(--color-muted);
    font-size: 13px;
}
.search-hint {
    padding: 8px 14px;
    text-align: center;
    color: var(--color-muted);
    font-size: 11px;
    border-top: 1px solid var(--color-border);
}
/* Old top-nav toast container — kept as a flex spacer for layout */
.top-nav-toasts {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    overflow: hidden;
    padding: 0 12px;
    min-width: 0;
}
/* Bottom-right stacked toast notifications */
.toast-stack {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    max-width: 400px;
    pointer-events: none;
}
.toast-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px 12px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
    pointer-events: auto;
    cursor: pointer;
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    word-break: break-word;
}
.toast-item.toast-visible {
    opacity: 1;
    transform: translateX(0);
}
.toast-item.toast-exiting {
    opacity: 0;
    transform: translateX(30px);
}
.toast-error   { background: var(--color-danger); color: #fff; }
.toast-success { background: #059669; color: #fff; }
.toast-warning { background: #d97706; color: #fff; }
.toast-info    { background: var(--color-primary); color: #fff; }
.toast-text { flex: 1; }
.toast-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    font-size: 18px;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
    flex-shrink: 0;
}
.toast-close:hover { color: #fff; }
@media (max-width: 500px) {
    .toast-stack { left: 12px; right: 12px; max-width: none; }
}
.top-nav-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 1;
    min-width: 0;
    /* Hard-pin to the right edge regardless of sibling visibility.
       When the global search wrap is display:none for anon visitors,
       justify-content:space-between leaves a single flex child which
       defaults to the start - this margin-left:auto restores right
       alignment in that case. */
    margin-left: auto;
}
.top-nav-notif {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    text-decoration: none;
    color: var(--color-text);
    transition: background 0.15s;
    position: relative;
}
.top-nav-notif, .top-nav-notif:hover {
    color: var(--color-text) !important;
}
.top-nav-notif:hover { background: #e2e8f0; }

/* Open-project cart widget (PPD-only, top-right). Only rendered when a project is open. */
.open-project-widget { margin-right: 6px; }
.open-project-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 10px;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #fff;
    border: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.25);
    transition: transform 0.1s, box-shadow 0.15s, filter 0.15s;
    max-width: 260px;
}
.open-project-btn:hover { filter: brightness(1.08); box-shadow: 0 3px 10px rgba(79, 70, 229, 0.35); }
.open-project-btn:active { transform: translateY(1px); }
.open-project-icon { display: inline-flex; align-items: center; }
.open-project-name {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.open-project-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.28);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}
.open-project-panel {
    /* Body-level, anchored under the top-nav on desktop (52px tall).
       Mobile override below repositions under the mobile-topbar. */
    position: fixed;
    top: calc(52px + 8px);
    right: 16px;
    width: min(720px, calc(100vw - var(--sidebar-width) - 32px));
    max-height: 520px;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.18);
    z-index: 9400;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: submenuPop 0.15s ease;
}
.open-project-panel.hidden { display: none; }
.op-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid var(--color-border);
    gap: 10px;
}
.op-panel-head-title {
    font-weight: 700;
    color: var(--color-text);
    font-size: 14px;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.op-panel-head-sub {
    font-size: 11px;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.op-panel-list {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 6px;
}
.op-panel-row {
    display: flex;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.12s;
}
.op-panel-row:hover { background: var(--color-bg-subtle, #f1f5f9); }
.op-panel-row-thumb {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    border-radius: 6px;
    background: #e5e7eb;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}
.op-panel-row-body { flex: 1 1 auto; min-width: 0; }
.op-panel-row-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.op-panel-row-meta {
    font-size: 11px;
    color: var(--color-muted);
    margin-top: 2px;
}
.op-panel-row-status {
    margin-top: 4px;
    display: flex;
    align-items: center;
}
.op-panel-row-price {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text);
    margin-left: 10px;
    white-space: nowrap;
}
.op-panel-row-figures {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    margin-left: 12px;
    white-space: nowrap;
}
.op-panel-row-figure {
    display: flex;
    align-items: baseline;
    gap: 6px;
    font-size: 12px;
    line-height: 1.3;
}
.op-panel-figure-label {
    color: var(--color-muted);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}
.op-panel-figure-value {
    font-weight: 600;
    color: var(--color-text);
    min-width: 64px;
    text-align: right;
}
.op-panel-figure-net,
.op-panel-foot-subtotal-value.op-panel-figure-net { color: #2563eb; }
.op-panel-figure-profit,
.op-panel-foot-subtotal-value.op-panel-figure-profit { color: #059669; }
.op-panel-empty {
    padding: 28px 16px;
    text-align: center;
    color: var(--color-muted);
    font-size: 13px;
}
.op-panel-foot {
    border-top: 1px solid var(--color-border);
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    /* Subtle tint derived from the theme text color so the strip
       darkens on light mode and lightens on dark mode without
       pinning to a hardcoded near-white (#f8fafc) that made the
       customer-price value unreadable when --color-text is light. */
    background: color-mix(in srgb, var(--color-text) 5%, transparent);
}
.op-panel-foot-subtotal-label {
    font-size: 11px;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.op-panel-foot-subtotal-value {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-text);
}
.op-panel-foot-actions { display: flex; gap: 6px; }
.op-panel-foot-totals {
    display: flex;
    gap: 18px;
    align-items: center;
    flex-wrap: wrap;
}
.op-panel-foot-total {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Top Nav Admin Flyout */
.top-nav-user-wrap {
    position: relative;
}
.top-nav-admin-flyout {
    display:       none;
    position:      absolute;
    top:           calc(100% + 6px);
    right:         0;
    background:    var(--color-card);
    border:        1px solid var(--color-border);
    border-radius: 12px;
    box-shadow:    0 8px 32px rgba(0,0,0,0.14);
    padding:       6px;
    min-width:     190px;
    z-index:       9500;
    animation:     submenuPop 0.15s ease;
}
.top-nav-admin-flyout.open { display: block; }

/* Anon-only secondary shop nav inside the top nav. Lives between
   notifications and the Create Account / Sign In CTAs. Hidden on
   mobile via the shared .top-nav { display:none } media query. */
.top-nav-shop-secondary {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-right: 8px;
}
.top-nav-shop-link {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    text-decoration: none;
    border-radius: 8px;
    transition: background-color 120ms ease, color 120ms ease;
}
.top-nav-shop-link:hover {
    background: var(--color-bg);
    color: var(--color-primary);
}
.top-nav-shop-link.is-active {
    background: rgba(99, 102, 241, 0.10);
    color: var(--color-primary);
}
[data-theme="dark"] .top-nav-shop-link:hover { background: rgba(255,255,255,0.06); }

/* Sidebar copies of the secondary nav links. Only shown on mobile
   where the top-nav (which holds the desktop copies) is hidden.
   Matches the 768px breakpoint where .top-nav { display: none }.
   !important needed because .nav-link sets display:block with
   higher specificity than a single .shop-anon-secondary class. */
.shop-anon-secondary { display: none !important; }
@media (max-width: 768px) {
    .shop-anon-secondary { display: block !important; }
}

.top-nav-admin-flyout-label {
    font-size:      10px;
    font-weight:    700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color:          var(--color-muted);
    padding:        6px 10px 4px;
}
.top-nav-admin-link {
    display:       block;
    padding:       8px 12px;
    border-radius: 8px;
    white-space:   nowrap;
    font-size:     13px;
    font-weight:   500;
    color:         var(--color-text);
    text-decoration: none;
    transition:    background 0.1s;
}
.top-nav-admin-link:hover { background: var(--color-bg); color: var(--color-text); }
.top-nav-admin-link-logout { color: #dc2626 !important; }
.top-nav-admin-link-logout:hover { background: #fee2e2 !important; color: #dc2626 !important; }
[data-theme="dark"] .top-nav-admin-link-logout:hover { background: rgba(239,68,68,.15) !important; color: #f87171 !important; }
.top-nav-admin-flyout-divider { height: 1px; background: var(--color-border); margin: 4px 6px; }

/* Top Nav User Button */
.top-nav-user-divider {
    width: 1px;
    height: 28px;
    background: var(--color-border);
    margin: 0 4px;
    flex-shrink: 0;
}
.top-nav-credits {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    font-weight: 700;
    color: #ffffff;
    padding: 6px 14px 6px 11px;
    border-radius: 20px;
    background: linear-gradient(135deg, #4338ca, #6366f1);
    border: 1px solid rgba(165, 180, 252, 0.4);
    text-decoration: none;
    margin-left: 8px;
    white-space: nowrap;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(99, 102, 241, 0.25);
}
.top-nav-credits::after {
    content: '';
    position: absolute;
    top: -50%; left: -75%; width: 50%; height: 200%;
    background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.12) 50%, transparent 60%);
    animation: tncShine 4s ease-in-out infinite;
}
@keyframes tncShine {
    0%   { left: -75%; }
    25%  { left: 125%; }
    100% { left: 125%; }
}
.top-nav-credits:hover {
    background: linear-gradient(135deg, #4f46e5, #818cf8);
    border-color: rgba(165, 180, 252, 0.6);
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.4);
    transform: translateY(-1px);
    color: #ffffff;
}
.tnc-icon {
    font-size: 11px;
    color: #c4b5fd;
    filter: drop-shadow(0 0 3px rgba(167, 139, 250, 0.5));
    transition: color 0.2s;
}
.top-nav-credits:hover .tnc-icon { color: #c4b5fd; }
.tnc-num {
    font-weight: 800;
    font-size: 13px;
    color: #fff;
    letter-spacing: -0.3px;
}
.tnc-label {
    font-weight: 500;
    font-size: 11px;
    opacity: 0.7;
    letter-spacing: 0.2px;
}
.top-nav-user-btn {
    display:     flex;
    align-items: center;
    gap:         10px;
    background:  none;
    border:      none;
    padding:     4px 10px 4px 6px;
    border-radius: 10px;
    cursor:      pointer;
    transition:  background 0.15s;
    overflow:    hidden;
    min-width:   0;
}
.top-nav-user-btn:hover { background: #e2e8f0; }
.top-nav-user-btn .avatar-circle {
    width:      32px;
    height:     32px;
    min-width:  32px;
    font-size:  12px;
    border-radius: 50%;
    display:    flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}
.top-nav-user-name {
    font-size:   13px;
    font-weight: 600;
    color:       var(--color-text);
    white-space: nowrap;
}
.top-nav-actions .user-role-badge {
    font-size:   9px;
    padding:     2px 8px;
    width:       auto;
    white-space: nowrap;
    flex-shrink: 0;
    align-self:  center;
}
/* Light-background overrides for role badge in top nav */
.top-nav-actions .user-role-badge.role-admin {
    background: rgba(217, 119, 6, 0.12);
    color:      #92400e;
    border:     1px solid rgba(217, 119, 6, 0.3);
}
.top-nav-actions .user-role-badge.role-ppd-user {
    background: rgba(99, 102, 241, 0.12);
    color:      #4338ca;
    border:     1px solid rgba(99, 102, 241, 0.3);
}
[data-theme="dark"] .top-nav-actions .user-role-badge.role-admin {
    background: rgba(217, 119, 6, 0.25);
    color:      #fcd34d;
    border:     1px solid rgba(252, 211, 77, 0.25);
}
[data-theme="dark"] .top-nav-actions .user-role-badge.role-ppd-user {
    background: rgba(99, 102, 241, 0.2);
    color:      #a5b4fc;
    border:     1px solid rgba(165, 180, 252, 0.2);
}
.top-nav-user-btn .user-subtitle {
    display: none;
}

/* ---- Main Content ---- */
.main-content {
    padding:    32px;
    padding-top: 84px;  /* 52px top-nav + 32px padding */
    overflow-y: auto;
    height:     100vh;
}

/* Impersonation Banner */
.impersonation-banner {
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    gap:             12px;
    padding:         10px 16px;
    margin-bottom:   16px;
    border-radius:   var(--radius);
    background:      linear-gradient(135deg, #92400e, #b45309);
    color:           #fff;
    font-size:       13px;
    font-weight:     600;
}
.impersonation-banner .btn {
    background:  rgba(255,255,255,0.2);
    color:       #fff;
    border:      1px solid rgba(255,255,255,0.35);
    flex-shrink: 0;
}
.impersonation-banner .btn:hover { background: rgba(255,255,255,0.3); }

/* Announcement Banner */
.announcement-banner {
    display:        flex;
    align-items:    center;
    justify-content: space-between;
    gap:            12px;
    padding:        12px 16px;
    margin-bottom:  24px;
    border-radius:  var(--radius);
    background:     linear-gradient(135deg, #1d4ed8, #2563eb);
    color:          #fff;
    font-size:      14px;
    font-weight:    500;
    line-height:    1.5;
    box-shadow:     0 2px 8px rgba(37, 99, 235, 0.3);
}
.announcement-dismiss {
    flex-shrink:    0;
    background:     rgba(255,255,255,0.2);
    border:         none;
    color:          #fff;
    font-size:      18px;
    line-height:    1;
    width:          28px;
    height:         28px;
    border-radius:  50%;
    cursor:         pointer;
    transition:     background 0.15s;
}
.announcement-dismiss:hover {
    background: rgba(255,255,255,0.35);
}

/* ---- Page Header ---- */
.page-header {
    display:        flex;
    flex-direction: column;
    gap:            12px;
    margin-bottom:  24px;
}

/* Sticky page headers */
#view-gallery > .page-header,
#view-projects > .page-header,
#view-dashboard > .page-header,
#view-leads > .page-header,
#view-art-library > .page-header,
#view-art-requests > .page-header,
#view-art-services > .page-header,
#view-companies > .page-header,
#view-customers > .page-header,
#view-suppliers > .page-header,
#view-supplier-items > .page-header,
#view-ppd-users > .page-header,
#view-team-performance > .page-header,
#view-order-detail > .page-header,
#view-art-request-detail > .page-header,
#view-art-service-detail > .page-header {
    position:         sticky;
    top:              -32px;       /* offset main-content top padding */
    z-index:          90;
    background:       var(--color-bg);
    padding-top:      12px;
    padding-bottom:   12px;
    margin-top:       -12px;
    margin-left:      -32px;
    margin-right:     -32px;
    padding-left:     32px;
    padding-right:    32px;
    border-bottom:    1px solid var(--color-border);
}
/* Art-tabs pages already render a bottom border on the .art-tabs-nav
   strip; suppress the page-header's own bottom border so the two
   lines don't stack into a doubled divider. */
#view-art-library > .page-header,
#view-art-requests > .page-header,
#view-art-services > .page-header {
    border-bottom: 0;
}
@media (max-width: 768px) {
    #view-gallery > .page-header,
    #view-projects > .page-header,
    #view-dashboard > .page-header,
    #view-leads > .page-header,
    #view-art-library > .page-header,
    #view-art-requests > .page-header,
        #view-art-services > .page-header,
    #view-companies > .page-header,
    #view-customers > .page-header,
    #view-suppliers > .page-header,
    #view-supplier-items > .page-header,
    #view-ppd-users > .page-header,
    #view-team-performance > .page-header,
    #view-order-detail > .page-header,
    #view-art-request-detail > .page-header,
    #view-art-service-detail > .page-header {
        top:            0;
        margin-left:    -16px;
        margin-right:   -16px;
        padding-left:   16px;
        padding-right:  16px;
        margin-top:     -4px;
        padding-top:    8px;
        padding-bottom: 8px;
    }
}

.header-title-row {
    display:     flex;
    align-items: center;
    gap:         16px;
}

.page-header h1 {
    font-size:   22px;
    font-weight: 700;
    color:       var(--color-text);
    flex:        1;
    margin:      0;
}

.header-buttons {
    display:     flex;
    align-items: center;
    gap:         8px;
    flex-shrink: 0;
}

.header-filter-row {
    display:   flex;
    flex-wrap: wrap;
    gap:       8px;
    align-items: center;
}

/* ---- Cards ---- */
.card {
    background:    var(--color-card);
    border-radius: var(--radius);
    box-shadow:    var(--shadow);
    margin-bottom: 20px;
    overflow:      hidden;
    border:        1px solid var(--color-border);
}

.card-header {
    display:       flex;
    align-items:   center;
    padding:       16px 20px;
    border-bottom: 1px solid var(--color-border);
    gap:           12px;
}

.card-header h2 {
    font-size:   16px;
    font-weight: 600;
    flex:        1;
}

/* ---- Stat Cards ---- */
.stat-cards {
    display:               grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap:                   16px;
    margin-bottom:         24px;
}
#perfStatCards {
    grid-template-columns: repeat(4, 1fr);
}
#statCards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    gap: 8px;
    margin-bottom: 16px;
}
#statCards .stat-card {
    padding: 10px 12px;
    border-left-width: 3px;
}
#statCards .stat-label {
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#statCards .stat-value {
    font-size: 20px;
}

.stat-card {
    background:    var(--color-card);
    border-radius: var(--radius);
    box-shadow:    var(--shadow);
    padding:       18px 20px;
    border-left:   4px solid var(--color-primary);
    cursor:        pointer;
    text-decoration: none;
    transition:    transform 0.12s, box-shadow 0.12s;
}
.stat-card:hover {
    transform:  translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}
.stat-card-active {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-primary), transparent 70%);
}
.notif-stat-unread { border-left-color: #1d4ed8; }
.notif-stat-unread .stat-value { color: #1d4ed8; }
.notif-stat-unread.stat-card-active { border-color: #1d4ed8; box-shadow: 0 0 0 2px rgba(29, 78, 216, 0.2); }
.notif-stat-read { border-left-color: #059669; }
.notif-stat-read .stat-value { color: #059669; }
.notif-stat-read.stat-card-active { border-color: #059669; box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.2); }
[data-theme="dark"] .notif-stat-unread .stat-value { color: #93c5fd; }
[data-theme="dark"] .notif-stat-unread { border-left-color: #93c5fd; }
[data-theme="dark"] .notif-stat-unread.stat-card-active { border-color: #93c5fd; box-shadow: 0 0 0 2px rgba(147, 197, 253, 0.2); }
[data-theme="dark"] .notif-stat-read .stat-value { color: #6ee7b7; }
[data-theme="dark"] .notif-stat-read { border-left-color: #6ee7b7; }
[data-theme="dark"] .notif-stat-read.stat-card-active { border-color: #6ee7b7; box-shadow: 0 0 0 2px rgba(110, 231, 183, 0.2); }
.notif-stat-total { border-left-color: #1e293b; }
.notif-stat-total .stat-value { color: #1e293b; }
.notif-stat-total.stat-card-active { border-color: #1e293b; box-shadow: 0 0 0 2px rgba(30, 41, 59, 0.2); }
[data-theme="dark"] .notif-stat-total { border-left-color: #e2e8f0; }
[data-theme="dark"] .notif-stat-total .stat-value { color: #e2e8f0; }
[data-theme="dark"] .notif-stat-total.stat-card-active { border-color: #e2e8f0; box-shadow: 0 0 0 2px rgba(226, 232, 240, 0.2); }

.stat-card .stat-label {
    font-size:  12px;
    color:      var(--color-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.stat-card .stat-value {
    font-size:   28px;
    font-weight: 700;
    color:       var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top:  4px;
}

/* ---- Order Progress Tracker ---- */
.order-progress-tracker {
    display: flex;
    align-items: flex-start;
    position: relative;
}
.progress-step {
    flex: 1;
    text-align: center;
    position: relative;
    z-index: 1;
}
.progress-step.clickable { cursor: pointer; }
.progress-step.clickable:hover .step-dot { transform: scale(1.2) !important; transition: transform 0.15s; }
.progress-step.clickable:hover .step-label { text-decoration: underline; }
.progress-step .step-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    margin: 0 auto 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    border: 2.5px solid #e2e8f0;
    background: transparent;
    color: #cbd5e1;
    transition: all 0.3s;
    position: relative;
    z-index: 2;
}
.progress-step.visited .step-dot {
    transition: all 0.3s;
}
.progress-step.current .step-dot {
    width: 36px;
    height: 36px;
    font-size: 14px;
}
.progress-step .step-label {
    font-size: 12px;
    font-weight: 600;
    color: #a0aec0;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    line-height: 1.3;
    margin-top: 2px;
}
.progress-step.current .step-label { font-size: 13px; }
.progress-step .step-date {
    font-size: 11px;
    color: #a0aec0;
    margin-top: 3px;
    white-space: nowrap;
}
.progress-step.skipped .step-dot {
    border-style: dashed;
    opacity: 0.4;
}
.progress-step.skipped .step-label { opacity: 0.4; }
.step-date.skipped-label {
    color: #94a3b8;
    font-style: italic;
}

/* Connector line between steps */
.progress-connector {
    flex: 1;
    height: 3px;
    background: #e2e8f0;
    margin-top: 14px;
    position: relative;
    z-index: 0;
    transition: background 0.3s;
}
.progress-connector.completed {
    background: #059669;
}
.progress-cancel-separator {
    width: 1px;
    min-width: 1px;
    background: #e2e8f0;
    align-self: stretch;
    margin: 8px 12px;
    opacity: 0.5;
}
.cancel-btn-node:hover .step-dot {
    transform: scale(1.1);
    transition: all 0.2s;
}
.canceled-node.cancel-btn-node:hover .step-dot {
    border-color: #991b1b !important;
    color: #991b1b !important;
    background: #fef2f2 !important;
}
.canceled-node.cancel-btn-node:hover .step-label {
    color: #991b1b !important;
}
.cancel-btn-node:not(.canceled-node):hover .step-dot {
    border-color: #15803d !important;
    color: #15803d !important;
    background: #f0fdf4 !important;
    transform: scale(1.1);
    transition: all 0.2s;
}
.cancel-btn-node:not(.canceled-node):hover .step-label {
    color: #15803d !important;
}
/* Convert buttons */
.btn-convert {
    background: #2563eb !important;
    color: #fff !important;
    border: 1px solid #2563eb !important;
}
.btn-convert:hover {
    background: #3b82f6 !important;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

/* Lead clickable status nodes */
.lead-status-clickable {
    transition: all 0.2s;
}
.lead-status-clickable:hover .step-dot {
    transform: scale(1.15);
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    opacity: 0.9;
}
.lead-status-clickable:hover .step-label {
    opacity: 0.9;
}

/* Lead temperature nodes */
.lead-temp-node {
    transition: all 0.2s ease !important;
    position: relative;
}
.lead-temp-node:hover {
    opacity: 1 !important;
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.lead-temp-node[data-val="hot"]:hover {
    border-color: #dc2626 !important;
    background: #dc262625 !important;
    color: #dc2626 !important;
    box-shadow: 0 2px 12px rgba(220,38,38,0.3);
}
.lead-temp-node[data-val="warm"]:hover {
    border-color: #d97706 !important;
    background: #d9770625 !important;
    color: #d97706 !important;
    box-shadow: 0 2px 12px rgba(217,119,6,0.3);
}
.lead-temp-node[data-val="cold"]:hover {
    border-color: #0284c7 !important;
    background: #0284c725 !important;
    color: #0284c7 !important;
    box-shadow: 0 2px 12px rgba(2,132,199,0.3);
}
.lead-temp-node[data-val="dead"]:hover {
    border-color: #6b7280 !important;
    background: #6b728025 !important;
    color: #6b7280 !important;
    box-shadow: 0 2px 12px rgba(107,114,128,0.3);
}
.lead-temp-node.active {
    transform: scale(1.05);
    box-shadow: 0 1px 6px rgba(0,0,0,0.1);
}
.lead-temp-node.active:hover {
    transform: scale(1.12);
}

[data-theme="dark"] .progress-cancel-separator {
    background: #374151;
}
[data-theme="dark"] .cancel-btn-node:hover .step-dot {
    background: #450a0a !important;
}

/* ---- Customer Dashboard ---- */
.customer-pipeline {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.pipeline-stage {
    flex: 1;
    min-width: 100px;
    padding: 12px;
    background: var(--color-bg);
    border-radius: 8px;
    text-align: center;
    border: 2px solid transparent;
    transition: border-color 0.2s;
    cursor: pointer;
}
.pipeline-stage:hover { border-color: var(--color-primary); }
.pipeline-stage .stage-count {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-text);
}
.pipeline-stage .stage-label {
    font-size: 11px;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}
.pipeline-stage.active {
    border-color: var(--color-primary);
    background: #eff6ff;
}
.customer-attention-item, .customer-deadline-item, .customer-activity-item {
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
    font-size: 13px;
}
.customer-attention-item:last-child, .customer-deadline-item:last-child, .customer-activity-item:last-child { border-bottom: none; }
.customer-attention-item a, .customer-deadline-item a, .customer-activity-item a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 600;
}
.customer-attention-item a:hover, .customer-deadline-item a:hover { text-decoration: underline; }
.deadline-date {
    font-weight: 600;
    color: var(--color-text);
}
.deadline-urgent { color: #ef4444; }
.customer-empty {
    color: var(--color-muted);
    font-size: 13px;
    padding: 16px 0;
    text-align: center;
}
/* Customer dashboard card enhancements */
/* Customer-dashboard cards opt out of the .chart-card 280px cap. The
   compound `.chart-card.cust-dash-card` selector is intentional - plain
   `.cust-dash-card` ties on specificity with `.chart-card` further down
   the file, and the later rule wins, leaving the card visually clipped
   while its inner content overflows on top of the next grid row. */
.chart-card.cust-dash-card { max-height: none; }
.cust-dash-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cust-dash-count { font-size: 11px; font-weight: 700; padding: 2px 10px; border-radius: 100px; }
.cust-dash-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 24px 16px; text-align: center; }
.cust-dash-empty-icon { font-size: 28px; opacity: 0.5; }
.cust-dash-empty-title { font-size: 13px; font-weight: 600; color: var(--color-text); }
.cust-dash-empty-sub { font-size: 12px; color: var(--color-muted); line-height: 1.5; max-width: 260px; }
.cust-attn-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; background: rgba(239,68,68,0.06); border: 1px solid rgba(239,68,68,0.12); margin-bottom: 8px; font-size: 13px; }
.cust-attn-item:last-child { margin-bottom: 0; }
.cust-attn-icon { width: 32px; height: 32px; border-radius: 8px; background: rgba(239,68,68,0.12); display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.cust-attn-text { flex: 1; min-width: 0; }
.cust-attn-text a { color: var(--color-primary); font-weight: 600; text-decoration: none; }
.cust-attn-text a:hover { text-decoration: underline; }
.cust-attn-text .attn-sub { font-size: 11px; color: var(--color-muted); margin-top: 2px; }
.cust-deadline-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--color-border); font-size: 13px; }
.cust-deadline-row:last-child { border-bottom: none; }
.cust-deadline-days { min-width: 44px; padding: 3px 0; border-radius: 6px; text-align: center; font-size: 11px; font-weight: 700; }
.cust-deadline-days.urgent { background: rgba(239,68,68,0.12); color: #ef4444; }
.cust-deadline-days.soon { background: rgba(245,158,11,0.12); color: #f59e0b; }
.cust-deadline-days.ok { background: rgba(34,197,94,0.12); color: #22c55e; }
.cust-activity-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--color-border); font-size: 13px; }
.cust-activity-row:last-child { border-bottom: none; }
.cust-activity-time { min-width: 60px; font-size: 11px; color: var(--color-muted); text-align: right; flex-shrink: 0; }
.cust-activity-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--color-primary); flex-shrink: 0; }

/* ---- Product Gallery ---- */
.gallery-featured-section {
    margin: 0 -32px 28px;
    padding: 24px 32px;
    background: var(--color-card);
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
}
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}
.gallery-card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s, transform 0.15s;
}
.gallery-card:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}
.gallery-card-img {
    position: relative;
    aspect-ratio: 1;
    background: #f8fafc;
    overflow: hidden;
}
[data-theme="dark"] .gallery-card-img { background: rgba(255,255,255,0.04); }
.gallery-card-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 16px;
    /* SAGE QPic caps its real images at 300px wide. Anything larger
       than that is upscaled by the browser and looks visibly soft.
       The image-rendering hint asks the browser to use the sharper
       scaling algorithm. The cap on max-width below stops the
       product-detail SSR snapshot (which lives in a wider container
       than catalog cards) from upscaling beyond ~1.2x. */
    image-rendering: -webkit-optimize-contrast;
    max-width: 360px;
    max-height: 360px;
    margin: 0 auto;
}
.gallery-fav-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255,255,255,0.9);
    border: none;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    font-size: 22px;
    cursor: pointer;
    color: var(--color-muted);
    transition: color 0.2s, background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
[data-theme="dark"] .gallery-fav-btn { background: rgba(0,0,0,0.5); }
.gallery-fav-btn:hover { color: #ec4899; }
.gallery-fav-btn.active { color: #ec4899; }
.gallery-card-cat {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: var(--color-primary);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.gallery-card-body {
    padding: 12px 14px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.gallery-card-supplier {
    font-size: 10px;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}
.gallery-card-title {
    font-size: 13px;
    font-weight: 600;
    margin: 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.gallery-card-rating {
    display: flex;
    align-items: center;
    gap: 4px;
}
.gallery-stars { color: #f59e0b; font-size: 12px; letter-spacing: -1px; }
.gallery-rating-text { font-size: 10px; color: var(--color-muted); }
.gallery-card-colors {
    display: flex;
    align-items: center;
    gap: 3px;
    margin-top: 2px;
}
.gallery-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid rgba(128,128,128,0.2);
    flex-shrink: 0;
}
.gallery-color-more { font-size: 10px; color: var(--color-muted); margin-left: 2px; }
.gallery-color-count { font-size: 10px; color: var(--color-muted); margin-left: 4px; white-space: nowrap; }
.check-label { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; padding: 2px 0; user-select: none; }
.check-label input[type="checkbox"] { width: 14px; height: 14px; margin: 0; flex-shrink: 0; cursor: pointer; }
.gallery-card-price {
    font-size: 14px;
    font-weight: 700;
    color: var(--color-text);
    margin-top: auto;
    padding-top: 4px;
}
.gallery-card-price-qty {
    font-size: 11px;
    font-weight: 500;
    color: var(--color-muted);
}
.gallery-card-actions {
    padding: 8px 14px 12px;
    display: flex;
    gap: 6px;
    border-top: 1px solid var(--color-border);
}
.gallery-card-actions .btn { flex: 1; }
/* Wide detail modal */
.modal-box-detail {
    width:     100%;
    max-width: min(1200px, 94vw);
}

/* Gallery detail modal */
.gallery-detail-images { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 16px; }
.gallery-detail-images img { height: 200px; border-radius: 8px; object-fit: contain; background: #f8fafc; cursor: pointer; }
[data-theme="dark"] .gallery-detail-images img { background: rgba(255,255,255,0.04); }
.gallery-detail-main-img { width: 100%; max-height: 320px; object-fit: contain; border-radius: 10px; background: #f8fafc; margin-bottom: 12px; }
[data-theme="dark"] .gallery-detail-main-img { background: rgba(255,255,255,0.04); }
/* Two explicit columns so field order is rigid — each field always lives
   in its designated column and never shuffles into the other based on which
   other fields are populated. */
.gallery-detail-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 40px; margin: 16px 0; }
.gallery-detail-meta-col { display: flex; flex-direction: column; gap: 14px; }
.gallery-detail-meta-item { font-size: 13px; }
.gallery-detail-meta-item .meta-label { color: var(--color-muted); text-transform: uppercase; font-size: 10px; font-weight: 600; letter-spacing: 0.5px; margin-bottom: 4px; }
.gallery-detail-colors { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 16px; }
.gallery-detail-color { padding: 4px 10px; border-radius: 100px; font-size: 11px; background: var(--color-bg); border: 1px solid var(--color-border); }
.gallery-detail-tiers { width: 100%; font-size: 12px; border-collapse: collapse; margin: 8px 0 16px; }
.gallery-detail-tiers th { text-align: left; font-size: 10px; text-transform: uppercase; color: var(--color-muted); padding: 6px 8px; border-bottom: 1px solid var(--color-border); }
.gallery-detail-tiers td { padding: 6px 8px; border-bottom: 1px solid var(--color-border); }
.gallery-detail-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 20px; }
.gallery-detail-actions .gallery-detail-actions-right { display: flex; gap: 10px; margin-left: auto; }

/* Compact horizontal product card used inside the order form's Product &
   Supplier section. Matches gallery-card visual language (border, radius,
   hover shadow, muted uppercase supplier) but laid out left-to-right. */
.order-form-product-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 12px 14px;
    position: relative;
}
.order-form-product-card-clear {
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    color: var(--color-muted);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 10px;
    margin-left: auto;
    flex-shrink: 0;
    transition: color 0.15s, border-color 0.15s;
}
.order-form-product-card-clear:hover {
    color: var(--color-danger);
    border-color: var(--color-danger);
}
.order-form-product-card-img {
    width: 72px;
    height: 72px;
    border-radius: 8px;
    background: #f8fafc;
    flex-shrink: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
[data-theme="dark"] .order-form-product-card-img { background: rgba(255,255,255,0.04); }
.order-form-product-card-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 6px;
}
.order-form-product-card-img-placeholder {
    font-size: 28px;
    color: var(--color-muted);
}
.order-form-product-card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.order-form-product-card-supplier {
    font-size: 10px;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}
.order-form-product-card-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
}
.order-form-product-card-item-id {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    color: var(--color-primary);
    background: color-mix(in srgb, var(--color-primary), transparent 90%);
    padding: 2px 8px;
    border-radius: 4px;
    margin-top: 4px;
    align-self: flex-start;
}

/* Similar items carousel */
.gallery-similar {
    margin-top:    28px;
    padding-top:   20px;
    border-top:    1px solid var(--color-border);
}
.gallery-similar-header {
    display:     flex;
    align-items: baseline;
    gap:         10px;
    margin-bottom: 14px;
}
.gallery-similar-title {
    font-size:      12px;
    font-weight:    700;
    letter-spacing: 0.7px;
    text-transform: uppercase;
    color:          var(--color-muted);
}
.gallery-similar-subtitle {
    font-size: 12px;
    color:     var(--color-muted);
    opacity:   0.7;
}
.gallery-similar-loading {
    font-size:  13px;
    color:      var(--color-muted);
    font-style: italic;
}
.gallery-similar-carousel {
    display:    flex;
    gap:        12px;
    overflow-x: auto;
    padding-bottom: 6px;
    scrollbar-width: thin;
    scrollbar-color: var(--color-border) transparent;
}
.gallery-similar-carousel::-webkit-scrollbar { height: 4px; }
.gallery-similar-carousel::-webkit-scrollbar-track { background: transparent; }
.gallery-similar-carousel::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 2px; }
.gallery-similar-card {
    flex:          0 0 140px;
    cursor:        pointer;
    border:        1px solid var(--color-border);
    border-radius: 10px;
    overflow:      hidden;
    background:    var(--color-bg);
    transition:    box-shadow 0.15s, border-color 0.15s, transform 0.15s;
}
.gallery-similar-card:hover {
    border-color: var(--color-primary);
    box-shadow:   0 2px 10px rgba(0,0,0,0.1);
    transform:    translateY(-2px);
}
.gallery-similar-img {
    height:          100px;
    display:         flex;
    align-items:     center;
    justify-content: center;
    overflow:        hidden;
    background:      #f8fafc;
}
[data-theme="dark"] .gallery-similar-img { background: rgba(255,255,255,0.04); }
.gallery-similar-img img {
    width:      100%;
    height:     100%;
    object-fit: contain;
    padding:    10px;
}
.gallery-similar-no-img {
    font-size: 28px;
    color:     var(--color-muted);
}
.gallery-similar-body {
    padding: 8px 10px 10px;
}
.gallery-similar-name {
    font-size:   12px;
    font-weight: 600;
    color:       var(--color-text);
    line-height: 1.3;
    display:     -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow:    hidden;
    margin-bottom: 4px;
}
.gallery-similar-cat {
    font-size:      10px;
    color:          var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight:    600;
}
.gallery-similar-stars {
    font-size: 10px;
    color:     #f59e0b;
    margin-top: 3px;
    letter-spacing: -1px;
}

.gallery-star-input { display: flex; gap: 2px; cursor: pointer; }
.gallery-star-input span { font-size: 20px; color: var(--color-border); transition: color 0.15s; }
.gallery-star-input span.filled { color: #f59e0b; }
.gallery-star-input span:hover, .gallery-star-input span:hover ~ span { color: #f59e0b; }

/* ===== Admin Dashboard ===== */
.admin-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 32px;
}
.admin-stat-card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 20px 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    border-left: 3px solid var(--stat-color, #4361ee);
    transition: box-shadow 0.15s, transform 0.12s;
}
.admin-stat-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.12); transform: translateY(-1px); }
.admin-stat-icon { font-size: 22px; line-height: 1; }
.admin-stat-value { font-size: 28px; font-weight: 800; color: var(--color-text); line-height: 1; }
.admin-stat-label { font-size: 11px; font-weight: 600; color: var(--color-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.admin-section-title { font-size: 16px; font-weight: 700; margin: 0 0 14px; color: var(--color-text); }
.admin-page-links {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
    margin-bottom: 32px;
}
.admin-page-card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: box-shadow 0.15s, transform 0.12s, border-color 0.15s;
}
.admin-page-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.12); transform: translateY(-2px); border-color: #4361ee; }
.admin-page-card-icon { font-size: 28px; margin-bottom: 10px; }
.admin-page-card-title { font-size: 15px; font-weight: 700; color: var(--color-text); margin-bottom: 4px; }
.admin-page-card-desc { font-size: 12px; color: var(--color-muted); line-height: 1.5; }

/* ===== DB Schema Diagram ===== */
.schema-group {
    margin-bottom: 28px;
}
.schema-group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 800;
    color: var(--group-color, #4361ee);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--group-color, #4361ee);
}
.schema-group-icon { font-size: 16px; }
.schema-table-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 10px;
}
.schema-table-card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 14px 16px;
}
.schema-table-name {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 6px;
}
.schema-table-desc {
    font-size: 12px;
    color: var(--color-muted);
    line-height: 1.55;
    margin-bottom: 8px;
}
.schema-table-refs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}
.schema-ref-badge {
    font-size: 10px;
    font-weight: 600;
    font-family: 'SF Mono', 'Fira Code', monospace;
    padding: 2px 7px;
    border-radius: 4px;
    white-space: nowrap;
}
.ref-out {
    background: rgba(67,97,238,0.12);
    color: #6382f5;
    border: 1px solid rgba(67,97,238,0.2);
}
.ref-in {
    background: rgba(16,185,129,0.1);
    color: #34d399;
    border: 1px solid rgba(16,185,129,0.2);
}

/* ===== Site Workflow Diagram ===== */
.wf-legend {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 14px 20px;
    margin-bottom: 28px;
}
.wf-legend-title {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--color-muted);
    white-space: nowrap;
}
.wf-legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.wf-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
}
.wf-section {
    margin-bottom: 36px;
}
.wf-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 800;
    color: var(--color-text);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--color-border);
}
.wf-section-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
    align-items: start;
}
.wf-card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    overflow: hidden;
}
.wf-card-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 18px;
}
.wf-card-icon {
    font-size: 24px;
    flex-shrink: 0;
    margin-top: 2px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}
.wf-card-title {
    font-size: 14px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 3px;
}
.wf-card-desc {
    font-size: 11px;
    color: rgba(255,255,255,0.55);
    line-height: 1.4;
}
.wf-card-body {
    padding: 16px;
}
.wf-step {
    background: var(--ac-bg, rgba(67,97,238,0.08));
    border: 1px solid var(--ac-border, rgba(67,97,238,0.2));
    border-left: 3px solid var(--ac, #4361ee);
    border-radius: 8px;
    padding: 10px 12px;
}
.wf-step-actor {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--ac, #4361ee);
    margin-bottom: 5px;
}
.wf-step-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 3px;
}
.wf-step-desc {
    font-size: 11px;
    color: var(--color-muted);
    line-height: 1.5;
}
.wf-step-note {
    display: inline-block;
    margin-top: 6px;
    font-size: 10px;
    font-weight: 600;
    color: var(--ac, #4361ee);
    background: var(--ac-bg, rgba(67,97,238,0.08));
    border: 1px solid var(--ac-border, rgba(67,97,238,0.2));
    border-radius: 4px;
    padding: 2px 7px;
}
.wf-connector {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 28px;
    position: relative;
    justify-content: center;
}
.wf-connector::before {
    content: '';
    position: absolute;
    top: 0; bottom: 0;
    left: 50%;
    width: 2px;
    background: linear-gradient(to bottom, var(--color-border), var(--color-border));
    transform: translateX(-50%);
}
.wf-connector::after {
    content: '▼';
    font-size: 8px;
    color: var(--color-muted);
    position: relative;
    z-index: 1;
    background: var(--color-card);
    padding: 0 2px;
}
.wf-connector-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--color-card);
    padding: 0 6px;
    position: relative;
    z-index: 1;
}

@media (max-width: 600px) {
    .gallery-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .gallery-card-img { padding: 8px; }
    .gallery-detail-meta { grid-template-columns: 1fr; }
    .gallery-featured-section { margin: 0 -16px 24px; padding: 20px 16px; }
}

/* ---- Dashboard Grid ---- */
.dashboard-grid {
    display:               grid;
    grid-template-columns: repeat(3, 1fr);
    gap:                   16px;
    margin-bottom:         24px;
}
.chart-range-select {
    padding: 4px 8px;
    font-size: 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-card);
    color: var(--color-text);
    cursor: pointer;
    outline: none;
}
.chart-card {
    background:    var(--color-card);
    border-radius: var(--radius);
    box-shadow:    var(--shadow);
    padding:       16px;
    max-height:    280px;
}
.chart-card canvas {
    max-height:    220px;
}
.chart-card h3 {
    margin:         0 0 8px;
    font-size:      12px;
    font-weight:    700;
    color:          var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* ---- Tables ---- */
.table-wrap {
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
}

/* Sticky horizontal scrollbar for tables */
.sticky-scrollbar {
    position: fixed;
    bottom: 0;
    overflow-x: scroll;
    overflow-y: hidden;
    height: 20px;
    z-index: 50;
    background: var(--color-card);
    border-top: 1px solid var(--color-border);
    box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
    display: none;
}
.sticky-scrollbar-inner {
    height: 1px;
}

/* Table scroll arrows */
.table-scroll-container { position: relative; overflow: visible; }
.table-scroll-arrow {
    position: fixed;
    top: 50vh;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    z-index: 10;
    border: none;
    background: #6b7280;
    color: #fff;
    box-shadow: 0 3px 12px rgba(107,114,128,0.4);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    padding: 0;
    line-height: 1;
    transition: background 0.15s, box-shadow 0.15s, transform 0.15s;
}
.table-scroll-arrow:hover { background: #4b5563; box-shadow: 0 4px 16px rgba(107,114,128,0.5); transform: translateY(-50%) scale(1.1); }
.table-scroll-arrow-left { }
.table-scroll-arrow-right { }

.data-table-compact th,
.data-table-compact td {
    padding: 8px 8px;
    font-size: 12.5px;
}
.data-table-compact th {
    font-size: 11px;
}

.range-sublabel {
    font-size: 10px;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 1px;
    line-height: 1;
}

/* Color count hover popup */
.color-hover-trigger {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    min-height: 28px;
    padding: 3px 6px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    cursor: default;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.color-swatches-inline {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    flex-wrap: nowrap;
}
.color-hover-trigger:hover {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
}
.color-hover-popup {
    display: none;
    flex-direction: column;
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
    padding: 0;
    min-width: 180px;
    max-height: 280px;
    overflow: hidden;
    z-index: 999;
    white-space: nowrap;
    animation: colorPopupIn 0.15s ease-out;
}
@keyframes colorPopupIn {
    from { opacity: 0; transform: translateX(-50%) translateY(4px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.color-hover-popup::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 7px solid transparent;
    border-top-color: #fff;
    filter: drop-shadow(0 1px 1px rgba(0,0,0,0.08));
}
.color-hover-popup::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-top-color: var(--color-border);
}
.color-hover-popup-header {
    padding: 8px 14px 6px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--color-text-secondary);
    border-bottom: 1px solid var(--color-border);
}
.color-hover-popup-list {
    max-height: 220px;
    overflow-y: auto;
    padding: 4px 0;
}
.color-hover-trigger:hover .color-hover-popup { display: flex; }
.color-hover-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    font-size: 12.5px;
    font-weight: 400;
    color: var(--color-text);
    line-height: 1.4;
    transition: background 0.1s;
}
.color-hover-item .color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1.5px solid rgba(0,0,0,0.2);
    box-shadow: 0 0 0 1px rgba(0,0,0,0.05);
}
.color-hover-item:hover { background: var(--color-bg); }

/* Stripe invoice progress overlay */
.stripe-progress-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.stripe-progress-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px 48px;
    text-align: center;
    min-width: 360px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: scaleIn 0.25s ease-out;
}
@keyframes scaleIn { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.stripe-progress-icon {
    font-size: 36px;
    margin-bottom: 12px;
    line-height: 1;
}
.stripe-progress-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 6px;
}
.stripe-progress-status {
    font-size: 13px;
    color: var(--color-text-secondary);
    margin-bottom: 20px;
    min-height: 20px;
    transition: color 0.2s;
}
.stripe-progress-bar-track {
    width: 100%;
    height: 6px;
    background: var(--color-border);
    border-radius: 3px;
    overflow: hidden;
}
.stripe-progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #635bff, #7c3aed);
    border-radius: 3px;
    transition: width 0.6s ease;
}
.stripe-progress-bar-fill.stripe-progress-error {
    background: linear-gradient(90deg, #e53e3e, #c53030);
}
.stripe-progress-success .stripe-progress-icon {
    color: #22c55e;
    font-size: 42px;
}
.stripe-progress-success .stripe-progress-status {
    color: #22c55e;
    font-weight: 600;
}
.stripe-progress-failed .stripe-progress-icon {
    color: #e53e3e;
    font-size: 42px;
}
.stripe-progress-failed .stripe-progress-status {
    color: #e53e3e;
    font-weight: 600;
}

/* SAGE-style pricing matrix */
.sage-matrix {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    overflow: hidden;
}
/* Lead Times section in the supplier-item modal: the outer 2-col grid
   cramps each column on narrow phones, so "Prod Days Max" wraps to
   two lines while "Prod Days Min" stays on one, misaligning the input
   rows. Collapse to a single column on mobile so each field-pair has
   full width and labels stay on one line. */
@media (max-width: 640px) {
    .lead-times-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Mobile: the SAGE pricing matrix can have many qty tiers (5+), and
   cells have white-space:nowrap so the rightmost columns get clipped
   off-screen on phones. Promote the table itself to a horizontal
   scroll container with display:block. Preserves cell formatting;
   users swipe horizontally to see additional tiers. */
@media (max-width: 640px) {
    .sage-matrix {
        display: block;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}
.sage-matrix th, .sage-matrix td {
    padding: 6px 12px;
    text-align: center;
    border: 1px solid var(--color-border);
    white-space: nowrap;
}
.sage-matrix thead th {
    background: var(--color-bg);
    font-weight: 700;
    font-size: 12px;
    color: var(--color-muted);
}
.sage-matrix .sage-label {
    text-align: left;
    font-weight: 600;
    background: var(--color-bg);
    color: var(--color-text);
    min-width: 120px;
    white-space: nowrap;
}
.sage-matrix tbody tr:first-child td:not(.sage-label) {
    font-weight: 600;
    color: var(--color-text);
}

/* Price tier editor rows */
.price-tier-row input {
    padding:       9px 12px;
    border:        1px solid var(--color-border);
    border-radius: var(--radius);
    font-size:     14px;
    font-family:   var(--font);
    color:         var(--color-text);
    background:    var(--color-card);
    transition:    border-color 0.15s, box-shadow 0.15s;
    outline:       none;
}
.price-tier-row input:focus {
    border-color: var(--color-primary);
    box-shadow:   0 0 0 3px rgba(67,97,238,0.12);
}

/* Product images grid (legacy) */
.product-images-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Product gallery (supplier item detail) */
.product-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.product-image-card {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--color-border);
    cursor: pointer;
    transition: box-shadow 0.15s, transform 0.15s;
    background: var(--color-bg);
}
.product-image-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}
.product-image-card img {
    display: block;
    max-width: 160px;
    max-height: 160px;
    object-fit: contain;
}
.product-image-card .product-img-delete {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    line-height: 20px;
    text-align: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s;
}
.product-image-card:hover .product-img-delete {
    opacity: 1;
}
/* Order detail product image carousel */
.order-product-carousel {
    margin-bottom: 12px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 10px;
    text-align: center;
}
.opc-main {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 6px;
}
.opc-main-img {
    max-width: 180px;
    max-height: 160px;
    object-fit: contain;
    border-radius: 6px;
    display: block;
}
.opc-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid var(--color-border);
    background: var(--color-card);
    color: var(--color-text);
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    transition: background 0.15s;
    z-index: 1;
}
.opc-arrow:hover { background: var(--color-bg); }
.opc-prev { left: -12px; }
.opc-next { right: -12px; }
.opc-thumbs {
    display: flex;
    gap: 4px;
    justify-content: center;
    flex-wrap: wrap;
}
.opc-thumb {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 4px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color 0.15s;
    background: var(--color-card);
}
.opc-thumb.active {
    border-color: var(--color-primary);
}
/* Salesperson pinned this image as the order's primary. The star overlay
   is a CSS-only pseudo-element so we don't have to mutate the <img>. */
.opc-thumb.opc-pinned {
    position: relative;
    box-shadow: 0 0 0 1px #f59e0b;
}
.opc-thumb.opc-pinned::after {
    content: '\2605';
    position: absolute;
    top: -4px;
    right: -4px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #f59e0b;
    color: #fff;
    font-size: 9px;
    line-height: 14px;
    text-align: center;
    box-shadow: 0 1px 2px rgba(0,0,0,0.25);
}
.opc-thumbs {
    position: relative;
    padding-top: 4px;
}
.opc-primary-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 4px;
    margin-bottom: 8px;
}
.opc-primary-controls button:disabled {
    opacity: 1;
    cursor: default;
    color: #b45309;
}

/* Product image thumbnail in tables */
.product-thumb {
    width: 96px;
    height: 96px;
    border-radius: 8px;
    object-fit: contain;
    border: 1px solid var(--color-border);
    background: var(--color-bg);
    vertical-align: middle;
}

/* Read-only SAGE options block rendered under the Master Pricing table.
   Slightly tighter than the main `.data-table` so it visually reads as a
   secondary detail dump and doesn't compete with the pricing matrix. */
.sage-options-table {
    font-size: 12px;
}
.sage-options-table th,
.sage-options-table td {
    padding: 6px 10px;
    vertical-align: top;
}
.sage-options-table th {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--color-muted);
    background: var(--color-bg);
    white-space: nowrap;
}

.data-table {
    width:           100%;
    border-collapse: collapse;
    font-size:       13.5px;
}

.data-table th {
    text-align:  left;
    padding:     10px 16px;
    font-size:   11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color:       var(--color-muted);
    background:  var(--color-table-header);
    border-bottom: 2px solid var(--color-border);
}
/* ---- Art Files ---- */
.art-files-list { display: flex; flex-direction: column; gap: 4px; }
.art-file-row {
    display:       flex;
    align-items:   flex-start;
    gap:           10px;
    padding:       10px 14px;
    background:    var(--color-bg);
    border:        1px solid var(--color-border);
    border-radius: var(--radius);
    font-size:     13px;
    transition:    background 0.15s;
}
.art-file-row:hover {
    background:    var(--color-card);
}
.art-file-name {
    color:          var(--color-primary);
    text-decoration: none;
    overflow:       hidden;
    text-overflow:  ellipsis;
    white-space:    nowrap;
    flex:           1;
    margin-right:   8px;
}
.art-file-name:hover { text-decoration: underline; }
.art-file-row {
    flex-wrap: wrap;
}
.art-file-actions {
    display: flex;
    gap: 4px;
    width: 100%;
    justify-content: flex-end;
    padding-top: 6px;
    opacity: 0;
    transition: opacity 0.15s;
}
.art-file-row:hover .art-file-actions { opacity: 1; }
.art-file-actions .btn { padding: 2px 8px; font-size: 11px; }
/* Scale Preview sits on the left, other actions push to the right. */
.art-file-actions .afm-actual-size { margin-right: auto; }

/* Scale calibration status chip at the top of each art-file manager. */
.afm-scale-status-row {
    display: flex; justify-content: flex-end;
    padding: 0 0 6px;
}
.afm-scale-chip {
    display: inline-flex; align-items: center;
    font-size: 11px; font-weight: 600;
    padding: 3px 10px; border-radius: 999px;
    text-decoration: none;
    border: 1px solid var(--color-border);
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.afm-scale-chip-default {
    background: var(--color-bg); color: var(--color-muted);
}
.afm-scale-chip-default:hover {
    background: #eef2ff; color: #4338ca; border-color: #c7d2fe;
}
.afm-scale-chip-cal {
    background: #ecfdf5; color: #065f46; border-color: #6ee7b7;
}
.afm-scale-chip-cal:hover {
    background: #d1fae5; border-color: #34d399;
}

.art-file-approve {
    font-size:      11px;
    padding:        2px 8px;
    border-radius:  999px;
    border:         1px solid #cbd5e1;
    background:     #f8fafc;
    color:          #64748b;
    cursor:         pointer;
    white-space:    nowrap;
    transition:     background 0.12s, border-color 0.12s;
}
.art-file-approve:hover { background: #e2e8f0; }
.art-file-approve.approved {
    background:   #f0fdf4;
    border-color: #86efac;
    color:        #15803d;
    cursor:       pointer;
}
.art-file-approve.approved:hover { background: #dcfce7; }

/* Art Library Picker */
.art-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    padding: 4px 2px;
}
.art-picker-card {
    position: relative;
    border: 2px solid var(--color-border);
    border-radius: 10px;
    padding: 8px;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
    background: var(--color-card);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.art-picker-card:hover {
    border-color: var(--color-primary);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.15);
    transform: translateY(-1px);
}
.art-picker-card.selected {
    border-color: var(--color-primary);
    background: rgba(99, 102, 241, 0.08);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}
.art-picker-card .picker-check {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--color-border);
    background: var(--color-card);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.15s;
}
.art-picker-card.selected .picker-check {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}
.art-picker-thumb {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-color: #fff;
    background-image: linear-gradient(45deg, #e5e7eb 25%, transparent 25%),
                      linear-gradient(-45deg, #e5e7eb 25%, transparent 25%),
                      linear-gradient(45deg, transparent 75%, #e5e7eb 75%),
                      linear-gradient(-45deg, transparent 75%, #e5e7eb 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}
.art-picker-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 6px;
}
.art-picker-thumb .picker-ext {
    font-size: 22px;
    font-weight: 700;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}
.art-picker-name {
    font-size: 11px;
    color: var(--color-text);
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
    line-height: 1.3;
}
.art-picker-meta {
    font-size: 10px;
    color: var(--color-muted);
    text-align: center;
    white-space: nowrap;
}
[data-theme="dark"] .art-picker-card.selected {
    background: rgba(129, 140, 248, 0.12);
    border-color: #818cf8;
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.25);
}
[data-theme="dark"] .art-picker-card.selected .picker-check {
    background: #818cf8;
    border-color: #818cf8;
}

.file-icon-link {
    display:     inline-flex;
    align-items: center;
    color:       var(--color-primary);
    padding:     2px;
    border-radius: 3px;
    transition:  background 0.12s, color 0.12s;
}
.file-icon-link:hover {
    background: #eff6ff;
    color:      #1d4ed8;
}

.sortable-header {
    cursor: pointer;
    user-select: none;
}
.sortable-header:hover { color: var(--color-text); }
.sort-arrow { font-size: 10px; margin-left: 2px; }

/* Pagination */
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-top: 1px solid var(--color-border);
    font-size: 13px;
    color: var(--color-muted);
    flex-wrap: wrap;
    gap: 12px;
    background: var(--color-card);
}
/* Hide the bar entirely when it has no rendered controls. Otherwise
   the padding + border-top + card background paints a stray white
   strip at the bottom of empty-state pages (projects, orders, etc.). */
.pagination-bar:empty {
    display: none;
}
.pagination-info {
    display: flex;
    align-items: center;
    gap: 12px;
}
.pagination-info strong {
    color: var(--color-text);
    font-weight: 600;
}
.pagination-divider {
    width: 1px;
    height: 16px;
    background: var(--color-border);
}
.pagination-size-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--color-muted);
}
.pagination-info select,
.page-size-select {
    padding: 4px 24px 4px 8px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: 13px;
    background: var(--color-card);
    color: var(--color-text);
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%23718096' d='M5 7L1 3h8z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
}
.pagination-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}
.pagination-controls button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-card);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text);
    transition: all 0.15s ease;
}
.pagination-controls button:hover:not(:disabled) {
    background: var(--color-bg);
    border-color: var(--color-primary);
    color: var(--color-primary);
}
.pagination-controls button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}
.pagination-controls .prev-btn,
.pagination-controls .next-btn {
    padding: 0 6px;
}
.pagination-controls .page-btn.active {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(67, 97, 238, 0.3);
}
.pagination-controls .page-btn.active:hover {
    background: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
}
.page-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    color: var(--color-muted);
    font-size: 14px;
    letter-spacing: 2px;
    user-select: none;
}

.data-table td {
    padding:     12px 16px;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}
.data-table th.col-nowrap,
.data-table td.col-nowrap { white-space: nowrap; }
.data-table tbody tr[data-id] {
    cursor: pointer;
}
.data-table tbody tr[data-order-id] {
    cursor: pointer;
}

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

.data-table tbody tr:hover { background: var(--color-bg); cursor: pointer; }

.loading-cell {
    text-align: center;
    color:      var(--color-muted);
    padding:    40px !important;
}

/* ---- Status Badges ---- */
.badge {
    display:       inline-block;
    padding:       3px 10px;
    border-radius: 999px;
    font-size:     12px;
    font-weight:   600;
    white-space:   nowrap;
}

/* ---- Favorite button & row ---- */
.favorite-btn {
    background:  none;
    border:      none;
    font-size:   24px;
    line-height: 1;
    color:       var(--color-star-empty);
    cursor:      pointer;
    padding:     2px 4px;
    transition:  color 0.15s, transform 0.15s;
}
.favorite-btn:hover {
    color:     #f56565;
    transform: scale(1.2);
}
.favorite-btn.active {
    color: #e53e3e;
}
.favorite-row {
    background: var(--color-fav-row) !important;
}
.favorite-row:hover {
    background: var(--color-fav-row-hover) !important;
}

/* ---- Star Ratings ---- */
/* Stars are rendered in reverse DOM order (5,4,3,2,1) and flipped
   visually with direction:rtl so CSS ~ targets lower-valued stars. */
.star-rating {
    display:     inline-flex;
    gap:         2px;
    white-space: nowrap;
    direction:   rtl;
}
.star-rating .star {
    font-size:   18px;
    line-height: 1;
    color:       var(--color-star-empty);
    cursor:      pointer;
    transition:  color 0.12s, transform 0.12s;
    direction:   ltr;
}
/* Default state: filled stars are gold */
.star-rating .star.filled { color: var(--color-star-filled); }
/* Hover state: reset ALL stars to grey, then paint hovered + lower gold */
.star-rating:hover .star { color: var(--color-star-empty); }
.star-rating .star:hover,
.star-rating .star:hover ~ .star { color: var(--color-star-filled); }
.star-rating .star:hover { transform: scale(1.15); }

.star-rating-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.star-team-avg {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text);
}
.star-team-count {
    font-weight: 400;
    color: var(--color-muted);
    font-size: 11px;
}

.badge-lead          { background: #eff6ff; color: #1d4ed8; }
.badge-needs-quoted  { background: #fef2f2; color: #dc2626; }  /* Red */
.badge-quoted        { background: #fff7ed; color: #ea580c; }  /* Orange */
.badge-confirmed     { background: #fffbeb; color: #d97706; }  /* Amber */
.badge-po-submitted  { background: #fefce8; color: #ca8a04; }  /* Yellow */
.badge-po-accepted   { background: #f7fee7; color: #65a30d; }  /* Lime */
.badge-proof         { background: #f0fdf4; color: #16a34a; }  /* Green */
.badge-proof-approved { background: #f0fdfa; color: #0d9488; }  /* Teal */
.badge-production    { background: #e0f2fe; color: #0284c7; }  /* Sky */
.badge-shipped       { background: #eff6ff; color: #2563eb; }  /* Blue */
.badge-delivered     { background: #eef2ff; color: #4f46e5; }  /* Indigo */
.badge-surveyed      { background: #f5f3ff; color: #7c3aed; }  /* Violet */
.badge-canceled      { background: #ffffff; color: #dc2626; border: 1px solid #fca5a5; }

/* Order status swatch dot */
.order-status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    vertical-align: 1px;
    margin-right: 8px;
}

/* ---- Lead-specific status badges ---- */
.badge-lead-needs-contacted    { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.badge-lead-contacted          { background: #fefce8; color: #a16207; border: 1px solid #fde68a; }
.badge-lead-waiting-on-customer { background: #fff7ed; color: #ea580c; border: 1px solid #fed7aa; }
.badge-lead-converted          { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.badge-lead-lost               { background: #fdf2f2; color: #991b1b; border: 1px solid #fecaca; opacity: 0.82; }

/* ---- Invoice status badges ---- */
.badge-inv-draft    { background: #f3f4f6; color: #6b7280; border: 1px solid #d1d5db; }
.badge-inv-open     { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.badge-inv-partial  { background: #fefce8; color: #a16207; border: 1px solid #fde68a; }
.badge-inv-pastdue  { background: #fff7ed; color: #c2410c; border: 1px solid #fed7aa; }
.badge-inv-paid     { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.badge-inv-refunded { background: #faf5ff; color: #7e22ce; border: 1px solid #e9d5ff; }
.badge-inv-void     { background: #f9fafb; color: #9ca3af; border: 1px solid #e5e7eb; opacity: 0.75; }

/* Supplier invoice statuses */
.badge-sinv-due          { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.badge-sinv-checkphoto   { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.badge-sinv-credit       { background: #ecfdf5; color: #059669; border: 1px solid #a7f3d0; }
.badge-sinv-complimentary { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }
.badge-sinv-payshipping  { background: #eff6ff; color: #2563eb; border: 1px solid #bfdbfe; }
.badge-sinv-posubmitted  { background: #eef2ff; color: #4f46e5; border: 1px solid #c7d2fe; }
.badge-sinv-refundneeded { background: #fdf4ff; color: #a21caf; border: 1px solid #f0abfc; }

/* Active/Inactive & utility badges */
.badge-active    { background: #e6fffa; color: #2c7a7b; }
.badge-inactive  { background: #f7fafc; color: #718096; }
.badge-enabled   { background: #dcfce7; color: #166534; }
.badge-disabled  { background: #f1f5f9; color: #64748b; }
.badge-open      { background: #dbeafe; color: #1e40af; }
.badge-completed { background: #dcfce7; color: #166534; }
.badge-muted     { background: #f1f5f9; color: #64748b; }
.badge-success   { background: #dcfce7; color: #166534; }
.badge-error     { background: #fef2f2; color: #991b1b; }
.badge-warning   { background: #fef3c7; color: #92400e; }
.badge-info      { background: #dbeafe; color: #1e40af; }
.badge-urgent    { background: #fef2f2; color: #991b1b; }
.badge-high      { background: #fff7ed; color: #c2410c; }
.badge-medium    { background: #eff6ff; color: #1e40af; }
.badge-low       { background: #f1f5f9; color: #64748b; }
.badge-running   { background: #dbeafe; color: #1e40af; animation: pulse-badge 1.5s ease-in-out infinite; }
.badge-danger    { background: #fef2f2; color: #991b1b; }
@keyframes pulse-badge { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }

/* Dark mode badge overrides */
[data-theme="dark"] .badge-lead          { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .badge-needs-quoted  { background: #450a0a; color: #fca5a5; }  /* Red */
[data-theme="dark"] .badge-quoted        { background: #431407; color: #fdba74; }  /* Orange */
[data-theme="dark"] .badge-confirmed     { background: #451a03; color: #fcd34d; }  /* Amber */
[data-theme="dark"] .badge-po-submitted  { background: #422006; color: #fef08a; }  /* Yellow */
[data-theme="dark"] .badge-po-accepted   { background: #1a2e05; color: #bef264; }  /* Lime */
[data-theme="dark"] .badge-proof         { background: #052e16; color: #86efac; }  /* Green */
[data-theme="dark"] .badge-proof-approved { background: #042f2e; color: #5eead4; }  /* Teal */
[data-theme="dark"] .badge-production    { background: #0c4a6e; color: #7dd3fc; }  /* Sky */
[data-theme="dark"] .badge-shipped       { background: #1e3a8a; color: #93c5fd; }  /* Blue */
[data-theme="dark"] .badge-delivered     { background: #1e1b4b; color: #a5b4fc; }  /* Indigo */
[data-theme="dark"] .badge-surveyed      { background: #2e1065; color: #d8b4fe; }  /* Violet */
[data-theme="dark"] .badge-canceled      { background: rgba(220,38,38,0.08); color: #f87171; border: 1px solid #991b1b; }

[data-theme="dark"] .badge-inv-draft    { background: #1e293b; color: #94a3b8; border-color: #475569; }
[data-theme="dark"] .badge-inv-open     { background: #1e3a5f; color: #93c5fd; border-color: #1e40af; }
[data-theme="dark"] .badge-inv-partial  { background: #422006; color: #fbbf24; border-color: #854d0e; }
[data-theme="dark"] .badge-inv-pastdue  { background: #431407; color: #fdba74; border-color: #9a3412; }
[data-theme="dark"] .badge-inv-paid     { background: #052e16; color: #86efac; border-color: #166534; }
[data-theme="dark"] .badge-inv-refunded { background: #2e1065; color: #d8b4fe; border-color: #7e22ce; }
[data-theme="dark"] .badge-inv-void     { background: #1e293b; color: #64748b; border-color: #334155; }

[data-theme="dark"] .badge-sinv-due          { background: #450a0a; color: #fca5a5; border-color: #991b1b; }
[data-theme="dark"] .badge-sinv-checkphoto   { background: #422006; color: #fde68a; border-color: #92400e; }
[data-theme="dark"] .badge-sinv-credit       { background: #052e16; color: #86efac; border-color: #166534; }
[data-theme="dark"] .badge-sinv-complimentary { background: #052e16; color: #86efac; border-color: #166534; }
[data-theme="dark"] .badge-sinv-payshipping  { background: #1e3a5f; color: #93c5fd; border-color: #1e40af; }
[data-theme="dark"] .badge-sinv-posubmitted  { background: #312e81; color: #a5b4fc; border-color: #4338ca; }
[data-theme="dark"] .badge-sinv-refundneeded { background: #4a044e; color: #f0abfc; border-color: #86198f; }

[data-theme="dark"] .badge-active    { background: #134e4a; color: #99f6e4; }
[data-theme="dark"] .badge-inactive  { background: #1e293b; color: #64748b; }
[data-theme="dark"] .badge-enabled   { background: #052e16; color: #86efac; }
[data-theme="dark"] .badge-disabled  { background: #1e293b; color: #64748b; }
[data-theme="dark"] .badge-open      { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .badge-completed { background: #052e16; color: #86efac; }
[data-theme="dark"] .badge-muted     { background: #1e293b; color: #64748b; }
[data-theme="dark"] .badge-success   { background: #052e16; color: #86efac; }
[data-theme="dark"] .badge-error     { background: #450a0a; color: #fca5a5; }
[data-theme="dark"] .badge-warning   { background: #422006; color: #fde68a; }
[data-theme="dark"] .badge-info      { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .badge-urgent    { background: #450a0a; color: #fca5a5; }
[data-theme="dark"] .badge-high      { background: #431407; color: #fdba74; }
[data-theme="dark"] .badge-medium    { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .badge-low       { background: #1e293b; color: #64748b; }
[data-theme="dark"] .badge-running   { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .badge-danger    { background: #450a0a; color: #fca5a5; }

/* ---- Buttons ---- */
.btn {
    display:       inline-flex;
    align-items:   center;
    gap:           6px;
    padding:       8px 16px;
    border-radius: var(--radius);
    font-size:     14px;
    font-weight:   600;
    cursor:        pointer;
    border:        none;
    transition:    background 0.15s, opacity 0.15s;
    text-decoration: none;
    white-space:   nowrap;
}

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

.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--color-primary-hover); color: #fff; box-shadow: 0 2px 8px rgba(67, 56, 202, 0.35); }

.btn-ghost { background: transparent; color: var(--color-text); border: 1px solid var(--color-border); }
.btn-ghost:hover:not(:disabled) { background: #e2e8f0; border-color: #cbd5e1; }


.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-xs { padding: 3px 8px; font-size: 12px; }
.btn-clear {
    background:    #fef3c7;
    color:         #92400e;
    border:        1px solid #fbbf24;
    font-weight:   600;
}
.btn-clear:hover {
    background: #fde68a;
}
.btn-edit {
    background:    #eff6ff;
    color:         #1d4ed8;
    border:        1px solid #93c5fd;
    font-weight:   600;
}
.btn-edit:hover {
    background: #dbeafe;
}
.btn-danger-text {
    color: var(--color-danger) !important;
}
.btn-danger-text:hover {
    background: #fff1f2 !important;
}

/* Typeahead search input */
.typeahead-wrapper { position: relative; }
.typeahead-wrapper input[type="text"] { width: 100%; box-sizing: border-box; padding-right: 32px; }
.typeahead-toggle {
    position: absolute; right: 1px; top: 1px; bottom: 1px; width: 30px;
    background: none; border: none; cursor: pointer; padding: 0;
    display: flex; align-items: center; justify-content: center;
    color: var(--color-muted); font-size: 12px; border-radius: 0 7px 7px 0;
}
.typeahead-toggle:hover { background: var(--color-bg); color: var(--color-text); }
.typeahead-results {
    position: absolute; top: 100%; left: 0; right: 0; z-index: 50;
    background: var(--color-card); border: 1px solid var(--color-border);
    border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.12);
    max-height: 260px; overflow-y: auto; margin-top: 4px;
}
.typeahead-result {
    padding: 8px 12px; cursor: pointer; font-size: 13px;
    border-bottom: 1px solid var(--color-border);
    display: flex; flex-direction: row; align-items: stretch; gap: 10px;
    position: relative;
}
.typeahead-result:last-child { border-bottom: none; }
.typeahead-result:hover, .typeahead-result.active { background: var(--color-bg); }
.typeahead-result-img {
    width: 40px; height: 40px; border-radius: 6px; object-fit: cover;
    border: 1px solid var(--color-border); flex-shrink: 0; align-self: center;
}
.typeahead-result-img-placeholder {
    display: flex; align-items: center; justify-content: center;
    background: var(--color-bg); font-size: 18px;
}
.typeahead-result-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; justify-content: center; }
/* Reserve right-side padding only for result rows that actually contain an
   Item # badge, so category/supplier/other typeaheads don't lose width. */
.typeahead-result:has(.typeahead-result-item-id) .typeahead-result-text { padding-right: 96px; }
.typeahead-result-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.typeahead-result-sub { font-size: 11px; color: var(--color-muted); }
.typeahead-result-item-id {
    position: absolute; right: 12px; bottom: 8px;
    font-size: 10px; font-weight: 700; color: var(--color-primary);
    background: color-mix(in srgb, var(--color-primary), transparent 90%);
    padding: 2px 8px; border-radius: 4px; letter-spacing: 0.3px;
}
.typeahead-selected-img {
    width: 32px; height: 32px; border-radius: 6px; object-fit: cover;
    border: 1px solid var(--color-border); flex-shrink: 0;
}
.typeahead-selected {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 12px; background: var(--color-bg); border: 1px solid var(--color-border);
    border-radius: 8px; font-size: 13px;
}
.typeahead-selected-text { flex: 1; font-weight: 500; }
.typeahead-clear {
    background: none; border: none; cursor: pointer; font-size: 16px;
    color: var(--color-muted); padding: 0 4px; line-height: 1;
}
.typeahead-clear:hover { color: var(--color-danger); }

/* Filter typeahead - fits inside filter bars */
.filter-typeahead { width: 100%; border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-card); }
.filter-typeahead:focus-within { border-color: var(--color-primary); outline: none; box-shadow: 0 0 0 2px rgba(99,102,241,0.15); }
/* Higher-specificity selectors so we beat the generic .filter-bar .filter-input
   rules further down the file. Otherwise the typeahead ends up with BOTH the
   wrapper AND the inner input showing their own borders + focus rings, and
   the doubled-up border/padding causes the dropdown to visibly shift on click. */
.filter-bar .filter-typeahead .filter-input,
.filter-typeahead .filter-input { font-size: 13px; border: none; background: transparent; outline: none; padding: 7px 12px; box-shadow: none; }
.filter-bar .filter-typeahead .filter-input:focus,
.filter-typeahead .filter-input:focus { border: none; box-shadow: none; outline: none; background: transparent; }
.filter-bar .filter-typeahead .filter-input.filter-active,
.filter-typeahead .filter-input.filter-active { border: none; box-shadow: none; background: transparent; }
.filter-typeahead .typeahead-toggle { right: 0; top: 0; bottom: 0; border-radius: 0 var(--radius) var(--radius) 0; }
.filter-typeahead .typeahead-selected {
    padding: 5px 10px; border-radius: var(--radius); font-size: 12px; gap: 6px;
}
.filter-typeahead .typeahead-selected-text { font-size: 12px; }
.filter-typeahead .typeahead-clear { font-size: 14px; padding: 0 2px; }
.filter-typeahead .typeahead-result { padding: 6px 10px; font-size: 12px; }
.filter-typeahead .typeahead-result-title { font-size: 12px; }
.filter-typeahead .typeahead-result-sub { font-size: 10px; }

/* Custom color select dropdown */
.color-select-wrapper { position: relative; }
.color-select-trigger {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 12px; border: 1px solid var(--color-border); border-radius: var(--radius);
    background: var(--color-card); cursor: pointer; font-size: 14px; color: var(--color-text);
    min-height: 38px; transition: border-color 0.15s;
}
.color-select-trigger:focus { border-color: var(--color-primary); outline: none; box-shadow: 0 0 0 2px rgba(99,102,241,0.15); }
.color-select-arrow { font-size: 10px; color: var(--color-muted); }
.color-select-label { display: flex; align-items: center; gap: 6px; }
.color-select-dropdown {
    position: absolute; top: 100%; left: 0; right: 0; z-index: 50;
    background: var(--color-card); border: 1px solid var(--color-border); border-radius: var(--radius);
    box-shadow: var(--shadow-md); max-height: 260px; overflow-y: auto; margin-top: 4px;
}
.color-select-dropdown.hidden { display: none; }
.color-select-search-wrap {
    position: sticky; top: 0; z-index: 1;
    padding: 6px; background: var(--color-card);
    border-bottom: 1px solid var(--color-border);
}
.color-select-search {
    width: 100%; padding: 6px 10px; font-size: 13px;
    border: 1px solid var(--color-border); border-radius: var(--radius);
    background: var(--color-card); color: var(--color-text);
    box-sizing: border-box;
}
.color-select-search:focus { border-color: var(--color-primary); outline: none; box-shadow: 0 0 0 2px rgba(99,102,241,0.15); }

/* =============================================================
   Projects page — card grid redesign
   ============================================================= */
.projects-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}
@media (min-width: 1100px) { .projects-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1600px) { .projects-grid { grid-template-columns: 1fr 1fr 1fr; } }
/* When the grid holds only an empty-state or filter-empty message, let
   the message span every column so it reads as a centered card instead
   of getting squished into the left cell of a 2-3 column grid. */
.projects-grid > .empty-state-guide,
.projects-grid > .empty-state-filter-msg {
    grid-column: 1 / -1;
}

.project-card {
    position: relative;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 14px;
    padding: 16px 18px 14px 22px;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-border);
    border-radius: 12px;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.05s;
}
.project-card.is-open { border-left-color: var(--color-primary); background: color-mix(in srgb, var(--color-primary), transparent 97%); }
.project-card.is-inactive { opacity: 0.65; }

.project-card-main { min-width: 0; display: flex; flex-direction: column; gap: 10px; }

.project-card-header { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.project-card-avatar {
    flex-shrink: 0; width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 13px; letter-spacing: 0.5px;
}
.project-card-title { display: block; width: 100%; font-size: 16px; font-weight: 700; color: var(--color-text); line-height: 1.25; word-break: break-word; }
.project-card-sub { font-size: 12px; color: var(--color-muted); margin-top: 2px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.project-card-sub .sep { opacity: 0.4; }

.project-card-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.project-chip {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 8px; border-radius: 999px;
    font-size: 11px; font-weight: 600; letter-spacing: 0.2px;
    background: var(--color-bg); color: var(--color-text-secondary);
    border: 1px solid var(--color-border);
}
.project-chip.active    { background: rgba(5,150,105,0.1);  color: #047857; border-color: rgba(5,150,105,0.25); }
.project-chip.inactive  { background: rgba(148,163,184,0.15); color: #64748b; border-color: rgba(148,163,184,0.3); }
.project-chip.due-urgent { background: rgba(220,38,38,0.1); color: #b91c1c; border-color: rgba(220,38,38,0.3); }
.project-chip.due-soon   { background: rgba(245,158,11,0.12); color: #b45309; border-color: rgba(245,158,11,0.3); }
.project-chip.due-ok     { background: rgba(5,150,105,0.08); color: #047857; border-color: rgba(5,150,105,0.2); }

.project-card-carousel-wrap {
    position: relative;
}
.project-card-carousel {
    display: flex; gap: 8px; overflow-x: auto;
    scroll-behavior: smooth; padding: 2px 0 4px;
    scrollbar-width: thin;
}
.project-card-carousel::-webkit-scrollbar { height: 6px; }
.project-card-carousel::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 4px; }
.project-order-tile {
    flex-shrink: 0; width: 88px; text-align: center;
    padding: 6px 4px 8px; border: 1px solid var(--color-border); border-radius: 8px;
    background: var(--color-bg); cursor: pointer;
    transition: border-color 0.1s, transform 0.05s;
}
.project-order-tile:hover { border-color: var(--color-primary); }
.project-order-tile .thumb {
    width: 76px; height: 76px; margin: 0 auto 4px; border-radius: 6px;
    background: var(--color-card); border: 1px solid var(--color-border);
    display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.project-order-tile .thumb img { width: 100%; height: 100%; object-fit: contain; }
.project-order-tile .thumb-empty { font-size: 10px; color: var(--color-muted); }
.project-order-tile .item { font-size: 10px; font-weight: 700; color: var(--color-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 2px; }
.project-order-tile .supp { font-size: 9px; color: var(--color-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 2px; }
.project-order-tile .price { font-size: 10px; font-weight: 600; color: var(--color-primary); margin-top: 2px; }
.project-order-tile.add-tile {
    border-style: dashed; background: transparent; color: var(--color-muted);
    display: flex; align-items: center; justify-content: center;
    min-height: 108px; font-size: 12px; font-weight: 600;
}
.project-order-tile.add-tile:hover { color: var(--color-primary); border-color: var(--color-primary); }

.project-card-stats { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 4px; font-size: 12px; margin-top: 6px; border-top: 1px solid var(--color-border); padding-top: 10px; }
.project-stat-row { display: flex; flex-wrap: wrap; column-gap: 12px; row-gap: 4px; align-items: center; }
.project-stat { display: inline-flex; gap: 4px; align-items: baseline; white-space: nowrap; }
.project-stat .label { color: var(--color-muted); }
.project-stat .value { color: var(--color-text); font-weight: 700; }
.project-stat .value.profit { color: #059669; }
.project-stat .value.net { color: #2563eb; }

.project-card-actions {
    display: flex; flex-direction: column; gap: 6px;
    min-width: 108px; flex-shrink: 0;
}
.project-card-actions .btn {
    padding: 6px 10px; font-size: 12px; min-width: 108px;
    white-space: nowrap; text-align: center;
    display: inline-flex; align-items: center; justify-content: center;
}

/* Inline Decks section on project card - spans the full card width. */
.project-card-decks { grid-column: 1 / -1; margin-top: 6px; border-top: 1px solid var(--color-border); padding-top: 10px; }
.project-decks-loading, .project-decks-empty { font-size: 12px; color: var(--color-muted); padding: 4px 0; }
.project-decks-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.project-decks-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--color-muted); font-weight: 700; }
.project-decks-list { display: flex; flex-direction: column; gap: 4px; }
.project-deck-row {
    display: flex; flex-direction: column; gap: 6px;
    padding: 8px 10px; border-radius: 6px;
    background: var(--color-bg); border: 1px solid transparent;
    transition: border-color 0.1s, background 0.1s;
}
.project-deck-row:hover { border-color: var(--color-border); background: var(--color-card); }
.project-deck-row.is-inactive { opacity: 0.55; }
.project-deck-name-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; width: 100%; }
.project-deck-name { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; color: var(--color-text); text-decoration: none; word-break: break-word; line-height: 1.3; }
.project-deck-name:hover { color: var(--color-primary); }
.project-deck-updated { font-size: 11px; color: var(--color-muted); white-space: nowrap; flex-shrink: 0; }
.project-deck-row-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.project-deck-status { font-size: 10px; padding: 2px 6px; border-radius: 3px; font-weight: 600; }
.project-deck-status.active   { background: rgba(5,150,105,0.1);  color: #047857; }
.project-deck-status.inactive { background: rgba(148,163,184,0.2); color: #64748b; }
.project-deck-actions { display: flex; gap: 6px; align-items: center; }
.project-deck-actions .btn { padding: 4px 10px; font-size: 12px; line-height: 1.4; white-space: nowrap; text-decoration: none; }
.proj-deck-more-wrap { position: relative; }
/* Pure-CSS hover flyout. Menu hides by default; hovering anywhere in the
   wrapper (button OR menu) keeps it open. A small pseudo-element bridges
   the button→menu gap so moving diagonally doesn't dismiss it. */
.proj-deck-menu {
    position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 140px;
    background: var(--color-card); border: 1px solid var(--color-border);
    border-radius: 8px; box-shadow: var(--shadow-md); padding: 4px 0;
    opacity: 0; visibility: hidden; pointer-events: none;
    transition: opacity 0.1s;
}
.proj-deck-more-wrap::after {
    /* invisible hover bridge between the button and menu (prevents
       flicker when the mouse crosses the gap) */
    content: ''; position: absolute; right: 0; top: 100%;
    width: 140px; height: 8px; pointer-events: none;
}
.proj-deck-more-wrap:hover .proj-deck-menu,
.proj-deck-more-wrap:focus-within .proj-deck-menu {
    opacity: 1; visibility: visible; pointer-events: auto;
}
.proj-deck-more-wrap:hover::after { pointer-events: auto; }
.proj-deck-menu-item { padding: 7px 12px; font-size: 13px; cursor: pointer; color: var(--color-text); }
.proj-deck-menu-item:hover { background: var(--color-bg); }
.proj-deck-menu-item.danger { color: var(--color-danger); }
.project-decks-show-more { margin-top: 4px; font-size: 12px; }

/* Recent Projects horizontal strip (top of projects page) */
.recents-strip-header { font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--color-muted); font-weight: 700; margin-bottom: 8px; }
.recents-strip-scroll { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.recent-project-pill {
    flex-shrink: 0; min-width: 180px; max-width: 220px;
    padding: 10px 12px; background: var(--color-card);
    border: 1px solid var(--color-border); border-radius: 10px;
    cursor: pointer; transition: border-color 0.15s;
}
.recent-project-pill:hover { border-color: var(--color-primary); }
.recent-project-pill .rpp-name { font-size: 13px; font-weight: 700; color: var(--color-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-project-pill .rpp-sub { font-size: 11px; color: var(--color-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }

/* Tiny display-only heart next to a favorite supplier's name.
   Appears on gallery cards, gallery detail, and order detail. */
.supplier-fav-heart {
    color: #ec4899;
    font-size: 16px;
    line-height: 1;
    vertical-align: middle;
    margin-left: 4px;
}

/* API payload viewer tabs (special tester) */
.api-payload-tab {
    background: transparent; border: none; padding: 8px 14px;
    font-size: 13px; font-weight: 600; color: var(--color-muted);
    cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
    transition: color 0.15s, border-color 0.15s;
}
.api-payload-tab:hover { color: var(--color-text); }
.api-payload-tab.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.color-select-option {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px; cursor: pointer; font-size: 13px; color: var(--color-text); transition: background 0.1s;
}
.color-select-option:hover { background: var(--color-bg); }
.color-select-option.selected { background: rgba(99,102,241,0.08); font-weight: 600; }
.color-select-swatch {
    width: 16px; height: 16px; border-radius: 50%; flex-shrink: 0;
    border: 1px solid rgba(0,0,0,0.1);
}
[data-theme="dark"] .color-select-swatch { border-color: rgba(255,255,255,0.15); }

/* Shipping address highlight */
.addr-ship-highlight {
    padding: 10px 14px;
    background: linear-gradient(135deg, #eef2ff, #e0e7ff);
    border: 2px solid #818cf8;
    border-radius: 8px;
}
[data-theme="dark"] .addr-ship-highlight {
    background: linear-gradient(135deg, rgba(99,102,241,0.1), rgba(129,140,248,0.08));
    border-color: #6366f1;
}

/* Copy/Duplicate button color scheme - Cyan */
.btn-copy { background: #0891b2; color: #fff; border-color: #0891b2; }
.btn-copy:hover:not(:disabled) { background: #06b6d4; color: #fff; box-shadow: 0 2px 8px rgba(8, 145, 178, 0.35); }
.btn-copy-ghost { color: #0891b2; border-color: #0891b2; }
.btn-copy-ghost:hover { background: rgba(8, 145, 178, 0.1); color: #0891b2; }
[data-theme="dark"] .btn-copy { background: #06b6d4; border-color: #06b6d4; }
[data-theme="dark"] .btn-copy:hover:not(:disabled) { background: #22d3ee; color: #fff; }
[data-theme="dark"] .btn-copy-ghost { color: #22d3ee; border-color: #22d3ee; }
[data-theme="dark"] .btn-copy-ghost:hover { background: rgba(34, 211, 238, 0.1); color: #22d3ee; }

/* Order button color scheme - Steel blue */
.btn-order { background: #2563eb; color: #fff; border-color: #2563eb; }
.btn-order:hover:not(:disabled) { background: #3b82f6; color: #fff; box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35); }
.btn-order-ghost { color: #2563eb; border-color: #2563eb; }
.btn-order-ghost:hover { background: rgba(37, 99, 235, 0.1); color: #2563eb; }
[data-theme="dark"] .btn-order { background: #3b82f6; border-color: #3b82f6; }
[data-theme="dark"] .btn-order:hover:not(:disabled) { background: #60a5fa; color: #fff; }
[data-theme="dark"] .btn-order-ghost { color: #60a5fa; border-color: #60a5fa; }
[data-theme="dark"] .btn-order-ghost:hover { background: rgba(96, 165, 250, 0.1); color: #60a5fa; }

/* Invoice button color scheme - Stripe-inspired indigo */
.btn-invoice { background: #635bff; color: #fff; border-color: #635bff; }
.btn-invoice:hover:not(:disabled) { background: #7a73ff; color: #fff; box-shadow: 0 2px 8px rgba(99, 91, 255, 0.35); }
[data-theme="dark"] .btn-invoice { background: #7a73ff; border-color: #7a73ff; }
[data-theme="dark"] .btn-invoice:hover:not(:disabled) { background: #9b95ff; color: #fff; }
.btn-invoice-ghost { color: #635bff; border-color: #635bff; }
.btn-invoice-ghost:hover { background: rgba(99, 91, 255, 0.1); color: #635bff; }
[data-theme="dark"] .btn-invoice-ghost { color: #9b95ff; border-color: #9b95ff; }
[data-theme="dark"] .btn-invoice-ghost:hover { background: rgba(155, 149, 255, 0.12); color: #9b95ff; }

/* Project button color scheme */
.btn-project { background: #7c3aed; color: #fff; border-color: #7c3aed; }
.btn-project:hover:not(:disabled) { background: #8b5cf6; color: #fff; box-shadow: 0 2px 8px rgba(124, 58, 237, 0.35); }
.btn-project-ghost { color: #7c3aed; border-color: #7c3aed; }
.btn-project-ghost:hover { background: rgba(124, 58, 237, 0.1); color: #7c3aed; }
[data-theme="dark"] .btn-project { background: #8b5cf6; border-color: #8b5cf6; }
[data-theme="dark"] .btn-project:hover:not(:disabled) { background: #a78bfa; color: #fff; }
[data-theme="dark"] .btn-project-ghost { color: #a78bfa; border-color: #a78bfa; }
[data-theme="dark"] .btn-project-ghost:hover { background: rgba(167, 139, 250, 0.1); color: #a78bfa; }

/* Sales deck button color scheme */
.btn-deck { background: #0d9488; color: #fff; border-color: #0d9488; }
.btn-deck:hover:not(:disabled) { background: #14b8a6; color: #fff; box-shadow: 0 2px 8px rgba(13, 148, 136, 0.35); }
.btn-deck-ghost { color: #0d9488; border-color: #0d9488; }
.btn-deck-ghost:hover { background: rgba(13, 148, 136, 0.1); color: #0d9488; }
[data-theme="dark"] .btn-deck { background: #14b8a6; border-color: #14b8a6; }
[data-theme="dark"] .btn-deck:hover:not(:disabled) { background: #2dd4bf; color: #fff; }
[data-theme="dark"] .btn-deck-ghost { color: #2dd4bf; border-color: #2dd4bf; }
[data-theme="dark"] .btn-deck-ghost:hover { background: rgba(45, 212, 191, 0.1); color: #2dd4bf; }

/* Sales deck project header card */
.sales-deck-project-card {
    background: linear-gradient(135deg, var(--color-card) 0%, var(--color-bg) 100%);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 20px;
}
.sales-deck-project-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 12px;
    letter-spacing: -0.3px;
}
.sales-deck-project-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}
.sales-deck-meta-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text);
}
.sales-deck-meta-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--color-muted);
}

/* My Team PPD header card */
.my-team-ppd-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: linear-gradient(135deg, var(--color-card) 0%, var(--color-bg) 100%);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 16px 24px;
    margin-bottom: 16px;
}
.my-team-ppd-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: linear-gradient(135deg, #6366f1, #818cf8);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}
.my-team-ppd-name {
    font-size: 17px;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: -0.3px;
}
.my-team-ppd-label {
    font-size: 12px;
    color: var(--color-muted);
    margin-top: 1px;
}

/* Sales deck action dropdown */
.deck-action-wrap { position: relative; display: inline-block; }
.deck-action-wrap:has(.deck-action-dropdown:not(.hidden)) { z-index: 100; }
.card:has(.deck-action-dropdown:not(.hidden)) { overflow: visible; }
.deck-action-dropdown {
    position: absolute;
    left: 0;
    top: calc(100% + 4px);
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 6px 0;
    min-width: 160px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 50;
}
[data-theme="dark"] .deck-action-dropdown { background: #1e293b; }
.deck-action-dropdown.hidden { display: none; }
.deck-action-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    transition: background 0.1s;
    white-space: nowrap;
    text-decoration: none;
}
.deck-action-item:hover { background: var(--color-bg); }
.deck-action-item.deck-action-danger { color: #dc2626; }
.deck-action-item.deck-action-danger:hover { background: #fef2f2; }
[data-theme="dark"] .deck-action-item.deck-action-danger:hover { background: rgba(220, 38, 38, 0.1); }
.deck-action-divider {
    border-top: 1px solid var(--color-border);
    margin: 4px 0;
}

.btn-remove-x {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    color: var(--color-danger);
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: var(--shadow);
    padding: 0;
}
.btn-remove-x:hover {
    background: #fff1f2;
    border-color: var(--color-danger);
}
[data-theme="dark"] .btn-remove-x:hover {
    background: #4c0519;
    border-color: var(--color-danger);
}
.btn-deactivate {
    background:    #fff1f2;
    color:         #be123c;
    border:        1px solid #fda4af;
    font-weight:   600;
}
.btn-deactivate:hover {
    background: #ffe4e6;
}
.btn-activate {
    background:    #f0fdf4;
    color:         #15803d;
    border:        1px solid #86efac;
    font-weight:   600;
}
.btn-activate:hover {
    background: #dcfce7;
}
[data-theme="dark"] .btn-activate { background: #052e16; color: #4ade80; border-color: #166534; }
[data-theme="dark"] .btn-activate:hover { background: #14532d; }
.btn-export {
    background:  #eff6ff;
    color:       #1e40af;
    border:      1px solid #93c5fd;
    font-weight: 600;
}
.btn-export:hover { background: #dbeafe; }

.btn-send-quote {
    background:    #ea580c;
    color:         #fff;
    border:        1px solid #ea580c;
    font-weight:   700;
}
.btn-send-quote:hover {
    background: #f97316;
    box-shadow: 0 2px 8px rgba(234, 88, 12, 0.35);
}
[data-theme="dark"] .btn-send-quote { background: #f97316; border-color: #f97316; }
[data-theme="dark"] .btn-send-quote:hover { background: #fb923c; }

.btn-send-po {
    background:    #059669;
    color:         #fff;
    border:        1px solid #059669;
    font-weight:   700;
}
.btn-send-po:hover {
    background: #047857;
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.35);
}
[data-theme="dark"] .btn-send-po:hover { background: #065f46; }

.btn-request-quote {
    background:    #d97706;
    color:         #fff;
    border-color:  #d97706;
    font-weight:   700;
}
.btn-request-quote:hover {
    background: #b45309;
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.35);
}
[data-theme="dark"] .btn-request-quote { background: #f59e0b; border-color: #f59e0b; }
[data-theme="dark"] .btn-request-quote:hover { background: #d97706; }

.btn-request-sample {
    background:    #e11d48;
    color:         #fff;
    border-color:  #e11d48;
    font-weight:   700;
}
.btn-request-sample:hover {
    background: #be123c;
    box-shadow: 0 2px 8px rgba(225, 29, 72, 0.35);
}
[data-theme="dark"] .btn-request-sample { background: #f43f5e; border-color: #f43f5e; }
[data-theme="dark"] .btn-request-sample:hover { background: #e11d48; }

/* Supplier email combo dropdown */
.btn-supplier-email {
    background: #475569;
    color: #fff;
    border: 1px solid #475569;
    font-weight: 700;
}
.btn-supplier-email:hover {
    background: #334155;
    box-shadow: 0 2px 8px rgba(71, 85, 105, 0.35);
}
[data-theme="dark"] .btn-supplier-email { background: #64748b; border-color: #64748b; }
[data-theme="dark"] .btn-supplier-email:hover { background: #475569; }

.supplier-email-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 6px 0;
    min-width: 190px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 50;
}
[data-theme="dark"] .supplier-email-dropdown { background: #1e293b; }
.supplier-email-dropdown.hidden { display: none; }
.supplier-email-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    transition: background 0.1s;
    white-space: nowrap;
}
.supplier-email-item:hover { background: var(--color-bg); }
.supplier-email-item.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}
.supplier-email-divider {
    border-top: 1px solid var(--color-border);
    margin: 4px 0;
}
.sed-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Customer buttons */
.btn-customer { background: #db2777; color: #fff; border-color: #db2777; }
.btn-customer:hover:not(:disabled) { background: #ec4899; color: #fff; box-shadow: 0 2px 8px rgba(219, 39, 119, 0.35); }
.btn-customer-ghost { color: #db2777; border-color: #db2777; }
.btn-customer-ghost:hover { background: rgba(219, 39, 119, 0.1); color: #db2777; }
[data-theme="dark"] .btn-customer { background: #ec4899; border-color: #ec4899; }
[data-theme="dark"] .btn-customer:hover:not(:disabled) { background: #f472b6; color: #fff; }
[data-theme="dark"] .btn-customer-ghost { color: #f472b6; border-color: #f472b6; }
[data-theme="dark"] .btn-customer-ghost:hover { background: rgba(244, 114, 182, 0.1); color: #f472b6; }

/* Customer email combo dropdown */
.btn-customer-email {
    background: #db2777;
    color: #fff;
    border: 1px solid #db2777;
    font-weight: 700;
}
.btn-customer-email:hover {
    background: #be185d;
    box-shadow: 0 2px 8px rgba(219, 39, 119, 0.35);
}
[data-theme="dark"] .btn-customer-email { background: #ec4899; border-color: #ec4899; }
[data-theme="dark"] .btn-customer-email:hover { background: #db2777; }

.customer-email-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 6px 0;
    min-width: 170px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 50;
}
[data-theme="dark"] .customer-email-dropdown { background: #1e293b; }
.customer-email-dropdown.hidden { display: none; }
.customer-email-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    transition: background 0.1s;
    white-space: nowrap;
}
.customer-email-item:hover { background: var(--color-bg); }
.customer-email-item.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.status-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    min-width: 200px;
    z-index: 100;
    padding: 4px 0;
    max-height: 400px;
    overflow-y: auto;
}
.status-dropdown.hidden { display: none; }
.status-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    cursor: pointer;
    font-size: 13px;
    color: var(--color-text);
    transition: background 0.1s;
}
.status-dropdown-item:hover { background: var(--color-bg); }
.status-dropdown-item.active {
    font-weight: 700;
    background: color-mix(in srgb, var(--color-primary), transparent 92%);
}
.status-dropdown-item .badge { pointer-events: none; }

.btn-danger {
    background: #ef4444;
    color: #fff;
    border: 1px solid #dc2626;
}
.btn-danger:hover:not(:disabled) { background: #dc2626; box-shadow: 0 2px 8px rgba(239, 68, 68, 0.35); }

/* Audit log */
.audit-entry {
    padding: 10px 12px;
    margin-bottom: 4px;
    border-radius: 6px;
    background: var(--color-bg);
    font-size: 13px;
}
/* ---- Product Tour ---- */
.tour-overlay {
    position: fixed;
    inset: 0;
    z-index: 9000;
    pointer-events: none;
    transition: opacity 0.3s;
}
.tour-overlay.hidden { display: none; }
.tour-overlay canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: all;
}
.tour-spotlight {
    position: fixed;
    z-index: 9001;
    border-radius: 8px;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.5), 0 0 0 9999px rgba(0, 0, 0, 0.55);
    pointer-events: none;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.tour-tooltip {
    position: fixed;
    z-index: 9002;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    padding: 20px;
    max-width: 380px;
    min-width: 280px;
    pointer-events: all;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.25s, transform 0.25s;
}
.tour-tooltip.visible {
    opacity: 1;
    transform: translateY(0);
}
.tour-tooltip-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-text);
    margin: 0 0 8px;
    line-height: 1.3;
}
.tour-tooltip-body {
    font-size: 13px;
    color: var(--color-muted);
    line-height: 1.6;
    margin: 0 0 16px;
}
.tour-tooltip-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
.tour-tooltip-progress {
    font-size: 11px;
    color: var(--color-muted);
    font-weight: 600;
}
.tour-tooltip-actions {
    display: flex;
    gap: 6px;
}
.tour-tooltip-arrow {
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    transform: rotate(45deg);
    z-index: -1;
}
.tour-tooltip-arrow.top    { bottom: -7px; left: 24px; border-top: none; border-left: none; }
.tour-tooltip-arrow.bottom { top: -7px; left: 24px; border-bottom: none; border-right: none; }
.tour-tooltip-arrow.left   { right: -7px; top: 24px; border-bottom: none; border-left: none; }
.tour-tooltip-arrow.right  { left: -7px; top: 24px; border-top: none; border-right: none; }

/* ---- Notification rows ---- */
.notif-unread {
    font-weight: 600;
    background: color-mix(in srgb, var(--color-primary), transparent 92%) !important;
    border-left: 3px solid var(--color-primary);
}
.notif-unread:hover { background: color-mix(in srgb, var(--color-primary), transparent 85%) !important; }
.notif-read {
    opacity: 0.55;
    border-left: 3px solid transparent;
}
.notif-read:hover { opacity: 0.75; }
.notif-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: transparent;
    border: 2px solid var(--color-border);
}
.notif-dot.unread {
    background: #ef4444;
    border-color: #ef4444;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.4);
}
.notif-read-btn {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
    font-weight: 600;
}
.notif-read-btn:hover { background: #d1fae5; }
[data-theme="dark"] .notif-read-btn { background: #052e16; color: #6ee7b7; border-color: #065f46; }
[data-theme="dark"] .notif-read-btn:hover { background: #064e3b; }

.notif-unread-btn {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    font-weight: 600;
}
.notif-unread-btn:hover { background: #dbeafe; }
[data-theme="dark"] .notif-unread-btn { background: #1e3a5f; color: #93c5fd; border-color: #1e40af; }
[data-theme="dark"] .notif-unread-btn:hover { background: #1e40af; }

/* Tour button — in top nav, right of Notifications */
.top-nav-tour-btn {
    background: transparent;
    border: 1px solid var(--color-border);
    cursor: pointer;
    color: var(--color-muted);
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
    margin-left: 4px;
    flex-shrink: 0;
    line-height: 1;
}
.top-nav-tour-btn:hover {
    color: var(--color-primary);
    border-color: var(--color-primary);
    background: color-mix(in srgb, var(--color-primary), transparent 92%);
}
/* Hide old floating position class if any leftover refs */
.tour-btn-help { display: none; }

/* ---- Email Log Rows ---- */
.email-log-row {
    padding: 10px 12px;
    border-bottom: 1px solid var(--color-border);
    cursor: pointer;
    transition: background 0.1s;
}
.email-log-row:last-child { border-bottom: none; }
.email-log-row:hover { background: color-mix(in srgb, var(--color-primary), transparent 95%); }
.email-log-line1 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 3px;
}
.email-type-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    letter-spacing: 0.5px;
}
.email-log-subject {
    font-size: 13px;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}
.email-log-meta { flex-shrink: 0; }
.email-log-line2 {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--color-muted);
}
.email-log-date { flex-shrink: 0; }

/* ---- Subscription Plan Cards ---- */
/* ---- Subscription: Usage stats ---- */
.sub-usage-section {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 24px 28px;
    margin-bottom: 24px;
}
.sub-usage-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.sub-usage-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text);
    margin: 0 0 4px;
}
.sub-usage-plan-label {
    font-size: 13px;
    color: var(--color-muted);
    margin: 0;
}
.sub-usage-plan-label strong {
    color: var(--color-text);
}
.sub-usage-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}
.sub-usage-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.sub-usage-header {
    display: flex;
    align-items: center;
    gap: 8px;
}
.sub-usage-icon {
    width: 18px;
    height: 18px;
    color: var(--color-primary);
    flex-shrink: 0;
}
.sub-usage-icon svg {
    width: 18px;
    height: 18px;
    display: block;
}
.sub-usage-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    flex: 1;
}
.sub-usage-count {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text);
    white-space: nowrap;
}
.sub-usage-bar-track {
    height: 6px;
    background: var(--color-border);
    border-radius: 3px;
    overflow: hidden;
}
.sub-usage-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease;
}
.sub-usage-note {
    font-size: 11px;
    color: var(--color-muted);
}

/* Public Storefront entry is gated to a single ops account
   (jay@deliveredbydecade.com). applyStorefrontEmailGate() adds the
   `storefront-allowed` class to <body> for the allowlisted user.
   The body-class approach (vs stripping `.storefront-jay-only`) lets
   dynamically-rendered settings sidebar entries inherit the gate
   automatically — no need to re-run a strip helper after every
   sidebar render. */
body:not(.storefront-allowed) .storefront-jay-only { display: none !important; }

.sub-page-grid {
    /* CSS Grid with grid-auto-flow:column + minmax(0,1fr) puts every
       plan card in a single row with equal width, regardless of how
       many plans the API returns. minmax(0,...) is critical — it lets
       columns shrink below their content's intrinsic width so long
       feature labels wrap inside the card instead of forcing the
       column wider. Flex layout couldn't reliably do this because some
       descendant defaults to min-content width and refuses to shrink.
       align-items:start anchors every card's top edge to the same Y
       (default `stretch` would equalize heights but the GOAT card's
       outer pill rendering made its visible top sit higher than its
       siblings). */
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    align-items: start;
    gap: 20px;
}
.sub-page-grid .sub-plan-card { min-width: 0; }
.sub-page-grid .sub-plan-features li { white-space: normal; word-wrap: break-word; }
.sub-plan-card {
    background: var(--color-card);
    border: 2px solid var(--color-border);
    border-radius: 12px;
    padding: 28px 24px;
    position: relative;
    display: flex;
    flex-direction: column;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.sub-plan-card:hover { border-color: var(--color-primary); }
.sub-plan-current {
    border-color: var(--color-primary);
    border-width: 2px;
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--color-primary), transparent 75%),
                0 8px 24px rgba(67, 97, 238, 0.15);
    background: color-mix(in srgb, var(--color-primary), var(--color-card) 95%);
    /* Anchor the scale to the top edge so the current plan card grows
       downward instead of upward — keeps every card's top aligned with
       its siblings even when scaled for emphasis. */
    transform: scale(1.03);
    transform-origin: top center;
    z-index: 1;
}
.sub-plan-current .sub-plan-name {
    color: var(--color-primary);
}
.sub-plan-current .sub-plan-amount {
    color: var(--color-primary);
}
.sub-plan-featured { border-color: #805ad5; }
.sub-plan-featured:hover { border-color: #6b46c1; }
.sub-plan-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 4px 16px;
    border-radius: 12px;
    white-space: nowrap;
    box-shadow: 0 2px 8px color-mix(in srgb, var(--color-primary), transparent 50%);
}
.sub-plan-badge-featured { background: #805ad5; }
/* When the GOAT card is also the current plan, both badges sit at
   top:-12px. Pin Current Plan to the left so it doesn't collide with
   the right-aligned Recommended pill. */
.sub-plan-badge-left {
    left: 14px;
    transform: none;
}
.sub-plan-name { font-size: 20px; font-weight: 700; margin: 8px 0 4px; }
.sub-plan-desc { font-size: 13px; color: var(--color-muted); margin: 0 0 16px; }
.sub-plan-price { display: flex; align-items: baseline; gap: 2px; margin-bottom: 4px; }
.sub-plan-amount { font-size: 32px; font-weight: 800; color: var(--color-text); }
.sub-plan-period { font-size: 14px; color: var(--color-muted); }
.sub-plan-yearly { font-size: 12px; color: #059669; margin: 0 0 16px; font-weight: 600; }
.sub-plan-features {
    list-style: none;
    padding: 0;
    margin: 0 0 20px;
    flex: 1;
}
.sub-plan-features li {
    font-size: 13px;
    padding: 5px 0;
    color: var(--color-text);
    border-bottom: 1px solid var(--color-border);
}
.sub-plan-features li::before { content: '\2713 '; color: #059669; font-weight: 700; margin-right: 6px; }
.sub-plan-features li.sub-feature-disabled { color: var(--color-muted); text-decoration: line-through; opacity: 0.5; }
.sub-plan-features li.sub-feature-disabled::before { content: '\2717 '; color: var(--color-muted); }
.sub-current-indicator {
    /* Filled solid pill so the "Your Current Plan" CTA matches the
       weight of the upgrade/switch buttons on its peers — same height,
       same radius, same boldness. */
    width: 100%;
    padding: 14px 20px;
    font-size: 15px;
    font-weight: 700;
    text-align: center;
    border-radius: 10px;
    background: var(--color-primary);
    color: #fff;
    border: none;
    letter-spacing: 0.3px;
    box-shadow: 0 4px 14px rgba(67, 97, 238, 0.32);
    cursor: default;
}
/* When the user is currently on the GOAT plan, swap the indicator's
   indigo treatment for the same gold + shimmer the upgrade-to-GOAT
   CTA uses. Keeps the GOAT brand consistent on the current-plan card
   instead of regressing to plain indigo. */
.sub-plan-card.sub-plan-goat .sub-current-indicator {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 35%, #d97706 70%, #b45309 100%);
    color: #fff;
    text-shadow: 0 1px 2px rgba(120, 53, 15, 0.45);
    letter-spacing: 0.4px;
    box-shadow:
        0 0 0 1px rgba(180, 83, 9, 0.5) inset,
        0 1px 0 rgba(255, 255, 255, 0.45) inset,
        0 4px 14px rgba(217, 119, 6, 0.45),
        0 0 24px rgba(245, 158, 11, 0.25);
}
.sub-plan-card.sub-plan-goat .sub-current-indicator::before {
    content: '';
    position: absolute;
    top: 0;
    left: -40%;
    width: 30%;
    height: 100%;
    background: linear-gradient(120deg, transparent 0%, rgba(255, 255, 255, 0.55) 50%, transparent 100%);
    transform: skewX(-20deg);
    pointer-events: none;
    animation: sub-cta-goat-shimmer 3.4s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
    .sub-plan-card.sub-plan-goat .sub-current-indicator::before { animation: none; opacity: 0; }
}
.sub-plan-action { margin-top: auto; padding-top: 8px; }
.sub-plan-action .btn {
    width: 100%;
    padding: 14px 20px;
    font-size: 15px;
    font-weight: 700;
    border-radius: 10px;
    letter-spacing: 0.3px;
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
/* Upgrade / Switch CTAs: bold filled indigo with shadow lift on hover. */
.sub-plan-action .btn-primary {
    background: linear-gradient(135deg, var(--color-primary), color-mix(in srgb, var(--color-primary), #1e3a8a 25%));
    color: #fff;
    border: none;
    box-shadow: 0 4px 14px rgba(67, 97, 238, 0.32);
}
.sub-plan-action .btn-primary:hover {
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(67, 97, 238, 0.4);
    filter: brightness(1.05);
}
/* Downgrade CTA stays quieter than the upgrade path so the visual
   hierarchy makes the "right" action obvious — but with a thicker
   border + bolder text than the default ghost so it still reads as a
   real button. */
.sub-plan-action .btn-ghost {
    background: var(--color-card);
    color: var(--color-text);
    border: 2px solid var(--color-border);
    box-shadow: none;
}
.sub-plan-action .btn-ghost:hover {
    border-color: var(--color-text);
    color: var(--color-text);
    background: var(--color-card);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* ---- Subscription CTA arrow + shimmer ---- */
/* The label + arrow live as inline-flex children of the button so the
   arrow can nudge right on hover without affecting label position. */
.sub-plan-action .btn .sub-cta-label,
.sub-plan-action .btn .sub-cta-arrow {
    display: inline-block;
    vertical-align: middle;
}
.sub-plan-action .btn .sub-cta-arrow {
    margin-left: 8px;
    transition: transform 0.18s ease;
}
.sub-plan-action .btn:hover .sub-cta-arrow {
    transform: translateX(4px);
}

/* GOAT CTA: deeper gold gradient, embossed inner highlight, glow,
   and a sweeping shimmer that loops every few seconds. The shimmer is
   a thin ::pseudo-like span positioned absolutely; we mask it to the
   button's rounded edges via overflow:hidden on the button host. */
.sub-plan-action .btn.sub-cta-goat {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 35%, #d97706 70%, #b45309 100%);
    color: #fff;
    border: none;
    text-shadow: 0 1px 2px rgba(120, 53, 15, 0.45);
    box-shadow:
        0 0 0 1px rgba(180, 83, 9, 0.5) inset,
        0 1px 0 rgba(255, 255, 255, 0.45) inset,
        0 4px 14px rgba(217, 119, 6, 0.45),
        0 0 24px rgba(245, 158, 11, 0.25);
    letter-spacing: 0.4px;
}
.sub-plan-action .btn.sub-cta-goat:hover {
    color: #fff;
    transform: translateY(-2px);
    filter: brightness(1.06) saturate(1.05);
    box-shadow:
        0 0 0 1px rgba(180, 83, 9, 0.55) inset,
        0 1px 0 rgba(255, 255, 255, 0.5) inset,
        0 8px 22px rgba(217, 119, 6, 0.55),
        0 0 32px rgba(245, 158, 11, 0.35);
}
.sub-plan-action .btn.sub-cta-goat:active {
    transform: translateY(0);
}
.sub-plan-action .btn.sub-cta-goat .sub-cta-shimmer {
    position: absolute;
    top: 0;
    left: -40%;
    width: 30%;
    height: 100%;
    background: linear-gradient(120deg, transparent 0%, rgba(255, 255, 255, 0.55) 50%, transparent 100%);
    transform: skewX(-20deg);
    pointer-events: none;
    animation: sub-cta-goat-shimmer 3.4s ease-in-out infinite;
}
@keyframes sub-cta-goat-shimmer {
    0%   { left: -40%; }
    55%  { left: 130%; }
    100% { left: 130%; }
}
@media (prefers-reduced-motion: reduce) {
    .sub-plan-action .btn.sub-cta-goat .sub-cta-shimmer { animation: none; opacity: 0; }
    .sub-plan-action .btn:hover .sub-cta-arrow { transform: none; }
}
.sub-plan-featured .sub-plan-action .btn-primary {
    color: #805ad5;
    background: transparent;
    border: 1px solid var(--color-border);
    box-shadow: none;
}
.sub-plan-featured .sub-plan-action .btn-primary:hover {
    color: #805ad5;
    background: rgba(128, 90, 213, 0.08);
    border-color: #805ad5;
}

@media (max-width: 768px) {
    .sub-page-grid { grid-template-columns: 1fr; max-width: 400px; }
    .sub-usage-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
    .sub-usage-grid { grid-template-columns: 1fr; }
}

/* ---- Email Preview Modal ---- */
.email-preview-box {
    max-width: 700px;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}
.email-preview-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
    position: relative;
}
.email-preview-subject {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-text);
    padding-right: 60px;
    line-height: 1.3;
}
.email-preview-meta {
    padding: 12px 20px;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
}
.email-meta-row {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 3px 0;
    font-size: 13px;
}
.email-meta-label {
    font-weight: 700;
    color: var(--color-muted);
    min-width: 48px;
    text-align: right;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.email-meta-value {
    color: var(--color-text);
}
.email-preview-body {
    flex: 1;
    overflow: auto;
    padding: 0;
    background: #fff;
}
[data-theme="dark"] .email-preview-body {
    background: #1e293b;
}

/* ---- Email Templates Preview ---- */
.email-tpl-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg);
}
.email-tpl-tab {
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    color: var(--color-muted);
    background: transparent;
    border: 1px solid transparent;
    transition: all 0.15s;
}
.email-tpl-tab:hover { color: var(--color-text); background: var(--color-card); }
.email-tpl-tab.active {
    color: var(--color-primary);
    background: var(--color-card);
    border-color: var(--color-primary);
}
.email-tpl-view-toggle {
    display: flex;
    gap: 4px;
    padding: 8px 16px;
    border-bottom: 1px solid var(--color-border);
}
.email-tpl-view-btn {
    color: #334155 !important;
}
.email-tpl-view-btn:hover:not(.active) {
    background: #e2e8f0 !important;
    border-color: #cbd5e1 !important;
    color: #1e293b !important;
}
[data-theme="dark"] .email-tpl-view-btn {
    color: #e2e8f0 !important;
}
[data-theme="dark"] .email-tpl-view-btn:hover:not(.active) {
    background: #334155 !important;
    border-color: #64748b !important;
    color: #e2e8f0 !important;
}
.email-tpl-view-btn.active {
    background: var(--color-primary) !important;
    color: #fff !important;
    border-color: var(--color-primary);
}
.email-tpl-subject {
    padding: 10px 16px;
    font-size: 13px;
    color: var(--color-muted);
    border-bottom: 1px solid var(--color-border);
}
.email-tpl-subject strong { color: var(--color-text); }
.email-tpl-frame-wrap {
    padding: 0;
}

.audit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
.audit-action {
    font-weight: 600;
    text-transform: capitalize;
    color: var(--color-text);
    font-size: 12px;
}
.audit-meta {
    font-size: 11px;
    color: var(--color-muted);
    white-space: nowrap;
}
.audit-changes {
    margin-top: 4px;
    font-size: 12px;
    color: var(--color-muted);
}
.audit-field {
    font-weight: 600;
    color: var(--color-text);
}

/* Orders summary bar */
.orders-summary-bar {
    padding: 14px 16px;
    background: var(--color-bg);
    border-radius: 10px;
    margin: 0 0 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    border: 1px solid var(--color-border);
}
.orders-summary-invoices {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}
.invoice-summary-group {
    flex: 1;
    min-width: 200px;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.invoice-summary-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}
.invoice-summary-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.invoice-summary-pills .badge {
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 6px;
    white-space: nowrap;
    font-weight: 600;
}
a.inv-summary-link {
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.15s;
}
a.inv-summary-link:hover {
    opacity: 0.85;
    transform: scale(1.05);
}

/* Bulk action bar */
.bulk-action-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: #eff6ff;
    border: 1px solid #93c5fd;
    border-radius: 8px;
    margin: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #1e40af;
}
.bulk-action-bar select {
    padding: 5px 10px;
    border: 1px solid #93c5fd;
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
}

/* Order Comments */
.order-comments-thread {
    max-height: 420px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 4px 0;
}
.comment-bubble {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.5;
}
.comment-bubble.outgoing {
    align-self: flex-end;
    background: var(--color-primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.comment-bubble.incoming {
    align-self: flex-start;
    background: var(--color-bg);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-bottom-left-radius: 4px;
}
.comment-meta {
    font-size: 10px;
    margin-top: 4px;
}
.comment-bubble.outgoing .comment-meta { color: rgba(255,255,255,0.6); }
.comment-bubble.incoming .comment-meta { color: var(--color-muted); }
.comment-author {
    font-weight: 700;
    font-size: 11px;
    margin-bottom: 3px;
    letter-spacing: 0.2px;
}
.comment-bubble.incoming .comment-author { color: var(--color-text); }
.comment-bubble.outgoing .comment-author { color: rgba(255,255,255,0.85); }
.comment-empty {
    text-align: center;
    color: var(--color-muted);
    font-size: 13px;
    padding: 20px 0;
}
.comment-role-tag {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 1px 5px;
    border-radius: 4px;
    margin-left: 4px;
}
.comment-bubble.incoming .comment-role-tag {
    background: rgba(0,0,0,0.08);
    color: var(--color-muted);
}
.comment-bubble.outgoing .comment-role-tag {
    background: rgba(255,255,255,0.2);
    color: rgba(255,255,255,0.8);
}

/* Comment Attachments */
.comment-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}
.comment-attach-thumb {
    width: 60px;
    height: 60px;
    object-fit: contain;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.2);
    cursor: pointer;
}
.comment-bubble.incoming .comment-attach-thumb {
    border-color: var(--color-border);
}
.comment-attach-file {
    display: inline-block;
    padding: 4px 8px;
    background: rgba(255,255,255,0.15);
    border-radius: 4px;
    font-size: 11px;
    color: inherit;
    text-decoration: none;
}
.comment-bubble.incoming .comment-attach-file {
    background: var(--color-bg);
    color: var(--color-primary);
}
.comment-attach-btn {
    cursor: pointer;
    font-size: 16px !important;
    padding: 4px 8px !important;
    line-height: 1;
}
.comment-file-status {
    font-size: 11px;
    color: var(--color-muted);
    margin-right: auto;
}

/* Comment Attachment Gallery */
.comment-attachments-gallery {
    margin-top: 16px;
    padding: 12px;
    background: var(--color-bg);
    border-radius: 8px;
    border: 1px solid var(--color-border);
}
.comment-gallery-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}
.comment-gallery-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid var(--color-border);
}
.comment-gallery-item:last-child {
    border-bottom: none;
}
.comment-gallery-thumb {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 4px;
    border: 1px solid var(--color-border);
    cursor: pointer;
}
.comment-gallery-file-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-card);
    border-radius: 4px;
    border: 1px solid var(--color-border);
    font-size: 10px;
    font-weight: 700;
    color: var(--color-muted);
}
.comment-gallery-info {
    flex: 1;
    min-width: 0;
}
.comment-gallery-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-primary);
    text-decoration: none;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.comment-gallery-name:hover { text-decoration: underline; }
.comment-gallery-meta {
    font-size: 11px;
    color: var(--color-muted);
    margin-top: 2px;
}

/* Proof Review Workflow */
.proof-file-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--color-bg);
    border-radius: 8px;
    margin-bottom: 8px;
    border: 1px solid var(--color-border);
    transition: border-color 0.15s;
}
.proof-file-card.status-approved { border-left: 3px solid #22c55e; }
.proof-file-card.status-revision_requested { border-left: 3px solid #f59e0b; }
.proof-file-card.status-pending_review { border-left: 3px solid var(--color-primary); }
.proof-file-info { flex: 1; min-width: 0; }
.proof-file-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--color-primary);
    text-decoration: none;
}
.proof-file-name:hover { text-decoration: underline; }
.proof-file-meta { font-size: 11px; color: var(--color-muted); margin-top: 4px; }
.proof-status-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 12px;
    white-space: nowrap;
}
.proof-status-badge.pending { background: #dbeafe; color: #1e40af; }
.proof-status-badge.approved { background: #dcfce7; color: #166534; }
.proof-status-badge.revision { background: #fef3c7; color: #92400e; }
.proof-file-actions { display: flex; gap: 6px; flex-shrink: 0; }
.proof-feedback-thread {
    max-height: 300px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--color-border);
}
.proof-feedback-item {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    border-left: 3px solid transparent;
}
.proof-feedback-item.action-approve { background: var(--color-bg); border-left-color: #22c55e; }
.proof-feedback-item.action-request_revision { background: var(--color-bg); border-left-color: #f59e0b; }
.proof-feedback-item.action-comment { background: var(--color-bg); border-left-color: var(--color-muted); }
.proof-feedback-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}
.proof-feedback-author { font-weight: 600; font-size: 12px; }
.proof-feedback-time { font-size: 11px; color: var(--color-muted); }
.proof-feedback-action-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 6px;
}

/* Tracking timeline */
.tracking-event {
    display: flex;
    gap: 12px;
    padding: 8px 0;
    position: relative;
}
.tracking-event:not(:last-child)::before {
    content: '';
    position: absolute;
    left: 5px;
    top: 22px;
    bottom: -8px;
    width: 2px;
    background: #e2e8f0;
}
.tracking-event.latest .tracking-event-desc { font-weight: 600; }
.tracking-event-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 4px;
}
.tracking-event-content { flex: 1; min-width: 0; }
.tracking-event-desc {
    font-size: 13px;
    color: var(--color-text);
}
.tracking-event-meta {
    font-size: 12px;
    color: var(--color-muted);
    margin-top: 2px;
}

/* ---- File Preview & Lightbox ---- */
.file-thumbnail {
    width: 120px;
    height: 120px;
    border-radius: 6px;
    object-fit: contain;
    border: 1px solid var(--color-border);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    flex-shrink: 0;
    background-color: #fff;
    background-image: linear-gradient(45deg, #e5e7eb 25%, transparent 25%),
                      linear-gradient(-45deg, #e5e7eb 25%, transparent 25%),
                      linear-gradient(45deg, transparent 75%, #e5e7eb 75%),
                      linear-gradient(-45deg, transparent 75%, #e5e7eb 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}
/* DST thumbnails get a larger display size (4x area vs generic thumbs) so
   the stitch detail + assigned thread colors are actually readable. The
   checker background is already on .file-thumbnail above; we just scale up.
   Hard min/max lock the footprint so a wide raster (PNG, WEBP, etc.)
   can't stretch the row taller/wider than its peers - object-fit:contain
   still letterboxes the image inside the locked 240x240 square. */
.file-thumbnail.file-thumbnail-dst,
.file-thumbnail-placeholder.file-thumbnail-dst {
    width: 240px;
    height: 240px;
    min-width: 240px;
    min-height: 240px;
    max-width: 240px;
    max-height: 240px;
    object-fit: contain;
    flex: 0 0 240px;
}
.file-thumbnail-placeholder.file-thumbnail-dst {
    font-size: 22px;
}
/* Scope: any thumbnail that lands inside an art-file-row snaps to the
   240 footprint regardless of whether the render path remembered to
   add the -dst modifier class. Prevents one-off renderings (library
   imports, staged previews, legacy rows) from blowing out the row. */
.art-file-row .file-thumbnail,
.art-file-row .file-thumbnail-placeholder {
    width: 240px;
    height: 240px;
    min-width: 240px;
    min-height: 240px;
    max-width: 240px;
    max-height: 240px;
    object-fit: contain;
    flex: 0 0 240px;
}
.file-thumbnail:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.file-thumbnail-placeholder {
    width: 120px;
    height: 120px;
    border-radius: 6px;
    border: 1px solid var(--color-border);
    background: var(--color-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--color-muted);
    flex-shrink: 0;
    cursor: pointer;
}
.file-thumbnail-placeholder:hover {
    background: var(--color-card);
}
.file-thumb-generating {
    flex-direction: column;
    gap: 2px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.thumb-spinner {
    width: 12px;
    height: 12px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: thumb-spin 0.8s linear infinite;
}
@keyframes thumb-spin { to { transform: rotate(360deg); } }

/* Lightbox - file preview modal */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.lightbox-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.68);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.lightbox-content {
    position: relative;
    z-index: 1;
    background: var(--color-card);
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(0,0,0,0.35);
    width: 100%;
    max-width: min(960px, 92vw);
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.lightbox-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-card);
    gap: 16px;
    flex-shrink: 0;
}
.lightbox-title-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}
.lightbox-file-ext {
    flex: 0 0 auto;
    padding: 4px 10px;
    border-radius: 6px;
    background: var(--color-primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    line-height: 1.3;
}
.lightbox-file-ext:empty { display: none; }
.lightbox-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
.lightbox-close {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-muted);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.lightbox-close:hover {
    background: #fee2e2;
    color: #dc2626;
    border-color: #fecaca;
}
.lightbox-body {
    flex: 1 1 auto;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 240px;
    padding: 24px;
    background-color: #ffffff;
    background-image:
        linear-gradient(45deg, #eef2f7 25%, transparent 25%),
        linear-gradient(-45deg, #eef2f7 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #eef2f7 75%),
        linear-gradient(-45deg, transparent 75%, #eef2f7 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}
.lightbox-body > img {
    max-width: 100%;
    max-height: 70vh;
    display: block;
    border-radius: 4px;
    filter: drop-shadow(0 8px 24px rgba(15,23,42,0.18));
}
.lightbox-body iframe {
    width: min(820px, 100%);
    height: 70vh;
    border: none;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(15,23,42,0.12);
}
.lightbox-body .lightbox-unsupported {
    padding: 48px 32px;
    text-align: center;
    color: var(--color-muted);
    background: var(--color-card);
    border-radius: 10px;
    border: 1px solid var(--color-border);
    max-width: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}
.lightbox-body .lightbox-unsupported p { margin: 0; }
.lightbox-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    border-top: 1px solid var(--color-border);
    background: var(--color-card);
    flex-shrink: 0;
    flex-wrap: wrap;
}
.lightbox-meta {
    flex: 1 1 auto;
    font-size: 12px;
    color: var(--color-muted);
    text-align: center;
    min-width: 120px;
}
.lightbox-meta:empty { display: none; }
.lightbox-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
    margin-left: auto;
}

.btn-full { width: 100%; justify-content: center; }

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

.form-group label {
    display:     block;
    font-size:   13px;
    font-weight: 600;
    color:       var(--color-text);
    margin-bottom: 6px;
}

.req { color: #ef4444; font-size: 13px; font-weight: 700; margin-left: 2px; }

.form-group input,
.form-group select,
.form-group textarea {
    width:         100%;
    padding:       9px 12px;
    border:        1px solid var(--color-border);
    border-radius: var(--radius);
    font-size:     14px;
    font-family:   var(--font);
    color:         var(--color-text);
    background:    var(--color-card);
    transition:    border-color 0.15s, box-shadow 0.15s;
    outline:       none;
}
/* Checkboxes/radios inside .form-group inherit the 100%-width input
   styles above by accident, which stretches them edge-to-edge and
   breaks any "<label><input type=checkbox> Label text</label>"
   pattern. Reset to native size + remove the input padding/border. */
.form-group input[type="checkbox"],
.form-group input[type="radio"] {
    width:        auto;
    padding:      0;
    border:       0;
    background:   transparent;
    box-shadow:   none;
    margin-right: 6px;
    vertical-align: middle;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--color-primary);
    box-shadow:   0 0 0 3px rgba(67,97,238,0.12);
}

.optional { font-weight: 400; color: var(--color-muted); }

.checkbox-label {
    display:     flex;
    align-items: center;
    gap:         8px;
    font-size:   14px;
    font-weight: 500;
    cursor:      pointer;
}
.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Base .filter-input — class works anywhere in the app, not only inside
   .filter-bar. Same visual style so inputs stay consistent whether they
   sit in a filter bar, a modal, a form, or a standalone card. */
.filter-input {
    padding:       7px 12px;
    border:        1px solid var(--color-border);
    border-radius: var(--radius);
    font-size:     13px;
    background:    var(--color-card);
    color:         var(--color-text);
    font-family:   var(--font);
    outline:       none;
    transition:    border-color 0.15s, box-shadow 0.15s;
}
.filter-input:focus {
    border-color: var(--color-primary);
    box-shadow:   0 0 0 2px rgba(99,102,241,0.15);
}

.filter-bar select,
.filter-bar .filter-input {
    padding:       7px 12px;
    border:        1px solid var(--color-border);
    border-radius: var(--radius);
    font-size:     13px;
    background:    var(--color-card);
    color:         var(--color-text);
}
.filter-bar select:focus,
.filter-bar .filter-input:focus {
    border-color: var(--color-primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(99,102,241,0.15);
}
.filter-bar select {
    cursor:        pointer;
    outline:       none;
    -webkit-appearance: none;
    appearance: none;
    color: #2d3748 !important;
    background-color: #ffffff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23718096' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}
[data-theme="dark"] .filter-bar select {
    color: #e2e8f0 !important;
    background-color: #1e293b;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
}
.filter-bar select.filter-active,
.filter-bar .filter-input.filter-active {
    border-color: var(--color-primary);
    background:   rgba(99, 102, 241, 0.1);
    box-shadow:   0 0 0 2.5px rgba(99, 102, 241, 0.3);
    font-weight:  600;
}
.filter-typeahead:has(.filter-active) {
    border-color: var(--color-primary);
    background:   rgba(99, 102, 241, 0.1);
    box-shadow:   0 0 0 2.5px rgba(99, 102, 241, 0.3);
}

/* ---- Error Message ---- */
.error-msg {
    background:    #fff5f5;
    color:         var(--color-danger);
    border:        1px solid #feb2b2;
    border-radius: var(--radius);
    padding:       10px 14px;
    font-size:     13px;
    margin-bottom: 14px;
}

.success-msg {
    background:    #f0fff4;
    color:         #276749;
    border:        1px solid #9ae6b4;
    border-radius: var(--radius);
    padding:       10px 14px;
    font-size:     13px;
    margin-bottom: 14px;
}

.hidden { display: none !important; }

/* Pre-paint role gating - the SSR shell tags <html> with `is-anon`
   when the visitor is anonymous. Hiding `.ppd-scoped` and
   `.non-anon` elements via CSS at parse time eliminates the flash
   that used to occur when applyAnonRoleGates() ran post-paint. */
html.is-anon .ppd-scoped,
html.is-anon .non-anon { display: none !important; }
.non-customer { display: none !important; }
/* Inverse of .non-customer: visible only to anon + customer roles. The
   anon path is gated at parse time via the html.is-anon body class so
   there's no flash for shoppers. Authed customers get the class
   stripped by initAuth when role === 'customer'. */
.customer-only { display: none; }
html.is-anon .customer-only { display: revert; }
body.is-customer-role .customer-only { display: revert; }

/* ---- Referral program stats ---- */
.referral-stat {
    text-align: center;
    padding: 14px 10px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 10px;
}
.referral-stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--color-muted);
    font-weight: 700;
    margin-bottom: 6px;
}
.referral-stat-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--color-text);
    line-height: 1;
}

/* ---- Storefront trust strip (Product Gallery + storefront landing) ---- */
.trust-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 14px 20px;
    margin: 0 0 16px;
    background: linear-gradient(135deg, color-mix(in srgb, var(--color-primary), transparent 94%) 0%, color-mix(in srgb, var(--color-primary), transparent 96%) 100%);
    border: 1px solid color-mix(in srgb, var(--color-primary), transparent 80%);
    border-radius: 10px;
    font-size: 13px;
    color: var(--color-text);
}
.trust-strip-item { display: inline-flex; align-items: center; gap: 8px; }
.trust-strip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--color-card);
    color: var(--color-primary);
    border: 1px solid color-mix(in srgb, var(--color-primary), transparent 75%);
    flex-shrink: 0;
}
.trust-strip-text strong { font-weight: 700; }
@media (max-width: 600px) {
    .trust-strip { gap: 10px; padding: 10px 14px; font-size: 12px; }
    .trust-strip-icon { width: 22px; height: 22px; }
    .trust-strip-icon svg { width: 14px; height: 14px; }
}
.ppd-only { display: none; }
.admin-only { display: none; }
.user-admin-only { display: none; }
.ppd-admin-only { display: none; }
.show-ppd-col { display: none; }

/* =============================================
   Login Page  -  Split panel layout
   ============================================= */
.login-page {
    display:    flex;
    flex-direction: column;
    min-height: 100vh;
    background: #0d1126;
    /* Belt-and-suspenders: any decorative element on the marketing pages
       (gradients, off-canvas badges, Stripe-style splits) that briefly
       overshoots the viewport must not push horizontal scroll on mobile. */
    overflow-x: hidden;
    max-width: 100vw;
}
html.login-page-html, .login-page { overflow-x: hidden; }

/* Login top nav bar */
.login-top-nav {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    position: absolute;
    top: 0;
    right: 0;
    z-index: 10;
}
.login-top-nav a {
    color: #94a3b8;
    text-decoration: none;
    font-size: 13px;
    padding: 6px 14px;
    border-radius: 6px;
    transition: all 0.15s;
}
.login-top-nav a:hover {
    color: #fff;
    background: rgba(255,255,255,0.06);
}
.login-top-nav .login-nav-btn {
    background: rgba(255,255,255,0.08);
    color: #e2e8f0;
    font-weight: 600;
    border: 1px solid rgba(255,255,255,0.12);
}
.login-top-nav .login-nav-btn:hover {
    background: rgba(255,255,255,0.14);
    border-color: rgba(255,255,255,0.25);
    color: #fff;
}

/* Light background variant for contact/demo pages */
.login-top-nav-light a {
    color: #4a5568;
}
.login-top-nav-light a:hover {
    color: #1a202c;
    background: rgba(0,0,0,0.04);
}
.login-top-nav-light .login-nav-btn {
    background: #4361ee;
    color: #fff;
    border-color: #4361ee;
}
.login-top-nav-light .login-nav-btn:hover {
    background: #3451d1;
    border-color: #3451d1;
    color: #fff;
}

/* View Pricing button  -  dark bg */
.login-top-nav .login-nav-pricing {
    background: rgba(255,255,255,0.06);
    color: #e2e8f0;
    font-weight: 600;
    border: 1px solid rgba(255,255,255,0.1);
}
.login-top-nav .login-nav-pricing:hover {
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.2);
    color: #fff;
}
/* View Pricing button  -  light bg */
.login-top-nav-light .login-nav-pricing {
    background: rgba(0,0,0,0.03);
    color: #4a5568;
    font-weight: 600;
    border: 1px solid var(--color-border);
}
.login-top-nav-light .login-nav-pricing:hover {
    background: rgba(0,0,0,0.06);
    border-color: #a0aec0;
    color: #1a202c;
}

/* Signup button (green)  -  dark bg */
.login-top-nav .login-nav-signup {
    background: #38a169;
    color: #fff;
    font-weight: 600;
    border: 1px solid #38a169;
}
.login-top-nav .login-nav-signup:hover {
    background: #2f855a;
    border-color: #2f855a;
    color: #fff;
}
/* Signup button  -  light bg */
.login-top-nav-light .login-nav-signup {
    background: #38a169;
    color: #fff;
    border-color: #38a169;
}
.login-top-nav-light .login-nav-signup:hover {
    background: #2f855a;
    border-color: #2f855a;
    color: #fff;
}

.login-split {
    display: flex;
    width:   100%;
    min-height: 100vh;
    flex-shrink: 0;
}

/* ---- Left: Brand / marketing panel ---- */
.login-brand {
    flex:       1 1 50%;
    background: linear-gradient(150deg, #1a1f36 0%, #0d1126 60%, #111827 100%);
    display:    flex;
    align-items: center;
    justify-content: center;
    padding:    60px 56px;
    position:   relative;
    overflow:   hidden;
}

.login-glow {
    position:      absolute;
    border-radius: 50%;
    pointer-events: none;
}
.login-glow-1 {
    width:      700px;
    height:     700px;
    background: radial-gradient(circle, rgba(67,97,238,0.18) 0%, transparent 65%);
    top:        -200px;
    right:      -200px;
}
.login-glow-2 {
    width:      400px;
    height:     400px;
    background: radial-gradient(circle, rgba(124,58,237,0.12) 0%, transparent 65%);
    bottom:     -100px;
    left:       -100px;
}

.login-brand-inner {
    position:   relative;
    z-index:    1;
    max-width:  480px;
    width:      100%;
}

.login-brand-logo {
    display:     flex;
    align-items: center;
    gap:         12px;
    margin-bottom: 52px;
}
.login-brand-mark {
    width:         44px;
    height:        44px;
    border-radius: 10px;
    flex-shrink:   0;
    display:       block;
}
.login-brand-logo span {
    font-size:   18px;
    font-weight: 800;
    color:       #fff;
    letter-spacing: -0.3px;
}

.login-brand-hero {
    margin-bottom: 44px;
}
.login-headline {
    font-size:      clamp(36px, 4.5vw, 52px);
    font-weight:    900;
    line-height:    1.08;
    letter-spacing: -1.5px;
    white-space:    nowrap;
    color:          #fff;
    margin:         0 0 20px;
}
.login-subhead {
    font-size:   16px;
    line-height: 1.65;
    color:       #8892b0;
    margin:      0;
    max-width:   400px;
}

/* Feature list */
.login-features {
    list-style:    none;
    padding:       0;
    margin:        0 0 48px;
    display:       flex;
    flex-direction: column;
    gap:           20px;
}
.login-feature {
    display:     flex;
    align-items: flex-start;
    gap:         16px;
}
.login-feature-icon {
    width:           36px;
    height:          36px;
    border-radius:   8px;
    background:      rgba(67,97,238,0.18);
    border:          1px solid rgba(67,97,238,0.3);
    display:         flex;
    align-items:     center;
    justify-content: center;
    flex-shrink:     0;
    color:           #7b9ef7;
    margin-top:      1px;
}
.login-feature-icon svg {
    width:  18px;
    height: 18px;
}
.login-feature div strong {
    display:     block;
    font-size:   14px;
    font-weight: 700;
    color:       #e2e8f0;
    margin-bottom: 2px;
}
.login-feature div span {
    font-size:   13px;
    line-height: 1.5;
    color:       #6b7a99;
}

/* Bottom divider & tagline */
.login-divider {
    height:       1px;
    background:   rgba(255,255,255,0.07);
    margin-bottom: 16px;
}
.login-tagline {
    font-size:      12px;
    color:          #4a5568;
    letter-spacing: 0.3px;
    margin:         0;
}

/* ---- Trusted logos ---- */
.login-trusted { margin-top: 24px; }
.login-trusted-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #718096;
    margin-bottom: 12px;
}
.login-logos {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.login-logo-pill {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    color: #a0aec0;
    letter-spacing: 0.3px;
}

/* ---- Testimonial ---- */
.login-testimonial {
    margin-top: 24px;
    padding: 20px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
}
.login-quote {
    font-size: 14px;
    line-height: 1.6;
    color: #cbd5e0;
    font-style: italic;
    margin: 0 0 12px;
    quotes: none;
}
.login-quote-author {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.login-quote-author strong {
    font-size: 13px;
    color: #e2e8f0;
}
.login-quote-author span {
    font-size: 11px;
    color: #718096;
}

/* ---- Demo CTA ---- */
.login-cta {
    margin-top: 24px;
}
.login-cta-text {
    font-size: 14px;
    color: #a0aec0;
    margin-bottom: 12px;
}
.login-cta-row {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    align-items: center;
    flex-wrap: wrap;
}
.login-cta-btn {
    display: inline-block;
    padding: 14px 40px;
    background: #4361ee;
    border: 2px solid #4361ee;
    border-radius: 10px;
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
    letter-spacing: 0.2px;
    box-shadow: 0 4px 14px rgba(67, 97, 238, 0.4);
    white-space: nowrap;
}
.login-cta-btn-ghost {
    background: transparent;
    border-color: rgba(255,255,255,0.2);
    box-shadow: none;
}
.login-cta-inline {
    margin-top: 24px;
}
@media (max-width: 600px) {
    .login-cta-row {
        flex-direction: column;
        align-items: stretch;
    }
    .login-cta-btn {
        text-align: center;
        padding: 13px 24px;
        font-size: 15px;
    }
    /* Top nav on public pages - tighten up on small screens */
    .login-top-nav {
        gap: 6px;
        padding: 10px 12px;
    }
    .login-top-nav a {
        font-size: 12px;
        padding: 5px 10px;
    }
    /* Hide less-critical nav links on very small screens, keep Sign In + Demo */
    .login-top-nav .login-nav-pricing { display: none; }
}

/* Testimonial on right (light) panel */
.login-testimonial-right {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    color: #4a5568;
    margin-top: 24px;
    max-width: 420px;
}
.login-testimonial-right .login-quote {
    color: #4a5568;
}
.login-testimonial-right .login-quote-author strong {
    color: #1a202c;
}
.login-testimonial-right .login-quote-author span {
    color: #718096;
}
.login-cta-btn:hover {
    background: #3451d1;
    border-color: #3451d1;
    color: #fff;
    box-shadow: 0 6px 20px rgba(67, 97, 238, 0.5);
    transform: translateY(-1px);
}

/* ---- Contact cards ---- */
.contact-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}
.contact-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
}
a.contact-card:hover {
    border-color: var(--color-primary);
    box-shadow: 0 2px 8px rgba(67, 97, 238, 0.1);
    transform: translateY(-1px);
}
a.contact-card:hover .contact-card-icon {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}
a.contact-card:hover .contact-card-arrow {
    color: var(--color-primary);
    transform: translateX(2px);
}
.contact-card-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(67, 97, 238, 0.08);
    border: 1px solid rgba(67, 97, 238, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--color-primary);
    transition: all 0.2s ease;
}
.contact-card-icon svg {
    width: 18px;
    height: 18px;
}
.contact-card-body {
    flex: 1;
    min-width: 0;
}
.contact-card-body strong {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 2px;
}
.contact-card-body span {
    font-size: 13px;
    color: var(--color-muted);
    line-height: 1.4;
}
.contact-card-arrow {
    color: var(--color-muted);
    flex-shrink: 0;
    transition: all 0.2s ease;
}
.contact-card-static {
    cursor: default;
}

/* ---- Right: Form panel ---- */
.login-form-panel {
    flex:            1 1 50%;
    background:      var(--color-bg);
    display:         flex;
    flex-direction:  column;
    align-items:     center;
    justify-content: center;
    padding:         40px;
}

.login-card {
    background:    var(--color-card);
    border-radius: 12px;
    box-shadow:    var(--shadow-md);
    padding:       40px;
    width:         100%;
    max-width:     380px;
}

.login-logo {
    text-align:    center;
    margin-bottom: 28px;
}
.login-logo h2 {
    font-size:   22px;
    font-weight: 800;
    color:       var(--color-text);
    margin:      0 0 6px;
}
.login-logo p {
    font-size:  13px;
    color:      var(--color-muted);
    margin:     0;
}

/* ---- Account split layout ---- */
.account-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}
@media (max-width: 768px) {
    .account-split { grid-template-columns: 1fr; }
}

/* =============================================================
   Settings shell — sidebar nav + content pane used by My Account
   and (eventually) every account-flyout page. Sidebar lists every
   settings-style page grouped by section header (matching the
   existing flyout dividers); content pane shows the active page.

   Role-gated groups (.ppd-only, .user-admin-only, .admin-only,
   .ppd-admin-only) inherit the global hide rules, so each user
   only sees groups they have permission for.
   ============================================================= */
.settings-shell {
    display:               grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap:                   28px;
    align-items:           start;
}
.settings-sidebar {
    position:        sticky;
    top:             8px;
    display:         flex;
    flex-direction:  column;
    gap:             18px;
    background:      var(--color-card);
    border:          1px solid var(--color-border);
    border-radius:   12px;
    padding:         16px 10px;
    max-height:      calc(100vh - 24px);
    overflow-y:      auto;
}
.settings-sidebar-group {
    display:        flex;
    flex-direction: column;
    gap:            2px;
}
/* Restore role-gating - the rules at line ~6205 (.admin-only / .ppd-only
   / .user-admin-only / .ppd-admin-only { display: none }) get overridden
   by the .settings-sidebar-group { display: flex } above due to identical
   specificity + cascade order. Re-assert hide with a higher-specificity
   selector so the role-gated groups stay hidden when the role class is
   still present (i.e. the user doesn't qualify). */
.settings-sidebar-group.admin-only,
.settings-sidebar-group.ppd-only,
.settings-sidebar-group.ppd-admin-only,
.settings-sidebar-group.user-admin-only,
.settings-sidebar-group.non-customer,
.settings-sidebar-link.admin-only,
.settings-sidebar-link.ppd-only,
.settings-sidebar-link.ppd-admin-only,
.settings-sidebar-link.user-admin-only,
.settings-sidebar-link.non-customer {
    display: none;
}
.settings-sidebar-heading {
    font-size:      11px;
    font-weight:    700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color:          var(--color-muted);
    padding:        2px 10px 6px;
}
.settings-sidebar-link {
    display:         block;
    padding:         8px 10px;
    font-size:       13.5px;
    font-weight:     500;
    color:           var(--color-text);
    text-decoration: none;
    border-radius:   6px;
    transition:      background-color 120ms ease, color 120ms ease;
}
.settings-sidebar-link:hover {
    background: var(--color-bg);
}
.settings-sidebar-link.is-active {
    background:  rgba(99, 102, 241, 0.10);
    color:       var(--color-primary);
    font-weight: 600;
}
[data-theme="dark"] .settings-sidebar-link.is-active {
    background: rgba(129, 140, 248, 0.18);
}

/* Credits link indicator: GOAT crown chip or live credit count badge. */
.settings-nav-credits-ind {
    margin-left: 8px;
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
}
.settings-nav-goat-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}
.settings-nav-count-badge {
    display: inline-flex;
    align-items: center;
    min-width: 22px;
    justify-content: center;
    padding: 1px 7px;
    background: var(--color-primary);
    color: #fff;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.4;
}

.settings-content {
    min-width: 0;
}
@media (max-width: 768px) {
    .settings-shell {
        grid-template-columns: 1fr;
        gap:                   16px;
    }
    .settings-sidebar {
        position:   static;
        max-height: none;
        padding:    12px 8px;
        gap:        12px;
    }
}

/* ---- Account Credits Card ---- */
.acct-credits-card {
    margin-bottom:  16px;
    border-radius:  16px;
    overflow:       hidden;
    box-shadow:     0 4px 32px rgba(0,0,0,0.1), 0 1px 4px rgba(0,0,0,0.05);
    border:         1px solid rgba(0,0,0,0.08);
    background:     #fff;
}
[data-theme="dark"] .acct-credits-card {
    background:   var(--color-card);
    border-color: var(--color-border);
    box-shadow:   0 4px 32px rgba(0,0,0,0.3);
}
/* Hero */
.acct-credits-hero {
    position:   relative;
    overflow:   hidden;
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 55%, #2e1065 100%);
    padding:    24px 24px 0;
}
.acct-credits-glow {
    position:   absolute;
    inset:      0;
    background: radial-gradient(ellipse at 80% 25%, rgba(139,92,246,0.4) 0%, transparent 58%),
                radial-gradient(ellipse at 10% 85%, rgba(13,148,136,0.22) 0%, transparent 52%);
    pointer-events: none;
}
.acct-credits-hero-body {
    position:        relative;
    display:         flex;
    align-items:     flex-start;
    justify-content: space-between;
    gap:             12px;
}
.acct-credits-eyebrow {
    font-size:      28px;
    font-weight:    900;
    letter-spacing: 1px;
    text-transform: uppercase;
    color:          rgba(255,255,255,0.9);
    margin-bottom:  8px;
}
.acct-credits-balance-row {
    display:     flex;
    align-items: baseline;
    gap:         10px;
}
.acct-credits-number {
    font-size:      56px;
    font-weight:    900;
    line-height:    1;
    color:          #fff;
    letter-spacing: -3px;
}
.acct-credits-unit {
    font-size:      16px;
    color:          rgba(255,255,255,0.38);
    font-weight:    500;
    padding-bottom: 4px;
}
.acct-credits-sub {
    font-size:  12px;
    color:      rgba(255,255,255,0.32);
    margin-top: 6px;
}
.acct-credits-sparkle {
    font-size:  28px;
    line-height: 1;
    opacity:    0.55;
    margin-top: 2px;
    flex-shrink: 0;
    filter: drop-shadow(0 0 12px rgba(139,92,246,0.6));
}
/* Inline mini-stats row */
.acct-credits-mini-stats {
    position:    relative;
    display:     flex;
    align-items: center;
    gap:         6px;
    margin-top:  18px;
    padding:     12px 0 14px;
    flex-wrap:   wrap;
}
.acct-mini-num {
    font-size:   13px;
    font-weight: 700;
    color:       rgba(255,255,255,0.65);
}
.acct-mini-num-remaining { color: #c084fc; }
.acct-mini-label {
    font-size: 12px;
    color:     rgba(255,255,255,0.32);
}
.acct-mini-sep {
    width:      1px;
    height:     12px;
    background: rgba(255,255,255,0.14);
    margin:     0 4px;
    flex-shrink: 0;
}
/* Progress bar  -  flush to hero bottom */
.acct-credits-bar-wrap {
    height:   3px;
    background: rgba(255,255,255,0.07);
    overflow: hidden;
}
.acct-credits-bar {
    height:     3px;
    background: linear-gradient(90deg, #0d9488, #7c3aed, #c084fc);
    transition: width 0.8s cubic-bezier(0.4,0,0.2,1);
}
/* Shop section  -  light background */
.acct-credits-shop {
    background:  #f8f7ff;
    padding:     20px 18px 16px;
    border-top:  1px solid rgba(0,0,0,0.05);
}
[data-theme="dark"] .acct-credits-shop {
    background:  color-mix(in srgb, #7c3aed 5%, var(--color-card));
    border-top:  1px solid var(--color-border);
}
.acct-credits-shop-label {
    font-size:      11px;
    font-weight:    700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color:          var(--color-muted);
    margin-bottom:  12px;
}
/* Tier cards */
.acct-credits-tiers {
    display:               grid;
    grid-template-columns: repeat(3, 1fr);
    gap:                   10px;
}
.acct-credits-tier {
    position:      relative;
    padding:       18px 12px 16px;
    text-align:    center;
    border-radius: 12px;
    border:        1.5px solid var(--color-border);
    background:    #fff;
    transition:    transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
[data-theme="dark"] .acct-credits-tier { background: var(--color-surface); }
.acct-credits-tier:hover {
    transform:   translateY(-2px);
    box-shadow:  0 6px 20px rgba(0,0,0,0.07);
    border-color: #c4b5fd;
}
.acct-credits-tier-featured {
    border-color: #7c3aed;
    background:   linear-gradient(160deg, #f5f3ff 0%, #fdf4ff 100%);
    box-shadow:   0 4px 20px rgba(124,58,237,0.13);
}
[data-theme="dark"] .acct-credits-tier-featured {
    background: color-mix(in srgb, #7c3aed 14%, var(--color-surface));
}
.acct-credits-tier-featured:hover {
    transform:  translateY(-3px);
    box-shadow: 0 10px 32px rgba(124,58,237,0.22);
}
.acct-credits-tier-badge {
    position:       absolute;
    top:            -11px;
    left:           50%;
    transform:      translateX(-50%);
    background:     linear-gradient(90deg, #6d28d9, #8b5cf6);
    color:          #fff;
    font-size:      9px;
    font-weight:    800;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    padding:        3px 10px;
    border-radius:  100px;
    white-space:    nowrap;
    box-shadow:     0 2px 8px rgba(109,40,217,0.38);
}
.acct-credits-tier-name {
    font-size:      10px;
    font-weight:    700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color:          var(--color-muted);
    margin-bottom:  8px;
    margin-top:     6px;
}
.acct-credits-tier-featured .acct-credits-tier-name {
    color:      #6d28d9;
    margin-top: 14px;
}
.acct-credits-tier-amt {
    font-size:      32px;
    font-weight:    900;
    color:          var(--color-text);
    line-height:    1;
    letter-spacing: -1px;
}
.acct-credits-tier-featured .acct-credits-tier-amt { color: #5b21b6; }
.acct-credits-tier-unit {
    font-size:     11px;
    font-weight:   600;
    color:         var(--color-muted);
    margin-bottom: 10px;
    margin-top:    2px;
}
.acct-credits-tier-price {
    font-size:     15px;
    font-weight:   800;
    color:         var(--color-text);
    margin-bottom: 2px;
}
.acct-credits-tier-featured .acct-credits-tier-price { color: #4c1d95; }
.acct-credits-tier-per {
    font-size:     10px;
    color:         var(--color-muted);
    margin-bottom: 12px;
    line-height:   1.4;
}
.acct-credits-tier-btn {
    width:         100%;
    padding:       8px 12px;
    border-radius: 8px;
    border:        1.5px solid var(--color-border);
    background:    #fff;
    color:         var(--color-text);
    font-size:     12px;
    font-weight:   700;
    cursor:        pointer;
    transition:    background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
[data-theme="dark"] .acct-credits-tier-btn { background: var(--color-surface); }
.acct-credits-tier-btn:hover {
    background:   #f5f3ff;
    border-color: #7c3aed;
    color:        #6d28d9;
}
.acct-credits-tier-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.acct-credits-tier-featured .acct-credits-tier-btn {
    background:   linear-gradient(135deg, #6d28d9, #8b5cf6);
    border-color: transparent;
    color:        #fff;
    box-shadow:   0 4px 14px rgba(109,40,217,0.32);
}
.acct-credits-tier-featured .acct-credits-tier-btn:hover {
    background:  linear-gradient(135deg, #5b21b6, #7c3aed);
    color:       #fff;
    box-shadow:  0 6px 20px rgba(109,40,217,0.44);
}
.acct-credits-footnote {
    font-size:   11px;
    color:       var(--color-muted);
    text-align:  center;
    margin-top:  14px;
    opacity:     0.65;
}

/* ---- Credits feature explainer ---- */
.acct-credits-features {
    margin-top: 12px;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    padding: 20px;
}
.acct-cf-heading {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--color-muted);
    margin-bottom: 16px;
}
.acct-cf-item {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}
.acct-cf-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
.acct-cf-body {
    flex: 1;
    min-width: 0;
}
.acct-cf-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 5px;
}
.acct-cf-desc {
    font-size: 12px;
    color: var(--color-muted);
    line-height: 1.6;
    margin-bottom: 8px;
}
.acct-cf-link {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-primary);
    text-decoration: none;
}
.acct-cf-link:hover { text-decoration: underline; }
.acct-cf-divider {
    height: 1px;
    background: var(--color-border);
    margin: 16px 0;
}
.acct-cf-footnote {
    font-size: 11px;
    color: var(--color-muted);
    text-align: center;
    margin-top: 16px;
    opacity: 0.65;
}

/* ---- Email Preferences ---- */
.email-pref-master {
    padding: 12px 16px;
    background: color-mix(in srgb, var(--color-primary), var(--color-card) 92%);
    border: 1px solid color-mix(in srgb, var(--color-primary), transparent 75%);
    border-radius: 8px;
}
.email-pref-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.email-pref-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.12s;
}
.email-pref-toggle:hover {
    background: var(--color-bg);
}
.email-pref-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    accent-color: var(--color-primary);
    cursor: pointer;
}
.email-pref-toggle input[type="checkbox"]:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.email-pref-label {
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.email-pref-label strong {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
}
.email-pref-label span {
    font-size: 12px;
    color: var(--color-muted);
}

/* ---- Login page footer ---- */
.login-page-footer {
    background: #080b19;
    text-align: center;
    padding: 24px 20px;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.login-page-footer p {
    font-size: 12px;
    color: #4a5568;
    letter-spacing: 0.3px;
    margin: 0;
}

/* ---- Welcome modal (first visit only) ---- */
.welcome-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    opacity: 0;
    animation: welcomeFadeIn 0.5s ease forwards;
}
.welcome-overlay.welcome-out {
    animation: welcomeFadeOut 0.4s ease forwards;
}
@keyframes welcomeFadeIn { to { opacity: 1; } }
@keyframes welcomeFadeOut { to { opacity: 0; } }

.welcome-modal {
    position: relative;
    max-width: 680px;
    width: 90%;
    background: linear-gradient(160deg, #12162e 0%, #0d1126 40%, #1a1040 100%);
    border-radius: 24px;
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 40px 120px rgba(0,0,0,0.6), 0 0 80px rgba(67,97,238,0.15);
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    animation: welcomeSlideUp 0.5s cubic-bezier(0.16,1,0.3,1) 0.1s forwards;
}
.welcome-overlay.welcome-out .welcome-modal {
    animation: welcomeSlideDown 0.35s ease forwards;
}
@keyframes welcomeSlideUp { to { transform: scale(1) translateY(0); } }
@keyframes welcomeSlideDown { to { transform: scale(0.95) translateY(30px); opacity: 0; } }

.welcome-modal-glow {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}
.welcome-modal-glow-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(67,97,238,0.25) 0%, transparent 60%);
    top: -200px;
    right: -150px;
}
.welcome-modal-glow-2 {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgba(124,58,237,0.18) 0%, transparent 60%);
    bottom: -100px;
    left: -80px;
}
.welcome-modal-glow-3 {
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(236,72,153,0.12) 0%, transparent 60%);
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.welcome-modal-body {
    position: relative;
    z-index: 1;
    padding: 56px 48px 48px;
    text-align: center;
}

.welcome-logo-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: 18px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 28px;
    box-shadow: 0 8px 32px rgba(67,97,238,0.2);
}
.welcome-logo-wrap img {
    width: 52px;
    height: 52px;
    border-radius: 10px;
}

.welcome-eyebrow {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: #818cf8;
    margin: 0 0 16px;
}

.welcome-headline {
    font-size: clamp(28px, 5vw, 42px);
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: -1px;
    color: #fff;
    margin: 0 0 16px;
    background: linear-gradient(135deg, #fff 30%, #818cf8 70%, #c084fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-subtitle {
    font-size: 15px;
    line-height: 1.65;
    color: rgba(255,255,255,0.45);
    margin: 0 auto 32px;
    max-width: 440px;
}

.welcome-features {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 36px;
}
.welcome-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 100px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    font-size: 12px;
    font-weight: 600;
    color: rgba(255,255,255,0.6);
    white-space: nowrap;
}
.welcome-chip svg {
    width: 14px;
    height: 14px;
    color: #818cf8;
    flex-shrink: 0;
}

.welcome-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.08) 50%, transparent 100%);
    margin-bottom: 28px;
}

.welcome-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 40px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #4361ee 0%, #7c3aed 100%);
    box-shadow: 0 4px 24px rgba(67,97,238,0.4);
    transition: transform 0.2s, box-shadow 0.2s;
    letter-spacing: -0.2px;
}
.welcome-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 32px rgba(67,97,238,0.55);
}
.welcome-btn:active {
    transform: translateY(0);
}

.welcome-dismiss-text {
    display: block;
    margin-top: 14px;
    font-size: 12px;
    color: rgba(255,255,255,0.25);
}

@media (max-width: 600px) {
    .welcome-modal-body { padding: 40px 24px 36px; }
    .welcome-features { gap: 8px; }
    .welcome-chip { padding: 6px 12px; font-size: 11px; }
}

/* ---- Users view toggle (Table | Org Chart) ---- */
.view-toggle-group {
    display:       flex;
    border:        1px solid var(--color-border);
    border-radius: 8px;
    overflow:      hidden;
}
.view-toggle-btn {
    background:  transparent;
    border:      none;
    padding:     6px 10px;
    cursor:      pointer;
    color:       var(--color-muted);
    display:     flex;
    align-items: center;
    transition:  background 0.15s, color 0.15s;
    line-height: 1;
}
.view-toggle-btn + .view-toggle-btn {
    border-left: 1px solid var(--color-border);
}
.view-toggle-btn.active {
    background: #b45309;
    color:      #fff;
}
.view-toggle-btn:not(.active):hover {
    background: var(--color-bg);
    color:      var(--color-text);
}

/* ---- PPD Org Chart ---- */
.org-filter-row {
    display:       flex;
    gap:           10px;
    margin-bottom: 28px;
}
.org-ppd-section {
    display:        flex;
    flex-direction: column;
    align-items:    center;
    margin-bottom:  52px;
}
.org-ppd-root {
    width:         100%;
    background:    var(--color-card);
    border:        2px solid rgba(180,83,9,0.3);
    border-radius: 14px;
    padding:       18px 24px;
    display:       flex;
    align-items:   center;
    justify-content: space-between;
    gap:           16px;
    box-shadow:    0 2px 12px rgba(180,83,9,0.07);
    position:      relative;
}
.org-ppd-root-accent {
    position:      absolute;
    left:          0;
    top:           0;
    bottom:        0;
    width:         4px;
    background:    linear-gradient(180deg, #b45309, #d97706);
    border-radius: 14px 0 0 14px;
}
.org-ppd-root-name {
    font-size:   18px;
    font-weight: 800;
    color:       var(--color-text);
    line-height: 1.2;
}
.org-ppd-root-meta {
    display:     flex;
    align-items: center;
    gap:         10px;
    margin-top:  7px;
    flex-wrap:   wrap;
}
.org-ppd-root-stat {
    font-size: 13px;
    color:     var(--color-muted);
}
.org-ppd-root-right {
    flex-shrink: 0;
    display:     flex;
    flex-direction: column;
    align-items: flex-end;
    gap:         6px;
}
.org-vline {
    width:      2px;
    height:     28px;
    background: var(--color-border);
}
.org-tier-box {
    width:         100%;
    border:        1px solid var(--color-border);
    border-radius: 12px;
    background:    var(--color-bg);
    padding:       16px 20px;
}
.org-tier-box.admins-tier {
    border-top:  2px solid rgba(180,83,9,0.2);
}
.org-tier-box.users-tier {
    border-top:  2px solid rgba(59,130,246,0.2);
}
.org-tier-header {
    display:     flex;
    align-items: center;
    gap:         8px;
    margin-bottom: 14px;
}
.org-tier-label {
    font-size:      11px;
    font-weight:    700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color:          var(--color-muted);
}
.org-tier-count {
    font-size:     11px;
    font-weight:   700;
    background:    var(--color-border);
    color:         var(--color-muted);
    border-radius: 10px;
    padding:       1px 7px;
    min-width:     20px;
    text-align:    center;
}
.org-people-wrap {
    display:   flex;
    flex-wrap: wrap;
    gap:       10px;
}
.org-person-card {
    display:     flex;
    align-items: center;
    gap:         10px;
    background:  var(--color-card);
    border:      1px solid var(--color-border);
    border-radius: 10px;
    padding:     11px 14px;
    transition:  box-shadow 0.15s, border-color 0.15s;
}
.org-person-card.user-tier {
    padding: 8px 12px;
}
.org-person-card.inactive {
    opacity: 0.5;
}
.org-person-avatar {
    width:           36px;
    height:          36px;
    border-radius:   50%;
    color:           #fff;
    font-size:       13px;
    font-weight:     700;
    display:         flex;
    align-items:     center;
    justify-content: center;
    flex-shrink:     0;
}
.org-person-card.user-tier .org-person-avatar {
    width:     30px;
    height:    30px;
    font-size: 11px;
}
.org-person-name {
    font-size:   13px;
    font-weight: 600;
    color:       var(--color-text);
    line-height: 1.3;
    display:     flex;
    align-items: center;
    gap:         5px;
}
.org-person-email {
    font-size:  12px;
    color:      var(--color-muted);
    margin-top: 2px;
    line-height: 1.3;
}
.org-person-status {
    width:         7px;
    height:        7px;
    border-radius: 50%;
    display:       inline-block;
    flex-shrink:   0;
}
.org-person-status.active   { background: #22c55e; }
.org-person-status.inactive { background: #94a3b8; }
.org-empty-tier {
    font-size:  13px;
    color:      var(--color-muted);
    font-style: italic;
    padding:    4px 0;
}

/* ---- Nav link row (link + help button side by side) ---- */
.nav-link-row {
    display:     flex;
    align-items: center;
}
.nav-link-row .nav-link {
    flex: 1;
}
.nav-help-btn {
    flex-shrink:     0;
    width:           18px;
    height:          18px;
    border-radius:   50%;
    border:          1.5px solid var(--color-border);
    background:      transparent;
    color:           var(--color-muted);
    font-size:       10px;
    font-weight:     700;
    line-height:     1;
    cursor:          pointer;
    display:         flex;
    align-items:     center;
    justify-content: center;
    margin-right:    10px;
    transition:      border-color 0.15s, color 0.15s, background 0.15s;
}
.nav-help-btn:hover {
    border-color: #f59e0b;
    color:        #f59e0b;
    background:   rgba(245,158,11,0.08);
}

/* ---- Capture Tool Help Modal ---- */
.capture-help-modal .modal-box {
    max-width: 640px;
    padding:   0;
    overflow:  hidden;
}
.capture-help-hero {
    background:  linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f2d1f 100%);
    padding:     32px 32px 28px;
    position:    relative;
    overflow:    hidden;
}
.capture-help-hero::before {
    content:       '';
    position:      absolute;
    top:           -40px;
    right:         -40px;
    width:         180px;
    height:        180px;
    border-radius: 50%;
    background:    radial-gradient(circle, rgba(245,158,11,0.18) 0%, transparent 70%);
}
.capture-help-hero::after {
    content:       '';
    position:      absolute;
    bottom:        -30px;
    left:          40px;
    width:         120px;
    height:        120px;
    border-radius: 50%;
    background:    radial-gradient(circle, rgba(34,197,94,0.12) 0%, transparent 70%);
}
.capture-help-icon {
    font-size:    40px;
    line-height:  1;
    margin-bottom: 12px;
    position:     relative;
    z-index:      1;
}
.capture-help-title {
    font-size:   22px;
    font-weight: 800;
    color:       #fff;
    margin:      0 0 6px;
    position:    relative;
    z-index:     1;
}
.capture-help-tagline {
    font-size:   14px;
    color:       #94a3b8;
    margin:      0;
    position:    relative;
    z-index:     1;
    line-height: 1.5;
}
.capture-help-body {
    padding: 24px 28px 28px;
}
.capture-help-features {
    display:               grid;
    grid-template-columns: 1fr 1fr;
    gap:                   12px;
    margin-bottom:         24px;
}
.capture-help-feature {
    background:    var(--color-bg);
    border:        1px solid var(--color-border);
    border-radius: 10px;
    padding:       14px;
}
.capture-help-feature-icon {
    font-size:     20px;
    margin-bottom: 6px;
}
.capture-help-feature-label {
    font-size:   12px;
    font-weight: 700;
    color:       var(--color-text);
    margin:      0 0 3px;
}
.capture-help-feature-desc {
    font-size:   12px;
    color:       var(--color-muted);
    margin:      0;
    line-height: 1.4;
}
.capture-help-steps {
    background:    var(--color-bg);
    border:        1px solid var(--color-border);
    border-radius: 10px;
    padding:       16px;
    margin-bottom: 20px;
}
.capture-help-steps-title {
    font-size:     11px;
    font-weight:   700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color:         var(--color-muted);
    margin:        0 0 12px;
}
.capture-help-step {
    display:       flex;
    align-items:   flex-start;
    gap:           10px;
    margin-bottom: 10px;
}
.capture-help-step:last-child { margin-bottom: 0; }
.capture-help-step-num {
    flex-shrink:     0;
    width:           22px;
    height:          22px;
    border-radius:   50%;
    background:      linear-gradient(135deg, #f59e0b, #d97706);
    color:           #fff;
    font-size:       11px;
    font-weight:     800;
    display:         flex;
    align-items:     center;
    justify-content: center;
    margin-top:      1px;
}
.capture-help-step-text {
    font-size:   13px;
    color:       var(--color-text);
    line-height: 1.5;
}
.capture-help-step-text strong { color: var(--color-text); font-weight: 700; }
.capture-help-credit-note {
    display:       flex;
    align-items:   center;
    gap:           8px;
    background:    rgba(245,158,11,0.07);
    border:        1px solid rgba(245,158,11,0.2);
    border-radius: 8px;
    padding:       10px 14px;
    font-size:     13px;
    color:         var(--color-text);
    margin-bottom: 20px;
}
.capture-help-credit-note span { color: var(--color-muted); }
.capture-help-footer {
    display:         flex;
    justify-content: flex-end;
    gap:             10px;
}

/* ─── AI Mockup: design-file picker tiles ─────────────────────────── */
.mockup-art-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--color-card);
    border: 2px solid var(--color-border);
    border-radius: 6px;
    padding: 6px;
    cursor: pointer;
    transition: border-color 0.1s, background 0.1s;
    overflow: hidden;
}
.mockup-art-tile:hover { border-color: var(--color-primary); }
.mockup-art-tile.is-selected {
    border-color: var(--color-primary);
    background: color-mix(in srgb, var(--color-primary), transparent 92%);
}
.mockup-art-thumb {
    aspect-ratio: 1 / 1;
    background: #f8fafc;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 4px;
}
.mockup-art-name {
    font-size: 10px;
    color: var(--color-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

/* ─── AI Mockup: generating animation ─────────────────────────────────
   Shown in place of the mockup thumbnail while the backend is busy.
   Three layered effects: a slow diagonal sheen sweep, a pulsing violet
   orb at the centre, and a slowly-rotating ⚡ glyph with animated dots
   for a "thinking" feel. All pure CSS, no JS frame cost. */
.mockup-generating {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: 6px;
    overflow: hidden;
    background: linear-gradient(135deg, #0f0f23 0%, #1e1b4b 50%, #0f172a 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #c7d2fe;
}
.mockup-generating-sheen {
    position: absolute;
    inset: 0;
    background: linear-gradient(115deg,
        transparent 0%,
        transparent 35%,
        rgba(167, 139, 250, 0.22) 50%,
        transparent 65%,
        transparent 100%);
    background-size: 220% 220%;
    animation: mockupSheen 2.4s ease-in-out infinite;
    pointer-events: none;
}
@keyframes mockupSheen {
    0%   { background-position: 130% 130%; }
    100% { background-position: -30% -30%; }
}
.mockup-generating-orb {
    position: relative;
    width: 38%;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, rgba(124, 58, 237, 0.55) 0%, rgba(79, 70, 229, 0.25) 60%, transparent 75%);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: mockupOrbPulse 1.8s ease-in-out infinite;
}
@keyframes mockupOrbPulse {
    0%, 100% { transform: scale(0.92); filter: blur(0.5px); }
    50%      { transform: scale(1.08); filter: blur(0); }
}
.mockup-generating-spark {
    font-size: 24px;
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.9), 0 0 22px rgba(167, 139, 250, 0.9);
    animation: mockupSparkSpin 3.6s linear infinite;
    display: inline-block;
}
@keyframes mockupSparkSpin {
    0%   { transform: rotate(0deg)   scale(1); }
    50%  { transform: rotate(180deg) scale(1.15); }
    100% { transform: rotate(360deg) scale(1); }
}
.mockup-generating-label {
    position: relative;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #ffffff;
    display: flex;
    align-items: baseline;
    gap: 2px;
}
.mockup-generating-dots {
    display: inline-flex;
    gap: 2px;
    padding-left: 2px;
}
.mockup-generating-dots i {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: currentColor;
    display: inline-block;
    opacity: 0.2;
    animation: mockupDot 1.2s ease-in-out infinite;
}
.mockup-generating-dots i:nth-child(2) { animation-delay: 0.2s; }
.mockup-generating-dots i:nth-child(3) { animation-delay: 0.4s; }
@keyframes mockupDot {
    0%, 100% { opacity: 0.2; transform: translateY(0); }
    50%      { opacity: 1;   transform: translateY(-2px); }
}

/* ---- Generic "AI" capability marker (nav items, headers, anywhere
   an AI-powered feature needs flagging). Distinct from capture-nav-badge
   so it reads as a capability tag rather than a promo badge. */
.ai-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.6px;
    color: #fff;
    background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);
    vertical-align: middle;
    line-height: 1.3;
}

/* ---- Capture Tool nav badge animation ---- */
.capture-nav-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.8px;
    color: #fff;
    background: linear-gradient(135deg, #059669 0%, #22c55e 100%);
    box-shadow: 0 0 10px rgba(5,150,105,0.4), 0 0 20px rgba(34,197,94,0.15);
    animation: captureBadgePulse 2.5s ease-in-out infinite;
    vertical-align: middle;
    position: relative;
}
.capture-nav-badge::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 6px;
    background: linear-gradient(135deg, #059669, #22c55e, #059669);
    z-index: -1;
    opacity: 0.4;
    filter: blur(4px);
    animation: captureBadgeGlow 2.5s ease-in-out infinite;
}
@keyframes captureBadgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.06); }
}
@keyframes captureBadgeGlow {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.6; }
}

/* ---- Capture Tool Hero Animation ---- */
.ct-hero {
    position: relative;
    background: linear-gradient(135deg, #0d1126 0%, #1a1040 40%, #0d1126 100%);
    border-radius: 20px;
    padding: 48px 40px;
    margin-bottom: 32px;
    overflow: hidden;
}
.ct-hero-glow { position: absolute; border-radius: 50%; pointer-events: none; }
.ct-hero-glow-1 { width: 400px; height: 400px; background: radial-gradient(circle, rgba(67,97,238,0.2) 0%, transparent 60%); top: -150px; right: -100px; }
.ct-hero-glow-2 { width: 300px; height: 300px; background: radial-gradient(circle, rgba(124,58,237,0.15) 0%, transparent 60%); bottom: -100px; left: -50px; }
.ct-hero-glow-3 { width: 200px; height: 200px; background: radial-gradient(circle, rgba(236,72,153,0.1) 0%, transparent 60%); top: 50%; left: 40%; transform: translate(-50%,-50%); }

.ct-hero-content { position: relative; z-index: 1; display: flex; align-items: center; gap: 40px; }
.ct-hero-text { flex: 1; min-width: 300px; }
.ct-hero-eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: 2.5px; color: #818cf8; font-weight: 700; margin-bottom: 12px; }
.ct-hero-headline { font-size: 32px; font-weight: 900; color: #fff; line-height: 1.15; margin: 0 0 16px; letter-spacing: -0.5px; }
.ct-hero-accent { background: linear-gradient(135deg, #818cf8, #c084fc); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.ct-hero-desc { font-size: 14px; color: rgba(255,255,255,0.45); line-height: 1.7; margin: 0 0 24px; }
.ct-hero-stats { display: flex; gap: 24px; }
.ct-hero-stat { display: flex; flex-direction: column; }
.ct-hero-stat-num { font-size: 22px; font-weight: 900; color: #fff; letter-spacing: -0.5px; }
.ct-hero-stat-label { font-size: 11px; color: rgba(255,255,255,0.35); font-weight: 500; }

.ct-hero-animation { flex-shrink: 0; width: 280px; height: 220px; position: relative; }

/* Animation steps */
.ct-anim-step { position: absolute; inset: 0; opacity: 0; }
.ct-anim-step-1 { animation: ctStep1 8s ease infinite; }
.ct-anim-step-2 { animation: ctStep2 8s ease infinite; }
.ct-anim-step-3 { animation: ctStep3 8s ease infinite; }

@keyframes ctStep1 { 0%,5% { opacity: 0; transform: translateY(10px); } 8%,35% { opacity: 1; transform: translateY(0); } 38%,100% { opacity: 0; transform: translateY(-10px); } }
@keyframes ctStep2 { 0%,35% { opacity: 0; } 40%,60% { opacity: 1; } 65%,100% { opacity: 0; } }
@keyframes ctStep3 { 0%,62% { opacity: 0; transform: scale(0.9); } 68%,92% { opacity: 1; transform: scale(1); } 96%,100% { opacity: 0; transform: scale(0.95); } }

/* Stage 1: Browser mockup */
.ct-anim-browser { background: #fff; border-radius: 10px; box-shadow: 0 12px 40px rgba(0,0,0,0.4); overflow: hidden; height: 100%; display: flex; flex-direction: column; }
.ct-anim-browser-bar { background: #f3f4f6; padding: 8px 10px; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid #e5e7eb; }
.ct-anim-dots { display: flex; gap: 4px; }
.ct-anim-dots span { width: 7px; height: 7px; border-radius: 50%; }
.ct-anim-dots span:nth-child(1) { background: #ef4444; }
.ct-anim-dots span:nth-child(2) { background: #fbbf24; }
.ct-anim-dots span:nth-child(3) { background: #22c55e; }
.ct-anim-url { flex: 1; background: #fff; border-radius: 4px; padding: 3px 8px; font-size: 9px; color: #6b7280; border: 1px solid #e5e7eb; }
.ct-anim-page { flex: 1; padding: 12px; display: flex; gap: 10px; position: relative; }
.ct-anim-product-img { width: 70px; height: 70px; border-radius: 6px; background: linear-gradient(135deg, #e0e7ff, #c7d2fe); flex-shrink: 0; }
.ct-anim-product-info { flex: 1; display: flex; flex-direction: column; gap: 5px; }
.ct-anim-product-name { height: 10px; width: 90%; border-radius: 3px; background: #e5e7eb; }
.ct-anim-product-sku { height: 8px; width: 50%; border-radius: 3px; background: #f3f4f6; }
.ct-anim-product-price { height: 10px; width: 65%; border-radius: 3px; background: #dbeafe; }
.ct-anim-product-price-sm { width: 45%; }
.ct-anim-product-colors { display: flex; gap: 3px; margin-top: 2px; }
.ct-anim-product-colors span { width: 10px; height: 10px; border-radius: 50%; }

/* Scan line */
.ct-anim-scan-line {
    position: absolute; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg, transparent, #4361ee, #7c3aed, transparent);
    box-shadow: 0 0 12px rgba(67,97,238,0.5);
    top: 30%; animation: ctScan 8s ease infinite;
}
@keyframes ctScan { 0%,8% { top: 25%; opacity: 0; } 12% { opacity: 1; } 15%,32% { top: 85%; opacity: 1; } 35% { opacity: 0; } 36%,100% { opacity: 0; top: 25%; } }

/* Stage 2: Particles */
.ct-anim-particles { display: flex; align-items: center; justify-content: center; }
.ct-anim-particle {
    position: absolute; padding: 4px 10px; border-radius: 6px;
    font-size: 10px; font-weight: 700; color: #fff;
    background: linear-gradient(135deg, #4361ee, #7c3aed);
    box-shadow: 0 4px 16px rgba(67,97,238,0.3);
}
.ct-anim-p1 { top: 20%; left: 15%; animation: ctFloat 3s ease-in-out infinite; }
.ct-anim-p2 { top: 50%; left: 60%; animation: ctFloat 3s ease-in-out 0.4s infinite; }
.ct-anim-p3 { top: 70%; left: 20%; animation: ctFloat 3s ease-in-out 0.8s infinite; }
.ct-anim-p4 { top: 30%; left: 55%; animation: ctFloat 3s ease-in-out 1.2s infinite; background: linear-gradient(135deg, #059669, #22c55e); }
.ct-anim-p5 { top: 65%; left: 50%; animation: ctFloat 3s ease-in-out 0.6s infinite; background: linear-gradient(135deg, #f59e0b, #f97316); }
.ct-anim-ai-badge {
    position: absolute; top: 42%; left: 38%;
    width: 44px; height: 44px; border-radius: 12px;
    background: linear-gradient(135deg, #4361ee, #7c3aed);
    color: #fff; font-size: 16px; font-weight: 900;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 30px rgba(67,97,238,0.5), 0 0 60px rgba(124,58,237,0.2);
    animation: ctPulseAI 2s ease-in-out infinite;
}
@keyframes ctFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes ctPulseAI { 0%,100% { transform: scale(1); box-shadow: 0 0 30px rgba(67,97,238,0.5); } 50% { transform: scale(1.08); box-shadow: 0 0 50px rgba(67,97,238,0.7); } }

/* Stage 3: Result card */
.ct-anim-result { display: flex; align-items: center; justify-content: center; }
.ct-anim-result-card {
    background: #fff; border-radius: 12px; width: 220px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.3); overflow: visible; position: relative;
}
.ct-anim-result-header {
    background: #1a1f36; padding: 8px 12px;
    display: flex; align-items: center; gap: 6px;
    font-size: 10px; font-weight: 800; color: #fff;
    border-radius: 12px 12px 0 0;
}
.ct-anim-result-logo { width: 16px; height: 16px; border-radius: 4px; background: #4361ee; }
.ct-anim-result-body { padding: 12px; display: flex; gap: 10px; }
.ct-anim-result-img { width: 50px; height: 50px; border-radius: 6px; background: linear-gradient(135deg, #e0e7ff, #c7d2fe); flex-shrink: 0; }
.ct-anim-result-details { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.ct-anim-result-name { height: 9px; width: 85%; border-radius: 3px; background: #1a1f36; }
.ct-anim-result-row { display: flex; justify-content: space-between; font-size: 9px; color: #6b7280; }
.ct-anim-result-row span:last-child { font-weight: 700; color: #1a1f36; }
.ct-anim-result-check {
    position: absolute; top: -8px; right: -8px;
    width: 32px; height: 32px; border-radius: 50%;
    background: #059669; color: #fff; font-size: 16px; font-weight: 900;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 12px rgba(5,150,105,0.4);
    animation: ctCheckPop 8s ease infinite;
}
@keyframes ctCheckPop { 0%,65% { transform: scale(0); } 70% { transform: scale(1.2); } 75%,92% { transform: scale(1); } 96%,100% { transform: scale(0); } }

@media (max-width: 768px) {
    .ct-hero { padding: 32px 24px 32px; }
    .ct-hero-content { flex-direction: column; }
    .ct-hero-animation { width: 100%; height: 220px; padding-right: 12px; }
    .ct-hero-headline { font-size: 24px; }
    .ct-hero-stats { gap: 16px; }
}

/* ---- Capture Tool CTA button ---- */
.btn-cta-credits {
    width: 100%;
    padding: 14px 16px;
    font-size: 14px;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, #4361ee 0%, #7c3aed 100%);
    border: none;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(67,97,238,0.35);
    letter-spacing: -0.2px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}
.btn-cta-credits:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 28px rgba(67,97,238,0.5);
}
.btn-cta-credits:active {
    transform: translateY(0);
    box-shadow: 0 2px 12px rgba(67,97,238,0.3);
}

/* ---- Capture Tool promo banner ---- */
.capture-promo {
    display: flex;
    align-items: center;
    gap: 16px;
    background: linear-gradient(135deg, #1a1f36 0%, #2d1b69 60%, #1a1f36 100%);
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.15s;
}
.capture-promo:hover {
    box-shadow: 0 4px 24px rgba(67,97,238,0.25);
    transform: translateY(-1px);
}
.capture-promo-glow {
    position: absolute;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(67,97,238,0.2) 0%, transparent 60%);
    top: -80px;
    right: -40px;
    pointer-events: none;
}
.capture-promo-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, #4361ee, #7c3aed);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.capture-promo-text {
    flex: 1;
    min-width: 0;
}
.capture-promo-title {
    font-size: 14px;
    font-weight: 800;
    color: #fff;
    margin: 0 0 2px;
    letter-spacing: -0.2px;
}
.capture-promo-desc {
    font-size: 12px;
    color: rgba(255,255,255,0.5);
    margin: 0;
    line-height: 1.4;
}
.capture-promo-btn {
    flex-shrink: 0;
    padding: 8px 16px;
    border-radius: 8px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    pointer-events: none;
}
.capture-promo-dismiss {
    background: none;
    border: none;
    color: rgba(255,255,255,0.3);
    font-size: 11px;
    cursor: pointer;
    padding: 4px 8px;
    flex-shrink: 0;
    align-self: center;
}
.capture-promo-dismiss:hover {
    color: rgba(255,255,255,0.7);
}

@media (max-width: 640px) {
    /* Two-row grid stacks the CTA button beneath the icon + title so
       the title isn't squeezed into a one-word-per-line column when
       the button and dismiss share the row. flex-wrap was unreliable
       because the text and button both grew via flex: 1 and split the
       row 50/50 before wrapping. */
    .capture-promo {
        display: grid;
        grid-template-columns: auto 1fr auto;
        grid-template-areas:
            "icon text dismiss"
            "btn  btn  btn";
        align-items: center;
        gap: 10px 12px;
        padding: 14px 16px;
    }
    .capture-promo-icon {
        grid-area: icon;
        width: 34px;
        height: 34px;
        font-size: 17px;
    }
    .capture-promo-text {
        grid-area: text;
        width: auto;
        min-width: 0;
    }
    .capture-promo-title {
        font-size: 13px;
    }
    .capture-promo-desc {
        display: none;
    }
    .capture-promo-btn {
        grid-area: btn;
        width: 100%;
        text-align: center;
        padding: 9px 12px;
        justify-self: stretch;
    }
    .capture-promo-dismiss {
        grid-area: dismiss;
        align-self: center;
    }
}

/* ---- Responsive view-level content grids ---- */
.hiw-steps-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}
.ext-credits-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}
.view-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
}
@media (max-width: 640px) {
    .hiw-steps-grid,
    .ext-credits-grid,
    .view-grid-2 {
        grid-template-columns: 1fr;
    }
}

/* ---- Lead temperature pill group ---- */
.lead-temp-group {
    display: inline-flex;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--color-border);
}
.lead-temp-btn {
    background: none;
    border: none;
    border-right: 1px solid var(--color-border);
    padding: 4px 9px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    color: var(--color-muted);
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    white-space: nowrap;
}
.lead-temp-btn:last-child { border-right: none; }
.lead-temp-btn:hover:not(.active) { background: rgba(255,255,255,0.06); color: var(--color-text); }
.lead-temp-btn.active[data-temp="hot"]  { background: rgba(220,38,38,0.15);  color: #ef4444; }
.lead-temp-btn.active[data-temp="warm"] { background: rgba(217,119,6,0.15);  color: #f59e0b; }
.lead-temp-btn.active[data-temp="cold"] { background: rgba(2,132,199,0.15);  color: #38bdf8; }
.lead-temp-btn.active[data-temp="dead"] { background: rgba(107,114,128,0.12); color: #9ca3af; }

/* ---- Leads Capture How-To Banner ---- */
.leads-capture-banner {
    display: flex;
    align-items: center;
    gap: 16px;
    background: linear-gradient(135deg, #05140d 0%, #042218 40%, #0a1628 100%);
    border: 1px solid rgba(0, 230, 118, 0.22);
    border-radius: 14px;
    padding: 18px 20px;
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
    cursor: default;
}
.leads-capture-banner::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(0,230,118,0.04) 0%, transparent 60%);
    pointer-events: none;
}
.lcb-shimmer {
    position: absolute;
    top: 0; left: -80%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0,230,118,0.07), transparent);
    animation: lcb-shimmer 4s ease-in-out infinite;
    pointer-events: none;
}
@keyframes lcb-shimmer {
    0%   { left: -80%; }
    100% { left: 160%; }
}
.lcb-bolt {
    font-size: 28px;
    flex-shrink: 0;
    line-height: 1;
    filter: drop-shadow(0 0 8px rgba(0,230,118,0.6));
    animation: lcb-pulse 2.5s ease-in-out infinite;
}
@keyframes lcb-pulse {
    0%, 100% { filter: drop-shadow(0 0 6px rgba(0,230,118,0.5)); }
    50%       { filter: drop-shadow(0 0 14px rgba(0,230,118,0.9)); }
}
.lcb-content {
    flex: 1;
    min-width: 0;
}
.lcb-headline {
    font-size: 14px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 8px;
    letter-spacing: -0.2px;
}
.lcb-steps {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}
.lcb-step {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 600;
    color: rgba(255,255,255,0.7);
}
.lcb-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0,230,118,0.18);
    border: 1px solid rgba(0,230,118,0.4);
    color: #00e676;
    font-size: 11px;
    font-weight: 800;
    flex-shrink: 0;
}
.lcb-arrow {
    color: rgba(0,230,118,0.5);
    font-size: 14px;
    font-weight: 700;
}
.lcb-cta {
    flex-shrink: 0;
    padding: 9px 18px;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(0,230,118,0.18), rgba(0,200,100,0.12));
    border: 1px solid rgba(0,230,118,0.35);
    color: #00e676;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
}
.lcb-cta:hover {
    background: linear-gradient(135deg, rgba(0,230,118,0.28), rgba(0,200,100,0.2));
    box-shadow: 0 0 12px rgba(0,230,118,0.2);
}
.lcb-dismiss {
    background: none;
    border: none;
    color: rgba(255,255,255,0.25);
    font-size: 13px;
    cursor: pointer;
    padding: 4px 6px;
    flex-shrink: 0;
    line-height: 1;
    transition: color 0.15s;
}
.lcb-dismiss:hover { color: rgba(255,255,255,0.6); }
@media (max-width: 640px) {
    .leads-capture-banner { flex-wrap: wrap; }
    .lcb-steps { display: none; }
    .lcb-cta { width: 100%; text-align: center; }
}

/* ---- Integrations banner (full-width below split) ---- */
.integrations-banner {
    background: linear-gradient(180deg, #0a0e1f 0%, #111827 100%);
    padding: 80px 40px;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.integrations-inner {
    max-width: 1100px;
    margin: 0 auto;
}
.integrations-header {
    text-align: center;
    margin-bottom: 56px;
}
.integrations-eyebrow {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #635bff;
    font-weight: 700;
    margin: 0 0 12px;
}
.integrations-title {
    font-size: 36px;
    font-weight: 800;
    color: #fff;
    margin: 0 0 16px;
    letter-spacing: -0.5px;
    line-height: 1.2;
}
.integrations-subtitle {
    font-size: 16px;
    color: #94a3b8;
    margin: 0 auto;
    max-width: 640px;
    line-height: 1.6;
}
.integrations-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
}
.integration-card {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    padding: 40px;
    transition: border-color 0.2s, background 0.2s;
}
.integration-card:hover {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.15);
}
.integration-card-stripe {
    border-color: rgba(99,91,255,0.2);
}
.integration-card-stripe:hover {
    border-color: rgba(99,91,255,0.4);
}
.integration-card-logo {
    margin-bottom: 24px;
}
.integration-card-logo img {
    border-radius: 8px;
}
.integration-card-logos {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.integration-card-logos img,
.integration-card-logo img {
    background: #fff;
    padding: 8px 12px;
    border-radius: 8px;
}
.integration-card h3 {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 12px;
}
.integration-card p {
    font-size: 14px;
    color: #94a3b8;
    line-height: 1.6;
    margin: 0 0 20px;
}
.integration-perks {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.integration-perks li {
    font-size: 13px;
    color: #cbd5e1;
    padding-left: 20px;
    position: relative;
}
.integration-perks li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #38a169;
}

/* ---- Mobile: stack vertically ---- */
@media (max-width: 768px) {
    .login-split {
        flex-direction: column;
    }
    .login-brand {
        padding:    40px 28px 36px;
        min-height: auto;
    }
    .login-headline {
        font-size: 32px;
    }
    .login-features {
        display: none;
    }
    .login-brand-footer,
    .login-trusted,
    .login-testimonial,
    .login-cta {
        display: none;
    }
    .login-form-panel {
        width:   100%;
        padding: 28px 20px 40px;
    }
    .login-card {
        box-shadow: none;
        padding:    28px 20px;
    }
    .integrations-banner {
        padding: 48px 20px;
    }
    .integrations-title {
        font-size: 26px;
    }
    .integrations-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .integration-card {
        padding: 28px 24px;
    }
    .integration-card-logos {
        gap: 12px;
    }
}

/* ---- Progress Toast ---- */
#progressToastContainer {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.progress-toast {
    pointer-events: all;
    width: 320px;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.22), 0 2px 8px rgba(0,0,0,0.12);
    overflow: hidden;
    animation: ptSlideIn 0.3s cubic-bezier(0.34,1.56,0.64,1) both;
}
.progress-toast.dismissing {
    animation: ptSlideOut 0.25s ease-in both;
}
@keyframes ptSlideIn {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0)   scale(1); }
}
@keyframes ptSlideOut {
    from { opacity: 1; transform: translateY(0)   scale(1); max-height: 200px; margin-bottom: 0; }
    to   { opacity: 0; transform: translateY(10px) scale(0.95); max-height: 0; margin-bottom: -10px; }
}

.pt-accent-bar {
    height: 3px;
    background: linear-gradient(90deg, #7c3aed, #a855f7, #c084fc);
    background-size: 200% 100%;
    animation: ptAccentFlow 2s linear infinite;
}
.progress-toast.pt-success .pt-accent-bar {
    background: linear-gradient(90deg, #16a34a, #22c55e, #4ade80);
    animation: ptAccentFlow 1.5s linear infinite;
}
.progress-toast.pt-error .pt-accent-bar {
    background: #ef4444;
    animation: none;
}
@keyframes ptAccentFlow {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.pt-body {
    padding: 14px 16px 12px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}
.pt-icon {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    background: color-mix(in srgb, #a855f7 15%, var(--color-bg));
    color: #a855f7;
    transition: background 0.3s, color 0.3s;
}
.progress-toast.pt-success .pt-icon {
    background: color-mix(in srgb, #22c55e 15%, var(--color-bg));
    color: #22c55e;
}
.progress-toast.pt-error .pt-icon {
    background: color-mix(in srgb, #ef4444 15%, var(--color-bg));
    color: #ef4444;
}
.pt-content { flex: 1; min-width: 0; }
.pt-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}
.pt-subtitle {
    font-size: 11px;
    color: var(--color-muted);
    margin-top: 2px;
    transition: color 0.2s;
    line-height: 1.4;
}
.progress-toast.pt-success .pt-subtitle { color: #22c55e; }
.progress-toast.pt-error   .pt-subtitle { color: #ef4444; }

.pt-progress-wrap {
    padding: 0 16px 14px;
}
.pt-progress-track {
    height: 5px;
    background: var(--color-border);
    border-radius: 99px;
    overflow: hidden;
}
.pt-progress-fill {
    height: 100%;
    border-radius: 99px;
    background: linear-gradient(90deg, #7c3aed, #a855f7);
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1), background 0.4s;
    position: relative;
    overflow: hidden;
}
.pt-progress-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.25) 50%, transparent 100%);
    background-size: 200% 100%;
    animation: ptShimmer 1.2s linear infinite;
}
.progress-toast.pt-success .pt-progress-fill {
    background: linear-gradient(90deg, #16a34a, #22c55e);
}
.progress-toast.pt-success .pt-progress-fill::after { display: none; }
.progress-toast.pt-error   .pt-progress-fill { background: #ef4444; }
.progress-toast.pt-error   .pt-progress-fill::after { display: none; }
@keyframes ptShimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.pt-stage-row {
    padding: 0 16px 12px;
    display: flex;
    gap: 4px;
}
.pt-stage-dot {
    height: 3px;
    border-radius: 99px;
    flex: 1;
    background: var(--color-border);
    transition: background 0.3s;
}
.pt-stage-dot.done    { background: #a855f7; }
.pt-stage-dot.active  { background: linear-gradient(90deg,#7c3aed,#a855f7); animation: ptAccentFlow 1.5s linear infinite; background-size: 200%; }
.progress-toast.pt-success .pt-stage-dot.done,
.progress-toast.pt-success .pt-stage-dot.active { background: #22c55e; animation: none; }

/* ---- New Customer Request Wizard ---- */
.wizard-progress { display:flex; align-items:center; justify-content:center; gap:0; margin-bottom:24px; }
.wizard-step-indicator { display:flex; flex-direction:column; align-items:center; gap:4px; }
.wizard-step-connector { width:40px; height:2px; background:var(--color-border); margin:0 4px; margin-bottom:20px; }
.wizard-step-dot { width:32px; height:32px; border-radius:50%; border:2px solid var(--color-border); display:flex; align-items:center; justify-content:center; font-size:13px; font-weight:600; color:var(--color-muted); transition:all 0.2s; }
.wizard-step-dot.active { background:var(--color-primary); border-color:var(--color-primary); color:#fff; }
.wizard-step-dot.completed { background:#22c55e; border-color:#22c55e; color:#fff; }
.wizard-step-label { font-size:11px; color:var(--color-muted); font-weight:500; }
.wizard-step-label.active { color:var(--color-primary); font-weight:600; }
.wizard-step-label.completed { color:#22c55e; }

.wizard-step { animation: fadeIn 0.15s ease; }
@keyframes fadeIn { from { opacity:0; transform:translateY(4px); } to { opacity:1; transform:translateY(0); } }

.wizard-search-results { max-height:200px; overflow-y:auto; margin:8px 0; }
.wizard-result-card { padding:10px 14px; border:1px solid var(--color-border); border-radius:8px; cursor:pointer; margin-bottom:6px; transition:background 0.15s, border-color 0.15s; display:flex; align-items:center; justify-content:space-between; }
.wizard-result-card:hover { background:var(--color-bg); border-color:var(--color-primary); }
.wizard-result-name { font-size:13px; font-weight:600; color:var(--color-text); }
.wizard-result-sub { font-size:12px; color:var(--color-muted); }

.wizard-selected { background:linear-gradient(135deg,#eef2ff,#e0e7ff); border:2px solid #818cf8; border-radius:8px; padding:10px 14px; margin-bottom:12px; font-size:13px; display:flex; align-items:center; justify-content:space-between; }
[data-theme="dark"] .wizard-selected { background:linear-gradient(135deg,#1e1b4b,#312e81); border-color:#6366f1; }
.wizard-selected-label { font-weight:600; color:var(--color-text); }
.wizard-selected-sub { font-size:12px; color:var(--color-text-secondary); margin-left:8px; }
.wizard-change-btn { font-size:12px; color:var(--color-primary); cursor:pointer; font-weight:500; }
.wizard-change-btn:hover { text-decoration:underline; }

.wizard-create-toggle { font-size:13px; color:var(--color-primary); cursor:pointer; margin:8px 0; display:inline-block; font-weight:500; }
.wizard-create-toggle:hover { text-decoration:underline; }
.wizard-inline-form { border:1px solid var(--color-border); border-radius:8px; padding:16px; margin-top:8px; background:var(--color-bg); }

.wizard-order-summary-card { background:var(--color-bg); border:1px solid var(--color-border); border-radius:8px; padding:12px 14px; }
.wizard-order-summary-card .summary-row { display:flex; justify-content:space-between; padding:4px 0; font-size:13px; }
.wizard-order-summary-card .summary-label { color:var(--color-muted); font-weight:500; }
.wizard-order-summary-card .summary-value { font-weight:600; color:var(--color-text); }

/* ---- Recently Viewed Strip ---- */
.recents-strip {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
}
.recents-strip::-webkit-scrollbar { height: 4px; }
.recents-strip::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 4px; }

.recent-card {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    cursor: pointer;
    transition: box-shadow 0.15s, border-color 0.15s;
    min-width: 160px;
    max-width: 220px;
}
.recent-card:hover {
    border-color: var(--color-primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.recent-card-icon {
    font-size: 18px;
    flex-shrink: 0;
}
.recent-card-img {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    object-fit: contain;
    flex-shrink: 0;
    background: var(--color-bg);
}
.recent-card-body {
    min-width: 0;
    flex: 1;
}
.recent-card-label {
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--color-text);
}
.recent-card-sub {
    font-size: 11px;
    color: var(--color-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}
.recent-card-time {
    font-size: 10px;
    color: var(--color-muted);
    margin-top: 2px;
}

/* ---- Modal ---- */
.modal {
    position: fixed;
    inset:    0;
    z-index:  1000;
    display:  flex;
    align-items: center;
    justify-content: center;
}
#confirmDialog,
#renameDialog {
    /* Higher than the design-center / crop / print-rect overlays
       (10200-10300) so confirm dialogs opened from inside those modals
       land on top instead of behind them. */
    z-index: 10500;
}

.modal-overlay {
    position:   absolute;
    inset:      0;
    background: rgba(0,0,0,0.45);
}

.modal-box {
    position:      relative;
    background:    var(--color-card);
    border-radius: 12px;
    padding:       28px;
    width:         100%;
    max-width:     600px;
    max-height:    90vh;
    overflow-y:    auto;
    box-shadow:    var(--shadow-md);
    z-index:       1;
}
@media (min-width: 900px) {
    .modal-box { max-width: min(900px, 90vw) !important; }
    .modal-box.modal-sm { max-width: 480px !important; }
    .modal-box-detail { max-width: min(1200px, 94vw) !important; }
}
@media (min-width: 1200px) {
    .modal-box { max-width: min(1100px, 88vw) !important; }
    .modal-box.modal-sm { max-width: 480px !important; }
    .modal-box-detail { max-width: min(1400px, 92vw) !important; }
}
@media (min-width: 1600px) {
    .modal-box { max-width: min(1200px, 85vw) !important; }
    .modal-box-detail { max-width: min(1500px, 90vw) !important; }
}

.modal-box h2 { font-size: 18px; font-weight: 700; margin-bottom: 20px; }

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

.modal-actions {
    display:         flex;
    justify-content: flex-end;
    gap:             10px;
    margin-top:      20px;
}

/* ---- Detail Layout ---- */
.detail-grid {
    display:               grid;
    grid-template-columns: 1fr 1fr;
    gap:                   20px;
}

.detail-card, .timeline-card { padding: 24px; }

.detail-card h3, .timeline-card h3 {
    font-size:     15px;
    font-weight:   700;
    margin-bottom: 16px;
    color:         var(--color-text);
    padding-bottom: 10px;
    border-bottom: 1px solid var(--color-border);
}

.detail-row {
    display:       flex;
    align-items:   baseline;
    gap:           12px;
    padding:       8px 0;
    font-size:     13.5px;
    border-bottom: 1px solid var(--color-border);
}
.detail-row:last-child { border-bottom: none; }

.detail-label {
    font-weight:    600;
    color:          var(--color-muted);
    min-width:      140px;
    flex-shrink:    0;
    font-size:      12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.detail-row span:last-child {
    color: var(--color-text);
    font-weight: 500;
}
.detail-link { color: var(--color-primary); text-decoration: none; font-weight: 600; }
.detail-link:hover { text-decoration: underline; }

/* Form  -  grouped sections */
.form-section {
    margin-bottom: 20px;
    padding-bottom: 4px;
}
.form-section:last-of-type { margin-bottom: 12px; }
.form-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--color-muted);
    padding-bottom: 8px;
    margin-bottom: 8px;
    border-bottom: 2px solid var(--color-primary);
}

/* PPD document rows */
.ppd-doc-row {
    padding: 10px 12px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
}
.ppd-doc-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.ppd-doc-preview-img {
    max-width: 100%;
    max-height: 160px;
    border-radius: 6px;
    border: 1px solid var(--color-border);
}

/* Order detail  -  grouped sections */
.order-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
@media (max-width: 768px) {
    .order-detail-grid { grid-template-columns: 1fr; }
}

.detail-section {
    padding: 0;
}
.detail-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--color-muted);
    padding-bottom: 8px;
    margin-bottom: 8px;
    border-bottom: 2px solid var(--color-primary);
}

.detail-section .detail-row {
    padding: 6px 0;
    border-bottom: 1px solid color-mix(in srgb, var(--color-border), transparent 50%);
}
.detail-section .detail-row:last-child { border-bottom: none; }

.detail-section .detail-label {
    min-width: 120px;
    font-size: 11px;
}

.order-hero {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: color-mix(in srgb, var(--color-primary), transparent 92%);
    border-radius: 8px;
    margin-bottom: 16px;
}
.order-hero-status-needs-quoted  { background: rgba(220, 38, 38, 0.08); }
.order-hero-status-quoted        { background: rgba(234, 88, 12, 0.08); }
.order-hero-status-confirmed     { background: rgba(217, 119, 6, 0.08); }
.order-hero-status-po-submitted  { background: rgba(202, 138, 4, 0.08); }
.order-hero-status-po-accepted   { background: rgba(101, 163, 13, 0.08); }
.order-hero-status-proofed       { background: rgba(22, 163, 74, 0.08); }
.order-hero-status-proof-approved { background: rgba(13, 148, 136, 0.08); }
.order-hero-status-in-production { background: rgba(2, 132, 199, 0.08); }
.order-hero-status-shipped       { background: rgba(37, 99, 235, 0.08); }
.order-hero-status-delivered     { background: rgba(79, 70, 229, 0.08); }
.order-hero-status-surveyed      { background: rgba(124, 58, 237, 0.08); }
.order-hero-status-canceled      { background: rgba(220, 38, 38, 0.06); }
.order-hero-number {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-text);
}
.order-hero-status { margin-left: auto; }
.order-hero-total {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-primary);
}
.order-hero-item {
    text-align: center;
    line-height: 1.3;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 44px;
    justify-content: space-between;
}
.order-hero-item-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-muted);
    font-weight: 600;
}
.order-hero-item-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
}
/* All value rows align on the same baseline with consistent inline spacing. */
.order-hero-item-value-row {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 22px;
}
/* Consistent vertical divider between field groups in the hero row. */
.order-hero-divider {
    border-left: 2px solid var(--color-border);
    padding-left: 16px;
    margin-left: 8px;
}
/* Subtle inline separator between badge and value within a field. */
.order-hero-sep {
    color: var(--color-muted);
    font-size: 12px;
    opacity: 0.7;
}

/* Modal detail improvements */
.modal-box h2 {
    font-size:     18px;
    font-weight:   700;
    color:         var(--color-text);
    padding-bottom: 12px;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 16px;
}
.modal-box h3 {
    font-size:     14px;
    font-weight:   700;
    color:         var(--color-text);
}
.modal-actions {
    padding-top: 16px;
    border-top:  1px solid var(--color-border);
    margin-top:  16px;
}

/* ---- Tabs ---- */
.tab-bar {
    display: flex;
    border-bottom: 2px solid var(--color-border);
    background: var(--color-card);
    overflow: visible;
    flex-shrink: 0;
}
.tab-btn {
    padding: 12px 20px;
    border: none;
    background: none;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-muted);
    cursor: pointer;
    white-space: nowrap;
    position: relative;
    transition: color 0.15s;
}
.tab-btn:hover { color: var(--color-text); }
.tab-btn.active {
    color: var(--color-primary);
}
.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--color-primary);
}
.tab-count-pill {
    font-size: 10px;
    font-weight: 700;
    background: var(--color-muted);
    color: #fff;
    border-radius: 8px;
    padding: 1px 6px;
    margin-left: 4px;
}
.tab-count-pill:empty { display: none; }
.tab-badge {
    display: inline-block;
    margin-left: 8px;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    vertical-align: middle;
    font-weight: 600;
}
.tab-content {
    position: relative;
    max-height: 600px;
    overflow-y: auto;
    overflow-x: auto;
}
.tab-pane {
    display: none;
    padding: 16px 20px;
}
.tab-pane.active { display: block; }

/* ---- Detail Sections (order detail subsections) ---- */
.detail-section {
    padding: 0 !important;
    overflow: hidden;
}

/* Customer detail modal: stack of bordered section cards. Kept scoped to
   .customer-detail-stack so existing uses of .detail-section (order detail,
   etc.) that already live inside a bordered panel are not affected. */
.customer-detail-stack {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.customer-detail-stack > .detail-section {
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 10px;
}
.customer-detail-stack > .detail-section.hidden { display: none; }
.customer-detail-stack > .detail-section:empty { display: none; }
.customer-detail-stack .detail-section-header {
    padding: 12px 16px;
}
.customer-detail-stack .detail-section-body {
    padding: 14px 16px;
}
.customer-detail-stack .detail-section-body:empty::after {
    padding: 6px 0;
}
.detail-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
}
.detail-section-header h3 {
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-muted);
}
.detail-section-body {
    padding: 16px 20px;
}
.detail-section-body:empty::after {
    content: 'No data available.';
    display: block;
    color: var(--color-muted);
    font-size: 13px;
    text-align: center;
    padding: 12px 0;
}
.detail-section-count {
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 8px;
    margin-left: 6px;
}

/* Comment compose area */
/* Thread moderation toolbar */
.comment-thread-toolbar-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0 8px;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 4px;
    min-height: 32px;
}
.comment-thread-toolbar-wrap:empty { display: none; }
.comment-thread-actions { display: flex; gap: 4px; align-items: center; }
.comment-thread-status-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.thread-status-open     { background: #dcfce7; color: #166534; }
.thread-status-pinned   { background: #ede9fe; color: #5b21b6; }
.thread-status-closed   { background: #f1f5f9; color: #64748b; }
.thread-status-flagged  { background: #fef3c7; color: #92400e; }
.thread-status-archived { background: #e2e8f0; color: #475569; }
.thread-pin-icon { color: var(--color-primary); font-size: 13px; margin-right: 4px; }
.comment-thread-warning {
    padding: 8px 12px;
    font-size: 12px;
    color: #64748b;
    background: #f8fafc;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    margin-bottom: 8px;
    text-align: center;
}
.comment-thread-warning.hidden { display: none; }
.comment-thread-removed-msg {
    padding: 24px;
    text-align: center;
    color: var(--color-muted);
    font-size: 13px;
}

/* Empty state guides */
.empty-state-guide {
    text-align: center;
    padding: 48px 24px;
    max-width: 420px;
    margin: 0 auto;
}
.empty-state-guide .esi { font-size: 40px; margin-bottom: 12px; line-height: 1; }
.empty-state-guide h3 { font-size: 16px; font-weight: 700; color: var(--color-text); margin: 0 0 8px; }
.empty-state-guide p { font-size: 13px; color: var(--color-muted); line-height: 1.6; margin: 0 0 16px; }
.empty-state-guide .esa { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.empty-state-filter-msg {
    text-align: center;
    padding: 32px 24px;
    color: var(--color-muted);
    font-size: 13px;
}
.empty-state-filter-msg button { margin-top: 10px; }

/* Capture Tool promo in empty state */
.empty-state-guide:has(.es-capture-promo) { max-width: 520px; }
.es-capture-promo {
    margin-top: 20px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #eef2ff, #e0e7ff);
    border: 1px solid #c7d2fe;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 14px;
    text-align: left;
}
.es-capture-btn {
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    font-weight: 600;
    padding: 8px 18px !important;
    font-size: 13px !important;
}
.es-capture-btn::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -75%;
    width: 50%;
    height: 200%;
    background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.5) 50%, transparent 60%);
    animation: captureShine 3s ease-in-out infinite;
}
@keyframes captureShine {
    0%   { left: -75%; }
    30%  { left: 125%; }
    100% { left: 125%; }
}
.es-capture-desc {
    font-size: 13px;
    color: var(--color-muted);
    line-height: 1.5;
}


/* Customer dashboard discovery cards */
#customerDashboard .card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.1); transform: translateY(-2px); }
#customerDashboard .card { transition: box-shadow 0.15s, transform 0.15s; }

/* Feature discovery tips */
.feature-tip {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 12px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    line-height: 1.6;
    margin-bottom: 12px;
}
.feature-tip-blue { background: #f0f9ff; border: 1px solid #bae6fd; color: #0369a1; }
.feature-tip-purple { background: #f5f3ff; border: 1px solid #ddd6fe; color: #6d28d9; }
.feature-tip-green { background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d; }
.feature-tip-amber { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.feature-tip .tip-icon { font-size: 15px; flex-shrink: 0; line-height: 1.3; }
.feature-tip .tip-dismiss {
    flex-shrink: 0; background: none; border: none; cursor: pointer;
    font-size: 16px; color: inherit; opacity: 0.5; padding: 0; line-height: 1;
}
.feature-tip .tip-dismiss:hover { opacity: 1; }

/* Drag-sort for project orders */
.project-products-row td { background: var(--color-bg); }
.project-products-row:hover td { background: var(--color-bg); }
.project-order-row[draggable="true"]:hover { background: var(--color-bg-secondary); }
.project-order-row.dragging { opacity: 0.4; }
.drag-handle:hover { color: var(--color-primary) !important; }
.drag-placeholder {
    height: 48px;
    border: 2px dashed var(--color-primary);
    border-radius: 8px;
    margin: 4px 0;
    background: rgba(67,97,238,0.05);
}

.comment-compose {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--color-border);
}
.comment-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-size: 13px;
    font-family: var(--font);
    resize: vertical;
    background: var(--color-card);
    color: var(--color-text);
    transition: border-color 0.15s;
}
.comment-textarea:focus {
    border-color: var(--color-primary);
    outline: none;
}
.comment-textarea::placeholder {
    color: var(--color-placeholder);
}
.comment-compose-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}

/* Detail value emphasis */
.detail-value-lg {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text);
}

/* ---- Timeline ---- */
.timeline { list-style: none; padding: 0; position: relative; }

.timeline-item {
    display:     flex;
    gap:         14px;
    padding-bottom: 20px;
    position:    relative;
}

.timeline-item::before {
    content:     '';
    position:    absolute;
    left:        11px;
    top:         22px;
    bottom:      0;
    width:       2px;
    background:  var(--color-border);
}

.timeline-item:last-child::before { display: none; }

.timeline-dot {
    width:         10px;
    height:        10px;
    border-radius: 50%;
    background:    var(--color-primary);
    flex-shrink:   0;
    margin-top:    5px;
}

.timeline-dot-inner { display: none; }

.timeline-content { flex: 1; }

.timeline-status {
    font-weight: 600;
    font-size:   13px;
    color:       var(--color-text);
}

.timeline-date {
    font-size: 12px;
    color:     var(--color-muted);
    margin-top: 2px;
}
.timeline-changed-by {
    font-size: 12px;
    color:     var(--color-muted);
}

.timeline-notes {
    font-size:     13px;
    color:         var(--color-text);
    margin-top:    6px;
    padding:       8px 12px;
    background:    var(--color-bg);
    border-radius: 6px;
    border-left:   3px solid var(--color-primary);
}

/* ---- Mobile Top Bar (hidden on desktop) ---- */
.mobile-topbar {
    display:     none;
    align-items: center;
    gap:         12px;
    position:    fixed;
    top:         0;
    left:        0;
    right:       0;
    height:      56px;
    background:  var(--color-sidebar);
    padding:     0 16px;
    z-index:     150;
    box-shadow:  0 1px 4px rgba(0,0,0,0.2);
}
.mobile-topbar-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}
/* Thin vertical line separating the open-project pill from the
   notification bells. Auto-hides when its preceding sibling
   (#mobileOpenProjectBtn) is hidden so no orphaned divider shows. */
/* Vertical divider between the open-project pill and the bell icons.
   User feedback (2026-04-25): unnecessary clutter on a phone-width
   topbar, so always hidden on mobile. The element stays in DOM for
   desktop layouts that may still want it. */
.mobile-topbar-divider {
    display: none;
}
/* Bell-style icon button: SVG icon centered, count badge perched on
   the top-right corner Facebook-style. Previously the counter stacked
   below the icon, which doubled the button's height and felt like a
   labelled stat card rather than a quick-glance unread indicator. */
.mobile-topbar-btn {
    position: relative;
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 8px;
    color: #e2e8f0;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    transition: background 120ms ease;
}
.mobile-topbar-btn:active {
    background: rgba(255,255,255,0.18);
}
.mobile-btn-label {
    /* Legacy text label sat under the icon. Hidden now that the
       Facebook-style overlay communicates state inline. */
    display: none;
}
.mobile-topbar-btn .notif-counter {
    position: absolute;
    top: -2px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    line-height: 18px;
    text-align: center;
    background: #ef4444; /* Facebook-red unread badge */
    color: #fff;
    border: 2px solid var(--color-sidebar);
    box-shadow: 0 1px 4px rgba(0,0,0,0.4);
    pointer-events: none;
}
/* Zero-state: collapse the badge entirely so the icon stands alone.
   `visibility: hidden` keeps DOM space stable for the JS counter
   updaters but the badge disappears visually. */
.mobile-topbar-btn .notif-counter.zero {
    visibility: hidden;
}
/* The open-project pill opts OUT of the 36x36 icon-only square that
   the other .mobile-topbar-btn buttons now use, because it carries
   the project NAME inline with the folder icon - that's the whole
   point of having a pill. The !important tags beat the
   .mobile-topbar-btn { width: 36px; height: 36px; padding: 0 } rules
   above, which would otherwise crush the pill into a featureless
   indigo square hiding the project name. */
.mobile-op-pill {
    width: auto !important;
    height: auto !important;
    flex-direction: row;
    gap: 6px;
    padding: 6px 12px !important;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #fff !important;
    border-radius: 999px !important;
    max-width: 180px;
    min-width: 0;
    box-shadow: 0 1px 3px rgba(79, 70, 229, 0.35);
}
/* The pill's count badge is part of the pill's flow (right of the
   name), not a corner overlay like the bell badges. Re-anchor it to
   normal flow so the new top:-2; right:-4 rule above doesn't kick it
   off the pill. */
.mobile-op-pill .mobile-op-pill-count {
    position: static !important;
    top: auto !important;
    right: auto !important;
    border: none !important;
    box-shadow: none !important;
}
.mobile-op-pill .mobile-topbar-icon {
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
}
.mobile-op-pill-name {
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mobile-op-pill .mobile-op-pill-count {
    background: rgba(255,255,255,0.28);
    color: #fff;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.mobile-op-pill .mobile-op-pill-count.zero {
    background: rgba(255,255,255,0.18);
    color: rgba(255,255,255,0.75);
}
.mobile-credits-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: rgba(99,91,255,0.2);
    color: #c4b5fd;
    font-size: 11px;
    font-weight: 700;
    border-radius: 100px;
    text-decoration: none;
    white-space: nowrap;
}
.mobile-search-drawer {
    display: none;
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    background: var(--color-sidebar);
    padding: 8px 16px 10px;
    z-index: 149;
    gap: 6px;
    flex-direction: column;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}
.mobile-search-drawer input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 8px;
    background: rgba(255,255,255,0.08);
    color: #e2e8f0;
    font-size: 13px;
    outline: none;
}
.mobile-search-drawer input[type="text"]::placeholder { color: var(--color-placeholder); }
.mobile-search-drawer input[type="text"]:focus {
    border-color: rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.12);
}
.mobile-search-drawer .global-search-results {
    position: relative;
    top: 0;
    width: 100%;
    max-height: 60vh;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.mobile-brand {
    display:         flex;
    align-items:     center;
    gap:             8px;
    text-decoration: none;
    /* Cap the brand block so a wide PPD logo can't squeeze the
       open-project pill + notification/task/comment icons off the
       right edge of the topbar. The 100px ceiling fits short PPD
       logos comfortably (Decade's "DELIVERED BY DECADE" round mark,
       a small wordmark, a 32x32 icon) and forces longer logos to
       contain themselves rather than push the actions row. */
    max-width:       110px;
    flex-shrink:     1;
    min-width:       0;
}
.mobile-brand-logo {
    width:         32px;
    height:        32px;
    border-radius: 7px;
    display:       block;
    flex-shrink:   0;
}
/* Tightened from 150px - same root cause as above. PPD wordmarks
   were dominating the topbar; 96px is enough for a brand mark to
   read at a glance without hijacking the actions area. */
.mobile-brand-ppd-logo { max-width: 96px; max-height: 32px; object-fit: contain; display: block; }
.mobile-brand-name {
    color:          #fff;
    font-size:      15px;
    font-weight:    800;
    letter-spacing: -0.2px;
    white-space:    nowrap;
}

/* ---- Hamburger Button ---- */
.hamburger {
    display:        flex;
    flex-direction: column;
    justify-content: center;
    gap:            5px;
    width:          36px;
    height:         36px;
    padding:        6px;
    background:     transparent;
    border:         none;
    cursor:         pointer;
    border-radius:  var(--radius);
    flex-shrink:    0;
}

.hamburger span {
    display:    block;
    width:      100%;
    height:     2px;
    background: #fff;
    border-radius: 2px;
    transition: transform 0.2s, opacity 0.2s;
}

.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---- Sidebar Overlay (mobile) ---- */
.sidebar-overlay {
    position:   fixed;
    inset:      0;
    background: rgba(0,0,0,0.5);
    z-index:    190;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    /* Layout */
    body:not(.login-page) {
        display:        block;
        /* 56px topbar + ~56px search drawer (grew from ~50 when
           inputs were bumped to 16px font-size in Phase 1A). */
        padding-top:    calc(56px + 56px + var(--safe-top));
    }
    /* Anon shop visitors don't see the mobile-search-drawer (we
       hide it in applyAnonRoleGates because the global "Search
       orders, customers, companies, projects" surface is
       meaningless for a public catalog visitor). Without this
       override, body still reserves the drawer's 56px - which
       shows up as an unexplained gap between the topbar and the
       page title.
       The +16px after the topbar is a small breathing room: the
       authed app effectively gets that breathing room for free
       from the search drawer below the topbar; without the drawer
       anon would have content sitting flush against the topbar
       (no visual separation), which felt cramped. */
    body.anon-shop:not(.login-page) {
        padding-top: calc(56px + var(--safe-top) + 16px);
    }
    /* Match for .main-content so its top edge sits flush with the
       reduced body padding instead of inheriting the 56-too-many
       px from the authed-app ruling further down. */
    body.anon-shop:not(.login-page) .main-content {
        height: calc(100vh - 56px - var(--safe-top) - 16px);
        height: calc(100dvh - 56px - var(--safe-top) - 16px);
    }
    /* .main-content is a scroll container with height: 100vh, so
       its top edge sits at viewport y=0 regardless of body padding-
       top. Body padding alone can't push its content below the two
       fixed mobile bars — we have to reserve the space inside its
       own padding-top. Desktop's default 84px (accounts for the
       52px top-nav) gets overridden here with 112px + safe-area. */
    body:not(.login-page) .main-content {
        padding-top: calc(112px + var(--safe-top) + 16px);
    }

    .mobile-topbar { display: flex; }
    .mobile-search-drawer { display: flex; }

    /* Hide desktop top nav on mobile */
    .top-nav { display: none; }

    /* Show sidebar user block on mobile */
    .sidebar-user-block { display: flex; }

    /* Popout menus: fit inside viewport on mobile */
    .nav-submenu-popout {
        left: 10px !important;
        right: 10px;
        max-width: calc(100vw - 20px);
        max-height: 60vh;
        overflow-y: auto;
    }
    .nav-categories-popout {
        min-width: 0;
    }

    /* Sidebar becomes a fixed drawer. Pinned to 240px on mobile; the
       desktop 250px widening lives on the root --sidebar-width variable. */
    .sidebar {
        position:   fixed;
        top:        0;
        left:       0;
        height:     100vh;
        z-index:    200;
        transform:  translateX(-100%);
        transition: transform 0.25s ease;
        width:      240px;
    }

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

    /* Main content  -  no top-nav offset on mobile.
       padding-top is 0 (not 16) so the first child <section>
       starts flush at main-content's padding-box top. The body
       already has padding-top: 112 + safe-top to clear the two
       fixed bars (mobile topbar + search drawer), so the section
       begins immediately below them. Any extra top 16 here would
       offset the sticky page-header's containing block, creating
       a visible gap between the fixed bars and the sticky header
       when the user scrolls. Per-view top padding is handled by
       the page-header's own padding-top. */
    .main-content {
        padding:     16px;
        padding-top: 0 !important;
        /* The body has padding-top: calc(56 + 56 + safe-top) on
           mobile to reserve space for the fixed topbar + search
           drawer. Since .main-content sits inside body's content
           area, its visible height is reduced by that padding too.
           If we set .main-content height to (100dvh - 56), the
           bottom (100dvh - 56) - (body padding-top) of content
           extends past body's content box and gets clipped by
           body's overflow:hidden. Subtracting the same 112+safe-top
           that body adds keeps .main-content's bottom edge inside
           body's clip box, so the search button + 72px clearance
           padding remain reachable.
           dvh keeps things in sync with body's 100dvh; vh fallback
           for browsers that don't yet understand dvh. */
        height:      calc(100vh - 112px - var(--safe-top));
        height:      calc(100dvh - 112px - var(--safe-top));
        /* Prevent scroll-chaining to the body. Without this, iOS Safari
           hits "the bottom" of .main-content and rubber-bands instead
           of releasing back to the page - users feel like they have to
           scroll twice to make progress. `contain` keeps the scroll
           local to this container; `none` would also block the
           pull-to-refresh gesture which we want to keep. */
        overscroll-behavior: contain;
        /* iOS <= 12 needed this for momentum; modern iOS has it by
           default but it's a cheap belt-and-suspenders. */
        -webkit-overflow-scrolling: touch;
    }
    /* Body itself shouldn't scroll on mobile - only .main-content
       does. Pinning the body to viewport height + overflow:hidden
       eliminates the double-scroll-container fight that was causing
       the "stuck at the bottom" symptom. The fixed mobile-topbar +
       sidebar + bottom-nav already handle their own positioning.
       padding-bottom: 0 because the bottom-nav is fixed (overlays
       the viewport). When body had a 60px padding-bottom AND
       overflow:hidden, body's content area was 116px shorter than
       100dvh - 56 (the .main-content height), causing the bottom
       of .main-content - including its 72px clearance for the
       bottom-nav - to be clipped. Net effect: the user couldn't
       scroll to the last button on long pages because the scroll
       container's bottom was hidden by body's clip box. */
    body:not(.login-page) {
        overflow: hidden;
        height: 100vh;
        height: 100dvh; /* dvh accounts for the iOS URL bar correctly */
        padding-bottom: 0 !important;
    }

    /* Page header */
    .page-header {
        gap: 8px;
        margin-bottom: 12px;
    }

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

    .page-header h1 { font-size: 18px; }

    .header-buttons {
        flex-wrap: wrap;
        gap: 6px;
    }

    .header-filter-row {
        gap: 6px;
    }

    .filter-bar {
        flex: 1 1 calc(50% - 6px);
        min-width: 0;
        max-width: 100%;
    }
    .filter-bar select, .filter-bar input {
        max-width: 100%;
    }
    .filter-bar select,
    .filter-bar .filter-input {
        width: 100%;
    }

    /* Stat cards: 2 columns on mobile */
    .stat-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        margin-bottom: 12px;
    }
    /* PPD Performance has its own 4-col rule at the top of the file -
       override it here so the page doesn't scroll horizontally on phones. */
    #perfStatCards {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-card { padding: 12px; }
    .stat-card .stat-value { font-size: 20px; }
    .stat-card .stat-label { font-size: 11px; }

    /* Dashboard grid: single column on mobile */
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .dashboard-grid .chart-card[style*="grid-column"] {
        grid-column: auto !important;
    }
    /* Customer-dashboard cards routinely showed horizontal overflow on
       phones: stat rows staying on one line, status badges pushing lead
       rows past the viewport, and long titles + "+ New Inquiry" fighting
       for the same row. Clamp horizontal spill (overflow-x: hidden) but
       leave vertical overflow visible and drop the desktop 280px
       max-height so long lists (lead rows, Needs Attention items)
       aren't clipped below the fold. */
    .chart-card {
        overflow-x: hidden;
        overflow-y: visible;
        max-width: 100%;
        max-height: none;
    }
    /* Card headers that pair a title with a CTA button — let them stack
       instead of cramming everything into one row. */
    .chart-card > div[style*="justify-content:space-between"]:first-child,
    .chart-card > div[style*="justify-content: space-between"]:first-child,
    .cust-dash-header {
        flex-wrap: wrap;
        gap: 8px;
    }
    /* Lead / inquiry rows: stack the title block above the
       date+status cluster so nothing gets pushed off-screen. Matches
       the inline-styled row built by renderCustomerDashLeads(). */
    .dash-lead-row {
        flex-wrap: wrap;
        gap: 6px;
    }
    .dash-lead-row > div:first-child {
        /* !important needed to beat the inline `flex:1` that the row
           builder sets on the title column (sets flex-basis:0). We
           want the whole title block to claim row 1 and push the
           date+badge cluster onto row 2. */
        flex: 1 1 100% !important;
        min-width: 0;
        overflow: hidden;
    }
    .dash-lead-row > div:first-child > div {
        overflow: hidden;
    }
    .dash-lead-row > div:last-child {
        margin-left: 0 !important;
        flex-wrap: wrap;
    }
}
/* Narrow phones: force the 4 inquiry-stat tiles into a 2x2 grid so the
   rightmost one ("Rescinded") doesn't get clipped. The tiles are built
   with flex:1;min-width:100px inline, so bump min-width to 50% via a
   container selector. Sits outside the 768px block so it also applies
   at 600-640px where the 100px min happens to still fit 3-across but
   crams the labels. */
@media (max-width: 600px) {
    .chart-card > div > div[style*="flex-wrap:wrap"] > div[style*="min-width:100px"] {
        min-width: calc(50% - 8px) !important;
        flex-basis: calc(50% - 8px) !important;
    }

    /* Detail grid: single column */
    .detail-grid { grid-template-columns: 1fr; }

    /* Tables: enable horizontal scroll */
    .table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .data-table {
        min-width: 600px;
    }
    .data-table th,
    .data-table td {
        padding: 8px 10px;
        font-size: 12px;
    }

    /* Order progress tracker: compact */
    .order-progress-tracker {
        gap: 2px;
    }
    .progress-step .step-dot {
        width: 22px;
        height: 22px;
        font-size: 10px;
    }
    .progress-step .step-label {
        font-size: 8px;
    }
    .progress-step .step-date {
        font-size: 8px;
    }
    .progress-connector {
        margin-top: 11px;
    }

    /* Comments: full width bubbles */
    .comment-bubble {
        max-width: 95%;
    }

    /* Proof file cards: stack */
    .proof-file-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .proof-file-actions {
        width: 100%;
    }
    .proof-file-actions .btn {
        flex: 1;
    }

    /* Bulk action bar */
    .bulk-action-bar {
        flex-wrap: wrap;
        font-size: 12px;
        padding: 8px 12px;
    }

    /* Pagination: stack on very small */
    .pagination-bar {
        flex-direction: column;
        gap: 8px;
        align-items: center;
    }

    /* Modals: full-width with margin, scrollable */
    .modal { align-items: flex-end; }

    .modal-box {
        max-width:     100% !important;
        width:         100%;
        border-radius: 16px 16px 0 0;
        padding:       20px 16px;
        max-height:    90vh;
        overflow-y:    auto;
    }

    /* Card */
    .card { padding: 16px; }

    /* Card header stacking */
    .card-header {
        flex-wrap: wrap;
        gap:       10px;
    }

    /* Login card */
    .login-card { padding: 28px 20px; }

    /* Customer pipeline: wrap 2 per row */
    .customer-pipeline {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }
    .pipeline-stage {
        min-width: 0;
        padding: 8px;
    }
    .pipeline-stage .stage-count { font-size: 20px; }
    .pipeline-stage .stage-label { font-size: 9px; }

    /* Invoice summary: stack */
    .orders-summary-invoices {
        flex-direction: column;
        gap: 8px;
    }
    .invoice-summary-group {
        gap: 4px;
    }

    /* Notification bar in top area */
    .notification-bar { padding: 4px 12px 0; }
}

/* Small phones */
@media (max-width: 480px) {
    .stat-cards {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }

    .filter-bar {
        flex: 1 1 100%;
    }

    .customer-pipeline {
        grid-template-columns: repeat(2, 1fr);
    }

    .page-header h1 { font-size: 16px; }
}

/* =============================================================
   Mobile horizontal-scroll guards
   Hardcoded multi-column grids and rigid flex rows that did not
   have a small-screen override and were causing the page to
   scroll horizontally on phones.
   ============================================================= */
@media (max-width: 768px) {
    /* Buy-credits tier cards: 3 cols at desktop, stack on phones */
    .acct-credits-tiers {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    /* Color family swatches: 3 cols hard-coded, drop to 2 on phones */
    .color-family-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    /* Feature tip banners: allow content to wrap rather than push width */
    .feature-tip {
        flex-wrap: wrap;
        align-items: flex-start;
    }
    .feature-tip > span,
    .feature-tip > * {
        min-width: 0;
    }
    /* Stripe-style progress overlay: shrink to viewport on small screens */
    .stripe-progress-card {
        min-width: 0 !important;
        max-width: calc(100vw - 24px) !important;
        padding: 24px 20px !important;
    }
    /* Capture promo banner: ensure children can shrink */
    .capture-promo-text { min-width: 0; }
    .capture-promo, .capture-promo > * { max-width: 100%; }
}

/* =============================================================
   Google Places Autocomplete
   ============================================================= */
.pac-container {
    z-index: 10000 !important;
    font-family: var(--font-sans);
    border-radius: 8px;
    border: 1px solid var(--color-border);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    margin-top: 4px;
    background: var(--color-card) !important;
}
.pac-item {
    padding: 8px 12px;
    font-size: 13px;
    color: var(--color-text);
    cursor: pointer;
    border-top: 1px solid var(--color-border);
}
.pac-item:first-child { border-top: none; }
.pac-item:hover,
.pac-item-selected { background: var(--color-primary-light); }
.pac-icon { display: none; }
.pac-item-query { font-weight: 600; color: var(--color-text); }
.pac-matched { font-weight: 700; }

/* =============================================================
   Art Services
   ============================================================= */
.badge-digitize { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
.badge-vectorize { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.badge-revision-needed { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.badge-pending { background: #f3f4f6; color: #6b7280; border: 1px solid #d1d5db; }
.badge-in-progress { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }

[data-theme="dark"] .badge-digitize { background: #1e3a5f; color: #93c5fd; border-color: #2563eb; }
[data-theme="dark"] .badge-vectorize { background: #052e16; color: #86efac; border-color: #16a34a; }
[data-theme="dark"] .badge-revision-needed { background: #422006; color: #fcd34d; border-color: #b45309; }
[data-theme="dark"] .badge-pending { background: #1f2937; color: #9ca3af; border-color: #4b5563; }
[data-theme="dark"] .badge-in-progress { background: #1e3a5f; color: #93c5fd; border-color: #2563eb; }

.art-history-timeline { display: flex; flex-direction: column; gap: 12px; }
.art-history-item { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 8px; background: var(--color-bg); }
.art-history-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.art-history-content { flex: 1; min-width: 0; }
.art-history-action { font-size: 13px; color: var(--color-text); line-height: 1.4; }
.art-history-meta { font-size: 11px; color: var(--color-muted); margin-top: 2px; }

.art-type-toggle { display: flex; gap: 0; border: 1px solid var(--color-border); border-radius: 8px; overflow: hidden; }
.art-type-toggle label { flex: 1; padding: 10px 16px; text-align: center; cursor: pointer; font-weight: 600; font-size: 13px; transition: all 0.15s; }
.art-type-toggle label:hover { background: var(--color-bg); }
.art-type-toggle input:checked + span { display: block; background: var(--color-primary); color: #fff; border-radius: 6px; padding: 8px 12px; margin: -8px -12px; }

.art-guide-modal .modal-box { max-width: 700px; }
.art-guide-section { margin-bottom: 20px; }
.art-guide-section h4 { font-size: 14px; font-weight: 700; margin: 0 0 6px; color: var(--color-text); }
.art-guide-section p { font-size: 13px; line-height: 1.6; color: var(--color-text-secondary); margin: 0; }

.art-service-hero { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.art-service-hero h2 { margin: 0; font-size: 20px; }

.art-service-specs { margin-top: 16px; }
.art-service-specs .detail-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--color-border); font-size: 13px; }
.art-service-specs .detail-row:last-child { border-bottom: none; }
.art-service-specs .detail-label { font-weight: 600; color: var(--color-text-secondary); }

/* Lead description sub-rows */
.lead-desc-row td { border-top: none !important; }
.lead-desc-row:hover { background: transparent !important; }

/* =============================================================
   Customer Leads
   ============================================================= */
.customer-leads-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.customer-lead-card {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 16px 20px;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.customer-lead-card:hover {
    border-color: var(--color-primary);
    box-shadow: 0 2px 8px rgba(67, 97, 238, 0.12);
}

.customer-lead-message {
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 8px;
}

.btn-img-remove {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--color-danger);
    color: #fff;
    border: none;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.customer-lead-img-thumb {
    position: relative;
    display: inline-block;
}

@media (max-width: 600px) {
    .customer-leads-grid {
        grid-template-columns: 1fr;
    }
}

/* ═══════════════════════════════════════════════════════
   ART FILE CHECKER
═══════════════════════════════════════════════════════ */

.ac-page-sub {
    color: var(--color-muted);
    font-size: 13px;
    margin: 4px 0 0;
}

/* ── Credits widget ─────────────────────────────────── */
.ac-credits-widget {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 8px 8px 8px 14px;
}
.ac-credits-widget-info { display: flex; flex-direction: row; align-items: baseline; gap: 6px; }
.ac-credits-widget-balance { font-size: 14px; font-weight: 700; color: var(--color-text); }
.ac-credits-widget-sub { font-size: 11px; color: var(--color-muted); letter-spacing: 0.2px; }
.ac-credits-widget.low-credits { border-color: rgba(245,158,11,0.4); }
.ac-credits-widget.low-credits .ac-credits-widget-balance { color: #f59e0b; }

/* ── Drop Zone ──────────────────────────────────────── */
.art-checker-drop-zone {
    position: relative;
    border: 2px dashed var(--color-border);
    border-radius: 20px;
    padding: 52px 24px 40px;
    text-align: center;
    cursor: pointer;
    background: var(--color-card);
    overflow: hidden;
    transition: border-color 0.2s, background 0.2s;
}
.art-checker-drop-zone:hover,
.art-checker-drop-zone.drag-over {
    border-color: #a855f7;
    background: rgba(168,85,247,0.04);
}
.art-checker-drop-zone.drag-over .ac-drop-icon { transform: scale(1.15); }
.ac-drop-glow {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 0%, rgba(168,85,247,0.10) 0%, transparent 70%);
    pointer-events: none;
}
.ac-drop-icon-wrap { position: relative; display: inline-block; margin-bottom: 20px; }
.ac-drop-icon {
    font-size: 52px;
    line-height: 1;
    display: block;
    transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
    filter: drop-shadow(0 4px 16px rgba(168,85,247,0.3));
}
.art-checker-drop-title { font-size: 22px; font-weight: 700; color: var(--color-text); margin-bottom: 8px; letter-spacing: -0.3px; }
.art-checker-drop-sub   { font-size: 14px; color: var(--color-muted); margin-bottom: 22px; max-width: 360px; margin-left: auto; margin-right: auto; line-height: 1.5; }
.ac-drop-btn {
    display: inline-block;
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    padding: 11px 28px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(124,58,237,0.35);
    transition: opacity 0.2s, transform 0.15s;
    margin-bottom: 24px;
}
.ac-drop-btn:hover { opacity: 0.88; transform: translateY(-1px); }
.ac-drop-formats { display: flex; justify-content: center; gap: 24px; flex-wrap: wrap; }
.ac-format-group { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.ac-format-group-label { font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: 1.5px; color: var(--color-muted); }
.ac-format-group-chips { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.ac-format-chip      { font-size: 13px; font-weight: 700; letter-spacing: 0.6px; padding: 7px 16px; border-radius: 20px; text-transform: uppercase; }
.ac-format-vector     { background: rgba(99,102,241,0.12); color: #818cf8; }
.ac-format-raster     { background: rgba(34,197,94,0.12);  color: #4ade80; }
.ac-format-embroidery { background: rgba(245,158,11,0.12); color: #fbbf24; }

/* ── Result card  -  two-column layout ───────────────── */
.ac-result-card {
    border-radius: 16px;
    overflow: hidden;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    margin-bottom: 16px;
    transition: box-shadow 0.2s, transform 0.15s;
}
.ac-result-card:hover { box-shadow: 0 8px 28px rgba(0,0,0,0.12); transform: translateY(-1px); }
.ac-result-card.verdict-pass       { border-top: 3px solid #22c55e; }
.ac-result-card.verdict-warn       { border-top: 3px solid #f59e0b; }
.ac-result-card.verdict-fail       { border-top: 3px solid #ef4444; }
.ac-result-card.verdict-embroidery { border-top: 3px solid #8b5cf6; }

.ac-card-layout {
    display: flex;
    min-height: 150px;
}
.ac-card-preview {
    width: 150px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg);
    border-right: 1px solid var(--color-border);
    overflow: hidden;
    position: relative;
}
.ac-card-preview-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 10px;
    display: block;
}
.ac-card-preview-ext {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--color-muted);
    background: var(--color-card);
    padding: 6px 12px;
    border-radius: 6px;
    letter-spacing: 1px;
}
.ac-card-content {
    flex: 1;
    min-width: 0;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.ac-card-header {
    margin: -14px -16px 0;
    padding: 16px 16px 18px;
    border-radius: 0;
    border-bottom: 1px solid var(--color-border);
}
.ac-card-header.verdict-pass {
    background: linear-gradient(135deg, rgba(34,197,94,.13) 0%, rgba(16,185,129,.06) 100%);
}
.ac-card-header.verdict-warn {
    background: linear-gradient(135deg, rgba(245,158,11,.13) 0%, rgba(234,88,12,.06) 100%);
}
.ac-card-header.verdict-fail {
    background: linear-gradient(135deg, rgba(239,68,68,.13) 0%, rgba(220,38,38,.05) 100%);
}
.ac-card-header.verdict-embroidery {
    background: linear-gradient(135deg, rgba(139,92,246,.13) 0%, rgba(109,40,217,.06) 100%);
}
.ac-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}
.ac-filename {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}
.ac-verdict-badge {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    padding: 5px 11px;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
}
.ac-verdict-badge.pass       { background: #dcfce7; color: #16a34a; }
.ac-verdict-badge.warn       { background: #fef3c7; color: #b45309; }
.ac-verdict-badge.fail       { background: #fee2e2; color: #dc2626; }
.ac-verdict-badge.embroidery { background: #ede9fe; color: #6d28d9; }
.dark-mode .ac-verdict-badge.pass       { background: rgba(34,197,94,.18);  color: #4ade80; }
.dark-mode .ac-verdict-badge.warn       { background: rgba(245,158,11,.18); color: #fbbf24; }
.dark-mode .ac-verdict-badge.fail       { background: rgba(239,68,68,.18);  color: #f87171; }
.dark-mode .ac-verdict-badge.embroidery { background: rgba(139,92,246,.2);  color: #a78bfa; }

/* ── Key metric (DPI / vector %) ────────────────────── */
.ac-key-metric { display: flex; align-items: baseline; gap: 10px; }
.ac-key-info { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; }
.ac-key-info-line { display: flex; align-items: flex-start; gap: 6px; font-size: 12px; font-weight: 500; color: var(--color-muted); line-height: 1.4; }
.ac-key-info-icon { font-size: 10px; flex-shrink: 0; margin-top: 2px; }
.ac-key-metric-value { font-size: 34px; font-weight: 900; letter-spacing: -1px; line-height: 1; }
.ac-key-metric-value.pass       { color: #22c55e; }
.ac-key-metric-value.low        { color: #f59e0b; }
.ac-key-metric-value.fail       { color: #ef4444; }
.ac-key-metric-value.embroidery { color: #8b5cf6; font-size: 28px; }
.ac-key-metric-note { font-size: 13px; font-weight: 600; color: var(--color-muted); }

/* ── Feedback list (issues + info combined) ─────────── */
.ac-feedback-list { display: flex; flex-direction: column; gap: 5px; }
.ac-issue-item, .ac-info-item {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    padding: 6px 10px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
}
.ac-issue-item.error { background: rgba(239,68,68,.08); color: #dc2626; }
.ac-issue-item.warn  { background: rgba(245,158,11,.08); color: #b45309; }
.ac-info-item        { background: var(--color-bg); color: var(--color-muted); }
.dark-mode .ac-issue-item.error { color: #f87171; }
.dark-mode .ac-issue-item.warn  { color: #fbbf24; }
.ac-issue-icon { font-size: 12px; line-height: 1.5; flex-shrink: 0; }

/* ── Recommendations ────────────────────────────────── */
.ac-recommendations {
    margin-top: 10px;
    border: 1px solid var(--color-border);
    border-radius: 9px;
    overflow: hidden;
}
.ac-rec-header {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.7px;
    text-transform: uppercase;
    color: var(--color-muted);
    padding: 6px 11px 5px;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
}
.ac-rec-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 7px 11px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.45;
    border-bottom: 1px solid var(--color-border);
}
.ac-rec-item:last-child { border-bottom: none; }
.ac-rec-item.error { color: #dc2626; background: rgba(239,68,68,.05); }
.ac-rec-item.warn  { color: #92400e; background: rgba(245,158,11,.05); }
.ac-rec-item.info         { color: var(--color-muted); background: var(--color-bg); }
.ac-image-list {
    margin-bottom: 10px;
    border: 1px solid var(--color-border);
    border-radius: 9px;
    overflow: hidden;
}
.ac-image-list-header {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.7px;
    text-transform: uppercase;
    color: var(--color-muted);
    padding: 7px 12px;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
}
.ac-img-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    font-size: 12.5px;
    border-bottom: 1px solid var(--color-border);
}
.ac-img-row:last-child { border-bottom: none; }
.ac-img-num {
    font-size: 11px;
    font-weight: 700;
    color: var(--color-muted);
    min-width: 16px;
}
.ac-img-dims { flex: 1; color: var(--color-text); font-variant-numeric: tabular-nums; }
.ac-img-enc {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-muted);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 1px 5px;
}
.ac-img-cs {
    font-size: 11px;
    font-weight: 700;
    border-radius: 4px;
    padding: 1px 5px;
    border: 1px solid transparent;
}
.ac-img-cs.cmyk { color: #0369a1; background: #e0f2fe; border-color: #bae6fd; }
.ac-img-cs.rgb  { color: #b45309; background: #fef3c7; border-color: #fde68a; }
.ac-img-cs.gray { color: #6b7280; background: #f3f4f6; border-color: #e5e7eb; }
.ac-img-dpi { font-size: 12px; font-weight: 700; min-width: 90px; text-align: right; }
.ac-img-dpi.pass    { color: #22c55e; }
.ac-img-dpi.low     { color: #f59e0b; }
.ac-img-dpi.fail    { color: #ef4444; }
.ac-img-dpi.unknown { color: var(--color-muted); font-weight: 500; }
.ac-process-compat {
    margin-bottom: 10px;
    border: 1px solid var(--color-border);
    border-radius: 9px;
    overflow: hidden;
}
.ac-process-compat-header {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.7px;
    text-transform: uppercase;
    color: var(--color-muted);
    padding: 6px 11px 5px;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
}
.ac-process-compat-body {
    display: flex;
    flex-direction: column;
}
.ac-process-group {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    font-size: 12.5px;
    font-weight: 500;
    border-bottom: 1px solid var(--color-border);
}
.ac-process-group:last-child { border-bottom: none; }
.ac-process-group.accept { background: rgba(34,197,94,.06); }
.ac-process-group.reject { background: rgba(239,68,68,.06); }
.ac-process-badge {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.3px;
    padding: 2px 8px;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
}
.ac-process-badge.accept  { background: rgba(34,197,94,.15); color: #16a34a; }
.ac-process-badge.reject  { background: rgba(239,68,68,.15); color: #dc2626; }
.ac-process-badge.neutral { background: rgba(99,102,241,.15); color: #6366f1; }
.ac-process-group.neutral { background: rgba(99,102,241,.04); }
.dark-mode .ac-process-badge.accept  { color: #4ade80; }
.dark-mode .ac-process-badge.reject  { color: #f87171; }
.dark-mode .ac-process-badge.neutral { color: #a5b4fc; }
.dark-mode .ac-rec-item.error { color: #f87171; }
.dark-mode .ac-rec-item.warn  { color: #fcd34d; }
.ac-rec-icon { font-size: 11px; flex-shrink: 0; margin-top: 1px; }

/* ── Meta chips ─────────────────────────────────────── */
.ac-meta-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: auto; padding-top: 4px; }
.ac-meta-chip {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.3px;
    color: var(--color-muted);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    padding: 2px 8px;
    border-radius: 20px;
}

/* ── Vectorize CTA (docked bottom) ──────────────────── */
.ac-vectorize-cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 13px 16px;
    background: rgba(124,58,237,0.07);
    border-top: 1px solid rgba(124,58,237,0.15);
    flex-wrap: wrap;
}
.ac-vectorize-cta.ac-vectorize-blocked {
    background: var(--color-bg);
    border-top-color: var(--color-border);
    opacity: 0.75;
}
.ac-vectorize-blocked .ac-vectorize-cta-title { color: var(--color-muted); }
.ac-vectorize-cta-info { flex: 1; min-width: 0; }
.ac-vectorize-cta-title { font-size: 13px; font-weight: 700; color: var(--color-text); }
.ac-vectorize-cta-sub   { font-size: 11px; color: var(--color-muted); margin-top: 2px; }
.ac-vectorize-cost { color: #a855f7; font-weight: 700; }

.ac-vec-size-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed rgba(124, 58, 237, 0.25);
}
.ac-vec-size-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text);
    display: flex;
    align-items: center;
    gap: 6px;
}
.ac-vec-size-hint { font-weight: 400; color: var(--color-muted); }
.ac-vec-size-inputs {
    display: flex;
    align-items: center;
    gap: 6px;
}
.ac-vec-size-in {
    width: 72px;
    padding: 4px 8px;
    font-size: 12px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: #fff;
    color: var(--color-text);
}
.ac-vec-size-in:focus {
    outline: none;
    border-color: #a855f7;
    box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.15);
}
.ac-vec-size-x    { color: var(--color-muted); font-size: 12px; }
.ac-vec-size-unit { color: var(--color-muted); font-size: 11px; font-weight: 600; }
.btn-vectorize {
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 9px 18px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(124,58,237,0.35);
    transition: opacity 0.2s, transform 0.15s;
    white-space: nowrap;
}
.btn-vectorize:hover    { opacity: 0.88; transform: translateY(-1px); }
.btn-vectorize:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ── Pass footer ────────────────────────────────────── */
.ac-pass-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(34,197,94,0.06);
    border-top: 1px solid rgba(34,197,94,0.15);
    font-size: 13px;
    color: #22c55e;
    font-weight: 600;
}

/* ── Vectorize ready CTA (after credit purchase) ────── */
.ac-vectorize-ready {
    padding: 20px 18px;
    background: linear-gradient(135deg, rgba(124,58,237,0.12), rgba(168,85,247,0.08));
    border-top: 1px solid rgba(124,58,237,0.2);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
.ac-vectorize-ready-badge {
    display: inline-block;
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    padding: 4px 12px;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(124,58,237,0.4);
    animation: acBadgePop 0.4s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes acBadgePop {
    from { transform: scale(0.6); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}
.btn-vectorize-hero {
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(124,58,237,0.45);
    transition: opacity 0.2s, transform 0.15s;
    animation: acBtnSlideUp 0.35s ease 0.1s both;
}
.btn-vectorize-hero:hover { opacity: 0.88; transform: translateY(-2px); }
@keyframes acBtnSlideUp {
    from { transform: translateY(12px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}
.ac-vectorize-ready-sub { font-size: 12px; color: #a78bfa; font-weight: 500; }

/* ── Processing state ───────────────────────────────── */
.ac-result-card.processing { opacity: 0.75; pointer-events: none; }
.ac-processing-bar {
    background: linear-gradient(90deg, #7c3aed, #a855f7, #7c3aed);
    background-size: 200%;
    animation: acBarSlide 1.2s linear infinite;
}
@keyframes acBarSlide {
    from { background-position: 0% }
    to   { background-position: 200% }
}

/* ── SVG result (after vectorization) ──────────────── */
.ac-svg-result {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 16px;
    background: rgba(34,197,94,0.06);
    border-top: 1px solid rgba(34,197,94,0.2);
    flex-wrap: wrap;
}
.ac-svg-preview {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--color-border);
    background: var(--color-bg);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ac-svg-preview img { max-width: 100%; max-height: 100%; object-fit: contain; padding: 4px; }
.ac-eps-preview { display: flex; align-items: center; justify-content: center; background: #f3f4f6; }
.ac-eps-icon { font-size: 13px; font-weight: 800; color: #6d28d9; letter-spacing: 1px; }
.ac-svg-info { flex: 1; min-width: 0; }
.ac-svg-info-title { font-size: 13px; font-weight: 700; color: #22c55e; }
.ac-svg-info-sub   { font-size: 11px; color: var(--color-muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Summary bar ────────────────────────────────────── */
.ac-summary-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 11px 16px;
    background: var(--color-card);
    border-radius: 12px;
    margin-bottom: 16px;
    border: 1px solid var(--color-border);
    font-size: 13px;
    font-weight: 500;
}
.ac-summary-stat { display: flex; align-items: center; gap: 6px; }
.ac-summary-dot  { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.ac-summary-dot.pass  { background: #22c55e; }
.ac-summary-dot.warn  { background: #f59e0b; }
.ac-summary-dot.fail  { background: #ef4444; }
.ac-summary-count  { font-weight: 700; }
.ac-summary-spacer { flex: 1; }

/* ── Check another CTA ──────────────────────────────── */
.ac-check-another-wrap {
    display: flex;
    justify-content: center;
    margin-top: 24px;
}
.ac-check-another { margin-bottom: 0; }

/* Inline "Check Another File" placed next to the Vectorize button in the
   vectorize CTA footer. Sits left of the Vectorize button so both primary
   actions share one row. Styled as a neutral ghost to keep the purple
   Vectorize CTA as the primary visual action. */
.ac-vectorize-cta-with-check { gap: 10px; }
.ac-check-another-inline {
    display: inline-flex;
    align-items: center;
    padding: 8px 14px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.8);
    color: #7c3aed;
    border: 1px solid rgba(124, 58, 237, 0.3);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s;
    margin-left: auto;
    order: 2;
}
.ac-check-another-inline:hover {
    background: #fff;
    border-color: rgba(124, 58, 237, 0.6);
}
.ac-vectorize-cta-with-check .btn-vectorize { order: 3; }
.ac-vectorize-cta-with-check .ac-vectorize-cta-info { order: 1; }

/* ── Vectorize History ───────────────────────────────── */
#vhTableWrap { margin-top: 16px; }
#vhTable .vh-date  { white-space: nowrap; color: var(--color-muted); font-size: 13px; }
#vhTable .vh-size, #vhTable .vh-credits, #vhTable .vh-user { white-space: nowrap; font-size: 13px; color: var(--color-muted); }
#vhTable .vh-credits { text-align: center; }
.vh-filename {
    font-size: 13px;
    max-width: 200px;
    display: inline-block;
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.vh-format-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.4px;
    border-radius: 4px;
    padding: 1px 5px;
    vertical-align: middle;
    margin-right: 5px;
    border: 1px solid transparent;
}
.vh-format-badge.vector { color: #6d28d9; background: #ede9fe; border-color: #ddd6fe; }
.vh-format-badge.raster { color: #0369a1; background: #e0f2fe; border-color: #bae6fd; }
.vh-actions { white-space: nowrap; }
.vh-dl-btn { font-size: 11px; margin-right: 4px; }

/* Inline "Add to Library" form inside a history row */
.vh-add-lib-form {
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}
.vh-add-lib-company {
    font-size: 12px;
    padding: 3px 6px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-card);
    color: var(--color-text);
    max-width: 140px;
}
.vh-added-badge {
    font-size: 12px;
    font-weight: 600;
    color: #059669;
    white-space: nowrap;
}
[data-theme="dark"] .vh-added-badge { color: #34d399; }
.vh-dl-svg { color: #7c3aed !important; }
.vh-load-more { display: flex; justify-content: center; padding: 20px 0; }

/* =============================================================================
   Thread Color Editor (Madeira Polyneon picker)
   Staff-only modal that opens from the art library on DST rows. Lets the
   user pick a Madeira Polyneon thread for each color change in the DST.
   ============================================================================= */
.tce-overlay {
    position: fixed; inset: 0; z-index: 1300;
    background: rgba(0,0,0,0.45);
    display: flex; align-items: center; justify-content: center;
    animation: fadeIn 0.18s ease-out;
}
.tce-modal {
    background: var(--color-card);
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: min(96vw, 1100px);
    max-height: 92vh;
    display: flex; flex-direction: column;
    overflow: hidden;
}
.tce-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--color-border);
}
.tce-title { font-size: 17px; font-weight: 700; color: var(--color-text); }
.tce-subtitle { font-size: 12px; color: var(--color-muted); margin-top: 2px; }
.tce-close {
    background: none; border: none; font-size: 24px; line-height: 1;
    color: var(--color-muted); cursor: pointer; padding: 0 4px;
}
.tce-close:hover { color: var(--color-text); }
.tce-body {
    display: grid;
    grid-template-columns: 560px 1fr;
    gap: 26px;
    padding: 24px 26px;
    overflow: auto;
    flex: 1;
}
@media (max-width: 1000px) {
    .tce-body { grid-template-columns: 1fr; }
}
.tce-preview-wrap {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 10px;
    height: fit-content;
    position: sticky; top: 0;
}
.tce-preview {
    width: 100%; height: auto; display: block;
    border-radius: 6px;
    aspect-ratio: 1 / 1; object-fit: contain;
    /* Checkered background shows through the transparent DST preview PNG
       so the user can see this is a flat design on a transparent canvas -
       same convention used by Photoshop / Figma for alpha-channel previews. */
    background-color: #fff;
    background-image:
        linear-gradient(45deg,  #d4d4d4 25%, transparent 25%),
        linear-gradient(-45deg, #d4d4d4 25%, transparent 25%),
        linear-gradient(45deg,  transparent 75%, #d4d4d4 75%),
        linear-gradient(-45deg, transparent 75%, #d4d4d4 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}
.tce-rows { display: flex; flex-direction: column; gap: 8px; }
.tce-row {
    display: grid;
    grid-template-columns: 72px 28px 1fr auto auto;
    gap: 10px;
    align-items: center;
    padding: 8px 10px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
}
.tce-row-label { font-size: 12px; font-weight: 600; color: var(--color-muted); letter-spacing: 0.2px; }
.tce-row-swatch {
    width: 28px; height: 28px; border-radius: 6px;
    border: 1px solid rgba(0,0,0,0.15);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
}
.tce-row-info { min-width: 0; }
.tce-row-code { font-size: 13px; font-weight: 700; color: var(--color-text); font-variant-numeric: tabular-nums; }
.tce-row-name { font-size: 12px; color: var(--color-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tce-row-unassigned { font-size: 12px; color: var(--color-muted); font-style: italic; }
.tce-footer {
    display: flex; align-items: center; gap: 8px;
    padding: 14px 22px;
    border-top: 1px solid var(--color-border);
    background: var(--color-bg);
}
.tce-footer-spacer { flex: 1; }
@media (max-width: 640px) {
    .tce-body { grid-template-columns: 1fr; }
    .tce-preview-wrap { position: static; }
}

/* Popover typeahead for the thread-color picker. Positioned via JS (fixed). */
.tcp-popover {
    position: fixed;
    z-index: 1400;
    width: min(380px, 90vw);
    max-height: 320px;
    display: flex; flex-direction: column;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.18);
    overflow: hidden;
    animation: fadeIn 0.12s ease-out;
}
.tcp-header { padding: 10px; border-bottom: 1px solid var(--color-border); }
.tcp-search {
    width: 100%; padding: 8px 10px; font-size: 13px;
    border: 1px solid var(--color-border); border-radius: 6px;
    background: var(--color-bg); color: var(--color-text);
}
.tcp-results { overflow: auto; flex: 1; max-height: 260px; }
.tcp-item {
    display: grid;
    grid-template-columns: 22px 56px 1fr;
    gap: 10px;
    align-items: center;
    width: 100%;
    padding: 8px 12px;
    background: transparent;
    border: 0;
    border-top: 1px solid var(--color-border);
    cursor: pointer;
    text-align: left;
    font-size: 13px;
    color: var(--color-text);
}
.tcp-item:first-child { border-top: 0; }
.tcp-item:hover { background: var(--color-bg); }
.tcp-item.selected { background: color-mix(in srgb, var(--color-primary), transparent 88%); }
.tcp-swatch { width: 20px; height: 20px; border-radius: 4px; border: 1px solid rgba(0,0,0,0.15); }
.tcp-code { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--color-text); }
.tcp-name { color: var(--color-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tcp-empty { padding: 14px; text-align: center; color: var(--color-muted); font-size: 12px; }

/* Inline DST thread-color chips: one per assigned color change. Shown on
   art-file rows in the library and on order/project/company art managers. */
/* DST thread-color chips: stacked vertically, one per color change. Shows
   "Color N" prefix, swatch, Madeira code, and full name so a glance at a
   row gives the complete palette breakdown. */
.dst-color-chips {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: stretch;
}
.dst-color-chip {
    display: grid;
    grid-template-columns: auto 14px auto 1fr;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 8px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: 11px;
    color: var(--color-text);
    line-height: 1.25;
    font-variant-numeric: tabular-nums;
}
.dst-color-chip-num {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: var(--color-muted);
    text-transform: uppercase;
    white-space: nowrap;
}
.dst-color-chip-swatch {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 1px solid rgba(0,0,0,0.15);
    flex-shrink: 0;
}
.dst-color-chip-code {
    font-weight: 700;
    letter-spacing: 0.2px;
    color: var(--color-text);
    white-space: nowrap;
}
.dst-color-chip-name {
    color: var(--color-muted);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    min-width: 0;
}
/* Unassigned chip: slightly faded background so it reads as "placeholder"
   next to the assigned chips above/below it. */
.dst-color-chip.dst-color-chip-unassigned {
    background: color-mix(in srgb, var(--color-bg), transparent 30%);
    border-style: dashed;
}
.dst-color-chip.dst-color-chip-unassigned .dst-color-chip-code { color: var(--color-muted); }

/* =============================================================================
   Art Color Chips (non-DST: PMS / HEX / CMYK)
   Vertical stack, same footprint as .dst-color-chips but with a type tag
   instead of the thread-number prefix.
   ============================================================================= */
.art-color-chips {
    display: flex; flex-direction: column; gap: 4px; align-items: stretch;
}
.art-color-chip {
    display: grid;
    grid-template-columns: auto 14px auto 1fr;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 8px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: 11px;
    color: var(--color-text);
    line-height: 1.25;
    font-variant-numeric: tabular-nums;
}
.art-color-chip-num {
    font-size: 10px; font-weight: 700; letter-spacing: 0.3px;
    color: var(--color-muted); text-transform: uppercase; white-space: nowrap;
}
.art-color-chip-swatch {
    width: 14px; height: 14px; border-radius: 3px;
    border: 1px solid rgba(0,0,0,0.15); flex-shrink: 0;
}
.art-color-chip-type {
    font-size: 9px; font-weight: 800; letter-spacing: 0.5px;
    padding: 1px 6px; border-radius: 4px;
    background: #eef2ff; color: #4338ca;
    white-space: nowrap; align-self: center;
}
.art-color-chip-value {
    font-weight: 600; color: var(--color-text);
    overflow: hidden; white-space: nowrap; text-overflow: ellipsis; min-width: 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px;
}

/* =============================================================================
   Art Color Editor Modal (PMS / HEX / CMYK)
   ============================================================================= */
.ace-overlay {
    position: fixed; inset: 0; z-index: 1400;
    background: rgba(0,0,0,0.55);
    display: flex; align-items: center; justify-content: center;
    animation: fadeIn 0.15s ease-out;
}
.ace-modal {
    background: var(--color-card);
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: min(95vw, 620px);
    max-height: 90vh;
    display: flex; flex-direction: column;
    overflow: hidden;
}
.ace-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 22px;
    border-bottom: 1px solid var(--color-border);
    gap: 16px;
}
.ace-header-left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}
.ace-file-thumb {
    flex: 0 0 auto;
    width: 56px; height: 56px;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    object-fit: contain;
    background-color: #ffffff;
    background-image:
        linear-gradient(45deg, #e5e7eb 25%, transparent 25%),
        linear-gradient(-45deg, #e5e7eb 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #e5e7eb 75%),
        linear-gradient(-45deg, transparent 75%, #e5e7eb 75%);
    background-size: 12px 12px;
    background-position: 0 0, 0 6px, 6px -6px, -6px 0;
}
.ace-file-thumb-ext {
    display: flex; align-items: center; justify-content: center;
    background: var(--color-bg);
    color: var(--color-muted);
    font-size: 12px; font-weight: 700;
    letter-spacing: 0.5px;
}
.ace-title { font-size: 17px; font-weight: 700; color: var(--color-text); }
.ace-subtitle {
    font-size: 12px; color: var(--color-muted); margin-top: 2px;
    max-width: 420px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ace-close {
    background: none; border: none; font-size: 24px; line-height: 1;
    color: var(--color-muted); cursor: pointer; padding: 0 4px;
}
.ace-close:hover { color: var(--color-text); }
.ace-body {
    flex: 1; overflow: auto;
    display: flex; flex-direction: column;
    min-height: 320px;
}
.ace-left { padding: 18px 22px; border-bottom: 1px solid var(--color-border); }
.ace-right { padding: 18px 22px; background: var(--color-bg); }
.ace-tabs {
    display: inline-flex; border: 1px solid var(--color-border);
    border-radius: 8px; overflow: hidden; margin-bottom: 10px;
}
.ace-tab {
    background: var(--color-card); border: 0; padding: 8px 18px;
    font-size: 13px; font-weight: 600; color: var(--color-muted);
    cursor: pointer; transition: background 0.1s, color 0.1s;
    min-width: 80px;
}
.ace-tab.active { background: var(--color-primary); color: #fff; }
.ace-tab-help {
    font-size: 12px; color: var(--color-muted);
    margin-bottom: 16px; line-height: 1.5;
}
.ace-field { display: block; }
.ace-field-label {
    display: block; font-size: 12px; font-weight: 600; color: var(--color-text);
    margin-bottom: 6px;
}
.ace-pms-combo { position: relative; }
.ace-pms-results {
    position: absolute; top: calc(100% + 4px); left: 0; right: 0;
    max-height: 320px; overflow: auto;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    z-index: 10;
}
.ace-pms-item {
    display: grid;
    grid-template-columns: 20px 1fr auto;
    gap: 10px; align-items: center;
    width: 100%; padding: 8px 12px;
    background: transparent; border: 0; cursor: pointer;
    text-align: left; font: inherit;
    border-bottom: 1px solid var(--color-border);
}
.ace-pms-item:last-child { border-bottom: 0; }
.ace-pms-item:hover, .ace-pms-item.ace-pms-item-active {
    background: #eef2ff;
}
.ace-pms-swatch { width: 20px; height: 20px; border-radius: 4px; border: 1px solid rgba(0,0,0,0.2); }
.ace-pms-label { font-size: 13px; font-weight: 600; color: var(--color-text); }
.ace-pms-hex { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; color: var(--color-muted); }
.ace-pms-empty { padding: 10px 12px; color: var(--color-muted); font-size: 13px; font-style: italic; }
.ace-hex-row { display: flex; gap: 8px; align-items: center; }
.ace-hex-row input[type="color"] {
    width: 48px; height: 38px; border: 1px solid var(--color-border);
    border-radius: 6px; padding: 2px; cursor: pointer; background: transparent;
}
.ace-cmyk-row {
    display: grid; grid-template-columns: 80px 1fr auto;
    gap: 16px; align-items: center;
}
.ace-cmyk-preview {
    width: 80px; height: 80px; border-radius: 10px;
    border: 1px solid var(--color-border);
    box-shadow: inset 0 0 0 3px #fff;
    background: #ff0;
    transition: background 0.08s;
}
.ace-cmyk-sliders { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ace-cmyk-slider {
    display: grid; grid-template-columns: 18px 1fr; gap: 6px; align-items: center;
    font-size: 12px; font-weight: 700; color: var(--color-text);
}
.ace-cmyk-slider input[type="number"] {
    width: 100%;
    font-variant-numeric: tabular-nums;
}
/* Hex text input: app-standard .filter-input base + monospace number feel. */
.ace-hex-text { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 600; text-transform: uppercase; flex: 1; }
/* Pick-from-image pseudo-tab: sits in the tab row but is an action button. */
/* "Pick from image" is an action button, not a tab. Lives in the same
   horizontal row as the tab group but renders as a standalone secondary
   button so there's no "is this selected?" ambiguity. */
.ace-tabs-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.ace-tabs-row .ace-tabs { margin-bottom: 0; }
.ace-tab-pick {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--color-primary);
    color: #fff;
    border: 1px solid var(--color-primary);
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(99, 102, 241, 0.25);
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.05s;
}
.ace-tab-pick:hover {
    background: #5b5ee8;
    border-color: #5b5ee8;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.35);
}
.ace-tab-pick:active {
    background: #4f52d4;
    border-color: #4f52d4;
    transform: translateY(1px);
    box-shadow: 0 1px 2px rgba(99, 102, 241, 0.3);
}
/* Suggested colors row (auto-extracted dominant palette). Sits above the
   assigned list in the art color editor. Each chip is click-to-add as
   PMS (default), with a hover menu for HEX / RGB / CMYK alternatives. */
.ace-suggest {
    display: flex; flex-wrap: wrap; gap: 6px;
    padding: 6px; background: var(--color-bg);
    border: 1px solid var(--color-border); border-radius: 8px;
    /* No overflow clipping here - the popover menu on hover uses
       position:absolute outside the chip, and overflow:auto on the
       parent would crop it to the container bounds. Letting the row
       grow to fit every chip is fine - 12 colors max wraps to ~3 rows. */
    overflow: visible;
}
.ace-suggest-empty {
    padding: 8px; font-size: 12px; color: var(--color-muted);
    font-style: italic; text-align: center; width: 100%;
}
.ace-suggest-chip {
    position: relative;
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 8px 4px 4px;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    font-size: 11px; font-weight: 600;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
}
.ace-suggest-chip:hover { border-color: var(--color-primary); background: rgba(99,102,241,0.06); }
.ace-suggest-swatch {
    width: 20px; height: 20px; border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.15);
}
.ace-suggest-label { font-variant-numeric: tabular-nums; }
.ace-suggest-add {
    display: inline-flex; align-items: center; justify-content: center;
    width: 18px; height: 18px; border-radius: 50%;
    background: var(--color-primary); color: #fff;
    font-weight: 700; font-size: 13px;
    margin-left: 2px;
}
/* Hover popover replaced with a simpler contextual pattern: the chip
   labels + click behavior follow whichever tab (PMS / HEX / RGB /
   CMYK) is active, so there's nothing to hover for. */

.ace-list { display: flex; flex-direction: column; gap: 6px; }
.ace-list-empty {
    padding: 20px 4px; color: var(--color-muted); font-size: 12px; font-style: italic;
    text-align: center; line-height: 1.5;
}
.ace-list-row {
    display: grid;
    grid-template-columns: auto 32px auto 1fr auto;
    gap: 12px; align-items: center;
    padding: 10px 14px;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-variant-numeric: tabular-nums;
}
.ace-list-num { font-size: 13px; font-weight: 700; color: var(--color-muted); min-width: 18px; }
.ace-list-swatch { width: 32px; height: 32px; border-radius: 6px; border: 1px solid rgba(0,0,0,0.2); }
.ace-list-type {
    font-size: 10px; font-weight: 800; letter-spacing: 0.5px;
    padding: 3px 8px; border-radius: 4px;
    background: #eef2ff; color: #4338ca;
    white-space: nowrap;
}
.ace-list-value {
    font-weight: 700;
    font-size: 16px;
    white-space: nowrap;
}
.ace-list-remove {
    background: transparent; border: 0; color: var(--color-muted);
    font-size: 18px; line-height: 1; cursor: pointer; padding: 0 4px;
    border-radius: 4px;
}
.ace-list-remove:hover { background: #fee2e2; color: #b91c1c; }
.ace-footer {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    padding: 12px 22px;
    border-top: 1px solid var(--color-border);
}

/* =============================================================================
   Color Converter page (PMS <-> RGB/HEX)
   ============================================================================= */
.cc-card { padding: 24px 28px; }
.cc-mode-toggle {
    display: inline-flex;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    overflow: hidden;
    margin: 0 auto 22px;
    align-self: center;
}
.cc-card { display: flex; flex-direction: column; align-items: stretch; }
.cc-mode-btn {
    background: var(--color-card); border: 0;
    padding: 10px 22px;
    font-size: 13px; font-weight: 600; color: var(--color-muted);
    cursor: pointer;
    transition: background 0.1s, color 0.1s;
    min-width: 200px;
}
.cc-mode-btn.active { background: var(--color-primary); color: #fff; }
.cc-panel-title { font-size: 20px; font-weight: 700; margin: 0 0 4px; color: var(--color-text); text-align: center; }
.cc-panel-sub { font-size: 13px; color: var(--color-muted); margin: 0 auto 20px; text-align: center; max-width: 640px; }

/* Mode A grid: PMS picker on the left, big readout on the right. */
.cc-to-rgb-grid {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 28px;
    align-items: start;
    max-width: 820px;
    margin: 0 auto;
}
.cc-to-rgb-input .ace-pms-combo { margin-top: 6px; }
.cc-to-rgb-output {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    min-height: 260px;
    overflow: hidden;
}
.cc-readout-empty {
    padding: 30px 20px; text-align: center;
    color: var(--color-muted); font-style: italic; font-size: 13px;
}
.cc-readout-swatch {
    width: 100%; height: 180px;
    background: #e2e8f0;
}
.cc-readout-labels {
    padding: 14px 16px;
    display: flex; flex-direction: column; gap: 3px;
    font-size: 13px; color: var(--color-text);
    font-variant-numeric: tabular-nums;
}
.cc-readout-title {
    font-size: 14px; font-weight: 700; margin-bottom: 4px;
    color: var(--color-text);
}
.cc-readout-row strong {
    display: inline-block; min-width: 42px;
    color: var(--color-muted); font-weight: 700;
    text-transform: uppercase; font-size: 11px; letter-spacing: 0.3px;
}
.cc-readout-cmyk { margin-top: 4px; padding-top: 6px; border-top: 1px dashed var(--color-border); }

/* Mode B grid: inputs on the left, selected preview on the right. */
.cc-to-pms-grid {
    display: grid;
    grid-template-columns: 1fr 260px;
    gap: 24px;
    align-items: stretch;
    max-width: 880px;
    margin: 0 auto 18px;
}
.cc-to-pms-input {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 18px;
    display: flex; flex-direction: column; gap: 14px;
}
.cc-rgb-row, .cc-hex-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.cc-rgb-slot { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 110px; }
.cc-rgb-slot span { font-size: 13px; font-weight: 700; color: var(--color-text); min-width: 20px; }
.cc-rgb-slot input { flex: 1; min-width: 0; }
.cc-hex-slot span { min-width: 36px; }
.cc-hex-row input[type="color"] {
    width: 44px; height: 38px; border: 1px solid var(--color-border);
    border-radius: 6px; padding: 2px; cursor: pointer; background: transparent;
}
.cc-to-pms-preview {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    overflow: hidden;
    display: flex; flex-direction: column;
}
.cc-to-pms-swatch { flex: 1; min-height: 160px; background: #e2e8f0; transition: background 0.15s; }
.cc-to-pms-labels {
    padding: 12px 14px;
    background: var(--color-bg);
    border-top: 1px solid var(--color-border);
    display: flex; flex-direction: column; gap: 3px;
    font-size: 12px; color: var(--color-text);
    font-variant-numeric: tabular-nums;
}
.cc-to-pms-label-row strong { color: var(--color-text); font-size: 13px; display: block; margin-bottom: 2px; }

/* Color Converter mobile: stack the two-column picker/preview grids
   so the preview panel doesn't get clipped on narrow viewports,
   shrink the mode toggle so both tabs fit side-by-side without the
   label wrapping to two lines, and tighten the card padding to
   reclaim horizontal room for the search input. */
@media (max-width: 640px) {
    .cc-card { padding: 16px; }
    .cc-mode-toggle { width: 100%; display: flex; }
    .cc-mode-btn {
        min-width: 0;
        flex: 1 1 0;
        padding: 10px 8px;
        font-size: 12px;
        line-height: 1.25;
    }
    .cc-panel-title { font-size: 17px; }
    .cc-panel-sub { font-size: 12px; margin-bottom: 14px; }
    .cc-to-rgb-grid,
    .cc-to-pms-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }
    .cc-to-rgb-output { min-height: 0; }
    .cc-readout-swatch { height: 140px; }
    .cc-to-pms-swatch { min-height: 120px; }
    .cc-rgb-slot { min-width: 0; flex: 1 1 calc(50% - 10px); }
    .cc-hex-row { flex-wrap: wrap; }
    .cc-hex-row input[type="color"] { flex: 0 0 44px; }
}

.cc-matches-header {
    font-size: 13px; font-weight: 700; color: var(--color-text);
    margin: 12px 0 10px; padding-top: 18px;
    border-top: 1px solid var(--color-border);
}
.cc-matches {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}
.cc-match-card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.12s, box-shadow 0.12s;
    cursor: default;
}
.cc-match-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(0,0,0,0.12);
}
.cc-match-swatch { height: 110px; background: #e2e8f0; }
.cc-match-meta {
    padding: 10px 12px;
    display: flex; flex-direction: column; gap: 3px;
    font-size: 12px; color: var(--color-text);
    font-variant-numeric: tabular-nums;
}
.cc-match-code {
    font-weight: 700; font-size: 13px;
    display: flex; align-items: center; gap: 6px;
    flex-wrap: wrap;
}
.cc-match-code-label { white-space: nowrap; }
.cc-match-distance { color: var(--color-muted); font-size: 11px; }
.cc-match-code .cc-dist-badge { margin-left: 0; }
.cc-match-hex { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; color: var(--color-muted); }
.cc-matches-footer { display: flex; justify-content: center; margin-top: 14px; }

/* =============================================================================
   Color Matcher: standalone intro page + modal (eyedropper)
   ============================================================================= */
.cm-intro-card { padding: 32px 32px 26px; text-align: center; max-width: 780px; margin: 0 auto; }
.cm-intro-title { font-size: 22px; font-weight: 700; margin: 0 0 6px; color: var(--color-text); }
.cm-intro-sub { font-size: 14px; color: var(--color-muted); margin: 0 auto 22px; max-width: 620px; line-height: 1.55; }
.cm-intro-buttons { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 22px; }
.cm-intro-tips { margin: 18px auto 0; padding: 14px 20px; background: var(--color-bg); border: 1px solid var(--color-border); border-radius: 10px; max-width: 620px; font-size: 13px; color: var(--color-muted); list-style: disc; text-align: left; padding-left: 36px; }
.cm-intro-tips li { margin: 4px 0; line-height: 1.5; }

/* Modal overlay + shell — same pattern as .ace-overlay. */
.cm-overlay {
    position: fixed; inset: 0; z-index: 1400;
    background: rgba(0,0,0,0.55);
    display: flex; align-items: center; justify-content: center;
    animation: fadeIn 0.18s ease-out;
}
.cm-modal {
    background: var(--color-card);
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: min(98vw, 1500px);
    max-height: 95vh;
    display: flex; flex-direction: column;
    overflow: hidden;
}
.cm-header {
    padding: 16px 22px;
    border-bottom: 1px solid var(--color-border);
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px;
}
.cm-title { font-size: 17px; font-weight: 700; color: var(--color-text); }
.cm-subtitle { font-size: 12px; color: var(--color-muted); margin-top: 2px; }
.cm-close {
    background: transparent; border: 0; font-size: 24px; line-height: 1;
    color: var(--color-muted); cursor: pointer; padding: 4px 10px;
    border-radius: 6px;
}
.cm-close:hover { background: var(--color-bg); color: var(--color-text); }

/* Body is a vertical flex column: the grid (canvas + controls) sits
   above the swatch strip so the two never collide. */
.cm-body {
    flex: 1; overflow: auto;
    display: flex; flex-direction: column;
    gap: 18px; padding: 18px 22px;
}
.cm-body-grid {
    display: grid; grid-template-columns: minmax(0, 1fr) 320px;
    gap: 18px; align-items: start;
}
.cm-body-empty { display: block; padding: 18px 22px; }
@media (max-width: 900px) {
    .cm-body-grid { grid-template-columns: 1fr; }
}

/* Canvas pane (left). Hugs the image so there's no wasted letterbox
   space - image renders at its largest possible size without
   artificial min-height padding around it. */
.cm-canvas-pane {
    background: repeating-conic-gradient(#f1f5f9 0% 25%, #e2e8f0 0% 50%) 0 0 / 20px 20px;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    position: relative;
    display: flex; align-items: flex-start; justify-content: center;
    overflow: hidden;
    padding: 8px;
    align-self: start;
}
.cm-canvas-wrap {
    position: relative;
    max-width: 100%; max-height: 100%;
    cursor: crosshair;
    line-height: 0;
    display: flex;
}
.cm-canvas-wrap canvas {
    display: block;
    max-width: 100%;
    /* Leave room for modal header/footer + one row of captured-color
       cards (~200px) so the cards are visible without scrolling. */
    max-height: calc(95vh - 420px);
    width: 100%; height: auto;
    image-rendering: -webkit-optimize-contrast;
}
.cm-loupe {
    position: absolute; pointer-events: none;
    width: 128px; height: 128px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.35);
    background-size: 1280px 1280px;
    background-repeat: no-repeat;
    image-rendering: pixelated;
    display: none;
    z-index: 2;
}
.cm-loupe-xhair {
    position: absolute; pointer-events: none;
    width: 128px; height: 128px;
    display: none;
    z-index: 3;
}
.cm-loupe-xhair::before,
.cm-loupe-xhair::after {
    content: '';
    position: absolute;
    background: rgba(0,0,0,0.6);
    box-shadow: 0 0 0 1px rgba(255,255,255,0.6);
}
.cm-loupe-xhair::before { left: 50%; top: 0; width: 1px; height: 100%; transform: translateX(-0.5px); }
.cm-loupe-xhair::after { top: 50%; left: 0; height: 1px; width: 100%; transform: translateY(-0.5px); }

/* Right column: controls + hover readout. */
.cm-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.cm-panel {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 14px;
}
.cm-panel-title {
    font-size: 11px; font-weight: 700; color: var(--color-muted);
    text-transform: uppercase; letter-spacing: 0.5px;
    margin: 0 0 10px;
}
.cm-ctrl-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.cm-ctrl-row label { font-size: 12px; color: var(--color-text); flex: 1; }
.cm-ctrl-row select.filter-input { flex: 1.2; }
.cm-ctrl-row:last-child { margin-bottom: 0; }
.cm-ctrl-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

.cm-readout { display: flex; gap: 12px; align-items: flex-start; }
.cm-readout-swatch {
    width: 64px; height: 64px;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    background: #e2e8f0;
    flex-shrink: 0;
}
.cm-readout-lines {
    flex: 1; min-width: 0;
    font-size: 12px; color: var(--color-text);
    font-variant-numeric: tabular-nums;
    display: flex; flex-direction: column; gap: 3px;
}
.cm-readout-lines strong {
    display: inline-block; min-width: 40px;
    color: var(--color-muted); font-weight: 700;
    text-transform: uppercase; font-size: 10px; letter-spacing: 0.3px;
}
.cm-readout-empty { font-size: 12px; color: var(--color-muted); font-style: italic; }

/* Captured swatch strip below the grid. Two-column layout: Palette
   on the left, Captured on the right, with a vertical divider. When
   Captured is empty the right column hides and Palette expands to
   fill the full width (see .cm-swatches-pane-solo). */
.cm-swatches-pane {
    border-top: 1px solid var(--color-border);
    padding-top: 14px;
    background: var(--color-card);
    position: relative;
    z-index: 1;
}
.cm-swatches-pane-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}
/* Palette is the reference / locked side - subtle indigo-tinted wash
   so it visually reads as a fixed reference, not something the user
   built up. Captured side stays the neutral card background. */
.cm-swatches-pane-split > .cm-section:first-child {
    background: rgba(99, 102, 241, 0.06);
    border: 1px solid rgba(99, 102, 241, 0.18);
    border-radius: 10px;
    padding: 12px 14px;
}
.cm-swatches-pane-split > .cm-section + .cm-section {
    padding-left: 18px;
    margin-left: 18px;
}
.cm-section {
    display: flex; flex-direction: column; gap: 10px;
    min-width: 0;
}
@media (max-width: 900px) {
    .cm-swatches-pane-split { grid-template-columns: 1fr; gap: 14px; }
    .cm-swatches-pane-split > .cm-section + .cm-section {
        padding-left: 0;
        margin-left: 0;
    }
}
/* Inline tag identifying each section at a glance. */
.cm-section-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-right: 6px;
    vertical-align: middle;
}
.cm-section-tag-palette {
    background: rgba(99, 102, 241, 0.14);
    color: var(--color-primary);
}
.cm-section-tag-captured {
    background: rgba(22, 163, 74, 0.14);
    color: #15803d;
}
.cm-swatches-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 10px;
}
.cm-swatches-title { font-size: 13px; font-weight: 700; color: var(--color-text); }
.cm-swatches-actions { display: flex; gap: 6px; }
.cm-swatches {
    display: grid;
    /* Narrower min-width so 2 cards fit per column (palette+captured
       each get roughly half the modal width). Pantone names stay on
       one line via nowrap; distance badge wraps below if tight. */
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    grid-auto-rows: 1fr;
    gap: 12px;
    align-items: stretch;
}
.cm-swatches-empty {
    padding: 18px; text-align: center;
    color: var(--color-muted); font-style: italic; font-size: 13px;
    border: 1px dashed var(--color-border); border-radius: 8px;
}
.cm-card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    overflow: hidden;
    display: flex; flex-direction: column;
    height: 100%;
}
.cm-card-swatch { height: 64px; flex: 0 0 64px; background: #e2e8f0; position: relative; }
.cm-card-remove {
    position: absolute; top: 4px; right: 4px;
    width: 22px; height: 22px;
    border: 0; border-radius: 50%;
    background: rgba(0,0,0,0.55); color: #fff;
    font-size: 14px; line-height: 1;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.cm-card-remove:hover { background: rgba(220,38,38,0.85); }
.cm-card-body {
    padding: 10px 12px;
    font-size: 12px; color: var(--color-text);
    font-variant-numeric: tabular-nums;
    display: flex; flex-direction: column; gap: 3px;
    flex: 1;
    min-height: 0;
}
/* Every "row" inside a card body occupies the same height so the Hex,
   RGB, and CMYK lines line up visually across all cards in the grid. */
.cm-card-row {
    min-height: 18px;
    line-height: 18px;
    display: flex; align-items: center; gap: 6px;
}
.cm-card-row strong {
    display: inline-block; min-width: 38px;
    color: var(--color-muted); font-weight: 700;
    text-transform: uppercase; font-size: 10px; letter-spacing: 0.3px;
    line-height: 18px;
}
/* PMS chip sits at the bottom of the body and stays the same height
   even on cards where the API returned no match. */
.cm-card-pms { margin-top: auto; min-height: 30px; }
.cm-card-pms {
    background: var(--color-bg);
    padding: 6px 8px;
    border-radius: 6px;
    margin-top: 4px;
    display: flex; align-items: center; gap: 6px;
    flex-wrap: wrap;
    font-size: 12px; font-weight: 600; color: var(--color-text);
}
.cm-card-pms > span { white-space: nowrap; }
.cm-card-pms-swatch { width: 16px; height: 16px; border-radius: 3px; border: 1px solid rgba(0,0,0,0.1); }
/* Match-quality badge: green = close (<15), amber = moderate (<30),
   red = poor (>=30). Same pill style used on Color Converter match
   cards for consistency. */
.cc-dist-badge,
.cm-dist-badge {
    display: inline-flex; align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    margin-left: auto;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.cc-dist-close,
.cm-dist-close  { background: rgba(22,163,74,0.15);  color: #15803d; }
.cc-dist-mid,
.cm-dist-mid    { background: rgba(217,119,6,0.15);  color: #b45309; }
.cc-dist-far,
.cm-dist-far    { background: rgba(220,38,38,0.15);  color: #b91c1c; }
.cm-card-actions {
    display: flex; gap: 4px; padding: 0 8px 8px;
    flex-wrap: wrap;
    margin-top: auto;
}
.cm-card-actions .btn {
    flex: 1 1 calc(50% - 2px);
    min-width: 0;
    padding: 4px 6px;
    font-size: 11px;
    white-space: nowrap;
    min-height: 26px;
    line-height: 18px;
}
.cm-card-saveas {
    padding: 6px 10px 10px;
    font-size: 11px; color: var(--color-muted);
    display: flex; align-items: center; gap: 6px;
}
.cm-card-saveas select { flex: 1; font-size: 11px; padding: 3px 6px; }
.cm-card-select {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 10px 10px;
    font-size: 11px; color: var(--color-text);
    cursor: pointer;
}
.cm-card-select input[type="checkbox"] {
    width: 14px; height: 14px; cursor: pointer; flex-shrink: 0;
}
.cm-card-select select {
    flex: 1; font-size: 11px; padding: 3px 6px;
    border: 1px solid var(--color-border); border-radius: 4px;
    background: var(--color-card); color: var(--color-text);
}
.cm-card-matches {
    padding: 8px 10px;
    border-top: 1px solid var(--color-border);
    background: var(--color-bg);
    display: none;
    grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
    gap: 4px;
}
.cm-card-matches.open { display: grid; }
.cm-card-match {
    aspect-ratio: 1;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid rgba(0,0,0,0.1);
    position: relative;
}
.cm-card-match.active { outline: 2px solid var(--color-primary); outline-offset: 1px; }
.cm-card-match-label { display: block; font-size: 9px; text-align: center; color: var(--color-muted); margin-top: 2px; }

.cm-footer {
    padding: 12px 22px;
    border-top: 1px solid var(--color-border);
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px;
}
.cm-footer-actions { display: flex; gap: 8px; }
.cm-footer-note { font-size: 11px; font-style: italic; color: var(--color-muted); flex: 1; }

/* Initial source-picker state shown when no file is loaded yet. */
.cm-source {
    grid-column: 1 / -1;
    padding: 48px 28px;
    text-align: center;
    background: var(--color-bg);
    border: 2px dashed var(--color-border);
    border-radius: 12px;
}
.cm-source-icon {
    width: 56px; height: 56px; margin: 0 auto 14px;
    border-radius: 50%; background: var(--color-card);
    display: flex; align-items: center; justify-content: center;
    font-size: 28px; color: var(--color-primary);
}
.cm-source-title { font-size: 16px; font-weight: 700; margin-bottom: 4px; color: var(--color-text); }
.cm-source-sub { font-size: 13px; color: var(--color-muted); margin-bottom: 16px; }
.cm-source-buttons { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.cm-source-hint { font-size: 11px; color: var(--color-muted); margin-top: 12px; font-style: italic; }

.cm-loading {
    grid-column: 1 / -1;
    padding: 48px 28px;
    text-align: center;
    color: var(--color-muted);
    font-size: 13px;
}

/* =============================================================================
   Scale Preview Viewer (works for every art file type)
   Renders the file with rulers on the top + left. Size uses a per-device
   calibration factor (pixels-per-inch) stored in localStorage; default 96.
   Users can calibrate via the Calibrate button in the header.
   ============================================================================= */
.asv-overlay {
    position: fixed; inset: 0; z-index: 1350;
    background: rgba(0,0,0,0.55);
    display: flex; align-items: center; justify-content: center;
    animation: fadeIn 0.18s ease-out;
}
.asv-modal {
    background: var(--color-card);
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: min(96vw, 1200px);
    max-height: 92vh;
    display: flex; flex-direction: column;
    overflow: hidden;
}
.asv-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 22px; border-bottom: 1px solid var(--color-border);
    gap: 16px;
}
.asv-title { font-size: 17px; font-weight: 700; color: var(--color-text); }
.asv-subtitle { font-size: 12px; color: var(--color-muted); margin-top: 2px; }
.asv-header-controls { display: flex; align-items: center; gap: 12px; }
.asv-ppi-chip {
    font-size: 11px; font-weight: 600; padding: 4px 10px;
    background: var(--color-bg); color: var(--color-muted);
    border: 1px solid var(--color-border); border-radius: 999px;
    font-variant-numeric: tabular-nums;
}
.asv-ppi-chip.asv-ppi-chip-calibrated {
    background: #ecfdf5; color: #065f46; border-color: #6ee7b7;
}
.asv-unit-toggle {
    display: inline-flex; border: 1px solid var(--color-border);
    border-radius: 8px; overflow: hidden;
}
.asv-unit-btn {
    background: var(--color-card); border: 0; padding: 6px 14px;
    font-size: 12px; font-weight: 600; color: var(--color-muted);
    cursor: pointer; transition: background 0.1s, color 0.1s;
}
.asv-unit-btn.active { background: var(--color-primary); color: #fff; }
.asv-close {
    background: none; border: none; font-size: 24px; line-height: 1;
    color: var(--color-muted); cursor: pointer; padding: 0 4px;
}
.asv-close:hover { color: var(--color-text); }
.asv-body {
    flex: 1; overflow: auto;
    padding: 18px 22px;
    background: var(--color-bg);
}
.asv-loading, .asv-error {
    text-align: center; padding: 40px; color: var(--color-muted); font-size: 13px;
}
.asv-error { color: var(--color-danger); }
.asv-size-readout {
    text-align: center; margin-bottom: 14px;
    font-size: 14px; color: var(--color-muted);
    font-variant-numeric: tabular-nums;
}
.asv-size-readout strong { color: var(--color-text); font-weight: 700; margin-right: 6px; }
.asv-stage-wrap {
    display: flex; justify-content: center;
    padding: 8px;
}
/* Grid-positioned rulers + art area. Corner is top-left, h-ruler is top row,
   v-ruler is left column, art fills the bottom-right cell. */
.asv-stage {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto 1fr;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 0;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
.asv-ruler-corner {
    grid-column: 1; grid-row: 1;
    background: #fafafa;
    border-right: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
}
.asv-ruler-h-wrap {
    grid-column: 2; grid-row: 1;
    border-bottom: 1px solid var(--color-border);
    overflow: hidden;
}
.asv-ruler-v-wrap {
    grid-column: 1; grid-row: 2;
    border-right: 1px solid var(--color-border);
    overflow: hidden;
}
.asv-art {
    grid-column: 2; grid-row: 2;
    /* Standard Photoshop/Figma checker to indicate transparency. */
    background-color: #fff;
    background-image:
        linear-gradient(45deg, #e5e7eb 25%, transparent 25%),
        linear-gradient(-45deg, #e5e7eb 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #e5e7eb 75%),
        linear-gradient(-45deg, transparent 75%, #e5e7eb 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
    position: relative;
}
.asv-art img {
    width: 100%; height: 100%;
    display: block;
    object-fit: contain;
}
/* Centered loader shown while the art is fetching/rendering. Hidden by
   JS once the <img> load event fires. */
.asv-art-loading {
    position: absolute; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 12px;
    background: rgba(255,255,255,0.72);
    backdrop-filter: blur(2px);
    z-index: 1;
    pointer-events: none;
}
.asv-art-spinner {
    width: 40px; height: 40px;
    border: 3px solid rgba(79,70,229,0.2);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: asv-spin 0.8s linear infinite;
}
.asv-art-loading-text {
    font-size: 12px; font-weight: 600; color: var(--color-text);
    letter-spacing: 0.3px;
}
@keyframes asv-spin { to { transform: rotate(360deg); } }
.asv-footer {
    padding: 12px 22px;
    border-top: 1px solid var(--color-border);
    background: var(--color-card);
}
.asv-caveat {
    font-size: 11px; color: var(--color-muted); font-style: italic; text-align: center;
    line-height: 1.4;
}
.asv-no-dims {
    text-align: center; padding: 30px 20px; color: var(--color-text);
}
.asv-no-dims-icon { font-size: 32px; margin-bottom: 12px; }
.asv-no-dims-title { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.asv-no-dims-desc { font-size: 13px; color: var(--color-muted); max-width: 420px; margin: 0 auto 14px; line-height: 1.5; }
.asv-no-dims-form { display: inline-flex; align-items: center; gap: 8px; }

/* Scale calibration modal (credit-card reference) */
.scal-card-wrap {
    display: flex; justify-content: center;
    padding: 18px 8px;
    background: repeating-linear-gradient(45deg, #f3f4f6 0 8px, #fff 8px 16px);
    border: 1px solid var(--color-border);
    border-radius: 8px;
}
.scal-card {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    border-radius: 10px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.25);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 600; text-align: center;
    transition: width 0.05s linear, height 0.05s linear;
}
.scal-card-label { font-size: 13px; line-height: 1.4; }
.scal-card-label span { font-size: 11px; font-weight: 500; opacity: 0.85; }
.scal-slider-row {
    display: flex; align-items: center; gap: 12px;
    margin-top: 18px;
}
.scal-ppi-readout {
    font-variant-numeric: tabular-nums;
    font-weight: 700; font-size: 13px; color: var(--color-text);
    min-width: 90px; text-align: right;
}


/* Vectorize History section when rendered inline on the Art File Checker
   page (merged from the previously standalone vectorize-history view). Adds
   a clear visual break between the checker UI above and the history table. */
.ac-history-section {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--color-border);
}
.ac-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.ac-history-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text);
    margin: 0;
}
.ac-history-header .filter-bar { margin: 0; }
@media (max-width: 640px) {
    .ac-history-header { flex-direction: column; align-items: stretch; }
}

/* ── Mobile ─────────────────────────────────────────── */
@media (max-width: 480px) {
    .ac-card-layout { flex-direction: column; }
    .ac-card-preview { width: 100%; height: 130px; border-right: none; border-bottom: 1px solid var(--color-border); }
    .ac-card-preview-img { max-height: 130px; }
}

/* ── Credits shortage (buy modal) ───────────────────── */
.ac-credits-shortage {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.ac-credits-shortage-row     { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.ac-credits-shortage-label   { color: var(--color-muted); }
.ac-credits-shortage-value   { font-weight: 600; }
.ac-credits-shortage-value.low      { color: #f59e0b; }
.ac-credits-shortage-label.shortage { color: #ef4444; font-weight: 600; }
.ac-credits-shortage-value.shortage { color: #ef4444; font-weight: 700; font-size: 14px; }
.ac-credits-shortage-divider { height: 1px; background: var(--color-border); margin: 2px 0; }

/* ── Credit pack card ───────────────────────────────── */
.ac-credit-pack {
    border: 2px solid var(--color-border);
    border-radius: 14px;
    padding: 22px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    margin-bottom: 14px;
    background: var(--color-card);
}
.ac-credit-pack:hover, .ac-credit-pack.selected {
    border-color: #a855f7;
    box-shadow: 0 0 0 3px rgba(168,85,247,0.15);
}
.ac-pack-amount {
    font-size: 48px;
    font-weight: 900;
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    margin-bottom: 4px;
}
.ac-pack-label    { font-size: 14px; font-weight: 600; color: var(--color-muted); margin-bottom: 16px; }
.ac-pack-features { display: flex; flex-direction: column; gap: 7px; margin-bottom: 18px; }
.ac-pack-feature  { font-size: 13px; color: var(--color-text); display: flex; align-items: center; gap: 7px; }
.ac-pack-feature::before { content: '✓'; color: #a855f7; font-weight: 800; flex-shrink: 0; }
.ac-pack-price     { font-size: 28px; font-weight: 800; color: var(--color-text); }
.ac-pack-price-sub { font-size: 12px; color: var(--color-muted); margin-top: 3px; }

/* ── Gallery favorites toggle ───────────────────────── */
.gallery-fav-toggle {
    display: inline-flex;
    align-items: center;
    height: 36px;
    padding: 0 14px;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-muted);
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s, box-shadow 0.15s;
    white-space: nowrap;
}
.gallery-fav-toggle svg { opacity: 0.45; transition: opacity 0.15s; }
.gallery-fav-toggle:hover {
    border-color: #a855f7;
    color: var(--color-text);
}
.gallery-fav-toggle:hover svg { opacity: 0.75; }
.gallery-fav-toggle.active {
    background: rgba(168,85,247,0.12);
    border-color: #a855f7;
    color: #a855f7;
    box-shadow: 0 0 0 3px rgba(168,85,247,0.12);
    font-weight: 600;
}
.gallery-fav-toggle.active svg { opacity: 1; }

/* ── Art checker info rec item ───────────────────────── */
.ac-rec-item.info {
    background: rgba(245,158,11,0.06);
    border-left: 3px solid #f59e0b;
    border-radius: 0 6px 6px 0;
}
.ac-rec-item.info .ac-rec-icon { color: #f59e0b; }

/* ── Vectorize button credit badge ───────────────────── */
.btn-vectorize-cost-badge {
    display: inline-block;
    background: rgba(255,255,255,0.2);
    border-radius: 20px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 700;
    margin-left: 6px;
    vertical-align: middle;
    letter-spacing: 0.2px;
}

/* ── Buy Credits modal redesign ─────────────────────── */
.bc-modal-box {
    padding: 0 !important;
    overflow: hidden !important;
    max-width: 520px;
}
.bc-modal-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: none;
    border: none;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    color: rgba(255,255,255,0.65);
    z-index: 2;
    transition: color 0.15s;
}
.bc-modal-close:hover { color: #fff; }
.bc-header {
    position: relative;
    background: linear-gradient(135deg, #140830 0%, #2a1060 50%, #140830 100%);
    padding: 32px 28px 26px;
    text-align: center;
    overflow: hidden;
}
.bc-header-glow {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    width: 220px;
    height: 180px;
    background: radial-gradient(ellipse, rgba(168,85,247,0.45) 0%, transparent 70%);
    pointer-events: none;
}
.bc-header-sparkle {
    font-size: 30px;
    color: #c084fc;
    margin-bottom: 10px;
    filter: drop-shadow(0 0 14px rgba(192,132,252,0.9));
    display: block;
}
.bc-header-title {
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 5px;
    letter-spacing: -0.3px;
}
.bc-header-sub {
    font-size: 13px;
    color: rgba(255,255,255,0.55);
}
.bc-body { padding: 20px 24px 24px; }

/* Balance callout */
.bc-balance-callout {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 18px;
}
.bc-balance-grid {
    display: flex;
    align-items: center;
    justify-content: space-around;
    gap: 4px;
}
.bc-balance-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    flex: 1;
}
.bc-balance-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-muted);
    font-weight: 600;
    white-space: nowrap;
}
.bc-balance-num {
    font-size: 30px;
    font-weight: 900;
    line-height: 1;
    display: flex;
    align-items: baseline;
    gap: 3px;
}
.bc-num-unit {
    font-size: 11px;
    font-weight: 600;
    opacity: 0.65;
    margin-left: 1px;
}
.bc-num-low    { color: #f59e0b; }
.bc-num-zero   { color: #ef4444; }
.bc-num-cost   { color: var(--color-text); }
.bc-num-need   { color: #ef4444; }
.bc-balance-arrow {
    font-size: 15px;
    color: var(--color-muted);
    flex-shrink: 0;
    padding: 0 2px;
}
.bc-arrow-need { color: #ef4444; }

/* Pack card */
.bc-pack {
    background: linear-gradient(135deg, rgba(124,58,237,0.07), rgba(168,85,247,0.13));
    border: 1.5px solid rgba(168,85,247,0.45);
    border-radius: 14px;
    padding: 20px 18px 16px;
    position: relative;
    margin-bottom: 14px;
    box-shadow: 0 4px 24px rgba(124,58,237,0.1);
}
.bc-pack-badge {
    position: absolute;
    top: -11px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 3px 14px;
    border-radius: 20px;
    white-space: nowrap;
}
.bc-pack-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 8px;
    margin-bottom: 14px;
}
.bc-pack-amount-wrap {
    display: flex;
    align-items: baseline;
    gap: 7px;
}
.bc-pack-num {
    font-size: 52px;
    font-weight: 900;
    line-height: 1;
    background: linear-gradient(135deg, #7c3aed, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.bc-pack-unit-label {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-text);
}
.bc-pack-price-wrap { text-align: right; }
.bc-pack-price {
    display: block;
    font-size: 28px;
    font-weight: 800;
    color: var(--color-text);
    line-height: 1;
}
.bc-pack-per-use {
    display: block;
    font-size: 11px;
    color: var(--color-muted);
    margin-top: 3px;
}
.bc-pack-features {
    display: flex;
    flex-direction: column;
    gap: 7px;
    border-top: 1px solid rgba(168,85,247,0.2);
    padding-top: 12px;
}
.bc-pack-feat {
    font-size: 13px;
    color: var(--color-text);
    display: flex;
    align-items: center;
    gap: 8px;
}
.bc-feat-check {
    color: #a855f7;
    font-weight: 800;
    font-size: 13px;
    flex-shrink: 0;
}

/* Return note */
.bc-return-note {
    font-size: 11px;
    color: var(--color-muted);
    text-align: center;
    margin-bottom: 14px;
    line-height: 1.5;
    padding: 8px 12px;
    background: var(--color-bg);
    border-radius: 8px;
    border: 1px solid var(--color-border);
}
.bc-return-note strong { color: var(--color-text); }

/* Checkout button */
.bc-checkout-btn {
    width: 100%;
    padding: 14px 20px 12px;
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: #fff;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.15s;
    box-shadow: 0 4px 22px rgba(124,58,237,0.45);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}
.bc-checkout-btn:hover  { opacity: 0.88; transform: translateY(-1px); }
.bc-checkout-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.bc-checkout-label {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 0.2px;
}
.bc-checkout-sub {
    font-size: 11px;
    opacity: 0.7;
    font-weight: 500;
}

/* =============================================================
   Art File Education Section (Art Checker page)
   ============================================================= */
.aed-wrap {
    margin-top: 40px;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--color-border);
    box-shadow: 0 4px 32px rgba(0,0,0,0.08);
}

/* ── Header ── */
.aed-header {
    background:    linear-gradient(135deg, #0f172a 0%, #1e1b4b 60%, #0f2744 100%);
    padding:       40px 40px 36px;
    text-align:    center;
    position:      relative;
    overflow:      hidden;
}
.aed-header::before {
    content:    '';
    position:   absolute;
    inset:      0;
    background: radial-gradient(ellipse at 30% 50%, rgba(99,102,241,0.22), transparent 55%),
                radial-gradient(ellipse at 75% 60%, rgba(13,148,136,0.15), transparent 50%);
    pointer-events: none;
}
.aed-eyebrow {
    position:       relative;
    font-size:      10px;
    font-weight:    800;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color:          rgba(255,255,255,0.4);
    margin-bottom:  10px;
}
.aed-title {
    position:    relative;
    font-size:   26px;
    font-weight: 900;
    color:       #fff;
    margin:      0 0 10px;
    letter-spacing: -0.5px;
}
.aed-subtitle {
    position:   relative;
    font-size:  14px;
    color:      rgba(255,255,255,0.5);
    margin:     0;
    max-width:  520px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

/* ── Raster vs Vector grid ── */
.aed-compare-grid {
    display:     grid;
    grid-template-columns: 1fr 56px 1fr;
    background:  var(--color-card);
    border-top:  1px solid var(--color-border);
}
@media (max-width: 700px) {
    .aed-compare-grid { grid-template-columns: 1fr; }
    .aed-vs-col { display: none; }
}
.aed-card {
    padding:     28px 28px 24px;
}
.aed-card-raster { border-right: 1px solid var(--color-border); }
@media (max-width: 700px) { .aed-card-raster { border-right: none; border-bottom: 1px solid var(--color-border); } }
.aed-card-top {
    display:     flex;
    align-items: center;
    gap:         14px;
    margin-bottom: 14px;
}
.aed-card-icon-wrap {
    width:         64px;
    height:        64px;
    border-radius: 14px;
    display:       flex;
    align-items:   center;
    justify-content: center;
    flex-shrink:   0;
}
.aed-icon-raster { background: rgba(249,115,22,0.1); border: 1px solid rgba(249,115,22,0.2); }
.aed-icon-vector { background: rgba(99,102,241,0.1); border: 1px solid rgba(99,102,241,0.2); }
.aed-card-eyebrow {
    font-size:      10px;
    font-weight:    800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom:  3px;
}
.aed-eyebrow-raster { color: #f97316; }
.aed-eyebrow-vector { color: #818cf8; }
.aed-card-title {
    font-size:   20px;
    font-weight: 800;
    color:       var(--color-text);
    margin:      0;
    letter-spacing: -0.3px;
}
.aed-card-body {
    font-size:   13px;
    line-height: 1.65;
    color:       var(--color-text-secondary, var(--color-muted));
    margin:      0 0 14px;
}
.aed-list {
    margin:      0 0 16px;
    padding-left: 18px;
    list-style:  none;
}
.aed-list li {
    font-size:   13px;
    color:       var(--color-text-secondary, var(--color-muted));
    line-height: 1.6;
    margin-bottom: 5px;
    position:    relative;
    padding-left: 14px;
}
.aed-list li::before {
    content:  '·';
    position: absolute;
    left:     0;
    font-weight: 800;
    color:    var(--color-muted);
}
.aed-formats-row {
    display:     flex;
    flex-wrap:   wrap;
    gap:         6px;
    align-items: center;
    margin-bottom: 14px;
}
.aed-chip {
    font-size:     11px;
    font-weight:   800;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    padding:       4px 10px;
    border-radius: 20px;
}
.aed-chip-raster { background: rgba(249,115,22,0.12); color: #f97316; }
.aed-chip-vector { background: rgba(99,102,241,0.12); color: #818cf8; }
.aed-chip-note {
    font-size:  11px;
    color:      var(--color-muted);
    font-style: italic;
}
.aed-verdict {
    display:       inline-flex;
    align-items:   center;
    gap:           6px;
    font-size:     12px;
    font-weight:   700;
    padding:       7px 14px;
    border-radius: 8px;
}
.aed-verdict-warn { background: rgba(245,158,11,0.1); color: #d97706; border: 1px solid rgba(245,158,11,0.2); }
.aed-verdict-pass { background: rgba(34,197,94,0.1);  color: #16a34a; border: 1px solid rgba(34,197,94,0.2); }

/* VS column */
.aed-vs-col {
    display:         flex;
    flex-direction:  column;
    align-items:     center;
    justify-content: center;
    padding:         20px 0;
    gap:             8px;
}
.aed-vs-badge {
    width:         36px;
    height:        36px;
    border-radius: 50%;
    background:    var(--color-bg);
    border:        1px solid var(--color-border);
    display:       flex;
    align-items:   center;
    justify-content: center;
    font-size:     11px;
    font-weight:   800;
    color:         var(--color-muted);
    letter-spacing: 0.5px;
    flex-shrink:   0;
    z-index:       1;
}
.aed-vs-line {
    flex:       1;
    width:      1px;
    background: var(--color-border);
}

/* ── The Myth Card ── */
.aed-myth {
    background:  var(--color-bg);
    border-top:  1px solid var(--color-border);
    padding:     32px 32px 28px;
}
.aed-myth-header {
    display:     flex;
    align-items: flex-start;
    gap:         16px;
    margin-bottom: 14px;
}
.aed-myth-icon {
    font-size:   28px;
    line-height: 1;
    flex-shrink: 0;
    margin-top:  2px;
}
.aed-myth-eyebrow {
    font-size:      10px;
    font-weight:    800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color:          #d97706;
    margin-bottom:  4px;
}
.aed-myth-title {
    font-size:   18px;
    font-weight: 800;
    color:       var(--color-text);
    margin:      0;
    letter-spacing: -0.3px;
    line-height: 1.3;
}
.aed-myth-intro {
    font-size:   14px;
    line-height: 1.65;
    color:       var(--color-text-secondary, var(--color-muted));
    margin:      0 0 22px;
    max-width:   680px;
}
.aed-myth-scenarios {
    display:    grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap:        16px;
    margin-bottom: 22px;
}
.aed-scenario {
    background:    var(--color-card);
    border:        1px solid var(--color-border);
    border-left:   3px solid #f59e0b;
    border-radius: 10px;
    padding:       16px 18px;
    display:       flex;
    gap:           14px;
    align-items:   flex-start;
}
.aed-scenario-num {
    font-size:   11px;
    font-weight: 900;
    color:       #f59e0b;
    letter-spacing: 0.5px;
    flex-shrink: 0;
    padding-top: 1px;
}
.aed-scenario-title {
    font-size:   13px;
    font-weight: 700;
    color:       var(--color-text);
    margin-bottom: 5px;
}
.aed-scenario-body {
    font-size:   13px;
    line-height: 1.6;
    color:       var(--color-text-secondary, var(--color-muted));
    margin:      0;
}
.aed-myth-footer {
    display:       flex;
    align-items:   flex-start;
    gap:           12px;
    background:    linear-gradient(135deg, rgba(99,102,241,0.07), rgba(13,148,136,0.05));
    border:        1px solid rgba(99,102,241,0.15);
    border-radius: 10px;
    padding:       14px 18px;
    font-size:     13px;
    line-height:   1.6;
    color:         var(--color-text-secondary, var(--color-muted));
}
.aed-myth-footer-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }

/* ── Embroidery Section ── */
.aed-emb {
    border-top: 1px solid var(--color-border);
}
.aed-emb-hero {
    position:   relative;
    overflow:   hidden;
    background: linear-gradient(135deg, #1a0533 0%, #2e1065 55%, #1e1040 100%);
    padding:    28px 32px;
}
.aed-emb-glow {
    position:       absolute;
    inset:          0;
    background:     radial-gradient(ellipse at 90% 50%, rgba(168,85,247,0.3), transparent 55%),
                    radial-gradient(ellipse at 10% 60%, rgba(139,92,246,0.15), transparent 45%);
    pointer-events: none;
}
.aed-emb-hero-inner {
    position:    relative;
    display:     flex;
    align-items: center;
    gap:         18px;
}
.aed-emb-icon {
    font-size:   38px;
    line-height: 1;
    flex-shrink: 0;
}
.aed-emb-eyebrow {
    font-size:      10px;
    font-weight:    800;
    letter-spacing: 2px;
    text-transform: uppercase;
    color:          rgba(255,255,255,0.4);
    margin-bottom:  4px;
}
.aed-emb-title {
    font-size:   20px;
    font-weight: 800;
    color:       #fff;
    margin:      0 0 6px;
    letter-spacing: -0.3px;
}
.aed-emb-sub {
    font-size:  13px;
    color:      rgba(255,255,255,0.5);
    margin:     0;
    line-height: 1.5;
}
.aed-emb-grid {
    display:     grid;
    grid-template-columns: 1fr 1fr;
    background:  var(--color-card);
}
@media (max-width: 700px) { .aed-emb-grid { grid-template-columns: 1fr; } }
.aed-emb-block {
    padding:   28px 28px 24px;
}
.aed-emb-block:first-child { border-right: 1px solid var(--color-border); }
@media (max-width: 700px) { .aed-emb-block:first-child { border-right: none; border-bottom: 1px solid var(--color-border); } }
.aed-emb-block-icon {
    font-size:     22px;
    margin-bottom: 8px;
}
.aed-emb-block-title {
    font-size:   15px;
    font-weight: 800;
    color:       var(--color-text);
    margin:      0 0 8px;
}
.aed-emb-block-body {
    font-size:   13px;
    line-height: 1.65;
    color:       var(--color-text-secondary, var(--color-muted));
    margin:      0 0 12px;
}
.aed-emb-list {
    margin:       0 0 16px;
    padding-left: 0;
    list-style:   none;
}
.aed-emb-list li {
    font-size:   13px;
    color:       var(--color-text-secondary, var(--color-muted));
    line-height: 1.6;
    margin-bottom: 5px;
    padding-left: 16px;
    position:    relative;
}
.aed-emb-list li::before {
    content:     '▸';
    position:    absolute;
    left:        0;
    color:       #a855f7;
    font-size:   10px;
    top:         2px;
}
.aed-emb-callout {
    background:    rgba(168,85,247,0.07);
    border:        1px solid rgba(168,85,247,0.2);
    border-radius: 8px;
    padding:       12px 14px;
    font-size:     13px;
    line-height:   1.6;
    color:         var(--color-text-secondary, var(--color-muted));
    margin-bottom: 16px;
}
.aed-emb-callout-warn {
    background: rgba(239,68,68,0.06);
    border-color: rgba(239,68,68,0.2);
}
.aed-emb-formats-row {
    display:   flex;
    flex-wrap: wrap;
    gap:       10px;
    align-items: center;
}
.aed-emb-fmt {
    display:     flex;
    flex-direction: column;
    align-items: center;
    gap:         4px;
}
.aed-emb-fmt-label {
    font-size:  10px;
    color:      var(--color-muted);
    font-weight: 600;
}
.aed-chip-emb       { background: rgba(168,85,247,0.15); color: #c084fc; }
.aed-chip-emb-muted { background: rgba(168,85,247,0.07); color: #a78bfa; }
/* CTA row */
.aed-emb-cta {
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    flex-wrap:       wrap;
    gap:             14px;
    background:      var(--color-card);
    border-top:      1px solid var(--color-border);
    padding:         18px 28px;
}
.aed-emb-cta-text {
    font-size:   13px;
    color:       var(--color-text-secondary, var(--color-muted));
    line-height: 1.5;
    max-width:   520px;
}
.aed-emb-cta-btn {
    padding:       10px 20px;
    border-radius: 8px;
    border:        none;
    background:    linear-gradient(135deg, #7c3aed, #a855f7);
    color:         #fff;
    font-size:     13px;
    font-weight:   700;
    cursor:        pointer;
    white-space:   nowrap;
    box-shadow:    0 4px 14px rgba(139,92,246,0.35);
    transition:    opacity 0.15s, transform 0.15s;
}
.aed-emb-cta-btn:hover { opacity: 0.9; transform: translateY(-1px); }
/* Dark mode tweaks */
[data-theme="dark"] .aed-verdict-warn { background: rgba(245,158,11,0.12); border-color: rgba(245,158,11,0.25); color: #fbbf24; }
[data-theme="dark"] .aed-verdict-pass { background: rgba(34,197,94,0.12);  border-color: rgba(34,197,94,0.25);  color: #4ade80; }
[data-theme="dark"] .aed-scenario     { background: var(--color-bg); }
[data-theme="dark"] .aed-myth-footer  { background: linear-gradient(135deg, rgba(99,102,241,0.1), rgba(13,148,136,0.08)); border-color: rgba(99,102,241,0.2); }

/* =============================================================
   Art File Library
   ============================================================= */
/* Upload area - company picker + upload button in the header title row (PPD only) */
.al-upload-area {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}
.al-upload-to-label {
    font-size: 12px;
    color: var(--color-muted);
    white-space: nowrap;
    font-weight: 500;
}
.al-upload-label {
    cursor: pointer;
    white-space: nowrap;
}
.al-company-picker {
    padding: 6px 28px 6px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 13px;
    background: var(--color-card);
    color: var(--color-text);
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
}
[data-theme="dark"] .al-company-picker {
    background-color: #1e293b;
    color: #e2e8f0;
    border-color: var(--color-border);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
}

/* File cell - wrapper div inside the td, NOT on the td itself */
.al-file-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}
.al-filename {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 280px;
}

/* Source badges */
.al-source-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 4px;
    border: 1px solid;
    white-space: nowrap;
}
.al-source-library {
    color: #059669;
    background: #ecfdf5;
    border-color: #a7f3d0;
}
.al-source-order {
    color: #d97706;
    background: #fffbeb;
    border-color: #fde68a;
}
[data-theme="dark"] .al-source-library {
    color: #34d399;
    background: rgba(5,150,105,0.12);
    border-color: rgba(52,211,153,0.3);
}
[data-theme="dark"] .al-source-order {
    color: #fbbf24;
    background: rgba(217,119,6,0.12);
    border-color: rgba(251,191,36,0.3);
}

.al-date    { white-space: nowrap; font-size: 13px; color: var(--color-muted); }
.al-actions { white-space: nowrap; overflow: visible; position: relative; }
.al-actions-col { width: 230px; }

/* Art Library row action menu */
.al-action-menu {
    position: absolute;
    right: 0;
    /* Opens downward; with up to 7 items (Copy to Order, Thread Colors, Link
       to Company, Link to Project, Rename, Delete + divider) the old
       bottom:100% anchor clipped against the sticky page header when rows
       were near the top of the viewport. */
    top: 100%;
    margin-top: 4px;
    z-index: 100;
    min-width: 200px;
    max-height: min(360px, calc(100vh - 120px));
    overflow-y: auto;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    padding: 4px 0;
    display: none;
}
.al-action-menu.open { display: block; }
.al-action-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 14px;
    border: none;
    background: none;
    color: var(--color-text);
    font-size: 13px;
    cursor: pointer;
    text-align: left;
    white-space: nowrap;
}
.al-action-menu-item:hover {
    background: var(--color-bg);
}
.al-action-menu-item .al-menu-icon {
    width: 16px;
    text-align: center;
    font-size: 13px;
    flex-shrink: 0;
}
.al-action-menu-item.danger { color: #ef4444; }
.al-action-menu-divider {
    height: 1px;
    background: var(--color-border);
    margin: 4px 0;
}
[data-theme="dark"] .al-action-menu {
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

/* Nav submenu popout divider - matches the between-group divider
   used in the left sidebar (`.nav-group:not(.hidden) + .nav-group`),
   not the dimmer inline `.nav-divider` inside a single group. Same
   1px line, same 18% white tint, full-bleed across the popout (no
   inset margin) so the divider visually separates sections at the
   same weight as the sidebar's group dividers. */
.nav-submenu-popout-divider {
    height: 1px;
    background: rgba(255,255,255,0.18);
    margin: 8px 0;
}

/* ============================================================
   Linked Art Files - compact list used inside detail modals
   ============================================================ */
.linked-art-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.linked-art-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 0;
    border-bottom: 1px solid var(--color-border);
    font-size: 13px;
}
.linked-art-item:last-child { border-bottom: none; }
.linked-art-thumb {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 3px;
    flex-shrink: 0;
    background: var(--color-surface-2);
}
.linked-art-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-surface-2);
    border-radius: 3px;
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 700;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.linked-art-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.linked-art-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

/* Art File Assign Modal */
.art-assign-filename {
    font-size: 13px;
    color: var(--color-muted);
    font-style: italic;
    margin: 0 0 16px;
}
.assign-link-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid var(--color-border);
    font-size: 13px;
}
.assign-link-row:last-child { border-bottom: none; }
.assign-link-type {
    font-size: 11px;
    font-weight: 600;
    text-transform: capitalize;
    padding: 2px 6px;
    border-radius: 10px;
    background: var(--color-surface-2);
    color: var(--color-muted);
    white-space: nowrap;
}
.assign-link-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---- Flatpickr Custom Theme ---- */
.flatpickr-calendar {
    border-radius: 12px !important;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06) !important;
    border: 1px solid var(--color-border) !important;
    font-family: inherit !important;
}
.flatpickr-months {
    padding: 4px 0;
}
.flatpickr-months .flatpickr-month {
    height: 36px;
}
.flatpickr-current-month {
    font-size: 14px !important;
    font-weight: 700 !important;
    color: var(--color-text) !important;
}
.flatpickr-current-month .flatpickr-monthDropdown-months {
    font-weight: 700 !important;
}
.flatpickr-months .flatpickr-prev-month,
.flatpickr-months .flatpickr-next-month {
    padding: 6px 10px;
}
.flatpickr-months .flatpickr-prev-month svg,
.flatpickr-months .flatpickr-next-month svg {
    fill: var(--color-text-secondary) !important;
}
.flatpickr-months .flatpickr-prev-month:hover svg,
.flatpickr-months .flatpickr-next-month:hover svg {
    fill: var(--color-primary) !important;
}
span.flatpickr-weekday {
    color: var(--color-muted) !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    text-transform: uppercase;
}
.flatpickr-day {
    border-radius: 8px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    color: var(--color-text) !important;
    max-width: 36px;
    height: 36px;
    line-height: 36px;
}
.flatpickr-day:hover {
    background: var(--color-bg) !important;
    border-color: transparent !important;
}
.flatpickr-day.today {
    border-color: var(--color-primary) !important;
    background: transparent !important;
    color: var(--color-primary) !important;
    font-weight: 700 !important;
}
.flatpickr-day.today:hover {
    background: rgba(79,70,229,0.08) !important;
}
.flatpickr-day.selected,
.flatpickr-day.selected:hover {
    background: var(--color-primary) !important;
    border-color: var(--color-primary) !important;
    color: #fff !important;
    font-weight: 700 !important;
}
.flatpickr-day.flatpickr-disabled {
    color: var(--color-muted) !important;
    opacity: 0.4;
}
.flatpickr-day.prevMonthDay,
.flatpickr-day.nextMonthDay {
    color: var(--color-muted) !important;
}
[data-theme="dark"] .flatpickr-calendar {
    background: var(--color-card) !important;
    border-color: var(--color-border) !important;
}
[data-theme="dark"] .flatpickr-day {
    color: var(--color-text) !important;
}
[data-theme="dark"] .flatpickr-day:hover {
    background: var(--color-sidebar-hover) !important;
}
[data-theme="dark"] .flatpickr-day.today {
    border-color: #818cf8 !important;
    color: #818cf8 !important;
}
[data-theme="dark"] .flatpickr-day.selected {
    background: #6366f1 !important;
    border-color: #6366f1 !important;
}

/* =============================================================
   Gallery Category Quick-Pick Chips
   ============================================================= */
.gallery-category-quickpicks {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
    padding: 4px 0;
}
.quickpick-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-muted);
    font-weight: 700;
    margin-right: 4px;
}
.quickpick-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.quickpick-chip:hover {
    border-color: var(--color-primary);
    background: color-mix(in srgb, var(--color-primary), transparent 92%);
}
.quickpick-chip.active {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}
.quickpick-chip-count {
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 8px;
    background: color-mix(in srgb, var(--color-text), transparent 90%);
    color: var(--color-muted);
    font-weight: 700;
}
.quickpick-chip.active .quickpick-chip-count {
    background: rgba(255,255,255,0.25);
    color: rgba(255,255,255,0.95);
}

/* =============================================================
   Gallery Detail — Setup & Shipping Fee Display
   ============================================================= */
.gallery-detail-fees {
    display: flex;
    gap: 16px;
    margin: 12px 0;
    flex-wrap: wrap;
}
.gallery-detail-fee {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-size: 13px;
}
.gallery-detail-fee-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
    color: var(--color-muted);
}
.gallery-detail-fee-val {
    font-weight: 700;
    color: var(--color-text);
}
.gallery-detail-fee-code {
    padding: 2px 6px;
    background: color-mix(in srgb, var(--color-primary), transparent 88%);
    color: var(--color-primary);
    border-radius: 3px;
    font-size: 10px;
    font-weight: 800;
    font-family: var(--font-mono, ui-monospace, monospace);
}
.gallery-detail-fee-net {
    font-size: 12px;
    color: #2563eb;
    font-weight: 600;
}
.gallery-detail-fee-profit {
    font-size: 12px;
    color: #059669;
    font-weight: 600;
}
/* Profit display on edit form (non-editable, matches input height) */
.fee-profit-display {
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 700;
    background: var(--color-bg);
    color: var(--color-text);
    min-height: 38px;
    display: flex;
    align-items: center;
}

/* =============================================================
   SAGE UX: Result banner, explainer, NEW badge, lock hint
   ============================================================= */

/* Session-scoped "viewing SAGE search results" context banner on the gallery.
   Indigo accent to distinguish from the green "added to catalog" banner. */
/* Active SAGE-search filter banner. Uses SAGE red with a left bar accent so
   the user can't miss that their gallery is filtered by a recent SAGE search,
   and a pulsing glow to draw the eye the moment it appears. */
.sage-context-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    margin: 10px 0;
    background: linear-gradient(135deg, rgba(220,38,38,0.12), rgba(185,28,28,0.06));
    border: 2px solid rgba(220,38,38,0.55);
    border-left: 6px solid #dc2626;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    color: #7f1d1d;
    box-shadow: 0 2px 12px rgba(220,38,38,0.18);
}
.sage-context-banner.hidden { display: none; }
.sage-context-banner-icon { font-size: 18px; flex-shrink: 0; color: #dc2626; }
.sage-context-banner-text { flex: 1; }
.sage-context-banner-text strong { font-weight: 800; color: #b91c1c; }
.sage-context-banner-hint { color: rgba(127,29,29,0.75); font-size: 12px; font-weight: 500; }
/* Clear Filter button inside the banner - make it pop against the red bg. */
.sage-context-banner .btn-clear {
    background: #fff;
    border: 1.5px solid #dc2626;
    color: #b91c1c;
    font-weight: 700;
}
.sage-context-banner .btn-clear:hover {
    background: #dc2626;
    color: #fff;
}

/* First-time explainer card in drawer */
.sage-explainer {
    background: linear-gradient(135deg, rgba(99,102,241,0.06), rgba(99,102,241,0.02));
    border: 1px solid rgba(99,102,241,0.2);
    border-radius: 10px;
    padding: 16px 18px;
    margin-bottom: 20px;
}
.sage-explainer-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 10px;
}
.sage-explainer-body {
    font-size: 13px;
    color: var(--color-text);
    line-height: 1.6;
}
.sage-explainer-body p { margin: 0 0 10px; }
.sage-explainer-body ul {
    margin: 0;
    padding-left: 18px;
    list-style: disc;
}
.sage-explainer-body li { margin-bottom: 4px; }
.sage-explainer-dismiss {
    display: inline-block;
    margin-top: 10px;
    background: none;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text);
    cursor: pointer;
}
.sage-explainer-dismiss:hover { border-color: var(--color-primary); color: var(--color-primary); }

/* "NEW" badge on freshly-adopted gallery cards */
.gallery-card-new-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: linear-gradient(135deg, #16a34a, #22c55e);
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    padding: 3px 7px;
    border-radius: 4px;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    z-index: 2;
}

/* Source badge (SAGE) on gallery card top strip */
/* =============================================================
   .sage-badge — unified SAGE brand badge
   Used EVERYWHERE "SAGE" is shown as a label/tag (gallery cards,
   table rows, product detail hint, drawer header, etc.).
   Red-to-stay-on-brand gradient. Size scales via the modifier
   classes: .sage-badge-sm (default, 9-10px) and .sage-badge-lg
   (12px+, drawer header).
   ============================================================= */
.sage-badge,
.gallery-card-source-sage,
.sage-import-hint-badge,
.sage-drawer-badge {
    display: inline-block;
    background: linear-gradient(135deg, #b91c1c, #dc2626);
    color: #fff;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-family: var(--font-mono, ui-monospace, SFMono-Regular, monospace);
    box-shadow: 0 1px 2px rgba(220,38,38,0.2);
    flex-shrink: 0;
}
.sage-badge-lg,
.sage-drawer-badge {
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    box-shadow: 0 2px 6px rgba(220,38,38,0.2);
}

/* .ppd-badge — parallel brand badge for manually-added PPD products.
   Same size/shape as .sage-badge but indigo to signal "your PPD's own item". */
.ppd-badge,
.gallery-card-source-ppd {
    display: inline-block;
    background: linear-gradient(135deg, #4338ca, #6366f1);
    color: #fff;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-family: var(--font-mono, ui-monospace, SFMono-Regular, monospace);
    box-shadow: 0 1px 2px rgba(79,70,229,0.2);
    flex-shrink: 0;
}

/* Orders-count badge on gallery card top strip */
.gallery-card-orders {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 7px;
    font-size: 10px;
    font-weight: 700;
    color: #065f46;
    background: #d1fae5;
    border-radius: 10px;
}

/* ========================================================================
   Color Family multi-select
   Used in the product gallery to filter by canonical color families.
   ======================================================================== */
.color-family-multi { position: relative; width: 200px; }
.color-family-trigger {
    display: flex; align-items: center; gap: 6px;
    height: 32px; width: 100%;
    padding: 0 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-card);
    color: var(--color-text);
    font-size: 13px;
    cursor: pointer;
    text-align: left;
}
.color-family-trigger:hover { border-color: var(--color-primary); }
.color-family-multi.is-open .color-family-trigger,
.color-family-multi.has-selection .color-family-trigger {
    border-color: var(--color-primary);
}
.color-family-multi.has-selection .color-family-trigger {
    background: rgba(99,102,241,0.08);
}
.color-family-trigger-swatches {
    display: inline-flex; align-items: center; gap: 2px;
    flex-shrink: 0;
}
.color-family-trigger-swatches .cfs-dot {
    width: 14px; height: 14px; border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.12);
    display: inline-block;
}
.color-family-trigger-text {
    flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
    color: var(--color-text);
}
.color-family-multi:not(.has-selection) .color-family-trigger-text {
    color: var(--color-muted);
}
.color-family-chev {
    font-size: 10px; color: var(--color-muted);
    transition: transform 0.15s;
}
.color-family-multi.is-open .color-family-chev { transform: rotate(180deg); }

.color-family-dropdown {
    position: absolute; top: calc(100% + 4px); left: 0;
    width: 320px;
    z-index: 100;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.18);
    padding: 12px;
    animation: cfFadeIn 0.15s ease-out;
}
@keyframes cfFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}
.color-family-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 10px;
}
.color-family-chip {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 8px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-card);
    color: var(--color-text);
    font-size: 12px; font-weight: 500;
    cursor: pointer;
    transition: border-color 0.1s, background 0.1s, transform 0.1s;
    text-align: left;
    min-width: 0;
}
.color-family-chip:hover { border-color: var(--color-primary); }
.color-family-chip.selected {
    border-color: var(--color-primary);
    background: rgba(99,102,241,0.12);
    font-weight: 600;
    box-shadow: 0 0 0 2px rgba(99,102,241,0.12);
}
.color-family-chip .cf-swatch {
    width: 20px; height: 20px; border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.15);
    flex-shrink: 0;
    position: relative;
}
/* White swatch needs an extra contrast ring since the background is almost white */
.color-family-chip .cf-swatch.cf-white { background: #fff !important; border-color: #ccc; }
/* Multicolor gradient swatch */
.color-family-chip .cf-swatch.cf-multi {
    background: conic-gradient(#ef4444, #f97316, #fbbf24, #16a34a, #2563eb, #9333ea, #ec4899, #ef4444);
}
.color-family-chip .cf-label {
    flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.color-family-chip .cf-check {
    font-size: 12px; color: var(--color-primary);
    opacity: 0; transition: opacity 0.1s;
}
.color-family-chip.selected .cf-check { opacity: 1; }
.color-family-footer {
    display: flex; justify-content: space-between; align-items: center;
    padding-top: 8px;
    border-top: 1px solid var(--color-border);
}
.color-family-footer button {
    height: 28px; padding: 0 12px;
    border-radius: 6px; border: 1px solid var(--color-border);
    background: var(--color-card); color: var(--color-text);
    font-size: 12px; font-weight: 500; cursor: pointer;
}
.color-family-footer .color-family-clear {
    color: var(--color-muted);
}
.color-family-footer .color-family-clear:hover { color: var(--color-danger); border-color: var(--color-danger); }
.color-family-footer .color-family-done {
    background: var(--color-primary); color: #fff; border-color: var(--color-primary);
}
.color-family-footer .color-family-done:hover { filter: brightness(1.08); }

/* Clickable category chips inside the gallery detail modal's meta grid.
   Each chip navigates to the gallery pre-filtered by that category. */
.gallery-detail-cat-links {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.gallery-detail-cat-links .gallery-detail-cat-link {
    display: inline-block;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 500;
    color: var(--color-primary);
    background: color-mix(in srgb, var(--color-primary), transparent 90%);
    border: 1px solid color-mix(in srgb, var(--color-primary), transparent 75%);
    border-radius: 999px;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
}
.gallery-detail-cat-links .gallery-detail-cat-link:hover {
    background: color-mix(in srgb, var(--color-primary), transparent 80%);
    border-color: var(--color-primary);
}
a.gallery-detail-cat-link:hover {
    filter: brightness(1.1);
}

/* Pricing-overridden note shown under the pricing table in the gallery
   detail modal. Paired with a Revert button that discards PPD-level
   pricing customizations and falls back to master/SAGE pricing. */
.gallery-detail-override-note {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    margin-top: 10px;
    background: color-mix(in srgb, #f59e0b, transparent 92%);
    border: 1px solid color-mix(in srgb, #f59e0b, transparent 75%);
    border-radius: 8px;
    font-size: 12px;
    color: var(--color-text);
}
.gallery-detail-override-note .gdor-icon { font-size: 14px; flex-shrink: 0; }
.gallery-detail-override-note .gdor-text { flex: 1; line-height: 1.5; }
.gallery-detail-override-note .gdor-actions {
    display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap;
}
.gallery-detail-override-note .gdor-revert,
.gallery-detail-override-note .gdor-toggle-master {
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid var(--color-border);
    background: var(--color-card);
    color: var(--color-text);
    font-size: 12px; font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.gallery-detail-override-note .gdor-revert:hover,
.gallery-detail-override-note .gdor-toggle-master:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}
.gallery-detail-override-note .gdor-toggle-master[aria-expanded="true"] {
    background: color-mix(in srgb, var(--color-primary), transparent 88%);
    border-color: var(--color-primary);
    color: var(--color-primary);
}
.gallery-detail-override-note .gdor-revert:disabled {
    opacity: 0.6;
    cursor: wait;
}

/* Subtle confirmation shown when a SAGE-linked product is displaying
   master pricing as-is (no PPD override). Intentionally low-key so it
   doesn't compete with the louder amber override banner. */
.gallery-detail-master-note {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    margin-top: 10px;
    background: color-mix(in srgb, #10b981, transparent 94%);
    border: 1px solid color-mix(in srgb, #10b981, transparent 80%);
    border-radius: 8px;
    font-size: 12px;
    color: var(--color-text-secondary);
}
.gallery-detail-master-note .gdmn-icon {
    color: #059669;
    font-weight: 700;
    flex-shrink: 0;
}
.gallery-detail-master-note .gdmn-text { line-height: 1.5; }

/* Master pricing table (toggle-shown below the override note) */
.gallery-detail-master-pricing {
    margin-top: 10px;
    padding: 12px;
    background: var(--color-bg);
    border: 1px dashed var(--color-border);
    border-radius: 8px;
}
.gallery-detail-tiers-master {
    opacity: 0.95;
}
.gallery-detail-tiers-master th,
.gallery-detail-tiers-master td {
    background: transparent !important;
}

/* Stable widths for gallery select filters — prevents the selected option's
   width change (especially under .filter-active font-weight:600) from reflowing
   the filter row so a filter jumps up from row 2 to row 1, or vice versa. */
#galleryRating { min-width: 130px; }
#gallerySort   { min-width: 150px; }
#gallerySource { min-width: 140px; }
#galleryDecoration { min-width: 150px; }

/* Gallery display controls — sort + per-page + view-toggle grouped together,
   pushed to the far right of the filter row. Wrapped in a subtle pill so
   presentation controls read as a distinct group from the data filters
   above, even when the row wraps to a second line. */
.gallery-view-controls {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    padding: 6px 10px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 999px;
}
.gallery-view-controls .filter-bar { margin: 0; }

/* Mobile: the gallery-view-controls pill (favorites + rating + sort +
   per-page + view toggle) doesn't fit on one line at phone widths,
   so let its items wrap and take the full row width rather than
   getting clipped off-screen. */
@media (max-width: 640px) {
    .gallery-view-controls {
        display: flex;
        flex-wrap: wrap;
        width: 100%;
        margin-left: 0;
        justify-content: flex-start;
        border-radius: 12px;
    }
    .gallery-view-controls > * { flex: 0 1 auto; }
    .gallery-view-controls .filter-bar,
    .gallery-view-controls .filter-bar > select {
        max-width: 100%;
    }
}

/* Gallery view-mode toggle (grid/table) */
.gallery-view-toggle {
    display: inline-flex;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    overflow: hidden;
    height: 32px;
}
.gallery-view-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    border: 0;
    background: var(--color-card);
    color: var(--color-muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.gallery-view-btn + .gallery-view-btn { border-left: 1px solid var(--color-border); }
.gallery-view-btn:hover { background: var(--color-bg); color: var(--color-text); }
.gallery-view-btn.active {
    background: color-mix(in srgb, var(--color-primary), transparent 88%);
    color: var(--color-primary);
}

/* Table-mode: override the grid display on the gallery container */
#galleryGrid.gallery-table-mode {
    display: block;
}
.gallery-data-table { width: 100%; }
.gallery-data-table tbody tr:hover { background: var(--color-bg); }
.gallery-data-table tbody td { padding-top: 10px; padding-bottom: 10px; vertical-align: middle; }
/* Row-level favorite button: reset the absolute positioning used in card view
   so it renders in-flow inside the table cell (and doesn't float onto
   the ORDERS header) */
.gallery-data-table .gallery-fav-btn {
    position: static;
    width: auto; height: auto;
    background: transparent;
    border-radius: 0;
    font-size: 20px;
    line-height: 1;
}

/* SAGE import hint in product detail modal */
.sage-import-hint {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    margin-bottom: 14px;
    background: linear-gradient(135deg, rgba(185,28,28,0.06), rgba(220,38,38,0.02));
    border: 1px solid rgba(185,28,28,0.15);
    border-radius: 8px;
    font-size: 12px;
    color: var(--color-text);
}
/* .sage-import-hint-badge now covered by the unified .sage-badge rule above */
.sage-import-hint-edit {
    color: var(--color-primary);
    font-weight: 600;
}

/* Supplier lock hint */
.sage-lock-hint {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    margin-bottom: 14px;
    background: rgba(245,158,11,0.08);
    border: 1px solid rgba(245,158,11,0.25);
    border-radius: 8px;
    font-size: 12px;
    color: var(--color-text);
    line-height: 1.5;
}
.sage-lock-icon { font-size: 16px; flex-shrink: 0; align-self: flex-start; margin-top: 1px; }
/* ============================================================
   SAGE Setup CTA — shown in multiple surfaces (gallery banner,
   empty state, dashboard tile, disabled "Find on SAGE" button)
   when the current PPD hasn't configured SAGE Connect yet.
   ============================================================ */
.sage-setup-cta {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 18px;
    border-radius: 12px;
    background: linear-gradient(135deg, color-mix(in srgb, var(--color-primary), transparent 92%), color-mix(in srgb, var(--color-primary), transparent 96%));
    border: 1px solid color-mix(in srgb, var(--color-primary), transparent 72%);
}
.sage-setup-cta-icon {
    width: 40px; height: 40px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--color-primary), transparent 82%);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; flex-shrink: 0;
}
.sage-setup-cta-body { flex: 1; min-width: 0; }
.sage-setup-cta-title { font-size: 14px; font-weight: 700; color: var(--color-text); margin-bottom: 2px; }
.sage-setup-cta-desc { font-size: 12px; color: var(--color-text-secondary); line-height: 1.5; }
.sage-setup-cta-action { flex-shrink: 0; }
.sage-setup-cta-dismiss {
    background: none; border: none; color: var(--color-muted); font-size: 18px;
    cursor: pointer; padding: 0 4px; line-height: 1; align-self: flex-start;
}
.sage-setup-cta-dismiss:hover { color: var(--color-text); }

/* Disabled / greyed variant of the "Find New Products on SAGE" button */
.btn-sage-disabled {
    opacity: 0.55;
    cursor: help !important;
    background: color-mix(in srgb, var(--color-muted), transparent 82%) !important;
    color: var(--color-muted) !important;
    border: 1px dashed var(--color-border) !important;
}
.btn-sage-disabled:hover { opacity: 0.7; }

/* "Not finding what you're looking for?" nudge shown at the bottom of the
   customer gallery (below pagination). Clickable card that opens the
   Discover More Products search. Uses the app's primary color so it reads
   as a positive next step rather than an error/empty state. */
.gallery-discover-nudge {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 22px;
    margin: 24px 0 8px;
    background: linear-gradient(135deg, color-mix(in srgb, var(--color-primary), transparent 92%), color-mix(in srgb, var(--color-primary), transparent 97%));
    border: 1px solid color-mix(in srgb, var(--color-primary), transparent 70%);
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.gallery-discover-nudge:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px color-mix(in srgb, var(--color-primary), transparent 82%);
    border-color: color-mix(in srgb, var(--color-primary), transparent 50%);
}
.gallery-discover-nudge.hidden { display: none; }
/* Compact variant for the top-of-gallery placement - slimmer padding and a
   single-line description so it doesn't dominate the fold before the grid. */
.gallery-discover-nudge-compact {
    padding: 12px 16px;
    margin: 0 0 14px;
    gap: 12px;
}
.gallery-discover-nudge-compact .gallery-discover-nudge-icon {
    width: 36px;
    height: 36px;
    font-size: 16px;
}
.gallery-discover-nudge-compact .gallery-discover-nudge-title { font-size: 14px; }
.gallery-discover-nudge-compact .gallery-discover-nudge-desc  { font-size: 12px; }
.gallery-discover-nudge-compact .gallery-discover-nudge-cta {
    padding: 8px 14px;
    font-size: 12px;
}
.gallery-discover-nudge-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary);
    color: #fff;
    border-radius: 10px;
    font-size: 20px;
}
.gallery-discover-nudge-body {
    flex: 1;
    min-width: 0;
}
.gallery-discover-nudge-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 2px;
}
.gallery-discover-nudge-desc {
    font-size: 13px;
    color: var(--color-muted);
    line-height: 1.45;
}
.gallery-discover-nudge-cta {
    flex-shrink: 0;
    padding: 10px 18px;
    background: var(--color-primary);
    color: #fff;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}
.gallery-discover-nudge:hover .gallery-discover-nudge-cta {
    filter: brightness(1.08);
}
@media (max-width: 640px) {
    .gallery-discover-nudge { flex-direction: column; text-align: center; }
    .gallery-discover-nudge-cta { align-self: stretch; text-align: center; }
}

/* "Override" badge shown next to a supplier field whose PPD value differs
   from the SAGE master value. Used in supplier detail rows and form labels. */
/* Read-only display span that replaces a disabled input in a form so it
   doesn't look like an editable textbox. Used for SAGE-master-locked fields
   (company_name, website) on the supplier edit form. */
.readonly-display {
    padding: 8px 0;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text);
    line-height: 1.4;
    word-break: break-word;
}
.readonly-display:empty::before { content: '-'; color: var(--color-muted); }
.readonly-display a { color: var(--color-primary); text-decoration: none; }
.readonly-display a:hover { text-decoration: underline; }

.supplier-override-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: #b45309;
    background: rgba(245, 158, 11, 0.14);
    border: 1px solid rgba(245, 158, 11, 0.35);
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 6px;
    text-transform: uppercase;
    vertical-align: middle;
}

/* SAGE Search Progress Modal
   =========================================================================
   Full-screen overlay shown while a SAGE search is running. Matches the
   visual language of the Send Invoice progress modal (stripe-progress-*)
   but with a "products flying from SAGE into the gallery" animation to
   make the wait feel purposeful. Replaces the old inline progress strip
   that lived above the submit button. */
.sage-search-progress-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}
.sage-search-progress-card {
    /* Theme-aware card surface so the overlay works in dark mode too
       (was hardcoded #fff, which made the whole thing read as a stray
       light-mode panel on dark-mode phones). */
    background: var(--color-card);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    padding: 40px 56px 36px;
    text-align: center;
    /* Wider card = longer particle runway, which makes the "products flying
       from SAGE into DECADE.promo" animation feel more purposeful. */
    min-width: 680px;
    max-width: min(92vw, 820px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    animation: scaleIn 0.25s ease-out;
}
/* Mobile: the 680px min-width pushes the right-hand DECADE pill past
   the viewport on phones. Collapse to viewport-width with tighter
   padding so the full animation fits on-screen. */
@media (max-width: 720px) {
    .sage-search-progress-card {
        min-width: 0;
        width: calc(100vw - 32px);
        max-width: calc(100vw - 32px);
        padding: 28px 20px 24px;
    }
    .sage-search-progress-anim {
        height: 64px;
        margin-bottom: 20px;
    }
    .sage-search-progress-endpoint {
        width: 44px;
        height: 44px;
        font-size: 11px;
    }
    .sage-search-progress-endpoint-to {
        min-height: 44px;
        padding: 6px 10px 6px 8px;
        font-size: 11px;
    }
    .sage-search-progress-logo { width: 22px; height: 22px; }
    .sage-search-progress-track {
        left: 52px;
        right: 120px;
    }
    .sage-search-progress-title { font-size: 16px; }
    .sage-search-progress-status { font-size: 12px; min-height: 32px; }
}
.sage-search-progress-anim {
    position: relative;
    height: 80px;
    margin-bottom: 26px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 4px;
}
.sage-search-progress-endpoint {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.3px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
    z-index: 2;
}
.sage-search-progress-endpoint-from {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: #fff;
}
/* Customer-facing variant: no SAGE red. A neutral slate block with a search
   icon reads as "searching" without naming the backend integration. */
.sage-search-progress-endpoint-generic {
    background: linear-gradient(135deg, #475569, #334155);
    color: #fff;
    font-size: 24px;
    font-weight: normal;
}
/* Destination endpoint: a wider pill containing the site logo + brand name
   so the animation reads as "products flowing from SAGE into DECADE.promo". */
.sage-search-progress-endpoint-to {
    background: linear-gradient(135deg, #eef2ff, #e0e7ff);
    color: #4338ca;
    border: 1px solid rgba(99, 102, 241, 0.25);
    width: auto;
    min-height: 56px;
    gap: 8px;
    padding: 8px 14px 8px 10px;
    font-size: 13px;
    font-weight: 700;
}
.sage-search-progress-logo {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    object-fit: contain;
    flex-shrink: 0;
}
.sage-search-progress-brand {
    white-space: nowrap;
    letter-spacing: 0.2px;
}
.sage-search-progress-track {
    position: absolute;
    top: 50%;
    left: 64px;
    /* Destination pill is wider than the fixed 56px from-endpoint, so pull
       the track back further on the right side to land at the logo. */
    right: 170px;
    height: 2px;
    background: linear-gradient(90deg, rgba(185, 28, 28, 0.25), rgba(99, 102, 241, 0.25));
    transform: translateY(-50%);
    border-radius: 2px;
    overflow: visible;
}
.sage-search-progress-particle {
    position: absolute;
    top: 50%;
    left: 0;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    transform: translate(-50%, -50%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    animation: sageProgressParticle 2.2s infinite cubic-bezier(0.4, 0, 0.2, 1);
}
.sage-search-progress-particle:nth-child(1) { animation-delay: 0s;    background: linear-gradient(135deg, #ef4444, #dc2626); }
.sage-search-progress-particle:nth-child(2) { animation-delay: 0.35s; background: linear-gradient(135deg, #f97316, #ea580c); }
.sage-search-progress-particle:nth-child(3) { animation-delay: 0.7s;  background: linear-gradient(135deg, #eab308, #ca8a04); }
.sage-search-progress-particle:nth-child(4) { animation-delay: 1.05s; background: linear-gradient(135deg, #22c55e, #16a34a); }
.sage-search-progress-particle:nth-child(5) { animation-delay: 1.4s;  background: linear-gradient(135deg, #6366f1, #4f46e5); }
@keyframes sageProgressParticle {
    0%   { left: 0%;   opacity: 0; transform: translate(-50%, -50%) scale(0.4) rotate(0deg); }
    15%  { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(45deg); }
    85%  { opacity: 1; transform: translate(-50%, 20%) scale(1) rotate(315deg); }
    100% { left: 100%; opacity: 0; transform: translate(-50%, 40%) scale(0.4) rotate(360deg); }
}
/* Stop the particle stream once the search resolves so the success/error
   state reads as "done" rather than "still working". */
.sage-search-progress-card.done .sage-search-progress-particle {
    animation-play-state: paused;
    opacity: 0;
}
.sage-search-progress-title {
    font-size: 19px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 6px;
}
.sage-search-progress-status {
    font-size: 13px;
    color: var(--color-text-secondary);
    margin-bottom: 20px;
    min-height: 38px;
    line-height: 1.4;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}
.sage-search-progress-bar-track {
    width: 100%;
    height: 6px;
    background: var(--color-border);
    border-radius: 3px;
    overflow: hidden;
}
.sage-search-progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #dc2626, #f97316, #eab308, #22c55e, #6366f1);
    background-size: 200% 100%;
    animation: sageProgressShimmer 3s linear infinite;
    border-radius: 3px;
    transition: width 0.5s ease;
}
@keyframes sageProgressShimmer {
    from { background-position: 0% 50%; }
    to   { background-position: 200% 50%; }
}
.sage-search-progress-bar-fill.error {
    background: linear-gradient(90deg, #e53e3e, #c53030);
    animation: none;
}
.sage-search-progress-card.success .sage-search-progress-status {
    color: #16a34a;
    font-weight: 600;
}
.sage-search-progress-card.success .sage-search-progress-endpoint-to {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #fff;
    animation: sageProgressPop 0.4s ease-out;
}
@keyframes sageProgressPop {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.15); }
    100% { transform: scale(1); }
}
.sage-search-progress-card.failed .sage-search-progress-status {
    color: #dc2626;
    font-weight: 600;
}
.sage-search-progress-card.failed .sage-search-progress-endpoint-to {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
}

/* Admin usage counter in drawer footer */
.sage-drawer-usage {
    text-align: center;
    padding: 6px 0 10px;
    font-size: 11px;
    color: var(--color-muted);
    font-weight: 500;
}

/* =============================================================
   Gallery Detail — Price Code badge next to Pricing header
   ============================================================= */
.price-code-badge,
.gallery-detail-price-code {
    display: inline-block;
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: var(--color-primary);
    background: color-mix(in srgb, var(--color-primary), transparent 88%);
    border: 1px solid color-mix(in srgb, var(--color-primary), transparent 70%);
    border-radius: 4px;
    text-transform: uppercase;
    font-family: var(--font-mono, ui-monospace, SFMono-Regular, monospace);
    white-space: nowrap;
}

/* =============================================================
   Advanced SAGE Filters Drawer
   ============================================================= */
.advanced-sage-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    margin-left: 6px;
    background: linear-gradient(135deg, #b91c1c, #dc2626);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    border-radius: 9px;
    letter-spacing: 0;
}

/* Overlay behind the drawer */
.sage-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 999;
    animation: sageOverlayFade 0.2s ease-out;
}
.sage-drawer-overlay.hidden { display: none; }
@keyframes sageOverlayFade {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Drawer container */
.sage-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 560px;
    max-width: 100vw;
    background: var(--color-card);
    border-left: 1px solid var(--color-border);
    box-shadow: -8px 0 32px rgba(0,0,0,0.25);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    animation: sageDrawerSlide 0.28s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.sage-drawer.hidden { display: none; }
@keyframes sageDrawerSlide {
    from { transform: translateX(100%); }
    to   { transform: translateX(0); }
}
@media (max-width: 640px) {
    .sage-drawer { width: 100vw; }
}

/* Inline mode: when the panel lives on the SAGE Product Search page, drop the
   fixed positioning and overlay chrome so it renders as a regular page panel
   and lay its body out in three columns so all filters + the submit button
   fit in the initial viewport without scrolling. */
.sage-drawer.sage-drawer-inline {
    position: static;
    top: auto;
    right: auto;
    bottom: auto;
    width: 100%;
    max-width: 100%;
    border-left: 1px solid var(--color-border);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: none;
    z-index: auto;
    animation: none;
    overflow: hidden;
}
.sage-drawer.sage-drawer-inline .sage-drawer-close { display: none; }
/* The inline SAGE Product Search page relocates the "SAGE | Find New Products"
   header to the top-right of the page header (see #sageSearchHeaderBadge).
   The drawer's own internal header is redundant once relocated, so hide it. */
.sage-drawer.sage-drawer-inline .sage-drawer-header {
    display: none;
}
.sage-drawer.sage-drawer-inline .sage-drawer-header h2 { font-size: 16px; }
/* The page already has a large "SAGE Product Search" heading above this card,
   and the context strip below spells out what's being searched. The small
   subtitle underneath the "Find New Products" title was just restating the
   same idea a third time - hide it inline to cut the word salad. */
.sage-drawer.sage-drawer-inline .sage-drawer-subtitle { display: none; }
.sage-drawer.sage-drawer-inline .sage-drawer-context {
    padding: 12px 22px;
    font-size: 12px;
}
.sage-drawer.sage-drawer-inline .sage-drawer-active-chips { padding: 12px 22px; }
.sage-drawer.sage-drawer-inline .sage-drawer-body {
    max-height: none;
    overflow: visible;
    padding: 14px 18px 16px;
    /* Fixed 3-column grid with explicit column placement (assigned via
       :nth-child below). Replaces the legacy `column-count: 3` masonry
       which reflowed cards across columns whenever a collapsible
       (More filters / Product Attributes) was opened. With explicit
       placement, expanding a collapsible only grows that column - the
       other two stay put. Col 3 is narrower (it only holds the two
       collapsed sections by default) so the empty space below them
       doesn't dominate the right side of the page. */
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.4fr) minmax(0, 0.8fr);
    column-gap: 18px;
    align-items: start;
    /* Without `dense`, the default `row` auto-flow advances a cursor
       through the grid in source order; items with explicit
       `grid-column` then land at whatever row the cursor reached, so
       col 2 + col 3 cards end up pushed far down the page instead
       of starting at row 1 of their own column. `dense` makes each
       item land in the earliest available row of its assigned
       column - which is the layout we actually want here. */
    grid-auto-flow: dense;
}
.sage-drawer.sage-drawer-inline .sage-drawer-body > section,
.sage-drawer.sage-drawer-inline .sage-drawer-body > div {
    margin: 0 0 8px;
    display: block;
}
/* Column assignments via nth-child - stable, no `:has()` browser
   gotchas, and immune to which sibling type the card uses. The
   .sage-drawer-body has these direct children in source order:
     1  #sageDrawerExplainer (.hidden by default; spans all cols)
     2  Keywords            -> col 1
     3  Category + Theme    -> col 1
     4  Color               -> col 1
     5  Item # + Item Name  -> col 1
     6  Price & Quantity    -> col 2
     7  Product Dimensions  -> col 2
     8  Imprint Area        -> col 2
     9  Decoration Method   -> col 2  (moved from col 3 to balance heights)
    10  More filters        -> col 3
    11  Product Attributes  -> col 3
   nth-child counts hidden siblings, so positions are stable
   regardless of role-gated visibility. */
.sage-drawer.sage-drawer-inline .sage-drawer-body > *:nth-child(1)  { grid-column: 1 / -1; } /* explainer span */
.sage-drawer.sage-drawer-inline .sage-drawer-body > *:nth-child(2),
.sage-drawer.sage-drawer-inline .sage-drawer-body > *:nth-child(3),
.sage-drawer.sage-drawer-inline .sage-drawer-body > *:nth-child(4),
.sage-drawer.sage-drawer-inline .sage-drawer-body > *:nth-child(5)  { grid-column: 1; }
.sage-drawer.sage-drawer-inline .sage-drawer-body > *:nth-child(6),
.sage-drawer.sage-drawer-inline .sage-drawer-body > *:nth-child(7),
.sage-drawer.sage-drawer-inline .sage-drawer-body > *:nth-child(8),
.sage-drawer.sage-drawer-inline .sage-drawer-body > *:nth-child(9)  { grid-column: 2; }
.sage-drawer.sage-drawer-inline .sage-drawer-body > *:nth-child(10),
.sage-drawer.sage-drawer-inline .sage-drawer-body > *:nth-child(11) { grid-column: 3; }
.sage-drawer.sage-drawer-inline .sage-field-card {
    padding: 8px 12px;
}
.sage-drawer.sage-drawer-inline .sage-field-card-title {
    font-size: 12px;
    margin: 0 0 6px;
}
.sage-drawer.sage-drawer-inline .sage-field-textarea { min-height: 32px; }
.sage-drawer.sage-drawer-inline .sage-field-label {
    font-size: 11px;
    margin-bottom: 2px;
}
.sage-drawer.sage-drawer-inline .sage-field-hint { font-size: 10px; margin-top: 2px; }
.sage-drawer.sage-drawer-inline .sage-field-input {
    padding: 5px 8px;
    font-size: 12px;
}
.sage-drawer.sage-drawer-inline .sage-field-check { font-size: 11px; padding: 2px 0; }
.sage-drawer.sage-drawer-inline .sage-field-group { margin-bottom: 0; }
.sage-drawer.sage-drawer-inline .sage-field-row { margin-bottom: 0; gap: 10px; }
/* Tighter dim row spacing so the 3 stacked rows + checkbox fit in less
   vertical room. The card itself was the tallest item in col 2; this
   pulls ~40px out without breaking the [val][unit][axis] layout. */
.sage-drawer.sage-drawer-inline .sage-dim-entries { margin-bottom: 4px; }
.sage-drawer.sage-drawer-inline .sage-dim-entry { gap: 6px; }
.sage-drawer.sage-drawer-inline .sage-dim-separator { padding: 1px 0; font-size: 11px; }
/* Hoisted footer (Sort + Search). Lives as a sibling of the filter
   card now (see initSageSearchPage). Visually a separate block: no
   shared border with the filter card above, breathing room between
   them, and the search button stands alone below the sort row. We
   combine the two classes (`.sage-drawer-footer.sage-search-actions`)
   so specificity beats the base `.sage-drawer-footer` rule that
   appears later in this stylesheet. */
.sage-drawer-footer.sage-search-actions {
    margin-top: 16px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
    border: 0;
    background: transparent;
    box-shadow: none;
}
.sage-drawer-footer.sage-search-actions .sage-drawer-footer-top {
    width: 100%;
    margin: 0;
    /* Cap the sort dropdown width - was stretching the entire row. */
    max-width: 320px;
}
.sage-drawer-footer.sage-search-actions .sage-field-group {
    flex: 0 1 auto;
    margin: 0;
}
.sage-drawer-footer.sage-search-actions .sage-drawer-usage { margin: 0; }
/* Search button: standard primary button size, right-aligned on its
   own row underneath the sort dropdown. */
.sage-drawer-footer.sage-search-actions .sage-drawer-submit-btn {
    width: auto;
    align-self: flex-end;
    padding: 10px 22px;
    font-size: 14px;
    border-radius: 8px;
    box-shadow: none;
}

/* Relocated SAGE / Find New Products header badge on the page header.
   Matches the visual weight of the page H1 sitting across from it. */
.sage-search-header-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
}
.sage-search-header-badge.hidden,
.sage-search-header-badge.non-customer-hidden { display: none; }
.sage-search-header-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
    white-space: nowrap;
}

/* Non-SAGE marketing / education card shown on the SAGE Product Search page
   when the active PPD hasn't connected SAGE. Replaces the live-search UI. */
.sage-marketing-card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    padding: 32px 36px;
    max-width: 1100px;
    margin: 0 auto;
}
.sage-marketing-hero {
    text-align: center;
    margin-bottom: 28px;
}
.sage-marketing-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
    font-size: 14px;
    color: var(--color-muted);
}
.sage-marketing-plus {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-muted);
}
.sage-marketing-brand {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: 0.2px;
}
.sage-marketing-title {
    font-size: 26px;
    font-weight: 800;
    color: var(--color-text);
    margin: 0 0 12px;
    line-height: 1.2;
}
.sage-marketing-lede {
    font-size: 15px;
    line-height: 1.55;
    color: var(--color-muted);
    max-width: 720px;
    margin: 0 auto;
}
.sage-marketing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}
.sage-marketing-feature {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 18px 18px 16px;
}
.sage-marketing-feature-icon {
    font-size: 22px;
    line-height: 1;
    margin-bottom: 10px;
}
.sage-marketing-feature-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 6px;
}
.sage-marketing-feature-desc {
    font-size: 13px;
    line-height: 1.5;
    color: var(--color-muted);
}
.sage-marketing-footer {
    text-align: center;
    padding-top: 6px;
}
.sage-marketing-cta-note {
    font-size: 13px;
    color: var(--color-muted);
    font-style: italic;
}
@media (max-width: 700px) {
    .sage-marketing-card { padding: 24px 20px; }
    .sage-marketing-title { font-size: 22px; }
}
/* Responsive overrides for the inline Discover More Products grid.
   The desktop layout is `display: grid` with three explicit columns
   (see ~14400 above). These breakpoints collapse to two columns at
   tablet width and one column at phone width. The legacy rules used
   `column-count`, which has no effect on a grid container - leaving
   the form stuck at three ~110px columns on iPhone. */
@media (max-width: 900px) {
    .sage-drawer.sage-drawer-inline .sage-drawer-body {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }
    /* Reassign nth-child columns: col-3 collapses into col-2 at tablet
       width since the grid only has two columns from here down. */
    .sage-drawer.sage-drawer-inline .sage-drawer-body > *:nth-child(2),
    .sage-drawer.sage-drawer-inline .sage-drawer-body > *:nth-child(3),
    .sage-drawer.sage-drawer-inline .sage-drawer-body > *:nth-child(4),
    .sage-drawer.sage-drawer-inline .sage-drawer-body > *:nth-child(5)  { grid-column: 1; }
    .sage-drawer.sage-drawer-inline .sage-drawer-body > *:nth-child(6),
    .sage-drawer.sage-drawer-inline .sage-drawer-body > *:nth-child(7),
    .sage-drawer.sage-drawer-inline .sage-drawer-body > *:nth-child(8),
    .sage-drawer.sage-drawer-inline .sage-drawer-body > *:nth-child(9),
    .sage-drawer.sage-drawer-inline .sage-drawer-body > *:nth-child(10),
    .sage-drawer.sage-drawer-inline .sage-drawer-body > *:nth-child(11) { grid-column: 2; }
}
@media (max-width: 600px) {
    .sage-drawer.sage-drawer-inline .sage-drawer-body {
        grid-template-columns: minmax(0, 1fr);
        column-gap: 0;
        padding: 12px 14px;
    }
    /* Single-column phone layout: every card flows into col 1 in source
       order. Override the explicit nth-child grid-column placements
       above. */
    .sage-drawer.sage-drawer-inline .sage-drawer-body > * {
        grid-column: 1 !important;
    }
    .sage-drawer.sage-drawer-inline .sage-field-row {
        flex-direction: column;
        gap: 8px;
    }
    .sage-drawer-footer.sage-search-actions .sage-drawer-submit-btn {
        width: 100%;
        align-self: stretch;
    }
    /* When .sage-field-row collapses to flex-direction: column, the
       desktop `align-items: center` on .sage-field-price-modifiers
       turns into HORIZONTAL centering and offsets EQP / Catalog /
       Net-Wholesale / Min Price Code from the rest of the form.
       Force flex-start so this card matches every other card's
       left-aligned content on mobile. */
    .sage-drawer.sage-drawer-inline .sage-field-price-modifiers {
        align-items: flex-start;
    }
    /* The radio group itself stays horizontal (Catalog vs
       Net/Wholesale) - it's only its parent column that needed
       the realignment. */
    .sage-drawer.sage-drawer-inline .sage-field-price-modifiers .sage-field-radio-group {
        align-items: center;
    }
    /* The "Min Price Code" sublabel was using a label-inline pattern
       that aligns center on desktop. Keep it left on mobile. */
    .sage-drawer.sage-drawer-inline .sage-field-price-modifiers .sage-field-label-inline {
        text-align: left;
    }
}

/* Sticky header */
.sage-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px 14px;
    border-bottom: 1px solid var(--color-border);
    background: linear-gradient(135deg, rgba(185,28,28,0.05), rgba(220,38,38,0.02));
    flex-shrink: 0;
}
.sage-drawer-title {
    display: flex;
    align-items: center;
    gap: 14px;
}
.sage-drawer-title h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.1;
}
.sage-drawer-subtitle {
    font-size: 12px;
    color: var(--color-muted);
    margin-top: 3px;
}
/* .sage-drawer-badge now covered by the unified .sage-badge / .sage-badge-lg rule above */
.sage-drawer-close {
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    color: var(--color-muted);
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}
.sage-drawer-close:hover {
    background: var(--color-bg);
    color: var(--color-text);
}

/* Active filter chips strip in drawer header */
.sage-drawer-active-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 10px 24px;
    background: color-mix(in srgb, var(--color-primary), transparent 94%);
    border-bottom: 1px solid color-mix(in srgb, var(--color-primary), transparent 80%);
    flex-shrink: 0;
}
.sage-drawer-active-chips.hidden { display: none; }
.sage-drawer-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 6px 4px 10px;
    background: var(--color-card);
    border: 1px solid color-mix(in srgb, var(--color-primary), transparent 65%);
    border-radius: 14px;
    font-size: 11px;
    font-weight: 600;
    color: var(--color-primary);
    white-space: nowrap;
}
.sage-drawer-chip-x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-primary);
    font-size: 12px;
    padding: 0;
    opacity: 0.6;
}
.sage-drawer-chip-x:hover { opacity: 1; background: color-mix(in srgb, var(--color-primary), transparent 80%); }
.sage-drawer-chips-clear {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--color-primary);
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    opacity: 0.7;
    padding: 2px 4px;
}
.sage-drawer-chips-clear:hover { opacity: 1; }

/* Context strip */
.sage-drawer-context {
    padding: 10px 24px;
    font-size: 12px;
    color: var(--color-muted);
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}
.sage-drawer-context strong {
    color: var(--color-text);
    font-weight: 600;
}

/* Scrollable body */
.sage-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px 24px;
}

/* Field sizing — all inputs use 34px height, consistent padding */
.sage-field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 18px;
    flex: 1;
    min-width: 0;
}
.sage-field-group:last-child { margin-bottom: 0; }
.sage-field-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
    color: var(--color-muted);
}
.sage-field-label-inline { margin-bottom: 4px; }
.sage-field-label-sm { font-size: 10px; }
.sage-field-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 13px;
    background: var(--color-card);
    color: var(--color-text);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    height: 34px;
    box-sizing: border-box;
}
.sage-field-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}
.sage-field-textarea {
    height: auto;
    min-height: 64px;
    resize: vertical;
    font-family: inherit;
    line-height: 1.4;
}
select.sage-field-input {
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    color: #2d3748;
    background-color: #ffffff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23718096' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}
[data-theme="dark"] select.sage-field-input {
    color: #e2e8f0;
    background-color: #1e293b;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
}
.sage-field-hint {
    font-size: 11px;
    color: var(--color-muted);
    line-height: 1.3;
}
.sage-field-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 12px;
    color: var(--color-text);
    padding: 4px 0;
    font-weight: 500;
}
.sage-field-check input[type="checkbox"],
.sage-field-check input[type="radio"] {
    width: 15px;
    height: 15px;
    cursor: pointer;
    accent-color: var(--color-primary);
}
.sage-field-check-inline {
    margin-top: 4px;
    padding: 0;
    font-size: 11px;
}

/* Row layouts */
.sage-field-row {
    display: flex;
    gap: 16px;
    margin-bottom: 18px;
    align-items: flex-start;
}
.sage-field-row:last-child { margin-bottom: 0; }
.sage-field-row .sage-field-group { margin-bottom: 0; }
.sage-field-row-3 > .sage-field-group { flex: 1; }
.sage-field-row-tight {
    gap: 20px;
    margin-top: 8px;
}

/* Visual "card" container for grouped related fields (Price, Dimensions, Imprint) */
.sage-field-card {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 16px 18px;
    margin-bottom: 20px;
}
.sage-field-card-title {
    margin: 0 0 14px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--color-text);
    font-weight: 800;
}

/* Price modifiers row: EQP + radio + min-code */
.sage-field-price-modifiers {
    align-items: center;
    gap: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--color-border);
    margin-top: 4px;
    flex-wrap: wrap;
}
.sage-field-radio-group {
    display: flex;
    gap: 10px;
    align-items: center;
}
.sage-field-radio {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
}

/* Dimensions: each entry is a horizontal row  [value] [unit ▾] [side ▾]
   Entries stack vertically with a  ×  separator between them. */
.sage-dim-entries {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 10px;
}
.sage-dim-entry {
    display: flex;
    align-items: center;
    gap: 8px;
}
.sage-dim-number {
    flex: 2;
    min-width: 80px;
}
.sage-dim-unit {
    flex: 1.5;
    min-width: 80px;
}
.sage-dim-axis {
    flex: 1.5;
    min-width: 90px;
}
.sage-dim-separator {
    color: var(--color-muted);
    font-weight: 700;
    font-size: 13px;
    text-align: center;
    padding: 4px 0;
    user-select: none;
}

/* =============================================================
   Searchable Multi-Select Dropdown (Decoration Methods)
   ============================================================= */
.sage-multiselect {
    position: relative;
}
.sage-multiselect-input {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    min-height: 38px;
    padding: 4px 8px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-card);
    cursor: text;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.sage-multiselect-input:focus-within {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}
.sage-multiselect-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.sage-multiselect-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 6px 3px 10px;
    background: color-mix(in srgb, var(--color-primary), transparent 88%);
    color: var(--color-primary);
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    animation: sagePillIn 0.15s ease-out;
}
@keyframes sagePillIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
.sage-multiselect-pill-x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-primary);
    font-size: 12px;
    padding: 0;
    line-height: 1;
}
.sage-multiselect-pill-x:hover {
    background: color-mix(in srgb, var(--color-primary), transparent 70%);
}
.sage-multiselect-search {
    flex: 1;
    min-width: 100px;
    border: none;
    outline: none;
    background: transparent;
    font-size: 13px;
    color: var(--color-text);
    padding: 4px 2px;
}
.sage-multiselect-search::placeholder {
    color: var(--color-muted);
}
.sage-multiselect-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    z-index: 50;
    max-height: 260px;
    overflow-y: auto;
}
.sage-multiselect-dropdown.hidden { display: none; }
.sage-multiselect-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    color: var(--color-text);
    transition: background 0.1s;
}
.sage-multiselect-option:hover {
    background: color-mix(in srgb, var(--color-primary), transparent 94%);
}
.sage-multiselect-option.selected {
    background: color-mix(in srgb, var(--color-primary), transparent 90%);
    font-weight: 600;
    color: var(--color-primary);
}
.sage-multiselect-option input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: var(--color-primary);
    cursor: pointer;
    flex-shrink: 0;
}
.sage-multiselect-option-count {
    margin-left: auto;
    font-size: 10px;
    padding: 1px 6px;
    background: color-mix(in srgb, var(--color-text), transparent 90%);
    border-radius: 6px;
    color: var(--color-muted);
    font-weight: 700;
}
.sage-multiselect-option.selected .sage-multiselect-option-count {
    background: color-mix(in srgb, var(--color-primary), transparent 75%);
    color: var(--color-primary);
}
.sage-multiselect-empty {
    padding: 14px 12px;
    font-size: 12px;
    color: var(--color-muted);
    text-align: center;
}

/* Chip-style checkboxes for product attributes */
.sage-chip-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 8px;
    margin-top: 4px;
}
.sage-chip-check {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 12px;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-size: 12px;
    color: var(--color-text);
    font-weight: 500;
    transition: background 0.15s, border-color 0.15s;
}
.sage-chip-check:hover {
    border-color: var(--color-primary);
    background: color-mix(in srgb, var(--color-primary), transparent 94%);
}
.sage-chip-check input[type="checkbox"] {
    width: 15px;
    height: 15px;
    cursor: pointer;
    accent-color: var(--color-primary);
}
.sage-chip-check:has(input:checked) {
    background: color-mix(in srgb, var(--color-primary), transparent 88%);
    border-color: var(--color-primary);
    color: var(--color-primary);
    font-weight: 600;
}
.sage-chip-check-count {
    display: inline-block;
    margin-left: 6px;
    padding: 0 5px;
    background: color-mix(in srgb, var(--color-text), transparent 90%);
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    color: var(--color-muted);
    vertical-align: 1px;
}
.sage-chip-check:has(input:checked) .sage-chip-check-count {
    background: color-mix(in srgb, var(--color-primary), transparent 75%);
    color: var(--color-primary);
}

/* Collapsible sections */
.sage-field-collapsible {
    margin-top: 8px;
    margin-bottom: 12px;
    border-top: 1px solid var(--color-border);
    padding-top: 16px;
}
.sage-collapse-btn {
    background: none;
    border: none;
    padding: 0;
    color: var(--color-text);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.sage-collapse-btn:hover { color: var(--color-primary); }
.sage-collapse-chevron {
    display: inline-block;
    width: 10px;
    font-size: 10px;
    transition: transform 0.15s;
}
.sage-collapse-hint {
    margin-left: auto;
    font-size: 10px;
    font-weight: 500;
    color: var(--color-muted);
    text-transform: none;
    letter-spacing: 0;
}
.sage-collapse-body {
    margin-top: 16px;
}

/* Sticky footer */
.sage-drawer-footer {
    flex-shrink: 0;
    padding: 16px 24px 20px;
    background: var(--color-card);
    border-top: 1px solid var(--color-border);
    box-shadow: 0 -4px 12px rgba(0,0,0,0.06);
}
.sage-drawer-footer-top {
    display: flex;
    align-items: flex-end;
    gap: 14px;
    margin-bottom: 12px;
}
.sage-drawer-clear-btn {
    background: none;
    border: none;
    color: var(--color-muted);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: underline;
    padding: 10px 4px;
    white-space: nowrap;
}
.sage-drawer-clear-btn:hover { color: var(--color-danger); }
.sage-drawer-submit-btn {
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, #b91c1c, #dc2626);
    color: #fff;
    border: 1px solid #991b1b;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: transform 0.12s, box-shadow 0.15s;
    box-shadow: 0 4px 12px rgba(220,38,38,0.25);
}
.sage-drawer-submit-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(220,38,38,0.35);
}
.sage-drawer-submit-btn:disabled {
    opacity: 0.7;
    cursor: default;
}
.sage-drawer-submit-icon { font-size: 16px; }

/* =============================================================
   SAGE Active Filter Chips
   ============================================================= */
.sage-active-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    margin: 8px 0;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 10px;
}
.sage-active-chips-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
    color: var(--color-muted);
    margin-right: 4px;
}
.sage-active-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 4px 4px 10px;
    background: linear-gradient(135deg, rgba(185,28,28,0.12), rgba(220,38,38,0.08));
    border: 1px solid rgba(185,28,28,0.25);
    border-radius: 14px;
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text);
}
.sage-active-chip-x {
    background: none;
    border: none;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--color-muted);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0;
}
.sage-active-chip-x:hover {
    background: rgba(185,28,28,0.2);
    color: var(--color-danger);
}
.sage-active-chips-clear {
    background: none;
    border: none;
    color: var(--color-muted);
    font-size: 11px;
    text-decoration: underline;
    cursor: pointer;
    margin-left: auto;
    padding: 4px 8px;
}
.sage-active-chips-clear:hover { color: var(--color-danger); }

/* =============================================================
   Inline Option-B SAGE Search Pill
   ============================================================= */
.sage-inline-pill {
    margin: 4px 0 8px;
    display: flex;
    justify-content: flex-start;
}
.sage-inline-pill-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: linear-gradient(135deg, #b91c1c, #dc2626);
    color: #fff;
    border: 1px solid #991b1b;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(220,38,38,0.2);
    transition: transform 0.15s, box-shadow 0.15s;
}
.sage-inline-pill-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(220,38,38,0.3);
}
.sage-inline-pill-btn:disabled { opacity: 0.7; cursor: default; }
.sage-inline-pill-icon { font-size: 14px; }
.sage-inline-pill-text strong { font-weight: 700; }
.sage-inline-pill-arrow {
    margin-left: 4px;
    font-size: 14px;
    transition: transform 0.15s;
}
.sage-inline-pill-btn:hover .sage-inline-pill-arrow { transform: translateX(3px); }

/* =============================================================
   Gallery Loading State
   ============================================================= */
.gallery-grid {
    position: relative;
}
.gallery-grid-loading {
    pointer-events: none;
}
.gallery-grid-loading > .gallery-card {
    opacity: 0.35;
    filter: saturate(0.6);
    transition: opacity 0.2s, filter 0.2s;
}
.gallery-grid-loading::after {
    content: 'Filtering your catalog...';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 260px;
    max-width: 80%;
    padding: 14px 20px;
    margin-top: 20px;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.18);
    z-index: 10;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='10' stroke='%236366f1' stroke-width='3' fill='none' stroke-dasharray='50' stroke-dashoffset='20' stroke-linecap='round'%3E%3CanimateTransform attributeName='transform' type='rotate' from='0 12 12' to='360 12 12' dur='0.9s' repeatCount='indefinite'/%3E%3C/circle%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 16px center;
    background-size: 24px 24px;
    padding-left: 52px;
    color: var(--color-text);
    font-size: 13px;
    font-weight: 600;
}
.gallery-loading-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    gap: 20px;
    color: var(--color-muted);
}
.gallery-loading-spinner {
    width: 44px;
    height: 44px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
.gallery-loading-text {
    font-size: 14px;
    color: var(--color-text);
    font-weight: 500;
}

/* =============================================================
   SAGE Catalog Integration
   ============================================================= */

/* SAGE-themed button (warm red, distinct from existing color palette) */
.btn-sage {
    background: linear-gradient(135deg, #b91c1c, #dc2626);
    color: #fff;
    border: 1px solid #991b1b;
    font-weight: 600;
}
.btn-sage:hover { background: linear-gradient(135deg, #991b1b, #b91c1c); }

/* SAGE Search Modal */
.sage-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
    border-bottom: 1px solid var(--color-border);
}
.sage-modal-title { display: flex; align-items: center; gap: 12px; }
.sage-modal-title h2 { margin: 0; font-size: 18px; }
.sage-modal-logo {
    background: linear-gradient(135deg, #b91c1c, #dc2626);
    color: #fff;
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 800;
    font-size: 13px;
    letter-spacing: 0.5px;
}
.sage-search-bar {
    display: flex;
    gap: 10px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--color-border);
}
.sage-search-bar input[type="text"],
.sage-search-bar select {
    padding: 7px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 13px;
    background: var(--color-card);
    color: var(--color-text);
    outline: none;
}
.sage-search-bar input[type="text"]:focus,
.sage-search-bar select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(99,102,241,0.15);
}
.sage-search-bar input[type="text"] { flex: 1; }
.sage-search-bar select {
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    color: #2d3748;
    background-color: #ffffff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23718096' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}
[data-theme="dark"] .sage-search-bar select {
    color: #e2e8f0;
    background-color: #1e293b;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
}
.sage-search-info {
    padding: 8px 20px;
    font-size: 13px;
    color: var(--color-muted);
}
.sage-info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.sage-cache-badge {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}
.sage-cache-hit {
    background: #dcfce7;
    color: #166534;
}
.sage-cache-fresh {
    background: #dbeafe;
    color: #1e40af;
}
[data-theme="dark"] .sage-cache-hit { background: #14532d; color: #bbf7d0; }
[data-theme="dark"] .sage-cache-fresh { background: #1e3a8a; color: #bfdbfe; }
.sage-search-results {
    flex: 1;
    overflow-y: auto;
    padding: 14px 20px 20px;
}
.sage-search-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--color-muted);
    font-size: 14px;
}
.sage-search-empty-icon { font-size: 48px; opacity: 0.4; margin-bottom: 12px; }
.sage-search-empty-tip {
    margin-top: 8px;
    font-size: 12px;
    opacity: 0.7;
}
.sage-search-loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--color-muted);
}
.sage-search-loading .spinner {
    width: 32px; height: 32px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}
.sage-search-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 14px 18px;
    border-radius: 8px;
    margin: 16px 0;
}
.sage-result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
}
.sage-result-card {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.15s, box-shadow 0.15s;
}
.sage-result-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.sage-result-thumb {
    position: relative;
    aspect-ratio: 1;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sage-result-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.sage-result-thumb-placeholder {
    color: var(--color-muted);
    font-size: 12px;
}
.sage-result-source {
    position: absolute;
    top: 6px;
    left: 6px;
    background: linear-gradient(135deg, #b91c1c, #dc2626);
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 3px;
    letter-spacing: 0.5px;
}
.sage-result-body {
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}
.sage-result-title {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--color-text);
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.sage-result-supplier { font-size: 11px; color: var(--color-muted); }
.sage-result-category { font-size: 11px; color: var(--color-muted); font-style: italic; }
.sage-result-price {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-primary);
    margin-top: 2px;
}
.sage-result-actions {
    margin-top: auto;
    padding-top: 8px;
}
.sage-result-actions .btn {
    width: 100%;
    font-size: 11px;
}
.btn-success {
    background: #16a34a !important;
    color: #fff !important;
    border-color: #15803d !important;
}

/* =============================================================
   SAGE Usage Dashboard
   ============================================================= */
.sage-usage-page { padding: 0 8px; }
.sage-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.sage-stat-card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 18px 20px;
    position: relative;
    overflow: hidden;
}
.sage-stat-card-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-muted);
    margin-bottom: 8px;
    font-weight: 600;
}
.sage-stat-card-value {
    font-size: 32px;
    font-weight: 800;
    color: var(--color-text);
    line-height: 1;
}
.sage-stat-card-sub {
    font-size: 12px;
    color: var(--color-muted);
    margin-top: 6px;
}
.sage-stat-ring {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 56px;
    height: 56px;
}
.sage-stat-ring svg { transform: rotate(-90deg); }
.sage-stat-ring-bg { fill: none; stroke: var(--color-border); stroke-width: 6; }
.sage-stat-ring-fg { fill: none; stroke-width: 6; transition: stroke-dashoffset 0.4s ease; }
.sage-stat-ring.green .sage-stat-ring-fg { stroke: #16a34a; }
.sage-stat-ring.amber .sage-stat-ring-fg { stroke: #f59e0b; }
.sage-stat-ring.red   .sage-stat-ring-fg { stroke: #dc2626; }
.sage-stat-ring-pct {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 11px;
    font-weight: 700;
    color: var(--color-text);
}
.sage-tier-bar-card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 18px 20px;
    margin-bottom: 24px;
}
.sage-tier-bar-card h3 { margin: 0 0 12px; font-size: 14px; font-weight: 700; }
.sage-tier-bar {
    display: flex;
    height: 44px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--color-border);
    position: relative;
}
.sage-tier-segment {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    text-shadow: 0 1px 1px rgba(0,0,0,0.2);
    position: relative;
}
.sage-tier-free      { background: linear-gradient(135deg, #16a34a, #22c55e); flex: 5; }
.sage-tier-standard  { background: linear-gradient(135deg, #f59e0b, #fbbf24); flex: 15; }
.sage-tier-volume    { background: linear-gradient(135deg, #dc2626, #ef4444); flex: 5; }
.sage-tier-marker {
    position: absolute;
    top: -6px;
    width: 4px;
    height: 56px;
    background: #1e293b;
    border-radius: 2px;
    z-index: 5;
    transition: left 0.4s ease;
}
.sage-tier-marker::after {
    content: '▼';
    position: absolute;
    top: -14px;
    left: -5px;
    font-size: 12px;
    color: #1e293b;
}
[data-theme="dark"] .sage-tier-marker { background: #fff; }
[data-theme="dark"] .sage-tier-marker::after { color: #fff; }
.sage-chart-card,
.sage-table-card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 18px 20px;
    margin-bottom: 24px;
}
.sage-chart-card h3,
.sage-table-card h3 {
    margin: 0 0 14px;
    font-size: 14px;
    font-weight: 700;
}
.sage-chart {
    width: 100%;
    height: 220px;
}
.sage-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}
@media (max-width: 900px) { .sage-grid-2 { grid-template-columns: 1fr; } }
.sage-recent-table { width: 100%; font-size: 12px; }
.sage-recent-table th { text-align: left; padding: 6px 8px; font-weight: 700; color: var(--color-muted); border-bottom: 1px solid var(--color-border); font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
.sage-recent-table td { padding: 8px; border-bottom: 1px solid var(--color-border); }
.sage-recent-table tr:last-child td { border-bottom: none; }
.sage-cache-mini { padding: 1px 6px; border-radius: 8px; font-size: 10px; font-weight: 700; }
.sage-cache-mini.hit  { background: #dcfce7; color: #166534; }
.sage-cache-mini.miss { background: #fef3c7; color: #92400e; }
.sage-cache-mini.fail { background: #fee2e2; color: #991b1b; }
[data-theme="dark"] .sage-cache-mini.hit  { background: #14532d; color: #bbf7d0; }
[data-theme="dark"] .sage-cache-mini.miss { background: #78350f; color: #fde68a; }
[data-theme="dark"] .sage-cache-mini.fail { background: #7f1d1d; color: #fecaca; }
.sage-top-list { list-style: none; padding: 0; margin: 0; }
.sage-top-list li {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--color-border);
    font-size: 13px;
}
.sage-top-list li:last-child { border-bottom: none; }
.sage-top-list-count {
    color: var(--color-muted);
    font-size: 12px;
}

/* ===================== Order form totals bands ===================== */
/* Three-column grid rows (customer | net | profit) on the edit order form.
   Columns match the fee-input grid so Setup / Art / Shipping customer-$,
   net-$, and code cells line up vertically with the totals columns. */
.order-totals-row { /* grid + padding already inline */ }
.order-totals-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-muted);
    margin-bottom: 2px;
}
.order-totals-value {
    font-weight: 700;
    font-size: 16px;
    line-height: 1.2;
}
.order-totals-value--lg {
    font-size: 20px;
    font-weight: 800;
}

/* ===================== Kanban board for orders ===================== */
.kanban-board {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 12px 4px 20px;
    align-items: flex-start;
    scroll-snap-type: x proximity;
    min-height: 480px;
}
.kanban-board.dragging { scroll-snap-type: none; }
.kanban-col {
    flex: 0 0 280px;
    max-width: 280px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 320px);
    scroll-snap-align: start;
}
.kanban-col-header {
    padding: 10px 12px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-card);
    border-radius: 10px 10px 0 0;
    display: flex;
    align-items: center;
    gap: 8px;
    position: sticky;
    top: 0;
    z-index: 1;
}
.kanban-header-tooltip {
    position:       fixed;
    padding:        5px 10px;
    border-radius:  6px;
    font-size:      11px;
    font-weight:    600;
    letter-spacing: 0.02em;
    white-space:    nowrap;
    color:          #fff;
    background:     rgba(15, 23, 42, 0.92);
    box-shadow:     0 4px 12px rgba(0,0,0,0.25);
    backdrop-filter: blur(6px);
    pointer-events: none;
    z-index:        10000;
    opacity:        0;
    text-transform: none;
    transition:     opacity 0.15s ease;
}
.kanban-header-tooltip.visible { opacity: 1; }
.kanban-col-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--color-text);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.kanban-col-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: var(--color-border);
    color: var(--color-text);
    font-size: 11px;
    font-weight: 700;
}
.kanban-col-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.kanban-col-body {
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    flex: 1;
}
.kanban-col-empty {
    font-size: 11px;
    color: var(--color-muted);
    text-align: center;
    padding: 20px 8px;
    font-style: italic;
}
.kanban-col.drag-over {
    background: color-mix(in srgb, var(--color-primary), transparent 88%);
    border-color: var(--color-primary);
}
.kanban-col.drag-over .kanban-col-header {
    background: color-mix(in srgb, var(--color-primary), transparent 85%);
}
.kanban-card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 10px;
    cursor: grab;
    transition: box-shadow 0.1s, transform 0.1s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.kanban-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border-color: color-mix(in srgb, var(--color-primary), transparent 60%);
}
.kanban-card:active,
.kanban-card.dragging {
    cursor: grabbing;
    opacity: 0.5;
    transform: scale(0.98);
}
.kanban-card-head {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}
.kanban-card-ordernum {
    font-weight: 700;
    font-size: 13px;
    color: var(--color-text);
}
.kanban-card-total {
    margin-left: auto;
    font-weight: 700;
    font-size: 13px;
    color: var(--color-primary);
}
.kanban-card-product {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text);
    line-height: 1.3;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.kanban-card-body {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}
.kanban-card-body-text {
    flex: 1;
    min-width: 0;
}
.kanban-card-thumb {
    width: 44px;
    height: 44px;
    border-radius: 6px;
    object-fit: cover;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    flex-shrink: 0;
}
.kanban-card-thumb-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--color-muted);
}
.kanban-card-meta {
    font-size: 11px;
    color: var(--color-text-secondary);
    line-height: 1.3;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.kanban-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--color-border);
    font-size: 11px;
}
.kanban-card-due {
    color: var(--color-text-secondary);
}

/* ---- Mini kanban: all columns fit the viewport ---- */
.kanban-board.mini {
    overflow-x: hidden;
    gap: 6px;
    scroll-snap-type: none;
    padding: 8px 2px 16px;
}
.kanban-board.mini .kanban-col {
    flex: 1 1 0;
    min-width: 0;
    max-width: none;
}
.kanban-board.mini .kanban-col-header {
    padding: 6px 8px;
    gap: 6px;
}
.kanban-board.mini .kanban-col-count {
    min-width: 14px;
    height: 14px;
    font-size: 9px;
    padding: 0 3px;
}
.kanban-board.mini .kanban-col-title {
    font-size: 8px;
    letter-spacing: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}
.kanban-board.mini .kanban-col-body {
    padding: 4px;
    gap: 4px;
}
.kanban-board.mini .kanban-card {
    padding: 6px 8px;
    border-radius: 6px;
}
.kanban-board.mini .kanban-card-head { margin-bottom: 2px; gap: 4px; }
.kanban-board.mini .kanban-card-ordernum { font-size: 11px; }
.kanban-board.mini .kanban-card-total    { font-size: 11px; }
.kanban-board.mini .kanban-card-body     { gap: 0; }
.kanban-board.mini .kanban-card-footer,
.kanban-board.mini .kanban-card-project,
.kanban-board.mini .kanban-card-customer,
.kanban-board.mini .kanban-card-qty,
.kanban-board.mini .kanban-card-total {
    display: none;
}
.kanban-board.mini .kanban-card-thumb {
    width: 28px;
    height: 28px;
    border-radius: 4px;
}
.kanban-board.mini .kanban-card-thumb-placeholder {
    font-size: 14px;
}
.kanban-board.mini .kanban-card-body { gap: 6px; }
.kanban-board.mini .kanban-card-product {
    font-size: 11px;
    -webkit-line-clamp: 1;
    margin-bottom: 2px;
}
.kanban-board.mini .kanban-card-company {
    font-size: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.kanban-board.mini .kanban-card-meta { gap: 0; }


/* =============================================================
   Responsive foundation (Phase 1A)
   =============================================================
   Shared tokens and mobile-universal rules applied sitewide so
   every existing page picks up the minimum mobile-quality baseline
   without per-page changes. Kept at the end of the file so these
   rules win cascade order against earlier, more specific selectors.
   ============================================================= */
:root {
    --bp-phone:     600px;
    --bp-tablet:    1024px;
    --bp-wide:      1280px;
    --tap-min:      44px;
    --safe-top:     env(safe-area-inset-top, 0px);
    --safe-bottom:  env(safe-area-inset-bottom, 0px);
    --safe-left:    env(safe-area-inset-left, 0px);
    --safe-right:   env(safe-area-inset-right, 0px);
}

@media (max-width: 600px) {
    /* iOS Safari zooms the viewport when focusing any input whose
       effective font-size is under 16px. Bumping to 16px on phones
       only preserves the denser desktop layout while eliminating
       the jarring zoom-on-focus behavior on every form in the app. */
    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
    select,
    textarea,
    .filter-input,
    .filter-bar select,
    .filter-bar .filter-input {
        font-size: 16px;
    }

    /* Apple HIG minimum tap-target size. Applied to the base .btn
       only so dense helpers (.btn-sm, .btn-xs) that live in table
       rows stay compact. Promoted buttons (.btn-primary, .btn-ghost,
       etc.) inherit from .btn so they all benefit. */
    .btn:not(.btn-sm):not(.btn-xs) {
        min-height: var(--tap-min);
    }
}

/* Honor the iOS safe area on the fixed mobile topbar so content
   doesn't hide behind the notch / status bar when the site is
   installed as a PWA. No-op in browsers that don't support env(). */
.mobile-topbar {
    padding-top:  var(--safe-top);
    padding-left: calc(10px + var(--safe-left));
    padding-right: calc(16px + var(--safe-right));
    height: calc(56px + var(--safe-top));
}

/* The top-left hamburger is redundant on phone — the bottom tab bar
   has a "Menu" slot that opens the same sidebar and is more thumb-
   reachable. Hide it on phone widths but leave it in the DOM so the
   existing click handler keeps working if the page is resized up.
   Also hide the sidebar logo on phone — the mobile topbar already
   shows the brand, and the sidebar-as-menu-drawer doesn't need it
   duplicated at the top of the drawer. */
@media (max-width: 600px) {
    .mobile-topbar .hamburger { display: none; }
    .sidebar .sidebar-logo { display: none; }
    /* Action buttons in page headers shrink to icon-only chips on
       phone so all of them fit on a single row no matter how long
       their desktop labels are. Button identity comes from the
       existing color classes (btn-clear amber, btn-export blue,
       btn-sage red, btn-primary indigo, etc). aria-label on each
       button carries the original wording for screen readers. */
    .header-buttons {
        flex-wrap: nowrap;
        gap: 6px;
        justify-content: flex-start;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .header-buttons::-webkit-scrollbar { display: none; }
    .header-title-row {
        flex-wrap: wrap;
        gap: 8px;
    }

    /* Header action buttons: every button uses the standard inline
       SVG icon + .btn-label span pattern that the rest of the app
       already uses (mobile-topbar, bottom tab bar, sidebar nav).
       The JS helper upgradeHeaderButtons() prepends the right SVG
       and wraps the existing text in <span class="btn-label"> so we
       don't have to edit ~40 button markup sites by hand. Phone
       layout: hide the label on utility buttons, keep it on the
       primary +New action. Tap target stays 40×40 minimum. */
    .header-buttons .btn {
        flex: 0 0 auto;
        gap: 6px;
        height: 40px;
        padding: 0 10px;
    }
    .header-buttons .btn-clear .btn-label,
    .header-buttons .btn-export .btn-label,
    .header-buttons .btn-sage .btn-label,
    .header-buttons .btn-ghost:has(.btn-label) .btn-label {
        display: none;
    }
    /* Discover More Products button: keep the text, ditch the
       magnifying glass icon on mobile and use the short label
       "More Products" so the button reads at a glance instead of
       being a mystery red square. The original "Discover More
       Products" / "Find New Products on SAGE" labels are too long
       for a phone-width header row, so we replace the visible text
       via a pseudo-element. The actual <span class="btn-label">
       label stays in DOM (hidden) so screen readers + the
       desktop layout keep working unchanged. */
    .header-buttons .btn-sage {
        width: auto !important;
        padding: 0 14px !important;
    }
    .header-buttons .btn-sage svg { display: none; }
    .header-buttons .btn-sage::after {
        content: 'More Products';
        font-size: 13px;
        font-weight: 600;
        white-space: nowrap;
    }
    /* :has() scope ensures we only collapse ghost buttons that were
       explicitly wrapped with a .btn-label span + SVG (Why Digitize,
       Why Vectorize, Design Teams). Plain ghost buttons without an
       icon (Referrers, Back to X, etc.) keep their text label. */
    .header-buttons .btn-clear,
    .header-buttons .btn-export,
    .header-buttons .btn-sage,
    .header-buttons .btn-ghost:has(.btn-label) {
        width: 40px;
        padding: 0;
        justify-content: center;
    }
    /* Primary +New X stays with label, grows to fill remaining row */
    .header-buttons .btn[id^="new"][id$="Btn"] {
        flex: 1 1 auto;
        min-width: 0;
        max-width: 180px;
    }
    .header-buttons .btn[id^="new"][id$="Btn"] .btn-label {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Pagination bar: a 470-page number row is untappable on phones.
       Condense to "< Prev [active page] Next >" by hiding non-active
       page buttons + ellipses, hiding the rows-per-page selector, and
       letting the row wrap cleanly centered. Info text + controls stack
       instead of fighting for horizontal space. */
    .pagination-bar {
        justify-content: center;
        padding: 12px;
        gap: 10px;
    }
    .pagination-info { flex-wrap: wrap; justify-content: center; gap: 8px; }
    .pagination-divider,
    .pagination-size-label { display: none; }
    .pagination-controls {
        flex-wrap: nowrap;
        justify-content: center;
        gap: 6px;
    }
    /* Page number buttons: the JS renderer already produces only a
       3-button window on mobile, so no CSS hiding is needed. Just
       size them for comfortable tapping. */
    .pagination-controls .page-btn {
        min-width: 40px;
        height: 40px;
    }
    .pagination-controls .page-btn.active {
        font-weight: 600;
    }
    .pagination-controls .prev-btn,
    .pagination-controls .next-btn {
        min-width: 64px;
        height: 40px;
    }
}

/* Mobile: the open-project panel's desktop anchor (#openProjectWidget)
   lives inside .top-nav which is display:none on phones, so its
   absolutely-positioned child panel has no layout context. Promote
   it to position:fixed below the mobile topbar so tapping the
   mobile-topbar folder button opens a usable sheet. */
@media (max-width: 600px) {
    .open-project-panel {
        position: fixed;
        top: calc(56px + var(--safe-top) + 4px);
        right: 8px;
        left: 8px;
        width: auto;
        max-height: calc(100vh - 56px - var(--safe-top) - 72px);
        z-index: 9400;
    }
}

/* Hide the sidebar + mobile-topbar brand until the client knows
   whether to show the DECADE logo or the user's white-label PPD
   logo. The .brand-loading class is added on <html> from an inline
   <head> script and removed by renderSidebarBrand() once the user
   object is resolved, eliminating the logo flash on every page load
   for PPD users with a custom brand.

   Same gate also hides the mobile-topbar action area + the desktop
   top-nav action area. Without this, on every refresh the comment
   / task / notification bells, the open-project pill, and credits
   chips render with their default state for ~100ms BEFORE
   applyAnonRoleGates / renderUserAvatar settles them into the
   correct per-role configuration. The class is removed in both
   paths (authed initAuth's renderSidebarBrand and the anon
   applyAnonRoleGates), so this works for every role. */
html.brand-loading .sidebar-logo .logo-link,
html.brand-loading .mobile-brand,
html.brand-loading .mobile-topbar-actions,
html.brand-loading .top-nav-actions,
html.brand-loading #topNavUserWrap,
html.brand-loading #topNavCredits {
    visibility: hidden;
}

/* For anon visitors the shell renderer (services/shell_render.js)
   has already SSR-baked the storefront PPD's logo into the HTML
   before the first byte ships - so there's no JS-driven swap to
   wait on. Keep the brand visible immediately and ignore the
   brand-loading hide. */
html.is-anon.brand-loading .sidebar-logo .logo-link,
html.is-anon.brand-loading .mobile-brand,
html.is-anon .sidebar-logo .logo-link,
html.is-anon .mobile-brand {
    visibility: visible !important;
}

/* =============================================================
   FOUC suppression for the mobile topbar.

   Without this, on every shop-page refresh you see a half-second
   flash where the comment / task / notification bells render
   visible BEFORE applyAnonRoleGates() runs and hides them, plus
   the open-project pill briefly shows for anon visitors who
   shouldn't see it.

   The shell renderer (services/shell_render.js) tags <html> with
   `role-{role}` and `is-anon` BEFORE first paint. We piggy-back
   on those classes here to pre-hide everything anon shouldn't see,
   so the very first frame paints the correct subset.

   This only fixes the SSR-rendered (anon shop) path. The authed /
   route still serves a static index.html with no role tag, so
   role-driven flash on those routes needs separate work.
   ============================================================= */
html.role-anon #mobileCommentsBell,
html.role-anon #mobileTasksBell,
html.role-anon #mobileNotifBell,
html.role-anon #mobileOpenProjectBtn,
html.role-anon #mobileOpenProjectDivider,
html.role-anon #mobileCredits,
html.role-anon #commentsBell,
html.role-anon #tasksBell,
html.role-anon #notificationBell,
html.role-anon #topNavCredits,
html.role-anon #openProjectBtn,
html.role-anon .ppd-scoped,
html.role-anon .non-customer {
    display: none !important;
}

/* =============================================================
   Responsive cards — table-to-card transform (Phase 1A Day 2)
   =============================================================
   Opt-in pattern: add the class `responsive-cards` to any existing
   <table class="data-table">. Above the phone breakpoint it renders
   as a normal table (no visual change). At or below --bp-phone each
   row becomes a stacked card, the <thead> hides, and labels are
   pulled from each <td>'s data-label attribute.

   Per-cell opt-outs (add as class on <td>):
     .card-title     - render as the card title (large, bold, full
                       width). If no cell has this class, the first
                       <td> is auto-promoted to title.
     .card-actions   - bottom action row (right-aligned buttons).
     .card-hide      - hide this cell in card mode entirely.

   The parent .table-wrap's horizontal scroll is disabled when it
   contains a responsive-cards table so cards flow naturally without
   a phantom scroll container.
   ============================================================= */
@media (max-width: 600px) {
    .table-wrap:has(.data-table.responsive-cards) {
        overflow-x: visible;
        overflow-y: visible;
    }
    .table-wrap:has(.data-table.responsive-cards) + .table-scroll-arrow,
    .data-table.responsive-cards ~ .table-scroll-arrow {
        display: none !important;
    }

    .data-table.responsive-cards,
    .data-table.responsive-cards tbody {
        display: block;
        width: 100%;
        min-width: 0;
        background: transparent;
        box-shadow: none;
        border: 0;
    }
    .data-table.responsive-cards thead { display: none; }

    .data-table.responsive-cards tr {
        display: block;
        background: var(--color-card);
        border: 1px solid var(--color-border);
        border-radius: var(--radius);
        padding: 12px 14px;
        margin-bottom: 10px;
        box-shadow: var(--shadow);
    }

    .data-table.responsive-cards td {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: 12px;
        padding: 5px 0;
        border: 0;
        font-size: 14px;
        color: var(--color-text);
        /* Override inline `white-space: nowrap` often set for
           desktop single-line cells — on phone we want long values
           (product names, addresses) to wrap instead of truncate. */
        white-space: normal !important;
        min-height: 0;
        text-align: right;
    }
    /* The value side of each card row should wrap / break freely
       rather than be truncated when long. */
    .data-table.responsive-cards td:not(.card-title):not(.card-actions):not(.card-hide) {
        word-break: break-word;
    }
    .data-table.responsive-cards td::before {
        content: attr(data-label);
        flex: 0 0 auto;
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        color: var(--color-muted);
    }
    .data-table.responsive-cards td:not([data-label])::before {
        display: none;
    }

    /* Card title — either explicitly marked or auto-promoted from
       the first cell. Renders full-width above a thin divider so
       the row has a clear visual hierarchy on the card. */
    .data-table.responsive-cards td.card-title,
    .data-table.responsive-cards tr > td:first-child:not(.card-actions):not(.card-hide) {
        display: block;
        font-size: 16px;
        font-weight: 600;
        padding: 2px 0 10px;
        margin-bottom: 8px;
        border-bottom: 1px solid var(--color-border);
        text-align: left;
        white-space: normal !important;
    }
    .data-table.responsive-cards td.card-title::before,
    .data-table.responsive-cards tr > td:first-child::before {
        display: none;
    }

    /* Action row — right-aligned buttons, full-width divider above. */
    .data-table.responsive-cards td.card-actions {
        display: flex;
        justify-content: flex-end;
        flex-wrap: wrap;
        gap: 6px;
        padding: 10px 0 2px;
        margin-top: 6px;
        border-top: 1px solid var(--color-border);
    }
    .data-table.responsive-cards td.card-actions::before { display: none; }

    /* Hide specific cells in card mode (e.g. noisy ids, redundant
       columns that only matter in table context). */
    .data-table.responsive-cards td.card-hide { display: none; }

    /* Loading / empty rows span full width and stay centered. */
    .data-table.responsive-cards td.loading-cell,
    .data-table.responsive-cards td[colspan] {
        display: block;
        text-align: center;
        padding: 20px 0;
        color: var(--color-muted);
    }
    .data-table.responsive-cards td.loading-cell::before,
    .data-table.responsive-cards td[colspan]::before { display: none; }

    /* Clickable rows get a subtle tap affordance. */
    .data-table.responsive-cards tr[data-id] { cursor: pointer; }
    .data-table.responsive-cards tr[data-id]:active {
        background: color-mix(in srgb, var(--color-primary), transparent 94%);
    }
}

/* =============================================================
   Modal-sheet — bottom sheet on phone (Phase 1A Day 3)
   =============================================================
   Opt-in modifier for an existing `.modal-box`. Above --bp-phone
   the modal stays as a centered dialog (unchanged). At or below
   the breakpoint it pins to the bottom of the screen, takes the
   full width, rounds only the top corners, and shows a small
   drag-handle indicator at top.

   Usage: add `.modal-sheet` to the `.modal-box` element:
       <div class="modal-box modal-sheet"> ... </div>
   ============================================================= */
@media (max-width: 600px) {
    /* Dock the sheet to the bottom edge, respecting safe area. */
    .modal:has(> .modal-sheet),
    .modal:has(> * > .modal-sheet) {
        align-items: flex-end;
    }
    .modal-box.modal-sheet {
        width: 100%;
        max-width: 100vw !important;
        max-height: 92vh;
        border-radius: 16px 16px 0 0;
        padding: 24px 20px calc(20px + var(--safe-bottom));
        margin: 0;
        animation: modal-sheet-slide-up 220ms ease-out;
    }
    /* Drag-handle indicator so the sheet reads as dismissible. */
    .modal-box.modal-sheet::before {
        content: '';
        display: block;
        width: 40px;
        height: 4px;
        border-radius: 2px;
        background: var(--color-border);
        margin: -8px auto 16px;
    }
    /* Action rows in a sheet get a sticky footer so primary actions
       stay reachable on short viewports with long scrollable content. */
    .modal-box.modal-sheet .modal-actions,
    .modal-box.modal-sheet .modal-btn-row--bottom {
        position: sticky;
        bottom: 0;
        background: var(--color-card);
        padding-top: 12px;
        margin-top: 16px;
        border-top: 1px solid var(--color-border);
    }
}
@keyframes modal-sheet-slide-up {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

/* =============================================================
   Filters-drawer — collapsible filter row (Phase 1A Day 3)
   =============================================================
   Opt-in utility for pages with many filter inputs. Wrap the
   existing `.header-filter-row` in a native <details> element.
   Above --bp-phone the <summary> hides and filters are always
   visible (desktop behavior unchanged). At or below the breakpoint
   the filters collapse behind a "Filters" summary button that
   expands in place.

   Usage:
       <details class="filters-drawer" open>
         <summary class="filters-toggle">Filters</summary>
         <div class="header-filter-row"> ...inputs... </div>
       </details>
   Keep `open` on desktop so the user never has to click to reveal
   filters there; the summary auto-hides above breakpoint.
   ============================================================= */
.filters-drawer > summary.filters-toggle {
    display: none;
}
.filters-drawer > summary::-webkit-details-marker { display: none; }
.filters-drawer > summary::marker { content: ''; }
/* Above --bp-phone the filters row is always visible regardless of
   the <details> open state. Forcing display: flex here overrides the
   UA stylesheet that would otherwise hide the row when <details>
   lacks the `open` attribute. This lets the markup omit `open` and
   still render correctly on desktop.
   IMPORTANT: this is desktop-only. On mobile (<=768px) we DO want
   the native <details> show/hide behavior so removing the `open`
   attribute via JS actually collapses the drawer. Gating with
   min-width: 769px below means: phone -> open attribute controls
   visibility, desktop -> always visible regardless of attribute. */
@media (min-width: 769px) {
    .filters-drawer > .header-filter-row {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        align-items: center;
    }
}
/* On mobile, a closed drawer has no open attribute - hide its
   contents and let users tap the header-buttons "Filters" toggle
   to expand. Open drawers show normally via the UA stylesheet. */
@media (max-width: 768px) {
    .filters-drawer:not([open]) > .header-filter-row {
        display: none;
    }
    .filters-drawer[open] > .header-filter-row {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        align-items: center;
    }
}

@media (max-width: 600px) {
    /* Flatten .header-title-row and .filters-drawer into .page-header
       via display:contents so the Filters toggle shares a row with
       .header-buttons instead of dropping to its own line. The title
       h1 claims row 1 via flex:1 1 100%; the action buttons + the
       summary share row 2; the expanded .header-filter-row takes row
       3 when the drawer is open. Gated by :has(.filters-drawer) so
       pages without a drawer (e.g. Color Converter) keep their
       existing layout. */
    .page-header:has(.filters-drawer) {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
        align-items: center;
    }
    .page-header:has(.filters-drawer) > .header-title-row,
    .page-header:has(.filters-drawer) > .filters-drawer {
        display: contents;
    }
    .page-header:has(.filters-drawer) > .header-title-row > h1 {
        flex: 1 1 100%;
    }
    .page-header:has(.filters-drawer) > .header-title-row > .header-buttons {
        /* Override the mobile default width:100% so header-buttons
           can share row 2 with the Filters summary instead of
           claiming the whole line by itself. !important needed to
           beat the earlier .header-buttons { width:100% } rule
           inside the same breakpoint. */
        width: auto !important;
        flex: 0 1 auto !important;
        min-width: 0;
        justify-content: flex-end !important;
    }
    .page-header:has(.filters-drawer) > .filters-drawer > .header-filter-row {
        flex: 1 1 100%;
    }
    /* Native <summary> filter toggle is replaced on mobile by the
       JS-injected .btn-filters-toggle that lives in .header-buttons
       (with the active-filter count badge). Hiding the summary here
       prevents the duplicate "Filters [v]" caret button that was
       rendering alongside the new toggle. */
    .filters-drawer > summary.filters-toggle {
        display: none;
    }
    /* Chevron that rotates when the drawer is open. */
    .filters-drawer > summary.filters-toggle::after {
        content: '';
        width: 8px;
        height: 8px;
        border-right: 2px solid currentColor;
        border-bottom: 2px solid currentColor;
        transform: rotate(45deg);
        margin-left: 4px;
        transition: transform 180ms ease;
    }
    .filters-drawer[open] > summary.filters-toggle::after {
        transform: rotate(-135deg);
    }
    /* Phone: filters hidden when closed, revealed when open. Markup
       omits the native `open` attribute so the drawer starts
       collapsed on first visit, giving users immediate content. */
    .filters-drawer:not([open]) > .header-filter-row { display: none; }
    .filters-drawer[open] > .header-filter-row { margin-top: 10px; }
}

/* =============================================================
   Form-grid — responsive form layouts (Phase 1A Day 3)
   =============================================================
   Drop-in CSS grid utilities for form rows. Columns stay side by
   side above --bp-phone and collapse to single column below. The
   -pair variant preserves the explicit rule from feedback memory:
   shipping and billing address blocks are always side by side on
   desktop, stacked on phone.

   Usage:
       <div class="form-grid">       <!-- 2 columns above bp -->
         <div>...field...</div>
         <div>...field...</div>
       </div>
       <div class="form-grid-3">     <!-- 3 columns above bp -->
         ...three children...
       </div>
       <div class="form-grid-pair">  <!-- 2 cols, always side-by-side above bp -->
         <fieldset>...ship...</fieldset>
         <fieldset>...bill...</fieldset>
       </div>
   ============================================================= */
.form-grid,
.form-grid-3,
.form-grid-pair {
    display: grid;
    gap: 14px;
    align-items: start;
}
.form-grid      { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid-3    { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid-pair { grid-template-columns: 1fr 1fr; }

@media (max-width: 600px) {
    .form-grid,
    .form-grid-3,
    .form-grid-pair {
        grid-template-columns: 1fr;
    }
}
/* Full-width opt-out for a single child that should span all
   columns above the breakpoint (common for notes / headings). */
.form-grid > .form-full,
.form-grid-3 > .form-full,
.form-grid-pair > .form-full {
    grid-column: 1 / -1;
}

/* =============================================================
   Mobile topbar icons (Phase 1A Day 4)
   =============================================================
   Replaces the cryptic C / T / N single-letter labels with proper
   icons. Sized to stay within the 56px topbar footprint and pairs
   cleanly with the existing .notif-counter overlay. */
.mobile-topbar-icon {
    width: 22px;
    height: 22px;
    color: #e2e8f0;
    flex: 0 0 22px;
}

/* =============================================================
   Mobile bottom tab bar (Phase 1A Day 4)
   =============================================================
   Phone-only primary nav. Sticks to the bottom of the viewport,
   safe-area-aware so it sits above the iOS home indicator when
   installed as a PWA. Active state auto-syncs via the existing
   showView() .nav-link active-class toggle.

   Hidden above --bp-phone by default — nothing to remove on
   desktop. On phone, the main content area reserves space at the
   bottom equal to the tab bar height so content never hides
   underneath it.
   ============================================================= */
.mobile-tab-bar {
    display: none;
}

@media (max-width: 600px) {
    .mobile-tab-bar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 150;
        display: flex;
        background: var(--color-sidebar);
        border-top: 1px solid rgba(255,255,255,0.08);
        padding-left: var(--safe-left);
        padding-right: var(--safe-right);
        padding-bottom: var(--safe-bottom);
        box-shadow: 0 -2px 12px rgba(0,0,0,0.25);
    }
    .mobile-tab {
        flex: 1 1 0;
        min-width: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        padding: 8px 4px 10px;
        min-height: 56px;
        color: #94a3b8;
        text-decoration: none;
        font-size: 11px;
        font-weight: 600;
        transition: color 140ms ease, background 140ms ease;
    }
    .mobile-tab:active {
        background: rgba(255,255,255,0.08);
    }
    .mobile-tab.active {
        color: var(--color-primary-hover, #a5b4fc);
    }
    .mobile-tab-icon {
        width: 22px;
        height: 22px;
    }
    .mobile-tab-label {
        line-height: 1;
        letter-spacing: 0.2px;
    }
    /* Reserve space at the bottom of scrollable content so nothing
       hides behind the tab bar. The bar is 56px tall plus whatever
       the home-indicator inset adds. */
    body,
    .main-content,
    .content {
        padding-bottom: calc(60px + var(--safe-bottom));
    }

    /* Dashboard stat cards: default auto-fit lays them out one-per-row
       on narrow phones, which wastes vertical space (each 18px-padded
       card takes ~130px tall). Pack them 2-per-row on phone with
       tighter padding so the user can glance at all their numbers
       without excessive scrolling. */
    .stat-cards,
    .admin-stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }
    .stat-card,
    .admin-stat-card {
        padding: 12px 14px;
    }
    .stat-card .stat-label,
    .admin-stat-label {
        font-size: 10px;
        letter-spacing: 0.4px;
    }
    .stat-card .stat-value,
    .admin-stat-value {
        font-size: 22px;
    }
    #perfStatCards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* =============================================================
   PWA banners (install prompt, iOS hint, update toast)
   =============================================================
   Shared bottom-anchored card used by public/js/pwa.js. One
   stacking context so multiple banners never show at once in
   practice (iOS hint + update toast are mutually exclusive by
   gating logic in the JS). Positioned above mobile tab bar via
   bottom offset that accounts for --safe-bottom.
   ============================================================= */
.pwa-banner {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(16px + var(--safe-bottom, 0px));
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
    padding: 14px 16px;
    background: #1e293b;
    color: #e2e8f0;
    border: 1px solid #334155;
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
    z-index: 9800;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 200ms ease, transform 200ms ease;
    pointer-events: none;
}
.pwa-banner-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.pwa-banner-body {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1 1 240px;
    min-width: 0;
}
.pwa-banner-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    flex: 0 0 auto;
}
.pwa-banner-text { min-width: 0; }
.pwa-banner-title {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}
.pwa-banner-sub {
    font-size: 12px;
    color: #94a3b8;
    line-height: 1.4;
    margin-top: 2px;
}
.pwa-banner-inline-icon {
    width: 14px;
    height: 14px;
    vertical-align: -3px;
    margin: 0 2px;
}
.pwa-banner-actions {
    display: flex;
    gap: 8px;
    flex: 0 0 auto;
}
.pwa-banner-btn-primary,
.pwa-banner-btn-ghost {
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: filter 120ms, background 120ms;
}
.pwa-banner-btn-primary {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #fff;
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.3);
}
.pwa-banner-btn-primary:hover { filter: brightness(1.08); }
.pwa-banner-btn-ghost {
    background: transparent;
    color: #cbd5e1;
    border: 1px solid #475569;
}
.pwa-banner-btn-ghost:hover { background: rgba(148, 163, 184, 0.1); }

/* =============================================================
   Behavioral polish for touch / PWA installs
   =============================================================
   Applied always (they're safe) to harden the mobile web
   experience. The display-mode: standalone block layers extra
   restrictions that only make sense when running as an installed
   app (no pull-to-refresh, no text selection on chrome, etc).
   ============================================================= */
button,
.btn,
.mobile-tab,
.mobile-topbar-btn,
.top-nav-notif,
.top-nav-user-btn,
.nav-link,
.open-project-btn,
a.mobile-topbar-btn,
a.mobile-tab {
    /* Eliminates the 300ms double-tap zoom delay and the gray
       iOS tap highlight flash, both of which make buttons feel
       sluggish/webby on touch. */
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

@media (display-mode: standalone) {
    html, body {
        /* Prevent the entire page from bouncing when the user
           pulls past the top or bottom edge. Individual scroll
           containers can still overscroll internally. */
        overscroll-behavior-y: contain;
    }
    /* No accidental text selection on chrome elements - behaves
       more like a native app. Content areas (tables, cards,
       text blocks) remain selectable via the override below. */
    .top-nav,
    .mobile-topbar,
    .mobile-tab-bar,
    .sidebar,
    .sidebar-logo,
    .mobile-brand,
    .nav-link,
    .btn,
    button,
    .open-project-btn,
    .mobile-topbar-btn,
    .mobile-tab,
    .top-nav-notif,
    .top-nav-user-btn {
        -webkit-user-select: none;
        user-select: none;
    }
    /* Keep content selectable so users can still copy order
       numbers, customer details, notes, etc. */
    .main-content,
    .op-panel-row,
    .op-panel-row-title,
    .modal-body,
    p, span, td, th, li, h1, h2, h3, h4 {
        -webkit-user-select: auto;
        user-select: auto;
    }
}

/* =============================================================
   Public storefront views (Phase 5).
   Loaded by every authed page too - selectors are scoped to
   #view-shop-home / #view-shop-quote / #view-shop-signup so
   they never bleed into the authed UI.
   ============================================================= */
.shop-hero {
    display: grid; grid-template-columns: 1.1fr 1fr; gap: 32px; align-items: center;
    padding: 48px 36px; margin-bottom: 32px;
    background: linear-gradient(135deg, var(--color-sidebar) 0%, #2d3561 100%);
    color: #fff; border-radius: 14px; position: relative; overflow: hidden;
}
.shop-hero h1 { color: #fff; font-size: 38px; font-weight: 900; line-height: 1.05; letter-spacing: -0.02em; margin: 12px 0 16px; }
.shop-hero-eyebrow { color: #fbbf24; }
.shop-hero-sub { color: #dbe3f5; font-size: 16px; margin-bottom: 22px; max-width: 520px; }
.shop-hero-ctas { display: flex; gap: 12px; flex-wrap: wrap; }
.shop-hero-ctas .btn-ghost { background: transparent; color: #fff; border: 2px solid rgba(255,255,255,0.45); }
.shop-hero-ctas .btn-ghost:hover { background: #fff; color: var(--color-sidebar); }
.shop-hero-carousel {
    position: relative; aspect-ratio: 4/3; max-height: 380px;
    border-radius: 12px; overflow: hidden; background: rgba(255,255,255,0.06);
    box-shadow: 0 18px 40px -18px rgba(0,0,0,0.45);
}
.shop-hero-slide {
    position: absolute; inset: 0; opacity: 0; transition: opacity 0.7s ease;
    pointer-events: none; background: #fff; text-decoration: none;
    display: flex; align-items: center; justify-content: center;
}
.shop-hero-slide.is-active { opacity: 1; pointer-events: auto; }
.shop-hero-slide img { width: 100%; height: 100%; object-fit: contain; padding: 18px; }
.shop-hero-slide-overlay {
    position: absolute; left: 0; right: 0; bottom: 0;
    padding: 28px 22px 36px;
    background: linear-gradient(180deg, rgba(15,23,42,0) 0%, rgba(15,23,42,0.92) 100%);
    color: #fff; display: flex; flex-direction: column; gap: 4px;
}
.shop-hero-slide-overlay strong {
    font-size: 16px; font-weight: 800; line-height: 1.25;
    overflow: hidden; text-overflow: ellipsis;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.shop-hero-slide-cat { font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: #fbbf24; font-weight: 800; }
.shop-hero-slide-price { font-size: 12px; color: #cbd5f5; }
.shop-hero-carousel-empty { padding: 32px; text-align: center; color: #cbd5f5; font-size: 14px; }
.shop-hero-carousel-dots {
    position: absolute; bottom: 10px; left: 0; right: 0;
    display: flex; justify-content: center; gap: 6px; z-index: 4;
}
.shop-hero-carousel-dot {
    width: 8px; height: 8px; border: 0; border-radius: 50%;
    background: rgba(255,255,255,0.55); cursor: pointer; padding: 0;
    transition: background 0.15s, transform 0.15s;
}
.shop-hero-carousel-dot.is-active { background: #fff; transform: scale(1.25); }

/* Prev/next arrow controls for the hero carousel. Sit half-overlay on
   the side edges; visible at all times but get a subtle hover lift. */
.shop-hero-carousel-arrow {
    position: absolute;
    top: 50%; transform: translateY(-50%);
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    border: 0; border-radius: 999px;
    background: rgba(15, 23, 42, 0.55);
    color: #fff;
    font-size: 22px; font-weight: 700; line-height: 1;
    cursor: pointer; padding: 0;
    z-index: 5;
    backdrop-filter: blur(4px);
    transition: background 0.12s, transform 0.12s;
}
.shop-hero-carousel-arrow:hover {
    background: var(--color-primary);
    transform: translateY(-50%) scale(1.08);
}
.shop-hero-carousel-arrow-prev { left: 10px; }
.shop-hero-carousel-arrow-next { right: 10px; }

#view-shop-home .shop-coupon-banner {
    display: flex; align-items: center; gap: 14px;
    padding: 12px 18px; margin-bottom: 24px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid #f59e0b; border-radius: 10px;
    color: #7c2d12; font-size: 13px; text-decoration: none;
    transition: transform 0.12s, box-shadow 0.12s;
}
#view-shop-home .shop-coupon-banner:hover { transform: translateY(-1px); box-shadow: 0 6px 18px -8px rgba(124,45,18,0.4); }
#view-shop-home .shop-coupon-banner-icon { font-size: 20px; }
#view-shop-home .shop-coupon-banner-copy { flex: 1; }
#view-shop-home .shop-coupon-banner-cta { font-weight: 800; white-space: nowrap; }

/* Shared shop layout primitives. Originally scoped to #view-shop-home;
   broadened so /shop/categories, /shop/faq, /shop/about, /shop/contact
   all consume the same components (DRY). The leading selector list is
   the intentional source-of-truth list of shop views that share these. */
#view-shop-home .shop-section,
#view-shop-categories .shop-section,
#view-shop-faq .shop-section,
#view-shop-about .shop-section,
#view-shop-contact .shop-section { margin: 36px 0; }

.shop-cat-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px;
}
.shop-cat-tile {
    display: flex; flex-direction: column; gap: 0;
    border: 1px solid var(--color-border); border-radius: 12px;
    background: var(--color-card); color: var(--color-text); text-decoration: none;
    transition: border-color 0.12s, transform 0.12s, box-shadow 0.18s;
    overflow: hidden; min-height: 180px;
}
.shop-cat-tile:hover {
    border-color: var(--color-primary);
    transform: translateY(-3px);
    box-shadow: 0 10px 24px -10px rgba(67, 56, 202, 0.35);
}
.shop-cat-tile-img {
    aspect-ratio: 4/3; background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}
.shop-cat-tile-img img {
    width: 100%; height: 100%; object-fit: cover; display: block;
    transition: transform 0.4s ease;
}
.shop-cat-tile:hover .shop-cat-tile-img img { transform: scale(1.06); }
.shop-cat-tile-img-placeholder {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    color: rgba(67, 56, 202, 0.55); font-weight: 800; font-size: 28px;
    letter-spacing: 0.06em;
    background: linear-gradient(135deg, rgba(67, 56, 202, 0.08), rgba(99, 102, 241, 0.14));
}
.shop-cat-tile-body {
    display: flex; flex-direction: column; gap: 4px;
    padding: 14px 16px;
}
.shop-cat-tile strong {
    font-size: 14px; font-weight: 700; line-height: 1.25;
    overflow: hidden; text-overflow: ellipsis;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.shop-cat-tile span {
    font-size: 11px; color: var(--color-muted);
    text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700;
}

/* Text-only variant - used on About-page "Who we work with" /
   "Decoration capabilities" tiles where no representative product
   image makes sense. Drops the empty image area and reverts to the
   compact text-only tile. */
.shop-cat-tile.shop-cat-tile-text {
    min-height: 0;
    padding: 18px;
    border-radius: 10px;
}
.shop-cat-tile.shop-cat-tile-text .shop-cat-tile-img,
.shop-cat-tile.shop-cat-tile-text .shop-cat-tile-img-placeholder { display: none; }
.shop-cat-tile.shop-cat-tile-text .shop-cat-tile-body { padding: 0; }

/* Live filter input above category / theme grids. Reuses native
   <input> styling + a search-icon background so visitors can type
   to narrow the grid. */
.shop-cat-filter {
    display: flex; align-items: center; gap: 12px;
    margin: 0 0 16px;
    flex-wrap: wrap;
}
.shop-cat-filter-input {
    flex: 1 1 320px;
    padding: 10px 14px 10px 38px;
    border: 1px solid var(--color-border); border-radius: 10px;
    background: var(--color-card) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>") no-repeat 12px center;
    font-size: 14px; color: var(--color-text);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.shop-cat-filter-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(67, 56, 202, 0.15);
}
.shop-cat-filter-count {
    font-size: 12px; color: var(--color-muted); white-space: nowrap;
}

/* Letter-index header within the grid. Spans all columns and
   anchors the alphabetical run that follows it. scroll-margin-top
   leaves room for the sticky top nav so the jump-bar anchor lands
   below the header instead of behind it. */
.shop-cat-letter {
    grid-column: 1 / -1;
    font-size: 11px; font-weight: 800; letter-spacing: 0.16em;
    color: var(--color-muted); text-transform: uppercase;
    padding: 14px 0 4px;
    border-bottom: 1px solid var(--color-border);
    scroll-margin-top: 90px;
}

/* A-Z quick-jump bar - sits above the category/theme grid (below
   the live-filter input) and lets visitors hop to a letter with
   one click. Letters with no items render dimmed and inert. */
.shop-cat-jumpbar {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    margin: 0 0 16px;
    padding: 8px 10px;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 10px;
}
.shop-cat-jumpbar-letter {
    flex: 1 1 28px;
    min-width: 28px;
    text-align: center;
    padding: 6px 4px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: var(--color-text);
    text-decoration: none;
    transition: background 0.12s, color 0.12s;
}
.shop-cat-jumpbar-letter:hover {
    background: var(--color-primary);
    color: #fff;
}
.shop-cat-jumpbar-letter.is-empty {
    color: var(--color-muted);
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
}
@media (max-width: 600px) {
    .shop-cat-jumpbar-letter { flex: 1 1 22px; min-width: 22px; font-size: 11px; padding: 5px 2px; }
}

/* Hide tiles + their preceding letter header when filtered out
   client-side by the live search. */
.shop-cat-tile.is-hidden,
.shop-cat-letter.is-hidden { display: none; }

.shop-cta-strip {
    margin: 40px 0; padding: 36px 28px; text-align: center;
    background: linear-gradient(135deg, var(--color-sidebar) 0%, #2d3561 100%);
    color: #fff; border-radius: 14px;
}
.shop-cta-strip h2 { color: #fff; font-size: 22px; }
.shop-cta-strip p { color: #dbe3f5; max-width: 520px; margin: 8px auto 18px; }
/* Ghost buttons inside the dark CTA strip need the same light-on-dark
   treatment the hero CTAs already get - the default .btn-ghost is dark
   text on a near-transparent bg, which renders nearly invisible on
   the navy gradient background. */
.shop-cta-strip .btn-ghost {
    background: transparent;
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.45);
}
.shop-cta-strip .btn-ghost:hover {
    background: #fff;
    color: var(--color-sidebar);
}

/* How-it-works step strip. Reuses .shop-cat-grid for the responsive
   3-column wrapper + .card for each step (both pre-existing). The
   only specific styling: a numeric badge in the top-left of each card. */
.shop-howitworks {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}
.shop-howitworks-step { padding: 22px 22px 18px; position: relative; }
.shop-howitworks-step h3 { margin: 8px 0 4px; font-size: 16px; }
.shop-howitworks-step p  { margin: 0; font-size: 13px; line-height: 1.55; color: var(--color-text-secondary); }
.shop-howitworks-num {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px;
    border-radius: 999px;
    background: linear-gradient(135deg, #4338ca, #6366f1);
    color: #fff; font-weight: 800; font-size: 14px;
}

/* Trust strip beneath the hero. Reuses .stat-cards (the dashboard
   KPI grid) so styling is shared. The .shop-home-trust modifier
   just lets us set tighter margins specific to this placement. */
.shop-home-trust { margin: 8px 0 28px; }

/* =================================================================
   PPD-staff Preview Mode (body.shop-preview-mode)
   When an authed PPD user visits /shop/*, they're previewing the
   storefront. The sticky banner labels the surface so they know
   they're seeing customer-facing content, and gives a one-click
   exit back to the dashboard. Customer-only CTAs (Request a Quote,
   Create Free Account, signup nudges) are hidden via the
   .preview-mode-hide utility - apply it in markup or via runtime
   class toggling on shop views.
   ================================================================= */
.shop-preview-banner {
    position: sticky;
    top: 0;
    z-index: 95;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 8px 18px;
    background: linear-gradient(90deg, #4338ca 0%, #6366f1 100%);
    color: #fff;
    font-size: 13px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
.shop-preview-banner-eyebrow {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    background: rgba(255,255,255,0.18);
    padding: 3px 8px;
    border-radius: 4px;
}
.shop-preview-banner-text {
    flex: 1;
    color: rgba(255,255,255,0.92);
}
.shop-preview-banner-exit {
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    padding: 4px 12px;
    border: 1px solid rgba(255,255,255,0.5);
    border-radius: 6px;
    transition: background 0.15s;
}
.shop-preview-banner-exit:hover {
    background: rgba(255,255,255,0.18);
}
@media (max-width: 700px) {
    .shop-preview-banner { font-size: 11px; gap: 8px; padding: 6px 12px; }
    .shop-preview-banner-text { display: none; }
}

/* Hide every customer-only CTA in preview mode. Marked .preview-mode-hide
   in markup OR added at runtime when the staff branch initializes. */
body.shop-preview-mode .preview-mode-hide,
body.shop-preview-mode [data-preview-hide],
body.shop-preview-mode .shop-cta-strip,
body.shop-preview-mode [data-shop-coupon-cta],
body.shop-preview-mode #shopHomeBrandEyebrow + h1 + p + .shop-hero-ctas {
    /* Last selector is intentionally narrow: hide the hero's signup/quote
       CTA cluster on shop-home since the PPD doesn't need either. The
       hero copy + image still render (preview value). */
}
body.shop-preview-mode .shop-cta-strip,
body.shop-preview-mode [data-preview-hide],
body.shop-preview-mode .preview-mode-hide {
    display: none !important;
}

@media (max-width: 900px) {
    .shop-hero { grid-template-columns: 1fr; padding: 32px 22px; }
    .shop-hero h1 { font-size: 28px; }
}

/* =================================================================
   Shop About page - distinct visual layouts per section so the page
   doesn't read as a wall of identical 3-card grids. Each section
   has its own component class. Five layouts, five different cadences.
   ================================================================= */

/* 1. Spotlight - oversize pull-quote on the left, body copy + outcomes
      on the right. Magazine-style opener. */
.shop-spotlight {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 36px;
    align-items: center;
    padding: 40px 32px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(99,102,241,0.06), rgba(99,102,241,0.02));
    border: 1px solid var(--color-border);
}
.shop-spotlight-quote {
    position: relative;
    padding-left: 28px;
    border-left: 4px solid var(--color-primary);
}
.shop-spotlight-quote p {
    font-size: 26px;
    line-height: 1.25;
    font-weight: 800;
    letter-spacing: -0.015em;
    color: var(--color-text);
    margin: 0;
}
.shop-spotlight-mark {
    position: absolute;
    top: -22px; left: 14px;
    font-size: 88px;
    line-height: 1;
    color: var(--color-primary);
    opacity: 0.18;
    font-family: Georgia, serif;
    pointer-events: none;
}
.shop-spotlight-eyebrow {
    color: var(--color-primary);
    font-size: 11px;
    letter-spacing: 0.12em;
    font-weight: 800;
    text-transform: uppercase;
}
.shop-spotlight-body p {
    margin: 12px 0 16px;
    font-size: 15px;
    line-height: 1.6;
    color: var(--color-text-secondary);
}
.shop-spotlight-outcomes {
    list-style: none;
    margin: 0; padding: 0;
    display: flex; flex-direction: column; gap: 8px;
}
.shop-spotlight-outcomes li {
    position: relative;
    padding-left: 26px;
    font-size: 14px;
    color: var(--color-text);
    font-weight: 600;
}
.shop-spotlight-outcomes li::before {
    content: "";
    position: absolute;
    left: 0; top: 6px;
    width: 16px; height: 16px;
    border-radius: 999px;
    background: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(99,102,241,0.15);
}
.shop-spotlight-outcomes li::after {
    content: "✓";
    position: absolute;
    left: 3px; top: 4px;
    color: #fff; font-size: 11px; font-weight: 900;
}
@media (max-width: 900px) {
    .shop-spotlight { grid-template-columns: 1fr; padding: 28px 22px; gap: 22px; }
    .shop-spotlight-quote p { font-size: 20px; }
}

/* 2. Compare - side-by-side "Them vs Us" columns. Red/green tinted
      headers, contrasting list styles. */
.shop-compare-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 14px;
}
.shop-compare-col {
    border-radius: 14px;
    padding: 24px 22px;
    border: 1px solid var(--color-border);
    background: var(--color-card);
    position: relative;
    overflow: hidden;
}
.shop-compare-col::before {
    content: "";
    position: absolute; left: 0; top: 0; right: 0;
    height: 4px;
}
.shop-compare-them { background: linear-gradient(180deg, rgba(239,68,68,0.04), transparent 60%); }
.shop-compare-them::before { background: #ef4444; }
.shop-compare-us { background: linear-gradient(180deg, rgba(16,185,129,0.05), transparent 60%); }
.shop-compare-us::before { background: #10b981; }
.shop-compare-head { margin-bottom: 14px; }
.shop-compare-head h3 { margin: 6px 0 0; font-size: 18px; font-weight: 800; }
.shop-compare-tag {
    display: inline-block;
    font-size: 10px; font-weight: 800;
    text-transform: uppercase; letter-spacing: 0.12em;
    padding: 3px 9px;
    border-radius: 999px;
}
.shop-compare-them .shop-compare-tag { background: rgba(239,68,68,0.12); color: #b91c1c; }
.shop-compare-us .shop-compare-tag { background: rgba(16,185,129,0.14); color: #047857; }
.shop-compare-col ul {
    list-style: none; padding: 0; margin: 0;
    display: flex; flex-direction: column; gap: 10px;
}
.shop-compare-col li {
    position: relative;
    padding: 8px 8px 8px 34px;
    border-radius: 8px;
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--color-text);
}
.shop-compare-col li::before {
    position: absolute;
    left: 8px; top: 8px;
    width: 18px; height: 18px;
    border-radius: 999px;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 900;
    color: #fff;
}
.shop-compare-them li::before { content: "✕"; background: #ef4444; }
.shop-compare-us li::before { content: "✓"; background: #10b981; }
.shop-compare-them li { color: var(--color-text-secondary); }
@media (max-width: 768px) {
    .shop-compare-grid { grid-template-columns: 1fr; }
}

/* 3. Timeline - horizontal numbered process flow with connector
      arrows between steps. Stacks vertically on mobile with the
      connector becoming a continuous left rail. */
.shop-timeline-track {
    list-style: none;
    counter-reset: tl;
    margin: 14px 0 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    position: relative;
}
.shop-timeline-step {
    position: relative;
    padding: 24px 18px 18px;
    border-radius: 14px;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.shop-timeline-step + .shop-timeline-step::before {
    content: "";
    position: absolute;
    top: 50%;
    left: -18px;
    width: 18px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--color-primary) 40%, var(--color-primary));
    transform: translateY(-50%);
}
.shop-timeline-step + .shop-timeline-step::after {
    content: "";
    position: absolute;
    top: 50%;
    left: -8px;
    width: 0; height: 0;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left: 7px solid var(--color-primary);
    transform: translateY(-50%);
}
.shop-timeline-num {
    display: inline-flex;
    align-items: center; justify-content: center;
    width: 36px; height: 36px;
    border-radius: 999px;
    background: linear-gradient(135deg, #4338ca, #6366f1);
    color: #fff;
    font-weight: 900; font-size: 16px;
    box-shadow: 0 4px 10px rgba(99,102,241,0.35);
    margin-bottom: 12px;
}
.shop-timeline-body h3 { margin: 0 0 6px; font-size: 15px; font-weight: 800; }
.shop-timeline-body p {
    margin: 0 0 10px;
    font-size: 13px; line-height: 1.55;
    color: var(--color-text-secondary);
}
.shop-timeline-meta {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px; font-weight: 800;
    letter-spacing: 0.05em; text-transform: uppercase;
    background: rgba(99,102,241,0.1);
    color: var(--color-primary);
}
@media (max-width: 900px) {
    .shop-timeline-track { grid-template-columns: 1fr; gap: 14px; padding-left: 22px; }
    .shop-timeline-track::before {
        content: "";
        position: absolute;
        left: 17px; top: 18px; bottom: 18px;
        width: 2px;
        background: linear-gradient(180deg, transparent, var(--color-primary) 8%, var(--color-primary) 92%, transparent);
    }
    .shop-timeline-step + .shop-timeline-step::before,
    .shop-timeline-step + .shop-timeline-step::after { display: none; }
    .shop-timeline-step::after {
        content: "";
        position: absolute;
        left: -22px; top: 30px;
        width: 12px; height: 12px;
        border-radius: 999px;
        background: var(--color-primary);
        border: 3px solid var(--color-bg);
    }
}

/* 4. Personas - bento-style asymmetric grid. The first persona
      ("hero") spans 2 columns and 2 rows on desktop, the rest fill
      a tighter 3x2 grid. Tinted backgrounds via data-tone for
      editorial color variety. */
.shop-personas-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 1fr;
    gap: 14px;
    margin-top: 14px;
}
.shop-persona {
    position: relative;
    display: flex; flex-direction: column;
    padding: 22px;
    border-radius: 14px;
    border: 1px solid var(--color-border);
    background: var(--color-card);
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
    overflow: hidden;
}
.shop-persona:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(15,23,42,0.10);
    border-color: rgba(99,102,241,0.4);
}
.shop-persona-emoji { font-size: 28px; line-height: 1; margin-bottom: 12px; display: block; }
.shop-persona h3 { margin: 0 0 4px; font-size: 16px; font-weight: 800; }
.shop-persona p { margin: 0 0 10px; font-size: 13px; line-height: 1.5; color: var(--color-text-secondary); }
.shop-persona-cta {
    margin-top: auto;
    font-size: 12px; font-weight: 800;
    color: var(--color-primary);
    letter-spacing: 0.04em;
}
.shop-persona-hero {
    grid-column: span 2;
    grid-row: span 2;
    padding: 32px;
    background: linear-gradient(135deg, #1e1b4b, #312e81);
    color: #fff;
    border-color: transparent;
}
.shop-persona-hero .shop-persona-emoji { font-size: 48px; margin-bottom: 18px; }
.shop-persona-hero h3 { font-size: 26px; letter-spacing: -0.01em; }
.shop-persona-hero p { color: #cbd5f5; font-size: 14px; max-width: 380px; }
.shop-persona-hero .shop-persona-cta { color: #fbbf24; font-size: 13px; }
.shop-persona-tag {
    display: inline-block;
    margin-bottom: 10px;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(251,191,36,0.18);
    color: #fbbf24;
    font-size: 10px; font-weight: 800;
    letter-spacing: 0.12em; text-transform: uppercase;
}

/* Tinted backgrounds for non-hero personas - keeps the "editorial"
   feel without going overboard. Each tone is a soft pastel + matching
   accent for the emoji block. */
.shop-persona[data-tone="marketing"] { background: linear-gradient(135deg, rgba(236,72,153,0.10), rgba(236,72,153,0.02)); }
.shop-persona[data-tone="ops"]       { background: linear-gradient(135deg, rgba(14,165,233,0.10), rgba(14,165,233,0.02)); }
.shop-persona[data-tone="founders"]  { background: linear-gradient(135deg, rgba(249,115,22,0.10), rgba(249,115,22,0.02)); }
.shop-persona[data-tone="schools"]   { background: linear-gradient(135deg, rgba(16,185,129,0.10), rgba(16,185,129,0.02)); }
.shop-persona[data-tone="agencies"]  { background: linear-gradient(135deg, rgba(139,92,246,0.10), rgba(139,92,246,0.02)); }

@media (max-width: 1100px) {
    .shop-personas-grid { grid-template-columns: repeat(3, 1fr); }
    .shop-persona-hero { grid-column: span 3; grid-row: auto; }
}
@media (max-width: 700px) {
    .shop-personas-grid { grid-template-columns: 1fr 1fr; }
    .shop-persona-hero { grid-column: span 2; padding: 24px; }
    .shop-persona-hero h3 { font-size: 22px; }
}

/* 5. Methods - dense list-style block. Two-column index of
      decoration methods, each with a colored accent bar (driven by
      --method-accent inline custom prop), inline icon, one-line
      copy, and a chevron. Different cadence from the persona grid. */
.shop-methods-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 14px;
}
.shop-method {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px 14px 22px;
    border-radius: 10px;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    text-decoration: none;
    color: inherit;
    transition: transform 0.12s, border-color 0.12s, box-shadow 0.12s;
    overflow: hidden;
}
.shop-method::before {
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 5px;
    background: var(--method-accent, var(--color-primary));
}
.shop-method:hover {
    transform: translateX(2px);
    border-color: var(--method-accent, var(--color-primary));
    box-shadow: 0 6px 16px rgba(15,23,42,0.08);
}
.shop-method-icon {
    flex: 0 0 auto;
    width: 38px; height: 38px;
    display: flex; align-items: center; justify-content: center;
    background: color-mix(in srgb, var(--method-accent) 12%, transparent);
    border-radius: 10px;
    font-size: 20px;
}
.shop-method-body { flex: 1 1 auto; min-width: 0; }
.shop-method-body h3 { margin: 0 0 2px; font-size: 14px; font-weight: 800; }
.shop-method-body p { margin: 0; font-size: 12.5px; color: var(--color-text-secondary); line-height: 1.4; }
.shop-method-chev {
    flex: 0 0 auto;
    font-size: 22px;
    color: var(--color-muted);
    font-weight: 600;
    transition: transform 0.12s, color 0.12s;
}
.shop-method:hover .shop-method-chev {
    color: var(--method-accent, var(--color-primary));
    transform: translateX(3px);
}
@media (max-width: 700px) {
    .shop-methods-list { grid-template-columns: 1fr; }
}

/* Contact page channel strip — sits at the bottom of the
   .auth-marketing column on /shop/contact. Compact list of
   email / phone / address / hours, styled to read on the
   indigo gradient panel. */
.shop-contact-channel-strip {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid rgba(255,255,255,0.18);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 18px;
}
.shop-contact-channel {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 13px;
    color: #fff;
}
.shop-contact-channel a {
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px dashed rgba(255,255,255,0.4);
    align-self: flex-start;
}
.shop-contact-channel a:hover { border-bottom-color: #fbbf24; color: #fbbf24; }
.shop-contact-channel-label {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #fbbf24;
}
.shop-contact-social {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid rgba(255,255,255,0.18);
}
.shop-contact-social-links {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.shop-contact-social-links .btn-ghost {
    background: rgba(255,255,255,0.08);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.25);
}
.shop-contact-social-links .btn-ghost:hover {
    background: #fff;
    color: var(--color-sidebar);
}
@media (max-width: 600px) {
    .shop-contact-channel-strip { grid-template-columns: 1fr; }
}

/* hCaptcha wrapper - the raw widget looks dropped-in on a polished
   form, so we add a labeled container with a small icon + helper
   line to integrate it into the form's visual rhythm. The widget
   itself is iframe-rendered by hCaptcha - we can't restyle that,
   but we can frame it. */
.shop-captcha-wrap {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 14px;
    border-radius: 10px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
}
.shop-captcha-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-text-secondary);
}
.shop-captcha-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px; height: 22px;
    border-radius: 6px;
    background: rgba(99,102,241,0.12);
    font-size: 12px;
}
.shop-captcha-wrap .h-captcha {
    display: flex;
    justify-content: center;
}
.shop-captcha-hint {
    margin: 0;
    font-size: 11px;
    color: var(--color-muted);
    text-align: center;
}

/* Personal sales rep section on the shop home. The single biggest
   differentiator from a generic online promo storefront: this is a
   relationship, not a self-checkout. Sized like a major content
   block so it pulls attention away from the product grid above. */
.shop-rep-card {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 28px;
    align-items: start;
    padding: 36px 32px;
    border-radius: 18px;
    background:
        radial-gradient(circle at 0% 0%, rgba(99,102,241,0.18), transparent 50%),
        radial-gradient(circle at 100% 100%, rgba(251,191,36,0.10), transparent 55%),
        linear-gradient(135deg, var(--color-sidebar) 0%, #2d3561 100%);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 14px 40px -16px rgba(15, 23, 42, 0.6);
    overflow: hidden;
}
.shop-rep-card-mark {
    width: 64px; height: 64px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 16px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #1e1b4b;
    font-size: 30px;
    flex-shrink: 0;
    box-shadow: 0 6px 18px rgba(251,191,36,0.35);
}
.shop-rep-eyebrow {
    color: #fbbf24 !important;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}
.shop-rep-card h2 {
    color: #fff;
    font-size: 28px;
    font-weight: 900;
    line-height: 1.15;
    letter-spacing: -0.015em;
    margin: 8px 0 14px;
}
.shop-rep-card > .shop-rep-card-body > p {
    color: #dbe3f5;
    font-size: 15px;
    line-height: 1.6;
    margin: 0 0 18px;
    max-width: 620px;
}
.shop-rep-list {
    list-style: none;
    padding: 0;
    margin: 0 0 22px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 24px;
}
.shop-rep-list li {
    display: flex;
    flex-direction: column;
    gap: 2px;
    position: relative;
    padding-left: 26px;
}
.shop-rep-list li::before {
    content: "";
    position: absolute;
    left: 0; top: 6px;
    width: 16px; height: 16px;
    border-radius: 999px;
    background: #fbbf24;
    box-shadow: 0 0 0 4px rgba(251,191,36,0.22);
}
.shop-rep-list li::after {
    content: "✓";
    position: absolute;
    left: 3px; top: 4px;
    color: #1e1b4b;
    font-size: 11px;
    font-weight: 900;
}
.shop-rep-list strong {
    color: #fff;
    font-size: 14px;
    font-weight: 800;
}
.shop-rep-list span {
    color: #cbd5f5;
    font-size: 13px;
    line-height: 1.5;
}
.shop-rep-ctas {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.shop-rep-ctas .btn-ghost {
    background: transparent;
    color: #fff;
    border: 2px solid rgba(255,255,255,0.45);
}
.shop-rep-ctas .btn-ghost:hover {
    background: #fff;
    color: var(--color-sidebar);
}
@media (max-width: 720px) {
    .shop-rep-card { grid-template-columns: 1fr; padding: 28px 22px; gap: 18px; }
    .shop-rep-card h2 { font-size: 22px; }
    .shop-rep-list { grid-template-columns: 1fr; }
}

/* Swatch-style color picker - drop-in replacement for a <select>
   on the gallery quote modal. Renders each color as a swatch chip +
   label so customers see what they're picking instead of a flat
   list of names. Anchored absolutely under its trigger button. */
.swatch-picker { position: relative; }
.swatch-picker-btn {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px; width: 100%;
    padding: 8px 12px; min-height: 38px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-card);
    color: var(--color-text);
    cursor: pointer;
    font-size: 14px;
    transition: border-color 0.12s, box-shadow 0.12s;
}
.swatch-picker-btn:hover { border-color: var(--color-primary); }
.swatch-picker-btn[aria-expanded="true"] {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.18);
}
.swatch-picker-current {
    display: flex; align-items: center;
    gap: 10px; min-width: 0;
}
.swatch-picker-label {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    text-align: left;
}
.swatch-picker-caret {
    flex-shrink: 0;
    font-size: 12px;
    color: var(--color-muted);
    transition: transform 0.15s;
}
.swatch-picker-btn[aria-expanded="true"] .swatch-picker-caret { transform: rotate(180deg); }
.swatch-picker-chip {
    flex-shrink: 0;
    width: 20px; height: 20px;
    border-radius: 999px;
    border: 1px solid rgba(15,23,42,0.18);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.18);
}
.swatch-picker-chip-any {
    background:
        conic-gradient(from 0deg, #ef4444, #f59e0b, #fbbf24, #10b981, #06b6d4, #6366f1, #ec4899, #ef4444);
}
.swatch-picker-chip-gradient {
    background: linear-gradient(135deg, #ef4444 0%, #f59e0b 25%, #10b981 50%, #6366f1 75%, #ec4899 100%);
}
.swatch-picker-chip-unknown {
    background:
        repeating-linear-gradient(45deg, #e5e7eb 0 6px, #f3f4f6 6px 12px);
}
.swatch-picker-menu {
    position: absolute; top: calc(100% + 6px); left: 0; right: 0;
    z-index: 50;
    max-height: 280px;
    overflow-y: auto;
    padding: 6px;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    box-shadow: 0 12px 30px -12px rgba(15,23,42,0.35);
    display: flex; flex-direction: column; gap: 2px;
}
.swatch-picker-menu.hidden { display: none; }
.swatch-picker-option {
    display: flex; align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--color-text);
    cursor: pointer;
    font-size: 14px;
    text-align: left;
    transition: background 0.1s;
}
.swatch-picker-option:hover { background: rgba(99,102,241,0.10); }
.swatch-picker-option.is-selected {
    background: rgba(99,102,241,0.14);
    font-weight: 700;
}
.swatch-picker-option.is-selected::after {
    content: '✓';
    margin-left: auto;
    color: var(--color-primary);
    font-weight: 900;
}

/* Active-filter chip — sits above the gallery grid when an anon
   visitor lands on /shop/category/<slug> or /shop/catalog?theme=
   so they know which filter is applied + can one-click clear it. */
.shop-active-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px 8px 14px;
    margin: 0 0 14px;
    border-radius: 999px;
    background: rgba(99,102,241,0.12);
    border: 1px solid rgba(99,102,241,0.35);
    font-size: 13px;
    color: var(--color-text);
}
.shop-active-filter-label {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-primary);
}
.shop-active-filter-chip strong { font-weight: 800; }
.shop-active-filter-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px; height: 22px;
    border-radius: 999px;
    background: rgba(99,102,241,0.18);
    color: var(--color-primary);
    text-decoration: none;
    font-size: 16px;
    font-weight: 800;
    line-height: 1;
    transition: background 0.12s, color 0.12s;
}
.shop-active-filter-clear:hover {
    background: var(--color-primary);
    color: #fff;
}

/* Quote view product-context pill */
#view-shop-quote .shop-quote-product-pill {
    padding: 10px 14px; margin-bottom: 14px;
    background: var(--color-bg); border: 1px solid var(--color-border);
    border-radius: 8px; font-size: 13px; color: var(--color-text);
}
#view-shop-quote .shop-quote-product-pill strong { color: var(--color-muted); margin-right: 6px; }

/* Customer-type badge - shown on PPD customer-list rows for
   customers signed up via the public storefront. Phase 7 / req #11. */
.customer-type-badge {
    display: inline-block; margin-left: 6px;
    padding: 1px 7px; border-radius: 999px;
    font-size: 10px; font-weight: 800; letter-spacing: 0.04em;
    text-transform: uppercase; vertical-align: middle;
}
.customer-type-badge.customer-type-web {
    background: rgba(99, 102, 241, 0.12);
    color: #4338ca;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

/* =============================================================
   Phase 13: visible eco/recyclable badges + "Use cases" eyebrow
   on the gallery detail modal. Same chips render in the
   <noscript> SEO snapshot for crawlers. Cached from SAGE
   envFriendly/recyclable + themes fields.
   ============================================================= */
.gallery-detail-eco-badges {
    display: flex; flex-wrap: wrap; gap: 6px;
    margin: 10px 0 4px;
}
.gallery-detail-eco-badges .gde-eco,
.gallery-detail-eco-badges .gde-rec {
    display: inline-block; padding: 3px 9px;
    font-size: 11px; font-weight: 700; letter-spacing: 0.02em;
    border-radius: 999px;
}
.gallery-detail-eco-badges .gde-eco {
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
    border: 1px solid rgba(16, 185, 129, 0.35);
}
.gallery-detail-eco-badges .gde-rec {
    background: rgba(59, 130, 246, 0.12);
    color: #1d4ed8;
    border: 1px solid rgba(59, 130, 246, 0.35);
}
.gallery-detail-eyebrow {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
    margin: 8px 0 4px;
    font-size: 12px;
}
.gallery-detail-eyebrow .gde-label {
    text-transform: uppercase; letter-spacing: 0.05em;
    font-weight: 700; color: var(--color-muted);
    font-size: 10px;
}
.gallery-detail-eyebrow .gde-themes { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.gallery-detail-eyebrow .gde-theme {
    display: inline-block; padding: 2px 8px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    font-size: 11px; color: var(--color-text-secondary);
}

/* SSR equivalents - these are the chips rendered into the
   <noscript> snapshot in routes/shop.js. Plain markup so it
   degrades cleanly when JS is off. */
.ssr-eco-badges { margin: 6px 0; display: flex; flex-wrap: wrap; gap: 6px; }
.ssr-eco-badge {
    display: inline-block; padding: 3px 9px;
    font-size: 11px; font-weight: 700;
    border-radius: 999px;
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
    border: 1px solid rgba(16, 185, 129, 0.35);
}
.ssr-eyebrow {
    margin: 6px 0; font-size: 13px;
    color: var(--color-text-secondary);
}

/* =============================================================
   Shop FAQ section. Visible <details> blocks on /shop home that
   mirror the FAQPage JSON-LD in routes/shop.js. Edit BOTH together.
   ============================================================= */
.shop-faq { margin-top: 32px; }
.shop-faq-list {
    display: grid; grid-template-columns: 1fr; gap: 8px;
    max-width: 920px; margin: 0;
}
.shop-faq-item {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 14px 18px;
    transition: box-shadow 0.15s ease;
}
.shop-faq-item[open] { box-shadow: 0 1px 4px rgba(0,0,0,0.05); }
.shop-faq-item summary {
    cursor: pointer;
    list-style: none;
    font-weight: 600;
    color: var(--color-text);
    font-size: 15px;
    position: relative;
    padding-right: 28px;
}
.shop-faq-item summary::-webkit-details-marker { display: none; }
.shop-faq-item summary::after {
    content: '+';
    position: absolute; right: 0; top: 50%;
    transform: translateY(-50%);
    font-size: 22px; font-weight: 300; color: var(--color-muted);
    transition: transform 0.15s ease;
}
.shop-faq-item[open] summary::after { content: '-'; }
.shop-faq-item p {
    margin: 10px 0 0;
    font-size: 14px; line-height: 1.6;
    color: var(--color-text-secondary);
}

/* =============================================================
   /shop/about + /shop/contact layouts. Mirrors the lightweight
   marketing-page style of the rest of the storefront.
   ============================================================= */
.shop-about-grid {
    max-width: 760px; margin: 0 auto;
}
.shop-about-prose h2 {
    margin: 28px 0 8px;
    font-size: 18px;
}
.shop-about-prose p, .shop-about-prose li {
    font-size: 15px; line-height: 1.7;
    color: var(--color-text-secondary);
}
.shop-about-prose ul {
    padding-left: 22px;
    margin: 8px 0 8px;
}
.shop-about-prose ul li { margin-bottom: 6px; }
.shop-about-prose ul li strong { color: var(--color-text); }

.shop-contact-grid {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) minmax(280px, 1.2fr);
    gap: 32px;
    max-width: 960px; margin: 0 auto;
    align-items: start;
}
@media (max-width: 720px) {
    .shop-contact-grid { grid-template-columns: 1fr; gap: 24px; }
}
.shop-contact-channels h2,
.shop-contact-form-side h2 {
    margin: 0 0 14px; font-size: 17px;
}
.shop-contact-dl {
    margin: 0; padding: 0;
    display: grid; grid-template-columns: 1fr; gap: 10px;
}
.shop-contact-row {
    display: grid; grid-template-columns: 84px 1fr; gap: 10px;
    align-items: start;
    padding: 8px 0;
    border-bottom: 1px solid var(--color-border);
}
.shop-contact-row:last-child { border-bottom: 0; }
.shop-contact-row dt {
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
    font-weight: 700; color: var(--color-muted);
    padding-top: 2px;
}
.shop-contact-row dd {
    margin: 0; font-size: 14px; color: var(--color-text);
}
.shop-contact-row dd a { color: var(--color-primary); text-decoration: none; }
.shop-contact-row dd a:hover { text-decoration: underline; }
.shop-contact-social { margin-top: 22px; }
.shop-contact-social h3 {
    margin: 0 0 8px;
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
    font-weight: 700; color: var(--color-muted);
}
.shop-contact-social-links {
    display: flex; flex-wrap: wrap; gap: 8px;
}

/* =============================================================
   Shop signup / quote / sign-in two-column layout. The
   `.auth-split` markup pattern was authored for these views but
   the CSS never landed - so the page rendered as an unstyled
   vertical stack. This block is the actual styling.
   ============================================================= */
.auth-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0;
    margin: 12px auto 32px;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 18px rgba(15, 23, 42, 0.06);
}
@media (max-width: 880px) {
    .auth-split { grid-template-columns: 1fr; }
}

/* Left side: brand-colored marketing panel. Matches the dark-navy
   gradient used by .shop-hero across the rest of /shop so the
   auth/contact/quote pages stay visually consistent with the
   storefront's hero treatment. */
.auth-split .auth-marketing {
    padding: 38px 40px;
    background: linear-gradient(135deg, var(--color-sidebar) 0%, #2d3561 100%);
    color: #f9fafb;
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 480px;
}
.auth-split .auth-marketing .eyebrow {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #fbbf24;
    margin-bottom: 4px;
}
.auth-split .auth-marketing h2 {
    margin: 0;
    font-size: 30px;
    line-height: 1.15;
    color: #ffffff;
    letter-spacing: -0.01em;
}
.auth-split .auth-marketing > p {
    margin: 0 0 8px;
    font-size: 15px;
    line-height: 1.55;
    color: rgba(249, 250, 251, 0.85);
}
.auth-split .auth-marketing ul {
    list-style: none;
    margin: 8px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.auth-split .auth-marketing ul li {
    display: grid;
    grid-template-columns: 22px 1fr;
    gap: 10px;
    align-items: start;
    font-size: 14px;
    line-height: 1.5;
}
.auth-split .auth-marketing ul li::before {
    content: '✓';
    grid-column: 1;
    color: #fbbf24;
    font-weight: 800;
    font-size: 16px;
    line-height: 1;
    margin-top: 2px;
}
.auth-split .auth-marketing ul li strong {
    grid-column: 2;
    display: block;
    color: #ffffff;
    font-weight: 700;
    font-size: 14px;
}
.auth-split .auth-marketing ul li span {
    grid-column: 2;
    color: rgba(249, 250, 251, 0.78);
    font-size: 13px;
}

/* Right side: form panel. */
.auth-split .auth-form-side {
    padding: 38px 40px;
    background: var(--color-card);
    display: flex;
    flex-direction: column;
}
.auth-split .auth-form-side form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.auth-split .auth-form-side .form-group {
    margin: 0;
}
.auth-split .auth-form-side .form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 4px;
}
.auth-split .auth-form-side .form-group label .optional {
    font-weight: 400;
    color: var(--color-muted);
    font-size: 11px;
}
.auth-split .auth-form-side .form-group input,
.auth-split .auth-form-side .form-group textarea,
.auth-split .auth-form-side .form-group select {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: var(--color-bg);
    color: var(--color-text);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.auth-split .auth-form-side .form-group input:focus,
.auth-split .auth-form-side .form-group textarea:focus,
.auth-split .auth-form-side .form-group select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(67, 56, 202, 0.15);
}
.auth-split .auth-form-side textarea { resize: vertical; min-height: 64px; }
.auth-split .auth-form-side button[type="submit"] { margin-top: 6px; }

/* Variant: shop-auth-split is just a wider max-width than the
   default narrower auth-split (used for richer marketing copy). */
.shop-auth-split {
    width: 100%;
    max-width: 1080px;
}

/* =============================================================
   Pre-paint role gating. The shell renderer (services/shell_render.js)
   tags <html> with `role-{role}` + `is-anon` for anon, BEFORE the
   browser paints. These rules make role-specific nav resolve at
   paint time instead of waiting on applyAnonRoleGates() to mutate
   the DOM after JS boots - which was causing a visible flash on
   every internal shop nav click + logo click for anon users.
   ============================================================= */

/* Anon: reveal .anon-only chrome (sidebar nav group, top-nav CTAs)
   before JS runs. We have to override the .hidden utility's
   display:none, hence !important. */
html.is-anon .anon-only,
html.is-anon .anon-only.hidden {
    display: revert !important;
}

/* Anon: hide PPD-staff + platform-admin chrome before JS runs. Same
   rationale - applyAnonRoleGates() does this in JS but only after the
   browser has already painted.
   The :not(...) carve-out is critical: the Gallery nav group + the
   Gallery/Favorites links are themselves marked .ppd-scoped (because
   authed PPDs also use them), but anon legitimately uses them too.
   We exclude them from this hide rather than undoing it later, so
   their original .nav-link display (flex) survives untouched -
   `display: revert` to override the hide flattens nav-links to the
   <a> user-agent default of `inline`, which broke the menu layout. */
/* Note: #navGroupGallery is intentionally NOT excluded - the inline
   reparent script (in index.html) moves Gallery + Favorites OUT of
   that group into the Shop group before paint, leaving just the
   "Products" label + (hidden) Discover More. Hiding the empty
   container avoids an orphan label. The two links survive individual
   :not() exclusions below since they're now siblings of the Shop
   group, no longer descendants of the hidden Products group. */
html.is-anon .ppd-scoped:not(.nav-link[data-view="gallery"]):not(.nav-link[data-view="favorites"]),
html.is-anon .platform-admin-only,
html.is-anon .non-customer,
html.is-anon #commentsBell,
html.is-anon #tasksBell,
html.is-anon #notificationBell,
html.is-anon #topNavUserWrap,
html.is-anon #userRoleBadge,
html.is-anon #userGoatBadge,
html.is-anon #mobileCommentsBell,
html.is-anon #mobileNotifBell,
html.is-anon #mobileTasksBell {
    display: none !important;
}

/* =============================================================
   Buying-guide article body. Reuses the app's typography
   primitives but bumps line-height + spacing for long-form
   readability. Scoped to .shop-guide-body so it doesn't bleed
   into the rest of the app.
   ============================================================= */
.shop-guide-body { font-size: 16px; line-height: 1.7; color: var(--color-text); }
.shop-guide-body h2 { margin: 36px 0 12px; font-size: 22px; line-height: 1.25; }
.shop-guide-body h3 { margin: 24px 0 8px; font-size: 17px; line-height: 1.3; }
.shop-guide-body p { margin: 14px 0; }
.shop-guide-body ul, .shop-guide-body ol { margin: 14px 0 14px 22px; padding: 0; }
.shop-guide-body li { margin: 6px 0; }
.shop-guide-body strong { color: var(--color-text); font-weight: 700; }
.shop-guide-body table { width: 100%; margin: 18px 0; }
.shop-guide-body table th { text-align: left; }
.shop-guide-body details { margin: 8px 0; }
.shop-guide-body p.lede { font-size: 18px; line-height: 1.55; color: var(--color-text-secondary); margin: 0 0 22px; }

/* =============================================================
   Mobile "Filters" toggle button. Lives in .header-buttons,
   forced to the leftmost slot on mobile via flex order. The
   native <summary> stays as the desktop trigger (this button is
   hidden above 768px) so screen readers and keyboard nav still
   work the way they always did.
   ============================================================= */
.btn-filters-toggle { display: none; }
@media (max-width: 768px) {
    .btn-filters-toggle {
        /* Force-visible because the icon-collapse rule for header-buttons
           uses width:40px + padding:0 which would crush this button into
           a count-only badge. We need icon + label + badge to stay
           together. !important beats the .header-buttons .btn { padding:0 }
           rule that fires inside the same breakpoint. */
        display: inline-flex !important;
        align-items: center;
        order: -1;
        gap: 6px;
        height: auto !important;
        width: auto !important;
        padding: 0 12px !important;
        min-height: 40px;
        background: var(--color-card);
        border: 1px solid var(--color-border);
        color: var(--color-text);
        font-weight: 600;
    }
    .btn-filters-toggle .btn-icon {
        flex-shrink: 0;
        opacity: 0.85;
    }
    /* When filters are active, the whole button flips to indigo so it's
       impossible to miss that a filter is hiding rows. The badge inverts
       (white background, indigo number) for contrast. */
    .btn-filters-toggle.filters-active {
        background: var(--color-primary);
        border-color: var(--color-primary);
        color: #fff;
    }
    .btn-filters-toggle.filters-active .btn-icon { opacity: 1; }
    /* Native <summary> on mobile is redundant once the toggle button
       is in the header-buttons row. Hide it so we don't show two
       filter triggers. */
    .filters-drawer > .filters-toggle { display: none; }
    /* Active-filter count badge. Hidden when zero. Sits at the right
       edge of the button after the label. */
    .btn-filters-toggle .filters-active-count:empty { display: none; }
    .btn-filters-toggle .filters-active-count {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 20px;
        height: 20px;
        background: var(--color-primary);
        color: #fff;
        border-radius: 100px;
        padding: 0 6px;
        font-size: 11px;
        font-weight: 700;
        line-height: 1;
        margin-left: 2px;
    }
    /* Inverted badge palette when the parent is the active (indigo) state. */
    .btn-filters-toggle.filters-active .filters-active-count {
        background: #fff;
        color: var(--color-primary);
    }
}

/* =============================================================
   Mobile bottom-nav padding. Without this, the last few rows of
   long lists (orders, leads, dashboard cards) sit BEHIND the
   fixed bottom tab bar, making them unreadable and untappable.
   The bottom nav is ~64px + safe-area; pad the main content's
   bottom by that amount on phones so users can scroll the last
   row above the bar.
   ============================================================= */
@media (max-width: 768px) {
    body:not(.login-page) .main-content {
        /* Bumped from 72px to 96px after a user reported the SAGE
           search submit button was still hidden behind the nav on
           iPhone. The bottom-nav is min-height: 56 + tab-padding
           (10) + border (1) + safe-area (~34 on notched iPhones)
           ≈ 100px on a notched device. 96px + safe-bottom (~34)
           = 130px clearance, which exceeds the worst-case nav
           height. */
        padding-bottom: calc(96px + var(--safe-bottom, env(safe-area-inset-bottom, 0px))) !important;
    }
}

/* =============================================================
   Mobile order-hero status pill. The "Needs Quoted" / "PO
   Submitted" / "In Production" labels are long enough that on
   a 375px viewport they push the surrounding hero card off the
   screen with no scroll. Wrap + smaller font keeps the whole
   hero visible without clipping.
   ============================================================= */
@media (max-width: 600px) {
    .order-hero-status,
    .order-hero-status-needs-quoted,
    [class*="order-hero-status-"] {
        font-size: 12px !important;
        padding: 4px 10px !important;
        white-space: normal;
        max-width: 100%;
        word-break: break-word;
    }
    /* Whole hero wraps onto multiple lines instead of forcing
       a single overflowing row. */
    .order-hero,
    .order-hero-row {
        flex-wrap: wrap !important;
        gap: 8px;
    }
}

/* =============================================================
   Per-page tab strip for Art Services views. Rendered into every
   <nav data-art-tabs> placeholder by renderArtServicesTabs().
   Lives just below the page-header H1 so users can hop between
   sibling art tools without going back to the left-nav flyout.

   On phones the strip becomes horizontally scrollable - the active
   tab is auto-centered into view by the JS render fn. Scrollbar
   hidden because it's noisy at this size.
   ============================================================= */
.art-tabs-nav {
    display: flex;
    gap: 4px;
    /* Sits inside .page-header (a flex-column with gap:12px), so
       the spacing above is handled by the parent gap. No top
       margin; small bottom margin keeps the strip tight against
       any subtitle / filter drawer that follows. */
    margin: 0 0 4px;
    border-bottom: 1px solid var(--color-border);
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0;
}
/* Pin the tabs row to a stable vertical position across every art
   services page. The title row uses a fixed height so widgets
   (credits, multiple buttons, none at all) never push the tabs up
   or down. Value chosen to comfortably fit the credits widget
   (the tallest header element across these pages, ~46px). */
.page-header:has(> .art-tabs-nav) > .header-title-row {
    height: 48px;
    min-height: 48px;
}
.art-tabs-nav::-webkit-scrollbar { display: none; }
.art-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-secondary);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px; /* overlap the nav border so active tab joins it */
    white-space: nowrap;
    transition: color 120ms ease, border-color 120ms ease;
}
.art-tab:hover {
    color: var(--color-text);
}
.art-tab.is-active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}
.art-tab .ai-badge {
    font-size: 9px;
}
@media (max-width: 600px) {
    .art-tabs-nav {
        margin-left: -16px;
        margin-right: -16px;
        padding-left: 16px;
        padding-right: 16px;
    }
    .art-tab {
        padding: 8px 12px;
        font-size: 13px;
    }
}

/* =============================================================
   Two-line nav links - title + a short description below. Used in
   the Art Services flyout popout so each item explains itself at
   a glance instead of forcing the user to know what "Art File
   Checker" vs "External Art Services" mean. Scoped to the new
   .nav-link-with-desc class so we don't disturb every other
   single-line nav item in the app.
   ============================================================= */
.nav-link-with-desc {
    display: flex !important;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding-top: 8px;
    padding-bottom: 8px;
    line-height: 1.3;
}
.nav-link-with-desc .nav-link-title {
    font-size: 14px;
    font-weight: 600;
    color: inherit;
}
.nav-link-with-desc .nav-link-desc {
    font-size: 11px;
    font-weight: 500;
    /* White on the dark popout background. 78% opacity keeps it
       a clear secondary line under the bolder title without
       blending into pure-white at hover. */
    color: #fff;
    opacity: 0.78;
    letter-spacing: 0.1px;
}
/* Active / hover state: full opacity so the description reaches
   pure white when the row is focused. */
.nav-link-with-desc:hover .nav-link-desc,
.nav-link-with-desc.active .nav-link-desc {
    opacity: 1;
}

/* =============================================================
   Art Services Hub. Landing page reachable by clicking "Art
   Services" in the left nav. PPD users see all 7 cards; customers
   see the 5-card subset (the .non-customer cards are hidden by
   the role-gating system the rest of the app uses).

   Card pattern:
     - 4px color stripe across the top (per-card class)
     - 56px circular icon medallion in matching brand color
     - Headline + descriptive paragraph
     - "open this →" CTA chip in the footer

   The hover lift mirrors the existing capture-promo / admin-card
   styling so the page feels native to the rest of the app and not
   like a one-off visual.
   ============================================================= */
.art-hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}
.art-hub-card {
    position: relative;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    padding: 20px 22px 64px;
    text-decoration: none;
    color: var(--color-text);
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: hidden;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.art-hub-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.08);
    border-color: rgba(0,0,0,0.12);
}
.art-hub-card-stripe {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: var(--art-hub-stripe, var(--color-primary));
}
.art-hub-card-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--art-hub-icon-bg, rgba(67,97,238,0.1));
    color: var(--art-hub-stripe, var(--color-primary));
    margin-bottom: 4px;
    flex-shrink: 0;
}
.art-hub-card-title {
    margin: 0;
    font-size: 17px;
    font-weight: 800;
    line-height: 1.25;
    color: var(--color-text);
}
.art-hub-card-title .ai-badge {
    margin-left: 6px;
    vertical-align: 2px;
}
.art-hub-card-desc {
    margin: 0;
    font-size: 13px;
    line-height: 1.55;
    color: var(--color-text-secondary);
}
.art-hub-card-cta {
    position: absolute;
    bottom: 18px;
    left: 22px;
    font-size: 13px;
    font-weight: 700;
    color: var(--art-hub-stripe, var(--color-primary));
}
/* Per-card brand colors. Stripe + icon + CTA all draw from the
   same `--art-hub-stripe` so adding a new color is a 2-line
   change here, not a multi-property edit on every card. */
.art-hub-card--violet { --art-hub-stripe: #7c3aed; --art-hub-icon-bg: rgba(124,58,237,0.10); }
.art-hub-card--amber  { --art-hub-stripe: #d97706; --art-hub-icon-bg: rgba(217,119,6,0.10); }
.art-hub-card--blue   { --art-hub-stripe: #2563eb; --art-hub-icon-bg: rgba(37,99,235,0.10); }
.art-hub-card--teal   { --art-hub-stripe: #0d9488; --art-hub-icon-bg: rgba(13,148,136,0.10); }
.art-hub-card--slate  { --art-hub-stripe: #475569; --art-hub-icon-bg: rgba(71,85,105,0.10); }

/* Quick-tips footer. Two parallel lists swap based on role. */
.art-hub-tips {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    padding: 18px 22px;
}
.art-hub-tips-title {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--color-muted);
    margin-bottom: 8px;
}
.art-hub-tips-list {
    margin: 0;
    padding-left: 20px;
    font-size: 13px;
    line-height: 1.65;
    color: var(--color-text);
}
.art-hub-tips-list li { margin: 6px 0; }
.art-hub-tips-list strong { color: var(--color-text); }

/* Mobile: tighter padding, single column, slightly smaller icon
   medallion so the cards don't feel chunky on a 375px viewport. */
@media (max-width: 600px) {
    .art-hub-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .art-hub-card {
        padding: 16px 18px 56px;
    }
    .art-hub-card-icon {
        width: 48px;
        height: 48px;
        border-radius: 12px;
    }
    .art-hub-card-title { font-size: 16px; }
    .art-hub-card-desc { font-size: 12.5px; }
    .art-hub-card-cta { left: 18px; bottom: 14px; }
}

/* =============================================================
   Mobile sidebar drawer offset. The drawer is `position:fixed;
   top:0; height:100vh`, which on iOS PWA puts the brand logo +
   first nav link partially behind the status bar / notch. The
   user reported "Product Gallery at the top of the left nav is
   unreachable" - that's the first nav link slipping under the
   iOS chrome. Pad the top by the safe-area inset so every nav
   link starts in the safe zone, and trim the height by the
   same amount so the bottom doesn't extend past the viewport.
   ============================================================= */
@media (max-width: 768px) {
    .sidebar {
        padding-top: var(--safe-top, env(safe-area-inset-top, 0px));
        height: calc(100vh - var(--safe-top, env(safe-area-inset-top, 0px)));
    }
}

/* =============================================================
   Mobile notification / task / comment popouts. These flyouts
   anchor to bell icons in the mobile-topbar (top-right of the
   screen) so by default they extend off the right edge on a
   narrow viewport. Constrain them to viewport width with a
   small horizontal margin and let them scroll vertically if
   the content is long.
   ============================================================= */
@media (max-width: 768px) {
    .notif-popout,
    .tasks-popout,
    .comments-popout,
    .nav-submenu-popout,
    [class*="-popout"] {
        left: 8px !important;
        right: 8px !important;
        max-width: calc(100vw - 16px);
        max-height: 70vh;
        overflow-y: auto;
    }
}

/* =============================================================
   Mobile order progress tracker. 12 statuses + connector lines
   in a single flex row don't fit on a 375px viewport - dots get
   crushed and labels truncate. Allow the row to scroll
   horizontally on phones so every step + label stays readable
   and tappable.
   ============================================================= */
@media (max-width: 768px) {
    .order-progress-tracker {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 8px;
        scrollbar-width: thin;
    }
    .order-progress-tracker .progress-step {
        min-width: 64px;
        flex: 0 0 auto;
    }
    .order-progress-tracker .progress-connector {
        min-width: 16px;
        flex: 0 0 auto;
    }
    .order-progress-tracker .step-label {
        font-size: 10px;
        white-space: normal;
        max-width: 60px;
        margin-left: auto;
        margin-right: auto;
    }
}

/* =============================================================
   Mobile pricing breakdown table. Up to 6 columns (Item, Qty,
   Unit Price, Total Price, Unit Net, Net Total) which is wider
   than 375px. The outer card had `overflow:hidden` which was
   clipping the table. Switch to horizontal scroll inside the
   card on phones so PPDs can swipe to see net columns without
   the page itself scrolling sideways.
   ============================================================= */
@media (max-width: 768px) {
    .order-pricing-breakdown {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }
    .order-pricing-breakdown > table {
        min-width: 560px; /* keep columns readable; user pans the card */
    }
}

/* =============================================================
   Hide Export CSV buttons on mobile. CSV exports are a desktop
   workflow (open the file in Excel / Sheets / a text editor) -
   tapping one on a phone drops a file in the Files app the user
   can't usefully do anything with from the same device. Removed
   per mobile feedback. Per-page headers still show every other
   action (Reset Filters, Discover More Products, +New, etc).
   ============================================================= */
@media (max-width: 768px) {
    .btn-export { display: none !important; }
}

/* =============================================================
   Mobile bottom-nav: hide the redundant Search tab. Global
   search is always reachable from the mobile-topbar at the top
   of the screen, so the bottom-nav Search slot was duplicating
   that affordance. The four remaining tabs (Home, Orders,
   Projects, Menu for staff; Home, Browse, Quote, Menu for anon)
   re-flex evenly.
   ============================================================= */
@media (max-width: 768px) {
    #mobileTabSearch { display: none; }
}

/* =============================================================
   Touch-target audit fixes. iOS HIG and WCAG AA both call for a
   minimum 44x44px tap target. The desktop button densities are
   intentionally tight, so we only relax them on actual touch
   devices via `(hover: none) and (pointer: coarse)` - this skips
   trackpad and mouse users on a small viewport while still
   catching every iPhone, iPad, and Android phone/tablet.

   `min-height: 44px` is preferred over `padding` bumps because
   it preserves the visual height of buttons that already happen
   to clear the threshold (e.g. .btn at 8px+text+8px ~= 36px),
   without distorting their internal alignment. We pair it with
   `inline-flex; align-items: center` so single-line text stays
   centered regardless of which one is ultimately taller.
   ============================================================= */
@media (hover: none) and (pointer: coarse) {
    /* All standard buttons hit 44px. .btn-sm and .btn-xs trade some
       visual compactness for tap-ability - the 13px / 12px font
       sizes stay so layouts that pack buttons next to text remain
       readable. */
    .btn,
    .btn-sm,
    .btn-xs {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    /* Tighten internal padding-y so text isn't double-padded; the
       min-height does the lifting now. */
    .btn-sm { padding-top: 6px; padding-bottom: 6px; }
    .btn-xs { padding-top: 4px; padding-bottom: 4px; }

    /* Icon-only and ghost-icon buttons: the heart on supplier rows,
       the dismiss X on capture banners, the lead-temperature chips,
       table sort arrows. These were tuned for desktop pixel density
       and become unreliable taps on a phone. */
    .favorite-btn {
        min-width: 44px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 0;
    }
    .capture-promo-dismiss {
        min-width: 44px;
        min-height: 44px;
    }
    .sage-drawer-close {
        min-width: 44px;
        min-height: 44px;
    }
    /* Lead-temperature pill group: 4 buttons in a row. 44px each
       would push the row past most table cells, so we settle on
       40px which is still well above the 22px desktop default and
       comfortable for thumb taps on every test device. */
    .lead-temp-btn {
        min-height: 40px;
        padding-top: 8px;
        padding-bottom: 8px;
    }
    /* Table sort-arrow icons sit inside header cells. Bump the
       parent header pad rather than the arrow itself so the
       header text + arrow remain a single tap surface. */
    th.sortable-header {
        padding-top: 10px;
        padding-bottom: 10px;
    }
    /* Image carousel arrows in the gallery detail / extension popup
       previews. Default ~30px circles - tap-miss prone next to the
       image edge. */
    .img-carousel-arrow,
    .table-scroll-arrow {
        min-width: 44px;
        min-height: 44px;
    }
    /* Pagination buttons: small page numbers in lists. */
    .pagination-bar button,
    .pagination-bar a {
        min-height: 40px;
        min-width: 40px;
    }
    /* Modal close X (top-right of every modal). The `&times;`
       glyph in a 24-32px button is a common miss target. */
    .modal-close,
    [data-act$="-close"],
    .ext-confirm-modal .btn,
    button[aria-label="Close"] {
        min-height: 44px;
        min-width: 44px;
    }
    /* Filter chip / pill buttons (gallery, leads, orders). They
       use small font + tight padding to fit several per row, so
       force a 36px minimum that still allows ~3-4 chips per
       phone-width row but is reliably tappable. */
    .filter-chip,
    .active-filter-chip,
    .lead-temp-btn,
    .badge[role="button"],
    .badge[onclick] {
        min-height: 36px;
    }
}
