/* NubiBooks AI UI tokens and classes.
   Loaded alongside output.css. These classes are plain CSS so the UI
   works without re-running the Tailwind CLI. */

:root {
    --nb-ink:       #1C2A11;
    --nb-forest:    #314025;
    --nb-deep:      #2B3A20;
    --nb-chat:      #2F3E25;
    --nb-moss:      #4E7A2E;
    --nb-sage:      #BACCA8;
    --nb-leaf:      #7A9E5A;
    --nb-mist:      #F7F9F5;
    --nb-wash:      #F3F6EF;
    --nb-hover:     #EEF1EB;
    --nb-inputbg:   #EEF2EA;
    --nb-line:      #E6EAE1;
    --nb-bubble:    #E3EAD9;
    --nb-field:     #CDD6C5;
    --nb-muted:     #4B5545;
    --nb-soft:      #5A6552;
    --nb-body:      #3F4A38;
    --nb-icon:      #6B7563;
    --nb-mintbg:    #E3EEDA;
    --nb-amberbg:   #FFF1C2;
    --nb-amberfg:   #8A5A00;
    --nb-amberline: #F1D48A;
    --nb-amberwash: #FFF8E1;
    --nb-redbg:     #FDECEA;
    --nb-redfg:     #B42318;
    --nb-dim:       #A7B49C;
}

/* background colours */
.nb-bg-ink       { background-color: var(--nb-ink); }
.nb-bg-forest    { background-color: var(--nb-forest); }
.nb-bg-deep      { background-color: var(--nb-deep); }
.nb-bg-chat      { background-color: var(--nb-chat); }
.nb-bg-moss      { background-color: var(--nb-moss); }
.nb-bg-sage      { background-color: var(--nb-sage); }
.nb-bg-leaf      { background-color: var(--nb-leaf); }
.nb-bg-mist      { background-color: var(--nb-mist); }
.nb-bg-wash      { background-color: var(--nb-wash); }
.nb-bg-hover     { background-color: var(--nb-hover); }
.nb-bg-inputbg   { background-color: var(--nb-inputbg); }
.nb-bg-bubble    { background-color: var(--nb-bubble); }
.nb-bg-mintbg    { background-color: var(--nb-mintbg); }
.nb-bg-amberbg   { background-color: var(--nb-amberbg); }
.nb-bg-amberwash { background-color: var(--nb-amberwash); }
.nb-bg-redbg     { background-color: var(--nb-redbg); }
.nb-bg-white     { background-color: #ffffff; }

/* text colours */
.nb-text-ink     { color: var(--nb-ink); }
.nb-text-forest  { color: var(--nb-forest); }
.nb-text-moss    { color: var(--nb-moss); }
.nb-text-muted   { color: var(--nb-muted); }
.nb-text-soft    { color: var(--nb-soft); }
.nb-text-body    { color: var(--nb-body); }
.nb-text-icon    { color: var(--nb-icon); }
.nb-text-amberfg { color: var(--nb-amberfg); }
.nb-text-redfg   { color: var(--nb-redfg); }
.nb-text-leaf    { color: var(--nb-leaf); }
.nb-text-white   { color: #ffffff; }

/* borders */
.nb-border          { border: 1px solid var(--nb-line); }
.nb-border-bubble   { border: 1px solid var(--nb-bubble); }
.nb-border-field    { border: 1px solid var(--nb-field); }
.nb-border-forest   { border: 1px solid var(--nb-forest); }
.nb-border-amberline{ border: 1px solid var(--nb-amberline); }
.nb-border-line     { border: 1px solid var(--nb-line); }
.nb-border-l        { border-left: 1px solid var(--nb-line); }
.nb-border-r        { border-right: 1px solid var(--nb-line); }
.nb-border-b        { border-bottom: 1px solid var(--nb-line); }
.nb-border-t        { border-top: 1px solid var(--nb-line); }
.nb-border-mintok   { border: 1px solid #BFD3AE; }
.nb-border-cardline { border: 1px solid #DDE5D4; }
.nb-ring-forest     { box-shadow: inset 0 0 0 1.5px var(--nb-forest); }

/* shell */
.nb-ai-shell {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--nb-mist);
    font-family: 'Poppins', ui-sans-serif, system-ui, sans-serif;
    color: var(--nb-ink);
    min-height: calc(100vh - 56px);
}

/* header */
.nb-ai-header {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 56px;
    padding: 0 14px;
    background: #ffffff;
    border-bottom: 1px solid var(--nb-line);
    position: sticky;
    top: 56px;
    z-index: 30;
}

.nb-ai-title { font-size: 15px; font-weight: 600; color: var(--nb-ink); }

.nb-ai-balance-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    background: var(--nb-hover);
    color: var(--nb-forest);
    font-size: 12.5px;
    font-weight: 600;
}

.nb-ai-new-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 12px;
    border-radius: 9px;
    background: var(--nb-chat);
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
}

/* messages */
.nb-ai-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 16px 14px;
}

