:root {
    --dashboard-sidebar-width: 240px;
    --dashboard-bg: #f5f7fb;
    --dashboard-surface: #ffffff;
    --dashboard-border: #e2e8f2;
    --dashboard-text: #10213e;
    --dashboard-muted: #71809a;
    --dashboard-primary: #2864f0;
    --dashboard-primary-soft: #eaf1ff;
    --dashboard-shadow: 0 8px 24px rgba(30, 57, 101, 0.055);
}

/*
 * Страницы кабинета рендерятся сервером. Cross-document View Transition
 * сохраняет сайдбар визуально неподвижным при переходе между разделами,
 * пока основная рабочая область заменяется новым документом.
 */
@view-transition {
    navigation: auto;
}

.user-dashboard-page .sidebar {
    view-transition-name: dashboard-sidebar;
}

::view-transition-old(dashboard-sidebar),
::view-transition-new(dashboard-sidebar) {
    animation: none;
}

body.user-dashboard-page {
    background: var(--dashboard-bg);
    color: var(--dashboard-text);
}

.user-dashboard-page .app-container {
    min-height: 100vh;
    height: auto;
    overflow: visible;
}

.user-dashboard-page .sidebar {
    width: var(--dashboard-sidebar-width);
    background: #f9fafc;
    border-right: 1px solid var(--dashboard-border);
    box-shadow: 8px 0 24px rgba(30, 57, 101, 0.025);
}

.user-dashboard-page .logo {
    min-height: 88px;
    padding: 22px 24px 16px;
    border-bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-dashboard-page .logo a {
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-dashboard-page .logo img {
    display: block;
    width: 174px;
    max-width: 100%;
    max-height: 48px;
    object-fit: contain;
}

.user-dashboard-page .menu {
    padding: 12px 12px 18px;
}

.user-dashboard-page .menu ul {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.user-dashboard-page .menu li {
    margin: 0;
}

.user-dashboard-page .menu a,
.user-dashboard-page .sidebar-admin-link,
.user-dashboard-page .sidebar-logout {
    position: relative;
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    min-height: 44px;
    margin: 0;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 11px;
    background: transparent;
    color: #4e5d75;
    font: inherit;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.2;
    text-align: left;
    text-decoration: none;
    transition: background-color .18s ease, color .18s ease, border-color .18s ease;
}

.user-dashboard-page .menu a i,
.user-dashboard-page .sidebar-admin-link i,
.user-dashboard-page .sidebar-logout i {
    width: 20px;
    flex: 0 0 20px;
    margin: 0;
    color: #7a879b;
    font-size: 18px;
    text-align: center;
    transition: color .18s ease;
}

.user-dashboard-page .menu a:hover {
    background: #f0f3f8;
    color: var(--dashboard-text);
}

.user-dashboard-page .menu li.active a {
    background: var(--dashboard-primary-soft);
    color: #2455d6;
    font-weight: 600;
}

.user-dashboard-page .menu li.active a::before {
    content: "";
    position: absolute;
    left: 0;
    top: 12px;
    bottom: 12px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--dashboard-primary);
}

.user-dashboard-page .menu li.active a i {
    color: var(--dashboard-primary);
}

.user-dashboard-page .sidebar-badge {
    min-width: 20px;
    height: 20px;
    margin-left: auto;
    padding: 0 6px;
    border-radius: 10px;
    background: #e8515b;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
}

.user-dashboard-page .bottom-menu {
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding: 14px 12px 18px;
    border-top: 1px solid var(--dashboard-border);
}

.user-dashboard-page .subscription-sidebar-notice {
    margin: auto 12px 12px;
    padding: 15px;
    border: 1px solid #f0cf71;
    border-radius: 12px;
    background: #fff8df;
    color: #654d0b;
    font-size: 14px;
    line-height: 1.48;
}

.user-dashboard-page .subscription-sidebar-notice.is-expired {
    border-color: #efb9bd;
    background: #fff0f1;
    color: #7d2830;
}

.user-dashboard-page .subscription-notice-title { display: flex; gap: 8px; align-items: center; font-size: 14.5px; }
.user-dashboard-page .subscription-sidebar-notice p { margin: 9px 0 6px; }
.user-dashboard-page .subscription-sidebar-notice small { display: block; overflow: hidden; font-size: 13px; line-height: 1.45; text-overflow: ellipsis; }
.user-dashboard-page .subscription-notice-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.user-dashboard-page .subscription-notice-actions a { color: inherit; font-size: 14px; font-weight: 700; text-decoration: none; }
.user-dashboard-page .subscription-notice-actions a.is-secondary { font-weight: 500; text-decoration: underline; }
.user-dashboard-page .subscription-mobile-notice { display: none; }

.templates-page .template-free-survivor-badge {
    align-self: flex-start;
    margin-top: 4px;
    padding: 2px 7px;
    border-radius: 999px;
    background: #e8f7ee;
    color: #187647;
    font-size: 11px;
    font-weight: 700;
}

.user-dashboard-page .sidebar-admin-link {
    background: #fff7df;
    border-color: #f4df9f;
    color: #7e5b00;
}

.user-dashboard-page .sidebar-admin-link i {
    color: #a77700;
}

.user-dashboard-page .sidebar-admin-link:hover {
    background: #ffefbd;
    color: #654900;
}

.user-dashboard-page .sidebar-logout {
    cursor: pointer;
}

.user-dashboard-page .sidebar-logout:hover {
    background: #f0f3f8;
    color: var(--dashboard-text);
}

.user-dashboard-page .main-content {
    width: calc(100% - var(--dashboard-sidebar-width));
    min-height: 100vh;
    margin-left: var(--dashboard-sidebar-width);
    padding: 18px 22px 32px;
    background: var(--dashboard-bg);
    align-items: stretch;
}

.user-dashboard-page .main-content > * {
    width: 100%;
}

.user-dashboard-page .main-content > .header:not(.template-header-card) {
    min-height: 86px;
    margin: 0 0 18px;
    padding: 18px 22px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    border: 1px solid var(--dashboard-border);
    border-radius: 14px;
    background: var(--dashboard-surface);
    box-shadow: var(--dashboard-shadow);
}

.user-dashboard-page .main-content > .header:not(.template-header-card) h1 {
    margin: 0 0 4px;
    color: var(--dashboard-text);
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -.02em;
}

.user-dashboard-page .main-content > .header:not(.template-header-card) p {
    margin: 0;
    color: var(--dashboard-muted);
    font-size: 14px;
}

.user-dashboard-page .header-content,
.user-dashboard-page .header-title {
    width: 100%;
}

.user-dashboard-page .card {
    border: 1px solid var(--dashboard-border);
    border-radius: 14px;
    background: var(--dashboard-surface);
    box-shadow: var(--dashboard-shadow);
    overflow: hidden;
}

.user-dashboard-page .card-header,
.user-dashboard-page .card-header.bg-white {
    padding: 14px 18px;
    border-bottom: 1px solid var(--dashboard-border);
    background: #fbfcfe !important;
    color: var(--dashboard-text);
}

.user-dashboard-page .card-header h4,
.user-dashboard-page .card-header h5 {
    color: var(--dashboard-text);
    font-size: 17px;
    font-weight: 650;
}

.user-dashboard-page .card-body {
    padding: 16px 18px;
}

.user-dashboard-page .form-control,
.user-dashboard-page .form-select {
    min-height: 42px;
    border-color: #d8e0eb;
    border-radius: 9px;
    color: var(--dashboard-text);
    box-shadow: none;
}

.user-dashboard-page .form-control:focus,
.user-dashboard-page .form-select:focus {
    border-color: #83a7ff;
    box-shadow: 0 0 0 3px rgba(40, 100, 240, .11);
}

.user-dashboard-page .btn {
    border-radius: 9px;
    font-weight: 550;
}

.user-dashboard-page .btn-primary {
    background: var(--dashboard-primary);
    border-color: var(--dashboard-primary);
}

.user-dashboard-page .table {
    margin-bottom: 0;
    color: var(--dashboard-text);
    vertical-align: middle;
}

.user-dashboard-page .table thead th {
    padding: 12px 14px;
    border: 0;
    background: #f7f9fc;
    color: #43516a;
    font-size: 13px;
    font-weight: 650;
    white-space: nowrap;
}

.user-dashboard-page .table tbody td {
    padding: 13px 14px;
    border-color: #e8edf4;
}

.user-dashboard-page .table tbody tr:hover > td {
    background: #f8faff;
}

.user-dashboard-page .modal-content {
    border: 1px solid var(--dashboard-border);
    border-radius: 15px;
    box-shadow: 0 22px 60px rgba(20, 38, 70, .16);
}

/* Шаблоны */
.templates-page .templates-create-panel {
    display: grid;
    width: 100%;
    max-width: var(--content-max-width);
    min-height: 108px;
    grid-template-columns: minmax(250px, .65fr) minmax(720px, 2.35fr);
    align-items: center;
    gap: 28px;
    margin: 0 auto 18px 0;
    padding: 18px 20px;
    border: 1px solid var(--dashboard-border);
    border-radius: 14px;
    background: var(--dashboard-surface);
    box-shadow: var(--dashboard-shadow);
}

.templates-page .templates-page-intro h1 {
    margin: 0 0 4px;
    color: var(--dashboard-text);
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -.02em;
}

.templates-page .templates-page-intro p {
    margin: 0;
    color: var(--dashboard-muted);
    font-size: 14px;
}

.templates-page #addTemplateForm {
    display: grid;
    min-width: 0;
    grid-template-columns: minmax(210px, 1fr) minmax(210px, 1fr) minmax(185px, auto);
    align-items: start;
    gap: 12px;
    margin: 0;
    padding: 0;
    border: 0 !important;
}

.templates-page .template-create-field,
.templates-page .template-create-submit {
    min-width: 0;
}

.templates-page #addTemplateForm .form-control,
.templates-page #addTemplateForm .btn {
    min-height: 42px;
}

.templates-page #addTemplateForm .btn {
    width: 100%;
    min-width: 185px;
    padding-right: 18px;
    padding-left: 18px;
    white-space: nowrap;
}

.templates-page .template-limit-notice {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 12px;
    margin-top: -6px;
    padding: 12px 14px;
    border: 1px solid #f0d89b;
    border-radius: 11px;
    color: #614b13;
    background: #fff9e9;
}

.templates-page .template-limit-notice[hidden] {
    display: none;
}

.templates-page .template-limit-notice__icon {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    color: #9a6b00;
    background: #ffedb9;
    font-size: 17px;
}

.templates-page .template-limit-notice__copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.templates-page .template-limit-notice__copy strong {
    color: #4f3b0d;
    font-size: 14px;
    font-weight: 700;
}

.templates-page .template-limit-notice__copy span {
    color: #7b6630;
    font-size: 13px;
    line-height: 1.45;
}

.templates-page .template-limit-notice__action {
    min-height: 36px;
    padding: 8px 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px solid #d8b85b;
    border-radius: 9px;
    color: #755400;
    background: #fff;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.templates-page .template-limit-notice__action:hover {
    color: #5e4300;
    border-color: #bd9630;
    background: #fffdf7;
}

.templates-page .template-limit-notice__close {
    width: 34px;
    height: 34px;
    padding: 0;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 9px;
    color: #806a36;
    background: transparent;
    font-size: 15px;
    cursor: pointer;
}

.templates-page .template-limit-notice__close:hover {
    color: #4f3b0d;
    background: #f7e9bd;
}

@media (max-width: 1350px) {
    .templates-page .templates-create-panel {
        grid-template-columns: 1fr;
        gap: 14px;
    }
}

