/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Fintech Color Palette */
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary-color: #10b981;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --border-radius: 12px;
    --navbar-height: 60px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Sukhumvit Set', 'Helvetica Neue', Arial, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    padding-top: var(--navbar-height); /* Space for fixed navbar */
}

/* Navigation Bar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.navbar-brand h1 {
    font-size: 20px;
    margin: 0;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Brand mascot icon — PNG โปร่งใส แทนโล่ */
.brand-icon {
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
    object-fit: contain;
}

.brand-icon--xs { width: 24px; height: 24px; }
.brand-icon--sm { width: 28px; height: 28px; }
.brand-icon--md { width: 36px; height: 36px; }
.brand-icon--lg { width: 48px; height: 48px; }

/* กัน Google Translate แปลชื่อแบรนด์ / ชื่อผู้ใช้ (proper nouns) */
.brand-mark,
.notranslate,
[translate="no"] {
    unicode-bidi: isolate;
}

.site-brand-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    text-decoration: none;
    color: #1a3c6e;
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 16px;
}
.site-brand-link:hover { opacity: 0.85; }

/* App page bar — logo + กลับ Dashboard (หน้าหลัง login) */
.page-app-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
    margin-bottom: 20px;
}
.page-app-bar .site-brand-link {
    margin-bottom: 0;
}
.page-app-bar__sep {
    width: 1px;
    height: 22px;
    background: #d8dff0;
    flex-shrink: 0;
}
.page-app-bar__back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #667eea;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    padding: 7px 14px;
    border-radius: 8px;
    background: #fff;
    border: 1.5px solid #e0e7ff;
    box-shadow: 0 1px 4px rgba(102, 126, 234, 0.08);
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.page-app-bar__back:hover {
    background: #f3f4ff;
    color: #5a6fd6;
    border-color: #c7d2fe;
    text-decoration: none;
}
.page-app-bar__admin {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff !important;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.2s, transform 0.15s;
}
.page-app-bar__admin:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    text-decoration: none;
}

.page-app-bar--compare {
    padding-top: 1.25rem;
    margin-bottom: 0.5rem;
}

