:root {
    --bg: #f4f7fb;
    --surface: #ffffff;
    --surface-2: #f9fbfd;
    --text: #172230;
    --muted: #667085;
    --line: #dde5ef;
    --brand: #0f4c81;
    --brand-2: #153a5b;
    --brand-soft: #e9f1fa;
    --success-bg: #e7f7eb;
    --success-text: #166534;
    --danger-bg: #fdecec;
    --danger-text: #991b1b;
    --shadow: 0 12px 36px rgba(15, 23, 42, 0.08);
    --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: linear-gradient(180deg, #f8fbff 0%, #f4f7fb 260px, #f4f7fb 100%);
    color: var(--text);
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: none; }

.container {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(14px);
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid rgba(221, 229, 239, 0.95);
}

.nav {
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.brand {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--brand-2);
    letter-spacing: 0.01em;
}

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

.main-nav a {
    color: var(--text);
    padding: 10px 14px;
    border-radius: 999px;
    font-weight: 600;
}

.main-nav a.active,
.main-nav a:hover {
    background: var(--brand-soft);
    color: var(--brand-2);
}

.hero {
    padding: 72px 0 44px;
}

.hero .container {
    background: radial-gradient(circle at top right, rgba(15, 76, 129, 0.09), transparent 32%), var(--surface);
    border: 1px solid var(--line);
    border-radius: 28px;
    padding: 48px;
    box-shadow: var(--shadow);
}

.section { padding: 34px 0 52px; }
.page { min-height: calc(100vh - 160px); }

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.grid-docs,
.admin-grid,
.filters {
    display: grid;
    gap: 18px;
}

.grid-docs { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.admin-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-bottom: 24px; }
.filters { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); align-items: end; }

.doc,
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.doc h3,
.card h3,
h1,
h2 { margin-top: 0; }

.doc h3 { min-height: 56px; }

.tag,
.eyebrow {
    display: inline-block;
    background: var(--brand-soft);
    color: var(--brand-2);
    padding: 7px 11px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.eyebrow { margin-bottom: 8px; }

.meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 16px 0 18px;
    font-size: 14px;
}

.meta > div {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    background: var(--brand);
    color: #fff;
    padding: 0 16px;
    border-radius: 12px;
    border: 1px solid var(--brand);
    cursor: pointer;
    font-weight: 700;
}

.btn:hover { filter: brightness(0.98); }

.btn-outline {
    background: #fff;
    color: var(--brand);
    border-color: var(--line);
}

.input,
textarea,
select {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid #cfd8e3;
    background: #fff;
    margin-top: 6px;
    font: inherit;
}

textarea { min-height: 120px; resize: vertical; }
label { font-weight: 700; font-size: 14px; }

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}

.table th,
.table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.table th {
    background: var(--surface-2);
    font-size: 14px;
}

.footer {
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.85);
    margin-top: 24px;
}

.footer-inner {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

.flash-wrap { margin-top: 16px; }
.flash {
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid transparent;
}
.flash.success { background: var(--success-bg); color: var(--success-text); border-color: #b7e4c0; }
.flash.error { background: var(--danger-bg); color: var(--danger-text); border-color: #f2c7c7; }

.muted { color: var(--muted); }
.small { max-width: 560px; }

.pagination {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 22px;
}

.pagination a {
    min-width: 42px;
    text-align: center;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #fff;
}

.pagination a.active {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.admin-topbar {
    padding: 28px 0 0;
}

.admin-topbar__inner {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 18px;
    flex-wrap: wrap;
}

.admin-title {
    margin: 0;
    font-size: 2rem;
}

.admin-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.admin-shell {
    padding-top: 24px;
    padding-bottom: 24px;
}

@media (max-width: 768px) {
    .nav,
    .section-head,
    .admin-topbar__inner,
    .footer-inner {
        align-items: flex-start;
        flex-direction: column;
    }

    .hero .container { padding: 28px; }
    .filters { grid-template-columns: 1fr; }
    .meta { grid-template-columns: 1fr; }
    .table { display: block; overflow-x: auto; }
}


body { line-height: 1.45; }

.admin-grid > a.card,
.grid-docs > a.card,
a.card {
    display: block;
    color: var(--text);
}

.admin-grid > a.card {
    min-height: 150px;
}

.admin-grid > a.card h3,
.admin-grid > a.card p {
    margin: 0 0 10px;
}

.card + .card,
.card + table,
table + .card {
    margin-top: 18px;
}

.table {
    display: table;
}

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

.card form .filters {
    margin-top: 8px;
}

@media (max-width: 768px) {
    .admin-grid > a.card {
        min-height: auto;
    }
}