@media (max-width: 850px) {
    .templates-page #addTemplateForm {
        grid-template-columns: 1fr 1fr;
    }

    .templates-page .template-create-submit {
        grid-column: 1 / -1;
    }

    .templates-page .template-limit-notice {
        grid-template-columns: auto minmax(0, 1fr) auto;
    }

    .templates-page .template-limit-notice__action {
        grid-column: 2;
        justify-self: start;
    }

    .templates-page .template-limit-notice__close {
        grid-column: 3;
        grid-row: 1;
    }
}

@media (max-width: 560px) {
    .templates-page .templates-create-panel {
        padding: 16px;
    }

    .templates-page #addTemplateForm {
        grid-template-columns: 1fr;
    }

    .templates-page .template-create-submit {
        grid-column: auto;
    }
}

.templates-page .card-body,
.archive-page .card-body {
    padding: 0;
}

.templates-page .table {
    min-width: 1100px;
    table-layout: fixed;
}

.templates-page .template-column-name {
    width: 32rem;
}

.templates-page .template-column-description {
    width: auto;
}

.templates-page .template-column-date {
    width: 12rem;
}

.templates-page .template-column-actions {
    width: 15rem;
}

.templates-page #templatesList tr {
    min-height: 78px;
}

.templates-page #templatesList td {
    overflow: hidden;
    vertical-align: middle;
}

.templates-page #templatesList td:nth-child(3),
.templates-page #templatesList td:nth-child(4) {
    white-space: nowrap;
}

.templates-page .template-name-cell {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}

.templates-page .template-name-copy {
    display: flex;
    min-width: 0;
    flex: 1 1 auto;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
}

.templates-page .template-list-icon {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #dce7f8;
    border-radius: 9px;
    background: #f5f8fd;
}

.templates-page .template-list-icon img {
    display: block;
    width: 23px;
    height: 23px;
    object-fit: contain;
}

.templates-page .template-name-link,
.templates-page .template-name-blocked {
    display: -webkit-box;
    min-width: 0;
    overflow: hidden;
    overflow-wrap: anywhere;
    white-space: normal;
    word-break: break-word;
    font-weight: 550;
    line-height: 1.3;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.templates-page .template-name-blocked {
    cursor: not-allowed;
}

.templates-page .template-pro-key {
    width: 15px;
    height: 15px;
    margin-left: 5px;
    opacity: .7;
    vertical-align: -2px;
}

.templates-page .template-source-filename {
    display: block;
    min-width: 0;
    overflow: hidden;
    color: #8a96a9;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.templates-page .template-source-filename.is-missing,
.templates-page .template-description-text.is-empty {
    color: #a5afbe;
}

.templates-page .template-description-text {
    display: -webkit-box;
    width: 100%;
    overflow: hidden;
    overflow-wrap: anywhere;
    white-space: normal;
    word-break: break-word;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.template-field-label-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.template-field-label-row .form-label {
    margin-bottom: .5rem;
}

.template-field-label-row small,
.template-length-hint {
    color: #8a96a9;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.template-length-hint {
    display: block;
    margin-top: 4px;
    padding-right: 2px;
    text-align: right;
}

.templates-page .template-name-link {
    color: #245bd8;
    text-decoration: none;
}

.templates-page .template-name-link:hover {
    color: #1745b7;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.templates-page .template-list-toolbar,
.templates-page .template-list-primary {
    display: flex;
    align-items: center;
    min-width: 0;
}

.templates-page .template-list-toolbar {
    justify-content: space-between;
    width: 100%;
    gap: 18px;
    position: relative;
}

.templates-page .template-delete-notice-stack {
    position: absolute;
    z-index: 25;
    top: 50%;
    left: 50%;
    width: min(390px, calc(100% - 40px));
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.templates-page .template-delete-notice {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 42px;
    padding: 8px 10px 8px 14px;
    color: #203453;
    background: #fff;
    border: 1px solid #cbd9f4;
    border-radius: 12px;
    box-shadow: 0 10px 28px rgba(31, 62, 122, 0.14);
    pointer-events: auto;
    animation: template-delete-notice-lifetime 8s linear forwards;
}

.templates-page .template-delete-notice.is-busy,
.templates-page .template-delete-notice.is-restored {
    animation: none;
}

.templates-page .template-delete-notice.is-restored {
    border-color: #b9e5d2;
    background: #f1fbf6;
    color: #087a51;
}

.templates-page .template-delete-notice__message {
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
    font-size: 14px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.templates-page .template-delete-notice__undo,
.templates-page .template-delete-notice__close {
    flex: 0 0 auto;
    border: 0;
    background: transparent;
}

.templates-page .template-delete-notice__undo {
    padding: 5px 8px;
    color: #2458df;
    font-size: 14px;
    font-weight: 700;
}

.templates-page .template-delete-notice__undo:hover {
    color: #163fae;
}

.templates-page .template-delete-notice__close {
    display: inline-grid;
    width: 28px;
    height: 28px;
    padding: 0;
    place-items: center;
    color: #75839b;
    border-radius: 8px;
}

.templates-page .template-delete-notice__close:hover {
    color: #203453;
    background: #eef3fb;
}

@keyframes template-delete-notice-lifetime {
    0%, 50% { opacity: 1; }
    100% { opacity: 0; }
}

.templates-page .template-list-primary {
    flex: 1 1 auto;
    gap: 16px;
}

.templates-page .template-list-primary h5 {
    flex: 0 0 auto;
    white-space: nowrap;
}

.templates-page .template-organizer-toolbar {
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0;
    gap: 12px;
    border: 0;
}

.templates-page .template-list-search {
    width: min(300px, 100%);
    flex: 0 0 300px;
}

.templates-page .template-view-switch {
    display: inline-flex;
    padding: 4px;
    gap: 3px;
    border-radius: 10px;
    background: #eef2f8;
}

.templates-page .template-view-option,
.templates-page .template-create-group-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 7px 13px;
    gap: 7px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: #5c6a81;
    background: transparent;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    transition: color .18s ease, border-color .18s ease, background-color .18s ease, box-shadow .18s ease;
}

.templates-page .template-view-option:hover {
    color: #3157e5;
}

.templates-page .template-view-option.active {
    color: #3157e5;
    background: #fff;
    box-shadow: 0 2px 8px rgba(31, 55, 95, .1);
}

.templates-page .template-create-group-btn {
    border-color: #cbd8f8;
    color: #2854d6;
    background: #f8faff;
}

.templates-page .template-create-group-btn:hover {
    border-color: #aabff4;
    color: #1f48c5;
    background: #f0f4ff;
}

.templates-page #templatesList .template-group-row {
    height: auto;
}

.templates-page #templatesList .template-group-row > td {
    padding: 9px 13px;
    overflow: visible;
    border-top: 1px solid #dfe6f0;
    border-bottom: 1px solid #dfe6f0;
    background: #f6f8fc;
}

.templates-page #templatesList .template-group-row:first-child > td {
    border-top: 0;
}

.templates-page #templatesList .template-group-row:hover > td {
    background: #f3f6fb;
}

.templates-page .template-group-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 0;
    gap: 12px;
}

.templates-page .template-group-toggle {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    padding: 3px 5px;
    gap: 8px;
    border: 0;
    color: #23334e;
    background: transparent;
    font: inherit;
    text-align: left;
}

.templates-page .template-group-chevron {
    color: #7d8aa0;
    font-size: 11px;
    transition: transform .18s ease;
}

.templates-page .template-group-row.is-collapsed .template-group-chevron {
    transform: rotate(-90deg);
}

.templates-page .template-group-folder {
    color: #3157e5;
    font-size: 17px;
}

.templates-page .template-group-name {
    overflow: hidden;
    font-size: 14px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.templates-page .template-group-count {
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 11px;
    color: #627089;
    background: #e7ebf3;
    font-size: 11px;
    font-weight: 700;
    line-height: 22px;
    text-align: center;
}

.templates-page .template-group-actions,
.templates-page .template-row-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 3px;
}

.templates-page .template-row-actions {
    min-width: 219px;
    justify-content: flex-start;
}

.templates-page .template-group-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 31px;
    height: 31px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 8px;
    color: #65738a;
    background: transparent;
}

.templates-page .template-group-actions button:hover {
    border-color: #d7dfeb;
    color: #3157e5;
    background: #fff;
}

.templates-page .template-group-actions button.is-danger:hover {
    border-color: #efd4d7;
    color: #c43e49;
    background: #fff4f5;
}

.templates-page #templatesList .template-group-empty-row {
    height: auto;
}

.templates-page #templatesList .template-group-empty-row > td {
    padding: 16px 54px;
    color: #8b97aa;
    background: #fbfcfe;
    font-size: 13px;
}

.templates-page .template-actions-cell {
    overflow: visible !important;
}

.templates-page .template-row-actions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    margin: 0;
    padding: 0;
    border: 1px solid transparent;
    color: #25324a;
    border-radius: 8px;
}

.templates-page .template-row-actions .btn:hover {
    border-color: #dbe2ec;
    background: #f7f9fc;
}

.templates-page .template-row-actions .btn:disabled {
    opacity: .45;
}

.templates-page .template-row-actions img {
    width: 20px;
    height: 20px;
}

.templates-page .template-row-actions .template-unlock-btn img {
    width: 22px;
    height: 22px;
}

.templates-page .template-row-actions .template-move-btn {
    color: #48617e;
    font-size: 19px;
}

.templates-page .template-move-name {
    margin: 0 0 16px;
    padding: 10px 12px;
    overflow: hidden;
    border: 1px solid #e1e7f0;
    border-radius: 9px;
    color: #2b3a54;
    background: #f7f9fc;
    font-size: 13px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 950px) {
    .templates-page .template-list-toolbar {
        flex-wrap: wrap;
    }

    .templates-page .template-list-search {
        width: 100%;
        flex-basis: 100%;
    }
}

@media (max-width: 760px) {
    .templates-page .template-list-toolbar,
    .templates-page .template-list-primary,
    .templates-page .template-organizer-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .templates-page .template-list-toolbar,
    .templates-page .template-list-primary {
        gap: 10px;
    }

    .templates-page .template-list-search {
        width: 100%;
        flex-basis: auto;
    }

    .templates-page .template-view-switch,
    .templates-page .template-create-group-btn {
        width: 100%;
    }

    .templates-page .template-view-option {
        flex: 1 1 0;
    }
}

/* Архив */
.archive-page #archiveTabs {
    display: inline-flex;
    align-self: flex-start;
    width: auto;
    max-width: 100%;
    gap: 4px;
    margin-bottom: 14px !important;
    padding: 4px;
    border: 1px solid var(--dashboard-border);
    border-radius: 11px;
    background: #edf1f6;
    box-shadow: inset 0 1px 2px rgba(30, 57, 101, .03);
}

.archive-page #archiveTabs .nav-item {
    flex: 0 0 auto;
}

.archive-page #archiveTabs .nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 8px 16px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: #627089;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    transition: color .18s ease, background-color .18s ease, box-shadow .18s ease;
}

.archive-page #archiveTabs .nav-link:hover {
    color: #33445f;
    background: rgba(255, 255, 255, .55);
}

.archive-page #archiveTabs .nav-link.active {
    background: #fff;
    color: var(--dashboard-primary);
    box-shadow: 0 2px 8px rgba(30, 57, 101, .09);
}

.archive-page #archiveTabs .tab-icon {
    margin: 0;
    color: #7b899e;
    font-size: 15px;
}

.archive-page #archiveTabs .nav-link.active .tab-icon {
    color: var(--dashboard-primary);
}

.archive-page #archiveTabsContent .card {
    border-radius: 13px;
    box-shadow: 0 7px 20px rgba(30, 57, 101, .045);
}

.archive-page #archiveTabsContent .card-header {
    padding: 13px 16px;
    background: #fff !important;
}

.archive-page .archive-toolbar {
    min-height: 46px;
    gap: 18px;
}

