: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;
    padding-bottom: 6.5rem;
}

.app-header {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 1.25rem 1.5rem 0;
}

.menu-toggle {
    display: inline-grid;
    place-items: center;
    gap: 0.22rem;
    width: 3rem;
    height: 3rem;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
}

.menu-toggle span {
    display: block;
    width: 1.15rem;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
}

.brand-block {
    min-width: 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 {
    padding: 1.25rem 1.5rem 1.5rem;
}

.app-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 960;
    width: min(320px, calc(100vw - 2rem));
    padding: 1rem;
    transform: translateX(-105%);
    transition: transform 180ms ease;
}

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

.nav-backdrop {
    position: fixed;
    inset: 0;
    z-index: 950;
    border: 0;
    background: rgba(0, 0, 0, 0.54);
}

.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;
    height: 100%;
    overflow-y: auto;
}

.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 h1:focus {
    outline: none;
}

.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-actions {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.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;
}

.edit-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.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-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.85rem;
    margin-top: 1rem;
    align-items: stretch;
}

.scanner-action {
    min-height: 3.2rem;
}

.multi-scan-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    min-height: 3.2rem;
    padding: 0.5rem 0.75rem;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    text-align: left;
    transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.multi-scan-switch:not(:disabled):hover {
    border-color: rgba(255, 140, 66, 0.42);
    background: rgba(255, 140, 66, 0.08);
}

.multi-scan-switch.enabled {
    border-color: rgba(255, 140, 66, 0.52);
    background: rgba(255, 140, 66, 0.13);
}

.multi-scan-switch:disabled {
    opacity: 0.72;
}

.switch-track {
    position: relative;
    width: 3rem;
    height: 1.55rem;
    flex: 0 0 auto;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
}

.switch-thumb {
    position: absolute;
    top: 0.22rem;
    left: 0.22rem;
    width: 1.1rem;
    height: 1.1rem;
    border-radius: 50%;
    background: #f7fbff;
    transition: transform 160ms ease, background 160ms ease;
}

.multi-scan-switch.enabled .switch-track {
    background: var(--accent-strong);
}

.multi-scan-switch.enabled .switch-thumb {
    transform: translateX(1.45rem);
    background: #051018;
}

.switch-copy {
    display: grid;
    gap: 0.05rem;
}

.switch-copy strong {
    line-height: 1;
}

.switch-copy small {
    color: var(--muted);
    font-weight: 600;
    line-height: 1.1;
}

.zoom-control {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-top: 0.95rem;
    color: var(--text);
    font-weight: 700;
}

.zoom-control span {
    white-space: nowrap;
}

.zoom-control input {
    width: 100%;
    accent-color: var(--accent-strong);
}

.bottom-work-dock {
    position: fixed;
    left: 50%;
    bottom: max(0.75rem, env(safe-area-inset-bottom));
    z-index: 900;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto auto auto;
    gap: 0.45rem;
    width: min(780px, calc(100vw - 1rem));
    padding: 0.55rem;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 22px;
    background: rgba(6, 17, 26, 0.92);
    box-shadow: 0 18px 56px rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(18px);
    transform: translateX(-50%);
}

.dock-sku-input {
    min-width: 0;
    height: 3.05rem;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 16px;
    padding: 0 0.9rem;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    font-size: 1.05rem;
    font-weight: 700;
}

.dock-sku-input::placeholder {
    color: var(--muted);
}

.dock-search-button,
.dock-camera-button,
.dock-photo-button,
.dock-multi-button {
    height: 3.05rem;
    border: 0;
    border-radius: 16px;
    font-weight: 800;
}

.dock-search-button {
    padding: 0 0.9rem;
    background: var(--accent);
    color: #051018;
}

.dock-camera-button,
.dock-photo-button,
.dock-multi-button {
    width: 3.05rem;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.09);
    color: var(--text);
}

.dock-camera-button.active,
.dock-multi-button.active {
    background: var(--accent-strong);
    color: #051018;
}

.dock-photo-button:not(:disabled) {
    background: rgba(45, 189, 133, 0.18);
}

.dock-photo-button:disabled {
    opacity: 0.45;
}

