/* ============================================
   COMPONENTS — Dashboard de Tráfego
   ============================================ */

/* ---- KPI Cards ---- */
.kpi-card {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-xl);
    padding: var(--space-4);
    color: #fff;
    box-shadow: var(--shadow-lg);
    cursor: default;
    min-height: 110px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.kpi-card .kpi-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-3);
}

.kpi-card .kpi-icon {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.kpi-card .kpi-icon svg {
    width: 18px;
    height: 18px;
    stroke: #fff;
}

.kpi-card .kpi-info {
    text-align: right;
}

.kpi-card .kpi-label {
    font-size: var(--font-size-sm);
    font-weight: 500;
    opacity: 0.9;
}

.kpi-card .kpi-sublabel {
    font-size: var(--font-size-xs);
    opacity: 0.65;
}

.kpi-card .kpi-value {
    font-size: var(--font-size-2xl);
    font-weight: 800;
    line-height: 1.2;
}

.kpi-card .kpi-change {
    font-size: var(--font-size-xs);
    font-weight: 600;
    margin-top: var(--space-1);
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.15);
}

/* Glow blobs */
.kpi-card .blob-1 {
    position: absolute;
    top: -20px;
    right: -20px;
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 50%;
    filter: blur(20px);
    pointer-events: none;
}

.kpi-card .blob-2 {
    position: absolute;
    bottom: -10px;
    left: -10px;
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 50%;
    filter: blur(16px);
    pointer-events: none;
}

/* ---- Glass Card ---- */
.glass-card {
    background: var(--bg-glass);
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-blur);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-2xl);
    padding: var(--space-6);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    overflow: hidden;
}

.glass-card:hover {
    border-color: var(--border-secondary);
    box-shadow: var(--shadow-glow-purple);
}

.glass-card-title {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-5);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.glass-card-title .card-icon {
    font-size: var(--font-size-2xl);
}

/* ---- Metric Row ---- */
.metric-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--border-primary);
}

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

.metric-label {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.metric-value {
    font-size: var(--font-size-sm);
    font-weight: 700;
    color: var(--text-primary);
}

/* ---- Data Table ---- */
.data-table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-primary);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-sm);
}

.data-table thead {
    background: var(--bg-tertiary);
}

.data-table th {
    padding: var(--space-3) var(--space-4);
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
    border-bottom: 1px solid var(--border-primary);
    position: relative;
}

.data-table th:hover {
    color: var(--primary-300);
}

.data-table th .sort-icon {
    margin-left: var(--space-1);
    opacity: 0.4;
    font-size: 10px;
}

.data-table th.sorted .sort-icon {
    opacity: 1;
    color: var(--primary-400);
}

.data-table td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-primary);
    color: var(--text-primary);
    white-space: nowrap;
}

.data-table tbody tr {
    transition: background var(--transition-fast);
}

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

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

/* ---- Badges ---- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: 600;
    white-space: nowrap;
}

.badge-escalar {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success-400);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-testar {
    background: rgba(251, 191, 36, 0.15);
    color: var(--warning-400);
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.badge-pausar {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger-400);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-monitorar {
    background: rgba(59, 130, 246, 0.15);
    color: var(--info-400);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

/* ---- Alert Box ---- */
.alert-box {
    border-radius: var(--radius-xl);
    padding: var(--space-4) var(--space-5);
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.alert-box.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.alert-box.alert-danger .alert-icon {
    color: var(--danger-400);
}

.alert-box.alert-warning {
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.25);
}

.alert-box.alert-warning .alert-icon {
    color: var(--warning-400);
}

.alert-box.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.alert-box.alert-success .alert-icon {
    color: var(--success-400);
}

.alert-box.alert-info {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.25);
}

.alert-box.alert-info .alert-icon {
    color: var(--info-400);
}

.alert-icon {
    font-size: var(--font-size-xl);
    flex-shrink: 0;
    margin-top: 2px;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-1);
}

.alert-text {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

/* ---- Progress Bar ---- */
.progress-bar-container {
    width: 100%;
    height: 12px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-full);
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    border-radius: var(--radius-full);
    position: relative;
    overflow: hidden;
    transition: width 1s ease;
}

