/* =========================================================
   Question AI · input card (CO-0008101)
   Figma: Calculator-Online › "question ai" (8521:6363)
   Markup: app/Modules/AiTools/Resources/views/question-ai.blade.php

   Everything is scoped under .qai-* so it can't collide with the shared
   AI scripts/styles (ai-style.css, latest-keyboard's global .tab/.btn rules)
   or with the AI Math Solver's .ams-* styles.
   ========================================================= */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

.qai-shell {
    --qai-blue: #2277AB;
    --qai-blue-soft: #EFF6FF;
    --qai-border: #DEE0E3;
    --qai-input-bg: #F8FAFC;
    --qai-muted: #AAAAAA;
    --qai-text: #000000;
    --qai-focus: 0 0 0 3px rgba(34, 119, 171, .25);
    width: 100%;
}

/* the global `* { font: Lato }` reset hits every descendant directly */
.qai-shell,
.qai-shell *:not(.katex):not(.katex *):not(.mq-math-mode):not(.mq-math-mode *),
.qai-menu,
.qai-menu *,
#advanceModal,
#advanceModal * {
    font-family: 'Inter', sans-serif;
}

/* ---------- Card ---------- */
.qai-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 20px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 0 6px 0 rgba(21, 143, 217, .2);
    box-sizing: border-box;
    position: relative;
}
/* input area + separator + toolbar: keeps the card's 10px rhythm between them */
.qai-box {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.qai-divider {
    height: 1px;
    width: 100%;
    background: #E5E7EB;
    flex-shrink: 0;
}

/* ---------- Tabs ---------- */
.qai-tabs,
.qai-tabs.button-container {
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    gap: 10px;
    align-items: center;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    /* room for the focus ring, which overflow would otherwise clip — and the
       snap must keep that padding, or it scrolls 3px and cuts the first tab */
    padding: 3px;
    margin: -3px;
    scroll-padding-inline: 3px;
}
.qai-tabs::-webkit-scrollbar { display: none; }
.qai-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 36px;
    padding: 0 20px;
    flex-shrink: 0;
    scroll-snap-align: start;
    background: #fff;
    border: 1.19px solid var(--qai-border);
    border-radius: 65px;
    color: var(--qai-text);
    font-size: 12px;
    font-weight: 400;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}
.qai-tab:hover { background: var(--qai-blue-soft); }
.qai-tab.active {
    background: var(--qai-blue-soft);
    border: 1px solid var(--qai-blue);
    color: var(--qai-blue);
    font-weight: 500;
}
.qai-tab img {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* ---------- Input area ---------- */
.qai-input-area {
    position: relative;
    background: var(--qai-input-bg);
    border-radius: 10px;
    padding: 20px;
    min-height: 140px;
    box-sizing: border-box;
    border: 1px solid transparent;
    transition: border-color .15s;
}
.qai-input-area.qai-focused { border-color: var(--qai-blue); }

/* #newInput also gets rules from ai-style.css / the old page CSS — beat them */
/* p#newInput[contenteditable] beats aitools.css's rule of the same shape
   (padding: 10px; line-height: 1.5), which pushed the caret off the placeholder */
.qai-input-area p#newInput[contenteditable] {
    display: block;
    width: 100%;
    min-width: 0 !important;
    min-height: 100px !important;
    margin: 0;
    padding: 0;
    border: none;
    outline: none;
    background: transparent;
    color: var(--qai-text);
    font-size: 14px;
    font-weight: 400;
    line-height: 20px;
    letter-spacing: normal;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
    position: relative;
    z-index: 1;
}
/* the placeholder is drawn by .qai-hint (so it can carry the Sample button) */
.qai-input-area #newInput.placeholder::before,
.qai-input-area #newInput::before { content: none !important; }