.archive-page .archive-section-heading {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.archive-page .archive-section-heading h5 {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.25;
}

.archive-page .archive-section-heading span {
    color: var(--dashboard-muted);
    font-size: 12px;
    line-height: 1.35;
}

.archive-page .archive-toolbar-actions {
    flex: 0 0 auto;
    align-items: center;
    gap: 8px !important;
}

.archive-page .archive-delete-all {
    min-width: 122px;
    min-height: 40px;
    margin: 0 !important;
    padding: 7px 12px;
    font-size: 13px;
}

.archive-page .archive-search {
    width: 270px;
}

.archive-page .archive-search .form-control,
.archive-page .archive-search .btn {
    min-height: 40px;
}

.archive-page .archive-search .form-control {
    font-size: 14px;
}

.archive-page .archive-search .btn {
    width: 44px;
    padding: 0;
    color: #607089;
    background: #fff;
    border-color: #d8e0eb;
}

.archive-page .table-responsive {
    scrollbar-color: #c8d1df transparent;
    scrollbar-width: thin;
}

.archive-page .table thead th {
    height: 44px;
    padding: 10px 14px;
    background: #f7f9fc;
    color: #526078;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .01em;
}

.archive-page .table tbody td {
    height: 60px;
    padding: 12px 14px;
    color: #22324b;
    font-size: 14px;
    line-height: 1.45;
}

.archive-page .table tbody tr:hover > td {
    background: #fafbfe;
}

.archive-page .table th[data-sort] img {
    width: 10px !important;
    height: 10px !important;
    margin-left: 4px !important;
    opacity: .45;
}

.archive-page #templatesTab .table {
    min-width: 920px;
    table-layout: fixed;
}

.archive-page #templatesTab .table th:nth-child(1) {
    width: 18%;
}

.archive-page #templatesTab .table th:nth-child(2) {
    width: auto;
}

.archive-page #templatesTab .table th:nth-child(3) {
    width: 12rem;
}

.archive-page #templatesTab .table th:nth-child(4) {
    width: 12.5rem;
}

.archive-page #templatesTab .table td:nth-child(3),
.archive-page #deletedTemplatesList td:nth-child(4) {
    white-space: nowrap;
}

.archive-page #deletedTemplatesList .archive-row-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
}

.archive-page #filesTab .table {
    min-width: 760px;
    table-layout: fixed;
}

.archive-page #filesTab .table th:nth-child(1) {
    width: auto;
}

.archive-page #filesTab .table th:nth-child(2) {
    width: 15rem;
}

.archive-page #filesTab .table th:nth-child(3) {
    width: 13rem;
}

.archive-page #generatedFilesList td:nth-child(2),
.archive-page #generatedFilesList td:nth-child(3) {
    white-space: nowrap;
}

.archive-page #inputFilesTab .table {
    min-width: 1080px;
    table-layout: fixed;
}

.archive-page #inputFilesTab .table th:nth-child(1) {
    width: 32%;
}

.archive-page #inputFilesTab .table th:nth-child(2) {
    width: 28%;
}

.archive-page #inputFilesTab .table th:nth-child(3) {
    width: 15rem;
}

.archive-page #inputFilesTab .table th:nth-child(4) {
    width: 11rem;
}

.archive-page #inputFilesTab .table th:nth-child(5) {
    width: 9.5rem;
}

.archive-page #inputFilesList td:nth-child(3),
.archive-page #inputFilesList td:nth-child(4),
.archive-page #inputFilesList td:nth-child(5) {
    white-space: nowrap;
}

.archive-page #deletedTemplatesList .btn-primary,
.archive-page #generatedFilesList .download-file-btn {
    min-height: 36px;
    padding: 6px 11px;
    border-color: #c9d9ff;
    background: #eef4ff;
    color: #245bd8;
    font-size: 13px;
}

.archive-page #deletedTemplatesList .btn-primary:hover,
.archive-page #generatedFilesList .download-file-btn:hover {
    border-color: #a9c2ff;
    background: #e3edff;
    color: #174bbd;
}

.archive-page #deletedTemplatesList .delete-from-archive-btn,
.archive-page #generatedFilesList .delete-from-archive-btn {
    width: 36px;
    min-width: 36px;
    min-height: 36px;
    padding: 0;
}

.archive-page #inputFilesList .badge {
    padding: 5px 8px;
    border: 1px solid #dce4ef;
    border-radius: 7px;
    background: #f0f3f8 !important;
    color: #53627a !important;
    font-size: 11px;
    font-weight: 650;
}

.archive-page #inputFilesList .btn-group {
    gap: 4px;
}

.archive-page #inputFilesList .btn-group .btn {
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid #d8e0eb;
    border-radius: 8px !important;
    background: #fff;
    color: #52647f;
}

.archive-page #inputFilesList .btn-group .btn:hover {
    border-color: #b8c8e0;
    background: #f4f7fb;
    color: #245bd8;
}

.archive-page #inputFilesList .btn-group .btn:last-child {
    border-color: #efc5c8;
    color: #c33e48;
}

.archive-page #inputFilesList .btn-group .btn:last-child:hover {
    border-color: #e8aeb3;
    background: #fff2f3;
    color: #a82e37;
}

.archive-page .card-header .d-flex:not(.archive-toolbar),
.templates-page .card-header .d-flex {
    gap: 10px;
}

.archive-page .btn-danger {
    background: #fff;
    border-color: #efb6ba;
    color: #c33e48;
}

.archive-page .btn-danger:hover {
    background: #fff0f1;
    border-color: #e9888f;
    color: #a82e37;
}

@media (max-width: 900px) {
    .archive-page #archiveTabs {
        display: flex;
        width: 100%;
        overflow-x: auto;
    }

    .archive-page .archive-toolbar {
        align-items: stretch !important;
        flex-direction: column;
        gap: 12px;
    }

    .archive-page .archive-toolbar-actions {
        width: 100%;
    }

    .archive-page .archive-search {
        width: min(100%, 320px);
    }
}

@media (max-width: 560px) {
    .archive-page .archive-toolbar-actions {
        align-items: stretch;
        flex-direction: column-reverse;
    }

    .archive-page .archive-search,
    .archive-page .archive-delete-all {
        width: 100%;
    }
}

/* Полная компоновка архива */
.archive-page .archive-workspace {
    padding: 0;
    overflow: hidden;
    border-top: 1px solid var(--archive-border);
}

.archive-page .archive-page-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 86px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--archive-border);
    background: #fff;
}

.archive-page .archive-eyebrow {
    display: block;
    margin-bottom: 2px;
    color: var(--archive-accent);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .1em;
    line-height: 1.2;
    text-transform: uppercase;
}

.archive-page .archive-page-heading h1 {
    margin: 0 0 2px;
    color: #1c2b45;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -.02em;
    line-height: 1.2;
}

.archive-page .archive-page-heading p {
    margin: 0;
    color: #718099;
    font-size: 13px;
    line-height: 1.4;
}

.archive-page .archive-tabs-navigation {
    display: flex;
    align-items: center;
    min-height: 62px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--archive-border);
    background: #fbfcfe;
}

.archive-page .archive-tabs-navigation #archiveTabs {
    width: min(100%, 580px);
    margin: 0 !important;
}

.archive-page #archiveTabs .nav-link {
    gap: 7px;
}

.archive-page .archive-tab-count {
    min-width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    border-radius: 10px;
    color: #66738a;
    background: #e5eaf2;
    font-size: 11px;
    font-weight: 700;
    line-height: 20px;
}

.archive-page #archiveTabs .nav-link.active .archive-tab-count {
    color: var(--archive-accent);
    background: #edf2ff;
}

.archive-page #archiveTabsContent {
    padding: 14px;
    background: #fff;
}

.archive-page .archive-tariff-notice {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 12px;
    margin: 14px 14px 0;
    padding: 12px 14px;
    border: 1px solid #f0d89b;
    border-radius: 11px;
    color: #614b13;
    background: #fff9e9;
}

.archive-page .archive-tariff-notice[hidden] {
    display: none;
}

.archive-page .archive-tariff-notice__icon {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    color: #9a6b00;
    background: #ffedb9;
    font-size: 17px;
}

.archive-page .archive-tariff-notice__copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.archive-page .archive-tariff-notice__copy strong {
    color: #4f3b0d;
    font-size: 14px;
    font-weight: 700;
}

.archive-page .archive-tariff-notice__copy span {
    color: #7b6630;
    font-size: 13px;
    line-height: 1.45;
}

.archive-page .archive-tariff-notice__action {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    gap: 7px;
    border: 1px solid #d8b85b;
    border-radius: 9px;
    color: #755400;
    background: #fff;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.archive-page .archive-tariff-notice__action:hover,
.archive-page .archive-tariff-notice__action:focus-visible {
    color: #5e4300;
    border-color: #bd9630;
    background: #fffdf7;
}

.archive-page .archive-tariff-notice__close {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 9px;
    color: #806a36;
    background: transparent;
    font-size: 15px;
    cursor: pointer;
}

.archive-page .archive-tariff-notice__close:hover,
.archive-page .archive-tariff-notice__close:focus-visible {
    color: #4f3b0d;
    background: #f7e9bd;
}

@media (max-width: 760px) {
    .archive-page .archive-tariff-notice {
        grid-template-columns: auto minmax(0, 1fr) auto;
    }

    .archive-page .archive-tariff-notice__action {
        grid-column: 1 / -1;
        width: 100%;
    }
}

.archive-page .archive-list-panel {
    overflow: hidden;
    border: 1px solid var(--archive-border);
    border-radius: 11px;
    background: #fff;
}

.archive-page .archive-toolbar {
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    gap: 14px;
    border-bottom: 1px solid var(--archive-border);
    background: #fff;
}

.archive-page .archive-toolbar-primary {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.archive-page .archive-search {
    width: 300px;
}

.archive-page .archive-search .input-group-text {
    width: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid #d7deea;
    border-right: 0;
    border-radius: 8px 0 0 8px;
    color: #718096;
    background: #fff;
    font-size: 14px;
}

.archive-page .archive-search .form-control {
    min-height: 38px;
    padding: 7px 10px 7px 2px;
    border-left: 0;
    border-radius: 0 8px 8px 0;
    font-size: 13px;
}

.archive-page .archive-search .form-control:focus {
    border-left: 0;
    box-shadow: none;
}

.archive-page .archive-search:focus-within {
    border-radius: 8px;
    box-shadow: 0 0 0 3px rgba(49, 87, 229, .11);
}

.archive-page .archive-search:focus-within .input-group-text,
.archive-page .archive-search:focus-within .form-control {
    border-color: #6d8df2;
}

.archive-page .archive-result-count {
    color: #7a879b;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.archive-page .archive-clear-button {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    gap: 7px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: #8a5960;
    background: transparent;
    box-shadow: none;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    transition: color .18s ease, border-color .18s ease, background-color .18s ease;
}

.archive-page .archive-clear-button:hover,
.archive-page .archive-clear-button:focus-visible {
    border-color: #f1cdd1;
    color: #c9434d;
    background: #fff1f2;
    outline: none;
}

.archive-page .archive-clear-button:disabled,
.archive-page .archive-clear-button:disabled:hover {
    border-color: transparent;
    color: #a6afbd;
    background: transparent;
    cursor: default;
}

.archive-page .archive-list-panel .table-responsive {
    width: 100%;
}

.archive-page #templatesTab .table,
.archive-page #filesTab .table {
    min-width: 720px;
}

.archive-page #inputFilesTab .table {
    min-width: 880px;
}

.archive-page #templatesTab .table th:nth-child(1),
.archive-page #filesTab .table th:nth-child(1) {
    width: auto;
}

.archive-page #templatesTab .table th:nth-child(2),
.archive-page #filesTab .table th:nth-child(2) {
    width: 11rem;
}

