/*
  CHAT_DESKTOP_PREMIUM_V1 (11-10, Dimas "rombak total ui chat desktop, premium dan elegan")
  Lapisan desain "Nila" untuk /chat DESKTOP (>=1024px) saja. Aktif hanya bila <html class="ui3">.
  Opt-in: /chat?ui3=1 (disimpan di localStorage isonai_ui3). Matikan: /chat?ui3=0.
  Arah: palet warm stone lama (krem/zaitun, Dimas 11-10) + satu aksen zaitun, hierarki lewat
  lapisan tonal (bukan garis), sidebar diredam, kolom baca ~70 karakter, composer = objek utama.
  Font: Instrument Sans (UI + jawaban), JetBrains Mono (kode).
  Rollback: hapus loader UI3 di chat.html (atau ?ui3=0 per browser).
  Mobile (<1024px) = blok CHAT_MOBILE_PREMIUM_V1 di akhir berkas, aktif hanya dengan html.ui3m.
*/

/* -- TOKENS (shared desktop + mobile; inert: only --p-* vars) -- */
html.ui3[data-theme="light"] {
  /* WARM_STONE palette kept from the old UI (Dimas 11-10: "warna bagusan yang lama") */
  --p-canvas: #FFFFFF;
  --p-seg-on: #FFFFFF;
  --p-side: #F3EEE3;
  --p-raise: #FFFFFF;
  --p-sunk: #F7F4ED;
  --p-ink: #0D0D0D;
  --p-ink-2: #5D5D5D;
  --p-ink-3: #8F8F8F;
  --p-ink-4: #B4B4B4;
  --p-line: rgba(31, 24, 18, .075);
  --p-line-2: rgba(31, 24, 18, .13);
  --p-nila: #7A6949;
  --p-nila-hi: #5E5037;
  --p-nila-wash: #F4F0E7;
  --p-nila-tint: rgba(122, 105, 73, .10);
  --p-on-nila: #FFFFFF;
  --p-send: #0D0D0D;
  --p-send-hi: #333333;
  --p-on-send: #FFFFFF;
  --p-shadow-xs: 0 1px 2px rgba(31, 24, 18, .06);
  --p-shadow-tray: 0 1px 2px rgba(31, 24, 18, .05), 0 14px 36px -14px rgba(84, 66, 38, .22);
  --p-shadow-pop: 0 2px 6px rgba(31, 24, 18, .06), 0 18px 48px -12px rgba(31, 24, 18, .18);
}
html.ui3[data-theme="dark"] {
  --p-canvas: #22211D;
  --p-seg-on: #3D3B34;
  --p-side: #181815;
  --p-raise: #2B2A24;
  --p-sunk: #27261F;
  --p-ink: #ECECEC;
  --p-ink-2: #B4B4B4;
  --p-ink-3: #8F8F8F;
  --p-ink-4: #6B6B6B;
  --p-line: rgba(255, 255, 255, .07);
  --p-line-2: rgba(255, 255, 255, .13);
  --p-nila: #A89878;
  --p-nila-hi: #BBAC8C;
  --p-nila-wash: #35342D;
  --p-nila-tint: rgba(154, 137, 104, .14);
  --p-on-nila: #181815;
  --p-send: #ECECEC;
  --p-send-hi: #FFFFFF;
  --p-on-send: #22211D;
  --p-shadow-xs: 0 1px 2px rgba(0, 0, 0, .35);
  --p-shadow-tray: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 16px 40px -16px rgba(0, 0, 0, .7);
  --p-shadow-pop: 0 2px 6px rgba(0, 0, 0, .4), 0 20px 50px -12px rgba(0, 0, 0, .65);
}

@media (min-width: 1024px) {

/* map the legacy tokens so every older component follows the new palette */
html.ui3[data-theme] {
  --font-b: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-d: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-h: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-s: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-m: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --bg-0: var(--p-canvas);
  --bg-1: var(--p-raise);
  --bg-2: var(--p-sunk);
  --bg-3: var(--p-line-2);
  --bg-4: var(--p-ink-4);
  --bg-user: var(--p-nila-wash);
  --bg-glass: color-mix(in srgb, var(--p-canvas) 86%, transparent);
  --brd: var(--p-line);
  --brd-2: var(--p-line-2);
  --brd-3: var(--p-ink-4);
  --tx: var(--p-ink);
  --tx-2: var(--p-ink-2);
  --tx-3: var(--p-ink-3);
  --tx-4: var(--p-ink-4);
  --ac: var(--p-nila);
  --ac-2: var(--p-nila-hi);
  --ac-3: var(--p-nila);
  --ac-dim: var(--p-nila-tint);
  --ac-glow: var(--p-nila-tint);
  --omni: var(--p-nila);
  --omni-dim: var(--p-nila-tint);
  --r: 10px; --r-lg: 14px; --r-xl: 22px;
}

html.ui3 body {
  background: var(--p-canvas) !important;
  color: var(--p-ink);
  font-family: var(--font-b) !important;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
html.ui3 .app, html.ui3 main.mn { background: var(--p-canvas) !important; }
html.ui3 .core-aura { display: none !important; }
html.ui3 .msg-wrap, html.ui3[data-theme] .msg-wrap { background: var(--p-canvas) !important; }

/* -- SIDEBAR: tonal, quiet, the chats are the content ----- */
html.ui3 aside#sb.sb.collapsed { width: 0 !important; min-width: 0 !important; }
html.ui3 aside#sb.sb:not(.collapsed) {
  width: 264px !important;
  background: var(--p-side) !important;
  border-right: 0 !important;
  box-shadow: none !important;
}
html.ui3 .sb-top { padding: 14px 14px 6px 16px !important; height: auto !important; }
html.ui3 .sb-top .logo { gap: 9px !important; }
html.ui3 .sb-top .logo img { width: 22px !important; height: 22px !important; }
html.ui3 .sb-top .logo-text {
  font-family: var(--font-b) !important;
  font-size: 17px !important;
  font-weight: 600 !important;
  letter-spacing: -.02em !important;
  color: var(--p-ink) !important;
}
html.ui3 .sb-top .sb-btn, html.ui3 .sb-search-btn {
  color: var(--p-ink-3) !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 8px !important;
}
html.ui3 .sb-top .sb-btn:hover, html.ui3 .sb-search-btn:hover { background: var(--p-line) !important; color: var(--p-ink) !important; }
html.ui3 .sb-actions { padding: 8px 12px 6px !important; gap: 6px !important; }
html.ui3 .sb-new {
  height: 36px !important;
  background: var(--p-raise) !important;
  color: var(--p-ink) !important;
  border: 1px solid var(--p-line) !important;
  border-radius: 10px !important;
  box-shadow: var(--p-shadow-xs) !important;
  font-size: 13.5px !important;
  font-weight: 550 !important;
  letter-spacing: -.005em !important;
}
html.ui3 .sb-new:hover { border-color: var(--p-line-2) !important; }
html.ui3 .sb-new svg { color: var(--p-nila) !important; }
html.ui3 .sb-search-btn { width: 36px !important; height: 36px !important; }

html.ui3 .sb-dock { padding: 4px 8px !important; gap: 0 !important; }
html.ui3 .sb-dock-item {
  height: 32px !important;
  padding: 0 10px !important;
  border-radius: 8px !important;
  color: var(--p-ink-2) !important;
  font-size: 13.5px !important;
  font-weight: 450 !important;
  background: transparent !important;
}
html.ui3 .sb-dock-item svg { width: 16px !important; height: 16px !important; color: var(--p-ink-3) !important; opacity: 1 !important; }
html.ui3 .sb-dock-item:hover { background: var(--p-line) !important; color: var(--p-ink) !important; }
html.ui3 .sb-divider { background: transparent !important; height: 8px !important; margin: 0 !important; }

html.ui3 .sb-list { padding: 4px 8px 16px !important; }
html.ui3 .sb-group, html.ui3[data-theme="dark"] .sb-group {
  font-family: var(--font-b) !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  color: var(--p-ink-3) !important;
  padding: 18px 10px 6px !important;
}
html.ui3 .sb-item, html.ui3[data-theme="dark"] .sb-item {
  height: 32px !important;
  min-height: 32px !important;
  padding: 0 10px !important;
  margin: 0 !important;
  border-radius: 8px !important;
  color: var(--p-ink-2) !important;
  font-size: 13.5px !important;
  font-weight: 400 !important;
  background: transparent !important;
}
html.ui3 .sb-item .ti { font-size: 13.5px !important; letter-spacing: -.003em; }
html.ui3 .sb-item:hover, html.ui3[data-theme="dark"] .sb-item:hover { background: var(--p-line) !important; color: var(--p-ink) !important; }
html.ui3 .sb-item.on, html.ui3[data-theme="dark"] .sb-item.on, html.ui3[data-theme="light"] .sb-item.on {
  background: var(--p-raise) !important;
  color: var(--p-ink) !important;
  font-weight: 500 !important;
  box-shadow: var(--p-shadow-xs), 0 0 0 1px var(--p-line) !important;
}
html.ui3 .sb-item.on::before, html.ui3[data-theme="dark"] .sb-item.on::before { display: none !important; }
html.ui3 .fd-head, html.ui3 .fd-row, html.ui3[data-theme="dark"] .fd-head, html.ui3[data-theme="dark"] .fd-row { color: var(--p-ink-2) !important; font-size: 13.5px !important; }
html.ui3 .fd-head:hover, html.ui3 .fd-row:hover { background: var(--p-line) !important; }
html.ui3 .sb-foot {
  background: transparent !important;
  border-top: 1px solid var(--p-line) !important;
  padding: 10px 10px 12px !important;
}
html.ui3 #accountTrigger { border-radius: 10px !important; }
html.ui3 #accountTrigger:hover { background: var(--p-line) !important; }
html.ui3 #uAv {
  background: var(--p-nila) !important;
  color: var(--p-on-nila) !important;
  font-weight: 600 !important;
}
html.ui3 #uNm { color: var(--p-ink) !important; font-weight: 550 !important; font-size: 13.5px !important; }
html.ui3 #uEm { color: var(--p-ink-3) !important; font-size: 12px !important; }
html.ui3 .sb-list::-webkit-scrollbar { width: 6px; }
html.ui3 .sb-list::-webkit-scrollbar-thumb { background: var(--p-line-2); border-radius: 3px; }

