/* =============================================================================
   LBQ PAINEL — Redesign v1.0
   -----------------------------------------------------------------------------
   Refinamento visual do SaaS dashboard. Consome 100% dos tokens customizáveis
   do sistema existente (color-customizer.js + theme-toggle.css).

   REGRAS INVIOLÁVEIS:
   1. Jamais hardcodar cor que seja customizável (--primary-gold, --text-main,
      --text-muted, --teor-bg). Sempre var().
   2. Não remover nem renomear os tokens existentes.
   3. Manter data-theme + classe .no-transitions funcionando (anti-flicker).

   ESCOPO: Todas as páginas do painel (dashboard, agenda, tarefas, processos,
   atendimento, email, equipe, configurações, perfil, etc.).
   NÃO afeta: index.html (landing tem landing-redesign.css).
   =========================================================================== */


/* =============================================================================
   1. TOKENS ADITIVOS — escala consolidada
   =============================================================================
   Mantém as vars existentes (--primary-gold, etc.) e adiciona novas aliases
   semânticas para um design system mais coeso. NADA substitui tokens
   customizáveis pelo usuário.
   =========================================================================== */
:root {
    /* Raios — consolidar em 5 níveis (hoje tem 70+ variações) */
    --r-xs:       6px;
    --r-sm:       10px;
    --r-md:       14px;
    --r-lg:       20px;
    --r-xl:       28px;
    --r-pill:     9999px;

    /* Espaçamento baseado em 4pt */
    --sp-1:       4px;
    --sp-2:       8px;
    --sp-3:       12px;
    --sp-4:       16px;
    --sp-5:       20px;
    --sp-6:       24px;
    --sp-8:       32px;
    --sp-10:      40px;
    --sp-12:      48px;
    --sp-16:      64px;

    /* Sombras — 4 tiers + gold accent */
    --elev-0:     0 0 0 1px var(--border-dark, rgba(255,255,255,0.06));
    --elev-1:     0 1px 2px rgba(0,0,0,0.06), 0 2px 8px rgba(0,0,0,0.10);
    --elev-2:     0 4px 12px -2px rgba(0,0,0,0.18), 0 10px 28px -8px rgba(0,0,0,0.22);
    --elev-3:     0 12px 32px -8px rgba(0,0,0,0.30), 0 28px 60px -16px rgba(0,0,0,0.35);
    --elev-gold:  0 10px 30px -8px rgba(var(--primary-gold-rgb, 212,175,55), 0.45);
    --elev-focus: 0 0 0 3px rgba(var(--primary-gold-rgb, 212,175,55), 0.22);

    /* Easings refinados */
    --ease-out-1: cubic-bezier(0.16, 1, 0.3, 1);     /* ease-out-expo */
    --ease-out-2: cubic-bezier(0.2, 0.8, 0.2, 1);    /* ease-out-quart */
    --ease-spring:cubic-bezier(0.34, 1.56, 0.64, 1); /* slight overshoot */

    /* Timing */
    --t-fast:     120ms;
    --t-med:      240ms;
    --t-slow:     420ms;
    --t-slower:   600ms;

    /* Hairlines (consumem bordas de tema) */
    --hairline:   var(--border-dark, rgba(255,255,255,0.08));
}

/* Light mode fine-tune (aditivo, não quebra existing) */
:root[data-theme="light"] {
    --elev-0:     0 0 0 1px rgba(0,0,0,0.06);
    --elev-1:     0 1px 2px rgba(0,0,0,0.04), 0 2px 8px rgba(0,0,0,0.06);
    --elev-2:     0 4px 12px -2px rgba(0,0,0,0.08), 0 10px 28px -8px rgba(0,0,0,0.10);
    --elev-3:     0 12px 32px -8px rgba(0,0,0,0.12), 0 28px 60px -16px rgba(0,0,0,0.16);
}


/* =============================================================================
   2. RESET REFINADO + TIPOGRAFIA BASE (não sobrescreve elementos já estilizados)
   ============================================================================= */
