:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --success-color: #15803d;
    --success-dark: #14532d;
    --background-color: #f8fafc;
    --border-color: #e2e8f0;
    --text-color: #1e293b;
    --text-light: #475569;
    --white: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --radius-sm: 0.375rem;
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
}

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.5;
}

.container {
    max-width: 1100px;
    width: 95%;
    padding: 2rem;
    background-color: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin: 2rem auto;
}

#title {
    font-size: 1.875rem;
    font-weight: 700;
    margin-bottom: 2rem;
    color: var(--text-color);
}

.privacy-notice {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #bae6fd;
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
}

.privacy-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.privacy-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.privacy-text {
    font-size: 0.875rem;
    color: var(--text-color);
    line-height: 1.4;
}

.privacy-text strong {
    color: #1e40af;
    font-weight: 600;
}

@media (max-width: 768px) {
    .privacy-notice {
        padding: 0.625rem 0.875rem;
    }
    
    .privacy-content {
        gap: 0.5rem;
    }
    
    .privacy-icon {
        font-size: 1.125rem;
    }
    
    .privacy-text {
        font-size: 0.8125rem;
    }
}

.flex {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

label {
    font-weight: 500;
    color: var(--text-color);
}

input {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: border-color 0.15s ease;
    width: 100%;
    box-sizing: border-box;
}

input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

button {
    font-weight: 500;
    transition: all 0.15s ease;
}

.calculate-button, .payoff-button {
    width: 100%;
    padding: 0.875rem;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    cursor: pointer;
    margin-bottom: 1rem;
}

.calculate-button {
    background-color: var(--success-color);
    color: var(--white);
}

.calculate-button:hover {
    background-color: var(--success-dark);
}

.payoff-button {
    background-color: var(--primary-color);
    color: var(--white);
}

.payoff-button:hover {
    background-color: var(--primary-dark);
}

table {
    width: 100%;
    border-radius: var(--radius);
    overflow: hidden;
    min-width: 900px; /* Ensure table doesn't squish too much */
    border-collapse: collapse;
}

.table-container {
    width: 100%;
    overflow-x: auto;
    margin-top: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    background: linear-gradient(90deg, transparent 0%, transparent 50px, rgba(255,255,255,0.8) 100%),
                linear-gradient(270deg, transparent 0%, transparent 50px, rgba(255,255,255,0.8) 100%);
    background-attachment: local, local;
    background-position: 0 0, 100% 0;
    background-repeat: no-repeat;
    background-size: 50px 100%, 50px 100%;
}

.table-container::after {
    content: "← Scroll horizontally to see all columns →";
    display: block;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-light);
    padding: 0.5rem;
    background-color: var(--background-color);
    border-top: 1px solid var(--border-color);
}

@media (min-width: 1100px) {
    .table-container::after {
        display: none;
    }
}

th, td {
    padding: 0.75rem 0.5rem;
    text-align: right;
    border: 1px solid var(--border-color);
    font-size: 0.9rem;
    white-space: nowrap;
}

th:first-child, td:first-child {
    text-align: center;
    font-weight: 600;
}

/* Table button styling */
.plus-button, .additional-payment {
    background: none;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    padding: 0.2rem 0.4rem;
    font-size: 0.75rem;
    border-radius: 3px;
    cursor: pointer;
    margin-left: 0.25rem;
}

.plus-button:hover, .additional-payment:hover {
    background-color: var(--primary-color);
    color: white;
}

.additional-payment {
    border-color: var(--success-color);
    color: var(--success-color);
}

.additional-payment:hover {
    background-color: var(--success-color);
}

th {
    background-color: var(--white);
    color: var(--text-color);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--success-color);
}

tr:nth-child(even) {
    background-color: var(--background-color);
}

.savings-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
    padding: 1.25rem;
    background-color: var(--background-color);
    border-radius: var(--radius);
    border-left: 4px solid var(--success-color);
}

.savings-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.savings-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.savings-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--success-color);
}

.savings-item small {
    font-size: 0.75rem;
    color: var(--text-light);
    font-style: italic;
    margin-top: 0.25rem;
}

details {
    width: 200px;
    margin-bottom: 1rem;
    position: relative;
}

.tax-section {
    width: 100%;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
}

.tax-section summary {
    background-color: var(--background-color);
    color: var(--text-color);
    padding: 1rem;
    margin: 0;
    border-radius: 0;
    border-bottom: 1px solid var(--border-color);
}

