/* Buunix Command: presentation only. Base component contracts remain in app.css. */
:root {
  --bg: #11121b; --surface: #1b1c27; --surface2: #242530; --surface3: #2a2c39;
  --border: #30323f; --border2: #484b5c; --text: #f4f5f8; --muted: #b2b5c4; --faint: #989cad;
  --accent: #53c6f1; --accent-soft: rgba(83,198,241,.1); --accent-hi: #91e1ff;
  --action: #ff880a; --action-hover: #ff9e35; --action-soft: rgba(255,136,10,.12);
  --green: #78ddb0; --red: #ff9199; --amber: #ffce79;
  --radius: 14px; --ring: 0 0 0 3px rgba(83,198,241,.45);
  --shadow: 0 16px 48px rgba(0,0,0,.3);
  color-scheme: dark;
}
[hidden] { display: none !important; }
html, body { min-width: 0; }
body { background: var(--bg); font-size: 14px; }
button, input, select, textarea, a { -webkit-tap-highlight-color: transparent; }
button, a, input, select, textarea { touch-action: manipulation; }
button { overflow-wrap: anywhere; }
button:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; box-shadow: none; }
input, textarea, select { border-radius: 10px; border-color: var(--border2); }
input::placeholder, textarea::placeholder { color: var(--faint); opacity: 1; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: var(--ring); }
.btn { min-height: 38px; padding: 8px 16px; border-radius: 10px; box-shadow: none; }
.btn-primary { background: var(--action); color: #18120b; border: 1px solid var(--action); box-shadow: none; font-weight: 800; }
.btn-primary:hover { background: var(--action-hover); border-color: var(--action-hover); box-shadow: none; filter: none; }
.btn-primary:disabled { opacity: .55; }
.btn-sm { min-height: 32px; }
.btn-danger:hover, .copy-btn:hover { box-shadow: none; }
.skip-link { position: fixed; left: 16px; top: -80px; z-index: 200; padding: 12px 18px; background: var(--surface3); border: 2px solid var(--accent); border-radius: 10px; }
.skip-link:focus { top: 12px; }
.shell { height: 100dvh; overflow: hidden; }
.main { grid-template-columns: 232px minmax(0,1fr); }
.sidebar { background: var(--surface); padding: 24px 14px 14px; overflow-y: auto; }
.brand { padding: 0 10px 26px; }
.brand-wordmark { width: 174px; height: 28px; object-fit: contain; display: block; }
.brand .b-sub { margin-top: 8px; font-size: 11px; letter-spacing: .055em; }
.brand-mark { display: none; width: 30px; height: 30px; object-fit: contain; }
.nav { gap: 6px; }
.nav-btn { min-height: 44px; padding: 11px 14px; border: 1px solid transparent; position: relative; font-size: 13px; }
.nav-btn.active { background: var(--action-soft); color: #ffb361; border-color: rgba(255,136,10,.28); box-shadow: none; }
.nav-btn.active::before { content: ''; position: absolute; left: -1px; top: 11px; bottom: 11px; width: 3px; border-radius: 4px; background: var(--action); }
.nav-symbol { display: none; width: 20px; height: 20px; flex: 0 0 auto; }
.nav-symbol svg, .bn-icon svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav-label { margin: 14px 14px 10px; color: var(--faint); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; }
.userchip { background: var(--bg); padding: 12px; min-width: 0; }
.u-meta { min-width: 0; }
.u-name { overflow-wrap: anywhere; }
.avatar { box-shadow: none; }
.content { min-width: 0; overflow: hidden; }
.command-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 72px; padding: 16px 28px; border-bottom: 1px solid var(--border); background: var(--bg); }
.command-heading { min-width: 0; }
.command-heading strong { font-size: 15px; letter-spacing: -.02em; }
.command-heading small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.command-search { display: flex; align-items: center; justify-content: space-between; gap: 24px; color: var(--muted); background: var(--surface); min-height: 40px; min-width: 190px; border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; cursor: pointer; }
.command-search kbd { border: 1px solid var(--border2); border-radius: 4px; padding: 1px 5px; font-size: 10px; }
.workspace-body { display: flex; flex: 1; min-height: 0; min-width: 0; overflow: hidden; }
.view-stack { display: flex; flex: 1; flex-direction: column; min-width: 0; min-height: 0; }
.view.active { animation: command-enter .16s ease-out; }
@keyframes command-enter { from { opacity: 0; } to { opacity: 1; } }
.view-head { padding: 26px 28px 18px; align-items: flex-start; flex-direction: column; gap: 6px; }
.view-head h1 { font-size: 24px; letter-spacing: -.045em; line-height: 1.2; }
.view-head .sub { max-width: 660px; font-size: 13px; line-height: 1.6; }
/* Both urgent routes remain visible, including narrow and translated layouts. */
.crisisbar { background: #24191f; display: grid; grid-template-columns: auto minmax(0,1fr) minmax(0,1fr); gap: 10px; padding: 8px 20px; overflow: visible; border-bottom: 1px solid #60373e; }
.crisisbar .cb-label { font-size: 10px; white-space: normal; }
.crisisbar .cb-label::before { display: none; animation: none; }
.crisis-btn { white-space: normal; border-radius: 8px; min-height: 34px; font-size: 11px; padding: 5px 12px; color: #ffc4c8; line-height: 1.35; }
.crisis-btn:hover { transform: none; box-shadow: none; background: #47272e; }
/* Ask: a calm, readable workspace, not a decorative hero. */
.ask-wrap { max-width: 1020px; padding: 0 32px; }
.thread { padding: 24px 2px; gap: 20px; scroll-behavior: auto; overflow-wrap: anywhere; }
.ask-empty { max-width: 740px; width: 100%; text-align: left; padding: 30px 0; }
.ask-empty .big { width: 58px; height: 58px; border-radius: 16px; margin: 0 0 20px; font-size: 0; background: var(--surface); border: 1px solid var(--border); box-shadow: none; display: grid; place-items: center; }
.ask-empty .big img { width: 30px; height: 30px; }
.ask-empty h2 { font-size: clamp(25px,3vw,36px); line-height: 1.2; letter-spacing: -.055em; margin-bottom: 12px; }
.ask-empty p { max-width: 600px; line-height: 1.65; font-size: 14px; margin-bottom: 24px; }
.sugg { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.sugg button { position: relative; text-align: left; padding: 17px 32px 17px 16px; min-height: 76px; border-radius: 12px; line-height: 1.5; color: var(--text); font-size: 12px; border-color: var(--border); }
.sugg button::after { content: '↗'; position: absolute; right: 14px; top: 17px; color: var(--action); font-size: 16px; }
.sugg button:hover { transform: none; border-color: var(--action); box-shadow: none; background: var(--surface2); }
.ask-inputrow { padding: 12px 0 18px; border-top: 1px solid var(--border); }
.ask-inputrow textarea { min-width: 0; background: var(--surface); font-size: 14px; }
.ask-inputrow .btn-primary { height: 46px; }
.msg-bot .m-body { max-width: 100%; background: var(--surface); border: 1px solid var(--border); padding: 20px 22px; border-radius: 14px; line-height: 1.65; }
.msg-bot > .avatar, .helper-intro > .avatar, .helper-hist-intro > .avatar { font-size: 0; background: var(--surface) url('/img/buunix-mark.png') center/20px 20px no-repeat !important; box-shadow: none; border: 1px solid var(--border); }
.msg-user .m-body { background: #29251f; border-color: #59452d; color: var(--text); padding: 12px 16px; }
.md h1, .md h2, .md h3 { color: var(--text); font-size: 14px; line-height: 1.5; margin-top: 18px; }
.md p { line-height: 1.7; }
.md blockquote { border-left-color: var(--accent); background: var(--accent-soft); }
.m-meta { padding-top: 12px; border-top: 1px solid var(--border); margin-top: 18px; gap: 8px; }
.src-chip { white-space: normal; text-align: left; max-width: 100%; min-height: 34px; border-radius: 8px; padding: 6px 10px; line-height: 1.45; font-size: 11px; }
.src-chip:hover { transform: none; box-shadow: none; }
.draft-badge { display: inline-block; color: var(--amber); background: var(--amber-soft); border: 1px solid #80603a; border-radius: 5px; padding: 1px 6px; font-size: 10px; font-weight: 700; white-space: nowrap; }
/* Reply Studio: the existing generation/copy/listen/history contracts are unchanged. */
.helper-wrap { max-width: 1200px; padding: 0 28px 28px; }
.helper-wrap .view-head { padding-left: 0; padding-right: 0; }
.helper-columns { display: grid; grid-template-columns: minmax(240px,.8fr) minmax(0,1.2fr); align-items: start; gap: 22px; }
.helper-compose { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 20px; }
.field-label { font-size: 12px; font-weight: 700; color: var(--text); text-transform: none; letter-spacing: 0; margin: 0 0 10px; }
.helper-inputrow { flex-direction: column; align-items: stretch; gap: 12px; }
.helper-inputrow textarea { min-height: 190px; max-height: 400px; width: 100%; }
.helper-inputrow .btn-primary { align-self: flex-start; height: 42px; }
.review-note { color: var(--muted); font-size: 11px; line-height: 1.6; margin: 14px 0 0; }
.helper-output { min-width: 0; }
.helper-output-title { margin: 0 0 12px; font-size: 12px; font-weight: 700; }
.helper-result { margin-top: 0; }
.helper-result-options { gap: 14px; }
.helper-intro { border-left: 2px solid var(--accent); padding: 12px; margin-bottom: 4px; background: var(--accent-soft); border-radius: 0 10px 10px 0; font-style: normal; }
.helper-reply-card { padding: 20px; gap: 12px; border-radius: 14px; }
.helper-reply-label { color: var(--muted); font-size: 10px; }
.helper-reply-text { font-size: 14px; line-height: 1.75; overflow-wrap: anywhere; }
.helper-reply-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.copy-btn { min-height: 36px; padding: 7px 12px; border-radius: 8px; font-size: 12px; }
.helper-reply-actions .copy-btn:not(.tts-btn), .band-say .copy-btn { color: #18120b; background: var(--action); border-color: var(--action); font-weight: 700; }
.copy-btn.copied { background: var(--green-soft) !important; color: var(--green) !important; border-color: var(--green) !important; }
.helper-history { margin-top: 30px; padding-top: 20px; border-top: 1px solid var(--border); }
.helper-history-list { display: grid; gap: 12px; }
.helper-hist-item { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.helper-hist-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.helper-hist-msg { font-weight: 600; overflow-wrap: anywhere; min-width: 0; }
.helper-hist-time { flex: 0 0 auto; color: var(--muted); font-size: 11px; }
/* Knowledge and the native-dialog reader. */
.kb-tools, .chips { padding-left: 28px; padding-right: 28px; }
.chips { gap: 8px; }
.chip { min-height: 34px; padding: 6px 12px; font-size: 11px; border-color: var(--border); }
.chip:hover { transform: none; }
.kb-list { padding: 8px 28px 28px; gap: 12px; grid-template-columns: repeat(auto-fill,minmax(min(100%,280px),1fr)); }
.kb-card { padding: 20px; background: var(--surface); box-shadow: none; }
.kb-card:hover { transform: none; border-color: var(--accent); box-shadow: none; }
.kb-card .k-top { flex-wrap: wrap; }
.kb-card .k-title { margin-top: 12px; font-size: 14px; line-height: 1.55; }
.kb-card .k-alias { color: var(--muted); line-height: 1.5; }
.reference-panel { display: none; position: static; flex: 0 0 390px; width: 390px; max-width: 42%; max-height: none; min-width: 0; height: 100%; margin: 0; padding: 0; color: var(--text); background: var(--surface); border: 0; border-left: 1px solid var(--border2); }
.reference-panel[open] { display: flex; flex-direction: column; }
.reference-content { overflow-y: auto; padding: 24px; min-height: 0; width: 100%; overflow-wrap: anywhere; }
.reference-content .modal-head { position: sticky; top: -24px; background: var(--surface); margin: -1px -1px 18px; padding: 1px 1px 16px; border-bottom: 1px solid var(--border); z-index: 1; }
.reference-content .modal-head h2 { font-size: 19px; letter-spacing: -.025em; }
.reference-content .modal-head .x { flex: 0 0 auto; }
.reference-content .document-content { white-space: pre-wrap; line-height: 1.75; font-size: 13px; }
.reference-content .band { padding: 14px; }
.reference-content .say-line { flex-direction: column; align-items: stretch; gap: 12px; }
.reference-content .say-line .copy-btn { align-self: flex-start; }
.reference-panel::backdrop { background: rgba(6,7,13,.7); }
.band .b-label { font-size: 10px; letter-spacing: .035em; line-height: 1.5; }
.band ul, .band .quote { line-height: 1.65; }
.art-source { color: var(--muted); line-height: 1.65; overflow-wrap: anywhere; }
/* Team chat: no new customer inbox or transport integrations. */
.chat-grid { grid-template-columns: 240px minmax(0,1fr); }
.conv-list { padding: 18px 12px; background: var(--surface); }
.conv { min-height: 40px; white-space: normal; }
.conv:hover { transform: none; }
.chat-head { min-height: 64px; padding: 16px 24px; flex-wrap: wrap; }
.chat-msgs { padding: 24px; scroll-behavior: auto; }
.cmsg { padding: 8px; }
.chat-inputrow { padding: 16px 24px 22px; border-top: 1px solid var(--border); }
.chat-inputrow input { min-width: 0; }
.typing-line { color: var(--muted); }
/* Admin uses the same system with denser, readable tables. */
.admin-main { grid-template-columns: 232px minmax(0,1fr); }
.admin-main .panel { padding: 30px 32px; }
.admin-main .sec-head { gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.admin-main .sec-head h2 { font-size: 24px; letter-spacing: -.04em; }
.admin-main .sec-head input, .admin-main .sec-head select { max-width: 100%; min-width: 0 !important; }
.stat-grid { gap: 14px; margin-bottom: 30px; }
.stat { padding: 22px; background: var(--surface); }
.stat:hover { transform: none; box-shadow: none; }
.stat .s-num { font-size: 30px; background: none !important; color: var(--text); -webkit-text-fill-color: currentColor; }
.stat.accent .s-num { color: var(--accent); }
.stat.green .s-num { color: var(--green); }
.stat.amber .s-num { color: var(--amber); }
.tbl-wrap { border: 1px solid var(--border); position: relative; }   /* keeps the .sr-only header cells inside the scroll box */
.tbl th, .tbl td { padding: 13px 16px; }
.tbl th { color: var(--muted); font-size: 10px; }
.tbl tbody tr:hover td { background: var(--surface2); }
.tab { min-height: 36px; }
/* Login: no credential, first-login, or access changes. */
.login-body { background: radial-gradient(ellipse at 15% 10%,rgba(255,136,10,.055),transparent 55%),var(--bg); padding: 28px 18px; }
.login-card { width: 430px; max-width: 100%; padding: 38px; border-radius: 20px; background: var(--surface); border-color: var(--border); box-shadow: var(--shadow); animation: none; }
.login-card .brand { padding-bottom: 28px; }
.login-card .brand-wordmark { width: 174px; height: 28px; }
.login-card h1 { font-size: 26px; color: var(--text); font-weight: 700; letter-spacing: -.04em; }
.login-card .sub { margin: 10px 0 28px; line-height: 1.6; }
.login-card label { text-transform: none; font-size: 12px; letter-spacing: 0; margin-top: 18px; color: var(--text); }
.login-card input { min-height: 46px; }
.login-card .btn-primary { height: 46px; margin-top: 24px; }
.login-foot { border-top: 1px solid var(--border); padding-top: 20px; margin-top: 20px; line-height: 1.7; color: var(--muted); }
.modal-backdrop { align-items: center; }
.modal { max-height: calc(100dvh - 40px); overflow-y: auto; border-radius: 16px; box-shadow: var(--shadow); animation: command-enter .16s ease-out; }
.toast { line-height: 1.5; }
@media (max-width: 1200px) {
  .main, .admin-main { grid-template-columns: 196px minmax(0,1fr); }
  .brand-wordmark { width: 150px; height: 25px; }
  .helper-columns { grid-template-columns: 1fr; }
  .helper-inputrow textarea { min-height: 120px; }
}
@media (max-width: 1100px) {
  .reference-panel { position: fixed; inset: 0 0 0 auto; width: min(540px,95vw); max-width: none; max-height: none; height: 100dvh; margin: 0; }
}
@media (max-width: 860px) and (min-width: 701px) {
  .main, .admin-main { grid-template-columns: 72px minmax(0,1fr); }
  .sidebar { padding: 20px 10px; }
  .sidebar .brand { padding: 0 10px 24px; }
  .sidebar .brand-wordmark, .sidebar .b-sub, .nav-label, .sidebar .u-meta { display: none; }
  .sidebar .brand-mark, .nav-symbol { display: block; }
  .nav-btn { padding: 12px; justify-content: center; }
  .userchip { justify-content: center; padding: 8px; }
  .command-header { padding-left: 22px; padding-right: 22px; }
}
@media (max-width: 700px) {
  body { font-size: 14px; }
  .main { grid-template-columns: minmax(0,1fr); }
  .sidebar { display: none; }
  .content { padding-bottom: calc(64px + env(safe-area-inset-bottom,0px)); }
  .command-header { padding: 12px 16px; min-height: 64px; gap: 10px; }
  .command-heading strong { font-size: 14px; }
  .command-heading small { font-size: 10px; }
  .command-search { min-width: 0; min-height: 40px; font-size: 11px; padding: 8px 10px; }
  .command-search kbd { display: none; }
  .crisisbar { padding: 6px 10px; gap: 6px; grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
  .crisisbar .cb-label { grid-column: 1/-1; font-size: 9px; }
  .crisis-btn { min-height: 44px; padding: 6px 8px; font-size: 10px; }
  .ask-wrap { padding: 0 16px; }
  .thread { padding-top: 14px; gap: 14px; }
  .ask-empty { padding: 16px 0; margin-top: 0; }
  .ask-empty .big { width: 46px; height: 46px; margin-bottom: 16px; }
  .ask-empty h2 { font-size: 27px; }
  .ask-empty p { font-size: 12px; margin-bottom: 18px; }
  .sugg { grid-template-columns: 1fr; gap: 8px; }
  .sugg button { min-height: 58px; padding: 13px 30px 13px 14px; }
  /* A multiline field gets the full phone width; the action no longer crowds it. */
  .ask-inputrow { display: grid; grid-template-columns: minmax(0,1fr); gap: 8px; flex-shrink: 0; padding-bottom: 12px; }
  .ask-inputrow textarea { width: 100%; min-height: 120px; padding: 12px 14px; line-height: 1.5; resize: none; overflow-y: auto; }
  .ask-inputrow .btn-primary { justify-self: end; min-width: 96px; }
  input, select, textarea, .ask-inputrow textarea { font-size: 16px; }
  .msg { gap: 6px; }
  .msg-bot > .avatar { display: none; }
  .msg-bot .m-body { padding: 16px; max-width: 100%; }
  .msg-user .m-body { max-width: 94%; }
  .view-head { padding: 20px 16px 14px; }
  .view-head h1 { font-size: 24px; }
  .helper-wrap { padding: 0 16px 20px; }
  .helper-columns { gap: 16px; }
  .helper-compose, .helper-reply-card { padding: 16px; }
  .helper-hist-head { flex-direction: column; gap: 6px; }
  .kb-tools, .chips { padding-left: 16px; padding-right: 16px; }
  .kb-tools input[type='search'] { min-width: 0; }
  .kb-list { padding: 8px 16px 20px; grid-template-columns: minmax(0,1fr); }
  .chip { min-height: 40px; }
  .bottomnav { min-height: 64px; background: var(--surface); padding: 7px 4px calc(7px + env(safe-area-inset-bottom,0px)); backdrop-filter: none; }
  .bn-icon { width: 21px; height: 21px; display: block; }
  .bn-btn { min-height: 48px; gap: 4px; }
  .bn-btn .bn-label { font-size: 10px; }
  .bn-btn.active { color: #ffb361; }
  .bn-btn.active::before { background: var(--action); box-shadow: none; top: -7px; width: 26px; }
  .reference-panel { inset: auto 0 0; width: 100%; height: 90dvh; border-radius: 18px 18px 0 0; border: 1px solid var(--border2); }
  .reference-content { padding: 20px 18px calc(20px + env(safe-area-inset-bottom,0px)); }
  .reference-content .modal-head { top: -20px; }
  .reference-content .modal-head h2 { font-size: 20px; }
  .reference-content .document-content { font-size: 14px; }
  .chat-grid { grid-template-columns: minmax(0,1fr); }
  .chat-head, .chat-msgs { padding: 16px; }
  .chat-inputrow { padding: 12px 16px 16px; }
  .chat-head .sub { width: 100%; }
  .toast-wrap { bottom: calc(78px + env(safe-area-inset-bottom,0px)); right: 12px; left: 12px; align-items: flex-end; }
  .toast { max-width: 100%; }
  .modal-backdrop { padding: 12px; }
  .modal { max-height: calc(100dvh - 24px); }
  /* Admin's rail must not disappear while its grid reserves an empty column. */
  .admin-main { grid-template-columns: minmax(0,1fr); height: 100dvh; grid-template-rows: auto minmax(0,1fr); }
  .admin-main .sidebar { display: flex; flex-direction: row; align-items: center; gap: 10px; padding: 8px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  .admin-main .sidebar .brand, .admin-main .sidebar .spacer, .admin-main .sidebar .userchip, .admin-main .sidebar .nav-label { display: none; }
  .admin-main .sidebar .nav { flex-direction: row; flex-shrink: 0; gap: 4px; }
  .admin-main .sidebar .nav-btn { width: auto; white-space: nowrap; min-height: 44px; font-size: 11px; padding: 8px 10px; flex-shrink: 0; margin: 0; }
  .admin-main .sidebar .nav-btn span.txt, .admin-main .sidebar .adminlink span.txt { display: inline; }
  .admin-main .panel { padding: 20px 16px; }
  .admin-main .sec-head h2 { font-size: 23px; }
  .admin-main .sec-head input, .admin-main .sec-head select { width: 100% !important; }
  .stat { padding: 16px; }
  .stat-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .tbl th, .tbl td { padding: 12px; }
  .login-card { padding: 28px 22px; }
}
/* Preserve conversation space in short viewports without returning to one line. */
@media (max-width: 700px) and (max-height: 500px) {
  .ask-inputrow { grid-template-columns: minmax(0,1fr) auto; }
  .ask-inputrow textarea { min-height: 96px; }
  .ask-inputrow .btn-primary { min-width: 76px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
.guidance-label { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .035em; margin-bottom: 14px; }
.helper-intro, .helper-hist-intro { flex-wrap: wrap; }
.helper-intro::before, .helper-hist-intro::before { content: attr(data-command-label); display: block; width: 100%; color: var(--muted); font-size: 10px; font-weight: 700; margin-bottom: 4px; }
@media (min-width: 701px) { #chat-back { display: none; } }
.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; }

/* Phone Ask composer: four readable lines without sacrificing input width.
   Keep the existing JS auto-grow/reset and 140px cap; only the layout changes. */
@media (max-width: 700px) {
  .ask-inputrow {
    flex: 0 0 auto;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .ask-inputrow textarea {
    flex: 0 0 auto;
    width: 100%;
    min-height: 122px;
    max-height: 140px;
    padding: 12px 14px;
    line-height: 1.5;
    resize: none;
    overflow-y: auto;
  }
  .ask-inputrow .btn-primary {
    align-self: flex-end;
    flex: 0 0 auto;
    min-width: 88px;
    height: 44px;
  }
}
/* Short viewports need a compact row so safety and navigation stay reachable. */
@media (max-width: 700px) and (max-height: 500px) {
  .thread { padding-block: 8px; }
  .ask-inputrow { flex-direction: row; align-items: flex-end; }
  .ask-inputrow textarea { flex: 1 1 auto; width: 0; min-height: 72px; max-height: clamp(72px, calc(100dvh - 264px), 112px); }
}

/* Settings: voice type switch and voice picker (common.js openSettings) */
.settings-title { font-size: 14px; margin: 16px 0 2px; }
.settings-sub { margin: 0 0 4px; }
.voice-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.voice-seg button { min-height: 44px; border: 1px solid var(--border2); border-radius: 10px; background: var(--surface2); color: var(--muted); font: inherit; font-weight: 700; cursor: pointer; }
.voice-seg button:hover { color: var(--text); }
.voice-seg button[aria-pressed="true"] { background: var(--action-soft); border-color: rgba(255,136,10,.45); color: #ffb361; }
.voice-select { width: 100%; }
.voice-note { margin: 8px 0 0; }
.modal-actions .grow { flex: 1; }