.archive-page #templatesTab .table th:nth-child(3),
.archive-page #filesTab .table th:nth-child(3) {
    width: 7rem;
}

.archive-page #inputFilesTab .table th:nth-child(1) {
    width: auto;
}

.archive-page #inputFilesTab .table th:nth-child(2) {
    width: 11rem;
}

.archive-page #inputFilesTab .table th:nth-child(3) {
    width: 10rem;
}

.archive-page #inputFilesTab .table th:nth-child(4) {
    width: 9rem;
}

.archive-page .archive-actions-column {
    text-align: right;
}

.archive-page .table tbody td:last-child {
    text-align: right;
}

.archive-page .archive-item {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.archive-page .archive-item-icon {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 32px;
    border: 1px solid #dbe5fa;
    border-radius: 8px;
    color: var(--archive-accent);
    background: #f5f8ff;
    font-size: 15px;
}

.archive-page .archive-item-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.archive-page .archive-item-copy strong,
.archive-page .archive-item-copy small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.archive-page .archive-item-copy strong {
    color: #25324a;
    font-size: 14px;
    font-weight: 650;
    line-height: 1.35;
}

.archive-page .archive-item-copy small {
    color: #7a879b;
    font-size: 11px;
    line-height: 1.3;
}

.archive-page .archive-date {
    display: inline-flex;
    flex-direction: column;
    gap: 1px;
    color: #34425a;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    line-height: 1.25;
    white-space: nowrap;
}

.archive-page .archive-date small {
    color: #8490a2;
    font-size: 11px;
}

.archive-page .archive-date-muted {
    color: #8490a2;
}

.archive-page .archive-row-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
}

.archive-page .archive-icon-button {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 32px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 7px;
    color: #68768d;
    background: transparent;
    box-shadow: none;
    font-size: 15px;
    transition: color .16s ease, border-color .16s ease, background-color .16s ease;
}

.archive-page .archive-icon-button:hover,
.archive-page .archive-icon-button:focus-visible,
.archive-page .archive-icon-button-primary:hover,
.archive-page .archive-icon-button-primary:focus-visible {
    border-color: #d8e3fa;
    color: var(--archive-accent);
    background: #eef4ff;
    outline: none;
}

.archive-page .archive-icon-button-danger:hover,
.archive-page .archive-icon-button-danger:focus-visible {
    border-color: #f2d1d5;
    color: #c9434d;
    background: #fff1f2;
}

.archive-page .archive-operation-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 4px 8px;
    border: 1px solid #dfe5ee;
    border-radius: 7px;
    color: #536078;
    background: #f6f8fb;
    font-size: 11px;
    font-weight: 650;
    line-height: 1.2;
    white-space: nowrap;
}

.archive-page .archive-empty-state {
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
    flex-direction: column;
    text-align: center;
}

.archive-page .archive-empty-icon {
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    border: 1px solid #dbe5fa;
    border-radius: 14px;
    color: var(--archive-accent);
    background: #f5f8ff;
    font-size: 22px;
}

.archive-page .archive-empty-state strong {
    margin-bottom: 4px;
    color: #25324a;
    font-size: 15px;
    font-weight: 700;
}

.archive-page .archive-empty-state p {
    max-width: 390px;
    margin: 0;
    color: #7a879b;
    font-size: 12px;
    line-height: 1.5;
}

.archive-page .archive-no-results td,
.archive-page .archive-load-error td {
    height: 150px !important;
    color: #7a879b !important;
    text-align: center !important;
}

.archive-page .archive-no-results td i {
    margin-right: 7px;
    color: #8c99ac;
}

.archive-page .archive-load-error td > div {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.archive-page .archive-load-error td i {
    color: #c47a36;
}

.archive-page .archive-load-error td button {
    min-height: 32px;
    padding: 5px 10px;
    border: 1px solid #d7dfeb;
    border-radius: 7px;
    color: #526078;
    background: #fff;
    font-size: 12px;
    font-weight: 600;
}

.archive-page .archive-load-error td button:hover {
    border-color: #b8c9f4;
    color: var(--archive-accent);
    background: #f7f9ff;
}

.archive-page .archive-skeleton-row td {
    height: 55px !important;
    padding: 15px 12px !important;
}

.archive-page .archive-skeleton-row td span {
    display: block;
    width: min(48%, 440px);
    height: 14px;
    border-radius: 7px;
    background: linear-gradient(90deg, #eef1f5 25%, #f7f9fc 45%, #eef1f5 65%);
    background-size: 220% 100%;
    animation: archive-skeleton 1.25s ease-in-out infinite;
}

@keyframes archive-skeleton {
    from { background-position: 100% 0; }
    to { background-position: -100% 0; }
}

@media (max-width: 760px) {
    .archive-page .archive-page-heading {
        min-height: 78px;
        padding: 14px 16px;
    }

    .archive-page .archive-tabs-navigation {
        overflow-x: auto;
    }

    .archive-page .archive-tabs-navigation #archiveTabs {
        width: max-content;
    }

    .archive-page #archiveTabs .nav-item {
        min-width: 160px;
    }

    .archive-page #archiveTabsContent {
        padding: 10px;
    }

    .archive-page .archive-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .archive-page .archive-toolbar-primary {
        width: 100%;
    }

    .archive-page .archive-search {
        width: min(100%, 340px);
    }

    .archive-page .archive-clear-button {
        align-self: flex-start;
    }
}

@media (max-width: 480px) {
    .archive-page .archive-page-heading p {
        max-width: 270px;
    }

    .archive-page .archive-toolbar-primary {
        align-items: stretch;
        flex-direction: column;
        gap: 7px;
    }

    .archive-page .archive-search {
        width: 100%;
    }
}

/* Единая система иконок действий архива */
.archive-page #deletedTemplatesList .archive-icon-button,
.archive-page #generatedFilesList .archive-icon-button,
.archive-page #inputFilesList .archive-icon-button {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 7px;
    color: #68768d;
    background: transparent;
    box-shadow: none;
}

.archive-page .archive-icon-button img {
    display: block;
    width: 17px;
    height: 17px;
    opacity: .86;
    filter: brightness(0) saturate(100%) invert(45%) sepia(14%) saturate(783%) hue-rotate(179deg) brightness(93%) contrast(88%);
    transition: opacity .16s ease, filter .16s ease;
}

.archive-page .archive-icon-button:hover img,
.archive-page .archive-icon-button:focus-visible img {
    opacity: 1;
    filter: brightness(0) saturate(100%) invert(34%) sepia(96%) saturate(3537%) hue-rotate(218deg) brightness(101%) contrast(101%);
}

.archive-page .archive-icon-button-danger:hover img,
.archive-page .archive-icon-button-danger:focus-visible img {
    filter: brightness(0) saturate(100%) invert(37%) sepia(76%) saturate(1152%) hue-rotate(317deg) brightness(88%) contrast(92%);
}

.archive-page .archive-clear-icon {
    display: block;
    width: 14px;
    height: 14px;
    filter: brightness(0) saturate(100%) invert(37%) sepia(28%) saturate(921%) hue-rotate(314deg) brightness(91%) contrast(84%);
}

/* Личный кабинет */
.profile-page .main-content > .container {
    max-width: none;
    padding: 0 !important;
}

.profile-page .card.shadow-sm.h-100 {
    height: auto !important;
    min-height: 100%;
    box-shadow: var(--dashboard-shadow) !important;
}

.profile-page .avatar-circle {
    width: 84px;
    height: 84px;
    margin-bottom: 14px;
    background: var(--dashboard-primary-soft);
    color: var(--dashboard-primary);
    box-shadow: none;
}

.profile-page .initials {
    color: var(--dashboard-primary);
    font-size: 34px;
}

.profile-page .plan-badge {
    background: #eef4ff;
    color: #315bd8;
}

.profile-page .profile-details p,
.profile-page .stats-item {
    border-color: var(--dashboard-border);
    background: #f8fafd;
}

.profile-page .stats-item {
    height: 100%;
    padding: 14px 8px;
    border: 1px solid var(--dashboard-border);
    border-radius: 11px;
}

.profile-page .stats-item .fs-1 {
    font-size: 26px !important;
}

.profile-page .stats-item h3 {
    margin: 7px 0 2px;
    font-size: 23px;
}

/* Помощь */
.faq-page .main-content > .faq-header,
.faq-page .faq-workspace,
.faq-page .faq-support {
    width: 100%;
    max-width: var(--content-max-width);
    margin-right: auto;
    margin-left: 0;
}

.faq-page .main-content > .faq-header .header-content {
    min-height: 0;
}

.faq-workspace {
    overflow: hidden;
    border: 1px solid var(--dashboard-border);
    border-radius: 14px;
    background: #fff;
    box-shadow: var(--dashboard-shadow);
}

.faq-intro {
    display: flex;
    min-height: 92px;
    padding: 18px 20px;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    border-bottom: 1px solid var(--dashboard-border);
    background: #fbfcfe;
}

.faq-intro-copy {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 12px;
}

.faq-intro-icon {
    display: inline-flex;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    color: var(--dashboard-primary);
    background: var(--dashboard-primary-soft);
    font-size: 20px;
}

.faq-intro h2 {
    margin: 0 0 3px;
    color: var(--dashboard-text);
    font-size: 18px;
    font-weight: 700;
}

.faq-intro p {
    margin: 0;
    color: var(--dashboard-muted);
    font-size: 13px;
}

.faq-search {
    display: flex;
    width: min(360px, 100%);
    min-height: 44px;
    align-items: center;
    gap: 10px;
    padding: 0 10px 0 14px;
    border: 1px solid #d8e0ec;
    border-radius: 10px;
    color: #71809a;
    background: #fff;
    transition: border-color .18s ease, box-shadow .18s ease;
}

.faq-search:focus-within {
    border-color: #7896ed;
    box-shadow: 0 0 0 3px rgba(49, 87, 229, .1);
}

.faq-search input {
    min-width: 0;
    flex: 1;
    border: 0;
    outline: 0;
    color: var(--dashboard-text);
    background: transparent;
    font-size: 14px;
}