.brand-logo-text {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.auth-logo h1 {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

/* Inline / nav icons — SVG แทน emoji */
.app-icon {
    width: 1.25em;
    height: 1.25em;
    vertical-align: -0.2em;
    display: inline-block;
    object-fit: contain;
    flex-shrink: 0;
}

.app-icon--sm { width: 1rem; height: 1rem; }
.app-icon--md { width: 1.25rem; height: 1.25rem; }
.app-icon--lg { width: 2rem; height: 2rem; }

.quick-action-icon img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.icon-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.title-with-icon {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* Help — mascot + ? badge (help.html, dashboard banner) */
.help-brand-icon {
    position: relative;
    display: inline-flex;
    width: 2.75rem;
    height: 2.75rem;
    flex-shrink: 0;
}
.help-brand-icon__mascot {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
.help-brand-icon__badge {
    position: absolute;
    right: 1px;
    top: 46%;
    transform: translateY(-50%);
    min-width: 1.05rem;
    height: 1.05rem;
    padding: 0 2px;
    border-radius: 999px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    font-weight: 800;
    font-size: 0.68rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.22);
    border: 1.5px solid #fff;
}

.form-section-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 4px;
    margin-bottom: 6px;
}

.form-section-label.death { color: #1a3c6e; background: #e8f0fb; }
.form-section-label.return { color: #1a6e3c; background: #e8fbf0; margin-top: 10px; margin-bottom: 6px; }
.form-section-label.maturity { color: #6e4a1a; background: #fbf4e8; margin-top: 10px; margin-bottom: 6px; }

.summary-icon img,
.winner-badge-top .badge-icon-img {
    width: 2.5rem;
    height: 2.5rem;
    object-fit: contain;
}

.btn-with-icon {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    justify-content: center;
}

.chart-lock-icon {
    width: 2rem;
    height: 2rem;
    margin: 0 auto 8px;
    display: block;
}

.result-label.icon-label {
    font-size: 0.9rem;
}

.navbar-menu {
    display: flex;
    align-items: center;
    gap: 15px;
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.navbar-agent-name {
    font-size: 14px;
    font-weight: 500;
}

.navbar-dropdown {
    position: relative;
}

.navbar-dropdown-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.navbar-dropdown-btn img {
    width: 20px;
    height: 20px;
    filter: brightness(0) invert(1);
}

.navbar-dropdown-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.navbar-dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 40px;
    padding-top: 8px;
    background: transparent;
    min-width: 180px;
    z-index: 100;
}

.navbar-dropdown-content-inner {
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 10px;
    overflow: hidden;
}

.navbar-dropdown-content.open {
    display: block;
}

/* removed hover trigger — now handled by JS click */

.navbar-dropdown-content a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    color: #333;
    text-decoration: none;
    transition: background 0.2s;
    font-size: 14px;
}

.navbar-dropdown-content a:hover {
    background: #f5f5f5;
}

/* Container */
.container {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Plans Container */
.plans-container {
    display: grid;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Plan Card */
.plan-card {
    position: relative;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.plan-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.plan-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.demo-sample-select {
    font-size: 0.75rem;
    padding: 5px 8px;
    border: 1.5px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
    color: #475569;
    max-width: 130px;
    cursor: pointer;
}

.demo-sample-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.15);
}

.plan-title {
    font-size: 1.25rem;
    color: var(--primary-color);
    margin: 0;
}

.plan-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.btn-remove-plan {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #fee2e2;
    color: #dc2626;
    border: none;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.btn-remove-plan:hover {
    background: #fecaca;
    transform: rotate(90deg);
}

/* Form Rows for Side-by-Side Inputs */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.section-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 1rem 0 0.75rem;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.btn-add-plan {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    background: white;
    color: var(--primary-color);
    border: 2px dashed var(--primary-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-add-plan:hover {
    background: var(--primary-color);
    color: white;
    border-style: solid;
}

.btn-add-plan .btn-icon {
    font-size: 1.5rem;
    font-weight: 700;
}

/* Results Grid */
.results-grid {
    display: grid;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.results-grid.results-grid--compare {
    align-items: stretch;
}

.results-grid.single-result {
    max-width: 480px;
    margin: 0 auto 1.5rem;
}

.results-card {
    position: relative;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.results-grid--compare .results-card {
    height: 100%;
}

.results-card.winner {
    border: 2px solid #fbbf24;
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.3);
}

/* Winner Badge (Top Style) */
.winner-badge-slot {
    position: relative;
    min-height: 2rem;
    margin-bottom: 0.35rem;
    flex-shrink: 0;
}

.winner-badge-top {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 0.85rem;
    z-index: 10;
    animation: bounce 0.6s ease;
}

.winner-badge-top .badge-icon {
    font-size: 1.2rem;
}

/* Comparison Summary */
.comparison-summary {
    background: linear-gradient(135deg, #fefce8 0%, #fef3c7 100%);
    border: 2px solid #fbbf24;
    animation: slideIn 0.5s ease;
}

.comparison-table {
    overflow-x: auto;
}

.comparison-table table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.comparison-table th {
    background: var(--primary-color);
    color: white;
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
}

.comparison-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.comparison-table tr:last-child td {
    border-bottom: none;
}

.comparison-table .winner-row {
    background: #fef3c7;
    font-weight: 600;
}

.comparison-table .winner-row td {
    color: var(--text-primary);
}

/* Responsive Design */
@media (min-width: 768px) {
    .container {
        max-width: 900px;
    }

    .plans-container {
        grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    }

    .results-grid:not(.single-result) {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }

    .results-grid.results-grid--compare {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .action-buttons {
        flex-direction: row;
        justify-content: center;
    }

    .btn-add-plan,
    .btn-primary {
        flex: 1;
        max-width: 300px;
    }
}

@media (min-width: 1024px) {
    .container {
        max-width: 1200px;
    }

    .plans-container {
        grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    }

    .results-grid:not(.single-result) {
        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    }

    .results-grid.results-grid--compare {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Mode Toggle */
.mode-toggle {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    background: var(--surface);
    padding: 0.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

.mode-btn {
    flex: 1;
    padding: 0.75rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mode-btn.active {
    color: white;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    box-shadow: var(--shadow-sm);
}

.mode-btn:hover:not(.active) {
    background: var(--background);
}

/* Compare Mode Layout */
.compare-container {
    display: grid;
    gap: 1rem;
    margin-bottom: 1rem;
}

.compare-card {
    position: relative;
}

.plan-title {
    font-size: 1.25rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
    text-align: center;
}

/* Compare Results */
.compare-results-container {
    display: grid;
    gap: 1rem;
    margin-bottom: 1.5rem;
    position: relative;
}

.compare-result {
    position: relative;
}

.winner-badge {
    display: none;
    position: absolute;
    top: -1rem;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    font-weight: 700;
    font-size: 0.85rem;
    text-align: center;
    z-index: 10;
    animation: bounce 0.6s ease;
}

.winner-badge.show {
    display: block;
}

.badge-icon {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.badge-text {
    font-size: 0.8rem;
}

.badge-arrow {
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #f59e0b;
}

@keyframes bounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-10px); }
}

/* Comparison Summary */
.comparison-summary {
    background: linear-gradient(135deg, #fefce8 0%, #fef3c7 100%);
    border: 2px solid #fbbf24;
}

.comparison-details {
    display: grid;
    gap: 1rem;
}

.comparison-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: white;
    border-radius: 8px;
}

.comparison-label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.comparison-values {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.comparison-value {
    font-weight: 700;
    font-size: 1rem;
}

.comparison-value.winner {
    color: var(--secondary-color);
    font-size: 1.1rem;
}

.comparison-value.loser {
    color: var(--text-secondary);
    opacity: 0.7;
}

.vs-separator {
    color: var(--text-secondary);
    font-weight: 600;
}

/* Responsive Design for Tablets and Desktop */
@media (min-width: 768px) {
    .container {
        max-width: 900px;
    }

    .compare-container {
        grid-template-columns: 1fr 1fr;
    }

    .compare-results-container {
        grid-template-columns: 1fr 1fr;
    }

    .winner-badge {
        top: 50%;
        left: auto;
        right: -1.5rem;
        transform: translateY(-50%) rotate(-90deg);
    }

    .winner-badge.plan1 {
        left: -1.5rem;
        right: auto;
        transform: translateY(-50%) rotate(90deg);
    }

    .badge-arrow {
        display: none;
    }
}

@media (min-width: 1024px) {
    .container {
        max-width: 1200px;
    }
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 2rem 1.5rem 3rem;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.logo h1 {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 0.5rem;
}

.tagline {
    font-size: 0.95rem;
    opacity: 0.95;
    font-weight: 300;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 0 1.5rem 2rem;
    margin-top: -1.5rem;
}

/* Card */
.card {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 2rem 1.5rem;
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
}

.form-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.form-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* Form Styles */
.form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.form-input,
.form-select {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text-primary);
    transition: all 0.2s ease;
    font-family: inherit;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1.25rem;
    padding-right: 3rem;
    cursor: pointer;
}

/* Button */
.btn-primary {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    margin-top: 0.5rem;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Features Section */
.features {
    display: grid;
    gap: 1rem;
    margin-bottom: 2rem;
}

.feature-item {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    text-align: center;
    transition: all 0.2s ease;
}

.feature-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.feature-icon {
    margin-bottom: 0.75rem;
}

.feature-icon img {
    width: 4rem;
    height: 4rem;
    object-fit: contain;
    display: inline-block;
}

.feature-item h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.feature-item p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Footer */
.footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    border-top: 1px solid var(--border-color);
}

.site-footer {
    text-align: center;
    padding: 1rem 1.25rem 1.5rem;
    font-size: 0.85rem;
}

.site-footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.35rem 1.25rem;
    margin-bottom: 0.5rem;
}

.site-footer-links a {
    color: inherit;
    text-decoration: none;
    font-weight: 500;
}

.site-footer-links a:hover,
.site-footer-links a[aria-current="page"] {
    text-decoration: underline;
}

.site-footer-copy {
    margin: 0;
    opacity: 0.85;
}

.site-footer--on-gradient {
    color: rgba(255, 255, 255, 0.88);
}

.site-footer--on-gradient a {
    color: #fff;
}

.site-footer--light {
    color: #666;
    border-top: 1px solid var(--border-color);
    background: #fff;
}

.site-footer--light a {
    color: #667eea;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 14px;
    line-height: 1.5;
    color: #444;
    cursor: pointer;
    font-weight: 400;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    flex-shrink: 0;
    accent-color: #667eea;
    cursor: pointer;
}

.checkbox-label a {
    color: #667eea;
    font-weight: 600;
    text-decoration: none;
}

.checkbox-label a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 480px) {
    .header {
        padding: 1.5rem 1rem 2.5rem;
    }

    .logo h1 {
        font-size: 1.75rem;
    }

    .main-content {
        padding: 0 1rem 1.5rem;
    }

    .card {
        padding: 1.5rem 1rem;
    }
}

/* Input validation styles */
.form-input:invalid:not(:placeholder-shown),
.form-select:invalid:not(:placeholder-shown) {
    border-color: #ef4444;
}

.form-input:valid:not(:placeholder-shown),
.form-select:valid {
    border-color: var(--secondary-color);
}

/* Section Divider */
.divider {
    height: 1px;
    background: linear-gradient(to right, transparent, var(--border-color), transparent);
    margin: 1.5rem 0;
}

.divider-thin {
    height: 1px;
    background: var(--border-color);
    margin: 1rem 0;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

/* Results Card */
.results-card {
    background: linear-gradient(135deg, #f0fdf4 0%, #dbeafe 100%);
    border: 2px solid var(--secondary-color);
}

.results-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex: 1;
}

/* จัดแถวให้ตรงกันเมื่อเปรียบเทียบ 2+ แผนบำนาญ */
.results-grid--compare .results-card-header {
    min-height: 5.25rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    margin-bottom: 1rem;
    flex-shrink: 0;
}

.results-grid--compare .results-plan-title {
    font-size: 1.05rem;
    line-height: 1.4;
    text-align: center;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.results-grid--compare .results-card-header .plan-subtitle {
    margin-bottom: 0;
}

.results-content.results-content--aligned {
    gap: 0;
}

.results-content--pension.results-content--aligned .result-row {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-bottom: 1rem;
}

.results-content--pension.results-content--aligned .result-row-total {
    min-height: 8.75rem;
}

.results-content--pension.results-content--aligned .result-row-income {
    min-height: 8.25rem;
}

.results-content--pension.results-content--aligned .result-row-income .result-grid {
    height: 100%;
    align-content: stretch;
}

.results-content--pension.results-content--aligned .result-row-income .result-item {
    height: 100%;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 0.35rem;
}

.results-content--pension.results-content--aligned .result-row-irr {
    min-height: 8.25rem;
}

.results-content--pension.results-content--aligned .result-row-divider {
    min-height: 1.5rem;
    justify-content: center;
    padding-bottom: 0.75rem;
}

.results-content--pension.results-content--aligned .result-row-divider .divider-thin {
    margin: 0;
}

.results-content--pension.results-content--aligned .pension-details-grid {
    gap: 0;
}

.results-content--pension.results-content--aligned .pension-details-grid .result-item {
    min-height: 3.75rem;
    padding: 0.55rem 0;
}

.result-item.result-item-detail {
    flex-direction: column;
    align-items: stretch;
    gap: 0.15rem;
}

.result-item-detail .result-item-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    width: 100%;
}

.result-item-detail .result-label {
    flex: 1;
    min-width: 0;
}

.result-item-detail .result-value {
    flex-shrink: 0;
    text-align: right;
}

.result-hint-inline {
    font-size: 0.72rem;
    font-weight: 400;
    color: var(--text-secondary);
    line-height: 1.35;
    opacity: 0.92;
}

.result-hint-pension {
    font-size: 0.75rem;
    font-weight: 400;
    color: #92400e;
    opacity: 0.85;
    line-height: 1.35;
    margin-top: 0.15rem;
}

.pension-highlight-block,
.pension-income-cell {
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
}

.pension-highlight-block .result-value,
.pension-income-cell .result-value {
    align-self: flex-end;
}

.pension-income-cell .result-label {
    width: 100%;
}

.result-span-muted {
    font-size: 0.75em;
    color: #888;
    font-weight: 500;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
}

.result-item.highlight {
    background: white;
    padding: 1.25rem;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
}

.result-item.highlight.irr {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
}

.result-item.highlight.irr .result-label,
.result-item.highlight.irr .result-value {
    color: white;
}

.result-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.result-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.result-value.small {
    font-size: 1.1rem;
}

.result-value.big {
    font-size: 2rem;
    font-weight: 800;
}

.result-value.positive {
    color: var(--secondary-color);
}

.result-value.negative {
    color: #ef4444;
}

/* Insurance Type Specific Highlights */
.pension-highlight {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 2px solid #f59e0b;
}

.pension-highlight .result-label,
.pension-highlight .result-value {
    color: #92400e;
}

.result-item.highlight.irr.pension-irr {
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
}

.result-item.highlight.irr.pension-irr .result-label,
.result-item.highlight.irr.pension-irr .result-value {
    width: 100%;
}

.result-item.highlight.irr.pension-irr .result-value {
    font-size: 1.75rem;
}

.result-hint {
    font-size: 0.75rem;
    font-weight: 400;
    opacity: 0.88;
    line-height: 1.4;
}

.result-label-note {
    font-size: 0.7em;
    font-weight: 400;
    opacity: 0.75;
}

.result-grid.pension-income-row {
    grid-template-columns: 1fr 1fr;
}

@media (max-width: 480px) {
    .result-grid.pension-income-row {
        grid-template-columns: 1fr;
    }
}

.lifelong-highlight {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border: 2px solid #3b82f6;
}

.lifelong-highlight .result-label,
.lifelong-highlight .result-value {
    color: #1e40af;
}

.savings-result {
    border-left: 4px solid #10b981;
}

.pension-result {
    border-left: 4px solid #f59e0b;
}

.lifelong-result {
    border-left: 4px solid #3b82f6;
}

.health-result {
    border-left: 4px solid #06b6d4;
}

/* Health Insurance Highlight */
.health-highlight {
    background: linear-gradient(135deg, #cffafe 0%, #a5f3fc 100%);
    padding: 1rem;
    border-radius: 8px;
    border: 2px solid #06b6d4;
    margin-bottom: 1rem;
}

.health-highlight .result-label,
.health-highlight .result-value {
    color: #164e63;
}

/* Best Value Indicator (Green Highlight) */
.best-value {
    color: #16a34a !important;
    font-weight: 800 !important;
}

.best-value-row {
    background: #f0fdf4 !important;
}

.best-value-row td {
    font-weight: 600;
}

.value-ratio {
    font-weight: 700;
    color: var(--secondary-color);
}

/* Premium Projection Display */
.premium-projection-display {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.projection-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background: var(--background);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.projection-item.current {
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
    border-color: var(--primary-color);
}

.projection-age {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.projection-premium {
    font-size: 0.9rem;
    color: var(--primary-color);
    font-weight: 700;
}

/* Smart Summary */
.smart-summary {
    margin-top: 2rem;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 50%, #fed7aa 100%);
    border: 2px solid #f59e0b;
}

.smart-summary .form-title {
    color: #92400e;
}

.summary-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

.summary-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.summary-icon {
    font-size: 2.5rem;
    line-height: 1;
}

.summary-content {
    flex: 1;
}

.summary-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.summary-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.summary-value.highlight-green {
    color: #16a34a;
    font-size: 2rem;
}

.summary-detail {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.summary-item.health-coverage {
    border-left: 4px solid #06b6d4;
}

.summary-item.tax-benefits {
    border-left: 4px solid #8b5cf6;
}

.summary-item.tax-refund {
    border-left: 4px solid #16a34a;
}

.summary-item.total-premium {
    border-left: 4px solid #f59e0b;
}

.summary-item.senior-highlight {
    border-left: 4px solid #dc2626;
    background: #fff7ed;
}

/* Minor (underage) warning banner */
.alert-minor {
    background: #fffbeb;
    border: 2px solid #f59e0b;
    border-radius: 10px;
    padding: 0.75rem 1.25rem;
    margin-bottom: 1rem;
    color: #92400e;
    font-weight: 600;
    font-size: 0.95rem;
}

/* Senior citizen notice card */
.senior-notice {
    margin-top: 1.5rem;
    background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
    border: 2px solid #ea580c;
}

.senior-notice-header {
    font-size: 1.1rem;
    font-weight: 700;
    color: #9a3412;
    margin-bottom: 0.75rem;
}

.senior-tips {
    margin: 0;
    padding-left: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.senior-tips li {
    color: #7c2d12;
    font-size: 0.9rem;
    line-height: 1.5;
}

@media (min-width: 768px) {
    .summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Comparison Type Headers */
.comparison-type-header {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 1.5rem 0 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

.comparison-type-header:first-child {
    margin-top: 0;
}

.result-grid {
    display: grid;
    gap: 0.75rem;
}

.cashflow-summary {
    margin-top: 0.5rem;
}

/* Button Secondary */
.btn-secondary {
    width: 100%;
    padding: 0.875rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--primary-color);
    background: white;
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: white;
}

/* Cashflow Table */
.cashflow-table {
    overflow-x: auto;
    margin-top: 1rem;
}

.cashflow-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.cashflow-table th,
.cashflow-table td {
    padding: 0.75rem 0.5rem;
    text-align: right;
    border-bottom: 1px solid var(--border-color);
}

.cashflow-table th {
    background: var(--background);
    font-weight: 600;
    color: var(--text-primary);
    position: sticky;
    top: 0;
}

.cashflow-table td:first-child,
.cashflow-table th:first-child {
    text-align: center;
    font-weight: 600;
}

.cashflow-table .cash-out {
    color: #ef4444;
}

.cashflow-table .cashflow-premium {
    color: #b45309;
}

.cashflow-table .cashflow-net-out {
    color: #d97706;
}

.cashflow-table .cashflow-cum-invested {
    color: #64748b;
    font-weight: 600;
}

.cashflow-table .cashflow-cum-pos {
    color: #059669;
    font-weight: 600;
}

.cashflow-table .cashflow-empty {
    color: #cbd5e1;
    text-align: center;
}

.cashflow-table .cash-in {
    color: var(--secondary-color);
}

.cashflow-table .net-flow {
    font-weight: 600;
}

.cashflow-table tr:last-child {
    border-bottom: 2px solid var(--primary-color);
}

.cashflow-table tr:last-child td {
    font-weight: 700;
    font-size: 0.95rem;
}

.compare-cashflow-table thead tr:first-child th {
    background: #1a3c6e;
    color: #fff;
    border: 1px solid #d0d8e8;
}

.compare-cashflow-table thead tr:nth-child(2) th {
    background: #2a4f8a;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid #d0d8e8;
}

.compare-cashflow-table tbody td {
    border: 1px solid #e0e8f0;
    font-size: 0.8rem;
    padding: 0.45rem 0.5rem;
}

.compare-cashflow-note {
    margin-top: 0.75rem;
    font-size: 0.75rem;
    color: #64748b;
    line-height: 1.5;
}

/* ============================================================
   Responsive — Mobile & Tablet (global)
   ============================================================ */

html {
    -webkit-text-size-adjust: 100%;
}

body {
    overflow-x: hidden;
}

/* Chart & export layout (compare page) */
.chart-flex-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.chart-flex-col {
    flex: 1;
    min-width: 0;
    max-width: 480px;
}

.export-buttons-bar {
    margin-top: 16px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.table-scroll-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -0.25rem;
    padding: 0 0.25rem;
}

/* ── Mobile (≤ 767px) ── */
@media (max-width: 767px) {
    body {
        padding-top: var(--navbar-height);
    }

    .navbar {
        padding: 10px 14px;
    }

    .navbar-brand h1 {
        font-size: 17px;
    }

    .navbar-agent-name {
        display: none;
    }

    body.guest-trial-active .navbar-agent-name {
        display: inline;
        font-size: 11px;
        max-width: 42vw;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .navbar-dropdown-btn {
        width: 40px;
        height: 40px;
    }

    .main-content {
        padding: 0 1rem 1.5rem;
    }

    .header {
        padding: 1.5rem 1rem 2.5rem;
    }

    .logo h1 {
        font-size: 1.65rem;
    }

    .tagline {
        font-size: 0.88rem;
    }

    .card {
        padding: 1.25rem 1rem;
    }

    .form-title {
        font-size: 1.25rem;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .plan-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .plan-title {
        font-size: 1.1rem;
    }

    .comparison-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .comparison-values {
        flex-wrap: wrap;
        gap: 0.5rem;
        width: 100%;
    }

    .result-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .result-item.highlight {
        padding: 1rem;
    }

    .result-value {
        font-size: 1.25rem;
    }

    .result-value.big {
        font-size: 1.5rem;
    }

    .summary-value {
        font-size: 1.4rem;
    }

    .summary-value.highlight-green {
        font-size: 1.6rem;
    }

    .summary-item {
        flex-direction: column;
        text-align: center;
    }

    .summary-icon {
        font-size: 2rem;
    }

    .winner-badge-top {
        font-size: 0.75rem;
        padding: 0.4rem 0.75rem;
        white-space: nowrap;
    }

    .mode-toggle {
        flex-wrap: wrap;
    }

    .mode-btn {
        font-size: 0.82rem;
        padding: 0.65rem 0.5rem;
    }

    .btn-primary,
    .btn-secondary,
    .btn-add-plan {
        min-height: 44px;
    }

    .comparison-table th,
    .comparison-table td {
        padding: 0.5rem;
        font-size: 0.8rem;
    }

    .cashflow-table {
        font-size: 0.78rem;
    }

    .cashflow-table th,
    .cashflow-table td {
        padding: 0.5rem 0.35rem;
    }

    .chart-flex-col {
        flex: 1 1 100%;
        max-width: 100%;
    }

    .export-buttons-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .export-buttons-bar .btn-secondary,
    .export-buttons-bar .btn-primary {
        width: 100%;
        text-align: center;
    }

    .features {
        gap: 0.75rem;
    }

    .feature-item {
        padding: 1.25rem;
    }

    .feature-icon {
        font-size: 2rem;
    }

    .auth-box {
        padding: 24px 18px !important;
        border-radius: 16px !important;
    }

    .auth-logo h1 {
        font-size: 26px !important;
    }
}

/* ── Small phones (≤ 480px) ── */
@media (max-width: 480px) {
    .container {
        max-width: 100%;
    }

    .navbar-brand h1 {
        font-size: 16px;
    }

    .form-input,
    .form-select {
        font-size: 16px; /* prevent iOS zoom on focus */
    }
}

/* Guest trial mode banner (compare page) — อยู่ใน document flow + sticky ใต้ navbar */
.guest-mode-banner {
    position: sticky;
    top: var(--navbar-height);
    z-index: 998;
    background: linear-gradient(90deg, #fff8e6 0%, #fff3cd 100%);
    border-bottom: 1px solid #f0c674;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.guest-mode-banner[hidden] {
    display: none !important;
}

.guest-mode-banner__inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px 16px;
    padding: 10px 16px;
}

.guest-mode-banner__text {
    flex: 1 1 200px;
    margin: 0;
    font-size: 13px;
    line-height: 1.45;
    color: #856404;
}

.guest-mode-banner__text-short {
    display: none;
}

.guest-mode-banner__cta-short {
    display: none;
}

.guest-mode-banner__cta {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    border-radius: 8px;
    background: #667eea;
    color: #fff !important;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.25);
    transition: background 0.2s, transform 0.15s;
}

.guest-mode-banner__cta:hover {
    background: #5a6fd6;
    transform: translateY(-1px);
    text-decoration: none;
}

/* Guest trial mode — layout แยกจากผู้ login: ไม่ซ้อน hero, ไม่มีแถบซ้ำ */
body.guest-trial-active .guest-mode-banner {
    position: static;
    top: auto;
}

body.guest-trial-active .page-app-bar--compare {
    display: none;
}

body.guest-trial-active .header {
    padding: 1.5rem 1.5rem 2rem;
    margin-top: 0;
}

body.guest-trial-active .main-content {
    margin-top: 0;
    padding-top: 0.75rem;
}

body.guest-trial-active .container > .header {
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

body.guest-trial-active .plans-container .plan-card:first-child {
    margin-top: 0;
}

/* สมาชิก login — แถบครบ (navbar + app-bar + hero) เรียงลำดับ ไม่ทับซ้อน */
body.member-compare-active .page-app-bar--compare {
    flex-shrink: 0;
    background: #f5f7fa;
    padding: 0.65rem 1.25rem 0.6rem;
    margin: 0;
    border-bottom: 1px solid #e2e8f0;
}

body.member-compare-active .header {
    flex-shrink: 0;
    margin-top: 0;
    padding: 1.5rem 1.5rem 2.25rem;
    box-shadow: none;
}

body.member-compare-active .container > .header {
    border-radius: 0;
}

body.member-compare-active .main-content {
    margin-top: 0;
    padding-top: 0.75rem;
    position: relative;
    z-index: auto;
}

@media (max-width: 767px) {
    :root {
        --navbar-height: 56px;
    }

    .page-app-bar--compare {
        padding-top: 0.75rem;
        padding-left: 1rem;
        padding-right: 1rem;
        margin-bottom: 0.25rem;
    }

    body.member-compare-active .page-app-bar--compare {
        padding: 0.5rem 1rem 0.45rem;
        margin-bottom: 0;
    }

    body.member-compare-active .header {
        padding: 1.25rem 1rem 2rem;
    }

    body.member-compare-active .main-content {
        margin-top: 0;
        padding-top: 0.65rem;
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .guest-mode-banner__inner {
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        gap: 8px;
        padding: 6px 10px;
    }

    .guest-mode-banner__text {
        flex: 1 1 auto;
        min-width: 0;
    }

    .guest-mode-banner__text-full {
        display: none;
    }

    .guest-mode-banner__text-short {
        display: block;
        text-align: left;
        font-size: 11px;
        line-height: 1.3;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .guest-mode-banner__cta-long {
        display: none;
    }

    .guest-mode-banner__cta-short {
        display: inline;
    }

    .guest-mode-banner__cta {
        width: auto;
        flex: 0 0 auto;
        font-size: 11px;
        padding: 5px 10px;
        border-radius: 6px;
        white-space: nowrap;
        box-shadow: none;
    }

    body.guest-trial-active .header {
        padding: 1rem 1rem 1.35rem;
        border-radius: 0;
    }

    body.guest-trial-active .logo h1 {
        font-size: 1.3rem;
        margin-bottom: 0.25rem;
    }

    body.guest-trial-active .tagline {
        font-size: 0.82rem;
    }

    body.guest-trial-active .main-content {
        margin-top: 0;
        padding-top: 0.75rem;
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .plan-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.65rem;
    }

    .plan-header > div {
        width: 100%;
        display: flex;
        justify-content: flex-start;
    }

    .plan-header .btn-upload-pdf,
    .plan-header label.btn-upload-pdf {
        width: 100%;
        justify-content: center;
        font-size: 0.78rem !important;
    }
}

@media (max-width: 480px) {
    body.guest-trial-active .tagline {
        display: none;
    }

    body.guest-trial-active .header {
        padding: 0.75rem 1rem 1rem;
    }

    body.guest-trial-active .logo h1 {
        font-size: 1.2rem;
        margin-bottom: 0;
    }
}
