/* Tax Simulator Page Styles */

body {
    margin: 0;
    padding: 0;
    background: #FAF9F5;
    color: #141413;
    font-family: "Sora", sans-serif;
}

body.page-sim {
    --paper: #FAF9F5;
    --paper-muted: #F0EEE6;
    --paper-deep: #E8E6DC;
    --surface: #FFFFFF;
    --ink: #141413;
    --ink2: #3D3D3A;
    --ink-muted: #5E5D59;
    --ink-faint: #B0AEA5;
    --accent-base: #0F766E;
    --accent-hover: #115E59;
    --accent-subtle: rgba(15, 118, 110, 0.08);
    --border-subtle: rgba(20, 20, 19, 0.10);
    --border-medium: rgba(20, 20, 19, 0.15);
    --bg-primary: var(--paper);
    --bg-elevated: var(--paper-muted);
    --bg-card: var(--surface);
    --text-primary: var(--ink);
    --text-secondary: var(--ink2);
    --text-tertiary: var(--ink-muted);
    --border: var(--border-subtle);
    --border-hover: var(--border-medium);
    --accent: var(--accent-base);
    --teal-mid: var(--accent-hover);
    --teal-deep: var(--accent-hover);
    --teal-pale: var(--accent-subtle);
}

.sim-v2-layout {
    --font-body: "Sora", sans-serif;
    --font-display: "Sora", sans-serif;
}

.sim-v2-layout,
.sim-v2-layout * {
    font-family: "Sora", sans-serif !important;
}

/* Main content area - offset for fixed sidebar */
.main {
    position: absolute;
    left: 280px;
    right: 0;
    min-height: 100vh;
    overflow-y: auto;
    padding: 48px 48px 64px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.layout-app.embed-mode .main {
    position: relative;
    left: 0;
    right: 0;
    width: 100%;
    padding: 0;
    display: block;
    overflow: visible;
    align-items: stretch;
    justify-content: flex-start;
    background: transparent;
}

/* Simulator styles */
.simulator-section {
    width: min(1100px, 100%);
    margin: 0 auto;
    padding: 0;
}

h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.5rem 0;
}

.sim-description {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    max-width: 820px;
    line-height: 1.6;
}

/* Search method selector */
.search-method-selector {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    justify-content: flex-start;
    align-items: center;
    width: fit-content;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    color: var(--text-primary);
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    transition: all 0.15s ease;
}

.radio-option input[type="radio"] {
    width: 16px;
    cursor: pointer;
    accent-color: var(--teal-mid);
}

/* Active pill state */
.radio-option input[type="radio"]:checked + span {
    color: var(--accent);
    font-weight: 600;
}

.radio-option:hover {
    background: rgba(74, 128, 124, 0.08);
}

/* Form single row */
.sim-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
    width: 100%;
}

/* Field label for groups (not floating) */
.field-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 1.5rem 0 0.75rem 0;
}

/* Input groups within sim-row */
.sim-row > .input-group {
    position: relative;
    margin-bottom: 0.75rem;
}

.sim-row > .input-group:last-of-type {
    margin-bottom: 0;
}

.sim-row > .input-group input,
.sim-row > .input-group select {
    width: 100%;
    height: 3.25rem;
    box-sizing: border-box;
    padding: 0.75rem 1rem;
    line-height: 1.5;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    background: var(--bg-card);
    transition: border-color 0.2s ease;
}

.sim-row > .input-group input:focus,
.sim-row > .input-group select:focus {
    outline: none;
    border-color: var(--teal-mid);
}

/* Force label to stay at top for selects */
.sim-row > .input-group select + label {
    position: absolute;
    top: -0.6rem !important;
    left: 0.75rem !important;
    font-size: 0.75rem !important;
    color: var(--text-secondary) !important;
    font-weight: 600 !important;
    background: var(--bg-card) !important;
    padding: 0 0.25rem;
    z-index: 1;
}

/* Calcular button - full width below sections */
.sim-row #simBtn {
    width: 100%;
    margin-top: 1rem;
    height: 3.5rem;
    padding: 0 1.25rem;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 10px;
}

/* Product mode - no special layout needed, sections already stack */

#simNcm,
#simValor {
    text-align: right;
}

/* Desktop: keep single column for simplicity */
@media (min-width: 1024px) {
    .sim-row,
    .search-method-selector {
        max-width: 600px;
        margin-left: auto;
        margin-right: auto;
    }
}

.input-group {
    position: relative;
    margin-bottom: var(--space-md);
}

.input-group label {
    position: absolute;
    left: var(--space-sm);
    top: 0.9rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-tertiary);
    transition: top var(--duration) var(--ease),
                left var(--duration) var(--ease),
                font-size var(--duration) var(--ease);
    pointer-events: none;
    background: transparent;
    padding: 0 0.25rem;
}

.input-group input:focus + label,
.input-group input:not(:placeholder-shown) + label,
.input-group select:focus + label,
.input-group select:not([value=""]) + label {
    top: -0.6rem;
    left: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 600;
    background: var(--bg-primary);
}

input, select {
    width: 100%;
    padding: 1.125rem 1.5rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 1rem;
    transition: border-color var(--duration) var(--ease);
    outline: none;
}

input:focus, select:focus {
    border-color: var(--border-hover);
}

input.error, .input-group.error input {
    border-color: var(--error, #ff6b6b) !important;
    background: var(--bg-card);
}

/* Error state shake animation */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* CRITICAL: Override design-system.css display:none on .error class */
.input-group.error {
    display: block !important;
    animation: shake 0.3s ease-in-out;
    /* Remove design-system.css alert styling */
    padding: 0 !important;
    border-radius: 0 !important;
    margin-bottom: var(--space-md) !important;
    background: transparent !important;
}

/* Prevent autofill styling in LIGHT theme */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px var(--bg-card) inset !important;
    -webkit-text-fill-color: var(--text-primary) !important;
    background-color: var(--bg-card) !important;
    border: 2px solid var(--border) !important;
    transition: border-color var(--duration) var(--ease) !important;
}

/* Dark theme input fix - prevent white background */
[data-theme="dark"] input,
[data-theme="dark"] select {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
}

/* Prevent autofill white background in dark theme */
[data-theme="dark"] input:-webkit-autofill,
[data-theme="dark"] input:-webkit-autofill:hover,
[data-theme="dark"] input:-webkit-autofill:focus,
[data-theme="dark"] input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px var(--bg-card) inset !important;
    -webkit-text-fill-color: var(--text-primary) !important;
    background-color: var(--bg-card) !important;
    border: 2px solid var(--border) !important;
}

/* Dark theme label background */
[data-theme="dark"] .input-group input:focus + label,
[data-theme="dark"] .input-group input:not(:placeholder-shown) + label,
[data-theme="dark"] .input-group select:focus + label,
[data-theme="dark"] .input-group select:not([value=""]) + label {
    background: var(--bg-primary) !important;
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b6b6b' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

/* Input error messages */
.input-error-message {
    position: absolute;
    bottom: -1.25rem;
    left: var(--space-sm);
    color: var(--error, #ff6b6b);
    font-size: 0.75rem;
    font-weight: 500;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
    z-index: 1;
}

.input-group.error .input-error-message {
    opacity: 1;
    visibility: visible;
}

/* Autocomplete dropdown */
.ncm-autocomplete-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 8px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.ncm-autocomplete-dropdown.active {
    display: block;
}

.ncm-autocomplete-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
}

.ncm-autocomplete-item:hover,
.ncm-autocomplete-item.selected {
    background: var(--bg-elevated);
}

.ncm-autocomplete-item:last-child {
    border-bottom: none;
}

.ncm-autocomplete-item-ncm {
    font-size: 0.875rem;
    color: var(--teal-mid);
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.ncm-autocomplete-item-desc {
    font-size: 0.875rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    cursor: pointer;
    transition: none;
}

.ncm-autocomplete-item-desc.expanded {
    -webkit-line-clamp: unset;
    display: block;
}

.ncm-autocomplete-item-desc.truncated::after {
    content: ' ▼';
    font-size: 0.625rem;
    color: var(--text-tertiary);
}

.ncm-autocomplete-item-desc.expanded::after {
    content: ' ▲';
    font-size: 0.625rem;
    color: var(--text-tertiary);
}

.ncm-autocomplete-item-badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 0.25rem;
}

.ncm-autocomplete-item-badge.zero {
    background: #d4edda;
    color: #155724;
}

.ncm-autocomplete-item-badge.reduced_60 {
    background: #fff3cd;
    color: #856404;
}

.ncm-autocomplete-item-badge.is {
    background: #f8d7da;
    color: #721c24;
}

.ncm-autocomplete-item-badge.standard {
    background: var(--bg-elevated);
    color: var(--text-secondary);
}

/* Button */
.simulator-section button {
    width: 100%;
    padding: 1rem 2rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s ease;
    margin-bottom: 0;
}

.simulator-section button:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.simulator-section button:disabled {
    background: var(--bg-elevated);
    color: var(--text-tertiary);
    cursor: not-allowed;
    opacity: 0.5;
}

.simulator-section button.loading {
    opacity: 0.7;
    cursor: wait;
}

/* Simulator button styling - same in both themes */
#simBtn,
[data-theme="dark"] #simBtn {
    background: var(--accent) !important;
    color: #ffffff !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

#simBtn:hover,
[data-theme="dark"] #simBtn:hover {
    background: var(--accent-hover) !important;
    color: #ffffff !important;
}

/* Quota Display */
.quota-display {
    display: none; /* Hidden by default - JavaScript will show when needed */
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    color: var(--teal-text);
    margin-top: 4px;
    margin-bottom: 1.5rem;
}