/* -- TOP BAR --------------------------------------------- */
html.ui3 .topbar {
  background: linear-gradient(var(--p-canvas) 62%, color-mix(in srgb, var(--p-canvas) 0%, transparent)) !important;
  border: 0 !important;
  box-shadow: none !important;
  height: 52px !important;
  padding: 0 16px !important;
  backdrop-filter: none !important;
}
html.ui3 .mode-pill {
  height: 32px !important;
  padding: 0 10px 0 10px !important;
  border: 0 !important;
  border-radius: 9px !important;
  background: transparent !important;
  color: var(--p-ink) !important;
  font-family: var(--font-b) !important;
  font-size: 14.5px !important;
  font-weight: 600 !important;
  letter-spacing: 0 !important;
  gap: 7px !important;
  box-shadow: none !important;
}
html.ui3 .mode-pill:hover { background: var(--p-line) !important; }
html.ui3 .mode-pill .model-dot { width: 7px !important; height: 7px !important; background: var(--p-nila) !important; box-shadow: none !important; }
html.ui3 .mode-pill [class*="tag"], html.ui3 .mode-pill .think-badge, html.ui3 .mode-pill small {
  background: transparent !important;
  border: 1px solid var(--p-line-2) !important;
  color: var(--p-ink-3) !important;
  font-weight: 500 !important;
  border-radius: 6px !important;
}
html.ui3 .top-btn, html.ui3 .top-ico {
  height: 32px !important;
  border: 0 !important;
  border-radius: 9px !important;
  background: transparent !important;
  color: var(--p-ink-2) !important;
  font-size: 13.5px !important;
  font-weight: 500 !important;
}
html.ui3 .top-btn:hover, html.ui3 .top-ico:hover { background: var(--p-line) !important; color: var(--p-ink) !important; }
html.ui3 .guest-banner {
  background: transparent !important;
  border: 0 !important;
  color: var(--p-ink-3) !important;
}
html.ui3 .guest-banner a { color: var(--p-nila) !important; text-decoration: none !important; font-weight: 550 !important; }

/* -- EMPTY STATE: a quiet page that starts with a question -- */
html.ui3 .welcome { padding-top: 0 !important; }
html.ui3 .wel-logo { width: 40px !important; height: 40px !important; margin-bottom: 22px !important; }
html.ui3 .wel-logo img {
  width: 40px !important;
  height: 40px !important;
}
html.ui3 .wel-logo .core-ring3 { display: none !important; }
html.ui3 .wel-title, html.ui3 #welTitle {
  font-family: var(--font-b) !important;
  font-size: 42px !important;
  line-height: 1.1 !important;
  font-weight: 540 !important;
  font-stretch: 92% !important;
  font-variation-settings: "wdth" 92 !important;
  letter-spacing: -.028em !important;
  color: var(--p-ink) !important;
}
html.ui3 .wel-title em, html.ui3 #welTitle em {
  font-family: inherit !important;
  font-style: normal !important;
  font-weight: inherit !important;
  color: inherit !important;
  font-size: inherit !important;
  letter-spacing: inherit !important;
}
html.ui3 .wel-sub {
  margin-top: 14px !important;
  font-size: 15px !important;
  color: var(--p-ink-3) !important;
  letter-spacing: -.003em !important;
}

/* -- MESSAGES: a reading column --------------------------- */
html.ui3 { --p-col: clamp(min(calc(100% - 48px), 760px), calc(100% - 336px), 1240px); }
html.ui3 #msgArea.msg-inner { width: 100% !important; max-width: var(--p-col) !important; padding-left: 32px !important; padding-right: 32px !important; }
html.ui3 .msg.assistant .m-txt, html.ui3 .msg.ai .m-txt {
  font-family: var(--font-b) !important;
  font-size: clamp(16px, calc(.55vw + 7px), 17px) !important;
  line-height: 1.62 !important;
  color: var(--p-ink) !important;
  letter-spacing: .002em !important;
}
html.ui3 .msg .m-txt p { margin: 0 0 1.15em !important; }
html.ui3[data-theme] .msg .m-txt :is(p, li, td, th, h1, h2, h3, h4, h5, dd, dt), html.ui3[data-theme] .msg.assistant .m-txt :is(p, li) { color: var(--p-ink) !important; }
html.ui3 .msg .m-txt p:last-child { margin-bottom: 0 !important; }
html.ui3 .msg .m-txt h1, html.ui3 .msg .m-txt h2, html.ui3 .msg .m-txt h3, html.ui3 .msg .m-txt h4 {
  font-family: var(--font-b) !important;
  font-style: normal !important;
  font-weight: 600 !important;
  letter-spacing: -.018em !important;
  line-height: 1.3 !important;
  margin: 1.6em 0 .6em !important;
}
html.ui3 .msg .m-txt h1 { font-size: 22px !important; }
html.ui3 .msg .m-txt h2 { font-size: 19px !important; }
html.ui3 .msg .m-txt h3 { font-size: 17px !important; }
html.ui3 .msg .m-txt h4 { font-size: 16px !important; }
html.ui3 .msg .m-txt > :first-child { margin-top: 0 !important; }
html.ui3 .msg .m-txt strong, html.ui3 .msg .m-txt b { font-weight: 600 !important; color: var(--p-ink) !important; }
html.ui3 .msg .m-txt ol, html.ui3 .msg .m-txt ul { padding-left: 1.4em !important; margin: 0 0 1.15em !important; }
html.ui3 .msg .m-txt li { margin: 0 0 .6em !important; padding-left: .2em !important; }
html.ui3 .msg .m-txt li:last-child { margin-bottom: 0 !important; }
html.ui3 .msg .m-txt li > p { margin: 0 0 .5em !important; }
html.ui3 .msg .m-txt li > p:last-child { margin-bottom: 0 !important; }
html.ui3 .msg .m-txt li > ul, html.ui3 .msg .m-txt li > ol { margin: .6em 0 0 !important; }
html.ui3 .msg .m-txt li::marker { color: var(--p-ink-3); font-weight: 500; }
html.ui3 .msg .m-txt a { color: var(--p-nila) !important; text-decoration: underline !important; text-decoration-color: color-mix(in srgb, var(--p-nila) 35%, transparent) !important; text-underline-offset: 3px !important; text-decoration-thickness: 1px !important; }
html.ui3 .msg .m-txt a:hover { text-decoration-color: var(--p-nila) !important; }
html.ui3 .msg .m-txt blockquote {
  border-left: 2px solid var(--p-nila) !important;
  background: transparent !important;
  color: var(--p-ink-2) !important;
  padding: 2px 0 2px 16px !important;
  margin: 1em 0 !important;
  font-style: normal !important;
}
html.ui3 .msg .m-txt hr { border: 0 !important; height: 1px !important; background: var(--p-line-2) !important; margin: 1.6em 0 !important; }
html.ui3 .msg .m-txt :not(pre) > code {
  font-family: var(--font-m) !important;
  font-size: .86em !important;
  background: var(--p-sunk) !important;
  color: var(--p-ink) !important;
  border: 1px solid var(--p-line) !important;
  border-radius: 5px !important;
  padding: .1em .38em !important;
}
html.ui3 .msg .m-txt table {
  border-collapse: separate !important;
  border-spacing: 0 !important;
  border: 1px solid var(--p-line-2) !important;
  border-radius: 12px !important;
  overflow: hidden !important;
  font-size: 14.5px !important;
  line-height: 1.5 !important;
  background: var(--p-raise) !important;
}
html.ui3 .msg .m-txt th {
  background: var(--p-sunk) !important;
  font-weight: 600 !important;
  text-align: left !important;
  border: 0 !important;
  border-bottom: 1px solid var(--p-line-2) !important;
  padding: 10px 14px !important;
}
html.ui3 .msg .m-txt td {
  border: 0 !important;
  border-top: 1px solid var(--p-line) !important;
  padding: 10px 14px !important;
}
html.ui3 .msg .m-txt tr:first-child td { border-top: 0 !important; }

