:root {
            --brand: #E26A2C;
            --brand-deep: #B6531F;
            --sidebar: #ffffff;
            --sidebar-foreground: #2A2620;
            --sidebar-border: #ECE9E4;
            --sidebar-accent: #F4F4F5;
            --background: #FAFAF9;
            --card: #FFFFFF;
            --card-foreground: #18181B;
            --foreground: #18181B;
            --border: #ECE9E4;
            --radius: 0.75rem; /* 12px */
            --radius-md: 0.375rem; /* 6px */

            /* Capitalio palette & components */
            --chart-1: #2563EB;
            --chart-2: #7466F6;
            --chart-3: #FF7A00;
            --chart-4: #00DA92;
            --chart-5: #E10B05;
            --dashboard-icon-bg: conic-gradient(from 90deg, #5e5959 0%, #413f3f 6.25%, #242424 12.5%, #1d1b1b 28.481%, #2c2a2a 31.034%, #3b3838 33.588%, #585656 38.694%, #3e3c3c 46.951%, #242222 55.208%, #353232 62.885%, #464242 70.562%, #353333 76.351%, #242424 82.14%, #413f3f 91.07%, #5e5959 100%);
            --dashboard-icon-shadow: 1px 1px 0 rgb(0 0 0 / 25%);
            --premium-from: #efe189;
            --premium-mid: #ebc745;
            --premium-to: #e7ad00;
            --premium-foreground: #5a3300;
            --olika-switch-off: #94A3B8;
            --olika-switch-on: var(--brand, #E26A2C);
            --olika-switch-knob: #FFFFFF;
            --olika-switch-width: 52px;
            --olika-switch-height: 28px;
            --olika-switch-knob-size: 22px;
            --olika-switch-padding: 3px;
        }

        .dark {
            --sidebar: #151517;
            --sidebar-foreground: #E4E4E7;
            --sidebar-border: #27272A;
            --sidebar-accent: #202022;
            --background: #09090B;
            --card: #151517;
            --card-foreground: #FAFAFA;
            --foreground: #FAFAFA;
            --border: #27272A;
            --chart-1: #3B82F6;
            --chart-2: #818CF8;
            --chart-3: #FB923C;
            --chart-4: #34D399;
            --chart-5: #F87171;
        }

        * { font-family: 'Inter', system-ui, sans-serif; }
        [x-cloak] { display: none !important; }
        *, *::before, *::after { box-sizing: border-box; }
        .scrollbar-hide::-webkit-scrollbar { display: none; }
        .scrollbar-hide { -ms-overflow-style: none; scrollbar-width: none; }

        /* === Mobile refinements === */
body {
    padding-bottom: env(safe-area-inset-bottom, 0px);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Mobile font-size baseline — garante consistência entre elementos */
@media (max-width: 767px) {
    .text-responsive-base { font-size: 0.9375rem; }
    .text-responsive-sm { font-size: 0.8125rem; }
    .text-responsive-xs { font-size: 0.6875rem; }
    .text-responsive-title { font-size: 1.125rem; }
    .text-responsive-h2 { font-size: 1rem; }
}
@media (max-width: 767px) {
    .painel-content-area {
        padding-bottom: 0;
    }
    .painel-content-area > main,
    .painel-content-area > .resp-content {
        padding-bottom: calc(4rem + env(safe-area-inset-bottom, 0px)) !important;
    }
    body.sidebar-open { overflow: hidden; }
}
@media (min-width: 768px) {
    .painel-content-area {
        padding-bottom: 2rem;
    }
}

/* === Toast notifications (mobile-first) === */
.olika-toast {
    position: fixed;
    bottom: calc(6rem + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    padding: 0.75rem 1.25rem;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
    max-width: calc(100vw - 2rem);
    text-align: center;
    animation: toast-in 0.3s ease;
    pointer-events: auto;
}
@keyframes toast-in {
    from { opacity: 0; transform: translateX(-50%) translateY(1rem); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.olika-toast--success { background: #065f46; color: #ecfdf5; }
.olika-toast--error { background: #991b1b; color: #fef2f2; }
.olika-toast--info { background: #1e3a5f; color: #eff6ff; }
.dark .olika-toast--success { background: #064e3b; }
.dark .olika-toast--error { background: #7f1d1d; }
.dark .olika-toast--info { background: #1e3a5f; }

/* === Link tap highlight reset === */
a, button, [role="button"] {
    -webkit-tap-highlight-color: transparent;
}

/* === Master admin dark mode (fallback para views sem dark: explicito) === */
        .dark .master-content { --master-bg: #292524; --master-text: #f5f5f4; --master-muted: #a8a29e; --master-border: #44403c; --master-card: #1c1917; }

        /* === Utility classes para substituir style="" inline === */
        .font-display { font-family: var(--olika-font-display, 'Inter', 'DM Sans', system-ui, -apple-system, sans-serif); }
        .form-input-wrapper { position: relative; width: 100%; }
        .bg-beige { background: #f4efe8; }
        .text-crust { color: var(--olika-crust); }
        .border-warning { border-color: rgba(217,119,6,0.2); }

        /* === Global anti-overflow === */
        html, body { min-width: 0; background-color: var(--background); color: var(--foreground); }
        body { overflow-x: clip; max-width: 100vw; min-width: 0; }
        img, video, iframe, table, pre, code { max-width: 100%; display: block; }
        .overflow-wrap-anywhere { overflow-wrap: anywhere; word-break: break-word; }

        /* Padding/tamanho padrão sem especificidade (para <a>, <div> etc.):
           sobrescrito por .ui-button-{sm|md|lg|icon} e utilities px-*. */
        :where(
            .ui-button:not(.ui-button-icon),
            .ui-button-primary:not(.ui-button-icon),
            .ui-button-secondary:not(.ui-button-icon),
            .ui-button-danger:not(.ui-button-icon),
            .ui-button-ghost:not(.ui-button-icon),
            .ui-button-whatsapp:not(.ui-button-icon),
            .ui-button-success:not(.ui-button-icon),
            .ui-button-amber:not(.ui-button-icon),
            .ui-button-info:not(.ui-button-icon),
            .botao:not(.ui-button-icon)
        ) {
            padding: 0.5rem 1.125rem;
            font-size: 0.875rem;
        }
        /* Nativo <button> recebe o mesmo padding, mas com especificidade
           suficiente para vencer o reset do preflight. Como usa :where(),
           ainda perde para .ui-button-sm/md/lg, .ui-button-icon e px-*. */
        button:where(
            .ui-button:not(.ui-button-icon),
            .ui-button-primary:not(.ui-button-icon),
            .ui-button-secondary:not(.ui-button-icon),
            .ui-button-danger:not(.ui-button-icon),
            .ui-button-ghost:not(.ui-button-icon),
            .ui-button-whatsapp:not(.ui-button-icon),
            .ui-button-success:not(.ui-button-icon),
            .ui-button-amber:not(.ui-button-icon),
            .ui-button-info:not(.ui-button-icon),
            .botao:not(.ui-button-icon)
        ) {
            padding: 0.5rem 1.125rem;
            font-size: 0.875rem;
        }
        /* === UI design system === */
        .ui-button,
        .ui-button-primary,
        .ui-button-secondary,
        .ui-button-danger,
        .ui-button-ghost,
        .ui-button-whatsapp,
        .ui-button-success,
        .ui-button-amber,
        .ui-button-info,
        .botao,
        .btn-sm {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 0.5rem;
            min-height: 44px;
            border-radius: var(--radius) !important;
            font-weight: 600;
            transition: all .15s ease;
            border: 1px solid transparent;
            text-decoration: none;
            cursor: pointer;
            -webkit-tap-highlight-color: transparent;
            user-select: none;
        }
        .ui-button:active, .ui-button-primary:active, .ui-button-secondary:active,
        .ui-button-danger:active, .ui-button-ghost:active, .ui-button-whatsapp:active,
        .ui-button-success:active, .ui-button-amber:active, .ui-button-info:active,
        .botao:active, .btn-sm:active {
            transform: scale(0.97);
        }
        .ui-button:focus-visible, .ui-button-primary:focus-visible, .ui-button-secondary:focus-visible,
        .ui-button-danger:focus-visible, .ui-button-ghost:focus-visible, .ui-button-whatsapp:focus-visible,
        .ui-button-success:focus-visible, .ui-button-amber:focus-visible, .ui-button-info:focus-visible,
        .botao:focus-visible, .btn-sm:focus-visible {
            outline: 2px solid var(--brand);
            outline-offset: 2px;
            box-shadow: 0 0 0 4px rgba(226, 106, 44, 0.2);
        }
        .ui-button-primary {
            background-color: color-mix(in srgb, var(--brand) 12%, white);
            color: var(--brand);
            border-color: color-mix(in srgb, var(--brand) 40%, transparent);
            box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
        }
        .ui-button-secondary {
            background-color: white;
            color: var(--brand);
            border-color: color-mix(in srgb, var(--brand) 25%, transparent);
        }
        .ui-button-danger {
            background-color: #fef2f2;
            color: #dc2626;
            border-color: rgba(239, 68, 68, 0.3);
        }
        .ui-button-ghost {
            background-color: transparent;
            color: var(--brand);
            border-color: transparent;
        }
        .ui-button-success {
            background-color: #ecfdf5;
            color: #15803d;
            border-color: rgba(21, 128, 61, 0.25);
        }
        .ui-button-amber {
            background-color: #fffbeb;
            color: #b45309;
            border-color: rgba(180, 83, 9, 0.25);
        }
        .ui-button-info {
            background-color: #f0f9ff;
            color: #0369a1;
            border-color: rgba(3, 105, 161, 0.25);
        }
        .ui-button-sm, .btn-sm { padding: 0.5rem 1rem; font-size: 0.875rem; }
        .ui-button-md { padding: 0.5rem 1.25rem; font-size: 0.875rem; }
        .ui-button-lg { padding: 0.75rem 1.5rem; font-size: 1rem; min-height: 48px; }
        .ui-button--pill { border-radius: 9999px !important; }
        .ui-button--full { width: 100%; }
        .ui-button-primary:hover { background-color: color-mix(in srgb, var(--brand) 20%, white); }
        .ui-button-secondary:hover { background-color: color-mix(in srgb, var(--brand) 12%, white); }
        .ui-button-danger:hover { background-color: #fee2e2; }
        .ui-button-ghost:hover { background-color: color-mix(in srgb, var(--brand) 10%, transparent); }
        .ui-button-ghost.text-destructive { color: var(--destructive, #dc2626); }
        .ui-button-ghost.text-destructive:hover { background-color: rgba(239, 68, 68, 0.1); }
        .ui-button-ghost.text-muted-foreground { color: var(--muted-foreground, #7b736a); }
        .ui-button-success:hover { background-color: #d1fae5; }
        .ui-button-amber:hover { background-color: #fef3c7; }
        .ui-button-info:hover { background-color: #e0f2fe; }
        
        .ui-input,
        .input-app,
        .ui-select,
        .select-app,
        .ui-textarea {
            width: 100%;
            min-width: 0;
            min-height: 48px;
            border: 1px solid var(--border);
            background: var(--card);
            color: var(--foreground);
            padding: 0.75rem 1rem;
            border-radius: var(--radius) !important;
            outline: none;
            transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease, color .15s ease;
            font-size: 16px;
            line-height: 1.35;
        }
        .ui-input::placeholder,
        .input-app::placeholder,
        .ui-textarea::placeholder { color: #9ca3af; }
        .ui-select,
        .select-app {
            appearance: none;
            -webkit-appearance: none;
            -moz-appearance: none;
            padding-right: 2.5rem;
            cursor: pointer;
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239CA3AF' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
            background-repeat: no-repeat;
            background-position: right 0.75rem center;
            background-size: 12px;
        }
        .ui-textarea {
            min-height: 7rem;
            resize: vertical;
        }
        .ui-select:hover,
        .select-app:hover { border-color: #d1d5db; }
        .dark .ui-select:hover,
        .dark .select-app:hover { border-color: #64748b; }
        .dark .ui-input,
        .dark .input-app,
        .dark .ui-select,
        .dark .select-app,
        .dark .ui-textarea {
            background-color: #1e293b;
            border-color: #475569;
            color: #f8fafc;
        }
        .dark .ui-select,
        .dark .select-app {
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
        }
        .ui-input:focus,
        .input-app:focus,
        .ui-select:focus,
        .select-app:focus,
        .ui-textarea:focus {
            border-color: var(--brand);
            box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 30%, transparent);
        }
        .dark .ui-input:focus,
        .dark .input-app:focus,
        .dark .ui-select:focus,
        .dark .select-app:focus,
        .dark .ui-textarea:focus {
            border-color: var(--brand);
            box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 40%, transparent);
        }
        .dark .ui-button-secondary {
            background-color: transparent;
            color: var(--brand);
            border-color: color-mix(in srgb, var(--brand) 30%, transparent);
        }
        .dark .ui-button-secondary:hover {
            background-color: color-mix(in srgb, var(--brand) 10%, transparent);
        }
        .dark .ui-button-ghost {
            color: #f1f5f9;
            border-color: #334155;
        }
        .dark .ui-button-ghost:hover {
            background-color: rgba(71, 85, 105, 0.4);
        }
        .dark .ui-button-success {
            background-color: rgba(34, 197, 94, 0.2);
            color: #86efac;
            border-color: rgba(34, 197, 94, 0.35);
        }
        .dark .ui-button-success:hover {
            background-color: rgba(34, 197, 94, 0.28);
        }
        .dark .ui-button-amber {
            background-color: rgba(245, 158, 11, 0.2);
            color: #fcd34d;
            border-color: rgba(245, 158, 11, 0.35);
        }
        .dark .ui-button-amber:hover {
            background-color: rgba(245, 158, 11, 0.28);
        }
        .dark .ui-button-info {
            background-color: rgba(14, 165, 233, 0.2);
            color: #7dd3fc;
            border-color: rgba(14, 165, 233, 0.35);
        }
        .dark .ui-button-info:hover {
            background-color: rgba(14, 165, 233, 0.28);
        }
        .ui-card {
            background: var(--card);
            border: 1px solid var(--border);
            border-radius: calc(var(--radius) + 4px);
            box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03), 0 8px 24px -12px rgba(24, 24, 27, 0.18);
            overflow: visible;
        }
        .ui-card:focus-within,
        .ui-card:has(.combo-dropdown--open) {
            position: relative;
            z-index: 30;
        }
        .ui-card--clipped { overflow: hidden; }
        .ui-card--flat { box-shadow: none; }
        .ui-card--interactive {
            transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
        }
        .ui-card--interactive:hover {
            border-color: color-mix(in srgb, var(--brand) 40%, var(--border));
            box-shadow: 0 4px 16px -6px rgba(24, 24, 27, 0.12);
        }
        .dark .ui-card--interactive:hover {
            border-color: color-mix(in srgb, var(--brand) 50%, var(--border));
        }
        .ui-card-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 0.75rem;
            padding: 0.875rem 1.25rem;
            border-bottom: 1px solid var(--border);
            border-top-left-radius: inherit;
            border-top-right-radius: inherit;
            background-color: color-mix(in srgb, var(--foreground) 4%, transparent);
        }
        .ui-card-title {
            font-size: 0.9375rem;
            font-weight: 600;
            color: var(--foreground);
            margin: 0;
            line-height: 1.25;
        }
        .ui-card-body { padding: 1rem 1.25rem; }
        @media (min-width: 640px) {
            .ui-card-body { padding: 1.5rem; }
        }
        .ui-card-body--compact { padding: 0.75rem 1rem; }
        .ui-stat-label { font-size: 0.6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted-foreground, #9CA3AF); }
        .ui-tab-ativa { background: var(--brand); color: #fff; }
        .ui-tab-inativa { background: transparent; color: var(--muted-foreground, #7B736A); }
        .ui-tab-inativa:hover { background: rgba(0,0,0,.05); }
        .dark .ui-tab-inativa:hover { background: rgba(255,255,255,.08); }
        .ui-button-whatsapp { background: #25D366; color: #fff; border: none; }
        .ui-button-whatsapp:hover { background: #20ba56; }

        .preview-swatch-header { background-color: var(--preview-header, #44403C); }
        .preview-swatch-accent { background-color: var(--preview-accent, #F59E0B); }
        .preview-swatch-bg { background-color: var(--preview-bg, #FAFAF9); }
        .preview-swatch-button { background-color: var(--preview-accent, #F59E0B); color: var(--preview-header, #44403C); }

        .olika-cor-badge::before {
            content: '';
            position: absolute;
            inset: 0;
            border-radius: inherit;
            opacity: 0.12;
            background-color: inherit;
        }
        .olika-cor-badge {
            position: relative;
            background-color: transparent !important;
            color: inherit;
        }
        @keyframes ui-fade-slide-down { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
        .ui-fade-slide-down { animation: ui-fade-slide-down 0.25s ease; }
        .ui-stat-card-icon { width: 2.5rem; height: 2.5rem; border-radius: 0.75rem; display: flex; align-items: center; justify-content: center; font-size: 1.125rem; flex-shrink: 0; }
        .ui-stat-card-value { font-size: 1.25rem; font-weight: 700; margin-top: 0.25rem; }
        @media (min-width: 768px) { .ui-stat-card-value { font-size: 1.5rem; } }

        .dark .ui-stat-label { color: #9CA3AF; }

        .ui-page-header {
            display: flex;
            flex-direction: column;
            gap: 0.75rem;
            margin-bottom: 1.25rem;
            background: var(--card);
            border: 1px solid var(--border);
            border-radius: var(--radius);
            box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
            padding: 1.25rem 1.75rem;
        }
        @media (min-width: 640px) {
            .ui-page-header {
                flex-direction: row;
                align-items: center;
                justify-content: space-between;
            }
        }
        .ui-page-title { font-size: 1.25rem; font-weight: 700; color: #0f172a; }
        @media (min-width: 640px) {
            .ui-page-title { font-size: 1.5rem; }
        }
        .ui-page-description { margin-top: 0.5rem; font-size: 0.8125rem; font-weight: 500; line-height: 1.45; color: #6b7280; }
        @media (min-width: 640px) {
            .ui-page-description { font-size: 0.875rem; }
        }
        .dark .ui-page-title { color: #f8fafc; }
        .dark .ui-page-description { color: #94a3b8; }

        /* === Responsivo === */
        .app-shell {
            height: 100vh;
            min-height: 100vh;
        }
        @supports (height: 100dvh) {
            .app-shell {
                height: 100dvh;
                min-height: 100dvh;
            }
        }
        @media (max-width: 412px) {
            .resp-padding { padding-left: 0.75rem !important; padding-right: 0.75rem !important; }
            .resp-gap { gap: 0.5rem !important; }
            .resp-text { font-size: 0.8125rem !important; }
            .resp-stack { flex-direction: column !important; }
            .resp-full { width: 100% !important; }
            .resp-hide { display: none !important; }
            .resp-content { width: 100% !important; max-width: min(405px, calc(100vw - 1rem)) !important; margin-left: auto !important; margin-right: auto !important; padding-left: 0.75rem !important; padding-right: 0.75rem !important; box-sizing: border-box !important; overflow-x: clip !important; overflow-y: visible !important; min-height: auto !important; }
            /* No painel administrativo, o conteúdo deve ocupar a largura total útil sem corte lateral */
            .painel-content-area .resp-content,
            .app-shell .resp-content { width: 100% !important; max-width: 100% !important; margin-left: 0 !important; margin-right: 0 !important; padding-left: 0.625rem !important; padding-right: 0.625rem !important; }
            .resp-card { max-width: 100% !important; box-sizing: border-box !important; }
            .resp-table-wrap { overflow-x: auto !important; -webkit-overflow-scrolling: touch; }
            .resp-table-wrap table { width: 100%; table-layout: auto; }
            .resp-table-wrap td, .resp-table-wrap th { white-space: normal !important; overflow-wrap: anywhere !important; word-break: break-word !important; min-width: 0 !important; }
        }
        @media (min-width: 411px) and (max-width: 768px) {
            .resp-padding { padding-left: 1rem !important; padding-right: 1rem !important; }
            .resp-gap { gap: 0.75rem !important; }
            .resp-content { max-width: 100%; overflow-x: clip !important; overflow-y: visible !important; min-height: auto !important; }
            .painel-content-area .resp-content,
            .app-shell .resp-content { width: 100% !important; max-width: 100% !important; }
            .resp-card { max-width: 100% !important; box-sizing: border-box !important; }
            .resp-table-wrap { overflow-x: auto !important; -webkit-overflow-scrolling: touch; }
        }
        @media (min-width: 769px) {
            .resp-grid-2 { grid-template-columns: repeat(2, 1fr); }
            .resp-grid-3 { grid-template-columns: repeat(3, 1fr); }
            .resp-grid-4 { grid-template-columns: repeat(4, 1fr); }
            td, th { white-space: nowrap; }
        }
        @media (max-width: 768px) {
            .resp-content.overflow-y-auto {
                overflow-y: auto !important;
                -webkit-overflow-scrolling: touch;
            }
            .resp-table-wrap { overflow-x: auto !important; }
            .resp-grid-2 { grid-template-columns: 1fr !important; }
            .resp-grid-3 { grid-template-columns: 1fr !important; }
            .resp-grid-4 { grid-template-columns: 1fr 1fr !important; }
            table { table-layout: auto; width: 100%; }
            /* Correção de bug: td/th globais não devem ter largura zero nem quebra forçada que destrói tabelas responsivas */
            .resp-table-wrap td, .resp-table-wrap th { 
                white-space: normal !important; 
                overflow-wrap: anywhere !important; 
                word-break: break-word !important; 
            }
        }
        @media (max-width: 410px) {
            td, th { padding: 0.375rem 0.25rem !important; font-size: 0.75rem !important; }
            .btn-sm { padding: 0.5rem 0.75rem !important; font-size: 0.75rem !important; min-height: 44px; min-width: 44px; }
            input, select, textarea { font-size: 16px !important; }
        }
        table { min-width: 0; width: 100%; }

        /* === Mobile Touch Targets & Feedback === */
        @media (max-width: 768px) {
            .ui-button-sm, .btn-sm {
                min-height: 44px;
                min-width: 44px;
                padding: 0.625rem 1rem !important;
                font-size: 0.8125rem !important;
            }
            .ui-button-md {
                min-height: 48px;
                min-width: 48px;
            }
            /* Links de navegação com área de toque adequada */
            nav a, .sidebar-link, .menu-grupo-btn {
                min-height: 44px;
                display: flex;
                align-items: center;
            }
        }
        /* Feedback visual de toque — escala sutil ao pressionar */
        .touch-feedback:active,
        .ui-button:active,
        nav a:active {
            transform: scale(0.97);
            opacity: 0.85;
            transition: transform 0.08s ease, opacity 0.08s ease;
        }
        .touch-feedback:focus-visible,
        nav a:focus-visible {
            outline: 2px solid var(--brand);
            outline-offset: 2px;
            border-radius: 0.5rem;
        }
        /* === Bottom Tab Bar (Painel Mobile) === */
        .bottom-tab-bar {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            z-index: 90;
            background: white;
            border-top: 1px solid #e5e7eb;
            display: flex;
            align-items: stretch;
            justify-content: space-around;
            padding-bottom: env(safe-area-inset-bottom, 0px);
            box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.08);
        }
        .dark .bottom-tab-bar {
            background: #1e293b;
            border-top-color: #334155;
            box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
        }
        .bottom-tab-item {
            position: relative;
            flex: 1;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 2px;
            padding: 8px 4px 6px;
            min-height: 56px;
            color: #6b7280;
            text-decoration: none;
            font-size: 0.625rem;
            font-weight: 500;
            letter-spacing: 0.01em;
            transition: color 0.15s ease;
            -webkit-tap-highlight-color: transparent;
            user-select: none;
        }
        .bottom-tab-item:active {
            transform: scale(0.92);
            transition: transform 0.08s ease;
        }
        .dark .bottom-tab-item {
            color: #9ca3af;
        }
        .bottom-tab-item.active {
            color: var(--brand);
        }
        .dark .bottom-tab-item.active {
            color: var(--brand);
        }
        .bottom-tab-item i {
            font-size: 1.25rem;
            line-height: 1;
        }
        /* Indicador ativo da tab */
        .bottom-tab-item.active::before {
            content: '';
            position: absolute;
            top: 0;
            left: 25%;
            right: 25%;
            height: 3px;
            background: var(--brand);
            border-radius: 0 0 4px 4px;
        }
        @media (min-width: 768px) {
            .bottom-tab-bar { display: none !important; }
        }

        /* === Toggle switch (padrão global — trilho deslizante) === */

        .olika-switch-input,
        label.olika-switch > input[type="checkbox"],
        .wa-switch > input[type="checkbox"] {
            position: absolute !important;
            opacity: 0 !important;
            width: 0 !important;
            height: 0 !important;
            margin: 0 !important;
            padding: 0 !important;
            appearance: none !important;
            -webkit-appearance: none !important;
            pointer-events: none !important;
        }

        .olika-switch,
        label.olika-switch,
        .olika-switch-row-interactive .olika-switch-visual,
        .wa-switch {
            position: relative;
            display: inline-block;
            width: var(--olika-switch-width);
            height: var(--olika-switch-height);
            flex-shrink: 0;
        }

        .olika-switch-track,
        .wa-slider,
        .wa-switch .olika-switch-track {
            position: absolute;
            cursor: pointer;
            inset: 0;
            background-color: var(--olika-switch-off);
            transition: background-color 0.25s ease;
            border-radius: 9999px;
        }

        .olika-switch-track::before,
        .wa-slider::before,
        .wa-switch .olika-switch-track::before {
            content: "";
            position: absolute;
            top: var(--olika-switch-padding);
            left: var(--olika-switch-padding);
            width: var(--olika-switch-knob-size);
            height: var(--olika-switch-knob-size);
            background-color: var(--olika-switch-knob);
            transition: transform 0.25s ease;
            border-radius: 50%;
            box-shadow: 0 1px 3px rgba(15, 23, 42, 0.2);
        }

        .olika-switch-input:checked + .olika-switch-track,
        label.olika-switch > input[type="checkbox"]:checked + .olika-switch-track,
        .wa-switch > input[type="checkbox"]:checked + .olika-switch-track,
        .wa-switch > input[type="checkbox"]:checked + .wa-slider {
            background-color: var(--olika-switch-on);
        }

        .olika-switch-input:checked + .olika-switch-track::before,
        label.olika-switch > input[type="checkbox"]:checked + .olika-switch-track::before,
        .wa-switch > input[type="checkbox"]:checked + .olika-switch-track::before,
        .wa-switch > input[type="checkbox"]:checked + .wa-slider::before {
            transform: translateX(calc(var(--olika-switch-width) - var(--olika-switch-knob-size) - (var(--olika-switch-padding) * 2)));
        }

        .olika-switch-input:focus-visible + .olika-switch-track,
        label.olika-switch > input[type="checkbox"]:focus-visible + .olika-switch-track,
        .wa-switch > input[type="checkbox"]:focus-visible + .olika-switch-track,
        .wa-switch > input[type="checkbox"]:focus-visible + .wa-slider {
            box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.28);
        }

        .olika-switch-input:disabled + .olika-switch-track,
        label.olika-switch > input[type="checkbox"]:disabled + .olika-switch-track {
            opacity: 0.55;
            cursor: not-allowed;
        }

        .dark label.olika-switch .olika-switch-track,
        .dark .wa-switch .olika-switch-track,
        .dark .wa-switch .wa-slider {
            background-color: #64748B;
        }

        .dark .olika-switch-input:checked + .olika-switch-track,
        .dark label.olika-switch > input[type="checkbox"]:checked + .olika-switch-track,
        .dark .wa-switch > input[type="checkbox"]:checked + .olika-switch-track,
        .dark .wa-switch > input[type="checkbox"]:checked + .wa-slider {
            background-color: var(--brand, #E26A2C);
        }

        .olika-switch--compact {
            --olika-switch-width: 44px;
            --olika-switch-height: 24px;
            --olika-switch-knob-size: 18px;
        }

        .olika-switch-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 1rem;
            min-height: 44px;
            padding: 0.625rem 0;
        }

        .olika-switch-row-interactive {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 1rem;
            min-height: 44px;
            padding: 0.625rem 0;
            cursor: pointer;
            user-select: none;
            -webkit-tap-highlight-color: transparent;
        }

        .olika-switch-row-copy {
            flex: 1;
            min-width: 0;
        }

        .olika-switch-field-label {
            display: block;
            font-size: 0.875rem;
            font-weight: 600;
            color: var(--foreground);
        }

        .dark .olika-switch-field-label {
            color: #f3f4f6;
        }

        .olika-switch-field-desc {
            display: block;
            font-size: 0.625rem;
            font-weight: 600;
            color: #7B736A;
            margin-top: 0.125rem;
        }

        .dark .olika-switch-field-desc {
            color: #9ca3af;
        }

        .olika-switch-list > .olika-switch-row-interactive + .olika-switch-row-interactive,
        .olika-switch-list > .olika-switch-row + .olika-switch-row,
        .olika-switch-list > .olika-switch-row-interactive + .olika-switch-row,
        .olika-switch-list > .olika-switch-row + .olika-switch-row-interactive {
            border-top: 1px solid var(--border);
        }

        .dark .olika-switch-list > .olika-switch-row-interactive + .olika-switch-row-interactive,
        .dark .olika-switch-list > .olika-switch-row + .olika-switch-row,
        .dark .olika-switch-list > .olika-switch-row-interactive + .olika-switch-row,
        .dark .olika-switch-list > .olika-switch-row + .olika-switch-row-interactive {
            border-top-color: #374151;
        }

        .olika-switch-inline {
            display: inline-flex;
            align-items: center;
            gap: 0.5rem;
            min-height: 44px;
            cursor: pointer;
            user-select: none;
        }

        .olika-switch-inline-label {
            font-size: 0.625rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.04em;
            color: #64748B;
        }

        .dark .olika-switch-inline-label {
            color: #94A3B8;
        }

        /* Barra canônica de ações de formulário: no desktop fica estática e
           alinhada à direita; o layout compacto/centralizado do mobile é
           definido em olika-responsivo-sistemico.css. */
        .olika-form-acoes {
            display: flex;
            align-items: center;
            justify-content: flex-end;
            gap: 0.75rem;
        }

        /* A regra sistêmica `.sticky-mobile-action-bar > *` alinha os filhos
           à direita; nos botões canônicos o conteúdo deve ficar centralizado. */
        .olika-form-acoes > .ui-button {
            justify-content: center;
        }

        .sticky-mobile-action-bar .ui-button-md,
        .olika-form-acoes .ui-button-md {
            min-height: 44px;
            min-width: 0;
            padding: 0.5rem 1.125rem;
            font-size: 0.875rem;
        }

        @media (max-width: 767.98px) {
            .sticky-mobile-action-bar.olika-form-acoes {
                justify-content: center;
                gap: 0.5rem;
            }

            .sticky-mobile-action-bar.olika-form-acoes > .ui-button {
                flex: 0 1 auto;
                min-width: 0;
                padding-left: 1rem;
                padding-right: 1rem;
            }

            .sticky-mobile-action-bar.olika-form-acoes--split {
                justify-content: center;
                gap: 0.5rem;
            }

            .sticky-mobile-action-bar.olika-form-acoes--split > * {
                flex: 0 1 auto;
                min-width: 0;
                justify-content: center;
            }

            .sticky-mobile-action-bar.olika-form-acoes--split .ui-button {
                flex: 0 1 auto;
                min-width: 0;
                padding-left: 1rem;
                padding-right: 1rem;
            }
        }

        @media (min-width: 768px) {
            .sticky-mobile-action-bar.olika-form-acoes {
                padding: 0.5rem 0 1.5rem;
            }

            .olika-form-acoes .ui-button {
                flex: 0 0 auto;
            }
        }

        /* === Sticky Action Bar (Formulários Mobile) === */
        .sticky-mobile-action-bar {
            position: fixed;
            bottom: calc(56px + env(safe-area-inset-bottom, 0px));
            left: 0;
            right: 0;
            z-index: 85;
            background: var(--card, #ffffff);
            border-top: 1px solid var(--border, #e5e7eb);
            padding: 0.75rem 1rem;
            display: flex;
            align-items: center;
            justify-content: flex-end;
            gap: 0.5rem;
            box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.08);
            backdrop-filter: blur(12px);
        }
        .dark .sticky-mobile-action-bar {
            background: var(--card, #1e293b);
            border-top-color: var(--border, #334155);
            box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.3);
        }
        @media (min-width: 768px) {
            .sticky-mobile-action-bar {
                position: static;
                z-index: auto;
                box-shadow: none;
                border-top: none;
                padding: 0;
                background: transparent;
                backdrop-filter: none;
            }
        }

        /* === Capitalio Dashboard Aesthetics & Animations === */
        .shadow-custom {
            box-shadow: inset 4px 0 4px 0 rgb(0 0 0 / 1%), 0 1px 3px 0 rgb(0 0 0 / 4%);
        }
        .dark .shadow-custom {
            box-shadow: inset 4px 0 4px 0 rgb(255 255 255 / 3%), 0 1px 3px 0 rgb(0 0 0 / 25%);
        }

        .active-sidebar-item {
            position: relative;
            background-color: var(--sidebar-accent) !important;
            color: var(--foreground) !important;
            box-shadow:
                0 0 5px 0 rgb(0 0 0 / 8%),
                inset 0 0 4px 2px rgb(0 0 0 / 3%);
        }

        .active-sidebar-item::before {
            position: absolute;
            inset: 0;
            padding: 1px;
            border-radius: inherit;
            background: linear-gradient(90deg, #f4f4f4 0%, #e3e3e3 50%, #ececec 100%);
            content: "";
            pointer-events: none;
            -webkit-mask:
                linear-gradient(#000 0 0) content-box,
                linear-gradient(#000 0 0);
            -webkit-mask-composite: xor;
            mask-composite: exclude;
        }

        .dark .active-sidebar-item {
            box-shadow:
                0 0 5px 0 rgb(0 0 0 / 60%),
                inset 0 0 4px 2px rgb(255 255 255 / 3%);
        }

        .dark .active-sidebar-item::before {
            background: linear-gradient(90deg, #27272A 0%, #3F3F46 50%, #18181B 100%);
        }

        .dashboard-icon-badge {
            background-image: var(--dashboard-icon-bg);
            box-shadow: var(--dashboard-icon-shadow);
        }

        .dashboard-dot-grid {
            background-image: radial-gradient(
                circle,
                color-mix(in srgb, var(--foreground) 10%, transparent) 1px,
                transparent 1px
            );
            background-size: 1.25rem 1.25rem;
        }

        .dashboard-progress-fill {
            transform-origin: left;
            animation: dashboard-progress-grow 700ms ease-out both;
        }

        @keyframes dashboard-progress-grow {
            from {
                transform: scaleX(0);
            }
            to {
                transform: scaleX(1);
            }
        }

        .premium-badge {
            display: inline-flex;
            align-items: center;
            width: fit-content;
            padding: 0.2rem 0.5rem;
            border-radius: 9999px;
            font-size: 0.65rem;
            font-weight: 700;
            line-height: 1;
            letter-spacing: 0.025em;
            text-transform: uppercase;
            background: linear-gradient(90deg, var(--premium-from) 0%, var(--premium-mid) 50%, var(--premium-to) 100%);
            color: var(--premium-foreground);
        }

        /* Acessibilidade Mobile & Touch Targets (Mínimo WCAG 44x44px) */
        .touch-target-44 {
            min-width: 44px !important;
            min-height: 44px !important;
            display: inline-flex;
            align-items: center;
            justify-content: center;
        }

        /* Efeito de Skeleton Loading Suave */
        .skeleton-shimmer {
            background: linear-gradient(90deg, rgba(240,237,233,0.7) 25%, rgba(250,248,245,0.9) 50%, rgba(240,237,233,0.7) 75%);
            background-size: 200% 100%;
            animation: shimmer 1.5s infinite;
        }

        @keyframes shimmer {
            0% { background-position: 200% 0; }
            100% { background-position: -200% 0; }
        }
/* progress */
.progress-campanha { appearance: none; width: 100%; height: .5rem; border: 0; border-radius: 9999px; overflow: hidden; background: var(--border); }
.progress-campanha::-webkit-progress-bar { background: var(--border); }
.progress-campanha::-webkit-progress-value { background: var(--brand); transition: width .4s ease; }
.progress-campanha::-moz-progress-bar { background: var(--brand); }

@media (max-width: 1023px) {
    .campanha-form input,
    .campanha-form select,
    .campanha-form textarea,
    .campanha-form button {
        min-height: 44px;
    }
}

/* Foco visível para navegação por teclado */
:where(a, button, input, select, textarea):focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

/* ==========================================================================
   Base de Componentes Padronizados — fonte única de estilização
   Change: padronizacao-css-componentes-base
   CSS nativo com custom properties e aliases legados ativos em blocos acima.
   ========================================================================== */

/* --- Campo, rótulo e mensagens ------------------------------------------- */

.ui-field {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    min-width: 0;
}

.ui-label {
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--foreground);
}

.ui-field__hint {
    font-size: 0.75rem;
    line-height: 1.4;
    color: #6b7280;
}

.ui-field__error {
    font-size: 0.75rem;
    line-height: 1.4;
    font-weight: 500;
    color: #dc2626;
}

/* --- Modificadores de input/select/textarea ------------------------------ */

.ui-input--sm,
.ui-input--compact {
    min-height: 44px;
    padding-top: 0.5625rem;
    padding-bottom: 0.5625rem;
}

@media (min-width: 640px) {
    .ui-input--sm {
        min-height: 40px;
        padding-top: 0.4375rem;
        padding-bottom: 0.4375rem;
    }
    .ui-input--compact {
        min-height: 36px;
        padding-top: 0.3125rem;
        padding-bottom: 0.3125rem;
    }
}

.ui-input--mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-variant-numeric: tabular-nums;
}

.ui-input--search {
    padding-left: 2.25rem;
}

.ui-input--pill {
    border-radius: 9999px !important;
}

.ui-input--suffix {
    padding-right: 3rem;
}

.ui-input--error {
    border-color: #dc2626;
}

.ui-input:disabled,
.ui-select:disabled,
.ui-textarea:disabled {
    background: var(--background);
    color: #9ca3af;
    cursor: not-allowed;
    opacity: 1;
}

.ui-input--error:focus {
    border-color: #dc2626;
    box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.25);
}

.ui-input--readonly {
    background: var(--background);
    color: #6b7280;
    cursor: default;
}

.dark .ui-input--error,
.dark .ui-select.ui-input--error,
.dark .ui-textarea.ui-input--error {
    border-color: #f87171;
}

.dark .ui-input--error:focus,
.dark .ui-select.ui-input--error:focus,
.dark .ui-textarea.ui-input--error:focus {
    border-color: #f87171;
    box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.25);
}

.dark .ui-input:disabled,
.dark .ui-select:disabled,
.dark .ui-textarea:disabled {
    background-color: #0f172a;
    border-color: #334155;
    color: #64748b;
}

.dark .ui-input--readonly {
    background-color: #0f172a;
    border-color: #334155;
    color: #94a3b8;
}

.ui-input--full { width: 100%; }
.ui-input--auto { width: auto; }
.ui-input--w16 { width: 4rem; }
.ui-input--w20 { width: 5rem; }
.ui-input--w24 { width: 6rem; }
.ui-input--w32 { width: 8rem; }

/* --- Controles marcáveis ------------------------------------------------- */

.ui-checkbox,
.ui-radio {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
    accent-color: var(--brand);
    cursor: pointer;
}

.ui-check-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 44px;
    cursor: pointer;
}

/* --- Botão somente ícone ------------------------------------------------- */

.ui-button-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    flex-shrink: 0;
    border-radius: var(--radius);
    cursor: pointer;
    border: 1px solid transparent;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease, transform .15s ease;
    -webkit-tap-highlight-color: transparent;
}

.ui-button-icon--subtle {
    background-color: transparent;
    border-color: transparent;
    box-shadow: none;
}

.ui-button-icon--subtle:hover {
    background-color: color-mix(in srgb, var(--foreground) 6%, transparent);
}

.dark .ui-button-icon--subtle:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

@media (min-width: 768px) and (pointer: fine) {
    .ui-button-icon--compact {
        width: 36px;
        height: 36px;
        min-width: 36px;
        min-height: 36px;
    }
}

.ui-button.hidden,
.ui-button-icon.hidden {
    display: none;
}

/* --- Barra e chip de filtros --------------------------------------------- */

.ui-filter-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.125rem;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.ui-filter-bar::-webkit-scrollbar { display: none; }

.ui-filter-tag,
.filter-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    min-height: 44px;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    border: 1px solid var(--border);
    background: var(--card);
    color: #7b736a;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease, transform .15s ease;
    -webkit-tap-highlight-color: transparent;
}

.ui-filter-tag:hover,
.filter-tag:hover {
    border-color: #d1d5db;
    background: color-mix(in srgb, var(--foreground) 4%, transparent);
}
.ui-filter-tag:active,
.filter-tag:active { transform: scale(0.95); }

.ui-filter-tag:focus-visible,
.filter-tag:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

.ui-filter-tag--active,
.ui-filter-tag[data-ativo="true"],
.filter-tag--active {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.ui-filter-tag--active:hover,
.ui-filter-tag[data-ativo="true"]:hover,
.filter-tag--active:hover {
    background: var(--brand);
    border-color: var(--brand);
}

.dark .ui-filter-tag,
.dark .filter-tag {
    background: #1e293b;
    border-color: #475569;
    color: #cbd5e1;
}

.dark .ui-filter-tag--active,
.dark .ui-filter-tag[data-ativo="true"],
.dark .filter-tag--active {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.ui-filter-tag--sobre-marca {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.28);
    color: rgba(255, 255, 255, 0.92);
}

.ui-filter-tag--sobre-marca:hover {
    background: rgba(255, 255, 255, 0.26);
    border-color: rgba(255, 255, 255, 0.45);
    color: #ffffff;
}

.ui-filter-tag--sobre-marca:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

.ui-filter-tag--sobre-marca.ui-filter-tag--active,
.ui-filter-tag--sobre-marca[data-ativo="true"] {
    background: #ffffff;
    border-color: #ffffff;
    color: var(--brand);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.dark .ui-filter-tag--sobre-marca {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.26);
    color: rgba(255, 255, 255, 0.92);
}

.dark .ui-filter-tag--sobre-marca:hover {
    background: rgba(255, 255, 255, 0.24);
    border-color: rgba(255, 255, 255, 0.42);
    color: #ffffff;
}

.dark .ui-filter-tag--sobre-marca.ui-filter-tag--active,
.dark .ui-filter-tag--sobre-marca[data-ativo="true"] {
    background: #ffffff;
    border-color: #ffffff;
    color: var(--brand);
}

@media (min-width: 768px) and (pointer: fine) {
    .ui-filter-tag,
    .filter-tag { min-height: 36px; }
}

/* --- Abas / Tabs ---------------------------------------------------------- */

.ui-tablist {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    border-bottom: 1px solid var(--border);
}

.ui-tablist--pills {
    border-bottom: 0;
}

.ui-tablist::-webkit-scrollbar { display: none; }

.ui-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 44px;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--muted-foreground, #7B736A);
    background: transparent;
    border: 0;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    cursor: pointer;
    flex-shrink: 0;
    text-decoration: none;
    transition: color .15s ease, background-color .15s ease, border-color .15s ease;
    -webkit-tap-highlight-color: transparent;
}

.ui-tab:hover {
    color: var(--foreground);
    background: color-mix(in srgb, var(--foreground) 4%, transparent);
}

.ui-tab:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: -2px;
}

.ui-tab--active {
    color: var(--brand);
    border-bottom-color: var(--brand);
    background: color-mix(in srgb, var(--brand) 8%, transparent);
}

.ui-tab--pill {
    border-bottom: 0;
    border-radius: 9999px;
    border: 1px solid var(--border);
    background: var(--card);
}

.ui-tab--pill.ui-tab--active {
    background: var(--brand);
    border-color: var(--brand);
    color: #ffffff;
}

.dark .ui-tab {
    color: #cbd5e1;
    border-bottom-color: transparent;
}

.dark .ui-tab:hover {
    color: #f8fafc;
    background: rgba(51, 65, 85, 0.5);
}

.dark .ui-tab--active {
    color: #fdba74;
    border-bottom-color: var(--brand);
    background: color-mix(in srgb, var(--brand) 16%, transparent);
}

.dark .ui-tab--pill {
    background: #1e293b;
    border-color: #334155;
}

.dark .ui-tab--pill.ui-tab--active {
    background: var(--brand);
    border-color: var(--brand);
    color: #ffffff;
}

@media (min-width: 768px) and (pointer: fine) {
    .ui-tab { min-height: 36px; }
}

/* --- Menu Dropdown -------------------------------------------------------- */

.ui-menu {
    display: flex;
    flex-direction: column;
    padding: 0.375rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.12), 0 8px 10px -6px rgba(0, 0, 0, 0.08);
}

/* Limita o menu à viewport e permite rolar itens em telas baixas */
.ui-menu--contained {
    max-width: calc(100vw - 1.5rem);
    max-height: 70vh;
    max-height: min(70vh, 26rem);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.ui-menu-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.625rem;
    width: 100%;
    min-height: 44px;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    border: 0;
    background: transparent;
    color: var(--foreground);
    font-size: 0.8125rem;
    font-weight: 500;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease;
    -webkit-tap-highlight-color: transparent;
}

.ui-menu-item:hover {
    background: color-mix(in srgb, var(--foreground) 5%, transparent);
}

.ui-menu-item:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: -2px;
}

.ui-menu-item--active,
.ui-menu-item.is-active {
    background: color-mix(in srgb, var(--brand) 12%, transparent);
    color: var(--brand);
    font-weight: 700;
}
.ui-menu-item--danger { color: #dc2626; }
.ui-menu-item--danger:hover { background: #fef2f2; }
.ui-menu-item--success { color: #15803d; }
.ui-menu-item--success:hover { background: #ecfdf5; }

.dark .ui-menu {
    background: var(--card);
    border-color: var(--border);
}

.dark .ui-menu-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.dark .ui-menu-item--active,
.dark .ui-menu-item.is-active {
    background: color-mix(in srgb, var(--brand) 20%, transparent);
    color: #fed7aa;
}
.dark .ui-menu-item--danger { color: #f87171; }
.dark .ui-menu-item--danger:hover { background: rgba(239, 68, 68, 0.15); }
.dark .ui-menu-item--success { color: #4ade80; }
.dark .ui-menu-item--success:hover { background: rgba(34, 197, 94, 0.15); }

@media (min-width: 768px) and (pointer: fine) {
    .ui-menu-item { min-height: 36px; }
}

/* --- Grid de formulário --------------------------------------------------- */

.ui-form-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

@media (min-width: 640px) {
    .ui-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
    .ui-form-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* --- Tabela --------------------------------------------------------------- */

.ui-table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.ui-table {
    display: table;
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    color: var(--foreground);
}

.ui-table thead { background: var(--background); }

.ui-table th {
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #6b7280;
    white-space: nowrap;
}

.ui-table td {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    vertical-align: middle;
}

.ui-table tbody tr:first-child td { border-top: 0; }

.ui-table tbody tr {
    transition: background-color .15s ease;
}

.ui-table tbody tr:hover {
    background: color-mix(in srgb, var(--brand) 4%, transparent);
}

.dark .ui-table thead { background: rgba(255, 255, 255, 0.03); }
.dark .ui-table th { color: #94a3b8; }

.ui-table--compact th,
.ui-table--compact td {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
}

.ui-table__row--interactive {
    cursor: pointer;
}

.ui-table__row--interactive:hover {
    background: color-mix(in srgb, var(--brand) 6%, transparent);
}

.row-status--inactive { opacity: 0.72; }
.row-status--danger { box-shadow: inset 3px 0 0 #e11d48; background: rgba(244, 63, 94, 0.04); }
.row-status--warning { box-shadow: inset 3px 0 0 #d97706; background: rgba(245, 158, 11, 0.04); }
.row-status--info { box-shadow: inset 3px 0 0 #0284c7; background: rgba(14, 165, 233, 0.04); }
.row-status--success { box-shadow: inset 3px 0 0 #059669; background: rgba(16, 185, 129, 0.04); }

.dark .row-status--danger { background: rgba(244, 63, 94, 0.08); }
.dark .row-status--warning { background: rgba(245, 158, 11, 0.08); }
.dark .row-status--info { background: rgba(14, 165, 233, 0.08); }
.dark .row-status--success { background: rgba(16, 185, 129, 0.08); }

/* --- Badge ---------------------------------------------------------------- */

.ui-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}

.ui-badge--success { background: #d1fae5; color: #065f46; }
.ui-badge--warning { background: #fef3c7; color: #92400e; }
.ui-badge--danger { background: #ffe4e6; color: #9f1239; }
.ui-badge--info { background: #e0f2fe; color: #075985; }
.ui-badge--neutral { background: #f3f4f6; color: #374151; }
.ui-badge--brand { background: color-mix(in srgb, var(--brand) 12%, transparent); color: var(--brand); }
.ui-badge--purple { background: #f3e8ff; color: #6b21a8; }

.ui-badge--sm { padding: 0.125rem 0.5rem; font-size: 0.625rem; }
.ui-badge--caps { text-transform: uppercase; letter-spacing: 0.04em; font-weight: 700; }
.ui-badge--outline { background: transparent !important; border: 1px solid currentColor; }
.ui-badge__dot { display: inline-block; width: 0.375rem; height: 0.375rem; border-radius: 9999px; background: currentColor; flex-shrink: 0; }

.dark .ui-badge--success { background: rgba(16, 185, 129, 0.2); color: #a7f3d0; }
.dark .ui-badge--warning { background: rgba(245, 158, 11, 0.2); color: #fde68a; }
.dark .ui-badge--danger { background: rgba(244, 63, 94, 0.2); color: #fecdd3; }
.dark .ui-badge--info { background: rgba(14, 165, 233, 0.2); color: #bae6fd; }
.dark .ui-badge--neutral { background: #374151; color: #e5e7eb; }
.dark .ui-badge--brand { background: color-mix(in srgb, var(--brand) 22%, transparent); color: #fdba74; }
.dark .ui-badge--purple { background: rgba(168, 85, 247, 0.2); color: #d8b4fe; }

/* --- Modal ---------------------------------------------------------------- */

.ui-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.ui-modal--elevated {
    z-index: 10020;
}

.ui-modal--overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.ui-modal--panel {
    position: relative;
    width: 100%;
    max-width: 28rem;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--card);
    color: var(--foreground);
    border: 1px solid var(--border);
    border-radius: 1rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.ui-modal--sm { max-width: 24rem; }
.ui-modal--md { max-width: 32rem; }
.ui-modal--lg { max-width: 36rem; }
.ui-modal--xl { max-width: 48rem; }

.ui-modal--close {
    flex-shrink: 0;
    color: var(--muted-foreground, #6b7280);
}

.ui-modal--close:hover {
    color: var(--foreground);
}

.ui-modal--header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.ui-modal--body { padding: 1rem 1.25rem; }
.ui-modal--body > * + * { margin-top: 1rem; }

.ui-modal--footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
}

@media (max-width: 639.98px) {
    .ui-modal--sheet {
        align-items: flex-end;
        padding: 0;
    }

    .ui-modal--sheet .ui-modal--panel {
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
        max-height: 92dvh;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
}

.ui-modal.hidden,
.ui-modal[hidden],
.ui-modal[x-cloak] {
    display: none !important;
}

.dark .ui-modal--panel {
    background: var(--card);
    border-color: var(--border);
    color: var(--foreground);
}

.dark .ui-modal--close {
    color: #94a3b8;
}

.dark .ui-modal--close:hover {
    color: #f8fafc;
}

/* --- Card: rodapé --------------------------------------------------------- */

.ui-card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    border-bottom-left-radius: inherit;
    border-bottom-right-radius: inherit;
    background: var(--background);
}

/* --- Alerta --------------------------------------------------------------- */

.ui-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    color: var(--foreground);
    font-size: 0.875rem;
    line-height: 1.45;
}

.ui-alert--success {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #065f46;
}

.ui-alert--danger {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.ui-alert--warning {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}

.ui-alert--info {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1e3a5f;
}

.dark .ui-alert--success { background: rgba(6, 78, 59, 0.45); border-color: rgba(16, 185, 129, 0.35); color: #a7f3d0; }
.dark .ui-alert--danger { background: rgba(127, 29, 29, 0.45); border-color: rgba(248, 113, 113, 0.35); color: #fecaca; }
.dark .ui-alert--warning { background: rgba(120, 53, 15, 0.45); border-color: rgba(251, 191, 36, 0.35); color: #fde68a; }
.dark .ui-alert--info { background: rgba(30, 58, 95, 0.45); border-color: rgba(96, 165, 250, 0.35); color: #bfdbfe; }

/* --- Seletor visual de ícones / opções ---------------------------------- */

.ui-picker-trigger {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    min-height: 48px;
    padding: 0.5rem 0.875rem;
    background-color: var(--card);
    color: var(--foreground);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-align: left;
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
    -webkit-tap-highlight-color: transparent;
}

.ui-picker-trigger:hover {
    border-color: #d1d5db;
    background-color: color-mix(in srgb, var(--foreground) 3%, var(--card));
}

.ui-picker-trigger:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(226, 106, 44, 0.18);
}

.dark .ui-picker-trigger {
    background-color: #1e293b;
    border-color: #475569;
    color: #f8fafc;
}

.dark .ui-picker-trigger:hover {
    border-color: #64748b;
    background-color: #273449;
}

.ui-icon-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    min-height: 56px;
    padding: 0.375rem 0.25rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background-color: var(--card);
    color: var(--muted-foreground, #64748b);
    cursor: pointer;
    transition: border-color .15s ease, background-color .15s ease, color .15s ease, transform .12s ease;
    -webkit-tap-highlight-color: transparent;
}

.ui-icon-tile:hover {
    border-color: color-mix(in srgb, var(--brand) 65%, var(--border));
    color: var(--foreground);
}

.ui-icon-tile:active {
    transform: scale(0.96);
}

.ui-icon-tile:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

.ui-icon-tile--active,
.ui-icon-tile.is-active {
    border-color: var(--brand);
    background-color: color-mix(in srgb, var(--brand) 10%, var(--card));
    color: var(--brand);
}

.dark .ui-icon-tile {
    background-color: #1e293b;
    border-color: #475569;
    color: #cbd5e1;
}

.dark .ui-icon-tile:hover {
    border-color: color-mix(in srgb, var(--brand) 75%, #475569);
    color: #f8fafc;
}

.dark .ui-icon-tile--active,
.dark .ui-icon-tile.is-active {
    border-color: var(--brand);
    background-color: color-mix(in srgb, var(--brand) 18%, #1e293b);
    color: #fed7aa;
}

/* --- Shell standalone (app-standalone) e skeleton customizavel ------------ */

html.app-standalone {
    --background: #f8fafc;
    --foreground: #0f172a;
    --card: #ffffff;
    --card-foreground: #0f172a;
    --popover: #ffffff;
    --popover-foreground: #0f172a;
    --primary: var(--tema-cor, #E26A2C);
    --primary-foreground: #ffffff;
    --secondary: #f1f5f9;
    --secondary-foreground: #0f172a;
    --muted: #f1f5f9;
    --muted-foreground: #64748b;
    --accent: #f8fafc;
    --accent-foreground: #0f172a;
    --destructive: #ef4444;
    --destructive-foreground: #ffffff;
    --border: #e2e8f0;
    --input: #e2e8f0;
    --ring: var(--tema-cor, #E26A2C);
    --radius: 0.75rem;
}

html.app-standalone.dark {
    --background: #0f172a;
    --foreground: #f8fafc;
    --card: #1e293b;
    --card-foreground: #f8fafc;
    --popover: #1e293b;
    --popover-foreground: #f8fafc;
    --primary: var(--tema-cor, #E26A2C);
    --primary-foreground: #ffffff;
    --secondary: #334155;
    --secondary-foreground: #f8fafc;
    --muted: #334155;
    --muted-foreground: #94a3b8;
    --accent: #1e293b;
    --accent-foreground: #f8fafc;
    --destructive: #ef4444;
    --destructive-foreground: #ffffff;
    --border: #334155;
    --input: #334155;
    --ring: var(--tema-cor, #E26A2C);
}

body.app-standalone-body {
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

body.app-standalone-body :is(input, textarea) {
    user-select: text !important;
    -webkit-user-select: text !important;
}

.ui-skeleton--w { width: var(--skeleton-w, 100%); }
.ui-skeleton--h { height: var(--skeleton-h, 1rem); }

/* === Chat / atendimento (compartilhado) === */

.ui-chat-topbar {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    flex-shrink: 0;
    padding: 0.5rem 0.75rem;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    position: relative;
    z-index: 20;
}

@media (max-width: 639.98px) {
    .ui-chat-topbar {
        align-items: stretch;
    }
}

@media (min-width: 640px) {
    .ui-chat-topbar {
        padding: 0.75rem 1rem;
    }
}

.ui-chat-shell {
    height: calc(100dvh - 8.5rem);
    margin-left: -0.625rem;
    margin-right: -0.625rem;
    margin-top: -0.75rem;
}

@media (min-width: 640px) {
    .ui-chat-shell {
        margin-left: -1.5rem;
        margin-right: -1.5rem;
        margin-top: -1rem;
        margin-bottom: -1.5rem;
    }
}

@media (max-width: 639.98px) {
    .ui-chat-shell {
        height: calc(100dvh - 7.6rem);
    }
}

@media (min-width: 768px) {
    .ui-chat-shell {
        height: calc(100dvh - 5.5rem);
    }
}

@media (min-width: 768px) and (max-width: 1199.98px) and (orientation: portrait) {
    .ui-chat-shell {
        height: calc(100dvh - 5.5rem - 3.5625rem - env(safe-area-inset-bottom, 0px));
    }
}

.ui-chat-list {
    width: 100%;
    min-height: 0;
    flex-shrink: 0;
    border-right: 1px solid var(--border);
    background: color-mix(in srgb, var(--card) 60%, transparent);
}

@media (min-width: 1024px) {
    .ui-chat-list {
        width: 24rem;
    }
}

.ui-chat-panel {
    flex: 1 1 0%;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: var(--background);
}

@media (max-width: 1023.98px) {
    .ui-chat-panel--fechado,
    .ui-chat-list--oculta {
        display: none;
    }
}

.ui-chat-aside {
    display: none;
    width: 18rem;
    min-height: 0;
    border-left: 1px solid var(--border);
    background: var(--card);
}

@media (min-width: 1536px) {
    .ui-chat-aside {
        display: flex;
    }
}

.ui-chat-scroll {
    scroll-behavior: smooth;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(120, 120, 120, 0.35) transparent;
}

.ui-chat-scroll::-webkit-scrollbar {
    width: 8px;
}

.ui-chat-scroll::-webkit-scrollbar-thumb {
    background: rgba(120, 120, 120, 0.35);
    border-radius: 999px;
}

.ui-chat-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.ui-chat-item {
    min-height: 44px;
}

.ui-chat-item--active {
    background: color-mix(in srgb, var(--brand, #5B3A23) 8%, var(--background));
    box-shadow: inset 3px 0 0 var(--brand, #5B3A23);
}

.ui-chat-bubble {
    max-width: min(80%, 42rem);
    border-radius: 1rem;
    padding: 0.625rem 0.75rem;
    font-size: 0.8125rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.ui-chat-bubble--recebida {
    background: color-mix(in srgb, var(--foreground) 6%, var(--background));
    color: var(--foreground);
    border: 1px solid var(--border);
    border-bottom-left-radius: 0.35rem;
}

.ui-chat-bubble--enviada {
    background: var(--brand, #5B3A23);
    color: #fff;
    border-bottom-right-radius: 0.35rem;
}

.ui-chat-bubble--enviada .text-muted-foreground {
    color: rgba(255, 255, 255, 0.75);
}

@media (max-width: 639.98px) {
    .ui-chat-bubble {
        max-width: 88%;
    }
}

.ui-filter-bar--fade {
    padding-right: 1.25rem;
    -webkit-mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 1.25rem), transparent 100%);
    mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 1.25rem), transparent 100%);
}
