:root {
    --primary: #1e315f;
    --primary-soft: #111b35;
    --secondary: #4f7cff;
    --secondary-soft: #dbe6ff;
    --surface: #f5f7fb;
    --surface-low: #eef2f8;
    --surface-high: #d8dee9;
    --surface-card: #ffffff;
    --text-main: #172033;
    --text-soft: #667085;
    --danger: #d92d20;
    --danger-soft: #fee4e2;
    --success-soft: #ecfdf3;
    --shadow: 0 20px 50px rgba(17, 27, 53, 0.1);
    --radius-xl: 28px;
    --radius-lg: 18px;
    --radius-md: 12px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background: linear-gradient(180deg, #f5f7fb 0%, #e9eef7 100%);
    color: var(--text-main);
}

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

.shell {
    min-height: 100vh;
    display: flex;
}

.sidebar {
    width: 260px;
    background: var(--primary);
    color: #fff;
    padding: 28px 18px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.brand-title {
    margin: 0;
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.04em;
}

.brand-subtitle {
    margin: 6px 0 0;
    color: rgba(255, 255, 255, 0.56);
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 11px;
}

.sidebar-nav {
    display: grid;
    gap: 8px;
}

.nav-link {
    padding: 14px 16px;
    border-radius: 14px;
    color: rgba(255, 255, 255, 0.7);
    transition: 160ms ease-out;
}

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

.cta-button,
.button-primary,
.button-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0 20px;
    border-radius: 14px;
    font-weight: 700;
    border: none;
    cursor: pointer;
}

.cta-button,
.button-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-soft) 100%);
    color: #fff;
    box-shadow: var(--shadow);
}

.button-secondary {
    background: var(--surface-high);
    color: var(--primary-soft);
}

.sidebar-footer {
    margin-top: auto;
}

.main-content {
    flex: 1;
    padding: 28px 32px 48px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 18px;
    margin-bottom: 28px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--secondary);
    font-weight: 800;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.18em;
}

.topbar h1 {
    margin: 0;
    font-size: clamp(30px, 4vw, 48px);
    line-height: 1;
    letter-spacing: -0.05em;
}

.topbar-meta {
    color: var(--text-soft);
    background: rgba(255, 255, 255, 0.72);
    padding: 12px 16px;
    border-radius: 999px;
    backdrop-filter: blur(14px);
}

.grid,
.stats-grid,
.cards-grid {
    display: grid;
    gap: 24px;
}

.stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    margin-bottom: 28px;
}

.cards-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.card {
    background: rgba(255, 255, 255, 0.9);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    padding: 28px;
}

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

.stat-label {
    margin: 0 0 10px;
    color: var(--text-soft);
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 11px;
    font-weight: 800;
}

.stat-value {
    margin: 0;
    font-size: 38px;
    font-weight: 800;
    letter-spacing: -0.05em;
    color: var(--primary);
}

.stat-note,
.muted,
.table-subtitle {
    color: var(--text-soft);
}

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

.toolbar-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

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

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

th {
    text-align: left;
    color: var(--text-soft);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    padding: 16px 0;
}

td {
    padding: 18px 0;
    font-weight: 500;
    vertical-align: top;
}

tbody tr + tr td {
    border-top: 1px solid rgba(197, 198, 207, 0.35);
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    border-radius: 999px;
    padding: 0 12px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.badge-valid {
    background: var(--success-soft);
    color: #027a48;
}

.badge-danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.badge-muted {
    background: var(--surface-high);
    color: var(--text-soft);
}

.two-column {
    display: grid;
    grid-template-columns: minmax(260px, 0.9fr) minmax(0, 1.3fr);
    gap: 28px;
}

.info-panel {
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-soft) 100%);
    color: #fff;
}

.info-panel p {
    color: rgba(255, 255, 255, 0.72);
}

.checklist {
    padding-left: 18px;
    margin: 0;
    color: var(--text-soft);
    line-height: 1.8;
}

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

