/* Hospital — единый слой оформления для всех страниц.
   Загружается после bundle-* и polish.css: тёплая красно-чёрная палитра,
   тёмная тема для старых Bootstrap-страниц, таблицы, формы, модалки. */

:root {
    --h-text: #f5eeee;
    --h-muted: rgba(245, 238, 238, 0.66);
    --h-dim: rgba(196, 162, 162, 0.44);
    --h-surface: #1b1414;
    --h-surface-2: #251a1a;
    --h-surface-elevated: #2e1d1d;
    --h-border: rgba(190, 90, 90, 0.22);
    --h-border-glow: rgba(225, 80, 90, 0.55);
    --h-violet: #b57878;
    --h-violet-soft: #e7b6b6;
    --h-ice: #d9bcbc;
}

/* ---------- Общая оболочка наследуемых страниц ---------- */

.legacy-page.h-page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 12px 20px 72px;
    color: var(--h-text);
}

.legacy-page .h-section-head {
    margin-bottom: 26px;
}

.legacy-page .h-subtitle {
    max-width: 680px;
}

.pp-section .pp-card {
    margin-left: auto;
    margin-right: auto;
}

.legacy-page h1,
.legacy-page h2,
.legacy-page h3,
.legacy-page h4,
.legacy-page h5,
.legacy-page h6,
.legacy-page .h1,
.legacy-page .h2,
.legacy-page .h3,
.legacy-page .h4,
.legacy-page .h5,
.legacy-page .h6 {
    color: #fff;
    font-family: var(--font-display);
}

.legacy-page .display-5,
.legacy-page .display-3 {
    color: #fff !important;
    font-weight: 800 !important;
    letter-spacing: -0.03em;
}

.legacy-page .lead,
.legacy-page .text-muted,
.legacy-page .form-text {
    color: var(--h-muted) !important;
}

.legacy-page .text-success {
    color: #86efac !important;
}

.legacy-page .text-warning {
    color: #f5b942 !important;
}

/* ---------- Карточки ---------- */

.legacy-page .card {
    background:
        linear-gradient(145deg, rgba(26, 18, 18, 0.88) 0%, rgba(14, 10, 10, 0.78) 100%);
    border: 1px solid var(--h-border);
    border-radius: 18px;
    box-shadow: var(--h-shadow);
    color: var(--h-text);
    overflow: hidden;
}

.legacy-page .card-header {
    background: linear-gradient(135deg, rgba(122, 21, 33, 0.42), rgba(58, 20, 20, 0.32)) !important;
    border-bottom: 1px solid var(--h-border);
    color: #fff !important;
    padding: 16px 22px;
}

.legacy-page .card-header h1,
.legacy-page .card-header h2,
.legacy-page .card-header h3,
.legacy-page .card-header h4,
.legacy-page .card-header h5,
.legacy-page .card-header h6 {
    color: #fff !important;
    margin: 0;
}

.legacy-page .card-body {
    padding: 22px;
    color: var(--h-text);
}

.legacy-page .card-footer {
    background: rgba(255, 255, 255, 0.025);
    border-top: 1px solid var(--h-border);
    padding: 16px 22px;
}

.legacy-page .card.border-success,
.legacy-page .card.border-warning {
    border-color: rgba(225, 90, 90, 0.42) !important;
}

.legacy-page .list-group-item {
    background: transparent;
    border-color: var(--h-border);
    color: var(--h-text);
}

.legacy-page .list-group-item-action {
    transition: background 0.2s ease, color 0.2s ease;
}

.legacy-page .list-group-item-action:hover,
.legacy-page .list-group-item-action:focus {
    background: rgba(190, 60, 70, 0.12);
    color: #fff;
}

/* ---------- Уведомления ---------- */

.legacy-page .alert {
    border-radius: 14px;
    border: 1px solid var(--h-border);
    background: rgba(30, 18, 18, 0.72);
    color: var(--h-text);
}

.legacy-page .alert-info {
    background: rgba(120, 35, 45, 0.16);
    border-color: rgba(200, 90, 100, 0.3);
    color: #f3dddd;
}

.legacy-page .alert-success {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(74, 222, 128, 0.28);
    color: #d9f7e3;
}

.legacy-page .alert-danger {
    background: rgba(220, 38, 38, 0.12);
    border-color: rgba(248, 113, 113, 0.32);
    color: #ffe0e0;
}