.progress-bar-fill .shimmer {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: shimmer 2s infinite;
}

/* ---- Funnel ---- */
.funnel-stage {
    margin-bottom: var(--space-4);
}

.funnel-stage-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-2);
}

.funnel-stage-name {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-primary);
}

.funnel-stage-values {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.funnel-stage-count {
    font-size: var(--font-size-sm);
    font-weight: 700;
    color: var(--text-primary);
}

.funnel-stage-percent {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
}

.funnel-bar {
    height: 48px;
    border-radius: var(--radius-lg);
    position: relative;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
}

.funnel-bar-fill {
    height: 100%;
    border-radius: var(--radius-lg);
    position: relative;
    overflow: hidden;
    transition: width 1.2s ease;
}

.funnel-connector {
    display: flex;
    justify-content: center;
    padding: var(--space-2) 0;
}

.funnel-connector-line {
    width: 2px;
    height: 24px;
    background: linear-gradient(to bottom, var(--text-tertiary), transparent);
}

.funnel-metrics {
    display: flex;
    gap: var(--space-3);
    margin-top: var(--space-2);
}

.funnel-metric-tag {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

/* ---- Health Score Gauge ---- */
.health-gauge {
    width: 200px;
    height: 200px;
    position: relative;
    margin: 0 auto var(--space-4);
}

.health-gauge svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.health-gauge-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.08);
    stroke-width: 12;
}

.health-gauge-fill {
    fill: none;
    stroke-width: 12;
    stroke-linecap: round;
    transition: stroke-dashoffset 1.5s ease, stroke 0.5s ease;
}

.health-gauge-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.health-gauge-label .score {
    font-size: var(--font-size-4xl);
    font-weight: 900;
    line-height: 1;
}

.health-gauge-label .score-text {
    font-size: var(--font-size-sm);
    font-weight: 600;
    margin-top: var(--space-1);
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 600;
    font-family: var(--font-family);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary-500);
    color: #fff;
    border-color: var(--primary-600);
}

.btn-primary:hover {
    background: var(--primary-400);
    box-shadow: var(--shadow-glow-purple);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border-primary);
}

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

.btn-success {
    background: var(--success-600);
    color: #fff;
}

.btn-success:hover {
    background: var(--success-500);
}

.btn-icon {
    padding: var(--space-2);
    min-width: 36px;
    min-height: 36px;
    justify-content: center;
}

.btn svg {
    width: 16px;
    height: 16px;
}

/* ---- Toggle Switch ---- */
.toggle-switch {
    position: relative;
    width: 48px;
    height: 26px;
    cursor: pointer;
}

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

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    border: 1px solid var(--border-primary);
    transition: background var(--transition-fast);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    left: 2px;
    bottom: 2px;
    background: #fff;
    border-radius: 50%;
    transition: transform var(--transition-fast);
}

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

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

/* ---- Chart Container ---- */
.chart-container {
    position: relative;
    width: 100%;
    min-height: 300px;
    padding: var(--space-4);
}

.chart-container canvas {
    width: 100% !important;
    max-height: 350px;
}

/* ---- Projection Cards ---- */
.projection-card {
    text-align: center;
    padding: var(--space-8) var(--space-6);
}

.projection-card .projection-icon {
    font-size: 2.5rem;
    margin-bottom: var(--space-3);
}

.projection-card .projection-label {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
    font-weight: 500;
}

.projection-card .projection-value {
    font-size: var(--font-size-3xl);
    font-weight: 800;
    color: var(--text-primary);
}

.projection-card .projection-subtext {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    margin-top: var(--space-2);
}

/* ---- Calculator ---- */
.calc-slider-group {
    margin-bottom: var(--space-6);
}

.calc-slider-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-2);
}

.calc-slider-label {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-primary);
}

.calc-slider-value {
    font-size: var(--font-size-sm);
    font-weight: 700;
    color: var(--primary-300);
    min-width: 60px;
    text-align: right;
}

.calc-slider {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    outline: none;
}

.calc-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-400);
    cursor: pointer;
    box-shadow: 0 0 10px rgba(124, 58, 237, 0.4);
}

.calc-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-400);
    cursor: pointer;
    border: none;
    box-shadow: 0 0 10px rgba(124, 58, 237, 0.4);
}

