/*
Styles dedies a la page de scan client.

Role:
- organiser l'UX scan/photo/saisie manuelle
- stabiliser le lecteur camera et ses etats visuels

Comment modifier:
- structure HTML attendue: `client/templates/client/cartouche_scan.html`
- comportements: `client/static/client/js/cartouche_scan.js`
*/

.scan-page {
    max-width: 1180px;
    margin: 0 auto;
}

.scan-shell {
    position: relative;
    isolation: isolate;
    display: grid;
    gap: 28px;
    overflow: hidden;
    margin: 18px auto 0;
    padding: clamp(22px, 3.8vw, 36px);
    border-radius: 34px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 243, 236, 0.94));
    border: 1px solid rgba(24, 75, 92, 0.12);
    box-shadow: 0 32px 68px rgba(24, 61, 72, 0.15);
}

.scan-shell::before,
.scan-shell::after {
    content: "";
    position: absolute;
    z-index: -1;
    border-radius: 999px;
    pointer-events: none;
}

.scan-shell::before {
    inset: 0;
    border-radius: inherit;
    background:
        radial-gradient(circle at top right, rgba(13, 124, 134, 0.16), transparent 28%),
        radial-gradient(circle at bottom left, rgba(223, 109, 45, 0.12), transparent 26%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.46), transparent 46%);
}

.scan-shell::after {
    width: 260px;
    height: 260px;
    right: -130px;
    bottom: -130px;
    background: radial-gradient(circle, rgba(90, 142, 82, 0.18), rgba(90, 142, 82, 0));
    filter: blur(10px);
}

.scan-hero {
    display: grid;
    gap: 12px;
    justify-items: center;
    text-align: center;
}

.scan-kicker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 14px;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(13, 124, 134, 0.10), rgba(223, 109, 45, 0.08));
    border: 1px solid rgba(13, 124, 134, 0.12);
    color: var(--brand-strong, #0a626c);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.scan-title {
    margin: 0;
    font-size: clamp(2rem, 3vw, 2.75rem);
    line-height: 1.05;
    letter-spacing: -0.03em;
}

.scan-subtitle {
    max-width: 60ch;
    margin: 0;
    color: var(--text-2, #516873);
    font-size: 1rem;
    line-height: 1.75;
}

.scan-overview {
    width: min(100%, 980px);
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 10px;
}

.scan-overview-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 12px;
    align-items: flex-start;
    padding: 16px 18px;
    border-radius: 22px;
    border: 1px solid rgba(13, 124, 134, 0.1);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(247, 243, 236, 0.68));
    box-shadow: 0 16px 32px rgba(24, 61, 72, 0.08);
    text-align: left;
}

.scan-overview-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(13, 124, 134, 0.12), rgba(223, 109, 45, 0.16));
    color: var(--text-1, #18313a);
    font-weight: 900;
}

.scan-overview-card h2,
.scan-overview-card p {
    margin: 0;
}

.scan-overview-card h2 {
    font-size: 0.98rem;
    color: var(--text-1, #18313a);
}

.scan-overview-card p {
    margin-top: 5px;
    color: var(--text-3, #718892);
    line-height: 1.55;
}

.scan-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.95fr);
    gap: 24px;
    align-items: start;
}

.scan-live-panel,
.scan-manual,
.scan-steps {
    border-radius: 28px;
    border: 1px solid rgba(13, 124, 134, 0.09);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(244, 249, 248, 0.93));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 18px 36px rgba(24, 61, 72, 0.08);
}

.scan-live-panel {
    display: grid;
    gap: 18px;
    padding: 22px;
    align-content: start;
}

.scan-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

.scan-section-head {
    display: grid;
    gap: 8px;
    padding: 18px 20px;
    border-radius: 24px;
    border: 1px solid rgba(13, 124, 134, 0.08);
    background: linear-gradient(180deg, rgba(250, 253, 252, 0.9), rgba(240, 248, 247, 0.86));
}