.tax-section .flex {
    padding: 1rem;
    margin-bottom: 0;
}

.tax-section small {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

select {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: border-color 0.15s ease;
    width: 100%;
    box-sizing: border-box;
    background-color: var(--white);
}

select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

summary {
    background-color: #f8f9fa;
    color: var(--text-color);
    padding: 0.875rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 500;
    border: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
}

summary:hover {
    background-color: #e9ecef;
}

.dropdown-content {
    margin-top: 0.25rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    width: 200px;
    position: absolute;
    background-color: var(--white);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.fun-scenario {
    width: 100%;
    padding: 0.875rem;
    text-align: left;
    background: var(--white);
    border: none;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    color: var(--text-color);
    transition: background-color 0.2s ease;
}

.fun-scenario:last-child {
    border-bottom: none;
}

.fun-scenario:hover {
    background-color: var(--background-color);
}

dialog {
    border: none;
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    max-width: 400px;
    width: 90%;
}

dialog::backdrop {
    background-color: rgba(0, 0, 0, 0.5);
}

dialog form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

dialog menu {
    display: flex;
    gap: 1rem;
    padding: 0;
    margin-top: 1.5rem;
}

dialog button {
    flex: 1;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    font-weight: 500;
}

dialog button[type="submit"] {
    background-color: var(--primary-color);
    color: var(--white);
}

dialog button[type="submit"]:hover {
    background-color: var(--primary-dark);
}

dialog button[value="cancel"] {
    background-color: var(--background-color);
    color: var(--text-color);
}

dialog button[value="cancel"]:hover {
    background-color: var(--border-color);
}

#investedInterestButton {
    background: none;
    border: none;
    color: var(--text-color);
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
    font-weight: normal;
    text-transform: none;
    letter-spacing: normal;
}

@media (max-width: 768px) {
    body {
        min-height: 100vh;
        margin: 0;
        padding: 0;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .container {
        padding: 0.875rem;
        margin: 0;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        border-radius: 0;
    }
    
    #title {
        font-size: 1.5rem;
        margin-bottom: 1rem;
        text-align: center;
        line-height: 1.3;
    }
    
    .privacy-notice {
        padding: 0.75rem;
        margin-bottom: 1.5rem;
        border-radius: var(--radius-sm);
    }
    
    .privacy-content {
        gap: 0.5rem;
    }
    
    .privacy-icon {
        font-size: 1.125rem;
    }
    
    .privacy-text {
        font-size: 0.8125rem;
        line-height: 1.4;
    }

    .flex {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .input-group {
        gap: 0.5rem;
    }
    
    label {
        font-size: 0.9rem;
        font-weight: 600;
    }
    
    input, select {
        padding: 0.875rem;
        font-size: 1rem;
        border-radius: var(--radius-sm);
        min-height: 44px; /* Touch target size */
        box-sizing: border-box;
    }
    
    .calculate-button, .payoff-button {
        padding: 1rem;
        font-size: 1.1rem;
        font-weight: 600;
        margin-bottom: 1rem;
        min-height: 50px; /* Better touch target */
        border-radius: var(--radius);
    }
    
    /* Tax section mobile optimization */
    .tax-section {
        margin-bottom: 1.5rem;
    }
    
    .tax-section summary {
        font-size: 1rem;
        padding: 0.875rem;
        align-items: center;
    }
    
    .tax-help {
        padding: 1rem;
        font-size: 0.9rem;
    }
    
    .tax-help h4 {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }
    
    .tax-section small {
        font-size: 0.8rem;
        margin-top: 0.25rem;
        display: block;
    }
    
    /* Scenarios button */
    #scenario-details summary {
        font-size: 1rem;
        padding: 0.875rem;
        align-items: center;
        background-color: #f8f9fa;
        border: 1px solid var(--border-color);
        border-radius: var(--radius-sm);
        color: var(--text-color);
        font-weight: 500;
        transition: background-color 0.2s ease;
    }
    
    #scenario-details summary:hover {
        background-color: #e9ecef;
    }
    
    .dropdown-content {
        padding: 0.5rem 0;
        margin-top: 0.5rem;
        background-color: var(--white);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        border: 1px solid var(--border-color);
        width: calc(100vw - 2rem);
        max-width: 250px;
        border-radius: var(--radius);
    }
    
    .fun-scenario {
        padding: 0.875rem;
        font-size: 0.9rem;
        min-height: 44px;
        width: 100%;
        text-align: left;
        transition: background-color 0.2s ease;
        border-bottom: 1px solid var(--border-color);
        background: var(--white);
    }
    
    .fun-scenario:last-child {
        border-bottom: none;
    }
    
    .fun-scenario:hover {
        background-color: var(--background-color);
    }
    
    /* Savings section mobile */
    .savings-section {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        margin-bottom: 1.5rem;
    }
    
    .savings-item {
        background-color: var(--background-color);
        padding: 0.875rem;
        border-radius: var(--radius-sm);
        border: 1px solid var(--border-color);
    }
    
    .savings-label {
        font-size: 0.8rem;
        font-weight: 600;
        display: block;
        margin-bottom: 0.25rem;
        color: var(--text-light);
    }
    
    .savings-value {
        font-size: 1.125rem;
        font-weight: 700;
        display: block;
        margin-bottom: 0.25rem;
    }
    
    .savings-item small {
        font-size: 0.75rem;
        color: var(--text-light);
        display: block;
    }
    
    /* Table mobile optimization */
    .table-container {
        margin: 1.5rem 0 0 0;
        border-radius: 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        background: var(--white);
        box-shadow: inset 0 0 0 1px var(--border-color);
    }
    
    .table-container::after {
        content: "← Swipe to see more columns →";
        font-size: 0.75rem;
        padding: 0.5rem 0.875rem;
        color: var(--text-light);
        text-align: center;
        background-color: var(--background-color);
        border-top: 1px solid var(--border-color);
    }
    
    table {
        min-width: 800px;
        border-radius: 0;
        font-size: 0.75rem;
    }
    
    th, td {
        padding: 0.5rem 0.375rem;
        font-size: 0.75rem;
        min-width: 70px;
        white-space: nowrap;
    }
    
    th {
        font-size: 0.7rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.025em;
        background-color: var(--background-color);
        position: sticky;
        top: 0;
        z-index: 10;
    }
    
    th:first-child, td:first-child {
        position: sticky;
        left: 0;
        background-color: var(--white);
        z-index: 5;
        box-shadow: 2px 0 4px rgba(0,0,0,0.1);
        min-width: 60px;
    }
    
    th:first-child {
        z-index: 15;
        background-color: var(--background-color);
    }
    
    /* Touch-friendly buttons in table */
    .plus-button, .additional-payment {
        padding: 0.375rem 0.5rem;
        font-size: 0.7rem;
        border-radius: 4px;
        min-height: 28px;
        margin-left: 0.25rem;
        touch-action: manipulation;
    }
    
    /* Dialogs mobile */
    dialog {
        max-width: calc(100vw - 2rem);
        width: calc(100vw - 2rem);
        margin: 1rem;
        padding: 1rem;
        max-height: calc(100vh - 4rem);
        overflow-y: auto;
        border-radius: var(--radius);
    }
    
    dialog h3 {
        font-size: 1.125rem;
        margin-bottom: 1rem;
        text-align: center;
    }
    
    .dialog-input, select.dialog-input {
        padding: 0.875rem;
        font-size: 1rem;
        min-height: 44px;
        border-radius: var(--radius-sm);
    }
    
    dialog menu {
        flex-direction: column;
        gap: 0.75rem;
        margin-top: 1.5rem;
    }
    
    dialog button {
        padding: 0.875rem;
        font-size: 1rem;
        font-weight: 600;
        border-radius: var(--radius-sm);
        min-height: 48px;
    }
    
    /* Recommendation section mobile */
    .recommendation-section {
        margin-top: 1.5rem;
        padding: 1rem;
        border-radius: var(--radius-sm);
    }
    
    .recommendation-header h3 {
        font-size: 1.125rem;
        margin-bottom: 0.5rem;
    }
    
    .recommendation-header p {
        font-size: 0.875rem;
        margin-bottom: 1rem;
    }
    
    .recommendation-grid {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .rec-item {
        padding: 0.875rem;
        border-radius: var(--radius-sm);
        background-color: var(--background-color);
        border: 1px solid var(--border-color);
    }
    
    .rec-item.rec-primary {
        background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
        border-color: #bae6fd;
    }
    
    .rec-label {
        font-size: 0.8rem;
        font-weight: 600;
        color: var(--text-light);
        margin-bottom: 0.25rem;
    }
    
    .rec-value {
        font-size: 1.125rem;
        font-weight: 700;
        margin-bottom: 0.25rem;
    }
    
    .rec-reason, .rec-subtitle {
        font-size: 0.8rem;
        color: var(--text-light);
        line-height: 1.3;
    }
    
    /* Native ads mobile */
    .native-ad-section {
        margin: 1.5rem -0.875rem;
        border-radius: 0;
        padding: 1rem 0.875rem;
    }
    
    .native-ad-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .native-ad-title {
        font-size: 1rem;
        line-height: 1.3;
        margin-bottom: 0.5rem;
    }
    
    .native-ad-description {
        font-size: 0.875rem;
        line-height: 1.4;
        margin-bottom: 0.75rem;
    }
    
    .native-ad-cta {
        flex-direction: column;
        gap: 0.875rem;
        align-items: stretch;
    }
    
    .native-ad-contact {
        text-align: center;
        padding: 0.75rem;
        background-color: var(--background-color);
        border-radius: var(--radius-sm);
    }
    
    .native-ad-business {
        font-size: 1rem;
        font-weight: 600;
        margin-bottom: 0.25rem;
    }
    
    .native-ad-location, .native-ad-credentials {
        font-size: 0.8rem;
        margin-bottom: 0.125rem;
    }
    
    .native-ad-actions {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .native-ad-button {
        padding: 0.875rem;
        font-size: 0.9rem;
        font-weight: 600;
        border-radius: var(--radius-sm);
        min-height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
        text-decoration: none;
    }
    
    .native-ad-value-props {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
        margin-top: 0.875rem;
    }
    
    .value-prop {
        padding: 0.5rem;
        font-size: 0.8rem;
        text-align: center;
        background-color: var(--background-color);
        border-radius: var(--radius-sm);
    }
    
    .value-icon {
        font-size: 1rem;
        margin-bottom: 0.25rem;
    }
    
    .value-text {
        font-size: 0.75rem;
        font-weight: 500;
    }
    
    /* Help section mobile */
    .help-section {
        margin-top: 1.5rem;
    }
    
    .help-section summary {
        font-size: 1rem;
        padding: 0.875rem;
        background-color: var(--background-color);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-sm);
    }
    
    .help-content {
        padding: 1rem;
        font-size: 0.875rem;
        line-height: 1.5;
    }
    
    .help-content h4 {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }
    
    .help-content li {
        margin-bottom: 0.375rem;
        line-height: 1.4;
    }
    
    .insight-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        margin-top: 1rem;
    }
    
    .insight-item {
        padding: 0.875rem;
        font-size: 0.875rem;
        line-height: 1.4;
        border-radius: var(--radius-sm);
        background-color: var(--background-color);
        border: 1px solid var(--border-color);
    }
    
    .insight-item strong {
        font-size: 0.9rem;
        display: block;
        margin-bottom: 0.25rem;
    }
    
    /* Formula section mobile */
    .formula-section {
        margin-top: 1rem;
        padding: 1rem;
        font-size: 0.875rem;
        line-height: 1.4;
        border-radius: var(--radius-sm);
        background-color: var(--background-color);
    }
    
    .formula-box {
        padding: 0.875rem;
        margin: 0.75rem 0;
        font-size: 0.8rem;
        line-height: 1.4;
        border-radius: var(--radius-sm);
    }
    
    .formula-example {
        margin-top: 0.75rem;
        padding: 0.75rem;
        font-size: 0.8rem;
        line-height: 1.4;
        border-radius: var(--radius-sm);
        background-color: var(--white);
        border: 1px solid var(--border-color);
    }
    
    .formula-example li {
        margin-bottom: 0.375rem;
        font-size: 0.75rem;
    }
}