/* Results */
.sim-result {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    margin-top: 1rem;
    margin-left: auto;
    margin-right: auto;
        --font-body
    ); /* Changed from --font-mono to --font-body (Plus Jakarta Sans) */
    font-size: 0.875rem;
    font-weight: 500; /* Set baseline weight - Plus Jakarta Sans 400 is too thin */
    line-height: 1.6;
    box-shadow: none;
    animation: fadeInUp 0.5s var(--ease);
    max-width: 900px;
}

[data-theme="dark"] .sim-result {
    background: transparent;
    border-radius: 0;
    padding: 0;
}

.sim-result-empty {
    display: none;
}

/* Warning message for zero-rate precedence */
.sim-warning {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-top: 20px;
    padding: 16px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 8px;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text-primary);
}

.sim-warning svg {
    flex-shrink: 0;
    margin-top: 2px;
    color: #f59e0b;
}

[data-theme="dark"] .sim-warning {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.4);
}

/* Tax Result Card Styles */
.tax-result-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 24px;
}

.result-product {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    cursor: pointer;
    transition: none;
}

.result-product.expanded {
    -webkit-line-clamp: unset;
    display: block;
}

.result-product.truncated::after {
    content: ' ▼';
    font-size: 0.625rem;
    color: var(--text-tertiary);
}

.result-product.expanded::after {
    content: ' ▲';
    font-size: 0.625rem;
    color: var(--text-tertiary);
}

.result-ncm {
    font-size: 14px;
    font-weight: 600;
    color: var(--teal-deep);
    margin-bottom: 8px;
}