.scan-section-eyebrow {
    margin: 0;
    color: var(--brand-strong, #0a626c);
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.scan-section-head h2,
.scan-guide-head h2 {
    margin: 0;
    color: var(--text-1, #18313a);
    font-size: 1.12rem;
}

.scan-section-head p,
.scan-guide-head p {
    margin: 5px 0 0;
    color: var(--text-3, #718892);
    line-height: 1.6;
}

.scan-status-box {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.scan-status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 76px;
    min-height: 38px;
    padding: 0 14px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    border: 1px solid transparent;
}

.scan-status-badge.is-idle {
    background: rgba(24, 61, 72, 0.06);
    color: var(--text-2, #516873);
    border-color: rgba(24, 61, 72, 0.08);
}

.scan-status-badge.is-requesting {
    background: rgba(223, 109, 45, 0.12);
    color: var(--accent-strong, #c85c22);
    border-color: rgba(223, 109, 45, 0.16);
}

.scan-status-badge.is-active {
    background: rgba(13, 124, 134, 0.12);
    color: var(--brand-strong, #0a626c);
    border-color: rgba(13, 124, 134, 0.16);
}

.scan-status-badge.is-success {
    background: rgba(90, 142, 82, 0.14);
    color: #4f7d48;
    border-color: rgba(90, 142, 82, 0.18);
}

.scan-status-badge.is-error {
    background: rgba(190, 73, 58, 0.12);
    color: #be493a;
    border-color: rgba(190, 73, 58, 0.16);
}

.scan-status-copy {
    min-width: 0;
}

.scan-status-copy p {
    margin: 0;
}

#scan-status-title {
    color: var(--text-1, #18313a);
    font-weight: 800;
}

#scan-status-detail {
    margin-top: 4px;
    color: var(--text-3, #718892);
    font-size: 0.93rem;
    line-height: 1.55;
}

.scan-chip-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.scan-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.76);
    border: 1px solid rgba(13, 124, 134, 0.08);
    color: var(--text-2, #516873);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.scan-reader-shell {
    position: relative;
    overflow: hidden;
    --scan-frame-size: 240px;
    aspect-ratio: 4 / 3;
    min-height: 0;
    padding: 16px;
    border-radius: 30px;
    background:
        linear-gradient(180deg, rgba(18, 37, 44, 0.94), rgba(24, 61, 72, 0.94)),
        linear-gradient(135deg, rgba(13, 124, 134, 0.2), rgba(223, 109, 45, 0.08));
    border: 1px solid rgba(13, 124, 134, 0.16);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 20px 44px rgba(24, 61, 72, 0.18);
}

.scan-reader-shell.is-live {
    background:
        linear-gradient(180deg, rgba(10, 23, 28, 0.98), rgba(15, 42, 52, 0.96)),
        linear-gradient(135deg, rgba(13, 124, 134, 0.14), rgba(223, 109, 45, 0.06));
}

.scan-reader-shell::before {
    content: "";
    position: absolute;
    inset: 18px;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    pointer-events: none;
}

.scan-reader-shell::after {
    content: "";
    position: absolute;
    inset: 10% 18%;
    border-radius: 34px;
    background: radial-gradient(circle, rgba(13, 124, 134, 0.18), rgba(13, 124, 134, 0));
    opacity: 0;
    filter: blur(18px);
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.scan-reader-shell.is-requesting::after,
.scan-reader-shell.is-active::after,
.scan-reader-shell.is-success::after {
    opacity: 1;
}

.scan-reader-placeholder {
    position: absolute;
    inset: 16px;
    display: grid;
    gap: 10px;
    align-content: center;
    justify-items: center;
    min-height: 0;
    padding: 34px 24px;
    text-align: center;
    color: rgba(255, 255, 255, 0.92);
    z-index: 1;
}

.scan-reader-placeholder[hidden] {
    display: none !important;
}

.scan-placeholder-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 74px;
    height: 74px;
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.08));
    border: 1px solid rgba(255, 255, 255, 0.14);
    font-size: 1.1rem;
    font-weight: 900;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.scan-reader-placeholder strong {
    font-size: 1.1rem;
    line-height: 1.4;
}

.scan-reader-placeholder p {
    max-width: 34ch;
    margin: 0;
    color: rgba(238, 247, 247, 0.76);
    line-height: 1.7;
}

#qr-reader {
    display: none;
    position: absolute !important;
    inset: 16px !important;
    width: auto !important;
    height: auto !important;
    max-width: none !important;
    padding: 0;
    border-radius: 24px;
    background: transparent;
    border: none;
    box-shadow: none;
    z-index: 1;
}

#qr-reader__scan_region {
    position: relative;
    display: grid;
    place-items: center;
    width: 100% !important;
    height: 100% !important;
    min-height: 0;
    border-radius: 24px;
    overflow: hidden;
    background: rgba(8, 20, 24, 0.28);
}

#qr-reader > div {
    border: none !important;
    box-shadow: none !important;
    width: 100% !important;
    height: 100% !important;
}

#qr-reader video {
    width: 100% !important;
    height: 100% !important;
    min-height: 0;
    object-fit: cover;
    transform: scale(var(--scan-video-scale, 1.14));
    transform-origin: center center;
    background: #071217;
    filter: saturate(1.02) contrast(1.03);
}

#qr-reader video,
#qr-reader img {
    border-radius: 22px;
}