.legacy-page .alert-heading {
    color: #fff;
    font-size: 1rem;
}

/* ---------- Кнопки ---------- */

.legacy-page .btn {
    border-radius: var(--h-radius-sm);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.82rem;
    letter-spacing: 0.03em;
    padding: 10px 20px;
    transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.legacy-page .btn-lg {
    padding: 13px 26px;
    font-size: 0.88rem;
}

.legacy-page .btn-primary,
.legacy-page .btn-success {
    background: var(--h-btn-bg) !important;
    border: 1px solid var(--h-btn-border) !important;
    color: #fff !important;
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.35);
}

.legacy-page .btn-primary:hover,
.legacy-page .btn-success:hover {
    transform: translateY(-2px);
    color: #fff !important;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45), 0 0 22px var(--h-accent-glow);
}

.legacy-page .btn-outline-primary,
.legacy-page .btn-outline-secondary {
    background: var(--h-surface-2);
    border: 1px solid var(--h-border);
    color: var(--h-muted);
}

.legacy-page .btn-outline-primary:hover,
.legacy-page .btn-outline-secondary:hover {
    background: #2a1c1c;
    border-color: var(--h-border-glow);
    color: #fff;
}

.legacy-page .btn-link {
    color: #f0a0a0;
    text-decoration: none;
}

.legacy-page .btn-close {
    filter: invert(1) grayscale(1) brightness(1.6);
    opacity: 0.7;
}

.legacy-page .btn-close:hover {
    opacity: 1;
}

/* ---------- Формы ---------- */

.legacy-page .form-label {
    color: var(--h-muted);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.legacy-page .form-control,
.legacy-page .form-select,
.legacy-page .input-group-text {
    background: rgba(255, 255, 255, 0.045) !important;
    border: 1px solid var(--h-border) !important;
    color: #fff !important;
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 0.9rem;
}

.legacy-page .input-group-text {
    border-radius: 12px 0 0 12px;
    color: var(--h-muted) !important;
}

.legacy-page .form-control:focus,
.legacy-page .form-select:focus {
    border-color: rgba(225, 90, 100, 0.55) !important;
    box-shadow: 0 0 0 3px rgba(200, 60, 70, 0.16) !important;
}

.legacy-page .form-control::placeholder {
    color: rgba(245, 238, 238, 0.35);
}

.legacy-page .form-select option {
    background: #1a1111;
    color: #fff;
}

.legacy-page .form-check-input {
    background-color: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--h-border);
}

.legacy-page .form-check-input:checked {
    background-color: #c0203a;
    border-color: #eb2d41;
}

.legacy-page .form-check-label {
    color: var(--h-text);
}

/* ---------- Таблицы ---------- */

.legacy-page .table {
    --bs-table-color: var(--h-text);
    --bs-table-bg: transparent;
    --bs-table-border-color: var(--h-border);
    margin-bottom: 0;
}

.legacy-page .table > :not(caption) > * > * {
    background: transparent;
    color: var(--h-text);
    border-color: var(--h-border);
    padding: 14px 16px;
}

.legacy-page .table thead th {
    color: var(--h-muted);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 700;
}

.legacy-page .table-striped > tbody > tr:nth-of-type(odd) > * {
    background: rgba(255, 255, 255, 0.025);
}

.legacy-page .table-hover > tbody > tr:hover > * {
    background: rgba(190, 60, 70, 0.1);
    color: #fff;
}

/* ---------- Модальные окна, прогресс, хлебные крошки ---------- */

.legacy-page .modal-content {
    background: #171010;
    border: 1px solid var(--h-border);
    border-radius: 18px;
    color: var(--h-text);
}

.legacy-page .modal-header,
.legacy-page .modal-footer {
    border-color: var(--h-border);
}

.legacy-page .modal-title {
    color: #fff;
}

.legacy-page .progress {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    overflow: hidden;
}

