/* =====================================================================
   Елогорская Республика — официальный портал НПА
   Стиль конца 2000-х / начала 2010-х: Aero, градиенты, глянец.
   ===================================================================== */

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

body {
    font-family: "Segoe UI", Tahoma, "Trebuchet MS", Verdana, Geneva, sans-serif;
    font-size: 13px;
    color: #1c2434;
    line-height: 1.5;
    background: #c7d8ee;
    min-height: 100vh;
}

.page-bg {
    position: fixed; inset: 0; z-index: -1;
    background:
        radial-gradient(circle at 20% -10%, rgba(255,255,255,0.85), transparent 45%),
        radial-gradient(circle at 100% 0%, rgba(120,170,230,0.4), transparent 50%),
        linear-gradient(180deg, #e9f1fb 0%, #c0d4ee 45%, #9bb8db 100%);
}

.wrap {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 18px;
}

a { color: #1d4f8b; text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 24px; margin: 0 0 14px; color: #142747; text-shadow: 0 1px 0 #fff; }
h2 { font-size: 18px; margin: 0 0 12px; color: #1a2c4d; text-shadow: 0 1px 0 #fff; }
.muted { color: #5a6b85; }
.small { font-size: 11.5px; }
.strong { font-weight: 600; }
.m0 { margin: 0; padding-left: 18px; }

/* ----- HEADER (флаг + герб) ----- */
.site-header {
    background:
        linear-gradient(180deg, #265a9c 0%, #1a4583 48%, #143b73 49%, #112e5a 100%);
    color: #f4f8ff;
    border-bottom: 1px solid #0a1d3c;
    box-shadow: 0 2px 0 rgba(255,255,255,0.4) inset, 0 4px 8px rgba(0,0,0,0.18);
}
.site-header .wrap {
    display: flex; align-items: center; justify-content: space-between;
    padding-top: 14px; padding-bottom: 14px; gap: 18px;
}
.brand { display: flex; align-items: center; gap: 14px; color: #fff; }
.brand:hover { text-decoration: none; }
.emblem {
    display: inline-block; padding: 3px;
    background: linear-gradient(180deg, #fff 0%, #d3e3fa 50%, #94b3e0 100%);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.35), 0 0 0 1px #1a4583 inset;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-line1 {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 20px; font-weight: 700;
    text-shadow: 0 1px 1px rgba(0,0,0,0.55), 0 -1px 0 rgba(255,255,255,0.15);
    letter-spacing: 0.2px;
}
.brand-line2 { font-size: 12px; color: #c2d6f5; margin-top: 3px; }

.topnav { display: flex; gap: 6px; align-items: center; }
.topnav-item {
    padding: 7px 14px;
    color: #eaf1fc; font-weight: 600; font-size: 12.5px;
    border-radius: 6px;
    border: 1px solid transparent;
    text-shadow: 0 1px 1px rgba(0,0,0,0.4);
}
.topnav-item:hover {
    background: linear-gradient(180deg, rgba(255,255,255,0.25) 0%, rgba(255,255,255,0.05) 50%, rgba(255,255,255,0.0) 100%);
    border-color: rgba(255,255,255,0.35);
    text-decoration: none;
}
.topnav-item.active {
    background: linear-gradient(180deg, #f4f8ff 0%, #c8dcf5 100%);
    color: #143b73;
    border-color: #0a1d3c;
    text-shadow: 0 1px 0 #fff;
    box-shadow: 0 1px 0 rgba(255,255,255,0.7) inset, 0 -1px 0 rgba(0,0,0,0.05) inset;
}

/* ----- РЕБРО ПОД ШАПКОЙ ----- */
.ribbon {
    background:
        linear-gradient(180deg, #fdca47 0%, #e9a514 50%, #c98605 100%);
    color: #3d2a06;
    border-top: 1px solid #ffe9a4;
    border-bottom: 1px solid #6e4a03;
    text-shadow: 0 1px 0 rgba(255,255,255,0.45);
    font-size: 12px;
}
.ribbon .wrap {
    display: flex; gap: 14px; align-items: center;
    padding-top: 6px; padding-bottom: 6px;
}
.ribbon .dot { color: #6e4a03; opacity: 0.6; }

/* ----- MAIN ----- */
.site-main { padding: 22px 0 60px; }

/* ----- GLOSSY (общая «стеклянная» панель) ----- */
.glossy {
    background:
        linear-gradient(180deg, rgba(255,255,255,0.95) 0%, rgba(245,250,255,0.9) 50%, rgba(220,232,247,0.92) 100%);
    border: 1px solid #87a4cb;
    border-radius: 8px;
    box-shadow:
        0 1px 0 rgba(255,255,255,0.95) inset,
        0 0 0 1px rgba(255,255,255,0.4) inset,
        0 2px 4px rgba(20,40,80,0.08),
        0 6px 18px rgba(20,40,80,0.10);
    padding: 18px 20px;
}
.glossy + .glossy { margin-top: 18px; }

/* ----- HERO ----- */
.hero { padding: 22px 26px; margin-bottom: 18px; }
.hero h1 { font-size: 26px; }
.hero p { margin: 0; color: #2c3a55; max-width: 920px; }

/* ----- ПОИСК ----- */
.search-card { margin-bottom: 18px; }
.search-form .form-row {
    display: grid; grid-template-columns: 2fr 1fr; gap: 14px;
    margin-bottom: 12px;
}
.search-form .form-row + .form-row {
    grid-template-columns: 1fr 1fr 1fr auto;
}
.search-form .form-row:last-child { margin-bottom: 0; }

.form-cell { display: flex; flex-direction: column; gap: 5px; }
.form-cell.grow { flex: 1; }
.form-cell.actions { flex-direction: row; align-items: end; gap: 8px; }
label { font-weight: 600; font-size: 12px; color: #2a3c5e; }
input[type="text"], input[type="password"], input[type="date"], select, textarea {
    font: 13px/1.4 "Segoe UI", Tahoma, sans-serif;
    color: #1c2434;
    background: linear-gradient(180deg, #f5f9ff 0%, #ffffff 100%);
    border: 1px solid #8ba9d0;
    border-top-color: #6f8ab0;
    border-radius: 4px;
    padding: 6px 9px;
    box-shadow: 0 1px 1px rgba(255,255,255,0.9) inset, 0 1px 0 rgba(0,0,0,0.02);
    outline: none;
}
input:focus, select:focus, textarea:focus {
    border-color: #2e6cb6;
    box-shadow:
        0 0 0 2px rgba(76,140,210,0.35),
        0 1px 1px rgba(255,255,255,0.9) inset;
}
textarea { resize: vertical; min-height: 90px; font-family: inherit; }
input[type="file"] {
    background: linear-gradient(180deg, #f5f9ff 0%, #e6eef9 100%);
    padding: 4px;
    border: 1px solid #8ba9d0;
    border-radius: 4px;
}

/* ----- AERO BUTTONS ----- */
.btn {
    display: inline-block;
    font: 600 12.5px/1 "Segoe UI", Tahoma, sans-serif;
    color: #1c2434;
    text-shadow: 0 1px 0 #fff;
    border-radius: 5px;
    padding: 7px 14px;
    cursor: pointer;
    user-select: none;
    border: 1px solid #6f8ab0;
    text-decoration: none;
    transition: filter 0.12s, box-shadow 0.12s;
}
.btn.big { padding: 10px 22px; font-size: 13.5px; }
.btn.small { padding: 4px 9px; font-size: 11.5px; border-radius: 4px; }
.btn.aero {
    position: relative;
    background:
        linear-gradient(180deg, #ffffff 0%, #e3edfa 49%, #c2d4ee 50%, #d8e6f7 100%);
    box-shadow:
        0 1px 0 rgba(255,255,255,0.95) inset,
        0 -1px 0 rgba(0,0,0,0.04) inset,
        0 1px 2px rgba(0,0,0,0.10);
}
.btn.aero:hover { filter: brightness(1.04); text-decoration: none; }
.btn.aero:active {
    background: linear-gradient(180deg, #c2d4ee 0%, #d8e6f7 50%, #e3edfa 100%);
    box-shadow:
        0 1px 1px rgba(0,0,0,0.15) inset,
        0 1px 0 rgba(255,255,255,0.4);
}
.btn.aero.btn-primary {
    color: #fff;
    text-shadow: 0 -1px 0 rgba(0,0,0,0.35);
    border-color: #0d2a55;
    background:
        linear-gradient(180deg, #4d8ed4 0%, #2e6cb6 49%, #1a4f97 50%, #2e6cb6 100%);
    box-shadow:
        0 1px 0 rgba(255,255,255,0.4) inset,
        0 -1px 0 rgba(0,0,0,0.25) inset,
        0 1px 2px rgba(0,0,0,0.18);
}
.btn.aero.btn-primary:hover { filter: brightness(1.07); }
.btn.aero.btn-danger {
    color: #fff;
    text-shadow: 0 -1px 0 rgba(0,0,0,0.35);
    border-color: #6e1010;
    background:
        linear-gradient(180deg, #d97676 0%, #b53a3a 49%, #8a1a1a 50%, #b53a3a 100%);
    box-shadow:
        0 1px 0 rgba(255,255,255,0.35) inset,
        0 -1px 0 rgba(0,0,0,0.25) inset,
        0 1px 2px rgba(0,0,0,0.18);
}

/* ----- FLASH ----- */
.flash {
    border-radius: 6px; padding: 10px 14px; margin: 0 0 16px;
    border: 1px solid #b8b8b8;
    background: linear-gradient(180deg, #fff8d6 0%, #fdebac 100%);
    color: #5e4a09; font-weight: 600;
    text-shadow: 0 1px 0 rgba(255,255,255,0.6);
}
.flash-success {
    border-color: #5b8c2b;
    background: linear-gradient(180deg, #e3f6c8 0%, #c2e58c 100%);
    color: #2e4d12;
}
.flash-error {
    border-color: #8a1a1a;
    background: linear-gradient(180deg, #ffd3d3 0%, #f7a4a4 100%);
    color: #5a0d0d;
}

/* ----- ЛЕНТА АКТОВ ----- */
.acts { margin-top: 18px; }
.acts-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 12px; padding: 0 4px;
}
.results-count { color: #2a3c5e; font-size: 12.5px; }

.act-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.act-item { padding: 0; }
.act-link {
    display: flex; align-items: stretch; gap: 14px;
    padding: 14px 16px;
    color: inherit;
}
.act-link:hover { text-decoration: none; }
.act-item:hover { box-shadow:
    0 1px 0 rgba(255,255,255,0.95) inset,
    0 0 0 1px rgba(255,255,255,0.4) inset,
    0 2px 6px rgba(20,40,80,0.14),
    0 8px 22px rgba(20,40,80,0.18); }

.act-icon {
    flex: 0 0 auto;
    width: 56px; height: 64px;
    display: flex; align-items: center; justify-content: center;
    font: 700 12px/1 "Segoe UI", Tahoma, sans-serif;
    color: #fff; text-shadow: 0 1px 1px rgba(0,0,0,0.4);
    border-radius: 6px;
    border: 1px solid #4a4a4a;
    background:
        linear-gradient(180deg, #6f7d92 0%, #455369 100%);
    box-shadow: 0 1px 0 rgba(255,255,255,0.3) inset, 0 1px 2px rgba(0,0,0,0.2);
    position: relative;
}
.act-icon.ext-pdf { background: linear-gradient(180deg, #e96565 0%, #b22222 100%); border-color: #6c0d0d; }
.act-icon.ext-docx, .act-icon.ext-doc { background: linear-gradient(180deg, #5c93dc 0%, #1f5aa8 100%); border-color: #0a2f5e; }
.act-icon.ext-txt { background: linear-gradient(180deg, #8d9aaf 0%, #4f5d75 100%); border-color: #2c3447; }
.act-icon.ext-rtf { background: linear-gradient(180deg, #7fb35e 0%, #3f6b22 100%); border-color: #244312; }

.act-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.act-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 11.5px; }
.act-title { font-size: 15px; font-weight: 600; color: #112e5a; }
.act-desc { color: #324464; font-size: 12.5px; }
.act-side {
    flex: 0 0 auto;
    display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between;
    color: #2a3c5e; font-size: 11.5px;
}
.act-side .open { color: #1d4f8b; font-weight: 600; }

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px; font-weight: 600;
    border: 1px solid #6f8ab0;
    background: linear-gradient(180deg, #ffffff 0%, #d8e6f7 100%);
    color: #143b73;
    text-shadow: 0 1px 0 #fff;
}
.badge.type.big { font-size: 12.5px; padding: 4px 12px; }

.empty {
    padding: 30px; text-align: center; color: #2a3c5e;
}
.empty-icon { font-size: 40px; opacity: 0.6; }

/* ----- СТРАНИЦА АКТА ----- */
.breadcrumbs { margin: 4px 0 14px; font-size: 12.5px; }
.act-page { padding: 24px 28px; }
.act-head { margin-bottom: 18px; }
.act-head h1 { margin-top: 10px; font-size: 22px; }
.act-attrs {
    display: flex; gap: 24px; flex-wrap: wrap; margin: 8px 0 12px;
    font-size: 12.5px; color: #324464;
}
.act-attrs .lbl { color: #5a6b85; }
.act-summary {
    background: linear-gradient(180deg, #fffbe7 0%, #fff3c2 100%);
    border: 1px solid #d8c46b;
    padding: 10px 14px; border-radius: 6px;
    color: #4a3c0c;
    text-shadow: 0 1px 0 rgba(255,255,255,0.5);
}
.act-toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

.act-viewer { margin-top: 22px; }
.viewer {
    background: #f0f3f7;
    border: 1px solid #87a4cb;
    border-radius: 6px;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.10);
    overflow: hidden;
}
.pdf-viewer { height: 80vh; min-height: 600px; }
.pdf-viewer iframe { width: 100%; height: 100%; border: 0; background: #525659; }
.txt-viewer {
    margin: 0; padding: 18px 22px;
    font: 13px/1.55 "Consolas", "Lucida Console", monospace;
    color: #1c2434;
    background: #fdfdfa;
    white-space: pre-wrap; word-break: break-word;
    max-height: 80vh; overflow: auto;
}
.docx-viewer { padding: 0; background: #d8dfe9; }
.docx-loading { padding: 40px; text-align: center; color: #324464; }
.docx-paper {
    background: #fff; max-width: 820px; margin: 24px auto; padding: 50px 60px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.18);
    color: #1c2434; line-height: 1.55;
    font-family: "Segoe UI", Tahoma, sans-serif;
}
.docx-paper p { margin: 0 0 0.6em; }
.docx-paper h1, .docx-paper h2, .docx-paper h3 { color: #112e5a; }

.fallback-viewer { padding: 30px; text-align: center; color: #324464; }

/* ----- ABOUT ----- */
.about { margin-top: 18px; padding: 22px 26px; }
.about p { margin: 6px 0; color: #2c3a55; }

/* ----- LOGIN ----- */
.login-card {
    max-width: 420px; margin: 60px auto;
    padding: 26px 30px;
}
.form-stack { display: flex; flex-direction: column; gap: 12px; }
.form-actions { display: flex; gap: 10px; margin-top: 6px; }

/* ----- ADMIN ----- */
.admin-bar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 18px; gap: 12px;
}
.admin-actions { display: flex; gap: 8px; }
.admin-card { padding: 18px 22px; }
.admin-card-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 12px;
}
.inline-form { display: inline-flex; align-items: center; gap: 8px; margin: 0; }

.acts-table {
    width: 100%; border-collapse: separate; border-spacing: 0;
    background: #fff;
    border: 1px solid #c0d2ea;
    border-radius: 6px; overflow: hidden;
    font-size: 12.5px;
}
.acts-table thead th {
    text-align: left;
    padding: 9px 12px;
    background: linear-gradient(180deg, #e9f0fb 0%, #c4d6ee 100%);
    color: #112e5a; font-weight: 600;
    border-bottom: 1px solid #87a4cb;
    text-shadow: 0 1px 0 #fff;
}
.acts-table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid #e1e9f5;
    vertical-align: middle;
}
.acts-table tbody tr:nth-child(even) td { background: #f5f9ff; }
.acts-table tbody tr:hover td { background: #e9f1fb; }
.row-actions { display: flex; gap: 4px; flex-wrap: wrap; }

.ext-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px; font-weight: 700;
    color: #fff; text-shadow: 0 1px 1px rgba(0,0,0,0.35);
    border: 1px solid rgba(0,0,0,0.25);
    background: linear-gradient(180deg, #6f7d92 0%, #455369 100%);
}
.ext-pill.ext-pdf { background: linear-gradient(180deg, #e96565 0%, #b22222 100%); }
.ext-pill.ext-docx, .ext-pill.ext-doc { background: linear-gradient(180deg, #5c93dc 0%, #1f5aa8 100%); }
.ext-pill.ext-txt { background: linear-gradient(180deg, #8d9aaf 0%, #4f5d75 100%); }
.ext-pill.ext-rtf { background: linear-gradient(180deg, #7fb35e 0%, #3f6b22 100%); }

/* ----- FOOTER ----- */
.site-footer {
    margin-top: 30px;
    background:
        linear-gradient(180deg, #1a4583 0%, #112e5a 100%);
    color: #d3dff3;
    border-top: 1px solid #0a1d3c;
    padding: 18px 0 22px;
    box-shadow: 0 -2px 0 rgba(255,255,255,0.25) inset;
    font-size: 12px;
}
.site-footer .wrap {
    display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap;
}
.site-footer strong { color: #fff; }
.site-footer .muted { color: #92a8c8; }

/* ----- ОТЗЫВЧИВОСТЬ ----- */
@media (max-width: 800px) {
    .site-header .wrap { flex-direction: column; align-items: flex-start; }
    .topnav { flex-wrap: wrap; }
    .search-form .form-row,
    .search-form .form-row + .form-row { grid-template-columns: 1fr; }
    .act-link { flex-direction: column; }
    .act-side { flex-direction: row; align-items: center; justify-content: space-between; }
    .acts-table thead { display: none; }
    .acts-table, .acts-table tbody, .acts-table tr, .acts-table td { display: block; width: 100%; }
    .acts-table tr { border-bottom: 1px solid #c0d2ea; padding: 8px 0; }
    .acts-table td { border: 0; padding: 4px 12px; }
    .row-actions { padding-top: 6px; }
}

/* ----- ПЕЧАТЬ ----- */
@media print {
    .site-header, .ribbon, .site-footer, .act-toolbar, .breadcrumbs, .topnav { display: none; }
    .page-bg { display: none; }
    body { background: #fff; }
    .glossy { box-shadow: none; border: 1px solid #999; }
}