.result-official-description {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.result-annex {
    font-size: 14px;
    font-weight: 500;
    color: var(--accent);
    margin-bottom: 6px;
}

.result-annex-description {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.5;
    color: var(--text-secondary);
    margin-bottom: 12px;
    padding: 8px 12px;
    background: var(--bg-elevated);
    border-left: 3px solid var(--accent);
    border-radius: 4px;
}

.result-meta {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.tax-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 12px 0;
}

.tax-label {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.tax-value {
    text-align: right;
}

.tax-amount {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.tax-rate {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-top: 2px;
}

.tax-reduction {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-tertiary);
    margin-top: 4px;
    font-style: italic;
}

.tax-total {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 2px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.tax-total-label {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tax-total-value {
    text-align: right;
}

.tax-total-amount {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent);
    white-space: nowrap;
}

.tax-total-rate {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Rate Badges (IS/Zero/Reduced Detection) */
.rate-badges-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.rate-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.rate-badge.zero {
    background: rgba(16, 185, 129, 0.15);
    color: #047857;
}

.rate-badge.reduced {
    background: rgba(74, 128, 124, 0.15);
    color: var(--teal-deep);
}

.rate-badge.is {
    background: rgba(245, 158, 11, 0.15);
    color: #b45309;
}

.rate-badge.is-pending {
    background: rgba(107, 114, 128, 0.15);
    color: #6b7280;
}

/* Timeline evolution */
.timeline-evolution-container {
    max-width: 900px;
    margin: 2rem auto 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 3rem;
}

.timeline-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 1.25rem;
    background: #e8e8e8;
    cursor: pointer;
    transition: background 0.2s;
}

.timeline-toggle span {
    color: #1a1a1a !important;
}

.timeline-toggle:hover {
    background: #d0d0d0;
}

[data-theme="dark"] .timeline-toggle {
    background: #e8e8e8 !important;
}

[data-theme="dark"] .timeline-toggle:hover {
    background: #d0d0d0 !important;
}

[data-theme="dark"] .timeline-toggle span {
    color: #1a1a1a !important;
}

.timeline-toggle::before {
    content: '▼';
    font-size: 0.75rem;
    color: var(--text-tertiary);
    transition: transform 0.2s;
    margin-right: 8px;
}

.timeline-toggle.expanded::before {
    transform: rotate(180deg);
}

.timeline-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.timeline-content.expanded {
    max-height: 2000px;
}

.timeline-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.timeline-table th {
    padding: 0.5rem 0.75rem;
    background: var(--teal-deep);
    color: white;
    font-weight: 600;
    text-align: center;
    border-bottom: 2px solid var(--border);
}

.timeline-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #e5e7eb; /* Light grey gridline */
    color: var(--text-primary);
}

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

.timeline-table tr.current-year {
    background: var(--teal-pale);
}

.timeline-table .year-cell {
    font-weight: 600;
}

.timeline-table .phase-cell {
    text-align: center;
}

.timeline-table .value-cell {
    text-align: right;
    font-size: 0.8125rem;
}

.phase-badge {
    display: inline-block;
    padding: 0.25rem 0.625rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.phase-badge.teste {
    background: #e3f2fd;
    color: #1565c0;
}

.phase-badge.cbs_is {
    background: #ede7f6;
    color: #5e35b1;
}

.phase-badge.transicao {
    background: #fff3e0;
    color: #e65100;
}

.phase-badge.completa {
    background: #e8f5e9;
    color: #2e7d32;
}

/* Dark theme phase badge overrides */
[data-theme="dark"] .phase-badge.teste {
    background: rgba(21, 101, 192, 0.2);
    color: #90caf9;
}

[data-theme="dark"] .phase-badge.cbs_is {
    background: rgba(94, 53, 177, 0.2);
    color: #b39ddb;
}

[data-theme="dark"] .phase-badge.transicao {
    background: rgba(230, 81, 0, 0.2);
    color: #ffcc80;
}

[data-theme="dark"] .phase-badge.completa {
    background: rgba(46, 125, 50, 0.2);
    color: #a5d6a7;
}

.timeline-chart-container {
    padding: 1.5rem;
    background: var(--bg-card);
    height: 350px;
    position: relative;
}

/* Chart legend - make clickable */
.timeline-chart-container canvas {
    cursor: default;
}

/* ========================================
   COMPACT RESULTS LAYOUT (NEW)
   ======================================== */

/* Compact result container */
.sim-result-compact {
    max-width: 900px;
    margin: 0 auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

/* Compact header */
.result-header {
    padding: 16px 20px 12px;
    border-bottom: 1px solid var(--border);
}

/* Rate details table */
.rate-details-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    border-top: 1px solid var(--border);
}

.rate-details-table thead th {
    padding: 12px 16px;
    background: var(--teal-deep);
    color: white;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: left;
    border-bottom: 2px solid var(--border);
}

.rate-details-table thead th:nth-child(2),
.rate-details-table thead th:nth-child(4) {
    text-align: right;
}

.rate-details-table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb; /* Light grey gridline */
    color: var(--text-primary);
    font-size: 0.9375rem;
}

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

.rate-details-table .tax-name {
    font-weight: 600;
    color: var(--text-primary);
}

.rate-details-table .tax-rate {
    text-align: right;
    font-style: italic;
    color: var(--teal-deep);
}

.rate-details-table .tax-calc {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.rate-details-table .tax-value {
    text-align: right;
    font-weight: 600;
    color: var(--text-primary);
}

.rate-details-table .total-row {
    background: var(--teal-pale);
}

.rate-details-table .total-row td {
    padding: 14px 16px;
    font-size: 0.9375rem;
}

/* Pro timeline section */
.timeline-pro-section {
    border-top: 1px solid var(--border);
}

.timeline-expand-btn {
    width: 100%;
    padding: 1rem 1.25rem;
    background: #e8e8e8;
    border: none;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    color: var(--text-primary);
    position: relative;
}

.timeline-expand-btn::before {
    content: '▼';
    font-size: 0.75rem;
    color: var(--text-tertiary);
    transition: transform 0.2s;
    margin-right: 8px;
}

.timeline-expand-btn.expanded::before {
    transform: rotate(180deg);
}

.timeline-expand-btn:hover {
    background: #d0d0d0;
}

[data-theme="dark"] .timeline-expand-btn {
    background: #e8e8e8 !important;
    color: #1a1a1a !important;
}

[data-theme="dark"] .timeline-expand-btn:hover {
    background: #d0d0d0 !important;
    color: #1a1a1a !important;
}

.pro-badge {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-size: 0.625rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    position: absolute;
    right: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Blurred preview for Free users */
.timeline-preview {
    position: relative;
}

.timeline-preview.blurred {
    filter: blur(4px);
    pointer-events: none;
    opacity: 0.6;
}

.blur-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(2px);
    pointer-events: auto;
    z-index: 10;
}

[data-theme="dark"] .blur-overlay {
    background: rgba(0, 0, 0, 0.5);
}

.upgrade-cta {
    text-align: center;
    padding: 24px;
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    max-width: 360px;
}

[data-theme="dark"] .upgrade-cta {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.upgrade-cta .lock-icon {
    font-size: 2rem;
    margin-bottom: 8px;
    display: block;
}

.upgrade-cta h4 {
    margin: 0 0 8px 0;
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
}

.upgrade-cta p {
    margin: 0 0 16px 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.btn-upgrade {
    display: inline-block;
    margin-top: 12px;
    padding: 10px 20px;
    background: var(--teal-mid);
    color: white;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s ease;
    font-size: 0.875rem;
}

.btn-upgrade:hover {
    background: var(--teal-deep);
    text-decoration: none;
}

/* Full timeline for Pro users */
.timeline-full {
    padding: 20px;
}

.timeline-full .timeline-table {
    margin-bottom: 20px;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    /* === MAIN CONTAINER & TYPOGRAPHY === */
    .main {
        padding: 60px 16px 20px 16px !important;
        left: 0 !important;
    }

    h2 {
        font-size: 1.5rem !important;
        margin-bottom: 0.75rem;
    }

    .sim-description {
        font-size: 0.875rem;
        margin-bottom: 1.5rem;
    }

    /* === SEARCH METHOD SELECTOR === */
    .search-method-selector {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }

    /* === FORM INPUTS === */
    .sim-row {
        flex-direction: column;
    }

    .sim-row .input-group {
        flex: 1 1 100% !important;
    }

    .sim-row .input-group input,
    .sim-row .input-group select {
        height: 3.5rem;
        font-size: 1rem;
    }

    .sim-row #simAnoGroup {
        flex: 1 1 100% !important;
    }

    .sim-row #simBtn {
        flex: 1 1 100% !important;
        width: 100%;
        height: auto !important;
        padding: 1rem 1.5rem !important;
        align-self: stretch;
    }

    /* === RATE EDITOR === */
    .rate-editor {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.75rem !important;
        padding: 1rem !important;
        border-radius: 8px 8px 0 0;
    }

    .rate-editor .rate-label {
        text-align: left;
        font-weight: 600;
    }

    .rate-input-inline {
        width: 100% !important;
        justify-content: space-between !important;
        flex-wrap: nowrap !important;
    }

    .rate-input-inline label {
        min-width: 80px;
        flex-shrink: 0;
    }

    .rate-input-inline input {
        flex: 1;
        max-width: 100px;
        width: auto !important;
    }

    /* === RESULT CONTAINER === */
    .sim-result {
        max-width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    .sim-result-compact {
        overflow: visible !important;
        max-width: 100%;
    }

    /* === COMPARISON TABLE === */
    .comparison-table {
        min-width: 500px !important;
        font-size: 0.75rem;
        overflow: visible !important;
    }

    .comparison-table thead th {
        padding: 0.375rem 0.25rem;
        font-size: 0.625rem;
    }

    .comparison-table td {
        padding: 0.375rem 0.25rem;
    }

    .comparison-table .tax-name {
        font-size: 0.75rem;
    }

    .comparison-table .tax-rate,
    .comparison-table .tax-value {
        font-size: 0.75rem;
        min-width: 2.5rem;
    }

    /* === SAVINGS BANNER === */
    .savings-banner {
        font-size: 0.875rem;
        padding: 0.75rem;
    }

    /* === TIMELINE TABLE === */
    .timeline-evolution-container {
        overflow-x: auto !important;
        overflow-y: visible !important;
        -webkit-overflow-scrolling: touch;
        margin-left: -16px;
        margin-right: -16px;
        padding: 0 16px;
        border-radius: 0;
    }

    .timeline-content {
        overflow-x: visible !important;
        overflow-y: hidden;
        max-height: none !important;
    }

    .timeline-table {
        min-width: 700px;
        font-size: 0.6875rem;
    }

    .timeline-table th,
    .timeline-table td {
        padding: 0.375rem 0.25rem;
        white-space: nowrap;
    }

    .phase-badge {
        font-size: 0.5625rem;
        padding: 0.125rem 0.375rem;
    }

    /* === TIMELINE CHART === */
    .timeline-chart-container {
        height: 250px;
        padding: 0.75rem;
    }

    /* === RESULT HEADER === */
    .result-header {
        padding: 12px 16px;
    }

    .result-product {
        font-size: 0.9375rem;
    }

    .result-ncm {
        font-size: 0.8125rem;
    }

    .result-meta {
        font-size: 0.75rem;
    }

    /* === QUOTA DISPLAY === */
    .quota-display {
        font-size: 0.6875rem;
    }
}

/* ═══════════════════════════════════════════════════════
   COMPARISON WITH CURRENT TAX SYSTEM
   ═══════════════════════════════════════════════════════ */

.comparison-section {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.comparison-section h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.comparison-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0 0 1rem 0;
}

.comparison-rates {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.rate-input-group {
    display: flex;
    flex-direction: column;
}

.rate-input-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
}

.rate-input-group input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-align: right;
    font-size: 0.9375rem;
    color: var(--text-primary);
    background: var(--bg-input);
    transition: border-color 0.2s ease;
}

.rate-input-group input:focus {
    outline: none;
    border-color: var(--teal-mid);
}

[data-theme="dark"] .rate-input-group input {
    background: var(--bg-primary);
}

#compareBtn {
    width: 100%;
    padding: 0.75rem 1.5rem;
    background: var(--teal-mid);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

#compareBtn:hover {
    background: var(--teal-deep);
}

#compareBtn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Extended table styling for comparison columns */
.rate-details-table.with-comparison th:nth-child(5),
.rate-details-table.with-comparison td:nth-child(5) {
    text-align: center;
    color: var(--text-tertiary);
    width: 30px;
    font-weight: 400;
    font-size: 1rem;
}

.rate-details-table.with-comparison th:nth-child(6),
.rate-details-table.with-comparison th:nth-child(7),
.rate-details-table.with-comparison th:nth-child(8) {
    background: rgba(139, 92, 246, 0.05);
}

[data-theme="dark"] .rate-details-table thead th {
    background: var(--teal-mid);
    color: white;
}

[data-theme="dark"] .rate-details-table tbody td {
    border-bottom-color: rgba(255, 255, 255, 0.1); /* Light grey gridline for dark mode */
}

[data-theme="dark"] .rate-details-table.with-comparison th:nth-child(6),
[data-theme="dark"] .rate-details-table.with-comparison th:nth-child(7),
[data-theme="dark"] .rate-details-table.with-comparison th:nth-child(8) {
    background: rgba(139, 92, 246, 0.1);
}

/* Difference row */
.difference-row {
    border-top: 2px solid var(--border);
    font-weight: 600;
}

.difference-row.savings {
    background: rgba(34, 197, 94, 0.1);
}

.difference-row.savings td {
    color: #16a34a;
}

[data-theme="dark"] .difference-row.savings {
    background: rgba(34, 197, 94, 0.15);
}

[data-theme="dark"] .difference-row.savings td {
    color: #22c55e;
}

.difference-row.increase {
    background: rgba(239, 68, 68, 0.1);
}

.difference-row.increase td {
    color: #dc2626;
}

[data-theme="dark"] .difference-row.increase {
    background: rgba(239, 68, 68, 0.15);
}

[data-theme="dark"] .difference-row.increase td {
    color: #ef4444;
}

/* ═══════════════════════════════════════════════════════
   INLINE RATE EDITOR
   ═══════════════════════════════════════════════════════ */

.rate-editor {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0.75rem 1rem;
    background: transparent;
    border-radius: 8px 8px 0 0;
    border-bottom: none;
    font-size: 0.875rem;
    max-width: 900px;
    margin: 0 auto;
}

.rate-editor .rate-label {
    color: var(--text-secondary);
    font-weight: 500;
    line-height: 1;
}

.rate-input-inline {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-bottom: 0;
}

.rate-input-inline label {
    display: flex;
    align-items: center;
    height: 1.75rem;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    line-height: 1;
    margin: 0;
}

.rate-input-inline input {
    width: 4rem;
    padding: 0.25rem 0.5rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    font-size: 0.875rem;
    text-align: right;
    line-height: 1;
    margin: 0;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#icmsRateInput,
#ipiRateInput {
    flex: 1 1 auto;
    min-width: 4rem;
}

.rate-input-inline input:focus {
    outline: none;
    border-color: var(--teal-mid);
    box-shadow: 0 0 0 3px rgba(74, 128, 124, 0.1);
}

.rate-input-inline span {
    color: var(--text-tertiary);
    line-height: 1;
}

/* Hide number input spinners */
.rate-input-inline input[type="number"]::-webkit-outer-spin-button,
.rate-input-inline input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.rate-input-inline input[type="number"] {
    -moz-appearance: textfield;
}

/* Show spinners only for ICMS and IPI */
#icmsRateInput::-webkit-outer-spin-button,
#icmsRateInput::-webkit-inner-spin-button,
#ipiRateInput::-webkit-outer-spin-button,
#ipiRateInput::-webkit-inner-spin-button {
    -webkit-appearance: inner-spin-button !important;
    opacity: 1 !important;
    margin: 0;
}

#icmsRateInput,
#ipiRateInput {
    -moz-appearance: number-input !important;
}

/* ═══════════════════════════════════════════════════════
   UNIFIED COMPARISON TABLE (Harvey Style)
   ═══════════════════════════════════════════════════════ */

.comparison-table {
    width: 100%;
    max-width: 900px;
    border-collapse: separate;
    border-spacing: 0;
    margin: 0 auto;
    background: white;
    border-radius: 0 0 12px 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.comparison-table thead {
    background: var(--teal-deep);
}

.comparison-table thead th {
    padding: 0.75rem 1rem;
    font-weight: 600;
    font-size: 0.875rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: white;
    border-bottom: 2px solid rgba(0, 0, 0, 0.1);
}

.comparison-table .tax-name-header {
    text-align: left;
}

.comparison-table .header-new {
    background: var(--teal-deep);
    text-align: center;
}

.comparison-table .header-current {
    background: var(--teal-deep);
    color: white;
    text-align: center;
}

.comparison-table tbody tr {
    transition: background-color 0.15s ease;
}

.comparison-table tbody tr:hover {
    background: rgba(0, 0, 0, 0.02);
}

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

.comparison-table td {
    padding: 0.625rem 1rem;
    border-bottom: 1px solid #e5e7eb; /* Light grey gridline */
}

.comparison-table .tax-name {
    text-align: left;
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text-primary);
}

.comparison-table .tax-rate {
    text-align: right;
    font-size: 0.9375rem;
    font-style: italic;
    color: #374151;
    min-width: 5rem;
}

.comparison-table .tax-rate.new {
    background: transparent;
}

