/* #region zone:desk.style.dialog — กล่องยืนยันกลางจอ (ทุกการตัดสินใจ ไม่ใช่ toast) */
/* #region zone:desk.style.dialog.scenario-scores — ตารางคะแนนยุบเป็นรายการบนโทรศัพท์ */
.desk-dialog.scenario-scores-dialog {
  width: min(70rem, calc(100vw - 2rem));
  max-height: calc(100dvh - 2rem);
}
.scenario-scores-body {
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}
.scenario-score-periods {
  display: flex;
  gap: 0.5rem;
  margin-block: 1rem;
}
.scenario-score-periods button {
  flex: 1;
}
.scenario-score-periods [aria-pressed='true'] {
  border-color: var(--accent);
  color: var(--accent-text);
}
.scenario-scores-summary {
  font-weight: 600;
  line-height: 1.7;
}
.scenario-scores-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
  table-layout: fixed;
}
.scenario-scores-table th,
.scenario-scores-table td {
  padding: 0.5rem 0.25rem;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
  text-align: start;
}
.scenario-scores-explain {
  font-size: 0.8125rem;
  line-height: 1.7;
  color: var(--muted);
}
@media (max-width: 700px) {
  .scenario-scores-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .scenario-scores-table,
  .scenario-scores-table tbody,
  .scenario-scores-table tr {
    display: block;
  }
  .scenario-scores-table tr {
    margin-block: 1rem;
  }
  .scenario-scores-table td {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.5rem;
  }
  .scenario-scores-table td::before {
    content: attr(data-label);
    font-weight: 600;
  }
}
/* #endregion */
/* desk-ui.js confirmDialog(): a centred modal with a scrim; on a phone it keeps the side gutters. */
.desk-dialog {
  width: min(420px, calc(100vw - 32px));
  max-width: none;
  padding: 22px 22px 18px;
  margin: auto;
  border: 1px solid var(--line);
  border-radius: var(--u-radius-dialog);
  background: var(--u-sheet);
  color: var(--text);
  box-shadow: var(--pop-shadow);
}
.desk-dialog[open] {
  animation: stDialogIn 0.16s ease-out;
}
.desk-dialog::backdrop {
  background: var(--scrim-strong);
}
/* Scrolling body of a Desk dialog (shared rule in desk-tokens.css): the 22px shell padding holds the
   scrollbar, so it sits 6px from the card edge and the text keeps its 22px margin. */
