/* Compounder on a desktop (>900 px). Every rule lives inside the media query, so the
   phone layout cannot be touched by this file. The elements prefixed desk- are built by
   js/desktop-shell.js; the shared sheets (js/compounder-sheets.js) open here as a
   popover beside what opened them, or as a centred dialog. */

@media (min-width: 901px) {
  .desk-i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }

  /* ---- CompAI in the header ------------------------------------------------------- */
  .desk-ask {
    display: inline-flex; align-items: center; gap: 8px; width: clamp(200px, 20vw, 300px); height: 38px; padding: 0 6px 0 11px;
    border: 1px solid var(--border); border-radius: 10px; background: none; color: var(--muted);
    font: inherit; font-size: 0.84rem; text-align: left; cursor: pointer;
    transition: border-color 140ms ease, color 140ms ease;
  }
  .desk-ask[hidden] { display: none; }
  .desk-ask:hover, .desk-ask:focus-visible { border-color: var(--accent-ring); color: var(--text-2); outline: none; }
  .desk-ask[aria-expanded="true"] { border-color: var(--accent); color: var(--text); }
  .desk-ask-spark { display: grid; place-items: center; color: var(--accent); }
  .desk-ask-ph { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .desk-ask kbd {
    display: grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px;
    border: 1px solid var(--border); border-radius: 5px; font: inherit; font-size: 0.72rem; color: var(--muted-2);
  }
  .desk-ask.locked .desk-ask-spark { color: var(--muted-2); }
  /* The menu keeps its width (it overflowed onto the field at 1280 px with Admin in it);
     the field gives way down to a short placeholder. */
  .global-header .desktop-navigation { flex-shrink: 0; }
  .global-header-actions { min-width: 0; }
  .desk-ask { flex: 0 1 auto; min-width: 150px; }

  /* The chat panel sits under the header (and the notifications panel that drops from
     it), Quick Search, dialogs and the sheets; above the page and a row's ⋯. */
  .cie-chat { z-index: 55; }
  /* Quick Search closes with Esc on a desktop; Cancel is the phone's. */
  .m-search-cancel { display: none; }
}

/* A narrower window: the header needs the room for its menu, so the field folds to its
   spark and shortcut, and the profile button to its initial (the popover names you). */
@media (min-width: 901px) and (max-width: 1279px) {
  .desk-ask { width: auto; min-width: 0; }
  .desk-ask .desk-ask-ph { display: none; }
  .global-header .topbar-user-name { display: none; }
}