/* user turn: a soft indigo-washed note on the right */
html.ui3 .msg.user .m-body {
  max-width: 78% !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
}
html.ui3 .msg.user .m-txt {
  background: var(--p-nila-wash) !important;
  color: var(--p-ink) !important;
  border: 0 !important;
  border-radius: 20px !important;
  padding: 11px 18px !important;
  font-size: 15.5px !important;
  line-height: 1.6 !important;
  letter-spacing: -.003em !important;
  box-shadow: none !important;
}
html.ui3 .msg.user .m-txt p { margin: 0 !important; }
html.ui3 .msg.user { margin-bottom: 30px !important; }
html.ui3 .msg.assistant { margin-bottom: 40px !important; }

/* actions + sources row */
html.ui3 .m-act {
  width: 30px !important;
  height: 30px !important;
  border-radius: 8px !important;
  color: var(--p-ink-3) !important;
  background: transparent !important;
  border: 0 !important;
}
html.ui3 .m-act:hover { color: var(--p-ink) !important; background: var(--p-line) !important; }
html.ui3 .assistant-foot { margin-top: 14px !important; gap: 8px !important; }
html.ui3 .ws-toggle {
  height: 30px !important;
  padding: 0 12px !important;
  border-radius: 999px !important;
  border: 1px solid var(--p-line-2) !important;
  background: var(--p-raise) !important;
  color: var(--p-ink-2) !important;
  font-size: 13px !important;
  font-weight: 500 !important;
}
html.ui3 .ws-toggle:hover { color: var(--p-ink) !important; border-color: var(--p-ink-4) !important; }
html.ui3 .ws-sources-inner {
  background: var(--p-raise) !important;
  border: 1px solid var(--p-line) !important;
  border-radius: 14px !important;
  box-shadow: var(--p-shadow-xs) !important;
  padding: 6px !important;
}
html.ui3 .ws-src-row { border-radius: 9px !important; color: var(--p-ink-2) !important; }
html.ui3 .ws-src-row:hover { background: var(--p-sunk) !important; color: var(--p-ink) !important; }

/* official-data card */
html.ui3 .civic-card {
  background: var(--p-raise) !important;
  border: 1px solid var(--p-line-2) !important;
  border-radius: 14px !important;
  box-shadow: var(--p-shadow-xs) !important;
}
html.ui3 .civic-card-tag { color: var(--p-ink-3) !important; }
html.ui3 .civic-card-main { color: var(--p-ink) !important; }
html.ui3 .civic-card-sub, html.ui3 .civic-card-dom { color: var(--p-ink-3) !important; }

/* code blocks */
html.ui3 .msg pre, html.ui3 .code-wrap {
  border-radius: 12px !important;
  border: 1px solid var(--p-line-2) !important;
}

/* -- COMPOSER: the one object that carries the brand ------ */
html.ui3 .input-area { background: transparent !important; padding-bottom: 6px !important; padding-left: 0 !important; padding-right: 0 !important; }
html.ui3 .input-area::before, html.ui3 .input-area::after { display: none !important; }
html.ui3 .input-wrap { width: 100% !important; max-width: var(--p-col) !important; padding: 0 32px !important; margin-left: auto !important; margin-right: auto !important; }
html.ui3 .input-box {
  background: var(--p-raise) !important;
  border: 1px solid var(--p-line-2) !important;
  border-radius: 24px !important;
  box-shadow: var(--p-shadow-tray) !important;
  padding: 10px 10px 10px 12px !important;
}
html.ui3 .input-box:focus-within {
  border-color: color-mix(in srgb, var(--p-nila) 45%, transparent) !important;
  box-shadow: var(--p-shadow-tray), 0 0 0 4px var(--p-nila-tint) !important;
}
html.ui3 .input-row { align-items: flex-end !important; gap: 6px !important; }
html.ui3 #msgIn {
  font-family: var(--font-b) !important;
  font-size: 16px !important;
  line-height: 1.55 !important;
  color: var(--p-ink) !important;
  padding: 7px 4px !important;
  min-height: 38px !important;
}
html.ui3 #msgIn::placeholder { color: var(--p-ink-3) !important; opacity: 1 !important; }
html.ui3 .in-tool {
  width: 36px !important;
  height: 36px !important;
  border-radius: 12px !important;
  color: var(--p-ink-3) !important;
  background: transparent !important;
  border: 0 !important;
}
html.ui3 .in-tool:hover { color: var(--p-ink) !important; background: var(--p-sunk) !important; }
html.ui3 .send-btn {
  width: 38px !important;
  height: 38px !important;
  border-radius: 14px !important;
  background: var(--p-send) !important;
  color: var(--p-on-send) !important;
  border: 0 !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .18) !important;
}
html.ui3 .send-btn:hover { background: var(--p-send-hi) !important; }
html.ui3 .send-btn.stop { background: var(--p-send) !important; color: var(--p-on-send) !important; }
html.ui3 .send-btn:active { transform: scale(.94) !important; }
html.ui3 .send-btn:disabled, html.ui3 .send-btn[disabled] { opacity: .35 !important; }
html.ui3 .input-foot { margin-top: 8px !important; }
html.ui3 .input-foot span { font-size: 11.5px !important; color: var(--p-ink-4) !important; letter-spacing: 0 !important; }

/* empty state: the composer sits under the question, then glides to the bottom on first send */