/* Accessibility */
.hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* Focus styles for keyboard navigation */
:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.year-group {
    background-color: #f5f5f5;
    font-weight: bold;
    cursor: pointer;
}
.year-group td {
    padding: 10px;
}
.year-group:hover {
    background-color: #e0e0e0;
}
.month-rows {
    display: table-row;
}
.month-rows.collapsed {
    display: none;
}
.year-group .toggle-icon {
    display: inline-block;
    width: 20px;
    transition: transform 0.2s;
}
.year-group.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

/* Custom Scenario Dialog Styles */
#customScenarioDialog {
    max-width: 500px;
    width: 90%;
}

#customScenarioDialog h3 {
    margin: 0 0 1.5rem 0;
    color: var(--text-color);
    font-size: 1.25rem;
    font-weight: 600;
    text-align: center;
}

.dialog-input, select.dialog-input {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: border-color 0.15s ease;
    width: 100%;
    box-sizing: border-box;
    background-color: var(--white);
}

.dialog-input:focus, select.dialog-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

#customScenarioDialog .input-group {
    margin-bottom: 1rem;
}

#customScenarioDialog .input-group label {
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

#customScenarioDialog .input-group small {
    color: var(--text-light);
    font-size: 0.875rem;
    margin-top: 0.25rem;
    font-style: italic;
}

