:root {
    --color-bg: #f7f8fa;
    --color-surface: #ffffff;
    --color-border: #e5e7eb;
    --color-text: #1f2430;
    --color-text-muted: #6b7280;
    --color-primary: #4f46e5;
    --color-primary-hover: #4338ca;
    --color-success: #16a34a;
    --color-warning: #d97706;
    --color-danger: #dc2626;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.05);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.container-narrow { max-width: 480px; margin: 0 auto; padding: 0 20px; }

/* ---- Top nav (public) ---- */
.site-header { border-bottom: 1px solid var(--color-border); background: var(--color-surface); }
.site-header .container { display: flex; align-items: center; justify-content: space-between; padding-top: 16px; padding-bottom: 16px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 1.25rem; color: var(--color-text); }
.brand span { color: var(--color-primary); }
.site-nav { display: flex; align-items: center; }
.site-nav a { margin-left: 20px; color: var(--color-text-muted); font-weight: 500; }
.site-nav a.btn-primary { color: #fff; }
.nav-toggle {
    display: none; background: none; border: 1px solid var(--color-border); border-radius: 6px;
    font-size: 1.3rem; line-height: 1; padding: 4px 10px; cursor: pointer; color: var(--color-text);
}
@media (max-width: 760px) {
    .nav-toggle { display: block; }
    .site-nav {
        display: none; flex-direction: column; align-items: stretch; width: 100%;
        margin-top: 12px; gap: 4px;
    }
    .site-nav.nav-open { display: flex; }
    .site-nav a { margin-left: 0; padding: 8px 0; }
    .site-nav .btn { display: block; text-align: center; margin-top: 6px; }
}
.btn { display: inline-block; padding: 10px 18px; border-radius: var(--radius); border: 1px solid transparent; font-weight: 600; cursor: pointer; font-size: 0.95rem; }
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-hover); text-decoration: none; }
.btn-secondary { background: var(--color-surface); border-color: var(--color-border); color: var(--color-text); }
.btn-secondary:hover { border-color: var(--color-primary); text-decoration: none; }
.btn-danger { background: #fee2e2; color: var(--color-danger); }
.btn-block { display: block; width: 100%; text-align: center; }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }

/* ---- Hero / landing ---- */
.hero { padding: 72px 0; text-align: center; }
.hero h1 { font-size: 2.4rem; margin-bottom: 16px; }
.hero p.lead { font-size: 1.15rem; color: var(--color-text-muted); max-width: 640px; margin: 0 auto 32px; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
@media (max-width: 600px) {
    .hero { padding: 48px 0; }
    .hero h1 { font-size: 1.7rem; }
    .hero p.lead { font-size: 1rem; }
}
.section { padding: 56px 0; }
.section h2 { text-align: center; font-size: 1.7rem; margin-bottom: 40px; }
.grid { display: grid; gap: 20px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; } }

