/* === Manrope (vendor, SIL OFL 1.1) — фирменный шрифт локально (без сторонних запросов) === */
@font-face {
    font-family: 'Manrope';
    font-style: normal;
    font-weight: 200 800;
    font-display: swap;
    src: url('../vendor/fonts/manrope/manrope-cyrillic-ext.woff2') format('woff2');
    unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
@font-face {
    font-family: 'Manrope';
    font-style: normal;
    font-weight: 200 800;
    font-display: swap;
    src: url('../vendor/fonts/manrope/manrope-cyrillic.woff2') format('woff2');
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
    font-family: 'Manrope';
    font-style: normal;
    font-weight: 200 800;
    font-display: swap;
    src: url('../vendor/fonts/manrope/manrope-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Manrope';
    font-style: normal;
    font-weight: 200 800;
    font-display: swap;
    src: url('../vendor/fonts/manrope/manrope-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* === Accessibility === */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 9999;
    padding: 8px 16px;
    background: var(--primary);
    color: #fff;
    border-radius: 0 0 8px 8px;
    font-size: 14px;
    text-decoration: none;
}
.skip-link:focus {
    left: 0;
}
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

:root {
    color-scheme: light;
    /* === Primary === */
    --primary: #5a52e0;
    --primary-light: #6c63ff;
    --primary-mid: #4840cc;
    --primary-dark: #3a34b0;
    --primary-bright: #8b83ff;
    --primary-rgb: 90, 82, 224;
    --primary-soft: #d0d0f0;
    --info: #0dcaf0;
    --info-rgb: 13, 202, 240;

    /* === Accent === */
    --accent: #00b8d4;
    --accent-hover: #009db5;
    --accent-secondary: #e0457b;
    --accent-rgb: 0, 184, 212;

    /* === Backgrounds === */
    --bg-base: #e4e6f4;
    --bg-surface: rgba(255, 255, 255, 0.72);
    --bg-surface-hover: rgba(255, 255, 255, 0.88);
    --bg-card: #f6f7fc;
    --bg-card-hover: #eef0fa;
    /* Непрозрачная поверхность для sticky/floating-панелей (action-бары, toast):
       --bg-card в dark — полупрозрачное стекло, плавающим элементам нужен solid */
    --bg-float: #f6f7fc;
    --bg-secondary: rgba(0, 0, 0, 0.03);
    /* === Paper / Stamp (doc-cards, Р7) === */
    --paper-bg: #fdfbf5;
    --paper-bg-hover: #f8f3e6;
    --paper-fold: #e9e3d0;
    --paper-edge: rgba(140, 120, 60, 0.16);
    --stamp-color: #2e6b53;
    --stamp-doc-color: #2c4a7c;
    --bg-header: rgba(228, 230, 244, 0.92);
    --bg-footer: #dfe1f0;
    --bg-tooltip: #1a1a2e;
    --text-tooltip: #e4e4f0;

    /* === Text === */
    --text-main: #1a1a2e;
    --text-secondary: #4a4a68;
    --text-muted: #6a6a88;
    --text-on-primary: #ffffff;
    --text-on-accent: #0b0b1a;

    /* === Borders === */
    --border: rgba(90, 82, 224, 0.10);
    --border-color: #e0e0e0;
    --border-focus: #5a52e0;
    --border-subtle: rgba(255,255,255,0.15);
    --glass-border: rgba(90, 82, 224, 0.10);
    --glass-border-hover: rgba(90, 82, 224, 0.20);

    /* === Glow / Shadow === */
    --glow-primary: 0 0 20px rgba(90, 82, 224, 0.15);
    --glow-accent: 0 0 20px rgba(var(--accent-rgb), 0.12);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 24px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.10);
    --shadow-hover: 0 8px 32px rgba(0, 0, 0, 0.12);

    /* === Buttons === */
    --btn-primary-bg: #5a52e0;
    --btn-primary-text: #ffffff;
    --btn-primary-hover-bg: #6c63ff;
    --btn-primary-hover-text: #ffffff;

    --btn-accent-bg: #00b8d4;
    --btn-accent-text: #0b0b1a;
    --btn-accent-hover-bg: #009db5;
    --btn-accent-hover-text: #0b0b1a;

    --btn-outline-border: #5a52e0;
    --btn-outline-text: #5a52e0;
    --btn-outline-hover-bg: #5a52e0;
    --btn-outline-hover-text: #ffffff;

    /* === Misc === */
    --radius: 14px;
    --radius-sm: 8px;
    --radius-lg: 20px;
    --transition: 0.3s ease;
    --font-main: "Manrope", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    --container-max: 1140px;
    --header-height: 64px;

    /* === Spacing scale === */
    --space-xs: 4px; --space-sm: 8px; --space-md: 12px; --space-lg: 16px;
    --space-xl: 20px; --space-2xl: 24px; --space-3xl: 28px; --space-4xl: 32px;

    --badge-msp-bg: #e3f2fd;
    --badge-msp-text: #1565c0;
    --badge-msp-border: #90caf9;
    --badge-sez-bg: #e8f5e9;
    --badge-sez-text: #2e7d32;
    --badge-sez-border: #a5d6a7;

    --success: #28a745;
    --success-rgb: 40, 167, 69;
    --danger: #dc3545;
    --danger-rgb: 220, 53, 69;
    --error: #ff6b6b;
    --error-rgb: 255, 107, 107;
    --warning: #f59e0b;
    --warning-rgb: 245, 158, 11;
    --warning-text: #856404;
    --warning-orange: #e67e22;
    --warning-bg: #fff3cd;
    --warning-border: #ffc107;

    --alert-success-bg: #d4edda;
    --alert-success-border: #bee5c0;
    --alert-success-text: #155724;
    --alert-danger-bg: #f8d7da;
    --alert-danger-border: #f5c6cb;
    --alert-danger-text: #721c24;
    --alert-warning-bg: #fff3cd;
    --alert-warning-border: #ffeeba;
    --alert-info-bg: #d1ecf1;
    --alert-info-border: #bee5eb;
    --alert-info-text: #0c5460;

    --xlsx-bg: #1d6f42;
    --xlsx-border: #1a6539;
    --xlsx-hover-bg: #228b53;
    --xlsx-hover-border: #1d6f42;

    --docx-bg: #2b5797;
    --docx-border: #234a82;
    --docx-hover-bg: #3568ad;
    --docx-hover-border: #2b5797;

    --badge-register-rgb: 0, 200, 83;
    --badge-pwd-rgb: 255, 145, 0;
    --badge-logout-rgb: 128, 128, 160;

    --dot-success: #43a047;
    --dot-warning: #ff9800;
    --dot-danger: #e53935;

    --calc-success-rgb: 76, 175, 80;
    --calc-warning-rgb: 255, 193, 7;
    --calc-accent-rgb: 33, 150, 243;
    --calc-blue-rgb: 13, 110, 253;
    --calc-success-dark-rgb: 25, 135, 84;
    --accent-secondary-rgb: 224, 69, 123;
    /* = --bg-tooltip #1a1a2e — менять вместе */
    --bg-tooltip-rgb: 26, 26, 46;

    --toast-bg: #1a1a2e;
    --toast-text: #ffffff;
    --border-warning: #ffc107;
    --badge-forecast-bg: #fff3e0;
    --badge-forecast-text: #e65100;
    --badge-forecast-border: #ffb74d;
    --best-row-bg: rgba(67, 160, 71, 0.12);
    --panel-sources-bg: #e3f2fd;
    --panel-sources-border: #bbdefb;
    --panel-warning-bg: #fff3e0;
    --panel-warning-border: #ffe0b2;
}

/* Global focus-visible — keyboard navigation outline (WCAG 2.4.7) */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Inputs: suppress outline to avoid double border+outline overlap (border+box-shadow handled per component) */
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.form-input:focus-visible,
.form-control:focus-visible { outline: none; }

/* ===== Dark Theme ===== */
[data-theme="dark"] {
    color-scheme: dark;
    --primary: #6c63ff;
    --primary-light: #8b83ff;
    --primary-mid: #5a52e0;
    --primary-dark: #4840cc;
    --primary-bright: #a8a2ff;
    --primary-rgb: 108, 99, 255;
    --primary-soft: rgba(108, 99, 255, 0.15);
    --info: #00e5ff;
    --info-rgb: 0, 229, 255;

    --accent: #00e5ff;
    --accent-hover: #00c8e0;
    --accent-secondary: #ff6b9d;
    --accent-rgb: 0, 229, 255;

    --bg-base: #0d0d1a;
    --bg-surface: rgba(255, 255, 255, 0.04);
    --bg-surface-hover: rgba(255, 255, 255, 0.08);
    --bg-card: rgba(255, 255, 255, 0.08);
    --bg-card-hover: rgba(255, 255, 255, 0.12);
    --bg-float: #1a1a2e;
    --bg-secondary: rgba(255, 255, 255, 0.05);
    /* === Paper / Stamp (doc-cards, Р7) — приглушённый тёплый вариант === */
    --paper-bg: rgba(255, 250, 235, 0.07);
    --paper-bg-hover: rgba(255, 250, 235, 0.11);
    --paper-fold: rgba(255, 250, 235, 0.15);
    --paper-edge: rgba(255, 250, 235, 0.14);
    --stamp-color: #8fd4b4;
    --stamp-doc-color: #9db8e8;
    --bg-header: rgba(13, 13, 26, 0.92);
    --bg-footer: #121220;
    --bg-tooltip: #1a1a2e;
    --text-tooltip: #e4e4f0;

    --text-main: #e4e4f0;
    --text-secondary: #a0a0c0;
    --text-muted: #9a9ab8;
    --text-on-primary: #ffffff;
    --text-on-accent: #0b0b1a;

    --toast-bg: #f0f0f5;
    --toast-text: #1a1a2e;

    --border: rgba(108, 99, 255, 0.12);
    --border-color: rgba(255, 255, 255, 0.12);
    --border-focus: #6c63ff;
    --border-subtle: rgba(255,255,255,0.08);
    --glass-border: rgba(108, 99, 255, 0.12);
    --glass-border-hover: rgba(108, 99, 255, 0.24);

    --glow-primary: 0 0 20px rgba(108, 99, 255, 0.3);
    --glow-accent: 0 0 20px rgba(var(--accent-rgb), 0.25);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.5);
    --shadow-hover: 0 8px 32px rgba(0, 0, 0, 0.5);

    --btn-primary-bg: #6c63ff;
    --btn-primary-text: #ffffff;
    --btn-primary-hover-bg: #8b83ff;
    --btn-primary-hover-text: #ffffff;

    --btn-accent-bg: #00e5ff;
    --btn-accent-text: #0b0b1a;
    --btn-accent-hover-bg: #00c8e0;
    --btn-accent-hover-text: #0b0b1a;

    --btn-outline-border: #6c63ff;
    --btn-outline-text: #6c63ff;
    --btn-outline-hover-bg: #6c63ff;
    --btn-outline-hover-text: #ffffff;

    --badge-msp-bg: #1a237e;
    --badge-msp-text: #90caf9;
    --badge-msp-border: #3949ab;
    --badge-sez-bg: #1b5e20;
    --badge-sez-text: #a5d6a7;
    --badge-sez-border: #2e7d32;
    --warning: #fbbf24;
    --warning-rgb: 251, 191, 36;
    --warning-text: #ffc832;
    --warning-orange: #f97316;

    --alert-danger-bg: rgba(var(--error-rgb), 0.1);
    --alert-danger-border: rgba(var(--error-rgb), 0.2);
    --alert-danger-text: var(--error);
    --alert-warning-bg: rgba(255, 200, 50, 0.1);
    --alert-warning-border: rgba(255, 200, 50, 0.2);
    --alert-info-bg: rgba(var(--accent-rgb), 0.1);
    --alert-info-border: rgba(var(--accent-rgb), 0.2);
    --alert-info-text: var(--info);

    --xlsx-bg: #217346;
    --xlsx-border: #2a8a56;
    --xlsx-hover-bg: #2a8a56;
    --xlsx-hover-border: #33a066;

    --docx-bg: #2b5797;
    --docx-border: #3568ad;
    --docx-hover-bg: #3568ad;
    --docx-hover-border: #4a7ec4;

    --dot-success: #66bb6a;
    --dot-warning: #ffb74d;
    --dot-danger: #ef5350;
    --accent-secondary-rgb: 255, 107, 157;
    /* = --bg-tooltip #1a1a2e — менять вместе */
    --bg-tooltip-rgb: 26, 26, 46;

    --success: #43a047;
    --success-rgb: 67, 160, 71;
    --danger: #ef5350;
    --danger-rgb: 239, 83, 80;
    --error: #ff6b6b;
    --error-rgb: 255, 107, 107;
    --warning-bg: rgba(255, 193, 7, 0.12);
    --warning-border: #ffc107;
    --border-warning: #ffc107;
    --badge-forecast-bg: rgba(230, 81, 0, 0.15);
    --badge-forecast-text: #ff9800;
    --badge-forecast-border: #e65100;
    --best-row-bg: rgba(102, 187, 106, 0.15);
    --panel-sources-bg: #0d2137;
    --panel-sources-border: #1a3a5c;
    --panel-warning-bg: #2a1f0d;
    --panel-warning-border: #4a3518;
}
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: var(--header-height); background-color: var(--bg-base); color: var(--text-main); }

body {
    font-family: var(--font-main);
    font-size: 16px;
    line-height: 1.65;
    color: var(--text-main);
    background-color: var(--bg-base);
    background-image:
        radial-gradient(ellipse 80% 50% at 50% -10%, rgba(90, 82, 224, 0.05), transparent),
        radial-gradient(circle, rgba(90, 82, 224, 0.03) 1px, transparent 1px);
    background-size: 100% 100%, 22px 22px;
    background-attachment: fixed;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color var(--transition), color var(--transition);
    -webkit-font-smoothing: antialiased;
}

[data-theme="dark"] body {
    background-image:
        radial-gradient(ellipse 80% 50% at 50% -10%, rgba(var(--primary-rgb), 0.06), transparent),
        radial-gradient(circle, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
}

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-light); }
.link-primary { color: var(--primary); text-decoration: underline; font-weight: 500; transition: color var(--transition); }
.link-primary:hover { color: var(--primary-light); }

img { max-width: 100%; display: block; }

/* ===== Layout ===== */
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 24px;
    width: 100%;
}

.main { flex: 1; padding: 0; }

/* ===== Glass ===== */
.glass {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    transition: background var(--transition), border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.glass:hover {
    background: var(--bg-card-hover);
    border-color: var(--glass-border-hover);
}

.glass-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(10px);
}

/* ===== Header ===== */
.header {
    background: var(--bg-header);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    color: var(--text-main);
    height: var(--header-height);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background-color var(--transition);
}

.header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, var(--accent) 50%, transparent 100%);
    opacity: 0.6;
    pointer-events: none;
}

.header__inner {
    display: flex;
    align-items: center;
    height: 100%;
    gap: 24px;
}

.header__logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    transition: opacity var(--transition);
}

.header__logo:hover { opacity: 0.8; }

.header__logo-img { height: 44px; width: auto; display: block; }

.header__nav {
    display: flex;
    gap: 4px;
    flex: 1;
}

.header__nav-link {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    transition: color var(--transition), background-color var(--transition);
    text-decoration: none;
}

.header__nav-link:hover {
    color: var(--text-main);
    background-color: var(--bg-surface-hover);
}