.legacy-page .progress-bar {
    background: linear-gradient(90deg, #7a1521, #eb2d41);
}

.legacy-page .progress-bar.bg-warning {
    background: linear-gradient(90deg, #b07b1f, #f5b942) !important;
}

.legacy-page .breadcrumb {
    --bs-breadcrumb-divider-color: rgba(245, 238, 238, 0.35);
    margin-bottom: 18px;
}

.legacy-page .breadcrumb a {
    color: #f0a0a0;
    text-decoration: none;
}

.legacy-page .breadcrumb-item.active {
    color: var(--h-muted);
}

.legacy-page .badge.bg-secondary {
    background: rgba(190, 60, 70, 0.22) !important;
    border: 1px solid var(--h-border);
    color: #fbd5d5;
    font-weight: 600;
}

.legacy-page .badge.bg-success {
    background: rgba(34, 197, 94, 0.18) !important;
    border: 1px solid rgba(74, 222, 128, 0.3);
    color: #b7f7cd;
}

/* ---------- История скачиваний ---------- */

.hist-card {
    padding: 0;
}

.hist-table {
    width: 100%;
    border-collapse: collapse;
}

.hist-table th,
.hist-table td {
    padding: 15px 18px;
    text-align: left;
    border-bottom: 1px solid var(--h-border);
    font-size: 0.88rem;
}

.hist-table th {
    color: var(--h-muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.02);
}

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

.hist-table tbody tr:hover td {
    background: rgba(190, 60, 70, 0.08);
}

.hist-ver {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(190, 60, 70, 0.16);
    border: 1px solid var(--h-border);
    color: #fbd5d5;
    font-weight: 700;
    font-size: 0.78rem;
}

.hist-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 18px 22px 22px;
}

/* ---------- Индивидуальный план ---------- */

.cp-page .card-header {
    background: linear-gradient(135deg, rgba(122, 21, 33, 0.46), rgba(58, 20, 20, 0.34)) !important;
}

.cp-page .list-group-item {
    padding-left: 0;
    padding-right: 0;
}

.cp-page .form-check {
    padding-left: 2.1em;
}

.cp-page .form-check-input {
    width: 1.15em;
    height: 1.15em;
    margin-left: -2.1em;
}

.cp-page .text-success,
.cp-page .text-success i {
    color: #86efac !important;
}

.cp-page .modal-content .list-group-item {
    padding-left: 14px;
    padding-right: 14px;
}

/* ---------- Отзывы ---------- */

.rev-page .card-text {
    color: var(--h-muted);
    line-height: 1.65;
}

.rev-page .card-title {
    color: #fff;
    font-size: 1rem;
}

.rev-page .rating-stars {
    color: #f5b942;
}

.rev-page .card img.rounded-circle {
    border: 1px solid var(--h-border);
}

.rev-toolbar {
    display: flex;
    justify-content: flex-end;
    margin: -12px 0 18px;
}

/* ---------- API-токены ---------- */

.tokens-page .bg-light {
    background: rgba(255, 255, 255, 0.045) !important;
    border: 1px solid var(--h-border);
    color: #f0c8c8 !important;
}

.tokens-page code {
    color: #f0c8c8;
}

.tokens-page .btn-warning {
    background: rgba(245, 185, 66, 0.16) !important;
    border: 1px solid rgba(245, 185, 66, 0.35) !important;
    color: #f6d799 !important;
}

.tokens-page .btn-danger {
    background: rgba(200, 40, 55, 0.24) !important;
    border: 1px solid rgba(235, 70, 80, 0.42) !important;
    color: #ffdada !important;
}

.tokens-pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-top: 18px;
    color: var(--h-muted);
    font-size: 0.82rem;
}

.tokens-pager a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid var(--h-border);
    background: var(--h-surface-2);
    color: var(--h-text);
    text-decoration: none;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.tokens-pager a:hover {
    border-color: var(--h-border-glow);
    background: #2a1c1c;
}

/* ---------- Статьи ---------- */

.article-page .blog-post {
    color: var(--h-text);
}

.article-page .blog-post h1 {
    font-size: clamp(1.6rem, 3.4vw, 2.3rem);
    font-weight: 800;
    letter-spacing: -0.02em;
}

.article-page .blog-content {
    color: rgba(245, 238, 238, 0.78);
    font-size: 1rem;
    line-height: 1.8;
}

.article-page .blog-content h2,
.article-page .blog-content h3 {
    margin-top: 1.8em;
    color: #fff;
}

.article-page .blog-content a {
    color: #f0a0a0;
}

.article-page .blog-content img {
    max-width: 100%;
    height: auto;
    border-radius: 14px;
    border: 1px solid var(--h-border);
}

.article-page .blog-content pre,
.article-page .blog-content code {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--h-border);
    border-radius: 10px;
    color: #ffd6d6;
}

.article-page .blog-content pre {
    padding: 16px;
    overflow-x: auto;
}

