:root {
    --bg: #08131c;
    --bg-alt: #0f2230;
    --panel: rgba(13, 32, 45, 0.82);
    --panel-soft: rgba(12, 26, 36, 0.66);
    --stroke: rgba(183, 223, 255, 0.12);
    --text: #f5f8fb;
    --muted: #93aac0;
    --accent: #2dbd85;
    --accent-strong: #ff8c42;
    --danger: #f26d6d;
}

html,
body {
    min-height: 100%;
    margin: 0;
    font-family: "Manrope", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(45, 189, 133, 0.16), transparent 30%),
        radial-gradient(circle at top right, rgba(255, 140, 66, 0.15), transparent 24%),
        linear-gradient(160deg, #071019 0%, #102433 45%, #071019 100%);
    color: var(--text);
}

body {
    min-height: 100vh;
}

a {
    color: inherit;
}

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

.app-header {
    padding: 1.25rem 1.5rem 0;
}

.brand-link {
    color: var(--text);
    font-size: 1.35rem;
    font-weight: 800;
    text-decoration: none;
}

.brand-subtitle {
    margin: 0.2rem 0 0;
    color: var(--muted);
}

.app-frame {
    display: grid;
    grid-template-columns: 290px minmax(0, 1fr);
    gap: 1.25rem;
    padding: 1.25rem 1.5rem 1.5rem;
}

.app-sidebar {
    align-self: start;
    position: sticky;
    top: 1rem;
}

.app-main {
    min-width: 0;
}

.nav-panel,
.panel-card,
.login-card {
    background: var(--panel);
    border: 1px solid var(--stroke);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(18px);
}

.nav-panel {
    border-radius: 28px;
    padding: 1rem;
}

.nav-links {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.nav-link {
    display: block;
    border: 1px solid transparent;
    border-radius: 18px;
    padding: 0.9rem 1rem;
    color: var(--muted);
    text-decoration: none;
    font-weight: 600;
    transition: 0.2s ease;
}

.nav-link.active,
.nav-link:hover {
    border-color: rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
}

.profile-card {
    margin-top: 0.5rem;
    padding: 1rem;
    border-radius: 20px;
    background: var(--panel-soft);
    border: 1px solid var(--stroke);
}

.profile-label,
.detail-label,
.eyebrow {
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.logout-form {
    margin-top: 0.5rem;
}

.logout-button {
    width: 100%;
    text-align: left;
    background: transparent;
    cursor: pointer;
}

.page-hero {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: end;
    margin-bottom: 1.2rem;
}

.page-hero.compact {
    align-items: center;
}

.page-hero h1 {
    margin: 0.15rem 0 0.25rem;
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 800;
}

.page-hero p {
    margin: 0;
    color: var(--muted);
}

.hero-actions {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.btn {
    border-radius: 16px;
    font-weight: 700;
}

.btn-primary,
.btn-success,
.btn-accent {
    color: #051018;
    border: none;
    background: linear-gradient(135deg, var(--accent) 0%, #7df3c5 100%);
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent-strong) 0%, #ffc266 100%);
}

.btn-outline-light {
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--text);
}

.btn-outline-light:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.24);
    color: var(--text);
}

.app-alert {
    border-radius: 18px;
    padding: 0.95rem 1rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
}

.alert-success {
    background: rgba(45, 189, 133, 0.12);
    border-color: rgba(45, 189, 133, 0.3);
    color: #bdf5dc;
}

.alert-warning {
    background: rgba(255, 178, 66, 0.12);
    border-color: rgba(255, 178, 66, 0.3);
    color: #ffd8a6;
}

.alert-danger {
    background: rgba(242, 109, 109, 0.12);
    border-color: rgba(242, 109, 109, 0.28);
    color: #ffd1d1;
}

.alert-info {
    background: rgba(95, 173, 255, 0.12);
    border-color: rgba(95, 173, 255, 0.26);
    color: #cee5ff;
}

.workspace-grid {
    display: grid;
    grid-template-columns: minmax(320px, 0.95fr) minmax(0, 1.35fr);
    gap: 1rem;
}

.panel-card,
.login-card {
    border-radius: 32px;
    padding: 1.4rem;
}

.panel-card h2,
.panel-card h3 {
    margin-top: 0;
}

.search-row,
.edit-grid,
.detail-grid,
.history-body {
    display: grid;
    gap: 1rem;
}

.search-row {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
}