.comparison-table .tax-rate.current {
    background: transparent;
}

.comparison-table .tax-value {
    text-align: right;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 7rem;
}

.comparison-table .offset-value {
    color: var(--text-tertiary);
    font-style: italic;
    opacity: 0.7;
}

.comparison-table .transition-note {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    font-style: italic;
    margin-left: 0.25rem;
}

.comparison-table tfoot {
    background: #e5e7eb;
    border-top: 2px solid var(--teal-deep);
}

.comparison-table tfoot td {
    font-weight: 700;
    font-size: 1rem;
    padding: 0.75rem 1rem;
}

/* DIFERENÇA Text (No Banner) */
.savings-banner {
    margin: 1rem 0;
    padding: 0;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    background: none;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.savings-banner.positive {
    color: var(--teal-deep);
}

.savings-banner.negative {
    color: #991b1b;
}

.savings-banner.zero-diff {
    color: #6b7280;
}

.result-note {
    margin: 1rem 0;
    padding: 0.75rem 1rem;
    border-left: 4px solid var(--teal-mid);
    background: rgba(74, 128, 124, 0.05);
    border-radius: 0 8px 8px 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* ═══════════════════════════════════════════════════════
   TIMELINE TABLE EXTENSIONS (Harvey Style)
   ═══════════════════════════════════════════════════════ */

.timeline-table thead tr:first-child th {
    padding: 1rem 0.75rem;
    font-weight: 600;
    font-size: 0.8125rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.timeline-table thead tr:nth-child(2) th {
    padding: 0.75rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.timeline-table .header-carga {
    background: var(--teal-deep);
    color: white;
    text-align: center;
}

.timeline-table .header-ref {
    background: rgba(74, 128, 124, 0.2);
    color: var(--teal-deep);
    font-weight: 600;
}

.timeline-table .header-diferenca {
    background: rgba(74, 128, 124, 0.2);
    color: var(--teal-deep);
    font-weight: 600;
}

.timeline-table tbody tr {
    transition: all 0.2s ease;
}

.timeline-table tbody tr:hover {
    background: rgba(74, 128, 124, 0.03);
    transform: none;
}

.timeline-table tbody tr.current-year {
    background: rgba(74, 128, 124, 0.05);
    box-shadow: none;
}

.timeline-table .value-cell {
    font-size: 0.875rem;
    font-weight: 600;
    text-align: right;
    padding: 0.5rem 0.5rem;
}

.timeline-table .total-cell {
    font-weight: 700;
    background: transparent;
    border-left: none;
}

.timeline-table .ref-cell {
    background: transparent;
    font-weight: 600;
}

.timeline-table .diff-cell {
    font-weight: 700;
}

.timeline-table .diff-cell.positive {
    color: #16a34a;
    background: transparent;
}

.timeline-table .diff-cell.negative {
    color: #dc2626;
    background: transparent;
}

.timeline-note-row {
    background: transparent;
}

.timeline-note {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-style: italic;
    padding: 0.875rem 1rem;
    text-align: left;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

/* Dark Mode Support */
[data-theme="dark"] .comparison-table {
    background: rgba(30, 30, 30, 0.6);
}

[data-theme="dark"] .comparison-table thead {
    background: var(--teal-mid);
}

[data-theme="dark"] .comparison-table .header-new {
    background: var(--teal-mid);
}

[data-theme="dark"] .comparison-table .header-current {
    background: var(--teal-mid);
    color: white;
}

[data-theme="dark"] .comparison-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .comparison-table td {
    border-bottom-color: rgba(255, 255, 255, 0.1); /* Grey gridline for dark mode */
}

[data-theme="dark"] .comparison-table .tax-name {
    color: rgba(255, 255, 255, 0.95);
}

[data-theme="dark"] .comparison-table .tax-rate {
    color: rgba(255, 255, 255, 0.9);
}

[data-theme="dark"] .comparison-table .tax-value {
    color: rgba(255, 255, 255, 0.9);
}

[data-theme="dark"] .comparison-table .tax-rate.new {
    background: transparent;
}

[data-theme="dark"] .comparison-table .tax-rate.current {
    background: transparent;
}

[data-theme="dark"] .comparison-table tfoot {
    background: #374151;
    border-top-color: #5a9995;
}

[data-theme="dark"] .savings-banner.positive {
    color: #5a9995;
}

[data-theme="dark"] .savings-banner.negative {
    color: #dc2626;
}

[data-theme="dark"] .savings-banner.zero-diff {
    color: #9ca3af;
}

[data-theme="dark"] .rate-editor {
    background: transparent;
    border-bottom: none;
}

[data-theme="dark"] .rate-input-inline input {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.9);
}

[data-theme="dark"] .rate-input-inline input:focus {
    border-color: #5a9995;
    box-shadow: 0 0 0 3px rgba(90, 153, 149, 0.2);
}

[data-theme="dark"] .result-note {
    background: rgba(74, 128, 124, 0.1);
    border-left-color: #5a9995;
    color: rgba(255, 255, 255, 0.7);
}

[data-theme="dark"] .timeline-table th {
    background: var(--teal-mid);
    color: white;
}

[data-theme="dark"] .timeline-table .header-carga {
    background: var(--teal-mid);
}

[data-theme="dark"] .timeline-table .header-ref {
    background: rgba(74, 128, 124, 0.25);
    color: rgba(90, 153, 149, 1);
}

[data-theme="dark"] .timeline-table .header-diferenca {
    background: rgba(74, 128, 124, 0.25);
    color: rgba(90, 153, 149, 1);
}

[data-theme="dark"] .timeline-table tbody tr:hover {
    background: rgba(74, 128, 124, 0.12);
}

[data-theme="dark"] .timeline-table tbody tr.current-year {
    background: rgba(74, 128, 124, 0.08);
}

[data-theme="dark"] .timeline-table td {
    border-bottom-color: rgba(255, 255, 255, 0.1); /* Light grey gridline for dark mode */
}

[data-theme="dark"] .timeline-table .total-cell {
    background: transparent;
    border-left: none;
}

[data-theme="dark"] .timeline-table .ref-cell {
    background: transparent;
}

[data-theme="dark"] .timeline-table .diff-cell.positive {
    color: #22c55e;
    background: transparent;
}

[data-theme="dark"] .timeline-table .diff-cell.negative {
    color: #ef4444;
    background: transparent;
}

[data-theme="dark"] .timeline-note {
    color: rgba(255, 255, 255, 0.6);
    border-top-color: rgba(255, 255, 255, 0.1);
}

/* Dark mode - Rate editor */
[data-theme="dark"] .rate-editor {
    background: rgba(74, 128, 124, 0.15);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .rate-input-inline input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
}

[data-theme="dark"] .rate-input-inline input:focus {
    border-color: var(--teal-mid);
    background: rgba(255, 255, 255, 0.08);
}

/* ═══════════════════════════════════════════════════════════════
   ADVANCED OPTIONS & CONTEXT WIZARD STYLES
   ═══════════════════════════════════════════════════════════════ */

/* Context Wizard Headings */
.context-wizard h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.section-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.5;
}

/* Context Grid (responsive) */
.context-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

@media (max-width: 640px) {
    .context-grid {
        grid-template-columns: 1fr; /* Stack on mobile */
    }
}

/* Status Message Badges */
#contextStatus {
    font-size: 0.875rem;
    color: var(--text-tertiary);
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border-left: 3px solid var(--teal-mid);
    border-radius: 4px;
    margin-top: 1rem;
    line-height: 1.5;
    transition: all 0.3s ease;
}

#contextStatus.loading {
    background: rgba(74, 128, 124, 0.1);
    color: var(--teal-mid);
    border-left: 3px solid var(--teal-mid);
}

#contextStatus.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border-left: 3px solid var(--success);
}

#contextStatus.error {
    background: rgba(220, 38, 38, 0.1);
    color: var(--error);
    border-left: 3px solid var(--error);
}

/* Progressive Context Animations */
#progressiveContext {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.context-row {
    animation: slideIn 0.2s ease-out;
    transition: opacity 0.2s ease, height 0.2s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Visual separator before progressive context */
#progressiveContext::before {
    content: "";
    display: block;
    width: 100%;
    height: 1px;
    background: var(--border);
    margin: 1.5rem 0;
}

/* Radio button improvements */
.search-method-selector {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 0;
    justify-content: flex-start;
    align-items: center;
}

.radio-option {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: 6px;
    transition: all 0.2s ease;
}

.radio-option:hover {
    background: rgba(74, 128, 124, 0.05);
    border-color: var(--border-hover);
}

.radio-option input[type="radio"] {
    width: auto;
    margin-right: 0.5rem;
    cursor: pointer;
    accent-color: var(--teal-mid);
}

.radio-option input[type="radio"]:focus {
    outline: 2px solid var(--teal-mid);
    outline-offset: 2px;
}

.radio-option:has(input:checked) {
    border-color: var(--teal-mid);
    background: rgba(74, 128, 124, 0.05);
}

.radio-option input[type="radio"]:checked + span {
    font-weight: 600;
    color: var(--teal-mid);
}

/* Context row labels */
.context-row > label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

/* Helper text styling */
.context-row .helper-text {
    font-size: 0.8125rem;
    color: var(--text-tertiary);
    margin-top: 0.5rem;
    line-height: 1.5;
}

.context-row .helper-text strong {
    color: var(--text-secondary);
    font-weight: 600;
}

/* Info tooltip pattern */
.info-tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    font-size: 0.75rem;
    cursor: help;
    color: var(--text-tertiary);
    transition: color 0.2s ease;
}

