:root {
    --primary: #0093ba;
    --primary-dark: #0084a6;
    --primary-darker: #00728f;
    --accent: #0093ba;
    --accent-dark: #0084a6;
    --accent-light: #00a9d6;
    --accent-rgb: 0, 147, 186;
    --ink: #00728f;
    --text: #333b45;
    --text-soft: #5f7684;
    --line: #d5e4ec;
    --bg: #eef6f9;
    --card: #ffffff;
    --header-bg: #0093ba;
    --nav-bg: #00789a;
    --panel-bg: #002f50;
    --panel-nav: #00365a;
    --header-text: #ffffff;
    --header-text-soft: #d9eef6;
    --radius: 6px;
    --shadow-sm: 0 1px 2px rgba(0, 147, 186, 0.10);
    --shadow-hover: 0 8px 20px rgba(0, 114, 143, 0.20);
    --font: "Open Sans", "Segoe UI", -apple-system, Arial, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

main {
    flex: 1;
    width: 100%;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 28px 24px;
}

/* ---------- Верхняя полоса (как на nrcii.ru) ---------- */

.head_line {
    background: var(--panel-bg);
    color: #bcd8e8;
    font-size: 0.85rem;
}

.head_line-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 8px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.head_line-site {
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    font-size: 0.8rem;
}

.head_line-info {
    color: #ffffff;
    font-weight: 600;
}

/* ---------- Шапка / меню (как на nrcii.ru) ---------- */

.navbar {
    background: var(--panel-nav);
    color: var(--header-text);
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 2px 8px rgba(0, 41, 70, 0.35);
}

.nav-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.brand {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--header-text);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 0;
}

.brand::before {
    content: "";
    width: 22px;
    height: 22px;
    border-radius: 3px;
    background: var(--accent);
    flex: none;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-wrap: wrap;
}

.nav-links a {
    color: var(--header-text-soft);
    text-decoration: none;
    padding: 9px 14px;
    font-weight: 600;
    font-size: 0.93rem;
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-links a:hover {
    color: #ffffff;
    background: var(--accent);
}

.nav-user {
    color: #ffffff;
    font-weight: 700;
    font-size: 0.88rem;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.35);
    padding: 5px 14px;
    border-radius: 999px;
    margin-right: 4px;
}

/* ---------- Hero ---------- */

.hero {
    background: var(--card);
    border-radius: var(--radius);
    padding: 48px 40px;
    margin-top: 28px;
    box-shadow: var(--shadow-sm);
    text-align: center;
    border: 1px solid var(--line);
}

.hero h1 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 12px;
    color: var(--ink);
}

.hero p {
    margin-bottom: 28px;
    color: var(--text-soft);
    font-size: 1.05rem;
    max-width: 540px;
    margin-left: auto;
    margin-right: auto;
}

/* ---------- Кнопки (как на nrcii.ru) ---------- */

.btn-group {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 3px;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease,
                box-shadow 0.15s ease;
    font-family: inherit;
}

.btn-accent {
    background: var(--accent);
    color: #fff;
}

.btn-accent:hover {
    background: var(--accent-dark);
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    border: 1.5px solid rgba(255, 255, 255, 0.55);
}

.btn-ghost:hover {
    border-color: #fff;
    color: #fff;
    background: rgba(255, 255, 255, 0.22);
}

.nav-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-dark);
}

.btn-secondary {
    background: #ffffff;
    color: var(--primary);
    border: 1.5px solid #c6d5e3;
    text-transform: none;
    letter-spacing: 0;
}

.btn-secondary:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: #f0faff;
}

.btn-danger {
    background: #d93a3a;
    color: #fff;
}

.btn-danger:hover {
    background: #c22f2f;
}

.btn-back {
    background: #ffffff;
    color: var(--text);
    border: 1.5px solid #c6d5e3;
    text-transform: none;
    letter-spacing: 0;
}

.btn-back:hover {
    border-color: var(--accent);
    color: var(--accent);
}

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

.btn-sm {
    padding: 6px 12px;
    font-size: 0.76rem;
    border-radius: 3px;
}

/* ---------- Auth cards ---------- */

.auth-card {
    background: var(--card);
    border: 1px solid var(--line);
    max-width: 420px;
    margin: 48px auto;
    padding: 36px 32px;
    border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(0, 114, 143, 0.12);
}

.auth-card h1 {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 26px;
    color: var(--ink);
    text-align: center;
    letter-spacing: -0.01em;
}

form label {
    display: block;
    font-weight: 600;
    margin-bottom: 14px;
    color: var(--text);
    font-size: 0.92rem;
}

form input {
    width: 100%;
    padding: 11px 13px;
    margin-top: 6px;
    border: 1px solid #d5e0ea;
    border-radius: 3px;
    font-size: 0.95rem;
    background: #f5f8fb;
    color: var(--text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    font-family: inherit;
}

form input:focus {
    outline: none;
    border-color: var(--accent);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.18);
}