html.ui3 main.mn:has(#msgArea > .welcome) .input-area { transform: translateY(calc(-50vh + 150px)) !important; }
html.ui3 main.mn:has(#msgArea > .welcome) .input-foot { opacity: 0 !important; }
html.ui3 main.mn:has(#msgArea > .welcome) .welcome { transform: translateY(-64px) !important; }

/* scroll-to-bottom */
html.ui3 .scroll-fab {
  background: var(--p-raise) !important;
  border: 1px solid var(--p-line-2) !important;
  color: var(--p-ink-2) !important;
  box-shadow: var(--p-shadow-pop) !important;
}

/* popovers / menus follow the same surfaces */
html.ui3 .mode-dd, html.ui3 #accountMenu, html.ui3 .img-gen-dd {
  background: var(--p-raise) !important;
  border: 1px solid var(--p-line) !important;
  border-radius: 14px !important;
  box-shadow: var(--p-shadow-pop) !important;
}

/* focus that is visible but calm */
html.ui3 :focus-visible { outline: 2px solid color-mix(in srgb, var(--p-nila) 60%, transparent) !important; outline-offset: 2px !important; }
html.ui3 #msgIn:focus-visible { outline: none !important; }

html.ui3 .msg-wrap::-webkit-scrollbar { width: 10px; }
html.ui3 .msg-wrap::-webkit-scrollbar-thumb { background: var(--p-line-2); border-radius: 5px; border: 3px solid var(--p-canvas); }

}

@media (min-width: 1024px) and (prefers-reduced-motion: reduce) {
  html.ui3 .input-box, html.ui3 .send-btn, html.ui3 .sb-new, html.ui3 .input-area { transition: none !important; }
}

/* =====================================================================
   CHAT_MOBILE_PREMIUM_V1 (11-10, Dimas "kalo mobile?"): same language for
   phones/tablets (<1024px). PREVIEW: active only with html.ui3m (/chat?ui3m=1).
   Composer stays at the bottom (thumb reach); text 16px (no iOS input zoom).
   ===================================================================== */
@media (max-width: 1023px) {

/* map the legacy tokens so every older component follows the new palette */
html.ui3.ui3m[data-theme] {
  --font-b: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-d: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-h: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-s: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-m: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --bg-0: var(--p-canvas);
  --bg-1: var(--p-raise);
  --bg-2: var(--p-sunk);
  --bg-3: var(--p-line-2);
  --bg-4: var(--p-ink-4);
  --bg-user: var(--p-nila-wash);
  --bg-glass: color-mix(in srgb, var(--p-canvas) 86%, transparent);
  --brd: var(--p-line);
  --brd-2: var(--p-line-2);
  --brd-3: var(--p-ink-4);
  --tx: var(--p-ink);
  --tx-2: var(--p-ink-2);
  --tx-3: var(--p-ink-3);
  --tx-4: var(--p-ink-4);
  --ac: var(--p-nila);
  --ac-2: var(--p-nila-hi);
  --ac-3: var(--p-nila);
  --ac-dim: var(--p-nila-tint);
  --ac-glow: var(--p-nila-tint);
  --omni: var(--p-nila);
  --omni-dim: var(--p-nila-tint);
  --r: 10px; --r-lg: 14px; --r-xl: 22px;
}

html.ui3.ui3m body {
  background: var(--p-canvas) !important;
  color: var(--p-ink);
  font-family: var(--font-b) !important;
  -webkit-font-smoothing: antialiased;
}
html.ui3.ui3m .app, html.ui3.ui3m main.mn, html.ui3.ui3m .msg-wrap, html.ui3.ui3m[data-theme] .msg-wrap { background: var(--p-canvas) !important; }
html.ui3.ui3m .core-aura { display: none !important; }

/* top bar: solid canvas that fades out, so text never runs under the buttons */
html.ui3.ui3m .topbar {
  background: linear-gradient(var(--p-canvas) 70%, color-mix(in srgb, var(--p-canvas) 0%, transparent)) !important;
  border: 0 !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  padding-bottom: 10px !important;
}
html.ui3.ui3m .topbar {
  height: calc(52px + var(--safe-t, 0px)) !important;
  min-height: calc(52px + var(--safe-t, 0px)) !important;
  padding-left: 6px !important;
  padding-right: 6px !important;
}
html.ui3.ui3m .topbar .top-menu, html.ui3.ui3m .topbar .top-ico {
  width: 44px !important; height: 44px !important;
  min-width: 44px !important; min-height: 44px !important;
  border-radius: 12px !important;
  color: var(--p-ink) !important;
  background: transparent !important;
}
html.ui3.ui3m .topbar .top-menu:active, html.ui3.ui3m .topbar .top-ico:active { background: var(--p-line) !important; }
html.ui3.ui3m .topbar .top-menu svg { width: 24px !important; height: 24px !important; stroke-width: 1.8 !important; }
html.ui3.ui3m .topbar .top-ico svg { width: 22px !important; height: 22px !important; }
html.ui3.ui3m #mobModelBadge {
  height: 32px !important;
  padding: 0 10px 0 12px !important;
  border-radius: 10px !important;
  background: var(--p-raise) !important;
  border: 1px solid var(--p-line-2) !important;
  box-shadow: var(--p-shadow-xs) !important;
  color: var(--p-ink) !important;
  gap: 6px !important;
  display: inline-flex !important;
  align-items: center !important;
}
html.ui3.ui3m #mobModelBadge .badge-label { font-size: 14px !important; font-weight: 600 !important; color: var(--p-ink) !important; line-height: 32px !important; height: auto !important; }
html.ui3.ui3m #mobModelBadge .badge-sub { font-size: 12px !important; font-weight: 500 !important; color: var(--p-ink-3) !important; line-height: 32px !important; height: auto !important; }
html.ui3.ui3m #mobModelBadge svg { color: var(--p-ink-3) !important; }
html.ui3.ui3m .guest-banner { background: transparent !important; border: 0 !important; color: var(--p-ink-3) !important; }
html.ui3.ui3m .guest-banner a { color: var(--p-nila) !important; text-decoration: none !important; font-weight: 600 !important; }

/* empty state */
html.ui3.ui3m .wel-logo .core-ring3 { display: none !important; }
html.ui3.ui3m .wel-logo, html.ui3.ui3m .wel-logo img { width: 36px !important; height: 36px !important; }
html.ui3.ui3m .wel-logo { margin-bottom: 18px !important; }
html.ui3.ui3m .wel-title, html.ui3.ui3m #welTitle {
  font-family: var(--font-b) !important;
  font-size: 30px !important;
  line-height: 1.15 !important;
  font-weight: 560 !important;
  font-variation-settings: "wdth" 92 !important;
  letter-spacing: -.025em !important;
  color: var(--p-ink) !important;
}
html.ui3.ui3m .wel-title em, html.ui3.ui3m #welTitle em { font-family: inherit !important; font-style: normal !important; font-weight: inherit !important; color: inherit !important; font-size: inherit !important; letter-spacing: inherit !important; }
html.ui3.ui3m .wel-sub { font-size: 15px !important; color: var(--p-ink-3) !important; margin-top: 10px !important; }

/* reading rhythm (same as desktop, sized for a phone) */
html.ui3.ui3m #msgArea.msg-inner { padding-left: 20px !important; padding-right: 20px !important; }
html.ui3.ui3m .msg.assistant .m-txt, html.ui3.ui3m .msg.ai .m-txt {
  font-family: var(--font-b) !important;
  font-size: 16px !important;
  line-height: 1.6 !important;
  color: var(--p-ink) !important;
  letter-spacing: .003em !important;
}
html.ui3.ui3m .msg .m-txt p { margin: 0 0 1.15em !important; }
html.ui3.ui3m .msg .m-txt :is(p, li, td, th, h1, h2, h3, h4, h5, dd, dt) { color: var(--p-ink) !important; }
html.ui3.ui3m .msg.assistant .m-txt p, html.ui3.ui3m .msg.assistant .m-txt li { line-height: 1.6 !important; font-size: 16px !important; }
html.ui3.ui3m .msg .m-txt p:last-child { margin-bottom: 0 !important; }
html.ui3.ui3m .msg .m-txt ol, html.ui3.ui3m .msg .m-txt ul { padding-left: 1.3em !important; margin: 0 0 1.15em !important; }
html.ui3.ui3m .msg .m-txt li { margin: 0 0 .6em !important; padding-left: .15em !important; }
html.ui3.ui3m .msg .m-txt li:last-child { margin-bottom: 0 !important; }
html.ui3.ui3m .msg .m-txt li > p { margin: 0 0 .5em !important; }
html.ui3.ui3m .msg .m-txt li > p:last-child { margin-bottom: 0 !important; }
html.ui3.ui3m .msg .m-txt li::marker { color: var(--p-ink-3); }
html.ui3.ui3m .msg .m-txt h1, html.ui3.ui3m .msg .m-txt h2, html.ui3.ui3m .msg .m-txt h3, html.ui3.ui3m .msg .m-txt h4 {
  font-family: var(--font-b) !important; font-style: normal !important; color: var(--p-ink) !important;
  font-weight: 600 !important; letter-spacing: -.015em !important; line-height: 1.3 !important; margin: 1.4em 0 .5em !important;
}
html.ui3.ui3m .msg .m-txt h1 { font-size: 20px !important; }
html.ui3.ui3m .msg .m-txt h2 { font-size: 18px !important; }
html.ui3.ui3m .msg .m-txt h3, html.ui3.ui3m .msg .m-txt h4 { font-size: 16.5px !important; }
html.ui3.ui3m .msg .m-txt > :first-child { margin-top: 0 !important; }
html.ui3.ui3m .msg .m-txt strong, html.ui3.ui3m .msg .m-txt b { font-weight: 600 !important; color: var(--p-ink) !important; }
html.ui3.ui3m .msg .m-txt a { color: var(--p-nila) !important; text-underline-offset: 3px !important; text-decoration-thickness: 1px !important; }
html.ui3.ui3m .msg .m-txt :not(pre) > code { font-family: var(--font-m) !important; font-size: .86em !important; background: var(--p-sunk) !important; border: 1px solid var(--p-line) !important; border-radius: 5px !important; padding: .1em .35em !important; }
html.ui3.ui3m .msg .m-txt table { border-collapse: separate !important; border-spacing: 0 !important; border: 1px solid var(--p-line-2) !important; border-radius: 12px !important; overflow: hidden !important; font-size: 14px !important; background: var(--p-raise) !important; }
html.ui3.ui3m .msg .m-txt th { background: var(--p-sunk) !important; font-weight: 600 !important; border: 0 !important; border-bottom: 1px solid var(--p-line-2) !important; padding: 9px 12px !important; text-align: left !important; }
html.ui3.ui3m .msg .m-txt td { border: 0 !important; border-top: 1px solid var(--p-line) !important; padding: 9px 12px !important; }
html.ui3.ui3m .msg .m-txt tr:first-child td { border-top: 0 !important; }

