
:root {
    --bg: #f5f7fa;
    --panel: #ffffff;
    --text: #172033;
    --muted: #6b7280;
    --line: #e3e8ef;
    --dark: #0f1724;
    --dark-2: #1e293b;
    --accent: #111827;
    --danger: #b91c1c;
    --success: #166534;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--bg);
}

a { color: inherit; }

.topbar {
    background: linear-gradient(90deg, var(--dark), var(--dark-2));
    color: white;
    min-height: 70px;
    padding: 0 34px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 22px;
    font-weight: 750;
}

.brand-mark {
    width: 38px;
    height: 38px;
    border: 1px solid rgba(255,255,255,.35);
    border-radius: 8px;
    display: grid;
    place-items: center;
    font-weight: 800;
}

.topbar nav {
    display: flex;
    gap: 24px;
}

.topbar nav a {
    text-decoration: none;
    opacity: .92;
}

.container {
    width: min(1450px, calc(100% - 64px));
    margin: 0 auto;
    padding: 42px 0 60px;
}

.hero { margin-bottom: 26px; }
.hero.compact { margin-bottom: 18px; }

.hero h1 {
    margin: 0 0 8px;
    font-size: clamp(28px, 3vw, 42px);
    line-height: 1.12;
}

.hero p {
    margin: 0;
    color: var(--muted);
    font-size: 17px;
}

.filter-card,
.panel,
.table-card,
.info-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 8px 28px rgba(15, 23, 42, .04);
}

.filter-card {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
    padding: 22px;
    margin-bottom: 30px;
}

.field { min-width: 0; }

label {
    display: block;
    font-weight: 650;
    margin-bottom: 7px;
}

input, select, textarea {
    width: 100%;
    border: 1px solid #cfd6df;
    background: white;
    border-radius: 8px;
    padding: 11px 12px;
    font: inherit;
    color: var(--text);
}

textarea { resize: vertical; }

input:focus, select:focus, textarea:focus {
    outline: 2px solid rgba(17,24,39,.12);
    border-color: #8b96a6;
}

.search-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
}

.btn {
    appearance: none;
    border: 0;
    border-radius: 8px;
    padding: 10px 15px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

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

.btn.secondary {
    background: #eef1f5;
    color: #1f2937;
}

.btn.wide { width: 100%; margin-top: 14px; }

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

.section-heading h2 {
    margin: 0;
    font-size: 20px;
}

.section-heading span {
    color: var(--muted);
}

.table-card, .panel {
    overflow: hidden;
}

.table-wrap { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 900px;
}

th {
    text-align: left;
    font-size: 13px;
    color: #687386;
    background: #fafbfc;
}

th, td {
    padding: 15px 18px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

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

.doc-title {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 260px;
}

.doc-title strong { display: block; }
.doc-title small {
    display: block;
    color: var(--muted);
    margin-top: 3px;
}

.pdf-icon {
    flex: 0 0 auto;
    width: 38px;
    height: 44px;
    background: #dc2626;
    color: white;
    display: grid;
    place-items: center;
    border-radius: 5px;
    font-size: 10px;
    font-weight: 800;
}

.action-cell { text-align: right; }

.empty-state {
    min-height: 180px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 6px;
    text-align: center;
    color: var(--muted);
}

.empty-state strong {
    color: var(--text);
    font-size: 18px;
}

.info-grid, .admin-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    margin-top: 22px;
}

.info-card, .panel {
    padding: 22px;
}

.info-card h3, .panel h2 {
    margin-top: 0;
}

.info-card p {
    color: var(--muted);
    margin-bottom: 0;
}

footer {
    padding: 26px;
    text-align: center;
    color: var(--muted);
}

.alert {
    padding: 13px 15px;
    border-radius: 9px;
    margin: 12px 0 20px;
    border: 1px solid;
}

.alert.success {
    color: var(--success);
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.alert.error {
    color: var(--danger);
    background: #fef2f2;
    border-color: #fecaca;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.document-form {
    margin-top: 22px;
}

.document-form > label,
.document-form > input,
.document-form > textarea {
    margin-top: 12px;
}

.help {
    display: block;
    color: var(--muted);
    margin-top: 6px;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 16px 0 !important;
    font-weight: 600;
}

.checkbox-row input {
    width: auto;
}

.status {
    display: inline-block;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 750;
}

.status.released {
    background: #dcfce7;
    color: #166534;
}

.status.private {
    background: #f3f4f6;
    color: #4b5563;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-card {
    width: min(430px, 100%);
    background: white;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 30px;
    box-shadow: 0 18px 60px rgba(15,23,42,.10);
}

.login-card .brand-mark {
    background: var(--dark);
    color: white;
    margin-bottom: 18px;
}

.login-card h1 { margin-bottom: 8px; }
.muted { color: var(--muted); }

code {
    background: #f2f4f7;
    padding: 2px 5px;
    border-radius: 5px;
}

@media (max-width: 1000px) {
    .filter-card, .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .admin-grid { grid-template-columns: 1fr; }
}

@media (max-width: 650px) {
    .container { width: min(100% - 28px, 1450px); padding-top: 26px; }
    .topbar { padding: 0 16px; align-items: flex-start; flex-direction: column; padding-top: 14px; padding-bottom: 14px; }
    .filter-card, .form-grid { grid-template-columns: 1fr; }
    .info-grid { grid-template-columns: 1fr; }
}
