/* #region zone:desk.style.quicktools — เครื่องมือด่วนมุมขวาบน: ปุ่มไอคอนบนหัวเว็บมืด */
/* Batch B (2026-09-26): the header quick-tools cluster (asset mockup + theme toggle), sitting on
   --header-bg between the clock and the account menu — same treatment as .ai-chip/.clock (the
   header-well tokens), not the panel-scoped .icon-btn. See DESIGN.md's do/don't: every colour
   below is a token, none is a new literal. Follow-up (09-26 09:55): the market toggle (formerly a
   left-of-header nav) moved in as a third button, #qt-market-btn — see
   docs/superpowers/specs/2026-09-26-desk-market-in-quick-tools.md. */
.quick-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-left: auto;
}
/* Far right (spec): the cluster takes the auto margin and hugs the account menu, which then drops its own. */
.quick-tools + .account {
  margin-left: 0;
}
.qt-btn {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  padding: 0;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--header-well-bg);
  border: 1px solid var(--header-well-line);
  border-radius: var(--r-control);
  color: var(--header-well-text);
  transition:
    background-color var(--dur-base) ease,
    color var(--dur-base) ease;
}
.qt-btn svg {
  width: 17px;
  height: 17px;
}
.qt-btn:hover {
  background: var(--header-well-hover);
  color: var(--header-text);
}
.qt-btn:active {
  background: var(--header-well-line);
}
/* Market button (i18n slice 1, owner 2026-10-13): "หุ้นไทย ฿ ▾" — market name, its unit and a caret, so it reads
   as a picker and never as a language. Below 600px only "฿ ▾" stays (the name is in the aria-label). */
.qt-market-btn {
  width: auto;
  min-width: 32px;
  gap: var(--sp-1);
  padding: 0 var(--sp-2) 0 var(--sp-3);
  font-size: var(--fs-md);
  font-weight: 600;
  white-space: nowrap;
}
.qt-market-unit {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--header-text);
}
.qt-btn .qt-market-caret {
  width: 14px;
  height: 14px;
  opacity: 0.8;
}
/* Theme button: sun/moon swap keyed off aria-pressed (true = dark currently on, so the sun icon —
   the action a click performs — shows); same pattern as .lock-toggle's ico-locked/ico-unlocked. */
.qt-btn .qt-icon-sun {
  display: none;
}
.qt-btn[aria-pressed='true'] .qt-icon-sun {
  display: block;
}
.qt-btn[aria-pressed='true'] .qt-icon-moon {
  display: none;
}
@media (pointer: coarse) {
  .qt-btn {
    width: 40px;
    height: 40px;
  }
  .qt-market-btn {
    width: auto;
    min-width: 40px;
  }
}
/* Phones: the header is already logo + quick-tools + avatar; the theme item stays reachable in the
   account sheet, so only the market and asset buttons are kept here at first, to avoid horizontal
   overflow at 360-420px. */
@media (max-width: 599px) {
  #qt-theme-btn {
    display: none;
  }
  .qt-market-name {
    display: none;
  }
  .qt-market-btn {
    padding: 0 var(--sp-2);
  }
}
/* Below 380px even the asset (mockup) button overflows the header, so it steps aside — but the
   market switch (owner: "reachable at every width") never hides, matching the exact single-button
   footprint the header already fit at this width before this button existed. */
/* #endregion */

/* #region zone:desk.style.asset-dialog — รายการเลือกตลาดและราคาอ้างอิงทองกับน้ำมัน */
/* Shared centred dialog tokens; market selection and reference prices have distinct rows. */
.asset-dialog {
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
}
.asset-dialog-head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
}
.asset-dialog-head .desk-dialog-title {
  margin-bottom: var(--sp-1);
}
.asset-dialog-head .icon-btn {
  flex-shrink: 0;
}
.asset-dialog-subhead {
  margin: 0 0 var(--sp-2);
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.asset-dialog-section {
  margin-bottom: var(--sp-4);
}
.asset-dialog-divider {
  height: 1px;
  margin: 0 0 var(--sp-4);
  border: 0;
  background: var(--line);
}
/* #market-th/#market-us: relocated from the header (same ids/role/click wiring), stretched full width. */
.market-seg {
  display: flex;
  flex-direction: column;
  height: auto;
  width: 100%;
  gap: var(--sp-2);
  padding: 0;
  border: 0;
  background: transparent;
}
.market-seg .seg-btn {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex: none;
  width: 100%;
  min-height: 44px;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-control);
  text-align: left;
}
.market-choice-icon {
  width: 24px;
  text-align: center;
}
.market-choice-unit {
  margin-left: auto;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
}
.market-choice-check {
  width: 16px;
  visibility: hidden;
  color: var(--accent);
}
.market-seg [aria-selected='true'] .market-choice-check {
  visibility: visible;
}
.asset-dialog-note {
  margin: 0 0 var(--sp-4);
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: 1.5;
}
.asset-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--r-inner);
  overflow: hidden;
}
.asset-list > .desk-dialog-btn {
  margin: var(--sp-3);
}
.asset-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--sp-1) var(--sp-3);
  padding: var(--sp-3);
}
.asset-row + .asset-row {
  border-top: 1px solid var(--line);
}
.asset-row-name {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-width: 0;
}
.asset-row-label {
  font-weight: 700;
  font-size: var(--fs-md);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.asset-row-ticker {
  grid-column: 1;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--muted);
}
.asset-row-price {
  grid-column: 2;
  grid-row: 1 / span 2;
  text-align: right;
}
.asset-row-price-value {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--fs-lg);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.asset-row-price-chg {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-variant-numeric: tabular-nums;
}
.asset-row-price-chg.is-up {
  color: var(--up-text);
}
.asset-row-price-chg.is-down {
  color: var(--down-text);
}

@media (prefers-reduced-motion: reduce) {
  .asset-dialog[open] {
    animation: none;
  }
}
/* #endregion */

/* #region zone:desk.style.lang-switch — ปุ่มสลับภาษา (ไอคอนเดียว) บนหัวเว็บและหน้า login */
/* Owner 2026-10-13 (v2): one square icon button that toggles ไทย ↔ EN. In the header it is a .qt-btn, so the header
   family (desk-header.css) gives it the theme button's size, radius, border and states. The login copy is the same
   square on the form's own surface colours, 44px (a touch target everywhere). */
.desk-lang-toggle {
  cursor: pointer;
}
.desk-lang-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.login-lang-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--tap-min);
  height: var(--tap-min);
  padding: 0;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  background: transparent;
  color: var(--muted);
  transition:
    background-color var(--dur-base) ease,
    color var(--dur-base) ease;
}
.login-lang-toggle:hover {
  background: var(--panel2);
  color: var(--text);
}
.login-lang-toggle svg {
  width: 18px;
  height: 18px;
}
/* 900–1199px: the search box needs the room, so the market button keeps "฿ ▾" (as the stage button goes icon-only). */
@media (min-width: 900px) and (max-width: 1199px) {
  .qt-market-name {
    display: none;
  }
}
/* Login: the same switch, right-aligned above the heading, on the form's own surface colours. */
.login-shell .login-shell-form > .login-lang-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: calc(-1 * var(--sp-2));
}
/* English: the Thai-first pages show the English stage term beside the Thai name; in English that is the name. */
:root[lang='en'] .stage-view-en,
:root[lang='en'] .stage-summary-name small,
:root[lang='en'] .stage-column-name small {
  display: none;
}
/* #endregion */