.header__actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ===== Avatar user menu (Шаг 1 v2) ===== */
.header__user {
    margin-left: auto;
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}
.header__avatar-btn {
    display: inline-flex; align-items: center; justify-content: center;
    background: none; border: 2px solid transparent; border-radius: 50%;
    padding: 0; cursor: pointer; line-height: 0;
}
.header__avatar-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.header__avatar {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 50%; color: #fff;
    font-size: 14px; font-weight: 700; line-height: 1; user-select: none;
}
.header__avatar--lg { width: 40px; height: 40px; font-size: 18px; }
.header__avatar-menu {
    position: absolute; top: calc(100% + 8px); right: 0; min-width: 220px;
    z-index: 200; background: var(--bg-surface); border: 1px solid var(--glass-border);
    border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,0.18);
    padding: 8px; display: flex; flex-direction: column; gap: 2px;
}
.header__avatar-menu[hidden] { display: none; }
.header__avatar-menu-header {
    display: flex; align-items: center; gap: 10px; padding: 8px 10px 10px;
    border-bottom: 1px solid var(--glass-border); margin-bottom: 4px;
}
.header__avatar-menu-email {
    font-size: 13px; color: var(--text-muted); max-width: 160px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.header__avatar-menu-item {
    display: flex; align-items: center; gap: 10px; padding: 9px 10px;
    border-radius: 8px; font-size: 14px; color: var(--text-main);
    text-decoration: none; cursor: pointer; background: none; border: none;
    width: 100%; font-family: inherit; font-weight: inherit; text-align: left;
    transition: background-color 0.15s, color 0.15s;
}
.header__avatar-menu-item:hover, .header__avatar-menu-item:focus-visible {
    background: rgba(var(--primary-rgb), 0.08); color: var(--text-main); outline: none;
}
.header__avatar-menu-item--danger { color: var(--danger); }
.header__avatar-menu-item--danger:hover, .header__avatar-menu-item--danger:focus-visible {
    background: rgba(var(--danger-rgb), 0.12); color: var(--danger);
}
.header__avatar-menu-icon { width: 18px; height: 18px; flex-shrink: 0; color: currentColor; }
.header__avatar-menu-form { margin: 0; }
.header__avatar-menu-form .header__avatar-menu-item { width: 100%; }
.header__avatar-menu-badge {
    margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700; color: #fff; background: var(--danger); border-radius: 9px;
}
:root:not([data-theme="dark"]) .header__avatar-menu { background: rgba(255, 255, 255, 0.96); }
[data-theme="dark"] .header__avatar-menu { background: rgba(20, 20, 35, 0.96); border-color: rgba(var(--primary-rgb), 0.15); }

.header__burger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.header__burger span {
    display: block;
    width: 22px;
    height: 2px;
    background-color: var(--text-main);
    border-radius: 1px;
    transition: transform var(--transition);
}

/* ===== Theme Toggle ===== */
.theme-toggle {
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-main);
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition), transform 0.2s ease;
    position: relative;
    overflow: hidden;
}

.theme-toggle:hover {
    border-color: var(--accent);
    box-shadow: var(--glow-accent);
    background: var(--bg-surface-hover);
    transform: scale(1.08);
}

.theme-toggle__icon {
    width: 20px;
    height: 20px;
    position: absolute;
    transition: opacity var(--transition), transform var(--transition);
}

.theme-toggle__icon--sun { opacity: 0; transform: rotate(-30deg) scale(0.8); }
.theme-toggle__icon--moon { opacity: 1; transform: rotate(0deg) scale(1); }

[data-theme="dark"] .theme-toggle__icon--sun { opacity: 1; transform: rotate(0deg) scale(1); }
[data-theme="dark"] .theme-toggle__icon--moon { opacity: 0; transform: rotate(30deg) scale(0.8); }

/* ===== Footer ===== */
.footer {
    background: var(--bg-footer);
    border-top: 1px solid var(--glass-border);
    color: var(--text-secondary);
    padding: 16px 0 12px;
    font-size: 0.82rem;
    transition: background-color var(--transition), color var(--transition);
}

.footer__rates {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    padding-bottom: 10px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--glass-border);
}

.footer__rates-date {
    width: 100%;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    opacity: 0.9;
    margin-bottom: 2px;
}

.footer__rate-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-muted);
    transition: color var(--transition);
    cursor: default;
}

.footer__rate-item:hover { color: var(--accent); }

.footer__rate-label {
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

.footer__rate-value {
    color: var(--accent);
    font-weight: 600;
    margin-left: 2px;
    font-variant-numeric: tabular-nums;
}

.footer__requisites {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px 20px;
    flex-wrap: wrap;
    padding-bottom: 10px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--glass-border);
}

.footer__req-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-decoration: none;
    transition: color var(--transition);
}

.footer__req-item:hover { color: var(--accent); }

.footer__req-item--copy { cursor: pointer; }
.footer__req-item--copy:hover { color: var(--accent); }
.footer__req-item--copy.copied { color: var(--accent-secondary); }
.footer__req-item--copy.copied .footer__icon { color: var(--accent-secondary); filter: drop-shadow(0 0 4px var(--accent-secondary)); }

.footer__icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: var(--text-muted);
    transition: color var(--transition), filter var(--transition);
}

.footer__req-item:hover .footer__icon,
.footer__rate-item:hover .footer__icon {
    color: var(--accent);
    filter: drop-shadow(0 0 4px var(--accent));
}

.footer__counters {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding-bottom: 8px;
}

.footer__counter-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 0;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.footer__counter-badge:hover {
    border-color: var(--accent);
    box-shadow: var(--glow-accent);
    transform: translateY(-1px);
}

.footer__counter-badge img { display: block; border-radius: 2px; }

.footer__copy {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    opacity: 0.8;
}

/* ===== Alerts ===== */
.alert { padding: 14px 18px; border-radius: var(--radius); margin-bottom: 16px; font-size: 0.95rem; }
.alert--success { background: var(--alert-success-bg); border: 1px solid var(--alert-success-border); color: var(--alert-success-text); }
.alert--danger { background: var(--alert-danger-bg); border: 1px solid var(--alert-danger-border); color: var(--alert-danger-text); }
.alert--warning { background: var(--alert-warning-bg); border: 1px solid var(--alert-warning-border); color: var(--warning-text); }
.alert--info { background: var(--alert-info-bg); border: 1px solid var(--alert-info-border); color: var(--alert-info-text); }

[data-theme="dark"] .alert--success { background: rgba(108, 255, 168, 0.1); border: 1px solid rgba(108, 255, 168, 0.2); color: #6cffa8; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    font-size: 0.95rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
    transition: background-color var(--transition), transform 0.1s, box-shadow var(--transition), color var(--transition);
}

.btn:active { transform: scale(0.97); }

.btn--primary {
    background-color: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    box-shadow: var(--shadow-sm);
}
.btn--primary:hover {
    background-color: var(--btn-primary-hover-bg);
    color: var(--btn-primary-hover-text);
    box-shadow: var(--glow-primary);
}

.btn--accent {
    background-color: var(--btn-accent-bg);
    color: var(--btn-accent-text);
    box-shadow: var(--shadow-sm);
}
.btn--accent:hover {
    background-color: var(--btn-accent-hover-bg);
    color: var(--btn-accent-hover-text);
    box-shadow: var(--glow-accent);
}

.btn--outline {
    background: transparent;
    border: 2px solid var(--btn-outline-border);
    color: var(--btn-outline-text);
}
.btn--outline:hover {
    background-color: var(--btn-outline-hover-bg);
    color: var(--btn-outline-hover-text);
    border-color: var(--btn-outline-hover-bg);
}

.btn--ghost {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
}
.btn--ghost:hover {
    background: var(--bg-surface-hover);
    color: var(--text-main);
    border-color: var(--glass-border-hover);
}

.btn--secondary {
    background: var(--bg-surface);
    color: var(--text-main);
    border: 1px solid var(--glass-border);
}
.btn--secondary:hover {
    background: var(--bg-surface-hover);
    border-color: var(--glass-border-hover);
}

.btn--xlsx {
    background: var(--xlsx-bg);
    color: #fff;
    border: 1px solid var(--xlsx-border);
}
.btn--xlsx:hover {
    background: var(--xlsx-hover-bg);
    border-color: var(--xlsx-hover-border);
}
.btn--xlsx svg {
    filter: brightness(0) invert(1);
}
[data-theme="dark"] .btn--xlsx {
    background: var(--xlsx-bg);
    border-color: var(--xlsx-border);
}
[data-theme="dark"] .btn--xlsx:hover {
    background: var(--xlsx-hover-bg);
    border-color: var(--xlsx-hover-border);
}
.btn--docx {
    background: var(--docx-bg);
    color: #fff;
    border: 1px solid var(--docx-border);
}
.btn--docx:hover {
    background: var(--docx-hover-bg);
    border-color: var(--docx-hover-border);
}
.btn--docx svg {
    filter: brightness(0) invert(1);
}
[data-theme="dark"] .btn--docx {
    background: var(--docx-bg);
    border-color: var(--docx-border);
}
[data-theme="dark"] .btn--docx:hover {
    background: var(--docx-hover-bg);
    border-color: var(--docx-hover-border);
}
.btn--disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

/* ---- Print-only elements: hidden on screen (SHARED, используется в
     calculator_base.html, calc_*.html) ---- */
.print-only {
    display: none;
}

.btn--block { width: 100%; }

.btn--danger {
    background: linear-gradient(135deg, #ff6b6b, #e0457b);
    color: #fff;
    border: none;
}
.btn--danger:hover {
    background: linear-gradient(135deg, #ff8585, #f06292);
    box-shadow: 0 0 20px rgba(var(--error-rgb), 0.3);
}
[data-theme="dark"] .btn--danger {
    background: linear-gradient(135deg, #ff8585, #f06292);
    color: var(--bg-tooltip);
}
[data-theme="dark"] .btn--danger:hover {
    background: linear-gradient(135deg, #ffa0a0, #ff80ab);
    box-shadow: 0 0 20px rgba(var(--error-rgb), 0.25);
}

/* ===== Header accent link ===== */
.header__nav-link--accent {
    color: var(--accent);
    font-weight: 600;
}
.header__nav-link--accent:hover {
    color: var(--accent-hover);
    background: rgba(var(--accent-rgb), 0.08);
}

/* ===== Auth ===== */
.section--auth {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - var(--header-height) - 200px);
    padding: 40px 24px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow-md);
}

.auth-card__title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 20px;
    text-align: center;
    color: var(--text-main);
}

.auth-form .form-group { margin-bottom: 18px; }

.auth-form .form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-main);
}

.auth-form .form-input {
    width: 100%;
    padding: 11px 14px;
    font-size: 0.95rem;
    font-family: var(--font-main);
    color: var(--text-main);
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.auth-form .form-input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: var(--glow-primary);
    background: var(--bg-surface-hover);
}

.auth-form .form-input--error {
    border-color: var(--error);
    background: rgba(var(--error-rgb), 0.04);
}
[data-theme="dark"] .auth-form .form-input--error {
    border-color: #ff8585;
    background: rgba(var(--error-rgb), 0.08);
}

/* Select dropdown readability in dark theme */
select.form-input option {
    background: var(--bg-card);
    color: var(--text-main);
}
[data-theme="dark"] select option {
    background: var(--bg-tooltip);
    color: var(--text-main);
}
[data-theme="dark"] select.form-input option {
    background: var(--bg-tooltip);
    color: var(--text-main);
}

/* Dark theme form inputs */
[data-theme="dark"] input.form-input,
[data-theme="dark"] select.form-input,
[data-theme="dark"] textarea.form-input {
    background: #0b1220;
    color: var(--text-main);
    border-color: var(--glass-border);
}
input.form-input::placeholder,
textarea.form-input::placeholder {
    color: var(--text-muted);
    opacity: 0.45;
    font-style: italic;
    font-size: 0.92em;
}
[data-theme="dark"] input.form-input::placeholder,
[data-theme="dark"] textarea.form-input::placeholder {
    color: var(--text-muted);
    opacity: 0.45;
    font-style: italic;
    font-size: 0.92em;
}
[data-theme="dark"] input.form-input:focus,
[data-theme="dark"] select.form-input:focus,
[data-theme="dark"] textarea.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.2);
}
[data-theme="dark"] .form-label {
    color: var(--text-secondary);
}

.form-input--disabled,
.form-input:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    background: var(--bg-card);
}
.btn--disabled,
.btn--disabled:hover {
    opacity: 0.5;
    cursor: not-allowed;
}

.auth-form .form-error {
    display: block;
    color: var(--error);
    font-size: 0.82rem;
    margin-top: 4px;
}
[data-theme="dark"] .auth-form .form-error {
    color: #ff8585;
}

.auth-footer {
    text-align: center;
    margin-top: 16px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--accent);
    font-weight: 500;
}
.auth-footer a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* ===== Profile (Tabbed Layout) ===== */
.section--profile {
    padding: 32px 24px;
}

.profile-wrapper {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 24px;
    max-width: 1100px;
    margin: 0 auto;
    align-items: start;
}

/* --- Sidebar --- */
.profile-sidebar {
    position: sticky;
    top: calc(var(--header-height) + 24px);
}

.profile-usercard {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    margin-bottom: 16px;
}

.profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-mid));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    box-shadow: var(--glow-primary);
}
.profile-avatar svg {
    width: 28px;
    height: 28px;
}

.profile-usermail {
    display: block;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-main);
    word-break: break-all;
}

.profile-userrole {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.profile-usernick {
    display: block;
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 2px;
    word-break: break-all;
}

/* --- Balance Widget (Sidebar) --- */
.profile-balance {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.profile-balance:hover {
    border-color: var(--glass-border-hover);
    box-shadow: var(--shadow-sm);
}

.profile-balance__plan-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 4px;
}

.profile-balance__features {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.profile-balance__divider {
    height: 1px;
    background: var(--glass-border);
    margin: 12px 0;
}

.profile-balance__pro {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.profile-balance__pro-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent);
}

/* --- Quicknav «Быстрый переход» (Sidebar, Р3) --- */
.quicknav {
    position: relative;
    margin-bottom: 16px;
}
.quicknav__label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.quicknav__field {
    position: relative;
}
.quicknav__field svg {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    width: 15px;
    height: 15px;
    color: var(--text-muted);
    pointer-events: none;
}
.quicknav__input {
    width: 100%;
    padding: 9px 12px 9px 33px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-surface);
    color: var(--text-main);
    font-size: 0.9rem;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.quicknav__input::placeholder {
    color: var(--text-muted);
    opacity: 0.75;
}
.quicknav__input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.12);
}
/* Список — оверлей поверх вкладок (z-index, как у avatar-меню): сайдбар sticky,
   inline-раскрытие уносило бы вкладки/футер за край экрана и дёргало layout */
.quicknav__list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 500;
    list-style: none;
    margin: 6px 0 0;
    padding: 6px;
    max-height: 316px;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
}
.quicknav__item {
    border-radius: 8px;
}
.quicknav__link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    color: var(--text-main);
    font-size: 0.88rem;
    text-decoration: none;
    transition: background var(--transition);
}
.quicknav__title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.quicknav__kind {
    flex-shrink: 0;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}
.quicknav__link:hover,
.quicknav__item--active .quicknav__link {
    background: var(--bg-surface-hover);
}
.quicknav__item--active .quicknav__link {
    color: var(--primary);
}
.quicknav__empty {
    padding: 12px 10px;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
}
/* --- Quicknav: закрепы (вариант Б) --- */
.quicknav__item {
    display: flex;
    align-items: center;
    gap: 2px;
}
.quicknav__item .quicknav__link {
    flex: 1;
    min-width: 0;
}
.quicknav__pins-head {
    padding: 6px 10px 4px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}
.quicknav__pins-hint {
    padding: 10px;
    font-size: 0.8rem;
    line-height: 1.45;
    color: var(--text-muted);
}
.quicknav__divider {
    height: 1px;
    margin: 4px 6px;
    background: var(--border);
}
.quicknav__item--pin {
    background: rgba(var(--primary-rgb), 0.05);
}
.quicknav__pin-btn {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0.45;
    transition: opacity .15s, color .15s, background .15s;
}
.quicknav__item:hover .quicknav__pin-btn,
.quicknav__pin-btn:focus-visible {
    opacity: 1;
}
.quicknav__pin-btn:hover {
    color: var(--primary);
    background: rgba(var(--primary-rgb), 0.10);
}
.quicknav__pin-btn:focus-visible {
    outline: 2px solid var(--border-focus);
    outline-offset: 1px;
}
.quicknav__pin-btn--active {
    color: var(--primary);
    opacity: 1;
}
[data-theme="dark"] .quicknav__input {
    background: #0b1220;
    border-color: var(--glass-border);
    color: var(--text-main);
}
[data-theme="dark"] .quicknav__list {
    background: var(--bg-tooltip);
    border-color: var(--glass-border);
}
[data-theme="dark"] .quicknav__link:hover,
[data-theme="dark"] .quicknav__item--active .quicknav__link {
    background: rgba(255, 255, 255, 0.07);
}

/* --- Tabs --- */
.profile-tabs__arrow { display: none; } /* стрелки прокрутки — только mobile (@media ≤768px) */

.profile-tabs {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 16px;
}

.profile-tab {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: background var(--transition), color var(--transition);
}
.profile-tab:hover {
    background: var(--bg-surface-hover);
    color: var(--text-main);
}
.profile-tab--active {
    background: var(--bg-surface);
    color: var(--primary);
    border: 1px solid var(--glass-border);
}
.profile-tab svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.profile-sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn--sm {
    padding: 8px 14px;
    font-size: 0.85rem;
}

/* --- Content --- */
.profile-content {
    min-width: 0;
}

.profile-panel {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 28px 32px;
}

.profile-panel-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--glass-border);
}

/* --- Profile panel helpers (inline style replacements) --- */
.profile-sidebar-footer__form { display: inline; width: 100%; }
.profile-panel-header {
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 12px; margin-bottom: 20px;
}
.profile-panel-header .profile-panel-title {
    margin: 0; padding-bottom: 0; border-bottom: none;
}
.profile-panel-header--top { align-items: flex-start; }
.profile-panel-actions {
    display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 24px;
}
.profile-panel-header .profile-panel-actions { margin-top: 0; }
.profile-hint--spaced { margin-bottom: 20px; }