form input[type="number"] {
    max-width: 120px;
}

form textarea {
    width: 100%;
    padding: 11px 13px;
    margin-top: 6px;
    border: 1px solid #d5e0ea;
    border-radius: 3px;
    font-size: 0.95rem;
    background: #f5f8fb;
    color: var(--text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    font-family: inherit;
    resize: vertical;
    min-height: 180px;
    line-height: 1.5;
}

form textarea:focus {
    outline: none;
    border-color: var(--accent);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.18);
}

.field-hint {
    display: block;
    margin-top: 4px;
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--text-soft);
    line-height: 1.4;
}

.muted {
    margin-top: 18px;
    text-align: center;
    color: var(--text-soft);
    font-size: 0.92rem;
}

.muted a {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
}

.muted a:hover {
    text-decoration: underline;
}

/* ---------- Flash ---------- */

.flash {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 16px;
    font-weight: 600;
    font-size: 0.92rem;
    border: 1px solid transparent;
}

.flash.success { background: #effaf3; color: #17803c; border-color: #b9ecd0; }
.flash.danger { background: #fff2f2; color: #c42a2a; border-color: #f7c4c4; }
.flash.warning { background: #fff8e9; color: #96610a; border-color: #f5e0b3; }
.flash.info { background: #ecf7fc; color: #00698c; border-color: #b7e0f0; }

/* ---------- Page head ---------- */

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 28px 0 20px;
    gap: 12px;
    flex-wrap: wrap;
}

.page-head h1 {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    margin: 0;
    color: var(--ink);
}

h2 {
    margin: 32px 0 14px;
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--ink);
}

/* ---------- Tables ---------- */

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 28px;
    box-shadow: var(--shadow-sm);
}

.table th,
.table td {
    padding: 13px 18px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    font-size: 0.93rem;
}

.table th {
    background: #eef4fa;
    color: var(--primary);
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

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

.table tbody tr {
    transition: background 0.12s ease;
}

.table tbody tr:hover {
    background: #eef8fc;
}

/* ---------- Actions ---------- */

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

.actions form {
    margin: 0;
}

/* ---------- Profile card ---------- */

.profile-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 26px 28px;
    margin-top: 6px;
    box-shadow: var(--shadow-sm);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 6px 24px;
}

.profile-card p {
    margin-bottom: 10px;
    font-size: 0.98rem;
}

.profile-card strong {
    color: var(--text-soft);
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    display: block;
    margin-bottom: 2px;
}

/* ---------- Upload / view ---------- */

.upload-form {
    display: flex;
    gap: 14px;
    align-items: center;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 26px;
    max-width: 640px;
    flex-wrap: wrap;
}

.upload-form input[type="file"] {
    flex: 1;
    min-width: 200px;
    padding: 10px;
    border: 1px dashed #a9bfd3;
    border-radius: 3px;
    background: #f7fafd;
    font-family: inherit;
    cursor: pointer;
}

.view-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 22px 0;
    gap: 12px;
    flex-wrap: wrap;
}

.view-toolbar .toolbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.view-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    word-break: break-all;
    color: var(--ink);
}

.preview-iframe {
    width: 100%;
    height: calc(100vh - 220px);
    min-height: 720px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.preview-image-wrap {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
}

.preview-image {
    max-width: 100%;
    border-radius: 4px;
}

.preview-text {
    background: var(--primary-darker);
    color: #e2edf6;
    border-radius: var(--radius);
    padding: 22px 24px;
    white-space: pre-wrap;
    word-break: break-word;
}

.preview-text pre {
    font-family: "Cascadia Code", "Consolas", "Courier New", monospace;
    font-size: 0.95rem;
    line-height: 1.6;
    white-space: pre-wrap;
}

/* ---------- Admin hints ---------- */

.admin-hint {
    margin-top: 20px;
}

.admin-hint a {
    color: var(--text-soft);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
}

.admin-hint a:hover {
    color: var(--accent);
}

/* ---------- Stats (плитки как на nrcii.ru) ---------- */

.stats-section {
    padding-top: 28px;
}

.stats-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--ink);
    margin: 24px 0 18px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--primary);
    border-radius: var(--radius);
    padding: 24px 22px;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: #ffffff;
    transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.stat-card:hover {
    background: var(--accent-light);
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.stat-card__name {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: #ffffff;
}

.stat-card__desc {
    color: #cfe6f5;
    font-size: 0.92rem;
    line-height: 1.4;
}

/* ---------- Banner ---------- */

.banner-guard {
    background: linear-gradient(90deg, var(--nav-bg) 0%, var(--primary) 100%);
    border-radius: var(--radius);
    color: #fff;
    padding: 40px 32px;
    margin-top: 28px;
    box-shadow: 0 10px 26px rgba(0, 114, 143, 0.25);
}

.banner-guard__inner {
    max-width: 560px;
}

.banner-guard .stats-title {
    color: #fff;
    font-size: 1.5rem;
    font-weight: 800;
    margin-top: 0;
}

.banner-guard p {
    color: #d8ecf8;
    margin-bottom: 24px;
    font-size: 1rem;
}

.banner-guard .btn-ghost {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.5);
}