.qai-hint {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2;
    pointer-events: none;
    color: var(--qai-muted);
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
}
.qai-hint.d-none { display: none !important; }
.qai-hint-text { margin-right: 10px; }
.qai-hint-text .qai-chip {
    display: inline-block;
    padding: 0 6px;
    border-radius: 4px;
    background: var(--qai-blue-soft);
    color: var(--qai-blue);
    font-weight: 500;
}
.qai-sample-btn {
    pointer-events: auto;
    display: inline-flex;
    align-items: center;
    gap: 5.6px;
    padding: 5.6px 11.26px;
    background: #fff;
    border: .94px solid #E5E7EB;
    border-radius: 5px;
    color: var(--qai-text);
    font-size: 11.26px;
    font-weight: 500;
    line-height: 1;
    vertical-align: middle;
    cursor: pointer;
    white-space: nowrap;
    transition: border-color .15s, background .15s;
}
.qai-sample-btn:hover { border-color: var(--qai-blue); background: var(--qai-blue-soft); }
.qai-sample-btn img { width: 7.6px; height: 7.6px; }
.qai-sample-btn.d-none { display: none !important; }

/* uploaded-file tile (markup injected by ai-scripts-manager) */
.qai-input-area #uploadedArea { margin-bottom: 10px; }
.qai-input-area #uploadedFiles { margin: 0; }

/* translate: from → to language pickers */
.qai-input-area .dropdown-container {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0;
    margin-bottom: 12px;
    position: relative;
    z-index: 3;
}
.qai-input-area .dropdown-container.d-none { display: none !important; }
.qai-input-area .custom-dropdown { position: relative; width: 170px; max-width: 45%; }
.qai-input-area .dropdown-selected {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 12px;
    border: 1px solid var(--qai-border);
    border-radius: 8px;
    background: #fff;
    color: var(--qai-text);
    font-size: 12px;
    cursor: pointer;
}
.qai-input-area .dropdown-selected::after {
    content: "";
    width: 4px;
    height: 7px;
    transform: rotate(-90deg);
    background: url('../assets/question-ai/tb-caret-down.svg') center / contain no-repeat;
}
.qai-input-area .dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 100%;
    max-height: 240px;
    overflow-y: auto;
    background: #fff;
    border: none;
    border-radius: 10px;
    box-shadow: 0 0 2px rgba(0, 0, 0, .2), 0 8px 24px rgba(16, 24, 40, .12);
    padding: 6px;
    display: none;
    z-index: 20;
}
.qai-input-area .custom-dropdown.active .dropdown-menu { display: block; }
.qai-input-area .dropdown-option {
    padding: 6px 8px;
    border-radius: 5px;
    font-size: 12px;
    line-height: 20px;
    color: var(--qai-text);
    cursor: pointer;
}
.qai-input-area .dropdown-option:hover,
.qai-input-area .dropdown-option:focus { background: var(--qai-blue-soft); outline: none; }
.qai-input-area .dropdown-option.selected { background: var(--qai-blue-soft); color: var(--qai-blue); }
.qai-input-area .dropdown-option.selected::after { content: none; }
.qai-input-area .arrow { color: #6B7280; font-size: 16px; }

/* ---------- Toolbar ---------- */
.qai-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.qai-tools-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
/* flex, not block: a block wrapper around the inline-flex button adds a text
   line box (descender space) and pushed "+" / Tutor Mode 2px off the row */
.qai-dropdown { position: relative; display: inline-flex; align-items: center; }
.qai-tool-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 36px;
    min-width: 36px;
    padding: 0 7px;
    box-sizing: border-box;
    background: #fff;
    border: 1.19px solid var(--qai-border);
    border-radius: 8px;
    color: var(--qai-text);
    font-size: 12px;
    font-weight: 400;
    white-space: nowrap;
    cursor: pointer;
    position: relative;
    transition: background .15s, border-color .15s;
}
.qai-tool-btn:hover,
.qai-tool-btn.active,
.qai-tool-btn[aria-expanded="true"] {
    background: var(--qai-blue-soft);
    border-color: var(--qai-blue);
}
.qai-tool-btn.d-none { display: none !important; }
/* icon-only buttons ("+", keyboard, bulb): identical square boxes */
.qai-tool-btn--square { width: 36px; padding: 0; }
/* higher specificity than the generic ".qai-tool-btn .qai-ico" (20.7px) below —
   the Figma glyph is 13.5px, thin */