.info-tooltip:hover {
    color: var(--teal-mid);
}

.info-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 0.5rem);
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 0.75rem;
    background: var(--text-primary);
    color: white;
    font-size: 0.75rem;
    line-height: 1.4;
    white-space: normal;
    width: max-content;
    max-width: 200px;
    border-radius: 4px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 1000;
}

.info-tooltip:hover::after {
    opacity: 1;
    visibility: visible;
}

.info-tooltip::before {
    content: "";
    position: absolute;
    bottom: calc(100% + 0.125rem);
    left: 50%;
    transform: translateX(-50%);
    border: 0.25rem solid transparent;
    border-top-color: var(--text-primary);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.info-tooltip:hover::before {
    opacity: 1;
    visibility: visible;
}

/* ═══════════════════════════════════════════════════════════════
   MOBILE RESPONSIVE - CONTEXT WIZARD
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    /* Stack context inputs vertically on tablets */
    .context-wizard > div {
        grid-template-columns: 1fr !important;
        gap: 0.75rem;
    }

    /* Stack radio buttons vertically on mobile */
    .search-method-selector {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .radio-option {
        padding: 0.75rem;
        border: 2px solid var(--border);
        border-radius: 6px;
        justify-content: center;
    }

    .radio-option input[type="radio"]:checked {
        accent-color: var(--teal-mid);
    }
}

@media (max-width: 480px) {
    /* Extra small screens - minimize padding */
    .context-wizard h4 {
        font-size: 0.9375rem;
    }

    #contextStatus {
        font-size: 0.75rem;
        padding: 0.5rem;
    }
}

/* ═══════════════════════════════════════════════════════════════
   TOGGLE SWITCH - IMPORTED PRODUCTS
   ═══════════════════════════════════════════════════════════════ */

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
    /* Ensure minimum tap target size for mobile */
    min-width: 48px;
    min-height: 26px;
}

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

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.2s ease;
    border-radius: 26px;
    min-width: 48px; /* Minimum tap target */
    min-height: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.2s ease;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--teal-mid);
}

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

.toggle-switch input:focus + .toggle-slider {
    box-shadow: 0 0 0 3px rgba(74, 128, 124, 0.2);
}

.toggle-switch input:disabled + .toggle-slider {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Dark mode toggle switch */
[data-theme="dark"] .toggle-slider {
    background-color: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .toggle-slider:before {
    background-color: rgba(255, 255, 255, 0.9);
}

[data-theme="dark"] .toggle-switch input:checked + .toggle-slider {
    background-color: var(--teal-mid);
}

/* ═══════════════════════════════════════════════════════════════
   DARK MODE - CONTEXT WIZARD
   ═══════════════════════════════════════════════════════════════ */

[data-theme="dark"] #contextStatus.loading {
    background: rgba(74, 128, 124, 0.2);
    color: #5fb3ae;
}

[data-theme="dark"] #contextStatus.success {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

[data-theme="dark"] #contextStatus.error {
    background: rgba(220, 38, 38, 0.2);
    color: #f87171;
}

[data-theme="dark"] .radio-option {
    color: rgba(255, 255, 255, 0.9);
}

[data-theme="dark"] .radio-option:hover {
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .radio-option {
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] #progressiveContext::before {
    background: rgba(255, 255, 255, 0.1);
}

/* ═══════════════════════════════════════════════════════════════
   BUSINESS VALUE IMPROVEMENTS - NEW STYLES
   ═══════════════════════════════════════════════════════════════ */

/* Legal Disclaimers */
.disclaimer-warning, .disclaimer-info {
    padding: 12px 16px;
    border-radius: 8px;
    margin: 12px 0;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.875rem;
    line-height: 1.5;
}

.disclaimer-warning {
    background: rgba(220, 38, 38, 0.1);
    border: 1px solid rgba(220, 38, 38, 0.2);
    color: #991b1b;
}

.disclaimer-info {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    color: #1e40af;
}

.disclaimer-warning .icon,
.disclaimer-info .icon {
    flex-shrink: 0;
    font-size: 1rem;
}

/* Comparison Banner */
.comparison-banner {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    border-radius: 12px;
    margin: 20px 0;
}

.comparison-banner.savings {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.05));
    border: 2px solid rgba(16, 185, 129, 0.3);
}

.comparison-banner.increase {
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.1), rgba(220, 38, 38, 0.05));
    border: 2px solid rgba(220, 38, 38, 0.3);
}

.banner-icon {
    font-size: 2.5rem;
}

.banner-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.banner-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.8;
}

.banner-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

.banner-percent {
    font-size: 0.875rem;
    opacity: 0.9;
}

/* Breakeven Card */
.breakeven-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
}

.breakeven-card h4 {
    margin: 0 0 16px 0;
    color: var(--text-primary);
    font-size: 1.125rem;
}

.breakeven-options {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.breakeven-options .option {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px;
    background: var(--bg-primary);
    border-radius: 8px;
    min-width: 120px;
    text-align: center;
}

.breakeven-options .option .icon {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.breakeven-options .option .label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.breakeven-options .option .value {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--teal-mid);
}

.option-or {
    font-weight: 600;
    color: var(--text-secondary);
    padding: 0 4px;
}

/* Recommendations */
.recommendations-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
}

.recommendations-card h4 {
    margin: 0 0 16px 0;
    color: var(--text-primary);
    font-size: 1.125rem;
}

.recommendation {
    padding: 12px;
    margin: 8px 0;
    border-radius: 8px;
    border-left: 4px solid;
}

.recommendation.alta {
    border-color: #dc2626;
    background: rgba(220, 38, 38, 0.05);
}

.recommendation.media {
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.05);
}

.recommendation.baixa {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.05);
}

.rec-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.rec-urgency {
    font-size: 0.6875rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.urgency-alta {
    color: #dc2626;
    background: rgba(220, 38, 38, 0.1);
}

.urgency-media {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
}

.urgency-baixa {
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}

.rec-action {
    font-weight: 600;
    color: var(--text-primary);
}

.rec-timeline {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-left: auto;
}

.rec-detail {
    font-size: 0.875rem;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.rec-article {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    font-style: italic;
}

/* Regime Comparison */
.regime-comparison-table {
    margin: 20px 0;
}

.regime-comparison-table h4 {
    margin: 0 0 12px 0;
    color: var(--text-primary);
    font-size: 1.125rem;
}

.regime-comparison-table table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: 8px;
    overflow: hidden;
}

.regime-comparison-table th,
.regime-comparison-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.regime-comparison-table th {
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.regime-comparison-table tr.recommended {
    background: rgba(16, 185, 129, 0.08);
}

.regime-recommendation {
    margin-top: 12px;
    padding: 12px 16px;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 8px;
    font-size: 0.9375rem;
}

.regime-recommendation strong {
    color: var(--teal-mid);
}

/* Benchmark Badge (Phase 7.3) */
.benchmark-badge {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    gap: 0.5rem;
    margin: 1rem 0;
    border: 2px solid;
}

.benchmark-badge.competitive {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.3);
    color: #065f46;
}

.benchmark-badge.above-avg {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.3);
    color: #92400e;
}

.badge-header {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.badge-comparison {
    font-size: 1rem;
    line-height: 1.4;
}

.badge-comparison strong {
    font-weight: 700;
    color: var(--text-primary);
}

.badge-icon {
    font-size: 1.125rem;
}

.badge-details {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    opacity: 0.9;
}

/* Multi-product Form */
.multi-product-toggle {
    margin: 16px 0;
}

.multi-product-toggle label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--text-primary);
    font-weight: 500;
}

.multi-product-form {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    margin: 16px 0;
    background: var(--bg-card);
}

/* Legacy product-row styles removed - now using card-based layout (see line ~2983) */

.product-total {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    font-weight: 600;
    color: var(--text-primary);
}

/* Dark Mode Overrides for New Components */
[data-theme="dark"] .disclaimer-warning {
    background: rgba(220, 38, 38, 0.15);
    border-color: rgba(220, 38, 38, 0.3);
    color: #fca5a5;
}

[data-theme="dark"] .disclaimer-info {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
    color: #93c5fd;
}

[data-theme="dark"] .comparison-banner.savings {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(16, 185, 129, 0.08));
    border-color: rgba(16, 185, 129, 0.4);
}

[data-theme="dark"] .comparison-banner.increase {
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.15), rgba(220, 38, 38, 0.08));
    border-color: rgba(220, 38, 38, 0.4);
}

[data-theme="dark"] .benchmark-badge.competitive {
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
}

[data-theme="dark"] .benchmark-badge.above-avg {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
}

/* ═══════════════════════════════════════════════════════════════════
   TAX RATE GRID
   ═══════════════════════════════════════════════════════════════════ */

/* Radio options styling within sim-row */
.sim-row .search-method-selector {
    margin: 0.5rem 0 1rem 0;
}

/* Tax rate grid */
.tax-rate-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

@media (max-width: 768px) {
    .tax-rate-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .tax-rate-grid {
        grid-template-columns: 1fr;
    }
}

.section-help {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.5;
}


/* ========================================
   Simulator V2 Redesign Styles (Dec 27, 2025)
   Consolidated from inline styles in sim.html
   ======================================== */