.banner-guard .btn-ghost:hover {
    border-color: #fff;
}

/* ---------- Staff/Admin login section ---------- */

.staff-admin-section {
    margin-top: 40px;
}

/* ---------- Badges (статусы разделов) ---------- */

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
}

.badge-ok {
    background: #effaf3;
    color: #17803c;
    border: 1px solid #b9ecd0;
}

.badge-off {
    background: #f2f4f7;
    color: #6b7684;
    border: 1px solid #dce2ea;
}

/* ---------- Контент раздела ---------- */

.section-content {
    line-height: 1.65;
    font-size: 0.98rem;
    white-space: pre-line;
}

/* ---------- Просмотр PDF ---------- */

.pdf-viewer {
    background: #2b3a4a;
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 16px;
}

.pdf-viewer iframe {
    width: 100%;
    height: calc(100vh - 220px);
    min-height: 720px;
    border: 0;
    border-radius: 4px;
    background: #ffffff;
}

/* ---------- Раздел: страница раздела (публичный просмотр) ---------- */

.section-content-block {
    display: block;
}

.section-public {
    margin-top: 8px;
}

.section-public__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin: 14px 0;
}

.section-public__head h2 {
    margin: 0;
}

.section-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.section-tab {
    border: 1.5px solid #c6d5e3;
    background: #ffffff;
    color: var(--text);
    border-radius: 20px;
    padding: 6px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    max-width: 260px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.section-tab:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.section-tab.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
}

.section-pdf-viewer iframe {
    height: calc(100vh - 240px);
    min-height: 700px;
}

/* ---------- Разделы: админка (создание/редактирование) ---------- */

.section-admin-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 20px;
    align-items: start;
}

.section-form-card,
.section-files-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 26px 28px;
    box-shadow: var(--shadow-sm);
}

.section-form-card__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.section-form-card__head h2 {
    margin: 0;
    font-size: 1.15rem;
}

.section-form .btn-block {
    margin-top: 22px;
}

.section-form-row {
    max-width: 320px;
}

.section-files-create {
    margin-top: 20px;
    padding: 16px 18px;
    border: 1px dashed #a9bfd3;
    border-radius: var(--radius);
    background: #f7fafd;
}

.section-file-input {
    width: 100%;
    margin-top: 8px;
    font-family: inherit;
}

.section-upload-inline {
    max-width: none;
    margin-bottom: 18px;
    padding: 12px 14px;
}

.section-file-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.section-file-item {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px 14px;
    background: #fbfdff;
}

.section-file-item__name {
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--text);
    word-break: break-all;
}

.section-file-item__meta {
    margin-top: 4px;
    color: var(--text-soft);
    font-size: 0.82rem;
}

@media (max-width: 880px) {
    .section-admin-grid {
        grid-template-columns: 1fr;
    }
}

/* ---------- Объявления ---------- */

.form-select {
    width: 100%;
    padding: 11px 13px;
    margin-top: 6px;
    border: 1px solid #d5e0ea;
    border-radius: 3px;
    font-size: 0.95rem;
    background: #f5f8fb;
    color: var(--text);
    font-family: inherit;
}

.form-select:focus {
    outline: none;
    border-color: var(--accent);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.18);
}

.notice-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.notice-item {
    background: var(--card);
    border: 1px solid var(--line);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius);
    padding: 16px 20px;
    box-shadow: var(--shadow-sm);
}

.notice-item__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.notice-item__target {
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--primary);
}

.notice-item__date {
    color: var(--text-soft);
    font-size: 0.82rem;
}

.notice-item__title {
    font-weight: 700;
    font-size: 1.02rem;
    margin-bottom: 4px;
    color: var(--ink);
}

.notice-item__content {
    white-space: pre-line;
    color: var(--text);
    font-size: 0.95rem;
    line-height: 1.6;
}

.notice-item__content:not(:last-child) {
    margin-bottom: 8px;
}

.notice-item form {
    margin-top: 10px;
}

/* ---------- Footer (как на nrcii.ru) ---------- */

.footer {
    margin-top: 40px;
    background: var(--panel-bg);
    color: #bcd8e8;
    font-size: 0.88rem;
}

.footer-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
    .hero {
        padding: 32px 20px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .hero h1 {
        font-size: 1.5rem;
    }

    .auth-card {
        padding: 28px 22px;
        margin: 32px auto;
    }

    .nav-inner,
    .head_line-inner,
    .footer-inner {
        padding: 0 16px;
    }

    .container {
        padding: 20px 14px;
    }

    .brand {
        padding: 14px 0;
    }
}