.deadline-badge {
    font-size: .72rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: .03em;
    white-space: nowrap;
}

.deadline-badge--critical {
    background: rgba(var(--danger-rgb), 0.1);
    color: var(--danger);
}

.deadline-badge--urgent {
    background: rgba(var(--warning-rgb), 0.1);
    color: var(--warning);
}

.deadline-badge--normal {
    background: rgba(var(--success-rgb), 0.1);
    color: var(--success);
}

/* --- Tax calendar page --- */
.tax-calendar-filters {
    margin-bottom: 24px;
}

.tax-calendar-filters__form {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
}

.tax-calendar-filters__form .form-group--inline {
    margin-bottom: 0;
}

.tax-calendar__month {
    margin-bottom: 28px;
}

.tax-calendar__month-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--glass-border);
    text-transform: capitalize;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tax-calendar__count {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.tax-calendar__chevron {
    transition: transform 0.2s;
    display: inline-block;
    margin-left: auto;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.tax-calendar__month[data-collapsed="true"] .tax-calendar__chevron {
    transform: rotate(-90deg);
}

.tax-calendar__month[data-collapsed="true"] .tax-calendar__list {
    display: none;
}

.tax-calendar__list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tax-calendar__item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
}

.tax-calendar__item--critical {
    border-left: 4px solid var(--danger);
}

.tax-calendar__item--urgent {
    border-left: 4px solid var(--warning);
}

.tax-calendar__item--normal {
    border-left: 4px solid var(--success);
}

.tax-calendar__date {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 42px;
}

.tax-calendar__day {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1;
}

.tax-calendar__weekday {
    font-size: .65rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: .05em;
}

.tax-calendar__info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tax-calendar__title {
    font-weight: 600;
    color: var(--text-main);
    font-size: .92rem;
}

.tax-calendar__desc {
    font-size: .78rem;
    color: var(--text-muted);
    line-height: 1.3;
}

.tax-calendar__meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.tax-calendar__system,
.tax-calendar__form,
.tax-calendar__law {
    font-size: .72rem;
    color: var(--text-muted);
    background: var(--bg-card-hover);
    padding: 2px 8px;
    border-radius: 4px;
}

.tax-calendar__badge-wrap {
    min-width: 64px;
    text-align: right;
}

/* --- Tax calendar: styled forms + search --- */
.select-wrap {
    position: relative;
}
.select-wrap::after {
    content: "";
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid var(--text-muted);
    pointer-events: none;
}

.form-select--styled,
.form-input--styled {
    appearance: none;
    -webkit-appearance: none;
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 8px 32px 8px 12px;
    font-size: .88rem;
    color: var(--text-main);
    min-width: 160px;
    cursor: pointer;
    transition: border-color .2s, box-shadow .2s;
}
.form-select--styled:hover,
.form-input--styled:hover {
    border-color: var(--primary);
}
.form-select--styled:focus,
.form-input--styled:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.search-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.search-input-wrap .form-input--styled {
    padding-right: 40px;
    min-width: 220px;
}
.search-btn {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary);
    border: none;
    border-radius: var(--radius-sm);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
    transition: background .2s;
}
.search-btn:hover {
    background: var(--primary-dark);
}
.search-btn svg {
    width: 14px;
    height: 14px;
}

.placeholder-card--center {
    text-align: center;
    padding: 48px 24px;
}
.placeholder-card__icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    color: var(--text-muted);
}
.placeholder-card__text {
    color: var(--text-main);
    font-size: 1rem;
    margin-bottom: 8px;
}
.placeholder-card__hint {
    color: var(--text-muted);
    font-size: .85rem;
}
.placeholder-card__hint a {
    color: var(--primary);
    text-decoration: underline;
}

/* --- Dashboard --- */
.dashboard-onboarding {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 16px 20px;
    margin-bottom: 20px;
}
.dashboard-onboarding__step {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
}
.dashboard-onboarding__num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
}
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.dashboard-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: transform var(--transition), box-shadow var(--transition);
}
.dashboard-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.dashboard-card__icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #fff;
}
.dashboard-card__icon svg {
    width: 22px;
    height: 22px;
}
.dashboard-card__icon--info { background: linear-gradient(135deg, #2962ff, #448aff); }
.dashboard-card__icon--warning { background: linear-gradient(135deg, #ff9100, #ffc400); }
.dashboard-card__icon--purple { background: linear-gradient(135deg, #7c4dff, #b388ff); }
.dashboard-card__icon--calendar { background: linear-gradient(135deg, #ff7043, #ffab40); }
.dashboard-card__icon--continue { background: linear-gradient(135deg, #00897b, #26a69a); }
/* «Продолжить» — текст длинный (название калькулятора): break-all из базового
   __value рвал слова посередине («индексаци-я») — переносим по словам */
.dashboard-card--continue .dashboard-card__value {
    word-break: normal;
    overflow-wrap: break-word;
    line-height: 1.35;
}

.dashboard-card--muted {
    opacity: 0.55;
    background: var(--bg-surface);
    border-style: dashed;
}

.dashboard-card__icon--muted {
    background: linear-gradient(135deg, var(--text-muted), var(--text-secondary));
    color: var(--text-on-primary);
}

.dashboard-card__body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.dashboard-card__value {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
    word-break: break-all;
}
.dashboard-card__label {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* --- Dashboard: mini deadlines inside card --- */
.dashboard-card--calendar {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 16px 20px;
    grid-column: 1 / -1;
}
.dashboard-card--calendar .dashboard-card__icon {
    align-self: flex-start;
    width: 32px;
    height: 32px;
    border-radius: 8px;
}
.dashboard-card--calendar .dashboard-card__icon svg {
    width: 16px;
    height: 16px;
}
.dashboard-card--calendar .dashboard-card__body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
}

.dashboard-mini-deadlines {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.dashboard-mini-deadline {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 5px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: background .15s;
    font-size: .76rem;
    color: var(--text-main);
    line-height: 1.35;
}
.dashboard-mini-deadline:hover {
    background: var(--bg-card-hover);
}

.dashboard-mini-deadline__date {
    font-weight: 700;
    color: var(--text-main);
    min-width: 40px;
    font-size: .72rem;
    flex-shrink: 0;
}

.dashboard-mini-deadline__title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-main);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.3;
}

.dashboard-mini-deadline__badge {
    font-size: .68rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 999px;
    white-space: nowrap;
    flex-shrink: 0;
}

.dashboard-mini-deadline--critical .dashboard-mini-deadline__badge {
    background: rgba(var(--danger-rgb), 0.1);
    color: var(--danger);
}
.dashboard-mini-deadline--urgent .dashboard-mini-deadline__badge {
    background: rgba(var(--warning-rgb), 0.1);
    color: var(--warning);
}
.dashboard-mini-deadline--normal .dashboard-mini-deadline__badge {
    background: rgba(var(--success-rgb), 0.1);
    color: var(--success);
}

/* --- Security mini cards --- */
.security-mini-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 16px;
}
.dashboard-card--compact {
    padding: 12px 16px;
}
.dashboard-card--compact .dashboard-card__icon {
    display: none;
}

/* --- Dashboard links --- */
.dashboard-section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 14px;
}


/* --- Favorites (Quick Access) --- */
/* --- Security --- */
.security-block { margin-bottom: 24px; }
.security-block--danger {
    background: rgba(var(--error-rgb), 0.03);
    border: 1px solid rgba(var(--error-rgb), 0.12);
    border-radius: var(--radius-sm);
    padding: 20px;
    margin-bottom: 0;
}

.security-block__title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 14px;
}
.security-block__title--danger {
    color: var(--error);
}

.security-divider {
    height: 1px;
    background: var(--glass-border);
    margin: 24px 0;
}

/* --- Tickets --- */
.tickets-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.ticket-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: inherit;
    transition: border-color var(--transition), background var(--transition);
    flex-wrap: wrap;
}
.ticket-row:hover {
    border-color: var(--primary-light);
    background: var(--bg-surface-hover);
    color: inherit;
}
.ticket-row--unread {
    border-left: 3px solid var(--primary-light);
}
.ticket-row__meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.ticket-row__subject {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-main);
    word-break: break-word;
}
.ticket-row__date {
    font-size: 0.78rem;
    color: var(--text-muted);
}
.ticket-row__badges {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    flex-wrap: wrap;
}
.ticket-badge {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.ticket-badge--open {
    background: rgba(var(--primary-rgb), 0.08);
    color: var(--primary-light);
}
.ticket-badge--answered {
    background: rgba(var(--accent-rgb), 0.10);
    color: var(--accent);
}
.ticket-badge--closed {
    background: rgba(128, 128, 160, 0.08);
    color: var(--text-muted);
}
.ticket-badge--new {
    background: rgba(var(--error-rgb), 0.10);
    color: var(--error);
}

.ticket-messages {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.ticket-message {
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid var(--glass-border);
}
.ticket-message--user {
    background: var(--bg-surface);
}
.ticket-message--admin {
    background: rgba(var(--primary-rgb), 0.04);
    border-left: 3px solid var(--primary-light);
}
.ticket-message__header {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.ticket-message__author {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-main);
}
.ticket-message--admin .ticket-message__author {
    color: var(--primary-light);
}
.ticket-message__time {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.ticket-message__body {
    font-size: 0.92rem;
    line-height: 1.6;
    color: var(--text-secondary);
    white-space: pre-wrap;
}

/* Ticket reply composer (ticket_detail / admin_ticket_detail; JS: js/ticket.js) */
.reply-composer {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: var(--bg-main);
    border: 1.5px solid var(--glass-border);
    border-radius: 22px;
    padding: 6px 6px 6px 16px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.reply-composer:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.18);
}
.reply-composer__input {
    flex: 1;
    min-height: 38px;
    max-height: 220px;
    padding: 8px 0;
    border: none;
    background: transparent;
    box-shadow: none;
    outline: none;
    resize: none;
    font: inherit;
    color: var(--text-main);
}
.reply-composer__input.form-input--error {
    color: var(--error);
}
.reply-send {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.12s ease, filter 0.12s ease;
}
.reply-send:hover { filter: brightness(1.1); transform: scale(1.06); }
.reply-send:active { transform: scale(0.94); }
.reply-send:disabled,
.reply-send:disabled:hover {
    opacity: 0.45;
    cursor: default;
    transform: none;
    filter: none;
}
.reply-send:focus-visible {
    outline: 2px solid var(--primary-light);
    outline-offset: 2px;
}
.reply-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    padding: 0 4px;
}
.reply-meta__hint {
    font-size: 0.78rem;
    color: var(--text-muted);
}
.reply-meta__hint kbd {
    background: var(--bg-main);
    border: 1px solid var(--glass-border);
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 0.72rem;
    font-family: inherit;
}
.reply-counter {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}
.reply-counter.is-limit {
    color: var(--error);
    font-weight: 600;
}
@media (max-width: 768px) {
    .reply-meta__hint { display: none; } /* kbd-подсказка бессмысленна на тач-клавиатуре */
}

.security-table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--glass-border);
}

.security-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}
.security-table th {
    text-align: left;
    padding: 10px 14px;
    background: var(--bg-surface);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--glass-border);
}
.security-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--glass-border);
    color: var(--text-main);
}
.security-table tr:last-child td {
    border-bottom: none;
}

.security-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
}
.security-badge--login { background: rgba(var(--primary-rgb), 0.1); color: var(--primary-light); }
.security-badge--logout { background: rgba(var(--badge-logout-rgb), 0.1); color: var(--text-muted); }
.security-badge--register { background: rgba(var(--badge-register-rgb), 0.1); color: rgb(var(--badge-register-rgb)); }
.security-badge--change_password { background: rgba(var(--badge-pwd-rgb), 0.1); color: rgb(var(--badge-pwd-rgb)); }
.security-badge--delete_account { background: rgba(var(--error-rgb), 0.1); color: var(--error); }

.security-ip {
    font-family: monospace;
    font-size: 0.85rem;
    color: var(--text-secondary);
    background: var(--bg-surface);
    padding: 2px 6px;
    border-radius: 4px;
}

.security-location {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.auth-form--narrow {
    max-width: 400px;
}

.profile-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 14px;
    line-height: 1.5;
}

.profile-hint--warning {
    color: var(--warning-text);
    background: rgba(255, 200, 50, 0.08);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 200, 50, 0.2);
}

[data-theme="dark"] .profile-hint--warning {
    color: var(--warning-text);
    background: rgba(255, 200, 50, 0.1);
    border-color: rgba(255, 200, 50, 0.25);
}

[data-theme="dark"] .activity-filters {
    background: var(--bg-card);
    border-color: var(--glass-border);
}

[data-theme="dark"] .activity-filter__input,
[data-theme="dark"] .activity-filter__select {
    background: #0b1220;
    color: var(--text-main);
    border-color: var(--glass-border);
}

[data-theme="dark"] .activity-filter__input:focus,
[data-theme="dark"] .activity-filter__select:focus {
    border-color: var(--primary);
}

[data-theme="dark"] .activity-pagination__btn {
    background: var(--bg-card);
    color: var(--text-secondary);
    border-color: var(--glass-border);
}

[data-theme="dark"] .activity-pagination__btn:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

[data-theme="dark"] .activity-pagination__page {
    background: var(--bg-card);
    color: var(--text-secondary);
    border-color: var(--glass-border);
}

[data-theme="dark"] .activity-pagination__page:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

[data-theme="dark"] .activity-pagination__page--active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

[data-theme="dark"] .calc-history__item {
    background: var(--bg-card);
    border-color: var(--glass-border);
}

[data-theme="dark"] .calc-history__tag {
    background: rgba(var(--primary-rgb), 0.12);
}

[data-theme="dark"] .calc-history__rate {
    background: rgba(var(--accent-rgb), 0.12);
}

[data-theme="dark"] .activity-timeline__calc {
    background: var(--bg-card);
    border-color: var(--glass-border);
}

[data-theme="dark"] .activity-timeline__calc-op {
    background: rgba(var(--primary-rgb), 0.12);
}

[data-theme="dark"] .activity-timeline__calc-rate {
    background: rgba(var(--accent-rgb), 0.12);
}

.alert__action {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    color: var(--accent);
    font-weight: 600;
    margin-left: 8px;
    text-decoration: underline;
}

/* Form layout helpers (Шаг F3) */
.form-inline { display: inline; }
.form-row-inline { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.btn--nowrap { white-space: nowrap; }
.form-input--flex { flex: 1; min-width: 160px; }
.delete-confirm-check { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.delete-confirm-check input { margin-top: 2px; }

/* --- Activity Timeline --- */
.activity-timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
    padding-left: 20px;
}
.activity-timeline::before {
    content: '';
    position: absolute;
    left: 5px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: var(--glass-border);
}

.activity-timeline__item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 14px 0;
    position: relative;
}

.activity-timeline__dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--bg-card);
    flex-shrink: 0;
    position: absolute;
    left: -20px;
    top: 18px;
    margin-left: 0;
}

.activity-timeline__content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.activity-timeline__title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
}

.activity-timeline__tag {
    display: inline-flex;
    align-self: flex-start;
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
}

.activity-timeline__meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.activity-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.activity-count {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

/* --- Activity Filters --- */
.activity-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 16px;
    align-items: flex-end;
    margin-bottom: 20px;
    padding: 14px 16px;
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
}

.activity-filter__group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.activity-filter__label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.activity-filter__input,
.activity-filter__select {
    padding: 7px 10px;
    font-size: 0.88rem;
    border-radius: 6px;
    border: 1px solid var(--glass-border);
    background: var(--bg-card);
    color: var(--text-main);
    min-width: 130px;
    font-family: inherit;
    transition: border-color var(--transition);
}

.activity-filter__input:focus,
.activity-filter__select:focus {
    outline: none;
    border-color: var(--primary);
}

.activity-filter__actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

/* --- Activity Pagination --- */
.activity-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--glass-border);
    flex-wrap: wrap;
}

.activity-pagination__btn {
    padding: 6px 12px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    text-decoration: none;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
    cursor: pointer;
    user-select: none;
}

.activity-pagination__btn:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.activity-pagination__btn--disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.activity-pagination__pages {
    display: flex;
    gap: 4px;
    align-items: center;
}

.activity-pagination__page {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    text-decoration: none;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.activity-pagination__page:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.activity-pagination__page--active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: var(--glow-primary);
}

.activity-pagination__ellipsis {
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 0 2px;
    user-select: none;
}

/* --- Dashboard Section Header --- */
.dashboard-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.dashboard-section-link {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition);
}

.dashboard-section-link:hover {
    color: var(--primary);
    text-decoration: underline;
}