@media (min-width: 901px) {
  /* ---- the folded quote on a symbol page --------------------------------------------- */
  .desk-quote {
    display: none; align-items: baseline; gap: 10px; margin-left: 18px; padding-left: 18px;
    border-left: 1px solid var(--border); font-variant-numeric: tabular-nums; white-space: nowrap;
  }
  .global-header.desk-folded .desk-quote { display: inline-flex; animation: desk-in 160ms ease; }
  .desk-quote b { font-size: 0.9rem; font-weight: 750; color: var(--text); }
  .desk-quote span { font-size: 0.9rem; color: var(--text); }
  .desk-quote em { font-style: normal; font-size: 0.82rem; font-weight: 650; }
  .desk-quote .pos { color: var(--positive); }
  .desk-quote .neg { color: var(--negative); }
  @keyframes desk-in { from { opacity: 0; transform: translateY(-4px); } }

  /* ---- a row's ⋯ -------------------------------------------------------------------- */
  .desk-more {
    position: fixed; z-index: 50; display: grid; place-items: center; width: 28px; height: 28px; padding: 0;
    border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text-2); cursor: pointer;
  }
  .desk-more[hidden] { display: none; }
  .desk-more:hover, .desk-more:focus-visible { color: var(--accent); border-color: var(--accent-ring); outline: none; }
  .desk-more .desk-i { fill: currentColor; stroke: none; }

  /* ---- the shared sheets: popovers and one dialog ---------------------------------- */
  .m-scrim { position: fixed; inset: 0; z-index: 1350; background: transparent; opacity: 0; pointer-events: none; transition: opacity 140ms ease; }
  .m-scrim.on { opacity: 1; pointer-events: auto; }
  .m-scrim.dim { background: rgba(4, 7, 14, .5); }
  .m-sheet {
    position: fixed; z-index: 1360; width: 360px; max-height: min(560px, calc(100vh - 24px));
    display: flex; flex-direction: column; outline: none;
    border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-lg);
    opacity: 0; visibility: hidden; transform: translateY(-4px);
    transition: opacity 140ms ease, transform 140ms ease, visibility 0s linear 140ms;
  }
  .m-sheet.on { opacity: 1; visibility: visible; transform: none; transition: opacity 140ms ease, transform 140ms ease; }
  .m-sheet.is-dialog { left: 50%; top: 50%; width: 420px; transform: translate(-50%, -48%); }
  .m-sheet.is-dialog.on { transform: translate(-50%, -50%); }
  #m-actions-sheet { width: 300px; }
  .m-grip { display: none; }
  .m-sheet-body { overflow-y: auto; overscroll-behavior: contain; padding: 12px 16px; }

  /* The content, at desktop size (css/sheets.css has the phone's). */
  .m-i { width: 18px; height: 18px; }
  .m-label { margin: 10px 2px 6px; }
  .m-row { min-height: 44px; padding: 8px 2px; }
  .m-row:hover, .m-row:focus-visible { color: var(--accent); outline: none; }
  .m-row.danger:hover { color: var(--negative); }
  .m-row-static:hover { color: var(--text); }
  .m-row b { font-size: 0.88rem; }
  .m-row small { font-size: 0.76rem; margin-top: 1px; }
  .m-row .m-row-go { width: 15px; height: 15px; }
  .m-count { min-width: 20px; height: 20px; border-radius: 10px; font-size: 0.72rem; }
  .m-seg button { height: 26px; padding: 0 10px; font-size: 0.78rem; }
  .m-me { padding: 4px 2px; }
  .m-me-ini { width: 40px; height: 40px; flex-basis: 40px; font-size: 1rem; }
  .m-me b { font-size: 0.95rem; }
  .m-me small { font-size: 0.78rem; max-width: 250px; }
  .m-plan { margin: 10px 2px 6px; font-size: 0.82rem; }
  .m-meter { height: 5px; margin-top: 7px; }
  .m-offer { margin: 8px 0 4px; padding: 12px 0; }
  .m-offer b { font-size: 0.9rem; }
  .m-offer p { font-size: 0.8rem; margin-bottom: 10px; }
  .m-btn { gap: 8px; height: 38px; border-radius: 10px; font-size: 0.86rem; }
  .m-btn:hover:not(:disabled) { border-color: var(--accent-ring); }
  .m-btn.primary:hover:not(:disabled) { filter: brightness(1.06); }
  .m-unlock { padding: 8px 8px 4px; }
  .m-unlock-ic { width: 44px; height: 44px; }
  .m-unlock > b { font-size: 1.1rem; }
  .m-unlock ul { font-size: 0.86rem; }
  .m-unlock li { padding: 7px 0 7px 22px; }
  .m-unlock li::before { top: 14px; }
  .m-unlock-act small { font-size: 0.76rem; }
  .m-note { font-size: 0.84rem; }
  .m-foot { font-size: 0.74rem; }
  .m-info { padding: 2px; }
  .m-info b { margin: 2px 0 6px; font-size: 0.95rem; }
  .m-info p { font-size: 0.84rem; }
  .m-actions-head { padding: 2px 2px 8px; }
  .m-actions-head b { font-size: 0.92rem; }
  .m-actions-head small { font-size: 0.76rem; }

  /* ---- a locked symbol: one quiet line in the summary --------------------------------- */
  body.access-free #symbol-detail-page:not(.symbol-unlocked) .symbol-aside-lock { display: flex; align-items: center; gap: 12px; padding-top: 10px; }
  .symbol-aside-lock .symbol-info-title { margin: 0; font-size: 0.8rem; white-space: nowrap; }
  .symbol-aside-lock-copy { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .symbol-aside-lock-cta { width: auto; flex: 0 0 auto; margin: 0; padding: 7px 16px; font-size: 0.8rem; box-shadow: none; }

  /* ---- a locked tab: the blurred preview behind what unlocking adds -------------------- */
  #symbol-detail-page:not(.symbol-unlocked) .premium-lock-overlay:has(.m-lock-prev) { position: relative; isolation: isolate; align-items: flex-start; padding: 24px 0 48px; }
  .premium-lock-overlay .m-lock-prev { position: absolute; z-index: -1; top: 24px; left: 50%; width: min(900px, 100%); gap: 16px; transform: translateX(-50%); }
  .premium-lock-overlay .m-lock-prev i:nth-child(1) { width: 40%; }
  .premium-lock-overlay:has(.m-lock-prev) .premium-lock-card {
    margin-top: 56px; padding: 24px 28px; max-width: 420px; gap: 6px;
    border: 1px solid var(--border); border-radius: 16px;
    background: color-mix(in srgb, var(--surface) 94%, transparent); box-shadow: var(--shadow-md);
  }
  .premium-lock-overlay .m-lock-gains { width: 100%; font-size: 0.86rem; }

  /* ---- Quick Search: the CompAI row ------------------------------------------------- */
  .quick-search-result[data-quick-kind="ask"] .nav-icon { color: var(--accent); }
}