.field {
    display: grid;
    gap: 8px;
}

.field label {
    font-size: 13px;
    font-weight: 800;
    color: var(--primary);
}

.field input,
.field select {
    width: 100%;
    min-height: 50px;
    border: none;
    border-radius: 14px;
    background: var(--surface-low);
    padding: 0 14px;
    color: var(--text-main);
    font: inherit;
}

.field input:focus,
.field select:focus {
    outline: 2px solid rgba(79, 124, 255, 0.34);
}

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

.stack {
    display: grid;
    gap: 18px;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px;
    background:
        radial-gradient(circle at top left, rgba(79, 124, 255, 0.16), transparent 32%),
        linear-gradient(180deg, #f5f7fb 0%, #e9eef7 100%);
}

.login-card {
    width: min(980px, 100%);
    display: grid;
    grid-template-columns: minmax(320px, 0.95fr) minmax(340px, 0.8fr);
    background: rgba(255, 255, 255, 0.94);
    border-radius: 32px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.1);
}

.login-banner {
    padding: 42px;
    background: linear-gradient(145deg, var(--primary) 0%, var(--primary-soft) 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 28px;
}

.login-banner-brand {
    align-items: center;
    justify-content: center;
    text-align: center;
}

.login-banner h1,
.login-banner p {
    margin: 0;
}

.login-banner h1 {
    font-size: clamp(34px, 5vw, 56px);
    line-height: .95;
    letter-spacing: -0.06em;
}

.login-banner p {
    margin-top: 16px;
    color: rgba(255, 255, 255, 0.78);
    line-height: 1.7;
    font-size: 15px;
    max-width: 420px;
}

.login-banner .eyebrow {
    margin: 0 0 12px;
    color: var(--secondary-soft);
    text-transform: uppercase;
    letter-spacing: .18em;
    font-size: 12px;
    font-weight: 800;
}

.login-brand-showcase {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 260px;
    margin: 18px 0 22px;
}

.login-brand-logo {
    width: min(280px, 100%);
    border-radius: 0;
    background: transparent;
    padding: 0;
    box-shadow: none;
}

.login-brand-subtitle {
    margin: 10px 0 0 !important;
    color: rgba(219, 230, 255, 0.9) !important;
    font-size: 15px !important;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.hero-card {
    padding: 20px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(18px);
}

.hero-card strong {
    display: block;
    font-size: 12px;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--secondary-soft);
    margin-bottom: 8px;
}

.hero-card span {
    color: rgba(255, 255, 255, 0.82);
    line-height: 1.7;
    font-size: 14px;
}

.login-body {
    padding: 42px 36px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: rgba(255, 255, 255, 0.84);
}

.login-body h2 {
    margin: 0 0 8px;
    font-size: 34px;
    letter-spacing: -0.05em;
    color: var(--primary);
}

.login-body > p {
    margin: 0 0 24px;
    color: var(--text-soft);
    line-height: 1.7;
    font-size: 15px;
}

.alert {
    padding: 14px 16px;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.6;
}

.alert-info {
    background: #eaf0ff;
    color: #1e315f;
}

.alert-success {
    background: #e6f6ea;
    color: #166534;
}

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

.field-help,
.field-error {
    margin: 0;
    font-size: 13px;
    line-height: 1.6;
}

.field-help {
    color: var(--text-soft);
}

.field-error {
    color: var(--danger);
    font-weight: 600;
}

.drawer-shell {
    position: fixed;
    inset: 0;
    z-index: 50;
    pointer-events: none;
}

.drawer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.18);
    pointer-events: auto;
}

.drawer-panel {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    width: min(100%, 430px);
    height: 100%;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: -20px 0 50px rgba(0, 0, 0, 0.12);
    pointer-events: auto;
    overflow: hidden;
}

.drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 24px;
    border-bottom: 1px solid rgba(197, 198, 207, 0.4);
}

.drawer-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 999px;
    background: var(--surface-low);
    color: var(--primary);
    font-size: 28px;
    line-height: 1;
}

