.reader-hero {
    background: linear-gradient(180deg, #f6faf8 0%, #eef4f1 100%);
    padding: 4rem 2rem 3rem;
}

.reader-container {
    max-width: 1180px;
    margin: 0 auto;
}

.reader-hero [hidden],
.barcode-details-section [hidden] {
    display: none !important;
}

.reader-hero-copy {
    max-width: 780px;
    margin: 0 auto 2rem;
    text-align: center;
}

.reader-badge,
.reader-engine-pill,
.result-state {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    border-radius: 999px;
    font-weight: 700;
}

.reader-badge {
    margin-bottom: 1rem;
    padding: 0.45rem 0.85rem;
    background: rgba(1, 155, 95, 0.1);
    color: var(--primary-green);
    font-size: 0.95rem;
}

.reader-badge .material-symbols-outlined {
    font-size: 20px;
}

.reader-hero-copy h1 {
    font-size: clamp(2.35rem, 5vw, 4rem);
    line-height: 1.08;
    letter-spacing: 0;
    margin-bottom: 1rem;
}

.reader-hero-copy p {
    max-width: 680px;
    margin: 0 auto;
    color: var(--text-muted);
    font-size: 1.125rem;
}

.reader-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1.18fr) minmax(320px, 0.82fr);
    gap: 1rem;
    align-items: stretch;
    min-width: 0;
}

.reader-panel {
    background: #fff;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    box-shadow: 0 14px 34px rgba(16, 24, 40, 0.08);
    padding: 1.25rem;
    min-width: 0;
}

.reader-panel-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.reader-kicker {
    color: var(--primary-green);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0;
    margin-bottom: 0.2rem;
    text-transform: uppercase;
}

.reader-panel h2,
.details-heading h2 {
    font-size: 1.35rem;
    line-height: 1.2;
    margin: 0;
}

.reader-engine-pill {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
    font-size: 0.8rem;
    padding: 0.35rem 0.65rem;
    white-space: nowrap;
}

.reader-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.reader-tab,
.reader-btn {
    border: 1px solid var(--border-light);
    border-radius: 8px;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.reader-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 46px;
    padding: 0.65rem 0.85rem;
    background: #f8fafc;
    color: #334155;
}

.reader-tab:hover,
.reader-tab.active {
    background: #ecfdf5;
    border-color: rgba(1, 155, 95, 0.45);
    color: var(--primary-dark);
}

.reader-tab:focus,
.reader-btn:focus,
.dropzone:focus {
    outline: none;
    box-shadow: var(--focus-ring);
}

.reader-mode-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.camera-frame {
    position: relative;
    min-height: 360px;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid #d6dde5;
    background: #0f172a;
}

.camera-frame video,
.upload-preview-wrap img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

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

.camera-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 2rem;
    background: linear-gradient(145deg, #111827 0%, #1f2937 100%);
    color: #dbeafe;
    text-align: center;
}

.camera-placeholder.is-hidden {
    opacity: 0;
    pointer-events: none;
}

.camera-placeholder .material-symbols-outlined {
    color: #86efac;
    font-size: 54px;
}

.camera-placeholder p {
    max-width: 340px;
    color: #d1d5db;
}

.camera-reticle {
    position: absolute;
    inset: 16%;
    pointer-events: none;
}

.camera-reticle span {
    position: absolute;
    width: 42px;
    height: 42px;
    border-color: #86efac;
    border-style: solid;
}

.camera-reticle span:nth-child(1) {
    top: 0;
    left: 0;
    border-width: 3px 0 0 3px;
}

.camera-reticle span:nth-child(2) {
    top: 0;
    right: 0;
    border-width: 3px 3px 0 0;
}

.camera-reticle span:nth-child(3) {
    right: 0;
    bottom: 0;
    border-width: 0 3px 3px 0;
}

.camera-reticle span:nth-child(4) {
    left: 0;
    bottom: 0;
    border-width: 0 0 3px 3px;
}

.reader-actions,
.result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.reader-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 44px;
    padding: 0.7rem 1rem;
}

.reader-btn-primary {
    background: var(--primary-green);
    border-color: var(--primary-green);
    color: #fff;
}

.reader-btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
}

.reader-btn-secondary {
    background: #fff;
    color: #1f2937;
}

.reader-btn-secondary:hover:not(:disabled) {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.reader-btn:disabled {
    cursor: not-allowed;
    opacity: 0.58;
}

.reader-status {
    min-height: 1.5rem;
    color: var(--text-muted);
    font-size: 0.94rem;
}

.reader-status.success {
    color: #047857;
}

.reader-status.error {
    color: #b91c1c;
}

.dropzone {
    position: relative;
    display: flex;
    min-height: 292px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 2rem;
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
    text-align: center;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.dropzone:hover,
.dropzone.drag-over {
    background: #f0fdf4;
    border-color: var(--primary-green);
}

.dropzone .material-symbols-outlined {
    color: var(--primary-green);
    font-size: 52px;
}

.dropzone h3 {
    font-size: 1.15rem;
    margin: 0;
}

.dropzone p {
    max-width: 380px;
    margin: 0;
    color: var(--text-muted);
}

.reader-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    opacity: 0;
    pointer-events: none;
}

.upload-preview-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.75rem;
    align-items: center;
}