/* --- Activity Timeline Top Row --- */
.activity-timeline__top {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}


/* --- Calc History (Dashboard) --- */
.calc-history {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.calc-history__item {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
}

.calc-history__meta {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.calc-history__date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.calc-history__tag {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--primary);
    background: rgba(var(--primary-rgb), 0.08);
    padding: 2px 8px;
    border-radius: 4px;
}

.calc-history__rate {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--accent);
    background: rgba(var(--accent-rgb), 0.08);
    padding: 2px 8px;
    border-radius: 4px;
}

.calc-history__values {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.calc-history__value {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
    font-variant-numeric: tabular-nums;
}

.calc-history__value--primary {
    color: var(--primary);
}

.calc-history__arrow {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.calc-history__detail {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

/* --- Activity Timeline Calc Row --- */
.activity-timeline__calc {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    align-items: center;
    margin-top: 4px;
    padding: 8px 10px;
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    font-variant-numeric: tabular-nums;
}

.activity-timeline__calc-op {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--primary);
    background: rgba(var(--primary-rgb), 0.08);
    padding: 2px 8px;
    border-radius: 4px;
}

.activity-timeline__calc-rate {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--accent);
    background: rgba(var(--accent-rgb), 0.08);
    padding: 2px 8px;
    border-radius: 4px;
}

.activity-timeline__calc-arrow {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.activity-timeline__calc-result {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-main);
}

.activity-timeline__calc-detail {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* --- Security Block Header --- */
.security-block__header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.security-block__count {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

/* --- Placeholder --- */
.placeholder-card {
    text-align: center;
    padding: 48px 24px;
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
}
.placeholder-card--small {
    padding: 32px 24px;
}

.placeholder-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    color: var(--text-muted);
    opacity: 0.5;
}
.placeholder-icon svg {
    width: 100%;
    height: 100%;
}
.placeholder-icon--small {
    width: 40px;
    height: 40px;
}

.placeholder-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 8px;
}
.placeholder-title--small {
    font-size: 1rem;
}

.placeholder-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.6;
}
.placeholder-desc a {
    color: var(--accent);
    font-weight: 500;
}

/* --- Avatar Initials --- */
.profile-avatar__letter {
    font-size: 1.6rem;
    font-weight: 700;
    color: #fff;
    line-height: 1;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* --- Recent Events (Dashboard) --- */
.dashboard-section--recent { margin-top: 8px; }

.recent-events {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.recent-event {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.recent-event:hover {
    transform: translateX(4px);
    border-color: var(--glass-border-hover);
    box-shadow: var(--shadow-sm);
}

.recent-event__icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #fff;
}

.recent-event__icon svg {
    width: 18px;
    height: 18px;
}

.recent-event--login .recent-event__icon { background: linear-gradient(135deg, #00c853, #64dd17); box-shadow: 0 0 10px rgba(0,200,83,0.25); }
.recent-event--logout .recent-event__icon { background: linear-gradient(135deg, #78909c, #b0bec5); box-shadow: 0 0 10px rgba(120,144,156,0.2); }
.recent-event--change_password .recent-event__icon { background: linear-gradient(135deg, #ffc400, #ffab00); box-shadow: 0 0 10px rgba(255,196,0,0.25); }
.recent-event--register .recent-event__icon { background: linear-gradient(135deg, var(--primary), var(--primary-mid)); box-shadow: var(--glow-primary); }
.recent-event--delete_account .recent-event__icon { background: linear-gradient(135deg, #ff6b6b, #e0457b); }

.recent-event__body {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.recent-event__title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-main);
}

.recent-event__time {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* --- Settings --- */
.settings-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 18px;
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    transition: background var(--transition), border-color var(--transition);
}

.settings-row:hover {
    background: var(--bg-surface-hover);
    border-color: var(--glass-border-hover);
}

.settings-row__info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.settings-row__title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
}

.settings-row__desc {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.settings-row--info {
    background: rgba(var(--primary-rgb), 0.04);
    border-style: dashed;
}

.settings-row__badge {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--primary-light);
    background: rgba(var(--primary-rgb), 0.08);
    padding: 4px 10px;
    border-radius: 20px;
    flex-shrink: 0;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
    cursor: pointer;
}

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

.toggle-slider {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--glass-border);
    border-radius: 24px;
    transition: background var(--transition);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform var(--transition), box-shadow var(--transition);
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

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

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

.toggle-switch--disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.toggle-switch--disabled .toggle-slider {
    background: var(--text-muted);
}

.toggle-switch--disabled input:checked + .toggle-slider {
    background: var(--primary);
    opacity: 0.5;
}

/* ===== Auth links (login page) ===== */
.auth-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 18px;
    font-size: 0.88rem;
}

.auth-link {
    color: var(--accent);
    font-weight: 500;
    text-decoration: none;
}
.auth-link:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

.auth-divider {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* --- Profile tablet --- */
@media (min-width: 769px) and (max-width: 1024px) {
    .profile-wrapper {
        grid-template-columns: 220px minmax(0, 1fr);
        gap: 16px;
    }
    .profile-panel {
        padding: 20px;
    }
    .dashboard-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* --- Profile responsive --- */
@media (max-width: 768px) {
    body {
        overflow-x: hidden;    /* fallback: все браузеры */
        overflow-x: clip;      /* progressive: Chrome 90+/FF 81+/Safari 16+ → sticky работает */
    }
    .profile-wrapper {
        grid-template-columns: minmax(0, 1fr);
    }
    .profile-sidebar {
        position: static;
    }
    .profile-usercard { display: none; }
    .profile-avatar { width: 40px; height: 40px; margin: 0; flex-shrink: 0; }
    .profile-avatar__letter { font-size: 1.1rem; }
    .profile-userinfo { min-width: 0; }
    .profile-balance { display: none; }
    /* Р5: мобильная навигация ЛК — горизонтальные скролл-чипсы
       (активная авто-центрируется scrollToActiveProfileTab в main.js) */
    .profile-tabs-wrap {
        position: relative;
        display: flex;
        align-items: center;
        margin: 0 0 12px 0;
    }
    /* Fade-тени по краям — индикатор «за краем есть ещё» */
    .profile-tabs-wrap::before,
    .profile-tabs-wrap::after {
        content: "";
        position: absolute;
        top: 0;
        bottom: 0;
        width: 28px;
        z-index: 1;
        pointer-events: none;
        opacity: 0;
        transition: opacity .2s;
    }
    .profile-tabs-wrap::before {
        left: 0;
        background: linear-gradient(90deg, var(--bg-base), transparent);
    }
    .profile-tabs-wrap::after {
        right: 0;
        background: linear-gradient(-90deg, var(--bg-base), transparent);
    }
    .profile-tabs-wrap:not(.profile-tabs-wrap--at-start)::before { opacity: 1; }
    .profile-tabs-wrap:not(.profile-tabs-wrap--at-end)::after { opacity: 1; }

    .profile-tabs__arrow {
        flex: 0 0 auto;
        width: 28px;
        height: 28px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0;
        margin: 0 2px;
        background: var(--bg-card);
        border: 1px solid var(--glass-border);
        border-radius: 50%;
        color: var(--text-secondary);
        cursor: pointer;
        z-index: 2;
        transition: color .15s, border-color .15s, opacity .15s;
    }
    .profile-tabs__arrow svg { width: 16px; height: 16px; }
    .profile-tabs__arrow:hover { color: var(--primary); border-color: var(--primary); }
    .profile-tabs__arrow:disabled {
        opacity: 0.35;
        cursor: default;
        color: var(--text-muted);
        border-color: var(--glass-border);
    }
    .profile-tabs {
        display: flex;
        flex-direction: row; /* перебиваем десктопный column (style.css:1130) */
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 6px;
        padding: 4px 2px 8px;
        margin: 0;
        background: var(--bg-base);
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x proximity;
    }
    .profile-tabs::-webkit-scrollbar { display: none; }
    .profile-tab {
        flex: 0 0 auto;
        flex-direction: row;
        align-items: center;
        gap: 6px;
        justify-content: center;
        padding: 8px 14px;
        white-space: nowrap;
        text-align: center;
        line-height: 1;
        font-size: 0.8rem;
        border: 1px solid var(--glass-border);
        border-radius: 999px;
        background: var(--bg-card);
        scroll-snap-align: center;
    }
    .profile-tab svg {
        width: 16px;
        height: 16px;
    }
    .profile-tab--active {
        background: var(--primary);
        color: var(--text-on-primary);
        border-color: var(--primary);
    }
    .profile-sidebar-footer { display: none; }
    .dashboard-grid {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }
    .profile-panel {
        padding: 20px;
    }
    .settings-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .activity-filters {
        flex-direction: column;
        align-items: stretch;
    }
    .activity-filter__group {
        width: 100%;
    }
    .activity-filter__input,
    .activity-filter__select {
        width: 100%;
        min-width: unset;
    }
    .activity-filter__actions {
        margin-left: 0;
        width: 100%;
    }
    .activity-filter__actions .btn {
        flex: 1;
    }
    .activity-pagination {
        gap: 6px;
    }
    .activity-pagination__btn {
        font-size: 0.78rem;
        padding: 5px 8px;
    }
    .activity-pagination__page {
        min-width: 28px;
        height: 28px;
        font-size: 0.78rem;
    }
    .security-block {
        background: var(--bg-card); border: 1px solid var(--glass-border);
        border-radius: var(--radius-sm); padding: var(--space-lg, 16px); margin-bottom: var(--space-md, 12px);
    }
    .security-block--danger {
        background: rgba(var(--error-rgb), 0.03); border: 1px solid rgba(var(--error-rgb), 0.12);
        padding: var(--space-lg, 16px); margin-bottom: var(--space-md, 12px);
    }
    .profile-content .security-table thead { display: none; }
    .profile-content .security-table tr {
        display: block; border: 1px solid var(--glass-border); border-radius: var(--radius-sm);
        margin-bottom: var(--space-sm, 8px); padding: var(--space-sm, 8px) var(--space-md, 12px);
    }
    .profile-content .security-table td {
        display: flex; justify-content: space-between; gap: var(--space-sm, 8px);
        border-bottom: 1px solid var(--glass-border); padding: 6px 0;
    }
    .profile-content .security-table td:last-child { border-bottom: none; }
    .profile-content .security-table:not(.security-table--auto-label) td::before {
        content: attr(data-label); font-weight: 600; color: var(--text-muted);
        flex: 0 0 auto; min-width: 100px;
    }
    .profile-content .security-table .doc-group-header {
        border: none; border-radius: 0; background: transparent;
        margin: var(--space-sm, 8px) 0 4px; padding: 4px 0;
    }
    .profile-content .security-table .doc-group-header td {
        display: block; text-align: center; font-weight: 700; text-transform: uppercase;
    }
    .profile-content .security-table .doc-group-header td::before { content: none; }
    .profile-content .security-table td.security-ua { word-break: break-all; }
    .tax-calendar-filters { display: flex; flex-direction: column; gap: var(--space-sm, 8px); margin-bottom: var(--space-md, 12px); }
    .tax-calendar-filters__form { flex-direction: column; align-items: stretch; gap: var(--space-sm, 8px); }
    .tax-calendar-filters__form .form-group--inline { width: 100%; }
    .tax-calendar-filters__form .form-select--styled, .tax-calendar-filters__form .form-input--styled { width: 100%; min-width: 0; }
    .tax-calendar__item { flex-direction: column; align-items: stretch; gap: var(--space-sm, 8px); padding: var(--space-sm, 8px) var(--space-md, 12px); }
    .tax-calendar__badge-wrap { align-self: flex-start; text-align: left; }
    .activity-timeline { gap: var(--space-sm, 8px); }
    .activity-timeline__item { padding: var(--space-md, 12px); }
    .settings-row { padding: var(--space-md, 12px) var(--space-lg, 16px); min-height: 44px; }
    /* Touch targets — WCAG 2.1 SC 2.5.5 (min 40px on mobile) */
    .btn--sm { padding: 10px 14px; min-height: 40px; }
    .toggle-switch { height: 28px; width: 48px; }
    .toggle-slider::before { height: 22px; width: 22px; }
    .toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }
    .activity-pagination__btn { padding: 8px 12px; min-height: 36px; }
    .activity-pagination__page { min-width: 36px; height: 36px; }
}

@media (max-width: 480px) {
    .dashboard-grid {
        grid-template-columns: minmax(0, 1fr);
    }
    .security-table-wrap {
        font-size: 0.8rem;
    }
    .activity-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
}

@media (max-width: 360px) {
    .profile-tab { font-size: 0.65rem; }
}

/* ===== Forms (generic) ===== */
.form-group { margin-bottom: 16px; }
.form-label { display: block; margin-bottom: 4px; font-weight: 500; font-size: 0.9rem; color: var(--text-main); }
.form-input--textarea {
    min-height: 120px;
    resize: vertical;
    line-height: 1.6;
    padding: 12px 14px;
}

/* --- Ticket Form --- */
.ticket-form-wrap {
    max-width: 720px;
}
.ticket-form-wrap .auth-form {
    max-width: 100%;
}
.ticket-form-wrap .form-input {
    width: 100%;
    padding: 12px 14px;
    font-size: 1rem;
}
.ticket-form-wrap .form-input--textarea {
    min-height: 160px;
    line-height: 1.7;
}
.ticket-form-wrap .form-label {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-main);
}
.ticket-form-wrap .btn--primary {
    padding: 12px 28px;
    font-size: 1rem;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    font-size: 0.95rem;
    font-family: var(--font-main);
    color: var(--text-main);
    background: var(--bg-surface);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.form-control:focus { outline: none; border-color: var(--border-focus); box-shadow: var(--glow-primary); }
.form-error { color: var(--error); font-size: 0.85rem; margin-top: 4px; }

/* ===== Card (generic) ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--glass-border-hover);
}
.card__title { font-size: 1.1rem; font-weight: 600; margin-bottom: 10px; color: var(--text-main); }

/* ===== Forms (generic extras) ===== */
.form-row {
    display: grid;
    gap: 16px;
    margin-bottom: 16px;
}

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

@media (max-width: 480px) {
    .form-row--2 { grid-template-columns: 1fr; }
}

.calc-form__group--hidden {
    display: none !important;
}

/* ============================================================
   CALCULATORS — Layout, Form, Result, Side Panel
   ============================================================ */

/* --- Header --- */
.calc-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--glass-border);
}

.calc-header__icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    flex-shrink: 0;
}

.calc-header__text {
    flex: 1;
    min-width: 0;
}

.calc-header__title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
    line-height: 1.2;
}

.calc-header__subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 4px 0 0;
}

[data-theme="dark"] .calc-header__title {
    color: var(--text-main);
}

/* --- Two-column layout --- */
.calculator-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 32px;
    align-items: start;
}

.calculator-main {
    min-width: 0;
}

/* --- Side Panel --- */
.side-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: sticky;
    top: calc(var(--header-height) + 16px);
}

.side-panel__section {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 16px;
}

.side-panel__section--sources {
    background: var(--panel-sources-bg);
    border-color: var(--panel-sources-border);
}

.side-panel__section--warning {
    background: var(--panel-warning-bg);
    border-color: var(--panel-warning-border);
}

.side-panel__title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 0 0 10px;
}

.side-panel__text {
    font-size: 0.85rem;
    line-height: 1.55;
    color: var(--text-secondary);
    margin: 0;
}

.side-panel__list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.7;
}

.side-panel__list--compact {
    line-height: 1.6;
}

/* Standalone plain list (standard browser bullets, NOT .side-panel__list custom bullets) */
.side-panel__plain-list {
    margin: 0;
    padding-left: 1.5rem;
    line-height: 1.6;
}

.side-panel__list li {
    position: relative;
    padding-left: 14px;
}

.side-panel__list li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: 700;
}

.side-panel__table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    line-height: 1.6;
}

.side-panel__table td {
    padding: 2px 0;
    vertical-align: top;
}

.side-panel__table td:first-child {
    padding-right: 10px;
    white-space: nowrap;
}

.side-panel__table td:last-child {
    color: var(--text-secondary);
}

.side-panel__date {
    display: block;
    margin-top: 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.side-panel__notice {
    background: var(--bg-surface);
    border: 1px dashed var(--glass-border);
    border-radius: 10px;
    padding: 12px;
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-top: 12px;
}

.side-panel__notice p {
    margin: 0;
}

[data-theme="dark"] .side-panel__section {
    background: rgba(15, 23, 42, 0.5);
}

/* --- Compact Form --- */
.calc-form {
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 0;
}

[data-theme="dark"] .calc-form {
    background: rgba(15, 23, 42, 0.5);
}

.calc-form__row {
    display: grid;
    gap: 16px;
    margin-bottom: 16px;
}

/* === calc-form__row / layout modifiers (SHARED) === */
.calc-form__row--mt { margin-top: 16px; }
.calc-form__row--mt-sm { margin-top: 12px; }
.calc-field--mt { margin-top: 12px; }
.calc-form__actions--mt { margin-top: 0.75rem; }
.calc-info-section--mb { margin-bottom: 1rem; }
.calc-form__row--align-end { align-items: end; }
.result-highlight__sub--mt { margin-top: 0.25rem; }
.input-with-suffix--mt { margin-top: 0.5rem; }
.calc-info-list--mt { margin-top: 6px; }

.calc-form__divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 8px 0 16px 0;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.calc-form__divider::before,
.calc-form__divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--glass-border);
}

