* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    background: #f5f7fb;
    color: #172033;
}

body {
    min-height: 100vh;
}

.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px 18px;
    background:
        radial-gradient(circle at top left, #e7edff, transparent 35%),
        #f6f8fc;
}

.auth-wrapper {
    width: 100%;
    max-width: 470px;
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
}

.brand-mark {
    width: 50px;
    height: 50px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #111827;
    color: white;
    font-weight: 800;
}

.auth-brand h1 {
    margin: 0;
    font-size: 20px;
}

.auth-brand p {
    margin: 4px 0 0;
    color: #7a8497;
    font-size: 13px;
}

.auth-card {
    background: #fff;
    padding: 32px;
    border: 1px solid #e6e9ef;
    border-radius: 20px;
    box-shadow:
        0 16px 45px rgba(32, 46, 80, 0.08);
}

.wide-card {
    width: 100%;
}

.auth-card-header {
    margin-bottom: 25px;
}

.auth-card-header h2 {
    margin: 8px 0;
    font-size: 27px;
}

.auth-card-header p {
    color: #6f7889;
    line-height: 1.6;
    margin: 0;
}

.eyebrow {
    display: inline-block;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.4px;
    color: #5965d8;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 700;
}

.form-group input {
    width: 100%;
    border: 1px solid #dce0e8;
    border-radius: 10px;
    padding: 13px 14px;
    font-size: 15px;
    outline: none;
}

