/* Qalcu — общий стиль всех страниц. Префикс fc-. */
:root {
    --fc-bg: #f8fafc;
    --fc-surface: #ffffff;
    --fc-text: #0f172a;
    --fc-text-2: #334155;
    --fc-muted: #64748b;
    --fc-border: #e2e8f0;
    --fc-border-strong: #cbd5e1;
    --fc-accent: #2563eb;
    --fc-accent-dark: #1d4ed8;
    --fc-accent-soft: #eff6ff;
    --fc-ok: #15803d;
    --fc-low: #b45309;
    --fc-error: #b91c1c;
    --fc-radius: 12px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; }
.fc-body { background: var(--fc-bg); color: var(--fc-text); font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif; line-height: 1.45;
    /* подвал всегда внизу окна, даже если контента мало */
    min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.fc-body a { color: var(--fc-accent); }
h1, h2, h3, h4, p { margin: 0; }

/* Шапка */
.fc-header { background: var(--fc-surface); border-bottom: 1px solid var(--fc-border); }
.fc-header-inner { max-width: 1200px; margin: 0 auto; padding: 12px 16px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px; }
.fc-brand { font-size: 1.5rem; font-weight: 700; color: var(--fc-accent) !important; text-decoration: none; }
.fc-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 20px; }
.fc-nav-link { color: var(--fc-text-2) !important; text-decoration: none; font-size: 0.95rem; }
.fc-nav-link:hover { color: var(--fc-accent) !important; }
.fc-nav-link.is-active { color: var(--fc-accent) !important; font-weight: 600; }
.fc-lang { display: inline-flex; background: #f1f5f9; padding: 3px; border-radius: 8px; }
.lang-btn { border: 0; background: transparent; color: var(--fc-accent); padding: 4px 10px; border-radius: 6px; font: inherit; font-size: 0.85rem; font-weight: 600; cursor: pointer; }
.lang-btn.is-active { background: var(--fc-accent); color: #fff; }

/* Подвал */
.fc-footer { border-top: 1px solid var(--fc-border); background: var(--fc-surface); }
.fc-footer p { max-width: 1200px; margin: 0 auto; padding: 16px; color: var(--fc-muted); font-size: 0.85rem; }

/* Страница */
.fc-main { max-width: 1200px; width: 100%; box-sizing: border-box; flex: 1 0 auto; margin: 0 auto; padding: 24px 16px 48px; }
.fc-h1 { font-size: 1.75rem; font-weight: 700; line-height: 1.2; margin: 0 0 6px; }
.fc-subtitle { color: var(--fc-muted); margin: 0 0 20px; }
.fc-h3 { font-size: 1.05rem; font-weight: 600; margin: 0 0 12px; }
.fc-muted { color: var(--fc-muted); }

.fc-layout { display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 860px) { .fc-layout { grid-template-columns: minmax(0, 1fr); } }

/* Форма */
.fc-form { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; display: grid; gap: 12px; }
@media (max-width: 860px) { .fc-form { position: static; max-height: none; overflow: visible; } }
.fc-group { background: var(--fc-surface); border: 1px solid var(--fc-border); border-radius: var(--fc-radius); padding: 12px 14px; margin: 0; min-width: 0; }
.fc-group[open] { padding-bottom: 14px; }
.fc-group summary { font-weight: 600; cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.fc-group summary::-webkit-details-marker { display: none; }
.fc-group summary::after { content: '▾'; color: var(--fc-muted); transition: transform 0.15s; }
.fc-group:not([open]) summary::after { transform: rotate(-90deg); }
.fc-field { display: grid; gap: 4px; margin-top: 10px; font-size: 0.9rem; }
.fc-field > span { color: var(--fc-text-2); }
.fc-field input, .fc-field select {
    width: 100%; min-width: 0; padding: 8px 10px; border: 1px solid var(--fc-border-strong); border-radius: 8px;
    background: #fff; font: inherit; color: inherit;
}
.fc-field input:focus, .fc-field select:focus { outline: 2px solid var(--fc-accent); outline-offset: 1px; border-color: transparent; }
.fc-field input[aria-invalid="true"], .fc-field select[aria-invalid="true"] { border-color: var(--fc-error); background: #fef2f2; }
.fc-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.fc-hint { color: var(--fc-muted); font-size: 0.78rem; }
.fc-check { display: flex; gap: 8px; align-items: center; margin-top: 12px; font-size: 0.9rem; }

/* Результаты */
.fc-results { display: grid; gap: 16px; min-width: 0; }
.fc-card { background: var(--fc-surface); border: 1px solid var(--fc-border); border-radius: var(--fc-radius); padding: 16px; min-width: 0; }
.fc-card--accent { background: var(--fc-accent-soft); border-color: #bfdbfe; }
.fc-card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; }
.fc-card-head .fc-h3 { margin: 0; }

/* Плитки с итогами */
.fc-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.fc-stat { background: var(--fc-surface); border: 1px solid var(--fc-border); border-radius: var(--fc-radius); padding: 14px 16px; display: grid; gap: 4px; min-width: 0; }
.fc-stat > span { color: var(--fc-muted); font-size: 0.85rem; }
.fc-stat strong { font-size: 1.35rem; line-height: 1.2; overflow-wrap: anywhere; }
.fc-stat small { color: var(--fc-muted); font-size: 0.8rem; }
.fc-stat--main { border-left: 4px solid var(--fc-accent); }
.fc-stat--main strong { color: var(--fc-accent-dark); font-size: 1.6rem; }
@media (max-width: 480px) {
    .fc-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .fc-stat { padding: 10px 12px; }
    .fc-stat strong { font-size: 1.05rem; }
    .fc-stat--main { grid-column: 1 / -1; }
    .fc-stat--main strong { font-size: 1.4rem; }
}
.is-ok { color: var(--fc-ok); }
.is-low { color: var(--fc-low); }

/* Переключатель */
.fc-segmented { display: inline-flex; background: #f1f5f9; padding: 3px; border-radius: 999px; }
.fc-segmented button { border: 0; background: transparent; padding: 5px 12px; border-radius: 999px; font: inherit; font-size: 0.85rem; font-weight: 600; color: var(--fc-text-2); cursor: pointer; }
.fc-segmented button.is-active { background: var(--fc-surface); color: var(--fc-accent); box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12); }

.fc-chart { position: relative; height: 300px; }
@media (max-width: 480px) { .fc-chart { height: 260px; } }

/* Таблицы */
.fc-table-wrap {
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    /* тени по краям: показывают, что таблицу можно прокрутить вбок (исчезают, когда край достигнут) */
    background:
        linear-gradient(to right, var(--fc-surface) 30%, transparent) left center / 40px 100% no-repeat local,
        linear-gradient(to left, var(--fc-surface) 30%, transparent) right center / 40px 100% no-repeat local,
        radial-gradient(farthest-side at 0 50%, rgba(0, 0, 0, 0.18), transparent) left center / 12px 100% no-repeat scroll,
        radial-gradient(farthest-side at 100% 50%, rgba(0, 0, 0, 0.18), transparent) right center / 12px 100% no-repeat scroll;
}
@media (max-width: 480px) {
    .fc-table { font-size: 0.82rem; min-width: 440px; }
    .fc-table th, .fc-table td { padding: 8px 7px; }
    .fc-table th[scope="row"], .fc-table thead th:first-child { position: sticky; left: 0; background: var(--fc-surface); z-index: 1; }
}
.fc-table-wrap--tall { max-height: 460px; overflow-y: auto; }
.fc-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; min-width: 520px; }
.fc-table caption { text-align: left; color: var(--fc-muted); font-size: 0.8rem; padding-bottom: 6px; }
.fc-table th, .fc-table td { padding: 8px 10px; border-bottom: 1px solid var(--fc-border); text-align: right; white-space: nowrap; }
.fc-table th[scope="row"], .fc-table thead th:first-child { text-align: left; white-space: normal; font-weight: 500; color: var(--fc-text-2); }
.fc-table thead th { font-weight: 600; position: sticky; top: 0; background: var(--fc-surface); }
.fc-table .is-active { background: var(--fc-accent-soft); }
.fc-table .fc-strong td { font-weight: 600; }

.fc-alerts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.fc-alerts li { background: #fffbeb; border: 1px solid #fde68a; border-radius: 10px; padding: 10px 12px; font-size: 0.9rem; }

.fc-error { background: #fef2f2; border: 1px solid #fecaca; color: var(--fc-error); border-radius: var(--fc-radius); padding: 14px 16px; }
.fc-error p { margin: 4px 0 0; }
.fc-error-field { font-weight: 600; }
.fc-disclaimer { color: var(--fc-muted); font-size: 0.8rem; margin: 0; }

/* Главная */
.fc-hero { text-align: center; padding: 32px 0 28px; }
.fc-hero .fc-h1 { font-size: 2.25rem; }
.fc-hero .fc-subtitle { max-width: 640px; margin: 8px auto 0; font-size: 1.05rem; }
@media (max-width: 480px) { .fc-hero .fc-h1 { font-size: 1.75rem; } }
.fc-tools { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.fc-tool { background: var(--fc-surface); border: 1px solid var(--fc-border); border-top: 4px solid var(--fc-accent); border-radius: var(--fc-radius);
    padding: 20px; display: flex; flex-direction: column; gap: 10px; color: inherit !important; text-decoration: none; transition: box-shadow 0.15s, transform 0.15s; }
.fc-tool:hover { box-shadow: 0 6px 20px rgba(15, 23, 42, 0.08); transform: translateY(-2px); }
.fc-tool h2 { font-size: 1.2rem; font-weight: 700; }
.fc-tool p { color: var(--fc-text-2); }
.fc-tool ul { margin: 0; padding-left: 18px; color: var(--fc-muted); font-size: 0.9rem; display: grid; gap: 2px; }
.fc-tool .fc-tool-cta { margin-top: auto; color: var(--fc-accent); font-weight: 600; }
.fc-tool--pension { border-top-color: #54A24B; }
.fc-tool--loan { border-top-color: #F58518; }
.fc-tool--deposit { border-top-color: #4C78A8; }

/* Окно выбора языка при первом заходе (js/localization.js) */
.fc-lang-dialog { border: 0; border-radius: 16px; padding: 26px 24px 24px; width: min(92vw, 400px); background: var(--fc-surface); color: var(--fc-text);
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.35); text-align: center; font-family: inherit; }
.fc-lang-dialog::backdrop { background: rgba(15, 23, 42, 0.55); }
.fc-lang-dialog h2 { margin: 0 0 18px; font-size: 1.1rem; font-weight: 600; line-height: 1.55; }
.fc-lang-dialog h2 span { display: block; }
.fc-lang-options { display: grid; gap: 10px; }
.lang-btn.fc-lang-option, .lang-btn.fc-lang-option.is-active { padding: 14px; border-radius: 12px; border: 1px solid var(--fc-border-strong); background: #fff;
    color: var(--fc-text); font-size: 1.05rem; font-weight: 600; cursor: pointer; }
.lang-btn.fc-lang-option:hover, .lang-btn.fc-lang-option:focus-visible { border-color: var(--fc-accent); background: var(--fc-accent-soft); outline: none; }

/* Стартовая страница собранного сайта: ссылки на языки (scripts/build-site.mjs) */
.fc-lang-page { display: grid; gap: 10px; width: min(92vw, 400px); margin: 0 auto; }
a.lang-btn.fc-lang-option { display: block; text-align: center; text-decoration: none; }

/* Текстовый блок под калькулятором: как считаем, вопросы и ответы, источники (scripts/build-site.mjs, content/*.json) */
.fc-article { max-width: 820px; margin: 40px 0 0; color: var(--fc-text-2); }
.fc-article .fc-h2 { font-size: 1.35rem; font-weight: 700; color: var(--fc-text); margin: 32px 0 12px; }
.fc-article .fc-h2:first-child { margin-top: 0; }
.fc-article .fc-h3 { margin: 20px 0 8px; color: var(--fc-text); }
.fc-article p { margin: 0 0 10px; }
.fc-article ul { margin: 0 0 12px; padding-left: 20px; display: grid; gap: 6px; }
.fc-faq { display: grid; gap: 8px; }
.fc-faq details { background: var(--fc-surface); border: 1px solid var(--fc-border); border-radius: 10px; padding: 12px 14px; }
.fc-faq summary { cursor: pointer; font-weight: 600; color: var(--fc-text); }
.fc-faq details[open] summary { margin-bottom: 8px; }
.fc-faq details p { margin: 0; }
.fc-sources { list-style: none; padding-left: 0; }
.fc-article .fc-disclaimer { margin-top: 20px; }

/* Переключатель «сегодняшние деньги / будущие тенге» над результатами пенсионного калькулятора */
.fc-money { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 12px; }
.fc-money-note { margin: 8px 0 0; font-size: 0.85rem; }