.card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.card h3 { margin-top: 0; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; }
.badge-success { background: #dcfce7; color: var(--color-success); }
.badge-warning { background: #fef3c7; color: var(--color-warning); }
.badge-danger { background: #fee2e2; color: var(--color-danger); }
.badge-muted { background: #f3f4f6; color: var(--color-text-muted); }

.privacy-callout { background: #eef2ff; border: 1px solid #c7d2fe; border-radius: var(--radius); padding: 24px 28px; margin: 40px auto; max-width: 760px; text-align: center; }

/* ---- Landing hero social links ---- */
/* Squircle app-icon badges, styled to match MAX's own icon (assets/img/icon-max.png) -
   Telegram/VK get the same shape + brand-gradient treatment so all three read as one set. */
.hero-social { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 28px; flex-wrap: wrap; }
.hero-social a { display: inline-flex; align-items: center; justify-content: center; width: 52px; height: 52px; border-radius: 22%; overflow: hidden; transition: transform .15s ease, box-shadow .15s ease; }
.hero-social a img { width: 100%; height: 100%; display: block; }
.hero-social a svg { width: 58%; height: 58%; }
.hero-social a:hover { transform: translateY(-3px) scale(1.03); box-shadow: var(--shadow); text-decoration: none; }
.hero-social a[data-brand="telegram"] { background: linear-gradient(135deg, #6dd5fa 0%, #2599e0 55%, #1c6fc9 100%); }
.hero-social a[data-brand="vk"] { background: linear-gradient(135deg, #6a9dff 0%, #2b6bff 55%, #1a3fd6 100%); }

/* ---- Pricing (landing) - visual journey + plan cards, see HomeController/home/index.php ---- */
.pricing-flow { display: flex; align-items: stretch; gap: 0; margin: 8px 0 40px; }
.pricing-flow-step { flex: 1; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 20px; text-align: center; }
.pricing-flow-step .pricing-flow-num { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; background: var(--color-primary); color: #fff; font-weight: 700; font-size: 0.85rem; margin-bottom: 10px; }
.pricing-flow-step h4 { margin: 0 0 6px; font-size: 1rem; }
.pricing-flow-step p { margin: 0; font-size: 0.85rem; color: var(--color-text-muted); }
.pricing-flow-arrow { flex: 0 0 auto; display: flex; align-items: center; justify-content: center; width: 40px; color: var(--color-text-muted); font-size: 1.3rem; }
@media (max-width: 760px) {
    .pricing-flow { flex-direction: column; }
    .pricing-flow-arrow { width: auto; padding: 6px 0; transform: rotate(90deg); }
}

.check-list { list-style: none; padding: 0; margin: 0; font-size: 0.9rem; }
.check-list li { display: flex; gap: 8px; padding: 6px 0; }
.check-yes { color: var(--color-success); flex-shrink: 0; }
.check-no { color: var(--color-danger); flex-shrink: 0; }

.pricing-card { text-align: center; position: relative; }
.pricing-card.is-highlight { border: 2px solid var(--color-primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.08); padding: 23px; }
.pricing-card .pricing-badge { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--color-primary); color: #fff; font-size: 0.72rem; font-weight: 700; padding: 3px 12px; border-radius: 999px; white-space: nowrap; }
.pricing-card .pricing-price { font-size: 2rem; font-weight: 700; margin: 12px 0 0; }
.pricing-card .pricing-price small { font-size: 0.9rem; font-weight: 500; color: var(--color-text-muted); }
.pricing-card .pricing-strike { color: var(--color-text-muted); text-decoration: line-through; font-size: 0.95rem; }
.pricing-card .pricing-sub { font-size: 0.82rem; color: var(--color-text-muted); margin: 4px 0 20px; }

/* "Choose exactly one of these mutually exclusive options" pattern - used
   where picking option A instead of B is a real, consequential choice
   (e.g. the operator working-chat transport), not just two independent
   forms that happen to sit on the same page. */
.exclusive-choice { display: flex; align-items: stretch; gap: 0; margin: 16px 0; }
.exclusive-choice-option { flex: 1; border: 1px solid var(--color-border); border-radius: var(--radius); padding: 20px; min-width: 0; }
.exclusive-choice-option.is-active { border-color: var(--color-primary); border-width: 2px; padding: 19px; box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.08); }
.exclusive-choice-option h4 { margin-top: 0; }
.exclusive-choice-divider { flex: 0 0 auto; display: flex; align-items: center; justify-content: center; width: 56px; }
.exclusive-choice-divider span { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 999px; background: var(--color-bg); border: 1px solid var(--color-border); color: var(--color-text-muted); font-size: 0.75rem; font-weight: 700; text-transform: uppercase; }
@media (max-width: 700px) {
    .exclusive-choice { flex-direction: column; }
    .exclusive-choice-divider { width: auto; padding: 4px 0; }
}

footer.site-footer { border-top: 1px solid var(--color-border); padding: 32px 0; color: var(--color-text-muted); font-size: 0.9rem; }
footer.site-footer .container { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
footer.site-footer a { color: var(--color-text-muted); margin-right: 16px; }
.support-footer { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--color-border); color: var(--color-text-muted); font-size: 0.82rem; text-align: center; }
.support-footer a { color: var(--color-text-muted); }
.legal-requisites { margin-top: 6px; font-size: 0.72rem; opacity: 0.7; }
.cookie-banner {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000;
    background: #1f2430; color: #fff; padding: 14px 20px;
    display: flex; align-items: center; justify-content: center; gap: 16px; flex-wrap: wrap;
    font-size: 0.85rem; box-shadow: 0 -2px 12px rgba(0,0,0,.15);
}
.cookie-banner-text { max-width: 720px; }
.testing-mode-banner {
    background: #fef3c7; color: var(--color-warning); text-align: center;
    padding: 8px 16px; font-size: 0.82rem; font-weight: 600;
}
.cookie-banner a { color: #fff; text-decoration: underline; }
@media (max-width: 600px) { .cookie-banner { flex-direction: column; text-align: center; } }

/* ---- Auth pages ---- */
.auth-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 40px 16px; }
.auth-card { width: 100%; max-width: 440px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 36px; box-shadow: var(--shadow); }
.auth-card h1 { font-size: 1.4rem; margin-top: 0; }
@media (max-width: 480px) {
    .auth-shell { padding: 24px 12px; }
    .auth-card { padding: 22px; }
}
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.9rem; }
.form-group input[type=text], .form-group input[type=email], .form-group input[type=password], .form-group input[type=number], .form-group select, .form-group textarea {
    width: 100%; padding: 10px 12px; border: 1px solid var(--color-border); border-radius: 8px; font-size: 0.95rem;
}
.form-group input[type=text]:focus, .form-group input[type=email]:focus, .form-group input[type=password]:focus, .form-group input[type=number]:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}
.form-check { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 12px; font-size: 0.88rem; color: var(--color-text-muted); }
.form-check input { margin-top: 3px; }
.form-hint { font-size: 0.82rem; color: var(--color-text-muted); margin-top: 4px; }
.form-section-title { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-text-muted); margin: 28px 0 14px; }
.form-section-title:first-child { margin-top: 0; }

/* ---- Mode picker: a small set of mutually exclusive options, each with
   its own one-line explanation - radio input + card, native control kept
   for accessibility, :has() drives the selected look with no JS. ---- */
.mode-picker { display: flex; flex-direction: column; gap: 8px; }
.mode-picker-option {
    display: flex; align-items: flex-start; gap: 12px;
    border: 1px solid var(--color-border); border-radius: var(--radius);
    padding: 12px 14px; cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.mode-picker-option:hover { border-color: #b7bac3; }
.mode-picker-option:has(input:checked) { border-color: var(--color-primary); border-width: 2px; padding: 11px 13px; box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.08); background: #fbfbff; }
.mode-picker-option input { margin-top: 3px; flex-shrink: 0; accent-color: var(--color-primary); }
.mode-picker-option-body { flex: 1; min-width: 0; }
.mode-picker-option-title { font-weight: 600; font-size: 0.92rem; }
.mode-picker-option-desc { font-size: 0.82rem; color: var(--color-text-muted); margin-top: 2px; }
.mode-picker-panel { margin: 10px 0 0; padding: 16px; background: var(--color-bg); border: 1px solid var(--color-border); border-radius: var(--radius); }
.mode-picker-panel .form-group:last-child { margin-bottom: 0; }
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 0.9rem; }
.alert-error { background: #fee2e2; color: var(--color-danger); }
.alert-success { background: #dcfce7; color: var(--color-success); }
.alert-warning { background: #fef3c7; color: var(--color-warning); }
.auth-links { text-align: center; margin-top: 16px; font-size: 0.88rem; }

/* ---- Dashboard shell ---- */
.app-shell { display: flex; min-height: 100vh; }
.app-sidebar { width: 240px; background: var(--color-surface); border-right: 1px solid var(--color-border); padding: 24px 0; flex-shrink: 0; }
.app-sidebar .brand { padding: 0 24px 20px; display: block; }
.app-sidebar nav a { display: block; padding: 10px 24px; color: var(--color-text-muted); font-weight: 500; font-size: 0.92rem; }
.app-sidebar nav a:hover, .app-sidebar nav a.active { background: #f3f4f6; color: var(--color-primary); text-decoration: none; }
.app-main { flex: 1; padding: 32px; min-width: 0; }
.app-topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.page-title { font-size: 1.5rem; margin: 0; }
@media (max-width: 800px) {
    .app-shell { flex-direction: column; }
    .app-sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--color-border); }
}
@media (max-width: 600px) {
    .app-main { padding: 20px 16px; }
    .card { padding: 18px; }
}

table { width: 100%; border-collapse: collapse; }
table th, table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--color-border); font-size: 0.9rem; }
table th { color: var(--color-text-muted); font-weight: 600; }
/* Wide tables (5+ columns) don't fit a phone screen - scroll horizontally
   inside their own box instead of forcing the whole page to scroll or
   crushing every column unreadably narrow. */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-responsive table { width: auto; min-width: 100%; }

.bulk-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; padding: 10px 12px; background: var(--color-bg); border: 1px solid var(--color-border); border-radius: var(--radius); }
.bulk-toolbar-group { display: inline-flex; align-items: center; gap: 4px; }

.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.muted { color: var(--color-text-muted); }
.legal-content h2 { margin-top: 32px; text-align: left; font-size: 1.35rem; }
.wizard-steps { counter-reset: step; list-style: none; padding: 0; }
.wizard-steps li { counter-increment: step; margin-bottom: 20px; padding-left: 40px; position: relative; }
.wizard-steps li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%; background: var(--color-primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.85rem; }
code, .code { background: #f3f4f6; padding: 2px 6px; border-radius: 4px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.88em; overflow-wrap: anywhere; }

/* ---- Pure-CSS section tabs (radio + label + ~ sibling selectors, no JS) ----
   Same technique as admin/settings.php's .settings-tabs, generalized here so
   any page (not just admin) can reuse it instead of re-inventing tabs. */
.page-tabs .page-tab-radio { position: absolute; opacity: 0; pointer-events: none; }
.page-tabs .page-tab-nav { display: flex; flex-wrap: wrap; gap: 2px; border-bottom: 1px solid var(--color-border); margin-bottom: 20px; }
.page-tabs .page-tab-btn { display: inline-block; padding: 10px 16px; cursor: pointer; border-radius: 8px 8px 0 0; font-size: 0.9rem; font-weight: 500; color: var(--color-text-muted); user-select: none; }
.page-tabs .page-tab-btn:hover { color: var(--color-text); background: var(--color-bg); }
.page-tabs .page-tab-panel { display: none; }
#page-tab-chats:checked ~ .page-tab-nav label[for="page-tab-chats"],
#page-tab-getcourse:checked ~ .page-tab-nav label[for="page-tab-getcourse"] { color: var(--color-primary); background: #eef2ff; border-bottom: 2px solid var(--color-primary); }
#page-tab-chats:checked ~ #page-panel-chats,
#page-tab-getcourse:checked ~ #page-panel-getcourse { display: block; }

/* ---- Кросспостинг: the rule editor's tabs live INSIDE the <form>, hence the `~ form` selectors ---- */
#page-tab-xp-src:checked ~ .page-tab-nav label[for="page-tab-xp-src"],
#page-tab-xp-utm:checked ~ .page-tab-nav label[for="page-tab-xp-utm"],
#page-tab-xp-adapt:checked ~ .page-tab-nav label[for="page-tab-xp-adapt"],
#page-tab-xp-notify:checked ~ .page-tab-nav label[for="page-tab-xp-notify"] { color: var(--color-primary); background: #eef2ff; border-bottom: 2px solid var(--color-primary); }
#page-tab-xp-src:checked ~ form #page-panel-xp-src,
#page-tab-xp-utm:checked ~ form #page-panel-xp-utm,
#page-tab-xp-adapt:checked ~ form #page-panel-xp-adapt,
#page-tab-xp-notify:checked ~ form #page-panel-xp-notify { display: block; }
.xp-tabs .card { margin-bottom: 16px; }

/* ---- Tariff comparison table (resources/views/partials/tariff_comparison.php) ---- */
.tariff-perks { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.tariff-perk { flex: 1; min-width: 220px; display: flex; gap: 12px; align-items: flex-start; background: var(--color-bg); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 14px 16px; }
.tariff-perk-icon { font-size: 1.5rem; line-height: 1; flex-shrink: 0; }
.tariff-perk strong { display: block; font-size: 0.9rem; margin-bottom: 2px; }
.tariff-perk span { display: block; font-size: 0.8rem; color: var(--color-text-muted); }
.tariff-table { min-width: 520px; }
.tariff-table th, .tariff-table td { text-align: center; vertical-align: middle; }
.tariff-table thead th:first-child { background: none; border: none; }
.tariff-table td:first-child { text-align: left; font-size: 0.88rem; }
.tariff-col-badge { display: inline-block; padding: 4px 14px; border-radius: 999px; font-size: 0.82rem; font-weight: 700; }
.tariff-col-badge-free { background: #f3f4f6; color: var(--color-text-muted); }
.tariff-col-badge-pro { background: var(--color-primary); color: #fff; }
.tariff-table .tariff-col-pro { background: rgba(79, 70, 229, 0.045); border-left: 1px solid rgba(79, 70, 229, 0.12); border-right: 1px solid rgba(79, 70, 229, 0.12); }
.tariff-table .tariff-section-row td { background: var(--color-bg); text-align: left; font-weight: 700; font-size: 0.82rem; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.03em; padding-top: 14px; padding-bottom: 8px; }
.tariff-check-yes { color: var(--color-success); font-weight: 700; }
.tariff-check-no { color: var(--color-danger); font-weight: 700; }
.tariff-locked { font-size: 0.95rem; opacity: 0.55; }
.tariff-count { display: block; font-weight: 700; font-size: 1rem; }
.tariff-count-pro { color: var(--color-primary); }
.tariff-bar-track { display: block; width: 72px; height: 5px; margin: 4px auto 0; border-radius: 999px; background: var(--color-border); overflow: hidden; }
.tariff-bar-fill { display: block; height: 100%; border-radius: 999px; }
.tariff-bar-free { background: #9ca3af; }
.tariff-bar-pro { background: var(--color-primary); }
@media (max-width: 600px) {
    .tariff-perks { flex-direction: column; }
}
img { max-width: 100%; height: auto; }

/* ---- Glossary: /glossary page and hover/focus term tooltips (App\Domain\Glossary) ---- */
.glossary-toc { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 20px 0 8px; font-size: 0.9rem; }
.glossary-list { margin: 12px 0 0; }
.glossary-item { padding: 14px 0; border-bottom: 1px solid var(--color-border); }
.glossary-item dt { font-weight: 700; }
.glossary-item dd { margin: 4px 0 0; color: var(--color-text); font-size: 0.95rem; }
.glossary-was { font-weight: 400; font-size: 0.8rem; color: var(--color-text-muted); margin-left: 6px; }
.glossary-item:target { background: #eef2ff; margin: 0 -12px; padding-left: 12px; padding-right: 12px; border-radius: 8px; }
.term { position: relative; display: inline; cursor: help; }
.term-word { border-bottom: 1px dotted var(--color-primary); }
.term-tip {
    display: none; position: absolute; z-index: 60; left: 0; top: 100%; margin-top: 6px;
    width: max-content; max-width: min(320px, 80vw); padding: 10px 12px; border-radius: 8px;
    background: #1f2430; color: #fff; font-size: 0.82rem; font-weight: 400; line-height: 1.4;
    text-align: left; text-transform: none; letter-spacing: 0; box-shadow: 0 6px 20px rgba(16, 24, 40, 0.25);
}
.term-tip a { color: #c7d2fe; text-decoration: underline; white-space: nowrap; }
.term:hover .term-tip, .term:focus .term-tip, .term:focus-within .term-tip { display: block; }
.term:focus { outline: 2px solid var(--color-primary); outline-offset: 2px; border-radius: 3px; }
@media (max-width: 600px) { .term-tip { left: 0; max-width: 78vw; } }
.term-tip::before { content: ""; position: absolute; left: 0; right: 0; top: -8px; height: 8px; }

/* ---- Cabinet navigation (stage 3) ---- */
.app-sidebar { display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.app-sidebar nav { flex: 1; }
.app-sidebar nav a { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.nav-dot { width: 8px; height: 8px; border-radius: 50%; background: #dc2626; display: inline-block; flex-shrink: 0; }
.nav-badge { font-size: 0.72rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: #e0e7ff; color: var(--color-primary); white-space: nowrap; }
.nav-badge-warn { background: #fef3c7; color: #92400e; }
.nav-badge-muted { background: #f3f4f6; color: var(--color-text-muted); }
.app-user-menu { border-top: 1px solid var(--color-border); padding-top: 12px; margin-top: 12px; }
.app-user-menu a { display: flex; align-items: center; justify-content: space-between; padding: 8px 24px; color: var(--color-text-muted); font-size: 0.88rem; }
.app-user-menu a:hover, .app-user-menu a.active { color: var(--color-primary); text-decoration: none; }
.app-user-menu form { padding: 8px 24px 0; margin: 0; }
.app-account-info { padding: 8px 24px 0; overflow: hidden; }
.app-account-company { font-size: 0.85rem; font-weight: 600; color: var(--color-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-account-email { font-size: 0.78rem; color: var(--color-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bottombar-more-list .app-account-info { padding: 6px 12px 0; }
.breadcrumbs { display: flex; flex-wrap: wrap; gap: 6px; font-size: 0.82rem; color: var(--color-text-muted); margin-bottom: 12px; }
.breadcrumbs a { color: var(--color-text-muted); }
.section-tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--color-border); margin-bottom: 24px; }
.section-tab { padding: 10px 16px; color: var(--color-text-muted); font-weight: 500; font-size: 0.92rem; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.section-tab:hover { color: var(--color-primary); text-decoration: none; }
.section-tab.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.section-tab-locked { opacity: 0.7; }
/* five tabs on «Главная»: one row that scrolls sideways on a phone instead of wrapping */
@media (max-width: 640px) {
    .section-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
    .section-tabs::-webkit-scrollbar { display: none; }
    .section-tab { flex: 0 0 auto; white-space: nowrap; padding: 10px 12px; }
}
.app-bottombar { display: none; }
@media (max-width: 800px) {
    .app-sidebar { display: none; }
    .app-main { padding-bottom: 88px; }
    .app-bottombar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: var(--color-surface); border-top: 1px solid var(--color-border); }
    .app-bottombar > a, .app-bottombar summary { flex: 1; text-align: center; padding: 12px 4px; font-size: 0.72rem; font-weight: 600; color: var(--color-text-muted); position: relative; list-style: none; cursor: pointer; }
    .app-bottombar > a.active { color: var(--color-primary); }
    .app-bottombar .nav-dot { position: absolute; top: 8px; right: 22%; }
    .app-bottombar summary::-webkit-details-marker { display: none; }
    .bottombar-more { flex: 1; position: static; }
    .bottombar-more-list { position: absolute; right: 8px; bottom: 56px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 12px; padding: 8px; min-width: 200px; box-shadow: 0 8px 24px rgba(0,0,0,.12); }
    .bottombar-more-list a { display: block; padding: 10px 12px; color: var(--color-text); font-size: 0.9rem; }
    .bottombar-more-list form { padding: 6px 12px 4px; margin: 0; }
}
.flow-scheme { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 20px; }
.flow-node { padding: 8px 14px; border-radius: 10px; background: #f3f4f6; font-size: 0.88rem; font-weight: 600; }
.flow-node-accent { background: #e0e7ff; color: var(--color-primary); }
.flow-arrow { color: var(--color-text-muted); }
.pro-lock { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 16px; margin-bottom: 20px; border: 1px solid #c7d2fe; background: #eef2ff; border-radius: var(--radius); font-size: 0.92rem; }

/* ---- Tariff page (stage 4) ---- */
.plan-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-top: 12px; }
.plan-choice { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 18px; border: 2px solid var(--color-border); border-radius: var(--radius); cursor: pointer; text-align: center; }
.plan-choice input { position: absolute; opacity: 0; pointer-events: none; }
.plan-choice:has(input:checked) { border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(79,70,229,0.12); background: #f5f7ff; }
.plan-choice:has(input:focus-visible) { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.plan-choice-best { border-color: #a5b4fc; }
.plan-name { font-weight: 600; }
.plan-price strong { font-size: 1.5rem; }
.plan-price s { margin-right: 6px; }
.plan-sub { font-size: 0.82rem; }
.plan-ribbon { align-self: center; background: #16a34a; color: #fff; font-size: 0.75rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; }
.pay-methods { display: flex; flex-direction: column; gap: 6px; }
.pay-methods label { font-weight: 400; }
.pay-note { background: var(--color-bg); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 10px 14px; font-size: 0.9rem; }
.pay-result { border-color: var(--color-primary); }
.pay-result-ok { border-color: #16a34a; background: #f0fdf4; }
.lose-list, .gain-list { margin: 0 0 16px; padding-left: 20px; }
.lose-list li::marker { color: #dc2626; }
.gain-list li::marker { color: #16a34a; }
.app-sidebar a.pro-card { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; margin: 12px 16px 0; padding: 12px 14px; border-radius: 12px; background: linear-gradient(135deg, #eef2ff, #e0e7ff); border: 1px solid #c7d2fe; color: var(--color-text); font-size: 0.85rem; }
.app-sidebar a.pro-card:hover { background: linear-gradient(135deg, #e0e7ff, #c7d2fe); color: var(--color-text); }
.pro-card span { color: var(--color-text-muted); font-size: 0.78rem; font-weight: 400; }
.pro-card em { color: var(--color-primary); font-style: normal; font-weight: 600; margin-top: 4px; }
.app-sidebar a.pro-card-warn { background: #fffbeb; border-color: #fde68a; }
.app-sidebar a.pro-card-ok { background: #f0fdf4; border-color: #bbf7d0; }

/* ---- Home (stage 5) ---- */
.status-strip { padding: 14px 18px; border-radius: var(--radius); margin-bottom: 20px; }
.status-strip-ok { background: #f0fdf4; border: 1px solid #bbf7d0; }
.status-strip-warn { background: #fffbeb; border: 1px solid #fde68a; }
.attention-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.attention-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.attention-details { flex: 1; min-width: 200px; }
.attention-details summary { cursor: pointer; color: inherit; }
.attention-details summary::-webkit-details-marker { color: var(--color-text-muted); }
.attention-details ul { list-style: none; margin: 6px 0 0; padding: 0 0 0 16px; display: flex; flex-direction: column; gap: 3px; font-size: .85rem; color: var(--color-text-muted); border-left: 2px solid var(--color-border); }
.next-step { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; border-color: #c7d2fe; background: #f5f7ff; }
.home-tariff { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.home-tariff-trial { border-color: #fde68a; background: #fffbeb; }
.home-stats-head { display: flex; align-items: baseline; justify-content: space-between; margin: 8px 0 12px; }
.home-stats { margin-bottom: 24px; }
.stat-num { font-size: 1.8rem; font-weight: 700; }
.link-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.link-list li { display: flex; flex-direction: column; gap: 2px; word-break: break-all; }
.link-list li span { font-size: 0.82rem; color: var(--color-text-muted); }
.empty-state { text-align: center; padding: 32px 20px; }

/* ---- Proxy/Relay risk (stage 6) ---- */
.risk-box { background: #fffbeb; border: 1px solid #fde68a; border-radius: var(--radius); padding: 12px 14px; margin: 12px 0; font-size: 0.88rem; }
.badge-risk { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; font-weight: 500; }
/* Quiet inline hint (e.g. "works through Proxy/Relay") - reuses .term-tip's hover/focus tooltip
   mechanics (see glossary highlighting) but a muted grey marker instead of the glossary's blue
   dotted underline, so it doesn't read as a defined term or as an alarming status badge. */
.risk-hint { position: relative; display: inline-block; cursor: help; color: var(--color-text-muted); font-size: 0.85rem; vertical-align: 1px; }
.risk-hint:hover, .risk-hint:focus { color: var(--color-text); }
.risk-hint:focus { outline: 2px solid var(--color-primary); outline-offset: 2px; border-radius: 3px; }
.risk-hint:hover .term-tip, .risk-hint:focus .term-tip, .risk-hint:focus-within .term-tip { display: block; }

/* ---- Help (stage 7) ---- */
.help-card { display: flex; flex-direction: column; gap: 6px; color: var(--color-text); }
.help-card:hover { text-decoration: none; border-color: var(--color-primary); }
.help-card .muted { font-size: 0.88rem; font-weight: 400; }
.help-category { margin-bottom: 24px; }
.instruction { display: flex; flex-direction: column; gap: 16px; max-width: 820px; }
.faq dt { font-weight: 600; margin-top: 10px; }
.faq dt:first-child { margin-top: 0; }
.faq dd { margin: 2px 0 0; color: var(--color-text-muted); }

/* ---- Wizard mode (stage 7) ---- */
.wizard-shell { min-height: 100vh; background: var(--color-bg); }
.wizard-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 24px; background: var(--color-surface); border-bottom: 1px solid var(--color-border); }
.wizard-main { max-width: 680px; margin: 0 auto; padding: 32px 16px 64px; }
.wizard-progress { display: flex; align-items: center; gap: 6px; margin-bottom: 20px; }
.wizard-dot { width: 28px; height: 6px; border-radius: 3px; background: var(--color-border); }
.wizard-dot.done { background: #16a34a; }
.wizard-dot.current { background: var(--color-primary); }
.wizard-list { list-style: none; padding: 0; margin: 0 0 20px; display: flex; flex-direction: column; gap: 6px; }
.wizard-list li.current { font-weight: 600; }
.wizard-list li.done { color: var(--color-text-muted); }
.wizard-return { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 16px; background: #eef2ff; border: 1px solid #c7d2fe; border-radius: var(--radius); font-size: 0.9rem; }