/* Layout */
.sim-v2-layout {
    --paper: #FAF9F5;
    --paper-muted: #F0EEE6;
    --paper-deep: #E8E6DC;
    --surface: #FFFFFF;
    --ink: #141413;
    --ink2: #3D3D3A;
    --ink-muted: #5E5D59;
    --ink-faint: #B0AEA5;
    --accent-base: #0F766E;
    --accent-hover: #115E59;
    --accent-subtle: rgba(15, 118, 110, 0.08);
    --border-subtle: rgba(20, 20, 19, 0.10);
    --border-medium: rgba(20, 20, 19, 0.15);
    --sim-bg: var(--paper);
    --sim-surface: var(--surface);
    --sim-surface-2: var(--paper-muted);
    --sim-border: var(--border-subtle);
    --sim-border-strong: var(--border-medium);
    --sim-text: var(--ink);
    --sim-text-muted: var(--ink-muted);
    --sim-ink: var(--ink);
    --sim-primary: var(--accent-base);
    --sim-primary-hover: var(--accent-hover);
    --sim-accent: var(--accent-base);
    --sim-focus: rgba(15, 118, 110, 0.24);
    --sim-shadow: 0 18px 40px rgba(20, 20, 19, 0.08);
    --sim-shadow-sm: 0 8px 18px rgba(20, 20, 19, 0.06);
    --sim-lift-shadow: 0 8px 24px rgba(15, 118, 110, 0.12);
    --sim-cta-shadow: 0 16px 30px rgba(15, 118, 110, 0.2);
    --sim-border-hover: rgba(15, 118, 110, 0.35);
    --sim-sidebar-width: 320px;
    --sim-sidebar-pad: 22px;
    --sim-sidebar-gap: 18px;
    --sim-form-gap: 16px;
    --sim-section-gap: 6px;
    --sim-control-pad-y: 10px;
    --sim-control-pad-x: 14px;
    --sim-control-radius: 10px;
    --sim-button-radius: 12px;
    --sim-toggle-pad: 0.25rem;
    --sim-toggle-gap: 0.3rem;
    display: flex;
    min-height: 100vh;
    background: var(--sim-bg);
}

/* Input Sidebar */
.input-sidebar {
    width: var(--sim-sidebar-width);
    flex-shrink: 0;
    background: var(--sim-surface);
    border-right: 1px solid var(--sim-border);
    padding: var(--sim-sidebar-pad);
    display: flex;
    flex-direction: column;
    gap: var(--sim-sidebar-gap);
    height: 100vh;
    overflow-y: auto;
    position: sticky;
    top: 0;
    box-shadow: var(--sim-shadow-sm);
}

.input-sidebar-header {
    padding-bottom: var(--sim-sidebar-gap);
    border-bottom: 1px solid var(--sim-border);
}

.back-link {
    text-decoration: none;
    display: inline-block;
}

.logo {
    font-size: 2rem;
    font-weight: 700;
    color: var(--sim-primary);
    transition: color 0.2s;
}

.back-link:hover .logo {
    color: var(--sim-primary-hover);
}

.input-form {
    display: flex;
    flex-direction: column;
    gap: var(--sim-form-gap);
    flex: 1;
}

.form-section {
    display: flex;
    flex-direction: column;
    gap: var(--sim-section-gap);
}

.section-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--sim-text-muted);
}

.form-input {
    font-size: 1rem;
    padding: var(--sim-control-pad-y) var(--sim-control-pad-x);
    border: 2px solid var(--sim-border);
    border-radius: var(--sim-control-radius);
    background: var(--sim-surface);
    color: var(--sim-text);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.form-input:hover {
    border-color: var(--sim-border-hover);
}

.form-input:focus {
    outline: none;
    border-color: var(--sim-accent);
    box-shadow: 0 0 0 1px var(--sim-accent), 0 6px 20px rgba(14, 107, 101, 0.18);
}

.form-input::placeholder {
    color: rgba(75, 85, 99, 0.55);
}

.field-error,
.form-notice,
.results-notice {
    font-size: 0.75rem;
    line-height: 1.4;
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(220, 38, 38, 0.2);
    background: rgba(220, 38, 38, 0.08);
    color: #991b1b;
}

.form-notice,
.results-notice {
    margin-top: 0;
    margin-bottom: 12px;
}

.form-notice.success,
.results-notice.success {
    border-color: rgba(16, 185, 129, 0.2);
    background: rgba(16, 185, 129, 0.08);
    color: #047857;
}

.input-wrapper {
    position: relative;
}

.margin-input-wrapper {
    position: relative;
}

.input-suffix {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-weight: 600;
    color: var(--sim-text-muted);
    pointer-events: none;
}

.margin-input-wrapper .form-input {
    padding-right: 3rem;
}

.tax-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: calc(var(--sim-section-gap) + 4px);
}

.tax-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tax-input-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--sim-text);
    min-width: 100px;
}

.tax-input-group input {
    flex: 1;
    font-size: 0.875rem;
    padding: calc(var(--sim-control-pad-y) - 2px) calc(var(--sim-control-pad-x) - 2px);
    border: 2px solid var(--sim-border);
    border-radius: calc(var(--sim-control-radius) - 2px);
    background: var(--sim-surface);
    color: var(--sim-text);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tax-input-group input:hover {
    border-color: var(--sim-border-hover);
}

.tax-input-group input:focus {
    outline: none;
    border-color: var(--sim-accent);
    box-shadow: 0 0 0 1px var(--sim-accent);
}

.tax-input-group span {
    font-weight: 600;
    color: var(--sim-text-muted);
    min-width: 20px;
}

.calculate-button {
    width: 100%;
    padding: calc(var(--sim-control-pad-y) + 2px) calc(var(--sim-control-pad-x) + 2px);
    background: var(--sim-accent);
    border: none;
    border-radius: var(--sim-button-radius);
    color: white;
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    cursor: pointer;
    box-shadow: var(--sim-cta-shadow);
    transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.calculate-button:hover {
    background: var(--sim-primary);
    transform: translateY(-1px);
    box-shadow: 0 18px 34px rgba(14, 107, 101, 0.24);
}

.calculate-button:active {
    transform: translateY(0);
    box-shadow: 0 10px 20px rgba(14, 107, 101, 0.16);
}

.calculate-button.loading {
    pointer-events: none;
    opacity: 0.7;
}

/* Autocomplete Dropdown */
.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--sim-surface);
    border: 1px solid var(--sim-border-strong);
    border-radius: 0 0 10px 10px;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: var(--sim-shadow-sm);
    z-index: 1000;
    display: none;
}

.ncm-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--sim-border);
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

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

.ncm-item:hover {
    background: var(--sim-surface-2);
}

.ncm-code {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--sim-primary);
}

.ncm-desc {
    font-size: 0.875rem;
    color: var(--sim-text-muted);
    line-height: 1.4;
}

/* Results Area */
.results-area {
    flex: 1;
    padding: 48px;
    overflow-y: auto;
    background: var(--sim-bg);
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 80px 40px;
    color: var(--sim-text-muted);
}

.empty-state h2 {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--sim-ink);
    margin: 0 0 12px 0;
    letter-spacing: -0.01em;
}

.empty-state p {
    font-size: 1rem;
    color: var(--sim-text-muted);
    margin: 0;
}

/* Expandable Rows */
.expand-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--sim-text-muted);
    transition: transform 0.2s ease;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transform-origin: center center;
    padding: 0;
    outline: none;
}

.expand-btn:hover {
    color: var(--sim-text);
    background: transparent;
}

.expand-btn:focus,
.expand-btn:active {
    outline: none;
    border: none;
    box-shadow: none;
}

.expand-btn.expanded {
    transform: rotate(90deg);
}

/* Phase Badges */
.phase-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.phase-badge.teste {
    background: #FFF3E0;
    color: #E65100;
}

.phase-badge.cbs_is {
    background: #E3F2FD;
    color: #1565C0;
}

.phase-badge.transicao {
    background: #F3E5F5;
    color: #7B1FA2;
}

.phase-badge.completa {
    background: #E8F5E9;
    color: #2E7D32;
}

/* Expanded Detail Row */
.detail-row {
    background: var(--sim-surface-2);
}

.detail-row td {
    padding: 0 !important;
}

.detail-content {
    padding: 16px 24px;
    border-top: 1px dashed var(--sim-border);
    max-width: 400px;
}

.detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
    margin-bottom: 12px;
}

.detail-table thead th {
    text-align: center;
    padding: 6px 8px;
    font-size: 0.6875rem;
    text-transform: uppercase;
    color: var(--sim-text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--sim-border);
}

.detail-table thead th:first-child {
    width: 90px;
}

.detail-table thead th:nth-child(2),
.detail-table thead th:nth-child(3) {
    width: 120px;
}

.detail-table tbody tr {
    border-bottom: 1px solid var(--sim-border);
}

.detail-table tbody tr.total-row {
    border-top: 2px solid var(--sim-border);
    background: var(--sim-surface-2);
    border-bottom: none;
}

.detail-table .tax-label {
    padding: 6px 8px;
    color: var(--sim-text);
    font-weight: 500;
    text-align: center;
}

.detail-table .tax-value {
    padding: 6px 8px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: var(--sim-text);
}

.detail-table .tax-value .empty {
    color: rgba(75, 85, 99, 0.45);
}

.detail-table .tax-rate {
    margin-left: 6px;
    font-size: 0.6875rem;
    color: var(--sim-text-muted);
}

.detail-result {
    text-align: center;
    padding: 8px 12px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.8125rem;
}

.detail-result.savings {
    background: rgba(22, 163, 74, 0.12);
    color: #166534;
}

.detail-result.increase {
    background: rgba(180, 35, 24, 0.12);
    color: #7F1D1D;
}

/* Results Table */
.spreadsheet-container {
    background: var(--sim-surface);
    border-radius: 16px;
    padding: 32px;
    border: 2px solid var(--sim-border);
    box-shadow: var(--sim-shadow);
    width: 100%;
}

.spreadsheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.spreadsheet-header h3 {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--sim-ink);
    margin: 0;
}