.qai-tool-btn.qai-tool-btn--plus .qai-ico.qai-ico--plus { width: 13.5px; height: 13.5px; }
/* Figma: 15px sides, icon and label touching, 8px to a 7px-wide caret (131.9 × 36) */
.qai-tool-btn--mode { padding: 0 15px; border-radius: 10px; gap: 0; }
.qai-tool-btn--mode .qai-mode-label { margin-right: 8px; }
.qai-tool-btn .qai-ico { width: 20.7px; height: 20.7px; flex-shrink: 0; }
.qai-tool-btn .qai-ico--bulb { width: 21px; height: 21px; }
.qai-tool-btn .qai-caret { width: 4px; height: 7px; margin: 0 1.5px; transform: rotate(-90deg); transition: transform .15s; }
.qai-tool-btn[aria-expanded="true"] .qai-caret { transform: rotate(90deg); }

/* ---------- Solve ---------- */
.qai-shell #convert,
.qai-kb-solve {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 45px;
    padding: 0 38px;
    margin: 0;
    border: none;
    border-radius: 10px;
    background: var(--qai-blue);
    color: #fff;
    font-size: 18px;
    font-weight: 600;
    line-height: 15px;
    white-space: nowrap;
    cursor: pointer;
    flex-shrink: 0;
    transition: filter .15s, opacity .15s;
}
/* sendMessage() re-injects "Solve <img send.png>" after every request */
.qai-shell #convert img { display: none !important; }
.qai-shell #convert:hover:not(:disabled),
.qai-kb-solve:hover:not(:disabled) { filter: brightness(1.08); }
.qai-shell #convert:disabled,
.qai-kb-solve:disabled {
    opacity: .5;
    cursor: not-allowed;
}

/* ---------- Dropdown menus ("+" and mode) ---------- */
.qai-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 60;
    display: none;
    flex-direction: column;
    gap: 8px;
    padding: 10px 15px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 0 2px 0 rgba(0, 0, 0, .2), 0 6px 18px rgba(16, 24, 40, .08);
    min-width: 170px;
    box-sizing: border-box;
}
.qai-menu.open { display: flex; }
.qai-menu--plus { min-width: 201px; }
.qai-menu-sep { height: 1px; background: #E5E7EB; margin: 0; border: none; }
.qai-menu-item {
    display: flex;
    align-items: center;
    gap: 5px;
    width: 100%;
    padding: 5px 3px;
    background: none;
    border: none;
    border-radius: 5px;
    color: var(--qai-text);
    font-size: 12px;
    font-weight: 400;
    line-height: 20px;
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
}
.qai-menu-item:hover { background: var(--qai-blue-soft); }
.qai-menu-item.active { background: var(--qai-blue-soft); color: var(--qai-blue); }
.qai-menu-item:disabled { opacity: .45; cursor: not-allowed; background: none; }
.qai-menu-item img { width: 16px; height: 16px; flex-shrink: 0; }
.qai-menu-item .qai-mi-chev { width: 4px; height: 7px; margin-left: auto; transform: rotate(180deg); }
.qai-menu-item .qai-mi-value { margin-left: auto; color: #6B7280; font-size: 11px; }
.qai-menu-item .qai-mi-value + .qai-mi-chev { margin-left: 6px; }
.qai-menu-clear {
    width: 100%;
    padding: 7.5px 10px;
    background: #fff;
    border: .5px solid var(--qai-border);
    border-radius: 5px;
    color: var(--qai-text);
    font-size: 12px;
    cursor: pointer;
}
.qai-menu-clear:hover { border-color: var(--qai-blue); color: var(--qai-blue); }

/* language sub-panel inside the "+" menu */
.qai-lang-panel { display: none; flex-direction: column; gap: 6px; }
.qai-menu.show-lang .qai-lang-panel { display: flex; }
.qai-menu.show-lang .qai-plus-main { display: none; }
.qai-plus-main { display: flex; flex-direction: column; gap: 8px; }
.qai-lang-back { font-weight: 500; }
.qai-lang-back img { width: 4px !important; height: 7px !important; margin: 0 4px; }
.qai-lang-search {
    width: 100%;
    border: 1px solid var(--qai-border);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 12px;
    outline: none;
    box-sizing: border-box;
}
.qai-lang-search:focus { border-color: var(--qai-blue); box-shadow: var(--qai-focus); }
.qai-lang-list { max-height: 200px; overflow-y: auto; display: flex; flex-direction: column; }
.qai-lang-empty { font-size: 12px; color: #6B7280; padding: 6px 3px; }

/* ---------- Tooltips ---------- */
.qai-tip {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: #4b4b4b;
    color: #fff;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.45;
    text-align: center;
    white-space: normal;
    width: max-content;
    max-width: 200px;
    padding: 7px 10px;
    border-radius: 8px;
    pointer-events: none;
    z-index: 70;
    transition: opacity .15s, transform .15s;
}
.qai-tip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #4b4b4b;
}
.qai-tool-btn:hover > .qai-tip,
.qai-tool-btn:focus-visible > .qai-tip {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
/* no tooltip while that button's own menu is open */
.qai-tool-btn[aria-expanded="true"] > .qai-tip { visibility: hidden; opacity: 0; }

/* ---------- Keyboard focus (ticket: focus on all inputs and buttons) ---------- */
.qai-shell button:focus-visible,
.qai-shell [role="menuitem"]:focus-visible,
.qai-shell [role="option"]:focus-visible,
.qai-shell .dropdown-selected:focus-visible,
#advanceModal a:focus-visible,
#advanceModal button:focus-visible {
    outline: none;
    box-shadow: var(--qai-focus);
}
.qai-shell #newInput:focus-visible { outline: none; }

/* ---------- Math keyboard (desktop: inline under the card) ----------
   Restyles this page's copy of x-latest-keyboard to the Figma keypad.
   The component ships global rules (.tabs/.tab/.btn, one with !important,
   and `div.buttons#btnsForAll button.btn`), hence the long selectors. */
.qai-kb-head { display: none; }
.qai-shell #keyboard.qai-kb {
    margin-top: 12px;
    padding: 0;
    background: transparent;
    border-radius: 0;
}
.qai-shell #keyboard .calculator-buttons { margin-top: 0; }
.qai-shell #keyboard .tabs {
    display: flex;
    align-items: center;
    border: none;
    border-radius: 12px;
    background: #F3F4F6;
    padding: 6px;
    margin-bottom: 14px;
    overflow: hidden;
}
.qai-shell #keyboard .tabs .tab-navigation { display: none !important; }
.qai-shell #keyboard .tabs > .tctd {
    display: flex;
    gap: 4px;
    width: 100%;
    margin: 0;
    overflow-x: auto;
    scrollbar-width: none;
}
.qai-shell #keyboard .tabs > .tctd::-webkit-scrollbar { display: none; }
.qai-shell #keyboard .tabs .tctd > button.tab {
    flex: 0 0 auto;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: #374151;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}
