:root {
    color-scheme: dark;
    --ink-950: #050326;
    --ink-900: #08043f;
    --ink-850: #101044;
    --ink-800: #19194f;
    --ink-700: #2b2b65;
    --brand-orange: #ff5b08;
    --brand-blue: #007caf;
    --brand-link: #56c8ef;
    --line: rgba(148, 163, 184, .18);
    --text: #f8fafc;
    --muted: #94a3b8;
    --green: #39e58c;
    --green-dark: #0c9f5b;
    --yellow: #facc15;
    --orange: #fb923c;
    --red: #fb5c68;
    --blue: #60a5fa;
    --radius: 18px;
    --header-height: 58px;
    --nav-height: 64px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-synthesis: none;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
    margin: 0;
    background: var(--ink-950);
    color: var(--text);
    overscroll-behavior-y: none;
    -webkit-tap-highlight-color: transparent;
}

body {
    min-width: 320px;
}

button,
input,
textarea,
select {
    color: inherit;
    font: inherit;
}

button,
a {
    touch-action: manipulation;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 3px solid rgba(96, 165, 250, .75);
    outline-offset: 2px;
}

a {
    color: var(--brand-link);
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0;
    font-size: clamp(1.55rem, 6vw, 2.35rem);
    letter-spacing: -.04em;
}

h2 {
    font-size: 1rem;
    letter-spacing: -.015em;
}

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.muted,
.section-intro,
.security-note {
    color: var(--muted);
}

.eyebrow {
    display: block;
    margin-bottom: 4px;
    color: #ff954f;
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .14em;
}

.app-shell {
    min-height: 100dvh;
    background:
        radial-gradient(circle at 80% -10%, rgba(0, 124, 175, .14), transparent 35%),
        var(--ink-950);
}

.app-header {
    position: sticky;
    z-index: 50;
    top: 0;
    display: flex;
    min-height: calc(var(--header-height) + var(--safe-top));
    align-items: center;
    justify-content: space-between;
    padding: calc(8px + var(--safe-top)) max(14px, var(--safe-right)) 8px max(14px, var(--safe-left));
    border-bottom: 1px solid var(--line);
    background: rgba(8, 4, 63, .94);
    backdrop-filter: blur(18px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--text);
    text-decoration: none;
}

.brand-mark {
    display: block;
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    object-fit: contain;
    border-radius: 10px;
    background: white;
}

.brand-mark-large {
    width: 76px;
    height: 76px;
    border-radius: 17px;
    font-size: 1.55rem;
}

.brand strong,
.brand small {
    display: block;
    line-height: 1;
}

.brand strong {
    font-size: .85rem;
    letter-spacing: .11em;
}

.brand small {
    margin-top: 4px;
    color: var(--muted);
    font-size: .58rem;
    letter-spacing: .16em;
}

.header-session {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-user {
    max-width: 115px;
    overflow: hidden;
    color: var(--muted);
    font-size: .78rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.icon-button,
.secondary-button,
.primary-button,
.review-button {
    min-height: 42px;
    border: 1px solid transparent;
    border-radius: 13px;
    cursor: pointer;
    font-weight: 750;
}

.icon-button,
.secondary-button {
    border-color: var(--line);
    background: rgba(148, 163, 184, .08);
    color: #dbe5f1;
}

.icon-button {
    min-height: 34px;
    padding: 5px 10px;
    border-radius: 10px;
    font-size: .72rem;
}

.primary-button {
    padding: 11px 18px;
    background: linear-gradient(135deg, #ff8734, var(--brand-orange));
    box-shadow: 0 8px 24px rgba(255, 91, 8, .18);
    color: #08043f;
}

.secondary-button,
.review-button {
    padding: 9px 14px;
}

.review-button {
    border-color: rgba(251, 146, 60, .35);
    background: rgba(251, 146, 60, .12);
    color: #fed7aa;
    font-size: .75rem;
}

button:disabled {
    cursor: not-allowed;
    filter: grayscale(.4);
    opacity: .48;
}

.compact {
    min-height: 36px;
    padding: 7px 11px;
    font-size: .78rem;
}

.full-width {
    width: 100%;
}

.app-content {
    min-height: calc(100dvh - var(--header-height) - var(--nav-height));
    padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 12px);
    scroll-padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 12px);
}

.app-nav {
    position: fixed;
    z-index: 60;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    min-height: calc(var(--nav-height) + var(--safe-bottom));
    grid-template-columns: repeat(auto-fit, minmax(44px, 1fr));
    padding: 5px max(8px, var(--safe-right)) calc(5px + var(--safe-bottom)) max(8px, var(--safe-left));
    border-top: 1px solid var(--line);
    background: rgba(7, 17, 31, .96);
    backdrop-filter: blur(18px);
}

/* On iOS/PWA a fixed layer can remain attached to an obsolete visual viewport
   after opening and closing the camera. Keep the mobile navigation in the app
   layout instead, and make only the content row scrollable. */
@media (max-width: 719.98px) {
    html,
    body,
    #app {
        width: 100%;
        height: 100%;
        min-height: 0;
        overflow: hidden;
    }

    .app-shell {
        display: grid;
        width: 100%;
        height: 100vh;
        height: 100dvh;
        min-height: 0;
        grid-template-rows: auto minmax(0, 1fr) auto;
        overflow: hidden;
    }

    .app-header {
        position: relative;
    }

    .app-content {
        min-width: 0;
        min-height: 0;
        overflow-x: hidden;
        overflow-y: auto;
        padding-bottom: 12px;
        scroll-padding-bottom: 12px;
        overscroll-behavior-y: contain;
        -webkit-overflow-scrolling: touch;
    }

    .app-nav {
        position: static;
        width: 100%;
        min-width: 0;
        flex: none;
    }
}

.nav-link {
    display: flex;
    min-width: 0;
    min-height: 48px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 2px;
    border-radius: 13px;
    color: #7f8ea3;
    text-decoration: none;
}

.nav-link span {
    font-size: 1.15rem;
    line-height: 1;
}

.nav-link small {
    overflow: hidden;
    max-width: 100%;
    font-size: .62rem;
    text-overflow: ellipsis;
}

.nav-link.active {
    background: rgba(0, 124, 175, .2);
    color: var(--brand-link);
}

