@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    /* IntegraSell brand */
    --brand-violet: #0ea5e9;
    --brand-lavender: #38bdf8;
    --brand-deep: #0c1a2e;

    /* Primary — ocean blue */
    --primary: #0284c7;
    --primary-dark: #0369a1;
    --primary-light: #e0f2fe;
    --primary-mid: #38bdf8;

    /* Semantic */
    --success: #10b981;
    --danger: #ef4444;

    /* Neutrals */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    --bg: #ffffff;
    --bg-page: #f0f9ff;

    --radius: 10px;
    --page-padding: 1rem;
    --shadow: 0 1px 4px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 20px rgba(2,132,199,0.1), 0 2px 6px rgba(0,0,0,0.06);
    --shadow-lg: 0 12px 40px rgba(2,132,199,0.18);

    /* Semantic aliases — resolve through the gray scale so dark mode remapping is automatic */
    --text-primary: var(--gray-800);
    --text-muted: var(--gray-500);
    --border-color: var(--gray-200);
}

/* Dark mode */
[data-theme="dark"] {
    --gray-50: #0c1a2e;
    --gray-100: #0f2233;
    --gray-200: #163347;
    --gray-300: #1e4560;
    --gray-400: #4a8bb5;
    --gray-500: #7ab3d0;
    --gray-600: #a8d0e6;
    --gray-700: #cce4f0;
    --gray-800: #e4f2f9;
    --gray-900: #f0f9ff;
    --bg: #0f2233;
    --bg-page: #0c1a2e;
    --primary: #38bdf8;
    --primary-dark: #7dd3fc;
    --primary-light: #163347;
    --shadow: 0 1px 4px rgba(0,0,0,0.5), 0 1px 2px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.5), 0 2px 6px rgba(0,0,0,0.4);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--gray-800);
    background: var(--bg-page);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overscroll-behavior: contain;
}

/* iOS Safari: prevent zoom-on-focus by ensuring inputs are >= 16px on mobile */
@media (max-width: 767px) {
    input, select, textarea {
        font-size: 16px;
    }
}

/* App layout */
.app-layout {
    display: grid;
    grid-template-columns: auto 1fr;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 220px;
    background: linear-gradient(180deg, #0c1a2e 0%, #0f2233 45%, #0d2b42 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    transition: width 0.2s ease;
    overflow: hidden;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 200;
    box-shadow: 2px 0 20px rgba(0,0,0,0.25);
}

[data-theme="dark"] .sidebar {
    background: linear-gradient(180deg, #060f1a 0%, #0c1a2e 45%, #0d2234 100%);
}

.sidebar.collapsed {
    width: 60px;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    height: 56px;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -0.01em;
    white-space: nowrap;
    border-bottom: 1px solid rgba(176, 171, 255, 0.15);
    background: rgba(0,0,0,0.15);
}

.sidebar-header svg {
    flex-shrink: 0;
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.75rem 0.625rem;
}

.sidebar-footer {
    border-top: 1px solid rgba(176, 171, 255, 0.12);
    padding: 0.625rem 0.625rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius);
    color: rgba(176, 171, 255, 0.75);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s, border-left-color 0.15s;
    white-space: nowrap;
    background: none;
    border: none;
    border-left: 3px solid transparent;
    cursor: pointer;
    width: 100%;
    font-family: inherit;
}

.sidebar-link:hover {
    background: rgba(176, 171, 255, 0.1);
    color: rgba(255,255,255,0.95);
}

.sidebar-link.active {
    background: rgba(176, 171, 255, 0.14);
    color: #fff;
    border-left-color: var(--brand-lavender);
    font-weight: 600;
}

/* Per-section icon colour when active */
.sidebar-nav .sidebar-link:nth-child(1).active .sidebar-icon { color: #c4b5fd; }
.sidebar-nav .sidebar-link:nth-child(2).active .sidebar-icon { color: #67e8f9; }
.sidebar-nav .sidebar-link:nth-child(3).active .sidebar-icon { color: #6ee7b7; }
.sidebar-nav .sidebar-link:nth-child(4).active .sidebar-icon { color: #fcd34d; }
.sidebar-nav .sidebar-link:nth-child(5).active .sidebar-icon { color: #fda4af; }

/* Subtle hover icon tint per section */
.sidebar-nav .sidebar-link:nth-child(1):hover .sidebar-icon { color: #c4b5fd; }
.sidebar-nav .sidebar-link:nth-child(2):hover .sidebar-icon { color: #67e8f9; }
.sidebar-nav .sidebar-link:nth-child(3):hover .sidebar-icon { color: #6ee7b7; }
.sidebar-nav .sidebar-link:nth-child(4):hover .sidebar-icon { color: #fcd34d; }
.sidebar-nav .sidebar-link:nth-child(5):hover .sidebar-icon { color: #fda4af; }

.sidebar-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-label {
    opacity: 1;
    width: auto;
    overflow: hidden;
    transition: opacity 0.2s ease, width 0.2s ease;
}

.sidebar.collapsed .sidebar-label {
    opacity: 0;
    width: 0;
}

/* Header bar */
.header {
	display: flex;
	align-items: center;
	height: 56px;
	padding: 0 1.25rem;
	background: var(--bg);
	border-bottom: 1px solid var(--gray-200);
	box-shadow: 0 1px 0 rgba(124,111,255,0.06);
	position: sticky;
	top: 0;
	z-index: 100;
	flex-shrink: 0;
	gap: 0.5rem;
}

.header-spacer {
    flex: 1;
}

.user-header-wrap {
    position: relative;
    flex-shrink: 0;
}

.header-username {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.85rem;
    color: var(--gray-600);
    font-weight: 500;
    background: none;
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: 0;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.header-username:hover,
.header-username.active {
    background: var(--primary-light, rgba(99,102,241,0.08));
    color: var(--primary, #6366f1);
}

.user-header-popup {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 180px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius, 6px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.08);
    padding: 0.75rem 1rem;
    z-index: 500;
    white-space: nowrap;
}

[data-theme="dark"] .user-header-popup {
    border-color: var(--gray-700);
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.user-popup-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

.user-popup-role {
    font-size: 0.78rem;
    color: var(--gray-500);
    margin-top: 0.15rem;
}

@media (max-width: 600px) {
    .user-header-popup {
        position: fixed;
        top: 60px;
        right: 0.75rem;
        left: auto;
        white-space: normal;
    }
}

.sidebar-toggle,
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 0;
    background: transparent;
    color: var(--gray-600);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.sidebar-toggle:hover,
.theme-toggle:hover {
    background: var(--gray-100);
    color: var(--gray-800);
}

/* Cart button in header */
.cart-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 36px;
    height: 32px;
    border: none;
    border-radius: 0;
    background: transparent;
    color: var(--gray-500);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.cart-btn:hover {
    background: var(--gray-100);
    color: var(--gray-800);
}

.cart-btn.has-items {
    color: var(--primary);
}

.cart-badge {
    position: absolute;
    top: 0;
    right: 0;
    min-width: 16px;
    height: 16px;
    padding: 0 3px;
    background: var(--primary);
    color: #fff;
    border-radius: 8px;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    pointer-events: none;
}

/* Cart rows on home page */
.cart-row:hover {
    background: var(--gray-50);
}

.cart-open-arrow {
    font-size: 1.4rem;
    color: var(--gray-400);
    line-height: 1;
}

.draft-row-code {
    color: var(--gray-400);
    font-size: 0.8rem;
}

/* Main area */
.main-area {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
	max-height: 100vh;
	overflow-x: hidden;
	overflow-y: auto;
}

.main-content {
    flex: 1;
    background: var(--bg-page);
}

/* Mobile menu — fixed left-drawer overlay */
.mobile-menu-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1999;
    background: rgba(0, 0, 0, 0.45);
}
.mobile-menu-backdrop.open {
    display: block;
}
.mobile-menu {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 300px;
    max-width: 90vw;
    z-index: 2000;
    background: var(--bg);
    border-left: 1px solid var(--gray-200);
    overflow-y: auto;
    padding-bottom: 1rem;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.18);
    flex-direction: column;
}
.mobile-menu.open {
    display: flex;
}
.mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    min-height: 56px;
    border-bottom: 1px solid var(--gray-200);
    flex-shrink: 0;
}
.mobile-menu-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-600);
    font-size: 1.25rem;
    padding: 0.3rem 0.5rem;
    line-height: 1;
    border-radius: var(--radius);
}
.mobile-menu-close:hover {
    background: var(--gray-100);
    color: var(--gray-900);
}

.mobile-menu-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1.25rem;
    color: var(--gray-700);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.15s;
    background: none;
    border: none;
    cursor: pointer;
    width: 100%;
    font-family: inherit;
}

.mobile-menu-link:hover {
    background: var(--gray-100);
}

.mobile-menu-link.active {
    color: var(--primary);
    background: var(--primary-light);
    font-weight: 600;
}

/* Utility classes */
.desktop-only {
    display: inline-flex;
}

.mobile-only {
    display: none;
}

.mobile-header-logo {
    display: none;
    height: 32px;
    cursor: pointer;
    flex-shrink: 0;
}

/* Layout */
.page {
    max-width: 820px;
    margin: 0 auto;
    padding: 2rem;
}

.page-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 0.375rem;
    letter-spacing: -0.02em;
}

.page-subtitle {
    color: var(--gray-500);
    margin-bottom: 2rem;
    font-size: 0.9rem;
}

/* Card */
.card {
    background: var(--bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: box-shadow 0.2s;
}

.card-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--gray-700);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Card titles lead with an icon (CardIcon in components/stroke-icon.js) — never a decorative bar.
   Monochrome by default; tone modifiers only when the colour carries meaning. */
.card-title-icon { color: var(--gray-500); flex-shrink: 0; }
.card-title-icon--primary { color: var(--primary); }
.card-title-icon--success { color: var(--success); }
.card-title-icon--danger { color: var(--danger); }
.card-title-icon--warning { color: #d97706; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(124,111,255,0.35);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, #075985 100%);
    box-shadow: 0 4px 12px rgba(2,132,199,0.4);
}

.btn-primary:disabled {
    background: var(--gray-300);
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(239,68,68,0.3);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
    box-shadow: 0 4px 12px rgba(239,68,68,0.4);
}

.btn-danger:disabled {
    background: var(--gray-300);
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

.btn-success {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(22,163,74,0.3);
}
.btn-success:hover {
    background: linear-gradient(135deg, #15803d 0%, #166534 100%);
    box-shadow: 0 4px 12px rgba(22,163,74,0.4);
}
.btn-success:disabled {
    background: var(--gray-300);
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

/* Purple — matches task-badge--done (#e0e7ff / #3730a3 palette) */
.btn-purple {
    background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(79,70,229,0.3);
}
.btn-purple:hover {
    background: linear-gradient(135deg, #3730a3 0%, #312e81 100%);
    box-shadow: 0 4px 12px rgba(79,70,229,0.4);
}
.btn-purple:disabled {
    background: var(--gray-300);
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

.btn-ghost {
    background: var(--gray-100);
    color: var(--gray-700);
    box-shadow: none;
}

.btn-ghost:hover {
    background: var(--gray-200);
}

[data-theme="dark"] .btn-ghost {
    background: var(--gray-700);
    color: var(--gray-200);
}

[data-theme="dark"] .btn-ghost:hover {
    background: var(--gray-600);
}

/* Sync status */
.sync-status {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    display: none;
}

.sync-status.visible {
    display: block;
}

.sync-status.success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.sync-status.error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.sync-status.loading {
    background: var(--primary-light);
    color: var(--primary-dark);
    border: 1px solid #bfdbfe;
}

/* ── Lightbox ───────────────────────────────────────────────────────────── */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.82);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    animation: lightbox-fade-in 0.15s ease;
}

@keyframes lightbox-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.lightbox-close {
    position: fixed;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.15);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9001;
    transition: background 0.15s;
}

.lightbox-close:hover {
    background: rgba(255,255,255,0.3);
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 85vh;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.3) transparent;
}

.lightbox-img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    animation: lightbox-fade-in 0.2s ease;
}

.lightbox-zoom-controls {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 2rem;
    padding: 0.35rem 0.6rem;
    z-index: 9001;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.lightbox-zoom-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    font-size: 1.1rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s;
    flex-shrink: 0;
}

.lightbox-zoom-btn:hover:not(:disabled) {
    background: rgba(255,255,255,0.28);
}

.lightbox-zoom-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

.lightbox-zoom-pct {
    background: none;
    border: none;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    min-width: 3.2rem;
    text-align: center;
    cursor: pointer;
    padding: 0.15rem 0.4rem;
    border-radius: 0.25rem;
    letter-spacing: 0.01em;
    transition: background 0.15s;
}

.lightbox-zoom-pct:hover {
    background: rgba(255,255,255,0.15);
}

.lightbox-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 120px;
    min-height: 120px;
    color: #fff;
}

/* Zoomable cursor on clickable product images */
.product-img-zoomable {
    cursor: zoom-in;
}

/* Image sync progress bar */
.image-sync-progress {
    padding: 0.5rem 0;
}

.image-sync-label {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-bottom: 0.35rem;
}

.image-sync-bar-track {
    height: 6px;
    background: var(--gray-200);
    border-radius: 3px;
    overflow: hidden;
}

.image-sync-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    transition: width 0.2s ease;
}

/* Spinner */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Search */
.search-container {
    position: relative;
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    outline: none;
    transition: border-color 0.15s;
    background: var(--bg);
    color: var(--gray-800);
}

.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(2,132,199,0.15);
}

.search-input::placeholder {
    color: var(--gray-400);
}

.search-hint {
    font-size: 0.8rem;
    color: var(--gray-400);
    margin-top: 0.375rem;
}

/* Dropdown */
.dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    max-height: 320px;
    overflow-y: auto;
    z-index: 50;
}

.dropdown-up {
    top: auto;
    bottom: calc(100% + 4px);
}

.dropdown-item {
    padding: 0.625rem 1rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--gray-100);
    transition: background 0.1s;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background: var(--primary-light);
}

.dropdown-item-name {
    font-weight: 500;
    font-size: 0.9rem;
}

.dropdown-item-code {
    font-size: 0.8rem;
    color: var(--gray-500);
    font-family: 'SF Mono', 'Consolas', monospace;
}

/* Customer detail */
.customer-detail {
    margin-top: 1.5rem;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.detail-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--gray-200);
}

.detail-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.detail-name {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--gray-900);
}

.detail-code {
    font-size: 0.85rem;
    color: var(--gray-500);
    font-family: 'SF Mono', 'Consolas', monospace;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.detail-field {
    padding: 0.75rem;
    background: var(--gray-50);
    border-radius: var(--radius);
}

.detail-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    margin-bottom: 0.25rem;
}

.detail-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
}

.detail-value.positive {
    color: var(--success);
}

.detail-value.negative {
    color: var(--danger);
}

/* Offline banner */
.offline-banner {
    background: linear-gradient(90deg, #fef3c7, #fde68a);
    color: #78350f;
    text-align: center;
    padding: 0.5rem 1rem;
    font-size: 0.825rem;
    font-weight: 600;
    display: none;
    letter-spacing: 0.01em;
}

.offline-banner.visible {
    display: block;
}

/* No data message */
.no-data {
    text-align: center;
    padding: 2rem;
    color: var(--gray-400);
}

/* Stats row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    padding: 1.25rem 1.25rem 1rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--brand-lavender) 100%);
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 0.375rem;
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Login page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: url('/images/login-bg.jpg') center center / cover no-repeat;
    padding: 1.5rem;
    position: relative;
}

.login-page::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(160deg, rgba(12,26,46,0.72) 0%, rgba(15,34,51,0.60) 50%, rgba(5,46,22,0.55) 100%);
}

.login-panel {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 400px;
    gap: 2rem;
}

.login-logo-box {
    background: transparent;
    padding: 0 1rem;
    width: 100%;
    text-align: center;
}

.login-logo {
    height: 72px;
    width: auto;
    display: block;
    margin: 0 auto;
}

.login-card {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.45), 0 4px 20px rgba(0,0,0,0.25);
    padding: 2.25rem 2.5rem 2.5rem;
    width: 100%;
}

.login-card-header {
    margin-bottom: 1.75rem;
    text-align: center;
}

.login-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.02em;
    margin-bottom: 0.25rem;
}

.login-subtitle {
    color: var(--gray-500);
    font-size: 0.875rem;
    margin-bottom: 0;
}

.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.375rem;
}

.form-input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.95rem;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--bg);
    color: var(--gray-800);
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(2,132,199,0.15);
}
[data-theme="dark"] input[type="date"].form-input,
[data-theme="dark"] input[type="datetime-local"].form-input {
    color: var(--gray-800);
}
[data-theme="dark"] input[type="date"].form-input::-webkit-calendar-picker-indicator,
[data-theme="dark"] input[type="datetime-local"].form-input::-webkit-calendar-picker-indicator {
    filter: invert(1) brightness(0.8);
    opacity: 0.75;
    cursor: pointer;
}

.login-btn {
    width: 100%;
    justify-content: center;
    margin-top: 0.75rem;
    padding: 0.75rem 1.25rem;
    font-size: 1rem;
    letter-spacing: 0.01em;
    border-radius: 10px;
}

.login-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
    border-radius: var(--radius);
    padding: 0.625rem 0.75rem;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}
[data-theme="dark"] .login-card {
    background: var(--gray-100);
    box-shadow: 0 24px 64px rgba(0,0,0,0.7), 0 4px 20px rgba(0,0,0,0.5);
}
[data-theme="dark"] .login-title {
    color: var(--gray-800);
}
[data-theme="dark"] .login-subtitle {
    color: var(--gray-600);
}
[data-theme="dark"] .form-label {
    color: var(--gray-700);
}
[data-theme="dark"] .login-error {
    background: #3b0a0a;
    color: #fca5a5;
    border-color: #7f1d1d;
}

/* Dashboard layout */
.page-wide {
    max-width: none;
    padding: var(--page-padding);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.dashboard-card {
    background: var(--bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.dashboard-card--full {
    grid-column: 1 / -1;
}

.dashboard-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--gray-200);
    background: linear-gradient(90deg, var(--gray-50) 0%, rgba(237,233,255,0.5) 100%);
}

.dashboard-card-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray-700);
}
[data-theme="dark"] .dashboard-card-header {
    background: linear-gradient(90deg, var(--gray-100) 0%, var(--gray-200) 100%);
}
[data-theme="dark"] .dashboard-card-title {
    color: var(--gray-800);
}

.dashboard-card-action {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--primary);
    text-decoration: none;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    border: 1px solid var(--primary);
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
.dashboard-card-action:hover {
    background: var(--primary);
    color: #fff;
}

.dashboard-card-body {
    padding: 1.25rem;
}

.dashboard-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    padding: 2rem;
    color: var(--gray-400);
    font-size: 0.9rem;
}

.dashboard-spinner {
    border-color: rgba(26, 86, 219, 0.2);
    border-top-color: var(--primary);
}

.dashboard-error {
    padding: 1.5rem;
    text-align: center;
    color: var(--danger);
    font-size: 0.875rem;
    background: #fef2f2;
    border-radius: var(--radius);
}

.dashboard-stale {
    margin-top: 0.75rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    color: #92400e;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: var(--radius);
}

/* Dashboard tables */
.dashboard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.dashboard-table thead th {
    text-align: left;
    padding: 0.625rem 0.75rem;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    border-bottom: 2px solid var(--gray-200);
}

.dashboard-table tbody td {
    padding: 0.625rem 0.75rem;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
}

.dashboard-table tbody tr:last-child td {
    border-bottom: none;
}

.dashboard-table tbody tr:hover {
    background: var(--gray-50);
}

/* Promotion cards */
.promo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
}

.promo-card {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1rem;
    position: relative;
    transition: box-shadow 0.15s;
}

.promo-card:hover {
    box-shadow: var(--shadow-md);
}

.promo-badge {
    display: inline-block;
    background: var(--danger);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    letter-spacing: 0.02em;
}

.promo-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.375rem;
}

.promo-desc {
    font-size: 0.825rem;
    color: var(--gray-500);
    line-height: 1.45;
    margin-bottom: 0.625rem;
}

.promo-dates {
    font-size: 0.75rem;
    color: var(--gray-400);
    font-weight: 500;
}

/* Prospect summary */
.prospect-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.prospect-stat {
    background: linear-gradient(135deg, var(--primary-light) 0%, rgba(176,171,255,0.2) 100%);
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
    border: 1px solid rgba(124,111,255,0.15);
}

.prospect-stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
}

.prospect-stat-label {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-top: 0.125rem;
}

.prospect-status {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
}

.prospect-status--new {
    background: #eff6ff;
    color: #1d4ed8;
}

.prospect-status--contacted {
    background: #fefce8;
    color: #a16207;
}

.prospect-status--qualified {
    background: #f0fdf4;
    color: #15803d;
}

.prospect-status--converted {
    background: #ecfdf5;
    color: #047857;
}

/* Today's Tasks widget */
.task-stats-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.875rem;
    flex-wrap: wrap;
}

.task-stat-chip {
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    background: var(--gray-100);
    color: var(--gray-600);
    border: 1px solid var(--gray-200);
}

.task-stat-chip--pending {
    background: #fef9c3;
    color: #854d0e;
    border-color: #fde68a;
}

.task-stat-chip--done {
    background: #e0e7ff;
    color: #3730a3;
    border-color: #c7d2fe;
}

.task-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 320px;
    overflow-y: auto;
}

.task-card {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.75rem 0.875rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    background: var(--bg);
    flex-shrink: 0;
}

.task-icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
    text-transform: uppercase;
}

.task-body {
    flex: 1;
    min-width: 0;
}

.task-subject-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.2rem;
}

.task-subject {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.task-customer {
    font-size: 0.8rem;
    color: var(--gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.3rem;
}

.task-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    color: var(--gray-400);
}

.task-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    white-space: nowrap;
    flex-shrink: 0;
}

.task-badge--pending {
    background: #fef9c3;
    color: #a16207;
}

/* Use the same purple as apt-status-badge--complete so "Done" on Today's Tasks
   doesn't visually clash with the green PhoneCall colour. */
.task-badge--done {
    background: #e0e7ff;
    color: #3730a3;
}

.appt-type-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    flex-shrink: 0;
}

.appt-type-badge--phone {
    background: #dcfce7;
    color: rgb(22, 163, 74);
}

.appt-type-badge--visit {
    background: color-mix(in srgb, var(--primary) 12%, transparent);
    color: var(--primary);
}

.task-empty {
    text-align: center;
    padding: 2rem;
    color: var(--gray-400);
    font-size: 0.875rem;
}

.task-card--link {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.task-card--link:hover {
    background: var(--gray-50);
    border-color: var(--primary-mid);
}

.task-card--done-true {
    opacity: 0.6;
}

.task-toggle-btn {
    flex-shrink: 0;
    align-self: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    border: 1.5px solid currentColor;
    background: transparent;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.task-toggle-btn--pending {
    color: #f59e0b;
}

.task-toggle-btn--pending:hover {
    background: #f59e0b;
    color: #fff;
}

.task-toggle-btn--done {
    color: var(--gray-500);
}

.task-toggle-btn--done:hover {
    background: var(--gray-200);
    color: var(--gray-700);
}

/* ── Play button on appointment cards ───────────────────────────────────────── */
.task-play-btn {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    border: 1px solid var(--gray-300);
    background: #fff;
    color: var(--gray-500);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
}
/* VISIT = primary blue */
.task-play-btn--visit {
    color: var(--primary);
    border-color: var(--primary);
}
.task-play-btn--visit:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    transform: scale(1.08);
}
/* PHONECALL = green */
.task-play-btn--phone {
    color: #16a34a;
    border-color: #16a34a;
}
.task-play-btn--phone:hover {
    background: #16a34a;
    border-color: #16a34a;
    color: #fff;
    transform: scale(1.08);
}

/* ── Show Overdue toggle button ─────────────────────────────────────────────── */
.task-overdue-toggle {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.65rem;
    border-radius: 1rem;
    border: 1px solid var(--gray-300);
    background: #fff;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.task-overdue-toggle:hover {
    border-color: #f59e0b;
    color: #92400e;
}
.task-overdue-toggle--on {
    background: #fffbeb;
    border-color: #f59e0b;
    color: #92400e;
}

/* ── AppointmentDetailsModal (.adm-*) ───────────────────────────────────────── */
.adm-overlay {
    z-index: 1100;
}
.adm-panel {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.adm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem 0.75rem;
    border-bottom: 1px solid var(--gray-200);
    gap: 0.75rem;
}
.adm-header-left {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
}
.adm-type-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.adm-customer-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.adm-type-label {
    font-size: 0.75rem;
    font-weight: 500;
}
.adm-body {
    padding: 0.75rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.adm-row {
    display: flex;
    gap: 0.75rem;
    font-size: 0.875rem;
    align-items: baseline;
}
.adm-label {
    color: var(--text-muted);
    font-size: 0.78rem;
    min-width: 5rem;
    flex-shrink: 0;
}
.adm-value {
    color: var(--text-primary);
    font-weight: 500;
}
.adm-link {
    color: var(--primary);
    text-decoration: none;
}
.adm-link:hover { text-decoration: underline; }
.adm-footer {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--gray-200);
    justify-content: flex-end;
    flex-wrap: wrap;
}

/* ── NoteDetailModal / TaskDetailModal (.ndm-*) ─────────────────────────────── */
.ndm-overlay {
    z-index: 1100;
}
.ndm-panel {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    width: 100%;
    max-width: 440px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.ndm-panel--edit-task {
    max-width: 560px;
}
.ndm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--gray-200);
    gap: 0.75rem;
}
.ndm-header-left {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
    flex: 1;
}
.ndm-type-dot {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.ndm-type-label {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.ndm-date {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.1rem;
}
.ndm-body {
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    max-height: 60vh;
    overflow-y: auto;
}
.ndm-loading {
    display: flex;
    justify-content: center;
    padding: 1rem 0;
}
.ndm-error {
    color: var(--danger);
    font-size: 0.875rem;
}
.ndm-subject {
    font-weight: 600;
    font-size: 0.975rem;
    color: var(--text-primary);
    line-height: 1.4;
}
.ndm-body-text {
    font-size: 0.875rem;
    color: var(--gray-600);
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
}
.ndm-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.ndm-meta-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
}
.ndm-meta-label {
    color: var(--text-muted);
    font-size: 0.78rem;
    min-width: 4.5rem;
    flex-shrink: 0;
}
.ndm-meta-value {
    color: var(--text-primary);
    font-weight: 500;
}
.ndm-footer {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--gray-200);
    justify-content: flex-end;
}

.appt-body {
    display: flex;
    flex-direction: column;
}

.appt-body .task-list {
    max-height: 600px; /* ~6 call cards */
    overflow-y: auto;
}

.appt-count {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--gray-200);
}

.appt-count-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-800);
    line-height: 1;
}

.appt-count-label {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.callplan-filter-tabs {
    display: flex;
    gap: 0.3rem;
}

.callplan-filter-tab {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.28rem 0.65rem;
    border-radius: 999px;
    border: 1.5px solid var(--gray-200);
    background: var(--bg);
    color: var(--gray-600);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
    white-space: nowrap;
}

.callplan-filter-tab:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.callplan-filter-tab--active {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.route-map {
    height: 300px;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--gray-200);
    position: relative;
    z-index: 0;
}

.route-marker {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.25);
    line-height: 1;
}

/* Responsive */
@media (max-width: 900px) {

    .prospect-stats {
        grid-template-columns: 1fr;
    }

    .page-wide {
        padding: 1rem;
    }
}

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .app-layout {
        grid-template-columns: 1fr;
    }

    .desktop-only {
        display: none !important;
    }

    .mobile-only {
        display: inline-flex !important;
    }

    .mobile-header-logo { display: block; }

    /* Mobile header: dark background */
    .header {
        background: linear-gradient(90deg, #0c1a2e 0%, #0f2233 100%);
        border-bottom: 1px solid rgba(255,255,255,0.08);
        box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    }
    /* Adapt interactive element colours for dark header on mobile */
    .header .sidebar-toggle,
    .header .theme-toggle {
        color: rgba(255,255,255,0.7);
    }
    .header .sidebar-toggle:hover,
    .header .theme-toggle:hover {
        background: rgba(255,255,255,0.1);
        color: #fff;
    }
    .header .cart-btn {
        color: rgba(255,255,255,0.65);
    }
    .header .cart-btn:hover,
    .header .cart-btn.has-items {
        background: rgba(56,189,248,0.15);
        color: #38bdf8;
    }
    .header .cart-btn.has-items:hover {
        background: rgba(56,189,248,0.25);
    }
    .header .header-username {
        color: rgba(255,255,255,0.7);
    }
    .header .header-username:hover,
    .header .header-username.active {
        background: rgba(255,255,255,0.1);
        color: #fff;
    }
    .header .customer-pill {
        background: rgba(255,255,255,0.08);
        border-color: rgba(255,255,255,0.18);
        color: rgba(255,255,255,0.85);
    }
    .header .customer-pill:hover,
    .header .customer-pill.has-customer {
        background: rgba(56,189,248,0.2);
        border-color: #38bdf8;
        color: #38bdf8;
    }

    /* Mobile header: logo left, customer centered, hamburger right */
    .header .cart-btn,
    .header .sync-header-wrap,
    .header .user-header-wrap {
        display: none !important;
    }
    /* Center without transform so position:fixed on the dropdown still uses the viewport */
    .header .header-customer {
        position: absolute;
        left: 0;
        right: 0;
        margin: 0 auto;
        width: fit-content;
        z-index: 1;
    }
    .hamburger-btn {
        margin-left: auto;
    }

    /* On mobile, show only the customer code when a customer is selected */
    .customer-pill.has-customer .customer-pill-name { display: none; }
    .customer-pill.has-customer .customer-pill-code--mobile-primary {
        display: inline;
        font-size: 0.85rem;
        font-family: inherit;
        opacity: 1;
        font-weight: 600;
    }
}

@media (max-width: 600px) {
    .page {
        padding: 1rem;
    }
    .detail-grid {
        grid-template-columns: 1fr;
    }
}

/* Map page layout */
.map-page-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 56px);
    overflow: hidden;
}

/* Title sits inside the edge-to-edge container so give it page-level padding */
.map-page-container > .page-title {
    padding: var(--page-padding) var(--page-padding) 0;
    flex-shrink: 0;
}

.map-topbar {
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 1rem;
    border-bottom: 1px solid var(--gray-200);
    background: var(--bg);
    flex-shrink: 0;
}

.map-topbar-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--gray-800);
}

.map-body {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
    z-index: 10;
}

.map-main {
    flex: 1;
    position: relative;
    min-height: 0;
}

.map-view {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
}

/* Fix Leaflet container in dark mode */
[data-theme="dark"] .leaflet-container {
    background: #1f2937;
}

[data-theme="dark"] .leaflet-popup-content-wrapper,
[data-theme="dark"] .leaflet-popup-tip {
    background: var(--bg);
    color: var(--gray-800);
}

[data-theme="dark"] .leaflet-control-zoom a {
    background: var(--bg);
    color: var(--gray-800);
}

[data-theme="dark"] .leaflet-control-attribution {
    background: rgba(31, 41, 55, 0.8);
    color: var(--gray-400);
}

.map-sidebar {
    width: 360px;
    min-width: 360px;
    background: var(--bg);
    border-left: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.28s ease, min-width 0.28s ease, border-left-width 0.28s ease;
    flex-shrink: 0;
}

.map-sidebar.sidebar-closed {
    width: 0;
    min-width: 0;
    border-left-width: 0;
}

.map-sidebar-inner {
    width: 360px;
    min-width: 360px;
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.map-results-count {
    margin-top: 0.75rem;
    font-size: 0.8rem;
    color: var(--gray-500);
    text-align: center;
}

/* Slider styling */
.slider-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.map-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: var(--gray-200);
    outline: none;
}

.map-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.map-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.map-slider:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.map-slider:disabled::-webkit-slider-thumb {
    cursor: not-allowed;
}

.slider-value {
    min-width: 50px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
    text-align: right;
}

.btn-location {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    background: var(--primary-light);
    color: var(--primary);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.15s;
}

.btn-location:hover {
    background: var(--primary);
    color: #fff;
}

.location-status {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.location-status.success {
    background: #f0fdf4;
    color: #166534;
}

.location-status.error {
    background: #fef2f2;
    color: #991b1b;
}

/* Customer list in sidebar */
.map-customer-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.map-customer-card {
    background: var(--bg);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 0.875rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: box-shadow 0.15s, border-color 0.15s;
}

.map-customer-card:hover {
    box-shadow: var(--shadow);
    border-color: var(--primary);
}

.map-customer-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.125rem;
}

.map-customer-code {
    font-size: 0.75rem;
    color: var(--gray-500);
    font-family: 'SF Mono', 'Consolas', monospace;
    margin-bottom: 0.25rem;
}

.map-customer-address {
    font-size: 0.75rem;
    color: var(--gray-600);
    margin-bottom: 0.5rem;
}

.map-customer-contact {
    font-size: 0.8rem;
    margin-bottom: 0.125rem;
}

.map-customer-contact a {
    color: var(--primary);
    text-decoration: none;
}

.map-customer-contact a:hover {
    text-decoration: underline;
}

/* Map loading and error states */
.map-loading,
.map-error {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    height: 100%;
    padding: 2rem;
    font-size: 0.9rem;
}

.map-loading {
    color: var(--gray-400);
}

.map-error {
    color: var(--danger);
    background: #fef2f2;
}

/* Map popup styling */
.map-popup {
    min-width: 180px;
}

.map-popup-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.5rem;
    padding-bottom: 0.375rem;
    border-bottom: 1px solid var(--gray-200);
}

.map-popup-field {
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

.map-popup-field a {
    color: var(--primary);
    text-decoration: none;
}

.map-popup-field a:hover {
    text-decoration: underline;
}

.map-popup-address {
    font-size: 0.75rem;
    color: var(--gray-600);
    margin-top: 0.25rem;
}

.map-popup-date {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 0.375rem;
    margin-bottom: 0.375rem;
}

.map-popup-addresses {
    margin-top: 0.5rem;
    padding-top: 0.375rem;
    border-top: 1px solid var(--gray-200);
}

.map-popup-address-row {
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.map-popup-address-row:last-child {
    border-bottom: none;
}

.map-popup-address-row--default .map-popup-address-label {
    color: var(--primary);
}

.map-popup-address-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-700);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.map-popup-address-default-badge {
    font-size: 0.65rem;
    background: var(--primary-light, #eff6ff);
    color: var(--primary);
    border-radius: 3px;
    padding: 0 0.3rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.map-popup-address-line {
    font-size: 0.75rem;
    color: var(--gray-600);
}

.map-popup-navigate-link {
    font-size: 0.72rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    align-self: flex-start;
}

.map-popup-navigate-link:hover {
    text-decoration: underline;
}

.map-popup-btn-navigate {
    background: var(--gray-50);
    color: var(--primary);
    border: 1.5px solid var(--primary);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.map-popup-btn-navigate:hover {
    background: var(--primary-light, #eff6ff);
}

/* Leaflet popup customization */
.leaflet-pane {
    z-index: 4 !important;
}

.leaflet-popup-content-wrapper {
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
}

.leaflet-popup-content {
    margin: 12px 14px;
}

/* Responsive map layout */
@media (max-width: 768px) {
    .map-body {
        position: relative;
        overflow: hidden;
    }

    .map-sidebar {
        position: absolute !important;
        right: 0;
        top: 0;
        bottom: 0;
        width: 90vw !important;
        min-width: 90vw !important;
        z-index: 900; /* above all Leaflet layers (max 800) */
        transform: translateX(100%);
        transition: transform 0.28s ease !important;
        border-left: 1px solid var(--gray-200) !important;
        box-shadow: -4px 0 24px rgba(0,0,0,0.12);
    }

    .map-sidebar.sidebar-open {
        transform: translateX(0) !important;
    }

    .map-sidebar.sidebar-closed {
        transform: translateX(100%) !important;
    }

    .map-sidebar-inner {
        width: 90vw;
        min-width: 90vw;
    }

    /* scoped to map-body so callplan backdrop is unaffected */
    .map-body .cp-sidebar-backdrop {
        display: block;
        position: absolute;
        inset: 0;
        background: rgba(0,0,0,0.3);
        z-index: 899;
    }
}

/* ================================
   Call Plan Page Styles
   ================================ */

/* Title sits inside the edge-to-edge container so give it page-level padding */
.callplan-container > .page-title {
    padding: var(--page-padding) var(--page-padding) 0;
    flex-shrink: 0;
}

.callplan-container {
    --callplan-time-col-width: 56px;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 56px);
    overflow: hidden;
}

/* ── Topbar ── */
.callplan-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 1.25rem;
    background: var(--bg);
    border-bottom: 1px solid var(--gray-200);
    flex-shrink: 0;
    gap: 0.75rem;
}

.callplan-week-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.callplan-nav-btn {
    width: 30px;
    height: 30px;
    border: none;
    background: none;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    border-radius: 6px;
    color: var(--gray-500);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s;
}

.callplan-nav-btn:hover {
    background: var(--gray-100);
    color: var(--gray-800);
}

.callplan-week-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--gray-800);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    text-decoration: underline dotted var(--gray-400);
    text-underline-offset: 3px;
    transition: background 0.12s;
    white-space: nowrap;
}

.callplan-week-title:hover {
    background: var(--gray-50);
}

.callplan-sidebar-toggle {
    width: 34px;
    height: 34px;
    border: 1.5px solid var(--gray-300);
    background: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--gray-600);
    transition: background 0.12s, border-color 0.12s;
}

.callplan-sidebar-toggle:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

.callplan-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.callplan-main {
    flex: 1;
    overflow: auto;
    background: var(--bg-page);
    scroll-snap-type: x mandatory;
    scroll-padding-left: var(--callplan-time-col-width);
}

.callplan-grid {
    display: flex;
    min-width: max-content;
}

.callplan-time-column {
    width: var(--callplan-time-col-width);
    flex-shrink: 0;
    background: var(--bg);
    border-right: 1px solid var(--gray-200);
    position: sticky;
    left: 0;
    z-index: 10;
}

/* Spacer aligns with the day-column headers */
.callplan-time-header-spacer {
    height: 68px;
    border-bottom: 2px solid var(--gray-200);
    flex-shrink: 0;
}

/* Continuous time axis content */
.callplan-time-content {
    position: relative;
}

.callplan-time-label-abs {
    position: absolute;
    right: 0.375rem;
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--gray-400);
    transform: translateY(-0.5em);
    white-space: nowrap;
    pointer-events: none;
}

.callplan-day-column {
    flex: 1;
    min-width: 240px;
    border-right: 1px solid var(--gray-200);
    scroll-snap-align: center;
}

.callplan-day-column:last-child {
    border-right: none;
}

.callplan-header-cell {
    height: 68px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    background: var(--bg);
    border-bottom: 2px solid var(--gray-200);
    cursor: pointer;
    transition: background 0.15s;
    padding: 0.25rem;
    position: relative;
}

.callplan-header-cell:hover {
    background: var(--gray-50);
}

.callplan-header-cell.selected {
    background: var(--primary-light);
    border-bottom-color: var(--primary);
}

.callplan-header-cell.today {
    position: relative;
}

.callplan-header-cell.today::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
}

.callplan-time-header {
    cursor: default;
}

.callplan-time-header:hover {
    background: var(--bg);
}

.callplan-header-day {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.callplan-header-date {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray-800);
}

/* Day content area — continuous absolute-positioned layout */
.callplan-day-content {
    position: relative;
    overflow: hidden;
}

/* Grid lines */
.cp-grid-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--gray-200);
    pointer-events: none;
    z-index: 1;
}

.cp-grid-line-half {
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--gray-100);
    border-top: 1px dashed var(--gray-150, #e8eaed);
    pointer-events: none;
    z-index: 1;
}

/* Out-of-bounds shading */
.cp-oob-shade {
    position: absolute;
    left: 0;
    right: 0;
    background: rgba(245, 158, 11, 0.08);
    pointer-events: none;
    z-index: 1;
}

/* Absolutely positioned appointment cards */
.callplan-appointment {
    position: absolute;
    left: 2px;
    right: 2px;
    color: #fff;
    border-radius: 4px;
    padding: 0.2rem 0.375rem 0.2rem;
    font-size: 0.75rem;
    cursor: pointer;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 1px 3px rgba(0,0,0,0.18);
    transition: transform 0.1s, box-shadow 0.1s;
    z-index: 3;
    user-select: none;
}

.callplan-appointment[draggable="true"] {
    cursor: grab;
}

.callplan-appointment[draggable="true"]:active {
    cursor: grabbing;
}

.callplan-appointment.compact {
    padding: 0.1rem 0.3rem;
    justify-content: center;
}

.callplan-appointment:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

/* Card body (scrollable content area) */
.callplan-apt-body {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    padding-right: 16px;
}

.callplan-apt-name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.75rem;
    line-height: 1.3;
}

.callplan-apt-type {
    font-size: 0.6rem;
    opacity: 0.85;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 1px;
}

.callplan-apt-addr {
    font-size: 0.6rem;
    opacity: 0.8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

/* Card footer — always pinned to bottom */
.callplan-apt-footer {
    display: flex;
    align-items: center;
    gap: 3px;
    margin-top: 2px;
    padding-right: 16px;
}

.callplan-apt-lock {
    font-size: 0.6rem;
    line-height: 1;
}

.callplan-apt-time-label {
    font-size: 0.63rem;
    opacity: 0.88;
    white-space: nowrap;
    overflow: hidden;
}

/* Compact mode: footer only (no body) */
.callplan-appointment.compact .callplan-apt-footer {
    margin-top: 0;
    padding-right: 14px;
}

.callplan-appointment.compact .callplan-apt-time-label {
    font-size: 0.6rem;
}

/* Locked card: slightly different cursor */
.callplan-appointment.locked {
    opacity: 0.92;
}

.callplan-appointment.status-complete,
.callplan-appointment.status-cancelled {
    opacity: 0.6;
}

/* Active call plan card — shimmer sweep on the coloured background */
.callplan-appointment.status-active::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 55%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255,255,255,0.28) 50%,
        transparent 100%
    );
    transform: translateX(-180%);
    animation: active-shimmer 2.6s ease-in-out infinite;
    mix-blend-mode: screen;
    pointer-events: none;
}

/* ── Optimise Route button — inside timeline at top of selected day ── */
@keyframes cp-optimise-shine {
    0%   { box-shadow: 0 0 0 0 rgba(var(--primary-rgb, 99,91,230), 0.85); }
    45%  { box-shadow: 0 0 0 7px rgba(var(--primary-rgb, 99,91,230), 0.35), 0 0 18px 4px rgba(var(--primary-rgb, 99,91,230), 0.25); }
    100% { box-shadow: 0 0 0 0 rgba(var(--primary-rgb, 99,91,230), 0); }
}

.callplan-optimise-btn {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.4rem 1rem;
    background: var(--primary);
    color: #fff;
    border: 2px solid rgba(255,255,255,0.25);
    border-radius: 20px;
    cursor: pointer;
    white-space: nowrap;
    letter-spacing: 0.03em;
    transition: background 0.15s, transform 0.15s;
    animation: cp-optimise-shine 1.4s ease-out forwards;
}

.callplan-optimise-btn:hover {
    background: var(--primary-dark, #5a52d5);
    transform: translateX(-50%) scale(1.04);
}


/* ── Sidebar (desktop: animated width; mobile: overlay) ── */
.callplan-sidebar {
    width: 340px;
    min-width: 340px;
    background: var(--bg);
    border-left: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.28s ease, min-width 0.28s ease, border-left-width 0.28s ease;
    flex-shrink: 0;
}

.callplan-sidebar.sidebar-closed {
    width: 0;
    min-width: 0;
    border-left-width: 0;
}

/* ── Sidebar sections ── */
.cp-section {
    border-bottom: 1px solid var(--gray-200);
    flex-shrink: 0;
}

.cp-section-header {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0.625rem 1rem;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    gap: 0.5rem;
    transition: background 0.1s;
}

.cp-section-header:hover {
    background: var(--gray-50);
}

.cp-section-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-800);
    flex: 1;
}

.cp-section-arrow {
    font-size: 0.65rem;
    color: var(--gray-400);
    flex-shrink: 0;
}

.cp-search-summary {
    font-size: 0.72rem;
    color: var(--gray-500);
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.cp-section-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.28s ease, padding 0.28s ease;
    padding: 0 1rem;
}

.cp-section-body.open {
    max-height: 800px;
    padding: 0.5rem 1rem 0.875rem;
}

/* ── Settings ── */
.cp-setting-group {
    margin-bottom: 0.875rem;
}

.cp-setting-label {
    font-size: 0.775rem;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 0.375rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.cp-day-toggles {
    display: flex;
    gap: 3px;
}

.cp-day-btn {
    width: 32px;
    height: 32px;
    border: 1.5px solid var(--gray-300);
    border-radius: 6px;
    background: none;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--gray-500);
    cursor: pointer;
    transition: all 0.12s;
    padding: 0;
}

.cp-day-btn.active {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
}

/* Dual range slider */
.dual-slider {
    position: relative;
    height: 22px;
    margin: 0.375rem 0 0;
}

.dual-slider-track {
    position: absolute;
    height: 4px;
    top: 9px;
    left: 0;
    right: 0;
    background: var(--gray-200);
    border-radius: 2px;
}

.dual-slider-fill {
    position: absolute;
    height: 4px;
    background: var(--primary);
    border-radius: 2px;
}

.dual-slider-input {
    position: absolute;
    left: 0;
    width: 100%;
    height: 4px;
    top: 9px;
    background: none;
    pointer-events: none;
    -webkit-appearance: none;
    appearance: none;
    outline: none;
}

.dual-slider-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary);
    pointer-events: all;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}

.dual-slider-input::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary);
    pointer-events: all;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.25);
    border: none;
}

.dual-slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--gray-600);
    margin-top: 0.375rem;
}

.cp-duration-select {
    width: 100%;
    font-size: 0.875rem;
    padding: 0.375rem 0.5rem;
}

/* ── Search criteria ── */
.cp-criterion {
    margin-bottom: 0.375rem;
    border-radius: 6px;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    transition: background 0.12s, opacity 0.12s;
    border: 1.5px solid transparent;
}

.cp-criterion--inactive {
    background: var(--gray-50);
    border-color: var(--gray-200);
}

.cp-criterion--inactive:hover {
    background: var(--gray-100);
    border-color: var(--gray-300);
}

.cp-criterion--active {
    background: rgba(22, 163, 74, 0.08);
    border-color: rgba(22, 163, 74, 0.3);
}

.cp-criterion--active:hover {
    background: rgba(22, 163, 74, 0.13);
}

/* Checkbox-style criterion (Requires Visit Only) */
.cp-criterion--checkbox {
    /* inherits active/inactive bg */
}

.cp-criterion-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 26px;
    pointer-events: none; /* clicks handled by parent .cp-criterion */
}

.cp-criterion-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-700);
}

/* Toggle indicator (+/×) — visual only, no onClick */
.cp-criterion-toggle {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1.5px solid var(--gray-400);
    background: none;
    font-size: 13px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-500);
    flex-shrink: 0;
    pointer-events: none;
}

.cp-criterion--active .cp-criterion-toggle {
    border-color: #16a34a;
    color: #16a34a;
}

.cp-criterion-toggle.remove {
    border-color: var(--danger, #dc2626);
    color: var(--danger, #dc2626);
}

.cp-criterion-input {
    margin-top: 0.3rem;
    width: 100%;
    font-size: 0.875rem;
    pointer-events: all;
}

.cp-criterion-checkbox {
    width: 18px;
    height: 18px;
    accent-color: #16a34a;
    cursor: pointer;
    flex-shrink: 0;
    pointer-events: all;
}

/* Distance controls */
.cp-distance-body {
    margin-top: 0.375rem;
}

.cp-location-btns {
    display: flex;
    gap: 0.375rem;
    margin-bottom: 0.375rem;
}

.cp-loc-btn {
    font-size: 0.775rem;
    font-weight: 500;
    padding: 0.2rem 0.5rem;
    border: 1.5px solid var(--gray-300);
    border-radius: 5px;
    background: none;
    color: var(--gray-700);
    cursor: pointer;
    transition: border-color 0.12s, color 0.12s;
}

.cp-loc-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.cp-distance-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.cp-distance-slider {
    flex: 1;
}

.cp-distance-number {
    width: 52px;
    padding: 0.2rem 0.3rem;
    border: 1.5px solid var(--gray-300);
    border-radius: 5px;
    font-size: 0.825rem;
    text-align: right;
    background: var(--bg);
    color: var(--gray-800);
}

.cp-distance-unit {
    font-size: 0.825rem;
    color: var(--gray-500);
}

.cp-search-btn {
    width: 100%;
    justify-content: center;
    margin-top: 0.75rem;
}

/* ── Results ── */
.cp-results {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.cp-results-count {
    padding: 0.375rem 1rem;
    font-size: 0.775rem;
    color: var(--gray-500);
    flex-shrink: 0;
}

.callplan-results-count {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--gray-500);
    text-align: center;
}

/* AI Button */
.btn-ai {
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-ai:hover {
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
}

.btn-ai:disabled {
    background: var(--gray-300);
}

.btn-ai svg {
    flex-shrink: 0;
}

/* Customer List */
.callplan-customer-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.callplan-customer-card {
    background: var(--bg);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: box-shadow 0.15s, border-color 0.15s, transform 0.1s;
}

.callplan-customer-card:hover {
    box-shadow: var(--shadow);
    border-color: var(--primary);
    transform: translateX(-2px);
}

.callplan-customer-card.requires-visit {
    border-left: 3px solid var(--danger);
}

.callplan-customer-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.callplan-customer-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-800);
}

.callplan-visit-badge {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.125rem 0.375rem;
    background: #fef2f2;
    color: #991b1b;
    border-radius: 4px;
    white-space: nowrap;
}

/* Smart compound status badge (replaces separate visit-badge calls) */
.callplan-status-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    white-space: nowrap;
}
.callplan-status-badge--active {
    background: #dcfce7;
    color: #15803d;
}
.callplan-status-badge--planned {
    background: #eff6ff;
    color: #1d4ed8;
}
.callplan-status-badge--complete {
    background: var(--gray-100);
    color: var(--gray-600);
}
.callplan-status-badge--required {
    background: #fef2f2;
    color: #991b1b;
}
.callplan-status-badge--never {
    background: #fef2f2;
    color: #7f1d1d;
    font-style: italic;
}

.callplan-customer-code {
    font-size: 0.7rem;
    color: var(--gray-500);
    font-family: 'SF Mono', 'Consolas', monospace;
    margin-bottom: 0.375rem;
}

.callplan-customer-address {
    font-size: 0.75rem;
    color: var(--gray-600);
    margin-bottom: 0.375rem;
    line-height: 1.4;
}

.callplan-customer-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.callplan-last-visit {
    font-size: 0.7rem;
    color: var(--gray-500);
}

.callplan-no-results {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--gray-400);
    font-size: 0.875rem;
}

/* ── Week Picker Modal ── */
.week-picker-panel {
    background: var(--bg);
    border-radius: 12px;
    padding: 1.125rem;
    width: 300px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}

.week-picker-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.875rem;
}

.week-picker-month {
    flex: 1;
    text-align: center;
    font-weight: 600;
    font-size: 0.925rem;
    color: var(--gray-800);
}

.week-picker-nav {
    width: 28px;
    height: 28px;
    border: none;
    background: var(--gray-100);
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-700);
    transition: background 0.1s;
}

.week-picker-nav:hover {
    background: var(--gray-200);
}

.week-picker-close {
    width: 28px;
    height: 28px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--gray-500);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.week-picker-close:hover {
    background: var(--gray-100);
}

.week-picker-day-headers {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    margin-bottom: 0.25rem;
}

.week-picker-day-name {
    text-align: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--gray-500);
    padding: 0.2rem 0;
}

.week-picker-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.1s;
}

.week-picker-row:hover,
.week-picker-row.hovered {
    background: var(--primary-light);
}

.week-picker-row.selected {
    background: var(--primary-light);
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}

.week-picker-day {
    text-align: center;
    font-size: 0.8rem;
    padding: 0.3rem 0;
    border-radius: 4px;
}

.week-picker-day.other-month {
    color: var(--gray-300);
}

.week-picker-day.today {
    font-weight: 700;
    color: var(--primary);
}

.week-picker-footer {
    padding: 0.6rem 1rem;
    border-top: 1px solid var(--gray-100);
    display: flex;
    justify-content: center;
}

.week-picker-today-link {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    transition: background 0.12s;
}

.week-picker-today-link:hover {
    background: var(--primary-light, rgba(99,91,230,0.08));
}

/* ── Location Picker Modal ── */
.location-picker-panel {
    background: var(--bg);
    border-radius: 12px;
    width: 580px;
    max-width: 92vw;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    max-height: 90vh;
}

.location-picker-header {
    display: flex;
    align-items: center;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--gray-200);
    gap: 0.75rem;
}

.location-picker-title {
    font-size: 0.975rem;
    font-weight: 600;
    flex: 1;
    color: var(--gray-800);
}

.location-picker-hint {
    padding: 0.5rem 1.25rem 0;
    font-size: 0.8rem;
    color: var(--gray-500);
    margin: 0;
}

.location-picker-map {
    height: 340px;
    flex-shrink: 0;
}

.location-picker-footer {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    border-top: 1px solid var(--gray-200);
    flex-wrap: wrap;
}

.location-picker-coords {
    font-size: 0.75rem;
    color: var(--gray-500);
    font-family: 'SF Mono', 'Consolas', monospace;
    margin-left: auto;
}

/* Mobile sidebar backdrop */
.cp-sidebar-backdrop {
    display: none;
}

/* ── Appointment Edit Modal ── */
.apt-edit-overlay {
    z-index: 200;
}

.apt-edit-panel {
    background: var(--bg);
    border-radius: 12px;
    width: 440px;
    max-width: 94vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    display: flex;
    flex-direction: column;
}

.apt-edit-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--gray-200);
    gap: 0.5rem;
}

.apt-edit-title {
    font-weight: 700;
    font-size: 1rem;
    color: var(--gray-900);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.apt-edit-body {
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}

/* Out-of-work-hours warning banner inside the appointment edit modal */
.apt-oowh-banner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: #fffbeb;
    border: 1px solid #f59e0b;
    border-radius: 6px;
    font-size: 0.825rem;
    color: #92400e;
    line-height: 1.4;
}

.apt-edit-row {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.apt-edit-row--inline {
    flex-direction: row;
    gap: 0.75rem;
}

.apt-edit-field {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.apt-edit-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.apt-locked-row {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding: 0.375rem 0.5rem;
    border-radius: 6px;
    transition: background 0.1s;
}

.apt-locked-row:hover {
    background: var(--gray-50);
}

.apt-locked-label {
    cursor: inherit;
}

/* Appointment type toggle */
.apt-type-toggle {
    display: flex;
    gap: 0.5rem;
}

.apt-type-btn {
    flex: 1;
    padding: 0.45rem 0.5rem;
    border: 1.5px solid var(--gray-300);
    border-radius: 6px;
    background: var(--bg);
    color: var(--gray-700);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.apt-type-btn:hover:not(.active) {
    border-color: var(--gray-400);
    background: var(--gray-50);
}

/* Address + geocode */
.apt-address-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.apt-address-input {
    flex: 1;
    min-width: 0;
}

.apt-geocode-btn {
    white-space: nowrap;
    font-size: 0.8rem;
    padding: 0.45rem 0.75rem;
}

.apt-geocode-msg {
    font-size: 0.75rem;
    margin-top: 0.2rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.apt-geocode-msg.ok {
    background: rgba(22, 163, 74, 0.1);
    color: #15803d;
    font-family: 'SF Mono', 'Consolas', monospace;
}

.apt-geocode-msg.err {
    background: rgba(220, 38, 38, 0.08);
    color: var(--danger, #dc2626);
}

.apt-edit-footer {
    display: flex;
    gap: 0.625rem;
    padding: 0.875rem 1.25rem;
    border-top: 1px solid var(--gray-200);
}

.apt-edit-delete-btn {
    margin-right: auto;
}

/* Timeline scale label (subtle) */
.cp-setting-label--subtle {
    color: var(--gray-400);
    font-size: 0.75rem;
}

/* ── Appointment type icon in footer ── */
.callplan-apt-type-icon {
    margin-left: auto;
    opacity: 0.85;
    flex-shrink: 0;
}

/* ── Overlap styles ── */
.callplan-apt-overlap-shade {
    position: absolute;
    left: 0;
    right: 0;
    background: rgb(220, 38, 38);
    opacity: 0.8;
    mix-blend-mode: color;
    pointer-events: none;
    z-index: 1;
}

.callplan-appointment.overlap-top {
    width: 90% !important;
    left: 5% !important;
    opacity: 0.9;
}

/* Bottom overlap card: raise on hover (desktop) or when focused (mobile tap) */
.callplan-appointment.overlap-bottom {
    z-index: 2;
}
.callplan-appointment.overlap-bottom:hover,
.callplan-appointment.overlap-bottom.focused {
    z-index: 4;
}

/* AUTO-FIX button */
.callplan-apt-autofix-btn {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    padding: 1px 5px;
    border-radius: 3px;
    border: none;
    cursor: pointer;
    color: #fff;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 1px 3px rgba(220,38,38,0.4), inset 0 1px 0 rgba(255,255,255,0.2);
    white-space: nowrap;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    transition: transform 0.1s, box-shadow 0.1s;
}
.callplan-apt-autofix-btn::after {
    content: '';
    position: absolute;
    top: 0; left: -60%; width: 40%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
    animation: cp-autofix-shine 2.2s infinite;
}
@keyframes cp-autofix-shine {
    0%   { left: -60%; }
    60%  { left: 120%; }
    100% { left: 120%; }
}
.callplan-apt-autofix-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 6px rgba(220,38,38,0.5);
}
.callplan-apt-autofix-btn:active {
    transform: scale(0.97);
}

/* ── Toast container ── */
.cp-toast-container {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}
.cp-toast {
    padding: 0.625rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: cp-toast-in 0.25s ease forwards;
    max-width: 320px;
}
@keyframes cp-toast-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.cp-toast--success { background: var(--success, #16a34a); }
.cp-toast--warning { background: #d97706; }
.cp-toast--danger  { background: var(--danger, #dc2626); }
.cp-toast--info    { background: var(--primary); }

/* ── Customer card states ── */
.callplan-customer-card.card-greyed {
    opacity: 0.45;
    pointer-events: none;
}
.callplan-customer-card.has-week-apt {
    opacity: 0.6;
    border-style: dashed;
    border-color: var(--gray-400);
}
.callplan-customer-card.has-week-apt:hover {
    border-color: var(--primary);
    opacity: 0.8;
}

/* ── Results sort bar ── */
.cp-results-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.5rem 0.25rem;
    flex-shrink: 0;
}
.cp-results-count {
    font-size: 0.75rem;
    color: var(--gray-500);
    flex: 1;
}
.cp-sort-select {
    font-size: 0.72rem;
    padding: 0.2rem 0.4rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--gray-700);
    cursor: pointer;
}

/* ── Confirm modal ── */
.cp-confirm-panel {
    background: var(--bg);
    border-radius: var(--radius-lg, 10px);
    box-shadow: var(--shadow-lg, 0 20px 60px rgba(0,0,0,0.2));
    width: min(360px, 90vw);
    overflow: hidden;
}
.cp-confirm-header {
    padding: 1rem 1.25rem 0.5rem;
    font-weight: 700;
    font-size: 1rem;
    color: var(--gray-800);
    border-bottom: 1px solid var(--gray-100);
}
.cp-confirm-body {
    padding: 0.875rem 1.25rem;
    font-size: 0.875rem;
    color: var(--gray-600);
    line-height: 1.5;
}
.cp-confirm-footer {
    display: flex;
    gap: 0.625rem;
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--gray-100);
}

/* ── Responsive Call Plan ── */
@media (max-width: 1100px) {
    .callplan-sidebar {
        width: 360px;
        min-width: 300px;
    }
}

@media (max-width: 768px) {
    .callplan-topbar {
        padding: 0.5rem 0.875rem;
    }

    .callplan-body {
        position: relative;
        overflow: hidden;
    }

    /* Sidebar becomes fixed overlay on mobile */
    .callplan-sidebar {
        position: absolute !important;
        right: 0;
        top: 0;
        bottom: 0;
        width: 90vw !important;
        min-width: 90vw !important;
        z-index: 50;
        transform: translateX(100%);
        transition: transform 0.28s ease !important;
        border-left: 1px solid var(--gray-200) !important;
        box-shadow: -4px 0 24px rgba(0,0,0,0.12);
    }

    .callplan-sidebar.sidebar-open {
        transform: translateX(0) !important;
    }

    .callplan-sidebar.sidebar-closed {
        transform: translateX(100%) !important;
    }

    .cp-sidebar-backdrop {
        display: block;
        position: absolute;
        inset: 0;
        background: rgba(0,0,0,0.3);
        z-index: 49;
    }

    .callplan-day-column {
        width: calc(100vw - 94px);
    }
}

/* ================================
   Modal Styles
   ================================ */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
    animation: fadeIn 0.15s ease;
}

.modal-panel {
    background: var(--bg);
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.2s ease;
}

@keyframes slideUp {
    from { transform: translateY(16px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-sm { width: 100%; max-width: 400px; }
.modal-md { width: 100%; max-width: 600px; }
.modal-lg { width: 100%; max-width: 800px; }
.modal-full { width: 100%; max-width: 95vw; height: 90vh; }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gray-200);
    flex-shrink: 0;
}

.modal-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--gray-500);
    font-size: 1.25rem;
    cursor: pointer;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.modal-close:hover {
    background: var(--gray-100);
    color: var(--gray-800);
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

/* ================================
   Dialog (themed alert / confirm)
   ================================ */

.dlg-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1rem;
    animation: fadeIn 0.15s ease;
}

.dlg-panel {
    background: var(--bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 380px;
    padding: 1.75rem 1.5rem 1.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.5rem;
    animation: slideUp 0.2s ease;
}

.dlg-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.25rem;
    flex-shrink: 0;
}

.dlg-icon-info {
    background: var(--primary-light);
    color: var(--primary);
}

.dlg-icon-danger {
    background: #fee2e2;
    color: var(--danger);
}

[data-theme="dark"] .dlg-icon-danger {
    background: rgba(239, 68, 68, 0.15);
}

.dlg-message {
    font-size: 0.9rem;
    color: var(--gray-700);
    line-height: 1.55;
    margin-bottom: 0.5rem;
}

.dlg-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    width: 100%;
    margin-top: 0.25rem;
}

.dlg-cancel {
    border: 1.5px solid var(--gray-300);
}

.dlg-panel-alert {
    align-items: stretch;
    text-align: left;
    gap: 0.75rem;
}

.dlg-inline {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.dlg-inline .dlg-icon {
    width: 36px;
    height: 36px;
    margin-bottom: 0;
    flex-shrink: 0;
}

.dlg-inline .dlg-message {
    margin-bottom: 0;
}

/* ================================
   Tab Component
   ================================ */

.tabs {
    display: flex;
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: 1rem;
    gap: 0;
}

.tab-btn {
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-500);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    font-family: inherit;
}

.tab-btn:hover {
    color: var(--gray-700);
    background: var(--gray-50);
    border-radius: var(--radius) var(--radius) 0 0;
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: var(--primary-light);
    border-radius: var(--radius) var(--radius) 0 0;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* ================================
   Sales Order Page Styles
   ================================ */

.so-page {
    max-width: 820px;
    margin: 0 auto;
    padding: 2rem;
}

.so-page.embedded {
    padding: 1.5rem 0 0;
}

.so-step-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    padding: 0.75rem;
    background: var(--bg);
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
}

.so-step {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-400);
    padding: 0.375rem 0.75rem;
    border-radius: 20px;
    transition: color 0.15s, background 0.15s;
}

.so-step.active {
    color: var(--primary);
    background: var(--primary-light);
}

.so-step.completed {
    color: var(--success);
}

.so-step-number {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    background: var(--gray-200);
    color: var(--gray-500);
}

.so-step.active .so-step-number {
    background: var(--primary);
    color: #fff;
}

.so-step.completed .so-step-number {
    background: var(--success);
    color: #fff;
}

.so-step-divider {
    width: 24px;
    height: 2px;
    background: var(--gray-200);
}

/* Customer card in sales order */
.so-customer-card {
    background: var(--bg);
    border: 2px solid var(--primary);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1rem;
    animation: fadeIn 0.2s ease;
}

.so-customer-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--gray-900);
}

.so-customer-info {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--gray-600);
}

/* Line items */
.so-line-item {
    background: var(--bg);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 0.875rem;
    margin-bottom: 0.5rem;
    transition: border-color 0.15s;
}

.so-line-item.price-error {
    border-color: var(--danger);
    background: #fef2f2;
}

.so-line-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.so-line-product {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-top: 0.25rem;
}

.so-line-code {
    font-size: 0.75rem;
    color: var(--gray-500);
    font-family: 'SF Mono', 'Consolas', monospace;
}

.so-line-fields {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.so-line-field {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.so-line-field label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.so-line-field input {
    width: 80px;
    padding: 0.375rem 0.5rem;
    font-size: 0.875rem;
    border: 1px solid var(--gray-200);
    border-radius: 4px;
    background: var(--bg);
    color: var(--gray-800);
}

.so-line-field input:focus {
    outline: none;
    border-color: var(--primary);
}

.so-line-field input.error {
    border-color: var(--danger);
}

.so-line-total {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-left: auto;
}

.so-line-actions {
    display: flex;
    gap: 0.375rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.so-line-btn {
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
    background: var(--gray-100);
    color: var(--gray-600);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.15s;
    font-family: inherit;
}

.so-line-btn:hover {
    background: var(--gray-200);
    color: var(--gray-800);
}

.so-line-btn.danger {
    color: var(--danger);
}

.so-line-btn.danger:hover {
    background: #fef2f2;
}

/* ---- Order lines table (tablet / desktop) ---- */
.so-lines-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.so-lines-table thead th {
    text-align: left;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
    white-space: nowrap;
}

.so-lt-row td {
    padding: 0.625rem 0.75rem;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}

.so-lt-row:last-child td {
    border-bottom: none;
}

.so-lt-row.price-error,
.so-lt-row.stock-error {
    background: #fef2f2;
}
.so-lt-row.stock-error td:first-child {
    box-shadow: inset 3px 0 0 var(--danger);
}

.so-lines-table .so-lt-product { width: 148px; }
.so-lines-table .so-lt-img    { width: 48px; }
.so-lines-table .so-lt-qty    { width: 116px; }
.so-lines-table .so-lt-price  { width: 110px; }
.so-lines-table .so-lt-total  { width: 82px; font-weight: 700; text-align: right; white-space: nowrap; color: var(--gray-800); }
.so-lines-table .so-lt-remove { width: 38px; text-align: center; }

/* shrink typeahead inside table cell */
.so-lt-product .search-container { margin: 0; }
.so-lt-product .search-input {
    font-size: 0.8rem;
    padding: 0.3rem 0.5rem;
    height: auto;
}

/* Product code as label (default state) */
.so-line-code-row {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.15rem;
}
.so-line-code {
    font-family: ui-monospace, monospace;
    font-size: 0.78rem;
    color: var(--gray-600);
    font-weight: 500;
}
.so-line-edit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    background: transparent;
    border: 1px solid transparent;
    color: var(--gray-500);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.12s;
}
.so-line-edit-btn:hover {
    background: var(--gray-100);
    border-color: var(--gray-300);
    color: var(--primary);
}

/* Editing state */
.so-line-edit-row { display: flex; align-items: center; gap: 0.35rem; }
.so-line-edit-row .search-container { flex: 1; }
.so-line-edit-input { border-color: var(--danger) !important; box-shadow: 0 0 0 1px var(--danger) !important; }
.so-line-edit-cancel {
    background: transparent;
    border: 1px solid var(--gray-300);
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    line-height: 1;
}
.so-line-edit-cancel:hover { border-color: var(--danger); background: rgba(239,68,68,0.06); }
/* product code shown as placeholder should look like real text */
.so-lt-product .search-input::placeholder {
    color: var(--gray-800);
    opacity: 1;
}

/* Product image — order table */
.so-line-img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    background: var(--bg);
    border-radius: 4px;
    border: 1px solid var(--gray-200);
    flex-shrink: 0;
    display: block;
}

/* Qty stepper */
.so-qty-ctrl {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    overflow: hidden;
}

.so-qty-btn {
    width: 28px;
    height: 30px;
    background: var(--gray-50);
    border: none;
    cursor: pointer;
    font-size: 1.05rem;
    color: var(--gray-600);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s;
    font-family: inherit;
    flex-shrink: 0;
    user-select: none;
}

.so-qty-btn:hover { background: var(--gray-200); }

.so-qty-input {
    width: 40px;
    height: 30px;
    text-align: center;
    border: none;
    border-left: 1px solid var(--gray-200);
    border-right: 1px solid var(--gray-200);
    font-size: 0.875rem;
    color: var(--gray-800);
    background: var(--bg);
    -moz-appearance: textfield;
}

.so-qty-input::-webkit-inner-spin-button,
.so-qty-input::-webkit-outer-spin-button { -webkit-appearance: none; }
.so-qty-input:focus { outline: none; }

.so-qty-display {
    width: 32px;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray-800);
    line-height: 30px;
}

/* Price override */
.so-price-display-wrap {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.so-price-display {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray-800);
}

.so-special-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.2rem 0.55rem;
    background: var(--success);
    color: #fff;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    flex-shrink: 0;
    line-height: 1;
    cursor: default;
    white-space: nowrap;
}

.so-price-input {
    display: block;
    width: 80px;
    padding: 0.3rem 0.4rem;
    font-size: 0.875rem;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    background: var(--bg);
    color: var(--gray-800);
}

.so-price-input.error { border-color: var(--danger); }
.so-price-input:focus { outline: none; border-color: var(--primary); }

.so-override-btn {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.64rem;
    padding: 0.1rem 0.35rem;
    background: transparent;
    border: 1px solid var(--gray-300);
    border-radius: 3px;
    color: var(--gray-500);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.12s;
}

.so-override-btn:hover { background: var(--gray-100); color: var(--gray-700); }

.so-price-error-sm {
    font-size: 0.62rem;
    color: var(--danger);
    margin-top: 0.2rem;
    max-width: 108px;
    line-height: 1.3;
}

/* Remove button */
.so-remove-btn {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: var(--gray-300);
    cursor: pointer;
    transition: all 0.12s;
}

.so-remove-btn:hover { background: #fef2f2; color: var(--danger); }

/* ---- Mobile cart ---- */
.so-cart-mobile { display: none; }

.so-cart-item {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.75rem;
    border-bottom: 1px solid var(--gray-100);
}

.so-cart-item:last-of-type { border-bottom: none; }
.so-cart-item.price-error { background: #fef2f2; }

.so-cart-img {
    width: 44px;
    height: 44px;
    object-fit: cover;
    background: var(--gray-100);
    border-radius: 4px;
    border: 1px solid var(--gray-200);
    flex-shrink: 0;
    display: block;
}

.so-cart-main {
    flex: 1;
    min-width: 0;
}

.so-cart-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.so-cart-code {
    font-size: 0.7rem;
    color: var(--gray-500);
    font-family: 'SF Mono', 'Consolas', monospace;
    margin-bottom: 0.25rem;
}

.so-cart-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.3rem;
    flex-shrink: 0;
}

.so-cart-total {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray-800);
}

.so-cart-unit {
    font-size: 0.68rem;
    color: var(--gray-400);
}

.so-cart-hint {
    font-size: 0.7rem;
    color: var(--gray-400);
    text-align: center;
    padding: 0.4rem;
    font-style: italic;
}

/* Mobile inline block inside product cell (visible only when table cols are hidden ≤639px) */
.so-lt-mobile-block { display: none; }
.so-lt-mob-total { font-weight: 700; font-size: 0.875rem; color: var(--gray-800); white-space: nowrap; }

/* Order summary */
.so-summary {
    background: var(--bg);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1rem;
    margin-top: 1rem;
}

.so-summary-row {
    display: flex;
    justify-content: space-between;
    padding: 0.375rem 0;
    font-size: 0.9rem;
    color: var(--gray-700);
}

.so-summary-row.total {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gray-900);
    border-top: 2px solid var(--gray-200);
    padding-top: 0.75rem;
    margin-top: 0.375rem;
}

/* Signature pad styles */
.signature-pad {
    text-align: center;
}

.signature-canvas {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius);
    cursor: crosshair;
    max-width: 100%;
    height: auto;
}

.signature-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 0.75rem;
}

.signature-preview {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 0.5rem;
    text-align: center;
}

.signature-preview img {
    max-width: 200px;
    max-height: 80px;
}

/* Camera styles */
.camera-capture {
    text-align: center;
}

.camera-preview {
    margin-bottom: 0.75rem;
}

.camera-video {
    width: 100%;
    max-width: 500px;
    border-radius: var(--radius);
    background: #000;
}

.camera-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.camera-error {
    padding: 1.5rem;
    text-align: center;
    color: var(--gray-600);
}

.camera-error p {
    margin-bottom: 0.75rem;
}

.camera-upload-label {
    cursor: pointer;
}

.camera-loading {
    padding: 2rem;
    color: var(--gray-400);
}

/* Photo thumbnails */
.so-photos {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.so-photo-thumb {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
}

.so-photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius);
    display: block;
}

.so-photo-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    border: none;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

/* Order status badges */
.so-status-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.so-status-badge.submitted {
    background: #eff6ff;
    color: #1d4ed8;
}

.so-status-badge.pending {
    background: #fefce8;
    color: #a16207;
}

.so-status-badge.synced {
    background: #f0fdf4;
    color: #15803d;
}

.so-status-badge.failed {
    background: #fef2f2;
    color: #991b1b;
}

/* Stock indicator colors */
.stock-high {
    color: var(--success);
    font-weight: 600;
}

.stock-medium {
    color: #d97706;
    font-weight: 600;
}

.stock-low {
    color: var(--danger);
    font-weight: 600;
}

/* Mini table for stock info */
.so-stock-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.so-stock-table th {
    text-align: left;
    padding: 0.5rem 0.625rem;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    border-bottom: 2px solid var(--gray-200);
}

.so-stock-table td {
    padding: 0.5rem 0.625rem;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
}

/* Button outline variant */
.btn-outline {
    background: transparent;
    color: var(--gray-600);
    border: 1.5px solid var(--gray-300);
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.btn-outline:hover {
    background: var(--gray-100);
    color: var(--gray-800);
    border-color: var(--gray-400);
}

.btn-outline.active {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}
.btn-scan-active {
    background: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 100%);
    color: #bfdbfe;
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
}
.btn-scan-active:hover { opacity: 0.85; }
.btn-scan-active::after {
    content: '';
    position: absolute;
    top: 0; bottom: 0; left: 0;
    width: 55%;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.45) 50%, transparent 100%);
    transform: translateX(-180%);
    animation: active-shimmer 2.6s ease-in-out infinite;
    mix-blend-mode: screen;
    pointer-events: none;
}
[data-theme="dark"] .btn-scan-active {
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
    color: #dbeafe;
}

/* ================================
   Draft Orders list (home page)
   ================================ */

.draft-list {
    display: flex;
    flex-direction: column;
    max-height: calc(4 * 5rem);
    overflow-y: auto;
}

.draft-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--gray-100);
}

@media (max-width: 600px) {
    .draft-row {
        flex-wrap: wrap;
    }
    .draft-row-body {
        width: 100%;
    }
    .draft-row-actions {
        width: 100%;
        justify-content: flex-end;
        padding-bottom: 0.25rem;
    }
}

.draft-row:last-child {
    border-bottom: none;
}

.draft-row-body {
    flex: 1;
    min-width: 0;
}

.draft-row-customer {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.draft-row-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
    font-size: 0.78rem;
    color: var(--gray-500);
}

.draft-row-sep {
    color: var(--gray-300);
}

.draft-row-total {
    font-weight: 600;
    color: var(--gray-700);
}

.draft-row-delete {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    color: var(--gray-400);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.draft-row-delete:hover {
    background: #fee2e2;
    color: var(--danger);
    border-color: var(--danger);
}

.draft-row-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}

.draft-row-load {
    height: 30px;
    padding: 0 0.6rem;
    font-size: 0.78rem;
    font-weight: 600;
    background: none;
    border: 1px solid var(--primary);
    border-radius: var(--radius);
    color: var(--primary);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.draft-row-load:hover {
    background: var(--primary);
    color: #fff;
}

/* Pending sync badge on nav */
.nav-badge {
    background: var(--danger);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    margin-left: 0.25rem;
}

/* Price error message */
.so-price-error {
    font-size: 0.75rem;
    color: var(--danger);
    margin-top: 0.25rem;
}

/* Confirmation page */
.so-confirm {
    text-align: center;
    padding: 2rem 0;
}

.so-confirm-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #f0fdf4;
    color: var(--success);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}

.so-confirm-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

.so-confirm-order-id {
    font-size: 1rem;
    color: var(--primary);
    font-family: 'SF Mono', 'Consolas', monospace;
    font-weight: 600;
    margin-bottom: 1rem;
}

.so-confirm-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 1.5rem;
}

/* Checkbox styled */
.so-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--gray-700);
    cursor: pointer;
    margin: 0.75rem 0;
}

.so-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

/* Review section */
.so-review-section {
    margin-bottom: 1.25rem;
}

.so-review-title {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    margin-bottom: 0.5rem;
    padding-bottom: 0.375rem;
    border-bottom: 1px solid var(--gray-200);
}

/* History bar chart container */
.so-history-chart {
    height: 200px;
    margin-bottom: 1rem;
}

.so-history-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.so-history-stat {
    text-align: center;
    padding: 0.75rem;
    background: var(--gray-50);
    border-radius: var(--radius);
}

.so-history-stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
}

.so-history-stat-label {
    font-size: 0.75rem;
    color: var(--gray-500);
}

/* Responsive sales order */
@media (max-width: 639px) {
    .so-page {
        padding: 1rem;
    }
    .so-page.embedded {
        padding: 0.75rem 0 0;
    }

    .so-step-indicator {
        flex-wrap: wrap;
        gap: 0.25rem;
    }

    .so-step {
        font-size: 0.7rem;
        padding: 0.25rem 0.5rem;
    }

    .so-step-divider {
        width: 12px;
    }

    .so-customer-info {
        flex-direction: column;
        gap: 0.25rem;
    }

    .so-history-stats {
        grid-template-columns: 1fr;
    }

    .so-confirm-actions {
        flex-direction: column;
    }

    /* Responsive table — hide price/qty/total/remove cols, show mobile block in product cell */
    .so-lines-table .so-lt-price,
    .so-lines-table .so-lt-qty,
    .so-lines-table .so-lt-total,
    .so-lines-table .so-lt-remove { display: none; }
    .so-lt-mobile-block { display: block !important; }
    .so-lt-mob-row {
        display: flex;
        align-items: center;
        gap: 0.4rem;
        margin-top: 0.4rem;
        flex-wrap: wrap;
    }
}

/* ============================================================
   Account / Customer Page
   ============================================================ */

.account-page {
    /* padding via .page-wide */
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.note-type-badge { display: inline-flex; align-items: center; gap: 0.25rem; }
.badge-success { background: #dcfce7; color: #15803d; }
.badge-danger  { background: #fee2e2; color: #b91c1c; }
.badge-warning { background: #fef9c3; color: #854d0e; }
.badge-primary { background: var(--primary-light); color: var(--primary); }

[data-theme="dark"] .badge-success { background: #14532d; color: #4ade80; }
[data-theme="dark"] .badge-danger  { background: #450a0a; color: #f87171; }
[data-theme="dark"] .badge-warning { background: #422006; color: #fcd34d; }

/* Account header */
.account-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1rem 1.25rem;
}

.account-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.account-info {
    flex: 1;
    min-width: 0;
}

.account-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gray-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.account-code {
    font-size: 0.8rem;
    color: var(--gray-500);
    font-family: 'SF Mono', 'Consolas', monospace;
}

.account-balance-block {
    text-align: right;
    flex-shrink: 0;
}

.account-balance-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gray-500);
}

.account-balance {
    font-size: 1.3rem;
    font-weight: 700;
}

.account-balance.positive { color: var(--success); }
.account-balance.negative { color: var(--danger); }

/* Tab navigation */
.tab-nav {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 0;
    border-bottom: 2px solid var(--gray-200);
    padding-bottom: 0;
}

.tab-btn {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-500);
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    border-radius: 0;
}

.tab-btn:hover {
    color: var(--gray-800);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

.tab-content {
    padding: 1.5rem;
}

@media (max-width: 768px) {
    .tab-nav {
        overflow-x: auto;
        flex-wrap: nowrap;
        scrollbar-width: none;
    }
    .tab-nav::-webkit-scrollbar {
        display: none;
    }
    .tab-btn {
        white-space: nowrap;
        flex-shrink: 0;
    }
}

/* Filter bar */
/* gap: replaced with margins — flex gap unsupported in Safari < iOS 14.5 */
.filter-bar {
    display: flex;
    align-items: flex-end;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    margin-top: -0.5rem;
}

.filter-bar > * {
    margin-top: 0.5rem;
}

.filter-bar > * + * {
    margin-left: 0.75rem;
}

.filter-bar-dates {
    display: flex;
    flex: 1;
    flex-wrap: wrap;
}

.filter-bar-dates > * + * {
    margin-left: 0.75rem;
}

.filter-field {
    display: flex;
    flex-direction: column;
    min-width: 140px;
}

.filter-field .form-label {
    margin-bottom: 0.25rem;
}

.filter-field-search {
    flex: 1;
    min-width: 180px;
}

.filter-apply-btn {
    align-self: flex-end;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

/* History table */
.history-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
}

.history-table {
    min-width: 620px;
    overflow: hidden;
}

.history-table-head {
    display: grid;
    grid-template-columns: 1.6fr 1fr 1fr 0.6fr 1fr;
    gap: 0;
    background: var(--gray-50);
    padding: 0.625rem 1rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    border-bottom: 1px solid var(--gray-200);
}

.history-table-head > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-table-row {
    display: grid;
    grid-template-columns: 1.6fr 1fr 1fr 0.6fr 1fr;
    gap: 0;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--gray-100);
    cursor: pointer;
    transition: background 0.1s;
    align-items: center;
}

.history-table-row > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-table-row:last-child { border-bottom: none; }

.history-table-row:hover { background: var(--primary-light); }

/* Prospects table — 6 columns: Account No, Name, Email, Phone, Status, Action */
.prospects-table .history-table-head,
.prospects-table .history-table-row {
    grid-template-columns: 1fr 1.5fr 1.5fr 1fr 0.7fr 0.5fr;
}

@media (max-width: 640px) {
    .prospects-table .history-table-head,
    .prospects-table .history-table-row {
        grid-template-columns: 1.2fr 1.5fr 0.8fr 0.5fr;
        font-size: 0.8rem;
    }

    /* Hide Email (3rd) and Phone (4th) on mobile */
    .prospects-table .history-table-head span:nth-child(3),
    .prospects-table .history-table-row span:nth-child(3),
    .prospects-table .history-table-head span:nth-child(4),
    .prospects-table .history-table-row span:nth-child(4) {
        display: none;
    }
}

.history-id {
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 0.8rem;
    color: var(--primary);
    font-weight: 600;
}

.history-id-lg {
    font-size: 0.95rem;
    font-weight: 700;
}

.history-id-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.history-id-wrap .history-webref-sub {
    margin-left: 0;
}

.history-webref-sub {
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-left: 0.5rem;
}

@media (max-width: 640px) {
    .history-webref-sub {
        display: block;
        margin-left: 0;
        margin-top: 0.15rem;
    }
}

.history-webref {
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.history-po {
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 0.8rem;
}

.history-total {
    font-weight: 600;
}

.history-pending-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
    margin-left: 0.375rem;
    vertical-align: middle;
}

.history-table-row--pending {
    background: #fffbeb;
}

.history-offline-note {
    font-size: 0.8rem;
    color: var(--gray-500);
    text-align: center;
    padding: 0.5rem 0 0.25rem;
    font-style: italic;
}

.text-right { text-align: right; }

/* Transaction detail modal extras */
.tx-invoice-link {
    color: var(--primary);
    text-decoration: underline;
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 0.875rem;
}

.tx-meta-row-narrative .tx-meta-value {
    line-height: 1.6;
    font-size: 0.875rem;
    color: var(--gray-600);
}

/* Pagination bar */
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.875rem;
    font-size: 0.875rem;
    color: var(--gray-600);
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pagination-nav {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.pagination-page {
    min-width: 90px;
    text-align: center;
    font-size: 0.875rem;
}

.pagination-size {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

/* Address cards */
.addresses-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.section-subtitle {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
}

.address-card {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.75rem;
    background: var(--bg);
    transition: border-color 0.15s;
}

.address-card-default {
    border-color: var(--primary);
    background: var(--primary-light);
}

.address-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.address-label {
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
}

.address-card-actions {
    display: flex;
    gap: 0.25rem;
}

.btn-icon {
    background: none;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 0.3rem;
    cursor: pointer;
    color: var(--gray-600);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.1s, color 0.1s;
}

.btn-icon:hover { background: var(--gray-100); color: var(--gray-900); }

.btn-icon-danger:hover { background: #fee2e2; color: var(--danger); border-color: var(--danger); }

.address-body {
    font-size: 0.875rem;
    color: var(--gray-600);
    line-height: 1.6;
}

/* Address form */
.address-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 0.5rem;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.85rem;
}

/* Transaction detail modal */
.tx-detail {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.tx-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--gray-200);
}

.tx-detail-meta {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.tx-meta-row {
    display: flex;
    gap: 0.75rem;
    font-size: 0.875rem;
    align-items: baseline;
}

.tx-meta-label {
    font-weight: 600;
    color: var(--gray-500);
    min-width: 80px;
    font-size: 0.8rem;
}

.tx-meta-value {
    color: var(--gray-800);
}

.tx-detail-total {
    text-align: right;
    flex-shrink: 0;
}

.tx-total-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
}

.tx-total-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
}

/* Transaction line items */
.tx-lines {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    overflow: hidden;
}

.tx-lines-header {
    display: grid;
    grid-template-columns: 44px 1fr 60px 60px 90px 90px;
    padding: 0.5rem 0.75rem;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    gap: 0.5rem;
    align-items: center;
}

.tx-line-row {
    display: grid;
    grid-template-columns: 44px 1fr 60px 60px 90px 90px;
    padding: 0.625rem 0.75rem;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.875rem;
    gap: 0.5rem;
    align-items: center;
}

.tx-line-row:last-child { border-bottom: none; }

.tx-col-img { display: flex; align-items: center; }
.tx-col-qty, .tx-col-uom, .tx-col-price, .tx-col-total { text-align: right; }

.tx-product-img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: 4px;
    border: 1px solid var(--gray-200);
    background: var(--bg);
}

.tx-product-name {
    font-weight: 500;
    font-size: 0.875rem;
}

.tx-product-code {
    font-size: 0.75rem;
    color: var(--gray-500);
    font-family: 'SF Mono', 'Consolas', monospace;
}
.tx-line-note {
    font-size: 0.75rem;
    color: var(--gray-600);
    font-style: italic;
    margin-top: 0.2rem;
}

.tx-col-total { font-weight: 600; }

.tx-line-total-row {
    display: flex;
    justify-content: space-between;
    padding: 0.625rem 0.75rem;
    background: var(--gray-50);
    font-weight: 700;
    font-size: 0.9rem;
    border-top: 2px solid var(--gray-200);
}

/* Order attachments (photos / signature in detail modal) */
.tx-attachments {
    margin-bottom: 1rem;
    padding: 0.875rem 1rem;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
}

.tx-attachments-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    margin-bottom: 0.625rem;
}

.tx-attachments-grid {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tx-attachment-thumb {
    width: 80px;
    height: 80px;
    border-radius: var(--radius);
    border: 2px solid var(--gray-200);
    overflow: hidden;
    cursor: pointer;
    padding: 0;
    background: var(--gray-100);
    transition: border-color 0.15s;
}

.tx-attachment-thumb:hover {
    border-color: var(--primary);
}

.tx-attachment-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Email dialog */
.email-dialog {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1rem;
}

.email-dialog-inner {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.email-dialog-inner .form-input {
    flex: 1;
    min-width: 200px;
}

.email-success {
    color: var(--success);
    font-weight: 500;
    font-size: 0.9rem;
}

.email-error {
    color: var(--danger);
    font-weight: 500;
    font-size: 0.9rem;
}

/* Email quote/order modal overlay — stacks above transaction detail modal */
.email-modal-overlay {
    z-index: 1100;
}

/* Email address suggestion chips */
.email-chip-list {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    margin-bottom: 0.625rem;
}

.email-chip {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    background: var(--gray-50);
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s, background 0.15s;
    width: 100%;
    font-size: inherit;
}

.email-chip:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.email-chip.selected {
    border-color: var(--primary);
    background: var(--primary-light);
}

.email-chip-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--gray-700);
    line-height: 1.3;
}

.email-chip-addr {
    font-size: 0.78rem;
    color: var(--gray-500);
}

.email-chip-check {
    color: var(--primary);
    font-size: 0.8rem;
}

/* Manually-added recipient pills */
.email-recipients-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-top: 0.5rem;
}

.email-recipient-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.5rem;
    background: var(--primary-light);
    border: 1px solid var(--primary);
    border-radius: 999px;
    font-size: 0.8rem;
    color: var(--gray-700);
}

.email-recipient-pill-remove {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-size: 1rem;
    line-height: 1;
    color: var(--gray-500);
    display: flex;
    align-items: center;
}

.email-recipient-pill-remove:hover {
    color: var(--danger);
}

/* PDF lightbox */
.pdf-lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 1100;
    display: flex;
    align-items: stretch;
    justify-content: center;
}

.pdf-lightbox-panel {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 960px;
    margin: 1rem;
    background: #fff;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.35);
}

.pdf-lightbox-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--gray-100);
    border-bottom: 1px solid var(--gray-200);
    font-weight: 600;
    font-size: 0.9375rem;
}

.pdf-lightbox-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-500);
    padding: 0.25rem;
    display: flex;
    align-items: center;
    border-radius: 0.25rem;
}

.pdf-lightbox-close:hover {
    color: var(--gray-800);
    background: var(--gray-200);
}

.pdf-lightbox-frame {
    flex: 1;
    border: none;
    width: 100%;
    min-height: 0;
}

/* Transaction action buttons */
.tx-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    flex-wrap: wrap;
    padding-top: 0.5rem;
    border-top: 1px solid var(--gray-200);
}

/* Tablet: filter-bar-dates (From/To/Product) fills row 1; Type, Status, Apply wrap to row 2 */
@media (min-width: 641px) and (max-width: 900px) {
    .filter-bar {
        flex-wrap: wrap;
    }

    .filter-bar-dates {
        flex: none;
        width: 100%;
    }

    .filter-bar > * + * {
        margin-left: 0;
    }

    .filter-bar > .filter-field + .filter-field,
    .filter-bar > .filter-field + .filter-apply-btn {
        margin-left: 0.75rem;
    }

    .filter-apply-btn {
        margin-top: 0.5rem;
    }
}

/* Responsive */
@media (max-width: 640px) {
    .account-header {
        flex-wrap: wrap;
    }

    .account-balance-block {
        width: 100%;
        text-align: left;
        padding-top: 0.5rem;
        border-top: 1px solid var(--gray-200);
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
        margin-top: 0;
    }

    .filter-bar > * {
        margin-top: 0;
    }

    .filter-bar > * + * {
        margin-left: 0;
        margin-top: 0.75rem;
    }

    .filter-bar-dates {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-bar-dates > * + * {
        margin-left: 0;
        margin-top: 0.5rem;
    }

    .filter-bar-dates .filter-field {
        min-width: 0;
    }

    .filter-apply-btn {
        width: 100%;
        justify-content: center;
    }

    .tx-lines-header,
    .tx-line-row {
        grid-template-columns: 36px 1fr 50px 70px 70px;
        font-size: 0.8rem;
    }

    .tx-col-uom { display: none; }

    .tx-lines-header span:nth-child(4),
    .tx-line-row span:nth-child(4) { display: none; }

    .tx-actions {
        flex-direction: column;
    }

    .form-row-2 {
        grid-template-columns: 1fr;
    }

    .modal-panel {
        height: 90vh;
    }

    .modal-panel.modal-sm {
        height: auto;
        max-height: 90vh;
    }
}

/* ============================================================
   Sidebar logo
   ============================================================ */
.sidebar-logo-full {
    max-width: 160px;
    width: 100%;
    height: auto;
    max-height: 44px;
    object-fit: contain;
    object-position: left center;
    display: block;
    flex-shrink: 0;
}

.sidebar-logo-icon {
    width: 36px;
    height: 36px;
    object-fit: contain;
    object-position: center center;
    display: none;
    flex-shrink: 0;
}

.sidebar.collapsed .sidebar-logo-full { display: none; }
.sidebar.collapsed .sidebar-logo-icon { display: block; }

/* ============================================================
   Header customer selector
   ============================================================ */
.header-customer {
    position: relative;
}

.customer-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.3rem 0.65rem;
    border-radius: 0;
    border: 1px solid var(--gray-300);
    background: var(--gray-50);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--gray-600);
    white-space: nowrap;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
    font-family: inherit;
}

.customer-pill:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.customer-pill.has-customer {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
    border-radius: var(--radius);
}

[data-theme="dark"] .customer-pill {
    background: rgba(176,171,255,0.08);
    border-color: rgba(176,171,255,0.25);
    color: rgba(176,171,255,0.75);
}

[data-theme="dark"] .customer-pill:hover {
    border-color: var(--brand-lavender);
    color: var(--brand-lavender);
    background: rgba(176,171,255,0.15);
}

[data-theme="dark"] .customer-pill.has-customer {
    background: rgba(176,171,255,0.15);
    border-color: var(--brand-lavender);
    color: var(--brand-lavender);
}

.customer-pill-name {
    overflow: hidden;
    text-overflow: ellipsis;
}

.customer-pill-code {
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 0.72rem;
    opacity: 0.65;
    flex-shrink: 0;
}

.customer-picker-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 340px;
    background: var(--bg);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.08);
    padding: 0.5rem;
    z-index: 500;
}

[data-theme="dark"] .customer-picker-dropdown {
    border-color: var(--gray-700);
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.recent-customers-section {
    margin-top: 0.25rem;
    border-top: 1px solid var(--gray-200);
    max-height: 240px;
    overflow-y: auto;
}

[data-theme="dark"] .recent-customers-section {
    border-top-color: var(--gray-700);
}

.recent-customers-label {
    padding: 0.3rem 1rem 0.2rem;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    user-select: none;
}

/* ── Customer picker dropdown — sections ───────────────────────────────────── */

.cpd-section-label {
    padding: 0.3rem 0.75rem 0.2rem;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    user-select: none;
}

.cpd-current-customer {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    margin-bottom: 0.35rem;
    cursor: pointer;
    transition: background 0.12s;
    border: 1px solid var(--primary-light, #ede9fe);
    background: var(--primary-light, #ede9fe);
}

.cpd-current-customer:hover,
.cpd-current-customer:focus {
    background: var(--primary-light-hover, #ddd6fe);
    border-color: var(--primary, #7c6fff);
    outline: none;
}

.cpd-current-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--primary, #7c6fff);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cpd-current-code {
    font-size: 0.75rem;
    font-family: 'SF Mono', 'Consolas', monospace;
    color: var(--gray-500);
    opacity: 0.85;
}

.cpd-change-section {
    border-top: 1px solid var(--gray-200);
    padding-top: 0.35rem;
    margin-top: 0.1rem;
}

[data-theme="dark"] .cpd-current-customer {
    background: rgba(124,111,255,0.15);
    border-color: rgba(124,111,255,0.35);
}

[data-theme="dark"] .cpd-current-customer:hover,
[data-theme="dark"] .cpd-current-customer:focus {
    background: rgba(124,111,255,0.25);
    border-color: rgba(124,111,255,0.6);
}

[data-theme="dark"] .cpd-current-name {
    color: var(--brand-lavender, #b0abff);
}

[data-theme="dark"] .cpd-change-section {
    border-top-color: var(--gray-700);
}

@media (max-width: 600px) {
    .customer-pill-code { display: none; }
    .customer-pill-code--mobile-primary { display: inline; }
    .customer-picker-dropdown {
        position: fixed;
        top: 60px;
        left: 0.75rem;
        right: 0.75rem;
        width: auto;
    }
}

.rep-search-input {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 0.45rem 0.75rem;
    margin-bottom: 0.25rem;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 6px;
    font-size: 0.85rem;
    background: var(--bg);
    color: var(--text);
    outline: none;
    font-family: inherit;
}
.rep-search-input:focus {
    border-color: var(--brand-violet);
    box-shadow: 0 0 0 2px rgba(124,111,255,0.15);
}
[data-theme="dark"] .rep-search-input {
    background: var(--gray-800, #1f2937);
    border-color: var(--gray-600, #4b5563);
    color: var(--text);
}

.rep-dropdown-list {
    max-height: 260px;
    overflow-y: auto;
}

.rep-dropdown-item {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    border-radius: 4px;
    cursor: pointer;
    color: var(--text);
    transition: background 0.1s;
}
.rep-dropdown-item:hover {
    background: var(--gray-50, #f9fafb);
}
.rep-dropdown-item--active {
    background: rgba(124, 111, 255, 0.08);
    color: var(--brand-violet);
    font-weight: 600;
}
[data-theme="dark"] .rep-dropdown-item:hover {
    background: rgba(255,255,255,0.06);
}
[data-theme="dark"] .rep-dropdown-item--active {
    background: rgba(56,189,248,0.12);
    color: var(--brand-lavender, #38bdf8);
}

/* ============================================================
   Customer page — new-order tab
   ============================================================ */
.no-customer-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3.5rem 2rem;
    text-align: center;
    color: var(--gray-500);
    font-size: 1rem;
    gap: 0.5rem;
}

.new-order-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    padding: 2.5rem 2rem;
}

.new-order-customer-card {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.new-order-hint {
    color: var(--gray-500);
    font-size: 0.9rem;
    margin: 0;
}

.new-order-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.btn-lg {
    padding: 0.7rem 1.75rem;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
}

/* ============================================================
   Customer page — account info tab
   ============================================================ */
.account-info-tab {
    padding: 0.25rem 0;
}

.account-info-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.account-info-details {
    flex: 1;
    min-width: 0;
}

.account-avatar.lg {
    width: 64px;
    height: 64px;
    font-size: 1.3rem;
}

@media (max-width: 640px) {
    .account-info-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .account-balance-block {
        width: 100%;
    }
}

/* ---- Account Info Tab — Enhanced Sections ---- */
.ai-callplan-btn {
    margin-left: auto;
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.78rem;
}

.ai-stop-credit-badge {
    font-size: 0.72rem;
    text-transform: none;
    letter-spacing: 0;
}

/* Detail grid (label / value pairs) */
.ai-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem 2rem;
}

.ai-detail-row {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.ai-detail-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.ai-detail-value {
    font-size: 0.925rem;
    font-weight: 500;
    color: var(--gray-900);
    word-break: break-word;
}

.ai-detail-value a {
    color: var(--primary);
    text-decoration: none;
}
.ai-detail-value a:hover { text-decoration: underline; }

@media (max-width: 480px) {
    .ai-detail-grid { grid-template-columns: 1fr; }
}

/* Credit info grid */
.ai-credit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.75rem;
}

.ai-credit-item {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 0.65rem 0.85rem;
}

.ai-credit-item-total {
    background: var(--primary-light);
    border-color: var(--primary-mid);
}

.ai-credit-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.2rem;
}

.ai-credit-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--gray-800);
}

.ai-credit-item-total .ai-credit-label { color: var(--primary-dark); }
.ai-credit-item-total .ai-credit-value { color: var(--primary-dark); }

/* Contacts table */
.ai-contacts-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.ai-contacts-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.ai-contacts-table th {
    text-align: left;
    padding: 0.5rem 0.75rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
}

.ai-contacts-table td {
    padding: 0.6rem 0.75rem;
    color: var(--gray-800);
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}

.ai-contacts-table tbody tr:last-child td { border-bottom: none; }

.ai-contacts-table a {
    color: var(--primary);
    text-decoration: none;
    white-space: nowrap;
}
.ai-contacts-table a:hover { text-decoration: underline; }

/* Location map */
.ai-map-container {
    height: 300px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--gray-200);
}

@media (max-width: 640px) {
    .ai-map-container { height: 220px; }
}

/* Call History Timeline */
.ai-timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.ai-timeline-entry {
    display: flex;
    gap: 0.85rem;
    cursor: pointer;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--gray-100);
    position: relative;
}

.ai-timeline-entry:last-child { border-bottom: none; }

.ai-timeline-entry--clickable:hover {
    background: var(--gray-50);
    border-radius: 6px;
}

.ai-timeline-dot {
    flex-shrink: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-top: 0.45rem;
}

.dot-visit { background: var(--success); }
.dot-appt  { background: var(--primary); }

.ai-timeline-content {
    flex: 1;
    min-width: 0;
}

.ai-timeline-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    user-select: none;
}

.ai-timeline-date {
    font-size: 0.78rem;
    color: var(--gray-500);
    white-space: nowrap;
    flex-shrink: 0;
}

.ai-timeline-summary {
    flex: 1;
    font-size: 0.875rem;
    color: var(--gray-800);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ai-timeline-chevron {
    flex-shrink: 0;
    color: var(--gray-400);
    transition: transform 0.2s ease;
}

.ai-timeline-entry.expanded .ai-timeline-chevron {
    transform: rotate(180deg);
}

.ai-timeline-body {
    margin-top: 0.65rem;
    padding-top: 0.65rem;
    border-top: 1px dashed var(--gray-200);
}

.ai-timeline-detail { display: flex; flex-direction: column; gap: 0.75rem; }

.ai-timeline-body-html {
    font-size: 0.875rem;
    max-height: 200px;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.ai-timeline-no-body {
    font-size: 0.85rem;
    color: var(--gray-500);
    font-style: italic;
}

.ai-timeline-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* ---- Notes Tab ---- */
.notes-tab {}

.notes-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
}

.notes-filter-bar .filter-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 130px;
}

.notes-filter-bar .filter-field-search {
    flex: 1;
    min-width: 180px;
}

.notes-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.note-card {
    border: 1px solid var(--border);
    border-left: 3px solid transparent;
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.75rem;
    background: var(--surface);
    transition: border-left-color 0.2s, background-color 0.2s;
}

.note-card:last-child { margin-bottom: 0; }

/* ── Overdue task styling (shared) ────────────────────────────────────────── */
.note-card--overdue,
.task-card--overdue,
.todo-item--overdue,
.ai-timeline-entry--overdue {
    border-left-color: var(--danger) !important;
    background: color-mix(in srgb, var(--danger) 4%, transparent);
}
.note-card--overdue:hover,
.task-card--overdue:hover,
.todo-item--overdue:hover {
    background: color-mix(in srgb, var(--danger) 8%, transparent);
}
.badge-overdue {
    background: var(--danger, #ef4444);
    color: #fff;
    border-radius: 0.75rem;
    padding: 0.18rem 0.55rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

/* Assigned-rep tag (manager view of prospects) */
.assigned-rep-tag {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.1rem 0.45rem;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--gray-600);
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: 0.75rem;
    vertical-align: middle;
}

/* Per-type left border — driven by --ntc CSS variable set inline per card from NOTE_TYPE_CONFIG */
.note-card                                                            { border-left-color: color-mix(in srgb, var(--ntc, #9ca3af) 30%, transparent); }
.note-card:hover                                                      { border-left-color: var(--ntc, #9ca3af); background-color: color-mix(in srgb, var(--ntc, #9ca3af) 5%, transparent); }

.note-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.note-card-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.note-card-actions {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}

.note-card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.note-meta-item {
    color: var(--text-muted);
}

.note-meta-date {
    margin-left: auto;
}

.note-body {
    font-size: 0.875rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--border);
    padding-top: 0.5rem;
    margin-top: 0.25rem;
    /* Quill ql-editor resets */
    padding-left: 0;
    min-height: unset;
}

/* Modified-by link in note meta row */
.note-meta-modified {
    background: none;
    border: none;
    padding: 0;
    font-size: inherit;
    color: var(--primary);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.note-meta-modified:hover { color: var(--primary-dark); }

/* Modal backdrop/panel (shared by note history and any future inline modals) */
.tx-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.tx-modal-panel {
    background: var(--bg);
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    max-height: 85vh;
    width: 100%;
    overflow: hidden;
}

.tx-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.tx-modal-body {
    overflow-y: auto;
    padding: 1.25rem;
    flex: 1;
}

/* Note edit history modal */
.note-history-modal { max-width: 580px; }

.note-history-title {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 1.25rem;
    color: var(--text-primary);
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

/* Timeline */
.note-history-timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.note-history-node {
    position: relative;
    padding: 0.9rem 0 0.9rem 1.25rem;
    border-left: 2px solid var(--border);
}

.note-history-node::before {
    content: '';
    position: absolute;
    left: -5px;
    top: 1.1rem;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid var(--surface);
    box-shadow: 0 0 0 2px var(--border);
}

.note-history-node:last-child { border-left-color: transparent; }

.note-history-node-meta {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.2rem;
}

.note-history-node-date {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.note-history-node-by {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.note-history-node-summary {
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--text-primary);
    margin-bottom: 0.6rem;
}

/* Inline diff rows (Status, Subject, Assignee, Due Date) */
.note-history-diff-row {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.4rem;
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
}

.note-history-diff-label {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.78rem;
    min-width: 5rem;
}

.note-history-diff-old {
    text-decoration: line-through;
    color: #dc2626;
    opacity: 0.85;
}

.note-history-diff-arrow {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.note-history-diff-new {
    color: #16a34a;
    font-weight: 500;
}

/* Body diff block */
.note-history-diff-body {
    margin-top: 0.5rem;
    font-size: 0.85rem;
}

.note-history-diff-body > .note-history-diff-label {
    display: block;
    margin-bottom: 0.35rem;
}

.note-history-diff-body-old,
.note-history-diff-body-new {
    border-radius: var(--radius);
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    min-height: unset;
}

.note-history-diff-body-old {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #7f1d1d;
    text-decoration: line-through;
    opacity: 0.85;
}

.note-history-diff-body-new {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #14532d;
}

.note-history-diff-body-arrow {
    text-align: center;
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.5;
    padding: 0.15rem 0;
}

.note-history-empty { color: var(--text-muted); font-style: italic; }

/* ---- Note Form ---- */
.note-form {}

/* ---- Note Attachments ---- */
.note-attachment-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.att-item {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.att-thumb {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: block;
}

.att-loading {
    width: 72px;
    height: 72px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
}

.att-offline {
    width: 72px;
    height: 72px;
    border-radius: var(--radius);
    border: 1px dashed var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    color: var(--text-muted);
    opacity: 0.6;
}

.att-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: none;
    background: var(--danger, #ef4444);
    color: #fff;
    font-size: 0.75rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.att-remove:hover { background: #dc2626; }

.att-doc-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.6rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.8rem;
    color: var(--text-secondary);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.att-doc-pill-btn {
    cursor: pointer;
    transition: background 0.15s;
}
.att-doc-pill-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

.att-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
}

/* Attachment indicator icon in note list (badge row) */
.note-att-indicator {
    display: inline-flex;
    align-items: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0 3px;
    color: var(--primary, #3b82f6);
    opacity: 0.65;
    transition: opacity 0.15s;
    vertical-align: middle;
    line-height: 1;
}
.note-att-indicator:hover { opacity: 1; }

.note-form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* ---- Rich Text Editor ---- */
.rich-text-editor-wrap {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg);
    /* Reserve full Quill height (toolbar ≈ 42px + editor 160px) so Quill
       initialisation never causes a layout shift. */
    min-height: 205px;
}

.rich-text-editor-inner {
    min-height: 160px;
}

/* Skeleton shown while note data is loading from the API.
   Same size as the editor wrap so the card doesn't jump when Quill appears. */
@keyframes rte-skeleton-sweep {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.aaw-note-skeleton {
    border: 1px solid var(--border, #e5e7eb);
    border-radius: var(--radius, 6px);
    min-height: 205px;
    background: linear-gradient(
        90deg,
        var(--gray-100, #f3f4f6) 25%,
        var(--gray-200, #e5e7eb) 50%,
        var(--gray-100, #f3f4f6) 75%
    );
    background-size: 400% 100%;
    animation: rte-skeleton-sweep 1.4s ease-in-out infinite;
}

/* Override Quill snow theme to fit our design */
.rich-text-editor-wrap .ql-toolbar {
    border: none;
    border-bottom: 1px solid var(--border);
    background: var(--surface-alt, var(--gray-50));
}

.rich-text-editor-wrap .ql-container {
    border: none;
    font-family: inherit;
    font-size: 0.9rem;
}

.rich-text-editor-wrap .ql-editor {
    min-height: 140px;
    color: var(--text-primary);
}

.cr-last-request {
    margin-top: 1.25rem;
    padding: 0.75rem 1rem;
    background: var(--gray-50);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.cr-last-request-label {
    font-size: 0.75rem;
    color: var(--gray-500);
    font-weight: 500;
    margin-bottom: 0.4rem;
}
.cr-last-request-body {
    font-size: 0.825rem;
    color: var(--gray-600);
    min-height: unset;
    padding: 0;
    border: none;
    opacity: 0.8;
}

.badge-neutral {
    background: var(--gray-100);
    color: var(--gray-600);
}

[data-theme="dark"] .badge-neutral {
    background: var(--gray-700);
    color: var(--gray-300);
}

@media (max-width: 640px) {
    .note-form-row-2 {
        grid-template-columns: 1fr;
    }
    .note-meta-date {
        margin-left: 0;
    }
}

/* ============================================================
   Route Planner Modal
   ============================================================ */

.rp-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
}

.rp-warnings {
    background: #fef3c7;
    border: 1px solid #fbbf24;
    border-radius: var(--radius);
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 0.8rem;
    color: #92400e;
    flex-shrink: 0;
}

[data-theme="dark"] .rp-warnings {
    background: #3b2700;
    border-color: #b45309;
    color: #fcd34d;
}

.rp-warning-item + .rp-warning-item { margin-top: 0.25rem; }

.rp-layout {
    display: flex;
    gap: 1rem;
    flex: 1;
    min-height: 0;
}

.rp-timeline-panel {
    flex: 0 0 360px;
    max-width: 360px;
    overflow-y: auto;
    max-height: 62vh;
    position: relative;
    padding-right: 0.25rem;
}

.rp-map-panel {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.rp-map {
    flex: 1;
    height: 62vh;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--gray-200);
}

.rp-map-no-location {
    font-size: 0.75rem;
    color: var(--gray-500);
    text-align: center;
    padding: 0.25rem 0;
}

.rp-footer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--gray-200);
    margin-top: 0.75rem;
    flex-shrink: 0;
}

.rp-loading-overlay {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 0;
    color: var(--gray-500);
    font-size: 0.875rem;
}

.rp-empty {
    color: var(--gray-400);
    font-size: 0.875rem;
    padding: 1rem 0;
}

.rp-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--gray-600);
    background: var(--gray-50);
    border-radius: var(--radius);
    padding: 0.4rem 0.75rem;
    margin-bottom: 0.75rem;
    flex-shrink: 0;
}

.rp-stats b { color: var(--gray-800); }

.rp-origin {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    margin-bottom: 0.25rem;
}

.rp-origin-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid var(--primary-dark);
    flex-shrink: 0;
}

.rp-origin-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary);
}

.rp-origin--excluded { opacity: 0.6; }

.rp-origin-dot--excluded { background: var(--gray-300); border-color: var(--gray-400); }

.rp-origin-label--excluded { color: var(--gray-400); }

.rp-no-location {
    font-size: 0.75rem;
    color: #b45309;
    background: #fef3c7;
    border-radius: var(--radius);
    padding: 0.4rem 0.6rem;
    margin-bottom: 0.5rem;
}

.rp-transition {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    padding: 0.4rem 0.4rem 0.4rem 1.25rem;
    font-size: 0.78rem;
    color: var(--gray-500);
    border-left: 2px solid var(--gray-200);
    margin-left: 0.85rem;
}

.rp-transition--conflict {
    color: var(--danger);
    border-left-color: var(--danger);
}

.rp-transition--stale {
    color: var(--gray-400);
    font-style: italic;
}

.rp-transition-icon { font-size: 0.7rem; margin-top: 2px; flex-shrink: 0; }

.rp-transition-info {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.rp-transition-travel { font-weight: 500; }

.rp-traffic-badge {
    display: inline-block;
    font-size: 0.7rem;
    background: #fef3c7;
    color: #92400e;
    border-radius: 3px;
    padding: 0 3px;
    margin-left: 3px;
}

.rp-transition-free { color: var(--success); font-size: 0.75rem; }

.rp-conflict-label {
    color: var(--danger);
    font-weight: 600;
    font-size: 0.75rem;
}

.rp-stop {
    display: flex;
    gap: 0.6rem;
    background: var(--bg);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 0.625rem 0.75rem;
    margin-bottom: 0.25rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.rp-stop:hover { border-color: var(--primary-light); box-shadow: var(--shadow); }

.rp-stop--excluded { opacity: 0.5; background: var(--gray-50); }

.rp-stop--conflict {
    border-color: #fca5a5;
    background: #fff5f5;
}

[data-theme="dark"] .rp-stop--conflict {
    border-color: #7f1d1d;
    background: #2d1111;
}

.rp-stop-badge {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 2px;
}

.rp-stop--excluded .rp-stop-badge { background: var(--gray-400); }

/* Phonecall stops — offset right, off the route line */

/* Wrapper draws the vertical route line behind the offset stop */
.rp-phonecall-wrap {
    position: relative;
    margin-bottom: 0.25rem;
}
.rp-phonecall-wrap::before {
    content: '';
    position: absolute;
    left: 0.85rem;       /* matches margin-left of .rp-transition */
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--gray-200);
    pointer-events: none;
}

.rp-stop--phonecall {
    margin-left: 2rem;
    margin-bottom: 0;    /* wrapper handles spacing */
    border-left: 3px solid #16a34a;
    background: var(--gray-50);
    opacity: 0.92;
}
.rp-stop-badge--phone {
    background: #16a34a;
    font-size: 0.85rem;
}
.rp-phone-in-leg {
    font-size: 0.72rem;
    color: #16a34a;
    margin-top: 2px;
    font-style: italic;
}
.rp-phone-locked {
    font-size: 0.8rem;
    opacity: 0.7;
}
.rp-stop-actions--phone {
    flex-direction: row;
    align-items: center;
}

.rp-stop-body { flex: 1; min-width: 0; }

.rp-stop-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
}

.rp-stop-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rp-stop-actions { display: flex; flex-direction: column; gap: 2px; flex-shrink: 0; }

.rp-action-btn {
    width: 26px;
    height: 26px;
    border: 1px solid var(--gray-200);
    background: var(--gray-50);
    color: var(--gray-500);
    font-size: 0.7rem;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.1s, color 0.1s;
    padding: 0;
    font-family: inherit;
}

.rp-action-btn:hover:not(:disabled) {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary-light);
}

.rp-action-btn:disabled { opacity: 0.3; cursor: default; }

.rp-action-btn--active {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

.rp-stop-meta {
    margin-top: 0.3rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.rp-stop-time {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
}

.rp-time-btn {
    background: none;
    border: none;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
    padding: 0;
    border-bottom: 1px dashed var(--primary-mid);
}

.rp-time-btn:hover { color: var(--primary-dark); }

.rp-time-input {
    font: inherit;
    font-size: 0.82rem;
    color: var(--gray-800);
    border: 1px solid var(--primary);
    border-radius: 4px;
    padding: 0.1rem 0.3rem;
    background: var(--bg);
    width: 90px;
}

.rp-stop-duration { font-size: 0.78rem; color: var(--gray-500); }

.rp-stop-address {
    font-size: 0.78rem;
    color: var(--gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rp-geocode-error { font-size: 0.75rem; color: var(--danger); }

.rp-stop-excluded-label {
    font-size: 0.75rem;
    color: var(--gray-400);
    margin-top: 0.2rem;
    font-style: italic;
}

.rp-excluded-section {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px dashed var(--gray-200);
}

.rp-excluded-header {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

/* Settings panel ──────────────────────────────────────────────────────────── */

.rp-settings {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1.25rem;
    padding: 0.6rem 1rem;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    font-size: 0.82rem;
}

.rp-setting-check {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    color: var(--gray-700);
    font-weight: 500;
    white-space: nowrap;
}

.rp-setting-check input[type="checkbox"] { cursor: pointer; }

.rp-setting-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--gray-700);
    white-space: nowrap;
}

.rp-setting-label {
    font-weight: 600;
    color: var(--gray-500);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.rp-setting-range {
    width: 90px;
    accent-color: var(--primary);
    cursor: pointer;
}

.rp-setting-value {
    min-width: 3rem;
    color: var(--gray-700);
    font-variant-numeric: tabular-nums;
}

.rp-setting-select {
    font: inherit;
    font-size: 0.82rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    padding: 0.15rem 0.35rem;
    background: var(--bg);
    color: var(--gray-800);
    cursor: pointer;
}

.rp-setting-time {
    font: inherit;
    font-size: 0.82rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    padding: 0.15rem 0.35rem;
    background: var(--bg);
    color: var(--gray-800);
    width: 6.5rem;
}

.rp-setting-sep {
    color: var(--gray-400);
    font-size: 0.75rem;
}

[data-theme="dark"] .rp-settings {
    background: var(--gray-100);
    border-color: var(--gray-300);
}
[data-theme="dark"] .rp-setting-check,
[data-theme="dark"] .rp-setting-item {
    color: var(--gray-800);
}
[data-theme="dark"] .rp-setting-label {
    color: var(--gray-600);
}
[data-theme="dark"] .rp-setting-value {
    color: var(--gray-800);
}
[data-theme="dark"] .rp-setting-sep {
    color: var(--gray-500);
}
[data-theme="dark"] .rp-setting-select,
[data-theme="dark"] .rp-setting-time {
    color: var(--gray-800);
    border-color: var(--gray-300);
}
[data-theme="dark"] .rp-setting-range::-webkit-slider-runnable-track {
    background: var(--gray-300);
    height: 4px;
    border-radius: 2px;
}
[data-theme="dark"] .rp-setting-time::-webkit-calendar-picker-indicator {
    filter: invert(1) brightness(0.8);
    opacity: 0.75;
    cursor: pointer;
}

/* Edit buttons (clickable time / duration inside a stop node) */

.rp-stop-time-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.rp-edit-btn {
    background: none;
    border: none;
    font: inherit;
    cursor: pointer;
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    transition: background 0.1s, color 0.1s;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--primary);
    border-bottom: 1px dashed var(--primary-mid);
    line-height: 1.3;
}

.rp-edit-btn:hover {
    background: var(--primary-light);
    color: var(--primary-dark);
    border-bottom-style: solid;
}

.rp-edit-btn--subtle {
    color: var(--gray-500);
    font-weight: 400;
    font-size: 0.78rem;
    border-bottom-color: transparent;
}

.rp-edit-btn--subtle:hover {
    color: var(--gray-700);
    background: var(--gray-100);
    border-bottom-color: var(--gray-300);
}

/* Sub-modal overlays (time picker, duration picker) */

.rp-submodal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1100;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.rp-submodal-panel {
    background: var(--bg);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg, 10px);
    padding: 1.5rem;
    width: 100%;
    max-width: 320px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.rp-submodal-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray-800);
}

.rp-submodal-time-input {
    font: inherit;
    font-size: 1.1rem;
    color: var(--gray-800);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    padding: 0.4rem 0.6rem;
    background: var(--bg);
    width: 100%;
    box-sizing: border-box;
}

.rp-submodal-note {
    font-size: 0.78rem;
    color: var(--gray-500);
    margin: 0;
}

.rp-submodal-footer {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* Duration chip grid */

.rp-duration-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.4rem;
}

.rp-duration-chip {
    padding: 0.35rem 0.25rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    background: var(--gray-50);
    color: var(--gray-700);
    font: inherit;
    font-size: 0.78rem;
    cursor: pointer;
    text-align: center;
    transition: background 0.1s, color 0.1s, border-color 0.1s;
}

.rp-duration-chip:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary-light);
}

.rp-duration-chip--active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    font-weight: 600;
}

[data-theme="dark"] .rp-submodal-panel {
    border-color: var(--gray-700);
}

[data-theme="dark"] .rp-duration-chip {
    background: var(--gray-800);
    border-color: var(--gray-700);
    color: var(--gray-200);
}

/* Navigation badge (↗ in transition rows) */
.rp-nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    color: var(--primary);
    font-size: 0.72rem;
    padding: 0 0.3rem;
    line-height: 1.4;
    cursor: pointer;
    vertical-align: middle;
    margin-left: 0.25rem;
    transition: background 0.1s, border-color 0.1s;
}
.rp-nav-badge:hover { background: var(--primary-light); border-color: var(--primary-mid); }

/* Footer spacer pushes nav buttons left, action buttons right */
.rp-footer-spacer { flex: 1; }

/* Navigation footer buttons — slightly muted vs primary actions */
.rp-nav-btn { color: var(--primary); }

/* Footer groups */
.rp-footer-nav { display: flex; gap: 0.5rem; flex: 1; }
.rp-footer-actions { display: flex; gap: 0.5rem; flex-shrink: 0; }

/* Collapsible settings section */
.rp-settings-section { margin-bottom: 0.5rem; }
.rp-settings-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: none;
    border: none;
    border-bottom: 1px solid var(--gray-200);
    padding: 0.35rem 0;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.rp-settings-toggle:hover { color: var(--primary); }
.rp-settings-arrow { font-size: 0.65rem; }

/* Mobile tab bar — hidden on desktop */
.rp-mobile-tabs { display: none; }

@media (max-width: 768px) {
    /* Show tab bar on mobile */
    .rp-mobile-tabs {
        display: flex;
        border-bottom: 1px solid var(--gray-200);
        margin-bottom: 0.5rem;
    }
    .rp-mobile-tab {
        flex: 1;
        padding: 0.5rem;
        background: none;
        border: none;
        border-bottom: 2px solid transparent;
        cursor: pointer;
        font-size: 0.875rem;
        color: var(--gray-500);
    }
    .rp-mobile-tab.active { border-bottom-color: var(--primary); color: var(--primary); font-weight: 600; }

    /* Hide inactive panel on mobile */
    .rp-panel--mobile-hidden { display: none !important; }

    /* Stack layout vertically; panels fill full height on mobile */
    .rp-layout { flex-direction: column; }
    .rp-timeline-panel { flex: none; max-width: 100%; max-height: 55vh; }
    .rp-map-panel { flex: none; }
    .rp-map { height: 55vh; min-height: 250px; }
    .rp-footer { flex-wrap: wrap; gap: 0.4rem; }
    .rp-footer-nav { order: 2; width: 100%; justify-content: center; }
    .rp-footer-actions { order: 1; width: 100%; justify-content: flex-end; }
}

/* ── Customer Insights Section ─────────────────────────────── */
.customer-insights-section {
    margin-top: 2rem;
}

.customer-insights-header {
    margin-bottom: 1.25rem;
}

.customer-insights-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gray-800);
}

.customer-insights-name {
    font-weight: 500;
    color: var(--primary);
}

.customer-insights-prompt {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--gray-500);
    padding: 1.5rem;
    background: var(--gray-50);
    border: 1px dashed var(--gray-300);
    border-radius: var(--radius);
    text-align: center;
}

.dashboard-card-subtitle {
    font-size: 0.75rem;
    color: var(--gray-400);
    font-weight: 400;
}
[data-theme="dark"] .dashboard-card-subtitle {
    color: var(--gray-600);
}

/* ── Customer Sales Widget (cs-) ────────────────────────────── */
.cs-summary {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.cs-stat {
    display: flex;
    flex-direction: column;
}

.cs-stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.1;
}

.cs-stat-label {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 0.125rem;
}

.cs-stat-up { color: var(--success); }
.cs-stat-down { color: var(--danger); }

.cs-no-data {
    text-align: center;
    color: var(--gray-400);
    font-size: 0.875rem;
    padding: 2rem 0;
}

.cs-stat-value--positive {
    color: #16a34a;
}

.cs-stat-value--negative {
    color: #dc2626;
}

/* ── Customer Timeline Widget (ct-) ─────────────────────────── */
.ct-empty {
    text-align: center;
    color: var(--gray-400);
    font-size: 0.875rem;
    padding: 2rem 0;
}

.ct-timeline {
    padding: 0.25rem 0;
}

.ct-node {
    display: flex;
    gap: 0.875rem;
    align-items: flex-start;
}

.ct-node-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    width: 36px;
}

.ct-dot {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1rem;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.10);
    z-index: 1;
}

.ct-dot-icon {
    font-size: 0.9rem;
    line-height: 1;
}

.ct-line {
    width: 2px;
    background: var(--gray-200);
    position: relative;
    display: flex;
    justify-content: center;
    min-height: 40px;
}

.ct-line-gap-label {
    position: absolute;
    left: 6px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.65rem;
    color: var(--gray-400);
    white-space: nowrap;
    font-weight: 500;
}

.ct-card {
    flex: 1;
    border-radius: var(--radius);
    padding: 0.75rem 0.875rem;
    margin-bottom: 0.25rem;
    cursor: pointer;
    transition: box-shadow 0.15s, transform 0.1s;
    border: 1px solid transparent;
}

.ct-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.ct-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.25rem;
    gap: 0.5rem;
}

.ct-type-badge {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.ct-date {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.1rem;
}

.ct-date-relative {
    font-size: 0.7rem;
    color: var(--gray-400);
    white-space: nowrap;
}

.ct-date-full {
    font-size: 0.65rem;
    color: var(--gray-300);
    white-space: nowrap;
}

.ct-subject {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.25rem;
    line-height: 1.3;
}

.ct-linked-orders {
    margin-top: 0.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    border-top: 1px solid var(--gray-200);
    padding-top: 0.4rem;
}

.ct-linked-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.78rem;
    color: var(--gray-600);
}

.ct-preview {
    font-size: 0.8rem;
    color: var(--gray-600);
    line-height: 1.4;
    margin-bottom: 0.25rem;
}

.ct-person {
    font-size: 0.75rem;
    color: var(--gray-400);
    margin-top: 0.25rem;
}

/* Show-more separator row replaces the old outline button */
.ct-show-more-sep {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    cursor: pointer;
    padding: 0.25rem 0;
    user-select: none;
}
.ct-show-more-sep:hover .ct-show-more-label { color: var(--primary); }
.ct-show-more-sep:hover .ct-show-more-line  { border-color: var(--primary); }
.ct-show-more-line {
    flex: 1;
    height: 0;
    border-top: 1px dashed var(--gray-300);
    transition: border-color 0.15s;
}
.ct-show-more-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--gray-400);
    white-space: nowrap;
    transition: color 0.15s;
}
.ct-show-more-count {
    font-weight: 400;
    color: var(--gray-300);
}

.ct-confirm-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    background: var(--blue-50, #eff6ff);
    border: 1px solid var(--blue-200, #bfdbfe);
    border-radius: 8px;
    padding: 0.6rem 0.875rem;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    flex-wrap: wrap;
}
.ct-confirm-actions { display: flex; gap: 0.5rem; flex-shrink: 0; }

.ct-upcoming {
    margin-bottom: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: var(--gray-50, #f9fafb);
    border-radius: 8px;
    border: 1px solid var(--gray-200, #e5e7eb);
}
.ct-upcoming-title { font-size: 0.75rem; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 0.35rem; }
.ct-upcoming-row { display: flex; align-items: center; gap: 0.5rem; padding: 0.25rem 0; font-size: 0.875rem; color: var(--gray-600); border-radius: 4px; }
.ct-upcoming-row--clickable { cursor: pointer; padding: 0.3rem 0.5rem; margin: 0 -0.5rem; transition: background-color 0.12s; }
.ct-upcoming-row--clickable:hover { background: var(--gray-100); color: var(--gray-800); }
.ct-upcoming-type { font-size: 1rem; }
.ct-upcoming-time { font-weight: 500; }

/* ── Shared widget cache / stale indicators ─────────────────── */
.widget-cache-label {
    font-size: 0.7rem;
    color: var(--gray-400);
    white-space: nowrap;
}

.widget-stale-warning {
    font-size: 0.8rem;
    color: #b45309;
    background: #fef3c7;
    border: 1px solid #fde68a;
    border-radius: 5px;
    padding: 0.4rem 0.75rem;
    margin-bottom: 0.75rem;
}

/* ── Customer Top Sellers Widget (cts-) ─────────────────────── */
.cts-table-wrap {
    overflow-x: auto;
}

.cts-table .text-right {
    text-align: right;
}

.cts-product-name {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--gray-800);
}

.cts-product-code {
    font-size: 0.7rem;
    color: var(--gray-400);
    font-family: monospace;
}

.cts-uom-inline {
    font-size: 0.7rem;
    color: var(--gray-500);
    font-family: monospace;
}

.cts-col-qty { width: 70px; }
.cts-col-price { width: 90px; }
.cts-col-order { width: 170px; text-align: center; }

.cts-qty-total {
    font-weight: 600;
    color: var(--gray-700);
}

/* Action cell: qty control + toggle button stacked vertically on mobile,
   inline on desktop */
.cts-action-cell {
    padding: 0.375rem 0.5rem !important;
}

.cts-qty-control {
    display: flex;
    align-items: center;
    gap: 2px;
    justify-content: center;
}

.cts-qty-btn {
    width: 26px;
    height: 26px;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    background: var(--gray-50);
    color: var(--gray-600);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.1s;
    line-height: 1;
    flex-shrink: 0;
}

.cts-qty-btn:hover {
    background: var(--gray-200);
}

.cts-qty-input {
    width: 50px;
    height: 26px;
    text-align: center;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    font-size: 0.875rem;
    color: var(--gray-800);
    background: var(--bg);
    padding: 0 4px;
}

.cts-qty-input::-webkit-inner-spin-button,
.cts-qty-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
}

/* Toggle button (+ / ✓) */
.cts-toggle-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--primary);
    background: transparent;
    color: var(--primary);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.1s;
    flex-shrink: 0;
    margin-left: 6px;
}

.cts-toggle-btn:hover:not(:disabled) {
    background: var(--primary-light);
    transform: scale(1.08);
}

.cts-toggle-btn--selected {
    background: #16a34a !important;
    border-color: #16a34a !important;
    color: #fff !important;
}

.cts-toggle-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.cts-row--selected td {
    background: #f0fdf4;
    transition: background 0.2s;
}

/* On desktop, qty control + toggle side-by-side */
.cts-action-cell > .cts-qty-control,
.cts-action-cell > .cts-toggle-btn {
    display: inline-flex;
}
.cts-action-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: nowrap;
}

/* Create Order bar */
.cts-create-order-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    border: 1px solid #86efac;
    border-radius: var(--radius);
    gap: 1rem;
}

.cts-create-order-count {
    font-size: 0.875rem;
    font-weight: 600;
    color: #15803d;
}

.cts-create-order-btn {
    padding: 0.5rem 1.25rem;
    background: #16a34a;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    white-space: nowrap;
}

.cts-create-order-btn:hover {
    background: #15803d;
    transform: translateY(-1px);
}

.cts-hint {
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
    color: var(--gray-600);
}

/* Show desktop table, hide mobile cards on wide screens */
.cts-mobile-only { display: none; }
.cts-desktop-only { display: block; }

@media (max-width: 640px) {
    .cts-mobile-only { display: block; }
    .cts-desktop-only { display: none; }
}

.cts-card-mobile {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: var(--white);
}

.cts-card-mobile--selected {
    border-color: var(--primary);
    background: var(--primary-light);
}

.cts-cm-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--gray-800);
    margin-bottom: 0.25rem;
}

.cts-cm-meta {
    font-size: 0.78rem;
    color: var(--gray-500);
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.cts-cm-sep {
    color: var(--gray-300);
}

.cts-cm-stats {
    font-size: 0.78rem;
    color: var(--gray-600);
    margin-bottom: 0.5rem;
}

.cts-cm-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cts-cm-total {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    margin-left: auto;
    margin-right: 0.25rem;
}

.cts-empty {
    text-align: center;
    color: var(--gray-400);
    font-size: 0.875rem;
    padding: 2rem 0;
}

/* ── Customer Patterns Widget (cp-) ─────────────────────────── */
.cp-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 2rem;
    color: var(--gray-400);
    font-size: 0.9rem;
}

.cp-header-right {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.cp-ai-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 4px;
    letter-spacing: 0.02em;
}

.cp-cached-at {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.7rem;
    color: var(--gray-400);
    white-space: nowrap;
}
[data-theme="dark"] .cp-cached-at {
    color: var(--gray-600);
}

.cp-refresh-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid var(--gray-300);
    border-radius: 5px;
    background: var(--bg);
    color: var(--gray-600);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.cp-refresh-btn:hover:not(:disabled) {
    background: var(--gray-100);
    color: var(--gray-800);
}

.cp-refresh-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.cp-refresh-btn--spinning {
    color: var(--primary);
    border-color: var(--primary);
}

.cp-refreshing-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--primary);
    padding: 0.375rem 0;
    margin-bottom: 0.5rem;
}

.cp-summary {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    background: var(--primary-light);
    border: 1px solid rgba(124,111,255,0.2);
    border-radius: var(--radius);
    padding: 0.875rem 1rem;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    color: var(--gray-700);
    line-height: 1.5;
}

.cp-summary-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.cp-patterns-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}

.cp-pattern-card {
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    border-left-width: 4px;
    padding: 1rem;
    transition: box-shadow 0.15s;
}

.cp-pattern-card:hover {
    box-shadow: var(--shadow-md);
}

.cp-pattern-header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.625rem;
}

.cp-pattern-icon {
    font-size: 1.5rem;
    line-height: 1;
    flex-shrink: 0;
}

.cp-pattern-meta {
    flex: 1;
    min-width: 0;
}

.cp-pattern-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 0.25rem;
    line-height: 1.2;
}

.cp-category-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
}

.cp-pattern-desc {
    font-size: 0.825rem;
    color: var(--gray-600);
    line-height: 1.45;
    margin-bottom: 0.75rem;
}

.cp-confidence {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cp-confidence-bar {
    flex: 1;
    height: 5px;
    background: var(--gray-200);
    border-radius: 3px;
    overflow: hidden;
}

.cp-confidence-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

.cp-confidence-label {
    font-size: 0.7rem;
    font-weight: 700;
    min-width: 2.5rem;
    text-align: right;
}

@media (max-width: 900px) {
    .cp-patterns-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 600px) {
    .cp-patterns-grid {
        grid-template-columns: 1fr;
    }

    /* On narrow screens, stack qty control and toggle button vertically */
    .cts-action-cell {
        flex-direction: column;
        align-items: center;
        gap: 4px;
    }

    .cts-toggle-btn {
        margin-left: 0;
    }

    /* Hide less-critical columns on small screens */
    .cts-col-qty,
    .cts-col-price {
        display: none;
    }

    .cts-create-order-bar {
        flex-direction: column;
        text-align: center;
    }

    .cp-header-right {
        flex-direction: column;
        align-items: flex-end;
        gap: 0.25rem;
    }
}

/* ============================================================
   Map card action buttons (sidebar customer list)
   ============================================================ */

.map-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-top: 0.625rem;
    padding-top: 0.625rem;
    border-top: 1px solid var(--gray-100);
}

.map-card-btn {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0.3rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    font-family: inherit;
    border-radius: 6px;
    border: 1px solid var(--gray-200);
    background: var(--gray-50);
    color: var(--gray-700);
    cursor: pointer;
    text-align: center;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.map-card-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

.map-card-btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.map-card-btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    color: #fff;
}

.map-card-btn-success {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--success);
    color: var(--success);
}

.map-card-btn-success:hover {
    background: var(--success);
    color: #fff;
}

.map-card-row {
    display: flex;
    gap: 0.375rem;
    width: 100%;
}

.map-card-btn-navigate {
    background: rgba(2, 132, 199, 0.08);
    border-color: #0284c7;
    color: #0284c7;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.map-card-btn-navigate:hover {
    background: #0284c7;
    color: #fff;
}

/* ============================================================
   Map popup action buttons (Leaflet popup — no CSS vars to be safe)
   ============================================================ */

.map-popup-actions {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: 0.625rem;
    padding-top: 0.5rem;
    border-top: 1px solid #e5e7eb;
}

.map-popup-btn {
    width: 100%;
    padding: 0.35rem 0.625rem;
    font-size: 0.78rem;
    font-weight: 500;
    font-family: inherit;
    border-radius: 5px;
    border: 1px solid #d1d5db;
    background: #f9fafb;
    color: #374151;
    cursor: pointer;
    text-align: center;
    line-height: 1.4;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.map-popup-btn:hover {
    background: #e0f2fe;
    border-color: #0284c7;
    color: #0284c7;
}

.map-popup-btn-primary {
    background: #0284c7;
    border-color: #0284c7;
    color: #fff;
}

.map-popup-btn-primary:hover {
    background: #0369a1;
    border-color: #0369a1;
    color: #fff;
}

.map-popup-btn-success {
    background: rgba(16, 185, 129, 0.1);
    border-color: #10b981;
    color: #10b981;
}

.map-popup-btn-success:hover {
    background: #10b981;
    color: #fff;
}

/* ============================================================
   New Call Plan modal content
   ============================================================ */

.cp-modal-customer-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 1rem;
}

.cp-modal-date-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.cp-modal-date-btn {
    flex: 1 1 auto;
    padding: 0.45rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 500;
    font-family: inherit;
    border-radius: 6px;
    border: 1px solid var(--gray-200);
    background: var(--gray-50);
    color: var(--gray-700);
    cursor: pointer;
    text-align: center;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    min-width: 0;
}

.cp-modal-date-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.cp-modal-date-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.cp-modal-date-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.cp-modal-date-picker {
    margin-bottom: 0.75rem;
}


.cp-modal-snap-time-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.cp-modal-time-item {
    flex: 1;
    min-width: 0;
}

.cp-modal-time-select-full {
    flex: 1;
    min-width: 0;
    width: 100%;
}

.cp-modal-time-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.cp-modal-time-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    flex-shrink: 0;
}

.cp-modal-time-select {
    width: 100%;
    min-width: 140px;
    padding: 0.45rem 0.75rem;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    background: var(--bg);
    color: var(--gray-800);
    font-size: 0.875rem;
    font-family: inherit;
    cursor: pointer;
}

.cp-modal-time-select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.cp-modal-locked-row {
    margin-bottom: 1rem;
}

.cp-modal-locked-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
    user-select: none;
}

.form-field-error {
    font-size: 0.78rem;
    color: var(--danger);
    margin-top: 0.25rem;
}

.form-error {
    font-size: 0.82rem;
    color: var(--danger);
    background: rgba(220, 38, 38, 0.06);
    border: 1px solid rgba(220, 38, 38, 0.25);
    border-radius: 6px;
    padding: 0.4rem 0.6rem;
}

.input-error {
    border-color: var(--danger) !important;
}

.cp-modal-time-select-wrap {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.cp-modal-type-row {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
}

.cp-modal-error {
    color: var(--danger, #ef4444);
    font-size: 0.78rem;
    margin-top: -0.4rem;
    margin-bottom: 0.6rem;
}

.cp-modal-type-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-600);
}

.cp-modal-phone-row {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
}

.cp-modal-phone-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
}

.cp-modal-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding-top: 0.75rem;
    border-top: 1px solid var(--gray-100);
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Responsive: stack card buttons on small sidebar widths */
@media (max-width: 400px) {
    .map-card-actions {
        flex-direction: column;
    }

    .cp-modal-date-row {
        flex-direction: column;
    }

    .cp-modal-date-btn {
        width: 100%;
    }
}
}

/* ── To Do Page ───────────────────────────────────────────── */

.todo-page-header {
    margin-bottom: 1.25rem;
}

/* Filter tabs */
.todo-filter-tabs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.todo-tab {
    font-size: 0.83rem;
    font-weight: 500;
    padding: 0.45rem 1rem;
    border-radius: 999px;
    border: 1.5px solid var(--gray-200);
    background: var(--bg);
    color: var(--gray-600);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.todo-tab:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.todo-tab--active {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.todo-tab--picker {
    cursor: pointer;
}

/* Hidden date input — opened programmatically via showPicker() */
.todo-date-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
    border: 0;
    padding: 0;
}

/* Summary chips */
.todo-summary-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.todo-summary-chip {
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    background: var(--gray-100);
    color: var(--gray-600);
    border: 1px solid var(--gray-200);
    cursor: pointer;
    transition: opacity 0.15s, box-shadow 0.15s;
}
button.todo-summary-chip { font-family: inherit; line-height: inherit; }
button.todo-summary-chip:hover { opacity: 0.8; }
.todo-summary-chip--active { box-shadow: 0 0 0 2px var(--gray-400); }

.todo-summary-chip--call {
    background: #eff6ff;
    color: #1d4ed8;
    border-color: #bfdbfe;
}

.todo-summary-chip--task {
    background: #fef9c3;
    color: #854d0e;
    border-color: #fde68a;
}

.todo-summary-chip--appt {
    background: #e0f2fe;
    color: #0369a1;
    border-color: #bae6fd;
}

.todo-summary-chip--phone-appt {
    background: #dcfce7;
    color: #15803d;
    border-color: #86efac;
}

.todo-summary-chip--visit {
    background: #fff7ed;
    color: #c2410c;
    border-color: #fed7aa;
}

.todo-summary-chip--general {
    background: var(--gray-100);
    color: var(--gray-600);
    border-color: var(--gray-200);
}

.todo-summary-chip--delivery {
    background: #ecfeff;
    color: #0e7490;
    border-color: #a5f3fc;
}

.todo-summary-chip--pickup {
    background: #fffbeb;
    color: #b45309;
    border-color: #fde68a;
}

/* Pending chip: mobile-only — hidden on desktop */
.todo-summary-chip--pending-mobile {
    display: none;
    background: #fef9c3;
    color: #854d0e;
    border-color: #fde68a;
}

.todo-summary-chip--done {
    background: var(--gray-50);
    color: var(--gray-500);
    border-color: var(--gray-200);
}

/* On mobile: hide per-type chips, show the Pending chip instead */
@media (max-width: 640px) {
    .todo-summary-chip--type {
        display: none;
    }

    .todo-summary-chip--pending-mobile {
        display: inline-block;
    }
}

/* Item list */
.todo-items {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.todo-item {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    padding: 0.875rem 1rem;
    border: 1px solid var(--gray-200);
    border-left-width: 4px;
    border-radius: var(--radius);
    background: var(--bg);
    border-left-color: var(--gray-300);
}

.todo-item--phonecall {
    border-left-color: #1d4ed8;
}

.todo-item--task {
    border-left-color: #f59e0b;
}

.todo-item--appointment {
    border-left-color: #0284c7;
}

.todo-item--visit {
    border-left-color: #c2410c;
}

.todo-item--general {
    border-left-color: var(--gray-400);
}

.todo-item--delivery {
    border-left-color: #0e7490;
}

.todo-item--pickup {
    border-left-color: #b45309;
}

.todo-item--done {
    opacity: 0.65;
}

.todo-item--clickable {
    cursor: pointer;
}

.todo-item--clickable:hover {
    background: var(--gray-50);
    border-color: var(--primary-mid, var(--gray-300));
}

/* Item content */
.todo-item-content {
    flex: 1;
    min-width: 0;
}

.todo-item-header-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.3rem;
}

/* Type badge */
.todo-type-badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
    white-space: nowrap;
    flex-shrink: 0;
}

.todo-type-badge--phonecall {
    background: #eff6ff;
    color: #1d4ed8;
}

.todo-type-badge--task {
    background: #fef9c3;
    color: #854d0e;
}

.todo-type-badge--phone-appt {
    background: #dcfce7;
    color: #15803d;
}

.todo-item--phone-appt {
    border-left-color: #16a34a;
}

.todo-item--phone-appt.todo-item--clickable:hover {
    background: #f0fdf4;
    border-color: #86efac;
}

.todo-type-badge--appointment {
    background: #e0f2fe;
    color: #0369a1;
}

.todo-type-badge--visit {
    background: #fff7ed;
    color: #c2410c;
}

.todo-type-badge--general {
    background: var(--gray-100);
    color: var(--gray-500);
}

.todo-type-badge--delivery {
    background: #ecfeff;
    color: #0e7490;
}

.todo-type-badge--pickup {
    background: #fffbeb;
    color: #b45309;
}

.todo-item-time {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--gray-500);
}

.todo-item-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.todo-item-name--done {
    text-decoration: line-through;
    color: var(--gray-400);
}

.todo-item-subject {
    font-size: 0.82rem;
    color: var(--gray-500);
    margin-bottom: 0.3rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.todo-item-detail {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.78rem;
    color: var(--gray-400);
    margin-top: 0.2rem;
}

.todo-item-detail--phone { color: #1d4ed8; }
.todo-item-detail--address { color: var(--gray-500); }

/* Action buttons */
.todo-item-actions {
    flex-shrink: 0;
    align-self: center;
}

.todo-view-btn,
.todo-status-btn {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.3rem 0.7rem;
    border-radius: 5px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}

.todo-view-btn {
    border: 1.5px solid var(--gray-300);
    background: var(--bg);
    color: var(--gray-600);
}

.todo-view-btn:hover {
    background: var(--gray-100);
    border-color: var(--gray-400);
}

.todo-status-btn--pending {
    border: 1.5px solid #15803d;
    background: transparent;
    color: #15803d;
}

.todo-status-btn--pending:hover {
    background: #15803d;
    color: #fff;
}

.todo-status-btn--done {
    border: 1.5px solid var(--gray-300);
    background: transparent;
    color: var(--gray-400);
}

.todo-status-btn--done:hover {
    background: var(--gray-100);
    color: var(--gray-600);
}

/* Loading / error / empty */
.todo-loading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 2rem;
    color: var(--gray-400);
    font-size: 0.875rem;
}

.todo-error {
    padding: 1rem;
    background: #fef2f2;
    color: #b91c1c;
    border-radius: var(--radius);
    font-size: 0.875rem;
}

.todo-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--gray-400);
    font-size: 0.875rem;
}

@media (max-width: 500px) {
    .todo-item {
        flex-wrap: wrap;
    }

    .todo-item-actions {
        width: 100%;
        display: flex;
        justify-content: flex-end;
    }
}

/* ═══════════════════════════════════════════════════════
   M11 Catalogue
   ═══════════════════════════════════════════════════════ */

.catalog-page {
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding-bottom: 5rem; /* space for cart footer */
}

/* Header / search bar */
.catalog-header {
    background: var(--bg);
    border-bottom: 1px solid var(--gray-200);
    /* padding via .page-wide */
}

.catalog-title-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: space-between;
}

/* Dev: tile width slider */
.dev-tile-width-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.dev-tile-width-label {
    font-size: 0.75rem;
    color: var(--gray-400);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    min-width: 5.5ch;
}

.dev-tile-width-slider {
    width: 100px;
    accent-color: var(--primary);
    cursor: pointer;
}

.catalog-search-bar {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.catalog-action-row {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.catalog-sort-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    font-size: 0.875rem;
}
.catalog-sort-label { color: var(--gray-600); }
.catalog-sort-select {
    padding: 0.3rem 0.5rem;
    border: 1.5px solid var(--primary);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-family: inherit;
    background: var(--primary-light);
    color: var(--primary-dark);
    cursor: pointer;
}


.catalog-keyword-input {
    flex: 1;
    min-width: 200px;
    padding: 0.5rem 0.75rem;
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.925rem;
    font-family: inherit;
    background: var(--bg);
    color: var(--gray-800);
    outline: none;
    transition: border-color 0.15s;
}
.catalog-keyword-input:focus {
    border-color: var(--primary);
}

/* Category filter button + dropdown */
.cat-filter-wrap {
    position: relative;
}

.cat-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.75rem;
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--gray-700);
    font-size: 0.875rem;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    min-width: 360px;
    transition: border-color 0.15s, background 0.15s;
}
.cat-filter-btn:hover,
.cat-filter-btn.active {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.cat-dropdown-panel {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 360px;
    max-width: 480px;
    max-height: 400px;
    overflow-y: auto;
    background: var(--bg);
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    z-index: 200;
}

/* Category tree */
.cat-tree-container {
    padding: 0.5rem;
}

.cat-tree-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.4rem 0.5rem;
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: 0.4rem;
}

.cat-tree-sep {
    color: var(--gray-400);
    font-size: 0.8rem;
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.btn-link:hover {
    color: var(--primary-dark);
}

.cat-tree {
    font-size: 0.875rem;
}

.cat-node {
    user-select: none;
}

.cat-node-row {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.25rem;
    border-radius: 6px;
    cursor: default;
}
.cat-node-row:hover {
    background: var(--gray-100);
}

.cat-expand-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-500);
    display: flex;
    align-items: center;
    padding: 0;
    flex-shrink: 0;
    width: 14px;
    height: 14px;
}
.cat-expand-btn:hover {
    color: var(--primary);
}

.cat-expand-spacer {
    width: 14px;
    flex-shrink: 0;
}

.cat-checkbox {
    flex-shrink: 0;
    accent-color: var(--primary);
    cursor: pointer;
    width: 14px;
    height: 14px;
}

.cat-node-label {
    color: var(--gray-700);
    font-size: 0.85rem;
    line-height: 1.3;
    cursor: pointer;
    flex: 1;
}

.cat-children {
    padding-left: 1.25rem;
}

/* Results grid */
.catalog-results {
    padding: 1.25rem 1.5rem;
}

.catalog-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--gray-500);
    font-size: 0.95rem;
}

.catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 1rem;
}

/* Product Tile */
.product-tile {
    background: var(--bg);
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.product-tile:hover {
    border-color: var(--gray-300);
    box-shadow: var(--shadow-md);
}

.product-tile.queued {
    border-color: var(--success);
    box-shadow: 0 0 0 2px rgba(16,185,129,0.15), var(--shadow-md);
}

.product-tile-image {
    height: 150px;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    position: relative; /* anchor for qty-warning overlay */
}

.product-tile-image img,
.product-tile-image .product-tile-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.product-tile-placeholder,
.product-img-placeholder {
    color: var(--gray-400);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: var(--gray-100);
}

.product-tile-body {
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex: 1;
}

.product-tile-code {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.product-tile-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--gray-800);
    line-height: 1.3;
}

.product-tile-price-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.product-tile-price {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary);
}

.product-tile-price.price-struck {
    text-decoration: line-through;
    color: var(--gray-400);
    font-size: 0.82rem;
    font-weight: 500;
}

.product-tile-uom {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--gray-500);
}

.btn-override-toggle {
    font-size: 0.72rem;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    border: 1.5px solid var(--gray-300);
    background: var(--bg);
    color: var(--gray-600);
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
    white-space: nowrap;
    flex-shrink: 0;
}
.btn-override-toggle:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* Inline override input — replaces the Override button in-place */
.price-override-inline {
    display: flex;
    align-items: center;
    border: 1.5px solid var(--primary);
    border-radius: 6px;
    background: var(--primary-light);
    overflow: hidden;
    flex: 1;
    min-width: 0;
}

.price-override-dollar {
    padding: 0 0.2rem 0 0.4rem;
    font-size: 0.8rem;
    color: var(--primary);
    flex-shrink: 0;
}

.price-override-input {
    border: none;
    outline: none;
    padding: 0.2rem 0.2rem 0.2rem 0;
    font-size: 0.875rem;
    font-family: inherit;
    font-weight: 600;
    color: var(--primary-dark);
    background: transparent;
    width: 100%;
    min-width: 0;
    -moz-appearance: textfield;
}
.price-override-input::-webkit-inner-spin-button,
.price-override-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
}

.price-override-cancel {
    background: none;
    border: none;
    border-left: 1px solid rgba(124,111,255,0.3);
    color: var(--primary);
    cursor: pointer;
    padding: 0.1rem 0.4rem;
    font-size: 0.9rem;
    font-family: inherit;
    flex-shrink: 0;
    line-height: 1;
    transition: background 0.15s, color 0.15s;
}
.price-override-cancel:hover {
    background: rgba(239,68,68,0.1);
    color: var(--danger);
}

/* Stock display */
.product-tile-stock-row {
    margin-top: 0.1rem;
}

.stock-display {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    padding: 0.2rem 0.5rem;
    cursor: pointer;
    font-size: 0.75rem;
    font-family: inherit;
    color: var(--gray-600);
    transition: border-color 0.15s, background 0.15s;
}
.stock-display:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
}

.stock-avail {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.stock-incoming {
    color: var(--success);
    font-weight: 500;
}

.stock-incoming--no-bo {
    text-decoration: line-through;
    color: var(--gray-400);
}

/* Note toggle */
/* ── Note field (3-state) ──────────────────────────────────────────────────── */

/* Clear state: just a dashed "add" button, full width */
.note-btn-clear {
    display: block;
    width: 100%;
    text-align: left;
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    border: 1.5px dashed var(--gray-300);
    background: transparent;
    color: var(--gray-400);
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.15s, color 0.15s;
}
.note-btn-clear:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* Focussed / Unfocussed wrapper */
.note-wrap {
    border: 1.5px solid var(--primary);
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
}
.note-wrap--unfocused {
    border-color: var(--gray-300);
    cursor: pointer;
}

.note-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    user-select: none;
}
.note-wrap--focused .note-header {
    background: var(--primary-light);
    color: var(--primary);
    border-bottom: 1px solid rgba(124,111,255,0.2);
}
.note-wrap--unfocused .note-header {
    background: var(--gray-50);
    color: var(--gray-500);
    border-bottom: 1px solid var(--gray-200);
}

.note-header-label {
    flex: 1;
}

.note-header-clear {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--primary);
    font-size: 0.9rem;
    line-height: 1;
    padding: 0 0.1rem;
    font-family: inherit;
    transition: color 0.15s;
}
.note-header-clear:hover {
    color: var(--danger);
}

.note-textarea {
    display: block;
    width: 100%;
    resize: none;
    border: none;
    outline: none;
    padding: 0.4rem 0.5rem;
    font-size: 0.82rem;
    font-family: inherit;
    background: var(--bg);
    color: var(--gray-800);
    min-height: 52px;
}
.note-textarea--readonly {
    font-size: 0.75rem;
    color: var(--gray-500);
    background: var(--gray-50);
    cursor: pointer;
    resize: none;
    min-height: unset;
    height: auto;
}

/* ── Cart row ──────────────────────────────────────────────────────────────── */

.product-tile-cart-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
    min-height: 32px;
}

/* Fused qty group [-[#]+] */
.qty-group {
    display: inline-flex;
    align-items: stretch;
    border: 1.5px solid var(--gray-300);
    border-radius: 6px;
    overflow: hidden;
    transition: border-color 0.15s;
    flex-shrink: 0;
}
.qty-group:focus-within {
    border-color: var(--primary);
}
.qty-group .qty-btn {
    border: none;
    border-radius: 0;
    background: var(--gray-50);
    color: var(--gray-700);
    width: 28px;
    height: 28px;
    font-size: 1.05rem;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.12s, color 0.12s;
}
.qty-group .qty-btn:hover:not(:disabled) {
    background: var(--primary-light);
    color: var(--primary);
}
.qty-group .qty-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}
.qty-group .qty-input {
    border: none;
    border-left: 1px solid var(--gray-200);
    border-right: 1px solid var(--gray-200);
    border-radius: 0;
    width: 44px;
    text-align: center;
    padding: 0.2rem 0.15rem;
    font-size: 0.9rem;
    font-family: inherit;
    font-weight: 600;
    background: var(--bg);
    color: var(--gray-800);
    outline: none;
    -moz-appearance: textfield;
}
.qty-group .qty-input::-webkit-inner-spin-button,
.qty-group .qty-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
}

.qty-line-total {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--success);
    flex: 1;
    text-align: center;
    white-space: nowrap;
    min-width: 0;
}

/* Compact mode: large line totals (≥$1000) shrink spinner + total text */
.product-tile-cart-row--compact .qty-group .qty-input { width: 32px; font-size: 0.78rem; }
.product-tile-cart-row--compact .qty-group .qty-btn { padding: 0 6px; }
.product-tile-cart-row--compact .qty-line-total { font-size: 0.7rem; }

.qty-btn-zero {
    background: none;
    border: 1.5px solid var(--gray-200);
    border-radius: 6px;
    color: var(--gray-400);
    cursor: pointer;
    font-size: 0.95rem;
    font-family: inherit;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
    transition: border-color 0.12s, color 0.12s, background 0.12s;
}
.qty-btn-zero:hover {
    border-color: var(--danger);
    color: var(--danger);
    background: rgba(239,68,68,0.06);
}


/* Stock warning — absolute overlay at bottom of product image */
.qty-warning {
    position: absolute;
    bottom: 0.35rem;
    left: 0.35rem;
    right: 0.35rem;
    font-size: 0.7rem;
    line-height: 1.3;
    border-radius: 4px;
    padding: 0.2rem 0.4rem;
    margin: 0;
    pointer-events: none;
    z-index: 1;
}
.qty-warning.warn {
    background: rgba(245, 158, 11, 0.88);
    color: #7c3a00;
    border: 1px solid rgba(245, 158, 11, 0.5);
    backdrop-filter: blur(4px);
}
.qty-warning.danger {
    background: rgba(239, 68, 68, 0.88);
    color: #fff;
    border: 1px solid rgba(239, 68, 68, 0.5);
    backdrop-filter: blur(4px);
}

/* Stock popup modal */
.stock-popup {
	width: 400px;
	max-width: 95vw;
	background-color: var(--bg);
}

.stock-popup-summary {
    display: flex;
    gap: 1.5rem;
    padding: 1rem 0 0.75rem;
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: 0.75rem;
}

.stock-popup-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
}

.stock-popup-stat-val {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--gray-800);
}

.stock-popup-no-bo {
    text-decoration: line-through;
    color: var(--gray-400);
}

.stock-popup-stat-lbl {
    font-size: 0.75rem;
    color: var(--gray-500);
    text-align: center;
}

.stock-popup-offline {
    font-size: 0.82rem;
    color: var(--gray-500);
    font-style: italic;
    padding: 0.5rem 0;
}

.stock-popup-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.stock-popup-table th {
    text-align: left;
    padding: 0.35rem 0.5rem;
    font-size: 0.75rem;
    color: var(--gray-500);
    font-weight: 600;
    border-bottom: 1px solid var(--gray-200);
}

.stock-popup-table td {
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
}

.stock-popup-table tr:last-child td {
    border-bottom: none;
}

/* Cart footer */
.cart-footer {
    position: fixed;
    bottom: 0;
    left: var(--sidebar-w, 0);
    right: 0;
    background: var(--bg);
    border-top: 2px solid var(--success);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    z-index: 150;
    box-shadow: 0 -4px 20px rgba(16,185,129,0.15);
}

.cart-footer-summary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--gray-700);
    flex-wrap: wrap;
}

.cart-footer-count,
.cart-footer-qty {
    font-weight: 500;
}

.cart-footer-total {
    font-weight: 700;
    color: var(--success);
    font-size: 1rem;
}

.cart-footer-sep {
    color: var(--gray-400);
}

.cart-footer-bo {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--gray-500);
}

.cart-footer-btn {
    white-space: nowrap;
    flex-shrink: 0;
}

.cart-footer-clear {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    color: var(--gray-500);
    border-color: var(--gray-300);
}

.cart-footer-clear:hover {
    color: var(--danger, #dc2626);
    border-color: var(--danger, #dc2626);
}

/* ── Order page: lines card header ──────────────────────────────────────────── */
.so-lines-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 1rem;
    border-bottom: 1px solid var(--gray-100);
    background: var(--gray-50);
}

.so-lines-card-count {
    font-size: 0.8125rem;
    color: var(--gray-500);
    font-weight: 500;
}

.so-clear-cart-btn {
    display: flex;
    align-items: center;
    color: var(--gray-500);
    border-color: var(--gray-300);
}

.so-clear-cart-btn:hover {
    color: var(--danger, #dc2626);
    border-color: var(--danger, #dc2626);
}

/* Responsive */
@media (max-width: 768px) {
    .cart-footer {
        left: 0; /* sidebar hidden on mobile */
    }
}

@media (max-width: 600px) {
    .catalog-results {
        padding: 1rem;
    }
    .product-tile-image {
        height: 120px;
    }
    .dev-tile-width-wrap {
        display: none; /* hide dev slider on small screens */
    }
}

/* =====================================================
   SmartOrderButton
   ===================================================== */

.sob-wrap {
    position: relative;
    display: inline-flex;
    flex-direction: column;
}

/* Split button */
.sob-split-btn {
    display: flex;
    align-items: stretch;
}

.sob-main-btn {
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    display: flex;
    align-items: center;
    gap: 0;
}

.sob-gear-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    padding: 0;
    background: var(--brand-blue, #3b82f6);
    color: #fff;
    border: none;
    border-left: 1px solid rgba(255,255,255,0.25);
    border-radius: 0 var(--radius, 0.375rem) var(--radius, 0.375rem) 0;
    cursor: pointer;
    transition: background 0.15s;
    flex-shrink: 0;
}
.sob-gear-btn:hover { background: var(--brand-blue-dark, #2563eb); }
.sob-gear-btn:focus-visible { outline: 2px solid var(--brand-blue, #3b82f6); outline-offset: 2px; }

/* Dropdown panel (desktop) */
.sob-panel-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 500;
    min-width: 240px;
}

/* Bottom sheet (mobile) */
.sob-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1200;
    display: flex;
    align-items: flex-end;
}

.sob-panel-sheet {
    width: 100%;
    border-radius: 1rem 1rem 0 0;
}

.sob-sheet-handle {
    width: 40px;
    height: 4px;
    background: var(--gray-300);
    border-radius: 2px;
    margin: 0.75rem auto 0.5rem;
}

.sob-sheet-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    font-size: 1rem;
    padding: 0.5rem 1.25rem 0.75rem;
    border-bottom: 1px solid var(--gray-200);
}

.sob-sheet-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    opacity: 0.5;
    padding: 0.25rem;
    line-height: 1;
}

/* Shared panel card */
.sob-panel {
    background: var(--card-bg, #fff);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius, 0.375rem);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    padding: 0.875rem 1rem;
}
[data-theme="dark"] .sob-panel {
    background: var(--gray-100);
    border-color: var(--gray-300);
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

/* Settings content */
.sob-settings-content {}

.sob-settings-section {
    margin-bottom: 0.875rem;
}
.sob-settings-section:last-child { margin-bottom: 0; }

.sob-settings-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    margin-bottom: 0.5rem;
}

.sob-indent {
    padding-left: 0.75rem;
    border-left: 2px solid var(--gray-200);
}

/* Radio chips */
.sob-radio-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.sob-radio-chip {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 2rem;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--gray-700);
    transition: border-color 0.15s, background 0.15s, color 0.15s;
    user-select: none;
}
.sob-radio-chip input[type="radio"] { display: none; }
.sob-radio-chip.active {
    border-color: var(--brand-blue, #3b82f6);
    background: color-mix(in srgb, var(--brand-blue, #3b82f6) 8%, transparent);
    color: var(--brand-blue, #3b82f6);
    font-weight: 600;
}

/* Checkbox rows */
.sob-checkbox-row {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--gray-700);
    cursor: pointer;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}
.sob-checkbox-row:last-child { margin-bottom: 0; }
.sob-checkbox-row input[type="checkbox"] { margin-top: 0.15em; flex-shrink: 0; }

@media (max-width: 600px) {
    .sob-settings-content { padding: 0.75rem 1.25rem 1.5rem; }
}

/* =====================================================
   M17 — Order / Quote page
   ===================================================== */

/* Nav item badge (cart count on sidebar Order/Quote link) */
.nav-item-badge {
    position: absolute;
    top: -4px;
    right: -6px;
    background: var(--danger);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    min-width: 14px;
    height: 14px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    line-height: 1;
    pointer-events: none;
}

/* Compact read-only lines table (steps 2 & 3) */
.oq-compact-lines {
    overflow-x: auto;
}

.oq-compact-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.oq-compact-table thead th {
    text-align: left;
    padding: 0.5rem 0.75rem;
    border-bottom: 2px solid var(--gray-200);
    font-weight: 600;
    color: var(--gray-600);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.oq-compact-table tbody td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}

.oq-compact-table tbody tr:last-child td {
    border-bottom: none;
}

.oq-col-qty   { width: 60px; text-align: right; white-space: nowrap; }
.oq-col-price { width: 90px; text-align: right; white-space: nowrap; }
.oq-col-total { width: 90px; text-align: right; white-space: nowrap; font-weight: 600; color: var(--gray-800); }

/* Category-sort group header row */
.oq-category-header-row td { padding: 0; border-bottom: none; }
.oq-category-header {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    background: var(--gray-50);
    padding: 0.3rem 0.75rem !important;
    border-top: 1px solid var(--gray-200);
}
.oq-category-header-row:first-child .oq-category-header { border-top: none; }

/* Card title row with sort toggle — sits inside .card (which already has padding) */
.card-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}
.card-title-row .card-title { margin-bottom: 0; }
.oq-sort-toggle { font-size: 0.8rem; padding: 0.25rem 0.6rem; }

/* Extra bottom breathing room so action buttons don't sit flush at the viewport edge */
.so-page.embedded {
    padding-bottom: 2.5rem;
}

/* Action row with Create Quote / Create Order buttons */
.oq-action-row {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.oq-btn-quote,
.oq-btn-order {
    display: flex;
    align-items: center;
}

.so-stock-block-msg {
    flex: 1;
    font-size: 0.8125rem;
    color: var(--warning-700, #b45309);
    background: var(--warning-50, #fffbeb);
    border: 1px solid var(--warning-200, #fde68a);
    border-radius: 0.375rem;
    padding: 0.25rem 0.625rem;
}

/* Print/Email card */
.oq-print-email-card {}

/* Email form */
.oq-email-form {
    border-top: 1px solid var(--gray-200);
    padding-top: 1rem;
    margin-top: 0.25rem;
}

@media (max-width: 480px) {
    .oq-action-row {
        flex-direction: column;
    }
    .oq-btn-quote,
    .oq-btn-order {
        width: 100%;
        justify-content: center;
    }
}

/* ── Product item shared components ────────────────────────────────────────── */

/* NOT IMPLEMENTED banner (History/Info modals) */
.pi-not-impl {
    background: #fef9c3;
    border: 1px solid #fde047;
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    margin-bottom: 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #713f12;
}

/* Icon-only action buttons (History, Info in action row) */
.pi-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 22px;
    padding: 0;
    border: 1px solid var(--gray-300);
    border-radius: 0.25rem;
    background: var(--bg);
    color: var(--gray-600);
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
    flex-shrink: 0;
    position: relative;
}
.pi-icon-btn:hover { background: var(--gray-100); border-color: var(--gray-400); }

/* Pricing tab — price level table */
.pi-price-table-wrap { overflow-x: auto; }
.pi-price-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}
.pi-price-table th {
    text-align: left;
    padding: 0.4rem 0.75rem;
    background: var(--gray-100);
    border-bottom: 1px solid var(--gray-300);
    font-weight: 600;
    color: var(--gray-600);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.pi-price-table td {
    padding: 0.45rem 0.75rem;
    border-bottom: 1px solid var(--gray-200);
    color: var(--gray-800);
    font-variant-numeric: tabular-nums;
}
.pi-price-table .pi-price-num { text-align: right; }
.pi-price-table .pi-price-cost-row td {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-600);
    font-size: 0.82rem;
}
.pi-price-table tbody tr:last-child td { border-bottom: none; }

/* Note dot indicator */
.pi-note-dot {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--primary);
}
.pi-note-has-value { border-color: var(--primary); color: var(--primary); }

/* Note popup */
.pi-note-popup {
    background: var(--bg);
    border: 1px solid var(--gray-300);
    border-radius: 0.5rem;
    padding: 0.5rem;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}
.pi-note-textarea {
    width: 100%;
    box-sizing: border-box;
    resize: vertical;
    font-size: 0.8rem;
    padding: 0.375rem 0.5rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.25rem;
    font-family: inherit;
    background: var(--bg);
    color: var(--gray-800);
    min-height: 64px;
}
.pi-note-textarea:focus { outline: none; border-color: var(--primary); }
.pi-note-clear {
    align-self: flex-start;
    font-size: 0.75rem;
    color: var(--danger);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}
.pi-note-clear:hover { text-decoration: underline; }

/* Stock button in product action rows */
.pi-stock-btn {
    font-size: 0.72rem;
    height: 22px;
}

/* Product tile actions row (History + Info icons) */
.product-tile-actions-row {
    display: flex;
    gap: 0.3rem;
    margin-top: 0.25rem;
    margin-bottom: 0.1rem;
}

/* Unit price cell in order lines */
.so-unit-price-cell {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.so-unit-price-override {
    display: flex;
    align-items: center;
}
.product-price-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-800);
    white-space: nowrap;
}
.product-price-value.price-struck {
    text-decoration: line-through;
    color: var(--gray-400);
    font-weight: 400;
}
.product-price-uom {
    font-size: 0.75rem;
    color: var(--gray-500);
    font-weight: 400;
}

/* Updated lines table column widths — product col grows to fill */
.so-lines-table .so-lt-product { width: auto; min-width: 180px; }
.so-lines-table .so-lt-img    { width: 90px; min-width: 90px; }
.so-lines-table .so-lt-price  { width: 120px; }
.so-lines-table .so-lt-qty    { width: 112px; }
.so-lines-table .so-lt-total  { width: 80px; font-weight: 700; text-align: right; white-space: nowrap; color: var(--gray-800); }
.so-lines-table .so-lt-remove { width: 38px; text-align: center; }

/* SOB panel dropdown: override to ensure no position:absolute rules interfere */
.sob-panel-dropdown {
    z-index: 3000 !important;
}

/* ---- Lines step: full-width page layout (issues 1, 2, 6) ---- */
.so-lines-page {
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding-bottom: 4.5rem; /* space for fixed footer */
}

.so-lines-page > .page-title {
    padding: var(--page-padding) var(--page-padding) 0;
    flex-shrink: 0;
}

.so-lines-header {
    background: var(--bg);
    border-bottom: 1px solid var(--gray-200);
    padding: 1rem 1.5rem;
    position: sticky;
    top: 56px;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}


/* Strip card look from stepper when inline in header */
.so-lines-header .so-step-indicator {
    margin: 0;
    padding: 0;
    background: none;
    border: none;
    flex-shrink: 0;
}

.so-lines-body {
    padding: 1.5rem;
}

.so-lines-footer {
    position: fixed;
    bottom: 0;
    left: var(--sidebar-w, 0px);
    right: 0;
    background: var(--bg);
    border-top: 1px solid var(--gray-200);
    padding: 0.875rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    z-index: 150;
    box-shadow: 0 -4px 20px rgba(124,111,255,0.12);
}

@media (max-width: 768px) {
    .so-lines-footer {
        left: 0;
    }
}

@media (max-width: 480px) {
    .so-lines-footer {
        flex-wrap: wrap;
        padding: 0.625rem 0.875rem;
        gap: 0.5rem;
    }
    /* Create Quote + Create Order: side-by-side, equal halves, first row */
    .so-lines-footer .oq-btn-quote,
    .so-lines-footer .oq-btn-order {
        flex: 1;
        justify-content: center;
        white-space: nowrap;
        order: 0;
    }
    /* Save as Draft: full-width second row */
    .so-lines-footer .btn:not(.oq-btn-quote):not(.oq-btn-order) {
        width: 100%;
        order: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        white-space: nowrap;
    }
}

@media (max-width: 600px) {
    .so-lines-header {
        padding: 0.75rem 1rem;
        top: 48px;
    }
    .so-lines-body {
        padding: 1rem;
    }
}

/* Add Products section inside the lines card (issue 4) */
.so-add-products-section {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--gray-100);
}

/* ── ProductPopup (item 2.2) ─────────────────────────────────────────── */

/* 2-line clamp on catalog tile description */
.pp-name-clamp {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Clickable name in order lines */
.pp-name-link {
    cursor: pointer;
    color: inherit;
}
.pp-name-link:hover { text-decoration: underline; }

/* Two-panel layout: image left, content right */
.pp-layout {
    display: flex;
    gap: 1.25rem;
    min-height: 260px;
}
.pp-image-panel {
    flex: 0 0 180px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}
.pp-product-image {
    width: 180px;
    height: 180px;
    object-fit: contain;
    border-radius: var(--radius);
    background: var(--bg);
}
.pp-content-panel {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.pp-tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 0.75rem;
    border-bottom: 1.5px solid var(--gray-200);
    padding-bottom: 0.25rem;
}
.pp-tab-btn {
    padding: 0.3rem 0.85rem;
    border: none;
    background: none;
    font-size: 0.875rem;
    font-family: inherit;
    color: var(--gray-600);
    cursor: pointer;
    border-radius: var(--radius) var(--radius) 0 0;
    transition: color 0.12s, background 0.12s;
}
.pp-tab-btn:hover { color: var(--gray-800); background: var(--gray-100); }
.pp-tab-btn.active { color: var(--primary); font-weight: 600; border-bottom: 2px solid var(--primary); margin-bottom: -1.5px; }
.pp-tab-body { flex: 1; overflow-y: auto; }
.pp-loading { display: flex; align-items: center; gap: 0.5rem; color: var(--gray-500); padding: 1rem 0; font-size: 0.875rem; }
.pp-error   { color: var(--danger); padding: 0.5rem 0; font-size: 0.875rem; }
.pp-empty   { color: var(--gray-500); padding: 0.5rem 0; font-size: 0.875rem; }
.pp-info-tabs { display: flex; gap: 0.25rem; margin-bottom: 0.75rem; }
.pp-meta  { font-size: 0.8rem; color: var(--gray-500); margin-bottom: 0.4rem; }
.pp-description { color: var(--gray-700); line-height: 1.6; margin-bottom: 0.75rem; font-size: 0.9rem; }
.pp-overview { font-size: 0.9rem; }
.pp-long-description {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--gray-200);
    font-size: 0.85rem;
    color: var(--gray-700);
    line-height: 1.6;
    white-space: pre-wrap;
}

/* Mobile: stack image above content */
@media (max-width: 600px) {
    .pp-layout { flex-direction: column; }
    .pp-image-panel { flex: none; width: 100%; justify-content: center; }
    .pp-product-image { width: 140px; height: 140px; }
}

/* ============================================================
   Header sync button + popup  (Prompt 5)
   ============================================================ */
.sync-header-wrap {
    position: relative;
}

.sync-header-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 36px;
    height: 32px;
    border: none;
    border-radius: 0;
    background: transparent;
    color: var(--warning, #f59e0b);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.sync-header-btn:hover,
.sync-header-btn.active {
    background: rgba(245, 158, 11, 0.12);
    color: var(--warning, #f59e0b);
}

.sync-header-badge {
    position: absolute;
    top: 1px;
    right: 1px;
    min-width: 14px;
    height: 14px;
    padding: 0 3px;
    background: var(--warning, #f59e0b);
    color: #fff;
    border-radius: 7px;
    font-size: 0.6rem;
    font-weight: 700;
    line-height: 14px;
    text-align: center;
    pointer-events: none;
}

.sync-header-popup {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 280px;
    background: var(--bg);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.08);
    padding: 0.875rem;
    z-index: 500;
}

[data-theme="dark"] .sync-header-popup {
    border-color: var(--gray-700);
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.sync-popup-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 0.5rem;
}

.sync-popup-reasons {
    margin: 0 0 0.75rem 0;
    padding: 0 0 0 1.1rem;
    font-size: 0.8rem;
    color: var(--gray-600);
    line-height: 1.6;
}

.sync-popup-reasons li { margin-bottom: 0.1rem; }

.sync-popup-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Make header popup mobile-friendly */
@media (max-width: 600px) {
    .sync-header-popup {
        position: fixed;
        top: 60px;
        right: 0.75rem;
        left: 0.75rem;
        width: auto;
    }
}

/* ============================================================
   Mobile customer pill — centered in header
   ============================================================ */
@media (max-width: 600px) {
    .header-spacer { display: none; }
    .header-customer {
        position: absolute;
        left: 0;
        right: 0;
        margin: 0 auto;
        width: fit-content;
        flex: unset;
        min-width: unset;
        z-index: 1;
    }
    .header { gap: 0.25rem; }
    .header-username { padding: 0.25rem; }
}

/* ============================================================
   Mobile menu — action strip (cart / sync / user) at top
   ============================================================ */
/* Mobile menu selector section (customer + rep pickers stacked) */
.mobile-menu-selectors {
    display: flex;
    flex-direction: column;
    gap: 0;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.mobile-menu-picker-wrap {
    position: relative;
    border-bottom: 1px solid var(--gray-100);
}
.mobile-menu-picker-wrap:last-child { border-bottom: none; }

.mobile-menu-picker-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.65rem 1.25rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-muted);
    text-align: left;
}
.mobile-menu-picker-btn.has-value { color: var(--text); font-weight: 500; }
.mobile-menu-picker-btn span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.mobile-menu-picker-dropdown {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 0.5rem 0.75rem 0.75rem;
    max-height: 280px;
    overflow-y: auto;
}

.mobile-menu-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: var(--primary-light);
    border-bottom: 2px solid var(--primary);
    flex-shrink: 0;
}
[data-theme="dark"] .mobile-menu-actions {
    background: rgba(56,189,248,0.08);
    border-bottom-color: rgba(56,189,248,0.35);
}
.mobile-menu-actions .cart-btn,
.mobile-menu-actions .sync-header-btn {
    border-radius: 0;
}
.mobile-action-user {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--primary);
    margin-left: auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}
.mobile-action-user span {
    overflow: hidden;
    text-overflow: ellipsis;
}
[data-theme="dark"] .mobile-action-user {
    color: var(--primary);
}

/* ============================================================
   Home page — compact sync card  (Prompt 5 rev)
   ============================================================ */

/* Card with no internal padding — sections provide their own */
.hs-card { padding: 0 !important; }

/* Each section inside the sync card */
.hs-section {
    padding: 0.75rem 1.1rem;
    border-bottom: 1px solid var(--gray-100);
}
.hs-section-last { border-bottom: none; }
[data-theme="dark"] .hs-section { border-bottom-color: var(--gray-800); }

/* Section header row: title+badge on left, button on right */
.hs-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.3rem;
}

.hs-title-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ALL-CAPS section title with left accent bar */
.hs-section-title {
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.07em;
    color: var(--gray-600);
    text-transform: uppercase;
    border-left: 3px solid var(--primary);
    padding-left: 0.45rem;
    line-height: 1.2;
}

/* Status badges */
.hs-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}
.hs-badge-none    { background: var(--gray-100);              color: var(--gray-500);           border: 1px solid var(--gray-200); }
.hs-badge-fresh   { background: rgba(16,185,129,0.1);         color: #059669;                    border: 1px solid rgba(16,185,129,0.25); }
.hs-badge-pending { background: rgba(245,158,11,0.12);        color: var(--warning, #f59e0b);    border: 1px solid rgba(245,158,11,0.3); }

[data-theme="dark"] .hs-badge-none    { background: var(--gray-800); color: var(--gray-400); border-color: var(--gray-700); }
[data-theme="dark"] .hs-badge-fresh   { background: rgba(16,185,129,0.15); border-color: rgba(16,185,129,0.3); }
[data-theme="dark"] .hs-badge-pending { background: rgba(245,158,11,0.18); border-color: rgba(245,158,11,0.4); }

/* Sub-text below Sync All title */
.hs-sub {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin: 0;
    line-height: 1.4;
}

/* Row list (upload + download items) */
.hs-rows {
    display: flex;
    flex-direction: column;
    margin-top: 0.25rem;
}

.hs-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.22rem 0;
    font-size: 0.82rem;
}

/* Bullet dot */
.hs-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--gray-300);
    flex-shrink: 0;
}
.hs-dot-active { background: var(--warning, #f59e0b); }

/* Step icon wrapper (download rows) */
.hs-step-icon {
    width: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.hs-check  { color: var(--success); font-weight: 700; font-size: 0.9rem; line-height: 1; }
.hs-error  { color: var(--danger);  font-weight: 700; font-size: 0.9rem; line-height: 1; }
.hs-spinner {
    width: 12px !important;
    height: 12px !important;
    border-color: var(--gray-300) !important;
    border-top-color: var(--primary) !important;
}

/* Clickable row (orders/quotes with pending items) */
.hs-row-clickable {
    cursor: pointer;
    border-radius: 4px;
}
.hs-row-clickable:hover {
    background: var(--primary-light);
}

/* Row label — grows to fill space */
.hs-row-label { flex: 1; color: var(--gray-700); }
.hs-muted     { color: var(--gray-400) !important; }

/* Time / age text on right */
.hs-row-time { font-size: 0.78rem; color: var(--gray-400); text-align: right; white-space: nowrap; }
.hs-stale    { color: var(--warning, #f59e0b) !important; font-weight: 600; }

/* Upload link button */
.hs-upload-link {
    font-size: 0.78rem;
    color: var(--primary);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
    white-space: nowrap;
    transition: color 0.12s;
}
.hs-upload-link:hover:not(:disabled) { color: var(--primary-dark, #5b4dd4); text-decoration: underline; }
.hs-upload-link:disabled,
.hs-upload-link.hs-muted { color: var(--gray-400); cursor: default; }

/* Data Downloads header controls (checkbox + Download All) */
.hs-download-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}
.hs-include-images {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8rem;
    cursor: pointer;
    white-space: nowrap;
}

/* Narrow screens: header controls don't fit beside the title/badge —
   wrap them onto their own full-width row instead of squeezing. */
@media (max-width: 480px) {
    .hs-section-header { flex-wrap: wrap; }
    .hs-download-controls {
        flex: 1 1 100%;
        justify-content: space-between;
        margin-top: 0.4rem;
    }
}

/* Quick Order preview modal table */
.qop-table { width: 100%; border-collapse: collapse; }
.qop-table th { padding: 0.4rem 0.75rem; border-bottom: 2px solid var(--gray-200); font-size: 0.8rem; color: var(--gray-500); text-align: left; font-weight: 600; }
.qop-table td { padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
.qop-table tr:last-child td { border-bottom: none; }
.qop-table .qop-price { text-align: right; white-space: nowrap; font-weight: 600; width: 100px; }
.qop-table .qop-check { width: 36px; padding-left: 0.75rem; padding-right: 0.25rem; }
.qop-table .qop-qty { width: 80px; text-align: center; }
.qop-qty-input { width: 60px; padding: 0.25rem 0.35rem; border: 1px solid var(--gray-300); border-radius: 4px; font-size: 0.875rem; text-align: center; }
.qop-qty-input:disabled { background: var(--gray-100); color: var(--gray-400); }
.qop-row-unchecked td { opacity: 0.4; }
.qop-name { font-weight: 600; font-size: 0.875rem; color: var(--gray-800); }
.qop-code { font-size: 0.72rem; color: var(--gray-500); font-family: 'SF Mono', 'Consolas', monospace; }

/* ============================================================
   Settings Page
   ============================================================ */

.settings-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--gray-100);
    gap: 1rem;
}

.settings-row:last-of-type {
    border-bottom: none;
}

.settings-label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.settings-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-900);
}

[data-theme="dark"] .settings-value {
    color: var(--gray-100);
}

.settings-description {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 1.25rem;
}
.settings-welcome-link {
    display: inline-block;
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--brand-blue, #2563eb);
    text-decoration: none;
}
.settings-welcome-link:hover { text-decoration: underline; }

.settings-counts {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

@media (max-width: 480px) {
    .settings-counts {
        grid-template-columns: repeat(2, 1fr);
    }
}

.settings-count-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 0.75rem 0.5rem;
    gap: 0.25rem;
}

[data-theme="dark"] .settings-count-item {
    background: rgba(255,255,255,0.04);
    border-color: rgba(255,255,255,0.08);
}

.settings-count-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
}

.settings-count-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-align: center;
}

.settings-alert {
    padding: 0.65rem 0.9rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.settings-alert--success {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.settings-alert--error {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

[data-theme="dark"] .settings-alert--success {
    background: #14532d;
    color: #4ade80;
    border-color: #166534;
}

[data-theme="dark"] .settings-alert--error {
    background: #450a0a;
    color: #f87171;
    border-color: #7f1d1d;
}

.settings-version-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}
.settings-version-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    min-width: 4.5rem;
}
.settings-version-value {
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.settings-confirm {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.5rem;
}

[data-theme="dark"] .settings-confirm {
    background: rgba(255,255,255,0.04);
    border-color: rgba(255,255,255,0.08);
}

.settings-confirm p {
    font-size: 0.875rem;
    color: var(--gray-700);
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

[data-theme="dark"] .settings-confirm p {
    color: var(--gray-300);
}

.settings-confirm-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Theme segmented control */
.theme-segment {
    display: inline-flex;
    background: var(--gray-100);
    border-radius: var(--radius);
    padding: 3px;
    gap: 2px;
}

[data-theme="dark"] .theme-segment {
    background: rgba(255,255,255,0.07);
}

.theme-segment-btn {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 1.1rem;
    border-radius: calc(var(--radius) - 2px);
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
    white-space: nowrap;
}

.theme-segment-btn:hover:not(.active) {
    color: var(--gray-700);
    background: rgba(0,0,0,0.04);
}

[data-theme="dark"] .theme-segment-btn:hover:not(.active) {
    color: var(--gray-200);
    background: rgba(255,255,255,0.06);
}

.theme-segment-btn.active {
    background: var(--bg);
    color: var(--primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.12), 0 0 0 1.5px rgba(0,0,0,0.07);
    font-weight: 600;
}

[data-theme="dark"] .theme-segment-btn.active {
    background: rgba(255,255,255,0.1);
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

/* ── Offline block ── */
.offline-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 4rem 2rem;
    text-align: center;
    color: var(--gray-500);
}
.offline-block-icon {
    font-size: 2.5rem;
}
.offline-block-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--gray-700);
}
.offline-block-msg {
    font-size: 0.9rem;
    max-width: 280px;
}

/* Offline notice inside home sync card */
.hs-offline-notice {
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    color: var(--gray-600);
    font-size: 0.82rem;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.5rem;
    text-align: center;
}

/* ── M18 Active Appointment Widget ────────────────────────────────────────── */

/* ── Dark card for active appointments ─────────────────────────────────────
   The card itself carries an animated dark gradient that acts as the shimmer.
   The header is transparent so the card bg shows through; the body uses
   mix-blend-mode:screen with a near-white background — near-white screened
   against dark ≈ near-white, keeping it readable while letting the gradient
   ripple show faintly through. */
@keyframes aaw-card-bg-shimmer {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.aaw-card--active {
    animation: aaw-card-bg-shimmer 7s ease infinite;
}

.aaw-card--blue {
    background: linear-gradient(
        135deg,
        #0f172a 0%,
        #4865b9 35%,
        #172554 65%,
        #0f172a 100%
    );
    background-size: 300% 300%;
    border-color: transparent;
}
.aaw-card--green {
    background: linear-gradient(
        135deg,
        #0f172a 0%,
        #34995c 35%,
        #052e16 65%,
        #0f172a 100%
    );
    background-size: 300% 300%;
    border-color: transparent;
}

/* Header: transparent so dark card gradient shows through */
.aaw-active-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.aaw-active-header--blue,
.aaw-active-header--green,
.aaw-imminent-header--blue,
.aaw-imminent-header--green {
    background: transparent;
    border-bottom-color: rgba(255,255,255,0.1);
}

/* Light foreground in dark header */
.aaw-card--active .dashboard-card-title,
.aaw-card--imminent .dashboard-card-title {
    color: #f1f5f9;
}
.aaw-card--active .aaw-timer {
    color: rgba(255,255,255,0.6);
}

/* Card body: near-white with screen blend so the card shimmer shows subtly.
   screen(near-white, dark) ≈ near-white — body stays light and readable. */
.aaw-card--active .dashboard-card-body,
.aaw-card--imminent .dashboard-card-body {
    background: rgba(255,255,255,0.94);
    mix-blend-mode: screen;
}

/* Pulsing dot — bright colours for dark background */
.aaw-pulse-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
    animation: aaw-pulse 1.5s infinite;
}
.aaw-pulse-dot--blue  { background: #60a5fa; }
.aaw-pulse-dot--green { background: #34d399; }

@keyframes aaw-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.25; }
}

/* ── Active appointment shimmer — shared wave sweep ─────────────────────────
   Uses mix-blend-mode: screen so it brightens any background colour without
   washing it out. Most visible on coloured backgrounds (call plan cards,
   widget header gradient); barely visible on white (fine — those surfaces
   use pulsing dot / border instead). Pointer-events:none keeps it inert. */

@keyframes active-shimmer {
    0%   { transform: translateX(-180%); }
    100% { transform: translateX(180%); }
}

/* Utility: add this class (or target via CSS) to give the shimmer sweep.
   Requires position:relative + overflow:hidden on the element. */
.appt-active-shimmer,
.appt-active-shimmer::after {
    /* defined below via ::after only */
}
.appt-active-shimmer {
    position: relative;
    overflow: hidden;
}
.appt-active-shimmer::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 55%;
    background: linear-gradient(
        90deg,
        transparent   0%,
        rgba(255,255,255,0.28) 50%,
        transparent 100%
    );
    transform: translateX(-180%);
    animation: active-shimmer 2.6s ease-in-out infinite;
    mix-blend-mode: screen;
    pointer-events: none;
    z-index: 1;
}

.aaw-timer {
    font-size: 0.875rem;
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Imminent mode: time chip next to title */
.aaw-time-chip {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    vertical-align: middle;
}
.aaw-time-chip--blue  { background: #dbeafe; color: #1d4ed8; }
.aaw-time-chip--green { background: #dcfce7; color: #15803d; }

/* Imminent mode: customer name prominence */
.aaw-imminent-customer {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 1rem;
    color: var(--text-primary);
}

/* Conflict message */
.aaw-conflict-msg {
    font-size: 0.875rem;
    color: var(--text-muted);
    background: var(--gray-50, #f9fafb);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 0.65rem 0.75rem;
    margin: 0;
}

.aaw-note-section {
    margin-bottom: 0.75rem;
}

.aaw-note-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.aaw-saved-indicator {
    font-size: 0.7rem;
    color: #16a34a;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
}

.aaw-note-loading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 0.5rem 0;
}

.aaw-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 0.75rem;
}

.aaw-end-btn {
    margin-left: auto;
}

.aaw-error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    border-radius: var(--radius);
    padding: 0.4rem 0.65rem;
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
}

.aaw-impromptu-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: 0 0 0.75rem;
}

/* Retrospective mode (COMPLETE / CANCELLED appointment review card) */
.aaw-retro-times {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.aaw-retro-times strong {
    color: var(--text-primary, #111827);
    font-weight: 600;
}

/* Ensure the status badge sits comfortably in the card header */
.dashboard-card-header .apt-status-badge {
    font-size: 0.7rem;
    padding: 0.15rem 0.45rem;
}

/* Outline variants for End button (don't use btn-danger for a normal workflow action) */
.btn-primary-outline {
    background: transparent;
    border: 1.5px solid var(--brand-blue, #2563eb);
    color: var(--brand-blue, #2563eb);
}
.btn-primary-outline:hover { background: rgba(37,99,235,0.07); }
.btn-success-outline {
    background: transparent;
    border: 1.5px solid #16a34a;
    color: #16a34a;
}
.btn-success-outline:hover { background: rgba(22,163,74,0.07); }

/* ── M18 Header Badge ─────────────────────────────────────────────────────── */

.appt-header-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem 0.25rem 0.5rem;
    border-radius: 1rem;
    border: none;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
    font-family: inherit;
    max-width: 240px;
    transition: opacity 0.15s;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}
.appt-header-badge:hover { opacity: 0.82; }
.appt-header-badge::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 55%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255,255,255,0.45) 50%,
        transparent 100%
    );
    transform: translateX(-180%);
    animation: active-shimmer 2.6s ease-in-out infinite;
    mix-blend-mode: screen;
    pointer-events: none;
}

/* Badge is always dark (inverted accent) regardless of app theme */
.appt-header-badge--blue {
    background: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 100%);
    color: #bfdbfe;
}
.appt-header-badge--green {
    background: linear-gradient(135deg, #14532d 0%, #166534 100%);
    color: #bbf7d0;
}
[data-theme="dark"] .appt-header-badge--blue {
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
    color: #dbeafe;
}
[data-theme="dark"] .appt-header-badge--green {
    background: linear-gradient(135deg, #14532d 0%, #15803d 100%);
    color: #dcfce7;
}

.appt-badge-dot {
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: aaw-pulse 1.5s infinite;
}
/* Bright dot colours for dark badge background */
.appt-badge-dot--blue  { background: #93c5fd; }
.appt-badge-dot--green { background: #86efac; }

.appt-badge-type {
    font-size: 0.7rem;
    letter-spacing: 0.04em;
    font-weight: 700;
    opacity: 0.75;
    flex-shrink: 0;
}
.appt-badge-name {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Customer pill compresses to icon+chevron-only when appointment badge is present */
.customer-pill--compressed .customer-pill-name,
.customer-pill--compressed .customer-pill-code { display: none; }

@media (max-width: 600px) {
    .appt-badge-name { display: none; }
    .appt-header-badge { padding: 0.25rem 0.4rem; }
}

/* ── M18 Dashboard — active appointment indicator on Today's Plan card ────── */

/* Base: stacking context; border/animation come from the type-specific class */
.task-card--active-appt {
    position: relative;
    overflow: hidden;
}

/* VISIT — blue border pulse */
@keyframes active-border-pulse-visit {
    0%, 100% { border-left-color: #2563eb; box-shadow: inset 3px 0 0 #2563eb; }
    50%       { border-left-color: #93c5fd; box-shadow: inset 3px 0 0 #93c5fd; }
}
.task-card--active-visit {
    border-left: 3px solid #2563eb;
    animation: active-border-pulse-visit 1.5s ease-in-out infinite;
}
.task-card--active-visit::after {
    content: '';
    position: absolute;
    top: 0; bottom: 0; left: 0;
    width: 55%;
    background: linear-gradient(90deg, transparent 0%, rgba(37,99,235,0.07) 50%, transparent 100%);
    transform: translateX(-180%);
    animation: active-shimmer 2.6s ease-in-out infinite;
    pointer-events: none;
}

/* PHONECALL — green border pulse */
@keyframes active-border-pulse-phone {
    0%, 100% { border-left-color: #16a34a; box-shadow: inset 3px 0 0 #16a34a; }
    50%       { border-left-color: #4ade80; box-shadow: inset 3px 0 0 #4ade80; }
}
.task-card--active-phone {
    border-left: 3px solid #16a34a;
    animation: active-border-pulse-phone 1.5s ease-in-out infinite;
}
.task-card--active-phone::after {
    content: '';
    position: absolute;
    top: 0; bottom: 0; left: 0;
    width: 55%;
    background: linear-gradient(90deg, transparent 0%, rgba(22,163,74,0.07) 50%, transparent 100%);
    transform: translateX(-180%);
    animation: active-shimmer 2.6s ease-in-out infinite;
    pointer-events: none;
}

/* Active type badge — dark style matching the header badge */
.appt-type-badge--live {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 100%);
    color: #bfdbfe;
}
.appt-type-badge--phone.appt-type-badge--live {
    background: linear-gradient(135deg, #14532d 0%, #166534 100%);
    color: #bbf7d0;
}
.appt-type-badge--live::after {
    content: '';
    position: absolute;
    top: 0; bottom: 0; left: 0;
    width: 55%;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.45) 50%, transparent 100%);
    transform: translateX(-180%);
    animation: active-shimmer 2.6s ease-in-out infinite;
    mix-blend-mode: screen;
    pointer-events: none;
}

/* Pulsing dot inside the live type badge */
.appt-active-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    margin-right: 3px;
    flex-shrink: 0;
    animation: aaw-pulse 1.5s infinite;
    vertical-align: middle;
}
.appt-active-dot--visit { background: #93c5fd; }
.appt-active-dot--phone { background: #86efac; }

/* ── M18 Call Plan — audit times section ─────────────────────────────────── */

.apt-audit-section {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--gray-200);
}

.apt-audit-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.apt-audit-readonly {
    font-size: 0.9rem;
    color: var(--text);
    padding: 0.4rem 0;
}

/* ── M18 Call Plan — appointment status badge ─────────────────────────────── */

.apt-status-badge {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.apt-status-badge--active   { background: #dcfce7; color: #15803d; }
.apt-status-badge--complete { background: #e0e7ff; color: #3730a3; }
.apt-status-badge--cancelled { background: #fee2e2; color: #b91c1c; }
.apt-status-badge--planned  { background: #f3f4f6; color: #6b7280; }

/* ── Welcome page ──────────────────────────────────────────────────────────── */
.welcome-msg-card {
    background: var(--primary-light);
    border-color: var(--primary-mid);
}

/* Initial-sync overlay — blurred backdrop */
.initial-sync-overlay {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

/* Initial-sync modal — fixed width, no close affordance */
.initial-sync-modal {
    width: 100%;
    max-width: 440px;
}

.initial-sync-desc {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0;
}

/* Page Tour button */
.welcome-tour-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.6rem 1.4rem;
    background: linear-gradient(135deg, var(--primary) 0%, #0369a1 100%);
    color: #fff;
    border: none;
    border-radius: 2rem;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(2, 132, 199, 0.35);
    transition: opacity 0.15s, box-shadow 0.15s, transform 0.15s;
    letter-spacing: 0.01em;
}

.welcome-tour-btn:hover {
    opacity: 0.9;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.45);
    transform: translateY(-1px);
}

.welcome-tour-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.3);
}

/* Redirect notice shown after tour completes */
.welcome-redirect-banner {
    margin-top: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 1rem 1.375rem;
    border-radius: 0.75rem;
    background: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 100%);
    color: #bfdbfe;
    font-size: 1rem;
    font-weight: 600;
    animation: fadeIn 0.3s ease;
}
[data-theme="dark"] .welcome-redirect-banner {
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
    color: #dbeafe;
}
.welcome-redirect-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: #93c5fd;
    flex-shrink: 0;
    animation: pulse 1.5s ease-in-out infinite;
}

.welcome-message {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0;
}

.welcome-section + .welcome-section {
    margin-top: 1.25rem;
}

.welcome-section--divided {
    padding-top: 1.25rem;
    border-top: 1px solid var(--gray-200);
}

[data-theme="dark"] .welcome-section--divided {
    border-top-color: rgba(255,255,255,0.08);
}

.welcome-section-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0.5rem 0 0.75rem;
}

.welcome-tour-link {
    color: var(--primary);
    text-decoration: underline;
    cursor: pointer;
}

/* ── Speech / Dictation ─────────────────────────────────────────────────── */

/* Shared mic button — used inside both SpeechInput and SpeechRichEditor */
.speech-mic-icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    flex-shrink: 0;
    transition: color 0.15s;
}
.speech-mic-icon-btn:hover:not(:disabled) { color: var(--primary); }
.speech-mic-icon-btn:disabled { opacity: 0.4; cursor: default; }

/* Waveform bars — heights driven by JS AudioAnalyser, no CSS animation */
.speech-waveform-bar {
    width: 3px;
    background: var(--primary);
    border-radius: 2px;
    flex-shrink: 0;
    transition: height 0.05s ease-out;
    position: relative;
    z-index: 1;
}

/* Cancel (×): plain borderless icon, muted colour */
.speech-record-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    align-items: center;
}
.speech-cancel-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    flex-shrink: 0;
    transition: color 0.15s;
}
.speech-cancel-btn:hover { color: var(--danger, #e53e3e); }

/* Confirm (✓): solid primary blue pill */
.speech-confirm-btn {
    background: var(--primary);
    color: #fff;
    border: none;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
    transition: opacity 0.15s;
}
.speech-confirm-btn:hover { opacity: 0.88; }

/* Error message below any speech field */
.speech-field-error {
    font-size: 0.8rem;
    color: var(--danger, #e53e3e);
    margin-top: 0.2rem;
}

/* ── SpeechInput (<input> or <textarea> wrapper) ── */
.speech-input-wrap {
    position: relative;
}
/* Right padding so text doesn't slide under the mic icon */
.speech-input-wrap .speech-field.has-mic {
    padding-right: 34px;
}
/* Single-line: mic is vertically centred */
.speech-input-wrap .speech-mic-icon-btn {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
}
/* Multiline (textarea): mic pins to the top */
.speech-input-wrap.is-multiline .speech-mic-icon-btn {
    top: 8px;
    transform: none;
}
/* Spinner mirrors mic position */
.speech-input-wrap .spinner-anchor {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
}
.speech-input-wrap.is-multiline .spinner-anchor {
    top: 10px;
    transform: none;
}
/* Recording block replaces the field during capture */
.speech-recording-block {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius, 4px);
    background: var(--bg, var(--surface));
    min-height: 38px;
}
.speech-recording-block.is-multiline {
    min-height: 80px;
}
/* SpeechInput waveform (inside recording block, centred in the field height) */
.speech-recording-block .speech-waveform {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 1;
    height: 28px;
    padding-right: 8px;
}

/* ── SpeechRichEditor (Quill wrapper) ── */
.speech-rich-wrap {
    position: relative; /* positioning context for the absolute overlay */
}

/* Idle: mic button floating at bottom-right inside the editor */
.speech-rich-overlay {
    position: absolute;
    bottom: 10px;
    right: 10px;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg, var(--surface));
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 5px 7px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.14);
}

/* Recording + transcribing: full-width bar flush with the editor bottom */
.speech-rich-overlay.is-recording,
.speech-rich-overlay.is-transcribing {
    left: 0;
    right: 0;
    bottom: 0;
    height: 44px;
    border-radius: 0 0 var(--radius, 4px) var(--radius, 4px);
    border: none;
    border-top: 1px solid var(--border);
    padding: 0 12px;
    box-shadow: none;
    background: var(--bg, var(--surface));
}
.speech-rich-overlay.is-recording    { justify-content: space-between; margin: 5px; }
.speech-rich-overlay.is-transcribing { justify-content: center; gap: 10px; }

.speech-transcribing-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Waveform — dotted centre baseline via ::before, bars float above it */
.speech-waveform {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 1;
    height: 32px;
    padding-right: 8px;
    position: relative;
}
.speech-waveform::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    border-top: 1.5px dotted var(--border);
    z-index: 0;
}

/* ── Group Patterns & Insights widget ─────────────────────────────── */
.grp-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-secondary, #666);
}
.grp-empty-icon {
    display: flex;
    justify-content: center;
    color: var(--gray-400);
    margin-bottom: 0.5rem;
}
.grp-empty-sub {
    margin-top: 0.4rem;
    font-size: 0.85rem;
}
.grp-section {
    margin-top: 1.25rem;
}
.grp-members-table {
    grid-template-columns: 2fr repeat(4, 1fr);
}
.grp-products-table {
    grid-template-columns: 2fr repeat(4, 1fr);
}
.grp-row-mine {
    background: var(--primary-tint, #eff6ff);
    font-weight: 500;
}
.grp-row-opportunity {
    background: var(--warning-tint, #fffbeb);
}
.grp-mine-badge {
    display: inline-block;
    margin-left: 0.4rem;
    padding: 1px 6px;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--primary, #2563eb);
    color: #fff;
    vertical-align: middle;
}
.grp-pct-bar-wrap {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.grp-pct-bar {
    height: 6px;
    border-radius: 3px;
    background: var(--primary, #2563eb);
    min-width: 2px;
    max-width: 80px;
    flex-shrink: 0;
}
@media (max-width: 700px) {
    .grp-members-table,
    .grp-products-table {
        grid-template-columns: 1fr;
    }
}

/* ── Cash Sale button (header) ───────────────────────────────────────────── */
.cash-sale-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.65rem;
    border-radius: var(--radius);
    border: 1px solid var(--gray-300);
    background: var(--gray-50);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--gray-500);
    white-space: nowrap;
    letter-spacing: 0.03em;
    font-family: inherit;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.cash-sale-btn:hover {
    border-color: #16a34a;
    color: #16a34a;
    background: #f0fdf4;
}
.cash-sale-btn--active {
    border-color: #16a34a;
    background: #f0fdf4;
    color: #16a34a;
    font-weight: 700;
}
.cash-sale-btn--active:hover {
    background: #dcfce7;
}
[data-theme="dark"] .cash-sale-btn {
    background: rgba(176,171,255,0.05);
    border-color: rgba(176,171,255,0.2);
    color: rgba(176,171,255,0.5);
}
[data-theme="dark"] .cash-sale-btn:hover {
    border-color: #4ade80;
    color: #4ade80;
    background: rgba(74,222,128,0.08);
}
[data-theme="dark"] .cash-sale-btn--active {
    border-color: #4ade80;
    background: rgba(74,222,128,0.12);
    color: #4ade80;
}
[data-theme="dark"] .cash-sale-btn--active:hover {
    background: rgba(74,222,128,0.2);
}

/* ── Price mode badge ($ / !) ────────────────────────────────────────────── */
.price-mode-badge {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 800;
    vertical-align: super;
    line-height: 1;
    margin-left: 1px;
    opacity: 0.9;
}
.price-mode-cash     { color: #22c55e; }
.price-mode-customer { color: #f59e0b; }

/* ── Test order mode ribbon ──────────────────────────────────────────────── */
.test-order-mode-ribbon {
    position: fixed;
    bottom: 22px;
    right: -54px;
    z-index: 9999;
    pointer-events: none;
    width: 220px;
    padding: 6px 0;
    background: #d6009c;
    color: #fff;
    font-weight: 800;
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    text-align: center;
    text-transform: uppercase;
    border-top: 1px dashed rgba(255,255,255,0.85);
    border-bottom: 1px dashed rgba(255,255,255,0.85);
    box-shadow: 0 2px 8px rgba(0,0,0,0.35);
    transform: rotate(-45deg);
}


/* ══════════════════════════════════════════════════════════════════════════
   VISION (MG-202609) — order intelligence workspace (mock-up)
   Order Proposal reuses the real Order/Quote page look via the shared
   OrderEditor component (.so-lines-* / .so-summary — see order.js).
   ══════════════════════════════════════════════════════════════════════════ */

/* Local accent tints (theme-agnostic rgba over the card background) */
.vision-page { --v-alert: 239,68,68; --v-warn: 217,119,6; --v-info: 2,132,199; --v-ok: 16,185,129; }

.vision-workspace { display: flex; gap: 1.25rem; align-items: flex-start; margin-top: 0.25rem; }

/* ── LEFT: Recommended Tasks ── */
.vision-tasks {
    width: 320px; flex-shrink: 0;
    background: var(--bg); border: 1px solid var(--gray-200);
    border-radius: var(--radius); box-shadow: var(--shadow);
    position: sticky; top: 0.5rem;
    max-height: calc(100vh - 130px); display: flex; flex-direction: column; overflow: hidden;
}
.vision-tasks-head { padding: 1rem 1.1rem; border-bottom: 1px solid var(--gray-200); }
.vision-tasks-title { font-size: 0.95rem; font-weight: 700; color: var(--gray-800); display: flex; align-items: center; gap: 0.5rem; }
.vision-tasks-count { font-size: 0.78rem; font-weight: 700; background: var(--primary-light); color: var(--primary); border-radius: 10px; padding: 0.1rem 0.55rem; }
.vision-tasks-filters { display: flex; gap: 0.4rem; padding: 0.75rem 1.1rem; border-bottom: 1px solid var(--gray-200); }
.vision-filter { font-size: 0.78rem; padding: 0.3rem 0.75rem; border-radius: 12px; border: 1px solid var(--gray-300); background: transparent; color: var(--gray-500); cursor: pointer; }
.vision-filter-on { background: var(--primary); color: #fff; border-color: var(--primary); }
.vision-tasks-list { flex: 1; overflow-y: auto; padding: 0.85rem; display: flex; flex-direction: column; gap: 0.65rem; }
.vision-tasks-empty { padding: 1.5rem 0.75rem; text-align: center; color: var(--gray-400); font-size: 0.85rem; }

.vt-card {
    display: block; width: 100%; text-align: left;
    background: var(--bg); border: 1px solid var(--gray-200); border-left: 4px solid var(--gray-300);
    border-radius: var(--radius); padding: 0.9rem 1rem; cursor: pointer;
    transition: border-color 0.12s, background 0.12s;
}
.vt-card:hover { border-color: var(--gray-300); background: var(--gray-50); }
.vt-selected { border-left-color: var(--primary); background: var(--primary-light); border-color: var(--primary-mid, var(--gray-200)); }
.vt-dimmed { opacity: 0.6; }
.vt-top { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; }
.vt-name { font-size: 0.92rem; font-weight: 600; color: var(--gray-800); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vt-val { font-size: 0.88rem; font-weight: 700; color: var(--success); flex-shrink: 0; }
.vt-meta { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-top: 0.35rem; font-size: 0.8rem; color: var(--gray-500); }
.vt-meta span { display: inline-flex; align-items: center; gap: 0.3rem; }
.vt-seg { color: var(--gray-400); }
.vt-urg { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.65rem; }
.vt-urg-label { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--gray-400); }
.vt-urg-track { flex: 1; height: 5px; background: var(--gray-200); border-radius: 3px; overflow: hidden; }
.vt-urg-fill { display: block; height: 100%; border-radius: 3px; }
.vt-urg-score { font-size: 0.78rem; font-weight: 700; min-width: 1.5rem; text-align: right; }
.vt-flags { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.65rem; }
.vt-flag { font-size: 0.7rem; font-weight: 600; padding: 0.15rem 0.55rem; border-radius: 8px; border: 1px solid; }
.vt-flag-alert { background: rgba(var(--v-alert),0.12); border-color: rgba(var(--v-alert),0.3); color: rgb(var(--v-alert)); }
.vt-flag-warn  { background: rgba(var(--v-warn),0.12);  border-color: rgba(var(--v-warn),0.3);  color: rgb(var(--v-warn)); }
.vt-flag-info  { background: rgba(var(--v-info),0.12);  border-color: rgba(var(--v-info),0.3);  color: var(--primary); }
.vt-flag-ok    { background: rgba(var(--v-ok),0.12);    border-color: rgba(var(--v-ok),0.3);    color: var(--success); }

/* ── RIGHT: main column ── */
.vision-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.vision-main-scroll { flex: 1; min-width: 0; }

.vision-empty { text-align: center; padding: 4rem 1rem; color: var(--gray-400); }
.vision-empty-title { font-size: 1.05rem; font-weight: 700; color: var(--gray-500); margin-bottom: 0.4rem; }
.vision-empty-sub { font-size: 0.9rem; max-width: 20rem; margin: 0 auto; line-height: 1.5; }

/* Sticky action bar */
.vision-action-bar {
    position: sticky; bottom: 0; z-index: 20;
    display: flex; align-items: center; gap: 0.6rem;
    padding: 0.9rem 1.1rem; margin-top: 0.75rem;
    background: var(--bg); border: 1px solid var(--gray-200); border-radius: var(--radius);
    box-shadow: 0 -4px 16px rgba(0,0,0,0.08);
}
.vision-action-spacer { flex: 1; }
.vision-decline-btn { color: var(--danger); border-color: rgba(var(--v-alert),0.4); }
.vision-decline-btn:hover { background: rgba(var(--v-alert),0.08); }

/* Proposal header */
.vp-head { margin-bottom: 1.25rem; }
.vp-name { font-size: 1.35rem; font-weight: 800; color: var(--gray-900); letter-spacing: -0.02em; margin-bottom: 0.5rem; }
.vp-chips { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; row-gap: 0.5rem; }
.vp-chip { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.82rem; color: var(--gray-500); }
.vp-conf { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.78rem; font-weight: 700; color: var(--primary); background: var(--primary-light); border: 1px solid rgba(var(--v-info),0.3); border-radius: 6px; padding: 0.15rem 0.55rem; }
.vp-card { padding: 1.25rem 1.4rem; margin-bottom: 1rem; }
.vp-ai { background: var(--primary-light); border: 1px solid rgba(var(--v-info),0.25); border-radius: 8px; padding: 0.9rem 1.05rem; font-size: 0.92rem; line-height: 1.65; color: var(--gray-700); margin-bottom: 0.75rem; }
.vp-sigs { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.vp-sig { font-size: 0.75rem; background: var(--primary-light); border: 1px solid rgba(var(--v-info),0.25); border-radius: 10px; padding: 0.18rem 0.6rem; color: var(--primary); }

/* Advisory pill (next to confidence badge) + click-to-open popover */
.vp-adv-badge { font-size: 0.72rem; font-weight: 700; padding: 0.18rem 0.6rem; border-radius: 8px; border: 1px solid; cursor: pointer; font-family: inherit; }
.vp-adv-badge-alert { background: rgba(var(--v-alert),0.1); border-color: rgba(var(--v-alert),0.3); color: rgb(var(--v-alert)); }
.vp-adv-badge-warn  { background: rgba(var(--v-warn),0.1);  border-color: rgba(var(--v-warn),0.3);  color: rgb(var(--v-warn)); }
.vp-adv-badge-info  { background: rgba(var(--v-info),0.1);  border-color: rgba(var(--v-info),0.3);  color: var(--primary); }
.vp-adv-badge-ok    { background: rgba(var(--v-ok),0.1);    border-color: rgba(var(--v-ok),0.3);    color: var(--success); }
.vp-adv-badge:hover { filter: brightness(0.96); }

.advp-panel {
    z-index: 2500; width: 300px; max-width: calc(100vw - 24px);
    background: var(--bg); border: 1px solid var(--gray-200); border-radius: var(--radius);
    box-shadow: 0 12px 32px rgba(0,0,0,0.18); padding: 0.9rem 1rem;
}
.advp-title { font-size: 0.88rem; font-weight: 700; color: var(--gray-800); margin-bottom: 0.35rem; }
.advp-body { font-size: 0.82rem; color: var(--gray-600); line-height: 1.55; margin-bottom: 0.6rem; }
.advp-actions { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.3rem; }
.advp-actions li { font-size: 0.78rem; font-weight: 500; padding: 0.35rem 0.55rem; border-radius: 6px; border: 1px solid var(--gray-200); background: var(--gray-50); color: var(--gray-700); }
.advp-actions li::before { content: "\2192  "; color: var(--gray-400); }
.advp-act-alert { border-color: rgba(var(--v-alert),0.3) !important; color: var(--danger) !important; }
.advp-act-warn  { border-color: rgba(var(--v-warn),0.3) !important; color: rgb(var(--v-warn)) !important; }
.advp-act-ok    { border-color: rgba(var(--v-ok),0.3) !important; color: var(--success) !important; }

/* Order Proposal card header total */
.vp-order-total-est { font-size: 0.85rem; font-weight: 700; color: var(--success); font-variant-numeric: tabular-nums; text-transform: none; letter-spacing: normal; margin-left: 0.4rem; }

/* Change log */
.vp-changelog { border: 1px solid var(--gray-200); border-radius: 8px; margin-top: 0.85rem; overflow: hidden; }
.vp-cl-head { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 0.6rem 0.85rem; background: var(--gray-50); border: none; cursor: pointer; font-size: 0.82rem; font-weight: 600; color: var(--gray-600); }
.vp-cl-badge { font-size: 0.72rem; font-weight: 700; padding: 0.05rem 0.5rem; border-radius: 10px; background: rgba(var(--v-warn),0.14); color: rgb(var(--v-warn)); margin-left: 0.35rem; }
.vp-cl-body { border-top: 1px solid var(--gray-200); }
.vp-cl-row { padding: 0.6rem 0.85rem; border-bottom: 1px solid var(--gray-200); border-left: 3px solid var(--gray-300); }
.vp-cl-row:last-child { border-bottom: none; }
.vp-cl-up { border-left-color: var(--primary); }
.vp-cl-down { border-left-color: rgb(var(--v-warn)); }
.vp-cl-prod { font-size: 0.84rem; font-weight: 600; color: var(--gray-800); display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; }
.vp-cl-tag { font-size: 0.7rem; font-weight: 700; padding: 0.05rem 0.45rem; border-radius: 6px; background: var(--gray-100); color: var(--gray-600); }
.vp-cl-fromto { font-size: 0.76rem; color: var(--gray-500); margin-top: 0.2rem; font-variant-numeric: tabular-nums; }
.vp-cl-detail { font-size: 0.76rem; color: var(--gray-500); margin-top: 0.2rem; }
.vp-cl-none { padding: 0.6rem 0.85rem; font-size: 0.82rem; color: var(--gray-500); }

/* Promo */
.vp-promo { display: flex; align-items: center; gap: 0.65rem; margin-top: 0.85rem; padding: 0.7rem 0.85rem; background: rgba(var(--v-warn),0.09); border: 1px solid rgba(var(--v-warn),0.3); border-radius: 8px; }
.vp-promo-info { flex: 1; min-width: 0; }
.vp-promo-name { font-size: 0.88rem; font-weight: 600; color: var(--gray-800); }
.vp-promo-why { font-size: 0.78rem; color: var(--gray-500); margin-top: 0.15rem; }
.vp-promo-match { font-size: 0.74rem; font-weight: 700; color: rgb(var(--v-warn)); background: rgba(var(--v-warn),0.14); border: 1px solid rgba(var(--v-warn),0.3); padding: 0.12rem 0.5rem; border-radius: 7px; flex-shrink: 0; }
.vp-promo-rm { border: none; background: none; color: var(--gray-400); cursor: pointer; flex-shrink: 0; display: flex; }
.vp-promo-rm:hover { color: var(--danger); }

/* Send message card */
.vp-rec { display: flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; color: var(--gray-600); background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: 8px; padding: 0.6rem 0.85rem; margin-bottom: 1rem; }
.vp-rec strong { color: var(--primary); }

/* ══ Message composer (mc-*) — mirrors the Vision alpha's TipTap-style composer ══ */
.mc-field-row { display: flex; align-items: flex-start; gap: 0.75rem; margin-bottom: 0.6rem; }
.mc-field-label { flex-shrink: 0; min-width: 3.5rem; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--gray-500); padding-top: 0.5rem; }

.mc-channel-row { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1rem; }
.mc-channel-switch { display: inline-flex; align-items: center; gap: 0.15rem; background: var(--gray-100); border-radius: 8px; padding: 0.2rem; }
.mc-channel-btn { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.4rem 0.85rem; font-size: 0.8rem; font-weight: 600; border-radius: 6px; border: 1px solid transparent; background: transparent; color: var(--gray-500); cursor: pointer; }
.mc-channel-on { background: var(--bg); color: var(--primary); border-color: var(--gray-200); box-shadow: 0 1px 3px rgba(0,0,0,0.08); }

.mc-chip-box {
    flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem;
    border: 1px solid var(--gray-300); border-radius: 8px; padding: 0.4rem 0.5rem; min-height: 2.35rem;
    background: var(--bg);
}
.mc-chip { display: inline-flex; align-items: center; gap: 0.3rem; background: var(--primary-light); border: 1px solid rgba(var(--v-info),0.25); color: var(--primary); border-radius: 6px; padding: 0.2rem 0.3rem 0.2rem 0.55rem; font-size: 0.8rem; max-width: 220px; }
.mc-chip-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-chip-x { display: inline-flex; border: none; background: none; color: inherit; opacity: 0.7; cursor: pointer; padding: 0.15rem; border-radius: 4px; }
.mc-chip-x:hover { opacity: 1; background: rgba(0,0,0,0.06); }
.mc-chip-input { flex: 1; min-width: 100px; border: none; outline: none; background: transparent; font-size: 0.85rem; color: var(--gray-800); }
.mc-add-contact-wrap { position: relative; margin-left: auto; flex-shrink: 0; }
.mc-add-contact-btn { display: inline-flex; align-items: center; gap: 0.15rem; border: none; background: none; color: var(--gray-400); cursor: pointer; padding: 0.2rem; }
.mc-add-contact-btn:hover { color: var(--primary); }
.mc-add-contact-menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 40; min-width: 220px; background: var(--bg); border: 1px solid var(--gray-200); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,0.14); padding: 0.3rem; }
.mc-add-contact-item { display: block; width: 100%; text-align: left; background: none; border: none; padding: 0.45rem 0.6rem; font-size: 0.8rem; color: var(--gray-700); border-radius: 6px; cursor: pointer; }
.mc-add-contact-item:hover { background: var(--gray-100); }

.mc-cc-toggles { display: flex; gap: 0.85rem; margin: -0.2rem 0 0.6rem calc(3.5rem + 0.75rem); }
.mc-cc-toggle { border: none; background: none; color: var(--primary); font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; cursor: pointer; padding: 0; }
.mc-cc-toggle:hover { text-decoration: underline; }

.mc-subject-input { flex: 1; border: 1px solid var(--gray-300); border-radius: 8px; padding: 0.5rem 0.7rem; font-size: 0.85rem; color: var(--gray-800); background: var(--bg); }
.mc-subject-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }

.mc-editor { border: 1px solid var(--gray-300); border-radius: 8px; background: var(--bg); margin-top: 0.9rem; }
.mc-toolbar { display: flex; align-items: center; gap: 0.15rem; padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--gray-200); background: var(--gray-50); border-radius: 8px 8px 0 0; flex-wrap: wrap; }
.mc-tb-btn { display: inline-flex; align-items: center; gap: 0.3rem; border: none; background: none; color: var(--gray-500); padding: 0.35rem 0.5rem; border-radius: 6px; cursor: pointer; font-size: 0.78rem; font-family: inherit; font-weight: 600; }
.mc-tb-btn:hover { background: var(--gray-200); color: var(--gray-800); }
.mc-tb-btn-wide { padding: 0.35rem 0.65rem; }
.mc-tb-sep { width: 1px; height: 1.1rem; background: var(--gray-300); margin: 0 0.35rem; }
.mc-link-menu-wrap { position: relative; }
.mc-link-menu { position: absolute; left: 0; top: calc(100% + 4px); z-index: 40; min-width: 210px; background: var(--bg); border: 1px solid var(--gray-200); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,0.14); padding: 0.3rem; }
.mc-link-menu button { display: block; width: 100%; text-align: left; background: none; border: none; padding: 0.5rem 0.65rem; font-size: 0.8rem; color: var(--gray-700); border-radius: 6px; cursor: pointer; font-family: inherit; }
.mc-link-menu button:hover { background: var(--gray-100); }

.mc-body { min-height: 170px; max-height: 320px; overflow-y: auto; padding: 0.85rem 0.9rem; font-size: 0.87rem; line-height: 1.65; color: var(--gray-800); border-radius: 0 0 8px 8px; }
.mc-body:focus { outline: none; }
.mc-body p { margin: 0 0 0.65em 0; }
.mc-body a { color: var(--primary); }

/* Atomic node views inside the composer body — non-editable chips/links */
.mc-order-chip {
    display: flex; align-items: center; justify-content: space-between; gap: 0.6rem;
    background: var(--gray-50); color: var(--gray-500); border: 1px dashed var(--gray-300);
    border-radius: 6px; padding: 0.5rem 0.75rem; font-size: 0.82rem; font-style: italic;
    margin: 0.3rem 0; cursor: pointer; user-select: none;
}
.mc-order-chip:hover { background: var(--primary-light); border-color: rgba(var(--v-info),0.4); color: var(--primary); }
.mc-order-chip-x { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 999px; border: none; background: transparent; color: var(--gray-400); cursor: pointer; flex-shrink: 0; }
.mc-order-chip-x:hover { background: rgba(var(--v-alert),0.14); color: var(--danger); }
.mc-link-btn { display: inline-block; background: var(--primary); color: #fff !important; padding: 0.4rem 0.9rem; border-radius: 6px; font-size: 0.85em; font-weight: 600; text-decoration: none !important; cursor: default; }
.mc-link-secondary { display: inline-block; color: var(--primary) !important; text-decoration: underline !important; font-size: 0.85em; cursor: default; }

/* SMS composer */
.mc-sms-meta { display: flex; align-items: center; justify-content: space-between; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--gray-200); background: var(--gray-50); }
.mc-sms-count { font-size: 0.75rem; color: var(--gray-500); }
.mc-sms-over { color: var(--danger); font-weight: 700; }
.mc-ai-badge { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.72rem; color: var(--primary); }
.mc-sms-textarea { width: 100%; border: none; outline: none; resize: vertical; padding: 0.85rem 0.9rem; font-size: 0.85rem; line-height: 1.65; color: var(--gray-800); font-family: ui-monospace, monospace; background: transparent; }
.mc-sms-tokens { display: flex; gap: 0.5rem; flex-wrap: wrap; padding: 0 0.75rem 0.6rem; }
.mc-token-btn { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.75rem; font-weight: 600; padding: 0.3rem 0.6rem; border-radius: 6px; border: 1px solid var(--gray-300); background: var(--bg); color: var(--gray-600); cursor: pointer; }
.mc-token-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.mc-token-btn-active { border-color: rgba(var(--v-info),0.4); background: var(--primary-light); color: var(--primary); cursor: default; }
.mc-sms-hint { font-size: 0.75rem; color: var(--gray-400); padding: 0 0.75rem 0.75rem; margin: 0; border-radius: 0 0 8px 8px; }

/* Success state */
.vision-success { text-align: center; padding: 2.5rem 1rem; }
.vision-success-icon { width: 56px; height: 56px; margin: 0 auto 0.85rem; border-radius: 50%; background: rgba(var(--v-ok),0.14); border: 2px solid rgba(var(--v-ok),0.35); color: var(--success); display: flex; align-items: center; justify-content: center; }
.vision-success-title { font-size: 1.25rem; font-weight: 800; color: var(--gray-900); margin-bottom: 0.4rem; }
.vision-success-sub { font-size: 0.88rem; color: var(--gray-500); max-width: 24rem; margin: 0 auto 1.25rem; line-height: 1.55; }
.vision-success-details { max-width: 22rem; margin: 0 auto 1.25rem; text-align: left; border: 1px solid var(--gray-200); border-radius: 10px; padding: 0.85rem 1rem; }
.vsd-row { display: flex; justify-content: space-between; font-size: 0.82rem; padding: 0.35rem 0; border-bottom: 1px solid var(--gray-200); }
.vsd-row:last-child { border-bottom: none; }
.vsd-row span:first-child { color: var(--gray-500); }
.vsd-row span:last-child { color: var(--gray-800); font-weight: 500; }

/* Modals — reuse SR6 .modal-* ; Vision extras */
.vision-modal-text { font-size: 0.85rem; color: var(--gray-600); line-height: 1.55; margin-bottom: 0.85rem; }
.vision-modal-foot { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 1rem; }
.vision-dec-reasons { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.85rem; }
.vision-dec-r { font-size: 0.78rem; padding: 0.25rem 0.65rem; border-radius: 12px; border: 1px solid var(--gray-300); background: transparent; color: var(--gray-500); cursor: pointer; }
.vision-dec-r-on { background: rgba(var(--v-alert),0.1); border-color: rgba(var(--v-alert),0.4); color: var(--danger); }

.vision-send-split { display: grid; grid-template-columns: 1fr 300px; gap: 1.25rem; }
.vision-send-subhd { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--gray-500); margin-bottom: 0.55rem; padding-bottom: 0.35rem; border-bottom: 1px solid var(--gray-200); }
.vision-send-subject { font-size: 0.8rem; color: var(--gray-600); margin-bottom: 0.4rem; }
.vision-send-msg { background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: 8px; padding: 0.7rem 0.85rem; font-size: 0.82rem; line-height: 1.6; color: var(--gray-700); white-space: pre-wrap; }

/* Phone preview */
.vph-tabs { display: flex; border: 1px solid var(--gray-200); border-radius: 7px; overflow: hidden; margin-bottom: 0.75rem; }
.vph-tab { flex: 1; padding: 0.4rem; border: none; background: var(--bg); color: var(--gray-500); font-size: 0.75rem; font-weight: 600; cursor: pointer; }
.vph-tab-on { background: var(--primary); color: #fff; }
.vph-wrap { display: flex; justify-content: center; }
.vph { width: 260px; border: 3px solid #1f2937; border-radius: 26px; overflow: hidden; background: #fff; box-shadow: 0 8px 30px rgba(0,0,0,0.25); }
.vph-notch { height: 18px; background: #1f2937; }
.vph-body { padding: 0.75rem; background: #f5f7ff; max-height: 420px; overflow-y: auto; }
.vph-brand { font-size: 0.72rem; font-weight: 700; color: #2c3e6b; margin-bottom: 0.55rem; }
.vph-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 9px; overflow: hidden; margin-bottom: 0.6rem; }
.vph-card-hd { background: #2c3e6b; padding: 0.6rem 0.7rem; }
.vph-card-title { font-size: 0.8rem; font-weight: 700; color: #fff; }
.vph-card-sub { font-size: 0.68rem; color: rgba(255,255,255,0.75); margin-top: 0.1rem; }
.vph-card-body { padding: 0.7rem; }
.vph-line { display: flex; align-items: center; gap: 0.5rem; font-size: 0.72rem; color: #374151; padding: 0.28rem 0; border-bottom: 1px solid #f3f4f6; }
.vph-line span:first-child { flex: 1; }
.vph-q { color: #6b7280; }
.vph-p { font-weight: 700; color: #111827; }
.vph-total { display: flex; justify-content: space-between; padding-top: 0.5rem; margin-top: 0.35rem; border-top: 1px solid #e5e7eb; font-size: 0.78rem; font-weight: 800; color: #2e7d32; }
.vph-promo { background: #fffbeb; border: 1px solid #fcd34d; border-radius: 7px; padding: 0.5rem 0.65rem; margin-bottom: 0.6rem; font-size: 0.7rem; color: #92400e; }
.vph-promo strong { display: block; }
.vph-confirm { width: 100%; padding: 0.65rem; border: none; border-radius: 8px; background: linear-gradient(135deg,#2e7d32,#00a86b); color: #fff; font-size: 0.8rem; font-weight: 700; cursor: pointer; }
.vph-change { width: 100%; margin-top: 0.5rem; background: none; border: none; color: #1565c0; font-size: 0.72rem; cursor: pointer; text-decoration: underline; }
.vph-expiry { text-align: center; font-size: 0.65rem; color: #9ca3af; margin-top: 0.6rem; padding: 0.35rem; background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 5px; }
.vph-back { background: none; border: none; color: #1565c0; font-size: 0.72rem; cursor: pointer; margin-bottom: 0.6rem; padding: 0; }
.vph-adj-title { font-size: 0.82rem; font-weight: 800; color: #2c3e6b; margin-bottom: 0.55rem; }
.vph-adj { display: flex; align-items: center; gap: 0.5rem; font-size: 0.72rem; color: #374151; padding: 0.3rem 0; border-bottom: 1px solid #f3f4f6; }
.vph-adj span:first-child { flex: 1; }
.vph-adj-removed { opacity: 0.45; text-decoration: line-through; }
.vph-note { font-size: 0.68rem; color: #6b7280; background: #eef2ff; border: 1px solid #e5e7eb; border-radius: 6px; padding: 0.5rem 0.6rem; margin-top: 0.6rem; }

/* Toast */
.vision-toast { position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%); z-index: 3000; padding: 0.6rem 1.15rem; border-radius: 20px; font-size: 0.85rem; font-weight: 500; color: #fff; box-shadow: 0 4px 16px rgba(0,0,0,0.25); }
.vision-toast-ok { background: var(--success); }
.vision-toast-info { background: var(--gray-700); }
.vision-toast-warn { background: rgb(var(--v-warn)); }

/* Responsive */
@media (max-width: 900px) {
    .vision-workspace { flex-direction: column; }
    .vision-tasks { width: 100%; position: static; max-height: none; }
    .vision-tasks-list { max-height: 40vh; }
    .vision-send-split { grid-template-columns: 1fr; }
    .vision-send-right { display: flex; flex-direction: column; align-items: center; }
    .mc-cc-toggles { margin-left: 0; }
}


/* =====================================================================
   Vision UX mock-ups (MG-202609, 12 Oct 2026) — .vx-* classes.
   Design: Docs/Vision/Vision.UX.md
   ===================================================================== */

/* ---- 00-foundation.css ---- */
/* =====================================================================
   Vision UX mockups — foundation (.vx-*). Built on SR6 tokens so light and
   dark themes follow [data-theme]. Page-specific CSS follows in later parts.
   ===================================================================== */

:root {
    --vx-blue-bg: #e0f2fe;   --vx-blue-fg: #075985;   --vx-blue-line: #bae6fd;
    --vx-teal-bg: #ccfbf1;   --vx-teal-fg: #115e59;   --vx-teal-line: #99f6e4;
    --vx-indigo-bg: #e0e7ff; --vx-indigo-fg: #3730a3; --vx-indigo-line: #c7d2fe;
    --vx-amber-bg: #fef3c7;  --vx-amber-fg: #92400e;  --vx-amber-line: #fcd34d;
    --vx-red-bg: #fee2e2;    --vx-red-fg: #991b1b;    --vx-red-line: #fca5a5;
    --vx-green-bg: #dcfce7;  --vx-green-fg: #166534;  --vx-green-line: #86efac;
    --vx-gray-bg: var(--gray-100); --vx-gray-fg: var(--gray-600); --vx-gray-line: var(--gray-200);
    --vx-gold-bg: #fff8e6;   --vx-gold-fg: #7c5400;   --vx-gold-line: #f2d283;
    --vx-row-hover: #f5fbff;
    /* charts: categorical (validated reference order) + status */
    --vx-c1: #2a78d6; --vx-c2: #eb6834; --vx-c3: #1baf7a; --vx-c4: #eda100; --vx-c5: #e87ba4; --vx-c6: #008300; --vx-c7: #4a3aa7; --vx-c8: #e34948;
    --vx-good: #0ca30c; --vx-warning: #fab219; --vx-serious: #ec835a; --vx-critical: #d03b3b;
    --vx-grid-line: #e7ebef; --vx-axis-line: #c9d1d9; --vx-muted-line: #a3b1bf;
    --vx-agent: linear-gradient(135deg, #7c3aed 0%, #0ea5e9 100%);
}
[data-theme="dark"] {
    --vx-blue-bg: #0c3a57;   --vx-blue-fg: #9bdcff;   --vx-blue-line: #165b85;
    --vx-teal-bg: #0b3b3a;   --vx-teal-fg: #7ee8d8;   --vx-teal-line: #13615d;
    --vx-indigo-bg: #23285a; --vx-indigo-fg: #c3cbff; --vx-indigo-line: #3a428a;
    --vx-amber-bg: #3d2a07;  --vx-amber-fg: #fcd68a;  --vx-amber-line: #6b4b10;
    --vx-red-bg: #45131a;    --vx-red-fg: #ffb4b4;    --vx-red-line: #7a2530;
    --vx-green-bg: #0f3a22;  --vx-green-fg: #8ae8ad;  --vx-green-line: #1c6b3e;
    --vx-gold-bg: #3a2d0b;   --vx-gold-fg: #f6d58a;   --vx-gold-line: #6e5413;
    --vx-row-hover: #12293d;
    --vx-c1: #3987e5; --vx-c2: #d95926; --vx-c3: #199e70; --vx-c4: #c98500; --vx-c5: #d55181; --vx-c7: #9085e9; --vx-c8: #e66767;
    --vx-grid-line: #1b3a50; --vx-axis-line: #285370; --vx-muted-line: #4a7393;
}

.vx-icon { flex-shrink: 0; vertical-align: middle; }
.vx-muted { color: var(--gray-500); }
.vx-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.vx-num { font-variant-numeric: tabular-nums; }

/* ── Page frame ─────────────────────────────────────────────────────── */
.vx-page { max-width: 1680px; margin: 0 auto; padding-bottom: 4.5rem; }
.vx-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.vx-page-titles { min-width: 0; }
.vx-eyebrow { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--primary); margin-bottom: 0.15rem; }
.vx-page-title { margin: 0; font-size: 1.45rem; font-weight: 700; }
.vx-page-sub { color: var(--gray-500); font-size: 0.9rem; margin-top: 0.15rem; }
.vx-page-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.vx-subnav { margin-bottom: 1rem; overflow-x: auto; }
.vx-subnav .tab-btn { display: inline-flex; align-items: center; gap: 0.4rem; text-decoration: none; white-space: nowrap; }
.vx-navbadge, .vx-sidebar-subbadge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #ef4444; color: #fff; font-size: 0.68rem; font-weight: 700; }

.vx-engine { display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.78rem; color: var(--gray-600); background: var(--bg); border: 1px solid var(--gray-200); border-radius: 999px; padding: 0.3rem 0.7rem; text-decoration: none; white-space: nowrap; }
.vx-engine:hover { border-color: var(--primary-mid); }
.vx-engine-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--vx-good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--vx-good) 22%, transparent); }
.vx-engine--paused { color: var(--vx-red-fg); background: var(--vx-red-bg); border-color: var(--vx-red-line); font-weight: 600; }
.vx-engine--paused .vx-engine-dot { background: var(--vx-critical); box-shadow: 0 0 0 3px color-mix(in srgb, var(--vx-critical) 25%, transparent); }

/* SR6 sidebar: Vision sub-sections (nav variant A) */
.vx-sidebar-sub { display: flex; flex-direction: column; margin: -0.15rem 0 0.35rem 2.55rem; border-left: 1px solid rgba(186, 230, 253, 0.18); }
.vx-sidebar-sublink { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.32rem 0.75rem; font-size: 0.82rem; color: rgba(255,255,255,0.68); text-decoration: none; border-radius: 0 6px 6px 0; }
.vx-sidebar-sublink:hover { color: #fff; background: rgba(255,255,255,0.06); }
.vx-sidebar-sublink.active { color: #fff; font-weight: 600; background: rgba(56, 189, 248, 0.14); box-shadow: inset 2px 0 0 #38bdf8; }
.vx-nav-alert { background: #ef4444 !important; }
.vx-mobile-sub { display: flex; flex-direction: column; padding-left: 2.6rem; }
.vx-mobile-sublink { font-size: 0.9rem !important; padding-top: 0.45rem !important; padding-bottom: 0.45rem !important; justify-content: space-between; }

/* ── Cards ──────────────────────────────────────────────────────────── */
.vx-card { padding: 1rem 1.15rem; margin-bottom: 1rem; }
.vx-card--flush { padding: 0; overflow: hidden; }
.vx-card--flush > .vx-card-head { padding: 0.85rem 1.15rem; border-bottom: 1px solid var(--gray-200); margin-bottom: 0; }
.vx-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.75rem; }
.vx-card-title { display: flex; align-items: center; gap: 0.45rem; font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--gray-700); margin: 0; }
.vx-card-title::before { content: ''; width: 3px; height: 14px; border-radius: 2px; background: linear-gradient(180deg, var(--primary) 0%, var(--brand-lavender) 100%); }
.vx-card-title .vx-icon { display: none; }
.vx-card-sub { font-size: 0.82rem; color: var(--gray-500); margin-top: 0.2rem; }
.vx-card-actions { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }

/* ── Pills / tags ───────────────────────────────────────────────────── */
.vx-pill { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.14rem 0.5rem; border-radius: 4px; font-size: 0.72rem; font-weight: 600; line-height: 1.35; white-space: nowrap; border: 1px solid transparent; }
.vx-pill--gray { background: var(--vx-gray-bg); color: var(--vx-gray-fg); border-color: var(--vx-gray-line); }
.vx-pill--blue { background: var(--vx-blue-bg); color: var(--vx-blue-fg); border-color: var(--vx-blue-line); }
.vx-pill--teal { background: var(--vx-teal-bg); color: var(--vx-teal-fg); border-color: var(--vx-teal-line); }
.vx-pill--indigo { background: var(--vx-indigo-bg); color: var(--vx-indigo-fg); border-color: var(--vx-indigo-line); }
.vx-pill--amber { background: var(--vx-amber-bg); color: var(--vx-amber-fg); border-color: var(--vx-amber-line); }
.vx-pill--red { background: var(--vx-red-bg); color: var(--vx-red-fg); border-color: var(--vx-red-line); }
.vx-pill--green { background: var(--vx-green-bg); color: var(--vx-green-fg); border-color: var(--vx-green-line); }
.vx-pill--gold { background: var(--vx-gold-bg); color: var(--vx-gold-fg); border-color: var(--vx-gold-line); }
.vx-pill--green-outline { background: transparent; color: var(--vx-green-fg); border-color: var(--vx-green-line); }
.vx-pill--gray-outline { background: transparent; color: var(--gray-500); border-color: var(--gray-300); }

.vx-src { display: inline-block; font-size: 0.66rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; padding: 0.06rem 0.38rem; border-radius: 4px; background: var(--vx-gray-bg); color: var(--vx-gray-fg); }
.vx-src--blue { background: var(--vx-blue-bg); color: var(--vx-blue-fg); }
.vx-src--teal { background: var(--vx-teal-bg); color: var(--vx-teal-fg); }
.vx-src--indigo { background: var(--vx-indigo-bg); color: var(--vx-indigo-fg); }
.vx-src--gold { background: var(--vx-gold-bg); color: var(--vx-gold-fg); border: 1px solid var(--vx-gold-line); }

.vx-proposed { display: inline-block; font-size: 0.62rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; padding: 0.05rem 0.35rem; border: 1px dashed var(--vx-indigo-line); color: var(--vx-indigo-fg); border-radius: 4px; vertical-align: middle; }
.vx-kbd { display: inline-block; min-width: 1.35em; padding: 0 0.3em; border: 1px solid var(--gray-300); border-bottom-width: 2px; border-radius: 4px; font: 600 0.72rem/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--gray-600); background: var(--bg); text-align: center; }

/* ── Popover ────────────────────────────────────────────────────────── */
.vx-popwrap { position: relative; display: inline-flex; }
.vx-poptrigger { background: none; border: 0; padding: 0; margin: 0; cursor: pointer; color: inherit; font: inherit; display: inline-flex; align-items: center; border-radius: 6px; }
.vx-poptrigger:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.vx-popover { position: absolute; top: calc(100% + 6px); z-index: 400; background: var(--bg); border: 1px solid var(--gray-200); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 0.75rem 0.85rem; font-size: 0.82rem; color: var(--gray-700); text-align: left; animation: slideUp 0.12s ease; }
.vx-popover--left { left: 0; }
.vx-popover--right { right: 0; }
.vx-pop-title { font-weight: 700; color: var(--gray-800); margin-bottom: 0.15rem; }
.vx-pop-sub { color: var(--gray-500); font-size: 0.78rem; margin-bottom: 0.4rem; }
.vx-pop-foot { color: var(--gray-500); font-size: 0.72rem; margin-top: 0.5rem; border-top: 1px solid var(--gray-100); padding-top: 0.4rem; }
.vx-factors { list-style: none; margin: 0; padding: 0; }
.vx-factors li { display: flex; justify-content: space-between; gap: 0.75rem; padding: 0.22rem 0; border-bottom: 1px dashed var(--gray-100); }
.vx-factors b { font-variant-numeric: tabular-nums; color: var(--gray-800); }
.vx-factors b.neg { color: var(--vx-green-fg); }

/* ── Urgency meter ──────────────────────────────────────────────────── */
.vx-urg { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.75rem; font-weight: 600; color: var(--gray-600); }
.vx-urg-bar { width: 44px; height: 6px; border-radius: 3px; background: var(--gray-200); overflow: hidden; display: inline-block; }
.vx-urg-bar > span { display: block; height: 100%; border-radius: 3px; background: var(--gray-400); }
.vx-urg-score { font-variant-numeric: tabular-nums; color: var(--gray-800); min-width: 1.4em; text-align: right; }
.vx-urg--urgent .vx-urg-bar > span { background: var(--vx-critical); }
.vx-urg--high .vx-urg-bar > span { background: var(--vx-serious); }
.vx-urg--normal .vx-urg-bar > span { background: var(--vx-c1); }
.vx-urg--low .vx-urg-bar > span { background: var(--gray-400); }
.vx-urg--urgent .vx-urg-label { color: var(--vx-red-fg); }
.vx-urg--high .vx-urg-label { color: var(--vx-amber-fg); }

/* ── ETA window ─────────────────────────────────────────────────────── */
.vx-eta { display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.8rem; white-space: nowrap; }
.vx-eta-axis { stroke: var(--gray-200); stroke-width: 1; }
.vx-eta-band { fill: var(--vx-blue-bg); stroke: var(--vx-blue-line); stroke-width: 1; }
.vx-eta-peak { fill: var(--vx-c1); stroke: var(--bg); stroke-width: 2; }
.vx-eta-today { stroke: var(--gray-700); stroke-width: 1.5; stroke-dasharray: 2 2; }
.vx-eta--overdue .vx-eta-band { fill: var(--vx-red-bg); stroke: var(--vx-red-line); }
.vx-eta--overdue .vx-eta-peak { fill: var(--vx-critical); }
.vx-eta--window .vx-eta-band { fill: var(--vx-amber-bg); stroke: var(--vx-amber-line); }
.vx-eta--window .vx-eta-peak { fill: #d97706; }
.vx-eta-label { color: var(--gray-700); font-weight: 600; }
.vx-eta--overdue .vx-eta-label { color: var(--vx-red-fg); }

.vx-conf { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; }
.vx-conf i { display: block; width: 4px; border-radius: 1px; background: var(--gray-300); }
.vx-conf i:nth-child(1) { height: 5px; } .vx-conf i:nth-child(2) { height: 8px; } .vx-conf i:nth-child(3) { height: 11px; }
.vx-conf--1 i:nth-child(1), .vx-conf--2 i:nth-child(-n+2), .vx-conf--3 i { background: var(--primary); }
.vx-conf span:not(.vx-sr) { margin-left: 0.3rem; font-size: 0.75rem; color: var(--gray-600); font-weight: 600; }

/* ── People ─────────────────────────────────────────────────────────── */
.vx-av { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; font-weight: 700; color: hsl(var(--av-h, 205) 70% 28%); background: hsl(var(--av-h, 205) 85% 90%); flex-shrink: 0; letter-spacing: 0.02em; }
[data-theme="dark"] .vx-av { color: hsl(var(--av-h, 205) 85% 85%); background: hsl(var(--av-h, 205) 45% 25%); }
.vx-av--agent { background: var(--vx-agent); color: #fff; }
[data-theme="dark"] .vx-av--agent { background: var(--vx-agent); color: #fff; }
.vx-av--none { background: var(--gray-100); color: var(--gray-500); border: 1px dashed var(--gray-300); }
.vx-userchip { display: inline-flex; align-items: center; gap: 0.45rem; min-width: 0; }
.vx-userchip > span:last-child { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.vx-userchip-name { font-size: 0.84rem; font-weight: 600; color: var(--gray-800); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vx-userchip-sub { font-size: 0.72rem; color: var(--gray-500); }

/* ── Stepper ────────────────────────────────────────────────────────── */
.vx-stepper { display: flex; list-style: none; margin: 0; padding: 0; gap: 0; align-items: center; flex-wrap: wrap; }
.vx-step { display: flex; align-items: center; gap: 0.35rem; font-size: 0.74rem; color: var(--gray-400); font-weight: 600; }
.vx-step + .vx-step::before { content: ''; width: 18px; height: 2px; background: var(--gray-200); margin: 0 0.35rem; border-radius: 1px; }
.vx-step-dot { width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--gray-300); background: var(--bg); }
.vx-step--done { color: var(--gray-600); }
.vx-step--done .vx-step-dot { background: var(--primary); border-color: var(--primary); }
.vx-step--done + .vx-step::before { background: var(--primary); }
.vx-step--current { color: var(--primary-dark); }
.vx-step--current .vx-step-dot { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); background: var(--primary); }
.vx-step--failed { color: var(--vx-red-fg); }
.vx-step--failed .vx-step-dot { border-color: var(--vx-critical); background: var(--vx-critical); box-shadow: 0 0 0 3px var(--vx-red-bg); }
.vx-stepper--closed .vx-step--muted { opacity: 0.55; }
.vx-step--end::before { display: none !important; }
.vx-step--end { margin-left: 0.5rem; }

/* ── Controls ───────────────────────────────────────────────────────── */
.vx-seg { display: inline-flex; background: var(--gray-100); border: 1px solid var(--gray-200); border-radius: 9px; padding: 2px; gap: 2px; flex-wrap: wrap; }
.vx-seg button { display: inline-flex; align-items: center; gap: 0.35rem; border: 0; background: transparent; padding: 0.38rem 0.75rem; border-radius: 7px; font: inherit; font-size: 0.82rem; font-weight: 600; color: var(--gray-600); cursor: pointer; white-space: nowrap; }
.vx-seg button:hover { color: var(--gray-800); }
.vx-seg button.on { background: var(--bg); color: var(--primary-dark); box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.vx-seg--sm button { padding: 0.22rem 0.55rem; font-size: 0.75rem; }
.vx-seg-count { font-size: 0.7rem; background: var(--gray-200); color: var(--gray-700); border-radius: 9px; padding: 0 0.4rem; min-width: 1.4em; text-align: center; }
.vx-seg button.on .vx-seg-count { background: var(--primary-light); color: var(--primary-dark); }

.vx-toggle { position: relative; width: 38px; height: 22px; border-radius: 11px; border: 0; background: var(--gray-300); cursor: pointer; padding: 0; flex-shrink: 0; transition: background 0.15s; }
.vx-toggle span { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.25); transition: transform 0.15s; }
.vx-toggle.on { background: var(--primary); }
.vx-toggle.on span { transform: translateX(16px); }
.vx-toggle:disabled { opacity: 0.5; cursor: not-allowed; }
.vx-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.btn.vx-btn-quiet { background: transparent; color: var(--primary-dark); padding: 0.4rem 0.6rem; box-shadow: none; }
.btn.vx-btn-quiet:hover { background: var(--primary-light); }
.btn .vx-icon { margin-right: -0.1rem; }

/* ── KPI tiles ──────────────────────────────────────────────────────── */
.vx-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0.75rem; margin-bottom: 1rem; }
.vx-kpi { background: var(--bg); border: 1px solid var(--gray-200); border-radius: var(--radius); box-shadow: var(--shadow); padding: 0.85rem 1rem; display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; }
.vx-kpi-label { display: flex; align-items: center; gap: 0.35rem; font-size: 0.74rem; font-weight: 600; color: var(--gray-500); }
.vx-kpi-value { font-size: 1.55rem; font-weight: 700; color: var(--gray-900); letter-spacing: -0.02em; line-height: 1.15; }
.vx-kpi-delta { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.75rem; font-weight: 600; }
.vx-kpi-delta--good { color: #15803d; } .vx-kpi-delta--bad { color: #b91c1c; } .vx-kpi-delta--flat { color: var(--gray-500); }
[data-theme="dark"] .vx-kpi-delta--good { color: #4ade80; } [data-theme="dark"] .vx-kpi-delta--bad { color: #f87171; }

/* ── Empty states ───────────────────────────────────────────────────── */
.vx-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0.4rem; padding: 2rem 1rem; color: var(--gray-400); }
.vx-empty-title { font-weight: 700; color: var(--gray-700); }
.vx-empty-body { font-size: 0.86rem; color: var(--gray-500); max-width: 42ch; }

/* ── Modal / drawer ─────────────────────────────────────────────────── */
.vx-modal-title { display: flex; align-items: center; gap: 0.45rem; }
.vx-drawer-wrap { position: fixed; inset: 0; z-index: 900; background: rgba(8, 20, 33, 0.35); display: flex; justify-content: flex-end; animation: fadeIn 0.12s ease; }
.vx-drawer { height: 100%; background: var(--bg); box-shadow: -12px 0 40px rgba(0,0,0,0.25); display: flex; flex-direction: column; animation: vxSlideIn 0.18s ease; }
@keyframes vxSlideIn { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.vx-drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 0.9rem 1.1rem; border-bottom: 1px solid var(--gray-200); }
.vx-drawer-head h2 { font-size: 1rem; margin: 0; }
.vx-drawer-body { flex: 1; overflow-y: auto; padding: 1rem 1.1rem; }
.vx-drawer-foot { padding: 0.8rem 1.1rem; border-top: 1px solid var(--gray-200); display: flex; justify-content: flex-end; gap: 0.5rem; }

/* ── Message body tokens ────────────────────────────────────────────── */
.vx-token { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.12rem 0.5rem; border-radius: 6px; font-size: 0.8rem; font-weight: 600; white-space: nowrap; }
.vx-token--link { background: var(--vx-blue-bg); color: var(--vx-blue-fg); border: 1px solid var(--vx-blue-line); }
.vx-token--table { background: var(--vx-gray-bg); color: var(--gray-700); border: 1px dashed var(--gray-300); }

/* ── Charts ─────────────────────────────────────────────────────────── */
.vx-chart { position: relative; width: 100%; }
.vx-chart svg { display: block; overflow: visible; }
.vx-grid { stroke: var(--vx-grid-line); stroke-width: 1; }
.vx-axis { stroke: var(--vx-axis-line); stroke-width: 1; }
.vx-tick { font-size: 10.5px; fill: var(--gray-500); font-variant-numeric: tabular-nums; }
.vx-crosshair { stroke: var(--gray-400); stroke-width: 1; }
.vx-ring { stroke: var(--bg); stroke-width: 2; }
.vx-tip { position: absolute; pointer-events: none; z-index: 5; background: var(--gray-900); color: #fff; border-radius: 8px; padding: 0.4rem 0.6rem; font-size: 0.76rem; display: flex; flex-direction: column; gap: 0.05rem; min-width: 120px; box-shadow: 0 6px 18px rgba(0,0,0,0.25); }
[data-theme="dark"] .vx-tip { background: #e4f2f9; color: #0c1a2e; }
.vx-tip b { font-weight: 700; }
.vx-hbars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.vx-hbars li { display: grid; grid-template-columns: minmax(90px, 34%) 1fr auto; align-items: center; gap: 0.6rem; font-size: 0.82rem; }
.vx-hbars-label { color: var(--gray-700); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vx-hbars-label small { display: block; color: var(--gray-500); font-size: 0.72rem; }
.vx-hbars-track { height: 10px; background: var(--gray-100); border-radius: 5px; overflow: hidden; }
.vx-hbars-fill { display: block; height: 100%; border-radius: 0 5px 5px 0; }
.vx-hbars-value { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--gray-800); min-width: 3.5em; text-align: right; }
.vx-funnel { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.vx-funnel-row { display: flex; align-items: baseline; gap: 0.5rem; font-size: 0.84rem; margin-bottom: 0.2rem; }
.vx-funnel-label { color: var(--gray-700); flex: 1; }
.vx-funnel-value { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--gray-900); }
.vx-funnel-rate { font-size: 0.72rem; color: var(--gray-500); min-width: 3em; text-align: right; }
.vx-funnel-track { height: 12px; background: var(--gray-100); border-radius: 6px; overflow: hidden; }
.vx-funnel-track span { display: block; height: 100%; background: var(--vx-c1); border-radius: 0 6px 6px 0; }
.vx-stack-bar { display: flex; gap: 2px; border-radius: 7px; overflow: hidden; background: var(--bg); }
.vx-stack-bar span { min-width: 3px; transition: opacity 0.12s; }
.vx-stack-bar span.dim { opacity: 0.35; }
.vx-legend { list-style: none; margin: 0.6rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; font-size: 0.78rem; color: var(--gray-600); }
.vx-legend li { display: inline-flex; align-items: center; gap: 0.35rem; }
.vx-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.vx-legend i.ring { border-radius: 50%; }
.vx-legend b { color: var(--gray-800); font-variant-numeric: tabular-nums; }
.vx-legend small { color: var(--gray-500); }
.vx-legend--inline { margin: 0; }
.vx-spark { display: block; }
.vx-rhythm-window { fill: var(--vx-blue-bg); stroke: var(--vx-blue-line); }
.vx-rhythm-peak { fill: var(--vx-c1); stroke: var(--bg); stroke-width: 2; }
.vx-rhythm-today { stroke: var(--gray-700); stroke-width: 1.5; stroke-dasharray: 2 3; }
.vx-rhythm-dot { stroke: var(--bg); stroke-width: 2; cursor: default; }
.vx-rhythm-dot--vision { fill: var(--vx-c1); }
.vx-rhythm-dot--elsewhere { fill: var(--vx-c3); }
.vx-rhythm-dot--external { fill: var(--vx-muted-line); }

/* ── Design-lab dock ────────────────────────────────────────────────── */
.vx-lab { position: fixed; left: 50%; bottom: 10px; transform: translateX(-50%); z-index: 950; display: flex; flex-direction: column; align-items: center; gap: 0.5rem; font-size: 0.8rem; pointer-events: none; }
.vx-lab > * { pointer-events: auto; }
.vx-lab-pill { display: inline-flex; align-items: center; gap: 0.45rem; border: 1px solid rgba(124, 58, 237, 0.35); background: rgba(15, 23, 42, 0.86); color: #e9e5ff; border-radius: 999px; padding: 0.32rem 0.75rem; font: inherit; font-weight: 600; cursor: pointer; box-shadow: 0 6px 18px rgba(0,0,0,0.25); backdrop-filter: blur(6px); opacity: 0.82; }
.vx-lab-pill:hover, .vx-lab.open .vx-lab-pill { opacity: 1; }
.vx-lab-who { color: #a5f3fc; font-weight: 500; }
.vx-lab-variants { font: 600 0.72rem ui-monospace, monospace; background: rgba(124, 58, 237, 0.35); color: #fff; border-radius: 5px; padding: 0 0.35rem; }
.vx-lab-panel { width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 120px); overflow-y: auto; background: var(--bg); color: var(--gray-800); border: 1px solid var(--gray-200); border-top: 3px solid #7c3aed; border-radius: 12px; box-shadow: 0 18px 50px rgba(0,0,0,0.3); padding: 0.85rem 1rem; }
.vx-lab-head { display: flex; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.6rem; }
.vx-lab-head b { display: block; font-size: 0.9rem; }
.vx-lab-head span { color: var(--gray-500); font-size: 0.76rem; }
.vx-lab-x { border: 0; background: none; font-size: 1.3rem; line-height: 1; color: var(--gray-500); cursor: pointer; }
.vx-lab-sec { border-top: 1px solid var(--gray-100); padding: 0.6rem 0; }
.vx-lab-label { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--gray-500); margin-bottom: 0.4rem; }
.vx-lab-personas { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.4rem; }
.vx-lab-persona { text-align: left; border: 1px solid var(--gray-200); background: var(--bg); border-radius: 8px; padding: 0.4rem 0.55rem; cursor: pointer; font: inherit; color: inherit; display: flex; flex-direction: column; gap: 0.1rem; }
.vx-lab-persona b { font-size: 0.8rem; }
.vx-lab-persona span { font-size: 0.68rem; color: var(--gray-500); line-height: 1.3; }
.vx-lab-persona.on { border-color: #7c3aed; box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.18); }
.vx-lab-group { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.4rem; }
.vx-lab-group > span { font-weight: 600; color: var(--gray-700); }
.vx-lab-none { color: var(--gray-500); font-size: 0.78rem; }
.vx-lab-sims { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.vx-lab-sim { border: 1px solid var(--gray-200); background: var(--gray-50); color: var(--gray-700); border-radius: 7px; padding: 0.28rem 0.55rem; font: inherit; font-size: 0.76rem; cursor: pointer; }
.vx-lab-sim:hover { border-color: #7c3aed; color: #6d28d9; }
.vx-lab-flash { margin-top: 0.45rem; font-size: 0.76rem; color: #15803d; font-weight: 600; }
.vx-lab-foot { display: flex; justify-content: space-between; gap: 0.5rem; border-top: 1px solid var(--gray-100); padding-top: 0.6rem; }

@media (max-width: 767px) {
    .vx-page { padding-bottom: 5rem; }
    .vx-page-head { align-items: flex-start; }
    .vx-lab-personas { grid-template-columns: 1fr; }
    .vx-lab-pill .vx-lab-who, .vx-lab-pill .vx-lab-variants { display: none; }
}

/* ── Scoped setting row ─────────────────────────────────────────────── */
.vx-setting { display: grid; grid-template-columns: 1fr auto; gap: 0.5rem 1.25rem; align-items: center; padding: 0.8rem 0; border-bottom: 1px solid var(--gray-100); }
.vx-setting:last-child { border-bottom: 0; }
.vx-setting-label { font-weight: 600; color: var(--gray-800); font-size: 0.9rem; display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.vx-setting-desc { font-size: 0.8rem; color: var(--gray-500); margin-top: 0.1rem; max-width: 70ch; }
.vx-setting-meta { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.3rem; }
.vx-setting-control { display: flex; align-items: center; gap: 0.5rem; justify-self: end; }
.vx-setting--compact { padding: 0.55rem 0; }
.vx-setting--ro .vx-setting-control { opacity: 0.75; }
.vx-src-chip { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.7rem; font-weight: 600; color: var(--gray-500); background: var(--gray-100); border-radius: 4px; padding: 0.05rem 0.4rem; }
.vx-src-chip--here { color: var(--vx-blue-fg); background: var(--vx-blue-bg); }
.vx-src-chip--lock { color: var(--vx-amber-fg); background: var(--vx-amber-bg); }
.vx-linkbtn { display: inline-flex; align-items: center; gap: 0.2rem; border: 0; background: none; padding: 0; color: var(--primary-dark); font: inherit; font-size: 0.75rem; font-weight: 600; cursor: pointer; }
.vx-linkbtn:hover { text-decoration: underline; }
.vx-setting-why { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.72rem; color: var(--gray-500); }
.vx-setting-error { margin-top: 0.3rem; font-size: 0.78rem; color: var(--vx-red-fg); }
.vx-setting-select { width: auto; min-width: 180px; padding: 0.4rem 0.6rem; font-size: 0.85rem; }
.vx-setting-text { width: 240px; padding: 0.4rem 0.6rem; font-size: 0.85rem; }
.vx-setting-num { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.82rem; color: var(--gray-500); }
.vx-setting-num input { width: 84px; padding: 0.4rem 0.5rem; font-size: 0.85rem; }
.vx-setting-range { display: inline-flex; align-items: center; gap: 0.6rem; }
.vx-setting-range input { width: 160px; accent-color: var(--primary); }
.vx-setting-range b { font-size: 0.82rem; min-width: 5.5em; text-align: right; font-variant-numeric: tabular-nums; }
.vx-setting-info { display: inline-flex; color: var(--gray-400); padding: 0.2rem; }
.vx-setting-info:hover { color: var(--primary); }
.vx-trail-here span, .vx-trail-here b { color: var(--primary-dark) !important; }
@media (max-width: 640px) {
    .vx-setting { grid-template-columns: 1fr; }
    .vx-setting-control { justify-self: start; }
}

/* ---- 10-home.css ---- */
/* =====================================================================
   Vision — Today (/vision) · .vx-home-*
   A Cockpit · B Focus list · C Pipeline board. Layout breakpoints are
   container queries on .vx-home-body so the SR6 sidebar width is respected.
   ===================================================================== */

.vx-home {
    --vx-home-you: #d97706;
    --vx-home-customer: var(--vx-c1);
    --vx-home-system: var(--vx-c7);
    --vx-home-snoozed: var(--vx-muted-line);
    --vx-home-day-bg: #f6f9fc;
    --vx-home-weekend-bg: #eceff3;
    --vx-home-col-bg: #eaf3f9;
    --vx-home-gap: 1rem;
}
[data-theme="dark"] .vx-home {
    --vx-home-you: #f59e0b;
    --vx-home-day-bg: rgba(255, 255, 255, 0.03);
    --vx-home-weekend-bg: rgba(255, 255, 255, 0.075);
    --vx-home-col-bg: rgba(255, 255, 255, 0.035);
}

.vx-home-body { container: vxhome / inline-size; }
.vx-home a.btn { text-decoration: none; }
.vx-home .vx-poptrigger .btn { pointer-events: none; }

/* urgency edge (inset shadow on the left, no layout shift) */
.vx-home-edge--urgent { --vx-home-edge: var(--vx-critical); }
.vx-home-edge--high { --vx-home-edge: var(--vx-serious); }
.vx-home-edge--normal { --vx-home-edge: var(--vx-c1); }
.vx-home-edge--low { --vx-home-edge: var(--gray-300); }
.vx-home-edge--none { --vx-home-edge: transparent; }

.vx-home-more { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.8rem; font-weight: 600; color: var(--primary-dark); text-decoration: none; white-space: nowrap; }
.vx-home-more:hover { text-decoration: underline; }
.vx-home-none { color: var(--gray-500); font-size: 0.86rem; margin: 0; }

/* markers (court colours) — used in the strip, tooltips, legends, group heads */
.vx-home-mark { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--mk, var(--gray-400)); flex-shrink: 0; }
.vx-home-mark--you { --mk: var(--vx-home-you); }
.vx-home-mark--customer { --mk: var(--vx-home-customer); }
.vx-home-mark--system { --mk: var(--vx-home-system); }
.vx-home-mark--snoozed { --mk: var(--vx-home-snoozed); }

/* ── Flash (snackbar) ───────────────────────────────────────────────── */
.vx-home-flash { position: fixed; left: 50%; bottom: 60px; transform: translateX(-50%); z-index: 960; display: flex; align-items: center; gap: 0.6rem;
    width: max-content; max-width: min(580px, calc(100vw - 32px)); padding: 0.6rem 0.7rem 0.6rem 0.9rem; border-radius: 10px;
    background: var(--gray-900); color: var(--bg); box-shadow: 0 10px 30px rgba(0,0,0,0.28); font-size: 0.86rem; animation: slideUp 0.15s ease; }
.vx-home-flash-text { flex: 1; min-width: 0; }
.vx-home-flash-btn { border: 0; background: none; color: var(--primary-light); font: inherit; font-weight: 700; cursor: pointer; padding: 0.15rem 0.35rem; border-radius: 5px; }
.vx-home-flash-btn:hover { text-decoration: underline; }
.vx-home-flash-x { border: 0; background: none; color: inherit; opacity: 0.7; font-size: 1.15rem; line-height: 1; cursor: pointer; padding: 0 0.25rem; }
.vx-home-flash-x:hover { opacity: 1; }

/* ── Later menu ─────────────────────────────────────────────────────── */
.vx-home-laterbtn { gap: 0.35rem; }
.vx-home-later { display: flex; flex-direction: column; }
.vx-home-later .vx-pop-title { display: flex; align-items: center; gap: 0.4rem; }
.vx-home-later-opt { display: flex; flex-direction: column; align-items: flex-start; gap: 0.05rem; width: 100%; border: 0; background: none; text-align: left; font: inherit; color: var(--gray-800);
    padding: 0.45rem 0.55rem; border-radius: 7px; cursor: pointer; }
.vx-home-later-opt span { font-weight: 600; font-size: 0.84rem; }
.vx-home-later-opt small { font-size: 0.74rem; color: var(--gray-500); }
.vx-home-later-opt:hover:not(:disabled), .vx-home-later-opt:focus-visible { background: var(--primary-light); outline: none; }
.vx-home-later-opt:disabled { cursor: not-allowed; opacity: 0.55; }

/* ── All clear / inbox zero ─────────────────────────────────────────── */
.vx-home-clear { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0.55rem; padding: 1.75rem 1rem 1.5rem; }
.vx-home-clear h2 { margin: 0.2rem 0 0; font-size: 1.25rem; font-weight: 700; color: var(--gray-900); }
.vx-home-clear p { margin: 0; color: var(--gray-600); font-size: 0.9rem; max-width: 54ch; }
.vx-home-clear .vx-home-clear-next { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.85rem; color: var(--gray-500); }
.vx-home-clear-next a { color: var(--primary-dark); font-weight: 600; text-decoration: none; }
.vx-home-clear .btn { margin-top: 0.35rem; }
.vx-home-burst { position: relative; display: inline-flex; border-radius: 50%; animation: vxHomePop 0.45s cubic-bezier(.2,.9,.3,1.3) both; }
.vx-home-burst::after { content: ''; position: absolute; inset: 4px; border-radius: 50%; animation: vxHomeRing 1.4s ease-out 0.45s both; }
.vx-home-burst-ring { fill: var(--vx-green-bg); stroke: var(--vx-good); stroke-width: 2.5; }
.vx-home-burst-check { fill: none; stroke: var(--vx-green-fg); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 36; stroke-dashoffset: 36; animation: vxHomeDraw 0.45s ease 0.3s forwards; }
@keyframes vxHomeDraw { to { stroke-dashoffset: 0; } }
@keyframes vxHomePop { 0% { transform: scale(0.6); opacity: 0; } 70% { transform: scale(1.06); opacity: 1; } 100% { transform: scale(1); } }
@keyframes vxHomeRing { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--vx-good) 40%, transparent); } 100% { box-shadow: 0 0 0 22px transparent; } }
@media (prefers-reduced-motion: reduce) {
    .vx-home-burst, .vx-home-burst::after { animation: none; }
    .vx-home-burst-check { animation: none; stroke-dashoffset: 0; }
}

/* ═══ A · Cockpit ═══════════════════════════════════════════════════════ */
.vx-home-top { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--vx-home-gap); margin-bottom: var(--vx-home-gap); }
.vx-home-top > .card, .vx-home-side > .card, .vx-home-lower > .card { margin-bottom: 0; }
.vx-home-side { display: grid; gap: var(--vx-home-gap); align-content: start; min-width: 0; }
@container vxhome (min-width: 900px) { .vx-home-top { grid-template-columns: minmax(0, 1.65fr) minmax(300px, 1fr); } }
@container vxhome (min-width: 620px) and (max-width: 899px) { .vx-home-side { grid-template-columns: 1fr 1fr; } }

/* hero */
.vx-home-hero { padding: 1.25rem 1.5rem 1.15rem; box-shadow: inset 4px 0 0 var(--vx-home-edge, var(--primary)), var(--shadow-md); }
.vx-home-hero--clear { display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow); }
.vx-home-hero-top { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; }
.vx-home-eyebrow { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--primary); }
.vx-home-hero-pos { font-size: 0.75rem; color: var(--gray-500); font-weight: 600; font-variant-numeric: tabular-nums; }
.vx-home-hero-head { display: flex; align-items: center; flex-wrap: wrap; gap: 0.4rem 0.65rem; margin-top: 0.35rem; }
.vx-home-hero-cust { margin: 0; font-size: 1.45rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.vx-home-hero-cust a { color: var(--gray-900); text-decoration: none; }
.vx-home-hero-cust a:hover { color: var(--primary-dark); text-decoration: underline; text-underline-offset: 3px; }
.vx-home-hero-title { display: flex; align-items: center; gap: 0.45rem; margin-top: 0.85rem; font-size: 1.06rem; font-weight: 600; color: var(--gray-800); }
.vx-home-na-icon { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 6px; background: var(--vx-gray-bg); color: var(--vx-gray-fg); flex-shrink: 0; }
.vx-home-na-icon--amber { background: var(--vx-amber-bg); color: var(--vx-amber-fg); }
.vx-home-na-icon--red { background: var(--vx-red-bg); color: var(--vx-red-fg); }
.vx-home-na-icon--blue { background: var(--vx-blue-bg); color: var(--vx-blue-fg); }
.vx-home-hero-sentence { margin: 0.25rem 0 0 calc(22px + 0.45rem); color: var(--gray-600); font-size: 0.92rem; max-width: 70ch; }
.vx-home-hero-meta { display: flex; flex-wrap: wrap; gap: 0.75rem 2rem; margin: 1rem 0; padding: 0.75rem 0; border-top: 1px solid var(--gray-100); border-bottom: 1px solid var(--gray-100); }
.vx-home-hero-meta dt { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--gray-500); margin-bottom: 0.2rem; }
.vx-home-hero-meta dd { margin: 0; display: flex; align-items: center; gap: 0.4rem; min-height: 26px; font-weight: 700; color: var(--gray-800); font-size: 1rem; }
.vx-home-hero-meta dd small { font-weight: 500; font-size: 0.76rem; color: var(--gray-500); }
.vx-home-hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.vx-home-cta { padding: 0.7rem 1.35rem; font-size: 0.95rem; text-decoration: none; }
.vx-home-session { padding: 0.55rem 1rem; }
.vx-home-session-n { font-size: 0.7rem; font-weight: 700; background: var(--gray-100); color: var(--gray-700); border-radius: 9px; padding: 0 0.45rem; min-width: 1.5em; text-align: center; }
.vx-home-hero-hint { margin: 0.55rem 0 0; font-size: 0.76rem; color: var(--gray-500); }

.vx-home-then { margin-top: 1.05rem; padding-top: 0.85rem; border-top: 1px solid var(--gray-100); }
.vx-home-then-title { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--gray-500); margin-bottom: 0.3rem; }
.vx-home-then-list { list-style: none; margin: 0 -0.5rem; padding: 0; }
.vx-home-then-row { display: grid; grid-template-columns: 10px minmax(0, 1fr) minmax(0, 1.25fr) 4.2em 5.2em 15px; align-items: center; gap: 0.75rem; padding: 0.5rem; border-radius: 8px; color: var(--gray-700); text-decoration: none; font-size: 0.86rem; }
.vx-home-then-row:hover, .vx-home-then-row:focus-visible { background: var(--vx-row-hover); outline: none; }
.vx-home-then-row:focus-visible { box-shadow: 0 0 0 2px var(--primary); }
.vx-home-then-cust { font-weight: 600; color: var(--gray-900); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vx-home-then-act { color: var(--gray-600); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vx-home-then-val { text-align: right; font-weight: 600; color: var(--gray-800); }
.vx-home-then-since { text-align: right; color: var(--gray-500); font-size: 0.76rem; white-space: nowrap; display: flex; justify-content: flex-end; }
.vx-home-then-chev { color: var(--gray-400); }
.vx-home-then .vx-home-more { margin-top: 0.4rem; }
.vx-home-then-none { display: flex; align-items: center; gap: 0.4rem; margin: 1rem 0 0; padding-top: 0.85rem; border-top: 1px solid var(--gray-100); font-size: 0.84rem; color: var(--gray-500); }
.vx-home-tdot { width: 10px; height: 10px; border-radius: 50%; background: var(--gray-300); }
.vx-home-tdot--urgent { background: var(--vx-critical); }
.vx-home-tdot--high { background: var(--vx-serious); }
.vx-home-tdot--normal { background: var(--vx-c1); }

/* whose move */
.vx-home-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.vx-home-tile { display: flex; flex-direction: column; gap: 0.05rem; padding: 0.65rem 0.8rem 0.7rem; border: 1px solid var(--gray-200); border-radius: 9px; background: var(--bg);
    color: inherit; text-decoration: none; box-shadow: inset 3px 0 0 var(--tc); transition: border-color 0.12s, background 0.12s; min-width: 0; }
.vx-home-tile:hover, .vx-home-tile:focus-visible { border-color: var(--primary-mid); background: var(--vx-row-hover); outline: none; }
.vx-home-tile--you { --tc: var(--vx-home-you); }
.vx-home-tile--customer { --tc: var(--vx-home-customer); }
.vx-home-tile--system { --tc: var(--vx-home-system); }
.vx-home-tile--snoozed { --tc: var(--vx-home-snoozed); }
.vx-home-tile-label { display: flex; align-items: center; gap: 0.3rem; font-size: 0.75rem; font-weight: 600; color: var(--gray-600); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vx-home-tile-label .vx-icon { color: var(--tc); }
.vx-home-tile-count { font-size: 1.65rem; font-weight: 700; color: var(--gray-900); line-height: 1.15; letter-spacing: -0.02em; }
.vx-home-tile-val { font-size: 0.78rem; color: var(--gray-500); display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; }

/* by type */
.vx-home-chips { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.vx-home-chip { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.32rem 0.4rem 0.32rem 0.65rem; border: 1px solid var(--gray-200); border-radius: 999px;
    background: var(--bg); color: var(--gray-700); font-size: 0.8rem; font-weight: 600; text-decoration: none; transition: border-color 0.12s, background 0.12s; }
.vx-home-chip .vx-icon { color: var(--gray-500); }
.vx-home-chip:hover, .vx-home-chip:focus-visible { border-color: var(--primary-mid); background: var(--vx-row-hover); outline: none; }
.vx-home-chip-n { min-width: 1.6em; padding: 0 0.4rem; border-radius: 999px; text-align: center; font-size: 0.72rem; line-height: 1.5; background: var(--vx-amber-bg); color: var(--vx-amber-fg); border: 1px solid var(--vx-amber-line); }
.vx-home-chip--zero { color: var(--gray-400); border-style: dashed; }
.vx-home-chip--zero .vx-icon { color: var(--gray-300); }
.vx-home-chip--zero .vx-home-chip-n { background: transparent; color: var(--gray-400); border-color: var(--gray-200); }

/* coming up strip */
.vx-home-coming { margin-bottom: var(--vx-home-gap); }
.vx-home-strip-wrap { position: relative; }
.vx-home-strip-scroll { overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; padding-bottom: 2px; }
.vx-home-strip { display: grid; grid-template-columns: minmax(66px, 1.2fr) repeat(14, minmax(48px, 1fr)); gap: 4px; }
.vx-home-day { display: flex; flex-direction: column; gap: 0.35rem; min-height: 128px; padding: 0.5rem 0.3rem 0.45rem; border-radius: 8px; border: 1px solid transparent;
    background: var(--vx-home-day-bg); color: inherit; text-decoration: none; transition: border-color 0.12s, background 0.12s; }
.vx-home-day:hover, .vx-home-day:focus-visible { border-color: var(--primary-mid); background: var(--vx-row-hover); outline: none; }
.vx-home-day--weekend { background: var(--vx-home-weekend-bg); }
.vx-home-day--today { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.vx-home-day--overdue { background: color-mix(in srgb, var(--vx-red-bg) 70%, transparent); margin-right: 6px; }
.vx-home-day--overdue .vx-home-day-wd, .vx-home-day--overdue .vx-home-day-num { color: var(--vx-red-fg); }
.vx-home-day--overdue.vx-home-day--empty { background: var(--vx-home-day-bg); }
.vx-home-day--overdue.vx-home-day--empty .vx-home-day-wd, .vx-home-day--overdue.vx-home-day--empty .vx-home-day-num { color: var(--gray-400); }
.vx-home-day-head { display: flex; flex-direction: column; align-items: center; line-height: 1.15; }
.vx-home-day-wd { font-size: 0.64rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--gray-500); }
.vx-home-day-num { font-size: 1.02rem; font-weight: 700; color: var(--gray-800); min-height: 1.2em; display: flex; align-items: center; }
.vx-home-day--today .vx-home-day-wd { color: var(--primary); }
.vx-home-day-marks { flex: 1; display: flex; flex-wrap: wrap; align-content: flex-end; justify-content: center; gap: 3px; min-height: 30px; }
.vx-home-day-more { font-size: 0.66rem; font-weight: 700; color: var(--gray-500); }
.vx-home-day-foot { display: flex; flex-direction: column; align-items: center; line-height: 1.2; font-size: 0.7rem; color: var(--gray-500); }
.vx-home-day-foot b { font-size: 0.85rem; color: var(--gray-800); }
.vx-home-day--empty .vx-home-day-foot b { color: var(--gray-300); font-weight: 600; }
.vx-home-strip-tip { transform: translate(-50%, calc(-100% - 8px)); min-width: 190px; max-width: 260px; gap: 0.2rem; }
.vx-home-tip-row { display: flex; align-items: center; gap: 0.45rem; }
.vx-home-tip-row em { margin-left: auto; padding-left: 0.75rem; font-style: normal; opacity: 0.8; font-variant-numeric: tabular-nums; }
.vx-home-tip-foot { font-size: 0.7rem; opacity: 0.7; margin-top: 0.15rem; }
.vx-home-strip-legend { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.4rem 1rem; margin-top: 0.7rem; }
.vx-home-strip-note { font-size: 0.74rem; color: var(--gray-500); }

/* lower row */
.vx-home-lower { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--vx-home-gap); }
@container vxhome (min-width: 820px) { .vx-home-lower { grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr); align-items: start; } }

.vx-home-acts { list-style: none; margin: 0; padding: 0; }
.vx-home-act { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 0.7rem; align-items: start; padding: 0.55rem 0; border-bottom: 1px solid var(--gray-100); }
.vx-home-act:last-child { border-bottom: 0; padding-bottom: 0; }
.vx-home-act-text { font-size: 0.86rem; color: var(--gray-600); line-height: 1.45; padding-top: 0.2rem; }
.vx-home-act-text a { color: var(--gray-900); font-weight: 600; text-decoration: none; }
.vx-home-act-text a:hover { color: var(--primary-dark); text-decoration: underline; }
.vx-home-act-text b { color: var(--gray-900); font-weight: 600; }
.vx-home-act-quote { color: var(--gray-500); font-style: italic; }
.vx-home-act-time { font-size: 0.74rem; color: var(--gray-500); white-space: nowrap; padding-top: 0.3rem; }
.vx-home-orgav .vx-av { border-radius: 7px; }
.vx-home-sysav { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: var(--vx-gray-bg); color: var(--vx-gray-fg); }
.vx-home-sysav--green { background: var(--vx-green-bg); color: var(--vx-green-fg); }
.vx-home-sysav--red { background: var(--vx-red-bg); color: var(--vx-red-fg); }

.vx-home-perf { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.vx-home-perf-item { display: flex; flex-direction: column; gap: 0.1rem; padding: 0.65rem 0.75rem; border-radius: 9px; background: var(--vx-home-day-bg); color: inherit; text-decoration: none; border: 1px solid transparent; min-width: 0; }
.vx-home-perf-item:hover, .vx-home-perf-item:focus-visible { border-color: var(--primary-mid); outline: none; }
.vx-home-perf-label { font-size: 0.74rem; font-weight: 600; color: var(--gray-500); }
.vx-home-perf-value { font-size: 1.4rem; font-weight: 700; color: var(--gray-900); letter-spacing: -0.02em; line-height: 1.2; }
.vx-home-perf-delta { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.74rem; font-weight: 600; }
.vx-home-perf-delta--good { color: #15803d; }
.vx-home-perf-delta--bad { color: #b91c1c; }
.vx-home-perf-delta--flat { color: var(--gray-500); }
[data-theme="dark"] .vx-home-perf-delta--good { color: #4ade80; }
[data-theme="dark"] .vx-home-perf-delta--bad { color: #f87171; }
.vx-home-perf-note { margin: 0.75rem 0 0; font-size: 0.76rem; color: var(--gray-500); }

/* ═══ B · Focus list ═══════════════════════════════════════════════════ */
.vx-home-fhead { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 0.9rem 1.5rem; padding: 1.25rem 1.5rem; margin-bottom: 1.25rem; }
.vx-home-fhead-main { display: flex; align-items: center; gap: 1rem; min-width: 0; }
.vx-home-fhead-n { font-size: 2.8rem; font-weight: 800; letter-spacing: -0.04em; color: var(--gray-900); line-height: 1; }
.vx-home-fhead-title { font-size: 1.08rem; font-weight: 700; color: var(--gray-800); }
.vx-home-fhead-sub { font-size: 0.86rem; color: var(--gray-500); }
.vx-home-fhead-go { display: flex; flex-direction: column; align-items: flex-end; gap: 0.35rem; }
.vx-home-start { padding: 0.85rem 1.7rem; font-size: 1rem; border-radius: 12px; }
.vx-home-fhead-hint { font-size: 0.75rem; color: var(--gray-500); }
.vx-home-progress { grid-column: 1 / -1; display: flex; align-items: center; gap: 0.75rem; font-size: 0.76rem; color: var(--gray-500); white-space: nowrap; }
.vx-home-progress-bar { flex: 1; height: 6px; border-radius: 3px; background: var(--gray-100); overflow: hidden; }
.vx-home-progress-bar span { display: block; height: 100%; border-radius: 3px; background: var(--vx-good); transition: width 0.45s ease; }

.vx-home-group { margin-bottom: 1rem; }
.vx-home-group-head { display: flex; align-items: center; gap: 0.5rem; width: 100%; padding: 0.4rem 0.35rem; margin-bottom: 0.4rem; border: 0; border-radius: 7px; background: none;
    font: inherit; color: var(--gray-700); text-align: left; cursor: pointer; }
.vx-home-group-head:hover { background: var(--gray-100); }
.vx-home-group-head:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.vx-home-group-label { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.vx-home-group-count { font-size: 0.72rem; font-weight: 700; background: var(--gray-200); color: var(--gray-700); border-radius: 9px; padding: 0 0.45rem; }
.vx-home-group-val { margin-left: auto; font-size: 0.8rem; font-weight: 600; color: var(--gray-500); }
.vx-home-group--customer .vx-home-flist, .vx-home-group--snoozed .vx-home-flist, .vx-home-group--system .vx-home-flist { opacity: 0.95; }
.vx-home-zero { margin-bottom: 0; }

.vx-home-flist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.55rem; }
.vx-home-frow { background: var(--bg); border: 1px solid var(--gray-200); border-radius: var(--radius); box-shadow: inset 4px 0 0 var(--vx-home-edge, transparent), var(--shadow); transition: box-shadow 0.15s, border-color 0.15s; }
.vx-home-frow:hover { border-color: var(--gray-300); }
.vx-home-frow.open { border-color: var(--gray-300); box-shadow: inset 4px 0 0 var(--vx-home-edge, transparent), var(--shadow-md); }
.vx-home-frow-line { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "main meta cta"; align-items: center; gap: 0.6rem 1.25rem; padding: 0.85rem 1rem 0.85rem 1.3rem; }
.vx-home-frow-toggle { grid-area: main; display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; border: 0; background: none; padding: 0; margin: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; border-radius: 6px; }
.vx-home-frow-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 4px; }
.vx-home-frow-head { display: flex; align-items: center; flex-wrap: wrap; gap: 0.35rem 0.55rem; }
.vx-home-frow-cust { font-size: 1rem; font-weight: 700; color: var(--gray-900); }
.vx-home-frow-owner { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.76rem; color: var(--gray-500); }
.vx-home-frow-title { display: flex; align-items: center; gap: 0.4rem; font-size: 0.88rem; font-weight: 600; color: var(--gray-700); margin-top: 0.1rem; }
.vx-home-frow-sentence { font-size: 0.84rem; color: var(--gray-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vx-home-frow.open .vx-home-frow-sentence { white-space: normal; }
.vx-home-frow-meta { grid-area: meta; display: flex; align-items: center; gap: 1rem; }
.vx-home-frow-val { font-weight: 700; color: var(--gray-800); min-width: 3.6em; text-align: right; font-size: 0.92rem; }
.vx-home-frow-cta { grid-area: cta; display: flex; align-items: center; gap: 0.35rem; justify-content: flex-end; }
.vx-home-frow-chev { display: inline-flex; color: var(--gray-400); padding: 0.25rem; cursor: pointer; transition: transform 0.15s; }
.vx-home-frow.open .vx-home-frow-chev { transform: rotate(180deg); }

.vx-home-fx { display: flex; flex-direction: column; gap: 0.8rem; padding: 0.95rem 1.25rem 1.1rem 1.3rem; border-top: 1px solid var(--gray-100); animation: fadeIn 0.15s ease; }
.vx-home-fx-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.vx-home-fx-note { display: flex; align-items: center; flex-wrap: wrap; gap: 0.4rem; margin: 0; font-size: 0.85rem; color: var(--gray-600); }
.vx-home-quote { margin: 0; padding: 0.65rem 0.9rem; border-left: 3px solid var(--gray-300); background: var(--gray-50); border-radius: 0 8px 8px 0; font-size: 0.86rem; color: var(--gray-700); }
.vx-home-quote p { margin: 0; white-space: pre-line; }
.vx-home-quote footer { margin-top: 0.35rem; font-size: 0.74rem; color: var(--gray-500); }
.vx-home-warn { display: inline-flex; align-items: center; gap: 0.2rem; color: var(--vx-amber-fg); font-weight: 600; }
.vx-home-intents { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.vx-home-intent { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.15rem 1rem; align-items: center; padding: 0.55rem 0.7rem 0.55rem 0.85rem; border: 1px solid var(--vx-amber-line);
    background: color-mix(in srgb, var(--vx-amber-bg) 45%, var(--bg)); border-radius: 8px; }
.vx-home-intent-text { font-weight: 600; font-size: 0.88rem; color: var(--gray-800); }
.vx-home-intent-meta { grid-column: 1; font-size: 0.75rem; color: var(--gray-500); }
.vx-home-intent-actions { grid-row: 1 / span 2; grid-column: 2; display: flex; gap: 0.35rem; }
.vx-home-draft { border: 1px solid var(--gray-200); border-radius: 9px; overflow: hidden; }
.vx-home-draft-meta { display: flex; align-items: center; gap: 0.45rem; padding: 0.5rem 0.8rem; background: var(--gray-50); border-bottom: 1px solid var(--gray-100); font-size: 0.8rem; color: var(--gray-600); }
.vx-home-draft-subj { padding: 0.6rem 0.9rem 0; font-weight: 700; font-size: 0.88rem; color: var(--gray-800); }
.vx-home-draft-body { padding: 0.4rem 0.9rem 0.8rem; max-height: 190px; overflow: hidden; font-size: 0.85rem; color: var(--gray-700);
    -webkit-mask-image: linear-gradient(180deg, #000 72%, transparent); mask-image: linear-gradient(180deg, #000 72%, transparent); }
.vx-home-draft-body p { margin: 0 0 0.45rem; }
.vx-home-changes { list-style: none; margin: 0; padding: 0; border: 1px solid var(--gray-200); border-radius: 9px; overflow: hidden; }
.vx-home-change { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.45rem 0.8rem; border-bottom: 1px solid var(--gray-100); font-size: 0.85rem; color: var(--gray-700); }
.vx-home-change:last-child { border-bottom: 0; }
.vx-home-change-desc { min-width: 0; }
.vx-home-change-desc small { display: block; font-size: 0.74rem; color: var(--gray-500); }
.vx-home-change-what { white-space: nowrap; color: var(--gray-600); }
.vx-home-change-what b { color: var(--gray-900); }
.vx-home-change--removed .vx-home-change-desc { text-decoration: line-through; color: var(--gray-500); }
.vx-home-change--removed .vx-home-change-what { color: var(--vx-red-fg); font-weight: 600; }
.vx-home-change--added .vx-home-change-what { color: var(--vx-green-fg); font-weight: 600; }
.vx-home-change--more { color: var(--gray-500); font-size: 0.8rem; }
.vx-home-order-foot { display: flex; flex-wrap: wrap; gap: 0.35rem 1.25rem; font-size: 0.83rem; color: var(--gray-600); }
.vx-home-order-foot b { color: var(--gray-900); }
.vx-home-order-foot small { color: var(--gray-500); }
.vx-home-error { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.7rem 0.85rem; border: 1px solid var(--vx-red-line); background: var(--vx-red-bg); color: var(--vx-red-fg); border-radius: 9px; font-size: 0.85rem; }
.vx-home-error small { display: block; margin-top: 0.25rem; opacity: 0.85; }
.vx-home-spin { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--vx-indigo-line); border-top-color: var(--vx-indigo-fg); animation: spin 0.8s linear infinite; flex-shrink: 0; }

/* ═══ C · Pipeline board ═══════════════════════════════════════════════ */
.vx-home-board-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1.25rem; margin-bottom: 0.75rem; }
.vx-home-board-hint { display: flex; align-items: center; gap: 0.4rem; margin: 0; font-size: 0.82rem; color: var(--gray-500); }
.vx-home-board-tools { display: flex; align-items: center; gap: 1.25rem; font-size: 0.84rem; color: var(--gray-600); }
.vx-home-board-total b { color: var(--gray-900); }
.vx-home-board-toggle { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 600; cursor: pointer; }
.vx-home-board { overflow-x: auto; overscroll-behavior-x: contain; padding-bottom: 0.6rem; border-radius: var(--radius); scrollbar-width: thin; }
.vx-home-board:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.vx-home-board-grid { display: grid; grid-template-columns: repeat(var(--cols, 7), minmax(200px, 1fr)); gap: 0.55rem; align-items: start; }
.vx-home-col-head { display: flex; flex-direction: column; gap: 0.1rem; padding: 0.6rem 0.75rem; background: var(--bg); border: 1px solid var(--gray-200); border-radius: 9px; box-shadow: inset 0 3px 0 var(--cc, var(--gray-300)), var(--shadow); }
.vx-home-col-head--gray { --cc: var(--gray-400); }
.vx-home-col-head--blue { --cc: var(--vx-c1); }
.vx-home-col-head--teal { --cc: #14b8a6; }
.vx-home-col-head--indigo { --cc: var(--vx-c7); }
.vx-home-col-head--amber { --cc: var(--vx-home-you); }
.vx-home-col-head--red { --cc: var(--vx-critical); }
.vx-home-col-head--closed { --cc: var(--vx-good); }
.vx-home-col-title { display: flex; align-items: center; justify-content: space-between; gap: 0.4rem; font-weight: 700; font-size: 0.85rem; color: var(--gray-800); }
.vx-home-col-n { font-size: 0.72rem; background: var(--gray-100); color: var(--gray-700); border-radius: 9px; padding: 0 0.45rem; }
.vx-home-col-val { font-size: 0.76rem; color: var(--gray-500); }
.vx-home-col { display: flex; flex-direction: column; gap: 0.5rem; min-height: 64px; padding: 0.45rem; border-radius: 10px; background: var(--vx-home-col-bg); }
.vx-home-col-empty { padding: 0.8rem 0; border: 1px dashed var(--gray-200); border-radius: 8px; text-align: center; font-size: 0.76rem; color: var(--gray-400); }
.vx-home-lane-head { grid-column: 1 / -1; margin-top: 0.6rem; }
.vx-home-lane-inner { position: sticky; left: 0; display: inline-flex; align-items: center; flex-wrap: wrap; gap: 0.25rem 0.55rem; padding: 0.25rem 0.35rem; }
.vx-home-lane-name { font-weight: 700; font-size: 0.9rem; color: var(--gray-800); }
.vx-home-lane-sub { font-size: 0.78rem; color: var(--gray-500); }

.vx-home-bcard { position: relative; display: flex; flex-direction: column; gap: 0.4rem; padding: 0.6rem 0.65rem 0.6rem 0.8rem; background: var(--bg); border: 1px solid var(--gray-200); border-radius: 9px;
    box-shadow: inset 3px 0 0 var(--vx-home-edge, transparent), var(--shadow); transition: border-color 0.12s, box-shadow 0.12s; }
.vx-home-bcard:hover { border-color: var(--primary-mid); box-shadow: inset 3px 0 0 var(--vx-home-edge, transparent), var(--shadow-md); }
.vx-home-bcard:focus-within { outline: 2px solid var(--primary); outline-offset: 1px; }
.vx-home-bcard-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem; }
.vx-home-bcard-link { font-weight: 700; font-size: 0.86rem; line-height: 1.3; color: var(--gray-900); text-decoration: none; }
.vx-home-bcard-link::after { content: ''; position: absolute; inset: 0; border-radius: 9px; }
.vx-home-bcard-link:focus-visible { outline: none; }
.vx-home-bcard .vx-popwrap, .vx-home-bcard .vx-av { position: relative; z-index: 1; }
.vx-home-bcard-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.35rem 0.5rem; font-size: 0.8rem; }
.vx-home-bcard-val { font-weight: 700; color: var(--gray-800); }
.vx-home-bcard-when, .vx-home-ref { font-size: 0.74rem; color: var(--gray-500); }
.vx-home-bcard--closed { box-shadow: none; background: color-mix(in srgb, var(--bg) 70%, transparent); }
.vx-home-badges { display: flex; flex-wrap: wrap; gap: 0.3rem; }

/* ═══ Narrow containers (phones, small tablets) ════════════════════════ */
@container vxhome (max-width: 760px) {
    .vx-home-frow-line { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "main main" "meta cta"; padding: 0.8rem 0.85rem 0.8rem 1.1rem; }
    .vx-home-frow-sentence { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
    .vx-home-frow-meta { gap: 0.7rem; }
    .vx-home-frow-meta .vx-urg-label { display: none; }
    .vx-home-fx { padding: 0.85rem 0.85rem 1rem 1.1rem; }
    .vx-home-intent { grid-template-columns: 1fr; }
    .vx-home-intent-actions { grid-row: auto; grid-column: 1; margin-top: 0.35rem; }
}
@container vxhome (max-width: 619px) {
    .vx-home-hero { padding: 1rem 1rem 1rem 1.15rem; }
    .vx-home-hero-cust { font-size: 1.25rem; }
    .vx-home-hero-sentence { margin-left: 0; }
    .vx-home-hero-meta { gap: 0.75rem 1.25rem; }
    .vx-home-cta { flex: 1 1 100%; justify-content: center; }
    .vx-home-session { flex: 1; justify-content: center; }
    .vx-home-hero-hint { display: none; }
    .vx-home-then-row { grid-template-columns: 10px minmax(0, 1fr) auto 15px; grid-template-areas: "dot cust val chev" ". act since chev"; row-gap: 0.1rem; }
    .vx-home-tdot { grid-area: dot; } .vx-home-then-cust { grid-area: cust; } .vx-home-then-act { grid-area: act; font-size: 0.8rem; }
    .vx-home-then-val { grid-area: val; } .vx-home-then-since { grid-area: since; } .vx-home-then-chev { grid-area: chev; }
    .vx-home-strip { grid-template-columns: 70px repeat(14, 54px); }
    .vx-home-strip-scroll { scroll-snap-type: x proximity; margin: 0 -0.25rem; padding: 0 0.25rem 4px; }
    .vx-home-day { scroll-snap-align: start; }
    .vx-home-strip-note { display: none; }
    .vx-home-fhead { grid-template-columns: 1fr; padding: 1rem 1.1rem; }
    .vx-home-fhead-go { align-items: stretch; }
    .vx-home-start { justify-content: center; }
    .vx-home-fhead-hint { text-align: center; }
    .vx-home-fhead-n { font-size: 2.3rem; }
    .vx-home-frow-meta .vx-eta svg { display: none; }
    .vx-home-board-grid { grid-template-columns: repeat(var(--cols, 7), 80cqw); }
    .vx-home-board { scroll-snap-type: x mandatory; }
    .vx-home-col-head, .vx-home-col { scroll-snap-align: start; }
    .vx-home-board-hint { font-size: 0.78rem; }
}

/* ---- 20-predictions.css ---- */
/* =====================================================================
   Vision — Predictions list (/vision/predictions). Prefix .vx-pl-
   ===================================================================== */

:root {
    --vx-pl-you: #eda100; --vx-pl-customer: #2a78d6; --vx-pl-system: #6a5cd0; --vx-pl-snoozed: #a3b1bf; --vx-pl-closed: #d1d9e0;
    --vx-pl-weekend: rgba(15, 34, 51, 0.035);
    --vx-pl-stick: 56px;           /* SR6 header height */
}
[data-theme="dark"] {
    --vx-pl-you: #c98500; --vx-pl-customer: #3987e5; --vx-pl-system: #8577e6; --vx-pl-snoozed: #4a7393; --vx-pl-closed: #285370;
    --vx-pl-weekend: rgba(255, 255, 255, 0.035);
}

.vx-pl-ellip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.vx-pl-btn-count { display: inline-flex; align-items: center; justify-content: center; min-width: 1.4em; padding: 0 0.35rem; margin-left: 0.15rem; border-radius: 9px; font-size: 0.7rem; font-weight: 700; background: rgba(255,255,255,0.25); line-height: 1.5; }
.btn-outline .vx-pl-btn-count, .vx-pl-mh .vx-pl-btn-count, .vx-pl-morebtn .vx-pl-btn-count { background: var(--gray-200); color: var(--gray-700); }
.vx-pl-spin { display: inline-block; width: 10px; height: 10px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: vxPlSpin 0.8s linear infinite; flex-shrink: 0; }
@keyframes vxPlSpin { to { transform: rotate(360deg); } }

/* ── Filter bar ─────────────────────────────────────────────────────── */
.vx-pl-filters { padding: 0.85rem 1rem; margin-bottom: 1rem; display: flex; flex-direction: column; gap: 0.7rem; }
.vx-pl-frow { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.6rem; }
.vx-pl-search { position: relative; flex: 1 1 220px; max-width: 340px; }
.vx-pl-search .vx-icon { position: absolute; left: 0.7rem; top: 50%; transform: translateY(-50%); color: var(--gray-400); pointer-events: none; }
.vx-pl-search .form-input { padding: 0.45rem 0.75rem 0.45rem 2.1rem; font-size: 0.86rem; height: 36px; }
.vx-pl-morebtn { display: none !important; }
.vx-pl-courts { min-width: 0; max-width: 100%; }

.vx-pl-field { position: relative; display: inline-flex; align-items: center; height: 34px; border: 1.5px solid var(--gray-200); border-radius: 8px; background: var(--bg); padding-left: 0.6rem; color: var(--gray-800); cursor: pointer; }
.vx-pl-field:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(2,132,199,0.15); }
.vx-pl-field.is-set { border-color: var(--primary-mid); background: var(--primary-light); }
.vx-pl-field-label { font-size: 0.72rem; font-weight: 600; color: var(--gray-500); margin-right: 0.3rem; white-space: nowrap; }
.vx-pl-field select { appearance: none; -webkit-appearance: none; border: 0; background: transparent; color: var(--gray-800); font: inherit; font-size: 0.82rem; font-weight: 600; height: 100%; padding: 0 1.7rem 0 0.1rem; cursor: pointer; outline: none; max-width: 220px; }
.vx-pl-field select option, .vx-pl-field select optgroup { background: var(--bg); color: var(--gray-800); }
.vx-pl-field-chev { position: absolute; right: 0.5rem; top: 50%; transform: translateY(-50%); color: var(--gray-500); pointer-events: none; }
.vx-pl-field--btn { padding-right: 1.8rem; font: inherit; }
.vx-pl-field--btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.vx-pl-field-value { font-size: 0.82rem; font-weight: 600; color: var(--gray-800); white-space: nowrap; }
.vx-pl-sort { display: inline-flex; align-items: center; gap: 0.3rem; }
.vx-pl-dirbtn { width: 34px; height: 34px; border-radius: 8px; border-width: 1.5px; }
.vx-pl-closedtoggle { display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.82rem; font-weight: 600; color: var(--gray-700); cursor: pointer; }
.vx-pl-closedtoggle small { color: var(--gray-500); font-weight: 500; }
.vx-pl-clear { font-size: 0.8rem; margin-left: auto; }

.vx-pl-ms { display: flex; flex-direction: column; gap: 0.1rem; }
.vx-pl-ms-title { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--gray-500); margin: 0.35rem 0 0.15rem; }
.vx-pl-ms-title:first-child { margin-top: 0; }
.vx-pl-ms-title span { text-transform: none; letter-spacing: 0; font-weight: 500; }
.vx-pl-ms-item { display: flex; align-items: center; gap: 0.5rem; padding: 0.22rem 0.25rem; border-radius: 6px; cursor: pointer; }
.vx-pl-ms-item:hover { background: var(--gray-50); }
.vx-pl-ms-item input { accent-color: var(--primary); }
.vx-pl-ms-count { margin-left: auto; font-size: 0.75rem; color: var(--gray-500); }
.vx-pl-ms-foot { display: flex; justify-content: space-between; border-top: 1px solid var(--gray-100); margin-top: 0.4rem; padding-top: 0.4rem; }
.vx-linkbtn:disabled { opacity: 0.45; cursor: default; text-decoration: none; }

.vx-pl-views { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.vx-pl-chip { display: inline-flex; align-items: center; gap: 0.35rem; border: 1px solid var(--gray-200); background: var(--bg); color: var(--gray-700); border-radius: 999px; padding: 0.28rem 0.7rem; font: inherit; font-size: 0.78rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.vx-pl-chip:hover { border-color: var(--primary-mid); color: var(--primary-dark); }
.vx-pl-chip.on { background: var(--primary-light); border-color: var(--primary); color: var(--primary-dark); }
.vx-pl-chip small { font-size: 0.72rem; font-weight: 500; color: var(--gray-500); }
.vx-pl-chip:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.vx-pl-summary { margin-left: auto; font-size: 0.84rem; color: var(--gray-600); white-space: nowrap; }
.vx-pl-summary b { color: var(--gray-900); }
.vx-pl-summary-note { margin-left: 0.4rem; color: var(--gray-500); }

/* ── Result banner ──────────────────────────────────────────────────── */
.vx-pl-banner { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem 0.75rem; padding: 0.65rem 0.9rem; margin-bottom: 1rem; border-radius: var(--radius); border: 1px solid var(--vx-blue-line); background: var(--vx-blue-bg); color: var(--vx-blue-fg); font-size: 0.86rem; animation: slideUp 0.18s ease; }
.vx-pl-banner--cancel { border-color: var(--gray-300); background: var(--gray-100); color: var(--gray-700); }
.vx-pl-banner-text { font-weight: 600; display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.vx-pl-banner-live { display: inline-flex; gap: 0.4rem; flex-wrap: wrap; }
.vx-pl-banner-hint { font-size: 0.78rem; opacity: 0.8; margin-right: auto; }

/* ── Delivery states (honest: queued ≠ sent ≠ delivered) ─────────────── */
.vx-pl-delivery { display: inline-flex; align-items: center; gap: 0.3rem; margin-top: 0.25rem; font-size: 0.72rem; font-weight: 600; color: var(--gray-600); white-space: nowrap; }
.vx-pl-delivery--queued { color: var(--vx-indigo-fg); }
.vx-pl-delivery--sent { color: var(--vx-blue-fg); }
.vx-pl-delivery--delivered { color: var(--vx-green-fg); }
.vx-pl-delivery--failed { color: var(--vx-red-fg); }
.vx-pl-banner .vx-pl-delivery { margin-top: 0; background: var(--bg); border-radius: 999px; padding: 0.1rem 0.5rem; }

/* ── A: table ───────────────────────────────────────────────────────── */
.vx-pl-tablecard { padding: 0; overflow: visible; }
.vx-pl-toolbar { position: sticky; top: var(--vx-pl-stick); z-index: 30; display: flex; align-items: center; gap: 0.6rem; height: 52px; padding: 0 1rem; background: var(--bg); border-bottom: 1px solid var(--gray-200); border-radius: var(--radius) var(--radius) 0 0; font-size: 0.84rem; }
.vx-pl-toolbar.is-bulk { background: var(--primary-light); }
.vx-pl-toolbar-hint { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--gray-500); }
.vx-pl-toolbar-sp { flex: 1; }
.vx-pl-selcount { color: var(--gray-700); }
.vx-pl-selcount b { color: var(--gray-900); }
.vx-pl-bulk { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.vx-pl-btn-danger { color: var(--vx-red-fg); }
.vx-pl-btn-danger:hover { border-color: var(--vx-red-line); background: var(--vx-red-bg); color: var(--vx-red-fg); }

.vx-pl-table { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: 0.85rem; }
.vx-pl-table thead th { position: sticky; top: calc(var(--vx-pl-stick) + 52px); z-index: 20; background: var(--gray-50); text-align: left; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--gray-500); padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--gray-200); white-space: nowrap; }
.vx-pl-sortbtn { display: inline-flex; align-items: center; gap: 0.2rem; border: 0; background: none; padding: 0; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; }
.vx-pl-sortbtn .vx-icon { opacity: 0.35; }
.vx-pl-sortbtn:hover, .vx-pl-sortbtn.on { color: var(--primary-dark); }
.vx-pl-sortbtn.on .vx-icon { opacity: 1; }
.vx-pl-sortbtn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 3px; }

.vx-pl-c-sel { width: 42px; }
.vx-pl-c-urg { width: 96px; }
.vx-pl-c-cust { width: 200px; }
.vx-pl-c-status { width: 132px; }
.vx-pl-c-eta { width: 170px; }
.vx-pl-c-val { width: 104px; text-align: right; }
.vx-pl-table thead th.vx-pl-c-val { text-align: right; }
.vx-pl-c-owner { width: 56px; }
.vx-pl-c-act { width: 96px; }

.vx-pl-table td { padding: 0.6rem; border-bottom: 1px solid var(--gray-100); vertical-align: middle; color: var(--gray-700); }
.vx-pl-row { cursor: pointer; transition: background 0.1s; }
.vx-pl-row:hover td { background: var(--vx-row-hover); }
.vx-pl-row.is-selected td { background: var(--primary-light); }
.vx-pl-row.is-pinned td { animation: vxPlFlash 1.6s ease; }
@keyframes vxPlFlash { 0% { background: var(--vx-blue-bg); } 100% { background: transparent; } }
.vx-pl-row.is-closed td { color: var(--gray-500); }
.vx-pl-row td.vx-pl-c-sel { box-shadow: inset 3px 0 0 transparent; }
.vx-pl-row--you td.vx-pl-c-sel { box-shadow: inset 3px 0 0 var(--vx-pl-you); }
.vx-pl-row--system td.vx-pl-c-sel { box-shadow: inset 3px 0 0 var(--vx-pl-system); }
.vx-pl-row--customer td.vx-pl-c-sel { box-shadow: inset 3px 0 0 var(--vx-pl-customer); }
.vx-pl-row--snoozed td.vx-pl-c-sel { box-shadow: inset 3px 0 0 var(--vx-pl-snoozed); }
.vx-pl-check { display: inline-flex; padding: 0.2rem; cursor: pointer; }
.vx-pl-check input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.vx-pl-check input:disabled { cursor: not-allowed; opacity: 0.4; }
.vx-pl-c-urg .vx-urg-label { display: none; }

.vx-pl-cust-name { display: block; font-weight: 600; color: var(--gray-900); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vx-pl-cust-name:hover { color: var(--primary-dark); text-decoration: underline; }
.vx-pl-cust-sub { font-size: 0.75rem; color: var(--gray-500); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vx-pl-next-title { display: flex; align-items: center; gap: 0.35rem; font-weight: 600; color: var(--gray-800); min-width: 0; }
.vx-pl-row.is-closed .vx-pl-next-title { color: var(--gray-600); }
.vx-pl-next-sub { font-size: 0.76rem; color: var(--gray-500); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vx-pl-routine, .vx-pl-moved { flex-shrink: 0; font-size: 0.62rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; padding: 0.04rem 0.35rem; border-radius: 4px; }
.vx-pl-routine { background: var(--vx-green-bg); color: var(--vx-green-fg); }
.vx-pl-moved { background: var(--vx-gray-bg); color: var(--gray-500); border: 1px dashed var(--gray-300); }
.vx-pl-clip { overflow: hidden; }
.vx-pl-c-val { font-weight: 600; color: var(--gray-800); white-space: nowrap; }
.vx-pl-owner { display: inline-flex; align-items: center; gap: 0.4rem; min-width: 0; }
.vx-pl-owner-name { display: none; font-size: 0.8rem; font-weight: 600; color: var(--gray-700); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vx-pl-c-act { font-size: 0.8rem; color: var(--gray-500); white-space: nowrap; }

.vx-pl-grouprow th { padding: 0.75rem 0.75rem 0.45rem; background: var(--bg); border-bottom: 1px solid var(--gray-200); text-align: left; font-weight: 500; }
.vx-pl-group { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; font-size: 0.82rem; color: var(--gray-700); }
.vx-pl-group b { color: var(--gray-900); }
.vx-pl-group-meta { color: var(--gray-500); font-weight: 600; }
.vx-pl-group-hint { color: var(--gray-400); font-size: 0.76rem; }
.vx-pl-pager { margin: 0; padding: 0.75rem 1rem; border-top: 1px solid var(--gray-100); }

@media (min-width: 1600px) {
    .vx-pl-c-owner { width: 128px; }
    .vx-pl-owner-name { display: inline; }
}
@media (max-width: 1279px) {
    .vx-pl-c-act { display: none; }
}
@media (max-width: 1023px) {
    .vx-pl-c-owner { display: none; }
    .vx-pl-c-cust { width: 170px; }
    .vx-pl-table thead th { position: static; }
    .vx-pl-toolbar { position: static; height: auto; min-height: 52px; padding: 0.5rem 1rem; flex-wrap: wrap; }
}

/* ── B: timeline ────────────────────────────────────────────────────── */
.vx-pl-gcard { padding: 0; overflow: hidden; }
.vx-pl-ghead { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; padding: 0.8rem 1rem; border-bottom: 1px solid var(--gray-200); }
.vx-pl-gtitle { display: flex; flex-direction: column; font-size: 0.8rem; min-width: 0; }
.vx-pl-gtitle b { font-size: 0.9rem; color: var(--gray-800); }
.vx-pl-gwrap { position: relative; }
.vx-pl-gscroll { overflow: auto; max-height: max(360px, calc(100vh - 330px)); }
.vx-pl-gcanvas { position: relative; }
.vx-pl-gaxis { position: sticky; top: 0; z-index: 6; display: flex; background: var(--gray-50); border-bottom: 1px solid var(--gray-200); }
.vx-pl-gcorner { position: sticky; left: 0; z-index: 7; flex-shrink: 0; background: var(--gray-50); border-right: 1px solid var(--gray-200); display: flex; align-items: flex-end; padding: 0 0.75rem 0.4rem; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--gray-500); }
.vx-pl-gdays { position: relative; height: 52px; flex-shrink: 0; }
.vx-pl-gmonth { position: absolute; top: 3px; padding-left: 4px; font-size: 0.72rem; font-weight: 700; color: var(--gray-700); border-left: 1px solid var(--vx-axis-line); white-space: nowrap; }
.vx-pl-gday { position: absolute; bottom: 0; height: 32px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding-bottom: 3px; font-size: 0.7rem; line-height: 1.1; color: var(--gray-600); font-variant-numeric: tabular-nums; }
.vx-pl-gday small { font-size: 0.6rem; color: var(--gray-400); }
.vx-pl-gday.is-weekend { background: var(--vx-pl-weekend); }
.vx-pl-gday.is-today span { color: #fff; background: var(--vx-critical); border-radius: 4px; padding: 0 3px; font-weight: 700; }
.vx-pl-gnowtag { display: none; }
.vx-pl-gbody { position: relative; }
.vx-pl-ggrid { position: absolute; top: 0; bottom: 0; z-index: 0; pointer-events: none; }
.vx-pl-gweekend { position: absolute; top: 0; bottom: 0; background: var(--vx-pl-weekend); }
.vx-pl-gweek { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--vx-grid-line); }
.vx-pl-gnow { position: absolute; top: 0; bottom: 0; border-left: 2px solid var(--vx-critical); opacity: 0.75; }
.vx-pl-grow { position: relative; z-index: 1; display: flex; border-bottom: 1px solid var(--gray-100); cursor: pointer; }
.vx-pl-grow:hover .vx-pl-gtrack, .vx-pl-grow.is-hover .vx-pl-gtrack { background: color-mix(in srgb, var(--vx-row-hover) 70%, transparent); }
.vx-pl-glabel { position: sticky; left: 0; z-index: 3; flex-shrink: 0; display: flex; flex-direction: column; justify-content: center; gap: 0.15rem; padding: 0 0.75rem; background: var(--bg); border-right: 1px solid var(--gray-200); min-width: 0; }
.vx-pl-grow:hover .vx-pl-glabel { background: var(--vx-row-hover); }
.vx-pl-glabel-name { font-size: 0.84rem; font-weight: 600; color: var(--gray-900); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vx-pl-glabel-name:hover { color: var(--primary-dark); text-decoration: underline; }
.vx-pl-glabel-meta { display: flex; align-items: center; justify-content: space-between; gap: 0.4rem; font-size: 0.75rem; color: var(--gray-600); font-weight: 600; }
.vx-pl-glabel .vx-pill { font-size: 0.66rem; padding: 0.02rem 0.4rem; }
.vx-pl-gtrack { position: relative; flex-shrink: 0; }
.vx-pl-glane { position: absolute; top: 13px; border-top: 1.5px dashed var(--vx-muted-line); }
.vx-pl-gbar { position: absolute; top: 26px; height: 14px; border-radius: 7px; opacity: 0.9; }
.vx-pl-gbar--you { background: var(--vx-pl-you); }
.vx-pl-gbar--customer { background: var(--vx-pl-customer); }
.vx-pl-gbar--system { background: var(--vx-pl-system); }
.vx-pl-gbar--snoozed { background: var(--vx-pl-snoozed); }
.vx-pl-gbar--closed { background: transparent; border: 1.5px solid var(--vx-muted-line); }
.vx-pl-gbar.is-overdue { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--vx-critical); }
.vx-pl-gpeak { position: absolute; top: 28px; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: var(--bg); border: 2.5px solid var(--gray-800); }
.vx-pl-gover { position: absolute; top: 25px; font-size: 0.7rem; font-weight: 700; color: var(--vx-red-fg); white-space: nowrap; }
.vx-pl-goff { position: absolute; top: 24px; display: inline-flex; align-items: center; gap: 0.15rem; font-size: 0.7rem; font-weight: 600; color: var(--gray-600); background: var(--gray-100); border-radius: 999px; padding: 0.05rem 0.45rem; white-space: nowrap; }
.vx-pl-goff--left { left: 4px; }
.vx-pl-goff--right { right: 4px; }
.vx-pl-goff--none { left: 8px; background: none; color: var(--gray-400); font-style: italic; }
.vx-pl-goff.is-overdue { color: var(--vx-red-fg); background: var(--vx-red-bg); }
.vx-pl-mk { position: absolute; top: 5px; width: 17px; height: 17px; margin-left: -8.5px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--bg); border: 1.5px solid; z-index: 2; }
.vx-pl-mk--legend { position: static; margin: 0; }
.vx-pl-mk--sent { color: var(--vx-blue-fg); border-color: var(--vx-c1); }
.vx-pl-mk--viewed { color: var(--vx-teal-fg); border-color: var(--vx-c3); }
.vx-pl-mk--lapse { color: var(--vx-red-fg); border-color: var(--vx-critical); }
.vx-pl-mk--closed { color: var(--vx-green-fg); border-color: var(--vx-good); }
.vx-pl-gtip { min-width: 220px; max-width: 270px; z-index: 20; }
.vx-pl-gtip span { opacity: 0.92; }
.vx-pl-tip-warn { color: #ffb4b4; font-weight: 600; opacity: 1 !important; }
[data-theme="dark"] .vx-pl-tip-warn { color: #b91c1c; }
.vx-pl-tip-next { margin-top: 0.2rem; font-weight: 600; }
.vx-pl-glegend { padding: 0.65rem 1rem 0.8rem; margin: 0; border-top: 1px solid var(--gray-200); }
.vx-pl-sw { width: 14px !important; height: 8px !important; border-radius: 4px !important; }
.vx-pl-sw--you { background: var(--vx-pl-you); } .vx-pl-sw--customer { background: var(--vx-pl-customer); }
.vx-pl-sw--system { background: var(--vx-pl-system); } .vx-pl-sw--snoozed { background: var(--vx-pl-snoozed); }
.vx-pl-sw--closed { border: 1.5px solid var(--vx-muted-line); }
.vx-pl-sw--peak { width: 10px !important; height: 10px !important; border-radius: 50% !important; border: 2.5px solid var(--gray-800); }
.vx-pl-sw--today { width: 2px !important; height: 14px !important; border-radius: 0 !important; background: var(--vx-critical); }
.vx-pl-sw--weekend { background: var(--vx-pl-weekend); border: 1px solid var(--gray-200); }

/* ── C: cards ───────────────────────────────────────────────────────── */
.vx-pl-cgroup { margin-bottom: 1.25rem; }
.vx-pl-cgroup-head { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; font-weight: 700; color: var(--gray-800); margin: 0 0 0.6rem; }
.vx-pl-cgroup-head .vx-muted { font-weight: 600; font-size: 0.8rem; }
.vx-pl-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 0.85rem; }
.vx-pl-card { display: flex; flex-direction: column; gap: 0.6rem; background: var(--bg); border: 1px solid var(--gray-200); border-top: 3px solid var(--gray-300); border-radius: var(--radius); box-shadow: var(--shadow); padding: 0.85rem 1rem; min-width: 0; }
.vx-pl-card:hover { box-shadow: var(--shadow-md); }
.vx-pl-card--you { border-top-color: var(--vx-pl-you); }
.vx-pl-card--customer { border-top-color: var(--vx-pl-customer); }
.vx-pl-card--system { border-top-color: var(--vx-pl-system); }
.vx-pl-card--snoozed { border-top-color: var(--vx-pl-snoozed); }
.vx-pl-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.5rem; }
.vx-pl-card-titles { min-width: 0; }
.vx-pl-card-name { display: block; font-weight: 700; color: var(--gray-900); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vx-pl-card-name:hover { color: var(--primary-dark); text-decoration: underline; }
.vx-pl-card-sub { font-size: 0.75rem; color: var(--gray-500); }
.vx-pl-card-na { font-weight: 600; color: var(--gray-800); font-size: 0.9rem; }
.vx-pl-card-next p { font-size: 0.8rem; color: var(--gray-600); margin-top: 0.1rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.vx-pl-card-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem 0.75rem; margin: 0; padding: 0.6rem 0 0; border-top: 1px solid var(--gray-100); }
.vx-pl-card-facts dt { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--gray-500); }
.vx-pl-card-facts dd { margin: 0.1rem 0 0; font-size: 0.82rem; min-width: 0; }
.vx-pl-card-val { font-weight: 700; color: var(--gray-900); }
.vx-pl-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-top: auto; }
.vx-pl-card-owner { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.76rem; color: var(--gray-500); min-width: 0; }
.vx-pl-card-cta { text-decoration: none; white-space: nowrap; }
.vx-pl-more { display: flex; align-items: center; justify-content: center; gap: 0.75rem; padding: 0.5rem 0 1rem; font-size: 0.82rem; }

/* ── Modals ─────────────────────────────────────────────────────────── */
.vx-pl-mintro { font-size: 0.86rem; color: var(--gray-600); margin-bottom: 0.9rem; line-height: 1.5; }
.vx-pl-mh { display: flex; align-items: center; gap: 0.4rem; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--gray-600); margin: 0.9rem 0 0.45rem; }
.vx-pl-mnone { font-size: 0.85rem; color: var(--gray-500); padding: 0.6rem 0.8rem; background: var(--gray-50); border-radius: 8px; }
.vx-pl-routine-list, .vx-pl-skip-list, .vx-pl-mlist { list-style: none; margin: 0; padding: 0; }
.vx-pl-rl { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.75rem; padding: 0.55rem 0.7rem; border: 1px solid var(--gray-200); border-radius: 8px; margin-bottom: 0.4rem; }
.vx-pl-rl.is-done { border-color: var(--vx-green-line); background: color-mix(in srgb, var(--vx-green-bg) 50%, transparent); }
.vx-pl-rl-main { display: flex; align-items: center; gap: 0.7rem; flex: 1 1 400px; min-width: 0; cursor: pointer; }
.vx-pl-rl-main input { width: 16px; height: 16px; accent-color: var(--primary); flex-shrink: 0; }
.vx-pl-rl-state { width: 16px; display: inline-flex; justify-content: center; color: var(--vx-green-fg); flex-shrink: 0; }
.vx-pl-rl-state .vx-pl-spin { color: var(--vx-indigo-fg); }
.vx-pl-rl-cust { display: flex; flex-direction: column; min-width: 0; flex: 1; font-size: 0.85rem; }
.vx-pl-rl-cust .vx-muted { font-size: 0.75rem; }
.vx-pl-rl-to { display: flex; align-items: center; gap: 0.45rem; min-width: 0; }
.vx-pl-rl-addr { display: flex; flex-direction: column; font-size: 0.78rem; line-height: 1.25; min-width: 0; }
.vx-pl-rl-addr span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vx-pl-preview { flex-basis: 100%; border: 1px solid var(--gray-200); border-radius: 8px; background: var(--gray-50); padding: 0.6rem 0.75rem; font-size: 0.82rem; color: var(--gray-700); }
.vx-pl-preview-subj { font-weight: 600; margin-bottom: 0.35rem; }
.vx-pl-preview-body p { margin: 0 0 0.45rem; }
.vx-pl-preview-foot { font-size: 0.72rem; color: var(--gray-500); border-top: 1px solid var(--gray-200); padding-top: 0.35rem; margin-top: 0.35rem; }
.vx-pl-skip-list > li { padding: 0.45rem 0.7rem; border-left: 3px solid var(--vx-amber-line); background: var(--gray-50); border-radius: 0 6px 6px 0; margin-bottom: 0.35rem; font-size: 0.84rem; }
.vx-pl-skip-list > li > a { font-weight: 600; color: var(--gray-800); }
.vx-pl-skip-list ul { margin: 0.15rem 0 0 1.1rem; padding: 0; font-size: 0.78rem; color: var(--gray-600); }
.vx-pl-mfoot-note { font-size: 0.75rem; color: var(--gray-500); margin-right: auto; }
.vx-pl-progress { display: flex; align-items: center; gap: 0.75rem; width: 100%; font-size: 0.84rem; font-weight: 600; color: var(--gray-700); }
.vx-pl-progress-bar { flex: 1; height: 8px; border-radius: 4px; background: var(--gray-200); overflow: hidden; }
.vx-pl-progress-bar span { display: block; height: 100%; background: var(--primary); border-radius: 4px; transition: width 0.25s ease; }
.vx-pl-mtag { display: flex; align-items: center; gap: 0.5rem; font-size: 0.76rem; color: var(--gray-500); margin-bottom: 0.75rem; }
.vx-pl-mlist { border: 1px solid var(--gray-200); border-radius: 8px; margin-bottom: 0.9rem; }
.vx-pl-mlist li { display: grid; grid-template-columns: 1fr auto auto; gap: 0.75rem; padding: 0.4rem 0.7rem; font-size: 0.84rem; border-bottom: 1px solid var(--gray-100); }
.vx-pl-mlist li:last-child { border-bottom: 0; }
.vx-pl-radios { border: 0; padding: 0; margin: 0 0 0.9rem; display: flex; flex-direction: column; gap: 0.35rem; }
.vx-pl-radio { display: flex; align-items: flex-start; gap: 0.6rem; padding: 0.5rem 0.7rem; border: 1px solid var(--gray-200); border-radius: 8px; cursor: pointer; font-size: 0.85rem; }
.vx-pl-radio.on { border-color: var(--primary); background: var(--primary-light); }
.vx-pl-radio input { margin-top: 0.2rem; accent-color: var(--primary); }
.vx-pl-radio > span { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.vx-pl-radio small { color: var(--gray-500); font-size: 0.76rem; }
.vx-pl-radio--compact { padding: 0.4rem 0.7rem; }
.vx-pl-date { margin-top: 0.4rem; max-width: 220px; padding: 0.4rem 0.6rem; font-size: 0.85rem; }
.vx-pl-mnote { display: flex; gap: 0.45rem; align-items: flex-start; font-size: 0.8rem; color: var(--gray-600); background: var(--gray-50); border-radius: 8px; padding: 0.55rem 0.7rem; margin-top: 0.75rem; }
.vx-pl-mnote .vx-icon { margin-top: 0.15rem; color: var(--gray-400); }
.vx-pl-person { align-items: center; }
.vx-pl-person input { margin-top: 0; }
.vx-pl-person-n { font-size: 0.76rem; color: var(--gray-500); white-space: nowrap; }

/* ── Mobile ─────────────────────────────────────────────────────────── */
@media (max-width: 767px) {
    .vx-pl-filters { padding: 0.75rem; gap: 0.6rem; }
    .vx-pl-search { max-width: none; flex: 1 1 0; }
    .vx-pl-morebtn { display: inline-flex !important; }
    .vx-pl-courts { flex-basis: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
    .vx-pl-courts .vx-seg { flex-wrap: nowrap; }
    .vx-pl-frow--fields { display: none; }
    .vx-pl-frow--fields.is-open { display: grid; grid-template-columns: 1fr; }
    .vx-pl-frow--fields .vx-pl-field, .vx-pl-frow--fields .vx-popwrap, .vx-pl-frow--fields .vx-pl-field--btn { width: 100%; }
    .vx-pl-field select { flex: 1; max-width: none; }
    .vx-pl-sort .vx-pl-field { flex: 1; }
    .vx-pl-clear { margin-left: 0; }
    .vx-pl-frow--views { flex-direction: column; align-items: stretch; }
    .vx-pl-views { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
    .vx-pl-summary { margin-left: 0; }

    .vx-pl-toolbar { position: sticky; top: var(--vx-pl-stick); padding: 0.5rem 0.75rem; }
    .vx-pl-toolbar-hint { display: none; }
    .vx-pl-bulk { width: 100%; }
    .vx-pl-bulk .btn { flex: 1 1 auto; justify-content: center; padding: 0.4rem 0.55rem; }
    .vx-pl-table, .vx-pl-table tbody { display: block; }
    .vx-pl-table thead { display: none; }
    .vx-pl-grouprow, .vx-pl-grouprow th { display: block; }
    .vx-pl-table tr.vx-pl-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.5rem; padding: 0.7rem 0.75rem 0.7rem 0.4rem; border-bottom: 1px solid var(--gray-100); }
    .vx-pl-row--you { box-shadow: inset 3px 0 0 var(--vx-pl-you); }
    .vx-pl-row--system { box-shadow: inset 3px 0 0 var(--vx-pl-system); }
    .vx-pl-row--customer { box-shadow: inset 3px 0 0 var(--vx-pl-customer); }
    .vx-pl-row--snoozed { box-shadow: inset 3px 0 0 var(--vx-pl-snoozed); }
    .vx-pl-row td.vx-pl-c-sel { box-shadow: none !important; }
    .vx-pl-row.is-selected { background: var(--primary-light); }
    .vx-pl-table td { display: block; padding: 0; border: 0; width: auto; background: transparent !important; }
    .vx-pl-c-sel { order: 0; width: 28px !important; }
    .vx-pl-c-cust { order: 1; flex: 1 1 0; min-width: 0; }
    .vx-pl-c-val { order: 2; }
    .vx-pl-c-next { order: 3; flex: 0 0 calc(100% - 36px); margin-left: 36px; min-width: 0; }
    .vx-pl-c-status { order: 4; margin-left: 36px; }
    .vx-pl-c-status .vx-pl-delivery { margin: 0 0 0 0.4rem; }
    .vx-pl-c-eta { order: 5; }
    .vx-pl-c-urg { order: 6; margin-left: auto; }
    .vx-pl-c-owner, .vx-pl-c-act { display: none !important; }
    .vx-pl-next-sub { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
    .vx-pl-c-eta .vx-eta svg, .vx-pl-c-eta .vx-conf { display: none; }
    .vx-pl-pager { justify-content: center; }

    .vx-pl-cards { grid-template-columns: 1fr; }
    .vx-pl-rl-main { flex-wrap: wrap; flex-basis: 100%; }
    .vx-pl-rl-to { margin-left: 1.6rem; }
    .vx-pl-banner-hint { display: none; }
}

/* ---- 30-workspace.css ---- */
/* Vision — prediction workspace (.vx-ws-*) */
.vx-ws-page { padding-bottom: 5rem; }
.vx-ws-session { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; padding: 0.5rem 0.85rem; margin-bottom: 0.75rem; border-radius: var(--radius); background: var(--vx-blue-bg, #eff6ff); color: var(--vx-blue-ink, #1e40af); font-size: 0.8125rem; }
.vx-ws-session-exit { margin-left: auto; font-weight: 600; color: inherit; }
.vx-ws-flash { padding: 0.5rem 0.85rem; margin-bottom: 0.75rem; border-radius: var(--radius); background: var(--gray-100); font-size: 0.8125rem; }

/* Header */
.vx-ws-head { padding: 0.75rem 1rem 0.9rem; margin-bottom: 0.75rem; }
.vx-ws-head-top { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.vx-ws-back { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.8125rem; font-weight: 600; color: var(--gray-600); text-decoration: none; }
.vx-ws-back:hover { color: var(--primary-dark); }
.vx-ws-nav { display: inline-flex; align-items: center; gap: 0.35rem; margin-left: auto; }
.vx-ws-nav-count { font-size: 0.75rem; color: var(--gray-500); min-width: 4.5rem; text-align: center; }
.vx-ws-keys { display: inline-flex; gap: 0.15rem; margin-left: 0.25rem; }
.vx-ws-sidebtns { display: inline-flex; gap: 0.35rem; }
.vx-ws-head-main { display: flex; align-items: center; justify-content: space-between; gap: 1rem 1.5rem; flex-wrap: wrap; margin-bottom: 0.7rem; }
.vx-ws-title { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; min-width: 0; }
.vx-ws-cust { display: inline-flex; align-items: center; gap: 0.15rem; border: 0; background: none; padding: 0; font: inherit; font-size: 1.25rem; font-weight: 700; color: var(--gray-900); cursor: pointer; text-align: left; }
.vx-ws-cust:hover { color: var(--primary-dark); text-decoration: underline; }
.vx-ws-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); gap: 0.6rem 1.25rem; margin: 0; padding-top: 0.7rem; border-top: 1px solid var(--gray-200); }
.vx-ws-facts dt { font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--gray-500); font-weight: 600; margin-bottom: 0.15rem; }
.vx-ws-facts dd { min-width: 0; margin: 0; font-size: 0.8125rem; color: var(--gray-800); min-height: 1.5rem; display: flex; align-items: center; flex-wrap: wrap; gap: 0.25rem; }
.vx-ws-value { font-weight: 700; font-variant-numeric: tabular-nums; }
.vx-ws-warn { color: var(--vx-red-ink, #b91c1c); font-weight: 600; }
.vx-ws-ownerbtn { display: inline-flex; align-items: center; gap: 0.2rem; border: 1px solid transparent; background: none; border-radius: 6px; padding: 0.1rem 0.3rem 0.1rem 0; cursor: pointer; color: inherit; font: inherit; }
.vx-ws-ownerbtn:hover { border-color: var(--gray-300); background: var(--gray-50); }
.vx-ws-people { list-style: none; margin: 0.35rem 0 0; padding: 0; max-height: 260px; overflow: auto; }
.vx-ws-people button { display: flex; align-items: center; gap: 0.5rem; width: 100%; padding: 0.4rem 0.5rem; border: 0; background: none; border-radius: 6px; font: inherit; font-size: 0.8125rem; color: var(--gray-800); cursor: pointer; text-align: left; }
.vx-ws-people button:hover, .vx-ws-people button.on { background: var(--gray-100); }

/* Banner */
.vx-ws-banner { --ws-tone: var(--gray-500); --ws-bg: var(--gray-50); display: flex; align-items: center; gap: 0.85rem; padding: 0.8rem 1rem; margin-bottom: 0.75rem; border: 1px solid var(--gray-200); border-left: 4px solid var(--ws-tone); border-radius: var(--radius); background: var(--ws-bg); }
.vx-ws-banner--amber { --ws-tone: #d97706; --ws-bg: #fffbeb; }
.vx-ws-banner--red { --ws-tone: #dc2626; --ws-bg: #fef2f2; }
.vx-ws-banner--blue { --ws-tone: #2563eb; --ws-bg: #eff6ff; }
.vx-ws-banner--indigo { --ws-tone: #4f46e5; --ws-bg: #eef2ff; }
.vx-ws-banner--green { --ws-tone: #16a34a; --ws-bg: #f0fdf4; }
.vx-ws-banner-icon { color: var(--ws-tone); display: flex; }
.vx-ws-banner-text { flex: 1; min-width: 0; }
.vx-ws-banner-title { font-weight: 700; font-size: 0.9375rem; color: var(--gray-900); }
.vx-ws-banner-text p { margin: 0.1rem 0 0; font-size: 0.8125rem; color: var(--gray-700); }
.vx-ws-banner-actions { display: flex; align-items: center; gap: 0.75rem; flex-shrink: 0; }
.vx-ws-why { border: 0; background: none; font: inherit; font-size: 0.8125rem; font-weight: 600; color: var(--primary-dark); cursor: pointer; text-decoration: underline dotted; }

/* Layouts */
.vx-ws-grid { display: grid; gap: 0.75rem; align-items: start; }
.vx-ws-grid--a { grid-template-columns: 250px minmax(0, 1fr); }
.vx-ws-grid--c { grid-template-columns: minmax(0, 1fr) 300px; }
.vx-ws-main { min-width: 0; }
.vx-ws-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0.75rem; align-items: start; }
.vx-ws-col { min-width: 0; }
.vx-ws-tabs { margin-bottom: 0.75rem; overflow-x: auto; flex-wrap: nowrap; }
.vx-ws-tabs .tab-btn { white-space: nowrap; }
.vx-ws-tabbadge { display: inline-block; margin-left: 0.35rem; min-width: 1.15rem; padding: 0 0.35rem; border-radius: 999px; background: var(--gray-200); color: var(--gray-700); font-size: 0.6875rem; font-weight: 700; line-height: 1.15rem; text-align: center; }
.vx-ws-tabbadge.alert { background: #d97706; color: #fff; }

/* Rail */
.vx-ws-rail { padding: 0.4rem; position: sticky; top: 0.5rem; max-height: calc(100vh - 7rem); overflow: auto; }
.vx-ws-rail-head { padding: 0.35rem 0.5rem; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--gray-500); }
.vx-ws-rail ul { list-style: none; margin: 0; padding: 0; }
.vx-ws-rail-item { display: flex; align-items: center; gap: 0.5rem; padding: 0.45rem 0.5rem; border-radius: 6px; text-decoration: none; color: inherit; border-left: 3px solid transparent; }
.vx-ws-rail-item:hover { background: var(--gray-50); }
.vx-ws-rail-item.on { background: var(--gray-100); border-left-color: var(--primary); }
.vx-ws-rail-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gray-400); flex-shrink: 0; }
.vx-ws-rail-dot--you { background: #d97706; }
.vx-ws-rail-dot--customer { background: #2563eb; }
.vx-ws-rail-dot--system { background: #4f46e5; }
.vx-ws-rail-body { display: flex; flex-direction: column; min-width: 0; flex: 1; font-size: 0.8125rem; }
.vx-ws-rail-body b { color: var(--gray-900); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vx-ws-rail-body span { color: var(--gray-500); font-size: 0.75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vx-ws-rail-empty { padding: 0.5rem; font-size: 0.8125rem; }

/* Panels */
.vx-ws-box { padding: 0.9rem 1rem; margin-bottom: 0.75rem; }
.vx-ws-box-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.7rem; }
.vx-ws-box-head h2 { display: flex; align-items: center; gap: 0.4rem; margin: 0; font-size: 0.9375rem; font-weight: 700; }
.vx-ws-note { display: flex; align-items: center; gap: 0.4rem; padding: 0.5rem 0.75rem; margin-bottom: 0.6rem; border-radius: var(--radius); background: var(--vx-indigo-bg, #eef2ff); color: var(--vx-indigo-ink, #3730a3); font-size: 0.8125rem; }
.vx-ws-composer { margin-bottom: 0.75rem; }
.vx-ws-convo, .vx-ws-orderpanel { min-width: 0; }

/* Sidebar */
.vx-ws-side { display: flex; flex-direction: column; gap: 0.75rem; position: sticky; top: 0.5rem; }
.vx-ws-sidebox { padding: 0.75rem 0.9rem; }
.vx-ws-sidebox h3 { margin: 0 0 0.5rem; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--gray-500); }
.vx-ws-sidebox p { margin: 0; font-size: 0.8125rem; }
.vx-ws-contacts, .vx-ws-rules, .vx-ws-outcomes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; font-size: 0.8125rem; }
.vx-ws-contacts li { display: flex; flex-wrap: wrap; align-items: center; gap: 0.15rem 0.4rem; }
.vx-ws-contacts li > span { flex-basis: 100%; font-size: 0.75rem; }
.vx-ws-rules li { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.vx-ws-outcomes a { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; text-decoration: none; color: var(--gray-700); }

/* Action bar */
.vx-ws-actionbar { position: sticky; bottom: 0; z-index: 20; display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-top: 0.75rem; padding: 0.65rem 1rem; background: var(--bg, #fff); border: 1px solid var(--gray-200); border-radius: var(--radius); box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.08); }
.vx-ws-actionbar-main { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; flex: 1; min-width: 0; }
.vx-ws-actionbar-more { display: flex; align-items: center; gap: 0.4rem; }
.vx-ws-actionbar .btn { display: inline-flex; align-items: center; gap: 0.35rem; }
.vx-ws-cancel { color: var(--vx-red-ink, #b91c1c); }
.vx-ws-outcome { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; font-size: 0.8125rem; }
.vx-ws-failed { display: flex; align-items: center; gap: 0.4rem; flex: 1 1 260px; font-size: 0.8125rem; color: var(--vx-red-ink, #b91c1c); }
.vx-ws-spin { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: vx-ws-spin 0.8s linear infinite; }
@keyframes vx-ws-spin { to { transform: rotate(360deg); } }
.vx-ws-other { margin-top: 0.5rem; }

/* Dark mode */
[data-theme="dark"] .vx-ws-banner { --ws-bg: var(--gray-100); }
[data-theme="dark"] .vx-ws-banner--amber { --ws-bg: rgba(217, 119, 6, 0.14); }
[data-theme="dark"] .vx-ws-banner--red { --ws-bg: rgba(220, 38, 38, 0.14); }
[data-theme="dark"] .vx-ws-banner--blue { --ws-bg: rgba(37, 99, 235, 0.16); }
[data-theme="dark"] .vx-ws-banner--indigo { --ws-bg: rgba(79, 70, 229, 0.18); }
[data-theme="dark"] .vx-ws-banner--green { --ws-bg: rgba(22, 163, 74, 0.14); }
[data-theme="dark"] .vx-ws-session, [data-theme="dark"] .vx-ws-note { background: rgba(99, 102, 241, 0.16); color: var(--gray-800); }
[data-theme="dark"] .vx-ws-actionbar { background: var(--bg); box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.4); }
[data-theme="dark"] .vx-ws-warn, [data-theme="dark"] .vx-ws-failed, [data-theme="dark"] .vx-ws-cancel { color: #f87171; }

/* Responsive */
@media (max-width: 1100px) {
    .vx-ws-grid--a, .vx-ws-grid--c { grid-template-columns: minmax(0, 1fr); }
    .vx-ws-rail { position: static; max-height: 220px; order: 2; }
    .vx-ws-grid--a .vx-ws-main { order: 1; }
    .vx-ws-side { position: static; }
}
@media (max-width: 1000px) { .vx-ws-split { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) {
    .vx-ws-banner { flex-wrap: wrap; }
    .vx-ws-banner-actions { width: 100%; justify-content: space-between; }
    .vx-ws-banner-actions .btn { flex: 1; justify-content: center; }
    .vx-ws-actionbar { margin: 0.75rem -0.5rem 0; border-radius: 0; }
    .vx-ws-actionbar-main .btn { flex: 1 1 auto; justify-content: center; }
    .vx-ws-cust { font-size: 1.1rem; }
    .vx-ws-keys { display: none; }
    .vx-ws-facts { grid-template-columns: 1fr 1fr; }
    .vx-ws-nav { margin-left: 0; }
}

/* ---- 31-workspace-components.css ---- */
/* Vision — shared workspace components: thread (.vx-th-*),
   composer (.vx-cmp-*), activity (.vx-act-*), evidence (.vx-ev-*). Tokens only; dark follows the tokens. */

/* ───────────── Thread ───────────── */
.vx-th { display: flex; flex-direction: column; gap: 0.9rem; min-width: 0; }
.vx-th--empty { align-items: center; text-align: center; gap: 0.3rem; padding: 2rem 1rem; color: var(--gray-500); }
.vx-th--empty b { color: var(--gray-800); }
.vx-th-day { display: flex; align-items: center; gap: 0.75rem; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; color: var(--gray-500); }
.vx-th-day::before, .vx-th-day::after { content: ""; flex: 1; height: 1px; background: var(--gray-200); }
.vx-th-msg { display: flex; gap: 0.6rem; align-items: flex-start; max-width: 100%; }
.vx-th-msg--in { justify-content: flex-start; }
.vx-th-msg--out { justify-content: flex-end; }
.vx-th-col { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; max-width: min(46rem, 88%); }
.vx-th-msg--out .vx-th-col { align-items: flex-end; }
.vx-th-meta { display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; font-size: 0.75rem; color: var(--gray-600); }
.vx-th-msg--out .vx-th-meta { justify-content: flex-end; }
.vx-th-addr { font-size: 0.7rem; overflow-wrap: anywhere; }
.vx-th-new { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: 0.05rem 0.4rem; border-radius: 999px; background: var(--primary); color: #fff; }
.vx-th-bubble { padding: 0.6rem 0.8rem; border-radius: 14px; font-size: 0.8125rem; line-height: 1.5; overflow-wrap: anywhere; min-width: 0; max-width: 100%; text-align: left; }
.vx-th-msg--in .vx-th-bubble { background: var(--gray-100); border: 1px solid var(--gray-200); border-top-left-radius: 4px; color: var(--gray-900); }
.vx-th-msg--out .vx-th-bubble { background: color-mix(in srgb, var(--primary) 12%, var(--bg)); border: 1px solid color-mix(in srgb, var(--primary) 28%, var(--bg)); border-top-right-radius: 4px; color: var(--gray-900); }
.vx-th-subject { font-weight: 700; margin-bottom: 0.25rem; }
.vx-th-body p { margin: 0 0 0.5rem; }
.vx-th-body p:last-child { margin-bottom: 0; }
.vx-th-body a { color: var(--primary-dark); }
.vx-th-body table { border-collapse: collapse; max-width: 100%; display: block; overflow-x: auto; font-size: 0.78rem; }
.vx-th-body th, .vx-th-body td { padding: 0.2rem 0.5rem; border-bottom: 1px solid var(--gray-200); text-align: left; }
.vx-th-body blockquote { margin: 0.4rem 0; padding-left: 0.6rem; border-left: 3px solid var(--gray-200); color: var(--gray-600); }
.vx-th-foot { display: flex; align-items: center; gap: 0.2rem 0.75rem; flex-wrap: wrap; font-size: 0.72rem; color: var(--gray-500); }
.vx-th-msg--out .vx-th-foot { justify-content: flex-end; }
.vx-th-foot > span { display: inline-flex; align-items: center; gap: 0.25rem; }
.vx-th-fail { color: var(--vx-red-fg); font-weight: 600; }
.vx-th-plink { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.72rem; font-weight: 600; color: var(--primary-dark); text-decoration: none; }
a.vx-th-plink:hover { text-decoration: underline; }
.vx-th-recips { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.vx-th-msg--out .vx-th-recips { justify-content: flex-end; }
.vx-th-recip { display: inline-flex; align-items: center; gap: 0.25rem; max-width: 100%; font-size: 0.7rem; padding: 0.1rem 0.5rem; border-radius: 999px; background: var(--vx-gray-bg); color: var(--vx-gray-fg); border: 1px solid var(--vx-gray-line); overflow-wrap: anywhere; }
.vx-th-recip small { text-transform: uppercase; font-size: 0.6rem; font-weight: 700; opacity: 0.75; }
.vx-th-recip i { font-style: normal; font-weight: 700; }
.vx-th-recip--blue { background: var(--vx-blue-bg); color: var(--vx-blue-fg); border-color: var(--vx-blue-line); }
.vx-th-recip--green { background: var(--vx-green-bg); color: var(--vx-green-fg); border-color: var(--vx-green-line); }
.vx-th-recip--red { background: var(--vx-red-bg); color: var(--vx-red-fg); border-color: var(--vx-red-line); }
.vx-th-recip--amber { background: var(--vx-amber-bg); color: var(--vx-amber-fg); border-color: var(--vx-amber-line); }
.vx-th-recip--gray { background: var(--vx-gray-bg); color: var(--vx-gray-fg); border-color: var(--vx-gray-line); }
.vx-th-sending { display: inline-flex; align-items: center; gap: 0.3rem; }
.vx-th-spin { width: 11px; height: 11px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; display: inline-block; animation: vx-th-rot 0.8s linear infinite; }
.vx-th-spin--light { color: #fff; margin-right: 0.3rem; }
@keyframes vx-th-rot { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .vx-th-spin { animation-duration: 3s; } }

.vx-th-match { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; padding: 0.45rem 0.7rem; border-radius: 8px; background: var(--vx-amber-bg); color: var(--vx-amber-fg); border: 1px solid var(--vx-amber-line); font-size: 0.78rem; }
.vx-th-matched { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.75rem; color: var(--vx-green-fg); font-weight: 600; }
.vx-th-addct { display: flex; flex-direction: column; gap: 0.5rem; padding: 0.7rem; border: 1px solid var(--gray-200); border-radius: var(--radius); background: var(--bg); width: 100%; }
.vx-th-addct-title { font-weight: 700; font-size: 0.8125rem; }
.vx-th-addct-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 0.5rem; }
.vx-th-addct-grid label { display: flex; flex-direction: column; gap: 0.15rem; font-size: 0.72rem; color: var(--gray-600); }
.vx-th-addct-btns { display: flex; align-items: center; justify-content: flex-end; gap: 0.5rem; flex-wrap: wrap; font-size: 0.72rem; }
.vx-th-addct-btns .vx-muted { flex: 1 1 14rem; text-align: left; }

/* drafts */
.vx-th-draft .vx-th-col { width: min(40rem, 88%); }
.vx-th-draft-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; width: 100%; font-size: 0.78rem; }
.vx-th-draft-head > span:first-child { display: inline-flex; align-items: center; gap: 0.3rem; }
.vx-th-bubble--draft { width: 100%; background: var(--bg) !important; border: 1px dashed var(--primary-mid) !important; }
.vx-th-bubble--draft:not(.open) .vx-th-body { max-height: 6.5rem; overflow: hidden; -webkit-mask-image: linear-gradient(#000 60%, transparent); mask-image: linear-gradient(#000 60%, transparent); }
.vx-th-more { border: 0; background: none; padding: 0.2rem 0 0; font: inherit; font-size: 0.75rem; font-weight: 600; color: var(--primary-dark); cursor: pointer; }
.vx-th-draft-btns { display: flex; justify-content: flex-end; gap: 0.4rem; flex-wrap: wrap; width: 100%; }
.vx-th-draft-note { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.75rem; color: var(--gray-600); }
.vx-th-draft--reviewing .vx-th-bubble--draft { opacity: 0.7; }
.vx-th-draft-inline { width: 100%; max-width: 46rem; margin-left: auto; }

/* intent cards */
.vx-th-intents { display: flex; flex-direction: column; gap: 0.4rem; width: 100%; margin-top: 0.15rem; }
.vx-th-intents-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 700; color: var(--gray-600); }
.vx-th-intent { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 0.6rem; align-items: start; padding: 0.6rem 0.75rem; background: var(--bg); border: 1px solid var(--gray-200); border-left: 4px solid var(--vx-amber-line); border-radius: var(--radius); font-size: 0.8125rem; }
.vx-th-intent--applied { border-left-color: var(--vx-green-line); }
.vx-th-intent--rejected { border-left-color: var(--gray-200); opacity: 0.85; }
.vx-th-intent--failed { border-left-color: var(--vx-red-line); }
.vx-th-intent-icon { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; background: var(--vx-amber-bg); color: var(--vx-amber-fg); }
.vx-th-intent--applied .vx-th-intent-icon { background: var(--vx-green-bg); color: var(--vx-green-fg); }
.vx-th-intent--failed .vx-th-intent-icon { background: var(--vx-red-bg); color: var(--vx-red-fg); }
.vx-th-intent--rejected .vx-th-intent-icon { background: var(--gray-100); color: var(--gray-500); }
.vx-th-intent-main { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; }
.vx-th-intent-title { font-weight: 700; overflow-wrap: anywhere; }
.vx-th-intent-diff { display: inline-flex; align-items: center; gap: 0.3rem; font-variant-numeric: tabular-nums; }
.vx-th-intent-meta { display: flex; flex-wrap: wrap; gap: 0.1rem 0.6rem; font-size: 0.72rem; color: var(--gray-500); }
.vx-th-intent-why, .vx-th-intent-check { display: flex; align-items: flex-start; gap: 0.3rem; font-size: 0.75rem; }
.vx-th-intent-why { color: var(--vx-amber-fg); }
.vx-th-intent-check { color: var(--vx-red-fg); }
.vx-th-intent-done { display: flex; align-items: center; gap: 0.3rem; font-size: 0.75rem; color: var(--vx-green-fg); }
.vx-th-intent-done--rej { color: var(--gray-600); }
.vx-th-intent-done--fail { color: var(--vx-red-fg); }
.vx-th-intent-reject { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.3rem; }
.vx-th-intent-reject .form-input { flex: 1 1 12rem; min-width: 0; }
.vx-th-intent-side { display: flex; align-items: flex-start; }
.vx-th-intent-btns { display: flex; gap: 0.35rem; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 640px) {
    .vx-th-col { max-width: 100%; }
    .vx-th-draft .vx-th-col { width: 100%; }
    .vx-th-intent { grid-template-columns: auto minmax(0, 1fr); }
    .vx-th-intent-side { grid-column: 1 / -1; justify-content: flex-end; }
}

/* ───────────── Composer ───────────── */
.vx-cmp { display: flex; flex-direction: column; background: var(--bg); border: 1px solid var(--gray-200); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.vx-cmp--approve { border-color: var(--primary-mid); }
.vx-cmp-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; flex-wrap: wrap; padding: 0.6rem 0.9rem; border-bottom: 1px solid var(--gray-200); }
.vx-cmp-title { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8125rem; min-width: 0; }
.vx-cmp-channels button { display: inline-flex; align-items: center; gap: 0.3rem; }
.vx-cmp-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--vx-gray-fg); }
.vx-cmp-dot--green { background: var(--vx-good); }
.vx-cmp-dot--amber { background: var(--vx-warning); }
.vx-cmp-dot--red { background: var(--vx-critical); }
.vx-cmp-pref { font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.04em; opacity: 0.75; }

.vx-cmp-recips { display: flex; flex-direction: column; gap: 0.3rem; padding: 0.6rem 0.9rem; border-bottom: 1px solid var(--gray-100); }
.vx-cmp-rrow { display: flex; align-items: flex-start; gap: 0.6rem; }
.vx-cmp-rlabel { flex: 0 0 2rem; padding-top: 0.3rem; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--gray-500); }
.vx-cmp-rchips { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; flex: 1; min-width: 0; }
.vx-cmp-chip { display: inline-flex; align-items: center; gap: 0.3rem; max-width: 100%; padding: 0.15rem 0.2rem 0.15rem 0.55rem; font-size: 0.75rem; border-radius: 999px; background: var(--gray-100); border: 1px solid var(--gray-200); color: var(--gray-800); }
.vx-cmp-chip--info { background: var(--vx-blue-bg); border-color: var(--vx-blue-line); color: var(--vx-blue-fg); }
.vx-cmp-chip--block { background: var(--vx-amber-bg); border-color: var(--vx-amber-line); color: var(--vx-amber-fg); }
.vx-cmp-chip--error { background: var(--vx-red-bg); border-color: var(--vx-red-line); color: var(--vx-red-fg); }
.vx-cmp-chip-name { font-weight: 600; overflow-wrap: anywhere; }
.vx-cmp-chip-addr { font-size: 0.68rem; opacity: 0.75; overflow-wrap: anywhere; }
.vx-cmp-chip button { display: inline-flex; border: 0; background: none; color: inherit; cursor: pointer; padding: 0.1rem 0.25rem; border-radius: 50%; }
.vx-cmp-chip button:hover { background: color-mix(in srgb, currentColor 15%, transparent); }
.vx-cmp-radd { position: relative; flex: 1 1 10rem; min-width: 8rem; }
.vx-cmp-radd input { width: 100%; border: 0; outline: 0; background: none; font: inherit; font-size: 0.8125rem; padding: 0.25rem 0.2rem; color: var(--gray-900); }
.vx-cmp-sugg { list-style: none; margin: 0.2rem 0 0; padding: 0.25rem; position: absolute; left: 0; z-index: 30; min-width: 15rem; max-width: 80vw; background: var(--bg); border: 1px solid var(--gray-200); border-radius: 8px; box-shadow: var(--shadow-md); }
.vx-cmp-sugg li { padding: 0.35rem 0.5rem; border-radius: 6px; font-size: 0.8125rem; cursor: pointer; overflow-wrap: anywhere; }
.vx-cmp-sugg li:hover { background: var(--primary-light); }
.vx-cmp-rmeta { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; font-size: 0.72rem; color: var(--gray-500); }
.vx-cmp-memo, .vx-cmp-ccbtns { display: inline-flex; align-items: center; gap: 0.4rem; }

.vx-cmp-tools { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; padding: 0.5rem 0.9rem; background: var(--gray-50); border-bottom: 1px solid var(--gray-100); }
.vx-cmp-tools-gap { flex: 1; }
.vx-cmp-tpl select { min-width: 11rem; max-width: 100%; padding-block: 0.25rem; font-size: 0.78rem; }
.vx-cmp-tplsrc { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.7rem; padding: 0.1rem 0.5rem; border-radius: 999px; background: var(--vx-gray-bg); color: var(--vx-gray-fg); }
.vx-cmp-tplsrc--warn { background: var(--vx-amber-bg); color: var(--vx-amber-fg); }
.vx-cmp-confirm { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; padding: 0.5rem 0.9rem; font-size: 0.78rem; border-bottom: 1px solid var(--gray-100); }
.vx-cmp-confirm { background: var(--vx-amber-bg); color: var(--vx-amber-fg); }
.vx-cmp-confirm > :first-child { flex: 1 1 14rem; }

.vx-cmp-body { display: flex; flex-direction: column; gap: 0.5rem; padding: 0.7rem 0.9rem; min-width: 0; }
.vx-cmp-subject { font-weight: 600; }
.vx-cmp-insertbar { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.vx-cmp-insert { position: relative; }
.vx-cmp-insert-menu { position: absolute; top: 100%; left: 0; z-index: 30; margin-top: 0.2rem; min-width: 16rem; max-width: 80vw; padding: 0.25rem; background: var(--bg); border: 1px solid var(--gray-200); border-radius: 8px; box-shadow: var(--shadow-md); }
.vx-cmp-insert-menu button { display: flex; flex-direction: column; align-items: flex-start; gap: 0.15rem; width: 100%; padding: 0.4rem 0.5rem; border: 0; border-radius: 6px; background: none; text-align: left; cursor: pointer; font: inherit; }
.vx-cmp-insert-menu button:hover { background: var(--gray-100); }
.vx-cmp-insert-menu small { font-size: 0.7rem; color: var(--gray-500); }
.vx-cmp-hint { font-size: 0.72rem; }
.vx-cmp-rte { min-width: 0; max-width: 100%; }
.vx-cmp-rte .ql-container { min-height: 9rem; }
.vx-qtoken { display: inline-block; padding: 0 0.4rem; border-radius: 4px; font-size: 0.75rem; font-weight: 600; background: var(--vx-indigo-bg); color: var(--vx-indigo-fg); border: 1px solid var(--vx-indigo-line); }
.vx-qtoken--table { background: var(--vx-teal-bg); color: var(--vx-teal-fg); border-color: var(--vx-teal-line); }
.vx-cmp-sms { display: flex; flex-direction: column; gap: 0.4rem; }
.vx-cmp-smsarea { resize: vertical; }
.vx-cmp-smsbar { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; }
.vx-cmp-count { font-size: 0.75rem; font-variant-numeric: tabular-nums; color: var(--gray-600); }
.vx-cmp-count.multi { color: var(--vx-amber-fg); font-weight: 600; }
.vx-cmp-smswarn { display: flex; align-items: center; gap: 0.3rem; flex-wrap: wrap; padding: 0.35rem 0.6rem; border-radius: 6px; background: var(--vx-amber-bg); color: var(--vx-amber-fg); font-size: 0.75rem; }

/* preview */
.vx-cmp-pv-mail { border: 1px solid var(--gray-200); border-radius: var(--radius); overflow: hidden; background: var(--bg); }
.vx-cmp-pv-hdr { display: flex; flex-direction: column; gap: 0.15rem; padding: 0.6rem 0.8rem; background: var(--gray-50); border-bottom: 1px solid var(--gray-200); font-size: 0.78rem; }
.vx-cmp-pv-hdr > div { overflow-wrap: anywhere; }
.vx-cmp-pv-hdr span:first-child { display: inline-block; min-width: 3.2rem; color: var(--gray-500); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; }
.vx-cmp-pv-content { padding: 0.9rem; font-size: 0.8125rem; line-height: 1.55; overflow-x: auto; color: var(--gray-900); }
.vx-cmp-pv-content p { margin: 0 0 0.6rem; }
.vx-cmp-pv-foot { padding: 0.45rem 0.8rem; border-top: 1px solid var(--gray-100); font-size: 0.7rem; color: var(--gray-500); background: var(--gray-50); }
.vx-cmp-pv-placeholder { color: var(--gray-500); font-style: italic; }
.vx-cmp-pv-btn { display: inline-block; padding: 0.4rem 0.9rem; border-radius: 6px; background: var(--primary); color: #fff; font-weight: 600; }
.vx-cmp-pv-url { font-size: 0.72rem; color: var(--gray-500); overflow-wrap: anywhere; }
.vx-cmp-pv-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.vx-cmp-pv-table th, .vx-cmp-pv-table td { padding: 0.3rem 0.5rem; border-bottom: 1px solid var(--gray-200); text-align: left; }
.vx-cmp-pv-table .n { text-align: right; font-variant-numeric: tabular-nums; }
.vx-cmp-pv-table tr.promo td { background: var(--vx-gold-bg); color: var(--vx-gold-fg); }
.vx-cmp-pv-table tfoot td { font-weight: 700; border-bottom: 0; }
.vx-cmp-pv-phone { align-self: center; width: min(19rem, 100%); padding: 0.6rem 0.75rem 0.75rem; border: 6px solid var(--gray-800); border-radius: 26px; background: var(--gray-50); }
[data-theme="dark"] .vx-cmp-pv-phone { border-color: var(--gray-200); }
.vx-cmp-pv-phone-top { text-align: center; font-size: 0.72rem; font-weight: 600; color: var(--gray-600); padding-bottom: 0.4rem; border-bottom: 1px solid var(--gray-200); margin-bottom: 0.6rem; }
.vx-cmp-pv-bubble { padding: 0.5rem 0.7rem; border-radius: 16px 16px 16px 4px; background: var(--gray-200); color: var(--gray-900); font-size: 0.8125rem; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; max-width: 88%; }
.vx-cmp-pv-bubble u { color: var(--primary-dark); }
.vx-cmp-pv-phone-meta { margin-top: 0.5rem; text-align: center; font-size: 0.68rem; color: var(--gray-500); }

.vx-cmp-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem 1rem; flex-wrap: wrap; padding: 0.6rem 0.9rem; border-top: 1px solid var(--gray-200); background: var(--gray-50); border-radius: 0 0 var(--radius) var(--radius); }
.vx-cmp-gate { display: flex; flex-direction: column; gap: 0.1rem; font-size: 0.78rem; min-width: 0; flex: 1 1 14rem; }
.vx-cmp-gate-main { font-weight: 600; color: var(--gray-800); }
.vx-cmp-gate-main.warn, .vx-cmp-gate-warn { color: var(--vx-amber-fg); }
.vx-cmp-gate-warn { font-weight: 500; font-size: 0.74rem; }
.vx-cmp-saved { font-size: 0.7rem; color: var(--gray-500); }
.vx-cmp-btns { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; justify-content: flex-end; }
.vx-cmp--compact .vx-cmp-body, .vx-cmp--compact .vx-cmp-recips, .vx-cmp--compact .vx-cmp-head { padding-inline: 0.7rem; }
@media (max-width: 640px) {
    .vx-cmp-rrow { flex-direction: column; gap: 0.1rem; }
    .vx-cmp-rlabel { flex: none; padding-top: 0; }
    .vx-cmp-tools-gap { display: none; }
    .vx-cmp-tpl, .vx-cmp-tpl select { width: 100%; }
    .vx-cmp-btns { width: 100%; }
    .vx-cmp-btns .btn { flex: 1 1 auto; justify-content: center; }
}

/* ───────────── Activity ───────────── */
.vx-act { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.vx-act-empty { padding: 1.5rem 0.5rem; text-align: center; color: var(--gray-500); font-size: 0.8125rem; }
.vx-act-daylabel { margin: 0 0 0.5rem; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--gray-500); }
.vx-act-list { list-style: none; margin: 0; padding: 0; position: relative; }
.vx-act-list::before { content: ""; position: absolute; left: calc(3.6rem + 0.6rem + 11px); top: 0.5rem; bottom: 0.5rem; width: 2px; background: var(--gray-200); }
.vx-act-item { display: grid; grid-template-columns: 3.6rem 24px minmax(0, 1fr); gap: 0 0.6rem; padding: 0.35rem 0; position: relative; }
.vx-act-time { padding-top: 0.2rem; font-size: 0.7rem; color: var(--gray-500); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.vx-act-who-av { position: relative; z-index: 1; display: inline-flex; align-items: flex-start; justify-content: center; background: var(--bg); border-radius: 50%; height: 24px; box-shadow: 0 0 0 3px var(--bg); }
.vx-act-sys { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: var(--vx-gray-bg); color: var(--vx-gray-fg); border: 1px solid var(--vx-gray-line); }
.vx-act-item--blue .vx-act-sys { background: var(--vx-blue-bg); color: var(--vx-blue-fg); border-color: var(--vx-blue-line); }
.vx-act-item--teal .vx-act-sys { background: var(--vx-teal-bg); color: var(--vx-teal-fg); border-color: var(--vx-teal-line); }
.vx-act-item--green .vx-act-sys { background: var(--vx-green-bg); color: var(--vx-green-fg); border-color: var(--vx-green-line); }
.vx-act-item--amber .vx-act-sys { background: var(--vx-amber-bg); color: var(--vx-amber-fg); border-color: var(--vx-amber-line); }
.vx-act-item--red .vx-act-sys { background: var(--vx-red-bg); color: var(--vx-red-fg); border-color: var(--vx-red-line); }
.vx-act-item--gold .vx-act-sys { background: var(--vx-gold-bg); color: var(--vx-gold-fg); border-color: var(--vx-gold-line); }
.vx-act-body { min-width: 0; padding-top: 0.15rem; }
.vx-act-text { display: flex; align-items: flex-start; gap: 0.35rem; font-size: 0.8125rem; color: var(--gray-800); overflow-wrap: anywhere; }
.vx-act-icon { flex: none; display: inline-flex; margin-top: 0.2rem; color: var(--gray-500); }
.vx-act-item--blue .vx-act-icon { color: var(--vx-blue-fg); }
.vx-act-item--teal .vx-act-icon { color: var(--vx-teal-fg); }
.vx-act-item--green .vx-act-icon { color: var(--vx-green-fg); }
.vx-act-item--amber .vx-act-icon { color: var(--vx-amber-fg); }
.vx-act-item--red .vx-act-icon { color: var(--vx-red-fg); }
.vx-act-item--gold .vx-act-icon { color: var(--vx-gold-fg); }
.vx-act-who { font-weight: 700; }
.vx-act-sub { margin-top: 0.1rem; margin-left: 1.3rem; font-size: 0.75rem; color: var(--gray-500); overflow-wrap: anywhere; }
.vx-act-changes { margin: 0.1rem 0 0; padding-left: 1rem; }
.vx-act-diff { font-variant-numeric: tabular-nums; font-weight: 600; }
.vx-act-more { align-self: flex-start; }
.vx-act--compact .vx-act-item { padding: 0.2rem 0; }
.vx-act--compact .vx-act-text { font-size: 0.78rem; }
@media (max-width: 520px) {
    .vx-act-list::before { left: calc(3.4rem + 0.45rem + 11px); }
    .vx-act-item { grid-template-columns: 3.4rem 24px minmax(0, 1fr); gap: 0 0.45rem; }
}

/* ───────────── Evidence ───────────── */
.vx-ev { display: flex; flex-direction: column; gap: 1.25rem; min-width: 0; }
.vx-ev-sec { min-width: 0; }
.vx-ev-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem 1.5rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.vx-ev-title { margin: 0 0 0.2rem; font-size: 1rem; font-weight: 700; }
.vx-ev-lede { margin: 0; font-size: 0.8125rem; color: var(--gray-600); }
.vx-ev-lede b { color: var(--gray-900); }
.vx-ev-headmeta { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.vx-ev-chart { padding: 0.5rem 0.6rem; border: 1px solid var(--gray-200); border-radius: var(--radius); background: var(--bg); overflow: hidden; }
.vx-ev-sub { margin: 0 0 0.5rem; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; color: var(--gray-600); }
.vx-ev-details summary { cursor: pointer; font-size: 0.8125rem; font-weight: 600; color: var(--primary-dark); }

.vx-ev-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.vx-ev-steps li { display: flex; align-items: flex-start; gap: 0.6rem; }
.vx-ev-steps li > div { display: flex; flex-direction: column; min-width: 0; font-size: 0.8125rem; }
.vx-ev-steps li > div span { color: var(--gray-600); overflow-wrap: anywhere; }
.vx-ev-step-n { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: var(--primary-light); color: var(--primary-dark); font-size: 0.72rem; font-weight: 700; font-variant-numeric: tabular-nums; }

.vx-ev-patterns { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 0.6rem; }
.vx-ev-pattern { display: flex; flex-direction: column; gap: 0.35rem; padding: 0.7rem 0.8rem; background: var(--bg); border: 1px solid var(--gray-200); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.vx-ev-pattern-top { display: flex; align-items: center; gap: 0.45rem; font-size: 0.8125rem; }
.vx-ev-pattern-icon { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 24px; height: 24px; border-radius: 6px; background: var(--primary-light); color: var(--primary-dark); }
.vx-ev-pattern-conf { margin-left: auto; display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.72rem; font-variant-numeric: tabular-nums; color: var(--gray-600); }
.vx-ev-confbar { display: inline-block; width: 3.5rem; height: 6px; border-radius: 3px; background: var(--gray-200); overflow: hidden; vertical-align: middle; }
.vx-ev-confbar > span { display: block; height: 100%; border-radius: 3px; background: var(--primary); }
.vx-ev-pattern-desc { font-size: 0.8125rem; color: var(--gray-800); overflow-wrap: anywhere; }
.vx-ev-pattern-params { font-size: 0.75rem; color: var(--gray-600); }
.vx-ev-pattern-foot { margin-top: auto; font-size: 0.7rem; color: var(--gray-500); }
.vx-ev-season { display: flex; align-items: flex-end; gap: 3px; height: 3.2rem; }
.vx-ev-season-bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.vx-ev-season-bar i { display: block; width: 100%; border-radius: 2px 2px 0 0; background: var(--vx-blue-line); }
.vx-ev-season-bar.cur i { background: var(--primary); }
.vx-ev-season-bar small { font-size: 0.6rem; color: var(--gray-500); margin-top: 2px; }

.vx-ev-basis { display: flex; flex-direction: column; border: 1px solid var(--gray-200); border-radius: var(--radius); overflow: hidden; background: var(--bg); font-size: 0.8125rem; }
.vx-ev-basis-row { display: grid; grid-template-columns: minmax(0, 2fr) 1fr minmax(0, 1.4fr) minmax(0, 1.4fr); gap: 0.5rem 0.75rem; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--gray-100); align-items: center; }
.vx-ev-basis-row:last-child { border-bottom: 0; }
.vx-ev-basis-head { background: var(--gray-50); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; color: var(--gray-500); }
.vx-ev-basis-prod { font-weight: 600; overflow-wrap: anywhere; }
.vx-ev-basis--muted { color: var(--gray-500); }
.vx-ev-basis--changed { background: var(--vx-amber-bg); }
.vx-ev-basis--removed { background: var(--vx-red-bg); }
.vx-ev-extra { margin: 0.5rem 0 0; font-size: 0.78rem; color: var(--gray-600); }

.vx-ev-insights { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.vx-ev-insight { padding: 0.65rem 0.8rem; background: var(--bg); border: 1px solid var(--gray-200); border-left: 4px solid var(--vx-indigo-line); border-radius: var(--radius); }
.vx-ev-insight--stale { border-left-color: var(--vx-amber-line); }
.vx-ev-insight-top { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; font-size: 0.8125rem; }
.vx-ev-insight p { margin: 0.3rem 0 0; font-size: 0.8125rem; color: var(--gray-700); }
.vx-ev-insight-foot { margin-top: 0.3rem; font-size: 0.7rem; color: var(--gray-500); }
.vx-ev-stale { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.7rem; font-weight: 600; color: var(--vx-amber-fg); }
.vx-ev-caveat { display: flex; align-items: flex-start; gap: 0.35rem; margin: 0.6rem 0 0; font-size: 0.75rem; color: var(--gray-500); }
.vx-ev-none { font-size: 0.8125rem; }
.vx-ev-fresh { display: flex; align-items: center; gap: 0.3rem 0.75rem; flex-wrap: wrap; font-size: 0.72rem; color: var(--gray-500); }
.vx-ev-note { color: var(--gray-600); }

.vx-ev-mini { display: flex; flex-direction: column; gap: 0.6rem; min-width: 0; }
.vx-ev-mini-eta { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; }
.vx-ev-mini-patterns { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.vx-ev-mini-patterns li { display: flex; align-items: center; gap: 0.45rem; font-size: 0.78rem; }
.vx-ev-mini-desc { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.vx-ev-mini-foot { font-size: 0.7rem; color: var(--gray-500); }
.vx-ev--compact { gap: 0.9rem; }

@media (max-width: 640px) {
    .vx-ev-patterns { grid-template-columns: 1fr; }
    .vx-ev-basis-head { display: none; }
    .vx-ev-basis-row { grid-template-columns: 1fr 1fr; }
    .vx-ev-basis-prod { grid-column: 1 / -1; }
}

/* ---- 40-inbox.css ---- */
/* =====================================================================
   Vision — Inbox (/vision/inbox) · .vx-ib-*
   A Decision queue · B Conversations · C Triage cards
   ===================================================================== */

.vx-ib { --ib-edge: var(--gray-300); }
.vx-ib a.btn { text-decoration: none; }
.vx-ib .card { padding: 0; margin-bottom: 0; }
.vx-ib-none { padding: 0.75rem; font-size: 0.86rem; margin: 0; }
.vx-ib-spacer { flex: 1; }

/* notice */
.vx-ib-notice { display: flex; align-items: center; gap: 0.5rem; padding: 0.55rem 0.8rem; margin-bottom: 0.75rem; border-radius: var(--radius); font-size: 0.88rem;
    background: var(--vx-green-bg); color: var(--vx-green-fg); border: 1px solid var(--vx-green-line); animation: vx-ib-in 0.2s ease-out; }
.vx-ib-notice button { margin-left: auto; background: none; border: 0; color: inherit; cursor: pointer; padding: 2px; border-radius: 4px; display: inline-flex; }
@keyframes vx-ib-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ── A: queue + detail ───────────────────────────────────────────── */
.vx-ib-a { display: grid; grid-template-columns: minmax(300px, 390px) minmax(0, 1fr); gap: 1rem; align-items: start; }
.vx-ib-list { position: sticky; top: 0.5rem; max-height: calc(100vh - 11rem); min-height: 12rem; overflow-y: auto; }
.vx-ib-filter { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; padding: 0.5rem 0.8rem; font-size: 0.82rem; background: var(--vx-blue-bg); color: var(--vx-blue-fg); border-bottom: 1px solid var(--vx-blue-line); }
.vx-ib-filter a { display: inline-flex; align-items: center; gap: 0.2rem; font-weight: 600; color: inherit; text-decoration: underline; }
.vx-ib-group h3 { display: flex; align-items: center; gap: 0.4rem; margin: 0; padding: 0.55rem 0.8rem 0.4rem; font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--gray-500);
    background: var(--gray-50); border-bottom: 1px solid var(--gray-200); position: sticky; top: 0; z-index: 1; }
.vx-ib-count { margin-left: auto; font-size: 0.72rem; background: var(--gray-200); color: var(--gray-700); border-radius: 999px; padding: 0 0.45rem; min-width: 1.3rem; text-align: center; }
.vx-ib-row { display: flex; flex-direction: column; gap: 0.2rem; width: 100%; text-align: left; padding: 0.65rem 0.8rem 0.65rem 0.95rem; background: var(--bg); border: 0; border-bottom: 1px solid var(--gray-100);
    box-shadow: inset 3px 0 0 var(--ib-edge); cursor: pointer; color: var(--gray-900); font: inherit; }
.vx-ib-row--urgent { --ib-edge: var(--vx-critical); }
.vx-ib-row--high { --ib-edge: var(--vx-serious); }
.vx-ib-row--normal { --ib-edge: var(--vx-c1); }
.vx-ib-row:hover { background: var(--vx-row-hover); }
.vx-ib-row.on { background: var(--primary-light, var(--vx-blue-bg)); }
.vx-ib-row:focus-visible, .vx-ib-thread:focus-visible, .vx-ib-opt:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.vx-ib-row-top { display: flex; justify-content: space-between; gap: 0.5rem; align-items: baseline; }
.vx-ib-row-top b { font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vx-ib-row-age { font-size: 0.74rem; color: var(--gray-500); white-space: nowrap; }
.vx-ib-row-body { font-size: 0.82rem; color: var(--gray-600); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.vx-ib-row-foot { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; margin-top: 0.1rem; }
.vx-ib-row-kind { font-size: 0.74rem; color: var(--gray-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.vx-ib-detail { min-width: 0; padding: 0; }
.vx-ib-back { display: none; margin: 0.6rem 0 0 0.6rem; }
.vx-ib-detail-inner { animation: vx-ib-in 0.18s ease-out; }
.vx-ib-dhead { display: flex; justify-content: space-between; gap: 1rem; padding: 1rem 1.1rem 0.8rem; border-bottom: 1px solid var(--gray-200); flex-wrap: wrap; }
.vx-ib-dtitle h2, .vx-ib-chead2 h2 { margin: 0.35rem 0 0.1rem; font-size: 1.2rem; }
.vx-ib-dtitle p, .vx-ib-chead2 p { margin: 0; color: var(--gray-600); font-size: 0.9rem; }
.vx-ib-dpills { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.vx-ib-age { font-size: 0.78rem; }
.vx-ib-noorder { font-size: 0.8rem; }
.vx-ib-body { padding: 1rem 1.1rem 1.2rem; display: flex; flex-direction: column; gap: 0.9rem; }
.vx-ib-ctx { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; font-size: 0.82rem; color: var(--gray-600); }
.vx-ib-ctx span { display: inline-flex; align-items: center; gap: 0.3rem; }
.vx-ib-ambient { display: flex; gap: 0.5rem; align-items: flex-start; padding: 0.6rem 0.75rem; border-radius: var(--radius); background: var(--vx-blue-bg); color: var(--vx-blue-fg); border: 1px solid var(--vx-blue-line); font-size: 0.84rem; }
.vx-ib-ambient .vx-icon { margin-top: 2px; }
.vx-ib-toolbar { display: flex; align-items: center; justify-content: flex-end; gap: 0.5rem; flex-wrap: wrap; }
.vx-ib-toolbar > .vx-muted { margin-right: auto; font-size: 0.84rem; display: inline-flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; }
.vx-ib .btn .vx-kbd { margin-left: 0.25rem; opacity: 0.8; }
.vx-ib-sec h3 { margin: 0 0 0.4rem; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--gray-500); }
.vx-ib-foot { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; padding-top: 0.8rem; border-top: 1px solid var(--gray-200); }
.vx-ib-full summary { cursor: pointer; font-size: 0.84rem; color: var(--primary-dark); font-weight: 600; padding: 0.2rem 0; }
.vx-ib-hint { font-size: 0.82rem; margin: 0; }

/* diff */
.vx-ib-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.vx-ib-table th { text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--gray-500); padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--gray-200); }
.vx-ib-table td { padding: 0.5rem; border-bottom: 1px solid var(--gray-100); vertical-align: top; }
.vx-ib-table td small { display: block; color: var(--gray-500); font-size: 0.74rem; }
.vx-ib-r { text-align: right !important; }
.vx-ib-tr--added td:first-child { box-shadow: inset 3px 0 0 var(--vx-good); }
.vx-ib-tr--removed td:first-child { box-shadow: inset 3px 0 0 var(--vx-critical); }
.vx-ib-tr--changed td:first-child { box-shadow: inset 3px 0 0 var(--vx-c4); }
.vx-ib-chg { display: inline-block; font-size: 0.7rem; font-weight: 700; padding: 0 0.4rem; border-radius: 999px; margin-left: 0.2rem; }
.vx-ib-chg--added { background: var(--vx-green-bg); color: var(--vx-green-fg); }
.vx-ib-chg--removed { background: var(--vx-red-bg); color: var(--vx-red-fg); }
.vx-ib-chg--changed { background: var(--vx-amber-bg); color: var(--vx-amber-fg); }
.vx-ib-diff-foot { display: flex; justify-content: space-between; gap: 1rem; padding: 0.6rem 0.5rem 0; font-size: 0.86rem; flex-wrap: wrap; }
.vx-ib-total small { margin-left: 0.4rem; font-size: 0.76rem; }
.vx-ib-total small.up { color: var(--vx-green-fg); } .vx-ib-total small.down { color: var(--vx-red-fg); }
.vx-ib-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.6rem; margin: 0.7rem 0 0; padding: 0.6rem 0.5rem; background: var(--gray-50); border-radius: var(--radius); font-size: 0.84rem; }
.vx-ib-meta dt { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--gray-500); }
.vx-ib-meta dd { margin: 0; }
.vx-ib-diff--compact .vx-ib-table { font-size: 0.8rem; }
.vx-ib-sendback { display: flex; flex-direction: column; gap: 0.4rem; padding: 0.7rem; border: 1px solid var(--vx-amber-line); background: var(--vx-amber-bg); border-radius: var(--radius); }
.vx-ib-sendback label { font-size: 0.8rem; color: var(--vx-amber-fg); font-weight: 600; }
.vx-ib-sendback div { display: flex; gap: 0.4rem; justify-content: flex-end; }

/* errors, recipients, options */
.vx-ib-error { display: flex; gap: 0.6rem; padding: 0.75rem 0.9rem; border-radius: var(--radius); background: var(--vx-red-bg); color: var(--vx-red-fg); border: 1px solid var(--vx-red-line); }
.vx-ib-error p { margin: 0.15rem 0; font-size: 0.88rem; } .vx-ib-error small { opacity: 0.85; }
.vx-ib-recips { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.vx-ib-recips li { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; font-size: 0.88rem; }
.vx-ib-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0.6rem; }
.vx-ib-opt { display: flex; flex-direction: column; align-items: flex-start; gap: 0.25rem; text-align: left; padding: 0.7rem 0.8rem; background: var(--bg); border: 1px solid var(--gray-200); border-radius: var(--radius); cursor: pointer; font: inherit; color: var(--gray-900); }
.vx-ib-opt span { font-size: 0.78rem; color: var(--gray-500); }
.vx-ib-opt:hover:not(:disabled), .vx-ib-opt.on { border-color: var(--primary); background: var(--vx-row-hover); }
.vx-ib-opt:disabled { opacity: 0.5; cursor: not-allowed; }

/* done panel */
.vx-ib-done { padding: 1rem 1.1rem; border-bottom: 1px solid var(--vx-green-line); background: var(--vx-green-bg); color: var(--vx-green-fg); }
.vx-ib-done .vx-cmp, .vx-ib-done .composer, .vx-ib-done > div:last-child { color: var(--gray-900); }
.vx-ib-done-head { display: flex; gap: 0.7rem; align-items: flex-start; }
.vx-ib-done-head h2 { margin: 0; font-size: 1rem; }
.vx-ib-done-head ul { margin: 0.3rem 0 0; padding-left: 1.1rem; font-size: 0.86rem; }
.vx-ib-done-ic { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; background: var(--vx-good); color: #fff; flex-shrink: 0; }
.vx-ib-done-q { margin: 0.8rem 0 0.4rem; font-size: 0.9rem; }
.vx-ib-done-btns { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.vx-ib-done > .vx-cmp, .vx-ib-done > form, .vx-ib-done > section { margin-top: 0.8rem; background: var(--bg); color: var(--gray-900); border-radius: var(--radius); }

/* inbox zero */
.vx-ib-zero { text-align: center; padding: 3.5rem 1.5rem; display: flex; flex-direction: column; align-items: center; gap: 0.5rem; }
.vx-ib-zero--compact { padding: 2.5rem 1rem; }
.vx-ib-zero h2 { margin: 0.4rem 0 0; font-size: 1.4rem; }
.vx-ib-zero p { margin: 0; max-width: 34rem; color: var(--gray-600); font-size: 0.92rem; }
.vx-ib-zero-links { display: flex; gap: 0.5rem; margin-top: 0.8rem; flex-wrap: wrap; justify-content: center; }
.vx-ib-zero-ring { display: inline-flex; align-items: center; justify-content: center; width: 72px; height: 72px; border-radius: 50%; color: var(--vx-green-fg); background: var(--vx-green-bg); border: 2px solid var(--vx-green-line);
    animation: vx-ib-pop 0.5s cubic-bezier(.2,1.4,.4,1), vx-ib-pulse 2.4s ease-out 0.5s 2; }
@keyframes vx-ib-pop { from { transform: scale(0.4); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes vx-ib-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--vx-good) 40%, transparent); } 100% { box-shadow: 0 0 0 22px transparent; } }

/* keys */
.vx-ib-keys { margin: 0 0 0.6rem; display: flex; flex-direction: column; gap: 0.5rem; }
.vx-ib-keys div { display: grid; grid-template-columns: 7rem 1fr; gap: 0.5rem; align-items: center; font-size: 0.88rem; }
.vx-ib-keys dt, .vx-ib-keys dd { margin: 0; }

/* ── B: conversations ────────────────────────────────────────────── */
.vx-ib-b { display: grid; grid-template-columns: minmax(300px, 400px) minmax(0, 1fr); gap: 1rem; align-items: start; }
.vx-ib-threads { position: sticky; top: 0.5rem; max-height: calc(100vh - 11rem); display: flex; flex-direction: column; overflow: hidden; }
.vx-ib-tools { padding: 0.7rem; display: flex; flex-direction: column; gap: 0.5rem; border-bottom: 1px solid var(--gray-200); }
.vx-ib-tools .vx-seg { flex-wrap: wrap; }
.vx-ib-search { position: relative; display: block; }
.vx-ib-search .vx-icon { position: absolute; left: 0.6rem; top: 50%; transform: translateY(-50%); color: var(--gray-400); pointer-events: none; }
.vx-ib-search input { padding-left: 2rem; width: 100%; }
.vx-ib-threadlist { overflow-y: auto; flex: 1; }
.vx-ib-thread { display: grid; grid-template-columns: 12px 32px minmax(0, 1fr); gap: 0.5rem; align-items: start; width: 100%; text-align: left; padding: 0.7rem 0.7rem 0.7rem 0.4rem; background: var(--bg); border: 0; border-bottom: 1px solid var(--gray-100); cursor: pointer; font: inherit; color: var(--gray-900); }
.vx-ib-thread:hover { background: var(--vx-row-hover); }
.vx-ib-thread.on { background: var(--primary-light, var(--vx-blue-bg)); }
.vx-ib-thread.unread .vx-ib-row-top b { font-weight: 800; }
.vx-ib-dot { display: flex; justify-content: center; padding-top: 0.7rem; }
.vx-ib-dot i { width: 8px; height: 8px; border-radius: 50%; background: var(--vx-c1); }
.vx-ib-thread-main { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; }
.vx-ib-thread .vx-ib-row-body { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vx-ib-thread .vx-ib-row-body .vx-icon { margin-right: 0.3rem; color: var(--gray-400); }
.vx-ib-badges { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.vx-ib-convo { min-width: 0; display: flex; flex-direction: column; }
.vx-ib-chead { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.9rem 1.1rem; border-bottom: 1px solid var(--gray-200); }
.vx-ib-chead h2 { margin: 0; font-size: 1.15rem; }
.vx-ib-need { display: flex; align-items: center; gap: 0.5rem; padding: 0.55rem 1.1rem; background: var(--vx-amber-bg); color: var(--vx-amber-fg); border-bottom: 1px solid var(--vx-amber-line); font-size: 0.84rem; text-decoration: none; }
.vx-ib-need span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0.9; }
.vx-ib-scroll { max-height: min(56vh, 560px); min-height: 200px; overflow-y: auto; padding: 1rem 1.1rem; background: var(--gray-50); }
.vx-ib-reply { padding: 0.9rem 1.1rem 1.1rem; border-top: 1px solid var(--gray-200); }

/* ── C: triage ───────────────────────────────────────────────────── */
.vx-ib-c { max-width: 720px; margin: 0 auto; }
.vx-ib-cprog { height: 6px; background: var(--gray-200); border-radius: 999px; overflow: hidden; }
.vx-ib-cprog i { display: block; height: 100%; background: var(--vx-good); border-radius: 999px; transition: width 0.4s ease; }
.vx-ib-ccount { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin: 0.5rem 0.2rem 0.7rem; font-size: 0.86rem; flex-wrap: wrap; }
.vx-ib-ccard { padding: 1.2rem 1.3rem 1.3rem !important; display: flex; flex-direction: column; gap: 0.9rem; animation: vx-ib-card-in 0.28s cubic-bezier(.2,.8,.3,1); transition: transform 0.23s ease, opacity 0.23s ease; }
.vx-ib-ccard--approve { transform: translateX(60px) rotate(2deg); opacity: 0; }
.vx-ib-ccard--reject { transform: translateX(-60px) rotate(-2deg); opacity: 0; }
.vx-ib-ccard--skip { transform: translateY(-24px) scale(0.97); opacity: 0; }
@keyframes vx-ib-card-in { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.vx-ib-chead2 h2 { font-size: 1.5rem; }
.vx-ib-chead2 p { font-size: 0.95rem; }
.vx-ib-cpreview { max-height: 46vh; overflow-y: auto; }
.vx-ib-quote { margin: 0; padding: 0.7rem 0.9rem; border-left: 3px solid var(--vx-c1); background: var(--gray-50); border-radius: 0 var(--radius) var(--radius) 0; font-size: 0.92rem; }
.vx-ib-quote--draft { border-left-color: var(--vx-c7); }
.vx-ib-quote-meta { display: flex; align-items: center; gap: 0.3rem; font-size: 0.78rem; color: var(--gray-500); margin-bottom: 0.3rem; }
.vx-ib-intents { list-style: none; margin: 0.6rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.vx-ib-intents li { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.7rem; background: var(--vx-amber-bg); color: var(--vx-amber-fg); border-radius: var(--radius); font-size: 0.9rem; }
.vx-ib-intents li span { flex: 1; } .vx-ib-intents small { opacity: 0.8; }
.vx-ib-cextra { display: flex; justify-content: flex-end; }
.vx-ib-cbtns { display: grid; grid-template-columns: 1fr auto auto 1.6fr; gap: 0.5rem; align-items: stretch; }
.vx-ib-cbtn { justify-content: center; padding-top: 0.75rem !important; padding-bottom: 0.75rem !important; font-size: 0.95rem; white-space: nowrap; }

/* ── responsive ──────────────────────────────────────────────────── */
@media (max-width: 1000px) {
    .vx-ib-a, .vx-ib-b { grid-template-columns: minmax(0, 1fr); }
    .vx-ib-list, .vx-ib-threads { position: static; max-height: none; }
    .vx-ib-back { display: inline-flex; }
    .vx-ib-a .vx-ib-detail { display: none; }
    .vx-ib-a--detail .vx-ib-list { display: none; }
    .vx-ib-a--detail .vx-ib-detail { display: block; }
    .vx-ib-b .vx-ib-convo { display: none; }
    .vx-ib-b--detail .vx-ib-threads { display: none; }
    .vx-ib-b--detail .vx-ib-convo { display: flex; }
}
@media (max-width: 640px) {
    .vx-ib-dhead, .vx-ib-body, .vx-ib-done, .vx-ib-chead, .vx-ib-reply, .vx-ib-scroll { padding-left: 0.8rem; padding-right: 0.8rem; }
    .vx-ib-table th:nth-child(2), .vx-ib-table td:nth-child(2) { display: none; }
    .vx-ib-ccard { padding: 1rem !important; }
    .vx-ib-chead2 h2 { font-size: 1.25rem; }
    .vx-ib-cbtns { grid-template-columns: 1fr 1fr; }
    .vx-ib-cbtn--main { grid-column: 1 / -1; grid-row: 1; padding-top: 0.95rem !important; padding-bottom: 0.95rem !important; font-size: 1.05rem; }
    .vx-ib-cbtns .vx-kbd { display: none; }
    .vx-ib-foot .btn-primary { flex: 1 1 100%; justify-content: center; }
    .vx-ib-keys div { grid-template-columns: 5rem 1fr; }
}

/* ── dark mode ───────────────────────────────────────────────────── */
[data-theme="dark"] .vx-ib-group h3 { background: rgba(255, 255, 255, 0.04); }
[data-theme="dark"] .vx-ib-count { background: rgba(255, 255, 255, 0.1); color: var(--gray-700); }
[data-theme="dark"] .vx-ib-row.on, [data-theme="dark"] .vx-ib-thread.on { background: rgba(56, 189, 248, 0.12); }
[data-theme="dark"] .vx-ib-scroll, [data-theme="dark"] .vx-ib-quote, [data-theme="dark"] .vx-ib-meta { background: rgba(255, 255, 255, 0.04); }
[data-theme="dark"] .vx-ib-opt { background: transparent; }
[data-theme="dark"] .vx-ib-done > .vx-cmp, [data-theme="dark"] .vx-ib-done > form, [data-theme="dark"] .vx-ib-done > section { background: var(--bg); }

/* ---- 50-performance.css ---- */
/* =====================================================================
   Vision — Performance (/vision/performance). Prefix .vx-pf-
   ===================================================================== */

/* ── Filter row ─────────────────────────────────────────────────────── */
.vx-pf-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1.25rem; margin-bottom: 1rem; padding: 0.6rem 0.85rem;
    background: var(--bg); border: 1px solid var(--gray-200); border-radius: var(--radius); box-shadow: var(--shadow); }
.vx-pf-ctl { display: inline-flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; min-width: 0; }
.vx-pf-ctl-label { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--gray-500); }
.vx-pf-select { width: auto; min-width: 150px; padding: 0.3rem 0.55rem; font-size: 0.82rem; }
.vx-pf-compare { cursor: pointer; font-size: 0.82rem; font-weight: 600; color: var(--gray-700); }
.vx-pf-scopechip { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.84rem; font-weight: 600; color: var(--gray-800); }
.vx-pf-range { margin-left: auto; display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.8rem; font-weight: 600; color: var(--gray-700); white-space: nowrap; }
.vx-pf-range .vx-muted { font-weight: 500; }

/* (i) definition trigger + popover body */
.vx-pf-i { color: var(--gray-400); padding: 2px; border-radius: 50%; }
.vx-pf-i:hover { color: var(--primary); }
.vx-pf-def-formula { color: var(--gray-700); margin: 0.3rem 0 0.4rem; line-height: 1.45; }
.vx-pf-def-note { color: var(--gray-500); font-size: 0.78rem; margin: 0 0 0.3rem; line-height: 1.45; }
.vx-pf-def-source { font-size: 0.72rem; line-height: 1.5; }
.vx-pf-def-source b { color: var(--gray-700); margin-right: 0.25rem; }

/* ── KPI tiles ──────────────────────────────────────────────────────── */
.vx-pf-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0.75rem; margin-bottom: 1rem; }
.vx-pf-kpis .vx-kpi-label { width: 100%; }
.vx-pf-kpis .vx-kpi-label .vx-popwrap { margin-left: auto; }
.vx-pf-kpi-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vx-pf-kpi-sub { font-size: 0.74rem; color: var(--gray-500); margin-top: 0.1rem; }
.vx-pf-compare-note { display: flex; align-items: center; gap: 0.35rem; font-size: 0.78rem; color: var(--gray-500); margin: -0.4rem 0 1rem; }
@media (max-width: 1279px) { .vx-pf-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .vx-pf-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; } .vx-pf-kpis .vx-kpi { padding: 0.7rem 0.75rem; } .vx-pf-kpis .vx-kpi-value { font-size: 1.3rem; } }

/* ── Layout ─────────────────────────────────────────────────────────── */
.vx-pf-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.vx-pf-grid2 > .vx-card { margin-bottom: 0; min-width: 0; }
@media (max-width: 999px) { .vx-pf-grid2 { grid-template-columns: 1fr; } }
.vx-pf-trend { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; }
.vx-pf-trend-item { min-width: 0; }
@media (max-width: 899px) { .vx-pf-trend { grid-template-columns: 1fr; } }
.vx-pf-chart-title { font-size: 0.84rem; font-weight: 600; color: var(--gray-700); margin-bottom: 0.25rem; }
.vx-pf-chart { border-radius: 6px; }
.vx-pf-chart:focus { outline: none; }
.vx-pf-chart:focus-visible { outline: 2px solid var(--primary); outline-offset: 4px; }
.vx-pf-band { fill: color-mix(in srgb, var(--primary) 8%, transparent); }
.vx-pf-bandlabel { font-size: 10.5px; font-weight: 600; fill: var(--primary-dark); }
.vx-pf-note { font-size: 0.8rem; color: var(--gray-600); margin-top: 0.7rem; line-height: 1.5; }
.vx-pf-note b { color: var(--gray-800); }
.vx-pf-subhead { font-size: 0.8rem; font-weight: 600; color: var(--gray-700); margin-bottom: 0.4rem; }
.vx-pf-outcome-sums { display: flex; flex-wrap: wrap; gap: 0.4rem 1.5rem; margin-top: 0.8rem; font-size: 0.82rem; color: var(--gray-700); }
.vx-pf-outcome-sums b { font-size: 1rem; color: var(--gray-900); }
.vx-pf-eta-sum { font-size: 0.84rem; color: var(--gray-700); margin-bottom: 0.4rem; }
.vx-pf-eta-sum b { font-size: 1rem; color: var(--gray-900); }
.vx-pf-axisnote { display: flex; justify-content: space-between; font-size: 0.7rem; color: var(--gray-500); padding-left: 44px; }

/* Tables (weekly numbers, leaderboard) */
.vx-pf-details { margin-top: 0.75rem; font-size: 0.82rem; }
.vx-pf-details > summary { cursor: pointer; color: var(--primary-dark); font-weight: 600; font-size: 0.8rem; }
.vx-pf-tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.vx-pf-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; margin-top: 0.5rem; }
.vx-pf-table th { text-align: left; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--gray-500); padding: 0.5rem 0.7rem; border-bottom: 1px solid var(--gray-200); white-space: nowrap; }
.vx-pf-table td { padding: 0.5rem 0.7rem; border-bottom: 1px solid var(--gray-100); color: var(--gray-800); vertical-align: middle; }
.vx-pf-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.vx-pf-table tfoot td { font-weight: 700; border-top: 1px solid var(--gray-200); border-bottom: 0; }
.vx-pf-lb { margin-top: 0; min-width: 820px; }
.vx-pf-lb tbody tr { cursor: pointer; }
.vx-pf-lb tbody tr:hover { background: var(--vx-row-hover); }
.vx-pf-lb tr.is-sel { background: var(--primary-light); box-shadow: inset 3px 0 0 var(--primary); }
.vx-pf-lb .num .vx-pf-delta { display: flex; justify-content: flex-end; }
.vx-pf-person { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; color: inherit; text-align: left; border-radius: 6px; }
.vx-pf-person:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.vx-pf-sparkcell { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.74rem; white-space: nowrap; }
.vx-pf-lb-list { display: none; list-style: none; margin: 0; padding: 0; }
.vx-pf-lb-list li { border-bottom: 1px solid var(--gray-100); }
.vx-pf-lb-list li.is-sel { background: var(--primary-light); }
.vx-pf-lb-item { display: flex; flex-direction: column; gap: 0.35rem; width: 100%; padding: 0.75rem 1rem; background: none; border: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.vx-pf-lb-top { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.vx-pf-lb-top b { font-size: 1rem; color: var(--gray-900); }
.vx-pf-lb-meta { font-size: 0.76rem; color: var(--gray-500); }
.vx-pf-lb-total { display: flex; justify-content: space-between; padding: 0.7rem 1rem; font-size: 0.82rem; font-weight: 600; color: var(--gray-700); }
@media (max-width: 720px) { .vx-pf-lb-table { display: none; } .vx-pf-lb-list { display: block; } }

/* Deltas used outside KPI tiles */
.vx-pf-delta { display: inline-flex; align-items: center; gap: 0.2rem; font-size: 0.72rem; font-weight: 600; white-space: nowrap; }
.vx-pf-delta--good { color: #15803d; } .vx-pf-delta--bad { color: #b91c1c; } .vx-pf-delta--flat { color: var(--gray-500); }
[data-theme="dark"] .vx-pf-delta--good { color: #4ade80; } [data-theme="dark"] .vx-pf-delta--bad { color: #f87171; }

/* Stats + meters */
.vx-pf-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 0.9rem 1rem; }
.vx-pf-stats--tight { margin-top: 0.9rem; }
.vx-pf-stat { min-width: 0; }
.vx-pf-stat-label { display: block; font-size: 0.74rem; font-weight: 600; color: var(--gray-500); }
.vx-pf-stat-value { font-size: 1.3rem; font-weight: 700; color: var(--gray-900); letter-spacing: -0.01em; }
.vx-pf-stat-sub { font-size: 0.72rem; color: var(--gray-500); }
.vx-pf-meters { display: flex; flex-direction: column; gap: 1rem; }
.vx-pf-meter-head { display: flex; justify-content: space-between; gap: 0.5rem; font-size: 0.84rem; color: var(--gray-700); margin-bottom: 0.3rem; }
.vx-pf-meter-head b { font-size: 1.05rem; color: var(--gray-900); }
.vx-pf-meter { height: 8px; border-radius: 4px; background: color-mix(in srgb, var(--vx-c1) 16%, var(--bg)); overflow: hidden; }
.vx-pf-meter > span { display: block; height: 100%; border-radius: 4px; background: var(--vx-c1); }
.vx-pf-meter-sub { font-size: 0.75rem; color: var(--gray-500); margin-top: 0.3rem; }

/* Uplift (disabled) */
.vx-pf-uplift { border-style: dashed; }
.vx-pf-uplift-body { display: flex; flex-direction: column; gap: 0.7rem; font-size: 0.84rem; color: var(--gray-600); line-height: 1.5; }
.vx-pf-uplift-body code { font-size: 0.78rem; background: var(--gray-100); padding: 0 0.25rem; border-radius: 4px; }
.vx-pf-uplift-ghost { display: flex; align-items: center; gap: 1rem; color: var(--gray-400); }
.vx-pf-uplift-ghost > div { display: flex; flex-direction: column; padding: 0.5rem 0.8rem; border: 1px dashed var(--gray-300); border-radius: 8px; min-width: 130px; }
.vx-pf-uplift-ghost b { font-size: 1.3rem; color: var(--gray-400); }
.vx-pf-uplift-ghost small { font-size: 0.7rem; }
.vx-pf-uplift-body .btn { align-self: flex-start; }

/* ── Digest ─────────────────────────────────────────────────────────── */
.vx-pf-digest { max-width: 780px; margin: 0 auto; }
.vx-pf-mail { background: var(--bg); border: 1px solid var(--gray-200); border-radius: var(--radius) var(--radius) 0 0; border-bottom: 0; padding: 0.75rem 1.1rem 0.25rem; }
.vx-pf-mail-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.5rem; }
.vx-pf-mail-tag { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--gray-500); }
.vx-pf-mail-meta { display: grid; grid-template-columns: auto 1fr; gap: 0.15rem 0.8rem; font-size: 0.82rem; margin: 0; }
.vx-pf-mail-meta dt { color: var(--gray-500); }
.vx-pf-mail-meta dd { margin: 0; color: var(--gray-800); min-width: 0; overflow-wrap: anywhere; }
.vx-pf-mail-setting { margin-top: 0.5rem; border-top: 1px solid var(--gray-100); }
.vx-pf-mail-setting .vx-pf-note { margin: -0.2rem 0 0.6rem; font-size: 0.75rem; color: var(--gray-500); }
.vx-pf-letter { padding: 1.5rem 1.75rem; border-radius: 0 0 var(--radius) var(--radius); margin-bottom: 1rem; }
.vx-pf-letter-eyebrow { font-size: 0.74rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--primary); margin-bottom: 0.35rem; }
.vx-pf-headline { font-size: 1.35rem; line-height: 1.35; font-weight: 700; color: var(--gray-900); margin: 0 0 0.5rem; letter-spacing: -0.01em; }
.vx-pf-lede { font-size: 0.95rem; line-height: 1.6; color: var(--gray-700); margin: 0; }
.vx-pf-figs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.75rem; margin: 1.1rem 0 0.25rem; padding: 0.9rem 0; border-top: 1px solid var(--gray-200); border-bottom: 1px solid var(--gray-200); }
.vx-pf-fig { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.vx-pf-fig-label { font-size: 0.74rem; font-weight: 600; color: var(--gray-500); }
.vx-pf-fig-value { font-size: 1.35rem; font-weight: 700; color: var(--gray-900); }
.vx-pf-sec { margin-top: 1.4rem; }
.vx-pf-sec-title { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--gray-700); margin: 0 0 0.6rem; }
.vx-pf-hl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.75rem; }
.vx-pf-hl-card { border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 0.85rem 0.95rem; font-size: 0.84rem; line-height: 1.5; color: var(--gray-700); display: flex; flex-direction: column; gap: 0.4rem; min-width: 0; }
.vx-pf-hl-card p { margin: 0; }
.vx-pf-hl-kicker { display: flex; align-items: center; gap: 0.45rem; font-size: 0.76rem; font-weight: 700; color: var(--gray-800); }
.vx-pf-hl-icon { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; background: var(--primary-light); color: var(--primary-dark); }
.vx-pf-hl-list { margin: 0; padding-left: 1rem; display: flex; flex-direction: column; gap: 0.3rem; }
.vx-pf-hl-more { font-size: 0.76rem; color: var(--gray-500); margin: 0; }
.vx-pf-link { display: inline-flex; align-items: center; gap: 0.15rem; font-size: 0.8rem; font-weight: 600; color: var(--primary-dark); text-decoration: none; margin-top: auto; }
.vx-pf-link:hover { text-decoration: underline; }
.vx-pf-letter a { color: var(--primary-dark); }
.vx-pf-misses { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.vx-pf-misses li { padding: 0.65rem 0; border-bottom: 1px solid var(--gray-100); }
.vx-pf-misses li:first-child { padding-top: 0; }
.vx-pf-misses p { margin: 0.25rem 0 0; font-size: 0.84rem; color: var(--gray-700); line-height: 1.5; }
.vx-pf-miss-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.3rem 0.6rem; font-size: 0.88rem; }
.vx-pf-miss-head a { text-decoration: none; }
.vx-pf-miss-why { font-size: 0.72rem; font-weight: 600; color: var(--vx-amber-fg); background: var(--vx-amber-bg); border-radius: 999px; padding: 0.05rem 0.5rem; }
.vx-pf-ok { display: flex; align-items: center; gap: 0.4rem; font-size: 0.86rem; color: var(--vx-green-fg); margin: 0; }
.vx-pf-rows { list-style: none; margin: 0; padding: 0; }
.vx-pf-rows li { display: flex; align-items: center; gap: 0.6rem; padding: 0.45rem 0; border-bottom: 1px solid var(--gray-100); font-size: 0.85rem; min-width: 0; }
.vx-pf-row-main { flex: 1; min-width: 0; color: var(--gray-800); font-weight: 600; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vx-pf-row-side { margin-left: auto; color: var(--gray-600); font-size: 0.8rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.vx-pf-due { min-width: 6.5em; font-size: 0.78rem; font-weight: 600; color: var(--gray-600); }
.vx-pf-due--late { color: var(--vx-red-fg); }
.vx-pf-outlook-sum { font-size: 0.86rem; color: var(--gray-700); margin: 0 0 0.4rem; line-height: 1.5; }
.vx-pf-defs dl { margin: 0.6rem 0 0; display: flex; flex-direction: column; gap: 0.15rem; }
.vx-pf-defs dt { font-weight: 700; color: var(--gray-800); margin-top: 0.4rem; }
.vx-pf-defs dd { margin: 0; color: var(--gray-600); line-height: 1.5; }
.vx-pf-letter-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem; margin-top: 1.3rem; padding-top: 1rem; border-top: 1px solid var(--gray-200); font-size: 0.76rem; }
.vx-pf-letter-foot .btn { display: inline-flex; align-items: center; gap: 0.35rem; }

@media (max-width: 860px) { .vx-pf-hl { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
    .vx-pf-controls { flex-direction: column; align-items: stretch; gap: 0.6rem; }
    .vx-pf-ctl { justify-content: flex-start; }
    .vx-pf-range { margin-left: 0; white-space: normal; }
    .vx-pf-figs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .vx-pf-letter { padding: 1.1rem 1rem; }
    .vx-pf-headline { font-size: 1.15rem; }
    .vx-pf-uplift-ghost > div { min-width: 0; flex: 1; }
    /* Definition popovers become a bottom sheet on phones */
    .vx-pf .vx-popover { position: fixed; left: 12px !important; right: 12px !important; top: auto; bottom: 12px; width: auto !important; max-height: 60vh; overflow-y: auto; z-index: 960; }
}
.vx-pf-note a, .vx-pf-hl-more a { color: var(--primary-dark); font-weight: 600; }

/* ---- 60-team.css ---- */
/* =====================================================================
   Vision — My assistant (CSU) / Team & agents (CSM)  ·  /vision/team
   ===================================================================== */

/* Layout */
.vx-tm-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 0 1rem; align-items: start; }
.vx-tm-grid--wide { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
.vx-tm-grid--even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.vx-tm-col { min-width: 0; }
.vx-tm-tabs { margin-bottom: 1rem; overflow-x: auto; }
.vx-tm-tabs .tab-btn { display: inline-flex; align-items: center; gap: 0.4rem; white-space: nowrap; }
.vx-tm-tabcount { font-size: 0.7rem; background: var(--gray-200); color: var(--gray-700); border-radius: 9px; padding: 0 0.4rem; }
@media (max-width: 1100px) {
    .vx-tm-grid, .vx-tm-grid--wide, .vx-tm-grid--even { grid-template-columns: 1fr; }
}

/* Paused banner + flash */
.vx-tm-banner { display: flex; align-items: center; gap: 0.85rem; padding: 0.85rem 1rem; margin-bottom: 1rem; border-radius: var(--radius);
    background: var(--vx-red-bg); color: var(--vx-red-fg); border: 1px solid var(--vx-red-line); }
.vx-tm-banner-icon { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; background: var(--vx-critical); color: #fff; flex-shrink: 0; }
.vx-tm-banner-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.15rem; font-size: 0.85rem; }
.vx-tm-banner-text b { font-size: 0.92rem; }
.vx-tm-banner-btn { background: var(--vx-critical); color: #fff; flex-shrink: 0; }
.vx-tm-banner-btn:hover { filter: brightness(1.08); }
.vx-tm-banner-who { font-size: 0.8rem; font-weight: 600; flex-shrink: 0; }
.vx-tm-flash { display: flex; align-items: center; gap: 0.5rem; padding: 0.6rem 0.85rem; margin-bottom: 1rem; border-radius: var(--radius);
    background: var(--vx-green-bg); color: var(--vx-green-fg); border: 1px solid var(--vx-green-line); font-size: 0.86rem; font-weight: 600; }
.vx-tm-flash span { flex: 1; }
.vx-tm-flash-x { border: 0; background: none; color: inherit; font-size: 1.2rem; cursor: pointer; line-height: 1; }

/* Hero (agent persona) */
.vx-tm-hero { display: flex; align-items: flex-start; gap: 1rem; }
.vx-tm-hero-main { flex: 1; min-width: 0; }
.vx-tm-hero-top { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.vx-tm-hero-name { font-size: 1.25rem; font-weight: 700; margin: 0; color: var(--gray-900); }
.vx-tm-hero-role { font-size: 0.86rem; color: var(--gray-600); margin-top: 0.15rem; }
.vx-tm-hero-role b { color: var(--gray-800); }
.vx-tm-hero-mode { display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.55rem; font-size: 0.88rem; color: var(--gray-700); }
.vx-tm-hero-paused { display: flex; align-items: center; gap: 0.35rem; margin-top: 0.5rem; font-size: 0.82rem; color: var(--vx-red-fg); font-weight: 600; }
.vx-tm-hero-cta { flex-shrink: 0; align-self: center; }
.vx-tm-hero-cta .btn { text-decoration: none; }
.vx-tm-hero--compact { padding: 0.85rem 1rem; }
.vx-tm-hero--compact .vx-tm-hero-name { font-size: 1.05rem; }

/* Notes and hints */
.vx-tm-note { display: flex; align-items: flex-start; gap: 0.5rem; padding: 0.55rem 0.75rem; border-radius: 8px; background: var(--vx-indigo-bg); color: var(--vx-indigo-fg);
    border: 1px solid var(--vx-indigo-line); font-size: 0.82rem; margin-bottom: 0.4rem; }
.vx-tm-note--ro { background: var(--vx-gray-bg); color: var(--gray-600); border-color: var(--gray-200); }
.vx-tm-hint { display: block; font-size: 0.8rem; color: var(--gray-500); margin: -0.25rem 0 0.6rem; }
.vx-tm-hint > .vx-icon, .vx-tm-hint > .vx-tm-dot { vertical-align: -2px; margin-right: 0.35rem; }
.vx-tm-hint--top { margin: 0 0 0.4rem; }
.vx-tm-foot { font-size: 0.74rem; color: var(--gray-500); margin-top: 0.6rem; }
.vx-tm-exc { font-size: 0.72rem; font-weight: 600; color: var(--vx-amber-fg); }
.vx-tm-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--gray-400); }
.vx-tm-dot--on { background: var(--vx-good); }
.vx-tm-warn { color: var(--vx-red-fg) !important; font-weight: 600; }
.vx-tm-act { display: inline-flex; align-items: center; gap: 0.4rem; }

/* Mode explainer */
.vx-tm-modes { list-style: none; margin: -0.2rem 0 0.7rem; padding: 0; display: grid; gap: 0.3rem; }
.vx-tm-modes li { display: grid; grid-template-columns: 11.5rem 1fr; gap: 0.75rem; padding: 0.4rem 0.6rem; border-radius: 7px; font-size: 0.8rem; color: var(--gray-500); border: 1px solid transparent; }
.vx-tm-modes li.on { background: var(--primary-light); border-color: var(--vx-blue-line); color: var(--gray-700); }
.vx-tm-modes-k { font-weight: 700; color: var(--gray-600); }
.vx-tm-modes li.on .vx-tm-modes-k { color: var(--primary-dark); }
@media (max-width: 640px) { .vx-tm-modes li { grid-template-columns: 1fr; gap: 0.1rem; } }

/* Stats */
.vx-tm-stats, .vx-tm-cost { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.5rem; margin-bottom: 0.9rem; }
.vx-tm-cost { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.vx-tm-stat { display: flex; flex-direction: column; gap: 0.1rem; padding: 0.6rem 0.7rem; border-radius: 8px; background: var(--gray-50); border: 1px solid var(--gray-200); min-width: 0; }
.vx-tm-stat b { font-size: 1.3rem; font-weight: 700; color: var(--gray-900); font-variant-numeric: tabular-nums; line-height: 1.15; }
.vx-tm-stat span { font-size: 0.72rem; color: var(--gray-500); font-weight: 600; }
@media (max-width: 520px) { .vx-tm-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.vx-tm-subhead { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--gray-500); margin: 0.9rem 0 0.45rem; }
.vx-tm-subhead--row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; }
.vx-tm-count { display: inline-block; margin-left: 0.25rem; font-size: 0.68rem; background: var(--vx-amber-bg); color: var(--vx-amber-fg); border-radius: 9px; padding: 0 0.4rem; letter-spacing: 0; }

/* Feed */
.vx-tm-feed { list-style: none; margin: 0; padding: 0; }
.vx-tm-feed-item { display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem 0; border-bottom: 1px solid var(--gray-100); }
.vx-tm-feed-item:last-child { border-bottom: 0; }
.vx-tm-feed-icon { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: var(--primary-light); color: var(--primary-dark); flex-shrink: 0; }
.vx-tm-feed-body { flex: 1; min-width: 0; }
.vx-tm-feed-text { font-size: 0.84rem; color: var(--gray-700); }
.vx-tm-feed-text b { color: var(--gray-900); }
.vx-tm-feed-sub { font-size: 0.74rem; color: var(--gray-500); }
.vx-tm-feed-cta { flex-shrink: 0; text-decoration: none; }
.vx-tm-feed-go { color: var(--gray-400); display: inline-flex; }
.vx-tm-feed-go:hover { color: var(--primary); }
.vx-tm-waiting { background: var(--vx-amber-bg); border: 1px solid var(--vx-amber-line); border-radius: 8px; padding: 0 0.75rem 0.25rem; margin-bottom: 0.4rem; }
.vx-tm-waiting .vx-tm-subhead { color: var(--vx-amber-fg); margin-top: 0.6rem; }
.vx-tm-waiting .vx-tm-feed-item { border-color: var(--vx-amber-line); }
.vx-tm-more { margin-top: 0.5rem; }

/* Trust */
.vx-tm-trust { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.8rem; }
.vx-tm-trust-top { display: flex; justify-content: space-between; gap: 0.5rem; font-size: 0.84rem; color: var(--gray-700); margin-bottom: 0.25rem; }
.vx-tm-trust-top b { font-variant-numeric: tabular-nums; color: var(--gray-900); }
.vx-tm-trust-sub { font-size: 0.74rem; color: var(--gray-500); margin-top: 0.2rem; display: flex; gap: 0.35rem; align-items: baseline; flex-wrap: wrap; }
.vx-tm-meter { display: block; height: 8px; border-radius: 4px; background: var(--gray-100); overflow: hidden; }
.vx-tm-meter > span { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--vx-c1); }
.vx-tm-meter--teal > span { background: var(--vx-c3); }
.vx-tm-meter--green > span { background: var(--vx-good); }
.vx-tm-meter--amber > span { background: var(--vx-warning); }
.vx-tm-meter--red > span { background: var(--vx-critical); }
.vx-tm-suggest { display: flex; gap: 0.65rem; margin-top: 1rem; padding: 0.75rem 0.85rem; border-radius: 10px; border: 1px solid var(--vx-indigo-line);
    background: linear-gradient(135deg, var(--vx-indigo-bg), var(--vx-blue-bg)); font-size: 0.84rem; color: var(--gray-700); }
.vx-tm-suggest b { color: var(--gray-900); }
.vx-tm-suggest p { margin: 0.3rem 0 0.6rem; }
.vx-tm-suggest-icon { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; background: var(--vx-agent); color: #fff; flex-shrink: 0; }
.vx-tm-suggest-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* Covered customers */
.vx-tm-cov .vx-setting-label { font-weight: 400; }
.vx-tm-cust { display: flex; align-items: center; gap: 0.25rem 0.6rem; flex-wrap: wrap; min-width: 0; }
.vx-tm-cust-name { font-weight: 600; color: var(--gray-900); font-size: 0.88rem; }
.vx-tm-cust-meta { font-size: 0.74rem; color: var(--gray-500); }
.vx-tm-cust-pred { display: inline-flex; align-items: center; gap: 0.3rem; text-decoration: none; flex-wrap: wrap; }
.vx-tm-cust-pred:hover .vx-pill { filter: brightness(0.96); }
.vx-tm-cust-none { font-size: 0.74rem; color: var(--gray-400); }
.vx-tm-src { display: block; font-size: 0.7rem; color: var(--gray-500); margin-top: 0.15rem; }

/* Identity */
.vx-tm-dl { display: grid; grid-template-columns: 7.5rem 1fr; gap: 0.45rem 0.75rem; font-size: 0.84rem; margin: 0 0 0.75rem; }
.vx-tm-dl dt { color: var(--gray-500); font-weight: 600; }
.vx-tm-dl dd { margin: 0; color: var(--gray-700); min-width: 0; }
.vx-tm-rename { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }
.vx-tm-rename .form-input { width: 180px; padding: 0.35rem 0.55rem; font-size: 0.85rem; }
.vx-tm-sig { border: 1px solid var(--gray-200); border-radius: 8px; margin-bottom: 0.6rem; overflow: hidden; }
.vx-tm-sig-head { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; padding: 0.35rem 0.6rem; background: var(--gray-50); font-size: 0.74rem; font-weight: 600; color: var(--gray-600); }
.vx-tm-sig-head > span:first-child { display: inline-flex; align-items: center; gap: 0.3rem; }
.vx-tm-sig-body { padding: 0.55rem 0.7rem; font-size: 0.84rem; color: var(--gray-700); }
.vx-tm-sig-body--sms { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.8rem; }
.vx-tm-sig + .btn, .vx-tm-sig ~ .btn { text-decoration: none; }

.vx-tm-noagent-agent { display: flex; justify-content: center; padding-bottom: 1rem; }

/* Automation health */
.vx-tm-health { display: grid; grid-template-columns: minmax(0, 1.5fr) repeat(3, minmax(0, 1fr)); gap: 0.6rem; }
.vx-tm-state { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.7rem 0.8rem; border-radius: 8px; border: 1px solid; }
.vx-tm-state > div { display: flex; flex-direction: column; gap: 0.1rem; font-size: 0.8rem; min-width: 0; }
.vx-tm-state b { font-size: 1.05rem; }
.vx-tm-state--ok { background: var(--vx-green-bg); color: var(--vx-green-fg); border-color: var(--vx-green-line); }
.vx-tm-state--paused { background: var(--vx-red-bg); color: var(--vx-red-fg); border-color: var(--vx-red-line); }
.vx-tm-state-dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 0.35rem; flex-shrink: 0; background: var(--vx-good); box-shadow: 0 0 0 4px color-mix(in srgb, var(--vx-good) 25%, transparent); }
.vx-tm-state--paused .vx-tm-state-dot { background: var(--vx-critical); box-shadow: 0 0 0 4px color-mix(in srgb, var(--vx-critical) 25%, transparent); }
.vx-tm-state-reason { font-style: italic; }
.vx-tm-hstat { display: flex; flex-direction: column; gap: 0.2rem; padding: 0.6rem 0.7rem; border-radius: 8px; background: var(--gray-50); border: 1px solid var(--gray-200); min-width: 0; }
.vx-tm-hstat-label { font-size: 0.72rem; font-weight: 600; color: var(--gray-500); }
.vx-tm-hstat-value { font-size: 1.1rem; font-weight: 700; color: var(--gray-900); font-variant-numeric: tabular-nums; }
.vx-tm-hstat-value small { font-size: 0.78rem; color: var(--gray-500); font-weight: 600; }
.vx-tm-hstat-sub { font-size: 0.72rem; color: var(--gray-500); }
.vx-tm-pausebtn:hover { color: var(--vx-red-fg); border-color: var(--vx-red-line); background: var(--vx-red-bg); }
@media (max-width: 1280px) { .vx-tm-health { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 460px) { .vx-tm-health { grid-template-columns: 1fr; } }

/* Tables */
.vx-tm-tablewrap { width: 100%; overflow-x: auto; }
.vx-tm-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.vx-tm-table th { text-align: left; padding: 0.55rem 0.7rem; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--gray-500);
    border-bottom: 2px solid var(--gray-200); white-space: nowrap; }
.vx-tm-table td { padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--gray-100); color: var(--gray-700); vertical-align: middle; }
.vx-tm-table tbody tr:last-child td { border-bottom: 0; }
.vx-tm-table tbody tr:hover { background: var(--vx-row-hover); }
.vx-tm-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.vx-tm-card-flushpad { padding: 0 1.15rem; }
.vx-tm-row-warn td { background: color-mix(in srgb, var(--vx-amber-bg) 45%, transparent); }
.vx-tm-cell-actions { text-align: right; white-space: nowrap; }
.vx-tm-rowacts { display: inline-flex; gap: 0.35rem; }
.vx-tm-rowacts .btn, .vx-tm-cell-actions .btn { text-decoration: none; }
.vx-tm-person { border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; text-align: left; border-radius: 6px; display: inline-flex; align-items: center; gap: 0.4rem; }
.vx-tm-person:hover .vx-userchip-name { color: var(--primary-dark); text-decoration: underline; }
.vx-tm-person:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.vx-tm-person--row { width: 100%; justify-content: space-between; padding: 0.5rem 0.6rem; border: 1px solid var(--gray-200); border-radius: 8px; }
.vx-tm-cell-main { white-space: nowrap; }
.vx-tm-cell-main .vx-pill { margin-left: 0.4rem; }
.vx-tm-num { display: inline-block; min-width: 1.6em; padding: 0 0.35rem; border-radius: 9px; font-weight: 700; text-align: center; }
.vx-tm-num--amber { background: var(--vx-amber-bg); color: var(--vx-amber-fg); }
.vx-tm-num--red { background: var(--vx-red-bg); color: var(--vx-red-fg); }
.vx-tm-wk { display: block; font-size: 0.7rem; }
.vx-card--flush .vx-tm-tablewrap { padding: 0 0.45rem 0.3rem; }

/* Phases */
.vx-tm-phases { display: inline-flex; gap: 4px; }
.vx-tm-phase { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 50%; font-size: 0.66rem; font-weight: 800; color: #fff; cursor: help; }
.vx-tm-phase i { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.vx-tm-phase--succeeded { background: var(--vx-good); }
.vx-tm-phase--failed { background: var(--vx-critical); }
.vx-tm-phase--running { background: var(--vx-c7); }
.vx-tm-phase--pending, .vx-tm-phase--skipped { background: var(--gray-300); }
.vx-tm-phase:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.vx-tm-runerr { display: flex; align-items: flex-start; gap: 0.35rem; font-size: 0.78rem; color: var(--vx-red-fg); white-space: normal; }
.vx-tm-runerr-row td { padding-top: 0 !important; }
.vx-tm-table tr.vx-tm-row-warn:not(.vx-tm-runerr-row) td { border-bottom: 0; }
@media (max-width: 760px) { .vx-tm-runerr-row td { grid-column: 1 / -1; } .vx-tm-table tr.vx-tm-runerr-row { padding-top: 0; } }
.vx-tm-runerr .vx-icon { margin-top: 0.15rem; }

/* Cost */
.vx-tm-kv { list-style: none; margin: 0; padding: 0; font-size: 0.82rem; }
.vx-tm-kv li { display: flex; justify-content: space-between; padding: 0.3rem 0; border-bottom: 1px dashed var(--gray-100); color: var(--gray-700); }
.vx-tm-kv b { font-variant-numeric: tabular-nums; color: var(--gray-900); }

/* Workload */
.vx-tm-wl { list-style: none; margin: 0.8rem 0 0; padding: 0; display: grid; gap: 0.55rem; }
.vx-tm-wl li { display: grid; grid-template-columns: minmax(80px, 34%) 1fr 2.2em; align-items: center; gap: 0.6rem; font-size: 0.82rem; }
.vx-tm-wl-name { color: var(--gray-700); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vx-tm-wl-track { display: block; height: 14px; }
.vx-tm-wl-bar { display: flex; gap: 2px; height: 100%; min-width: 3px; }
.vx-tm-wl-bar > span { min-width: 3px; height: 100%; }
.vx-tm-wl-bar > span:last-child { border-radius: 0 4px 4px 0; }
.vx-tm-wl-total { text-align: right; font-variant-numeric: tabular-nums; color: var(--gray-800); }

/* Agent-owned customers */
.vx-tm-unowned { list-style: none; margin: 0; padding: 0; }
.vx-tm-unowned li { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1.2fr) minmax(0, 1.2fr) auto; gap: 0.75rem; align-items: center; padding: 0.6rem 0; border-bottom: 1px solid var(--gray-100); }
.vx-tm-unowned li:last-child { border-bottom: 0; }
.vx-tm-unowned-main { display: flex; flex-direction: column; min-width: 0; }
.vx-tm-unowned-act { display: inline-flex; align-items: center; gap: 0.4rem; justify-self: end; }
@media (max-width: 1280px) { .vx-tm-unowned li { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .vx-tm-unowned-act { justify-self: start; } }

/* Person drawer */
.vx-tm-person-head { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 1rem; }
.vx-tm-person-head > div { display: flex; flex-direction: column; }
.vx-tm-person-head span { font-size: 0.8rem; color: var(--gray-500); }
.vx-tm-stats--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.vx-tm-plist { list-style: none; margin: 0 0 0.8rem; padding: 0; }
.vx-tm-plist a { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; padding: 0.5rem 0.35rem; border-bottom: 1px solid var(--gray-100); text-decoration: none; color: inherit; border-radius: 6px; }
.vx-tm-plist a:hover { background: var(--vx-row-hover); }
.vx-tm-plist-main { display: flex; flex-direction: column; min-width: 0; font-size: 0.84rem; }
.vx-tm-plist-main b { color: var(--gray-900); }
.vx-tm-plist-main span { font-size: 0.76rem; color: var(--gray-500); }
.vx-tm-plist-tags { display: inline-flex; align-items: center; gap: 0.3rem; flex-shrink: 0; }
.vx-tm-agent-drawer .vx-card { box-shadow: none; }
.vx-drawer-body .btn { text-decoration: none; }

/* Modals */
.vx-tm-modal-p { font-size: 0.86rem; color: var(--gray-600); margin-bottom: 0.75rem; }
.vx-tm-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.5rem; }
.vx-tm-chip { border: 1px solid var(--gray-200); background: var(--gray-50); color: var(--gray-700); border-radius: 999px; padding: 0.22rem 0.6rem; font: inherit; font-size: 0.76rem; cursor: pointer; }
.vx-tm-chip.on, .vx-tm-chip:hover { border-color: var(--primary); color: var(--primary-dark); background: var(--primary-light); }
.vx-tm-fromto { display: grid; grid-template-columns: 1fr auto 1fr; gap: 0.6rem; align-items: end; margin-bottom: 0.8rem; }
.vx-tm-fromto label { display: flex; flex-direction: column; min-width: 0; }
.vx-tm-fromto-arrow { color: var(--gray-400); padding-bottom: 0.6rem; }
.vx-tm-form { display: grid; gap: 0.8rem; margin-bottom: 0.6rem; }
.vx-tm-form label { display: flex; flex-direction: column; }
.vx-tm-form .vx-tm-hint { margin: 0.4rem 0 0; }
.vx-tm-picklist { list-style: none; margin: 0 0 0.6rem; padding: 0; max-height: 46vh; overflow-y: auto; border: 1px solid var(--gray-200); border-radius: 8px; }
.vx-tm-picklist li + li { border-top: 1px solid var(--gray-100); }
.vx-tm-check { display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem 0.7rem; cursor: pointer; font-size: 0.84rem; }
.vx-tm-check:hover { background: var(--vx-row-hover); }
.vx-tm-check input { width: 16px; height: 16px; accent-color: var(--primary); flex-shrink: 0; }
.vx-tm-check--all { padding-left: 0.7rem; font-weight: 600; color: var(--gray-600); }
.vx-tm-check--line { padding-left: 0; }
.vx-tm-check--line:hover { background: none; }
.vx-tm-pick-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.vx-tm-pick-main b { color: var(--gray-900); }
.vx-tm-pick-main span { font-size: 0.76rem; color: var(--gray-500); }
.vx-tm-pick-tags { display: inline-flex; align-items: center; gap: 0.4rem; flex-shrink: 0; }

/* Mobile: tables become cards */
@media (max-width: 760px) {
    .vx-tm-hero { flex-wrap: wrap; }
    .vx-tm-hero-cta { width: 100%; }
    .vx-tm-banner { flex-wrap: wrap; }
    .vx-tm-tablewrap { overflow: visible; }
    .vx-tm-table thead { display: none; }
    .vx-tm-table, .vx-tm-table tbody, .vx-tm-table tr { display: block; width: 100%; }
    .vx-tm-table tr { display: grid; grid-template-columns: 1fr 1fr; gap: 0.35rem 0.75rem; padding: 0.75rem 0.4rem; border-bottom: 1px solid var(--gray-200); }
    .vx-tm-table tbody tr:last-child { border-bottom: 0; }
    .vx-tm-table td { display: flex; flex-direction: column; gap: 0.1rem; padding: 0; border: 0; text-align: left !important; white-space: normal; }
    .vx-tm-table td[data-label]::before { content: attr(data-label); font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--gray-500); }
    .vx-tm-table td.vx-tm-cell-main, .vx-tm-table td.vx-tm-cell-actions { grid-column: 1 / -1; }
    .vx-tm-table td.vx-tm-cell-main::before { display: none; }
    .vx-tm-table td.vx-tm-cell-main { flex-direction: row; align-items: center; }
    .vx-tm-runs td[data-label="Phases"] { grid-column: 1 / -1; }
    .vx-tm-rowacts { flex-wrap: wrap; }
    .vx-tm-unowned li { grid-template-columns: 1fr; gap: 0.4rem; }
    .vx-tm-fromto { grid-template-columns: 1fr; }
    .vx-tm-fromto-arrow { display: none; }
    .vx-tm-dl { grid-template-columns: 1fr; gap: 0.1rem; }
    .vx-tm-dl dd { margin-bottom: 0.4rem; }
    .vx-tm-stats--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---- 70-settings.css ---- */
/* =====================================================================
   Vision UX mockups — Settings (/vision/settings/:tab). Prefix .vx-st-
   ===================================================================== */

/* ── Frame ──────────────────────────────────────────────────────────── */
.vx-st-tabs { margin-bottom: 1rem; overflow-x: auto; scrollbar-width: none; }
.vx-st-tabs .tab-btn { display: inline-flex; align-items: center; gap: 0.4rem; text-decoration: none; white-space: nowrap; }
.vx-st-tabcount, .vx-st-side-count { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--gray-100); color: var(--gray-600); font-size: 0.68rem; font-weight: 700; }
.vx-st-tabs .tab-btn.active .vx-st-tabcount { background: var(--primary-light); color: var(--primary-dark); }

.vx-st-main { min-width: 0; container-type: inline-size; container-name: vxst; }
.vx-st-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 0.75rem 1rem; flex-wrap: wrap; margin-bottom: 0.85rem; }
.vx-st-intro-text { min-width: 0; flex: 1 1 320px; }
.vx-st-intro-text p { margin: 0; color: var(--gray-600); font-size: 0.88rem; max-width: 75ch; }
.vx-st-h2 { display: flex; align-items: center; gap: 0.45rem; font-size: 1.1rem; font-weight: 700; color: var(--gray-800); margin: 0 0 0.2rem; }
.vx-st-h2 .vx-icon { color: var(--primary); }
.vx-st-intro-tools { display: flex; gap: 0.5rem; align-items: center; }

.vx-st-search { display: inline-flex; align-items: center; gap: 0.4rem; background: var(--bg); border: 1.5px solid var(--gray-200); border-radius: var(--radius); padding: 0 0.65rem; color: var(--gray-400); min-width: 240px; }
.vx-st-search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(2,132,199,0.15); }
.vx-st-search input { border: 0; outline: 0; background: transparent; padding: 0.5rem 0; font: inherit; font-size: 0.86rem; color: var(--gray-800); width: 100%; }
.vx-st-search--sm { min-width: 220px; }
.vx-st-search--sm input { padding: 0.36rem 0; font-size: 0.8rem; }

.vx-st-jump { display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; margin: -0.2rem 0 0.9rem; font-size: 0.8rem; }
.vx-st-jump > span { color: var(--gray-500); font-weight: 600; margin-right: 0.15rem; }
.vx-st-jump a { padding: 0.2rem 0.6rem; border: 1px solid var(--gray-200); border-radius: 999px; background: var(--bg); color: var(--gray-700); text-decoration: none; font-weight: 600; }
.vx-st-jump a:hover { border-color: var(--primary-mid); color: var(--primary-dark); }

.vx-st-anchor { scroll-margin-top: 72px; }
.vx-st-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 1rem; align-items: start; }
.vx-st-col, .vx-st-rail, .vx-st-full { min-width: 0; }
@container vxst (min-width: 1000px) {
    .vx-st-grid { grid-template-columns: minmax(0, 1fr) 320px; }
}

/* ── Variant B: side navigation ─────────────────────────────────────── */
.vx-st-split { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.vx-st-side { position: sticky; top: 72px; }
.vx-st-side-nav { background: var(--bg); border: 1px solid var(--gray-200); border-radius: var(--radius); box-shadow: var(--shadow); padding: 0.5rem; }
.vx-st-side-group + .vx-st-side-group { border-top: 1px solid var(--gray-100); margin-top: 0.4rem; padding-top: 0.4rem; }
.vx-st-side-head { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--gray-500); padding: 0.45rem 0.6rem 0.3rem; }
.vx-st-side-link { display: flex; align-items: center; gap: 0.55rem; padding: 0.5rem 0.6rem; border-radius: 8px; color: var(--gray-700); text-decoration: none; font-size: 0.88rem; font-weight: 600; }
.vx-st-side-link span:not(.vx-st-side-count) { flex: 1; min-width: 0; }
.vx-st-side-link:hover { background: var(--gray-100); color: var(--gray-900); }
.vx-st-side-link:focus-visible, .vx-st-side-anchors a:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.vx-st-side-link.on { background: var(--primary-light); color: var(--primary-dark); }
.vx-st-side-link.on .vx-st-side-count { background: var(--bg); color: var(--primary-dark); }
.vx-st-side-anchors { list-style: none; margin: 0.15rem 0 0.35rem 1.45rem; padding: 0; border-left: 1px solid var(--gray-200); }
.vx-st-side-anchors a { display: block; padding: 0.28rem 0.7rem; margin-left: -1px; border-left: 2px solid transparent; font-size: 0.8rem; color: var(--gray-500); text-decoration: none; }
.vx-st-side-anchors a:hover { color: var(--gray-800); }
.vx-st-side-anchors a.on { color: var(--primary-dark); border-left-color: var(--primary); font-weight: 600; }
.vx-st-side-select { display: none; }
.vx-st-side-select-label { display: block; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--gray-500); margin-bottom: 0.3rem; }
@media (max-width: 900px) {
    .vx-st-split { grid-template-columns: minmax(0, 1fr); gap: 0.75rem; }
    .vx-st-side { position: static; }
    .vx-st-side-nav { display: none; }
    .vx-st-side-select { display: block; }
}

/* ── Banners, rows, legends ─────────────────────────────────────────── */
.vx-st-banner { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.7rem 0.9rem; border-radius: var(--radius); font-size: 0.84rem; line-height: 1.45; margin-bottom: 1rem; border: 1px solid var(--vx-blue-line); background: var(--vx-blue-bg); color: var(--vx-blue-fg); }
.vx-st-banner .vx-icon { margin-top: 0.1rem; }
.vx-st-banner a, .vx-st-banner .vx-linkbtn { color: inherit; text-decoration: underline; font-size: inherit; }
.vx-st-banner--lock { border-color: var(--vx-amber-line); background: var(--vx-amber-bg); color: var(--vx-amber-fg); }
.vx-st-banner code { font-size: 0.8em; background: rgba(0,0,0,0.06); padding: 0 0.25rem; border-radius: 3px; }

.vx-st-row { border-bottom: 1px solid var(--gray-100); }
.vx-st-row:last-child { border-bottom: 0; }
.vx-st-row > .vx-setting { border-bottom: 0; }
.vx-st-native { display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; font-size: 0.75rem; color: var(--gray-500); margin: -0.35rem 0 0.7rem; }
.vx-st-native--block { color: var(--vx-amber-fg); }

.vx-st-subject { display: flex; align-items: center; gap: 0.5rem 0.75rem; flex-wrap: wrap; padding: 0.75rem 1rem; margin-bottom: 1rem; }
.vx-st-subject-label { font-size: 0.85rem; font-weight: 700; color: var(--gray-700); }
.vx-st-subject select { width: auto; min-width: 240px; padding: 0.42rem 0.6rem; font-size: 0.86rem; }
.vx-st-subject-hint { font-size: 0.78rem; color: var(--gray-500); }

.vx-st-linkrow .vx-setting-meta { gap: 0.75rem; }
.vx-st-sigpart { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.75rem; color: var(--gray-500); }
.vx-st-agenthead { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; padding: 0.15rem 0 0.5rem; border-bottom: 1px solid var(--gray-100); }
.vx-st-agentnote { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.76rem; color: var(--gray-500); }

.vx-st-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.55rem; }
.vx-st-legend li > span:first-child { white-space: nowrap; }
.vx-st-legend li { display: grid; grid-template-columns: 1fr; gap: 0.6rem; align-items: start; font-size: 0.8rem; color: var(--gray-600); }
.vx-st-legend li > span:first-child { justify-self: start; }
.vx-st-legend-link { font-size: 0.75rem; font-weight: 600; color: var(--primary-dark); }
.vx-st-fine { font-size: 0.75rem; color: var(--gray-500); margin: 0.7rem 0 0; line-height: 1.45; }
.vx-st-fine--top { margin: 0 0 0.7rem; }
.vx-st-fine--center { text-align: center; }
.vx-st-fine .vx-icon { vertical-align: -2px; }

.vx-st-native-list, .vx-st-changes, .vx-st-phlist, .vx-st-chain { list-style: none; margin: 0; padding: 0; }
.vx-st-native-list li { display: grid; grid-template-columns: 1fr auto; gap: 0.1rem 0.6rem; padding: 0.4rem 0; border-bottom: 1px dashed var(--gray-100); font-size: 0.8rem; }
.vx-st-native-list li:last-child { border-bottom: 0; }
.vx-st-native-list a { color: var(--gray-700); text-decoration: none; }
.vx-st-native-list a:hover { color: var(--primary-dark); text-decoration: underline; }
.vx-st-native-list b { color: var(--gray-800); white-space: nowrap; }
.vx-st-native-list small { grid-column: 1 / -1; color: var(--gray-500); font-size: 0.72rem; }
.vx-st-native-av { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--gray-100); color: var(--gray-500); border: 1px solid var(--gray-200); flex-shrink: 0; }

.vx-st-changes li { display: flex; gap: 0.6rem; padding: 0.55rem 0; border-bottom: 1px solid var(--gray-100); font-size: 0.8rem; color: var(--gray-700); }
.vx-st-changes li:last-child { border-bottom: 0; }
.vx-st-changes li > div { min-width: 0; }
.vx-st-change-main b { color: var(--gray-800); }
.vx-st-change-sub { color: var(--gray-500); font-size: 0.74rem; margin-top: 0.1rem; }
.vx-st-reason { margin-top: 0.25rem; font-size: 0.76rem; color: var(--gray-600); font-style: italic; border-left: 2px solid var(--gray-200); padding-left: 0.45rem; }
.vx-st-more { margin-top: 0.4rem; }

/* ── Tables (shared) ────────────────────────────────────────────────── */
.vx-st-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.vx-st-table th, .vx-st-table td { text-align: left; vertical-align: top; padding: 0.7rem 1rem; border-bottom: 1px solid var(--gray-100); }
.vx-st-table thead th { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--gray-500); background: var(--gray-50); border-bottom: 1px solid var(--gray-200); white-space: nowrap; padding-top: 0.55rem; padding-bottom: 0.55rem; }
.vx-st-table thead th .vx-icon { vertical-align: -2px; margin-right: 0.15rem; }
.vx-st-table tbody tr:last-child > * { border-bottom: 0; }
.vx-st-table tbody tr:hover > * { background: var(--vx-row-hover); }
.vx-st-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.vx-st-cellsub { font-size: 0.74rem; color: var(--gray-500); margin-top: 0.15rem; }
.vx-st-dim > * { opacity: 0.62; }
.vx-st-namebtn { border: 0; background: none; padding: 0; font: inherit; font-weight: 700; color: var(--primary-dark); cursor: pointer; text-align: left; }
.vx-st-namebtn:hover { text-decoration: underline; }
.vx-st-namebtn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 3px; }

/* ── Templates ──────────────────────────────────────────────────────── */
.vx-st-tplhead { flex-wrap: wrap; }
.vx-st-inline-select { display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.8rem; font-weight: 600; color: var(--gray-600); }
.vx-st-inline-select select { width: auto; min-width: 220px; padding: 0.36rem 0.55rem; font-size: 0.82rem; }
.vx-st-tplnote { display: flex; align-items: center; gap: 0.4rem; padding: 0.55rem 1.15rem; font-size: 0.8rem; color: var(--vx-indigo-fg); background: var(--vx-indigo-bg); border-bottom: 1px solid var(--vx-indigo-line); }
.vx-st-tpltable tbody th { width: 30%; font-weight: 400; }
.vx-st-tpltable td { width: 35%; padding: 0.55rem 0.6rem; }
.vx-st-kind { font-weight: 700; color: var(--gray-800); font-size: 0.86rem; }
.vx-st-kind-hint { font-size: 0.74rem; color: var(--gray-500); margin-top: 0.1rem; }
.vx-st-cell { display: flex; flex-direction: column; gap: 0.3rem; width: 100%; text-align: left; border: 1px solid var(--gray-200); background: var(--bg); border-radius: 8px; padding: 0.5rem 0.65rem; cursor: pointer; font: inherit; color: inherit; transition: border-color 0.12s, box-shadow 0.12s; }
.vx-st-cell:hover { border-color: var(--primary-mid); box-shadow: var(--shadow); }
.vx-st-cell:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.vx-st-cell--mine { border-left: 3px solid var(--vx-blue-line); }
.vx-st-cell-top { display: flex; align-items: center; justify-content: space-between; gap: 0.4rem; }
.vx-st-cell-when { font-size: 0.7rem; color: var(--gray-500); white-space: nowrap; }
.vx-st-cell-snip { font-size: 0.78rem; color: var(--gray-600); line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.vx-st-cell-warn { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.7rem; color: var(--vx-amber-fg); }
.vx-st-tplcards { display: none; list-style: none; margin: 0; padding: 0; }
.vx-st-tplcards > li { padding: 0.75rem 1rem; border-bottom: 1px solid var(--gray-100); }
.vx-st-tplcards-cells { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin-top: 0.5rem; }
.vx-st-chan { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--gray-500); margin-bottom: 0.25rem; }
.vx-st-chain li { display: flex; flex-direction: column; gap: 0.25rem; padding: 0.45rem 0 0.45rem 0.8rem; border-left: 2px solid var(--gray-200); font-size: 0.8rem; color: var(--gray-600); }
.vx-st-chain li > span:first-child { align-self: flex-start; }
.vx-st-phlist li { display: flex; flex-direction: column; gap: 0.15rem; align-items: flex-start; padding: 0.3rem 0; font-size: 0.74rem; }

.vx-st-tok { display: inline-flex; align-items: center; gap: 0.2rem; padding: 0.05rem 0.45rem; border-radius: 5px; font-size: 0.78em; font-weight: 600; background: var(--vx-indigo-bg); color: var(--vx-indigo-fg); border: 1px solid var(--vx-indigo-line); white-space: nowrap; vertical-align: baseline; line-height: 1.5; }
.vx-st-tok--btn { cursor: pointer; font: inherit; font-size: 0.74rem; font-weight: 600; }
.vx-st-tok--btn:hover { border-color: var(--vx-indigo-fg); }
.vx-st-tok--btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }

/* Template editor drawer */
.vx-st-ed { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.vx-st-ed-main { min-width: 0; }
.vx-st-ed-hint { margin: 0 0 0.75rem; font-size: 0.84rem; color: var(--gray-500); }
.vx-st-trail { list-style: none; margin: 0; padding: 0; display: flex; align-items: stretch; gap: 0; }
.vx-st-trail li { display: flex; align-items: center; flex: 1; min-width: 0; }
.vx-st-trail-arrow { color: var(--gray-400); padding: 0 0.15rem; flex-shrink: 0; }
.vx-st-step { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.25rem; text-align: left; border: 1px solid var(--gray-200); border-radius: 8px; background: var(--bg); padding: 0.5rem 0.6rem; cursor: pointer; font: inherit; color: inherit; height: 100%; }
.vx-st-step:hover { border-color: var(--primary-mid); }
.vx-st-step:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.vx-st-step.empty { border-style: dashed; background: var(--gray-50); }
.vx-st-step.empty .vx-st-step-name { color: var(--gray-500); }
.vx-st-step.wins { border-color: var(--vx-green-line); }
.vx-st-step.on { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-light); }
.vx-st-step-top { display: flex; align-items: center; justify-content: space-between; gap: 0.3rem; }
.vx-st-step-name { font-weight: 700; font-size: 0.82rem; color: var(--gray-800); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vx-st-step-state { display: inline-flex; align-items: center; gap: 0.2rem; font-size: 0.7rem; color: var(--gray-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vx-st-applies { display: inline-flex; align-items: center; gap: 0.15rem; font-size: 0.64rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--vx-green-fg); background: var(--vx-green-bg); border-radius: 4px; padding: 0.02rem 0.3rem; flex-shrink: 0; }
.vx-st-why { display: flex; gap: 0.4rem; align-items: flex-start; font-size: 0.82rem; color: var(--gray-700); margin: 0.65rem 0 0.85rem; }
.vx-st-why .vx-icon { margin-top: 0.15rem; color: var(--primary); }

.vx-st-lock { display: flex; gap: 0.75rem; align-items: flex-start; padding: 0.7rem 0.85rem; border: 1px solid var(--gray-200); border-radius: var(--radius); background: var(--gray-50); margin-bottom: 1rem; }
.vx-st-lock.on { border-color: var(--vx-amber-line); background: var(--vx-amber-bg); }
.vx-st-lock p { margin: 0.15rem 0 0; font-size: 0.78rem; color: var(--gray-600); }
.vx-st-lock.on p, .vx-st-lock.on .vx-st-lock-title { color: var(--vx-amber-fg); }
.vx-st-lock-title { display: flex; align-items: center; gap: 0.3rem; font-weight: 700; font-size: 0.84rem; color: var(--gray-800); }

.vx-st-fields .form-group { margin-bottom: 0.85rem; }
.vx-st-bodyhead { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; }
.vx-st-bodyhint { font-size: 0.72rem; color: var(--gray-500); }
.vx-st-palette { display: flex; flex-wrap: wrap; gap: 0.3rem; align-items: center; margin-bottom: 0.5rem; }
.vx-st-palette-label { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--gray-500); margin-right: 0.15rem; }
.vx-st-ro { border: 1px dashed var(--gray-300); border-radius: var(--radius); padding: 0.65rem 0.8rem; background: var(--gray-50); font-size: 0.88rem; color: var(--gray-700); line-height: 1.55; overflow-wrap: anywhere; }
.vx-st-ro p { margin: 0 0 0.5rem; }
.vx-st-ro p:last-child { margin-bottom: 0; }
.vx-st-ro--line { padding: 0.5rem 0.8rem; }
.vx-st-smsarea { font-size: 0.9rem; line-height: 1.5; resize: vertical; }

.vx-st-rte .rich-text-editor-wrap { border: 1.5px solid var(--gray-200); border-radius: var(--radius); overflow: hidden; background: var(--bg); }
.vx-st-rte .rich-text-editor-wrap:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(2,132,199,0.15); }
.vx-st-rte .ql-toolbar.ql-snow { border: 0; border-bottom: 1px solid var(--gray-200); background: var(--gray-50); }
.vx-st-rte .ql-container.ql-snow { border: 0; font-family: inherit; font-size: 0.9rem; }
.vx-st-rte .ql-editor { min-height: 190px; color: var(--gray-800); line-height: 1.55; }
.vx-st-qtok { display: inline-block; padding: 0 0.4rem; margin: 0 1px; border-radius: 5px; font-size: 0.82em; font-weight: 600; background: var(--vx-indigo-bg); color: var(--vx-indigo-fg); border: 1px solid var(--vx-indigo-line); line-height: 1.45; user-select: all; white-space: nowrap; }
[data-theme="dark"] .vx-st-rte .ql-snow .ql-stroke { stroke: var(--gray-600); }
[data-theme="dark"] .vx-st-rte .ql-snow .ql-fill { fill: var(--gray-600); }
[data-theme="dark"] .vx-st-rte .ql-snow button:hover .ql-stroke, [data-theme="dark"] .vx-st-rte .ql-snow button.ql-active .ql-stroke { stroke: var(--primary); }
[data-theme="dark"] .vx-st-rte .ql-snow button:hover .ql-fill, [data-theme="dark"] .vx-st-rte .ql-snow button.ql-active .ql-fill { fill: var(--primary); }
[data-theme="dark"] .vx-st-rte .ql-editor.ql-blank::before { color: var(--gray-500); }

/* Preview */
.vx-st-ed-preview { min-width: 0; background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 0.85rem; position: sticky; top: 0; }
.vx-st-prevhead { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.4rem; }
.vx-st-prevtitle { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.74rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--gray-600); }
.vx-st-sample { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.76rem; color: var(--gray-500); min-width: 0; }
.vx-st-sample select { width: auto; max-width: 240px; padding: 0.3rem 0.45rem; font-size: 0.78rem; }
.vx-st-mail { background: var(--bg); border: 1px solid var(--gray-200); border-radius: 8px; box-shadow: var(--shadow); overflow: hidden; }
.vx-st-mail-head { margin: 0; padding: 0.6rem 0.85rem; border-bottom: 1px solid var(--gray-100); font-size: 0.8rem; display: flex; flex-direction: column; gap: 0.2rem; }
.vx-st-mail-head > div { display: flex; gap: 0.5rem; min-width: 0; }
.vx-st-mail-head dt { width: 52px; flex-shrink: 0; color: var(--gray-500); }
.vx-st-mail-head dd { margin: 0; color: var(--gray-800); min-width: 0; overflow-wrap: anywhere; }
.vx-st-mail-body { padding: 0.85rem; font-size: 0.88rem; line-height: 1.55; color: var(--gray-800); overflow-wrap: anywhere; }
.vx-st-mail-body p { margin: 0 0 0.6rem; }
.vx-st-mail-body p:last-child { margin-bottom: 0; }
.vx-st-mail-body ul, .vx-st-mail-body ol { margin: 0 0 0.6rem 1.2rem; }
.vx-st-phone { background: var(--bg); border: 1px solid var(--gray-200); border-radius: 18px; padding: 0.85rem; box-shadow: var(--shadow); }
.vx-st-phone-to { font-size: 0.72rem; color: var(--gray-500); text-align: center; margin-bottom: 0.6rem; }
.vx-st-bubble { background: var(--vx-blue-bg); color: var(--vx-blue-fg); border-radius: 16px 16px 4px 16px; padding: 0.6rem 0.8rem; font-size: 0.88rem; line-height: 1.45; margin-left: 12%; overflow-wrap: anywhere; }
.vx-st-bubble .vx-token { white-space: normal; }
.vx-st-segs { margin-top: 0.75rem; }
.vx-st-segbar { height: 6px; border-radius: 3px; background: var(--gray-100); overflow: hidden; }
.vx-st-segbar span { display: block; height: 100%; background: var(--primary); border-radius: 3px; }
.vx-st-segtext { font-size: 0.76rem; color: var(--gray-600); margin-top: 0.35rem; }
.vx-st-segtext b { color: var(--gray-800); font-variant-numeric: tabular-nums; }
.vx-st-segwarn { display: flex; gap: 0.35rem; align-items: flex-start; font-size: 0.75rem; color: var(--vx-amber-fg); background: var(--vx-amber-bg); border-radius: 6px; padding: 0.4rem 0.55rem; margin-top: 0.45rem; }

/* Drawer footers */
.vx-st-foot-msg { margin-right: auto; display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.82rem; color: var(--gray-600); }
.vx-st-foot-msg--err { color: var(--vx-red-fg); }
.vx-st-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--vx-warning); }
.vx-drawer-foot { flex-wrap: wrap; align-items: center; }
.vx-st-modal-p { font-size: 0.86rem; color: var(--gray-600); margin: 0 0 0.75rem; }

/* ── Promotions ─────────────────────────────────────────────────────── */
.vx-st-promohead, .vx-st-suphead { flex-wrap: wrap; }
.vx-st-mode { font-weight: 600; color: var(--gray-800); }
.vx-st-prod { color: var(--gray-800); }
.vx-st-pstats { display: inline-flex; gap: 0.7rem; flex-wrap: wrap; font-size: 0.78rem; color: var(--gray-500); white-space: nowrap; }
.vx-st-pstats b { color: var(--gray-800); font-variant-numeric: tabular-nums; }
.vx-st-activecell { display: flex; align-items: center; gap: 0.6rem; justify-content: flex-end; }
.vx-st-promotable td:last-child, .vx-st-promotable th:last-child { text-align: right; }
.vx-st-promocards, .vx-st-supcards { display: none; list-style: none; margin: 0; padding: 0; }
.vx-st-promocards > li, .vx-st-supcards > li { padding: 0.8rem 1rem; border-bottom: 1px solid var(--gray-100); display: flex; flex-direction: column; gap: 0.35rem; }
.vx-st-promocard-top, .vx-st-supcard-top { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.vx-st-promocard-meta { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; font-size: 0.78rem; color: var(--gray-600); }
.vx-st-promocard-stats { display: flex; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; font-size: 0.78rem; color: var(--gray-600); }

.vx-st-ped { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.vx-st-ped-form, .vx-st-ped-side { min-width: 0; }
.vx-st-ped-side { position: sticky; top: 0; display: flex; flex-direction: column; gap: 0.75rem; }
.vx-st-ped-status { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; font-size: 0.8rem; margin-bottom: 0.85rem; }
.vx-st-err { font-size: 0.78rem; color: var(--vx-red-fg); margin-top: 0.3rem; }
.vx-st-warntext { color: var(--vx-amber-fg); }
.vx-st-pickedprod { display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 0.75rem; border: 1px solid var(--gray-200); border-radius: var(--radius); background: var(--gray-50); }
.vx-st-pickedprod > div { flex: 1; min-width: 0; }
.vx-st-erpprice { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.8rem; font-weight: 600; color: var(--gray-600); white-space: nowrap; font-variant-numeric: tabular-nums; }
.vx-st-psearch { position: relative; display: flex; align-items: center; }
.vx-st-psearch > .vx-icon { position: absolute; left: 0.7rem; color: var(--gray-400); pointer-events: none; }
.vx-st-psearch input { padding-left: 2rem; }
.vx-st-psearch-list { position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; right: 0; list-style: none; margin: 0; padding: 0.25rem; background: var(--bg); border: 1px solid var(--gray-200); border-radius: var(--radius); box-shadow: var(--shadow-lg); max-height: 280px; overflow-y: auto; }
.vx-st-psearch-list button { display: flex; flex-direction: column; gap: 0.1rem; width: 100%; text-align: left; border: 0; background: none; padding: 0.45rem 0.6rem; border-radius: 6px; cursor: pointer; font: inherit; color: var(--gray-800); }
.vx-st-psearch-list button:hover, .vx-st-psearch-list button:focus-visible { background: var(--primary-light); outline: none; }
.vx-st-psearch-list button b { font-size: 0.86rem; font-weight: 600; }
.vx-st-psearch-list button span { font-size: 0.74rem; color: var(--gray-500); }
.vx-st-psearch-none { padding: 0.5rem 0.6rem; font-size: 0.8rem; color: var(--gray-500); }
.vx-st-modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; }
.vx-st-modebtn { display: flex; gap: 0.5rem; align-items: flex-start; text-align: left; border: 1.5px solid var(--gray-200); border-radius: var(--radius); background: var(--bg); padding: 0.55rem 0.65rem; cursor: pointer; font: inherit; color: var(--gray-700); }
.vx-st-modebtn .vx-icon { margin-top: 0.1rem; color: var(--gray-400); }
.vx-st-modebtn b { display: block; font-size: 0.84rem; color: var(--gray-800); }
.vx-st-modebtn small { display: block; font-size: 0.72rem; color: var(--gray-500); line-height: 1.35; margin-top: 0.1rem; }
.vx-st-modebtn.on { border-color: var(--primary); background: var(--primary-light); }
.vx-st-modebtn.on .vx-icon { color: var(--primary); }
.vx-st-modebtn:disabled { cursor: default; }
.vx-st-modebtn:focus-visible, .vx-st-cat:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.vx-st-sub { padding: 0.75rem; border-left: 3px solid var(--primary-light); background: var(--gray-50); border-radius: 0 var(--radius) var(--radius) 0; }
.vx-st-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.5rem; }
.vx-st-chip { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.15rem 0.3rem 0.15rem 0.6rem; border-radius: 999px; background: var(--bg); border: 1px solid var(--gray-200); font-size: 0.78rem; color: var(--gray-700); }
.vx-st-chip button { border: 0; background: none; color: var(--gray-500); cursor: pointer; padding: 0.1rem; display: inline-flex; border-radius: 50%; }
.vx-st-chip button:hover { color: var(--vx-red-fg); background: var(--vx-red-bg); }
.vx-st-none { font-size: 0.8rem; }
.vx-st-label-gap { margin-top: 0.75rem; }
.vx-st-cats { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.vx-st-cat { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.22rem 0.6rem; border-radius: 999px; border: 1px solid var(--gray-200); background: var(--bg); font: inherit; font-size: 0.76rem; color: var(--gray-600); cursor: pointer; }
.vx-st-cat.on { border-color: var(--primary); background: var(--primary-light); color: var(--primary-dark); font-weight: 600; }
.vx-st-dates { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.vx-st-activerow { display: flex; gap: 0.7rem; align-items: flex-start; margin-bottom: 1rem; font-size: 0.86rem; }
.vx-st-activerow .vx-st-fine { margin-top: 0.1rem; }
.vx-st-proposed-field { padding-top: 0.85rem; border-top: 1px dashed var(--gray-200); }
.vx-st-proposed-field .form-label { display: flex; align-items: center; gap: 0.4rem; }
.vx-st-pct { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--gray-500); }
.vx-st-pct input { width: 100px; }

.vx-st-est, .vx-st-lineprev { background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 0.8rem 0.9rem; font-size: 0.82rem; color: var(--gray-700); }
.vx-st-est p { margin: 0.4rem 0 0; }
.vx-st-est-label { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--gray-500); margin-bottom: 0.35rem; }
.vx-st-est-big { display: flex; align-items: baseline; gap: 0.4rem; font-size: 0.9rem; color: var(--gray-700); font-weight: 600; }
.vx-st-est-big b { font-size: 1.8rem; font-weight: 700; color: var(--gray-900); line-height: 1; font-variant-numeric: tabular-nums; }
.vx-st-est-big .vx-icon { color: var(--primary); align-self: center; }
.vx-st-est-names { font-size: 0.78rem; color: var(--gray-600); }
.vx-st-est-why { list-style: none; margin: 0.6rem 0 0; padding: 0; }
.vx-st-est-why li { display: flex; justify-content: space-between; gap: 0.5rem; padding: 0.2rem 0; border-bottom: 1px dashed var(--gray-200); }
.vx-st-est-why li:last-child { border-bottom: 0; }
.vx-st-est-why b { font-variant-numeric: tabular-nums; color: var(--gray-800); }
.vx-st-goldline { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; padding: 0.55rem 0.7rem; border: 1px solid var(--vx-gold-line); background: var(--vx-gold-bg); border-radius: 8px; color: var(--vx-gold-fg); }
.vx-st-goldline b { display: block; margin-top: 0.2rem; color: var(--gray-800); font-size: 0.84rem; }
.vx-st-goldline .vx-st-cellsub { color: var(--vx-gold-fg); }
.vx-st-goldline .vx-st-erpprice { color: var(--vx-gold-fg); }

/* ── Suppression ────────────────────────────────────────────────────── */
.vx-st-addr { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 600; color: var(--gray-800); overflow-wrap: anywhere; }
.vx-st-addr .vx-icon { color: var(--gray-500); }
.vx-st-evid { font-size: 0.8rem; color: var(--gray-600); max-width: 34ch; }
.vx-st-liftcell { text-align: right; width: 1%; white-space: nowrap; }
.vx-st-liftbtn { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.25rem 0.55rem; border: 1px dashed var(--gray-300); border-radius: 7px; font-size: 0.76rem; font-weight: 600; color: var(--gray-500); }
.vx-st-liftbtn:hover { color: var(--gray-700); border-color: var(--gray-400); }
.vx-st-new > *, li.vx-st-new { animation: vxStFlash 3.5s ease; }
@keyframes vxStFlash { 0%, 40% { background: var(--vx-green-bg); } 100% { background: transparent; } }

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 1000px) {
    .vx-st-ed, .vx-st-ped { grid-template-columns: minmax(0, 1fr); }
    .vx-st-ed-preview, .vx-st-ped-side { position: static; }
}
@media (max-width: 760px) {
    .vx-st-tpltable, .vx-st-promotable, .vx-st-suptable { display: none; }
    .vx-st-tplcards, .vx-st-promocards, .vx-st-supcards { display: block; }
    .vx-st-search { min-width: 0; width: 100%; }
    .vx-st-intro-tools { width: 100%; }
    .vx-st-modes { grid-template-columns: minmax(0, 1fr); }
    .vx-st-trail { flex-direction: column; gap: 0.35rem; }
    .vx-st-trail li { width: 100%; }
    .vx-st-trail-arrow { display: none; }
    .vx-st-subject select, .vx-st-inline-select select { min-width: 0; width: 100%; }
    .vx-st-inline-select { width: 100%; flex-wrap: wrap; }
    .vx-st-legend li { grid-template-columns: 1fr; gap: 0.2rem; }
    .vx-card-actions .vx-st-search--sm { width: 100%; }
}
@media (max-width: 420px) {
    .vx-st-tplcards-cells, .vx-st-dates { grid-template-columns: minmax(0, 1fr); }
}

/* ---- 80-notifications.css ---- */
/* =====================================================================
   SR6 notification centre — header bell, panel (dropdown / drawer /
   sheet), toasts and the /vision/notifications page. Prefix .vx-nt-
   ===================================================================== */

/* ── Bell button (matches .cart-btn / .sync-header-btn) ─────────────── */
.vx-nt-wrap { position: relative; flex-shrink: 0; display: inline-flex; }
.vx-nt-bell { display: inline-flex; align-items: center; justify-content: center; position: relative; width: 36px; height: 32px; border: none; border-radius: 0; background: transparent; color: var(--gray-500); cursor: pointer; transition: background 0.15s, color 0.15s; }
.vx-nt-bell:hover, .vx-nt-bell.active { background: var(--gray-100); color: var(--gray-800); }
.vx-nt-bell.has-action { color: var(--gray-700); }
.vx-nt-bell:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.vx-nt-badge { position: absolute; top: 0; right: 0; min-width: 16px; height: 16px; padding: 0 4px; background: #ef4444; color: #fff; border-radius: 8px; font-size: 0.65rem; font-weight: 700; line-height: 16px; text-align: center; pointer-events: none; box-shadow: 0 0 0 2px var(--bg); }
.vx-nt-badge--moon { display: inline-flex; align-items: center; justify-content: center; width: 16px; padding: 0; background: #6366f1; }
.vx-nt-dot { position: absolute; top: 5px; right: 8px; width: 9px; height: 9px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 2px var(--bg); pointer-events: none; }

@media (max-width: 768px) {
    .header .vx-nt-wrap { margin-left: auto; }
    .header .vx-nt-wrap ~ .hamburger-btn { margin-left: 0; }
    .header .vx-nt-bell { color: rgba(255,255,255,0.75); }
    .header .vx-nt-bell:hover, .header .vx-nt-bell.active { background: rgba(255,255,255,0.1); color: #fff; }
    .header .vx-nt-badge, .header .vx-nt-dot { box-shadow: 0 0 0 2px #0e1f30; }
    .header .vx-nt-dot { background: #38bdf8; }
}

/* ── Panel ──────────────────────────────────────────────────────────── */
.vx-nt-panel { display: flex; flex-direction: column; background: var(--bg); color: var(--gray-800); outline: none; text-align: left; }
.vx-nt-panel :focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.vx-nt-panel--dropdown { position: fixed; z-index: 1200; top: 64px; right: 16px; width: min(400px, calc(100vw - 16px)); max-height: min(660px, calc(100vh - 80px)); border: 1px solid var(--gray-200); border-radius: var(--radius); box-shadow: 0 14px 40px rgba(2,132,199,0.16), 0 2px 8px rgba(0,0,0,0.08); animation: vxNtDrop 0.14s ease; }
[data-theme="dark"] .vx-nt-panel--dropdown { box-shadow: 0 14px 40px rgba(0,0,0,0.55), 0 2px 8px rgba(0,0,0,0.4); }
.vx-nt-panel--dropdown::before { content: ''; position: absolute; top: -7px; right: var(--vx-nt-caret, 20px); width: 12px; height: 12px; background: var(--bg); border-left: 1px solid var(--gray-200); border-top: 1px solid var(--gray-200); transform: rotate(45deg); }
.vx-nt-backdrop { position: fixed; inset: 0; z-index: 1200; background: rgba(8, 20, 33, 0.35); display: flex; justify-content: flex-end; animation: vxNtFade 0.12s ease; }
.vx-nt-panel--drawer { height: 100%; width: min(440px, 100vw); border-left: 1px solid var(--gray-200); box-shadow: -12px 0 40px rgba(0,0,0,0.25); animation: vxNtSlide 0.18s ease; }
.vx-nt-panel--sheet { width: 100%; height: 100%; animation: vxNtUp 0.18s ease; }
@keyframes vxNtDrop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes vxNtFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes vxNtSlide { from { transform: translateX(28px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes vxNtUp { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }

.vx-nt-head { display: flex; align-items: center; gap: 0.5rem; padding: 0.7rem 0.75rem 0.55rem 1rem; }
.vx-nt-h { flex: 1; margin: 0; font-size: 1rem; font-weight: 700; color: var(--gray-900); letter-spacing: -0.01em; }
.vx-nt-head-actions { display: flex; align-items: center; gap: 0.15rem; }
.vx-nt-textbtn { border: 0; background: none; padding: 0.3rem 0.45rem; border-radius: 6px; font: inherit; font-size: 0.8rem; font-weight: 600; color: var(--primary-dark); cursor: pointer; white-space: nowrap; }
.vx-nt-textbtn:hover:not(:disabled) { background: var(--primary-light); }
.vx-nt-textbtn:disabled { color: var(--gray-400); cursor: default; }
.vx-nt-iconbtn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: 0; border-radius: 8px; background: none; color: var(--gray-500); cursor: pointer; text-decoration: none; }
.vx-nt-iconbtn:hover { background: var(--gray-100); color: var(--gray-800); }

.vx-nt-tabs { display: flex; gap: 0.25rem; padding: 0 0.85rem; border-bottom: 2px solid var(--gray-200); }
.vx-nt-tab { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.55rem 0.75rem; margin-bottom: -2px; border: 0; border-bottom: 2px solid transparent; background: none; font: inherit; font-size: 0.85rem; font-weight: 600; color: var(--gray-500); cursor: pointer; border-radius: var(--radius) var(--radius) 0 0; }
.vx-nt-tab:hover { color: var(--gray-700); background: var(--gray-50); }
.vx-nt-tab.on { color: var(--primary); border-bottom-color: var(--primary); background: var(--primary-light); }
.vx-nt-count { display: inline-block; font-size: 0.68rem; font-weight: 700; padding: 0 0.4rem; min-width: 18px; height: 18px; line-height: 18px; border-radius: 9px; background: var(--gray-200); color: var(--gray-700); text-align: center; }
.vx-nt-count--red { background: #ef4444; color: #fff; }
.vx-nt-count--blue { background: var(--vx-blue-bg); color: var(--vx-blue-fg); }

.vx-nt-pausebar { display: flex; align-items: center; gap: 0.45rem; margin: 0 0.85rem 0.5rem; padding: 0.35rem 0.4rem 0.35rem 0.6rem; border-radius: 8px; background: var(--vx-indigo-bg); color: var(--vx-indigo-fg); font-size: 0.78rem; }
.vx-nt-pausebar span { flex: 1; }
.vx-nt-pausebar .vx-nt-textbtn { color: var(--vx-indigo-fg); }

.vx-nt-focus { display: flex; align-items: center; gap: 0.65rem; margin: 0 0.85rem 0.6rem; padding: 0.55rem 0.7rem; border: 1px solid var(--gray-200); border-radius: var(--radius); background: var(--gray-50); }
.vx-nt-focus.is-on { background: var(--vx-indigo-bg); border-color: var(--vx-indigo-line); }
.vx-nt-focus--compact { margin: 0; }
.vx-nt-focus-ico { width: 28px; height: 28px; border-radius: 50%; background: var(--bg); color: #6366f1; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
[data-theme="dark"] .vx-nt-focus-ico { color: #a5b4fc; }
.vx-nt-focus-text { flex: 1; min-width: 0; }
.vx-nt-focus-title { display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; font-size: 0.82rem; font-weight: 600; color: var(--gray-800); }
.vx-nt-focus-sub { font-size: 0.74rem; color: var(--gray-500); }
.vx-nt-focus.is-on .vx-nt-focus-sub { color: var(--vx-indigo-fg); }

.vx-nt-chips { display: flex; gap: 0.35rem; flex-wrap: wrap; padding: 0 0.85rem 0.65rem; border-bottom: 1px solid var(--gray-200); }
.vx-nt-chip { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.28rem 0.65rem; border-radius: 999px; border: 1px solid var(--gray-200); background: var(--bg); color: var(--gray-600); font: inherit; font-size: 0.78rem; font-weight: 600; cursor: pointer; }
.vx-nt-chip:hover { border-color: var(--primary-mid); color: var(--gray-800); }
.vx-nt-chip.on { background: var(--primary-light); border-color: var(--primary); color: var(--primary-dark); }
.vx-nt-chip-count { font-size: 0.68rem; background: var(--gray-100); color: var(--gray-600); border-radius: 9px; padding: 0 0.35rem; min-width: 1.3em; text-align: center; }
.vx-nt-chip.on .vx-nt-chip-count { background: var(--bg); color: var(--primary-dark); }
.vx-nt-chip--alert .vx-nt-chip-count { background: #ef4444; color: #fff; }

/* ── Items ──────────────────────────────────────────────────────────── */
.vx-nt-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.vx-nt-list { list-style: none; margin: 0; padding: 0; }
.vx-nt-item { position: relative; display: flex; gap: 0.7rem; padding: 0.75rem 2.3rem 0.75rem 1rem; border-bottom: 1px solid var(--gray-100); transition: background 0.1s; }
.vx-nt-item:hover { background: var(--vx-row-hover); }
.vx-nt-item.is-new { background: color-mix(in srgb, var(--primary-light) 50%, var(--bg)); }
.vx-nt-item.is-new:hover { background: var(--vx-row-hover); }
.vx-nt-item.is-new::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--primary); }
.vx-nt-item.is-busy { opacity: 0.6; }
.vx-nt-ico { flex-shrink: 0; width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--vx-gray-bg); color: var(--vx-gray-fg); }
.vx-nt-ico--red { background: var(--vx-red-bg); color: var(--vx-red-fg); }
.vx-nt-ico--amber { background: var(--vx-amber-bg); color: var(--vx-amber-fg); }
.vx-nt-ico--blue { background: var(--vx-blue-bg); color: var(--vx-blue-fg); }
.vx-nt-ico--teal { background: var(--vx-teal-bg); color: var(--vx-teal-fg); }
.vx-nt-ico--indigo { background: var(--vx-indigo-bg); color: var(--vx-indigo-fg); }
.vx-nt-ico--green { background: var(--vx-green-bg); color: var(--vx-green-fg); }
.vx-nt-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.12rem; }
.vx-nt-title { font-size: 0.86rem; font-weight: 600; line-height: 1.35; color: var(--gray-800); text-decoration: none; }
.vx-nt-item.is-new .vx-nt-title { font-weight: 700; color: var(--gray-900); }
.vx-nt-stretch::after { content: ''; position: absolute; inset: 0; z-index: 0; }
.vx-nt-panel .vx-nt-stretch:focus-visible, .vx-nt-stretch:focus-visible { outline: none; }
.vx-nt-stretch:focus-visible::after { outline: 2px solid var(--primary); outline-offset: -2px; }
.vx-nt-body { font-size: 0.8rem; line-height: 1.4; color: var(--gray-600); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.vx-nt-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0 0.4rem; font-size: 0.72rem; color: var(--gray-500); }
.vx-nt-meta > span + span::before { content: '·'; margin-right: 0.4rem; color: var(--gray-400); }
.vx-nt-cust { font-weight: 600; color: var(--gray-700); }
.vx-nt-actions { position: relative; z-index: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin-top: 0.4rem; }
.vx-nt-act { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.26rem 0.65rem; border-radius: 7px; border: 1.5px solid var(--gray-300); background: var(--bg); color: var(--gray-700); font: inherit; font-size: 0.76rem; font-weight: 600; line-height: 1.3; cursor: pointer; text-decoration: none; }
.vx-nt-act:hover { background: var(--gray-100); border-color: var(--gray-400); color: var(--gray-900); }
.vx-nt-act:disabled { opacity: 0.55; cursor: progress; }
.vx-nt-act--primary { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); border-color: transparent; color: #fff; }
.vx-nt-act--primary:hover { background: linear-gradient(135deg, var(--primary-dark) 0%, #075985 100%); border-color: transparent; color: #fff; }
[data-theme="dark"] .vx-nt-act--primary, [data-theme="dark"] .vx-nt-act--primary:hover { color: #0c1a2e; }
.vx-nt-act--danger { border-color: var(--vx-red-line); color: var(--vx-red-fg); }
.vx-nt-act--link { border-color: transparent; background: none; color: var(--primary-dark); padding-left: 0.35rem; padding-right: 0.35rem; }
.vx-nt-act--link:hover { background: var(--primary-light); border-color: transparent; color: var(--primary-dark); }
.vx-nt-newdot { position: absolute; top: 1.05rem; right: 0.95rem; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); pointer-events: none; }
.vx-nt-x { position: absolute; z-index: 1; top: 0.55rem; right: 0.45rem; width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 6px; background: transparent; color: var(--gray-500); cursor: pointer; opacity: 0; transition: opacity 0.1s; }
.vx-nt-item:hover .vx-nt-x, .vx-nt-x:focus-visible { opacity: 1; }
.vx-nt-x:hover { background: var(--gray-200); color: var(--gray-800); }
.vx-nt-item--update:hover .vx-nt-newdot, .vx-nt-item--update:focus-within .vx-nt-newdot { opacity: 0; }
@media (hover: none) {
    .vx-nt-x { opacity: 1; }
    .vx-nt-item--update .vx-nt-newdot { top: auto; bottom: 1rem; opacity: 1 !important; }
}

.vx-nt-day { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 0.4rem; margin: 0; padding: 0.4rem 1rem; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--gray-500); background: var(--gray-50); border-bottom: 1px solid var(--gray-100); }
.vx-nt-day span { font-weight: 600; letter-spacing: 0; color: var(--gray-400); }

.vx-nt-flashwrap:empty { display: none; }
.vx-nt-flash { display: flex; align-items: center; gap: 0.45rem; margin: 0.5rem 0.85rem; padding: 0.45rem 0.65rem; border-radius: 8px; border: 1px solid var(--vx-green-line); background: var(--vx-green-bg); color: var(--vx-green-fg); font-size: 0.8rem; font-weight: 600; animation: vxNtFade 0.15s ease; }
.vx-nt-flash--error { border-color: var(--vx-red-line); background: var(--vx-red-bg); color: var(--vx-red-fg); }

.vx-nt-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0.35rem; padding: 2.25rem 1.5rem; }
.vx-nt-empty-ico { width: 44px; height: 44px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 0.25rem; background: var(--vx-green-bg); color: var(--vx-green-fg); }
.vx-nt-empty-title { font-size: 0.92rem; font-weight: 700; color: var(--gray-800); }
.vx-nt-empty-body { font-size: 0.8rem; color: var(--gray-500); max-width: 34ch; }

.vx-nt-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.6rem 1rem; border-top: 1px solid var(--gray-200); }
.vx-nt-panel--dropdown .vx-nt-foot { justify-content: center; }
.vx-nt-viewall { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.82rem; font-weight: 600; color: var(--primary-dark); text-decoration: none; }
.vx-nt-viewall:hover { text-decoration: underline; }
.vx-nt-foot-note { font-size: 0.72rem; color: var(--gray-500); }
.vx-nt-panel--sheet .vx-nt-foot { padding-bottom: calc(0.6rem + env(safe-area-inset-bottom, 0px)); }
.vx-nt-panel--sheet .vx-nt-item { padding-right: 2.6rem; }

/* ── Toasts ─────────────────────────────────────────────────────────── */
.vx-nt-toasts { position: fixed; right: 16px; bottom: 16px; z-index: 1300; display: flex; flex-direction: column; gap: 0.5rem; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.vx-nt-toast { --vx-nt-bar: var(--primary); pointer-events: auto; position: relative; display: flex; gap: 0.65rem; padding: 0.75rem 2.4rem 0.8rem 1rem; background: var(--bg); border: 1px solid var(--gray-200); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(0,0,0,0.16), 0 2px 6px rgba(0,0,0,0.08); overflow: hidden; animation: vxNtToastIn 0.2s ease; }
[data-theme="dark"] .vx-nt-toast { box-shadow: 0 12px 32px rgba(0,0,0,0.55); }
.vx-nt-toast::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--vx-nt-bar); }
.vx-nt-toast--red { --vx-nt-bar: var(--vx-critical); border-color: var(--vx-red-line); }
.vx-nt-toast--amber { --vx-nt-bar: #f59e0b; }
.vx-nt-toast--blue { --vx-nt-bar: var(--vx-c1); }
.vx-nt-toast--teal { --vx-nt-bar: #14b8a6; }
.vx-nt-toast--indigo { --vx-nt-bar: #6366f1; }
.vx-nt-toast--green { --vx-nt-bar: var(--vx-good); }
.vx-nt-toast--gray { --vx-nt-bar: var(--gray-400); }
.vx-nt-toast-main { flex: 1; min-width: 0; }
.vx-nt-toast-title { font-size: 0.86rem; font-weight: 700; line-height: 1.3; color: var(--gray-900); }
.vx-nt-toast-body { margin-top: 0.1rem; font-size: 0.8rem; color: var(--gray-600); }
.vx-nt-toast-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-top: 0.35rem; }
.vx-nt-toast-src { font-size: 0.7rem; color: var(--gray-500); }
.vx-nt-toast-open { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.15rem 0.45rem; border-radius: 6px; font-size: 0.78rem; font-weight: 700; color: var(--primary-dark); text-decoration: none; }
.vx-nt-toast-open:hover { background: var(--primary-light); }
.vx-nt-toast-x { position: absolute; top: 0.45rem; right: 0.45rem; width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 6px; background: none; color: var(--gray-500); cursor: pointer; }
.vx-nt-toast-x:hover { background: var(--gray-100); color: var(--gray-800); }
.vx-nt-toast :focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.vx-nt-toast-timer { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--vx-nt-bar); opacity: 0.55; transform-origin: left; animation-name: vxNtTimer; animation-timing-function: linear; animation-fill-mode: forwards; }
.vx-nt-toast.is-held .vx-nt-toast-timer { animation-play-state: paused; }
@keyframes vxNtTimer { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes vxNtToastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (max-width: 1180px) { .vx-nt-toasts { bottom: 60px; } }
@media (max-width: 768px) {
    .vx-nt-toasts { top: 64px; bottom: auto; left: 12px; right: 12px; width: auto; flex-direction: column-reverse; }
    .vx-nt-toast { animation-name: vxNtToastDown; }
}
@keyframes vxNtToastDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
    .vx-nt-panel, .vx-nt-backdrop, .vx-nt-toast, .vx-nt-flash { animation: none !important; }
}

/* ── /vision/notifications page ─────────────────────────────────────── */
.vx-nt-page { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1rem; align-items: start; }
.vx-nt-page-card { padding: 0; overflow: clip; margin-bottom: 1rem; }
.vx-nt-page-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem; padding: 0.8rem 1.15rem; border-bottom: 1px solid var(--gray-200); }
.vx-nt-kind { width: auto; min-width: 180px; padding: 0.4rem 0.6rem; font-size: 0.85rem; }
.vx-nt-page .vx-nt-item { padding-left: 1.15rem; padding-right: 2.6rem; }
.vx-nt-page .vx-nt-day { top: 56px; padding-left: 1.15rem; }
.vx-nt-page .vx-nt-flash { margin: 0.75rem 1.15rem 0; }
.vx-nt-page-side { display: flex; flex-direction: column; gap: 0; }
.vx-nt-kinds { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.75rem; }
.vx-nt-kinds li { display: flex; gap: 0.6rem; font-size: 0.82rem; color: var(--gray-600); line-height: 1.45; }
.vx-nt-kinds b { display: block; color: var(--gray-800); font-size: 0.85rem; }
.vx-nt-kinds .vx-nt-ico { width: 28px; height: 28px; }
.vx-nt-prefs { list-style: none; margin: 0 0 0.75rem; padding: 0; }
.vx-nt-prefs li { display: flex; justify-content: space-between; align-items: baseline; gap: 0.75rem; padding: 0.4rem 0; border-bottom: 1px dashed var(--gray-100); font-size: 0.82rem; }
.vx-nt-prefs li:last-child { border-bottom: 0; }
.vx-nt-prefs span { color: var(--gray-600); }
.vx-nt-prefs b { color: var(--gray-800); font-weight: 600; text-align: right; white-space: nowrap; }
.vx-nt-prefs small { display: block; font-weight: 500; color: var(--gray-500); font-size: 0.7rem; }
.vx-nt-side-note { font-size: 0.75rem; color: var(--gray-500); margin-top: 0.5rem; }
@media (max-width: 1100px) {
    .vx-nt-page { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .vx-nt-page-toolbar { padding: 0.7rem 0.85rem; }
    .vx-nt-page .vx-nt-item { padding-left: 0.85rem; }
    .vx-nt-page .vx-nt-day { padding-left: 0.85rem; }
    .vx-nt-page-toolbar .vx-seg { width: 100%; }
    .vx-nt-kind { width: 100%; }
}

/* ---- 90-customer-tab.css ---- */
/* =====================================================================
   Vision — Customer → Vision tab (.vx-ct-*). Also used embedded in the
   workspace's customer drawer (.vx-ct--embedded: always one column).
   ===================================================================== */

.vx-ct { display: flex; flex-direction: column; gap: 0; min-width: 0; }
.vx-ct--loading { padding: 1.5rem; }
.vx-ct-title h2 { font-size: 1.1rem; font-weight: 700; color: var(--gray-800); margin: 0; }
.vx-ct-title { margin-bottom: 0.75rem; }
.vx-ct-note { display: flex; gap: 0.45rem; align-items: center; font-size: 0.82rem; color: var(--vx-blue-fg); background: var(--vx-blue-bg); border: 1px solid var(--vx-blue-line); border-radius: var(--radius); padding: 0.45rem 0.75rem; margin-bottom: 0.75rem; }
.vx-ct-lbl { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--gray-500); }
.vx-ct-sub { font-size: 0.8rem; font-weight: 700; color: var(--gray-700); margin: 1rem 0 0.4rem; }
.vx-ct-sub .vx-muted { font-weight: 400; }
.vx-ct-stack { display: flex; flex-direction: column; min-width: 0; }
.vx-ct-single { min-width: 0; }

/* Two columns on wide pages; one column in the drawer and on narrow screens. */
.vx-ct-cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 1.25rem; align-items: start; }
.vx-ct-col { min-width: 0; }
@media (min-width: 1200px) { .vx-ct:not(.vx-ct--embedded) .vx-ct-cols { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); } }

/* Header strip */
.vx-ct-head { padding: 0.9rem 1.15rem 0.3rem; }
.vx-ct-head-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.8rem 1.25rem; padding-bottom: 0.8rem; }
.vx-ct-head-cell { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.vx-ct-head-val { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; font-size: 0.9rem; color: var(--gray-800); min-height: 26px; }
.vx-ct-reason { font-size: 0.8rem; }
.vx-ct-head-outreach { border-top: 1px solid var(--gray-100); }
.vx-ct-head-outreach .vx-setting { padding: 0.55rem 0; }
.vx-ct-prospect { margin-bottom: 1rem; }

/* Sub-tabs (variant B) */
.vx-ct-subtabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--gray-200); margin-bottom: 1rem; overflow-x: auto; scrollbar-width: none; }
.vx-ct-subtabs::-webkit-scrollbar { display: none; }
.vx-ct-subtabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 0.55rem 0.85rem; font: inherit; font-size: 0.88rem; font-weight: 600; color: var(--gray-500); cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 0.4rem; margin-bottom: -1px; }
.vx-ct-subtabs button:hover { color: var(--gray-800); }
.vx-ct-subtabs button.on { color: var(--primary); border-bottom-color: var(--primary); }
.vx-ct-subtabs button:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; border-radius: 4px; }
.vx-ct-subcount { font-size: 0.7rem; font-weight: 700; min-width: 18px; padding: 0 5px; line-height: 18px; text-align: center; border-radius: 9px; background: var(--vx-gray-bg); color: var(--vx-gray-fg); }

/* Current prediction */
.vx-ct-cur { display: flex; flex-direction: column; gap: 0.7rem; }
.vx-ct-cur-top { display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; }
.vx-ct-cur-value { font-weight: 700; font-size: 1.05rem; color: var(--gray-800); margin-left: 0.25rem; font-variant-numeric: tabular-nums; }
.vx-ct-cur-next { display: flex; flex-direction: column; gap: 0.15rem; }
.vx-ct-cur-next b { color: var(--gray-800); }
.vx-ct-cur-next span { color: var(--gray-600); font-size: 0.88rem; }
.vx-ct-cur-eta { display: flex; flex-direction: column; gap: 0.25rem; }
.vx-ct-none { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.vx-ct-none-act { display: flex; flex-direction: column; align-items: flex-start; gap: 0.3rem; }
.vx-ct-gap { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.78rem; }

/* Forecast */
.vx-ct-fc-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.vx-ct-fc-date { font-size: 1.15rem; font-weight: 700; color: var(--gray-800); }
.vx-ct-fc-date .vx-muted { font-size: 0.85rem; font-weight: 400; }
.vx-ct-fc-eta { display: flex; align-items: center; gap: 0.6rem; }
.vx-ct-fc-chart { margin-top: 0.25rem; min-width: 0; }

/* Tables */
.vx-ct-tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -0.15rem; padding: 0 0.15rem; }
.vx-ct-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.vx-ct-table th { text-align: left; font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--gray-500); padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--gray-200); white-space: nowrap; }
.vx-ct-table td { padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--gray-100); color: var(--gray-700); vertical-align: middle; }
.vx-ct-table tr:last-child td { border-bottom: 0; }
.vx-ct-table .r { text-align: right; }
.vx-ct-hist { min-width: 640px; }
.vx-ct-hist td { white-space: nowrap; }
.vx-ct-chan { display: inline-flex; align-items: center; gap: 0.3rem; }
.vx-ct-tag { font-size: 0.68rem; font-weight: 700; padding: 1px 6px; border-radius: 8px; background: var(--vx-teal-bg); color: var(--vx-teal-fg); border: 1px solid var(--vx-teal-line); vertical-align: 1px; }
.vx-ct-histkpi .vx-kpis { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.vx-ct-histkpi .vx-kpi { box-shadow: none; }

/* Patterns & insights */
.vx-ct-patterns { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0.6rem; }
.vx-ct-pattern { border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 0.65rem 0.75rem; background: var(--bg); min-width: 0; }
.vx-ct-pattern-top { display: flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; color: var(--gray-800); }
.vx-ct-pattern-top .vx-muted { margin-left: auto; font-size: 0.75rem; }
.vx-ct-pattern-icon { display: inline-flex; width: 24px; height: 24px; align-items: center; justify-content: center; border-radius: 6px; background: var(--vx-blue-bg); color: var(--vx-blue-fg); flex-shrink: 0; }
.vx-ct-pattern p { margin: 0.4rem 0 0.25rem; font-size: 0.84rem; color: var(--gray-700); }
.vx-ct-pattern small { font-size: 0.74rem; }
.vx-ct-conf { width: 44px; height: 5px; border-radius: 3px; background: var(--gray-200); overflow: hidden; margin-left: auto; flex-shrink: 0; }
.vx-ct-conf + .vx-muted { margin-left: 0; }
.vx-ct-conf span { display: block; height: 100%; background: var(--vx-c1); border-radius: 3px; }
.vx-ct-insights { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.vx-ct-insights li { border-left: 3px solid var(--gray-200); padding: 0.1rem 0 0.1rem 0.75rem; }
.vx-ct-insights li.stale { border-left-style: dashed; }
.vx-ct-ins-top { display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; font-size: 0.88rem; color: var(--gray-800); }
.vx-ct-insights p { margin: 0.25rem 0 0.2rem; font-size: 0.86rem; color: var(--gray-700); }
.vx-ct-insights small { font-size: 0.74rem; }
.vx-ct-stale { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.74rem; color: var(--vx-amber-fg); background: var(--vx-amber-bg); border: 1px solid var(--vx-amber-line); border-radius: 10px; padding: 0 0.45rem; }
.vx-ct-caveat { display: flex; gap: 0.4rem; align-items: flex-start; font-size: 0.78rem; color: var(--gray-500); margin: 0.75rem 0 0; }

/* Messages */
.vx-ct-thread { min-width: 0; }
.vx-ct-thread--scroll { max-height: 520px; overflow-y: auto; padding-right: 0.25rem; }

/* Product rules */
.vx-ct-rulegroup { margin-top: 0.25rem; }
.vx-ct-rules { list-style: none; margin: 0; padding: 0; }
.vx-ct-rule { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; padding: 0.55rem 0; border-bottom: 1px solid var(--gray-100); }
.vx-ct-rule:last-child { border-bottom: 0; }
.vx-ct-rule--edit { display: block; }
.vx-ct-rule-main { min-width: 0; font-size: 0.88rem; color: var(--gray-800); display: flex; flex-direction: column; gap: 0.1rem; }
.vx-ct-rule-main small { font-size: 0.76rem; }
.vx-ct-arrow { display: inline-flex; vertical-align: middle; color: var(--gray-500); }
.vx-ct-rule-act { display: flex; gap: 0.15rem; flex-shrink: 0; }
.vx-ct-ruleform { background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 0.8rem; margin: 0.25rem 0 0.75rem; display: flex; flex-direction: column; gap: 0.6rem; }
.vx-ct-ruleform-row { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: flex-start; }
.vx-ct-field { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; }
.vx-ct-field--grow { flex: 1 1 200px; }
.vx-ct-field--qty { width: 110px; }
.vx-ct-field .form-label { margin: 0; }
.vx-ct-picker { position: relative; }
.vx-ct-picked { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; padding: 0.45rem 0.65rem; border: 1px solid var(--gray-200); border-radius: var(--radius); background: var(--bg); font-size: 0.88rem; min-height: 38px; }
.vx-ct-results { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 2px); margin: 0; padding: 0.25rem; list-style: none; background: var(--bg); border: 1px solid var(--gray-200); border-radius: var(--radius); box-shadow: var(--shadow-md); max-height: 240px; overflow-y: auto; }
.vx-ct-results button { display: flex; flex-direction: column; align-items: flex-start; width: 100%; text-align: left; background: none; border: 0; padding: 0.4rem 0.55rem; border-radius: 6px; cursor: pointer; font: inherit; font-size: 0.86rem; color: var(--gray-800); }
.vx-ct-results button:hover, .vx-ct-results button:focus-visible { background: var(--vx-row-hover); outline: none; }
.vx-ct-results button .vx-muted { font-size: 0.76rem; }
.vx-ct-results--none { position: absolute; padding: 0.6rem 0.75rem; font-size: 0.84rem; color: var(--gray-500); }
.vx-ct-error { display: flex; gap: 0.4rem; align-items: flex-start; font-size: 0.84rem; color: var(--vx-red-fg); background: var(--vx-red-bg); border: 1px solid var(--vx-red-line); border-radius: var(--radius); padding: 0.45rem 0.65rem; }
.vx-ct-error .vx-icon { margin-top: 2px; }
.vx-ct-ruleform-act { display: flex; justify-content: flex-end; gap: 0.4rem; }

/* Settings & contacts */
.vx-ct-settings .vx-setting { padding: 0.6rem 0; }
.vx-ct-contacts { list-style: none; margin: 0; padding: 0; }
.vx-ct-contact { padding: 0.8rem 0; border-bottom: 1px solid var(--gray-100); }
.vx-ct-contact:first-child { padding-top: 0; }
.vx-ct-contact:last-child { border-bottom: 0; padding-bottom: 0; }
.vx-ct-contact-head { font-size: 0.92rem; color: var(--gray-800); display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; }
.vx-ct-contact-addr { display: flex; gap: 0.5rem 1.25rem; flex-wrap: wrap; margin: 0.3rem 0 0.2rem; font-size: 0.84rem; color: var(--gray-600); }
.vx-ct-addr { display: inline-flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; min-width: 0; overflow-wrap: anywhere; }
.vx-ct-contact-set { margin-left: 0.25rem; padding-left: 0.75rem; border-left: 2px solid var(--gray-100); }
.vx-ct-contact-set .vx-setting { padding: 0.45rem 0; }

/* Mobile */
@media (max-width: 640px) {
    .vx-ct-head-grid { grid-template-columns: 1fr 1fr; }
    .vx-ct-fc-top { align-items: flex-start; }
    .vx-ct-rule { align-items: flex-start; }
    .vx-ct-ruleform-row { flex-direction: column; }
    .vx-ct-field--qty { width: 100%; }
    .vx-ct-field--grow { flex: 0 0 auto; width: 100%; }
    .vx-ct-thread--scroll { max-height: 420px; }
    .vx-ct .vx-setting { grid-template-columns: 1fr; }
}

[data-theme="dark"] .vx-ct-ruleform { background: color-mix(in srgb, var(--gray-100) 60%, transparent); }
[data-theme="dark"] .vx-ct-results { background: var(--bg); }
.vx-ct-kpis { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.vx-ct-fc-eta { min-width: 0; max-width: 100%; flex-wrap: wrap; }
.vx-ct-fc-eta .vx-eta svg, .vx-ct-cur-eta .vx-eta svg { max-width: 100%; height: auto; }
.vx-ct .vx-card-actions .btn { white-space: nowrap; }
.vx-ct .vx-card-head { flex-wrap: wrap; }

/* ---- Vision feedback pass (12 Oct): shell, predictions list, workspace ---- */

/* ---- 01-shell-v2.css ---- */
/* ── Shell v2 (12 Oct feedback): compact heading, subtitle variants, compact ETA ── */
.vx-page-head { align-items: center; margin-bottom: 0.85rem; }
.vx-page-title { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; font-size: 1.35rem; }
.vx-page-mark { display: inline-flex; color: var(--primary); cursor: help; }
.vx-page-sub-inline { font-size: 0.82rem; font-weight: 400; color: var(--gray-500); letter-spacing: 0; margin-left: 0.25rem; }
.vx-page-sub-info { display: inline-flex; color: var(--gray-400); cursor: help; }
.vx-page-sub-info:hover, .vx-page-sub-info:focus { color: var(--primary); }
.vx-page-head--subA .vx-page-sub { margin-top: 0.1rem; }
@media (max-width: 640px) { .vx-page-sub-inline { display: none; } }

/* Sidebar sub-items: rule drops from the centre of the Vision eye icon */
.vx-sidebar-sub { margin-left: calc(1.62rem - 1.5px); }
.vx-sidebar-sublink { padding-left: 0.85rem; }

/* Compact ETA: bar with the label underneath */
.vx-eta { display: inline-flex; flex-direction: column; align-items: center; gap: 0.1rem; width: var(--eta-w, auto); }
.vx-eta svg { display: block; }
.vx-eta-label { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--gray-500); line-height: 1.1; }
.vx-eta--window .vx-eta-label { color: var(--vx-amber-fg); }
.vx-eta--overdue .vx-eta-label { color: var(--vx-red-fg); }
.vx-eta--ahead .vx-eta-label { color: var(--vx-blue-fg); }

/* ---- 21-predictions-v2.css ---- */
/* Predictions list v2: collapsible filters on desktop, dismissible hint, sticky bulk bar. */
.vx-pl-morebtn { display: inline-flex !important; }
.vx-pl-frow--fields { display: none; }
.vx-pl-frow--fields.is-open { display: flex; }
@media (max-width: 767px) { .vx-pl-frow--fields.is-open { display: grid; } }

.vx-pl-toolbar { border-radius: var(--radius) var(--radius) 0 0; }
.vx-pl2-hint-x { width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; color: var(--gray-500); }
@media (max-width: 767px) { .vx-pl-toolbar-hint { display: inline-flex; } }

.vx-pl2-bar { position: sticky; bottom: 0; margin: 0.75rem calc(-1 * var(--page-padding)) 0; z-index: 60; display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap;
    padding: 0.65rem var(--page-padding); padding-bottom: calc(0.65rem + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--gray-200);
    box-shadow: 0 -4px 16px rgba(0,0,0,0.10); font-size: 0.86rem; }
.vx-pl2-count { color: var(--gray-800); }
[data-theme="dark"] .vx-pl2-bar { box-shadow: 0 -4px 16px rgba(0,0,0,0.5); }

/* ---- 32-workspace-v2.css ---- */
/* Prediction workspace v2: merged header card, details, order card, action bar, composer modal */
.vx-ws-primary { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.5rem 1.75rem; margin: 0; }
.vx-ws-primary dt { font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--gray-500); font-weight: 600; margin-bottom: 0.15rem; }
.vx-ws-primary dd { margin: 0; font-size: 0.8125rem; color: var(--gray-800); display: flex; align-items: center; min-height: 1.5rem; }
.vx-ws-next { display: flex; align-items: flex-start; gap: 0.6rem; padding: 0.6rem 0.8rem; margin-bottom: 0.4rem; border-radius: var(--radius); border-left: 4px solid var(--ws-tone, var(--gray-400)); background: var(--ws-bg, var(--gray-50)); font-size: 0.875rem; }
.vx-ws-next b { font-weight: 700; }
.vx-ws-next span { color: var(--gray-700); }
.vx-ws-next-icon { color: var(--ws-tone, var(--gray-500)); display: inline-flex; padding-top: 0.1rem; }
.vx-ws-next--amber { --ws-tone: #d97706; --ws-bg: #fffbeb; }
.vx-ws-next--red { --ws-tone: #dc2626; --ws-bg: #fef2f2; }
.vx-ws-next--blue { --ws-tone: #2563eb; --ws-bg: #eff6ff; }
.vx-ws-next--indigo { --ws-tone: #4f46e5; --ws-bg: #eef2ff; }
.vx-ws-next--green { --ws-tone: #16a34a; --ws-bg: #f0fdf4; }
[data-theme="dark"] .vx-ws-next { --ws-bg: rgba(255, 255, 255, 0.05); }
.vx-ws-detailsbtn { display: inline-flex; align-items: center; gap: 0.3rem; background: none; border: 0; padding: 0.2rem 0; font: inherit; font-size: 0.8125rem; font-weight: 600; color: var(--gray-600); cursor: pointer; }
.vx-ws-detailsbtn:hover { color: var(--primary); }
.vx-ws-details { margin-top: 0.5rem; padding-top: 0.7rem; border-top: 1px solid var(--gray-200); display: grid; gap: 0.8rem; }
.vx-ws-details .vx-ws-facts { border-top: 0; padding-top: 0; }
.vx-ws-detail-btns { display: flex; gap: 0.4rem; align-items: center; }
.vx-ws-detail-btns .btn { display: inline-flex; align-items: center; gap: 0.35rem; }
.vx-ws-insights h4 { margin: 0 0 0.4rem; font-size: 0.8125rem; }
.vx-ws-insights ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.4rem; }
.vx-ws-insights li { display: flex; gap: 0.5rem; align-items: flex-start; font-size: 0.8125rem; color: var(--gray-700); }
.vx-ws-box-sub { font-size: 0.8125rem; }
.vx-ws-actionbar-msg { flex: 1; min-width: 0; }
.vx-ws-actionbar-btns { display: flex; align-items: center; justify-content: flex-end; gap: 0.5rem; flex-wrap: wrap; margin-left: auto; }
.vx-cmp--modal { border: 0; box-shadow: none; padding: 0; }
@media (max-width: 640px) {
    .vx-ws-actionbar-btns { width: 100%; }
    .vx-ws-actionbar-btns .btn-primary { flex: 1 1 auto; justify-content: center; }
}

/* ---- Vision feedback pass 2 (12 Oct): compact filters, workspace header, decisions ---- */

/* ---- 22-predictions-v3.css ---- */
/* Predictions list v3: slim collapsed filter row, three-row expanded bar. */
.vx-pl-frow--top .vx-pl-morebtn { margin-left: auto; }
.vx-pl3-showing { display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.84rem; color: var(--gray-600); font-weight: 500; white-space: nowrap; }
.vx-pl3-showing select.form-input { width: auto; min-width: 150px; height: 36px; padding: 0.35rem 2rem 0.35rem 0.7rem; font-size: 0.86rem; }
.vx-pl3-hide { border-color: var(--primary); color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, transparent); font-weight: 600; }
.vx-pl3-hide:hover { background: color-mix(in srgb, var(--primary) 18%, transparent); }
.vx-pl-frow--views .vx-pl-summary { margin-left: auto; }
@media (max-width: 767px) {
    .vx-pl-search { flex: 1 1 100%; }
    .vx-pl3-showing { flex: 1 1 0; min-width: 0; }
    .vx-pl3-showing select.form-input { flex: 1; min-width: 0; }
    .vx-pl-frow--top .vx-pl-morebtn { margin-left: 0; }
    .vx-pl-frow--views .vx-pl-summary { margin-left: 0; }
}

/* ---- 33-workspace-v3.css ---- */
.vx-ws-head { position: relative; padding-bottom: 1.5rem; margin-bottom: 1.1rem; }
.vx-ws-head .vx-ws-next { margin-bottom: 0; }
.vx-ws-detailsbtn { position: absolute; left: 50%; bottom: 0; transform: translate(-50%, 50%); z-index: 2; display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.2rem 0.75rem; border-radius: 999px; border: 1px solid var(--gray-300); background: var(--bg, #fff); box-shadow: var(--shadow); font-size: 0.75rem; }
.vx-ws-detailsbtn:hover { border-color: var(--primary); }
.vx-ws-detailswrap { display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows 0.25s ease, opacity 0.2s ease; }
.vx-ws-detailswrap.open { grid-template-rows: 1fr; opacity: 1; }
.vx-ws-details-inner { overflow: hidden; min-height: 0; }
.vx-ws-detailswrap .vx-ws-details { margin-top: 0.7rem; padding-top: 0.7rem; }
.vx-ws-minis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.6rem; }
.vx-ws-mini { border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 0.55rem 0.7rem; font-size: 0.8125rem; color: var(--gray-800); min-width: 0; }
.vx-ws-mini h5 { margin: 0 0 0.3rem; font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--gray-500); font-weight: 600; }
.vx-ws-insights-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.4rem; }
.vx-ws-insights-head h4 { margin: 0; }
.vx-ws-detail-btns { display: inline-flex; gap: 0.4rem; flex-wrap: wrap; }
@media (max-width: 900px) { .vx-ws-minis { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .vx-ws-minis { grid-template-columns: 1fr; } }
.vx-ws-dec-top { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.6rem; }
.vx-ws-dec-top p { margin: 0; }
.vx-ws-dec-group { border: 1px solid var(--gray-200); border-radius: var(--radius); margin-bottom: 0.7rem; overflow: hidden; }
.vx-ws-dec-group > header { padding: 0.55rem 0.75rem; background: var(--gray-50); font-size: 0.8125rem; }
.vx-ws-dec-group blockquote { margin: 0.25rem 0 0; padding-left: 0.6rem; border-left: 3px solid var(--gray-300); color: var(--gray-600); }
.vx-ws-dec-item { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.6rem 0.75rem; border-top: 1px solid var(--gray-200); flex-wrap: wrap; }
.vx-ws-dec-body { min-width: 0; flex: 1 1 220px; }
.vx-ws-dec-title { font-weight: 600; font-size: 0.875rem; }
.vx-ws-dec-meta { display: flex; gap: 0.2rem 0.75rem; flex-wrap: wrap; font-size: 0.75rem; color: var(--gray-500); margin-top: 0.15rem; }
.vx-ws-seg { display: inline-flex; border: 1px solid var(--gray-300); border-radius: var(--radius); overflow: hidden; }
.vx-ws-seg button { border: 0; background: var(--bg, #fff); padding: 0.35rem 0.9rem; font: inherit; font-size: 0.8125rem; font-weight: 600; color: var(--gray-700); cursor: pointer; }
.vx-ws-seg button + button { border-left: 1px solid var(--gray-300); }
.vx-ws-seg button.on.approve { background: #16a34a; color: #fff; }
.vx-ws-seg button.on.reject { background: #dc2626; color: #fff; }
.vx-ws-dec-count { margin-right: auto; font-size: 0.8125rem; }

/* ---- Vision feedback pass 3 (12 Oct): draft preview, approve colours, team side nav ---- */

/* ---- 34-workspace-v4.css ---- */

/* ── v4: details lifecycle, convo buttons, phone mockup ── */
.vx-ws-mini:has(.vx-ws-details-step) { grid-column: span 2; }
.vx-ws-details-step { white-space: nowrap; }
.vx-ws-convo-btns { display: inline-flex; gap: 6px; }
.vx-th-intent-btns .btn-success, .vx-th-intents-head .btn-success { color: #fff; }
.vx-ws-seg button.on.approve { background: var(--vx-green-bg, #dcfce7); color: var(--vx-green-fg, #166534); }
.vx-cmp-pv-phonewrap { display: flex; justify-content: center; padding: 8px 0; }
.vx-cmp-pv-phone { position: relative; width: 260px; height: 520px; box-sizing: border-box; display: flex; flex-direction: column; border: 8px solid #1f2937; border-radius: 36px; background: var(--bg, #fff); overflow: hidden; box-shadow: var(--shadow-md); }
.vx-cmp-pv-notch { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 90px; height: 18px; background: #1f2937; border-radius: 0 0 12px 12px; z-index: 2; }
.vx-cmp-pv-status { display: flex; justify-content: space-between; padding: 6px 18px 0; font-size: 10px; font-weight: 600; color: var(--gray-700); }
.vx-cmp-pv-phone-top { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 8px 8px; border-bottom: 1px solid var(--gray-200); font-size: 12px; background: var(--gray-50); }
.vx-cmp-pv-av { width: 32px; height: 32px; border-radius: 50%; background: var(--gray-300); color: #fff; display: grid; place-items: center; font-weight: 600; }
.vx-cmp-pv-thread { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.vx-cmp-pv-thread .vx-cmp-pv-bubble { align-self: flex-start; max-width: 88%; margin: 0; }
.vx-cmp-pv-input { display: flex; align-items: center; gap: 6px; margin: 8px; padding: 6px 6px 6px 12px; border: 1px solid var(--gray-300); border-radius: 18px; font-size: 12px; color: var(--gray-500); }
.vx-cmp-pv-input span { flex: 1; }
.vx-cmp-pv-input i { font-style: normal; width: 22px; height: 22px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; }

/* ---- 61-team-v2.css ---- */
/* Team page layout C: side navigation (reuses .vx-st-split / .vx-st-side-* from Settings). */
.vx-tm2-main { min-width: 0; display: flex; flex-direction: column; gap: 1rem; }
.vx-tm2-main > .vx-st-anchor, .vx-tm2-main > .card { scroll-margin-top: 80px; }
.vx-st-split .vx-tm-tablewrap { max-width: 100%; }

/* ---- Vision round 4 (13 Oct): locked layouts, list layouts, digest, mute, order editor ---- */

/* ---- 02-global-r4.css ---- */
/* ── Round 4 global rules ─────────────────────────────────────────────── */
/* Page description: inline muted on wide screens, info icon on narrow. */
.vx-page-sub-info { display: none; }
@media (max-width: 900px) {
    .vx-page-sub-inline { display: none; }
    .vx-page-sub-info { display: inline-flex; }
}
/* Design rule: card headers never use the generic vertical bar — an icon leads the title. */
.vx-card-title::before { display: none; }
.vx-card-title .vx-icon { display: inline-block; color: var(--gray-500); }
/* Informational pills/badges read as non-clickable: scooped corners + tinted hairline. */
.vx-pill, .vx-src, .vx-src-chip {
    corner-shape: scoop;
    border: 1px solid color-mix(in srgb, currentColor 50%, transparent);
}
.vx-page .card-title::before, .vx-drawer .card-title::before { display: none; }

/* ---- 35-workspace-r4.css ---- */
/* ---- 35-workspace-r4.css: round 4 — focus split locked in, collapsible cards, snooze upward, composer popup, decisions ---- */

/* Collapsible Order / Conversation cards (toggle + chevron only when the split stacks, <=1000px) */
.vx-ws-box-toggle { display: inline-flex; align-items: center; gap: 0.4rem; flex: 1; min-width: 0; padding: 0; border: 0; background: none; font: inherit; color: inherit; text-align: left; cursor: default; pointer-events: none; }
.vx-ws-box-toggle h2 { margin: 0; font-size: 0.9375rem; font-weight: 700; }
.vx-ws-box-chev { display: none; color: var(--gray-500); transition: transform 0.15s ease; }
@media (max-width: 1000px) {
    .vx-ws-box-toggle { cursor: pointer; pointer-events: auto; padding: 0.15rem 0; }
    .vx-ws-box-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
    .vx-ws-box-chev { display: inline-flex; }
    .vx-ws-box--closed .vx-ws-box-chev { transform: rotate(-90deg); }
    .vx-ws-box--closed .vx-ws-box-body { display: none; }
    .vx-ws-box--closed .vx-ws-box-head { margin-bottom: 0; }
    .vx-ws-box--collapsible { scroll-margin-top: 4rem; }
}

/* Later (snooze) menu opens upward from the action bar and stays on screen */
.vx-ws-snooze .vx-popover { top: auto; bottom: calc(100% + 8px); left: auto; right: 0; max-width: calc(100vw - 24px); max-height: min(60vh, 320px); overflow-y: auto; }
@media (max-width: 640px) {
    .vx-ws-snooze .vx-popover { position: fixed; left: 12px; right: 12px; bottom: 76px; top: auto; width: auto !important; max-width: none; z-index: 960; }
}

/* Inbound message: one-line "changes awaiting your decision" chip (thread.js onReviewIntents) */
.vx-th-intentchip { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 0.3rem 0.4rem; margin-top: 0.3rem; padding: 0.2rem 0.65rem; border-radius: 999px; border: 1px solid var(--vx-amber-line, #fcd34d); background: var(--vx-amber-bg, #fffbeb); color: var(--vx-amber-fg, #92400e); font-size: 0.75rem; align-self: flex-start; }
.vx-th-intentchip .vx-linkbtn { font-size: inherit; font-weight: 700; color: inherit; text-decoration: underline; cursor: pointer; }
.vx-th-intentchip--done { border-color: var(--gray-200); background: var(--gray-50); color: var(--gray-600); }

/* Review decisions modal */
.vx-ws-dec-bulk { display: inline-flex; gap: 0.4rem; flex-wrap: wrap; }
.vx-ws-dec-rejall { color: var(--vx-red-ink, #b91c1c); border-color: var(--vx-red-line, #fca5a5); }
.vx-ws-dec-quote { white-space: pre-line; overflow-wrap: anywhere; }
.vx-ws-dec-quote.long { cursor: pointer; }
.vx-ws-dec-quote.long:hover { border-left-color: var(--primary); }
.vx-ws-dec-more { display: block; margin-top: 0.2rem; font-size: 0.75rem; font-weight: 600; color: var(--primary-dark, var(--primary)); white-space: normal; }
.vx-ws-dec-group .vx-ws-seg button.on.approve { background: #16a34a; color: #fff; }
.vx-ws-dec-group .vx-ws-seg button.on.reject { background: var(--bg, #fff); color: #b91c1c; box-shadow: inset 0 0 0 2px #dc2626; }
[data-theme="dark"] .vx-ws-dec-group .vx-ws-seg button.on.reject { color: #f87171; box-shadow: inset 0 0 0 2px #f87171; }
[data-theme="dark"] .vx-ws-dec-rejall { color: #f87171; }

/* Composer popup: sticky footer, internal portal button in the preview */
.vx-modal .modal-body:has(.vx-cmp--modal) { padding-bottom: 0; }
.vx-cmp--modal .vx-cmp-foot { position: sticky; bottom: 0; z-index: 6; margin: 1rem -1.25rem 0; padding-inline: 1.25rem; border-radius: 0; }
.vx-cmp-pv-btn { text-decoration: none; }
.vx-cmp-pv-btn:hover { background: var(--primary-dark, var(--primary)); color: #fff; }
.vx-cmp-pv-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---- 50-round4-lists.css ---- */
/* =====================================================================
   Round 4 — Predictions list layouts. Layout control, decision-layout bar,
   Triage cards polish (stack, facts, progress dots, swipe). Prefix .vx-pl4-
   and the existing .vx-ib- classes.
   ===================================================================== */

/* Layout control sits beside "Showing" in the filters panel (collapsed and expanded). */
.vx-pl4-layout { margin-left: auto; }
.vx-pl4-layout > span { display: inline-flex; align-items: center; gap: 0.3rem; }
.vx-pl4-layout select.form-input { min-width: 140px; }
.vx-pl-frow--top .vx-pl4-layout + .vx-pl-morebtn { margin-left: 0; }
@media (max-width: 767px) {
    .vx-pl4-layout { margin-left: 0; flex: 1 1 0; min-width: 0; }
    .vx-pl4-layout > span { display: none; }
    .vx-pl4-layout select.form-input { flex: 1; min-width: 0; }
}

/* Decision layouts: slim bar above the queue / card */
.vx-ib-bar { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.6rem; }
.vx-ib-bar-sub { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.86rem; font-weight: 600; color: var(--gray-600); }
.vx-ib-keys { margin: 0 0 0.75rem; display: grid; gap: 0.55rem; }
.vx-ib-keys div { display: grid; grid-template-columns: 6.5rem 1fr; gap: 0.75rem; align-items: baseline; }
.vx-ib-keys dt { white-space: nowrap; }
.vx-ib-keys dd { margin: 0; color: var(--gray-600); }
/* The workspace's page title already says what it is; keep the queue near the filters */
.vx-pl-filters + .vx-ib { margin-top: 0; }
.vx-pl-filters { margin-bottom: 0.75rem; }

/* ── Triage cards, polished ─────────────────────────────────────────── */
.vx-ib-c { max-width: 640px; margin: 0 auto; }
.vx-ib-ccount { flex-wrap: wrap; row-gap: 0.25rem; }
.vx-ib-cdots { display: inline-flex; align-items: center; gap: 4px; margin: 0 0.25rem; }
.vx-ib-cdots i { width: 7px; height: 7px; border-radius: 50%; background: var(--gray-300); transition: background 0.2s, transform 0.2s; }
.vx-ib-cdots i.past { background: var(--primary); opacity: 0.45; }
.vx-ib-cdots i.on { background: var(--primary); transform: scale(1.5); }
.vx-ib-cdots small { font-size: 0.7rem; color: var(--gray-500); margin-left: 2px; }
.vx-ib-chint { margin-left: auto; }

/* A stack: ghost cards peek out beneath the current one */
.vx-ib-cstack { position: relative; }
.vx-ib-cstack.has-next::before, .vx-ib-cstack.has-more::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: -7px; height: 100%; z-index: 0;
    border: 1px solid var(--gray-200); border-radius: var(--radius); background: var(--bg); box-shadow: var(--shadow); }
.vx-ib-cstack.has-more::after { left: 20px; right: 20px; bottom: -14px; opacity: 0.6; }
.vx-ib-cstack > .vx-ib-ccard { position: relative; z-index: 1; margin-bottom: 0; }
.vx-ib-cstack.has-next { margin-bottom: 1rem; }
.vx-ib-cstack.has-more { margin-bottom: 1.5rem; }

.vx-ib-cfacts { display: flex; flex-wrap: wrap; gap: 0.35rem 0.9rem; margin: 0.15rem 0 0.35rem; font-size: 0.8rem; color: var(--gray-600); }
.vx-ib-cfacts span { display: inline-flex; align-items: center; gap: 0.3rem; }
.vx-ib-cfacts svg { color: var(--gray-400); }

.vx-ib-cnext { display: flex; align-items: baseline; gap: 0.5rem; justify-content: center; flex-wrap: wrap; margin: 0.25rem 0 0; font-size: 0.82rem; color: var(--gray-500); }
.vx-ib-cnext span { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.vx-ib-cnext b { color: var(--gray-700); }
.vx-ib-cnext em { font-style: normal; }

/* Swipe (touch): the card follows the finger and shows what the gesture will do */
.vx-ib-ccard { touch-action: pan-y; }
.vx-ib-swipe { position: absolute; top: 0.9rem; z-index: 3; display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.3rem 0.7rem; border-radius: 999px; font-size: 0.8rem; font-weight: 700; opacity: 0; pointer-events: none; }
.vx-ib-swipe--yes { left: 0.9rem; background: var(--vx-green-bg); color: var(--vx-green-fg); border: 1px solid var(--vx-green-line); }
.vx-ib-swipe--no { right: 0.9rem; background: var(--vx-gray-bg); color: var(--vx-gray-fg); border: 1px solid var(--gray-300); }
.vx-ib-ccard.is-swipe-yes { box-shadow: 0 0 0 2px var(--vx-green-line), var(--shadow-md); }
.vx-ib-cswipehint { display: none; margin: 0.6rem 0 0; text-align: center; font-size: 0.74rem; color: var(--gray-500); }
@media (hover: none) and (pointer: coarse) {
    .vx-ib-cswipehint { display: block; }
    .vx-ib-chint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .vx-ib-cdots i { transition: none; }
}

@media (max-width: 767px) {
    .vx-pl4-type > span { display: none; }
}

/* ---- 51-round4-notify.css ---- */
/* =====================================================================
   Round 4 — notification centre: Drawer only, Mute (replaces focus mode),
   toasts bottom-left. Overrides/extends the 80-notifications block.
   ===================================================================== */

/* ── Bell: muted state ──────────────────────────────────────────────── */
.vx-nt-bell.is-muted { color: var(--gray-400); }
.vx-nt-slash { stroke: currentColor; }
.vx-nt-badge--muted { background: var(--gray-500); }
.vx-nt-dot--muted { background: var(--gray-400); }
@media (max-width: 768px) {
    .header .vx-nt-bell.is-muted { color: rgba(255,255,255,0.5); }
    .header .vx-nt-badge--muted { background: #64748b; }
}

/* ── Toasts: bottom-left of the content area (clear of the sidebar; the
   bottom right is an action region) ───────────────────────────────── */
@media (min-width: 769px) {
    .vx-nt-toasts { right: auto; left: calc(var(--sidebar-w, 220px) + 16px); bottom: 16px; }
}
@media (min-width: 769px) and (max-width: 1180px) {
    .vx-nt-toasts { bottom: 16px; }
}

/* ── Mute control ───────────────────────────────────────────────────── */
.vx-nt-mute { margin: 0 0.85rem 0.6rem; border: 1px solid var(--gray-200); border-radius: var(--radius); background: var(--gray-50); }
.vx-nt-mute.is-on { background: var(--vx-indigo-bg); border-color: var(--vx-indigo-line); }
.vx-nt-mute--compact { margin: 0; }
.vx-nt-mute-row { display: flex; align-items: center; gap: 0.65rem; padding: 0.55rem 0.7rem; flex-wrap: wrap; }
.vx-nt-mute-ico { width: 28px; height: 28px; border-radius: 50%; background: var(--bg); color: var(--gray-500); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.vx-nt-mute.is-on .vx-nt-mute-ico { color: #6366f1; }
[data-theme="dark"] .vx-nt-mute.is-on .vx-nt-mute-ico { color: #a5b4fc; }
.vx-nt-mute-text { flex: 1 1 11rem; min-width: 0; }
.vx-nt-mute-title { display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; font-size: 0.82rem; font-weight: 600; color: var(--gray-800); }
.vx-nt-mute-sub { font-size: 0.74rem; color: var(--gray-500); line-height: 1.35; }
.vx-nt-mute.is-on .vx-nt-mute-sub { color: var(--vx-indigo-fg); }
.vx-nt-mute-btns { display: inline-flex; gap: 0.35rem; margin-left: auto; }
.vx-nt-mute-btn { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.28rem 0.65rem; border-radius: 7px; border: 1.5px solid var(--gray-300); background: var(--bg); color: var(--gray-700); font: inherit; font-size: 0.78rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.vx-nt-mute-btn:hover { background: var(--gray-100); border-color: var(--gray-400); color: var(--gray-900); }
.vx-nt-mute-btn--main { border-color: var(--primary); color: var(--primary-dark); }
.vx-nt-mute-btn:focus-visible, .vx-nt-mute-opt:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.vx-nt-mute-pick { display: flex; flex-direction: column; gap: 0.15rem; padding: 0.3rem 0.5rem 0.5rem; border-top: 1px solid var(--gray-200); }
.vx-nt-mute.is-on .vx-nt-mute-pick { border-top-color: var(--vx-indigo-line); }
.vx-nt-mute-pick-title { padding: 0.2rem 0.25rem; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--gray-500); }
.vx-nt-mute-opt { display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem; padding: 0.42rem 0.6rem; border: 0; border-radius: 7px; background: transparent; font: inherit; font-size: 0.85rem; font-weight: 600; color: var(--gray-800); cursor: pointer; text-align: left; }
.vx-nt-mute-opt small { font-size: 0.72rem; font-weight: 500; color: var(--gray-500); }
.vx-nt-mute-opt:hover { background: var(--bg); }
.vx-nt-side-links { display: flex; flex-direction: column; align-items: flex-start; gap: 0.1rem; }

/* Settings → Notifications: the per-device mute row */
.vx-st-muterow .vx-nt-mute { margin: 0; }

/* ---- 52-round4-digest.css ---- */
/* =====================================================================
   Round 4 — Weekly digest page (/vision/digest) and the email preview.
   Prefix .vx-dg-. The email is always light (email clients are), so its
   colours are fixed rather than theme tokens.
   ===================================================================== */

.vx-dg-tools { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.vx-dg-weeknav { display: inline-flex; align-items: center; gap: 0.35rem; }
.vx-dg-weeklabel { display: inline-flex; align-items: center; gap: 0.4rem; min-width: 11.5rem; justify-content: center; font-size: 0.85rem; font-weight: 600; color: var(--gray-700); }
.vx-dg-emailtoggle { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; font-weight: 600; color: var(--gray-700); cursor: pointer; }
.vx-dg-emailtoggle span { display: inline-flex; align-items: center; gap: 0.35rem; }

.vx-dg-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1rem; align-items: start; }
.vx-dg-main { min-width: 0; }
.vx-dg .vx-pf-digest { max-width: none; margin: 0; }
.vx-dg .vx-pf-letter { border-radius: var(--radius); }
.vx-pf-letter-eyebrow { display: inline-flex; align-items: center; gap: 0.4rem; }
.vx-pf-sec-title { display: flex; align-items: center; gap: 0.4rem; }
.vx-pf-digestlink { display: flex; align-items: center; gap: 0.4rem; margin: 0.25rem 0 1rem; font-size: 0.85rem; color: var(--gray-600); }
.vx-dg-side { display: flex; flex-direction: column; gap: 0; }
.vx-dg-fine { margin: 0.5rem 0 0; font-size: 0.75rem; color: var(--gray-500); line-height: 1.45; }
.vx-dg-off { display: flex; align-items: flex-start; gap: 0.5rem; margin-bottom: 0.75rem; padding: 0.55rem 0.8rem; border-radius: var(--radius); border: 1px solid var(--vx-amber-line); background: var(--vx-amber-bg); color: var(--vx-amber-fg); font-size: 0.85rem; }
.vx-dg-off svg { flex-shrink: 0; margin-top: 0.1rem; }

.vx-dg-weeks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.vx-dg-weekbtn { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.4rem 0.6rem; border: 0; border-radius: 7px; background: transparent; font: inherit; font-size: 0.85rem; color: var(--gray-700); cursor: pointer; text-align: left; }
.vx-dg-weekbtn:hover { background: var(--gray-100); }
.vx-dg-weekbtn.on { background: var(--primary-light); color: var(--primary-dark); font-weight: 600; }
.vx-dg-weekbtn small { font-size: 0.7rem; font-weight: 700; color: var(--primary-dark); }
.vx-dg-weekbtn:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.vx-dg-where { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; font-size: 0.82rem; color: var(--gray-600); line-height: 1.45; }
.vx-dg-where li { display: flex; gap: 0.55rem; }
.vx-dg-where svg { flex-shrink: 0; margin-top: 0.15rem; color: var(--gray-500); }

/* ── Email client frame ─────────────────────────────────────────────── */
.vx-dg-client { border: 1px solid var(--gray-300); border-radius: var(--radius); overflow: hidden; background: var(--bg); box-shadow: var(--shadow); }
.vx-dg-client-bar { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 0.8rem; background: var(--gray-100); border-bottom: 1px solid var(--gray-200); }
.vx-dg-dots { display: inline-flex; gap: 0.3rem; }
.vx-dg-dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--gray-300); }
.vx-dg-client-title { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.78rem; font-weight: 600; color: var(--gray-500); }
.vx-dg-client-head { display: grid; grid-template-columns: auto 1fr; gap: 0.2rem 0.9rem; margin: 0; padding: 0.8rem 1.1rem; border-bottom: 1px solid var(--gray-200); font-size: 0.82rem; }
.vx-dg-client-head dt { color: var(--gray-500); }
.vx-dg-client-head dd { margin: 0; min-width: 0; overflow-wrap: anywhere; color: var(--gray-800); }
.vx-dg-client-head dd span { color: var(--gray-500); }
.vx-dg-client-subj { font-weight: 700; }
.vx-dg-client-body { padding: 1.25rem 1rem 1.5rem; background: #eef1f5; }

/* The message itself: fixed light colours, narrow column, table-ish like real email. */
.vx-dg-mail { max-width: 600px; margin: 0 auto; padding: 1.6rem 1.75rem 1.4rem; background: #ffffff; color: #1f2937; border-radius: 6px; font-size: 0.92rem; line-height: 1.6; box-shadow: 0 1px 3px rgba(0,0,0,0.12); }
.vx-dg-mail p { margin: 0 0 0.8rem; }
.vx-dg-mail a { color: #0369a1; }
.vx-dg-mail-brand { display: flex; align-items: center; gap: 0.5rem; font-weight: 800; font-size: 1.05rem; color: #0c4a6e; margin-bottom: 1rem; }
.vx-dg-mail-brand span:last-child { font-weight: 500; font-size: 0.82rem; color: #6b7280; margin-left: 0.15rem; }
.vx-dg-mail-logo { width: 26px; height: 26px; border-radius: 7px; background: #0284c7; color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.vx-dg-mail-eyebrow { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: #0284c7; margin-bottom: 0.3rem !important; }
.vx-dg-mail-h1 { font-size: 1.3rem; line-height: 1.35; margin: 0 0 0.6rem; color: #111827; font-weight: 700; letter-spacing: -0.01em; }
.vx-dg-mail-figs { width: 100%; border-collapse: collapse; margin: 1rem 0 0.4rem; border-top: 1px solid #e5e7eb; border-bottom: 1px solid #e5e7eb; table-layout: fixed; }
.vx-dg-mail-figs td { padding: 0.7rem 0.4rem; vertical-align: top; text-align: left; }
.vx-dg-mail-figs b { display: block; font-size: 1.2rem; color: #111827; font-variant-numeric: tabular-nums; }
.vx-dg-mail-figs span { display: block; font-size: 0.72rem; color: #6b7280; }
.vx-dg-mail-figs em { display: block; font-style: normal; font-size: 0.7rem; color: #6b7280; margin-top: 0.1rem; }
.vx-dg-mail-figs em.up { color: #15803d; }
.vx-dg-mail-figs em.down { color: #b91c1c; }
.vx-dg-mail-h2 { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: #374151; margin: 1.2rem 0 0.4rem; }
.vx-dg-mail-list { margin: 0 0 0.8rem; padding-left: 1.1rem; }
.vx-dg-mail-list li { margin-bottom: 0.35rem; }
.vx-dg-mail-cta { margin: 1.3rem 0 0.9rem !important; }
.vx-dg-mail-btn { display: inline-block; padding: 0.55rem 1.1rem; border-radius: 6px; background: #0284c7; color: #fff !important; font-weight: 700; text-decoration: none; }
.vx-dg-mail-foot { font-size: 0.74rem; color: #6b7280; border-top: 1px solid #e5e7eb; padding-top: 0.8rem; margin: 0 !important; }

@media (max-width: 1100px) {
    .vx-dg-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
    .vx-dg-weeklabel { min-width: 0; }
    .vx-dg-client-body { padding: 0.6rem 0.4rem 0.8rem; }
    .vx-dg-mail { padding: 1.1rem 1rem; }
    .vx-dg-mail-figs, .vx-dg-mail-figs tbody, .vx-dg-mail-figs tr { display: block; }
    .vx-dg-mail-figs tr { display: grid; grid-template-columns: 1fr 1fr; }
    .vx-dg-client-head { grid-template-columns: 1fr; gap: 0; }
    .vx-dg-client-head dt { margin-top: 0.4rem; font-size: 0.72rem; }
}

/* ── Vision wiring Phase 3: data-source notice (remote loading / demo data) ── */
.vx-source { margin: 0 0 0.85rem; padding: 0.5rem 0.8rem; border-radius: var(--radius); font-size: 0.85rem; border: 1px solid var(--gray-200); background: var(--gray-50); color: var(--gray-700); }
.vx-source--unavailable { border-color: color-mix(in srgb, var(--warning, #d97706) 45%, transparent); background: color-mix(in srgb, var(--warning, #d97706) 9%, transparent); }
.vx-source--loading { color: var(--gray-500); }

/* ── Vision workspace: SR6's shared order line editor with Vision extras (W15) ── */
.vx-pl-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: 0.25rem 0 0.6rem; font-size: 0.85rem; color: var(--gray-600); }
.vx-pl-total { font-weight: 700; color: var(--gray-900); font-variant-numeric: tabular-nums; }
.vx-pl .so-lines-table { width: 100%; }
.vx-pl-extras { display: inline-flex; align-items: center; gap: 0.35rem; margin-left: 0.35rem; }
.vx-pl-was { font-size: 0.75rem; color: var(--gray-500); }
.vx-pl-removed { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.9rem; margin-top: 0.6rem; font-size: 0.82rem; }
.vx-pl-removed-item { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--gray-600); }
/* In the workspace's half-width panel, use SR6's compact (phone) line layout: price, qty and total move into
   the product cell. Container query, so it follows the panel, not the window. */
.vx-pl { container-type: inline-size; }
@container (max-width: 700px) {
    .vx-pl .so-lines-table .so-lt-price,
    .vx-pl .so-lines-table .so-lt-qty,
    .vx-pl .so-lines-table .so-lt-total,
    .vx-pl .so-lines-table .so-lt-remove { display: none; }
    .vx-pl .so-lt-mobile-block { display: block; }
    .vx-pl .so-lt-mob-row { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-top: 0.5rem; }
    .vx-pl .so-lt-mob-total { margin-left: auto; font-weight: 600; white-space: nowrap; }
}

/* Stock warnings inside the order-lines table sit in the line's own cell, not as an overlay on a product tile. */
.so-lines-table .qty-warning {
    position: static;
    margin: 0.35rem 0 0;
    max-width: 22rem;
    pointer-events: auto;
}

/* Vision: edits still on their way to the server */
.vx-saving { position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 60; display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.4rem 0.8rem; border-radius: 999px; background: var(--gray-800, #1f2937); color: #fff; font-size: 0.8rem; box-shadow: 0 2px 10px rgba(0,0,0,0.25); pointer-events: none; }
.vx-saving-spin { width: 0.8rem; height: 0.8rem; border-radius: 50%; border: 2px solid rgba(255,255,255,0.35); border-top-color: #fff; animation: vx-saving-rot 0.7s linear infinite; }
@keyframes vx-saving-rot { to { transform: rotate(360deg); } }

/* Removed order lines (O15): greyed row with Restore, shared by the Order page and the Vision workspace */
.so-lt-removed td { background: var(--gray-50); }
.so-lt-removed .so-line-img, .so-lt-removed .so-line-code, .so-lt-removed .so-line-product { opacity: 0.5; }
.so-lt-removed .so-line-product { text-decoration: line-through; cursor: default; }
.so-lt-removed-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; margin-top: 0.35rem; }
.so-lt-removed-tag { font-size: 0.78rem; font-weight: 600; color: var(--gray-500); }
.so-lt-removed-was { font-weight: 400; }

/* ═════════════════════════════════════════════════════════════════════════
   Customer portal (portal.html, js/portal/*) — .po-* — portal plan O9.
   Separate app, shared stylesheet. Mobile-first; light and dark via the same tokens as the staff app.
   ═════════════════════════════════════════════════════════════════════════ */
.po-body { background: var(--bg-page); color: var(--text-primary); margin: 0; min-height: 100vh; }
.po-shell { max-width: 960px; margin: 0 auto; padding: 1rem 1rem 0; }
.po-muted { color: var(--gray-500); font-size: 0.85rem; }

.po-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; padding: 0.25rem 0 1rem; }
.po-brand { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }
.po-logo { max-height: 40px; max-width: 160px; object-fit: contain; }
.po-brand-name { font-size: 1.15rem; font-weight: 700; color: var(--po-accent, var(--primary)); }
.po-for { color: var(--gray-600); font-size: 0.95rem; }

.po-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem 1rem; padding: 0.75rem 1rem; margin-bottom: 1rem;
    border-radius: var(--radius); border: 1px solid var(--vx-blue-line); background: var(--vx-blue-bg); color: var(--vx-blue-fg); font-size: 0.92rem; }
.po-banner--ok { background: var(--vx-green-bg); border-color: var(--vx-green-line); color: var(--vx-green-fg); }
.po-banner--warn { background: var(--vx-amber-bg); border-color: var(--vx-amber-line); color: var(--vx-amber-fg); }
.po-banner-actions { display: inline-flex; flex-wrap: wrap; gap: 0.4rem; }

.po-card { margin-bottom: 1rem; padding: 1rem; }
.po-lines-card { padding: 0; overflow: hidden; }
.po-card-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.9rem 1rem 0.5rem; }
.po-card-head .card-title { margin: 0; }
.po-save { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.8rem; color: var(--gray-500); white-space: nowrap; }
.po-save-spin { width: 0.8rem; height: 0.8rem; border-width: 2px; }
.po-empty { padding: 1rem; color: var(--gray-500); text-align: center; }

.po-line-extras { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.75rem; font-size: 0.8rem; }
.po-tag { display: inline-block; padding: 0.05rem 0.5rem; border-radius: 999px; font-size: 0.72rem; font-weight: 600; border: 1px solid currentColor; background: transparent; corner-shape: scoop; }
.po-tag--added { color: var(--vx-teal-fg); }
.po-tag--offer { color: var(--vx-gold-fg); }
.po-tag--note { color: var(--gray-600); font-weight: 500; }
.po-link { background: none; border: 0; padding: 0; color: var(--po-accent, var(--primary)); cursor: pointer; font: inherit; text-decoration: underline; }
.po-check { display: inline-flex; align-items: center; gap: 0.35rem; cursor: pointer; font-size: 0.85rem; }
.po-replace { display: inline-flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.po-row-changed td { animation: po-changed 8s ease-out; }
@keyframes po-changed { 0%, 70% { background: var(--vx-amber-bg); } 100% { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .po-row-changed td { animation: none; background: var(--vx-amber-bg); } }

.po-fields { display: grid; gap: 0.75rem; margin-bottom: 0.75rem; }
.po-field { display: grid; gap: 0.25rem; font-size: 0.85rem; color: var(--gray-600); }
.po-field .form-input { width: 100%; }

.po-search-box { display: flex; align-items: center; gap: 0.5rem; color: var(--gray-500); }
.po-search-box .form-input { flex: 1; }
.po-results { list-style: none; margin: 0.75rem 0 0; padding: 0; display: grid; gap: 0.5rem; }
.po-result { display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem; border: 1px solid var(--border-color); border-radius: var(--radius); }
.po-result-img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; background: var(--gray-100); flex-shrink: 0; }
.po-result-body { flex: 1; min-width: 0; }
.po-result-name { font-weight: 600; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.po-result-meta { display: flex; flex-wrap: wrap; gap: 0.15rem 0.75rem; color: var(--gray-500); font-size: 0.78rem; }
.po-result-qty { width: 4.5rem; }

.po-bar { position: sticky; bottom: 0; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem 1rem;
    margin: 0 -1rem; padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--border-color); box-shadow: 0 -4px 16px rgba(0,0,0,0.06); }
.po-bar-total { display: flex; flex-direction: column; line-height: 1.25; }
.po-bar-total strong { font-size: 1.3rem; }
.po-bar-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: flex-end; }
.po-body .btn-primary { background: var(--po-accent, var(--primary)); border-color: var(--po-accent, var(--primary)); }
.po-bar-actions .btn-ghost { background: transparent; border: 1px solid var(--border-color); color: var(--gray-600); }

.po-toast { position: fixed; left: 50%; bottom: 5.5rem; transform: translateX(-50%); z-index: 70; display: inline-flex; align-items: center; gap: 0.75rem; max-width: calc(100vw - 2rem);
    padding: 0.6rem 0.9rem; border-radius: 999px; background: var(--gray-800); color: #fff; font-size: 0.88rem; box-shadow: var(--shadow-md); }
.po-toast--success { background: var(--vx-green-fg); }
.po-toast--error { background: var(--vx-red-fg); }
.po-toast-close { background: none; border: 0; color: inherit; cursor: pointer; opacity: 0.8; }

.po-calm { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.po-calm-card { max-width: 440px; text-align: center; color: var(--gray-600); }
.po-calm-card h1 { font-size: 1.3rem; color: var(--text-primary); margin: 0.75rem 0 0.4rem; }

.po-readonly { padding: 0 1rem 1rem; }
.po-ro-line { display: grid; grid-template-columns: 1fr auto auto; gap: 0.5rem 1rem; padding: 0.6rem 0; border-top: 1px solid var(--border-color); align-items: start; }
.po-ro-line--removed { opacity: 0.55; text-decoration: line-through; }
.po-ro-code { font-family: ui-monospace, monospace; font-size: 0.75rem; color: var(--gray-500); }
.po-ro-total { text-align: right; font-variant-numeric: tabular-nums; }

.po-facts { display: grid; gap: 0.5rem; margin: 0; }
.po-facts > div { display: flex; flex-wrap: wrap; gap: 0.25rem 0.75rem; }
.po-facts dt { color: var(--gray-500); min-width: 8rem; }
.po-facts dd { margin: 0; }

.po-popup { max-width: 560px; width: calc(100vw - 2rem); }
.po-popup-main { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-start; }
.po-popup-img { width: 140px; max-width: 40%; border-radius: var(--radius); background: var(--gray-100); }
.po-popup-main .po-facts { flex: 1; min-width: 12rem; }
.po-popup-desc { white-space: pre-line; color: var(--gray-600); }
.po-popup-section { margin-top: 1rem; }
.po-popup-heading { font-weight: 600; margin-bottom: 0.4rem; }
.po-mini-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.po-mini-table th { text-align: left; color: var(--gray-500); font-weight: 500; }
.po-mini-table th, .po-mini-table td { padding: 0.3rem 0.5rem 0.3rem 0; border-bottom: 1px solid var(--border-color); }

.po-sheet { max-width: 520px; width: calc(100vw - 2rem); }
.po-sheet-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.5rem; margin-top: 1rem; }
.po-reasons { display: grid; gap: 0.5rem; margin-top: 0.75rem; }

/* Shared table additions for the portal (and the workspace): a read-only override price, a static stock word */
.so-override-readout { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.35rem; }
.so-special-tag { font-size: 0.7rem; font-weight: 600; padding: 0 0.4rem; border-radius: 999px; border: 1px solid currentColor; color: var(--vx-gold-fg); corner-shape: scoop; }
.pi-stock-static { cursor: default; }
.pi-stock-static--bo { opacity: 0.9; }

@media (max-width: 699px) {
    .po-bar { gap: 0.4rem; }
    .po-bar-total { flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 0.1rem 0.6rem; width: 100%; }
    .po-bar-total strong { font-size: 1.15rem; }
    .po-bar-actions { width: 100%; flex-wrap: nowrap; }
    .po-bar-actions .btn { flex: 1; justify-content: center; padding-left: 0.5rem; padding-right: 0.5rem; }
    .po-bar-actions .btn-ghost { font-size: 0.8rem; }
    .po-toast { bottom: 9rem; }
}

@media (min-width: 700px) {
    .po-shell { padding: 1.5rem 1.5rem 0; }
    .po-bar { margin: 0 -1.5rem; padding-left: 1.5rem; padding-right: 1.5rem; }
    .po-fields { grid-template-columns: 1fr 2fr; }
}

/* Portal, staff side (portal plan Phase 5): the preview page, the workspace link bar and portal notes */
.po-preview { padding: 0; background: transparent; min-height: 0; }
.po-shell--preview { max-width: 820px; margin: 0 auto; padding: 0 0 1rem; }
.vx-pv-staff { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem 1rem; padding: 0.75rem 1rem; margin-bottom: 1rem;
    border-radius: var(--radius); border: 1px dashed var(--vx-indigo-line); background: var(--vx-indigo-bg); color: var(--vx-indigo-fg); font-size: 0.9rem; }
.vx-pv-staff-main { display: flex; gap: 0.6rem; align-items: flex-start; min-width: 0; }
.vx-pv-link { margin-top: 0.2rem; font-size: 0.82rem; opacity: 0.9; }
.vx-pv-total { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.75rem; padding: 0.5rem 0.25rem 1rem; }
.vx-pv-total strong { font-size: 1.25rem; }

.vx-ws-link { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.75rem; padding: 0.4rem 0.75rem; margin-bottom: 0.6rem; border: 1px solid var(--border-color); border-radius: var(--radius);
    background: var(--gray-50); font-size: 0.85rem; color: var(--gray-600); }
.vx-ws-link--dead { opacity: 0.75; }
.vx-ws-link > span { flex: 1 1 14rem; min-width: 0; }
.vx-ws-portalnotes { display: grid; gap: 0.5rem; margin-bottom: 0.6rem; }
.vx-ws-note--warn { background: var(--vx-amber-bg); border-color: var(--vx-amber-line); color: var(--vx-amber-fg); }
.vx-ws-note ul { margin: 0.25rem 0 0; padding-left: 1.1rem; }
.vx-th-match--portal { align-items: center; }
.vx-th-linkct { display: inline-flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }
.vx-th-linkct .form-input { width: auto; min-width: 12rem; }