.desk-dialog .dialog-body {
  --dlg-bg: var(--u-sheet);
}
@media (hover: hover) and (pointer: fine) {
  .desk-dialog .dialog-body {
    margin-inline-end: -16px;
    padding-inline-end: var(--sp-2);
  }
}
/* All Desk close icons share an inset rounded ring, clear of clipping ancestors. */
.desk-dialog button.icon-btn {
  margin: 0;
  flex-shrink: 0;
  border-radius: var(--r-control);
}
.desk-dialog button.icon-btn:focus:not(:focus-visible) {
  outline: none;
}
.desk-dialog button.icon-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
:root[data-desk-focus-input='pointer'] .desk-dialog button.icon-btn:focus-visible {
  outline: none;
}
.desk-dialog-title {
  margin: 0 0 var(--sp-2);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
}
.desk-dialog-body {
  margin: 0;
  font-size: var(--u-text-sm);
  line-height: 1.65;
  color: var(--muted);
}
.desk-dialog-error {
  margin: var(--sp-3) 0 0;
  font-size: var(--u-text-xs);
  color: var(--down);
}
.desk-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--sp-2);
  margin-top: var(--sp-5);
}
.desk-dialog-btn {
  height: 38px;
  padding: 0 var(--sp-4);
  border: 1px solid var(--line);
  border-radius: var(--r-button);
  background: var(--panel);
  color: var(--text);
  font-size: var(--u-text-sm);
  font-weight: 600;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease;
}
.desk-dialog-btn:not(:disabled):hover {
  background: var(--hover);
}
.desk-dialog-btn.is-danger {
  background: var(--tag-down-bg);
  border-color: var(--tag-down-bg);
  color: var(--tag-down-fg);
}
.desk-dialog-btn.is-danger:not(:disabled):hover {
  background: color-mix(in srgb, var(--tag-down-bg) 88%, var(--text));
}
.desk-dialog-btn.is-primary,
.desk-dialog-btn.is-primary:not(:disabled):hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.desk-dialog-btn.is-primary:not(:disabled):hover {
  background: color-mix(in srgb, var(--accent) 88%, var(--text));
}
.desk-dialog-btn:disabled {
  opacity: 0.6;
  cursor: default;
}
@keyframes stDialogIn {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (max-width: 480px) {
  .desk-dialog-actions .desk-dialog-btn {
    flex: 1 1 0;
  }
  /* DUI-20: the 3-action alert dialog stacks full-width on a phone, primary first. */
  .desk-input-dialog .desk-dialog-actions {
    flex-direction: column-reverse;
  }
  .desk-input-dialog .desk-dialog-actions .desk-dialog-btn {
    flex: none;
    width: 100%;
    white-space: nowrap;
  }
}
@media (pointer: coarse) {
  .desk-dialog-btn {
    height: 44px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .desk-dialog[open] {
    animation: none;
  }
}
/* #endregion */

/* #region zone:desk.style.chat-resize — แถบลากปรับความกว้างแผงแชท */
/* Owner 2026-09-26 "อยากให้ขยายยืดหดหน้าแชทได้อิสระ drag ได้" (desk-chat-resize.js): a hit target
   straddling the chat column's own left edge (.chat-col already has a positioning context via its
   own position:sticky in desk.css §layout). Hidden below 900px — the chat there is a full-screen
   phone tab, not a side column with a chart to trade width against. */
.chat-resize-handle {
  display: none;
  position: absolute;
  top: 0;
  bottom: 0;
  left: -10px;
  width: 20px;
  z-index: 5;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  cursor: col-resize;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
/* Owner 2026-09-27: no full-height line — only the col-resize cursor plus a small grip on hover/drag. */
.chat-resize-handle::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 8px;
  width: 4px;
  height: 32px;
  margin-top: -16px;
  border-radius: 2px;
  background: var(--muted);
  opacity: 0;
  transition: opacity 0.15s ease;
}
.chat-resize-handle:hover::before,
.chat-resize-handle:focus-visible::before,
.chat-resize-handle.is-dragging::before {
  opacity: 0.45;
}
@media (prefers-reduced-motion: reduce) {
  .chat-resize-handle::before {
    transition: none;
  }
}
.chat-resize-handle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -6px;
  border-radius: 4px;
}
@media (min-width: 900px) {
  .chat-resize-handle {
    display: block;
  }
}
@media (pointer: coarse) {
  .chat-resize-handle {
    width: 28px;
    left: -14px;
  }
}
/* While dragging: the whole page shows the resize cursor (pointer capture keeps the events on the
   handle regardless of what is under the pointer) and text never gets selected mid-drag. */
body.is-resizing-chat,
body.is-resizing-chat * {
  cursor: col-resize !important;
  user-select: none;
}
/* .app-grid's own transition (desk.css §layout, for the watchlist rail collapsing) also reads
   --chat-w, so without this override it would ease every drag/keyboard/reset step of ours too —
   both fighting the pointer during a live drag and, briefly, feeding desk-chat-resize.js's own
   post-change width read a mid-animation value instead of the real target. */
body.is-resizing-chat .app-grid {
  transition: none;
}
/* #endregion */

/* #region zone:desk.style.chat-topic — ขีดคั่น "เริ่มคุยเรื่อง … ใหม่" เมื่อเปลี่ยนหุ้น */
/* Clear on stock switch (desk-chat-topic.js): a quiet full-width rule with the label in the middle — a passive
   notice, not a control. Motion is opacity/transform only and is dropped under reduced motion. */
.chat-topic-divider {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  align-self: stretch;
  min-width: 0;
  padding: var(--sp-1) 0;
  color: var(--muted);
  font-size: var(--fs-xs);
  line-height: 1.5;
}
.chat-topic-divider::before,
.chat-topic-divider::after {
  content: '';
  flex: 1 1 16px;
  min-width: 16px;
  height: 1px;
  background: var(--line);
}
.chat-topic-divider span {
  flex: 0 1 auto;
  min-width: 0;
  text-align: center;
  overflow-wrap: anywhere;
}
@media (prefers-reduced-motion: no-preference) {
  .chat-topic-divider {
    animation: chat-topic-in var(--dur-slow) var(--ease-out) both;
  }
}
@keyframes chat-topic-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
/* #endregion */

/* #region zone:desk.chat.model-picker — ตัวเลือกโมเดล (ข้อความ) และ "ตอบโดย / ข้อมูลที่ใช้" ใต้คำตอบ */
.model-switch.model-picker {
  gap: var(--sp-1);
}

.reply-meta {
  display: grid;
  gap: var(--sp-2);
  font-size: var(--fs-sm, 12px);
  color: var(--muted);
}
.reply-meta p {
  margin: 0;
}
.reply-note {
  margin: 0;
}
.reply-effort {
  opacity: 0.8;
}
.reply-evidence {
  margin: 0;
}
.reply-evidence summary {
  cursor: pointer;
  width: fit-content;
  padding: var(--sp-1) 0;
}
.reply-evidence ul {
  margin: var(--sp-2) 0 0;
  padding-left: var(--sp-4);
  display: grid;
  gap: var(--sp-1);
}
.reply-evidence small {
  color: var(--muted);
}

/* #endregion */