.calc-form__divider-text {
    white-space: nowrap;
}

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

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

.calc-form__row--4 {
    grid-template-columns: repeat(4, 1fr);
}

.calc-form__row--5 {
    grid-template-columns: repeat(5, 1fr);
}

.calc-form__row--6 {
    grid-template-columns: repeat(6, 1fr);
}

.calc-form__row--auto {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.calc-form__row--amount {
    margin-bottom: 24px;
}

.calc-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    overflow: visible;
}

.calc-field--amount {
    max-width: 100%;
    width: 100%;
}

/* Date range helper (IP months, etc.) */
.calc-date-range {
    margin-top: 0.5rem;
    padding-top: 0.4rem;
    border-top: 1px dashed var(--glass-border, rgba(255,255,255,0.1));
}
.calc-date-range__row {
    display: flex;
    gap: 0.6rem;
    align-items: flex-end;
    flex-wrap: wrap;
}
.calc-date-range__field {
    flex: 1 1 120px;
    min-width: 120px;
}
.calc-date-range__field label {
    display: block;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.15rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.calc-date-range__field label small {
    font-size: 0.6rem;
    font-weight: 400;
    opacity: 0.7;
    text-transform: none;
}

/* Compact date inputs inside overlay (placeholder visibility) */
.calc-date-range input[type="date"].form-input--compact {
    font-size: 0.85rem;
    padding: 4px 6px;
    min-height: 28px;
}
[data-theme="light"] .calc-date-range {
    border-top-color: rgba(0,0,0,0.12);
}
[data-theme="dark"] .calc-date-toggle[open] .calc-date-range {
    background: var(--bg-tooltip);
    border-color: rgba(var(--primary-rgb), 0.2);
}
.calc-date-range__hint {
    margin-bottom: 0.25rem;
    opacity: 0.85;
}

/* Inline toggle row: select + details side-by-side, NEVER wraps */
.calc-inline-toggle-row {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.5rem;
    margin-top: 0.2rem;
}
.calc-inline-toggle-row select.form-input--compact {
    flex: 0 0 auto;
    width: 70px;
    min-width: 70px;
}

/* Date toggle: overlay dropdown (does NOT push layout) */
.calc-date-toggle-wrap {
    position: relative;
    display: inline-block;
    flex: 0 0 auto;
}
.calc-date-toggle {
    display: inline-block;
}
.calc-date-toggle > summary {
    list-style: none;
    cursor: pointer;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    user-select: none;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    background: rgba(var(--primary-rgb),0.08);
    border: 1px solid rgba(var(--primary-rgb),0.18);
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
    display: inline-block;
}
.calc-date-toggle > summary:hover {
    background: rgba(var(--primary-rgb),0.15);
    border-color: rgba(var(--primary-rgb),0.35);
}
.calc-date-toggle > summary::-webkit-details-marker {
    display: none;
}
[data-theme="light"] .calc-date-toggle > summary {
    color: var(--primary);
    background: rgba(var(--primary-rgb),0.06);
    border-color: rgba(var(--primary-rgb),0.14);
}
[data-theme="light"] .calc-date-toggle > summary:hover {
    background: rgba(var(--primary-rgb),0.12);
}

/* Date range: absolute overlay (does NOT expand parent height) */
.calc-date-toggle[open] .calc-date-range {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 20;
    background: var(--bg-card);
    border: 1px solid var(--glass-border, rgba(255,255,255,0.12));
    border-radius: 8px;
    padding: 0.6rem 0.7rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    min-width: 260px;
    max-width: 320px;
}
.calc-date-range__row {
    display: flex;
    gap: 0.6rem;
    align-items: flex-end;
    flex-wrap: wrap;
}
.calc-date-range__field {
    flex: 1 1 100px;
    min-width: 100px;
}
.calc-date-range__field label {
    display: block;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.15rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.calc-date-range__field label small {
    font-size: 0.6rem;
    font-weight: 400;
    opacity: 0.7;
    text-transform: none;
}
.calc-inline-toggle-row select.form-input--compact {
    flex: 0 0 auto;
    width: 70px;
    min-width: 70px;
}
.calc-date-toggle {
    flex: 0 0 auto;
    margin-top: 0;
}
.calc-date-toggle > summary {
    list-style: none;
    cursor: pointer;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    user-select: none;
    padding: 0.25rem 0.4rem;
    border-radius: 6px;
    background: rgba(var(--primary-rgb),0.08);
    border: 1px solid rgba(var(--primary-rgb),0.18);
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}
.calc-date-toggle > summary:hover {
    background: rgba(var(--primary-rgb),0.15);
    border-color: rgba(var(--primary-rgb),0.35);
}
.calc-date-toggle > summary::-webkit-details-marker {
    display: none;
}
[data-theme="light"] .calc-date-toggle > summary {
    color: var(--primary);
    background: rgba(var(--primary-rgb),0.06);
    border-color: rgba(var(--primary-rgb),0.14);
}
[data-theme="light"] .calc-date-toggle > summary:hover {
    background: rgba(var(--primary-rgb),0.12);
}

/* Compact inputs: calmer suffix (₽/мес) */
.calc-form .input-with-suffix .form-input--compact + .input-suffix,
.calc-form .input-with-suffix .form-input--compact ~ .input-suffix {
    font-size: 0.85rem;
    font-weight: 500;
}

/* Monthly fill-all row */
.calc-month-fill-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
    flex-wrap: wrap;
}
.calc-month-fill-row .btn--sm {
    font-size: 0.75rem;
    padding: 0.35rem 0.6rem;
}

.calc-field__label {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.3rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.calc-form__actions {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.btn--reset {
    font-size: 0.9rem;
    padding: 10px 16px;
    color: var(--text-muted);
    border-color: var(--glass-border);
}

.btn--reset:hover {
    color: var(--text-main);
    border-color: var(--glass-border-hover);
    background: var(--bg-card-hover);
}

.form-input--small {
    padding: 8px 10px;
    font-size: 0.9rem;
}

.form-input--compact {
    padding: 5px 8px;
    font-size: 0.85rem;
    min-height: 32px;
    line-height: 1.3;
}

select.form-input--compact {
    padding-right: 24px;
    background-position: right 4px center;
}

.input-with-suffix .form-input--compact {
    padding-right: 28px;
}

/* calc_vznosy: fill-months input (fixup #11: scoped to .calc-form for specificity 0,3,0 > 0,2,1) */
.calc-form .form-input--fill-months { width: 130px; }

/* --- Result --- */
.calc-result {
    /* margin and animation moved to .calc-result-wrapper */
}

.calc-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
    color: var(--text-muted);
    gap: 12px;
}

.calc-empty-state__icon {
    color: var(--text-muted);
    opacity: 0.5;
}

.calc-empty-state__text {
    font-size: 1rem;
    line-height: 1.5;
    max-width: 400px;
}

[data-theme="dark"] .calc-empty-state__icon {
    opacity: 0.45;
}

.calc-result__main--hidden {
    display: none;
}

/* ---- Disclaimers (pretty cards) ---- */
.calc-disclaimer {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 12px 0 0;
}
.calc-disclaimer__item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    border-left: 3px solid var(--warning, #f59e0b);
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--text-secondary);
}
.calc-disclaimer__icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    color: var(--warning, #f59e0b);
    margin-top: 1px;
}
[data-theme="dark"] .calc-disclaimer__item {
    background: var(--bg-surface);
    border-left-color: var(--warning, #f59e0b);
}
[data-theme="dark"] .calc-disclaimer__icon {
    color: var(--warning, #f59e0b);
}

.result-card-lg {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    text-align: center;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}
.result-card-lg--accent {
    border-left: 4px solid var(--primary);
}
.result-card-lg__label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}
.result-card-lg__value {
    font-size: 2.4rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.2;
}

.result-highlight {
    background: var(--bg-card);
    border: 2px solid var(--primary);
    border-radius: 16px;
    padding: 28px 24px;
    text-align: center;
    margin-bottom: 16px;
    position: relative;
    cursor: pointer;
    transition: box-shadow 0.2s ease;
}

.result-highlight:hover {
    box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.1);
}

.result-highlight__label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.result-highlight__value {
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

[data-theme="dark"] .result-highlight__value {
    color: var(--primary-bright);
}

.result-grid {
    display: grid;
    gap: 12px;
    margin-bottom: 16px;
}

.result-grid--2 {
    grid-template-columns: 1fr 1fr;
}

.result-grid--3 {
    grid-template-columns: 1fr 1fr 1fr;
}

.result-card-sm {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.result-card-sm:hover {
    border-color: var(--primary-light);
}

.result-card-sm__label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.result-card-sm__value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    font-variant-numeric: tabular-nums;
    word-break: break-all;
}

.result-card-sm__value--compact {
    font-size: 0.85rem;
}

.result-card-sm__value--mono {
    font-size: 0.95rem;
    font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
    letter-spacing: 0.02em;
}

.result-card-sm--info {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
}

.result-highlight--success {
    border-color: var(--success);
}

.result-highlight--success .result-highlight__value {
    color: var(--success);
}

[data-theme="dark"] .result-highlight--success .result-highlight__value {
    color: #66bb6a;
}

.result-card-sm--accent {
    border-color: var(--accent);
}

.result-card-sm--accent .result-card-sm__value {
    color: var(--accent);
}

[data-theme="dark"] .result-card-sm--accent .result-card-sm__value {
    color: var(--accent);
}

.result-card-sm--danger {
    border-color: var(--danger);
}

.result-card-sm--danger .result-card-sm__value {
    color: var(--danger);
}

[data-theme="dark"] .result-card-sm--danger .result-card-sm__value {
    color: #ef5350;
}

.calc-field__hint {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
    line-height: 1.4;
    overflow-wrap: break-word;
    word-break: normal;
}

/* === calc-field__hint modifiers (SHARED) === */
.calc-field__hint--mt-sm { margin-top: 0.15rem; }
.calc-field__hint--mt { margin-top: 6px; }
.calc-field__hint--mt-md { margin-top: 8px; }
.calc-field__hint--mb { margin-bottom: 8px; }
.calc-field__hint--mb-md { margin-bottom: 12px; }
.calc-field__hint--mb-sm { margin-bottom: 0.25rem; }
.calc-field__hint--mb0 { margin-bottom: 0; }
.calc-field__hint--primary { color: var(--primary); }
.calc-field__hint--accent { color: var(--accent); font-size: 0.78rem; }
.calc-field__hint--semibold { font-weight: 600; }
.calc-toggle-wrap--mt { margin-top: 0.25rem; }

/* ---- Advance schedule (tax calendar) ---- */
.advance-schedule {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    margin-top: 0.2rem;
}

.advance-schedule__row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.15rem 0.3rem;
    border-radius: 4px;
    font-size: 0.82rem;
    line-height: 1.3;
    gap: 0.5rem;
}

.advance-schedule__period {
    flex: 1 1 auto;
    min-width: 90px;
    font-weight: 500;
}

.advance-schedule__date {
    flex: 0 0 auto;
    color: var(--text-muted);
    font-size: 0.78rem;
    white-space: nowrap;
}

.advance-schedule__remaining {
    flex: 0 0 auto;
    font-size: 0.78rem;
    white-space: nowrap;
    text-align: right;
    min-width: 80px;
}

.advance-schedule__row--next {
    background: rgba(var(--primary-rgb), 0.08);
    border-left: 2px solid var(--primary, #2563eb);
    font-weight: 600;
}

.advance-schedule__row--next .advance-schedule__remaining {
    color: var(--primary, #2563eb);
}

.advance-schedule__row--overdue {
    opacity: 0.65;
}

.advance-schedule__row--overdue .advance-schedule__remaining {
    color: #dc2626;
}

[data-theme="dark"] .advance-schedule__row--next {
    background: rgba(129, 140, 248, 0.12);
}

[data-theme="dark"] .advance-schedule__row--overdue .advance-schedule__remaining {
    color: #f87171;
}

.calc-toggle {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
}

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

.calc-toggle__slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--glass-border, #ccc);
    border-radius: 20px;
    transition: 0.3s;
}

.calc-toggle__slider::before {
    content: "";
    position: absolute;
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    border-radius: 50%;
    transition: 0.3s;
}

.calc-toggle input:checked + .calc-toggle__slider {
    background-color: var(--primary, #2563eb);
}

.calc-toggle input:checked + .calc-toggle__slider::before {
    transform: translateX(16px);
}

.calc-toggle-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.calc-field__label--inline {
    margin: 0;
}

.calc-toggle-row .calc-field__label--inline {
    flex: 1;
    min-width: 0;
}

.calc-toggle-row--tight {
    gap: 0.35rem;
    justify-content: flex-start;
}

.calc-toggle-row--tight .calc-field__label--inline {
    flex: 0 1 auto;
    white-space: nowrap;
    text-transform: none;
    font-size: 0.82rem;
}

/* Toggle group: compact horizontal row of toggles */
.calc-toggle-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 24px;
    align-items: flex-start;
}

/* Toggle buttons (simple/advanced mode) */
.calc-toggle-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 8px;
    background: var(--bg-card, #fff);
    color: var(--text-main, #1f2937);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}
.calc-toggle-btn.is-active {
    background: var(--primary, #2563eb);
    color: #fff;
    border-color: var(--primary, #2563eb);
}
[data-theme="dark"] .calc-toggle-btn {
    background: var(--bg-card);
    color: var(--text-main);
    border-color: var(--glass-border);
}
[data-theme="dark"] .calc-toggle-btn.is-active {
    background: var(--primary, #3b82f6);
    border-color: var(--primary, #3b82f6);
}

/* Demo presets */
.calc-preset-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.calc-toggle-group__item {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    min-width: 0;
}

.calc-toggle-group__hint {
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.3;
    width: 100%;
    margin-top: 2px;
    padding-left: 42px;
}

.calc-toggle-group__label {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-main);
    white-space: nowrap;
}

/* contributions-group: stable 2-col grid, manual/auto in left cell, advances in right */
#contributions-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
}
#contributions-group .calc-field:first-child {
    grid-column: 1;
    min-width: 0;
}
#contributions-group .contrib-advances {
    grid-column: 2;
    min-width: 0;
    align-self: start;
}

/* === calc_usn contrib classes (SHARED) === */
.contrib-toggle-row { margin-top: 0.35rem; }
.contrib-auto__hints {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
    margin-top: 0.2rem;
}
.contrib-breakdown {
    margin-top: 0.35rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.5;
}
.contrib-breakdown__sep {
    margin-top: 0.2rem;
    padding-top: 0.2rem;
    border-top: 1px dotted var(--glass-border);
}

/* trade-fee-group: single row toggle, stable spacing */
#trade-fee-group {
    margin-bottom: 16px;
}
#trade-fee-group .calc-field--toggle-expand {
    grid-column: 1 / -1;
    padding-bottom: 4px;
}

/* === Calculator radio group (NDS rate) === */
.calc-radio-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* 2x2 symmetric grid for 4 radio options (no "domed" wrap) */
.calc-radio-group--grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.4rem;
}

.calc-radio-group--grid .calc-radio-label {
    justify-content: center;
    padding: 0.35rem 0.3rem;
}

.calc-rate-tooltip {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    margin-left: 0.3rem;
    color: var(--text-muted, #999);
    cursor: help;
    position: relative;
    opacity: 0.6;
    transition: opacity 0.15s;
}
.calc-rate-tooltip:hover {
    opacity: 1;
}
.calc-rate-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-tooltip, var(--bg-card));
    color: var(--text-tooltip, var(--text-main));
    padding: 0.55rem 0.75rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    font-size: 0.78rem;
    line-height: 1.45;
    white-space: normal;
    width: max-content;
    max-width: 280px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    /* display:none (НЕ visibility:hidden): скрытый псевдоэлемент с position:absolute
       иначе участвует в scrollWidth body → горизонтальный скролл на mobile 375 */
    display: none;
    z-index: 10;
    pointer-events: none;
}
.calc-rate-tooltip::before {
    content: "";
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--bg-tooltip, var(--bg-card));
    display: none;
    z-index: 11;
    pointer-events: none;
}
[data-theme="light"] .calc-rate-tooltip::after {
    background: var(--bg-tooltip, var(--bg-card));
    color: var(--text-tooltip, var(--text-main));
    border-color: var(--border);
}
[data-theme="light"] .calc-rate-tooltip::before {
    border-top-color: var(--bg-tooltip, var(--bg-card));
}
.calc-rate-tooltip:hover::after,
.calc-rate-tooltip:hover::before {
    display: block;
    animation: calc-tooltip-fade-in 0.15s;
}