.spreadsheet-actions {
    display: flex;
    gap: 12px;
}

.action-btn {
    display: flex;
    align-items: center;
    padding: 10px 18px;
    background: var(--sim-surface);
    border: 1px solid var(--sim-border-strong);
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--sim-text);
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}

.action-btn:hover {
    background: var(--sim-surface-2);
    border-color: var(--sim-primary);
    color: var(--sim-primary);
    transform: translateY(-1px);
    box-shadow: var(--sim-lift-shadow);
}

.spreadsheet-scroll {
    overflow-x: auto;
    border: 1px solid var(--sim-border);
    border-radius: 12px;
    background: var(--sim-surface);
    -webkit-overflow-scrolling: touch;
    position: relative;
}

.spreadsheet-scroll::after {
    content: "";
    position: sticky;
    right: 0;
    top: 0;
    width: 56px;
    height: 100%;
    pointer-events: none;
    background: linear-gradient(90deg, rgba(250, 249, 245, 0), rgba(250, 249, 245, 0.9));
    display: none;
}

.scroll-hint {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--sim-text-muted);
    margin: -8px 0 12px;
    display: none;
}

.results-table,
.spreadsheet-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.results-table thead,
.spreadsheet-table thead {
    background: var(--sim-surface-2);
    position: sticky;
    top: 0;
    z-index: 10;
}

.results-table th,
.spreadsheet-table th {
    padding: 16px 12px;
    text-align: center;
    font-weight: 700;
    color: var(--sim-ink);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--sim-border);
    white-space: nowrap;
}

.results-table td,
.spreadsheet-table td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--sim-border);
    color: var(--sim-text);
    vertical-align: middle;
}

.results-table tbody tr:hover,
.spreadsheet-table tbody tr:hover {
    background: rgba(15, 118, 110, 0.06);
}

.results-table td:first-child,
.spreadsheet-table td:first-child {
    font-weight: 600;
    color: var(--sim-primary);
}