html.ui3.ui3m .msg.user .m-body { background: transparent !important; border: 0 !important; box-shadow: none !important; padding: 0 !important; max-width: 85% !important; }
html.ui3.ui3m .msg.user .m-txt {
  background: var(--p-nila-wash) !important;
  color: var(--p-ink) !important;
  border: 0 !important;
  border-radius: 20px !important;
  padding: 10px 16px !important;
  font-size: 16px !important;
  line-height: 1.5 !important;
  box-shadow: none !important;
}
html.ui3.ui3m .msg.user .m-txt p { margin: 0 !important; }
html.ui3.ui3m .msg.user { margin-bottom: 24px !important; }
html.ui3.ui3m .msg.assistant { margin-bottom: 32px !important; }

html.ui3.ui3m .m-act { width: 36px !important; height: 36px !important; border-radius: 10px !important; color: var(--p-ink-3) !important; background: transparent !important; border: 0 !important; }
html.ui3.ui3m .m-act svg { width: 17px !important; height: 17px !important; }
html.ui3.ui3m .assistant-foot { margin-top: 10px !important; gap: 4px !important; align-items: center !important; }
html.ui3.ui3m .ws-toggle { height: 32px !important; padding: 0 12px !important; border-radius: 999px !important; border: 1px solid var(--p-line-2) !important; background: var(--p-raise) !important; color: var(--p-ink-2) !important; font-size: 13px !important; font-weight: 500 !important; }
html.ui3.ui3m .ws-sources-inner { background: var(--p-raise) !important; border: 1px solid var(--p-line) !important; border-radius: 14px !important; }
html.ui3.ui3m .civic-card { background: var(--p-raise) !important; border: 1px solid var(--p-line-2) !important; border-radius: 16px !important; box-shadow: var(--p-shadow-xs) !important; }
html.ui3.ui3m .msg pre { border-radius: 12px !important; border: 1px solid var(--p-line-2) !important; }

/* composer */
html.ui3.ui3m .input-area { background: linear-gradient(color-mix(in srgb, var(--p-canvas) 0%, transparent), var(--p-canvas) 28%) !important; }
html.ui3.ui3m .input-area::before, html.ui3.ui3m .input-area::after { display: none !important; }
html.ui3.ui3m .input-box {
  background: var(--p-raise) !important;
  border: 1px solid var(--p-line-2) !important;
  border-radius: 24px !important;
  box-shadow: var(--p-shadow-tray) !important;
  padding: 7px 7px 7px 8px !important;
}
html.ui3.ui3m .input-box:focus-within { border-color: color-mix(in srgb, var(--p-nila) 45%, transparent) !important; box-shadow: var(--p-shadow-tray), 0 0 0 3px var(--p-nila-tint) !important; }
html.ui3.ui3m .input-row { align-items: flex-end !important; gap: 4px !important; }
html.ui3.ui3m #msgIn { font-family: var(--font-b) !important; font-size: 16px !important; line-height: 1.5 !important; color: var(--p-ink) !important; padding: 9px 4px !important; }
html.ui3.ui3m #msgIn::placeholder { color: var(--p-ink-3) !important; opacity: 1 !important; }
html.ui3.ui3m .in-tool { width: 40px !important; height: 40px !important; border-radius: 14px !important; color: var(--p-ink-3) !important; background: transparent !important; }
html.ui3.ui3m .send-btn { width: 40px !important; height: 40px !important; border-radius: 15px !important; background: var(--p-send) !important; color: var(--p-on-send) !important; border: 0 !important; box-shadow: 0 1px 2px rgba(0, 0, 0, .18) !important; }
html.ui3.ui3m .send-btn.stop { background: var(--p-send) !important; color: var(--p-on-send) !important; }
html.ui3.ui3m .send-btn svg { width: 18px !important; height: 18px !important; }
html.ui3.ui3m .input-foot span { font-size: 11px !important; color: var(--p-ink-4) !important; }
html.ui3.ui3m .scroll-fab { background: var(--p-raise) !important; border: 1px solid var(--p-line-2) !important; color: var(--p-ink-2) !important; box-shadow: var(--p-shadow-pop) !important; }

/* drawer */
html.ui3.ui3m aside#sb.sb { background: var(--p-side) !important; border-right: 0 !important; }
html.ui3.ui3m .sb-top .logo-text { font-family: var(--font-b) !important; font-weight: 600 !important; letter-spacing: -.02em !important; color: var(--p-ink) !important; }
html.ui3.ui3m .sb-new { background: var(--p-raise) !important; color: var(--p-ink) !important; border: 1px solid var(--p-line) !important; border-radius: 12px !important; box-shadow: var(--p-shadow-xs) !important; font-weight: 550 !important; }
html.ui3.ui3m .sb-search-btn { background: transparent !important; border: 0 !important; color: var(--p-ink-3) !important; }
html.ui3.ui3m .sb-dock-item { border-radius: 10px !important; color: var(--p-ink-2) !important; background: transparent !important; }
html.ui3.ui3m .sb-dock-item svg { color: var(--p-ink-3) !important; }
html.ui3.ui3m .sb-divider { background: transparent !important; }
html.ui3.ui3m .sb-group, html.ui3.ui3m[data-theme="dark"] .sb-group { font-family: var(--font-b) !important; font-size: 13px !important; font-weight: 500 !important; text-transform: none !important; letter-spacing: 0 !important; color: var(--p-ink-3) !important; }
html.ui3.ui3m .sb-item, html.ui3.ui3m[data-theme="dark"] .sb-item { border-radius: 10px !important; color: var(--p-ink-2) !important; background: transparent !important; font-weight: 400 !important; }
html.ui3.ui3m .sb-item.on, html.ui3.ui3m[data-theme="dark"] .sb-item.on, html.ui3.ui3m[data-theme="light"] .sb-item.on { background: var(--p-raise) !important; color: var(--p-ink) !important; font-weight: 500 !important; box-shadow: var(--p-shadow-xs), 0 0 0 1px var(--p-line) !important; }
html.ui3.ui3m .sb-item.on::before { display: none !important; }
html.ui3.ui3m .sb-foot { background: transparent !important; border-top: 1px solid var(--p-line) !important; }
html.ui3.ui3m #uAv { background: var(--p-nila) !important; color: var(--p-on-nila) !important; }

}

/* =====================================================================
   COMPOSER_PLUS_MENU_V1 (11-10, Dimas "+ instead of attachment, kayak
   ChatGPT"): one "+" opens a tool menu anchored to the composer (opens
   downward on the empty state, upward in a chat); picked mode = a pill.
   ===================================================================== */