#qr-reader__dashboard {
    display: none !important;
}

#qr-reader__dashboard_section_swaplink,
#qr-reader__dashboard_section_csr button,
#qr-reader__dashboard_section_csr select {
    border-radius: 14px !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    background: rgba(255, 255, 255, 0.08) !important;
    color: rgba(255, 255, 255, 0.92) !important;
    box-shadow: none !important;
}

#qr-reader__dashboard_section_swaplink {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 14px;
    font-weight: 700;
}

#qr-reader__dashboard_section_csr {
    display: grid;
    gap: 10px;
}

.scan-reader-overlay {
    position: absolute;
    inset: 16px;
    z-index: 2;
    pointer-events: none;
}

.scan-reader-focus-ring {
    position: absolute;
    inset: 50% auto auto 50%;
    width: var(--scan-frame-size);
    height: var(--scan-frame-size);
    transform: translate(-50%, -50%);
    border-radius: 28px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow:
        0 0 0 1px rgba(13, 124, 134, 0.18),
        inset 0 0 0 999px rgba(3, 11, 14, 0.08);
    transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}

.scan-reader-shell.is-requesting .scan-reader-focus-ring,
.scan-reader-shell.is-active .scan-reader-focus-ring {
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow:
        0 0 0 1px rgba(13, 124, 134, 0.28),
        0 0 28px rgba(13, 124, 134, 0.18),
        inset 0 0 0 999px rgba(3, 11, 14, 0.04);
}

.scan-reader-shell.is-success .scan-reader-focus-ring {
    border-color: rgba(190, 244, 182, 0.42);
    box-shadow:
        0 0 0 1px rgba(90, 142, 82, 0.34),
        0 0 28px rgba(90, 142, 82, 0.18),
        inset 0 0 0 999px rgba(3, 11, 14, 0.02);
}

.scan-reader-corner {
    position: absolute;
    width: 42px;
    height: 42px;
    border-color: rgba(255, 255, 255, 0.78);
    border-style: solid;
    transition: border-color 0.25s ease, transform 0.25s ease;
}

.scan-reader-corner.is-top-left {
    top: calc(50% - (var(--scan-frame-size) / 2));
    left: calc(50% - (var(--scan-frame-size) / 2));
    transform: translate(-18px, -18px);
    border-width: 3px 0 0 3px;
    border-top-left-radius: 18px;
}

.scan-reader-corner.is-top-right {
    top: calc(50% - (var(--scan-frame-size) / 2));
    right: calc(50% - (var(--scan-frame-size) / 2));
    transform: translate(18px, -18px);
    border-width: 3px 3px 0 0;
    border-top-right-radius: 18px;
}

.scan-reader-corner.is-bottom-left {
    bottom: calc(50% - (var(--scan-frame-size) / 2));
    left: calc(50% - (var(--scan-frame-size) / 2));
    transform: translate(-18px, 18px);
    border-width: 0 0 3px 3px;
    border-bottom-left-radius: 18px;
}

.scan-reader-corner.is-bottom-right {
    bottom: calc(50% - (var(--scan-frame-size) / 2));
    right: calc(50% - (var(--scan-frame-size) / 2));
    transform: translate(18px, 18px);
    border-width: 0 3px 3px 0;
    border-bottom-right-radius: 18px;
}