.qai-shell #keyboard .tabs .tctd > button.tab.active {
    background: var(--qai-blue) !important;
    color: #fff !important;
}
.qai-shell #keyboard .tabs .tctd > button.tab > span.keyboard-help-text { display: inline !important; }
.qai-shell #keyboard .buttons,
.qai-shell #keyboard .buttons-other {
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
}
.qai-shell #keyboard #btnsForAll { margin-top: 8px !important; }
.qai-shell #keyboard .calculator-buttons button.btn {
    height: 50px;
    padding: 4px;
    border: 1px solid #EEF2F7;
    border-radius: 10px;
    background: #F8FAFC;
    color: #6B7280;
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    box-shadow: none;
    transition: filter .15s, background .15s;
}
.qai-shell #keyboard .calculator-buttons button.btn:hover { filter: brightness(.96); }
.qai-shell #keyboard .calculator-buttons button.btn.qai-key--num { background: #fff; color: #111827; font-weight: 500; }
.qai-shell #keyboard .calculator-buttons button.btn.qai-key--op { background: #EFF6FF; color: var(--qai-blue); border-color: #E3EEFB; }
.qai-shell #keyboard .calculator-buttons button.btn.qai-key--clr { background: #F8FAFC; color: #111827; font-weight: 700; }
.qai-shell #keyboard .calculator-buttons button.btn.qai-key--nav { background: #fff; color: #374151; }
.qai-shell #keyboard .calculator-buttons button.btn.qai-key--pi { background: #EEF2FB; color: #1F2937; }
.qai-shell #keyboard .calculator-buttons button.btn.qai-key--bksp { background: #E5E7EB; color: #111827; }
.qai-shell #keyboard .calculator-buttons button.btn img { width: 22px; height: 22px; }
.qai-shell #keyboard .calculator-buttons button.btn .katex { white-space: nowrap; }
/* Solve inside the keypad: mobile modal only (desktop has the card's Solve) */
.qai-shell #keyboard .qai-kb-key-solve { display: none; }