html.ui3 .input-box { position: relative; }
html.ui3 .input-box .input-tools { position: static !important; }  /* chat-base mobile layer made it relative -> menu anchored to a 43px box */
html.ui3 .plus-wrap { display: flex; }
html.ui3 .plus-btn svg { width: 20px !important; height: 20px !important; transition: transform .18s ease; }
html.ui3 .plus-btn[aria-expanded="true"] { color: var(--p-ink) !important; background: var(--p-sunk) !important; }
html.ui3 .plus-btn[aria-expanded="true"] svg { transform: rotate(45deg); }
html.ui3 .plus-menu {
  position: absolute; left: 0; bottom: calc(100% + 8px); z-index: 60;
  width: min(440px, 100%); padding: 6px;
  background: var(--p-raise); border: 1px solid var(--p-line); border-radius: 18px;
  box-shadow: var(--p-shadow-pop);
  display: flex; flex-direction: column; gap: 1px;
  transform-origin: bottom left; animation: plusIn .14s ease-out;
}
@media (min-width: 1024px) { html.ui3 main.mn:has(#msgArea > .welcome) .plus-menu { bottom: auto; top: calc(100% + 8px); transform-origin: top left; } }  /* desktop empty state: composer sits mid-screen */
html.ui3 .plus-menu[hidden] { display: none; }
html.ui3 .plus-item {
  display: flex; align-items: baseline; gap: 8px; width: 100%; min-width: 0;
  padding: 9px 12px; border: 0; border-radius: 12px; background: transparent;
  font: inherit; font-size: 14px; line-height: 1.3; color: var(--p-ink); text-align: left; cursor: pointer;
}
html.ui3 .plus-item svg { width: 18px; height: 18px; flex: none; color: var(--p-ink-2); align-self: center; margin-right: 4px; }
html.ui3 .plus-item .pi-l { flex: none; font-weight: 500; }
html.ui3 .plus-item .pi-d { min-width: 0; color: var(--p-ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html.ui3 .plus-item:hover, html.ui3 .plus-item:focus-visible { background: var(--p-sunk); outline: none !important; }
html.ui3 .plus-cam { display: none; }
html.ui3 .plus-web { cursor: default; }
html.ui3 .plus-web:hover { background: transparent; }
html.ui3 .plus-web .pi-sw { margin-left: auto; align-self: center; flex: none; width: 30px; height: 18px; border-radius: 999px; background: var(--p-nila); position: relative; }
html.ui3 .plus-web .pi-sw i { position: absolute; top: 2px; right: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--p-on-nila); }
@media (pointer: coarse) { html.ui3 .plus-cam { display: flex; } }
html.ui3 .plus-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 4px 0 10px; margin-left: 2px;
  border-radius: 999px; background: var(--p-nila-wash); color: var(--p-nila-hi);
  font-size: 13.5px; font-weight: 500; white-space: nowrap; flex: none;
}
html.ui3 .plus-chip[hidden] { display: none; }
html.ui3 .plus-chip > svg { width: 16px; height: 16px; flex: none; }
html.ui3 .plus-chip-x { display: inline-grid; place-items: center; width: 24px; height: 24px; border: 0; border-radius: 999px; background: transparent; color: inherit; cursor: pointer; opacity: .7; }
html.ui3 .plus-chip-x:hover { opacity: 1; background: var(--p-nila-tint); }
html.ui3 .plus-chip-x svg { width: 14px; height: 14px; }
@media (max-width: 1023px) {
  html.ui3.ui3m .plus-item { flex-wrap: wrap; row-gap: 2px; padding: 11px 14px; font-size: 15px; min-height: 44px; }
  html.ui3.ui3m .plus-web .pi-sw { order: 2; }
  html.ui3.ui3m .plus-item .pi-d { order: 3; flex-basis: 100%; padding-left: 30px; font-size: 13px; white-space: normal; }
  html.ui3.ui3m .plus-btn svg { width: 22px !important; height: 22px !important; }
  html.ui3.ui3m .plus-chip { height: 34px; }
}
@media (max-width: 559px) {
  html.ui3.ui3m .plus-chip { padding-left: 9px; gap: 2px; }
  html.ui3.ui3m #plusChipTx { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }  /* narrow phones: icon + x, label stays for screen readers */
}
@keyframes plusIn { from { opacity: 0; transform: translateY(4px) scale(.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { html.ui3 .plus-menu { animation: none; } html.ui3 .plus-btn svg { transition: none; } }

/* =====================================================================
   COMPOSER_MODEL_PICKER_V1 (11-10, Dimas): model + thinking picker sits in
   the composer next to Send on desktop (ChatGPT/Gemini). Mobile keeps the
   top badge (.mode-wrap is hidden below 1024px by the mobile layer).
   RESPONSE_STYLE_PRESET_V1: style sub-panel in the + menu + style chip.
   ===================================================================== */
html.ui3 .input-right { display: flex; align-items: center; gap: 6px; }
@media (min-width: 1024px) {
  html.ui3 .input-right .mode-pill {
    height: 36px !important; padding: 0 8px 0 12px !important; border-radius: 12px !important;
    font-size: 14px !important; font-weight: 500 !important; color: var(--p-ink-2) !important; gap: 6px !important;
  }
  html.ui3 .input-right .mode-pill:hover, html.ui3 .input-right .mode-pill.open { background: var(--p-sunk) !important; color: var(--p-ink) !important; }
  html.ui3 .input-right .mode-pill .model-dot { display: none !important; }
  html.ui3 .input-right .mode-pill .chev { display: block !important; width: 14px; height: 14px; opacity: .7; }
  html.ui3 .input-right .mode-pill .think-badge { border: 0 !important; padding: 0 !important; color: var(--p-ink-3) !important; font-size: 14px !important; font-weight: 500 !important; }
  html.ui3 .input-right .mode-dd { top: auto !important; bottom: calc(100% + 12px) !important; left: auto !important; right: -44px !important; transform-origin: bottom right; }
  html.ui3 main.mn:has(#msgArea > .welcome) .input-right .mode-dd { bottom: auto !important; top: calc(100% + 12px) !important; transform-origin: top right; }
}
html.ui3 .plus-panel { display: flex; flex-direction: column; gap: 1px; }
html.ui3 .plus-panel[hidden] { display: none; }
html.ui3 .plus-item .pi-chev { width: 16px; height: 16px; margin-left: auto; color: var(--p-ink-3); align-self: center; flex: none; }
html.ui3 .plus-back { color: var(--p-ink-2); }
html.ui3 .plus-back .pi-l { font-weight: 600; color: var(--p-ink); }
html.ui3 .plus-sty { padding-left: 16px; }
html.ui3 .plus-sty .pi-check { width: 16px; height: 16px; margin-left: auto; align-self: center; flex: none; color: var(--p-nila); visibility: hidden; }
html.ui3 .plus-sty[aria-checked="true"] .pi-check { visibility: visible; }
@media (max-width: 1023px) {
  html.ui3.ui3m .plus-sty .pi-check { order: 2; }
  html.ui3.ui3m .plus-item .pi-chev { order: 2; }
}

/* =====================================================================
   MODEL_PICKER_REDESIGN_V1 (11-10, Dimas): compact model menu. One line
   per model (name + subtle slogan, check on the active one), thinking
   modes as a horizontal segmented control, no descriptions. Side and
   max-height are set by JS from the room around the pill.
   ===================================================================== */
html.ui3 #modeDD { width: 300px !important; min-width: 0 !important; padding: 6px !important; border-radius: 18px !important; overflow-x: hidden !important; overflow-y: auto !important; overscroll-behavior: contain; }
html.ui3 #modeDD .mode-opt {
  position: relative; display: block !important; padding: 9px 38px 9px 12px !important; margin: 0 !important;
  border: 0 !important; border-radius: 12px !important; background: transparent !important;
}
html.ui3 #modeDD .mode-opt:hover, html.ui3 #modeDD .mode-opt.on:hover { background: var(--p-sunk) !important; }
html.ui3 #modeDD .mode-opt.on { background: transparent !important; }
html.ui3 #modeDD .mode-opt > .model-dot, html.ui3 #modeDD .mo-sub, html.ui3 #modeDD .mo-tag[data-i18n="mo_flag"] { display: none !important; }
html.ui3 #modeDD .mo-label { font-size: 14px !important; font-weight: 600 !important; color: var(--p-ink) !important; display: flex !important; align-items: baseline; gap: 8px; white-space: nowrap; }
html.ui3 #modeDD .mo-slg { font-size: 13px; font-weight: 400; color: var(--p-ink-3); overflow: hidden; text-overflow: ellipsis; }
html.ui3 #modeDD .mo-tag, html.ui3 #modeDD .mo-offline {
  font-size: 10.5px !important; font-weight: 500 !important; letter-spacing: 0 !important; text-transform: none !important;
  padding: 1px 7px !important; margin-left: 0 !important; border-radius: 999px !important; align-self: center;
  background: var(--p-nila-wash) !important; color: var(--p-nila-hi) !important; border: 0 !important;
}
html.ui3 #modeDD .mode-opt.on::after {
  content: ""; position: absolute; right: 14px; top: 50%; width: 16px; height: 16px; margin-top: -8px;
  background: var(--p-nila);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5L20 7'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5L20 7'/%3E%3C/svg%3E") center / contain no-repeat;
}
html.ui3 #modeDD .mode-opt.disabled { opacity: .5 !important; }
html.ui3 #modeDD .ext-think-section {
  margin: 6px 0 0 !important; padding: 10px 6px 4px !important; border-top: 1px solid var(--p-line) !important;
  background: transparent !important; border-radius: 0 !important;
}
html.ui3 #modeDD .ext-think-label { padding: 0 6px 8px !important; font-size: 12px !important; font-weight: 500 !important; color: var(--p-ink-3) !important; letter-spacing: 0 !important; text-transform: none !important; }
html.ui3 #modeDD .ext-think-desc, html.ui3 #modeDD .tm-d, html.ui3 #modeDD .tm-check { display: none !important; }
html.ui3 #modeDD .thinking-segment {
  display: flex !important; gap: 2px !important; grid-template-columns: none !important;
  padding: 3px !important; margin: 0 !important; background: var(--p-sunk) !important; border: 0 !important; border-radius: 12px !important; box-shadow: none !important;
}
html.ui3 #modeDD .thinking-segment button {
  flex: 1 1 auto; min-width: 0; display: flex !important; align-items: center; justify-content: center;
  height: 32px; padding: 0 9px !important; border: 0 !important; border-radius: 9px !important; box-shadow: none !important;
  background: transparent !important; color: var(--p-ink-2) !important; font: inherit !important; font-size: 13px !important; font-weight: 500 !important; white-space: nowrap; cursor: pointer;
}
html.ui3 #modeDD .thinking-segment button[style*="display: none"], html.ui3 #modeDD .thinking-segment button[style*="display:none"] { display: none !important; }
html.ui3 #modeDD .thinking-segment button:hover { color: var(--p-ink) !important; }
html.ui3 #modeDD .thinking-segment button.on { background: var(--p-seg-on) !important; color: var(--p-ink) !important; box-shadow: 0 1px 2px rgba(0, 0, 0, .10), 0 0 0 1px var(--p-line) !important; }
@media (min-width: 1024px) {
  html.ui3 main.mn .input-right #modeDD.flip-up, html.ui3 main.mn:has(#msgArea > .welcome) .input-right #modeDD.flip-up { top: auto !important; bottom: calc(100% + 12px) !important; transform-origin: bottom right; }
  html.ui3 main.mn .input-right #modeDD.flip-down, html.ui3 main.mn:has(#msgArea > .welcome) .input-right #modeDD.flip-down { bottom: auto !important; top: calc(100% + 12px) !important; transform-origin: top right; }
}

