:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #dbe3ee;
    --primary: #1d4ed8;
    --primary-dark: #163ea8;
    --danger-bg: #fee2e2;
    --danger-text: #991b1b;
    --success-bg: #dcfce7;
    --success-text: #166534;
    --light-bg: #eef2ff;
    --shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
    --radius: 16px;
}

* {
    box-sizing: border-box;
}

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

a {
    color: inherit;
    text-decoration: none;
}

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

.topbar {
    background: #0f172a;
    color: #fff;
    box-shadow: var(--shadow);
}

.topbar-inner {
    min-height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand a {
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
}

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

.nav a {
    color: #e2e8f0;
}

.nav-user {
    color: #cbd5e1;
    font-size: 0.95rem;
}

main.container {
    padding: 28px 0 48px;
}

.auth-wrap {
    min-height: calc(100vh - 140px);
    display: grid;
    place-items: center;
}

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

.auth-card {
    width: min(460px, 100%);
}

h1, h2 {
    margin-top: 0;
}

.muted {
    color: var(--muted);
}

.form-group {
    margin-bottom: 16px;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 1rem;
    background: #fff;
    font-family: inherit;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 12px;
    padding: 11px 16px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: 0.2s ease;
}

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

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

.btn-outline {
    background: transparent;
    color: #fff;
    border: 1px solid rgba(255,255,255,0.25);
}

.btn-light {
    background: var(--light-bg);
    color: #1e3a8a;
}

.btn-outline-dark {
    background: transparent;
    color: #111827;
    border: 1px solid #cbd5e1;
}

.btn-sm {
    padding: 8px 12px;
    font-size: 0.9rem;
}

.btn-block {
    width: 100%;
}

.alert {
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 16px;
    font-size: 0.95rem;
}

.alert-danger {
    background: var(--danger-bg);
    color: var(--danger-text);
}

.alert-success {
    background: var(--success-bg);
    color: var(--success-text);
}

.page-header {
    margin-bottom: 20px;
}

.page-header-flex {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
}

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

.stat-card {
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.stat-label {
    color: var(--muted);
    font-weight: 600;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
}

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

.separator {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 24px 0;
}

.actions {
    margin-top: 20px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.table-card {
    overflow: hidden;
    padding: 0;
}

.table-wrap {
    overflow-x: auto;
    padding: 10px 18px;
}

.table {
    width: 100%;
    min-width: 1100px;
    border-collapse: separate;
    border-spacing: 0;
}

.table thead th {
    background: #f8fafc;
    font-size: 0.95rem;
    font-weight: 700;
    color: #334155;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}

.table th,
.table td {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
    line-height: 1.45;
}

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

.table tbody tr:hover td {
    background: #fafcff;
}

.table td strong {
    font-weight: 800;
}

.table th:first-child,
.table td:first-child {
    padding-left: 24px;
}

.table th:last-child,
.table td:last-child {
    padding-right: 24px;
}

.table td:nth-child(1) {
    min-width: 190px;
    white-space: nowrap;
}

.table td:nth-child(2) {
    min-width: 260px;
}

.table td:nth-child(3) {
    min-width: 120px;
    white-space: nowrap;
}

.table td:nth-child(4) {
    min-width: 100px;
    white-space: nowrap;
}

.table td:nth-child(5) {
    min-width: 180px;
}

.table td:nth-child(6) {
    min-width: 130px;
    white-space: nowrap;
}

.table td:nth-child(7) {
    min-width: 140px;
    white-space: nowrap;
}

.table td:nth-child(8) {
    min-width: 90px;
    white-space: nowrap;
}

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 0.82rem;
    font-weight: 700;
}

.badge-approved {
    background: #dcfce7;
    color: #166534;
}

.badge-draft {
    background: #fef3c7;
    color: #92400e;
}

.badge-review {
    background: #dbeafe;
    color: #1d4ed8;
}

.badge-obsolete {
    background: #e5e7eb;
    color: #374151;
}

.badge-current {
    background: #ede9fe;
    color: #6d28d9;
}

.badge-default {
    background: #e5e7eb;
    color: #374151;
}

.meta-list {
    display: grid;
    gap: 12px;
}

.versions-list {
    display: grid;
    gap: 14px;
}

.version-item {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
}

.version-head {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.version-body {
    display: grid;
    gap: 8px;
}

@media (max-width: 900px) {
    .stats-grid,
    .grid-2 {
        grid-template-columns: 1fr;
    }

    .container {
        width: min(100%, calc(100% - 28px));
    }

    .table-wrap {
        padding: 8px 10px;
    }

    .table th,
    .table td {
        padding: 16px 14px;
    }

    .table th:first-child,
    .table td:first-child {
        padding-left: 16px;
    }

    .table th:last-child,
    .table td:last-child {
        padding-right: 16px;
    }
}

@media (max-width: 640px) {
    .topbar-inner {
        flex-direction: column;
        justify-content: center;
        padding: 12px 0;
    }

    .nav {
        justify-content: center;
    }

    .page-header-flex {
        flex-direction: column;
    }
}
.version-files {
    margin-top: 6px;
}

.file-list {
    margin: 8px 0 0;
    padding-left: 18px;
    display: grid;
    gap: 8px;
}

.file-list li {
    line-height: 1.45;
}

.file-role {
    font-weight: 700;
}