.faq-search input::placeholder { color: #95a1b4; }

.faq-result-count {
    display: inline-flex;
    min-width: 26px;
    height: 26px;
    align-items: center;
    justify-content: center;
    padding: 0 7px;
    border-radius: 7px;
    color: #3157e5;
    background: #edf2ff;
    font-size: 12px;
    font-weight: 700;
}

.faq-list { padding: 10px 14px 14px; }

.faq-page .faq-item {
    margin: 4px 0 0;
    overflow: hidden;
    border: 1px solid transparent;
    border-radius: 10px;
    background: #fff;
    transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease;
}

.faq-page .faq-item[hidden] { display: none; }

.faq-page .faq-item + .faq-item { border-top-color: #edf0f5; border-radius: 0; }
.faq-page .faq-item:hover { background: #fbfcff; }

.faq-page .faq-item.is-open {
    margin-top: 8px;
    border-color: #ccd8f7;
    border-radius: 10px;
    background: #fbfcff;
    box-shadow: 0 5px 16px rgba(43, 71, 135, .06);
}

.faq-page .faq-item.is-open + .faq-item { border-top-color: transparent; }

.faq-page .faq-question {
    display: grid;
    width: 100%;
    min-height: 62px;
    grid-template-columns: 38px minmax(0, 1fr) 34px;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 0;
    color: var(--dashboard-text);
    background: transparent;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.faq-page .faq-question:focus-visible {
    outline: 3px solid rgba(49, 87, 229, .18);
    outline-offset: -3px;
}

.faq-number {
    display: inline-flex;
    width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    color: #657590;
    background: #f0f3f8;
    font-size: 11px;
    font-weight: 750;
    letter-spacing: .04em;
}

.faq-question-text {
    font-size: 15px;
    font-weight: 650;
    line-height: 1.4;
}

.faq-toggle-icon {
    display: inline-flex;
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: #70809a;
    background: #f3f5f8;
    transition: color .18s ease, background-color .18s ease, transform .22s ease;
}

.faq-item.is-open .faq-number,
.faq-item.is-open .faq-toggle-icon {
    color: #3157e5;
    background: #eaf0ff;
}

.faq-item.is-open .faq-toggle-icon { transform: rotate(180deg); }

.faq-page .faq-answer {
    padding: 0 58px 18px 62px;
    color: #5d6c83;
    font-size: 14px;
    line-height: 1.7;
}

.faq-answer-content {
    padding-top: 14px;
    border-top: 1px solid #e5eaf3;
}

.faq-answer-content > :last-child { margin-bottom: 0; }
.faq-answer-content a { color: #3157e5; }

.faq-no-results,
.faq-empty-state {
    min-height: 260px;
    padding: 42px 20px;
    color: #75839a;
    text-align: center;
}

.faq-no-results > i,
.faq-empty-state > span {
    display: inline-flex;
    width: 54px;
    height: 54px;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    border-radius: 15px;
    color: #3157e5;
    background: #edf2ff;
    font-size: 23px;
}

.faq-no-results h3,
.faq-empty-state h3 { margin: 0 0 5px; color: var(--dashboard-text); font-size: 18px; }
.faq-no-results p,
.faq-empty-state p { margin: 0; font-size: 14px; }

.faq-support {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    margin-top: 14px !important;
    padding: 17px 20px;
    border: 1px solid #dbe3ef;
    border-radius: 14px;
    background: linear-gradient(135deg, #fff 0%, #f7f9ff 100%);
    box-shadow: var(--dashboard-shadow);
}

.faq-support-icon {
    display: inline-flex;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    color: #3157e5;
    background: #eaf0ff;
    font-size: 19px;
}

.faq-support h2 { margin: 0 0 3px; color: var(--dashboard-text); font-size: 17px; font-weight: 700; }
.faq-support p { margin: 0; color: var(--dashboard-muted); font-size: 13px; }

.faq-support-button {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 14px;
    border: 1px solid #3157e5;
    border-radius: 9px;
    color: #fff;
    background: #3157e5;
    font-size: 13px;
    font-weight: 650;
    text-decoration: none;
    transition: background-color .18s ease, transform .18s ease, box-shadow .18s ease;
}

.faq-support-button:hover {
    color: #fff;
    background: #2749c8;
    box-shadow: 0 6px 14px rgba(49, 87, 229, .18);
    transform: translateY(-1px);
}

@media (max-width: 760px) {
    .faq-intro { align-items: stretch; flex-direction: column; gap: 14px; }
    .faq-search { width: 100%; }
    .faq-support { grid-template-columns: 44px minmax(0, 1fr); }
    .faq-support-button { grid-column: 1 / -1; }
}

@media (max-width: 480px) {
    .faq-intro { padding: 16px; }
    .faq-list { padding: 8px; }
    .faq-page .faq-question { grid-template-columns: 32px minmax(0, 1fr) 30px; gap: 8px; padding: 10px 8px; }
    .faq-number { width: 30px; height: 30px; }
    .faq-toggle-icon { width: 30px; height: 30px; }
    .faq-page .faq-answer { padding: 0 40px 16px 48px; }
}

/* Обратная связь */
.feedback-page .main-content > .feedback-header,
.feedback-page .feedback-workspace {
    width: 100%;
    max-width: var(--content-max-width);
    margin-right: auto;
    margin-left: 0;
}

.feedback-page .main-content > .feedback-header .header-content { min-height: 0; }

.feedback-workspace {
    overflow: hidden;
    border: 1px solid var(--dashboard-border);
    border-radius: 14px;
    background: #fff;
    box-shadow: var(--dashboard-shadow);
}

.feedback-toolbar {
    display: flex;
    min-height: 92px;
    padding: 18px 20px;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    border-bottom: 1px solid var(--dashboard-border);
    background: #fbfcfe;
}

.feedback-toolbar-copy,
.feedback-title-row {
    display: flex;
    min-width: 0;
    align-items: center;
}

.feedback-toolbar-copy { gap: 12px; }
.feedback-title-row { gap: 9px; }

.feedback-toolbar-icon {
    display: inline-flex;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    color: var(--dashboard-primary);
    background: var(--dashboard-primary-soft);
    font-size: 19px;
}

.feedback-toolbar h2 { margin: 0; color: var(--dashboard-text); font-size: 20px; font-weight: 700; line-height: 1.25; }
.feedback-toolbar p { margin: 4px 0 0; color: var(--dashboard-muted); font-size: 14px; line-height: 1.4; }

.feedback-unread-total {
    display: inline-flex;
    min-height: 23px;
    align-items: center;
    padding: 3px 8px;
    border-radius: 999px;
    color: #b52e42;
    background: #fdebf0;
    font-size: 12px;
    font-weight: 700;
}

.feedback-new-button,
.feedback-secondary-button {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 14px;
    border: 1px solid #3157e5;
    border-radius: 9px;
    color: #fff;
    background: #3157e5;
    font: inherit;
    font-size: 14px;
    font-weight: 650;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color .18s ease, transform .18s ease, box-shadow .18s ease;
}

.feedback-new-button:hover:not(:disabled) { background: #2749c8; box-shadow: 0 6px 14px rgba(49, 87, 229, .18); transform: translateY(-1px); }
.feedback-new-button:disabled { opacity: .65; cursor: wait; }
.feedback-secondary-button { border-color: #d8e0ec; color: #42536d; background: #fff; }
.feedback-secondary-button:hover { border-color: #bdc9dc; background: #f6f8fb; }

.feedback-layout {
    display: grid;
    min-height: 570px;
    grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
}

.feedback-dialogs {
    min-width: 0;
    border-right: 1px solid var(--dashboard-border);
    background: #fbfcfe;
}

.feedback-dialogs-heading {
    display: flex;
    height: 54px;
    padding: 0 16px;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--dashboard-border);
    color: #41516a;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.feedback-dialogs-heading strong {
    display: inline-flex;
    min-width: 25px;
    height: 25px;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    color: #3157e5;
    background: #eaf0ff;
    font-size: 12px;
}

.feedback-page .dialog-list {
    max-height: 516px;
    padding: 8px;
    overflow-y: auto;
}

.feedback-page .dialog-item {
    display: flex;
    width: 100%;
    min-width: 0;
    flex-direction: column;
    gap: 7px;
    padding: 13px 12px;
    border: 1px solid transparent;
    border-radius: 10px;
    color: #465671;
    background: transparent;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: color .18s ease, border-color .18s ease, background-color .18s ease, box-shadow .18s ease;
}

.feedback-page .dialog-item + .dialog-item { margin-top: 4px; }
.feedback-page .dialog-item:hover { background: #f3f6fb; }
.feedback-page .dialog-item.active { border-color: #cbd7f7; color: #244bbf; background: #eef3ff; box-shadow: 0 4px 12px rgba(43, 72, 142, .06); }
.feedback-page .dialog-item:focus-visible { outline: 3px solid rgba(49, 87, 229, .16); outline-offset: -2px; }

.dialog-item-top,
.dialog-item-bottom {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.feedback-page .dialog-item-top strong { overflow: hidden; color: #172b4d; font-size: 15px; font-weight: 700; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.feedback-page .dialog-item-top time { flex: 0 0 auto; color: #7f8da3; font-size: 12px; line-height: 1.35; }
.feedback-page .dialog-preview { display: -webkit-box; overflow: hidden; color: #5f6f88; font-size: 14px; line-height: 1.5; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.feedback-page .dialog-item-bottom { color: #74839a; font-size: 12px; line-height: 1.35; }
.dialog-item-bottom > span:first-child { display: inline-flex; align-items: center; gap: 5px; }
.dialog-unread { display: inline-flex; min-width: 22px; height: 22px; align-items: center; justify-content: center; padding: 0 6px; border-radius: 999px; color: #fff; background: #e24b62; font-size: 11px; font-weight: 700; }

.feedback-conversation {
    display: flex;
    min-width: 0;
    min-height: 570px;
    flex-direction: column;
    background: #fff;
}

.conversation-heading {
    min-height: 54px;
    padding: 10px 18px;
    border-bottom: 1px solid var(--dashboard-border);
}

.conversation-heading h3 { margin: 0; color: var(--dashboard-text); font-size: 16px; font-weight: 700; line-height: 1.3; }
.conversation-heading p { display: flex; margin: 3px 0 0; align-items: center; gap: 6px; color: #74839a; font-size: 12px; line-height: 1.35; }
.conversation-heading p span { width: 7px; height: 7px; border-radius: 50%; background: #20a56b; }

.conversation-placeholder,
.feedback-empty-state {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 42px 20px;
    text-align: center;
}

.conversation-placeholder[hidden] { display: none; }

.conversation-placeholder > span,
.feedback-empty-icon {
    display: inline-flex;
    width: 60px;
    height: 60px;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    border-radius: 17px;
    color: #3157e5;
    background: #edf2ff;
    font-size: 25px;
}

.conversation-placeholder h3,
.feedback-empty-state h2 { margin: 0 0 5px; color: var(--dashboard-text); font-size: 20px; font-weight: 700; }
.conversation-placeholder p,
.feedback-empty-state p { max-width: 470px; margin: 0; color: var(--dashboard-muted); font-size: 14px; line-height: 1.55; }
.feedback-empty-state { min-height: 430px; }
.feedback-empty-state .feedback-new-button { margin-top: 20px; }

.dialog-content {
    height: 390px;
    padding: 18px;
    overflow-y: auto;
    background: #f7f9fc;
}

.feedback-page .message-row {
    display: flex;
    width: 100%;
    max-width: 760px;
    margin-right: auto;
    margin-bottom: 14px;
    margin-left: auto;
}
.feedback-page .message-row.is-admin { justify-content: flex-start; }
.feedback-page .message-row.is-user { justify-content: flex-end; }

.message-bubble {
    max-width: 78%;
    padding: 13px 16px;
    border-radius: 14px;
    box-shadow: 0 3px 10px rgba(28, 47, 78, .06);
}

.feedback-page .admin-message { border: 1px solid #e1e7f0; border-bottom-left-radius: 4px; color: #32445f; background: #fff; }
.feedback-page .user-message { border-bottom-right-radius: 4px; color: #fff; background: #3157e5; }
.feedback-page .message-text { font-size: 16px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.feedback-page .message-bubble time { display: block; margin-top: 7px; color: #8290a5; font-size: 12px; line-height: 1.35; }
.feedback-page .user-message time { color: rgba(255,255,255,.65); text-align: right; }

.feedback-reply-form {
    padding: 14px 18px 16px;
    border-top: 1px solid var(--dashboard-border);
    background: #fff;
}

.feedback-reply-form > label,
.feedback-reply-form > .feedback-composer,
.feedback-reply-form > .feedback-form-message {
    width: 100%;
    max-width: 760px;
    margin-right: auto;
    margin-left: auto;
}

.feedback-reply-form > label,
.feedback-modal .modal-body > label { display: block; margin-bottom: 7px; color: #394c6b; font-size: 13px; font-weight: 700; }
.feedback-composer { display: flex; align-items: flex-end; gap: 9px; }
.feedback-composer textarea,
.feedback-modal textarea {
    width: 100%;
    resize: vertical;
    border: 1px solid #d5deec;
    border-radius: 10px;
    outline: 0;
    color: var(--dashboard-text);
    background: #fbfcfe;
    font: inherit;
    font-size: 15px;
    line-height: 1.5;
    transition: border-color .18s ease, box-shadow .18s ease;
}

.feedback-composer textarea { min-height: 82px; padding: 12px 13px; font-size: 15px; }
.feedback-composer textarea:focus,
.feedback-modal textarea:focus { border-color: #7896ed; box-shadow: 0 0 0 3px rgba(49, 87, 229, .1); }

.feedback-composer button {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 13px;
    border: 0;
    border-radius: 9px;
    color: #fff;
    background: #3157e5;
    font: inherit;
    font-size: 13px;
    font-weight: 650;
}

.feedback-composer button:disabled { opacity: .65; }
.feedback-form-message:empty { display: none; }
.feedback-form-message { margin-top: 8px; font-size: 13px; }
.feedback-form-message.is-error { color: #b43c4d; }
.feedback-form-message.is-success { color: #16825a; }

.feedback-modal .modal-dialog { max-width: 540px; }
.feedback-modal .modal-content { overflow: hidden; border: 0; border-radius: 16px; box-shadow: 0 22px 60px rgba(31, 52, 91, .2); }
.feedback-modal .modal-header { align-items: flex-start; padding: 20px 22px; border-bottom: 1px solid #e5ebf5; background: #fbfcff; }
.feedback-modal-heading { display: flex; align-items: center; gap: 12px; }
.feedback-modal-heading > span { display: inline-flex; width: 42px; height: 42px; align-items: center; justify-content: center; border-radius: 11px; color: #3157e5; background: #edf2ff; font-size: 18px; }
.feedback-modal-heading h2 { margin: 0; color: var(--dashboard-text); font-size: 20px; font-weight: 700; }
.feedback-modal-heading p { margin: 3px 0 0; color: var(--dashboard-muted); font-size: 14px; }
.feedback-modal .modal-body { padding: 20px 22px; }
.feedback-modal textarea { min-height: 145px; padding: 12px 13px; }
.feedback-modal .modal-footer { padding: 0 22px 20px; border: 0; }

.feedback-loading {
    position: fixed;
    z-index: 1090;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #3157e5;
    background: rgba(242, 245, 250, .68);
    backdrop-filter: blur(2px);
}

.feedback-loading[hidden] { display: none; }

@media (max-width: 900px) {
    .feedback-layout { grid-template-columns: minmax(240px, 300px) minmax(0, 1fr); }
    .feedback-composer button span { display: none; }
}

@media (max-width: 700px) {
    .feedback-toolbar { align-items: stretch; flex-direction: column; }
    .feedback-new-button { width: 100%; }
    .feedback-layout { grid-template-columns: 1fr; }
    .feedback-dialogs { border-right: 0; border-bottom: 1px solid var(--dashboard-border); }
    .feedback-page .dialog-list { max-height: 290px; }
    .feedback-conversation { min-height: 500px; }
}

@media (max-width: 480px) {
    .feedback-toolbar { padding: 16px; }
    .dialog-content { padding: 12px; }
    .message-bubble { max-width: 88%; }
    .feedback-reply-form { padding: 12px; }
}

@media (max-width: 1100px) {
    :root {
        --dashboard-sidebar-width: 78px;
    }

    .user-dashboard-page .logo {
        padding: 20px 12px;
    }

    .user-dashboard-page .logo img {
        width: 52px;
        height: 44px;
        object-fit: cover;
        object-position: center;
    }

    .user-dashboard-page .menu-label,
    .user-dashboard-page .sidebar-badge {
        display: none;
    }

    .user-dashboard-page .menu a,
    .user-dashboard-page .sidebar-admin-link,
    .user-dashboard-page .sidebar-logout {
        justify-content: center;
        padding: 10px;
    }

    .user-dashboard-page .menu a i,
    .user-dashboard-page .sidebar-admin-link i,
    .user-dashboard-page .sidebar-logout i {
        width: auto;
        flex-basis: auto;
    }

    .user-dashboard-page .subscription-sidebar-notice { display: none; }

    .user-dashboard-page .subscription-mobile-notice {
        position: fixed;
        z-index: 900;
        top: 10px;
        left: 88px;
        right: 10px;
        display: flex;
        align-items: center;
        gap: 10px;
        min-height: 64px;
        padding: 10px 12px;
        border: 1px solid #f0cf71;
        border-radius: 12px;
        background: #fff8df;
        box-shadow: var(--dashboard-shadow);
        color: #654d0b;
        font-size: 12px;
    }

    .user-dashboard-page .subscription-mobile-notice.is-expired { border-color: #efb9bd; background: #fff0f1; color: #7d2830; }
    .user-dashboard-page .subscription-mobile-notice > div { min-width: 0; flex: 1; }
    .user-dashboard-page .subscription-mobile-notice strong,
    .user-dashboard-page .subscription-mobile-notice span { display: block; }
    .user-dashboard-page .subscription-mobile-notice a { color: inherit; font-weight: 700; }
    .user-dashboard-page .subscription-mobile-notice ~ .main-content { padding-top: 88px; }
}

@media (max-width: 600px) {
    .user-dashboard-page .subscription-mobile-notice span { display: none; }
    .user-dashboard-page .subscription-mobile-notice { gap: 7px; }
}

@media (max-width: 760px) {
    .user-dashboard-page .main-content {
        padding: 12px 12px 24px;
    }

    .user-dashboard-page .main-content > .header:not(.template-header-card) {
        min-height: 76px;
        padding: 15px 17px;
    }

    .user-dashboard-page .main-content > .header:not(.template-header-card) h1 {
        font-size: 21px;
    }

    .archive-page .archive-toolbar,
    .templates-page .card-header .d-flex {
        align-items: stretch !important;
        flex-direction: column;
    }

    .archive-page .archive-toolbar-actions {
        width: 100%;
    }
}

/* Архив: визуальная система рабочей области редактора */
.archive-page {
    --archive-accent: #3157e5;
    --archive-accent-hover: #2849c7;
    --archive-border: #e3e8f0;
    --archive-muted: #66738a;
    --archive-soft: #f3f6fa;
}

.archive-page .main-content > .header:not(.template-header-card) {
    min-height: 86px;
    margin-bottom: 18px;
    padding: 18px 22px;
    border-radius: 14px;
    box-shadow: 0 8px 28px rgba(31, 52, 82, .06);
}

.archive-page .archive-header .header-content {
    min-height: 0;
}

.archive-page .main-content > .header:not(.template-header-card) h1 {
    margin-bottom: 4px;
    font-size: 24px;
    font-weight: 700;
}

.archive-page .main-content > .header:not(.template-header-card) p {
    color: var(--archive-muted);
    font-size: 14px;
}

.archive-page .archive-workspace {
    display: flex;
    min-height: 0;
    padding: 14px;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e4eaf3;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 8px 28px rgba(31, 52, 82, .06);
}

.archive-page #archiveTabs {
    display: inline-flex;
    align-self: flex-start;
    width: min(100%, 600px);
    margin: 0 0 14px !important;
    padding: 4px;
    gap: 4px;
    overflow: visible;
    border: 0;
    border-radius: 10px;
    background: #f1f4f9;
    box-shadow: none;
}

.archive-page #archiveTabs .nav-item {
    min-width: 0;
    flex: 1 1 0;
    margin: 0;
}

.archive-page #archiveTabs .nav-link {
    width: 100%;
    min-height: 36px;
    padding: 7px 12px;
    gap: 6px;
    border: 0;
    border-radius: 8px;
    color: var(--archive-muted);
    background: transparent;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    text-align: center;
}

.archive-page #archiveTabs .nav-link:hover {
    color: var(--archive-accent);
    background: rgba(255, 255, 255, .55);
}

.archive-page #archiveTabs .nav-link.active {
    color: var(--archive-accent);
    background: #fff;
    box-shadow: 0 2px 7px rgba(35, 58, 97, .11);
}

.archive-page #archiveTabs .nav-link.active::after {
    display: none;
}

.archive-page #archiveTabs .tab-icon,
.archive-page #archiveTabs .nav-link.active .tab-icon {
    margin: 0;
    color: currentColor;
    font-size: 14px;
}

.archive-page #archiveTabsContent {
    width: 100%;
    min-height: 0;
    padding: 0;
    overflow: hidden;
}

.archive-page #archiveTabsContent .card {
    overflow: hidden;
    border: 1px solid var(--archive-border);
    border-radius: 11px;
    background: #fff;
    box-shadow: none;
}

.archive-page #archiveTabsContent .card-header {
    padding: 12px;
    border-bottom: 1px solid var(--archive-border);
    background: #fff !important;
}

.archive-page .archive-toolbar {
    min-height: 40px;
    gap: 16px;
}

.archive-page .archive-section-heading {
    gap: 2px;
}

.archive-page .archive-section-heading h5 {
    color: #25324a;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.35;
}

.archive-page .archive-section-heading span {
    color: #7a879b;
    font-size: 12px;
    line-height: 1.35;
}

.archive-page .archive-toolbar-actions {
    gap: 6px !important;
}

.archive-page .archive-delete-all {
    min-width: 0;
    min-height: 36px;
    padding: 6px 12px;
    border: 1px solid #e8c9cd;
    border-radius: 8px;
    color: #b9414b;
    background: #fff;
    box-shadow: none;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
}

.archive-page .archive-delete-all:hover,
.archive-page .archive-delete-all:focus-visible {
    border-color: #f1c3c8;
    color: #c63d4b;
    background: #fff7f8;
}

.archive-page .archive-search {
    width: 270px;
}

.archive-page .archive-search .form-control {
    min-height: 36px;
    padding: 7px 10px;
    border-color: #d7deea;
    border-radius: 8px 0 0 8px;
    color: #1f2d45;
    background: #fff;
    font-size: 13px;
    line-height: 1.35;
}

.archive-page .archive-search .form-control:focus {
    z-index: 3;
    border-color: #6d8df2;
    box-shadow: 0 0 0 3px rgba(49, 87, 229, .11);
}

.archive-page .archive-search .btn {
    width: 38px;
    min-height: 36px;
    border-color: #d7deea;
    border-radius: 0 8px 8px 0;
    color: #718096;
    background: #fff;
}

.archive-page .archive-search .btn:hover {
    border-color: #bdc8d9;
    color: var(--archive-accent);
    background: #f7f9ff;
}

.archive-page .table-responsive {
    border: 0;
    border-radius: 0;
    scrollbar-color: #cbd5e4 transparent;
    scrollbar-width: thin;
}

.archive-page .table {
    border-collapse: separate;
    border-spacing: 0;
    color: #25324a;
}

.archive-page .table thead th {
    height: auto;
    padding: 9px 12px;
    border: 0 !important;
    border-bottom: 1px solid var(--archive-border) !important;
    color: var(--archive-muted) !important;
    background: var(--archive-soft) !important;
    font-size: 12px;
    font-weight: 700 !important;
    letter-spacing: .01em;
    line-height: 1.35;
}

.archive-page .table tbody td {
    height: auto;
    padding: 10px 12px;
    border: 0;
    border-bottom: 1px solid #edf0f5;
    color: #26344c;
    background: #fff;
    font-size: 14px;
    line-height: 1.4;
    transition: background-color .15s ease;
}

.archive-page .table tbody tr:last-child td {
    border-bottom: 0;
}

.archive-page .table tbody tr:hover td {
    background: #f9fbff;
}

.archive-page .table th[data-sort] img {
    width: 10px !important;
    height: 10px !important;
    margin-left: 4px !important;
    opacity: .5;
}

.archive-page #templatesTab .table th:nth-child(1) {
    width: 19%;
}

.archive-page #templatesTab .table th:nth-child(3) {
    width: 12rem;
}

.archive-page #templatesTab .table th:nth-child(4) {
    width: 12rem;
}

.archive-page #filesTab .table th:nth-child(2) {
    width: 14rem;
}

.archive-page #filesTab .table th:nth-child(3) {
    width: 12rem;
}

.archive-page #inputFilesTab .table th:nth-child(5) {
    width: 8rem;
}

.archive-page #deletedTemplatesList .archive-row-actions {
    gap: 4px;
}

.archive-page #deletedTemplatesList .btn-primary,
.archive-page #generatedFilesList .download-file-btn {
    min-height: 36px;
    padding: 6px 12px;
    border: 1px solid #c9d8ff;
    border-radius: 8px;
    color: var(--archive-accent);
    background: #fff;
    box-shadow: 0 2px 7px rgba(35, 58, 97, .08);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
}

.archive-page #deletedTemplatesList .btn-primary:hover,
.archive-page #generatedFilesList .download-file-btn:hover {
    border-color: #b8c9f4;
    color: var(--archive-accent-hover);
    background: #f7f9ff;
}

.archive-page #deletedTemplatesList .delete-from-archive-btn,
.archive-page #generatedFilesList .delete-from-archive-btn,
.archive-page #inputFilesList .btn-group .btn {
    width: 31px;
    height: 31px;
    min-width: 31px;
    min-height: 31px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 31px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 7px !important;
    color: #607089;
    background: transparent;
    box-shadow: none;
}

.archive-page #inputFilesList .btn-group {
    gap: 4px;
}

.archive-page #inputFilesList .btn-group .btn:hover {
    border-color: #d8e3fa;
    color: var(--archive-accent);
    background: #eef4ff;
}

.archive-page #deletedTemplatesList .delete-from-archive-btn:hover,
.archive-page #generatedFilesList .delete-from-archive-btn:hover,
.archive-page #inputFilesList .btn-group .btn:last-child:hover {
    border-color: #f2d1d5;
    color: #c9434d;
    background: #fff1f2;
}

.archive-page #inputFilesList .badge {
    padding: 5px 8px;
    border: 1px solid #d9e4fd;
    border-radius: 7px;
    color: #405374 !important;
    background: #f6f8fe !important;
    font-size: 11px;
    font-weight: 700;
}

.archive-page #noDeletedTemplatesMessage,
.archive-page #noGeneratedFilesMessage,
.archive-page #noInputFilesMessage {
    color: #718096;
    font-size: 13px;
}

@media (max-width: 900px) {
    .archive-page #archiveTabs {
        width: 100%;
        overflow-x: auto;
    }

    .archive-page #archiveTabs .nav-item {
        min-width: 150px;
    }

    .archive-page .archive-toolbar {
        align-items: stretch !important;
        flex-direction: column;
        gap: 10px;
    }

    .archive-page .archive-toolbar-actions {
        width: 100%;
    }
}