.edit-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 1rem;
}

.detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 1rem 0 1.2rem;
}

.detail-item,
.history-card,
.admin-user-card {
    padding: 1rem;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--stroke);
}

.detail-item strong,
.history-body strong {
    font-size: 1rem;
}

.result-heading {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: start;
}

.result-heading.compact h3 {
    margin: 0;
}

.detail-line {
    margin: 0.15rem 0 0;
    color: var(--muted);
    font-family: "IBM Plex Mono", monospace;
}

.status-pill {
    align-self: start;
    padding: 0.6rem 0.9rem;
    border-radius: 999px;
    background: rgba(45, 189, 133, 0.15);
    color: #c9ffe9;
    border: 1px solid rgba(45, 189, 133, 0.32);
    font-weight: 700;
}

.status-pill.muted {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    border-color: rgba(255, 255, 255, 0.08);
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.stack-form {
    display: grid;
    gap: 0.9rem;
}

.form-control,
.form-select {
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(4, 14, 21, 0.8);
    color: var(--text);
    min-height: 3rem;
}

.form-control::placeholder {
    color: #6e8497;
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    border-color: rgba(45, 189, 133, 0.7);
    box-shadow: 0 0 0 0.18rem rgba(45, 189, 133, 0.16);
    background: rgba(4, 14, 21, 0.95);
    color: var(--text);
}

.scanner-panel {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(255, 255, 255, 0.18);
}

.scanner-live {
    border-color: rgba(255, 140, 66, 0.45);
    box-shadow: inset 0 0 0 1px rgba(255, 140, 66, 0.16);
}

.scanner-region {
    min-height: 280px;
    overflow: hidden;
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
}

.scanner-help,
.photo-message {
    margin: 0.8rem 0 0;
    color: var(--muted);
}

.photo-section {
    margin-top: 1.4rem;
}

.photo-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
}

.photo-header h3 {
    margin-bottom: 0.2rem;
}

.photo-header p {
    margin: 0;
    color: var(--muted);
}

.photo-showcase {
    display: grid;
    gap: 0.75rem;
    margin-top: 1rem;
}

.hero-photo {
    width: 100%;
    max-height: 420px;
    object-fit: contain;
    border-radius: 24px;
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid var(--stroke);
}

.photo-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
    gap: 0.65rem;
}

.photo-thumb {
    padding: 0;
    border: 1px solid transparent;
    border-radius: 18px;
    background: transparent;
    overflow: hidden;
}

.photo-thumb.selected {
    border-color: rgba(45, 189, 133, 0.6);
    box-shadow: 0 0 0 1px rgba(45, 189, 133, 0.15);
}

.photo-thumb img {
    width: 100%;
    height: 88px;
    object-fit: cover;
    display: block;
}

.history-list,
.admin-user-list {
    display: grid;
    gap: 0.85rem;
}

.history-meta {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    margin-bottom: 0.75rem;
}

.history-body {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.5rem;
}

.login-card {
    width: min(520px, 100%);
}

.login-brand h1 {
    margin: 0.2rem 0 0.3rem;
    font-size: clamp(2rem, 5vw, 2.7rem);
}

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

.login-form {
    display: grid;
    gap: 1rem;
    margin-top: 1rem;
}

.remember-row {
    display: flex;
    gap: 0.55rem;
    align-items: center;
    color: var(--muted);
}

.empty-state-panel {
    padding: 1.4rem;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(255, 255, 255, 0.16);
}

.empty-state-panel h1,
.empty-state-panel h2,
.empty-state-panel h3 {
    margin-top: 0;
}

.validation-message {
    color: #ff9c9c;
    font-size: 0.9rem;
}

#blazor-error-ui {
    color-scheme: dark;
    background: rgba(23, 8, 8, 0.95);
    color: white;
    bottom: 0;
    display: none;
    left: 0;
    padding: 0.8rem 1rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

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

@media (max-width: 980px) {
    .app-frame,
    .workspace-grid {
        grid-template-columns: 1fr;
    }

    .app-sidebar {
        position: static;
    }
}

@media (max-width: 720px) {
    .app-header,
    .app-frame {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .page-hero,
    .photo-header,
    .result-heading,
    .history-meta {
        flex-direction: column;
        align-items: stretch;
    }

    .search-row,
    .edit-grid,
    .detail-grid,
    .history-body {
        grid-template-columns: 1fr;
    }
}