html { -webkit-text-size-adjust: 100%; }

body {
    font-feature-settings: "cv02", "cv11", "ss01";
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Seleção com a cor primária */
::selection { background: var(--primary-gold); color: var(--text-dark, #000); }

/* Scrollbars custom (Webkit) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--border-dark);
    border-radius: var(--r-pill);
    border: 2px solid var(--bg-main);
    transition: background var(--t-med) var(--ease-out-1);
}
::-webkit-scrollbar-thumb:hover { background: var(--primary-gold); }
::-webkit-scrollbar-corner { background: transparent; }

/* Firefox */
* { scrollbar-width: thin; scrollbar-color: var(--border-dark) transparent; }

/* Reduced motion honorado */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}


/* =============================================================================
   3. SIDEBAR — refinamento (preserva .sidebar, .menu-item, .menu-link)
   ============================================================================= */
.sidebar {
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-right: 1px solid var(--hairline);
    transition: transform var(--t-slow) var(--ease-out-1);
}

/* Menu items — indicador lateral e hover mais refinado */
.sidebar .menu-item,
.sidebar .nav-item,
.sidebar-menu li {
    position: relative;
}

.sidebar .menu-link,
.sidebar a.menu-item,
.sidebar a.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: 10px 14px;
    border-radius: var(--r-sm);
    color: var(--text-muted);
    text-decoration: none;
    transition:
        background var(--t-med) var(--ease-out-1),
        color var(--t-med) var(--ease-out-1),
        transform var(--t-med) var(--ease-out-1);
    overflow: hidden;
}

.sidebar .menu-link::before,
.sidebar a.menu-item::before,
.sidebar a.nav-item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%) scaleY(0);
    width: 3px;
    height: 60%;
    background: var(--primary-gold);
    border-radius: 0 var(--r-pill) var(--r-pill) 0;
    transition: transform var(--t-slow) var(--ease-spring);
}

.sidebar .menu-link:hover,
.sidebar a.menu-item:hover,
.sidebar a.nav-item:hover {
    color: var(--text-main);
    background: var(--bg-hover);
}

.sidebar .menu-link.active,
.sidebar a.menu-item.active,
.sidebar a.nav-item.active,
.sidebar .menu-link[aria-current="page"] {
    color: var(--primary-gold);
    background: var(--accent-gold-low);
}

.sidebar .menu-link.active::before,
.sidebar a.menu-item.active::before,
.sidebar a.nav-item.active::before {
    transform: translateY(-50%) scaleY(1);
}

/* Ícones dentro do menu */
.sidebar .menu-link i,
.sidebar a.menu-item i,
.sidebar a.nav-item i,
.sidebar .menu-link svg,
.sidebar a.menu-item svg {
    width: 18px;
    height: 18px;
    font-size: 1rem;
    flex-shrink: 0;
    transition: transform var(--t-med) var(--ease-spring);
}

.sidebar .menu-link:hover i,
.sidebar a.menu-item:hover i,
.sidebar a.nav-item:hover i {
    transform: scale(1.08);
}


/* =============================================================================
   4. TOPBAR / HEADER — search pill, icon buttons, user chip
   ============================================================================= */
.top-header,
.topbar,
.main-topbar {
    border-bottom: 1px solid var(--hairline);
    backdrop-filter: blur(16px) saturate(150%);
    -webkit-backdrop-filter: blur(16px) saturate(150%);
}

/* Search bar refinada */
.search-bar,
.topbar-search {
    position: relative;
    border-radius: var(--r-pill);
    border: 1px solid var(--hairline);
    background: var(--bg-input);
    transition:
        border-color var(--t-med) var(--ease-out-1),
        box-shadow var(--t-med) var(--ease-out-1);
}

.search-bar:focus-within,
.topbar-search:focus-within {
    border-color: var(--primary-gold);
    box-shadow: var(--elev-focus);
}

.search-bar input,
.topbar-search input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-main);
    padding: 10px 14px 10px 42px;
    width: 100%;
    font: inherit;
}

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

