/* ===========================
   E-commerce Tracker — Dark Theme
   =========================== */

:root {
    --bg-primary: #0f1117;
    --bg-secondary: #1a1d27;
    --bg-card: #1e2130;
    --bg-card-hover: #252839;
    --bg-input: #252839;
    --bg-modal: #1e2130;
    --border: #2d3148;
    --border-focus: #6366f1;

    --text-primary: #e8eaed;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;

    --accent: #6366f1;
    --accent-hover: #818cf8;
    --accent-light: rgba(99, 102, 241, 0.15);

    --green: #22c55e;
    --green-bg: rgba(34, 197, 94, 0.12);
    --red: #ef4444;
    --red-bg: rgba(239, 68, 68, 0.12);
    --yellow: #f59e0b;
    --yellow-bg: rgba(245, 158, 11, 0.12);
    --blue: #3b82f6;

    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-lg: 0 4px 20px rgba(0,0,0,0.4);

    --transition: 0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
}

/* ===========================
   Top Bar
   =========================== */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-bar-left, .top-bar-center, .top-bar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.store-switcher {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
}

.store-switcher label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.store-switcher #store-selector {
    min-width: 150px;
}

.logo {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.currency-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-card);
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    font-size: 0.85rem;
}

.currency-label {
    color: var(--text-secondary);
}

#exchange-rate {
    font-weight: 700;
    color: var(--green);
}

.status-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-weight: 500;
}

.status-disconnected {
    background: var(--red-bg);
    color: var(--red);
}

.status-connected {
    background: var(--green-bg);
    color: var(--green);
}

/* ===========================
   Tab Navigation
   =========================== */
.tab-nav {
    display: flex;
    gap: 0;
    padding: 0 1.5rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

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

.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* ===========================
   Tab Content
   =========================== */
.tab-content {
    padding: 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* ===========================
   Section Headers
   =========================== */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.section-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
}

.section-header h3 {
    font-size: 1.15rem;
    font-weight: 600;
}

.section-subtitle {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* ===========================
   Buttons
   =========================== */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
}

.btn-danger {
    background: var(--red-bg);
    color: var(--red);
}

.btn-danger:hover {
    background: var(--red);
    color: white;
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0.2rem;
    opacity: 0.7;
    transition: var(--transition);
}

.btn-icon:hover {
    opacity: 1;
}

/* ===========================
   Inputs & Forms
   =========================== */
.input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.85rem;
    transition: var(--transition);
}

.input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.input-lg {
    padding: 0.75rem 1rem;
    font-size: 1rem;
}

.input-sm {
    width: auto;
    min-width: 80px;
}

select.input {
    cursor: pointer;
}

textarea.input {
    resize: vertical;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex: 1;
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group small {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

/* ===========================
   Modal
   =========================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal.hidden {
    display: none;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--bg-modal);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    width: 90%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-sm .modal-content,
.modal-content.modal-sm {
    max-width: 420px;
}

.modal-sm {
    max-width: 420px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    transition: var(--transition);
}

.btn-close:hover {
    color: var(--text-primary);
}

.store-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
    max-height: 280px;
    overflow-y: auto;
}

.store-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
}

.store-list-item.active {
    border-color: var(--accent);
    background: var(--accent-light);
}

.store-list-main {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.store-list-name {
    font-weight: 600;
}

.store-badge {
    font-size: 0.68rem;
    color: var(--green);
    background: var(--green-bg);
    border: 1px solid rgba(34, 197, 94, 0.35);
    border-radius: 12px;
    padding: 0.15rem 0.45rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.store-list-actions {
    display: flex;
    gap: 0.45rem;
}

/* ===========================
   Tables
   =========================== */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
}

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

.data-table th {
    padding: 0.7rem 0.75rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 0.65rem 0.75rem;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border);
}

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

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

.empty-row td {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem !important;
}

/* ===========================
   Cards Grid
   =========================== */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1rem;
}

.goal-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    transition: var(--transition);
}

.goal-card:hover {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent-light);
}

.goal-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.goal-card-title {
    font-size: 1rem;
    font-weight: 600;
}

.goal-card-period {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.goal-card-actions {
    display: flex;
    gap: 0.5rem;
}

.goal-progress-bar {
    height: 6px;
    background: var(--bg-input);
    border-radius: 3px;
    overflow: hidden;
    margin: 0.75rem 0;
}

.goal-progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.5s ease;
}

.goal-progress-fill.on-track {
    background: var(--green);
}

.goal-progress-fill.behind {
    background: var(--yellow);
}

.goal-progress-fill.at-risk {
    background: var(--red);
}

.goal-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.goal-stat {
    display: flex;
    flex-direction: column;
}

.goal-stat label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.goal-stat span {
    font-size: 0.95rem;
    font-weight: 600;
}

.goal-stat .countdown {
    color: var(--yellow);
}

/* ===========================
   Dashboard Specific
   =========================== */