@media (min-width: 768px) { .nb-ai-scroll { padding: 16px 24px; } }

.nb-ai-messages {
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* bubbles */
.nb-ai-ai-row { display: flex; gap: 10px; align-items: flex-start; }

.nb-ai-avatar {
    width: 30px;
    height: 30px;
    margin-top: 20px;
    border-radius: 50%;
    background: var(--nb-sage);
    border: 2px solid var(--nb-bubble);
    font-size: 14px;
    font-weight: 700;
    color: var(--nb-ink);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nb-ai-ai-col {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    flex: 1;
}

@media (min-width: 768px) { .nb-ai-ai-col { max-width: 540px; } }

.nb-ai-meta { display: flex; gap: 6px; font-size: 11px; }
.nb-ai-meta strong { color: var(--nb-soft); }
.nb-ai-meta .nb-when { color: var(--nb-icon); }

.nb-ai-bubble-ai {
    padding: 12px 16px;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    background: #ffffff;
    border: 1px solid var(--nb-bubble);
    font-size: 14px;
    line-height: 22px;
}

.nb-ai-user-row { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.nb-ai-user-row .nb-ai-meta strong { color: var(--nb-forest); }

.nb-ai-user-wrap { display: flex; gap: 8px; align-items: flex-end; justify-content: flex-end; }

.nb-ai-bubble-user {
    max-width: 270px;
    padding: 12px 16px;
    border-radius: 16px;
    border-bottom-right-radius: 4px;
    background: var(--nb-chat);
    color: #ffffff;
    font-size: 14px;
    line-height: 22px;
}

@media (min-width: 768px) { .nb-ai-bubble-user { max-width: 480px; } }

.nb-ai-user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--nb-sage);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--nb-ink);
}

/* streaming caret */
.nb-caret {
    display: inline-block;
    width: 2px;
    height: 15px;
    margin-left: 3px;
    vertical-align: -2px;
    border-radius: 2px;
    background: var(--nb-forest);
    animation: nb-blink 1s infinite;
}

@keyframes nb-blink { 0%,50%,100% { opacity: 1; } 25%,75% { opacity: 0.2; } }

/* composer */
.nb-ai-footer {
    flex-shrink: 0;
    background: #ffffff;
    border-top: 1px solid var(--nb-line);
    padding: 12px 14px 10px;
}

@media (min-width: 768px) { .nb-ai-footer { padding: 12px 24px 10px; } }