.search-bar i,
.search-bar svg,
.topbar-search i,
.topbar-search svg {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

/* Icon buttons (notification, theme-toggle, etc.) no topbar */
.header-actions button,
.topbar-actions button,
.btn-icon,
.icon-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: var(--r-sm);
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition:
        background var(--t-med) var(--ease-out-1),
        color var(--t-med) var(--ease-out-1),
        border-color var(--t-med) var(--ease-out-1),
        transform var(--t-med) var(--ease-spring);
}

.header-actions button:hover,
.topbar-actions button:hover,
.btn-icon:hover,
.icon-btn:hover {
    background: var(--bg-hover);
    color: var(--text-main);
    border-color: var(--hairline);
    transform: translateY(-1px);
}

.header-actions button:active,
.btn-icon:active,
.icon-btn:active {
    transform: translateY(0);
}

/* Notification dot */
.notification-dot,
.badge-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-red, #ef4444);
    border: 2px solid var(--bg-main);
    pointer-events: none;
}


/* =============================================================================
   5. PAGE HEADER — título + ações
   ============================================================================= */
.page-header,
.content-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--sp-4);
    padding-bottom: var(--sp-5);
    border-bottom: 1px solid var(--hairline);
    margin-bottom: var(--sp-6);
}

.page-header h1,
.page-header h2,
.content-header h1 {
    font-family: var(--font-heading);
    font-size: clamp(1.4rem, 2.2vw, 1.9rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-main);
    margin: 0;
    line-height: 1.2;
}

.page-header .subtitle,
.page-header > p {
    color: var(--text-muted);
    font-size: 0.92rem;
    margin: 4px 0 0 0;
}


/* =============================================================================
   6. CARDS — design unificado
   =============================================================================
   Hoje tem raios 24, 28, 32, 40, 48px. Consolidar em --r-lg (20px) ou --r-xl (28px).
   =========================================================================== */
.card,
.widget-card,
.panel-card,
.content-card,
.kpi-card,
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--hairline);
    border-radius: var(--r-lg);
    transition:
        transform var(--t-med) var(--ease-out-1),
        box-shadow var(--t-slow) var(--ease-out-1),
        border-color var(--t-med) var(--ease-out-1);
}

/* KPI/Stat cards com hover suave */
.kpi-card,
.stat-card,
.widget-card.hoverable {
    cursor: default;
}

.kpi-card:hover,
.stat-card:hover,
.widget-card.hoverable:hover {
    transform: translateY(-2px);
    border-color: rgba(var(--primary-gold-rgb), 0.35);
    box-shadow: var(--elev-2);
}

/* Card header interno padronizado */
.card-header,
.card-header-flex {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
    padding-bottom: var(--sp-3);
    margin-bottom: var(--sp-4);
    border-bottom: 1px solid var(--hairline);
}

.card-header h3,
.card-header h4,
.card-header-flex h3 {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text-main);
    margin: 0;
}


/* =============================================================================
   7. BOTÕES — família unificada
   ============================================================================= */
.btn,
.btn-primary,
.btn-secondary,
.btn-ghost,
.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    padding: 10px 18px;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    letter-spacing: -0.005em;
    border-radius: var(--r-sm);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
    isolation: isolate;
    transition:
        background var(--t-med) var(--ease-out-1),
        color var(--t-med) var(--ease-out-1),
        border-color var(--t-med) var(--ease-out-1),
        transform var(--t-med) var(--ease-spring),
        box-shadow var(--t-slow) var(--ease-out-1);
    user-select: none;
}

.btn:disabled,
.btn-primary:disabled,
.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* PRIMARY: cor custom do user */
.btn-primary {
    color: var(--text-dark);
    background: var(--primary-gradient, var(--primary-gold));
    border-color: var(--primary-gold);
}