/* ---------- Mobile ---------- */
@media (max-width: 767px) {
    /* the layout's tool-box wrapper (calculator-page.blade.php) — no side
       padding, so the card gets the full content width like in the design */
    .page-question-ai { padding-left: 0 !important; padding-right: 0 !important; }
    /* mobile design order of the tab slider: Solve, AI Search, Ai Writing, Translate, Summarize */
    .qai-tab[data-tab="ai_search"] { order: 1; }
    .qai-tab[data-tab="ai_writing"] { order: 2; }
    .qai-tab[data-tab="translate"] { order: 3; }
    .qai-tab[data-tab="summarize"] { order: 4; }
    /* mobile design: no outer card — the tabs sit on the page and the input,
       Sample, divider, toolbar and Solve share one white box with a blue border */
    .qai-card { padding: 0; gap: 11px; background: transparent; box-shadow: none; }
    .qai-divider--top { display: none; }
    .qai-tabs, .qai-tabs.button-container { gap: 5.5px; }
    .qai-tab { height: 33px; padding: 0 15px; gap: 2px; }
    .qai-tab img { width: 18px; height: 18px; }
    .qai-box { background: #fff; border: 1px solid var(--qai-blue); border-radius: 16px; padding: 12px 10px 10px; gap: 12px; }
    .qai-input-area { background: #fff; padding: 0; min-height: 100px; border: none; }
    .qai-input-area.qai-focused { border: none; }
    .qai-input-area p#newInput[contenteditable] { font-size: 13px; min-height: 90px !important; }
    .qai-hint {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 8px;
        font-size: 13px;
    }
    .qai-hint-text { margin-right: 0; }
    .qai-sample-btn {
        padding: 4px 8px;
        border-radius: 5px;
        border-color: #E5E7EB;
        background: #F3F4F6;
        font-size: 11px;
    }
    .qai-toolbar { gap: 6px; }
    .qai-tools-left { gap: 5px; }
    /* mobile design: the icon buttons and the answer-mode pill are one 26px row;
       the pill is light blue with a blue border, icon and label */
    .qai-tool-btn { height: 26px; min-width: 26px; border-radius: 6px; }
    .qai-tool-btn--square { width: 26px; padding: 0; }
    .qai-tool-btn--square .qai-ico { width: 15px; height: 15px; }
    .qai-tool-btn.qai-tool-btn--plus .qai-ico.qai-ico--plus { width: 11px; height: 11px; }
    .qai-tool-btn--mode {
        padding: 0 11px;
        border-radius: 6px;
        font-size: 12.5px;
        background: var(--qai-blue-soft);
        border-color: var(--qai-blue);
        color: var(--qai-blue);
    }
    .qai-tool-btn--mode .qai-ico { width: 10px; height: 10px; margin-right: 5px; }
    .qai-tool-btn--mode .qai-mode-label { margin-right: 3px; }
    .qai-tool-btn--mode .qai-caret { width: 3.5px; height: 6px; margin: 0 1.25px; }
    .qai-tool-btn--mode .qai-ico,
    .qai-tool-btn--mode .qai-caret { filter: invert(33%) sepia(62%) saturate(747%) hue-rotate(166deg) brightness(92%) contrast(88%); }
    .qai-shell #convert {
        height: 35px;
        min-width: 85px;
        padding: 0 18px;
        border-radius: 7px;
        font-size: 17px;
        box-shadow: 0 4px 10px rgba(34, 119, 171, .25);
    }
    .qai-shell #convert:disabled { box-shadow: none; }
    .qai-tip { display: none; }
    .qai-menu--mode { left: auto; right: 0; }
}
@media (max-width: 330px) {
    .qai-tool-btn--mode .qai-mode-label { display: none; }
}

/* ---------- Mobile: keyboard opens as a modal with its own input + Solve ---------- */
body.qai-no-scroll { overflow: hidden; }
@media (max-width: 767px) {
    .qai-shell.qai-kb-open {
        position: fixed;
        inset: 0;
        /* above the sticky site header */
        z-index: 2147483000;
        background: rgba(0, 0, 0, .55);
        padding: 16px;
        overflow-y: auto;
        box-sizing: border-box;
    }
    .qai-shell.qai-kb-open .qai-kb-sheet {
        background: #fff;
        border-radius: 28px;
        padding: 20px 16px 18px;
        position: relative;
        max-width: 480px;
        margin: 28px auto 0;
    }
    .qai-shell.qai-kb-open .qai-card { box-shadow: none; padding: 0; }
    .qai-shell.qai-kb-open .qai-box { border: none; border-radius: 0; padding: 0; }
    /* in the modal the mode picker is the blue pill from the design */
    .qai-shell.qai-kb-open .qai-tool-btn--mode {
        height: 38px;
        padding: 0 16px;
        border-radius: 20px;
        border-color: var(--qai-blue);
        color: var(--qai-blue);
        font-size: 14px;
    }
    .qai-shell.qai-kb-open .qai-tool-btn--mode .qai-caret,
    .qai-shell.qai-kb-open .qai-tool-btn--mode .qai-ico { filter: invert(33%) sepia(62%) saturate(747%) hue-rotate(166deg) brightness(92%) contrast(88%); }
    .qai-shell.qai-kb-open #qaiTipsBtn { height: 38px; min-width: 38px; }
    .qai-shell.qai-kb-open .qai-divider:not(.qai-divider--top) { margin-bottom: 6px; }
    .qai-shell.qai-kb-open #keyboard .qai-kb-key-solve {
        display: inline-flex;
        grid-column: span 2;
        width: auto;
        height: 50px;
        padding: 0;
        border-radius: 10px;
        font-size: 18px;
    }
    .qai-shell.qai-kb-open .qai-tabs,
    .qai-shell.qai-kb-open .qai-divider--top,
    .qai-shell.qai-kb-open .qai-dropdown--plus,
    .qai-shell.qai-kb-open .qai-keyboard-btn,
    .qai-shell.qai-kb-open #convert { display: none !important; }
    .qai-shell.qai-kb-open .qai-input-area { min-height: 0; background: #fff; padding: 10px 0; border: none; }
    .qai-shell.qai-kb-open .qai-input-area #newInput { min-height: 70px !important; }
    .qai-shell.qai-kb-open .qai-kb-head { display: block; }
    .qai-kb-close {
        position: absolute;
        top: -10px;
        right: -6px;
        width: 44px;
        height: 44px;
        border-radius: 50%;
        border: none;
        background: #F3F4F6;
        color: #111;
        font-size: 18px;
        line-height: 1;
        cursor: pointer;
        box-shadow: 0 1px 4px rgba(0, 0, 0, .15);
    }
}

/* ---------- "Unlock Advanced Model" modal (bulb) ---------- */
#advanceModal.adv-modal {
    display: none;
    position: fixed;
    z-index: 100000000;
    inset: 0;
    background: rgb(0 0 0 / .4);
    justify-content: center;
    align-items: center;
    padding: 20px;
}
#advanceModal .adv-modal-content {
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    width: 500px;
    max-width: 100%;
    box-shadow: 0 5px 15px rgba(0, 0, 0, .3);
}
#advanceModal .qai-adv-close {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    line-height: 0;
    border-radius: 4px;
}
#advanceModal .upgrade-pro {
    display: inline-block;
    text-decoration: none;
    background: #1670a7 !important;
    color: #fff;
    padding: 9px 18px;
    font-size: 14px;
    border-radius: 8px;
}

/* ---------- Page title (layout adds .qai-page-title on this page) ----------
   Figma: centred, black, Inter Bold 34 / subtitle Inter 16 on 27 — mobile 24 / 14. */
.qai-page-title,
.qai-page-title *,
#after_title_line { font-family: 'Inter', sans-serif !important; }
.qai-page-title { color: #000 !important; font-size: 34px !important; line-height: 1.2; margin-bottom: 2px; }
.qai-page-title strong { font-weight: 700; }
#after_title_line { color: #000; font-size: 16px !important; line-height: 27px; max-width: 1000px; margin: 0 auto 8px; padding: 0 !important; }
@media (max-width: 767px) {
    .qai-page-title { font-size: 24px !important; margin-top: 6px; }
    #after_title_line { font-size: 14px !important; line-height: 18px; margin-bottom: 6px; }
}