.scenario-preview {
    background-color: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 1rem;
    margin: 1.5rem 0;
    font-size: 0.9rem;
}

.scenario-preview strong {
    color: var(--text-color);
    display: block;
    margin-bottom: 0.5rem;
}

#previewText {
    color: var(--text-light);
    font-family: monospace;
    font-size: 0.875rem;
}

/* Additional spacing for the custom dialog */
#customScenarioDialog form > div:not(:last-child) {
    margin-bottom: 1rem;
}

#customScenarioDialog menu {
    margin-top: 1.5rem;
}

.total-summary {
    background-color: var(--success-color);
    color: var(--white);
    font-weight: 600;
}

.total-summary td {
    border-color: var(--success-dark);
}

.tax-help {
    background-color: #eff6ff;
    border: 1px solid #3b82f6;
    border-radius: var(--radius-sm);
    padding: 1.5rem;
    margin: 1.5rem;
}

.tax-help h4 {
    margin: 0 0 0.5rem 0;
    color: #1e40af;
    font-size: 1rem;
}

.tax-help p {
    margin: 0;
    font-size: 0.9rem;
    color: #1e40af;
    line-height: 1.4;
}

.help-section {
    margin-top: 2rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.help-section summary {
    background-color: #f8fafc;
    padding: 1rem 1.5rem;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-color);
    border-bottom: 1px solid var(--border-color);
    font-size: 1.1rem;
}