.btn-primary::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, transparent 0%, rgba(255,255,255,0.25) 50%, transparent 100%);
    transform: translateX(-120%);
    transition: transform 0.9s var(--ease-out-1);
    pointer-events: none;
    z-index: 1;
}

.btn-primary:hover {
    background: var(--primary-gold-hover);
    border-color: var(--primary-gold-hover);
    transform: translateY(-1px);
    box-shadow: var(--elev-gold);
}

.btn-primary:hover::before { transform: translateX(120%); }

.btn-primary:active { transform: translateY(0); box-shadow: var(--elev-1); }

.btn-primary > * { position: relative; z-index: 2; }

/* SECONDARY: outline */
.btn-secondary {
    color: var(--text-main);
    background: transparent;
    border-color: var(--hairline);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--primary-gold);
    color: var(--primary-gold);
    transform: translateY(-1px);
}

.btn-secondary:active { transform: translateY(0); }

/* GHOST: sem fundo, sem borda */
.btn-ghost {
    color: var(--text-muted);
    background: transparent;
    border-color: transparent;
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-main);
}

/* DANGER: destructive actions */
.btn-danger {
    color: #fff;
    background: var(--color-red, #ef4444);
    border-color: var(--color-red, #ef4444);
}

.btn-danger:hover {
    background: #dc2626;
    border-color: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 8px 24px -8px rgba(239, 68, 68, 0.5);
}

/* Tamanhos */
.btn-sm, .btn.btn-sm { padding: 7px 13px; font-size: 0.8rem; border-radius: var(--r-xs); }
.btn-lg, .btn.btn-lg { padding: 14px 26px; font-size: 0.95rem; border-radius: var(--r-md); }
.btn-block, .btn.btn-block { width: 100%; }

/* Botão só com ícone */
.btn-icon-only {
    width: 38px; height: 38px;
    padding: 0;
    border-radius: var(--r-sm);
}


/* =============================================================================
   8. FORMS — inputs, selects, textarea, checkbox, radio
   ============================================================================= */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="date"],
input[type="time"],
input[type="url"],
select,
textarea {
    font: inherit;
    color: var(--text-main);
    background: var(--bg-input);
    border: 1px solid var(--hairline);
    border-radius: var(--r-sm);
    padding: 10px 14px;
    transition:
        border-color var(--t-med) var(--ease-out-1),
        background var(--t-med) var(--ease-out-1),
        box-shadow var(--t-med) var(--ease-out-1);
    outline: none;
    width: 100%;
}

input[type="text"]::placeholder,
input[type="email"]::placeholder,
input[type="tel"]::placeholder,
input[type="password"]::placeholder,
input[type="number"]::placeholder,
input[type="search"]::placeholder,
textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.8;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="search"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
input[type="url"]:focus,
select:focus,
textarea:focus {
    border-color: var(--primary-gold);
    box-shadow: var(--elev-focus);
    background: var(--bg-lighter);
}

input[disabled],
select[disabled],
textarea[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
}

textarea {
    min-height: 96px;
    resize: vertical;
    line-height: 1.5;
}

/* Select native com seta custom */
select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'><path d='M1 1.5l5 5 5-5' stroke='%23A3A3A3' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 12px;
    padding-right: 42px;
    cursor: pointer;
}

:root[data-theme="light"] select {
    background-image: url("data:image/svg+xml;utf8,<svg viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'><path d='M1 1.5l5 5 5-5' stroke='%236B6B6B' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
}

/* Labels */
label {
    display: inline-block;
    margin-bottom: 6px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: -0.005em;
}

/* Form group */
.form-group,
.input-group,
.field-group {
    margin-bottom: var(--sp-4);
}

/* Checkbox & Radio refinado (mantém HTML nativo) */
input[type="checkbox"],
input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--hairline);
    background: var(--bg-input);
    cursor: pointer;
    display: inline-grid;
    place-items: center;
    vertical-align: middle;
    transition:
        background var(--t-fast) var(--ease-out-1),
        border-color var(--t-fast) var(--ease-out-1),
        box-shadow var(--t-fast) var(--ease-out-1);
}