.prediction-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.prediction-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.prediction-card label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.prediction-value {
    font-size: 1.3rem;
    font-weight: 700;
}

.prediction-input-wrap {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.prediction-input-wrap .input {
    max-width: 200px;
}

.prediction-input-wrap select {
    width: auto;
    min-width: 65px;
}

.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
}

.chart-container h4 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* ===========================
   Diary Specific
   =========================== */
.filter-bar {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    padding: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-group label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.filter-group .input {
    width: auto;
    min-width: 130px;
}

.filter-group span {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.diary-summary {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.summary-card label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.summary-card span {
    font-size: 1.1rem;
    font-weight: 700;
}

.diary-notion-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.diary-date-group {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.diary-date-header {
    padding: 0.7rem 0.9rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    font-size: 0.78rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
}

.diary-product-stream {
    display: flex;
    flex-direction: column;
}

.diary-entry-card {
    padding: 0.9rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.diary-entry-card:last-child {
    border-bottom: none;
}

.diary-entry-top {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.diary-entry-title {
    font-size: 0.95rem;
    font-weight: 700;
}

.diary-entry-subtitle {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.diary-entry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
    gap: 0.65rem;
}

.diary-entry-metric {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.55rem 0.65rem;
}

.diary-entry-metric label {
    display: block;
    font-size: 0.68rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.15rem;
}

.diary-entry-metric strong {
    font-size: 0.88rem;
}

.diary-entry-history {
    font-size: 0.82rem;
    color: var(--text-secondary);
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: var(--radius);
    padding: 0.6rem 0.7rem;
    white-space: pre-wrap;
}

.diary-entry-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* ===========================
   Calculator Specific
   =========================== */
.calc-product-select {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.calc-product-info {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.info-chip {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.5rem 0.75rem;
    font-size: 0.82rem;
}

.info-chip span {
    color: var(--text-secondary);
}

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

.info-chip.highlight {
    border-color: var(--accent);
    background: var(--accent-light);
}

.info-chip.highlight strong {
    color: var(--accent);
}

.calc-sections {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.calc-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
}

.calc-section h3 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--accent);
}

.calc-results {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}

.result-card {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.result-card label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.result-value {
    font-size: 1.15rem;
    font-weight: 700;
}

.result-card.highlight {
    border-color: var(--green);
    background: var(--green-bg);
}

.result-card.highlight .result-value {
    color: var(--green);
}

.scenarios-table-wrap {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.scenarios-table-wrap h4 {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.scenarios-table {
    font-size: 0.82rem;
}

.custom-scenario-row {
    background: var(--accent-light);
    border: 1px solid var(--accent);
}

.custom-scenario-row td {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.scenario-input {
    width: 80px;
    padding: 0.35rem 0.5rem;
    font-size: 0.82rem;
    background: var(--bg-input);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    color: var(--text-primary);
    text-align: center;
    font-weight: 700;
}

.scenario-input:focus {
    outline: none;
    border-color: var(--accent-hover);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
}

.scenario-input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

.compare-table {
    margin-top: 1rem;
}

/* ===========================
   Profit Preview (Modal)
   =========================== */
.profit-preview {
    background: var(--accent-light);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    padding: 1rem;
    margin-top: 1rem;
}

.profit-preview h4 {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.profit-preview-values {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1.1rem;
    font-weight: 700;
}

.profit-preview-values .divider {
    color: var(--text-muted);
}

.goal-preview-details {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.goal-preview-details div {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
}

.goal-preview-details span {
    color: var(--text-secondary);
}

/* ===========================
   Empty State
   =========================== */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-muted);
    grid-column: 1 / -1;
}

/* ===========================
   Dual Currency Display
   =========================== */
.dual-currency {
    display: flex;
    flex-direction: column;
}

.dual-currency .primary {
    font-weight: 600;
}

.dual-currency .secondary {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ===========================
   Toast Notifications
   =========================== */
#toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
    max-width: 360px;
}

.toast.success {
    background: var(--green);
    color: white;
}

.toast.error {
    background: var(--red);
    color: white;
}

.toast.info {
    background: var(--blue);
    color: white;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

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

/* ===========================
   Responsive
   =========================== */
@media (max-width: 1024px) {
    .prediction-row {
        grid-template-columns: 1fr 1fr;
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }

    .diary-summary {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ===========================
   Funnel / Diagnóstico de Conversão
   =========================== */
.funnel-controls {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.funnel-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.funnel-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    font-size: 0.85rem;
    min-width: 1100px;
}

.funnel-table thead {
    background: var(--bg-secondary);
}

.funnel-table th {
    padding: 0.6rem 0.75rem;
    text-align: center;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
}

.funnel-table th:last-child {
    border-right: none;
}

.funnel-table td {
    padding: 0.5rem 0.6rem;
    text-align: center;
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
    white-space: nowrap;
}

.funnel-table td:last-child {
    border-right: none;
}

.funnel-col-label {
    width: 85px;
    text-align: left !important;
}

.funnel-col-metric {
    width: 200px;
    text-align: left !important;
}

.funnel-col-realizado {
    min-width: 110px;
}

.funnel-col-benchmark {
    min-width: 110px;
}

.funnel-col-sim {
    background: rgba(245, 158, 11, 0.08);
}

.funnel-col-sim-sub {
    min-width: 130px;
    font-size: 0.68rem !important;
    background: rgba(245, 158, 11, 0.08);
}

.funnel-section-header td {
    background: var(--bg-secondary);
    font-weight: 700;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent);
    text-align: left !important;
    padding: 0.6rem 0.75rem;
}

.funnel-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: left !important;
    font-style: italic;
}

.funnel-metric {
    font-weight: 600;
    text-align: left !important;
    color: var(--text-primary);
}

.funnel-auto {
    color: var(--text-secondary);
    font-weight: 500;
}

.funnel-input {
    width: 90px;
    padding: 0.3rem 0.4rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 0.82rem;
    text-align: center;
    font-weight: 600;
}

.funnel-input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 2px var(--accent-light);
}

.funnel-input-actual {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.08);
}

.funnel-input-bench {
    border-color: var(--blue);
    color: var(--blue);
    background: rgba(59, 130, 246, 0.08);
}

.funnel-input-sim {
    border-color: var(--blue);
    color: var(--blue);
    background: rgba(59, 130, 246, 0.1);
    font-weight: 700;
}

.funnel-input-sim:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

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

.funnel-table tbody tr.funnel-section-header:hover {
    background: var(--bg-secondary);
}

/* Mobile: cards layout (hidden on desktop) */
.funnel-mobile {
    display: none;
}

.funnel-mobile-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
    overflow: hidden;
}

.funnel-mobile-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--accent);
    cursor: pointer;
    user-select: none;
}

.funnel-mobile-card-header::after {
    content: '▼';
    font-size: 0.65rem;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.funnel-mobile-card.collapsed .funnel-mobile-card-header::after {
    transform: rotate(-90deg);
}

.funnel-mobile-card.collapsed .funnel-mobile-card-body {
    display: none;
}

.funnel-mobile-card-header.bench-header {
    color: var(--blue);
}

.funnel-mobile-card-header.sim-header {
    color: var(--yellow);
}

.funnel-mobile-card-body {
    padding: 0.5rem 1rem;
}

.funnel-mobile-section {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 0.5rem 0 0.25rem;
    border-bottom: 1px solid var(--border);
    margin-top: 0.25rem;
}

.funnel-mobile-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(45, 49, 72, 0.5);
    gap: 0.5rem;
}

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

.funnel-mobile-row-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    flex: 1;
    min-width: 0;
}

.funnel-mobile-row .funnel-input {
    width: 110px;
    flex-shrink: 0;
}

.funnel-mobile-row .funnel-auto {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    text-align: right;
    flex-shrink: 0;
}

/* ---- Facebook Ads Controls Bar ---- */
.fb-controls-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding: 0.6rem 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    flex-wrap: wrap;
}

.fb-controls-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 0.25rem;
}

/* ---- Facebook Campaigns Mapper ---- */
.fb-campaigns-list {
    max-height: 400px;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.fb-campaign-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-primary);
    transition: background 0.15s;
}

.fb-campaign-item:hover {
    background: var(--bg-card-hover);
}

.fb-campaign-item:last-child {
    border-bottom: none;
}

.fb-campaign-item input[type="checkbox"] {
    accent-color: var(--accent);
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.fb-campaign-name {
    flex: 1;
    font-weight: 500;
}

.fb-campaign-status {
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 700;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
}

.fb-campaign-status.status-fb-active {
    color: var(--green);
    background: var(--green-bg);
}

.fb-campaign-status.status-fb-paused {
    color: var(--yellow);
    background: var(--yellow-bg);
}

.text-error {
    color: var(--red);
    text-align: center;
    padding: 1rem;
}

.text-center {
    text-align: center;
}

@media (max-width: 768px) {
    .top-bar {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.5rem 1rem;
    }

    .top-bar-left,
    .top-bar-right,
    .top-bar-center {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    .store-switcher {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    .store-switcher #store-selector {
        min-width: 140px;
        width: auto;
    }

    .tab-content {
        padding: 1rem;
    }

    .form-row {
        flex-direction: column;
        gap: 0.75rem;
    }

    .prediction-row {
        grid-template-columns: 1fr;
    }

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

    .calc-results {
        grid-template-columns: 1fr;
    }

    .cards-grid {
        grid-template-columns: 1fr;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group {
        flex-direction: column;
        align-items: stretch;
    }

    /* Funnel: hide table, show mobile cards */
    .funnel-table-wrap {
        display: none;
    }

    .funnel-mobile {
        display: block;
    }
}