.help-section summary:hover {
    background-color: #f1f5f9;
}

.help-content {
    padding: 2rem;
    background-color: var(--white);
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    overflow-wrap: break-word;
}

.help-content h4 {
    margin: 0 0 1.5rem 0;
    color: var(--text-color);
    font-size: 1.2rem;
    font-weight: 600;
}

.help-content ul {
    margin: 0 0 2rem 0;
    padding-left: 1.5rem;
}

.help-content li {
    margin-bottom: 0.75rem;
    line-height: 1.6;
    font-size: 1rem;
}

.help-content li ul {
    margin: 0.5rem 0 0 0;
}

.insight-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.insight-item {
    background-color: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem;
    font-size: 1rem;
    line-height: 1.5;
    box-shadow: var(--shadow-sm);
}

.insight-item strong {
    display: block;
    margin-bottom: 0.75rem;
    font-size: 1.05rem;
    color: var(--text-color);
}

@media (max-width: 768px) {
    .insight-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .insight-item {
        padding: 1rem;
        font-size: 0.9rem;
    }
    
    .insight-item strong {
        font-size: 1rem;
    }
    
    .tax-help {
        padding: 0.75rem;
    }
    
    .help-content {
        padding: 1rem;
    }
    
    .help-content h4 {
        font-size: 1.1rem;
    }
    
    .help-content li {
        font-size: 0.9rem;
    }
}

/* Formula section styling */
.formula-section {
    margin: 1.5rem 0;
    padding: 1rem;
    background-color: var(--background-color);
    border-radius: var(--radius);
    border-left: 4px solid var(--primary-color);
}

.formula-box {
    background-color: var(--white);
    padding: 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    margin: 0.75rem 0;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
    overflow-x: auto;
    max-width: 100%;
    box-sizing: border-box;
}

.formula-box p {
    margin: 0.5rem 0;
    color: var(--text-color);
}

.formula-example {
    background-color: var(--white);
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    margin: 0.75rem 0;
    font-size: 0.85rem;
    overflow-x: auto;
    max-width: 100%;
}