input[type="checkbox"] { border-radius: 5px; }
input[type="radio"] { border-radius: 50%; }

input[type="checkbox"]:checked,
input[type="radio"]:checked {
    background: var(--primary-gold);
    border-color: var(--primary-gold);
}

input[type="checkbox"]:checked::before {
    content: "";
    width: 10px; height: 10px;
    background: var(--text-dark);
    clip-path: polygon(14% 44%, 0% 60%, 40% 100%, 100% 20%, 80% 8%, 40% 70%);
}

input[type="radio"]:checked::before {
    content: "";
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--text-dark);
}

input[type="checkbox"]:focus-visible,
input[type="radio"]:focus-visible {
    box-shadow: var(--elev-focus);
    outline: none;
}


/* =============================================================================
   9. TABELAS — padronização
   ============================================================================= */
table.data-table,
table.panel-table,
.table-wrapper > table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9rem;
}

table.data-table thead th,
table.panel-table thead th,
.table-wrapper > table thead th {
    position: sticky;
    top: 0;
    text-align: left;
    padding: 14px 18px;
    font-weight: 600;
    font-size: 0.74rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    background: var(--bg-main);
    border-bottom: 1px solid var(--hairline);
    white-space: nowrap;
}

table.data-table tbody td,
table.panel-table tbody td,
.table-wrapper > table tbody td {
    padding: 14px 18px;
    color: var(--text-main);
    border-bottom: 1px solid var(--hairline);
    vertical-align: middle;
}

table.data-table tbody tr,
table.panel-table tbody tr,
.table-wrapper > table tbody tr {
    transition: background var(--t-fast) var(--ease-out-1);
}

table.data-table tbody tr:hover,
table.panel-table tbody tr:hover,
.table-wrapper > table tbody tr:hover {
    background: var(--bg-hover);
}

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


/* =============================================================================
   10. MODAIS — refinar overlay + dialog
   ============================================================================= */
.modal-overlay,
.modal-backdrop,
.dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(8px) saturate(150%);
    -webkit-backdrop-filter: blur(8px) saturate(150%);
    z-index: 1000;
    animation: fadeIn var(--t-med) var(--ease-out-1);
}

.modal,
.modal-content,
.modal-dialog,
.dialog {
    background: var(--bg-card);
    border: 1px solid var(--hairline);
    border-radius: var(--r-xl);
    box-shadow: var(--elev-3);
    animation: dialogIn var(--t-slow) var(--ease-out-1);
}

.modal-header,
.dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sp-5) var(--sp-6);
    border-bottom: 1px solid var(--hairline);
}

.modal-header h3,
.modal-header h2,
.dialog-header h3 {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin: 0;
    color: var(--text-main);
}

.modal-body,
.dialog-body { padding: var(--sp-5) var(--sp-6); }

.modal-footer,
.dialog-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--sp-3);
    padding: var(--sp-4) var(--sp-6);
    border-top: 1px solid var(--hairline);
}

.modal-close,
.dialog-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px; height: 32px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: background var(--t-med), color var(--t-med);
}

.modal-close:hover,
.dialog-close:hover {
    background: var(--bg-hover);
    color: var(--text-main);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes dialogIn {
    from { opacity: 0; transform: translateY(16px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}


/* =============================================================================
   11. BADGES / TAGS / CHIPS
   ============================================================================= */
.badge,
.tag,
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    border-radius: var(--r-pill);
    background: var(--accent-gold-low);
    color: var(--primary-gold);
    border: 1px solid rgba(var(--primary-gold-rgb), 0.25);
    line-height: 1.4;
}

/* Variantes semânticas */
.badge-success, .tag-success, .chip-success {
    background: rgba(20, 184, 166, 0.1);
    color: var(--color-teal, #14b8a6);
    border-color: rgba(20, 184, 166, 0.3);
}

.badge-warning, .tag-warning, .chip-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--color-yellow, #f59e0b);
    border-color: rgba(245, 158, 11, 0.3);
}

.badge-danger, .tag-danger, .chip-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--color-red, #ef4444);
    border-color: rgba(239, 68, 68, 0.3);
}

.badge-info, .tag-info, .chip-info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--color-blue, #3b82f6);
    border-color: rgba(59, 130, 246, 0.3);
}