@media (max-width: 560px) {
    .archive-page .archive-workspace {
        padding: 10px;
    }

    .archive-page .archive-toolbar-actions {
        align-items: stretch;
        flex-direction: column-reverse;
    }

    .archive-page .archive-search,
    .archive-page .archive-delete-all {
        width: 100%;
    }
}

/* Приоритет новой структуры над прежними архивными правилами */
.archive-page .archive-workspace {
    padding: 0;
    border-top: 1px solid var(--archive-border);
}

.archive-page #archiveTabsContent {
    padding: 14px;
}

.archive-page .archive-toolbar {
    min-height: 60px;
    gap: 14px;
}

.archive-page .archive-search {
    width: 300px;
}

.archive-page .archive-search .form-control {
    min-height: 38px;
    padding: 7px 10px 7px 2px;
    border-left: 0;
    border-radius: 0 8px 8px 0;
}

.archive-page #templatesTab .table th:nth-child(1),
.archive-page #filesTab .table th:nth-child(1) {
    width: auto;
}

.archive-page #templatesTab .table th:nth-child(2),
.archive-page #filesTab .table th:nth-child(2) {
    width: 11rem;
}

.archive-page #templatesTab .table th:nth-child(3),
.archive-page #filesTab .table th:nth-child(3) {
    width: 7rem;
}