.dock-icon {
    width: 1.45rem;
    height: 1.45rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.photo-glyph {
    position: relative;
    display: block;
}

.photo-glyph {
    width: 1.35rem;
    height: 1.1rem;
    border: 2px solid currentColor;
    border-radius: 0.22rem;
}

.photo-glyph::before {
    content: "";
    position: absolute;
    left: 0.18rem;
    right: 0.18rem;
    bottom: 0.16rem;
    height: 0.45rem;
    background: currentColor;
    clip-path: polygon(0 100%, 36% 35%, 55% 62%, 75% 20%, 100% 100%);
    opacity: 0.88;
}

.dock-multi-button {
    font-size: 0.95rem;
    letter-spacing: 0;
}

.dock-scanner-panel {
    position: fixed;
    left: 50%;
    bottom: calc(5.3rem + env(safe-area-inset-bottom));
    z-index: 890;
    width: min(780px, calc(100vw - 1rem));
    padding: 0.7rem;
    border: 1px solid rgba(255, 140, 66, 0.34);
    border-radius: 22px;
    background: rgba(6, 17, 26, 0.94);
    box-shadow: 0 18px 56px rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(18px);
    transform: translateX(-50%);
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

.dock-scanner-panel.open {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
}

.dock-scanner-region {
    min-height: min(48vh, 360px);
    overflow: hidden;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.04);
}

.dock-zoom-control {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin-top: 0.65rem;
    color: var(--text);
    font-weight: 800;
}

.dock-zoom-control input {
    width: 100%;
    accent-color: var(--accent-strong);
}

.dock-scanner-message {
    margin: 0.55rem 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.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) {
    .workspace-grid {
        grid-template-columns: 1fr;
    }
}

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

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

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

    .multi-scan-switch {
        justify-content: flex-start;
    }

    .zoom-control {
        align-items: stretch;
        flex-direction: column;
        gap: 0.45rem;
    }

    .brand-subtitle,
    .search-panel {
        display: none;
    }

    .app-shell {
        padding-bottom: 5.6rem;
    }

    .app-header {
        padding: 0.55rem 0.75rem 0;
    }

    .app-frame {
        padding: 0.55rem 0.75rem 5.8rem;
    }

    .brand-link {
        font-size: 0.95rem;
    }

    .menu-toggle {
        width: 2.65rem;
        height: 2.65rem;
        border-radius: 14px;
    }

    .page-hero {
        margin-bottom: 0.65rem;
        gap: 0.65rem;
    }

    .page-hero .eyebrow,
    .page-hero p {
        display: none;
    }

    .page-hero h1 {
        font-size: 1.45rem;
        line-height: 1.05;
        margin: 0;
    }

    .hero-actions .btn {
        min-height: 2.55rem;
        padding: 0.45rem 0.8rem;
        border-radius: 999px;
        font-size: 0.92rem;
    }

    .panel-card,
    .login-card {
        border-radius: 20px;
        padding: 0.85rem;
    }

    .empty-state-panel {
        padding: 1rem;
        border-radius: 18px;
    }

    .empty-state-panel h2 {
        font-size: 1.45rem;
        line-height: 1.12;
    }

    .empty-state-panel p {
        font-size: 0.98rem;
        line-height: 1.45;
    }

    .bottom-work-dock {
        bottom: max(0.35rem, env(safe-area-inset-bottom));
        grid-template-columns: minmax(0, 1fr) 2.75rem 2.75rem 2.75rem;
        width: calc(100vw - 0.5rem);
        gap: 0.3rem;
        padding: 0.34rem;
        border-radius: 16px;
        z-index: 1200;
    }

    .dock-search-button {
        display: none;
    }

    .dock-sku-input,
    .dock-camera-button,
    .dock-photo-button,
    .dock-multi-button {
        height: 2.75rem;
        border-radius: 13px;
    }

    .dock-camera-button,
    .dock-photo-button,
    .dock-multi-button {
        width: 2.75rem;
    }

    .dock-scanner-panel {
        bottom: calc(4.15rem + env(safe-area-inset-bottom));
        width: calc(100vw - 0.5rem);
        z-index: 1190;
    }

    .dock-scanner-region {
        min-height: min(42vh, 300px);
    }
}
