/* Shared application palette. Landing pages keep their own styles.
   Общая палитра приложения. Главная страница использует свои стили. */
:root {
    --app-primary: #1677b8;
    --app-primary-hover: #0f5e93;
    --app-primary-soft: #eaf5fd;
    --app-sky: var(--AKME-light-2-blue);
    --app-sky-soft: var(--AKME-light-1-blue);
    --app-heading: #173e5b;
    --app-text: #29465b;
    --app-muted: #61788b;
    --app-line: #d7e5f0;
    --app-canvas: #f4f8fc;
    --app-surface: #fff;
    --app-success: #24825b;
    --app-success-soft: #e0f3e9;
    --app-danger: #b43c3c;
    --app-danger-soft: #fff3f2;
    --app-warning: #88621b;
    --app-warning-soft: #fff8e8;
    --app-radius: 1rem;
    --app-shadow: 0 8px 28px rgb(23 62 91 / 5%);
}

/* Scope every shared rule to the application layout, never the landing page.
   Ограничиваем общие правила макетом приложения, не затрагивая главную. */
.app-shell, .app-shell * { box-sizing: border-box; }
.app-shell { width: 100%; color: var(--app-text); background: var(--app-canvas); font-family: "Segoe UI", Arial, sans-serif; line-height: 1.55; }
.app-shell .main-content { min-width: 0; padding: 1rem clamp(1.1rem, 3vw, 3rem) 2rem; overflow: visible; }
.app-shell .content { width: 100%; max-width: 1320px; margin-inline: auto; padding-top: .8rem; }
.app-shell .app-language-bar { max-width: 1320px; margin-inline: auto; padding: 0; min-height: 42px; align-items: center; }
.app-shell :where(h1, h2, h3, h4, h5) { color: var(--app-heading); line-height: 1.3; overflow-wrap: anywhere; }
.app-shell :where(h1) { font-size: clamp(1.7rem, 3vw, 2.2rem); }
.app-shell :where(p) { overflow-wrap: anywhere; }
.app-shell :where(fieldset) { min-width: 0; padding: 0; border: 0; }
.app-shell :where(input, select, textarea, button) { font: inherit; }
.app-shell :where(a, button, input, select, textarea, summary):focus-visible { outline: 3px solid var(--app-primary); outline-offset: 3px; }
.app-shell :where(button, .btn) { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 42px; padding: .65rem 1rem; border: 1px solid transparent; border-radius: .65rem; color: #fff; background: var(--app-primary); font-size: .88rem; font-weight: 650; line-height: 1.3; text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s; }
.app-shell :where(button, .btn):hover { color: #fff; background: var(--app-primary-hover); }
.app-shell :where(button:disabled, fieldset:disabled button) { opacity: .55; cursor: default; }
.app-shell :where(button:disabled):hover { background: var(--app-primary); }
.app-shell :is(.btn-primary, .btn-success) { border-color: var(--app-primary); color: #fff; background: var(--app-primary); }
.app-shell :is(.btn-primary, .btn-success):hover { border-color: var(--app-primary-hover); background: var(--app-primary-hover); }
.app-shell :is(.btn-secondary, .btn-outline-secondary, .btn-outline-primary, .btn-light, .btn-warning) { color: var(--app-primary-hover); border-color: var(--app-line); background: var(--app-surface); }
.app-shell :is(.btn-secondary, .btn-outline-secondary, .btn-outline-primary, .btn-light, .btn-warning):hover { color: var(--app-primary-hover); border-color: var(--app-primary); background: var(--app-primary-soft); }
.app-shell .btn-danger { color: #fff; border-color: var(--app-danger); background: var(--app-danger); }
.app-shell .btn-danger:hover { background: #923030; }
.app-shell .btn-outline-danger { color: var(--app-danger); border-color: #edcece; background: #fff; }
.app-shell .btn-outline-danger:hover { color: var(--app-danger); border-color: var(--app-danger); background: var(--app-danger-soft); }
.app-shell .btn-sm { min-height: 36px; padding: .45rem .7rem; font-size: .8rem; }
.app-shell .btn-link { border: 0; background: none; color: var(--app-primary); }
.app-shell :is(.form-control, .form-select),
.app-shell :where(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="hidden"]), select, textarea) { width: 100%; min-width: 0; min-height: 44px; padding: .7rem .85rem; border: 1px solid var(--app-line); border-radius: .65rem; color: var(--app-text); background: var(--app-surface); box-shadow: none; }
.app-shell :is(.form-control, .form-select):focus { border-color: var(--app-primary); box-shadow: 0 0 0 3px rgb(22 119 184 / 12%); }
.app-shell :where(textarea) { min-height: 110px; resize: vertical; }
.app-shell :where(input[type="checkbox"], input[type="radio"]) { flex-shrink: 0; width: 18px; height: 18px; margin: 0; accent-color: var(--app-primary); }
.app-shell :where(label, legend) { color: var(--app-heading); font-weight: 600; font-size: .88rem; }
.app-shell .form-group { margin-bottom: 1rem; }
.app-shell .form-group > label, .app-shell .form-label { display: block; margin-bottom: .4rem; }
.app-shell .form-check { display: flex; align-items: center; gap: .65rem; padding: .45rem 0; }
.app-shell .form-check-label { min-width: 0; margin: 0; font-weight: 450; overflow-wrap: anywhere; }
.app-shell .form-text { color: var(--app-muted); font-size: .82rem; line-height: 1.55; }
.app-shell .input-group { gap: .5rem; }
.app-shell .form-group .input-group .input-group-append { padding: 0; }
.app-shell .password-toggle { width: 44px; min-height: 44px; padding: .5rem; border: 1px solid var(--app-line); color: var(--app-primary); background: var(--app-primary-soft); }
.app-shell .password-toggle:hover { color: var(--app-primary-hover); background: #dcedfa; }
.app-shell .password-toggle i { font-size: 1rem; }
.app-shell .validation-message, .app-shell .validation-errors { color: var(--app-danger); font-size: .82rem; margin-top: .35rem; }
.app-shell .alert { width: 100%; max-width: none; margin: 1rem 0; padding: 1rem 1.2rem; border: 1px solid var(--app-line); border-radius: .8rem; background: var(--app-primary-soft); }
.app-shell .alert p:first-child { margin-top: 0; }
.app-shell .alert p:last-child { margin-bottom: 0; }
.app-shell .alert-danger { color: var(--app-danger); border-color: #edcece; background: var(--app-danger-soft); }
.app-shell .alert-success { color: var(--app-success); border-color: #c9e9d7; background: var(--app-success-soft); }
.app-shell .alert-warning { color: var(--app-warning); border-color: #ebd8ac; background: var(--app-warning-soft); }

/* Reusable headings, cards and tables for old and new pages.
   Общие заголовки, карточки и таблицы для старых и новых страниц. */
.app-page { width: 100%; min-width: 0; padding-bottom: 2rem; }
.page-header { display: flex; justify-content: space-between; align-items: center; gap: 1.5rem; margin: 1rem 0 1.5rem; padding: clamp(1.25rem, 2.8vw, 2rem); border: 1px solid var(--app-line); border-radius: 1.2rem; background: linear-gradient(115deg, var(--app-primary-soft), #fff); }
.page-heading { min-width: 0; }
.page-eyebrow { display: block; color: var(--app-primary); font-size: .74rem; font-weight: 750; text-transform: uppercase; letter-spacing: .1em; }
.page-heading h1 { margin: .35rem 0 .55rem; color: var(--app-heading); font-size: clamp(1.65rem, 2.8vw, 2.2rem); }
.page-heading p { max-width: 720px; margin: 0; color: var(--app-muted); font-size: .92rem; }
.page-actions, .table-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.page-actions { flex-shrink: 0; }
.surface-card, .app-shell .card { padding: 1.4rem; border: 1px solid var(--app-line); border-radius: var(--app-radius); background: var(--app-surface); box-shadow: var(--app-shadow); }
.surface-card h2, .surface-card h3, .surface-card h4 { margin-top: 0; }
.app-shell .card-header { align-items: center; gap: .75rem; padding: .85rem 1rem; border-radius: .65rem; color: var(--app-heading); background: var(--app-primary-soft); }
.table-container { max-width: 100%; min-width: 0; overflow-x: auto; border: 1px solid var(--app-line); border-radius: var(--app-radius); background: var(--app-surface); box-shadow: var(--app-shadow); }
.data-table { width: 100%; min-width: 780px; border-collapse: collapse; text-align: left; font-size: .88rem; }
.data-table th { padding: 1rem 1.2rem; color: var(--app-heading); background: var(--app-primary-soft); font-size: .8rem; font-weight: 700; }
.data-table td { padding: 1.1rem 1.2rem; vertical-align: top; border-top: 1px solid var(--app-line); overflow-wrap: anywhere; }
.data-table tbody tr:hover { background: #f8fbfe; }
.data-table a { color: var(--app-primary-hover); font-weight: 600; text-decoration: none; }
.data-table a:hover { text-decoration: underline; }
.data-table .table-actions { min-width: 245px; }
.record-id { display: block; margin-top: .4rem; color: var(--app-muted); font: .7rem/1.5 Consolas, monospace; overflow-wrap: anywhere; }
.table-description { min-width: 180px; max-width: 420px; color: var(--app-muted); }
.table-description-text { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.status-badge { display: inline-flex; align-items: center; padding: .3rem .65rem; border-radius: 999px; color: var(--app-primary-hover); background: var(--app-primary-soft); font-size: .75rem; font-weight: 650; white-space: nowrap; }
.status-badge.is-muted { color: var(--app-muted); background: #edf1f5; }
.empty-state { margin: 1rem 0; padding: 2rem; border: 1px dashed var(--app-line); border-radius: var(--app-radius); color: var(--app-muted); background: var(--app-surface); line-height: 1.7; }
.empty-state p { margin: 0 0 1rem; }
.empty-state p:last-child { margin-bottom: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }
.group-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-top: 1.25rem; }
.group-card h2 { margin: 0 0 .6rem; font-size: 1.15rem; }
.group-card p { color: var(--app-muted); font-size: .84rem; }
.group-members { display: grid; gap: .2rem; max-height: 340px; overflow: auto; margin: 1rem 0; padding: .7rem 1rem; border: 1px solid var(--app-line); border-radius: .7rem; background: var(--app-canvas); }
.group-editor { margin-block: 1rem; }
.moderator-invite { display: flex; align-items: end; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.5rem; }
.moderator-invite .form-group { flex: 1 1 300px; margin: 0; }
.auth-page { width: 100%; max-width: 620px; margin: 0 auto 2rem; }
.auth-page .page-header { display: block; text-align: center; padding-block: 1.7rem; }
.app-shell .simple-form, .app-shell .registration-form { width: 100%; max-width: none; margin: 0; padding: clamp(1.2rem, 3vw, 2rem); border: 1px solid var(--app-line); border-radius: 1.1rem; background: var(--app-surface); box-shadow: var(--app-shadow); }
.app-shell .simple-form .form-control { border-color: var(--app-line); border-radius: .65rem; }
.app-shell .simple-form .btn-primary { width: 100%; padding: .8rem 1rem; border-radius: .65rem; font-size: .9rem; background: var(--app-primary); }
.app-shell .simple-form .btn-primary:hover { background: var(--app-primary-hover); }
.auth-links { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .75rem; margin-top: 1.25rem; font-size: .86rem; }
.auth-links a { color: var(--app-primary); text-decoration: none; }
.auth-links a:hover { text-decoration: underline; }
.choice-options { display: flex; flex-wrap: wrap; gap: 1.25rem; }
.choice-options label { display: inline-flex; align-items: center; gap: .55rem; font-weight: 450; }
.document-page { width: 100%; max-width: 980px; margin: 0 auto; }
.document-body { line-height: 1.8; }
.document-body p { margin: 0 0 1.15rem; }
.app-shell .language-option.is-active { background: var(--app-primary); }
.app-shell .language-option { min-height: 32px; color: var(--app-muted); background: transparent; }
.app-shell .language-option.is-active { color: #fff; }
.app-shell .language-option:focus-visible { outline-color: var(--app-primary); }
.app-shell .notification-container { width: min(420px, calc(100vw - 2rem)); z-index: 1200; }
.app-shell .notification { padding: .8rem 1rem; border: 1px solid var(--app-line); border-radius: .85rem; box-shadow: var(--app-shadow); }
.app-shell .notification p { margin: .2rem .7rem; font-size: .88rem; }
.app-shell .notification-success { color: var(--app-success); background: var(--app-success-soft); border-color: #c9e9d7; }
.app-shell .notification-error { color: var(--app-danger); background: var(--app-danger-soft); border-color: #edcece; }
.app-shell .notification-info { color: var(--app-primary-hover); background: var(--app-primary-soft); }
.app-shell .notification .close-button { min-height: 30px; color: inherit; background: none; }
.app-shell .popup { width: min(640px, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); border: 1px solid var(--app-line); border-radius: 1rem; box-shadow: var(--app-shadow); }
.app-shell .popup-header { border-color: var(--app-line); background: var(--app-primary-soft); }
.app-shell .popup-close-button { min-height: 30px; color: var(--app-muted); background: none; }

/* Legacy grids and native scoring tables share the same card treatment.
   Старые сетки и таблицы методик используют такое же оформление карточек. */
.app-shell .builder-shell .table { max-width: 100%; border: 1px solid var(--app-line); border-radius: .75rem; background: var(--app-surface); border-collapse: collapse; }
.app-shell .builder-shell :is(.th, th) { padding: .85rem 1rem; border-color: var(--app-line); color: var(--app-heading); background: var(--app-primary-soft); font-size: .8rem; }
.app-shell .builder-shell :is(.td, td) { min-width: 0; padding: .85rem 1rem; border-color: var(--app-line); color: var(--app-text); font-size: .85rem; overflow-wrap: anywhere; }
.app-shell .builder-shell .tr:hover .td { background: #f8fbfe; }
.app-shell .builder-shell .btn-delete { min-height: 36px; color: var(--app-danger); border: 1px solid #edcece; background: var(--app-danger-soft); }
.app-shell .builder-shell .btn-delete:hover { color: var(--app-danger); border-color: var(--app-danger); background: #ffe8e6; }
.app-shell .password-setup { margin-top: 1.25rem; }
.app-shell .btn i { font-size: 1rem; }

/* Sidebar occupies its own flex column: no second left offset on the content.
   Боковое меню уже занимает колонку Flexbox: второй отступ слева не нужен. */
.app-shell .sidebar { flex: 0 0 72px; width: 72px; border-right: 1px solid var(--app-line); background: var(--app-surface); }
.app-shell .sidebar:not(.collapsed) { flex-basis: 240px; width: 240px; }
.app-shell .sidebar:not(.collapsed) + .main-content { padding-left: clamp(1.1rem, 3vw, 3rem); }
.app-shell .burger-menu { position: static; display: flex; width: 44px; min-height: 44px; margin: 14px auto 12px; padding: .6rem; color: var(--app-primary); background: var(--app-primary-soft); }
.app-shell .burger-menu:hover { color: var(--app-primary-hover); background: #dcedfa; }
.app-shell .nav-menu { width: auto; padding: 0 8px; }
.app-shell .nav-item { padding: 0; }
.app-shell .sidebar .nav-link { width: 100%; min-height: 46px; margin-bottom: .35rem; padding: .8rem; border: 0; border-radius: .65rem; color: var(--app-muted); background: transparent; font-size: .86rem; font-weight: 550; }
.app-shell .sidebar .nav-link i { flex: 0 0 28px; text-align: center; font-size: 1.2rem; }
.app-shell .sidebar .nav-link:hover, .app-shell .sidebar .nav-link.active { color: var(--app-primary-hover); background: var(--app-primary-soft); }
.app-shell .sidebar .nav-text { margin-left: .7rem; }
.app-shell .sidebar.collapsed .nav-link { justify-content: center; padding-inline: .6rem; }
.app-shell .sidebar.collapsed .nav-text { margin: 0; }
.app-shell .mobile-bottom-nav { padding: .45rem .35rem max(.45rem, env(safe-area-inset-bottom)); gap: .3rem; border-color: var(--app-line); background: var(--app-surface); }
.app-shell .mobile-bottom-nav .nav-link { flex: 1 0 64px; min-height: 54px; padding: .4rem; border: 0; border-radius: .65rem; color: var(--app-muted); background: transparent; font-size: .7rem; font-weight: 550; }
.app-shell .mobile-bottom-nav .nav-link.active { color: var(--app-primary-hover); background: var(--app-primary-soft); }
.app-shell .mobile-bottom-nav .nav-text { font-size: .65rem; }

@media (max-width: 1000px) { .page-header { align-items: start; flex-direction: column; } .page-actions { flex-shrink: 1; } }
@media (max-width: 767.98px) {
    .app-shell .main-content { width: 100%; padding: 1rem .85rem calc(6.5rem + env(safe-area-inset-bottom, 0px)); }
    .app-shell .content { padding-top: .4rem; padding-bottom: 0; }
    .page-header { margin-top: .65rem; padding: 1.2rem; }
    .page-actions { width: 100%; }
    .group-grid, .form-grid { grid-template-columns: minmax(0, 1fr); }
    .surface-card, .app-shell .card { padding: 1.15rem; }
    .empty-state { padding: 1.3rem; }
    /* Keep every navigation label visible, including administrator sections.
       Все подписи меню видны целиком, включая разделы администратора. */
    .app-shell .mobile-bottom-nav { display: grid; grid-template-columns: repeat(auto-fit, minmax(64px, 1fr)); overflow: visible; }
    .app-shell .mobile-bottom-nav:has(> :nth-child(5)) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .app-shell .mobile-bottom-nav .nav-link { width: 100%; min-width: 0; min-height: 64px; }
    .app-shell .mobile-bottom-nav .nav-text { width: 100%; margin-top: .3rem; font-size: .69rem; line-height: 1.25; white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
    .app-shell:has(.mobile-bottom-nav > :nth-child(5)) .main-content { padding-bottom: calc(10rem + env(safe-area-inset-bottom, 0px)); }
}
@media (prefers-reduced-motion: reduce) { .app-shell *, .app-shell *::before, .app-shell *::after { scroll-behavior: auto; transition: none; animation: none; } }