.page-section {
    width: min(100%, 1120px);
    margin: 0 auto;
    padding: 22px max(15px, var(--safe-right)) 30px max(15px, var(--safe-left));
}

.narrow-section {
    max-width: 720px;
}

.section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.section-intro {
    max-width: 760px;
    margin-bottom: 20px;
    line-height: 1.55;
}

.route-message,
.empty-state {
    display: flex;
    min-height: 180px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 6px;
    color: var(--muted);
    text-align: center;
}

.empty-state strong {
    color: var(--text);
}

.alert {
    margin: 14px 0;
    padding: 12px 14px;
    border: 1px solid;
    border-radius: 14px;
    line-height: 1.4;
}

.alert-error {
    border-color: rgba(251, 92, 104, .35);
    background: rgba(251, 92, 104, .1);
    color: #fecdd3;
}

.alert-warning {
    border-color: rgba(250, 204, 21, .3);
    background: rgba(250, 204, 21, .08);
    color: #fef08a;
}

.alert-success {
    border-color: rgba(57, 229, 140, .3);
    background: rgba(57, 229, 140, .08);
    color: #bbf7d0;
}

.auth-shell {
    display: grid;
    min-height: 100dvh;
    place-items: center;
    padding: calc(24px + var(--safe-top)) max(18px, var(--safe-right)) calc(24px + var(--safe-bottom)) max(18px, var(--safe-left));
    background:
        radial-gradient(circle at 50% 12%, rgba(0, 124, 175, .24), transparent 40%),
        linear-gradient(165deg, var(--ink-950), var(--ink-900) 70%);
}

.login-card {
    width: min(100%, 410px);
    padding: 26px;
    border: 1px solid var(--line);
    border-radius: 26px;
    background: rgba(16, 16, 68, .94);
    box-shadow: 0 30px 80px rgba(0, 0, 0, .35);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
}

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

.login-brand p {
    color: #ff954f;
    font-size: .7rem;
    font-weight: 850;
    letter-spacing: .16em;
}

.login-brand h1 {
    margin-top: 2px;
    font-size: 1.75rem;
}

.field {
    margin: 16px 0;
}

.field label {
    display: block;
    margin-bottom: 7px;
    color: #cbd5e1;
    font-size: .82rem;
    font-weight: 700;
}

.field input,
.field textarea,
.field select,
.code-editor {
    width: 100%;
    min-height: 46px;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(2, 8, 23, .68);
}

.proposal-editor {
    min-height: 330px;
}

.rule-regression {
    margin-top: 18px;
}

.responsive-table {
    margin-top: 12px;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 12px;
}

.responsive-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: .7rem;
}

.responsive-table th,
.responsive-table td {
    padding: 9px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    white-space: nowrap;
}

