/* Orientação guiada do terminal físico (PhysicalGuidedStep, TerminalMachineFrontView, TerminalDrawerTopView).
   Reimplementa a versão visual 1 aprovada em 13/10/2026 (docs/prototypes/terminal-physical-guided-execution-prototype.html)
   com os tokens do canal: laranja de ação --tm-primary-action, texto --tm-text/--tm-text-muted.
   Versão visual 2 (14/10/2026, docs/prototypes/terminal-physical-clean-checkout-prototype.html): estado "registrando"
   e checkout compacto da operação encerrada (PhysicalExecutionCheckout), sem desenho.
   Carregada DEPOIS de terminal-landscape.css (App.razor): as regras daqui valem nas duas orientações e a
   largura disponível decide a coluna das ações. */

.terminal-guided,
.terminal-physical-checkout {
    --tg-line: var(--tm-border);
    --tg-soft: #F5F6F7;
    --tg-tint: #FFF2EB;
    --tg-green: #256744;
    --tg-amber: #845609;
}

.terminal-guided {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.terminal-guided-step-line {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    flex-wrap: wrap;
    color: var(--tm-text-muted, #6A7076);
    font-size: 13px;
    margin-bottom: 8px;
}

.terminal-guided-status {
    color: var(--tm-primary-action, #CE4716);
    font-weight: 700;
}

.terminal-guided-title {
    margin: 0;
    font-size: clamp(24px, 3vw, 34px);
    line-height: 1.2;
    letter-spacing: -0.6px;
    color: var(--tm-text);
}

.terminal-guided-instruction p {
    margin: 10px 0 0;
    font-size: 18px;
    color: var(--tm-text-muted, #6A7076);
}

.terminal-guided-tool {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px 0 18px;
}

.terminal-guided-tool-name {
    font-weight: 650;
}

.terminal-guided-quantity {
    padding: 5px 11px;
    background: var(--tg-soft);
    border-radius: 5px;
    font-weight: 750;
    font-size: 14px;
}

.terminal-guided-work {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 285px;
    gap: 24px;
    align-items: start;
}

.terminal-guided-maps {
    display: grid;
    grid-template-columns: minmax(0, 2.4fr) minmax(128px, 1fr);
    gap: 18px;
    align-items: start;
    padding: 18px;
    border: 1px solid var(--tg-line);
    border-radius: 10px;
    background: #FBFCFC;
}

.terminal-guided-maps-single {
    grid-template-columns: 1fr;
}

.terminal-guided figure {
    margin: 0;
    min-width: 0;
}

.terminal-guided figcaption {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
    font-weight: 700;
    font-size: 14px;
}

.terminal-guided figcaption span {
    font-size: 12px;
    font-weight: 500;
    color: var(--tm-text-muted, #6A7076);
}

.terminal-guided-cabinet,
.terminal-guided-inside {
    display: block;
    width: 100%;
    max-height: 430px;
}

.terminal-guided-outline {
    fill: #FFFFFF;
    stroke: #818A92;
    stroke-width: 2;
}

.terminal-guided-base {
    fill: #EEF0F2;
    stroke: #818A92;
    stroke-width: 2;
}

.terminal-guided-cell rect {
    fill: #FAFBFC;
    stroke: #A7AEB5;
    stroke-width: 1;
}

.terminal-guided-cell text {
    fill: #5E666E;
    font-weight: 550;
}

/* Alvo: contorno grosso + preenchimento + rótulo em negrito. A cor não é o único sinal. */
.terminal-guided-target rect {
    stroke: var(--tm-primary-action, #CE4716);
    stroke-width: 2.8;
    fill: #FFE5D7;
}

.terminal-guided-inside .terminal-guided-target rect {
    stroke-width: 6;
}

.terminal-guided-target text {
    fill: #842900;
    font-weight: 850;
}

.terminal-guided-target.terminal-guided-active rect {
    animation: terminal-guided-pulse 1.4s ease-in-out infinite;
}

.terminal-guided-target.terminal-guided-finished rect {
    fill: #E0F1E7;
    stroke: var(--tg-green);
}

.terminal-guided-target.terminal-guided-finished text {
    fill: var(--tg-green);
}

@keyframes terminal-guided-pulse {
    50% {
        fill: #F6A47F;
    }
}

@media (prefers-reduced-motion: reduce) {
    .terminal-guided-target.terminal-guided-active rect {
        animation: none;
        fill: #FFE5D7;
    }
}

.terminal-guided-caption {
    fill: #626970;
}

.terminal-guided-caption-strong {
    font-weight: 700;
}

.terminal-guided-map-note {
    margin: 10px 0 0;
    font-size: 12px;
    color: var(--tm-text-muted, #6A7076);
}

.terminal-guided-unavailable p {
    margin: 0;
    padding: 18px;
    border: 1px dashed #A7AEB5;
    border-radius: 8px;
    color: var(--tm-text-muted, #6A7076);
    font-size: 14px;
}

.terminal-guided-location {
    margin-top: 12px;
    padding: 12px;
    border-left: 3px solid var(--tm-primary);
    background: var(--tg-tint);
    font-size: 14px;
}

.terminal-guided-location strong {
    display: block;
    font-size: 17px;
}

.terminal-guided-lines {
    margin: 6px 0;
    padding-left: 18px;
}

.terminal-guided-actions {
    text-align: center;
    padding: 20px 18px;
    background: var(--tg-soft);
    border-radius: 10px;
}

.terminal-guided-eyebrow {
    font-weight: 650;
    font-size: 14px;
    color: var(--tm-text-muted, #6A7076);
}

.terminal-guided-timer {
    --progress: 100%;
    width: 146px;
    height: 146px;
    margin: 16px auto;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: conic-gradient(var(--tm-primary-action, #CE4716) var(--progress), #E1E4E7 0);
}

.terminal-guided-timer-center {
    width: 132px;
    height: 132px;
    border-radius: 50%;
    background: var(--tg-soft);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.terminal-guided-timer-number {
    font-size: 46px;
    font-weight: 760;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.terminal-guided-timer-unit {
    margin-top: 7px;
    font-size: 13px;
    color: var(--tm-text-muted, #6A7076);
}

.terminal-guided-caption-text {
    margin: 0;
    font-size: 14px;
    color: var(--tm-text-muted, #6A7076);
}

.terminal-guided-timeout {
    margin: 12px 0 0;
    color: #744B0D;
    font-size: 15px;
}

.terminal-guided-operator-actions {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.terminal-guided-operator-actions .mud-button-root {
    min-height: 54px;
}

.terminal-guided-outcome {
    padding: 18px;
    border-left: 4px solid var(--tg-green);
    background: #ECF6EF;
    border-radius: 4px;
    margin-bottom: 20px;
}

.terminal-guided-outcome-warning {
    border-left-color: #A37022;
    background: #FFF6E7;
}

.terminal-guided-outcome h3 {
    margin: 0 0 6px;
    color: var(--tg-green);
    font-size: 23px;
}

.terminal-guided-outcome-warning h3 {
    color: var(--tg-amber);
}

.terminal-guided-outcome p {
    margin: 5px 0 0;
}

.terminal-guided-outcome-neutral {
    border-left-color: #8B939A;
    background: var(--tg-soft);
}

.terminal-guided-outcome-neutral h3 {
    color: var(--tm-text);
}

/* Pendência física: aviso destacado com a gaveta, também no checkout. */
.terminal-guided-pending {
    margin-top: 14px;
    padding: 12px 14px;
    border-left: 4px solid #C98A1B;
    background: #FFF4E1;
    color: #5E3E08;
    font-size: 15px;
}

.terminal-guided-pending strong {
    display: block;
    margin-bottom: 2px;
}

/* Fechamento recebido, registro com o servidor: sem desenho, só o estado. */
.terminal-guided-processing {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    background: var(--tg-soft);
    border-radius: 10px;
    font-size: 15px;
}

/* Checkout da operação encerrada (versão visual 2): uma coluna, resultado e ações próximos. */
.terminal-physical-checkout {
    display: grid;
    gap: 16px;
    max-width: 640px;
    min-width: 0;
}

.terminal-physical-checkout .terminal-result-state-code {
    margin: 0;
}

.terminal-physical-checkout .terminal-guided-title:focus {
    outline: none;
}

.terminal-physical-checkout .terminal-guided-title:focus-visible {
    outline: 3px solid var(--tm-primary-action, #CE4716);
    outline-offset: 3px;
}

.terminal-physical-checkout .terminal-guided-tool {
    padding: 0;
}

.terminal-physical-checkout .terminal-guided-outcome {
    margin-bottom: 0;
}

.terminal-checkout-steps {
    margin: 10px 0 0;
    padding-left: 20px;
    font-size: 15px;
}

.terminal-checkout-steps li + li {
    margin-top: 4px;
}

.terminal-checkout-occurrence {
    font-size: 15px;
}

.terminal-physical-checkout-card .terminal-continuation-actions {
    max-width: 420px;
    margin-top: 18px;
}

.terminal-physical-checkout-card .terminal-continuation-actions .mud-button-root {
    min-height: 54px;
}

.terminal-guided-problem {
    margin-top: 20px;
    padding: 20px;
    border: 1px solid #D1BA94;
    background: #FFFBF5;
    border-radius: 10px;
}

.terminal-guided-problem h3 {
    margin: 0;
    font-size: 18px;
}

.terminal-guided-problem > p {
    margin: 7px 0 14px;
    font-size: 14px;
    color: var(--tm-text-muted, #6A7076);
}

.terminal-guided-problem-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    align-items: start;
}

.terminal-guided-problem-wide {
    grid-column: 1 / -1;
}

.terminal-guided-problem-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.terminal-guided-cancel-note {
    margin: 10px 0 0;
    font-size: 14px;
    color: #744B0D;
}

.terminal-guided-problem-notice {
    margin-top: 16px;
    padding: 16px;
    border-left: 4px solid #A37022;
    background: #FFF6E7;
}

.terminal-guided-problem-notice p {
    margin: 6px 0 0;
}

@media (max-width: 950px) {
    .terminal-guided-work {
        grid-template-columns: minmax(0, 1fr) 240px;
        gap: 16px;
    }

    .terminal-guided-maps {
        gap: 10px;
        padding: 12px;
    }
}

/* Retrato e telas estreitas: ações embaixo do desenho, contagem à esquerda do texto. */
@media (max-width: 820px) {
    .terminal-guided-work {
        grid-template-columns: 1fr;
    }

    .terminal-guided-actions {
        display: grid;
        grid-template-columns: 112px 1fr;
        align-items: center;
        column-gap: 18px;
        text-align: left;
    }

    .terminal-guided-timer {
        grid-column: 1;
        grid-row: 1 / 4;
        width: 105px;
        height: 105px;
        margin: 0;
    }

    .terminal-guided-timer-center {
        width: 93px;
        height: 93px;
    }

    .terminal-guided-timer-number {
        font-size: 34px;
    }

    .terminal-guided-eyebrow,
    .terminal-guided-caption-text,
    .terminal-guided-timeout {
        grid-column: 2;
    }

    .terminal-guided-actions:not(:has(.terminal-guided-timer)) {
        display: block;
        text-align: left;
    }

    .terminal-guided-operator-actions {
        grid-column: 1 / -1;
    }

    .terminal-physical-checkout,
    .terminal-physical-checkout-card .terminal-continuation-actions {
        max-width: none;
    }
}

@media (max-width: 480px) {
    .terminal-guided-maps {
        grid-template-columns: 1fr;
    }

    .terminal-guided-inside {
        height: 340px;
    }

    .terminal-guided-problem-fields {
        grid-template-columns: 1fr;
    }

    .terminal-guided-title {
        font-size: 25px;
    }

    .terminal-guided-instruction p {
        font-size: 16px;
    }
}