.upload-preview-wrap img {
    max-height: 260px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: #f8fafc;
}

.result-panel {
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.result-state {
    background: #f1f5f9;
    color: #475569;
    font-size: 0.78rem;
    padding: 0.35rem 0.7rem;
    white-space: nowrap;
}

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

.result-empty {
    display: flex;
    flex: 1;
    min-height: 260px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: #f8fafc;
    color: var(--text-muted);
    text-align: center;
    padding: 2rem;
}

.result-empty .material-symbols-outlined {
    color: #94a3b8;
    font-size: 54px;
}

.result-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.result-value-block {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.result-value-block label {
    color: #475569;
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
}

.result-value-block pre {
    min-height: 132px;
    max-height: 230px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    border: 1px solid #d6dde5;
    border-radius: 8px;
    background: #0f172a;
    color: #f8fafc;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.92rem;
    line-height: 1.55;
    padding: 1rem;
}

.result-facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
}

.result-fact {
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: #f8fafc;
    padding: 0.75rem;
}

.result-fact span {
    display: block;
    color: #64748b;
    font-size: 0.74rem;
    font-weight: 800;
    text-transform: uppercase;
}

.result-fact strong {
    display: block;
    margin-top: 0.2rem;
    color: #111827;
    font-size: 0.96rem;
    line-height: 1.25;
}

.barcode-details-section {
    padding: 3.5rem 2rem;
    background: #fff;
}

.details-heading {
    display: grid;
    grid-template-columns: minmax(0, 0.85fr) minmax(280px, 0.65fr);
    gap: 2rem;
    align-items: end;
    margin-bottom: 1.5rem;
}

.details-heading p:last-child {
    color: var(--text-muted);
}

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

.detail-card,
.gs1-fields-panel,
.reader-info-grid article {
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: #fff;
}

.detail-card {
    padding: 1.1rem;
}

.detail-card h3,
.gs1-fields-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 0.9rem;
    font-size: 1rem;
}

.detail-card h3 .material-symbols-outlined {
    color: var(--primary-green);
    font-size: 22px;
}

.detail-card dl {
    display: grid;
    gap: 0.55rem;
}

.detail-row {
    display: grid;
    grid-template-columns: minmax(130px, 0.42fr) minmax(0, 1fr);
    gap: 0.75rem;
    align-items: baseline;
    padding-bottom: 0.55rem;
    border-bottom: 1px solid #eef2f7;
}

.detail-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.detail-row dt {
    color: #64748b;
    font-size: 0.82rem;
    font-weight: 800;
}

.detail-row dd {
    min-width: 0;
    color: #111827;
    overflow-wrap: anywhere;
}

.detail-row code,
.gs1-field-value code {
    border-radius: 6px;
    background: #f1f5f9;
    color: #0f172a;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.88rem;
    padding: 0.1rem 0.28rem;
}

.detail-muted {
    color: var(--text-muted);
}

.gs1-fields-panel {
    margin-top: 1rem;
    overflow: hidden;
}

.gs1-fields-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.1rem;
    border-bottom: 1px solid var(--border-light);
    background: #f8fafc;
}

.gs1-fields-header h3 {
    margin: 0;
}

.gs1-fields-header span {
    min-width: 2rem;
    border-radius: 999px;
    background: var(--primary-green);
    color: #fff;
    font-size: 0.82rem;
    font-weight: 800;
    padding: 0.2rem 0.55rem;
    text-align: center;
}

.gs1-fields-list {
    display: grid;
    gap: 0.85rem;
    padding: 1rem;
}

.gs1-field {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
}

.gs1-field-title {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: baseline;
    margin-bottom: 0.65rem;
}

.gs1-field-title strong {
    color: var(--primary-dark);
}

.gs1-field-title span {
    color: #475569;
    font-weight: 700;
}

.gs1-field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem 1rem;
}

.gs1-field-value {
    min-width: 0;
}

.gs1-field-value span {
    display: block;
    color: #64748b;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
}

.details-empty {
    color: var(--text-muted);
}

.reader-info-section {
    padding: 3rem 2rem;
    background: var(--bg-light);
}

.reader-info-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.reader-info-grid article {
    padding: 1.25rem;
}

.reader-info-grid .material-symbols-outlined {
    color: var(--primary-green);
    font-size: 30px;
    margin-bottom: 0.75rem;
}

.reader-info-grid h2 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.reader-info-grid p {
    color: var(--text-muted);
}

@media (max-width: 980px) {
    .reader-workspace,
    .details-heading,
    .reader-info-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .reader-hero,
    .barcode-details-section,
    .reader-info-section {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .reader-panel {
        padding: 1rem;
    }

    .camera-frame {
        min-height: 280px;
        aspect-ratio: 4 / 3;
    }

    .details-grid,
    .result-facts,
    .gs1-field-grid {
        grid-template-columns: 1fr;
    }

    .detail-row {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }

    .upload-preview-wrap {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 520px) {
    .reader-tabs,
    .reader-actions,
    .result-actions {
        grid-template-columns: 1fr;
    }

    .reader-tab,
    .reader-btn {
        width: 100%;
    }
}