.results-table .currency,
.spreadsheet-table .currency {
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.results-table .formula,
.spreadsheet-table .formula {
    font-size: 0.75rem;
    color: var(--sim-text-muted);
}

.money {
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.money.total {
    text-align: left;
}

.increase {
    color: #B42318;
}

.savings {
    color: #16A34A;
}

/* Column Sizing */
.col-expand {
    width: 40px;
}

.col-ncm {
    width: 120px;
    text-align: center;
}

.col-desc {
    width: 140px;
    max-width: 140px;
    text-align: center !important;
}

.results-table .ncm {
    text-align: center !important;
}

.results-table .desc {
    text-align: center !important;
}

.col-valor,
.col-total {
    width: 100px;
}

.col-ano {
    width: 60px;
    text-align: center;
}

.col-fase {
    width: 140px;
    text-align: center;
}

.col-tax {
    width: 90px;
}

.col-diff {
    width: 80px;
}

.col-actions {
    width: 50px;
}

.delete-btn {
    background: transparent;
    border: none;
    color: #A32929;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
}

.delete-btn:hover {
    background: rgba(163, 41, 41, 0.1);
}

.spreadsheet-footer {
    margin-top: 16px;
    font-size: 0.75rem;
    color: var(--sim-text-muted);
    font-style: italic;
}

/* Quota Display in Sidebar */
.input-sidebar .quota-display {
    display: flex;
    padding: var(--sim-form-gap) 0;
    font-size: 0.875rem;
    color: var(--sim-text-muted);
    border-top: 1px solid var(--sim-border);
}

/* Top Bar with User Button */
.top-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 16px 0;
    margin-bottom: 16px;
    position: relative;
}

.user-button {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--sim-surface);
    border: 1px solid var(--sim-border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.user-button:hover {
    border-color: var(--sim-accent);
    background: var(--sim-surface-2);
}

.user-button-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--sim-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.75rem;
}

.user-button-email {
    font-size: 0.875rem;
    color: var(--sim-text);
    font-weight: 500;
}

/* User Dropdown Menu */
.user-menu {
    position: absolute;
    top: 50px;
    right: 0;
    background: var(--sim-surface);
    border: 1px solid var(--sim-border);
    border-radius: 12px;
    box-shadow: var(--sim-shadow-sm);
    min-width: 240px;
    padding: 12px;
    z-index: 1000;
}

.user-menu-info {
    padding: 8px 12px;
    border-bottom: 1px solid var(--sim-border);
    margin-bottom: 8px;
}

.user-menu-email {
    font-size: 0.875rem;
    color: var(--sim-text);
    font-weight: 500;
    margin-bottom: 6px;
}

.user-menu-plan {
    display: flex;
    gap: 6px;
}

.user-menu-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.user-menu-item {
    display: block;
    padding: 10px 12px;
    font-size: 0.875rem;
    color: var(--sim-text-muted);
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.2s;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    cursor: pointer;
}

.user-menu-item:hover {
    background: var(--sim-surface-2);
    color: var(--sim-text);
}

.user-menu-item.logout {
    color: #A32929;
}

.user-menu-item.logout:hover {
    background: rgba(163, 41, 41, 0.05);
}

/* Modal Overlay & Content */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: #ffffff;
    border-radius: 16px;
    padding: 40px;
    max-width: 700px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-content h2 {
    color: #1a1a1a;
    margin-bottom: 12px;
    font-size: 1.75rem;
    font-weight: 700;
}

.modal-content p {
    color: #4a4a4a;
    margin-bottom: 32px;
    font-size: 1rem;
    line-height: 1.6;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.btn-primary {
    background: var(--teal-mid);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

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

.btn-secondary {
    background: #f0f0f0;
    color: #4a4a4a;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.btn-secondary:hover {
    background: var(--sim-surface-2);
}

/* Anonymous User Links (top-right) */
.auth-links {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--sim-text-muted);
}

.auth-links a {
    color: var(--sim-primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.auth-links a:hover {
    color: var(--sim-primary-hover);
    text-decoration: underline;
}

.auth-links span {
    color: var(--sim-text-muted);
}

@media (max-width: 1024px) {
    .results-area {
        padding: 32px;
    }

    .spreadsheet-container {
        padding: 24px;
    }
}

@media (max-width: 860px) {
    .sim-v2-layout {
        flex-direction: column;
    }

    .input-sidebar {
        width: 100%;
        height: auto;
        position: relative;
        border-right: none;
        border-bottom: 1px solid var(--sim-border);
        box-shadow: none;
    }

    .results-area {
        padding: 28px 24px 40px;
        overflow: visible;
    }

    .top-bar {
        justify-content: space-between;
    }
}

@media (max-width: 640px) {
    .input-sidebar {
        padding: 20px 16px;
        gap: 16px;
    }

    .results-area {
        padding: 20px 16px 32px;
    }

    .spreadsheet-container {
        padding: 16px;
        border-radius: 12px;
    }

    .spreadsheet-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .spreadsheet-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .action-btn {
        width: 100%;
        justify-content: center;
    }

    .product-type-toggle,
    .lookup-toggle {
        width: 100%;
        max-width: none;
    }

    .type-toggle-btn,
    .search-toggle-btn {
        flex: 1;
        text-align: center;
    }

    .user-button-email {
        max-width: 160px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .user-menu {
        left: 0;
        right: 0;
    }

    .scroll-hint {
        display: block;
    }

    .spreadsheet-scroll::after {
        display: block;
    }

    .results-table {
        --sticky-col-1: 72px;
    }

    .results-table th.col-expand,
    .results-table td.col-expand {
        position: sticky;
        left: 0;
        z-index: 3;
        background: var(--sim-surface);
        box-shadow: 1px 0 0 var(--sim-border);
    }

    .results-table th.col-ncm,
    .results-table td.col-ncm {
        position: sticky;
        left: var(--sticky-col-1);
        z-index: 2;
        background: var(--sim-surface);
        box-shadow: 1px 0 0 var(--sim-border);
    }

    .results-table th.col-expand,
    .results-table th.col-ncm {
        background: var(--sim-surface-2);
        z-index: 4;
    }

    .results-table tr.detail-row td {
        position: static;
        box-shadow: none;
    }
}

@media (max-width: 420px) {
    .section-label {
        font-size: 0.6875rem;
    }

    .calculate-button {
        font-size: 0.8rem;
        letter-spacing: 0.06em;
    }

    .form-input {
        font-size: 0.95rem;
    }
}

/* ═══════════════════════════════════════════════════════
   PRODUCT TYPE TOGGLE (Goods vs Services)
   ═══════════════════════════════════════════════════════ */

.product-type-toggle {
    display: flex;
    gap: var(--sim-toggle-gap);
    background: var(--sim-surface-2);
    padding: var(--sim-toggle-pad);
    border-radius: 999px;
    border: 2px solid var(--sim-border);
    max-width: 240px;
    margin-bottom: var(--sim-toggle-gap);
    width: fit-content;
}

.type-toggle-btn {
    flex: 1;
    padding: 0.4rem 0.75rem;
    background: transparent;
    border: none;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--sim-text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.type-toggle-btn:hover {
    background: var(--sim-surface);
    color: var(--sim-text);
}

.type-toggle-btn.active {
    background: var(--sim-primary);
    color: white;
    box-shadow: 0 6px 12px rgba(14, 107, 101, 0.18);
}

.type-toggle-btn.active:hover {
    background: var(--sim-primary-hover);
}

.lookup-toggle {
    display: inline-flex;
    align-items: center;
    gap: var(--sim-toggle-gap);
    padding: var(--sim-toggle-pad);
    border-radius: 999px;
    border: 2px solid var(--sim-border);
    background: var(--sim-surface-2);
    margin-bottom: var(--sim-toggle-gap);
    width: fit-content;
}

.search-toggle-btn {
    padding: 0.35rem 0.65rem;
    border: none;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: transparent;
    color: var(--sim-text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.search-toggle-btn:hover {
    background: var(--sim-surface);
    color: var(--sim-text);
}

.search-toggle-btn.active {
    background: var(--sim-primary);
    color: white;
}

.search-toggle-btn.active:hover {
    background: var(--sim-primary-hover);
}

/* Dark theme overrides */
[data-theme="dark"] .product-type-toggle {
    background: var(--bg-primary);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .type-toggle-btn:hover {
    background: var(--bg-elevated);
}

/* ═══════════════════════════════════════════════════════
   REDESIGNED SIMULATOR PAGE (Jan 2026)
   Linear card-based layout replacing two-column design
   ═══════════════════════════════════════════════════════ */

/* Main Page Container */
.sim-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Breadcrumb Navigation */
.sim-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.sim-breadcrumb a {
    color: var(--teal-mid);
    text-decoration: none;
    transition: color 0.2s ease;
}

.sim-breadcrumb a:hover {
    color: var(--teal-deep);
    text-decoration: underline;
}

.sim-breadcrumb .separator {
    color: var(--text-tertiary);
    user-select: none;
}

.sim-breadcrumb .user-link {
    margin-left: auto;
    font-weight: 600;
}

/* Page Header */
.sim-header {
    text-align: center;
    margin-bottom: 3rem;
}

.sim-header h1 {
    font-family: var(--font-display);
    font-size: clamp(2rem, 3.5vw, 2.75rem);
    font-weight: 700;
    color: var(--sim-ink);
    margin: 0 0 1rem 0;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.sim-subheadline {
    font-size: 1.125rem;
    color: var(--text-secondary);
    line-height: 1.6;
    max-width: 700px;
    margin: 0 auto 1rem;
}

.sim-microcopy {
    font-size: 0.8125rem;
    color: var(--text-tertiary);
    font-style: italic;
    margin-top: 0.75rem;
}

/* Input Card */
.sim-input-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.sim-input-card h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 1.5rem 0;
}

/* NCM Toggle (Tenho NCM vs Não sei NCM) */
.ncm-toggle {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    background: var(--bg-elevated);
    padding: 0.25rem;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.toggle-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.toggle-btn.active {
    background: var(--teal-mid);
    color: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.toggle-btn.active:hover {
    background: var(--teal-deep);
}

/* CTA Button */
.sim-cta-btn {
    width: 100%;
    padding: 1rem 2rem;
    background: #2c2c2c;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 1.5rem;
}

.sim-cta-btn:hover {
    background: #1a1a1a;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

.sim-cta-btn:disabled {
    background: var(--bg-elevated);
    color: var(--text-tertiary);
    cursor: not-allowed;
    transform: none;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Form Styling for Input Card */
.sim-input-card .form-group {
    margin-bottom: 1.5rem;
}

.sim-input-card .form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.sim-input-card .form-group input,
.sim-input-card .form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text-primary);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.sim-input-card .form-group input:focus,
.sim-input-card .form-group select:focus {
    outline: none;
    border-color: var(--teal-mid);
    box-shadow: 0 0 0 3px rgba(74, 128, 124, 0.15);
}

.sim-input-card .form-group .helper {
    display: block;
    font-size: 0.8125rem;
    color: var(--text-tertiary);
    margin-top: 0.5rem;
    line-height: 1.4;
}

/* Quota and Tip Text */
.quota-text {
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.sim-tip {
    text-align: center;
    font-size: 0.8125rem;
    color: var(--text-tertiary);
    padding: 1rem;
    background: var(--bg-elevated);
    border-radius: 6px;
    margin-top: 0.5rem;
}

/* Dark Mode Support for Form Inputs */
[data-theme="dark"] .sim-input-card .form-group input,
[data-theme="dark"] .sim-input-card .form-group select {
    background: var(--bg-primary);
    border-color: rgba(255, 255, 255, 0.1);
}

/* 3-Column Form Row Layout */
.form-row-3 {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.form-row-3 .form-group {
    margin-bottom: 0;
}

.form-row-3 label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.form-row-3 .helper {
    display: block;
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-top: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Responsive: Stack on tablet and mobile */
@media (max-width: 900px) {
    .form-row-3 {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }

    .form-row-3 .form-group:first-child {
        grid-column: 1 / -1;
    }
}

@media (max-width: 600px) {
    .form-row-3 {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .form-row-3 .form-group:first-child {
        grid-column: auto;
    }

    .form-row-3 .helper {
        white-space: normal;
    }
}

/* Empty State */
.sim-empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--bg-elevated);
    border: 1px dashed var(--border);
    border-radius: 8px;
    margin: 2rem 0;
}

.sim-empty-state h2 {
    font-size: 1.5rem;
    color: var(--text-secondary);
    margin: 0 0 0.75rem 0;
}

.sim-empty-state p {
    color: var(--text-tertiary);
    font-size: 0.9375rem;
    line-height: 1.6;
    max-width: 500px;
    margin: 0 auto;
}

/* Results Section */
.sim-results {
    margin: 2rem 0;
}

/* Executive Summary (3 Big Numbers) */
.executive-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin: 2rem 0;
}

.summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.2s ease;
}

.summary-card.highlight {
    border-color: var(--teal-mid);
    border-width: 2px;
    box-shadow: 0 0 0 3px rgba(74, 128, 124, 0.1);
}

.summary-card.delta {
    background: var(--bg-elevated);
}

.summary-card.negative {
    border-color: #ef4444;
    border-width: 2px;
}

.summary-card.positive {
    border-color: #22c55e;
    border-width: 2px;
}

.summary-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
}

.summary-value {
    display: block;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.summary-card.negative .summary-value {
    color: #ef4444;
}

.summary-card.positive .summary-value {
    color: #22c55e;
}

.summary-percent {
    display: block;
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 600;
}

/* Tax Comparison Table */
.sim-tax-table {
    margin: 2rem 0;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.comparison-table thead {
    background: var(--bg-elevated);
}

.comparison-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

.comparison-table td {
    padding: 0.75rem 1rem;
    font-size: 0.9375rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
}

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

.comparison-table tbody tr:hover {
    background: var(--bg-elevated);
}

.comparison-table .total-row {
    font-weight: 700;
    background: var(--bg-elevated);
}

.comparison-table .total-row td {
    font-size: 1rem;
    padding: 1rem;
}

.comparison-table .extinct {
    color: var(--text-tertiary);
    text-decoration: line-through;
}

.comparison-table .new-tax {
    color: var(--teal-deep);
    font-weight: 600;
}

/* Timeline Evolution Table */
.sim-timeline {
    margin: 2rem 0;
    padding: 2rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.sim-timeline h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 1.5rem 0;
}

.timeline-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    font-size: 0.875rem;
}

.timeline-table thead {
    background: var(--bg-elevated);
}

.timeline-table th {
    padding: 0.75rem 0.5rem;
    text-align: center;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
}

.timeline-table td {
    padding: 0.75rem 0.5rem;
    text-align: center;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
}

.timeline-table td.timeline-label {
    text-align: left;
    font-weight: 600;
    padding-left: 1rem;
}

.timeline-table td.selected {
    background: var(--teal-pale);
    font-weight: 700;
    color: var(--teal-deep);
    position: relative;
}

.timeline-table td.selected::after {
    content: '●';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--teal-mid);
    font-size: 1.5rem;
    opacity: 0.3;
}

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

.timeline-table td.negative {
    color: #ef4444;
}

.timeline-table td.positive {
    color: #22c55e;
}

/* Footer */
.sim-footer {
    margin-top: 3rem;
    padding: 2rem 0;
    border-top: 1px solid var(--border);
    text-align: center;
}

.sim-disclaimer {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 0.75rem;
}

.sim-legal-note {
    font-size: 0.8125rem;
    color: var(--text-tertiary);
    font-style: italic;
}

/* Dark Mode Overrides */
[data-theme="dark"] .sim-input-card,
[data-theme="dark"] .summary-card,
[data-theme="dark"] .comparison-table,
[data-theme="dark"] .timeline-table,
    background: var(--bg-elevated);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .sim-empty-state {
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .ncm-toggle,
[data-theme="dark"] .product-type-toggle {
    background: var(--bg-primary);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .toggle-btn:hover,
[data-theme="dark"] .type-toggle-btn:hover {
    background: var(--bg-elevated);
}

[data-theme="dark"] .comparison-table thead,
[data-theme="dark"] .timeline-table thead {
    background: var(--bg-primary);
}

[data-theme="dark"] .comparison-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .sim-page {
        padding: 1rem;
    }

    .sim-header h1 {
        font-size: 1.75rem;
    }

    .sim-subheadline {
        font-size: 1rem;
    }

    .sim-input-card {
        padding: 1.5rem;
    }

    .executive-summary {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .comparison-table,
    .timeline-table {
        font-size: 0.8125rem;
    }

    .comparison-table th,
    .comparison-table td {
        padding: 0.5rem;
    }

    .timeline-table th,
    .timeline-table td {
        padding: 0.5rem 0.25rem;
    }

    .sim-breadcrumb {
        font-size: 0.8125rem;
    }

    .sim-breadcrumb .user-link {
        margin-left: 0;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .sim-header h1 {
        font-size: 1.5rem;
    }

    .summary-value {
        font-size: 1.5rem;
    }

    .comparison-table,
    .timeline-table {
        font-size: 0.75rem;
    }

    .timeline-table th {
        font-size: 0.75rem;
    }
}