.scan-reader-shell.is-requesting .scan-reader-corner,
.scan-reader-shell.is-active .scan-reader-corner {
    border-color: rgba(130, 237, 247, 0.94);
}

.scan-reader-shell.is-success .scan-reader-corner {
    border-color: rgba(190, 244, 182, 0.92);
}

.scan-reader-line {
    position: absolute;
    left: 50%;
    top: calc(50% - (var(--scan-frame-size) / 2));
    width: var(--scan-frame-size);
    height: 2px;
    transform: translateX(-50%);
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0), rgba(130, 237, 247, 0.95), rgba(0, 0, 0, 0));
    box-shadow: 0 0 18px rgba(130, 237, 247, 0.56);
    opacity: 0;
}

.scan-reader-shell.is-requesting .scan-reader-line,
.scan-reader-shell.is-active .scan-reader-line {
    opacity: 1;
    animation: scan-reader-sweep 2.4s linear infinite;
}

.scan-reader-shell.is-success .scan-reader-line {
    opacity: 1;
    top: 50%;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0), rgba(190, 244, 182, 0.95), rgba(0, 0, 0, 0));
    box-shadow: 0 0 18px rgba(190, 244, 182, 0.5);
    animation: none;
}

.scan-reader-hint {
    position: absolute;
    left: 50%;
    bottom: 14px;
    transform: translateX(-50%);
    margin: 0;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(6, 18, 22, 0.56);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.88);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    text-align: center;
    white-space: nowrap;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.scan-action-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.scan-action-card {
    display: grid;
    gap: 14px;
    padding: 18px;
    border-radius: 24px;
    border: 1px solid rgba(13, 124, 134, 0.09);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(243, 249, 248, 0.88));
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.8), 0 14px 28px rgba(24, 61, 72, 0.06);
}

.scan-action-card.is-secondary {
    background: linear-gradient(180deg, rgba(255, 250, 245, 0.96), rgba(255, 243, 231, 0.92));
    border-color: rgba(223, 109, 45, 0.12);
}

.scan-action-copy {
    display: grid;
    gap: 6px;
}

.scan-action-copy h2,
.scan-action-copy p {
    margin: 0;
}

