/* lm1-quality.css v2 — build options dropdown + day/night switch in the chat.
   Derives from the app's own tokens (--bg/--panel/--ink/--line/--muted/--accent) and adds
   explicit dark rules for the popover, which lives outside the app's component tree. */

/* ---------- the two controls, INSIDE .chat-composer (overrides its blanket button rule) ---------- */
.chat-composer .lm1q-controls { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; }

.chat-composer .lm1q-theme,
.chat-composer .lm1q-trigger {
  display: inline-flex; align-items: center; gap: 6px;
  height: 42px; border-radius: 11px; border: 1px solid var(--line, #e3e3e3);
  background: var(--panel, #fff); color: var(--ink, #1a1a1a);
  padding: 0 10px; font: inherit; font-size: 13.5px; font-weight: 600;
  cursor: pointer; box-shadow: 0 1px 1px rgba(0,0,0,.03);
  transition: border-color .12s, background .12s, box-shadow .12s, transform .06s;
}
.chat-composer .lm1q-theme { width: 42px; justify-content: center; padding: 0; }
/* the day/night switch in the TASKBAR, next to the clock */
.lm1q-tb {
  display: inline-grid; place-items: center; width: 30px; height: 30px; flex: 0 0 auto;
  margin-right: 4px; border-radius: 8px; border: 0; padding: 0;
  background: var(--task-btn, rgba(0,0,0,.05)); color: var(--task-ink, #16233a);
  cursor: pointer; transition: background .12s, transform .06s;
}

.lm1q-tb:hover { background: var(--task-btn-hover, rgba(0,0,0,.09)); }
.lm1q-tb:active { transform: scale(.94); }
.lm1q-tb:focus-visible { outline: 2px solid var(--accent, #0067c0); outline-offset: 2px; }
.chat-composer .lm1q-trigger { width: 42px; padding: 0; justify-content: center; gap: 4px; }
.chat-composer .lm1q-trigger svg, .lm1q-tb svg { display: block; flex: 0 0 auto; }
/* the chat text field keeps priority: without this the 4 flex children squeezed it to ~34 px
   inside a 300 px chat column (measured complaint: "text field is now super tiny") */
#chatInput, .chat-composer textarea { min-width: 140px; }
.chat-composer .lm1q-trigger-label { letter-spacing: .1px; }
.chat-composer .lm1q-caret { opacity: .55; transition: transform .15s ease; }
.chat-composer .lm1q-trigger:hover,
.chat-composer .lm1q-theme:hover { border-color: var(--accent, #0067c0); box-shadow: 0 2px 6px rgba(0,0,0,.07); }
.chat-composer .lm1q-trigger:active { transform: translateY(1px); }
.chat-composer .lm1q-trigger:focus-visible,
.chat-composer .lm1q-theme:focus-visible { outline: 2px solid var(--accent, #0067c0); outline-offset: 2px; }

.lm1q-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; background: #94a3b8; box-shadow: 0 0 0 3px rgba(148,163,184,.18); }
.lm1q-dot[data-tier="medium"]       { background: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.16); }
.lm1q-dot[data-tier="high"]         { background: #7c3aed; box-shadow: 0 0 0 3px rgba(124,58,237,.16); }
.lm1q-dot[data-tier="experimental"] { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245,158,11,.18); }

/* ---------- the popover (fixed, anchored to the trigger) ---------- */
.lm1q-panel {
  position: fixed; z-index: 10000; width: 384px; max-width: calc(100vw - 16px);
  background: var(--panel, #fff); color: var(--ink, #1a1a1a);
  border: 1px solid var(--line, #e3e3e3); border-radius: 16px;
  box-shadow: 0 24px 60px rgba(16,24,40,.20), 0 2px 8px rgba(16,24,40,.08);
  padding: 10px; opacity: 0; transform: translateY(6px) scale(.985);
  transition: opacity .14s ease, transform .14s ease;
  font-size: 13px;
}
.lm1q-panel.is-in { opacity: 1; transform: translateY(0) scale(1); }
.lm1q-head { display: flex; align-items: baseline; gap: 8px; padding: 4px 8px 8px; }
.lm1q-head span { font-weight: 750; font-size: 12.5px; letter-spacing: .3px; text-transform: uppercase; opacity: .75; }
.lm1q-head small { font-size: 11.5px; opacity: .55; }

.lm1q-opts { display: flex; flex-direction: column; gap: 2px; }
.lm1q-opt {
  display: grid; grid-template-columns: 16px 1fr auto 14px; align-items: center; gap: 9px;
  width: 100%; text-align: left; padding: 9px; border-radius: 11px;
  border: 1px solid transparent; background: transparent; color: inherit; cursor: pointer;
  font: inherit; transition: background .1s, border-color .1s;
}
.lm1q-opt:hover:not([disabled]) { background: rgba(37,99,235,.06); }
.lm1q-opt.is-on { background: rgba(37,99,235,.09); border-color: rgba(37,99,235,.35); }
.lm1q-opt[disabled] { opacity: .45; cursor: not-allowed; }
.lm1q-opt:focus-visible { outline: 2px solid var(--accent, #0067c0); outline-offset: 1px; }
.lm1q-opttext { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.lm1q-opttext b { font-size: 13.5px; font-weight: 650; }
.lm1q-opttext small { font-size: 11.5px; opacity: .62; line-height: 1.35; }
.lm1q-call { font-size: 11px; font-weight: 600; opacity: .7; white-space: nowrap; padding: 2px 7px; border-radius: 999px; background: rgba(15,23,42,.05); }
.lm1q-lock { font-size: 15px; opacity: .55; }
.lm1q-radio { width: 15px; height: 15px; border-radius: 50%; border: 1.5px solid rgba(15,23,42,.28); position: relative; }
.lm1q-opt.is-on .lm1q-radio { border-color: var(--accent, #0067c0); }
.lm1q-opt.is-on .lm1q-radio::after { content: ''; position: absolute; inset: 2.5px; border-radius: 50%; background: var(--accent, #0067c0); }

.lm1q-foot { display: flex; align-items: center; gap: 8px; padding: 10px 8px 4px; margin-top: 6px; border-top: 1px solid var(--line, #e3e3e3); }
.lm1q-tag { font-size: 11px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase; opacity: .55; }
.lm1q-modes { display: inline-flex; gap: 4px; margin-left: auto; }
.lm1q-mode {
  border: 1px solid var(--line, #e3e3e3); background: transparent; color: inherit;
  border-radius: 999px; padding: 5px 11px; font: inherit; font-size: 12px; font-weight: 650; cursor: pointer;
  transition: background .1s, border-color .1s, color .1s;
}
.lm1q-mode:hover { border-color: var(--accent, #0067c0); }
.lm1q-mode.is-on { background: var(--accent, #0067c0); border-color: var(--accent, #0067c0); color: #fff; }

.lm1q-toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: #101828; color: #fff; padding: 9px 16px; border-radius: 999px;
  font-size: 12.5px; z-index: 10001; box-shadow: 0 10px 30px rgba(0,0,0,.28);
  transition: opacity .4s, transform .4s;
}
.lm1q-toast.is-out { opacity: 0; transform: translateX(-50%) translateY(8px); }

/* ---------- dark ---------- */
[data-theme="dark"] .lm1q-panel { background: #131a2a; color: #dbe4f4; border-color: rgba(255,255,255,.1); box-shadow: 0 24px 60px rgba(0,0,0,.6); }
[data-theme="dark"] .lm1q-opt:hover:not([disabled]) { background: rgba(96,165,250,.1); }
[data-theme="dark"] .lm1q-opt.is-on { background: rgba(96,165,250,.14); border-color: rgba(96,165,250,.4); }
[data-theme="dark"] .lm1q-radio { border-color: rgba(255,255,255,.35); }
[data-theme="dark"] .lm1q-call { background: rgba(255,255,255,.08); }
[data-theme="dark"] .lm1q-foot { border-color: rgba(255,255,255,.1); }
[data-theme="dark"] .lm1q-mode { border-color: rgba(255,255,255,.16); }
[data-theme="dark"] .lm1q-mode.is-on { background: #3b82f6; border-color: #3b82f6; color: #fff; }
[data-theme="dark"] .chat-composer .lm1q-theme,
[data-theme="dark"] .chat-composer .lm1q-trigger { background: #131a2a; border-color: rgba(255,255,255,.14); color: #dbe4f4; }
[data-theme="dark"] .lm1q-toast { background: #e8eefc; color: #0b1220; }

@media (max-width: 560px) {
  .lm1q-panel { width: calc(100vw - 16px); }
  .chat-composer .lm1q-trigger-label { display: none; }
  .chat-composer .lm1q-trigger { padding: 0 8px; }
  .lm1q-opttext small { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .lm1q-panel, .lm1q-toast, .chat-composer .lm1q-trigger, .chat-composer .lm1q-theme { transition: none; }
}

/* ================= dark chat window =================
   The chat surface was the one place the app's dark theme never reached: .chat-head,
   .chat-composer and the bubbles carry hardcoded light colours (#fafafa, #f1f4f9, #eaf3ff,
   #fff, #1a1a1a) and there was no [data-theme=dark] rule for any of them. These overrides
   give the whole chat room — head, message area, bubbles, composer, artifact card — the
   dark palette, while the preview pane (.chat-app) keeps its own dark navy. */
[data-theme="dark"] .win.chat-win { background: #12161f; border-color: rgba(255,255,255,.1); }
[data-theme="dark"] .chat-left { background: #12161f; border-color: rgba(255,255,255,.08); }
[data-theme="dark"] .chat-msgs { background: #0f141d; }
[data-theme="dark"] .chat-head { background: #151b26; border-color: rgba(255,255,255,.08); }
[data-theme="dark"] .chat-head b,
[data-theme="dark"] .chat-head input#chatProjName { color: #e6edf7; }
[data-theme="dark"] .chat-head button { background: transparent; color: #c7d2e5; }
[data-theme="dark"] .chat-head button:hover { background: rgba(255,255,255,.07); }
[data-theme="dark"] .chat-composer { background: #151b26; border-color: rgba(255,255,255,.08); }
[data-theme="dark"] .chat-composer textarea {
  background: #0f141d; color: #e6edf7; border-color: rgba(255,255,255,.12);
}
[data-theme="dark"] .chat-composer textarea::placeholder { color: #8b97b8; }
[data-theme="dark"] .chat-composer .chat-attach { background: #1c2432; color: #c7d2e5; }
[data-theme="dark"] .chat-composer .chat-attach:hover { background: #26303f; }
[data-theme="dark"] .cbubble { background: #1b2230; color: #e6edf7; }
[data-theme="dark"] .cmsg.user .cbubble { background: #1d2a44; color: #eaf1fb; }
[data-theme="dark"] .cmsg .cava { color: #fff; }
[data-theme="dark"] .c-empty { color: #8b97b8; }
[data-theme="dark"] .cart { background: #161c28; border-color: rgba(255,255,255,.1); }
[data-theme="dark"] .cart-head { background: #1b2231; border-color: rgba(255,255,255,.1); }
[data-theme="dark"] .cart-head b { color: #e6edf7; }
[data-theme="dark"] .cart-body, [data-theme="dark"] .cart pre { background: #0f141d; color: #cdd8ea; }
[data-theme="dark"] .cmore { background: #1b2230; color: #dbe4f4; border-color: rgba(255,255,255,.14); }
[data-theme="dark"] .chat-ver { background: #1b2230; color: #9fb0c9; }
[data-theme="dark"] .chat-composer .lm1q-trigger { background: #1b2230; border-color: rgba(255,255,255,.14); color: #e6edf7; }
[data-theme="dark"] .cbubble .chat-tick, [data-theme="dark"] .cbubble .stream-status { color: #8b97b8; }

/* on a narrow chat the label goes, the dot + chevron stay: the composer must not shrink */