.responsive-table th {
    color: var(--muted);
    font-size: .62rem;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.responsive-table tbody tr:last-child td {
    border-bottom: 0;
}

.field input:focus,
.field textarea:focus,
.code-editor:focus {
    border-color: rgba(57, 229, 140, .65);
}

.remember-session-copy {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.remember-session-copy strong {
    color: #cbd5e1;
    font-size: .82rem;
    line-height: 1.35;
}

.remember-session-copy small {
    margin: 0;
    color: var(--muted);
    font-size: .7rem;
    font-weight: 400;
    line-height: 1.4;
}

.persistent-session-note {
    margin: 2px 0 14px;
    padding: 10px 12px;
    border: 1px solid rgba(57, 229, 140, .22);
    border-radius: 12px;
    background: rgba(57, 229, 140, .06);
}

.field small,
.security-note {
    display: block;
    margin-top: 7px;
    font-size: .7rem;
    line-height: 1.4;
}

.validation-message {
    color: #fda4af;
    font-size: .72rem;
}

.login-card .primary-button {
    margin-top: 8px;
}

.login-card .security-note {
    margin-top: 18px;
    text-align: center;
}

/* Scanner */
.scanner-page {
    width: min(100%, 980px);
    margin: 0 auto;
    padding: 6px max(5px, var(--safe-right)) 24px max(5px, var(--safe-left));
    overflow: hidden;
}

.scanner-meta {
    display: flex;
    min-height: 30px;
    align-items: center;
    gap: 6px;
    padding: 0 3px 6px;
    overflow-x: auto;
    scrollbar-width: none;
}

.scanner-meta span,
.scanner-meta a {
    flex: 0 0 auto;
    padding: 4px 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    font-size: .65rem;
    text-decoration: none;
}

.connection-pill.online {
    border-color: rgba(57, 229, 140, .25);
    color: #86efac;
}

.connection-pill.offline {
    border-color: rgba(251, 146, 60, .28);
    color: #fdba74;
}

.camera-stage {
    position: relative;
    height: clamp(380px, 62dvh, 640px);
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, .22);
    border-radius: 18px;
    background: #000;
    box-shadow: 0 16px 45px rgba(0, 0, 0, .28);
    isolation: isolate;
}

.camera-host,
.camera-host > * {
    width: 100% !important;
    height: 100% !important;
}

.zxing-camera-view {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;
    /* Optical pixels stay absolute. Informational overlays share real rows,
       so an OCR progress message cannot cover the audio recovery action. */
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto auto;
}

.zxing-camera-video,
.zxing-camera-overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.zxing-camera-video {
    object-fit: cover;
}

.zxing-camera-overlay {
    z-index: 2;
    pointer-events: none;
}

.zxing-camera-tip {
    position: absolute;
    z-index: 3;
    top: 9px;
    left: 9px;
    max-width: calc(100% - 18px);
    padding: 6px 9px;
    border: 1px solid rgba(148, 163, 184, .32);
    border-radius: 10px;
    background: rgba(2, 6, 23, .72);
    color: #e2e8f0;
    font-size: .69rem;
    text-align: center;
    pointer-events: none;
    backdrop-filter: blur(6px);
}

.scanner-audio-status {
    position: relative;
    z-index: 4;
    grid-row: 3;
    margin: 0 9px 9px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 11px;
    border: 1px solid #facc15;
    border-radius: 10px;
    background: rgba(2, 6, 23, .94);
    color: #fff5ce;
    font-size: .8rem;
    line-height: 1.25;
    overflow-wrap: anywhere;
}
.scanner-audio-status[hidden], .scanner-audio-status button[hidden] { display: none; }
.scanner-audio-status[data-audio-state="available"] { border-color: #94a3b8; color: #e2e8f0; }
.scanner-audio-status[data-audio-state="disabled"] { border-color: #64748b; color: #cbd5e1; }
.scanner-audio-status[data-audio-presentation="notice"] { border-color: #64748b; color: #cbd5e1; }
.scanner-audio-status[data-audio-presentation="compact"] {
    justify-self: end;
    padding: 0;
    border: 0;
    background: transparent;
}
.scanner-audio-status[data-audio-presentation="compact"] span {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}
.scanner-audio-status span { flex: 1; min-width: 0; }
.scanner-audio-status button {
    flex: 0 0 auto;
    max-width: 45%;
    min-height: 44px;
    padding: 7px 10px;
    border: 1px solid #facc15;
    border-radius: 8px;
    background: #27384a;
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}
.scanner-audio-status button:focus-visible { outline: 3px solid #56c8ef; outline-offset: 2px; }
.scanner-audio-status button:disabled { opacity: .65; cursor: wait; }
.scanner-audio-status[data-audio-presentation="compact"] button {
    max-width: none;
    border-color: #64748b;
    background: rgba(2, 6, 23, .88);
    font-size: .72rem;
    font-weight: 600;
}

.camera-activation,
.camera-error {
    position: absolute;
    z-index: 5;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 25px;
    background: radial-gradient(circle, #12243c, #020817 74%);
    text-align: center;
}

.camera-activation h2,
.camera-error strong {
    margin: 16px 0 7px;
}

.camera-activation p,
.camera-error span,
.camera-error small {
    max-width: 420px;
    color: var(--muted);
    line-height: 1.4;
}

.camera-activation .primary-button {
    margin-top: 8px;
}

.camera-browser-fallback {
    margin-top: 14px;
    text-decoration: none;
}

.scanner-target {
    width: 96px;
    height: 64px;
    border: 2px solid var(--green);
    border-right-color: transparent;
    border-left-color: transparent;
    border-radius: 12px;
    opacity: .7;
}

.scan-status {
    display: flex;
    min-height: 36px;
    align-items: center;
    gap: 9px;
    margin-top: 6px;
    padding: 7px 10px;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 12px;
    background: var(--ink-850);
    font-size: .74rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 12px currentColor;
}

.status-review .status-dot,
.status-offlinequeued .status-dot,
.status-duplicate .status-dot,
.status-carrierconflict .status-dot {
    background: var(--orange);
}

.status-error .status-dot,
.status-rejected .status-dot,
.status-invalidrequest .status-dot {
    background: var(--red);
}

.status-paused .status-dot {
    background: var(--muted);
}

.scanner-controls {
    display: grid;
    grid-auto-columns: minmax(66px, 1fr);
    grid-auto-flow: column;
    gap: 6px;
    padding: 7px 0 8px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-padding-inline: 2px;
    scroll-snap-type: inline proximity;
    scrollbar-width: none;
}

.scanner-controls::-webkit-scrollbar,
.session-counters::-webkit-scrollbar {
    display: none;
}

.control-button {
    display: flex;
    min-width: 0;
    min-height: 58px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 3px;
    padding: 5px 2px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--ink-850);
    color: #dbe5f1;
    text-decoration: none;
    scroll-snap-align: start;
}

.control-button span {
    font-size: .96rem;
    font-weight: 800;
}

.control-button small {
    max-width: 100%;
    overflow: hidden;
    color: var(--muted);
    font-size: .64rem;
    text-overflow: ellipsis;
}

.control-button.active {
    border-color: rgba(57, 229, 140, .4);
    background: rgba(57, 229, 140, .1);
    color: var(--green);
}

.difficult-label-control {
    border-color: rgba(96, 223, 236, .48);
    background: rgba(8, 124, 193, .16);
    color: #8cebf4;
}

.difficult-label-control small {
    overflow: visible;
    white-space: normal;
    line-height: 1.05;
    text-align: center;
    text-overflow: clip;
}

.result-panel {
    min-height: 77px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--ink-850);
}

.result-panel.state-captured,
.result-panel.state-saved {
    border-color: rgba(57, 229, 140, .35);
    box-shadow: inset 0 0 24px rgba(57, 229, 140, .05);
}

.empty-result {
    display: flex;
    min-height: 55px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: var(--muted);
    font-size: .76rem;
}

.empty-result strong {
    color: #dbe5f1;
    font-size: .9rem;
}

.candidate-card {
    display: grid;
    align-items: center;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 10px 11px;
    border-left: 3px solid var(--yellow);
    border-radius: 10px;
    background: rgba(2, 8, 23, .5);
}

.candidate-card + .candidate-card {
    margin-top: 7px;
}

.candidate-card > div span,
.candidate-card > div strong,
.candidate-card > div small {
    display: block;
}

.candidate-card > div strong {
    overflow-wrap: anywhere;
    font-size: clamp(1rem, 4.3vw, 1.1rem);
    letter-spacing: .02em;
}

.candidate-card > div small {
    color: var(--muted);
}

.candidate-accepted {
    border-left-color: var(--green);
}

.candidate-pending {
    border-left-color: var(--yellow);
    background: rgba(250, 204, 21, .07);
}

.candidate-queued {
    border-left-color: var(--orange);
    background: rgba(251, 146, 60, .07);
}

.candidate-review,
.candidate-duplicate {
    border-left-color: var(--orange);
}

.carrier-label {
    color: var(--green);
    font-size: .62rem;
    font-weight: 850;
    letter-spacing: .08em;
}

.candidate-score {
    color: var(--muted);
    font-size: .7rem;
}

.candidate-card .review-button {
    grid-column: 1 / -1;
    min-height: 48px;
    font-size: .8rem;
}

.session-counters {
    display: grid;
    grid-auto-columns: minmax(74px, 1fr);
    grid-auto-flow: column;
    gap: 4px;
    padding-top: 8px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: inline proximity;
    scrollbar-width: none;
}

.session-counters div {
    min-width: 0;
    padding: 7px 2px;
    border: 1px solid var(--line);
    border-radius: 10px;
    text-align: center;
    scroll-snap-align: start;
}

.session-counters strong,
.session-counters span {
    display: block;
}

.session-counters strong {
    color: #dbe5f1;
    font-size: .9rem;
}

.session-counters span {
    overflow: hidden;
    color: var(--muted);
    font-size: .6rem;
    text-overflow: ellipsis;
}

/* Lists and cards */
.recent-list,
.queue-list,
.pattern-grid {
    display: grid;
    gap: 10px;
}

.recent-card {
    display: grid;
    align-items: center;
    grid-template-columns: 40px minmax(0, 1fr) auto;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: var(--ink-850);
}

.recent-icon {
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    border-radius: 12px;
    background: rgba(57, 229, 140, .1);
    color: var(--green);
    font-size: .72rem;
    font-weight: 900;
}

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

.recent-main strong,
.recent-main small,
.recent-main span {
    display: block;
}

.recent-main strong {
    overflow: hidden;
    text-overflow: ellipsis;
}

.recent-main small,
.recent-meta time {
    color: var(--muted);
    font-size: .65rem;
}

.recent-meta {
    display: flex;
    align-items: end;
    flex-direction: column;
    gap: 5px;
}

.record-status {
    padding: 3px 7px;
    border-radius: 999px;
    background: rgba(57, 229, 140, .1);
    color: #86efac;
    font-size: .58rem;
    font-weight: 800;
}

.recent-thumbnail {
    width: 100%;
    max-height: 180px;
    grid-column: 1 / -1;
    border-radius: 10px;
    object-fit: cover;
}

.skeleton-list {
    display: grid;
    gap: 10px;
}

.skeleton-list span {
    height: 70px;
    border-radius: 15px;
    background: linear-gradient(90deg, var(--ink-850), var(--ink-800), var(--ink-850));
    background-size: 200% 100%;
    animation: skeleton 1.2s linear infinite;
}

@keyframes skeleton {
    to { background-position: -200% 0; }
}

.queue-overview,
.package-queue-overview,
.diagnostic-summary,
.benchmark-metrics {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.queue-overview div,
.package-queue-overview div,
.diagnostic-summary div,
.benchmark-metrics div {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--ink-850);
}

.queue-overview strong,
.queue-overview span,
.package-queue-overview strong,
.package-queue-overview span,
.diagnostic-summary strong,
.diagnostic-summary span,
.benchmark-metrics strong,
.benchmark-metrics span {
    display: block;
}

.queue-overview strong,
.package-queue-overview strong,
.benchmark-metrics strong {
    font-size: 1.15rem;
}

.queue-overview span,
.package-queue-overview span,
.diagnostic-summary span,
.benchmark-metrics span {
    color: var(--muted);
    font-size: .67rem;
}

.queue-card,
.pattern-card,
.debug-candidate {
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: var(--ink-850);
}

.debug-rule-columns {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.debug-rule-columns > div {
    min-width: 0;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(2, 8, 23, .35);
}

.debug-rule-columns h3 {
    margin: 0 0 8px;
    font-size: .76rem;
}

.debug-rule-columns ul {
    margin: 0;
    padding-left: 18px;
}

.debug-rule-columns li,
.debug-rule-columns .muted {
    font-size: .68rem;
    line-height: 1.45;
}

.queue-card header,
.queue-card footer,
.pattern-card header,
.debug-candidate header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.queue-card header span,
.pattern-card header span,
.debug-candidate header span {
    color: var(--orange);
    font-size: .68rem;
    text-transform: uppercase;
}

.queue-tracking {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 0;
    border-bottom: 1px solid var(--line);
}

.queue-tracking span,
.queue-card small {
    color: var(--muted);
    font-size: .7rem;
}

.queue-card footer {
    padding-top: 9px;
}

.queue-error {
    margin: 9px 0 0;
    color: #fda4af;
    font-size: .72rem;
}

/* Settings/admin */
.settings-group {
    margin-bottom: 16px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--ink-850);
}

.settings-group h2 {
    margin-bottom: 14px;
}

.toggle-row {
    display: flex;
    min-height: 58px;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    border-bottom: 1px solid var(--line);
}

.toggle-row span strong,
.toggle-row span small {
    display: block;
}

.toggle-row span small {
    margin-top: 3px;
    color: var(--muted);
    font-size: .7rem;
}

.toggle-row input {
    width: 22px;
    height: 22px;
    accent-color: var(--green);
}

.settings-list,
.pattern-card dl,
.debug-candidate dl {
    margin: 0;
}

.settings-list div,
.pattern-card dl div,
.debug-candidate dl div {
    display: grid;
    grid-template-columns: minmax(110px, 1fr) 2fr;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
}

dt {
    color: var(--muted);
    font-size: .72rem;
}

dd {
    margin: 0;
    overflow-wrap: anywhere;
    font-size: .78rem;
}

.admin-grid {
    display: grid;
    gap: 16px;
}

.admin-nav {
    display: flex;
    gap: 6px;
    margin: -7px 0 18px;
    padding-bottom: 5px;
    overflow-x: auto;
    scrollbar-width: none;
}

.admin-nav a {
    flex: 0 0 auto;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    font-size: .7rem;
    text-decoration: none;
}

.admin-nav a.active {
    border-color: rgba(57, 229, 140, .35);
    background: rgba(57, 229, 140, .08);
    color: var(--green);
}

.code-editor {
    min-height: 430px;
    resize: vertical;
    color: #c8facc;
    font: .72rem/1.5 ui-monospace, SFMono-Regular, Consolas, monospace;
    tab-size: 2;
}

.button-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 12px;
}

.rule-test-result,
.diagnostic-json {
    margin-top: 14px;
    padding: 12px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--ink-950);
    font-size: .74rem;
}

.rule-test-result strong,
.rule-test-result span {
    display: block;
}

.rule-test-result span {
    margin-top: 4px;
    color: var(--muted);
}

.pattern-card ul,
.debug-candidate p {
    color: var(--muted);
    font-size: .72rem;
    line-height: 1.5;
}

.debug-candidate + .debug-candidate {
    margin-top: 10px;
}

.diagnostic-json {
    max-height: 520px;
    margin: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.benchmark-camera {
    height: min(48dvh, 500px);
    margin-bottom: 12px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #000;
}

.benchmark-camera > * {
    width: 100% !important;
    height: 100% !important;
}

.benchmark-cases {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.benchmark-cases span {
    padding: 6px 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: #cbd5e1;
    font-size: .7rem;
}

#blazor-error-ui {
    position: fixed;
    z-index: 1000;
    right: 12px;
    bottom: calc(var(--nav-height) + var(--safe-bottom) + 12px);
    left: 12px;
    display: none;
    padding: 12px 36px 12px 14px;
    border: 1px solid rgba(251, 92, 104, .45);
    border-radius: 14px;
    background: #3b1119;
    box-shadow: 0 15px 40px rgba(0, 0, 0, .35);
    color: #fecdd3;
}

#blazor-error-ui .dismiss {
    position: absolute;
    top: 7px;
    right: 10px;
    cursor: pointer;
}

.loading-screen {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    background: var(--ink-950);
}

.loading-brand {
    display: flex;
    align-items: center;
    flex-direction: column;
    gap: 12px;
    color: var(--muted);
    font-size: .75rem;
    letter-spacing: .08em;
}

.loading-ring {
    width: 42px;
    height: 42px;
    border: 3px solid rgba(148, 163, 184, .18);
    border-top-color: var(--brand-orange);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@media (min-width: 720px) {
    :root {
        --nav-height: 0px;
    }

    .app-shell {
        padding-left: 88px;
    }

    .app-header {
        padding-left: 18px;
    }

    .app-nav {
        top: 0;
        right: auto;
        width: 88px;
        min-height: 100dvh;
        grid-template-columns: 1fr;
        grid-template-rows: repeat(7, 68px);
        align-content: center;
        padding: calc(12px + var(--safe-top)) 8px calc(12px + var(--safe-bottom)) calc(8px + var(--safe-left));
        border-top: 0;
        border-right: 1px solid var(--line);
    }

    .app-content {
        padding-bottom: 0;
    }

    .scanner-controls {
        grid-auto-flow: initial;
        grid-template-columns: repeat(7, minmax(0, 1fr));
        overflow: visible;
    }

    .session-counters {
        grid-auto-flow: initial;
        grid-template-columns: repeat(6, minmax(0, 1fr));
        overflow: visible;
    }

    .scanner-page {
        padding-top: 12px;
    }

    .camera-stage {
        height: min(57dvh, 610px);
    }

    .queue-overview,
    .package-queue-overview,
    .diagnostic-summary,
    .benchmark-metrics {
        grid-template-columns: repeat(4, 1fr);
    }

    .admin-grid {
        grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr);
        align-items: start;
    }

    .debug-rule-columns {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .pattern-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 719px) {
    .scanner-controls {
        grid-auto-flow: row;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        overflow: visible;
    }
}

@media (min-width: 1050px) {
    .recent-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .benchmark-metrics {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (max-height: 700px) and (max-width: 719px) {
    .camera-stage {
        height: clamp(320px, 56dvh, 400px);
        min-height: 320px;
    }

    .scanner-controls {
        padding: 5px 0;
    }

    .control-button {
        min-height: 48px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}

.reception-strip { display:flex; justify-content:space-between; gap:12px; padding:14px; margin:10px 0;
    border:1px solid var(--green); border-radius:14px; background:rgba(57,229,140,.07); text-decoration:none; color:inherit; }
.reception-strip span { min-width:0; }
.reception-strip strong, .reception-strip small { display:block; overflow-wrap:anywhere; }
.reception-strip small, .reception-hint { color:var(--muted); font-size:.75rem; }
.reception-hint { display:block; text-align:center; padding:14px; }
.reception-summary-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(230px,1fr)); gap:12px; }
.reception-summary-grid small { display:block; }
.reception-total { display:block; font-size:2rem; margin:10px 0; }
.reception-list { display:grid; gap:14px; }
.arrival-active { border-color:var(--green); }
.reception-numbers { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; margin:18px 0; }
.reception-numbers strong { display:block; font-size:1.6rem; }
.reception-numbers small { color:var(--muted); font-size:.72rem; }
.reception-actions { display:flex; gap:10px; flex-wrap:wrap; margin:12px 0; }
.reception-package { display:flex; gap:10px; padding:12px 0; border-bottom:1px solid var(--line); overflow-wrap:anywhere; }
.reception-package small { display:block; color:var(--muted); }
.reception-package input { width:22px; flex-shrink:0; }
.reception-detail { margin-top:20px; }
.reception-page summary { cursor:pointer; padding:8px 0; }
.reception-page select, .reception-page input:not([type=checkbox]) {
    width:100%; min-height:44px; margin:8px 0; padding:10px 12px; border:1px solid var(--line);
    border-radius:10px; background:var(--surface, #0c1726); color:var(--text, #f4f7fc); font:inherit; color-scheme:dark;
}
.reception-page h2, .reception-page small { overflow-wrap:anywhere; }
.reception-package > div { min-width:0; }

/* Fast package intake */
.package-intake-page { max-width:980px; }
.intake-steps { display:flex; gap:6px; margin:16px 0; }
.intake-steps button { flex:1; min-height:46px; padding:8px 4px; background:var(--surface); border:1px solid var(--line); border-radius:12px; color:var(--muted); font:inherit; font-size:.8rem; }
.intake-steps button.active { color:white; background:rgba(255,77,10,.18); border-color:var(--brand-orange); }
.package-section[hidden] { display:none!important; }
.intake-camera-wizard { grid-template-columns:minmax(0,1fr)!important; }
.intake-camera .scanner-page { padding:0; min-height:0; }
.intake-camera .camera-stage { height:clamp(320px,52svh,640px); min-height:320px; }
.package-intake-page .section-intro { font-size:.82rem; margin-bottom:8px; }
.intake-global-photo { padding:14px; border:1px dashed var(--brand-orange); border-radius:12px; }
.intake-global-photo p { font-size:.82rem; color:var(--muted); }
.intake-camera .scanner-meta .queue-pill,.intake-camera .scanner-controls a { display:none; }
.intake-camera .result-panel { min-height:0; margin-bottom:12px; }
.intake-camera .scanner-controls { overflow-x:auto; }
.package-scan-mode { display:flex; align-items:center; gap:10px; margin:10px 0; flex-wrap:wrap; }
.package-scan-mode .secondary-button { min-height:40px; }
.package-scan-mode small { color:var(--muted); font-size:.78rem; }
.intake-tracking-list { display:grid; gap:10px; margin:14px 0; max-height:380px; overflow-y:auto; }
.intake-tracking { display:grid; grid-template-columns:56px minmax(0,1fr) auto; align-items:center; gap:8px; padding:10px; border:1px solid var(--line); border-radius:14px; background:rgba(8,124,193,.08); }
.intake-tracking img,.intake-photo-placeholder { width:56px; height:64px; object-fit:cover; border-radius:8px; background:rgba(255,255,255,.07); }
.intake-photo-placeholder { display:grid; place-items:center; color:var(--brand-orange); font-size:1.8rem; }
.intake-tracking strong { display:block; overflow-wrap:anywhere; font-size:.85rem; }
.intake-tracking small { display:block; color:var(--muted); margin-top:5px; }
.intake-tracking .icon-button { font-size:.75rem; min-height:44px; }
.intake-photo-upload { grid-column:2 / -1; position:relative; overflow:hidden; min-height:36px; display:flex; align-items:center; color:var(--brand-link); font-size:.8rem; cursor:pointer; }
.intake-photo-upload input { position:absolute; inset:0; opacity:0; width:100%; cursor:pointer; }
.intake-photo-actions { grid-column:2 / -1; display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.intake-photo-actions .intake-photo-upload { grid-column:auto; padding:8px 10px; border:1px solid var(--brand-link); border-radius:9px; }
button.intake-photo-upload { border:1px solid var(--brand-link); background:transparent; border-radius:9px; padding:8px 10px; font:inherit; }
.pending-tracking-error { display:block; max-width:100%; color:#ffd2cd!important; overflow-wrap:anywhere; }
.intake-search { width:100%; min-height:46px; border-radius:12px; border:1px solid var(--line); background:rgba(2,8,23,.68); color:var(--text); padding:10px; font:inherit; }
.intake-content-results { display:grid; gap:7px; max-height:240px; overflow:auto; padding:3px; }
.intake-content-results label:has(input:checked) { border-color:var(--brand-orange); background:rgba(255,77,10,.1); }
.intake-summary { display:grid; gap:9px; padding:14px; margin-bottom:15px; background:rgba(8,124,193,.1); border:1px solid var(--line); border-radius:12px; overflow-wrap:anywhere; }
.intake-summary span,.intake-summary small { color:var(--muted); }
.intake-weight-review { display:grid; gap:4px; min-width:0; padding:12px; border:1px solid var(--brand-link); border-radius:10px; background:rgba(8,124,193,.12); }
.intake-weight-review strong { color:var(--text); font-size:clamp(1.5rem,6vw,2rem); line-height:1.2; font-variant-numeric:tabular-nums; }
.package-step { flex:none; padding:7px 10px; border:1px solid rgba(255,77,10,.4); border-radius:999px; color:#ff9a61; font-size:.72rem; font-weight:800; }
.package-wizard { display:grid; gap:14px; }
.package-section { margin:0; }
.package-section > header { display:flex; align-items:center; gap:11px; margin-bottom:14px; }
.package-section > header > span { display:grid; width:34px; height:34px; flex:none; place-items:center; border-radius:11px; background:linear-gradient(135deg,var(--brand-orange),#ff8b45); color:#08043f; font-weight:900; }
.package-section h2,.package-section header small { margin:0; }
.package-section header small { color:var(--muted); }
.tracking-add-row { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:8px; }
.tracking-add-row input { width:100%; min-width:0; min-height:46px; padding:11px 12px; border:1px solid var(--line); border-radius:12px; background:rgba(2,8,23,.68); color:var(--text); font:inherit; }
.tracking-chip-list { display:flex; flex-wrap:wrap; gap:7px; margin-top:10px; }
.tracking-chip-list button { max-width:100%; min-height:44px; padding:7px 9px; overflow-wrap:anywhere; border:1px solid rgba(8,124,193,.45); border-radius:12px; background:rgba(8,124,193,.12); color:#dbeafe; font:inherit; font-size:.72rem; }
.tracking-chip-list button span { color:#ff9a61; font-size:1rem; }
.evidence-ready { margin-top:11px; padding:10px; border:1px solid rgba(57,229,140,.3); border-radius:11px; background:rgba(57,229,140,.08); color:#bbf7d0; font-size:.78rem; }
.locker-results { display:grid; gap:7px; margin-top:10px; }
.locker-results button { display:flex; align-items:flex-start; flex-direction:column; gap:2px; width:100%; padding:11px; border:1px solid var(--line); border-radius:11px; background:rgba(2,8,23,.5); color:var(--text); text-align:left; }
.locker-results button:hover { border-color:var(--brand-link); }
.locker-results span,.locker-results small,.selected-locker span { color:var(--muted); }
.selected-locker { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:13px; border:1px solid rgba(57,229,140,.35); border-radius:13px; background:rgba(57,229,140,.06); }
.selected-locker strong,.selected-locker span { display:block; }
.package-field-grid { display:grid; gap:0 12px; }
.content-options { display:grid; gap:8px; margin-top:10px; padding:0; border:0; }
.content-options legend { margin-bottom:8px; color:#cbd5e1; font-size:.82rem; font-weight:700; }
.content-options label { display:flex; align-items:center; gap:9px; min-height:42px; padding:8px 10px; border:1px solid var(--line); border-radius:10px; }
.content-options input[type="checkbox"],.package-confirm input { width:21px; height:21px; flex:none; accent-color:var(--brand-orange); }
.content-options { min-width:0; }
.intake-content-dropdown { min-width:0; width:100%; }
.intake-content-dropdown summary { padding:16px; border:1px solid var(--line); border-radius:12px; cursor:pointer; font-weight:700; }
.smart-select-panel { border:1px solid var(--brand-link); border-radius:12px; padding:8px; background:var(--surface); }
.smart-select-status { font-size:.8rem; color:var(--muted); padding:6px; }
.smart-locker-options { max-height:320px; overflow:auto; display:grid; gap:5px; }
.smart-locker-options button { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:4px 10px; text-align:left; background:transparent; border:1px solid var(--line); color:var(--text); padding:12px; border-radius:9px; min-height:64px; font:inherit; cursor:pointer; }
.smart-locker-options button span { grid-column:1; font-size:.85rem; overflow-wrap:anywhere; }
.smart-locker-options button small { grid-column:2; grid-row:1 / 3; align-self:center; font-size:.7rem; color:var(--brand-link); }
.smart-locker-options button:hover,.smart-locker-options button[aria-selected="true"] { border-color:var(--brand-orange); background:rgba(255,77,10,.12); }
.smart-select-close { display:block; width:100%; border:0; padding:10px; background:transparent; color:var(--brand-link); cursor:pointer; }
.smart-locker input { font-size:16px; }
.intake-content-dropdown[open] summary { margin-bottom:12px; }
.content-options .intake-search { width:100%; min-width:0; min-height:48px; box-sizing:border-box; font-size:16px; }
.intake-content-dropdown .intake-content-results { max-height:45svh; overflow-y:auto; margin-top:12px; }
.intake-camera .empty-result span,.intake-camera .scanner-meta { display:none; }
.intake-camera .camera-activation p { display:none; }
@media(max-width:600px) {
    .package-intake-page { padding-inline:12px; }
    .package-intake-page .package-section { padding:12px; }
    .package-intake-page .selected-locker { overflow-wrap:anywhere; }
}
.package-confirm { display:flex; align-items:center; gap:10px; margin:12px 0; color:#dbe5f1; font-size:.8rem; }
.package-save-readiness { display:grid; gap:8px; margin:12px 0; padding:12px 14px; border:1px solid; border-radius:14px; outline:none; }
.package-save-readiness.ready { border-color:rgba(57,229,140,.35); background:rgba(57,229,140,.08); color:#bbf7d0; }
.package-save-readiness.blocked { border-color:rgba(250,204,21,.32); background:rgba(250,204,21,.08); color:#fef3c7; }
.package-save-readiness:focus { box-shadow:0 0 0 3px rgba(8,124,193,.4); }
.package-save-readiness strong,.package-save-readiness span { display:block; }
.package-save-readiness ul { display:grid; gap:5px; margin:0; padding-left:20px; color:#fde68a; }
.package-save-feedback { padding-top:5px; border-top:1px solid rgba(250,204,21,.2); font-weight:750; }
.package-pending-scan { display:grid; gap:8px; }
.package-save { min-height:52px; font-size:1rem; }
.save-hint { display:block; margin-top:8px; color:var(--muted); text-align:center; }
.package-success-card { padding:22px; border:1px solid rgba(57,229,140,.38); border-radius:22px; background:linear-gradient(145deg,rgba(57,229,140,.09),rgba(8,124,193,.08)); text-align:center; }
.package-success-card > span { color:#86efac; font-size:.7rem; font-weight:900; letter-spacing:.12em; }
.package-success-card > strong { display:block; margin:8px 0; color:white; font-size:clamp(1.8rem,7vw,3rem); overflow-wrap:anywhere; }
.package-pending-card { padding:22px; border:1px solid rgba(251,191,36,.5); border-radius:22px; background:linear-gradient(145deg,rgba(251,191,36,.12),rgba(8,124,193,.08)); text-align:center; }
.package-pending-card > span { color:#fde68a; font-size:.7rem; font-weight:900; letter-spacing:.12em; }
.package-pending-card > strong { display:block; margin:8px 0; color:white; font-size:clamp(1.35rem,6vw,2.35rem); overflow-wrap:anywhere; }
.package-pending-card p { color:var(--muted); max-width:42rem; margin:0 auto 14px; }
.package-pending-card .package-actions { justify-content:center; }
.package-sync-note { display:block; margin-top:10px; color:var(--muted); font-size:.78rem; }
.package-connection-badge { display:inline-flex; align-items:center; gap:6px; min-height:30px; padding:5px 10px; border:1px solid var(--line); border-radius:999px; color:var(--muted); font-size:.75rem; }
.package-connection-badge.online { border-color:rgba(57,229,140,.38); color:#86efac; }
.package-connection-badge.offline { border-color:rgba(251,191,36,.5); color:#fde68a; }
.queue-section-heading { margin-top:28px; }
.queue-package-card .queue-tracking { align-items:flex-start; }
.queue-package-card .queue-tracking strong { overflow-wrap:anywhere; }
.package-actions { display:flex; justify-content:center; flex-wrap:wrap; gap:8px; margin:18px 0; }
.package-actions a { display:inline-flex; align-items:center; justify-content:center; text-decoration:none; }
.package-print-grid { display:grid; gap:12px; margin-top:18px; text-align:left; }
.print-job { margin-top:12px; padding:10px; border-radius:10px; background:rgba(8,124,193,.12); color:#bfdbfe; }
.package-from-scan { display:inline-flex; align-items:center; justify-content:center; margin-top:8px; text-decoration:none; }
@media (min-width:720px) {
    .package-wizard { grid-template-columns:repeat(2,minmax(0,1fr)); align-items:start; }
    .package-field-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
    .package-print-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media print {
    .app-header,.app-nav,.no-print { display:none!important; }
    .app-shell { padding:0!important; }
    .reception-page,.reception-page * { color:#111!important; background:white!important; box-shadow:none!important; }
    .settings-group { break-inside:avoid; border:1px solid #aaa; }
}

/* Admin operator productivity */
.productivity-page {
    min-width: 0;
}

.productivity-definition {
    display: flex;
    align-items: flex-start;
    gap: 8px 16px;
    flex-wrap: wrap;
    margin-bottom: 14px;
    padding: 12px 14px;
    border: 1px solid rgba(57, 229, 140, .28);
    border-radius: 14px;
    background: rgba(57, 229, 140, .07);
    font-size: .78rem;
}

.productivity-definition strong {
    color: #bbf7d0;
}

.productivity-definition span,
.productivity-context,
.productivity-chart-card header span,
.productivity-roster > header span {
    color: var(--muted);
}

.productivity-filters {
    display: grid;
    min-width: 0;
    gap: 12px;
    margin-bottom: 18px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(16, 16, 68, .72);
}

.productivity-presets {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
}

.productivity-presets button {
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: rgba(2, 8, 23, .45);
    color: var(--muted);
    cursor: pointer;
}

.productivity-presets button.active {
    border-color: rgba(255, 91, 8, .55);
    background: rgba(255, 91, 8, .14);
    color: #ffd7c2;
    font-weight: 800;
}

.productivity-date-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
    align-items: end;
    gap: 8px;
}

.productivity-date-fields label,
.productivity-operator-filter {
    display: grid;
    min-width: 0;
    gap: 6px;
    color: #cbd5e1;
    font-size: .72rem;
    font-weight: 750;
}

.productivity-date-fields input,
.productivity-operator-filter select {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: rgba(2, 8, 23, .68);
    color-scheme: dark;
}

.productivity-error {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.productivity-error strong,
.productivity-error span {
    display: block;
}

.productivity-error span {
    margin-top: 3px;
    font-size: .75rem;
}

.productivity-context {
    display: flex;
    gap: 7px 14px;
    flex-wrap: wrap;
    margin: 0 2px 10px;
    font-size: .7rem;
}

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

.productivity-kpis article {
    min-width: 0;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: linear-gradient(145deg, rgba(25, 25, 79, .94), rgba(8, 124, 175, .08));
}

.productivity-kpis span,
.productivity-kpis strong,
.productivity-kpis small {
    display: block;
    overflow-wrap: anywhere;
}

.productivity-kpis span {
    min-height: 30px;
    color: var(--muted);
    font-size: .68rem;
}

.productivity-kpis strong {
    margin: 3px 0;
    font-size: clamp(1.35rem, 7vw, 2rem);
    letter-spacing: -.04em;
}

.productivity-kpis small {
    color: #7dd3fc;
    font-size: .65rem;
}

.productivity-chart-card,
.productivity-roster {
    min-width: 0;
    margin-top: 14px;
    padding: 14px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 17px;
    background: rgba(16, 16, 68, .68);
}

.productivity-chart-card > header,
.productivity-roster > header {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 13px;
}

.productivity-chart-card h2,
.productivity-roster h2 {
    margin: 0 0 3px;
}

.productivity-chart-card header span,
.productivity-roster > header span {
    font-size: .7rem;
}

.productivity-chart-card header > strong {
    color: var(--green);
    font-size: 1.35rem;
}

.productivity-chart-scroll {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
}

.productivity-chart {
    display: flex;
    min-width: min-content;
    height: 190px;
    align-items: stretch;
    gap: 5px;
    padding-top: 8px;
}

.productivity-chart-column {
    display: grid;
    width: max(22px, calc((100vw - 74px) / 8));
    max-width: 42px;
    flex: 1 0 22px;
    grid-template-rows: 18px 1fr 20px;
    text-align: center;
}

.productivity-chart-value {
    overflow: hidden;
    color: #bae6fd;
    font-size: .6rem;
    text-overflow: ellipsis;
}

.productivity-chart-track {
    display: flex;
    min-height: 120px;
    align-items: end;
    justify-content: center;
    border-bottom: 1px solid var(--line);
}

.productivity-chart-bar {
    width: min(16px, 72%);
    min-height: 3px;
    height: max(3px, calc(var(--productivity-ratio) * 100%));
    border-radius: 5px 5px 2px 2px;
    background: linear-gradient(180deg, var(--green), var(--brand-blue));
}

.productivity-chart-column time {
    padding-top: 5px;
    color: var(--muted);
    font-size: .55rem;
    white-space: nowrap;
}

.productivity-table-wrap {
    display: none;
    max-width: 100%;
    overflow-x: auto;
}

.productivity-table-wrap table {
    width: 100%;
    border-collapse: collapse;
    font-size: .72rem;
}

.productivity-table-wrap th,
.productivity-table-wrap td {
    padding: 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    white-space: nowrap;
}

.productivity-table-wrap th {
    color: var(--muted);
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
}

.productivity-table-wrap td small {
    color: var(--muted);
}

.productivity-operator-cards {
    display: grid;
    gap: 9px;
}

.productivity-operator-card {
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(2, 8, 23, .34);
}

.productivity-operator-card > header {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 10px;
}

.productivity-operator-card > header > strong {
    color: var(--green);
    font-size: 1.45rem;
}

.productivity-operator-card dl {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 12px 0;
}

.productivity-operator-card dl div {
    padding: 8px;
    border-radius: 9px;
    background: rgba(25, 25, 79, .62);
}

.productivity-operator-card dt,
.productivity-operator-card dd {
    display: block;
}

.productivity-operator-card dd {
    margin-top: 3px;
    color: var(--text);
    font-weight: 800;
}

.productivity-operator-card > small {
    color: var(--muted);
    font-size: .65rem;
}

.productivity-operator-identity {
    min-width: 0;
}

.productivity-operator-identity strong,
.productivity-operator-identity span,
.productivity-operator-identity small {
    display: block;
    overflow-wrap: anywhere;
}

.productivity-operator-identity span,
.productivity-operator-identity small {
    margin-top: 2px;
    color: var(--muted);
    font-size: .65rem;
}

.productivity-no-activity {
    opacity: .68;
}

@media (max-width: 430px) {
    .productivity-heading {
        align-items: center;
    }

    .productivity-date-fields {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .productivity-date-fields .primary-button {
        grid-column: 1 / -1;
        width: 100%;
    }

    .productivity-error {
        align-items: stretch;
        flex-direction: column;
    }
}

@media (min-width: 720px) {
    .productivity-filters {
        grid-template-columns: minmax(250px, .7fr) minmax(360px, 1fr);
        align-items: end;
    }

    .productivity-operator-filter {
        grid-column: 1 / -1;
    }

    .productivity-kpis {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .productivity-kpis span {
        min-height: 0;
    }

    .productivity-chart-column {
        width: max(25px, calc((100vw - 160px) / 16));
    }

    .productivity-table-wrap {
        display: block;
    }

    .productivity-operator-cards {
        display: none;
    }
}

@media (min-width: 1000px) {
    .productivity-filters {
        grid-template-columns: 280px minmax(390px, 1fr) minmax(210px, .65fr);
    }

    .productivity-operator-filter {
        grid-column: auto;
    }
}
.manifest-snapshot { position:absolute; inset:0; z-index:1; width:100%; height:100%; object-fit:contain; background:#080d20; pointer-events:none; }
.live-ocr-status { position:relative; grid-row:2; z-index:4; margin:0 9px 8px; padding:8px 10px; border:1px solid #64748b; border-radius:10px; background:rgba(3,18,29,.94); color:#e2e8f0; font-size:.8rem; line-height:1.35; overflow-wrap:anywhere; pointer-events:none; }
.live-ocr-status[hidden] { display:none; }