.nb-ai-footer-inner {
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nb-ai-composer {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 54px;
    padding: 0 6px;
    border-radius: 27px;
    border: 1.5px solid var(--nb-field);
    background: var(--nb-inputbg);
}

.nb-ai-composer:focus-within { border-color: var(--nb-forest); }

.nb-ai-mic {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #ffffff;
    color: var(--nb-forest);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
    border: none;
}
.nb-ai-mic:hover { background: var(--nb-wash); }
.nb-ai-mic.recording { background: var(--nb-redbg); color: var(--nb-redfg); }

.nb-ai-input {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    padding: 0;
    font-size: 14px;
    color: var(--nb-ink);
    outline: none;
}
.nb-ai-input::placeholder { color: var(--nb-soft); }
.nb-ai-input:focus { outline: none; box-shadow: none; }

.nb-ai-send {
    height: 40px;
    padding: 0 16px;
    border-radius: 20px;
    background: var(--nb-chat);
    color: #ffffff;
    font-size: 13.5px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    cursor: pointer;
    border: none;
}
.nb-ai-send:disabled { background: var(--nb-dim); cursor: not-allowed; }

.nb-ai-foot-note { text-align: center; font-size: 11px; line-height: 16px; color: var(--nb-icon); }

/* empty / welcome */
.nb-ai-empty {
    width: 100%;
    max-width: 760px;
    margin: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 32px 4px;
    text-align: center;
    align-items: center;
}

.nb-ai-empty-mark {
    position: relative;
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: var(--nb-sage);
    font-size: 32px;
    font-weight: 700;
    color: var(--nb-ink);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.nb-ai-empty-mark .nb-dot {
    position: absolute;
    right: -2px;
    top: -4px;
    width: 14px;
    height: 14px;
    border-top-left-radius: 999px;
    border-bottom-right-radius: 999px;
    background: var(--nb-leaf);
}

.nb-ai-empty h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: var(--nb-forest);
    line-height: 1.25;
}

@media (min-width: 768px) { .nb-ai-empty h1 { font-size: 26px; } }

.nb-ai-empty p { margin: 0; max-width: 460px; font-size: 14px; line-height: 22px; color: var(--nb-muted); }

.nb-ai-starters {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 8px;
}

@media (min-width: 768px) { .nb-ai-starters { grid-template-columns: 1fr 1fr; } }

.nb-ai-starter {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 14px;
    background: #ffffff;
    border: 1px solid var(--nb-bubble);
    cursor: pointer;
    text-align: left;
    transition: border-color .12s, background .12s;
    width: 100%;
    font-family: inherit;
    color: var(--nb-ink);
}

.nb-ai-starter:hover { border-color: var(--nb-dim); background: #FBFCFA; }

.nb-ai-starter-ico {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nb-ai-starter-ico.green  { background: #E6EEDD; color: var(--nb-moss); }
.nb-ai-starter-ico.amber  { background: var(--nb-amberbg); color: #B26B00; }

.nb-ai-starter-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.nb-ai-starter-text .nb-ai-starter-title { font-size: 14.5px; font-weight: 600; }
.nb-ai-starter-text .nb-ai-starter-sub   { font-size: 12.5px; color: var(--nb-muted); }

/* voice overlay */
.nb-voice-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 20px;
    border: 1.5px solid var(--nb-forest);
    background: #ffffff;
}
.nb-voice-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.nb-voice-dot-wrap { position: relative; display: inline-flex; width: 10px; height: 10px; }
.nb-voice-dot-wrap .ping { position: absolute; inset: 0; border-radius: 999px; background: #D92D20; opacity: 0.6; animation: nb-ping 1.3s cubic-bezier(0,0,0.2,1) infinite; }
.nb-voice-dot-wrap .solid { position: relative; display: inline-block; width: 10px; height: 10px; border-radius: 999px; background: #D92D20; }
@keyframes nb-ping { 75%,100% { transform: scale(2); opacity: 0; } }

.nb-voice-label { font-size: 13.5px; font-weight: 600; color: var(--nb-forest); }
.nb-voice-sub   { font-size: 12.5px; color: var(--nb-soft); }
.nb-voice-timer { margin-left: auto; font-size: 12.5px; font-weight: 600; color: var(--nb-muted); }

.nb-voice-text { min-height: 44px; font-size: 15px; line-height: 22px; }

.nb-voice-actions { display: flex; align-items: center; gap: 12px; }
.nb-voice-cancel { font-size: 13.5px; font-weight: 600; color: var(--nb-muted); background: transparent; border: none; cursor: pointer; }
.nb-voice-wave { flex: 1; height: 36px; display: flex; align-items: center; justify-content: center; gap: 3px; overflow: hidden; }
.nb-voice-wave .bar { width: 3px; border-radius: 2px; background: var(--nb-leaf); height: 8px; animation: nb-wave 1.1s ease-in-out infinite; }
@keyframes nb-wave { 0%, 100% { height: 6px; } 50% { height: 24px; } }

.nb-voice-stop {
    width: 52px; height: 52px; border-radius: 50%;
    background: var(--nb-redfg);
    box-shadow: 0 0 0 8px rgba(180, 35, 24, 0.15);
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0; border: none; cursor: pointer;
}
.nb-voice-stop .sq { width: 16px; height: 16px; background: #ffffff; border-radius: 3px; }

.nb-voice-review-hint {
    display: flex; align-items: center; gap: 8px;
    font-size: 12.5px; font-weight: 500; color: var(--nb-forest);
}

.nb-voice-edit-wrap {
    display: flex; align-items: flex-end; gap: 8px;
    padding: 10px 8px 8px 16px;
    border-radius: 20px;
    border: 1.5px solid var(--nb-forest);
    background: #ffffff;
}

.nb-voice-textarea {
    flex: 1; min-width: 0;
    border: none; resize: none; padding: 2px 0;
    font-size: 15px; line-height: 22px; outline: none;
    font-family: inherit; color: var(--nb-ink);
    min-height: 44px;
    background: transparent;
}
.nb-voice-textarea:focus { outline: none; box-shadow: none; }

.nb-voice-retalk {
    width: 40px; height: 40px; border-radius: 50%;
    border: 1px solid var(--nb-field); color: var(--nb-forest);
    background: #ffffff; display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0; cursor: pointer;
}

/* preview card */
.nb-preview {
    width: 100%;
    background: #ffffff;
    border: 1px solid #DDE5D4;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.nb-preview-head {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px;
    background: var(--nb-wash);
    border-bottom: 1px solid var(--nb-line);
}

.nb-preview-head-ico {
    width: 32px; height: 32px; border-radius: 9px;
    background: #ffffff; border: 1px solid #DDE5D4;
    color: var(--nb-forest);
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.nb-preview-head-title { font-size: 14.5px; font-weight: 600; }
.nb-preview-head-sub   { font-size: 12px; color: var(--nb-muted); }

.nb-preview-badge {
    margin-left: auto;
    font-size: 11px; font-weight: 600;
    padding: 2px 8px; border-radius: 6px;
    background: var(--nb-amberbg); color: var(--nb-amberfg);
}

.nb-preview-body { padding: 12px 16px 14px; display: flex; flex-direction: column; gap: 10px; }

.nb-row { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; }
.nb-row .k { color: var(--nb-muted); }
.nb-row .v { text-align: right; font-weight: 600; }

.nb-items {
    border: 1px solid #EEF1EB;
    border-radius: 12px;
    overflow: hidden;
}
.nb-items .nb-items-head {
    display: grid; grid-template-columns: minmax(0,1fr) auto auto;
    gap: 12px; padding: 8px 12px;
    background: #FBFCFA;
    font-size: 11.5px; font-weight: 600; color: var(--nb-soft);
}
.nb-items .nb-items-head .amt { min-width: 72px; text-align: right; }

.nb-items .nb-items-row {
    display: grid; grid-template-columns: minmax(0,1fr) auto auto;
    gap: 12px; padding: 10px 12px;
    border-top: 1px solid #EEF1EB;
    font-size: 13.5px; align-items: center;
}
.nb-items .nb-items-row .q { color: var(--nb-muted); }
.nb-items .nb-items-row .amt { min-width: 72px; text-align: right; font-weight: 600; }

.nb-total { display: flex; justify-content: space-between; align-items: flex-end; }
.nb-total .l { font-size: 14px; font-weight: 600; }
.nb-total .v { font-size: 22px; font-weight: 700; }

.nb-note {
    background: var(--nb-mintbg);
    border-radius: 10px;
    padding: 10px 12px;
    display: flex; gap: 10px; align-items: flex-start;
    font-size: 13px; line-height: 19px;
}
.nb-note svg { color: var(--nb-forest); flex-shrink: 0; margin-top: 2px; }

.nb-preview-actions {
    display: flex; flex-wrap: wrap; gap: 8px;
    padding: 12px 16px 16px;
}

.nb-btn-primary {
    flex: 1 1 140px;
    height: 44px;
    border-radius: 10px;
    background: var(--nb-deep);
    color: #ffffff;
    font-size: 14px; font-weight: 600;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border: none; cursor: pointer;
}
.nb-btn-primary:hover { background: var(--nb-forest); }

.nb-btn-outline {
    flex: 1 1 90px;
    height: 44px;
    border-radius: 10px;
    background: #ffffff;
    color: var(--nb-forest);
    font-size: 14px; font-weight: 600;
    border: 1.5px solid var(--nb-forest);
    cursor: pointer;
}
.nb-btn-outline:hover { background: var(--nb-wash); }

.nb-btn-ghost {
    flex: 1 1 90px;
    height: 44px;
    border-radius: 10px;
    background: #ffffff;
    color: var(--nb-muted);
    font-size: 14px; font-weight: 600;
    border: 1px solid var(--nb-line);
    cursor: pointer;
}
.nb-btn-ghost:hover { background: var(--nb-wash); }

/* saved card */
.nb-saved {
    width: 100%;
    background: #ffffff;
    border: 1px solid #BFD3AE;
    border-radius: 16px;
    overflow: hidden;
}
.nb-saved-head {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px;
    background: var(--nb-mintbg);
}
.nb-saved-check {
    width: 28px; height: 28px; border-radius: 999px;
    background: var(--nb-moss); color: #ffffff;
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.nb-saved-title { font-size: 14.5px; font-weight: 600; }
.nb-saved-time  { margin-left: auto; font-size: 12px; color: var(--nb-body); }

/* tax answer bubble */
.nb-tax-bubble {
    width: 100%;
    padding: 14px 16px;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    background: #ffffff;
    border: 1px solid var(--nb-bubble);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.nb-tax-bubble .lead { font-size: 17px; font-weight: 700; color: var(--nb-forest); margin: 0; }
.nb-tax-bubble .body { font-size: 14px; line-height: 22px; margin: 0; }
.nb-tax-bubble .box  { background: var(--nb-wash); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.nb-tax-bubble .disclaimer {
    border-top: 1px solid #EEF1EB;
    padding-top: 10px;
    display: flex; gap: 10px; align-items: flex-start;
    font-size: 12.5px; line-height: 19px; color: var(--nb-muted);
    margin: 0;
}
.nb-tax-bubble .disclaimer svg { color: var(--nb-soft); flex-shrink: 0; margin-top: 2px; }

/* low balance alert */
.nb-low {
    width: 100%;
    padding: 14px 16px;
    border-radius: 16px;
    background: var(--nb-amberwash);
    border: 1px solid var(--nb-amberline);
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.nb-low-head { display: flex; gap: 12px; align-items: flex-start; }
.nb-low-ico {
    width: 36px; height: 36px; border-radius: 10px;
    background: var(--nb-amberbg); color: #B26B00;
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.nb-low-title { font-size: 14.5px; font-weight: 600; margin: 0; }
.nb-low-body  { font-size: 13.5px; line-height: 21px; color: var(--nb-body); margin: 2px 0 0; }
.nb-low-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.nb-low-topup {
    height: 42px; padding: 0 20px;
    border-radius: 10px;
    background: var(--nb-deep); color: #ffffff;
    font-size: 14px; font-weight: 600;
    display: inline-flex; align-items: center; gap: 8px;
    border: none; cursor: pointer;
    text-decoration: none;
}
.nb-low-topup:hover { background: var(--nb-forest); }
.nb-low-link { padding: 0 8px; font-size: 13.5px; font-weight: 600; color: var(--nb-forest); text-decoration: none; }
.nb-low-link:hover { color: var(--nb-leaf); }

/* suggestion chips below reply */
.nb-chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.nb-chip {
    height: 34px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid var(--nb-field);
    background: #ffffff;
    font-size: 13px;
    font-weight: 500;
    color: var(--nb-forest);
    cursor: pointer;
}
.nb-chip:hover { background: var(--nb-wash); }

/* page assistant panel */
.nb-pa-panel {
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border: 1px solid var(--nb-line);
    border-radius: 14px;
    overflow: hidden;
}
.nb-pa-header {
    display: flex; align-items: center; gap: 10px;
    height: 58px; padding: 0 14px 0 16px;
    border-bottom: 1px solid var(--nb-line);
    background: #ffffff;
}
.nb-pa-head-ico {
    width: 32px; height: 32px; border-radius: 999px;
    background: var(--nb-sage);
    font-size: 15px; font-weight: 700; color: var(--nb-ink);
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.nb-pa-head-title { font-size: 14.5px; font-weight: 600; }
.nb-pa-head-sub   { font-size: 11.5px; color: var(--nb-muted); }

.nb-pa-toggle {
    margin-left: auto;
    width: 36px; height: 36px;
    border-radius: 9px;
    border: 1px solid var(--nb-line);
    color: var(--nb-forest);
    background: #ffffff;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer;
}
.nb-pa-toggle:hover { background: var(--nb-wash); }

.nb-pa-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
}

.nb-pa-messages { margin-top: auto; display: flex; flex-direction: column; gap: 14px; }

.nb-pa-ai-row { display: flex; align-items: flex-start; gap: 8px; }
.nb-pa-ai-avatar {
    width: 26px; height: 26px; border-radius: 999px;
    background: var(--nb-sage); border: 2px solid var(--nb-bubble);
    font-size: 12px; font-weight: 700; color: var(--nb-ink);
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.nb-pa-ai-bubble {
    padding: 10px 14px;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    border: 1px solid var(--nb-bubble);
    background: #ffffff;
    font-size: 13.5px; line-height: 21px;
}
.nb-pa-user-row { display: flex; justify-content: flex-end; }
.nb-pa-user-bubble {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    border-bottom-right-radius: 4px;
    background: var(--nb-chat); color: #ffffff;
    font-size: 13.5px; line-height: 21px;
}

.nb-pa-footer {
    flex-shrink: 0;
    border-top: 1px solid var(--nb-line);
    padding: 10px 12px 12px;
    display: flex; flex-direction: column; gap: 6px;
}

.nb-pa-composer {
    display: flex; align-items: center; gap: 6px;
    height: 48px; padding: 0 5px;
    border-radius: 24px;
    border: 1.5px solid var(--nb-field);
    background: var(--nb-inputbg);
}
.nb-pa-composer:focus-within { border-color: var(--nb-forest); }

.nb-pa-mic {
    width: 36px; height: 36px; border-radius: 999px;
    background: #ffffff; color: var(--nb-forest);
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0; border: none; cursor: pointer;
}
.nb-pa-mic.recording { background: var(--nb-redbg); color: var(--nb-redfg); }

.nb-pa-input {
    flex: 1; min-width: 0; border: none; background: transparent; padding: 0;
    font-size: 13px; color: var(--nb-ink); outline: none;
}
.nb-pa-input::placeholder { color: var(--nb-soft); }

.nb-pa-send {
    height: 36px; padding: 0 12px; border-radius: 18px;
    background: var(--nb-chat); color: #ffffff;
    font-size: 13px; font-weight: 600;
    display: inline-flex; align-items: center; gap: 6px;
    flex-shrink: 0; border: none; cursor: pointer;
}
.nb-pa-send:disabled { background: var(--nb-dim); cursor: not-allowed; }

.nb-pa-foot-link { text-align: center; font-size: 11px; color: var(--nb-soft); text-decoration: none; }
.nb-pa-foot-link:hover { color: var(--nb-forest); }

/* small utility */
.nb-flex { display: flex; }
.nb-flex-col { display: flex; flex-direction: column; }
.nb-gap-2 { gap: 8px; }
.nb-gap-3 { gap: 12px; }
.nb-items-center { align-items: center; }
.nb-items-start  { align-items: flex-start; }
.nb-justify-between { justify-content: space-between; }
.nb-ml-auto { margin-left: auto; }
.nb-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* avoid phone horizontal scroll */
@media (max-width: 420px) {
    .nb-ai-messages, .nb-ai-footer-inner { padding-left: 0; padding-right: 0; }
}

/* ─────────────────────────────────────────────────────────────────────
   v3 Lane C, Batch 4b. SCAN A PHOTO.
   Design: design/scanning/Scan/HTML/02 Take photo or upload.html, 03 Scanning.html,
           06 Could not read it.html.
   Phone, tablet and laptop share the same sheet; grid flips to one column
   below md so the Take-photo and Upload cards do not shrink to unreadable.
   ─────────────────────────────────────────────────────────────────── */

.nb-scan-sheet {
    width: 100%;
    max-width: 760px;
    margin: 0 auto 10px auto;
    border: 1px solid #DDE5D4;
    border-radius: 18px;
    background: #FFFFFF;
    box-shadow: 0 8px 28px rgba(28, 42, 17, 0.14);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-family: 'Poppins', ui-sans-serif, system-ui, sans-serif;
}

.nb-scan-sheet-head {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nb-scan-sheet-title {
    font-size: 15px;
    font-weight: 600;
    color: #1C2A11;
}

.nb-scan-sheet-sub {
    font-size: 12.5px;
    color: #4B5545;
}

.nb-scan-sheet-close {
    margin-left: auto;
    width: 36px;
    height: 36px;
    border-radius: 9px;
    border: 1px solid #E6EAE1;
    background: #FFFFFF;
    color: #314025;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
}

.nb-scan-sheet-close:hover { background: #F3F6EF; }
.nb-scan-sheet-close:disabled { opacity: 0.4; cursor: not-allowed; }

.nb-scan-sheet-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

@media (min-width: 768px) {
    .nb-scan-sheet-grid { grid-template-columns: 1fr 1fr; }
}

.nb-scan-choice {
    min-height: 64px;
    border: 1px solid #E3EAD9;
    border-radius: 14px;
    background: #FBFCFA;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    transition: border-color 0.15s;
}

.nb-scan-choice:hover { border-color: #A7B49C; }
.nb-scan-choice-disabled { opacity: 0.5; cursor: not-allowed; }

.nb-scan-choice-ico {
    width: 42px;
    height: 42px;
    border-radius: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nb-scan-choice-ico-dark {
    background: #2B3A20;
    color: #FFFFFF;
}

.nb-scan-choice-ico-light {
    background: #E6EEDD;
    color: #4E7A2E;
}

.nb-scan-choice-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.nb-scan-choice-title {
    font-size: 14.5px;
    font-weight: 600;
    color: #1C2A11;
}

.nb-scan-choice-sub {
    font-size: 12.5px;
    color: #4B5545;
}

.nb-scan-sheet-help {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 12px;
    line-height: 18px;
    color: #4B5545;
}

.nb-scan-sheet-help svg {
    margin-top: 2px;
    color: #5A6552;
    flex-shrink: 0;
}

.nb-scan-sheet-error {
    font-size: 12.5px;
    color: #B42318;
    background: #FDECEA;
    border: 1px solid #F5B5AD;
    border-radius: 10px;
    padding: 8px 10px;
}

/* The camera button in the composer. Dark pill when the sheet is closed; it toggles to a lighter
   fill when the sheet is open so the merchant sees which state they are in. */
.nb-scan-cam-btn {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #2B3A20;
    color: #FFFFFF;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s;
}

.nb-scan-cam-btn:hover { background: #314025; }

.nb-scan-cam-btn.nb-scan-cam-open {
    background: #FFFFFF;
    color: #314025;
    border: 1px solid #CDD6C5;
}

.nb-scan-cam-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ─────────────────────────────────────────────────────────────────────
   SCANNING ANIMATION (03 Scanning.html).
   Rendered inside the chat as a message bubble while the vision service
   works. The animation is CSS only; no JS, no polling.
   ─────────────────────────────────────────────────────────────────── */

.nb-scan-progress {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    border-radius: 16px 16px 16px 4px;
    background: #FFFFFF;
    border: 1px solid #E3EAD9;
}

.nb-scan-progress-title {
    font-size: 15px;
    font-weight: 600;
    color: #314025;
}

.nb-scan-progress-sub {
    font-size: 13px;
    line-height: 20px;
    color: #4B5545;
}

.nb-scan-progress-steps {
    display: flex;
    flex-direction: column;
    gap: 7px;
    font-size: 13px;
}

.nb-scan-progress-step {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #1C2A11;
}

.nb-scan-progress-step-dot {
    width: 18px;
    height: 18px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: #FFFFFF;
    border: 1.5px solid #CDD6C5;
}

.nb-scan-progress-step.active .nb-scan-progress-step-dot {
    border-color: #4E7A2E;
    border-width: 2px;
}

.nb-scan-progress-step.active { font-weight: 600; }

.nb-scan-progress-step.done .nb-scan-progress-step-dot {
    background: #4E7A2E;
    border-color: #4E7A2E;
    color: #FFFFFF;
}

.nb-scan-dots::after {
    content: '...';
    display: inline-block;
    animation: nb-scan-dot-pulse 1.4s infinite steps(4, end);
    width: 1.2em;
    overflow: hidden;
    vertical-align: bottom;
}

@keyframes nb-scan-dot-pulse {
    0%, 100% { width: 0; }
    25% { width: 0.4em; }
    50% { width: 0.8em; }
    75% { width: 1.2em; }
}

/* "Could not read it" and other action-row messages in the chat (06 Could not read it.html). */
.nb-scan-action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}

.nb-scan-action-row > a,
.nb-scan-action-row > button {
    flex: 1 1 150px;
    min-height: 44px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    cursor: pointer;
    border: none;
}

.nb-scan-action-primary {
    background: #2B3A20;
    color: #FFFFFF;
}

.nb-scan-action-primary:hover { background: #314025; }

.nb-scan-action-outline {
    background: #FFFFFF;
    color: #314025;
    border: 1.5px solid #314025 !important;
}

.nb-scan-action-outline:hover { background: #F3F6EF; }

.nb-scan-free-note {
    font-size: 12.5px;
    color: #4B5545;
}