@keyframes calc-tooltip-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Mobile tooltip — tap-to-show (shared, all calculators) */
.calc-rate-tooltip--visible::after,
.calc-rate-tooltip--visible::before {
    display: block !important;
    animation: calc-tooltip-fade-in 0.15s;
}

/* Tooltip below (for fields in top of form — prevents off-screen) */
.calc-rate-tooltip--below::after {
    bottom: auto;
    top: calc(100% + 8px);
}
.calc-rate-tooltip--below::before {
    bottom: auto;
    top: calc(100% + 2px);
    border-top-color: transparent;
    border-bottom-color: var(--bg-tooltip, var(--bg-card));
}
[data-theme="light"] .calc-rate-tooltip--below::before {
    border-bottom-color: var(--bg-tooltip, var(--bg-card));
}

/* Mobile tooltip — prevent overflow on small screens */
@media (max-width: 768px) {
    .calc-rate-tooltip::after {
        max-width: calc(100vw - 32px);
        width: max-content;
        left: 0;
        transform: none;
    }
    .calc-rate-tooltip::before {
        left: 16px;
        transform: none;
    }
}
@media (max-width: 480px) {
    .calc-rate-tooltip::after {
        max-width: calc(100vw - 24px);
        font-size: 0.72rem;
        padding: 0.5rem 0.65rem;
    }
}

.calc-radio-label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg-surface);
}

.calc-radio-label:hover {
    border-color: var(--border-focus);
    background: var(--bg-surface-hover);
}

.calc-radio-input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

.calc-radio-text {
    font-size: 0.85rem;
    color: var(--text-main);
}

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

[data-theme="dark"] .calc-radio-label:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary-light);
}

.result-formula {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 14px 16px;
}

.result-formula__code {
    display: block;
    font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
    font-size: 0.85rem;
    color: var(--primary);
    background: rgba(var(--primary-rgb), 0.06);
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 8px;
    word-break: break-all;
}

.result-formula__source {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.5;
}

[data-theme="dark"] .result-formula__code {
    background: rgba(var(--primary-rgb), 0.12);
    color: var(--primary-bright);
}

.btn--large {
    padding: 14px 28px;
    font-size: 1.05rem;
    font-weight: 600;
}

.form-input--xl {
    font-size: 1.25rem;
    font-weight: 700;
    padding: 14px 16px;
    min-height: 52px;
}

/* --- Info details (accordion after result) --- */
.calc-info-details {
    margin-top: 16px;
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    overflow: hidden;
    background: var(--bg-card);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.calc-info-details:hover {
    border-color: var(--glass-border-hover);
    box-shadow: var(--shadow-sm);
}

.calc-info-details[open] {
    border-color: var(--glass-border-hover);
}

.calc-info-details .calc-info-section {
    margin-top: 0;
    border: none;
    border-radius: 0;
    background: transparent;
}

.calc-info-details .calc-info-section:hover {
    box-shadow: none;
}

.calc-result-actions {
    margin-top: 16px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Button spinner */
.btn .btn-spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: btnSpin 0.8s linear infinite;
}

.btn.is-loading .btn-spinner {
    display: inline-block;
}

.btn.is-loading .btn-text {
    opacity: 0.7;
}

@keyframes btnSpin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* --- Info blocks after result --- */
.calc-info-section,
.calc-info-section {
    margin-top: 24px;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 24px;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.calc-info-section:hover {
    border-color: var(--glass-border-hover);
    box-shadow: var(--shadow-sm);
}

.calc-info-section__title {
    margin: 0 0 16px 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-main);
    padding-bottom: 12px;
    border-bottom: 1px solid var(--glass-border);
}

details > summary.calc-info-section__title {
    cursor: pointer;
    list-style: none;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text-main);
    padding: 16px 20px;
    background: var(--bg-card);
    user-select: none;
}

details > summary.calc-info-section__title::-webkit-details-marker {
    display: none;
}

details > summary.calc-info-section__title::marker {
    display: none;
    content: "";
}

.calc-info-section__subtitle {
    margin: 20px 0 12px 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.required-indicator {
    color: var(--danger);
    margin-left: 2px;
}

details[open] > .calc-info-section__body {
    padding-top: 12px;
}

.calc-info-section__body p {
    margin: 0 0 8px 0;
}

.calc-info-section__body ul {
    margin: 0 0 12px 0;
    padding-left: 1.5rem;
    line-height: 1.8;
}

.calc-info-section__note {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--glass-border);
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Step-by-step calculation breakdown (vznosy detailed calc) */
.calc-info-steps {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

/* --- Detailed calculation table (vznosy single mode) --- */
.result-table--detail th,
.result-table--detail td {
    font-size: 0.88rem;
    padding: 0.5rem 0.6rem;
    vertical-align: middle;
}
.result-table--detail tbody tr {
    transition: background 0.15s ease;
}
.result-table--detail tbody tr:hover {
    background: rgba(var(--primary-rgb),0.03);
}
.calc-detail-row--ops {
    background: rgba(13, 110, 253, 0.04);
}
.calc-detail-row--oms {
    background: rgba(25, 135, 84, 0.04);
}
.calc-detail-row--vnim {
    background: rgba(255, 193, 7, 0.04);
}
.calc-detail-row--extra {
    background: rgba(255, 152, 0, 0.04);
}
.calc-detail-row--limit {
    background: rgba(255, 193, 7, 0.08);
    border-left: 3px solid var(--warning, #ffc107);
}
.calc-detail-row--ip {
    background: rgba(13, 202, 240, 0.06);
    border-left: 3px solid var(--info, #0dcaf0);
}
.calc-detail-row--total {
    background: rgba(var(--primary-rgb),0.08);
    border-left: 3px solid var(--primary);
}
.calc-detail-row--total td {
    font-weight: 700;
    color: var(--primary);
}
.calc-detail-row--empty {
    color: var(--text-muted);
    font-style: italic;
}


.text-success { color: var(--success, #28a745); }
.text-danger { color: var(--danger, #dc3545); }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary); }

/* === Utility (SHARED) === */
.calc-note-sm { font-weight: 400; font-size: 0.78rem; color: var(--text-muted); }
.alert--mb-sm { margin-bottom: 10px; }
.side-panel__chevron { display: inline; vertical-align: middle; margin-left: 4px; }
.calc-table-scroll { overflow-x: auto; }
.calc-form__label--start { align-self: flex-start; margin-top: 4px; }
.calc-form__checkbox { margin-right: 6px; }
.honeypot-field { position: absolute; left: -9999px; }
.calc-warning {
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border-radius: var(--radius);
    border-left: 3px solid var(--primary);
    font-size: 0.9rem;
    color: var(--text-main);
}
.calc-warning--mt { margin-top: 0.75rem; }
.calc-warning--mb { margin-bottom: 1rem; }
.calc-recommendation {
    margin-bottom: 1rem;
    font-size: 0.95rem;
    color: var(--text-main);
}
.calc-recommendation__text { color: var(--primary); }

/* --- NDFL table --- */
.ndfl-table-wrapper {
    margin-top: 20px;
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

.ndfl-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
    background: var(--bg-card);
}

.ndfl-table th,
.ndfl-table td {
    padding: 12px 14px;
    border: 1px solid var(--glass-border);
    text-align: left;
}

.ndfl-table th {
    background: var(--bg-card);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.ndfl-table td {
    color: var(--text-main);
    font-variant-numeric: tabular-nums;
}

.ndfl-table tr:hover td {
    background: var(--bg-card-hover);
}

.ndfl-table__total td {
    font-weight: 700;
    background: var(--bg-card);
    border-top: 2px solid var(--primary);
}

.ndfl-table td[role="button"] {
    cursor: pointer;
    transition: background 0.15s;
}

.ndfl-table td[role="button"]:hover {
    background: var(--bg-card-hover);
}

.ndfl-rounding-note {
    margin-top: 12px;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px dashed var(--glass-border);
    border-radius: 8px;
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.ndfl-rounding-note p {
    margin: 0;
}

/* Checkbox inside calc form */
.calc-field--checkbox {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.checkbox-block {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    background: var(--bg-card);
    transition: border-color var(--transition), background var(--transition);
    cursor: pointer;
    min-height: 42px;
}

.checkbox-block:hover {
    border-color: var(--glass-border-hover);
}

.checkbox-block:has(input[type="checkbox"]:checked) {
    border-color: var(--primary);
    background: var(--bg-card);
}

.checkbox-block input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
}

.checkbox-block label {
    font-size: 0.9rem;
    color: var(--text-main);
    cursor: pointer;
    user-select: none;
    line-height: 1.3;
}

.checkbox-block--prominent {
    padding: 12px 14px;
    border-width: 2px;
    border-color: var(--primary-soft, #d0d0f0);
    background: var(--bg-card);
    box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.08);
}

.checkbox-block--prominent label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
}

.checkbox-block--prominent:has(input[type="checkbox"]:checked) {
    border-color: var(--primary);
    background: rgba(var(--primary-rgb), 0.06);
    box-shadow: 0 2px 12px rgba(var(--primary-rgb), 0.15);
}

.calc-info-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0 0 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--glass-border);
}

.calc-info-body {
    font-size: 0.92rem;
    line-height: 1.7;
    color: var(--text-secondary);
}

.calc-info-body p {
    margin-bottom: 10px;
}

.calc-info-subtitle {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 16px 0 8px;
}

.calc-info-list {
    list-style: none;
    padding: 0;
    margin: 0 0 12px;
}

.calc-info-list li {
    position: relative;
    padding-left: 18px;
    margin-bottom: 8px;
}

.calc-info-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 9px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--primary);
    opacity: 0.7;
}

.calc-example {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: 10px 0 14px;
}

.calc-example-subject {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0 0 4px;
}

.calc-example-scenario {
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 14px 16px;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.calc-example-scenario:hover {
    border-color: var(--glass-border-hover);
    box-shadow: var(--shadow-sm);
}

.calc-example-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 10px;
}

.calc-example-row {
    display: flex;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 10px;
}

.calc-example-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 12px;
    border-radius: 8px;
    background: var(--bg-card);
    border-left: 3px solid var(--primary);
    min-width: 0;
}

.calc-example-card--in {
    border-left-color: var(--accent);
}

.calc-example-card--out {
    border-left-color: var(--primary);
}

.calc-example-card__label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.calc-example-card__value {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

.calc-example-card__meta {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.calc-example-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    flex-shrink: 0;
    width: 24px;
}

.calc-example-result-inline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    padding: 8px 12px;
    background: rgba(var(--primary-rgb), 0.06);
    border-radius: 8px;
    border-left: 3px solid var(--primary);
}

.calc-example-result-inline--positive {
    background: rgba(var(--accent-rgb), 0.08);
    border-left-color: var(--accent);
}

.calc-example-formula {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-main);
    font-variant-numeric: tabular-nums;
}

.calc-example-note {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

@media (max-width: 480px) {
    .calc-example-row {
        flex-direction: column;
        gap: 8px;
    }
    .calc-example-arrow {
        transform: rotate(90deg);
        align-self: center;
    }
    .calc-example-result-inline {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
}

[data-theme="dark"] .calc-example-scenario {
    background: rgba(255, 255, 255, 0.03);
}

[data-theme="dark"] .calc-example-card {
    background: rgba(15, 23, 42, 0.4);
}

[data-theme="dark"] .calc-example-result-inline {
    background: rgba(var(--primary-rgb), 0.1);
}

[data-theme="dark"] .calc-example-result-inline--positive {
    background: rgba(var(--accent-rgb), 0.12);
}

.calc-example-result {
    margin: 8px 0 0;
    font-size: 0.9rem;
    color: var(--text-main);
}

[data-theme="dark"] .calc-info-section {
    background: rgba(15, 23, 42, 0.5);
}

[data-theme="dark"] .calc-example {
    background: rgba(255, 255, 255, 0.03);
}

.calc-info-note {
    margin-top: 10px;
    padding: 10px 12px;
    background: rgba(var(--badge-pwd-rgb), 0.06);
    border-left: 3px solid rgb(var(--badge-pwd-rgb));
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.55;
}

[data-theme="dark"] .calc-info-note {
    background: rgba(var(--badge-pwd-rgb), 0.08);
    border-left-color: #ffb347;
    color: #ffedd5;
}

/* Copy hint */
.copy-hint {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    opacity: 0;
    transition: opacity 0.2s ease, color 0.2s ease, transform 0.2s ease;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
}

/* Feedback: icon-only checkmark, no layout expansion */
.copy-hint.is-copied {
    color: var(--success);
    opacity: 1;
    transform: scale(1.15);
}

.result-highlight:hover .copy-hint {
    opacity: 1;
    color: var(--primary);
    background: rgba(var(--primary-rgb), 0.08);
}

.result-card-sm .copy-hint {
    opacity: 0;
    transition: opacity 0.2s ease;
    vertical-align: middle;
    margin-left: 4px;
}

.result-card-sm:hover .copy-hint {
    opacity: 0.6;
}

.ndfl-table td .copy-hint,
.result-table td .copy-hint {
    opacity: 0;
    transition: opacity 0.2s ease;
    vertical-align: middle;
    margin-left: 4px;
}

.ndfl-table td:hover .copy-hint,
.result-table td:hover .copy-hint {
    opacity: 0.6;
}

/* Copy toast */
.copy-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text-main);
    color: var(--bg-base);
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: var(--shadow-md);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    pointer-events: none;
    z-index: 9999;
}

.copy-toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

[data-theme="dark"] .copy-toast {
    background: var(--primary-bright);
    color: var(--bg-base);
}

/* --- Enhanced Calculator Inputs --- */
.calc-form input.form-input,
.calc-form select.form-input {
    font-size: 1.12rem;
    padding: 12px 14px;
    min-height: 48px;
    border-radius: 10px;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.calc-form select.form-input {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235a52e0' stroke-width='2.5' 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 6px center;
    padding-right: 28px;
    cursor: pointer;
}

[data-theme="dark"] .calc-form select.form-input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238b83ff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

/* Suffix inside input */
.input-with-suffix {
    position: relative;
    display: block;
    width: 100%;
}

.input-with-suffix .form-input--suffix {
    padding-right: 48px;
}

.input-with-suffix input.form-input {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    font-variant-numeric: tabular-nums;
}

/* Calculator forms: smaller, calmer amount inputs */
.calc-form .input-with-suffix input.form-input {
    font-size: 1.05rem;
    font-weight: 500;
}

.calc-form input.form-input::placeholder {
    font-size: 0.85em;
    font-weight: 400;
    font-style: italic;
    opacity: 0.45;
}

.input-suffix {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-muted);
    pointer-events: none;
    line-height: 1;
}

/* Calculator: calmer suffix (₽/мес) to match smaller input font */
.calc-form .input-suffix {
    font-size: 0.95rem;
    font-weight: 500;
}

/* Custom rate toggle */
.calc-custom-rate { display: none; }
.is-hidden { display: none !important; }
.hidden { display: none !important; }
.calc-custom-rate.is-visible { display: block; margin-top: 8px; }

/* --- Side-panel details (reimbursement / examples) --- */
.side-panel__details {
    margin-top: 10px;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    overflow: hidden;
}

.side-panel__summary {
    padding: 10px 12px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
    background: var(--bg-surface);
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
}

.side-panel__summary::-webkit-details-marker { display: none; }

.side-panel__summary::after {
    content: '›';
    font-size: 1.2rem;
    color: var(--primary);
    transition: transform 0.2s ease;
}

.side-panel__details[open] .side-panel__summary::after {
    transform: rotate(90deg);
}

.side-panel__example {
    padding: 0 12px 12px;
    font-size: 0.82rem;
    line-height: 1.55;
}

.side-panel__example p {
    margin-bottom: 6px;
}

@media (max-width: 1100px) {
    .calculator-layout {
        grid-template-columns: 1fr;
    }
    .side-panel {
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
    }
    .side-panel__section {
        flex: 1;
        min-width: 200px;
    }
    .calc-form__row--3 {
        grid-template-columns: repeat(2, 1fr);
    }
    #contributions-group {
        grid-template-columns: 1fr;
    }
    #contributions-group .calc-field:first-child,
    #contributions-group .contrib-advances {
        grid-column: auto;
    }
}

@media (max-width: 768px) {
    .calc-form__row--2 {
        grid-template-columns: minmax(0, 1fr);
    }
    .calc-form__row--3 {
        grid-template-columns: minmax(0, 1fr);
    }
    .calc-form__row--4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .calc-form__group {
        min-width: 0;
    }
    .calc-radio-group--grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .calc-field--amount {
        max-width: 100%;
    }
    .result-grid--2 {
        grid-template-columns: 1fr;
    }
    .result-highlight__value {
        font-size: 1.7rem;
    }
    .side-panel {
        flex-direction: column;
    }
    .calculator-main {
        padding-bottom: 90px;
    }
    .calc-field__hint {
        font-size: 0.72rem;
        line-height: 1.35;
    }
}
.warning-box {
    background: var(--panel-warning-bg);
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid var(--dot-warning);
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-main);
}
[data-theme="dark"] .warning-box {
    background: #3b2612;
    border-left-color: #ffb347;
    color: #ffedd5;
}