.scan-action-copy h2 {
    color: var(--text-1, #18313a);
    font-size: 1.02rem;
}

.scan-action-copy p {
    color: var(--text-3, #718892);
    line-height: 1.58;
}

.scan-action-kicker {
    margin: 0;
    color: var(--brand-strong, #0a626c);
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.scan-action-card.is-secondary .scan-action-kicker {
    color: #b35724;
}

.scan-stop-wrap {
    display: flex;
    justify-content: center;
}

#scan-image-input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    opacity: 0;
    pointer-events: none;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    overflow: hidden;
}

.scan-control-hint {
    margin: -2px 0 0;
    color: var(--text-3, #718892);
    font-size: 0.88rem;
    line-height: 1.55;
}

.scan-live-warning {
    margin: -2px 0 0;
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid rgba(223, 109, 45, 0.16);
    background: rgba(223, 109, 45, 0.08);
    color: #9f4a1e;
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.55;
}

.scan-primary-label,
#start-scan,
.scan-secondary-btn,
#manual-form button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 56px;
    border: none;
    border-radius: 18px;
    font-weight: 800;
    letter-spacing: -0.01em;
    text-align: center;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

#start-scan,
.scan-primary-label {
    width: 100%;
    min-width: 0;
    padding: 0 24px;
    background: linear-gradient(180deg, var(--brand, #0d7c86), var(--brand-strong, #0a626c));
    color: #fff;
    box-shadow: 0 18px 34px rgba(13, 124, 134, 0.22);
}

#start-scan {
    cursor: pointer;
}

.scan-primary-label {
    cursor: pointer;
}

.scan-primary-label.is-alt {
    background: linear-gradient(180deg, rgba(223, 109, 45, 0.96), rgba(200, 92, 34, 1));
    box-shadow: 0 16px 30px rgba(223, 109, 45, 0.22);
}

.scan-secondary-btn {
    grid-column: 1 / -1;
    min-width: 0;
    padding: 0 20px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-1, #18313a);
    border: 1px solid rgba(13, 124, 134, 0.1);
    box-shadow: 0 14px 28px rgba(24, 61, 72, 0.08);
}

.scan-secondary-btn[hidden] {
    display: none;
}

.scan-primary-label:hover:not(:disabled),
#start-scan:hover:not(:disabled),
.scan-secondary-btn:hover:not(:disabled),
#manual-form button:hover:not(:disabled) {
    transform: translateY(-1px);
}

.scan-primary-label:disabled,
#start-scan:disabled,
.scan-secondary-btn:disabled,
#manual-form button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.scan-camera-tools {
    display: grid;
    gap: 8px;
    padding: 16px 18px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(13, 124, 134, 0.08);
}

.scan-camera-tools label {
    color: var(--text-2, #516873);
    font-size: 0.9rem;
    font-weight: 800;
}

.scan-camera-tools select {
    min-height: 50px;
    padding: 0 16px;
    border-radius: 16px;
    border: 1px solid rgba(13, 124, 134, 0.14);
    background: rgba(255, 255, 255, 0.96);
    color: var(--text-1, #18313a);
    font-weight: 700;
}

.scan-live-tools {
    display: grid;
    gap: 12px;
    margin-top: 4px;
}

.scan-live-tool {
    display: grid;
    gap: 10px;
}

.scan-live-tool-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.scan-live-tool-head span {
    color: var(--brand-strong, #0a626c);
    font-size: 0.86rem;
    font-weight: 800;
}

#zoom-range {
    width: 100%;
    accent-color: var(--brand, #0d7c86);
}

.scan-tertiary-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
    padding: 0 18px;
    border-radius: 16px;
    border: 1px solid rgba(223, 109, 45, 0.24);
    background: linear-gradient(180deg, rgba(255, 244, 231, 0.96), rgba(255, 236, 214, 0.98));
    color: #9f4a1e;
    font-weight: 800;
    letter-spacing: -0.01em;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.scan-tertiary-btn:hover:not(:disabled) {
    transform: translateY(-1px);
}

.scan-tertiary-btn.is-active {
    background: linear-gradient(180deg, rgba(223, 109, 45, 0.96), rgba(200, 92, 34, 1));
    color: #fff;
    border-color: rgba(223, 109, 45, 0.18);
    box-shadow: 0 16px 30px rgba(223, 109, 45, 0.22);
}

.scan-tertiary-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#scan-result {
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    max-width: 100%;
    padding: 10px 18px;
    border-radius: 999px;
    background: rgba(13, 124, 134, 0.08);
    border: 1px solid rgba(13, 124, 134, 0.1);
    text-align: center;
    font-weight: 700;
    line-height: 1.45;
    color: var(--text-2, #516873);
}

.error-message {
    margin: 0;
    padding: 14px 18px;
    border-radius: 20px;
    border: 1px solid rgba(190, 73, 58, 0.16);
    background: rgba(190, 73, 58, 0.08);
    color: #be493a;
    font-weight: 700;
    text-align: center;
    line-height: 1.6;
    transition: opacity 0.3s ease, max-height 0.3s ease, padding 0.3s ease, margin 0.3s ease;
}

.scan-side {
    display: grid;
    gap: 20px;
    align-content: start;
}

.scan-side-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    width: fit-content;
    padding: 0 12px;
    border-radius: 999px;
    background: rgba(13, 124, 134, 0.1);
    border: 1px solid rgba(13, 124, 134, 0.12);
    color: var(--brand-strong, #0a626c);
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.scan-manual,
.scan-steps {
    padding: 22px;
}

.scan-manual {
    display: grid;
    gap: 16px;
}

.scan-manual-head {
    display: grid;
    gap: 6px;
    text-align: left;
}

.scan-manual-title,
.scan-manual-copy {
    margin: 0;
}

.scan-manual-title {
    color: var(--text-1, #18313a);
    font-weight: 800;
    font-size: 1.05rem;
}

.scan-manual-copy {
    color: var(--text-3, #718892);
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.6;
}

.scan-manual-note {
    margin: -4px 0 0;
    color: var(--text-2, #516873);
    font-size: 0.92rem;
}

.scan-manual-note strong {
    color: var(--brand-strong, #0a626c);
}

#manual-form {
    display: grid;
    gap: 12px;
}

#manual-form input[type="text"] {
    min-width: 0;
    min-height: 56px;
    padding: 0 18px;
    border-radius: 18px;
    border: 1px solid rgba(13, 124, 134, 0.14);
    background: rgba(255, 255, 255, 0.94);
    color: var(--text-1, #18313a);
    font-weight: 800;
    letter-spacing: 0.12em;
    text-align: center;
    text-transform: uppercase;
    box-shadow: 0 10px 22px rgba(24, 61, 72, 0.06);
}

#manual-form input[type="text"]::placeholder {
    letter-spacing: normal;
    text-transform: none;
    color: var(--text-3, #718892);
    font-weight: 600;
}

#manual-form input[type="text"]:focus {
    outline: none;
    border-color: var(--brand, #0d7c86);
    box-shadow: 0 0 0 4px rgba(223, 109, 45, 0.1), 0 0 0 1px rgba(13, 124, 134, 0.12);
}

#manual-form button {
    width: 100%;
    background: linear-gradient(180deg, rgba(223, 109, 45, 0.96), rgba(200, 92, 34, 1));
    color: #fff;
    box-shadow: 0 16px 30px rgba(223, 109, 45, 0.22);
}

.scan-steps {
    display: grid;
    gap: 14px;
}

.scan-guide-head {
    display: grid;
    gap: 8px;
    margin-bottom: 2px;
}

.scan-step-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 14px;
    align-items: flex-start;
    padding: 16px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.74);
    border: 1px solid rgba(13, 124, 134, 0.08);
}

.scan-step-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(180deg, rgba(13, 124, 134, 0.12), rgba(223, 109, 45, 0.14));
    color: var(--text-1, #18313a);
    font-weight: 900;
}

.scan-step-card h2,
.scan-step-card p {
    margin: 0;
}

.scan-step-card h2 {
    font-size: 1rem;
    color: var(--text-1, #18313a);
}

.scan-step-card p {
    margin-top: 6px;
    color: var(--text-3, #718892);
    line-height: 1.65;
}

.hidden {
    opacity: 0;
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin: 0;
    overflow: hidden;
    border-width: 0;
    pointer-events: none;
}

input.shake {
    border-color: rgba(190, 73, 58, 0.45);
    animation: scan-shake 0.32s ease;
}

@keyframes scan-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    50% { transform: translateX(5px); }
    75% { transform: translateX(-4px); }
}

@keyframes scan-reader-sweep {
    0% {
        top: calc(50% - (var(--scan-frame-size) / 2));
    }
    50% {
        top: calc(50% + (var(--scan-frame-size) / 2));
    }
    100% {
        top: calc(50% - (var(--scan-frame-size) / 2));
    }
}

@media (max-width: 960px) {
    .scan-overview {
        grid-template-columns: 1fr;
    }

    .scan-layout {
        grid-template-columns: 1fr;
    }

    .scan-action-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .scan-shell {
        gap: 22px;
        padding: 18px;
        border-radius: 28px;
    }

    .scan-live-panel,
    .scan-manual,
    .scan-steps {
        padding: 18px;
        border-radius: 24px;
    }

    .scan-overview-card,
    .scan-section-head,
    .scan-action-card {
        border-radius: 20px;
    }

    .scan-reader-shell {
        aspect-ratio: 1 / 1;
        padding: 12px;
        border-radius: 24px;
    }

    .scan-reader-corner {
        width: 34px;
        height: 34px;
    }

    .scan-reader-hint {
        bottom: 10px;
        max-width: calc(100% - 28px);
        white-space: normal;
        line-height: 1.45;
    }

    .scan-primary-label,
    #start-scan,
    .scan-secondary-btn {
        width: 100%;
    }

    .scan-status-box {
        align-items: flex-start;
    }

    .scan-step-card {
        grid-template-columns: 1fr;
    }

    .scan-step-index {
        width: 34px;
        height: 34px;
    }
}