/* INCOG_ICON_CENTER_V1 (11-10, Dimas): .guest-hide{display:revert} turned the incognito button back into an inline
   box, so its icon sat on the text baseline 1.5px above the other topbar icons */
html.ui3 .top-right #incognitoBtn { display: inline-flex; align-items: center; justify-content: center; }
html.ui3 .top-right #incognitoBtn svg { display: block; }

/* =====================================================================
   MOBILE_PICKER_REDESIGN_V1 (11-10, Dimas): the phone model menu
   (#mobModelDd, built by mobile-native.js) looks like the desktop one.
   ===================================================================== */
@media (max-width: 1023px) {
  html.ui3.ui3m #mobModelDd {
    width: min(300px, calc(100vw - 24px)) !important; padding: 6px !important; border-radius: 18px !important;
    background: var(--p-raise) !important; border: 1px solid var(--p-line) !important; box-shadow: var(--p-shadow-pop) !important;
  }
  html.ui3.ui3m #mobModelDd .dd-item {
    position: relative; display: flex !important; align-items: center; gap: 8px; width: 100%; min-height: 44px;
    padding: 0 40px 0 12px !important; border: 0 !important; border-radius: 12px !important; background: transparent !important; text-align: left;
  }
  html.ui3.ui3m #mobModelDd .dd-item:active { background: var(--p-sunk) !important; }
  html.ui3.ui3m #mobModelDd .dd-dot { display: none !important; }
  html.ui3.ui3m #mobModelDd .dd-info { flex-direction: row !important; align-items: baseline; gap: 8px !important; min-width: 0; }
  html.ui3.ui3m #mobModelDd .dd-label { font-size: 15px !important; font-weight: 600 !important; color: var(--p-ink) !important; white-space: nowrap; }
  html.ui3.ui3m #mobModelDd .dd-desc { font-size: 13.5px !important; color: var(--p-ink-3) !important; line-height: 1.3 !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  html.ui3.ui3m #mobModelDd .dd-tag {
    font-size: 11px !important; font-weight: 500 !important; letter-spacing: 0 !important; text-transform: none !important;
    padding: 1px 8px !important; border-radius: 999px !important; background: var(--p-nila-wash) !important; color: var(--p-nila-hi) !important;
  }
  html.ui3.ui3m #mobModelDd .dd-tag:empty { display: none !important; }
  html.ui3.ui3m #mobModelDd .dd-item.active::after {
    content: ""; position: absolute; right: 14px; top: 50%; width: 16px; height: 16px; margin-top: -8px; background: var(--p-nila);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5L20 7'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5L20 7'/%3E%3C/svg%3E") center / contain no-repeat;
  }
  html.ui3.ui3m #mobModelDd .dd-item.disabled { opacity: .5 !important; }
  html.ui3.ui3m #mobModelDd .dd-div { height: 1px !important; background: var(--p-line) !important; margin: 6px 0 !important; }
  html.ui3.ui3m #mobModelDd .dd-reason { padding: 4px 6px 4px !important; }
  html.ui3.ui3m #mobModelDd .dd-toggle-label { font-size: 12.5px !important; font-weight: 500 !important; color: var(--p-ink-3) !important; padding: 0 6px 8px; }
  html.ui3.ui3m #mobModelDd .dd-toggle-desc { display: none !important; }
  html.ui3.ui3m #mobModelDd .dd-reason-seg {
    display: flex !important; gap: 2px !important; padding: 3px !important; margin: 0 !important;
    background: var(--p-sunk) !important; border: 0 !important; border-radius: 12px !important;
  }
  html.ui3.ui3m #mobModelDd .dd-reason-seg button {
    flex: 1 1 auto; height: 36px; padding: 0 8px !important; border: 0 !important; border-radius: 9px !important;
    background: transparent !important; color: var(--p-ink-2) !important; font-size: 13.5px !important; font-weight: 500 !important; box-shadow: none !important;
  }
  html.ui3.ui3m #mobModelDd .dd-reason-seg button.on { background: var(--p-seg-on) !important; color: var(--p-ink) !important; box-shadow: 0 1px 2px rgba(0, 0, 0, .10), 0 0 0 1px var(--p-line) !important; }
}

/* STYLE_LEARN_NOT_LYT_V1: [hidden] must win over .plus-item display:flex */
html.ui3 .plus-item[hidden] { display: none !important; }