.form-group input:focus {
    border-color: #6670df;
    box-shadow:
        0 0 0 3px rgba(102, 112, 223, 0.12);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 10px;
    padding: 13px 18px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.btn-primary {
    background: #111827;
    color: white;
}

.btn-secondary {
    background: #eef0f5;
    color: #222a38;
}

.auth-card form .btn {
    width: 100%;
}

.alert {
    border-radius: 10px;
    margin-bottom: 18px;
    padding: 13px 15px;
    font-size: 14px;
    line-height: 1.5;
}

.alert-danger {
    background: #fff0f0;
    color: #9b2525;
}

.alert-warning {
    background: #fff9e8;
    color: #795b06;
}

.alert-success {
    background: #edfff4;
    color: #19713c;
}

.divider {
    text-align: center;
    position: relative;
    margin: 25px 0;
    color: #969dad;
    font-size: 12px;
}

.security-box {
    background: #f8f9fc;
    padding: 20px;
    border-radius: 14px;
    margin: 18px 0;
}

.security-box h3 {
    margin-top: 0;
}

.qr-container {
    display: inline-flex;
    padding: 15px;
    background: white;
    border-radius: 12px;
    margin: 10px 0;
}

.recovery-codes {
    display: grid;
    gap: 8px;
}

.recovery-codes code {
    background: white;
    padding: 10px;
    border-radius: 7px;
}

.topbar {
    height: 68px;
    background: white;
    border-bottom: 1px solid #e7eaf0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
}

.topbar strong,
.topbar small {
    display: block;
}

.topbar small {
    margin-top: 2px;
    color: #8991a1;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 18px;
}

.topbar-actions a {
    text-decoration: none;
    color: #30384a;
}

.logout-button {
    border: 0;
    background: transparent;
    cursor: pointer;
    color: #b63333;
}

.dashboard-container {
    width: min(1200px, calc(100% - 40px));
    margin: 0 auto;
    padding: 50px 0;
}

.dashboard-heading h1 {
    margin: 8px 0;
    font-size: 34px;
}

.dashboard-heading p {
    color: #737c8e;
}

.dashboard-grid {
    display: grid;
    grid-template-columns:
        repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-top: 35px;
}

.dashboard-card {
    background: white;
    border: 1px solid #e7eaf0;
    border-radius: 17px;
    padding: 23px;
}

.dashboard-card span,
.dashboard-card strong,
.dashboard-card small {
    display: block;
}

.dashboard-card span {
    color: #7c8495;
    font-size: 13px;
}

.dashboard-card strong {
    font-size: 24px;
    margin: 10px 0;
}

.dashboard-card small {
    color: #9097a5;
}

@media (max-width: 900px) {
    .dashboard-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {

    .auth-card {
        padding: 24px 20px;
    }

    .topbar {
        padding: 0 16px;
    }

    .topbar small {
        display: none;
    }

    .dashboard-container {
        width: calc(100% - 28px);
        padding-top: 30px;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-heading h1 {
        font-size: 27px;
    }
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-brand .brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    font-size: 12px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 28px;
}

.page-header h1 {
    margin: 7px 0 6px;
    font-size: 32px;
}

.page-header p {
    color: #778092;
    margin: 0;
}

.filter-card,
.table-card {
    background: #ffffff;
    border: 1px solid #e6e9ef;
    border-radius: 16px;
}

.filter-card {
    padding: 18px;
    margin-bottom: 18px;
}

.filter-form {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 14px;
}

.filter-field {
    min-width: 180px;
}

.filter-field label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 7px;
}

.filter-field select {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid #dadee8;
    border-radius: 9px;
    background: #fff;
}

.filter-actions {
    display: flex;
    gap: 8px;
}

.table-card {
    overflow: hidden;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.audit-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 900px;
}

.audit-table th {
    padding: 13px 16px;
    text-align: left;
    background: #f8f9fb;
    font-size: 11px;
    letter-spacing: .4px;
    text-transform: uppercase;
    color: #727b8d;
    border-bottom: 1px solid #e7eaf0;
}

.audit-table td {
    padding: 15px 16px;
    border-bottom: 1px solid #eef0f4;
    font-size: 13px;
    vertical-align: top;
}

.audit-table tbody tr:last-child td {
    border-bottom: 0;
}

.audit-table code {
    font-size: 12px;
    background: #f3f5f8;
    padding: 5px 7px;
    border-radius: 6px;
    color: #333b4b;
}

.nowrap {
    white-space: nowrap;
}

.audit-level {
    display: inline-flex;
    padding: 5px 8px;
    border-radius: 7px;
    font-size: 10px;
    font-weight: 800;
}

.audit-level-info {
    background: #edf3ff;
    color: #315ea8;
}

.audit-level-reminder {
    background: #f1edff;
    color: #6548ad;
}

.audit-level-important {
    background: #fff6df;
    color: #8c6500;
}

.audit-level-critical {
    background: #ffeded;
    color: #a82d2d;
}

.empty-table {
    text-align: center;
    padding: 50px !important;
    color: #8b93a1;
}

.pagination-wrapper {
    margin-top: 20px;
}

@media (max-width: 700px) {

    .topbar {
        height: auto;
        min-height: 68px;
        padding-top: 12px;
        padding-bottom: 12px;
    }

    .topbar-actions {
        gap: 10px;
        font-size: 12px;
    }

    .filter-form {
        display: grid;
        grid-template-columns: 1fr;
    }

    .filter-field {
        width: 100%;
    }

    .filter-actions {
        width: 100%;
    }

    .filter-actions .btn {
        flex: 1;
    }
}

.settings-card {
    background: #ffffff;
    border: 1px solid #e6e9ef;
    border-radius: 18px;
    padding: 26px;
    margin-bottom: 22px;
}

.settings-section + .settings-section {
    border-top: 1px solid #edf0f4;
    margin-top: 28px;
    padding-top: 28px;
}

.settings-section h3 {
    margin: 0 0 20px;
    font-size: 18px;
}

.settings-description {
    color: #737c8e;
    margin-top: -8px;
    margin-bottom: 22px;
    line-height: 1.6;
}

.settings-grid {
    display: grid;
    grid-template-columns:
        repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.settings-card select {
    width: 100%;
    border: 1px solid #dce0e8;
    border-radius: 10px;
    padding: 13px 14px;
    font-size: 14px;
    background: #ffffff;
    outline: none;
}

.settings-card select:focus {
    border-color: #6670df;
    box-shadow:
        0 0 0 3px rgba(102, 112, 223, 0.12);
}

.settings-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 22px;
}

.settings-actions form {
    margin: 0;
}

.field-error {
    color: #b42318;
    margin-top: 7px;
    font-size: 12px;
}

.danger-settings-card {
    border-color: #f0dddd;
}

.secure-recovery-codes {
    display: grid;
    grid-template-columns:
        repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 20px 0;
}

.secure-recovery-codes code {
    display: block;
    padding: 12px;
    border-radius: 9px;
    background: #f4f6f9;
    border: 1px solid #e6e9ef;
    font-size: 13px;
}

@media (max-width: 800px) {

    .settings-grid {
        grid-template-columns: 1fr;
    }

    .secure-recovery-codes {
        grid-template-columns: 1fr;
    }

    .settings-card {
        padding: 20px;
    }

}

@media (max-width: 650px) {

    .topbar {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }

    .topbar-actions {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .topbar-actions a,
    .logout-button {
        white-space: nowrap;
    }

}