/* Sprint 4 WEB-FIRST: launch-critical mobile/chat states only. */
.nch-web-mobilebar { display: none; }
.nch-web-desktop-pay { margin-top: 12px; }
.nch-web-banner {
    margin: 0 0 12px;
    padding: 10px 12px;
    border: 1px solid #dbeafe;
    border-radius: 10px;
    background: #eff6ff;
    color: #1e40af;
    font-size: 13px;
    line-height: 1.45;
}
.nch-web-banner[hidden] { display: none; }
.nch-web-paywall {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(15, 23, 42, .52);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    overscroll-behavior: contain;
    box-sizing: border-box;
}
.nch-web-paywall.open { display: flex; }
.nch-web-paywall-card {
    width: 100%;
    max-width: 440px;
    max-height: 90vh;
    max-height: min(90vh, calc(var(--nch-paywall-height, 100vh) - 32px));
    overflow-y: auto;
    border-radius: 18px;
    background: #fff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 24px 70px rgba(15, 23, 42, .3);
    padding: 22px;
    box-sizing: border-box;
    overscroll-behavior: contain;
    overflow-wrap: anywhere;
}
.nch-web-paywall button:focus-visible { outline: 3px solid #2563eb; outline-offset: 3px; }
.nch-web-paywall-head { display: flex; align-items: flex-start; gap: 12px; }
.nch-web-paywall-head h2 { margin: 0; font-size: 20px; color: #0f172a; }
.nch-web-paywall-head p { margin: 4px 0 0; color: #64748b; font-size: 13px; line-height: 1.4; }
.nch-web-paywall-close {
    margin-left: auto;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 9px;
    background: #f8fafc;
    color: #475569;
    cursor: pointer;
    font-size: 20px;
}
.nch-web-receipt { margin-top: 18px; }
.nch-web-receipt label { display: block; font-size: 13px; font-weight: 650; color: #334155; margin-bottom: 6px; }
.nch-web-receipt input {
    width: 100%;
    height: 44px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 0 12px;
    font: inherit;
    font-size: 14px;
    outline: none;
}
.nch-web-receipt input:focus { border-color: #2563eb; box-shadow: 0 0 0 3px #dbeafe; }
.nch-web-receipt small { display: block; color: #64748b; font-size: 11.5px; line-height: 1.4; margin-top: 5px; }
.nch-web-packages { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.nch-web-package {
    min-height: 72px;
    border: 1px solid #dbe3ee;
    border-radius: 12px;
    background: #fff;
    color: #0f172a;
    cursor: pointer;
    font: inherit;
    padding: 10px;
}
.nch-web-package strong { display: block; font-size: 17px; }
.nch-web-package span { display: block; margin-top: 3px; color: #2563eb; font-size: 13px; font-weight: 650; }
.nch-web-package:hover { background: #eff6ff; border-color: #bfdbfe; }
.nch-web-package:disabled { opacity: .58; cursor: wait; }
.nch-web-pay-status {
    margin-top: 14px;
    padding: 10px 12px;
    border-radius: 10px;
    background: #f8fafc;
    color: #475569;
    font-size: 13px;
    line-height: 1.45;
}
.nch-web-pay-status.is-error { background: #fef2f2; color: #b91c1c; }
.nch-web-pay-status.is-ok { background: #ecfdf5; color: #166534; }
.nch-web-pay-retry,
.nch-web-pay-continue {
    width: 100%;
    margin-top: 10px;
    border: 0;
    border-radius: 10px;
    background: #2563eb;
    color: #fff;
    min-height: 42px;
    padding: 9px 12px;
    font: inherit;
    font-size: 13px;
    font-weight: 650;
    cursor: pointer;
}

@media (max-width: 820px) {
    .nch-layout { display: block !important; padding: 0 0 18px !important; }
    .nch-col-left, .nch-col-right { display: none !important; }
    .nch-chat-card { border-radius: 14px !important; overflow: visible !important; }
    .nch-chat-head {
        position: sticky;
        top: 56px;
        z-index: 22;
        background: #fff;
        border-radius: 14px 14px 0 0;
    }
    .nch-web-mobilebar {
        position: sticky;
        top: 118px;
        z-index: 21;
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        align-items: center;
        gap: 8px;
        padding: 9px 12px;
        border-bottom: 1px solid #eef2f7;
        background: rgba(255, 255, 255, .96);
        backdrop-filter: blur(7px);
        -webkit-backdrop-filter: blur(7px);
    }
    .nch-web-mobilebar .nch-web-available { flex: 1 0 100%; font-size: 12px; font-weight: 700; color: #166534; white-space: nowrap; }
    .nch-web-mobilebar button {
        min-height: 34px;
        border-radius: 9px;
        padding: 0 10px;
        border: 1px solid #dbe3ee;
        background: #fff;
        color: #2563eb;
        font: inherit;
        font-size: 12px;
        font-weight: 650;
    }
    .nch-web-mobilebar .nch-web-pay { background: #2563eb; border-color: #2563eb; color: #fff; }
    .nch-chat-body { padding: 12px !important; }
    .nch-msg-user { max-width: 88% !important; }
    .nch-answer { padding: 14px !important; }
    .nch-composer-sep { margin: 16px 0 0 !important; }
    .nch-composer {
        /* UX-M01: composer follows the answer in normal document flow. */
        position: static;
        bottom: auto;
        z-index: auto;
        margin: 0 -12px -12px;
        padding: 12px 12px calc(10px + env(safe-area-inset-bottom));
        border-top: 1px solid #eef2f7;
        background: rgba(255, 255, 255, .98);
    }
    .nch-composer textarea { min-height: 68px !important; font-size: 16px !important; }
    /* UX-M02: expose the original Copy/Word buttons without cloning them. */
    .nch-layout .nch-col-right {
        display: flex !important;
        order: 2;
        flex-wrap: wrap;
        gap: 8px;
        padding: 12px !important;
    }
    .nch-col-right > :not(#nch-copy-btn):not(#nch-word-btn) { display: none !important; }
    .nch-col-right #nch-copy-btn, .nch-col-right #nch-word-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 1 1 160px;
        min-height: 44px;
    }
    .nch-web-paywall { align-items: flex-end; padding: 0; }
    .nch-web-paywall-card {
        max-width: none;
        max-height: 88vh;
        max-height: min(88vh, calc(var(--nch-paywall-height, 100vh) - 8px));
        border-radius: 20px 20px 0 0;
        padding: 20px 16px calc(16px + env(safe-area-inset-bottom));
    }
}

@media (max-width: 380px) {
    .nch-web-packages { grid-template-columns: 1fr; }
    .nch-web-mobilebar button { padding: 0 8px; }
}

/* Owner-approved recovery: one action, only on an unconfirmed GET result. */
.nch-recovery {
    margin-top: 12px;
    padding: 12px 14px;
    border: 1px solid #fde68a;
    border-radius: 10px;
    background: #fffbeb;
    color: #78350f;
    font-size: 14px;
    line-height: 1.45;
}
.nch-recovery[hidden] { display: none !important; }
.nch-recovery strong { display: block; margin-bottom: 5px; }
.nch-recovery p { margin: 0 0 10px; }
/* The original arrow button changes mode, but never position or identity. */
.nch-btn-send.is-recovery .nch-send-icon { display: none; }
.nch-btn-send.is-recovery::before {
    content: "↻";
    font-size: 27px;
    line-height: 1;
    font-weight: 500;
}
.nch-btn-send.is-recovery:focus-visible { outline: 3px solid #2563eb; outline-offset: 2px; }