.archive-page #inputFilesTab .table th:nth-child(1) {
    width: auto;
}

.archive-page #inputFilesTab .table th:nth-child(2) {
    width: 11rem;
}

.archive-page #inputFilesTab .table th:nth-child(3) {
    width: 10rem;
}

.archive-page #inputFilesTab .table th:nth-child(4) {
    width: 9rem;
}

@media (max-width: 900px) {
    .archive-page #archiveTabsContent {
        padding: 10px;
    }
}

@media (max-width: 560px) {
    .archive-page .archive-workspace {
        padding: 0;
    }

    .archive-page .archive-search {
        width: 100%;
    }
}

/* Личный кабинет: компактная рабочая область */
.profile-page {
    --profile-accent: #3157e5;
    --profile-accent-hover: #2849c7;
    --profile-border: #e3e8f0;
    --profile-muted: #68768d;
    --profile-soft: #f4f7fb;
}

.profile-page .main-content > .header:not(.template-header-card) {
    width: 100%;
    min-height: 72px;
    margin: 0 0 14px;
    padding: 14px 22px;
    border: 1px solid var(--dashboard-border);
    border-radius: 14px;
    box-shadow: var(--dashboard-shadow);
}

.profile-page .main-content > .header:not(.template-header-card) .header-content {
    min-height: 0;
}

.profile-page .main-content > .header:not(.template-header-card) h1 {
    margin-bottom: 4px;
    font-size: 24px;
    font-weight: 700;
}

.profile-page .main-content > .header:not(.template-header-card) p {
    color: var(--profile-muted);
    font-size: 14px;
}

.profile-page .profile-container {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0 !important;
}

.profile-page .profile-container > .alert {
    margin-bottom: 14px;
}

.profile-page .profile-dashboard {
    display: grid;
    gap: 14px;
}

.profile-page .profile-panel {
    border: 1px solid var(--profile-border);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 8px 28px rgba(31, 52, 82, .06);
}

.profile-page .profile-overview {
    display: grid;
    grid-template-columns: minmax(260px, .8fr) minmax(520px, 1.7fr);
    gap: 14px 28px;
    padding: 18px;
}

.profile-page .profile-identity {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 15px;
}

.profile-page .avatar-circle {
    display: flex;
    width: 72px;
    height: 72px;
    margin: 0;
    flex: 0 0 72px;
    align-items: center;
    justify-content: center;
    border: 1px solid #d8e3fb;
    border-radius: 20px;
    color: var(--profile-accent);
    background: #eef4ff;
    box-shadow: inset 0 0 0 5px rgba(255, 255, 255, .55);
}

.profile-page .initials {
    color: currentColor;
    font-size: 29px;
    font-weight: 700;
    line-height: 1;
}

.profile-page .profile-identity-copy {
    min-width: 0;
}

.profile-page .profile-section-label {
    display: block;
    margin-bottom: 2px;
    color: var(--profile-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    line-height: 1.2;
    text-transform: uppercase;
}

.profile-page .profile-identity h2 {
    margin: 0;
    overflow: hidden;
    color: var(--dashboard-text);
    font-size: 21px;
    font-weight: 700;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-page .profile-identity p {
    margin: 3px 0 8px;
    overflow: hidden;
    color: var(--profile-muted);
    font-size: 13px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-page .plan-badge {
    display: inline-flex;
    min-height: 24px;
    padding: 4px 8px;
    align-items: center;
    gap: 5px;
    border: 1px solid #d8e3fb;
    border-radius: 7px;
    color: #315bd8;
    background: #f2f6ff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
}

.profile-page .profile-facts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 9px;
}

.profile-page .profile-fact {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 80px;
    padding: 13px;
    align-items: center;
    gap: 12px;
    border: 1px solid #e5eaf2;
    border-radius: 10px;
    background: #f8fafc;
}

.profile-page .profile-fact-icon,
.profile-page .profile-heading-icon,
.profile-page .stats-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--profile-accent);
    background: #eef4ff;
}

.profile-page .profile-fact-icon {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border-radius: 9px;
    font-size: 18px;
}

.profile-page .profile-fact > span:nth-child(2) {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 2px;
}

.profile-page .profile-fact small {
    color: var(--profile-muted);
    font-size: 13px;
    font-weight: 550;
    line-height: 1.2;
}

.profile-page .profile-fact strong {
    overflow: hidden;
    color: #1a2942;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-page .profile-status-dot {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #e6a700;
}

.profile-page .profile-status-dot.is-verified {
    background: #20a56b;
}

.profile-page .profile-actions {
    display: flex;
    grid-column: 1 / -1;
    padding-top: 12px;
    align-items: center;
    gap: 8px;
    border-top: 1px solid #edf0f5;
}

.profile-page .profile-action {
    display: inline-flex;
    width: auto;
    min-height: 38px;
    padding: 8px 12px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px solid #dce3ee;
    border-radius: 8px;
    color: #44536b;
    background: #fff;
    box-shadow: none;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.25;
    text-decoration: none;
    white-space: nowrap;
    transition: color .16s ease, border-color .16s ease, background-color .16s ease;
}

.profile-page .profile-action:hover,
.profile-page .profile-action:focus-visible {
    border-color: #cbd8f6;
    color: var(--profile-accent);
    background: #f4f7ff;
    outline: none;
}

.profile-page .profile-action-primary {
    border-color: var(--profile-accent);
    color: #fff;
    background: var(--profile-accent);
}

.profile-page .profile-action-primary:hover,
.profile-page .profile-action-primary:focus-visible {
    border-color: var(--profile-accent-hover);
    color: #fff;
    background: var(--profile-accent-hover);
}

.profile-page .profile-action-pro {
    border-color: #ead99c;
    color: #846100;
    background: #fffaf0;
}

.profile-page .profile-action-pro:hover,
.profile-page .profile-action-pro:focus-visible {
    border-color: #dec673;
    color: #694c00;
    background: #fff5d9;
}

.profile-page .profile-content-grid {
    display: grid;
    grid-template-columns: minmax(360px, .9fr) minmax(520px, 1.1fr);
    gap: 14px;
}

.profile-page .profile-stats-panel,
.profile-page .profile-plan-panel {
    min-width: 0;
    padding: 18px;
}

.profile-page .profile-panel-heading {
    display: flex;
    min-width: 0;
    margin-bottom: 16px;
    align-items: center;
    gap: 10px;
}

.profile-page .profile-heading-icon {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border-radius: 9px;
    font-size: 16px;
}

.profile-page .profile-heading-icon-plan {
    color: var(--profile-accent);
    background: #eef4ff;
}

.profile-page .profile-panel-heading h2 {
    margin: 0;
    color: var(--dashboard-text);
    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
}

.profile-page .profile-panel-heading p {
    margin: 2px 0 0;
    color: var(--profile-muted);
    font-size: 13px;
    line-height: 1.3;
}

.profile-page .profile-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 9px;
}

.profile-page .stats-item {
    display: flex;
    height: auto;
    min-height: 112px;
    padding: 16px;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    border: 1px solid #e5eaf2;
    border-radius: 10px;
    background: #f8fafc;
}

.profile-page .stats-item > span:last-child {
    display: flex;
    min-width: 0;
    flex-direction: column;
    align-items: flex-end;
}

.profile-page .stats-icon {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border-radius: 8px;
    font-size: 17px;
}

.profile-page .stats-templates .stats-icon {
    color: #13875a;
    background: #eaf8f1;
}

.profile-page .stats-fields .stats-icon {
    color: #a97500;
    background: #fff6dc;
}

.profile-page .stats-item strong {
    color: var(--dashboard-text);
    font-size: 32px;
    font-weight: 700;
    line-height: 1;
}

.profile-page .stats-item small {
    margin-top: 7px;
    color: var(--profile-muted);
    font-size: 13px;
    line-height: 1.2;
}

.profile-page .profile-current-badge {
    min-height: 24px;
    margin-left: auto;
    padding: 5px 8px;
    border-radius: 7px;
    color: #56647a;
    background: #edf1f6;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.4;
    text-transform: uppercase;
}

.profile-page .profile-current-badge i {
    margin-right: 4px;
    font-size: 10px;
}