.article-page .blog-content blockquote {
    border-left: 3px solid #c0203a;
    padding-left: 16px;
    color: var(--h-muted);
}

.article-page .social-share a {
    border-radius: 10px;
}

/* ---------- Радар ---------- */

.radar-page .radar-shell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 22px 20px 20px;
}

.radar-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 30px;
    padding: 7px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--h-border);
    color: var(--h-muted);
    font-size: 0.82rem;
    font-weight: 600;
    text-align: center;
}

.radar-canvas {
    width: min(100%, 520px);
    height: auto;
    display: block;
    background: #0b0709;
    border-radius: 50%;
    border: 1px solid rgba(220, 90, 90, 0.2);
    box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.55), 0 0 40px rgba(160, 40, 50, 0.08);
}

.radar-legend {
    margin: 0;
    text-align: center;
    font-size: 0.75rem;
    line-height: 1.5;
    color: var(--h-muted);
}

/* ---------- Мобильная адаптация ---------- */

/* ---------- Восстановление доступа ---------- */

.auth-wrapper {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    min-height: calc(100vh - 220px);
    padding: 36px 20px 64px;
}

.auth-card {
    width: 100%;
    max-width: 460px;
    padding: 30px 26px;
    border-radius: 20px;
    border: 1px solid var(--h-border);
    background: linear-gradient(145deg, rgba(26, 18, 18, 0.92), rgba(13, 9, 9, 0.9));
    box-shadow: var(--h-shadow);
    color: var(--h-text);
}

.auth-card h4 {
    margin: 0 0 18px;
    color: #fff;
    font-family: var(--font-display);
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.auth-card .form-label {
    color: var(--h-muted);
    font-size: 0.8rem;
    font-weight: 600;
}

.auth-card .form-control,
.auth-card .input-group-text {
    background: rgba(255, 255, 255, 0.045);
    border: 1px solid var(--h-border);
    color: #fff;
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 0.9rem;
}

.auth-card .input-group-text {
    border-radius: 12px 0 0 12px;
    color: var(--h-muted);
}

.auth-card .form-control:focus {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(225, 90, 100, 0.55);
    box-shadow: 0 0 0 3px rgba(200, 60, 70, 0.16);
    color: #fff;
}

.auth-card .btn-auth {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 13px 24px;
    border: 1px solid var(--h-btn-border);
    border-radius: var(--h-radius-sm);
    background: var(--h-btn-bg);
    color: #fff;
    font-family: var(--font-display);
    font-size: 0.86rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.35);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.auth-card .btn-auth:hover {
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.4), 0 0 22px var(--h-accent-glow);
}

.auth-card .alert {
    border-radius: 12px;
    border: 1px solid var(--h-border);
    background: rgba(30, 18, 18, 0.7);
    color: var(--h-text);
    font-size: 0.84rem;
}

.auth-card .alert-danger {
    background: rgba(220, 38, 38, 0.12);
    border-color: rgba(248, 113, 113, 0.32);
    color: #ffe0e0;
}

.auth-card .alert-info {
    background: rgba(120, 35, 45, 0.16);
    border-color: rgba(200, 90, 100, 0.3);
    color: #f3dddd;
}

.auth-card .auth-footer {
    margin-top: 20px;
    text-align: center;
    color: var(--h-muted);
    font-size: 0.84rem;
}

.auth-card .auth-footer a,
.auth-card a {
    color: #f0a0a0;
}

.auth-card .auth-footer a:hover,
.auth-card a:hover {
    color: #ffd6d6;
}

/* ---------- Мобильная адаптация ---------- */

@media (max-width: 860px) {
    .legacy-page.h-page {
        padding: 8px 14px 56px;
    }

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

    .legacy-page .hist-table th,
    .legacy-page .hist-table td {
        padding: 12px 10px;
        font-size: 0.82rem;
    }

    .hist-actions {
        padding: 16px;
    }
}

@media (max-width: 640px) {
    .legacy-page .h1 {
        font-size: 1.6rem;
    }

    .legacy-page .table-responsive {
        margin: 0 -4px;
    }

    .hist-table th:nth-child(4),
    .hist-table td:nth-child(4) {
        display: none;
    }

    .hist-table th,
    .hist-table td {
        padding: 12px 9px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .legacy-page .btn,
    .legacy-page .list-group-item-action,
    .legacy-page .card {
        transition: none !important;
    }
}