/* SELF_HARM_CARD_V1 (2026-11-12): crisis-help card (calm, not an alarm) */
.crisis-card { margin: 12px 0 4px; padding: 14px 16px; border-radius: 14px; max-width: 560px;
  background: var(--p-nila-wash, #F4F0E7); border: 1px solid var(--p-line-2, rgba(31,24,18,.13)); color: var(--p-ink, #0D0D0D); }
.crisis-card-h { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--p-nila-hi, #5E5037); }
.crisis-card-h b { font-weight: 600; color: var(--p-ink, #0D0D0D); }
.crisis-card-d { margin-top: 6px; font-size: 14px; line-height: 1.5; color: var(--p-ink-2, #5D5D5D); }
.crisis-card-a { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.crisis-card-btn { flex: 1 1 200px; display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 10px;
  text-decoration: none !important; background: var(--p-raise, #fff); border: 1px solid var(--p-line-2, rgba(31,24,18,.13));
  color: var(--p-ink, #0D0D0D) !important; }
.crisis-card-btn:hover, .crisis-card-btn:focus-visible { border-color: var(--p-nila, #7A6949); outline: none; }
.crisis-card-btn b { font-size: 14px; font-weight: 600; }
.crisis-card-btn span { font-size: 12.5px; color: var(--p-ink-3, #8F8F8F); }
.crisis-card-e { margin-top: 10px; font-size: 12.5px; line-height: 1.45; color: var(--p-ink-2, #5D5D5D); }

/* SVARA_TITLE_ORIGIN_V1: Svara mark before the title of a chat started in Svara. Top level on purpose (desktop AND
   mobile; a copy inside the >=1024px block left the icon unsized on phones). */
.sb-item .sb-svara { width: 13px; height: 13px; flex: 0 0 13px; opacity: .55; }
.sb-item.on .sb-svara { opacity: .8; }

/* -- CHAT_SAND_EMPTY_V1 (11-13): strata sand behind the empty new-chat state (chat-sand.js). Kill: CHAT_SAND_ON=false
   in chat.html or ?sand=0. The canvas sits under the text (z -1 inside an isolated main), msg-wrap goes transparent
   only while the sand is on. -- */
#chatSand { display: none; }
html.sand #chatSand { display: block; position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 100%;
  z-index: -1; pointer-events: none; transition: opacity .3s; }
html.sand main.mn { isolation: isolate; }
html.ui3.ui3m.sand.sand-on .msg-wrap, html.ui3.ui3m.sand.sand-on[data-theme] .msg-wrap { background: transparent !important; }
@media (max-width: 1023px) { html.sand #chatSand { bottom: var(--sand-ia-h, 96px); height: 34%; } }
html.sand .wel-title { animation: none !important; }
html.sand .wel-title .w { display: inline-block; white-space: nowrap; }
html.sand .wel-title .ch { display: inline-block; animation: sandForm .7s cubic-bezier(.2,.8,.2,1) both;
  animation-delay: calc(var(--i) * 26ms + 380ms); }
@keyframes sandForm { from { opacity: 0; filter: blur(9px); transform: translateY(18px) scale(.94); } to { opacity: 1; filter: blur(0); transform: none; } }
.sand-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; user-select: none; -webkit-user-select: none; }
.sand-ghost, .sand-ghost * { animation: none !important; }
@media (prefers-reduced-motion: reduce) { html.sand .wel-title .ch { animation: none !important; } }
/* SAND_MOTION_TOGGLE_V1: Settings > General "Sand animation" off = one still frame, letters do not animate;
   the row is hidden when the sand itself is killed (no html.sand). */
html.sand-still .wel-title .ch { animation: none !important; }
html:not(.sand) #rowSand, html:not(.sand) #setModal #rowSand { display: none !important; }   /* beats settings-v2 .s-row flex */


/* ANSWER_TYPO_CHATGPT_V1 (11-18, Dimas: "paragraf, jarak2, tata penempatan teksnya dibuat mirip chatgpt"): answer body ONLY
   (.msg.assistant .m-txt). Values measured on chatgpt.com (Plus, Unpersonalized, desktop 1440 + 390). Dimas 17:14Z: "samain
   persis chatgpt kecuali tabel tetep yg skrg" + "jarak nya juga tetep yg skrg aja" -> ChatGPT text size/line height (16/26px),
   heading sizes, list markers and the 768px column (answer + composer); IsonAI's own spacing (block gaps, list gaps/indent,
   phone gutter) and table look are kept. Kill = delete this block (+ bump ?v=). Needs html.ui3.ui3m (CHAT_UI3_ONLY_V1). */
html.ui3 #msgArea.msg-inner { max-width: min(var(--p-col), 832px) !important; }  /* 768px text column (was up to 1176 on wide screens) */
html.ui3 .input-wrap { max-width: min(var(--p-col), 832px) !important; }  /* composer in the same column as the answer, like ChatGPT */

html.ui3.ui3m .msg.assistant .m-txt {
  --a-fs: 16px; --a-lh: 1.625;                 /* ChatGPT 16px / 26px */
  --a-h1: 20px; --a-h2: 18px; --a-h3: 16px; --a-h4: 16px;   /* ChatGPT sizes */
  font-size: var(--a-fs) !important; line-height: var(--a-lh) !important; letter-spacing: 0 !important;
}
html.ui3.ui3m .msg.assistant .m-txt :is(p, li) { font-size: var(--a-fs) !important; line-height: var(--a-lh) !important; letter-spacing: 0 !important; }

/* headings: weight and size only (spacing stays IsonAI's) */
html.ui3.ui3m .msg.assistant .m-txt :is(h1, h2, h3, h4, h5, h6) { font-weight: 600 !important; letter-spacing: 0 !important; }
html.ui3.ui3m .msg.assistant .m-txt h1 { font-size: var(--a-h1) !important; line-height: 28px !important; }
html.ui3.ui3m .msg.assistant .m-txt h2 { font-size: var(--a-h2) !important; line-height: 28px !important; }
html.ui3.ui3m .msg.assistant .m-txt h3 { font-size: var(--a-h3) !important; line-height: 24px !important; }
html.ui3.ui3m .msg.assistant .m-txt :is(h4, h5, h6) { font-size: var(--a-h4) !important; line-height: var(--a-lh) !important; }

/* list markers like ChatGPT: ink colour, bold numbers (spacing/indent stay IsonAI's) */
html.ui3.ui3m .msg.assistant .m-txt li::marker { color: var(--p-ink) !important; font-weight: 400; }
html.ui3.ui3m .msg.assistant .m-txt ol > li::marker { font-weight: 600; }

/* quote: size only (spacing and accent bar stay) */
html.ui3.ui3m .msg.assistant .m-txt blockquote { font-size: var(--a-fs) !important; line-height: var(--a-lh) !important; font-style: normal !important; }
/* tables: IsonAI's current look kept on purpose (Dimas 17:14Z) */

/* FONT_SYSTEM_STACK_V1 (11-19, Dimas "chatgpt tuh font/weight nya pake apa ... punya kita terlalu kaku, berasa baca
   microsoft word"): measured on chatgpt.com 11-19 -- it loads NO web font; text is the device UI font (Segoe UI on
   Windows, San Francisco on Mac/iPhone, Roboto on Android) at 16px / 400 / bold 600 / line 26px / #0D0D0D, the same
   numbers our answer text already uses (ANSWER_TYPO_CHATGPT_V1). html.font-sys swaps every chat font token to that
   stack. DEFAULT for everyone since 11-19 ~19:00Z (chat.html loader); old font per browser /chat?font=inst. */
html.ui3.font-sys[data-theme], html.ui3.ui3m.font-sys[data-theme] {
  --font-b: ui-sans-serif, -apple-system, system-ui, "Segoe UI", Helvetica, "Apple Color Emoji", Arial, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol";
  --font-d: ui-sans-serif, -apple-system, system-ui, "Segoe UI", Helvetica, "Apple Color Emoji", Arial, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol";
  --font-h: ui-sans-serif, -apple-system, system-ui, "Segoe UI", Helvetica, "Apple Color Emoji", Arial, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol";
  --font-s: ui-sans-serif, -apple-system, system-ui, "Segoe UI", Helvetica, "Apple Color Emoji", Arial, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol";
}

/* FONT_SYSTEM_STACK_SIDEBAR_V1 (11-20 02:0xZ, Dimas "yg di sidebar fontnya ga usah diutak atik"): the sidebar keeps
   Instrument Sans; the device font stays for the chat column (answers, your messages, composer, top bar). */
html.ui3.font-sys aside#sb.sb, html.ui3.ui3m.font-sys aside#sb.sb {
  --font-b: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-d: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-h: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-s: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-family: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif !important;
}