/* ===== Favorite button ===== */
.favorite-btn {
    padding: 0.5rem;
    min-width: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.favorite-btn svg {
    transition: transform 0.2s ease;
}
.favorite-btn:hover svg {
    transform: scale(1.15);
}
.favorite-btn--active {
    color: var(--accent-secondary);
    border-color: var(--accent-secondary);
}
.favorite-btn--active:hover {
    background: rgba(224, 69, 123, 0.08);
}

/* ============================================================
   CALCULATORS — Single Calculator Page
   ============================================================ */

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--primary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 20px;
    transition: color 0.2s ease;
}
.back-link:hover {
    color: var(--primary-light);
}

/* --- Calculators grid (index) --- */
.calculators-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    margin-bottom: 2rem;
}

.calculator-card {
    background: var(--bg-surface);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    border: 1px solid var(--glass-border);
    text-decoration: none;
    color: inherit;
    display: block;
}

.calculator-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.calculator-card__title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.calculator-card__desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

[data-theme="dark"] .calculator-card {
    background: rgba(15, 23, 42, 0.6);
}

[data-theme="dark"] .calculator-card__title {
    color: var(--primary-bright);
}

/* --- Partner Card (СПАО «Ингосстрах») --- */
.calculator-card--partner {
    border: 1.5px solid rgba(0, 77, 229, 0.3);
    background: linear-gradient(135deg, var(--bg-surface) 0%, rgba(0, 77, 229, 0.04) 100%);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

[data-theme="dark"] .calculator-card--partner {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.8) 0%, rgba(0, 77, 229, 0.12) 100%);
    border-color: rgba(0, 77, 229, 0.45);
}

.calc-partner-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.calc-partner-brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.calc-partner-logo-box {
    display: flex;
    align-items: center;
}

.calc-partner-name {
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #004DE5;
}

[data-theme="dark"] .calc-partner-name {
    color: #3b82f6;
}

.calc-partner-badge {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 6px;
    border-radius: 4px;
    background: #EBF2FE;
    color: #004DE5;
}

[data-theme="dark"] .calc-partner-badge {
    background: rgba(0, 77, 229, 0.25);
    color: #60a5fa;
}

.calc-partner-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

[data-theme="dark"] .calc-partner-title {
    color: var(--text-main);
}

.calc-partner-footer {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.calc-partner-btn {
    background: #004DE5;
    color: #ffffff !important;
    border: none;
    font-weight: 600;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    transition: background-color 0.15s ease, transform 0.15s ease;
}

.calc-partner-btn:hover {
    background: #003bb3;
    color: #ffffff !important;
    transform: none;
}

.calc-partner-legal {
    font-size: 0.65rem;
    line-height: 1.35;
    color: var(--text-muted);
    word-break: break-all;
}

.calc-search-wrapper .search-input-wrap .form-input--styled {
    width: 100%;
    border-radius: var(--radius);
    padding: 12px 44px 12px 16px;
    font-size: 1rem;
    background: var(--bg-surface);
    color: var(--text-main);
    border: 1px solid var(--glass-border);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.calc-search-wrapper .search-input-wrap .form-input--styled:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15);
}

.calc-search-wrapper .search-btn {
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
}

.search-no-results {
    color: var(--text-muted);
    font-size: 0.95rem;
}

[data-theme="dark"] .calc-search-wrapper .form-input--styled {
    background: rgba(15, 23, 42, 0.6);
    color: var(--text-main);
    border-color: var(--glass-border);
}

[data-theme="dark"] .calc-search-wrapper .form-input--styled:focus {
    box-shadow: 0 0 0 3px rgba(139, 131, 255, 0.20);
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

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

/* ============================================================
   SHARED layout — lp-container, lp-heading (используются в
   index.html, calculator_base.html, calculators/index.html).
   Landing-специфичные классы (hero, about-services, tools-section,
   contacts-section, service-item, tool-card, contact-card, lp-map)
   вынесены в components/landing.css (Шаг 7).
   ============================================================ */

.lp-container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 24px;
    width: 100%;
}

/* Широкая страница (паттерн use_wide_page): включается {% set use_wide_page = true %}
   в шаблоне-наследнике calculator_base.html → класс lp-container--wide (паттерн широкой страницы, первопроходец — plancalc).
   Двойной класс (специфичность 0-2-0) — не зависит от порядка каскада;
   базовый --container-max и mobile-поведение не меняются. */
.lp-container.lp-container--wide {
    max-width: 1400px;
}

.lp-heading {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-main);
    text-align: center;
    margin-bottom: 28px;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

/* ===== Responsive (shared — header/footer/calc-framework) ===== */
/* Landing-responsive (hero, about-services__grid, tools-grid,
   contacts-grid, lp-map) вынесен в components/landing.css. */
@media (max-width: 860px) {
    .header__nav {
        display: none;
        position: absolute;
        top: var(--header-height);
        left: 0; right: 0;
        background: var(--bg-header);
        backdrop-filter: blur(20px);
        flex-direction: column;
        padding: 16px 24px;
        gap: 4px;
        border-bottom: 1px solid var(--glass-border);
        z-index: 150;
    }
    .header__nav.active { display: flex; }
    .header__actions { display: none; }
    .header__actions.active {
        display: flex;
        position: absolute;
        top: calc(var(--header-height) + 236px);
        left: 0; right: 0;
        background: var(--bg-header);
        backdrop-filter: blur(20px);
        padding: 12px 24px;
        border-bottom: 1px solid var(--glass-border);
        z-index: 150;
    }
    .header__burger { display: flex; }
    .header__avatar-menu { min-width: min(220px, calc(100vw - 48px)); }
    .header__user { display: flex; }
}

@media (max-width: 768px) {
    .footer__rates { gap: 12px; }
    .footer__requisites { flex-direction: column; align-items: center; gap: 8px; }
    .footer__counters { padding-bottom: 6px; }
}

@media (max-width: 480px) {
    .calc-form__row--4,
    .calc-form__row--5,
    .calc-form__row--auto {
        grid-template-columns: minmax(0, 1fr);
    }
    .calc-form__row--3 {
        grid-template-columns: minmax(0, 1fr);
    }
    .calc-form__row--2,
    .calc-form__row--6 {
        grid-template-columns: minmax(0, 1fr);
    }
    .calc-form__group {
        min-width: 0;
    }
    .calc-info-section {
        padding: 16px;
        border-radius: 12px;
    }
    .lp-heading { font-size: 1.4rem; margin-bottom: 20px; }
    .calc-field__hint {
        font-size: 0.7rem;
        line-height: 1.35;
    }
}

/* ===== Saved Documents (profile tab) — migrated to components/documents.css =====
   .doc-list, .doc-card, .doc-search-*, .doc-group-*, .doc-rename-*,
   .doc-bulk-*, .doc-checkbox, .btn--danger-text, @keyframes doc-float-in(-mobile)
   вынесены в components/documents.css (Шаг 8).
   .anon-limit-* и .print-only — SHARED, остались ниже в style.css. */

/* ---- Anonymous limit badge (micro badge on buttons) ---- */
.anon-limit-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    margin-left: 6px;
    border-radius: 9px;
    background: var(--primary);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1;
    vertical-align: middle;
    transition: background 0.2s;
}
.anon-limit-badge--low {
    background: var(--dot-warning);
    color: var(--text-main);
}
.anon-limit-btn {
    position: relative;
}
.anon-limit-btn .anon-limit-tooltip {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%) scale(0.95);
    background: var(--text-main);
    color: #fff;
    font-size: 0.72rem;
    padding: 4px 8px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s, transform 0.15s;
    z-index: 10;
}
.anon-limit-btn .anon-limit-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: var(--text-main);
}
.anon-limit-btn:hover .anon-limit-tooltip {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}
[data-theme="dark"] .anon-limit-btn .anon-limit-tooltip {
    background: #2a2a4a;
    color: var(--text-main);
}
[data-theme="dark"] .anon-limit-btn .anon-limit-tooltip::after {
    border-top-color: #2a2a4a;
}
[data-theme="dark"] .anon-limit-badge {
    background: var(--primary-light);
}
[data-theme="dark"] .anon-limit-badge--low {
    background: #ffb74d;
    color: var(--bg-tooltip);
}

/* ---- Anonymous limit modal ---- */
.anon-limit-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}
.anon-limit-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(4px);
}
.anon-limit-modal__card {
    position: relative;
    max-width: 440px;
    width: 100%;
    text-align: center;
    padding: 32px 28px;
}
.anon-limit-modal__icon {
    margin-bottom: 12px;
    color: var(--accent-secondary);
}
.anon-limit-modal__title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-main);
}
.anon-limit-modal__text {
    font-size: 0.92rem;
    line-height: 1.55;
    color: var(--text-secondary);
    margin-bottom: 20px;
}
.anon-limit-modal__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}
.anon-limit-modal__actions .btn {
    min-width: 130px;
}

/* ---- Anonymous limit bar ---- */
.anon-limit-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 16px;
    margin-bottom: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.anon-limit-bar--low {
    background: #fff8e1;
    border-color: #ffcc80;
    color: #e65100;
}
.anon-limit-bar--blocked {
    background: #ffebee;
    border-color: #ef9a9a;
    color: #c62828;
}
.anon-limit-bar__cta {
    margin-left: auto;
    font-size: 0.8rem;
    padding: 4px 10px;
}
[data-theme="dark"] .anon-limit-bar {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.18);
    color: var(--text-main);
}
[data-theme="dark"] .anon-limit-bar--low {
    background: rgba(255,183,77,0.12);
    border-color: rgba(255,183,77,0.35);
    color: #ffb74d;
}
[data-theme="dark"] .anon-limit-bar--blocked {
    background: rgba(239,83,80,0.12);
    border-color: rgba(239,83,80,0.35);
    color: #ff8a80;
}

/* ---- Nav anon limit badge (compact dot in header) ---- */
.anon-limit-badge--nav {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 4px 8px;
    border-radius: 12px;
    transition: background 0.2s, color 0.2s;
}
.anon-limit-badge--nav:hover {
    background: var(--bg-surface-hover);
    color: var(--text-main);
}
.anon-limit-badge--nav__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--dot-success);
    flex-shrink: 0;
}
.anon-limit-badge--nav__dot--low {
    background: var(--dot-warning);
}
.anon-limit-badge--nav__dot--blocked {
    background: var(--dot-danger);
}
.anon-limit-badge--nav__text {
    font-variant-numeric: tabular-nums;
    min-width: 12px;
    text-align: center;
}
[data-theme="dark"] .anon-limit-badge--nav__dot {
    background: var(--dot-success);
}
[data-theme="dark"] .anon-limit-badge--nav__dot--low {
    background: var(--dot-warning);
}
[data-theme="dark"] .anon-limit-badge--nav__dot--blocked {
    background: var(--dot-danger);
}

/* ===== Tax Burden Calculator (nagruzka) ===== */
.result-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 3px;
    table-layout: auto;
    margin-top: 16px;
    font-size: 0.95rem;
}
.result-table th {
    background: var(--primary);
    color: var(--text-on-primary);
    padding: 10px 12px;
    text-align: center;
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 2px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 2;
}
.result-table td {
    padding: 8px 10px;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    text-align: center;
    vertical-align: top;
    transition: background 0.15s;
}
.result-table td:first-child {
    border-radius: 8px 0 0 8px;
    border-left: 1px solid var(--border);
    text-align: left;
}
.result-table td:last-child {
    border-radius: 0 8px 8px 0;
    border-right: 1px solid var(--border);
}
.result-table tbody tr:hover td {
    background: var(--bg-surface-hover);
}
.result-table .text-left {
    text-align: left;
}
.result-table__row--best {
    font-weight: 600;
}
.result-table__row--best td {
    background: var(--best-row-bg, rgba(67, 160, 71, 0.12));
    border-color: var(--success) !important;
    color: var(--text-main);
    box-shadow: inset 4px 0 0 var(--success);
}
.result-table__best-mark {
    color: var(--success, #43a047);
    font-weight: 700;
    margin-right: 4px;
}
.calc-glossary {
    margin-top: 1rem;
    font-size: 0.85rem;
}
.calc-glossary summary {
    cursor: pointer;
    color: var(--text-muted);
    font-weight: 600;
    padding: 0.4rem 0;
}
.calc-glossary__table {
    margin-top: 0.5rem;
    border-collapse: collapse;
}
.calc-glossary__table td {
    padding: 0.25rem 0.75rem 0.25rem 0;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
    vertical-align: top;
}
.calc-glossary__table td:first-child {
    font-weight: 600;
    white-space: nowrap;
    color: var(--primary);
}
.result-table__num {
    font-variant-numeric: tabular-nums;
    text-align: right;
    cursor: pointer;
    white-space: nowrap;
}
.result-table__total {
    font-weight: 700;
    color: var(--primary);
    font-size: 1.08em;
}
.result-table__row--total td {
    border-top: 2px solid var(--primary);
    border-bottom: 2px solid var(--primary);
    font-weight: 700;
    background: var(--bg-card);
    font-size: 1.05em;
}
.result-table small {
    color: var(--text-muted);
    font-weight: 400;
}

/* ========== PREMIUM TABLE ENHANCEMENTS ========== */
.cell-detail {
    margin-top: 5px;
    font-size: 0.88em;
    line-height: 1.35;
    color: var(--text-muted);
}
.cell-detail--stack {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.cell-detail--badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 6px;
    justify-content: flex-end;
}
.detail-badge {
    display: inline-block;
    background: var(--bg-surface);
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
    font-size: 0.92em;
    border: 1px solid var(--glass-border);
}
.result-table--contrib {
    border-spacing: 0 2px;
}
.result-table--contrib th:first-child {
    width: 40px;
    padding: 0 4px;
}
.result-table--contrib .result-table__num {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.result-table--contrib td:first-child {
    position: relative;
    width: 40px;
    padding: 0 4px;
    vertical-align: middle;
    border-left: 1px solid var(--border);
}
.result-table--contrib td:first-child .viz-bar {
    display: block;
    width: 6px;
    height: calc(var(--viz-pct) * 0.6px);
    max-height: 60px;
    min-height: 4px;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
    margin: 0 auto;
    opacity: 0.55;
    transition: opacity 0.2s;
}
.result-table--contrib tr:hover .viz-bar {
    opacity: 0.9;
}
.viz-bar--total {
    height: 60px !important;
    background: var(--success) !important;
    opacity: 0.7 !important;
}
.result-table--contrib td:last-child {
    font-family: ui-monospace, SFMono-Regular, monospace;
    font-size: 0.88em;
    color: var(--text-muted);
    border-right: 1px solid var(--border);
    line-height: 1.3;
}
/* ========== RESULT WRAPPER (full-width below form+side-panel) ========== */
.calc-result-wrapper {
    width: 100%;
    margin-top: 24px;
    animation: fadeInUp 0.4s ease;
}
.side-panel {
    transition: gap 0.4s ease;
}
.side-panel--compact {
    gap: 8px;
}
.side-panel--compact .side-panel__section {
    padding: 10px;
}
.side-panel--compact .side-panel__title {
    margin-bottom: 0;
    font-size: 0.75rem;
}
.side-panel--compact .side-panel__text,
.side-panel--compact .side-panel__list {
    font-size: 0.78rem;
}
.side-panel--compact .side-panel__collapsible summary {
    padding: 6px 0;
    font-size: 0.8rem;
}

.text-muted { color: var(--text-muted); }
.result-highlight__rate {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 2px;
}
.result-highlight__note {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
    line-height: 1.4;
}
.result-highlight__note--ip-period {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--glass-border);
    font-size: 0.88rem;
    color: var(--text-main);
}
.result-highlight__subnote {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}
.result-highlight__note--sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
    display: block;
}
.calc-detail-row--fund td:first-child {
    padding-left: 1.5rem;
}
.result-highlight__badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 8px;
    vertical-align: middle;
}
.result-highlight__badge--msp {
    background: var(--badge-msp-bg);
    color: var(--badge-msp-text);
    border: 1px solid var(--badge-msp-border);
}
.result-highlight__badge--sez {
    background: var(--badge-sez-bg);
    color: var(--badge-sez-text);
    border: 1px solid var(--badge-sez-border);
}
/* Base progress bar (предельная база взносов) */
.base-progress {
    margin-top: 10px;
    width: 100%;
}
.base-progress__track {
    background: var(--bg-surface);
    border-radius: 6px;
    height: 8px;
    overflow: hidden;
    border: 1px solid var(--glass-border);
}
.base-progress__bar {
    height: 100%;
    border-radius: 6px;
    transition: width 0.4s ease;
    min-width: 2px;
}
.base-progress__bar--green { background: var(--success); }
.base-progress__bar--yellow { background: var(--warning); }
.base-progress__bar--red { background: var(--danger); }
.base-progress__label {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 4px;
    display: block;
}