.profile-page .profile-plan-summary {
    display: flex;
    min-height: 104px;
    padding: 18px;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    border: 1px solid #e5eaf2;
    border-radius: 10px;
    background: linear-gradient(135deg, #fbfcff 0%, #f7f9fd 100%);
}

.profile-page .profile-plan-summary strong {
    color: var(--dashboard-text);
    font-size: 26px;
    font-weight: 700;
    line-height: 1.2;
}

.profile-page .profile-plan-copy {
    min-width: 0;
}

.profile-page .profile-plan-name {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.profile-page .profile-plan-summary p {
    margin: 4px 0 0;
    color: var(--profile-muted);
    font-size: 14px;
    line-height: 1.4;
}

.profile-page .profile-plan-mark {
    display: inline-flex;
    width: 50px;
    height: 50px;
    flex: 0 0 50px;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    color: var(--profile-accent);
    background: #eef4ff;
    font-size: 22px;
}

.profile-page .profile-plan-features {
    display: flex;
    margin-top: 12px;
    flex-wrap: wrap;
    gap: 7px;
}

.profile-page .profile-plan-features span {
    display: inline-flex;
    min-height: 34px;
    padding: 7px 10px;
    align-items: center;
    gap: 5px;
    border: 1px solid #e3e8f0;
    border-radius: 7px;
    color: #536078;
    background: #fff;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.25;
}

.profile-page .profile-plan-features i {
    color: #16825a;
    font-size: 13px;
}

/* Премиальное оформление появляется только у активного PRO-пользователя */
.profile-page .profile-plan-panel.is-pro {
    position: relative;
    overflow: hidden;
    border-color: #ead483;
    background: linear-gradient(180deg, #fffdf7 0%, #ffffff 46%);
    box-shadow: 0 10px 32px rgba(160, 112, 0, .13);
}

.profile-page .profile-plan-panel.is-pro::before {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 4px;
    content: "";
    background: linear-gradient(90deg, #d79a00 0%, #ffd96b 48%, #d79a00 100%);
}

.profile-page .profile-plan-panel.is-pro .profile-heading-icon-plan {
    color: #9a6700;
    background: #fff1bd;
}

.profile-page .profile-plan-panel.is-pro .profile-current-badge {
    border: 1px solid #ebcf70;
    color: #714b00;
    background: linear-gradient(135deg, #ffe58b 0%, #fff1bd 100%);
    box-shadow: 0 3px 10px rgba(166, 113, 0, .12);
}

.profile-page .profile-plan-panel.is-pro .profile-plan-summary {
    border-color: #ead58a;
    background: linear-gradient(135deg, #fff7d6 0%, #fffdf5 46%, #f4f7ff 100%);
}

.profile-page .profile-plan-panel.is-pro .profile-plan-summary strong {
    color: #8a5b00;
}

.profile-page .profile-plan-panel.is-pro .profile-plan-mark {
    color: #8d5e00;
    background: linear-gradient(145deg, #ffe17a 0%, #fff1b5 100%);
    box-shadow: 0 6px 18px rgba(175, 119, 0, .16);
}

.profile-page .profile-plan-panel.is-pro .profile-plan-features span {
    border-color: #ebdfb4;
    background: #fffdf7;
}

@media (max-width: 1180px) {
    .profile-page .profile-overview {
        grid-template-columns: 1fr;
    }

    .profile-page .profile-content-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .profile-page .profile-overview,
    .profile-page .profile-stats-panel,
    .profile-page .profile-plan-panel {
        padding: 15px;
    }

    .profile-page .profile-facts,
    .profile-page .profile-stats {
        grid-template-columns: 1fr;
    }

    .profile-page .profile-fact,
    .profile-page .stats-item {
        min-height: 64px;
    }

    .profile-page .profile-actions {
        flex-wrap: wrap;
    }

    .profile-page .profile-action {
        flex: 1 1 calc(50% - 4px);
    }
}

@media (max-width: 480px) {
    .profile-page .profile-identity {
        align-items: flex-start;
    }

    .profile-page .avatar-circle {
        width: 58px;
        height: 58px;
        flex-basis: 58px;
        border-radius: 16px;
    }

    .profile-page .initials {
        font-size: 24px;
    }

    .profile-page .profile-action {
        flex-basis: 100%;
    }
}

/* Профиль использует общую рабочую ширину страниц кабинета */
.profile-page .main-content > .header:not(.template-header-card),
.profile-page .profile-container {
    width: 100%;
    max-width: var(--content-max-width);
    margin-left: 0;
    margin-right: auto;
}

/* Компактные формы профиля в модальных окнах */
.profile-page .profile-form-modal .modal-dialog {
    max-width: 520px;
}

.profile-page .profile-form-modal .modal-content {
    overflow: hidden;
    border: 0;
    border-radius: 16px;
    box-shadow: 0 22px 60px rgba(31, 52, 91, .2);
}

.profile-page .profile-form-modal .modal-header {
    align-items: flex-start;
    padding: 20px 22px;
    border-bottom: 1px solid #e5ebf5;
    background: #fbfcff;
}

.profile-page .profile-modal-heading {
    display: flex;
    align-items: center;
    gap: 12px;
}

.profile-page .profile-modal-icon {
    display: inline-flex;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    color: #2459e8;
    background: #edf3ff;
    font-size: 18px;
}

.profile-page .profile-modal-heading h2 {
    margin: 0;
    color: #071b3d;
    font-size: 20px;
    font-weight: 700;
}

.profile-page .profile-modal-heading p {
    margin: 3px 0 0;
    color: #6b7c98;
    font-size: 13px;
}

.profile-page .profile-form-modal .modal-body {
    padding: 22px;
}

.profile-page .profile-form-modal .modal-footer {
    padding: 0 22px 20px;
    border: 0;
}

.profile-page .profile-form-modal .form-label {
    color: #263b5d;
    font-size: 14px;
    font-weight: 600;
}

.profile-page .profile-form-modal .form-control {
    min-height: 46px;
    border-color: #d5deec;
    border-radius: 9px;
}

.profile-page .profile-form-modal .form-control:focus {
    border-color: #3764eb;
    box-shadow: 0 0 0 3px rgba(55, 100, 235, .12);
}

.profile-page .profile-modal-message:empty {
    display: none;
}

.profile-page .profile-modal-message {
    margin-bottom: 16px;
    font-size: 14px;
}

/* История платежей в общем макете личного кабинета */
.payment-history-page .main-content > .payment-history-header,
.payment-history-page .payment-history-workspace {
    width: 100%;
    max-width: var(--content-max-width);
    margin-right: auto;
    margin-left: 0;
}

.payment-history-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.payment-history-heading h1 { margin: 0 0 4px; }
.payment-history-heading p { margin: 0; color: #71809a; }

.payment-back-button,
.payment-primary-button {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 14px;
    border: 1px solid #d5deec;
    border-radius: 9px;
    color: #263b5d;
    background: #fff;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: border-color .18s ease, color .18s ease, transform .18s ease;
}

.payment-back-button:hover { border-color: #3764eb; color: #2459e8; transform: translateY(-1px); }
.payment-primary-button { border-color: #315be8; color: #fff; background: #315be8; }
.payment-primary-button:hover { color: #fff; background: #254cd2; }

.payment-history-workspace {
    padding: 18px;
    border: 1px solid #dbe3ef;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 8px 26px rgba(35, 56, 89, .07);
}

.payment-list { display: grid; gap: 10px; }

.payment-history-page .payment-card {
    display: grid;
    grid-template-columns: minmax(280px, 1.8fr) minmax(145px, .7fr) minmax(150px, .7fr) minmax(130px, .55fr);
    align-items: center;
    gap: 18px;
    margin: 0;
    padding: 16px;
    border: 1px solid #e1e7f0;
    border-radius: 11px;
    background: #fff;
    transition: border-color .18s ease, box-shadow .18s ease;
}

.payment-history-page .payment-card:hover { border-color: #bdccf7; box-shadow: 0 6px 18px rgba(48, 79, 145, .08); }
.payment-card-primary { display: flex; min-width: 0; align-items: center; gap: 12px; }
.payment-icon {
    display: inline-flex;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    color: #2459e8;
    background: #edf3ff;
    font-size: 18px;
}

.payment-card-primary h2 {
    overflow: hidden;
    margin: 0 0 3px;
    color: #0b1f40;
    font-size: 16px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.payment-id { display: block; overflow: hidden; color: #8694ab; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.payment-card-date, .payment-card-method, .payment-card-total { display: flex; flex-direction: column; gap: 3px; color: #314565; font-size: 14px; }
.payment-card-total { align-items: flex-end; }
.payment-card-total strong { color: #0b1f40; font-size: 20px; }
.payment-label { color: #8a98ad; font-size: 11px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; }
.payment-status { display: inline-flex; width: fit-content; padding: 4px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.payment-history-page .status-succeeded { color: #087451; background: #e5f7ef; }
.payment-history-page .status-pending { color: #815b00; background: #fff2c6; }
.payment-history-page .status-canceled { color: #ad3441; background: #fdecef; }

.payment-subscription-notice {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    padding: 14px 16px;
    border: 1px solid #d8c477;
    border-radius: 11px;
    color: #654600;
    background: #fffae8;
}

.payment-subscription-notice > span { font-size: 20px; }
.payment-subscription-notice p { margin: 2px 0 0; color: #806a30; font-size: 13px; }
.payment-empty-state { display: flex; min-height: 360px; flex-direction: column; align-items: center; justify-content: center; padding: 40px 20px; text-align: center; }
.payment-empty-icon { display: inline-flex; width: 64px; height: 64px; align-items: center; justify-content: center; margin-bottom: 16px; border-radius: 18px; color: #315be8; background: #edf3ff; font-size: 28px; }
.payment-empty-state h2 { margin: 0 0 6px; color: #0b1f40; font-size: 21px; }
.payment-empty-state p { margin: 0; color: #71809a; }
.payment-empty-actions { display: flex; gap: 8px; margin-top: 20px; }

@media (max-width: 1050px) {
    .payment-history-page .payment-card { grid-template-columns: minmax(260px, 1.5fr) 1fr 130px; }
    .payment-card-method { display: none; }
}

@media (max-width: 760px) {
    .payment-history-heading { align-items: flex-start; flex-direction: column; }
    .payment-history-page .payment-card { grid-template-columns: 1fr 1fr; }
    .payment-card-primary { grid-column: 1 / -1; }
    .payment-card-total { align-items: flex-start; }
}

@media (max-width: 480px) {
    .payment-history-page .payment-card { grid-template-columns: 1fr; }
    .payment-card-primary { grid-column: auto; }
    .payment-empty-actions { width: 100%; flex-direction: column; }
}
.system-sidebar-notice {
    margin: 12px 16px 0;
    padding: 13px 14px;
    border: 1px solid #bfd3fa;
    border-radius: 12px;
    color: #24416f;
    background: #eef4ff;
    font-size: 13px;
    line-height: 1.4;
}
.system-sidebar-notice__title { display: flex; align-items: center; gap: 7px; margin-bottom: 5px; }
.system-sidebar-notice__title strong { flex: 1; }
.system-sidebar-notice__close { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; flex: 0 0 26px; padding: 0; border: 0; border-radius: 7px; color: currentColor; background: transparent; cursor: pointer; }
.system-sidebar-notice__close:hover { background: rgba(23, 32, 51, .08); }
.system-sidebar-notice p { margin: 0; }
.system-sidebar-notice.is-success { border-color: #a9dfc8; color: #176446; background: #edfaf4; }
.system-sidebar-notice.is-warning { border-color: #efcc73; color: #725511; background: #fff8df; }
.system-sidebar-notice.is-danger { border-color: #edb7bd; color: #8c2933; background: #fff0f1; }
