:root {
    --app-bg: #f6f7f9;
    --card-bg: #ffffff;
    --border: #e5e7eb;
    --text: #111827;
    --muted: #6b7280;
    --primary: #2563eb;
    --success: #16a34a;
    --warning: #f59e0b;
    --danger: #dc2626;
    --radius: 10px;
    --sidebar-width: 260px;
    --topbar-height: 64px;
}

* {
    box-sizing: border-box;
}

body {
    background: var(--app-bg);
    color: var(--text);
    font-size: 14px;
}

a {
    text-decoration: none;
}

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

.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    background: #ffffff;
    border-right: 1px solid var(--border);
    z-index: 1040;
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 18px;
    border-bottom: 1px solid var(--border);
}

.brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    letter-spacing: .5px;
}

.brand-title {
    font-weight: 700;
    line-height: 1.1;
}

.brand-subtitle {
    color: var(--muted);
    font-size: 12px;
}

.sidebar-nav {
    padding: 12px;
    overflow-y: auto;
}

.sidebar-nav .nav-link {
    color: #374151;
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 3px;
    font-weight: 500;
}

.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
    background: #eef4ff;
    color: var(--primary);
}

.app-topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--topbar-height);
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    z-index: 1030;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 22px;
}

.topbar-title {
    font-size: 18px;
    font-weight: 700;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #374151;
    font-weight: 500;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: #f3f4f6;
    color: #111827;
    font-weight: 700;
}

.icon-btn {
    border: 1px solid var(--border);
    background: #fff;
}

.app-main {
    margin-left: var(--sidebar-width);
    padding: calc(var(--topbar-height) + 24px) 24px 32px;
    min-height: 100vh;
}

.content-container {
    max-width: 1280px;
    margin: 0 auto;
}

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

.page-header h1 {
    font-size: 24px;
    margin: 0;
    font-weight: 750;
}

.page-header p {
    margin: 5px 0 0;
    color: var(--muted);
}

.app-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.narrow-card {
    max-width: 620px;
}

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

.stat-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
}

.stat-card span {
    color: var(--muted);
    display: block;
    margin-bottom: 8px;
}

.stat-card strong {
    font-size: 28px;
    line-height: 1;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.settings-card {
    display: block;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    color: var(--text);
    min-height: 108px;
}

.settings-card:hover {
    border-color: #b8c7ff;
    box-shadow: 0 8px 20px rgba(37, 99, 235, .08);
}

.settings-card strong {
    display: block;
    margin-bottom: 6px;
}

.settings-card span {
    color: var(--muted);
    font-size: 13px;
}

.detail-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-row span {
    color: var(--muted);
}

.app-alert {
    max-width: 1280px;
    margin: 0 auto 16px;
}

.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
    background: linear-gradient(180deg, #f6f7f9, #eef4ff);
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 28px;
    box-shadow: 0 20px 50px rgba(16, 24, 40, .08);
}

.login-brand {
    text-align: center;
    margin-bottom: 24px;
}

.login-brand h1 {
    font-size: 22px;
    margin: 14px 0 4px;
}

.login-brand p {
    color: var(--muted);
    margin: 0;
}

@media (max-width: 991.98px) {
    .app-sidebar {
        transform: translateX(-100%);
        transition: transform .2s ease;
    }

    .app-sidebar.open {
        transform: translateX(0);
    }

    .app-topbar {
        left: 0;
    }

    .app-main {
        margin-left: 0;
        padding-left: 14px;
        padding-right: 14px;
    }

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

@media (max-width: 575.98px) {
    .dashboard-grid,
    .settings-grid {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
    }
}


.app-table thead th {
    background: #f9fafb;
    color: #374151;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .03em;
    border-bottom: 1px solid var(--border);
}

.app-table td,
.app-table th {
    padding: 12px 14px;
}

.setting-check-card {
    min-height: 46px;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 12px 12px 36px;
    background: #fafafa;
}


.mini-detail {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    background: #fafafa;
    min-height: 68px;
}

.mini-detail span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 4px;
}

.mini-detail strong {
    display: block;
    overflow-wrap: anywhere;
}


.btn-group-sm .btn {
    white-space: nowrap;
}


.document-card-list {
    padding: 10px;
}

.document-card-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    margin-bottom: 10px;
}

.document-card-row:last-child {
    margin-bottom: 0;
}

.doc-title-line {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.doc-badge-wrap {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.doc-meta-line {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    color: var(--muted);
    font-size: 12px;
}

.document-card-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.doc-mini-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    max-width: 240px;
}

.doc-mini {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    border: 1px solid transparent;
}

.doc-mini.uploaded {
    color: #166534;
    background: #dcfce7;
    border-color: #bbf7d0;
}

.doc-mini.optional-uploaded {
    color: #075985;
    background: #e0f2fe;
    border-color: #bae6fd;
}

.doc-mini.missing {
    color: #991b1b;
    background: #fee2e2;
    border-color: #fecaca;
}

.doc-mini.optional-missing {
    color: #4b5563;
    background: #f3f4f6;
    border-color: #e5e7eb;
}

.doc-mini-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 10px 14px;
    border-top: 1px solid var(--border);
    background: #fafafa;
    color: var(--muted);
    font-size: 12px;
}

.legend-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 999px;
    margin-right: 5px;
}

.legend-dot.uploaded {
    background: #22c55e;
}

.legend-dot.missing {
    background: #ef4444;
}

.legend-dot.optional {
    background: #9ca3af;
}

@media (max-width: 767.98px) {
    .document-card-row {
        grid-template-columns: 1fr;
    }

    .doc-title-line {
        flex-direction: column;
    }

    .doc-badge-wrap,
    .document-card-actions {
        justify-content: flex-start;
    }

    .document-card-actions .btn,
    .document-card-actions .btn-group {
        width: 100%;
    }

    .document-card-actions .btn-group .btn {
        width: 100%;
    }
}