.calc-results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-4);
    margin-top: var(--space-6);
    padding-top: var(--space-6);
    border-top: 1px solid var(--border-primary);
}

.calc-result-item {
    text-align: center;
    padding: var(--space-4);
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
}

.calc-result-label {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-2);
}

.calc-result-value {
    font-size: var(--font-size-xl);
    font-weight: 800;
    color: var(--text-primary);
}

.calc-result-change {
    font-size: var(--font-size-xs);
    margin-top: var(--space-1);
}

.calc-result-change.positive {
    color: var(--success-400);
}

.calc-result-change.negative {
    color: var(--danger-400);
}

/* ---- Break Even Visual ---- */
.breakeven-visual {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-8);
    margin: var(--space-6) 0;
    flex-wrap: wrap;
}

.breakeven-item {
    text-align: center;
    padding: var(--space-6);
    background: var(--bg-tertiary);
    border-radius: var(--radius-xl);
    min-width: 200px;
    border: 1px solid var(--border-primary);
}

.breakeven-label {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: var(--space-2);
}

.breakeven-value {
    font-size: var(--font-size-2xl);
    font-weight: 800;
}

.breakeven-divider {
    font-size: var(--font-size-2xl);
    color: var(--text-muted);
}

/* ---- Executive Summary ---- */
.summary-card {
    padding: var(--space-8);
    border-radius: var(--radius-2xl);
}

.summary-card h4 {
    font-size: var(--font-size-lg);
    font-weight: 700;
    margin-bottom: var(--space-4);
}

.summary-list {
    list-style: none;
}

.summary-list li {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    padding: var(--space-2) 0;
    font-size: var(--font-size-sm);
    line-height: 1.5;
}

.summary-list li .list-icon {
    flex-shrink: 0;
    margin-top: 2px;
    font-size: var(--font-size-base);
}

/* ---- Export Buttons Row ---- */
.export-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-6);
}

/* ---- Copy Angle Radar ---- */
.copy-angle-card {
    display: flex;
    align-items: center;
    gap: var(--space-6);
    flex-wrap: wrap;
}

.copy-angle-card .chart-side {
    flex: 1;
    min-width: 280px;
}

.copy-angle-card .table-side {
    flex: 1;
    min-width: 300px;
}

/* ---- Audience Cards ---- */
.audience-card {
    text-align: center;
    padding: var(--space-6);
    border-radius: var(--radius-2xl);
    border: 1px solid var(--border-primary);
    background: var(--bg-glass);
    transition: border-color var(--transition-fast), transform var(--transition-fast);
}

.audience-card:hover {
    border-color: var(--primary-400);
    transform: translateY(-4px);
}

.audience-card .audience-emoji {
    font-size: 2.5rem;
    margin-bottom: var(--space-3);
}

.audience-card .audience-name {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-4);
}

.audience-card .audience-metrics {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.audience-card .audience-metric {
    display: flex;
    justify-content: space-between;
    font-size: var(--font-size-sm);
}

.audience-card .audience-metric .label {
    color: var(--text-secondary);
}

.audience-card .audience-metric .value {
    font-weight: 700;
    color: var(--text-primary);
}

/* ---- Section Subtitle ---- */
.section-subtitle {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--text-primary);
    margin: var(--space-8) 0 var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* ---- Platform Cards ---- */
.platform-card {
    border-radius: var(--radius-2xl);
    padding: var(--space-6);
    border: 1px solid;
}

.platform-card .platform-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-5);
}

.platform-card .platform-logo {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-xl);
}

.platform-card .platform-name {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--text-primary);
}

/* ---- Tooltip ---- */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    font-size: var(--font-size-xs);
    white-space: nowrap;
    border: 1px solid var(--border-primary);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast);
    z-index: 10;
    margin-bottom: 6px;
}

.tooltip:hover::after {
    opacity: 1;
}

/* ---- Empty State ---- */
.empty-state {
    text-align: center;
    padding: var(--space-12) var(--space-8);
    color: var(--text-tertiary);
}

.empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: var(--space-4);
}