.badge-purple, .tag-purple, .chip-purple {
    background: rgba(139, 92, 246, 0.1);
    color: var(--color-purple, #8b5cf6);
    border-color: rgba(139, 92, 246, 0.3);
}


/* =============================================================================
   12. DROPDOWNS / MENUS
   ============================================================================= */
.dropdown-menu,
.menu-popover,
.notification-panel,
.filter-select {
    background: var(--bg-card);
    border: 1px solid var(--hairline);
    border-radius: var(--r-md);
    box-shadow: var(--elev-2);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    animation: menuIn var(--t-med) var(--ease-out-1);
    overflow: hidden;
}

.dropdown-menu a,
.dropdown-menu button,
.menu-popover a,
.menu-popover button {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: 9px 14px;
    color: var(--text-main);
    background: transparent;
    border: none;
    text-decoration: none;
    font-size: 0.88rem;
    cursor: pointer;
    transition: background var(--t-fast), color var(--t-fast);
}

.dropdown-menu a:hover,
.dropdown-menu button:hover,
.menu-popover a:hover,
.menu-popover button:hover {
    background: var(--bg-hover);
    color: var(--primary-gold);
}

.dropdown-divider,
.menu-divider {
    height: 1px;
    background: var(--hairline);
    margin: 6px 0;
}

@keyframes menuIn {
    from { opacity: 0; transform: translateY(-6px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}


/* =============================================================================
   13. TABS
   ============================================================================= */
.tabs,
.tabs-list,
.tab-list {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--hairline);
    margin-bottom: var(--sp-5);
    overflow-x: auto;
}

.tab,
.tab-btn,
.tabs-list button,
.tab-list button {
    position: relative;
    padding: 10px 16px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.88rem;
    cursor: pointer;
    white-space: nowrap;
    transition: color var(--t-med) var(--ease-out-1);
}

.tab::after,
.tab-btn::after,
.tabs-list button::after,
.tab-list button::after {
    content: "";
    position: absolute;
    left: 12px; right: 12px;
    bottom: -1px;
    height: 2px;
    background: var(--primary-gold);
    border-radius: var(--r-pill);
    transform: scaleX(0);
    transition: transform var(--t-slow) var(--ease-out-1);
}

.tab:hover,
.tab-btn:hover,
.tabs-list button:hover,
.tab-list button:hover {
    color: var(--text-main);
}

.tab.active,
.tab-btn.active,
.tabs-list button.active,
.tab-list button.active,
.tabs-list button[aria-selected="true"] {
    color: var(--primary-gold);
}

.tab.active::after,
.tab-btn.active::after,
.tabs-list button.active::after,
.tab-list button.active::after,
.tabs-list button[aria-selected="true"]::after {
    transform: scaleX(1);
}


/* =============================================================================
   14. EMPTY STATES
   ============================================================================= */
.empty-state,
.no-data-msg,
.empty-placeholder {
    text-align: center;
    padding: var(--sp-12) var(--sp-6);
    color: var(--text-muted);
}

.empty-state i,
.empty-state svg,
.no-data-msg i {
    font-size: 2.5rem;
    color: var(--text-muted);
    opacity: 0.55;
    margin-bottom: var(--sp-4);
    display: inline-block;
}

.empty-state h3,
.empty-state h4 {
    color: var(--text-main);
    font-family: var(--font-heading);
    font-weight: 700;
    margin: 0 0 8px 0;
}

.empty-state p {
    max-width: 420px;
    margin: 0 auto;
    line-height: 1.55;
}


/* =============================================================================
   15. LOADERS / SPINNERS
   ============================================================================= */
.spinner,
.loading-spinner {
    width: 24px;
    height: 24px;
    border: 2.5px solid var(--hairline);
    border-top-color: var(--primary-gold);
    border-radius: 50%;
    display: inline-block;
    animation: spin 0.8s linear infinite;
}

.spinner-lg { width: 40px; height: 40px; border-width: 3px; }
.spinner-sm { width: 16px; height: 16px; border-width: 2px; }

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Skeleton loader refinado */
.skeleton,
.loading-bar {
    background: linear-gradient(90deg,
        var(--bg-hover) 0%,
        var(--bg-lighter) 40%,
        var(--bg-hover) 80%);
    background-size: 200% 100%;
    animation: skeletonShift 1.4s linear infinite;
    border-radius: var(--r-xs);
}

@keyframes skeletonShift {
    from { background-position: 200% 0; }
    to   { background-position: -200% 0; }
}


/* =============================================================================
   16. TOASTS / NOTIFICATIONS
   ============================================================================= */
.toast,
.toast-notification {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: 14px 18px;
    background: var(--bg-card);
    border: 1px solid var(--hairline);
    border-radius: var(--r-md);
    box-shadow: var(--elev-3);
    color: var(--text-main);
    min-width: 280px;
    max-width: 440px;
    animation: toastIn 0.45s var(--ease-spring);
}

.toast i,
.toast svg,
.toast-notification i {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.toast-success { border-left: 3px solid var(--color-teal, #14b8a6); }
.toast-success i { color: var(--color-teal, #14b8a6); }
.toast-error,
.toast-danger { border-left: 3px solid var(--color-red, #ef4444); }
.toast-error i,
.toast-danger i { color: var(--color-red, #ef4444); }
.toast-warning { border-left: 3px solid var(--color-yellow, #f59e0b); }
.toast-warning i { color: var(--color-yellow, #f59e0b); }
.toast-info { border-left: 3px solid var(--color-blue, #3b82f6); }
.toast-info i { color: var(--color-blue, #3b82f6); }

@keyframes toastIn {
    from { opacity: 0; transform: translateY(-16px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}


/* =============================================================================
   17. KPI CARDS / STAT CARDS — padrão visual
   ============================================================================= */
.kpi-card .kpi-number,
.stat-card .stat-number,
.widget-card .big-number {
    font-family: var(--font-heading);
    font-size: clamp(1.8rem, 3vw, 2.5rem);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.03em;
    color: var(--text-main);
    margin: 0;
}

.kpi-card .kpi-label,
.stat-card .stat-label,
.widget-card .kpi-label {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0 0 10px 0;
}

.kpi-card .kpi-trend-up { color: var(--color-teal, #14b8a6); }
.kpi-card .kpi-trend-down { color: var(--color-red, #ef4444); }


/* =============================================================================
   18. LINKS refinados globalmente (só no conteúdo do painel)
   ============================================================================= */
a {
    color: var(--primary-gold);
    text-decoration: none;
    transition: color var(--t-med) var(--ease-out-1);
}

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


/* =============================================================================
   19. FOCUS VISIBLE (acessibilidade)
   ============================================================================= */
:focus-visible {
    outline: 2px solid var(--primary-gold);
    outline-offset: 2px;
    border-radius: var(--r-xs);
}

button:focus-visible,
a:focus-visible,
[role="button"]:focus-visible {
    outline-offset: 3px;
}


/* =============================================================================
   20. UTILITÁRIOS
   ============================================================================= */
.u-text-main { color: var(--text-main); }
.u-text-muted { color: var(--text-muted); }
.u-text-primary { color: var(--primary-gold); }

.u-bg-card { background: var(--bg-card); }
.u-border { border: 1px solid var(--hairline); }

.u-hidden { display: none !important; }
.u-flex { display: flex; }
.u-grid { display: grid; }
.u-gap-2 { gap: var(--sp-2); }
.u-gap-3 { gap: var(--sp-3); }
.u-gap-4 { gap: var(--sp-4); }

/* Fade in util pra listas revelando */
.fade-in {
    animation: fadeIn var(--t-slow) var(--ease-out-1) backwards;
}


/* =============================================================================
   21. RESPONSIVE REFINEMENTS (mobile-first tweaks)
   ============================================================================= */
@media (max-width: 768px) {
    .page-header,
    .content-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--sp-3);
    }

    .kpi-card .kpi-number,
    .stat-card .stat-number {
        font-size: clamp(1.5rem, 6vw, 2rem);
    }

    .modal,
    .modal-content,
    .modal-dialog {
        margin: var(--sp-3);
        width: calc(100% - var(--sp-6));
        max-height: calc(100vh - var(--sp-6));
        overflow-y: auto;
    }

    .modal-header,
    .dialog-header { padding: var(--sp-4); }
    .modal-body,
    .dialog-body { padding: var(--sp-4); }
    .modal-footer,
    .dialog-footer {
        padding: var(--sp-3) var(--sp-4);
        flex-direction: column-reverse;
    }

    .modal-footer .btn,
    .dialog-footer .btn {
        width: 100%;
    }

    table.data-table,
    table.panel-table {
        font-size: 0.82rem;
    }

    table.data-table thead th,
    table.panel-table thead th,
    table.data-table tbody td,
    table.panel-table tbody td {
        padding: 10px 12px;
    }
}

@media (max-width: 480px) {
    .page-header h1,
    .page-header h2 {
        font-size: 1.3rem;
    }

    .btn-lg,
    .btn.btn-lg { padding: 12px 20px; font-size: 0.88rem; }
}


/* =============================================================================
   22a. HOTFIX — color customizer quebrado em dashboard.css
   -----------------------------------------------------------------------------
   BUG PRÉ-EXISTENTE: dashboard.css hardcoda:
   - `--gold-gradient: linear-gradient(135deg, #D4AF37 0%, #F4D03F 100%);`
   - várias regras `.btn-primary { background: var(--gold-gradient, ...) }`
   - `!important` com `#D4AF37` / `#F7C843` em várias classes
   Isso impede que a cor primária customizada pelo user (via color picker)
   propague. Fix: tornar --gold-gradient dinâmico e sobrescrever com !important.
   ============================================================================= */
:root {
    --gold-gradient: linear-gradient(135deg, var(--primary-gold) 0%, var(--secondary-gold, var(--primary-gold-hover)) 100%) !important;
}

/* Forçar botão primário a usar a cor dinâmica */
.btn-primary,
button.btn-primary {
    background: var(--primary-gradient, var(--primary-gold)) !important;
    border-color: var(--primary-gold) !important;
    color: var(--text-dark) !important;
}
.btn-primary:hover,
button.btn-primary:hover {
    background: var(--primary-gold-hover) !important;
    border-color: var(--primary-gold-hover) !important;
}

/* Task checkbox — corrigir gradient hardcoded em .task-checkbox.checked */
.painel-task-item .task-checkbox.checked,
.task-checkbox.checked {
    background: linear-gradient(135deg, var(--primary-gold-hover), var(--primary-gold)) !important;
    border-color: var(--primary-gold) !important;
    color: var(--text-dark, #000) !important;
}

.painel-task-item .task-checkbox.checked i,
.task-checkbox.checked i {
    color: var(--text-dark, #000) !important;
}

/* Star icons, action buttons em task-items */
.painel-task-item .task-star.active,
.task-star.active {
    color: var(--primary-gold) !important;
}

/* Elementos com gradient gold hardcoded — força dinâmico */
.gold-gradient-bg,
[class*="gold-gradient"]:not(.btn) {
    background: var(--gold-gradient) !important;
}


/* =============================================================================
   22. PRINT (bônus)
   ============================================================================= */
@media print {
    .sidebar,
    .top-header,
    .topbar,
    .btn,
    .modal-overlay {
        display: none !important;
    }

    * {
        background: white !important;
        color: black !important;
        box-shadow: none !important;
    }
}
