:root {
    --bg: #f4f6f1;
    --surface: rgba(255, 255, 255, 0.88);
    --surface-strong: #ffffff;
    --surface-soft: rgba(255, 255, 255, 0.68);
    --border: rgba(24, 41, 34, 0.11);
    --text: #173126;
    --muted: #617267;
    --primary: #0f766e;
    --primary-dark: #115e59;
    --primary-soft: #d6f4ef;
    --warning: #b45309;
    --warning-soft: #fff1dd;
    --danger: #c2410c;
    --danger-soft: #ffe7dc;
    --valid-soft: #dcfce7;
    --passive-soft: #eef2f0;
    --shadow: 0 18px 45px rgba(23, 49, 38, 0.08);
    --radius: 24px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(15, 118, 110, 0.16), transparent 28%),
        radial-gradient(circle at bottom right, rgba(217, 119, 6, 0.12), transparent 24%),
        linear-gradient(180deg, #fbfcf8 0%, var(--bg) 100%);
}

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

button,
input,
select,
textarea {
    font: inherit;
}

img {
    max-width: 100%;
}

.login-shell,
.app-shell {
    min-height: 100vh;
}

.login-shell {
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-card {
    width: min(1040px, 100%);
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    background: var(--surface);
    border-radius: 32px;
    border: 1px solid rgba(255, 255, 255, 0.72);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.login-side {
    padding: 44px;
    background: linear-gradient(145deg, rgba(17, 24, 39, 0.94), rgba(15, 118, 110, 0.92));
    color: #eef7f3;
}

.login-form-side {
    padding: 44px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand > div {
    min-width: 0;
}

.brand-title {
    margin: 0;
    font-size: 24px;
    line-height: 1.05;
    letter-spacing: -0.02em;
}

.brand-mark {
    width: 56px;
    height: 56px;
    display: grid;
    place-items: center;
    border-radius: 18px;
    background: linear-gradient(135deg, #14b8a6, #f59e0b);
    color: #ffffff;
    font-weight: 800;
    font-size: 20px;
}

.eyebrow {
    margin: 0 0 6px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 12px;
    opacity: 0.72;
}

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

.login-highlights {
    margin-top: 36px;
    display: grid;
    gap: 18px;
}

.highlight-card,
.stat-card,
.panel,
.hero-panel,
.sidebar-note,
.request-card,
.user-card,
.history-item {
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.72);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
    border-radius: var(--radius);
}

.highlight-card {
    padding: 20px;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.1);
}

.form-grid,
.filters,
.stats-grid,
.two-column,
.cards-grid,
.stack-grid {
    display: grid;
    gap: 16px;
}

.form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid .full,
.full {
    grid-column: 1 / -1;
}

label {
    display: grid;
    gap: 8px;
    font-size: 14px;
    color: var(--muted);
}

input,
select,
textarea {
    width: 100%;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.96);
    color: var(--text);
}

textarea {
    resize: vertical;
}

.primary-btn,
.ghost-btn,
.danger-btn,
.menu-toggle {
    border: 0;
    border-radius: 14px;
    padding: 12px 16px;
    cursor: pointer;
    transition: 0.2s ease;
}

.primary-btn {
    background: linear-gradient(135deg, var(--primary), #0ea5a1);
    color: #ffffff;
    box-shadow: 0 10px 30px rgba(15, 118, 110, 0.24);
}

.ghost-btn {
    background: var(--surface-strong);
    color: var(--text);
    border: 1px solid var(--border);
}

.danger-btn {
    background: linear-gradient(135deg, #ea580c, #dc2626);
    color: #ffffff;
}

.primary-btn:hover,
.ghost-btn:hover,
.danger-btn:hover {
    transform: translateY(-1px);
}

.app-shell {
    display: grid;
    grid-template-columns: 300px 1fr;
}

.sidebar {
    padding: 28px;
    background: rgba(17, 24, 39, 0.94);
    color: #eef7f3;
    display: flex;
    flex-direction: column;
    gap: 24px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.nav {
    display: grid;
    gap: 10px;
}

.nav-link {
    display: block;
    padding: 14px 16px;
    border-radius: 16px;
    color: #d9e6df;
}

.nav-link-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.nav-badge {
    min-width: 24px;
    height: 24px;
    padding: 0 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: linear-gradient(135deg, #f97316, #dc2626);
    color: #ffffff;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    box-shadow: 0 8px 18px rgba(220, 38, 38, 0.26);
}

.nav-link.active,
.nav-link:hover {
    background: rgba(255, 255, 255, 0.09);
    color: #ffffff;
}

.sidebar-note {
    margin-top: auto;
    padding: 18px;
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
}

.sidebar-note strong,
.sidebar-note span {
    display: block;
}

.sidebar-note span {
    margin-top: 6px;
    color: #bdd3c8;
}

.main {
    padding: 28px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.menu-toggle {
    display: none;
    background: var(--surface-strong);
    box-shadow: var(--shadow);
}

.hero-panel {
    padding: 28px;
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 20px;
    margin-bottom: 18px;
}

.hero-grid {
    display: grid;
    gap: 16px;
}

.hero-chip {
    padding: 20px;
    border-radius: 22px;
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.12), rgba(15, 118, 110, 0.02));
    border: 1px solid rgba(15, 118, 110, 0.14);
}

.hero-chip.warning {
    background: linear-gradient(135deg, rgba(217, 119, 6, 0.14), rgba(217, 119, 6, 0.03));
    border-color: rgba(217, 119, 6, 0.14);
}

.stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 18px;
}

.stat-card {
    padding: 22px;
}

.stat-card strong {
    display: block;
    font-size: 32px;
    margin-top: 8px;
}

.stat-card.warning {
    background: linear-gradient(135deg, rgba(255, 241, 221, 0.92), rgba(255, 255, 255, 0.8));
}

.stat-card.danger {
    background: linear-gradient(135deg, rgba(255, 231, 220, 0.92), rgba(255, 255, 255, 0.8));
}

.panel {
    padding: 24px;
    margin-bottom: 18px;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filters {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    text-align: left;
    padding: 16px 14px;
    border-bottom: 1px solid rgba(23, 49, 38, 0.08);
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 13px;
}

.card-actions,
.inline-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

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

.table-actions form {
    margin: 0;
}

.table-actions .ghost-btn,
.table-actions .danger-btn,
.table-actions .primary-btn {
    padding: 9px 12px;
    white-space: nowrap;
    font-size: 13px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
}

.status-badge.valid {
    background: var(--valid-soft);
    color: #166534;
}

.status-badge.warning {
    background: var(--warning-soft);
    color: #9a4d00;
}

.status-badge.missing {
    background: #fff4d9;
    color: #9a4d00;
}

.status-badge.expired {
    background: var(--danger-soft);
    color: #9a3412;
}

.status-badge.passive,
.status-badge.pending {
    background: var(--passive-soft);
    color: #52625a;
}

.status-badge.info {
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.two-column {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.user-card,
.request-card,
.history-item {
    padding: 18px;
    background: var(--surface-soft);
    border: 1px solid rgba(23, 49, 38, 0.08);
}

.request-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

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

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

.checkbox-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(23, 49, 38, 0.08);
    color: var(--text);
}

.checkbox-item input {
    width: auto;
    margin: 0;
}

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

.permission-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 14px 0 16px;
}

.permission-pill {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 700;
}

.muted-pill {
    background: var(--passive-soft);
    color: #52625a;
}

.permission-note {
    display: block;
    margin-top: 10px;
}

.compact-submit {
    width: fit-content;
    min-width: 180px;
    justify-self: start;
}

.alert {
    padding: 14px 16px;
    border-radius: 16px;
    margin-bottom: 16px;
}

.alert.success {
    background: var(--valid-soft);
    color: #166534;
}

.alert.error {
    background: var(--danger-soft);
    color: #9a3412;
}

.alert.info {
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.empty-state {
    padding: 24px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.66);
    border: 1px dashed rgba(23, 49, 38, 0.14);
    color: var(--muted);
}

.help-list {
    margin: 16px 0 0;
    padding-left: 18px;
    color: var(--muted);
}

.metric {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(23, 49, 38, 0.08);
}

.metric:last-child {
    border-bottom: 0;
}

.document-preview {
    border-radius: 22px;
    overflow: hidden;
    border: 1px solid rgba(23, 49, 38, 0.08);
    background: rgba(255, 255, 255, 0.8);
}

.preview-frame {
    width: 100%;
    min-height: 540px;
    border: 0;
    background: #ffffff;
}

.preview-image {
    display: block;
    width: 100%;
    max-height: 720px;
    object-fit: contain;
    background: #ffffff;
}

.pagination {
    margin-top: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.pagination-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: var(--muted);
}

.file-link {
    color: var(--primary-dark);
    font-weight: 600;
}

@media (max-width: 1180px) {
    .stats-grid,
    .filters,
    .two-column,
    .cards-grid,
    .form-grid,
    .checkbox-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hero-panel,
    .login-card {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 920px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        left: -100%;
        width: 280px;
        z-index: 20;
        transition: left 0.25s ease;
    }

    .sidebar.open {
        left: 0;
    }

    .menu-toggle {
        display: inline-grid;
        place-items: center;
    }

    .main {
        padding: 18px;
    }

    .stats-grid,
    .filters,
    .two-column,
    .cards-grid,
    .form-grid,
    .checkbox-list {
        grid-template-columns: 1fr;
    }

    .login-side,
    .login-form-side {
        padding: 28px;
    }
}