.empty-state h3 {
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.empty-state p {
    font-size: var(--font-size-sm);
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-secondary);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ---- Integration Cards ---- */
.integrations-grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

.integration-card {
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.integration-card.integration-connected {
    border-color: rgba(16, 185, 129, 0.3);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.05);
}

.integration-header {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin-bottom: var(--space-5);
}

.integration-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.integration-header>div:nth-child(2) {
    flex: 1;
}

.integration-title {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.integration-desc {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.integration-status {
    font-size: var(--font-size-sm);
    font-weight: 600;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    white-space: nowrap;
    flex-shrink: 0;
}

.integration-status.status-connected {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.integration-status.status-disconnected {
    background: rgba(100, 116, 139, 0.15);
    color: #94a3b8;
    border: 1px solid rgba(100, 116, 139, 0.3);
}

.integration-body {
    padding: var(--space-4) 0;
}

.integration-field {
    margin-bottom: var(--space-4);
}

.integration-field label {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.integration-input {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    font-family: var(--font-family);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.integration-input:focus {
    border-color: var(--primary-400);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.integration-input::placeholder {
    color: var(--text-muted);
}

.integration-actions {
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
    margin-top: var(--space-4);
}

.integration-info-box {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    margin-bottom: var(--space-4);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.integration-info-box strong {
    color: var(--text-primary);
}

.integration-footer {
    border-top: 1px solid var(--border-primary);
    padding-top: var(--space-4);
    margin-top: var(--space-2);
}

.integration-hint {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
}

.integration-hint a {
    color: var(--primary-300);
    text-decoration: none;
}

.integration-hint a:hover {
    text-decoration: underline;
}

.btn-danger-text {
    color: var(--danger-400) !important;
}

.btn-danger-text:hover {
    background: rgba(239, 68, 68, 0.1) !important;
}

/* ---- Small Buttons ---- */
.btn-sm {
    padding: 4px 12px;
    font-size: var(--font-size-xs);
}

/* ---- Client Cards ---- */
.client-card {
    transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease;
    border: 1px solid var(--border-primary);
}

.client-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.client-card.client-active {
    animation: subtle-glow 3s ease-in-out infinite;
}

@keyframes subtle-glow {

    0%,
    100% {
        box-shadow: 0 0 15px rgba(124, 58, 237, 0.1);
    }

    50% {
        box-shadow: 0 0 25px rgba(124, 58, 237, 0.2);
    }
}

/* ---- API Blocks inside Client Card ---- */
.apis-panel {
    animation: fadeSlideDown 0.3s ease;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.api-block {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    transition: border-color 0.2s ease;
}

.api-block:hover {
    border-color: rgba(124, 58, 237, 0.2);
}

.light-mode .api-block {
    background: rgba(0, 0, 0, 0.02);
}

/* ---- Platform Chip Buttons ---- */
.btn-platform-chip {
    transition: all 0.2s ease;
}

.btn-platform-chip:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.btn-platform-chip.chip-active {
    transform: translateY(-1px);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

/* APIs toggle button active state */
.btn-toggle-apis.btn-toggle-active {
    background: rgba(124, 58, 237, 0.15) !important;
    color: var(--primary-300) !important;
}

.light-mode .btn-platform-chip:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Client card — clicável */
.client-card:hover {
    border-color: var(--border-secondary) !important;
    box-shadow: 0 0 0 1px rgba(124, 58, 237, 0.12), var(--shadow-md);
}

.client-card:active {
    transform: scale(0.995);
}


/* ============================================
   DATE PICKER — Calendário Visual
   ============================================ */

/* Botão trigger que substitui o select */
.dp-trigger-btn {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    font-family: var(--font-family);
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    min-width: 160px;
    transition: all var(--transition-fast);
}

.dp-trigger-btn:hover {
    border-color: var(--primary-500);
    background: var(--bg-card-hover);
}

/* Popover principal */
.dp-popover {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 9999;
    display: flex;
    gap: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-xl);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(124, 58, 237, 0.1);
    overflow: hidden;
    animation: dpFadeIn 0.15s ease;
    min-width: 480px;
}

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

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Coluna de presets */
.dp-presets {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 8px;
    border-right: 1px solid var(--border-primary);
    background: var(--bg-tertiary);
    min-width: 130px;
    flex-shrink: 0;
}

.dp-preset-btn {
    padding: 7px 12px;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: var(--font-size-xs);
    font-weight: 500;
    font-family: var(--font-family);
    cursor: pointer;
    text-align: left;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.dp-preset-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.dp-preset-active {
    background: rgba(124, 58, 237, 0.15) !important;
    color: var(--primary-300) !important;
    font-weight: 600;
}

/* Calendário */
.dp-calendar-wrap {
    padding: 14px 16px 12px;
    flex: 1;
}

/* Header: mês + nav */
.dp-cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.dp-month-label {
    font-size: var(--font-size-sm);
    font-weight: 700;
    color: var(--text-primary);
}

.dp-nav-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: var(--font-family);
}

.dp-nav-btn:hover {
    background: var(--bg-card-hover);
    color: var(--primary-300);
    border-color: var(--primary-500);
}

/* Dias da semana */
.dp-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    margin-bottom: 4px;
}

.dp-weekday {
    text-align: center;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 4px 0;
}

/* Grade dos dias */
.dp-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.dp-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 100ms ease;
    position: relative;
    border: 1px solid transparent;
    user-select: none;
}

.dp-day:hover:not(.dp-day-other) {
    background: var(--bg-card-hover);
    color: var(--primary-200);
}

.dp-day-other {
    color: var(--text-muted);
    opacity: 0.4;
    cursor: default;
    pointer-events: none;
}

.dp-day-today {
    font-weight: 700;
    border-color: var(--primary-600);
    color: var(--primary-300);
}

/* Dia de início/fim do range */
.dp-day-selected {
    background: var(--primary-500) !important;
    color: #fff !important;
    font-weight: 700;
    border-radius: var(--radius-sm);
    border-color: var(--primary-400) !important;
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.3);
    z-index: 1;
}

.dp-day-start {
    border-radius: var(--radius-sm) 0 0 var(--radius-sm) !important;
}

.dp-day-end {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0 !important;
}

.dp-day-start.dp-day-end {
    border-radius: var(--radius-sm) !important;
}

/* Dias dentro do range selecionado */
.dp-day-in-range {
    background: rgba(124, 58, 237, 0.15);
    color: var(--primary-200);
    border-radius: 0;
    border-color: transparent;
}

/* Preview do range ao hover */
.dp-day-hover-range {
    background: rgba(124, 58, 237, 0.08);
    color: var(--primary-300);
    border-radius: 0;
}

/* Info das datas selecionadas */
.dp-selection-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding: 8px 10px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-primary);
}

.dp-sel-item {
    flex: 1;
    text-align: center;
}

.dp-sel-label {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    display: block;
}

.dp-sel-value {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    display: block;
    margin-top: 2px;
}

.dp-sel-filled .dp-sel-value {
    color: var(--primary-300);
}

.dp-sel-arrow {
    color: var(--text-muted);
    font-size: 14px;
    flex-shrink: 0;
}

/* Botões Cancelar / Aplicar */
.dp-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 10px;
}

.dp-btn-cancel {
    padding: 6px 14px;
    background: transparent;
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    font-family: var(--font-family);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.dp-btn-cancel:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.dp-btn-apply {
    padding: 6px 20px;
    background: var(--primary-500);
    border: 1px solid var(--primary-600);
    border-radius: var(--radius-md);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    font-family: var(--font-family);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.dp-btn-apply:hover {
    background: var(--primary-400);
    box-shadow: 0 0 16px rgba(124, 58, 237, 0.35);
}

/* Light mode */
.light-mode .dp-popover {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.12);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(124, 58, 237, 0.08);
}

.light-mode .dp-presets {
    background: #f8fafc;
}

.light-mode .dp-trigger-btn {
    background: #f1f5f9;
}

.light-mode .dp-day-in-range {
    background: rgba(124, 58, 237, 0.08);
}

/* Responsivo */
@media (max-width: 640px) {
    .dp-popover {
        flex-direction: column;
        min-width: 300px;
        max-width: calc(100vw - 20px);
    }

    .dp-presets {
        flex-direction: row;
        flex-wrap: wrap;
        border-right: none;
        border-bottom: 1px solid var(--border-primary);
        min-width: unset;
    }
}