/* ── Base ─────────────────────────────────────────────────── */
html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    color: #1e293b;
    background: #f1f5f9;
}

a {
    color: #3b82f6;
    text-decoration: none;
}

a:hover {
    color: #2563eb;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
}

/* ── Layout ───────────────────────────────────────────────── */
.page {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.content {
    padding: 1.5rem 2rem;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
    background: #0f172a;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ── Top bar ──────────────────────────────────────────────── */
.top-row {
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* ── Cards ────────────────────────────────────────────────── */
.card {
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.card-header {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    border-radius: 0.75rem 0.75rem 0 0 !important;
    font-weight: 600;
    padding: 1rem 1.25rem;
}

/* ── Tables ───────────────────────────────────────────────── */
.table {
    font-size: 0.875rem;
}

.table thead th {
    background: #f8fafc;
    color: #64748b;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid #e2e8f0;
    padding: 0.75rem 1rem;
}

.table td {
    padding: 0.85rem 1rem;
    vertical-align: middle;
    border-color: #f1f5f9;
}

.table-hover tbody tr:hover {
    background-color: #f8fafc;
}

/* ── Badges ───────────────────────────────────────────────── */
.badge {
    font-weight: 500;
    font-size: 0.72rem;
    padding: 0.35em 0.65em;
    border-radius: 0.375rem;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
    font-weight: 500;
    border-radius: 0.5rem;
    font-size: 0.8rem;
}

.btn-sm {
    padding: 0.3rem 0.65rem;
    font-size: 0.775rem;
}

/* ── Form controls ────────────────────────────────────────── */
.form-control, .form-select {
    border-radius: 0.5rem;
    border-color: #cbd5e1;
    font-size: 0.875rem;
}

.form-control:focus, .form-select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.form-label {
    font-weight: 500;
    color: #374151;
    font-size: 0.85rem;
    margin-bottom: 0.4rem;
}

/* ── Alert messages ───────────────────────────────────────── */
.alert {
    border-radius: 0.6rem;
    border: none;
    font-size: 0.875rem;
}

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

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
}

/* ── Input group tweaks (login page) ─────────────────────── */
.input-group-text {
    border-radius: 0.5rem 0 0 0.5rem;
    border-color: #cbd5e1;
    color: #94a3b8;
}

.input-group .form-control {
    border-radius: 0 0.5rem 0.5rem 0;
}

.input-group .form-control:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
    z-index: 1;
}

/* ── Login page ───────────────────────────────────────────── */
.login-wrapper {
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.login-card {
    background: rgba(255, 255, 255, 0.97);
    border-radius: 1rem;
    padding: 2.5rem;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
}

.login-logo {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: white;
    margin: 0 auto 1.25rem;
}

.login-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: #0f172a;
    text-align: center;
    margin-bottom: 0.25rem;
}

.login-subtitle {
    color: #64748b;
    text-align: center;
    font-size: 0.85rem;
    margin-bottom: 1.75rem;
}

/* ── Stat cards ───────────────────────────────────────────── */
.stat-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1;
    color: #0f172a;
}

.stat-label {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 0.2rem;
}

/* ── Page header ──────────────────────────────────────────── */
.page-header {
    margin-bottom: 1.5rem;
}

.page-header h3, .page-header h4 {
    margin-bottom: 0.2rem;
    color: #0f172a;
}

.page-header .text-muted {
    font-size: 0.85rem;
}

/* ── Fingerprint code display ─────────────────────────────── */
code {
    font-size: 0.8rem;
    background: #f1f5f9;
    padding: 0.2em 0.45em;
    border-radius: 0.3rem;
    color: #1e40af;
    word-break: break-all;
}

/* ── Spinner/Loading ──────────────────────────────────────── */
.loading-row {
    text-align: center;
    padding: 3rem;
    color: #94a3b8;
}

/* ── Blazor error UI ──────────────────────────────────────── */
#blazor-error-ui {
    background: #fef3c7;
    border-top: 2px solid #f59e0b;
    bottom: 0;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    font-size: 0.875rem;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
    background: #b32121;
    border-radius: 0.5rem;
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

/* ── Responsive ───────────────────────────────────────────── */
@media (min-width: 641px) {
    .page {
        flex-direction: row;
    }

    .sidebar {
        width: 240px;
        min-height: 100vh;
        position: sticky;
        top: 0;
        height: 100vh;
        overflow-y: auto;
    }

    .top-row {
        position: sticky;
        top: 0;
        z-index: 10;
    }
}

@media (max-width: 640.98px) {
    .content {
        padding: 1rem;
    }

    .top-row {
        position: relative;
    }
}