.drawer-body {
    min-height: 0;
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.drawer-table {
    border: 1px solid rgba(197, 198, 207, 0.5);
    border-radius: 22px;
    overflow: hidden;
    background: #fff;
}

.drawer-row {
    display: grid;
    grid-template-columns: 140px minmax(0, 1fr);
}

.drawer-row + .drawer-row {
    border-top: 1px solid rgba(197, 198, 207, 0.35);
}

.drawer-label {
    padding: 18px 20px;
    background: var(--surface-low);
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    border-right: 1px solid rgba(197, 198, 207, 0.35);
}

.drawer-value {
    padding: 18px 20px;
    color: var(--text-main);
    font-size: 16px;
    line-height: 1.6;
    min-width: 0;
    word-break: break-word;
}

.drawer-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 18px;
    background: #dbe6ff;
    color: var(--primary);
    font-weight: 800;
    font-size: 18px;
}

.drawer-note {
    margin-top: 18px;
    padding: 18px 20px;
    border-radius: 18px;
    background: var(--surface-low);
    color: var(--text-soft);
    line-height: 1.7;
}

.qr-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.qr-card img {
    width: 180px;
    height: 180px;
    object-fit: contain;
    padding: 10px;
    border-radius: 18px;
    background: #fff;
    border: 1px solid rgba(197, 198, 207, 0.35);
}

.token {
    width: 100%;
    padding: 10px 12px;
    border-radius: 14px;
    background: var(--surface-low);
    color: var(--text-soft);
    font-family: monospace;
    font-size: 12px;
    line-height: 1.6;
    word-break: break-all;
}

.qr-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-top: 6px;
}

.qr-actions .button-primary,
.qr-actions .button-secondary {
    min-width: 190px;
}

.qr-actions .button-secondary {
    margin-top: 14px;
}

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

.verify-card {
    width: min(840px, 100%);
    background: rgba(255, 255, 255, 0.92);
    border-radius: 36px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.verify-banner {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-soft) 100%);
    color: #fff;
    padding: 32px;
}

.verify-banner h1,
.verify-banner p {
    margin: 0;
}

.verify-banner p {
    margin-top: 10px;
    color: rgba(255, 255, 255, 0.76);
}

.verify-body {
    padding: 32px;
    display: grid;
    gap: 24px;
}

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

.verify-item {
    background: var(--surface-low);
    border-radius: 18px;
    padding: 18px;
}

.verify-item strong {
    display: block;
    color: var(--text-soft);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    margin-bottom: 10px;
}

.verify-item span {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.verify-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.app-content {
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.app-content.is-loading {
    opacity: 0.42;
    transform: translateY(6px);
}

.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 9999;
    width: 100%;
    height: 3px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
}

.page-loader.is-visible {
    opacity: 1;
}

.page-loader__bar {
    width: 34%;
    height: 100%;
    border-radius: 0 999px 999px 0;
    background: linear-gradient(90deg, var(--secondary) 0%, #9db7ff 100%);
    box-shadow: 0 0 18px rgba(79, 124, 255, 0.42);
    animation: page-loader-slide 1.1s ease-in-out infinite;
}

@keyframes page-loader-slide {
    0% {
        transform: translateX(-120%);
    }
    55% {
        transform: translateX(110%);
    }
    100% {
        transform: translateX(220%);
    }
}

@media (max-width: 900px) {
    .shell {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
    }

    .main-content {
        padding: 20px;
    }

    .topbar,
    .toolbar,
    .two-column,
    .login-card {
        grid-template-columns: 1fr;
        display: grid;
    }

    .form-grid,
    .verify-grid {
        grid-template-columns: 1fr;
    }

    .drawer-panel {
        width: 100%;
    }

    .drawer-row {
        grid-template-columns: 1fr;
    }

    .drawer-label {
        border-right: 0;
        border-bottom: 1px solid rgba(197, 198, 207, 0.2);
    }
}