.calc-form__section {
    background: var(--bg-surface);
    padding: 16px;
    border-radius: 10px;
    margin-bottom: 16px;
}
.form-input--compact-sm {
    max-width: 140px;
}

.input-with-suffix--flex {
    flex: 1;
}

.calc-field__label--inline--small {
    font-size: 0.78rem;
    white-space: nowrap;
}

.alert--compact {
    margin-bottom: 12px;
    font-size: 0.85rem;
}

.result-table__row--alt {
    background: var(--bg-card);
}

.side-panel__text--mt {
    margin-top: 0.35rem;
}

.calc-field__hint--block {
    display: block;
    margin-top: 6px;
    font-size: 0.78rem;
}

.calc-field__hint--semibold {
    font-weight: 600;
}

.calc-field--spacer {
    visibility: hidden;
}

.calc-form__row--tight {
    margin-top: -8px;
}

.calc-form__section-title {
    margin: 0 0 12px 0;
    font-size: 1.05rem;
    color: var(--text-main);
    font-weight: 600;
}
.calc-form__section-title--mb-xs { margin-bottom: 0.3rem; }
.calc-result__subtitle {
    margin-top: 24px;
    margin-bottom: 8px;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-main);
}
@media (max-width: 768px) {
    .result-table th, .result-table td {
        padding: 6px 8px;
        font-size: 0.78rem;
    }
    .result-table { font-size: 0.82rem; }
    .result-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
        width: 100%;
    }
    .calc-result, .calc-result-wrapper { max-width: 100%; overflow-x: hidden; }
    .info-tooltip__text {
        max-width: calc(100vw - 40px);
        width: auto;
        left: 0;
        transform: none;
    }
    .calc-date-toggle[open] .calc-date-range {
        min-width: 0;
        max-width: calc(100vw - 40px);
    }
    .result-grid--3 {
        grid-template-columns: 1fr;
    }
    .calc-toggle-group {
        flex-direction: column;
        gap: 6px;
        max-width: 100%;
        overflow: hidden;
    }
    .calc-toggle-group__label {
        white-space: normal;
        word-break: break-word;
    }
    .calc-field__label:not(.calc-field__label--inline) {
        display: block;
        white-space: normal;
        word-break: break-word;
    }
    .calc-form__row--auto {
        grid-template-columns: 1fr;
    }
    .calc-inline-toggle-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0.35rem;
    }
    .calc-date-toggle-wrap {
        max-width: 100%;
    }
    .result-highlight__badge {
        font-size: 0.65rem;
        padding: 1px 5px;
        margin-left: 4px;
    }
     .side-panel__section {
         min-width: unset;
     }
.side-panel .side-panel__collapsible {
    margin: 0;
    padding: 0;
}
.side-panel .side-panel__collapsible + .side-panel__collapsible {
    margin-top: 2px;
}
.side-panel .side-panel__collapsible summary {
         display: block;
         cursor: pointer;
         list-style: none;
         padding: 8px 0;
         font-weight: 600;
         font-size: 0.95rem;
         color: var(--text-main);
     }
     .side-panel .side-panel__collapsible summary::-webkit-details-marker {
         display: none;
     }
     .side-panel .side-panel__collapsible summary::after {
         content: " ▼";
         font-size: 0.7rem;
         opacity: 0.5;
     }
     .side-panel .side-panel__collapsible[open] summary::after {
         content: " ▲";
     }
}
[data-theme="dark"] .text-success { color: var(--success); }


/* Info tooltip (custom, replaces native title) */
.info-tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-left: 4px;
    color: var(--text-muted);
    cursor: help;
    vertical-align: middle;
}
.info-tooltip:hover,
.info-tooltip:focus {
    color: var(--primary);
}
.info-tooltip svg {
    display: block;
}
.info-tooltip__text {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    width: 260px;
    padding: 10px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    font-size: 0.78rem;
    line-height: 1.45;
    color: var(--text-main);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
    z-index: 100;
}

.info-tooltip:hover .info-tooltip__text,
.info-tooltip:focus .info-tooltip__text {
    opacity: 1;
    visibility: visible;
}

/* ===== Segmented toggle (modern pill switcher) ===== */
.segmented-toggle {
    display: inline-flex;
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 4px;
    gap: 2px;
    width: 100%;
    max-width: 320px;
}
.segmented-toggle__option {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    transition: all 0.2s ease;
    position: relative;
    user-select: none;
}
.segmented-toggle__option:hover {
    color: var(--text-main);
    background: rgba(var(--primary-rgb), 0.06);
}
.segmented-toggle__option input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.segmented-toggle__option--active,
.segmented-toggle__option:has(input:checked) {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.25);
}
.segmented-toggle__option--active:hover,
.segmented-toggle__option:has(input:checked):hover {
    background: var(--primary-light);
    color: #fff;
}
.segmented-toggle__icon {
    flex-shrink: 0;
}
[data-theme="dark"] .segmented-toggle {
    background: var(--bg-surface);
    border-color: var(--glass-border);
}
[data-theme="dark"] .segmented-toggle__option:hover {
    background: rgba(var(--primary-rgb), 0.08);
}
[data-theme="dark"] .segmented-toggle__option--active {
    background: var(--primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ===== Segmented toggle: 3 items (SHARED — alimony/salary) ===== */
.segmented-toggle--3 {
    max-width: 100%;
    width: auto;
}
.segmented-toggle--3 .segmented-toggle__option {
    flex: 1 1 auto;
    white-space: nowrap;
}

/* ===== Segmented toggle: 4 items (SHARED — date_diff/alimony) ===== */
.segmented-toggle--4 {
    max-width: 100%;
    width: 100%;
    gap: 4px;
}
.segmented-toggle--4 .segmented-toggle__option {
    flex: 1 1 0;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 8px 8px;
    font-size: 0.82rem;
}

/* ===== Mode toggle chips (SHARED — alimony/vacation/salary) ===== */
.calc-mode-toggle {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.calc-mode-chip {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid var(--glass-border);
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-weight: 500;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.calc-mode-chip:hover {
    border-color: var(--primary-light);
    color: var(--text-main);
}
.calc-mode-chip--active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--text-on-primary);
}
.calc-mode-chip--active:hover {
    background: var(--primary-light);
    border-color: var(--primary-light);
    color: var(--text-on-primary);
}
.calc-mode-chip__input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.calc-mode-chip__label {
    user-select: none;
}

/* ===== Result cards (SHARED — alimony/salary) ===== */
.calc-result-card {
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    background: var(--bg-surface);
    margin-bottom: 10px;
}
.calc-result-card--main {
    border: 2px solid var(--primary);
    background: var(--bg-surface);
}
.calc-result-card--main .calc-result-card__label {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.calc-result-card--main .calc-result-card__value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
}
.calc-result-card--secondary {
    flex: 1 1 0;
    min-width: 0;
}
.calc-result-card--secondary .calc-result-card__label {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 3px;
}
.calc-result-card--secondary .calc-result-card__value {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-main);
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
}
.calc-result-card--warning {
    border-color: var(--danger);
    background: var(--bg-surface);
}
.calc-result-card--warning .calc-result-card__label {
    font-size: 0.78rem;
    color: var(--danger);
}
.calc-result-card--warning .calc-result-card__value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--danger);
    font-variant-numeric: tabular-nums;
}
.calc-result-card--info {
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
}
.calc-result-card--info .calc-result-card__value {
    color: var(--info, var(--primary));
}
.calc-result-card__label {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 3px;
}
.calc-result-card__value {
    font-variant-numeric: tabular-nums;
}
.calc-result-card__value--text {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-main);
    cursor: default;
}
.calc-result-card__sub {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 6px;
    line-height: 1.4;
}
.calc-result-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}
.calc-result-card__value .copy-hint {
    font-size: 0.75rem;
    opacity: 0.4;
    transition: opacity var(--transition);
}
.calc-result-card__value:hover .copy-hint {
    opacity: 1;
}
[data-theme="dark"] .calc-result-card--main {
    border-color: var(--primary);
}
[data-theme="dark"] .calc-result-card--warning {
    border-color: var(--danger);
}
[data-theme="dark"] .calc-result-card--info {
    border-color: var(--glass-border);
}

/* ===== Segmented toggle 3/4 — mobile (SHARED) ===== */
@media (max-width: 480px) {
    .segmented-toggle--3,
    .segmented-toggle--4 {
        display: flex;
        width: 100%;
        max-width: 100%;
        flex-wrap: wrap;
        justify-content: center;
        gap: 3px;
        padding: 4px;
        border-radius: 10px;
    }
    .segmented-toggle--3 .segmented-toggle__option {
        flex: 1 1 45%;
        font-size: 0.75rem;
        padding: 5px 6px;
        border-radius: 6px;
        white-space: normal;
        line-height: 1.2;
        overflow: visible;
        text-overflow: clip;
    }
    .segmented-toggle--4 .segmented-toggle__option {
        flex: 1 1 45%;
        font-size: 0.8rem;
        padding: 5px 6px;
        border-radius: 6px;
        white-space: normal;
        line-height: 1.2;
        overflow: visible;
        text-overflow: clip;
    }
    .calc-result-row {
        flex-direction: column;
        gap: 8px;
    }
    .calc-result-card--main .calc-result-card__value {
        font-size: 1.5rem;
    }
}

/* ===== Profi fields container (calc_inflation) ===== */
.profi-fields {
    margin-top: 8px;
    padding-top: 16px;
    border-top: 1px dashed var(--glass-border);
}

/* ===== Glass input ===== */
.input-glass {
    display: flex;
    align-items: center;
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 0 4px 0 16px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}
.input-glass:focus-within {
    border-color: var(--border-focus);
}
.input-glass__field {
    flex: 1;
    border: none;
    background: transparent;
    padding: 12px 8px 12px 0;
    font-size: 1rem;
    color: var(--text-main);
    outline: none;
    min-width: 0;
}
.input-glass__field--readonly { cursor: default; }
.input-glass__field::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}
.input-glass__suffix {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 0 12px;
    user-select: none;
    border-left: 1px solid var(--glass-border);
    margin-left: 4px;
}
.input-glass--with-action {
    padding-right: 4px;
    gap: 4px;
}
.input-glass--with-action .input-glass__field {
    padding-right: 4px;
}

.input-glass--error,
.input-glass--error:focus-within {
    border-color: var(--danger) !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.08);
}

.select-glass--error .select-glass__field,
.select-glass--error .select-glass__field:focus {
    border-color: var(--danger) !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.08);
}

/* ===== Glass select ===== */
.select-glass {
    position: relative;
    display: flex;
    align-items: center;
}
.select-glass__field {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 12px 40px 12px 16px;
    font-size: 1rem;
    color: var(--text-main);
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.select-glass__field:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.08);
    outline: none;
}
.select-glass__icon {
    position: absolute;
    right: 14px;
    pointer-events: none;
    color: var(--text-muted);
}

/* ===== Tooltip ===== */
.calc-tooltip {
    position: fixed;
    background: var(--text-main);
    color: var(--bg-base);
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 500;
    line-height: 1.4;
    max-width: 280px;
    z-index: 1000;
    pointer-events: none;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    animation: tooltip-in 0.2s ease;
}
/* Mobile tooltip — prevent overflow */
@media (max-width: 768px) {
    .calc-tooltip {
        max-width: calc(100vw - 32px);
    }
}
@media (max-width: 480px) {
    .calc-tooltip {
        max-width: calc(100vw - 24px);
        font-size: 0.72rem;
        padding: 6px 10px;
    }
}
@keyframes tooltip-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}
[data-tooltip] {
    cursor: help;
    border-bottom: 1px dashed var(--glass-border);
}

/* Info tooltip inline */
.info-tooltip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--bg-surface);
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: help;
    margin-left: 4px;
    border: 1px solid var(--glass-border);
    transition: background var(--transition), color var(--transition);
}

.info-tooltip:hover {
    background: var(--primary);
    color: var(--text-on-primary);
    border-color: var(--primary);
}

[data-theme="dark"] .info-tooltip:hover {
    background: var(--primary-light);
}
[data-theme="dark"] .info-tooltip__text {
    background: #1e1e32;
    border-color: rgba(255,255,255,0.12);
    box-shadow: 0 4px 16px rgba(0,0,0,0.45);
    color: var(--text-main);
}

/* ===== FAB ===== */

/* Dark theme overrides */
[data-theme="dark"] .input-glass {
    background: var(--bg-surface);
    border-color: var(--glass-border);
}
[data-theme="dark"] .input-glass:focus-within {
    border-color: var(--border-focus);
}
[data-theme="dark"] .select-glass__field {
    background: var(--bg-surface);
    border-color: var(--glass-border);
    color: var(--text-main);
}
[data-theme="dark"] .select-glass__field option {
    background: var(--bg-card);
    color: var(--text-main);
}
[data-theme="dark"] .calc-tooltip {
    background: var(--bg-tooltip);
    color: var(--text-tooltip);
    border: 1px solid var(--glass-border);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .input-glass__field,
    .auth-form .form-input, .form-input,
    input[type="text"], input[type="email"], input[type="password"],
    input[type="tel"], input[type="search"], input[type="number"], input[type="date"],
    textarea, select,
    .activity-filter__input {
        font-size: 16px;
    }
}

/* ===== Skeleton loading ===== */
.skeleton-text {
    position: relative;
}
.skeleton-line {
    display: inline-block;
    min-width: 80px;
    min-height: 1em;
}
[data-loading="true"] .skeleton-line {
    background: linear-gradient(90deg, rgba(0,0,0,0.06) 25%, rgba(0,0,0,0.12) 50%, rgba(0,0,0,0.06) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 4px;
    color: transparent;
}
[data-theme="dark"] [data-loading="true"] .skeleton-line {
    background: linear-gradient(90deg, rgba(255,255,255,0.08) 25%, rgba(255,255,255,0.18) 50%, rgba(255,255,255,0.08) 75%);
    background-size: 200% 100%;
}
@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===== Side panel sections ===== */
.side-panel__section--sources {
    background: var(--panel-sources-bg);
    border: 1px solid var(--panel-sources-border);
}
.side-panel__text--sources {
    margin-bottom: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.side-panel__section--warning {
    background: var(--panel-warning-bg);
    border: 1px solid var(--panel-warning-border);
}
.side-panel__note {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 8px;
}

/* ===== Mobile: inflation ===== */
@media (max-width: 768px) {
    .segmented-toggle {
        max-width: 100%;
    }
    .profi-fields {
        padding-top: 12px;
    }
    .profi-fields .calc-form__row--2 {
        grid-template-columns: minmax(0, 1fr);
    }
    .calc-info-section {
        max-width: 100%;
        overflow-x: hidden;
    }
    .calc-info-section__body {
        min-width: 0;
    }
}

/* ===== Mobile: very narrow ===== */
@media (max-width: 480px) {
    html, body {
        overflow-x: hidden;    /* fallback */
        overflow-x: clip;      /* progressive — sticky header+tabs */
    }
    .segmented-toggle {
        flex-wrap: wrap;
        font-size: 0.8rem;
    }
    .segmented-toggle__option {
        padding: 6px 10px;
        gap: 4px;
    }
    .input-glass--with-action {
        flex-wrap: wrap;
    }
    .input-glass--with-action .btn {
        width: 100%;
        justify-content: center;
        padding: 6px 8px;
        font-size: 0.75rem;
    }
}


/* Currency calculator — migrated to components/calc_currency.css */

/* Vacation calculator — migrated to components/calc_vacation.css */

/* Amount text calculator — migrated to components/calc_amount_text.css */

/* EGRUL CTA button — hover via CSS (replaces inline onmouseover/onmouseout) */
.egrul-cta:hover {
    opacity: 0.85;
}

/* === Form consent (SHARED) — строка согласия под кнопкой формы (152-ФЗ) === */
.form-consent {
    margin: var(--space-sm) 0 0;
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.45;
    text-align: center;
}
.form-consent a {
    color: var(--primary);
    text-decoration: underline;
}
.form-consent a:hover {
    color: var(--primary-dark);
}