.formula-example li {
    margin-bottom: 0.5rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    color: var(--text-color);
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.formula-section p {
    margin: 0.5rem 0;
}

.formula-section em {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Recommendation section styling */
.recommendation-section {
    margin: 2rem 0;
    padding: 1.5rem;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #0ea5e9;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.recommendation-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.recommendation-header h3 {
    margin: 0 0 0.5rem 0;
    color: var(--text-color);
    font-size: 1.5rem;
    font-weight: 700;
}

.recommendation-header p {
    margin: 0;
    color: var(--text-light);
    font-size: 1rem;
}

.recommendation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.rec-item {
    background-color: var(--white);
    padding: 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.rec-item.rec-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: var(--white);
    border-color: var(--primary-dark);
    grid-column: span 2;
}

@media (max-width: 768px) {
    .rec-item.rec-primary {
        grid-column: span 1;
    }
}

.rec-label {
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    opacity: 0.8;
}

.rec-primary .rec-label {
    color: rgba(255, 255, 255, 0.9);
}

.rec-value {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    color: var(--text-color);
}

.rec-primary .rec-value {
    color: var(--white);
    font-size: 1.5rem;
}

.rec-reason {
    font-size: 0.875rem;
    opacity: 0.9;
    line-height: 1.4;
}

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

.recommendation-insights {
    background-color: var(--white);
    border-radius: var(--radius);
    padding: 1rem;
    border: 1px solid var(--border-color);
}

.insights-content {
    font-size: 0.9rem;
    line-height: 1.5;
}

.insight-bullet {
    display: flex;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.insight-bullet:last-child {
    margin-bottom: 0;
}

.insight-icon {
    margin-right: 0.5rem;
    margin-top: 0.1rem;
    font-size: 1rem;
}

/* Native Advertising Section */
.native-ad-section {
    margin: 2rem 0;
    padding: 1.5rem;
    background: linear-gradient(135deg, #fefce8 0%, #fef3c7 100%);
    border: 1px solid #f59e0b;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.native-ad-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.native-ad-container {
    width: 100%;
}

.native-ad-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(245, 158, 11, 0.2);
}

.native-ad-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #92400e;
    background: rgba(245, 158, 11, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.native-ad-disclosure {
    font-size: 0.75rem;
    color: #78716c;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
    background: rgba(120, 113, 108, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(120, 113, 108, 0.2);
}

.native-ad-content {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1.5rem;
    align-items: start;
    margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
    .native-ad-content {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

.native-ad-main {
    flex: 1;
}

.native-ad-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 0.75rem;
    line-height: 1.3;
}

.native-ad-description {
    font-size: 0.95rem;
    color: var(--text-light);
    line-height: 1.5;
    margin-bottom: 1rem;
}

.native-ad-cta {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 200px;
}

@media (max-width: 768px) {
    .native-ad-cta {
        min-width: auto;
    }
}

.native-ad-contact {
    background: var(--white);
    padding: 1rem;
    border-radius: var(--radius);
    border: 1px solid rgba(245, 158, 11, 0.2);
    box-shadow: var(--shadow-sm);
}

.native-ad-business {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.native-ad-location {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 0.25rem;
}

.native-ad-credentials {
    font-size: 0.75rem;
    color: #059669;
    font-weight: 500;
    background: rgba(5, 150, 105, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    display: inline-block;
}

.native-ad-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.native-ad-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    text-align: center;
    border: none;
    cursor: pointer;
}

.native-ad-button.primary {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: var(--white);
    box-shadow: 0 2px 4px rgba(5, 150, 105, 0.2);
}

.native-ad-button.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(5, 150, 105, 0.3);
}

.native-ad-button.secondary {
    background: var(--white);
    color: #059669;
    border: 1px solid #059669;
}

.native-ad-button.secondary:hover {
    background: #f0fdf4;
    transform: translateY(-1px);
}

.native-ad-value-props {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(245, 158, 11, 0.2);
}

@media (max-width: 768px) {
    .native-ad-value-props {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }
}

.value-prop {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.7);
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(245, 158, 11, 0.1);
}

.value-icon {
    font-size: 1rem;
    flex-shrink: 0;
}

.value-text {
    font-size: 0.8rem;
    color: var(--text-color);
    font-weight: 500;
}

/* Positive and negative outcome styling */
.positive-outcome {
    color: #059669 !important;
}

.negative-outcome {
    color: #dc2626 !important;
}
