/* Fråga myceon — panelen bredvid det man tittar på (js/myceon-ask.js, admin docs/NU.md leverans 12).
   En egen kolumn i skalets rutnät (q), till höger om Öppna bredvid (r) när den är öppen. Under 40rem ett ark över allt. */
#myceon-shell { --ms-ask-w: clamp(320px, 28vw, 420px); }
/* En egen kolumn när det finns plats: panelen ensam från 64rem, bredvid Öppna bredvid från 90rem. Annars ligger den över
   platsen till höger (ett ark), så att platsen aldrig trycks ihop. */
@media (min-width: 64.0625rem) {
  #myceon-shell[data-ask]:not([data-side])[data-layout="sidebar-full"] { --areas: "l h h" "l m q" "l f f"; --cols: var(--col-l, var(--rail-l)) minmax(0, 1fr) var(--ms-ask-w); }
  #myceon-shell[data-ask]:not([data-side])[data-layout="sidebar"] { --areas: "h h h" "l m q" "f f f"; --cols: var(--col-l, var(--rail-l)) minmax(0, 1fr) var(--ms-ask-w); }
  #myceon-shell[data-ask]:not([data-side])[data-rail="icons"] { --cols: var(--rail-icons-col, 60px) minmax(0, 1fr) var(--ms-ask-w); }
  #myceon-shell[data-ask]:not([data-side]) > .mq { grid-area: q; }
}
@media (min-width: 90.0625rem) {
  #myceon-shell[data-ask][data-side][data-layout="sidebar-full"] { --areas: "l h h h" "l m r q" "l f f f"; --cols: var(--col-l, var(--rail-l)) minmax(0, 1fr) var(--ms-side-w) var(--ms-ask-w); }
  #myceon-shell[data-ask][data-side][data-layout="sidebar"] { --areas: "h h h h" "l m r q" "f f f f"; --cols: var(--col-l, var(--rail-l)) minmax(0, 1fr) var(--ms-side-w) var(--ms-ask-w); }
  #myceon-shell[data-ask][data-side][data-rail="icons"] { --cols: var(--rail-icons-col, 60px) minmax(0, 1fr) var(--ms-side-w) var(--ms-ask-w); }
  #myceon-shell[data-ask][data-side] > .mq { grid-area: q; }
}

.mq { position: fixed; top: 0; right: 0; bottom: 0; z-index: 100050; width: min(420px, 100vw); display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden;
  background: var(--bg-surface); color: var(--text-primary); border-inline-start: 1px solid var(--border-default); box-shadow: -12px 0 32px rgba(31, 36, 32, .12); }
/* I rutnätet (kolumnen q ovan): i flödet, utan skugga. */
@media (min-width: 64.0625rem) { #myceon-shell[data-ask]:not([data-side]) > .mq { position: static; width: auto; z-index: auto; box-shadow: -8px 0 24px rgba(31, 36, 32, .04); } }
@media (min-width: 90.0625rem) { #myceon-shell[data-ask][data-side] > .mq { position: static; width: auto; z-index: auto; box-shadow: -8px 0 24px rgba(31, 36, 32, .04); } }
.mq[hidden] { display: none; }
@media (max-width: 40rem) {
  .mq { inset: 0; width: auto; z-index: 100100; border: 0; box-shadow: none; padding-bottom: env(safe-area-inset-bottom); }
}
.mq-sr { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.mq-head { flex: none; display: flex; align-items: center; gap: 10px; padding: 14px 10px 8px 18px; }
.mq-mark { display: inline-flex; color: var(--lugn-lingon, var(--accent)); }
.mq-mark svg { width: 20px; height: 20px; }
.mq-h { margin: 0; font-size: 16px; font-weight: 600; flex: 1 1 auto; min-width: 0; }
.mq-h:focus { outline: none; }
.mq-ibtn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 40px; height: 40px; padding: 0 8px; border: 0; border-radius: 10px;
  background: transparent; color: var(--text-muted); font: inherit; font-size: 13px; cursor: pointer; }
.mq-ibtn:hover { background: var(--bg-hover); color: var(--text-primary); }
.mq-ibtn[hidden] { display: none; }
.mq-ibtn:focus-visible, .mq-send:focus-visible, .mq-chip-x:focus-visible, .mq-linkbtn:focus-visible, .mq-choice:focus-visible, .mq-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.mq-ctx { flex: none; padding: 0 18px 10px; }
.mq-ctx:empty { display: none; }
.mq-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 4px 4px 4px 12px; border-radius: 999px; background: var(--bg-inset, var(--bg-hover)); font-size: 13px; color: var(--text-secondary); }
.mq-chip-k { color: var(--text-muted); flex: none; }
.mq-chip-v { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mq-chip:not(:has(.mq-chip-x)) { padding-right: 12px; }
.mq-chip-x { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border: 0; border-radius: 50%; background: transparent; color: var(--text-muted); cursor: pointer; }
.mq-chip-x:hover { background: var(--bg-active, var(--bg-hover)); color: var(--text-primary); }
.mq-chip-x svg { width: 14px; height: 14px; }
.mq-dim { margin: 0; font-size: 13px; color: var(--text-muted); }

.mq-log { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 6px 18px 12px; display: flex; flex-direction: column; gap: 16px; scrollbar-width: thin; }
.mq-q { align-self: flex-end; max-width: 88%; padding: 9px 13px; border-radius: 16px 16px 4px 16px; background: var(--bg-inset, var(--bg-hover)); font-size: 14.5px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.mq-a { font-size: 14.5px; line-height: 1.6; color: var(--text-primary); overflow-wrap: anywhere; }
.mq-a.is-thinking { color: var(--text-muted); }
.mq-a > :first-child { margin-top: 0; } .mq-a > :last-child { margin-bottom: 0; }
.mq-a p { margin: 0 0 .6em; } .mq-a ul, .mq-a ol { margin: 0 0 .6em; padding-left: 1.3em; }
.mq-a pre { overflow-x: auto; max-width: 100%; }
.mq-a table { display: block; overflow-x: auto; max-width: 100%; }
.mq-err { margin: .4em 0 0; color: var(--error); font-size: 13.5px; }
.mq-blk { margin: 6px 0; }
.mq-link { display: inline-flex; align-items: center; min-height: 36px; padding: 0 12px; border: 1px solid var(--border-default); border-radius: 10px; background: transparent; color: var(--text-primary); font: inherit; font-size: 13.5px; cursor: pointer; }
.mq-link:hover { background: var(--bg-hover); }
.mq-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.mq-choice { min-height: 36px; padding: 0 12px; border: 1px solid var(--border-default); border-radius: 999px; background: transparent; color: var(--text-secondary); font: inherit; font-size: 13.5px; cursor: pointer; }
.mq-choice:hover { background: var(--bg-hover); color: var(--text-primary); }

.mq-listen { flex: none; display: flex; align-items: center; gap: 12px; padding: 6px 18px; font-size: 13.5px; color: var(--text-secondary); }
.mq-listen[hidden] { display: none; }
.mq-bars { display: inline-flex; align-items: center; gap: 4px; height: 28px; }
.mq-bars i { display: block; width: 4px; height: 26px; border-radius: 2px; background: var(--lugn-lingon, var(--accent)); transform: scaleY(.3); transform-origin: center; }
@media (prefers-reduced-motion: no-preference) { .mq-bars i { transition: transform .12s ease; } }

.mq-form { flex: none; display: flex; align-items: flex-end; gap: 6px; margin: 4px 14px 8px; padding: 6px 6px 6px 14px; border: 1px solid var(--border-default); border-radius: 14px; background: var(--bg-base); }
.mq-form:focus-within { border-color: var(--border-strong); }
.mq-form textarea { flex: 1 1 auto; min-width: 0; min-height: 28px; max-height: 160px; margin: 0 0 6px; padding: 0; border: 0; outline: none; resize: none; background: transparent; color: var(--text-primary); font: inherit; font-size: 15px; line-height: 1.45; }
.mq-mic.is-on { background: color-mix(in srgb, var(--lugn-lingon, var(--accent)) 12%, transparent); color: var(--lugn-lingon, var(--accent)); }
.mq-send { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 0; border-radius: 10px; background: var(--accent); color: #fff; cursor: pointer; }
.mq-send:disabled { opacity: .35; cursor: default; }
.mq-foot { flex: none; margin: 0; padding: 2px 18px 14px; font-size: 13px; color: var(--text-muted); }
.mq-foot[hidden] { display: none; }
.mq-linkbtn { border: 0; padding: 0; background: none; color: var(--accent); font: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }

/* Knappen: längst ner i kolumnen (ovanför kontot) och i den tunna topbaren. */
#myceon-shell .ms-askbtn .ui-icon, #myceon-shell .ms-askbtn > svg { color: var(--lugn-lingon, var(--accent)); width: 18px; height: 18px; flex: none; }
#myceon-shell .ms-col .ms-askbtn { margin-bottom: 4px; }
#myceon-shell:not([data-rail="icons"]) .ms-col .ms-askbtn:is(:hover, :focus-visible) .ms-kbd { display: inline-block; margin-inline-start: auto; }
#myceon-shell .ms-col .ms-askbtn.is-on { background: var(--accent-subtle); color: var(--text-primary); }
#myceon-shell .ms-bar .ms-askbtn { display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 40rem) { #myceon-shell .ms-bar .ms-askbtn > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); } }
/* Svaret uppläst (leverans 13): raden med Tysta överst i svaret. */
.mq-reading { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; font-size: 13px; color: var(--text-muted); }
.mq-reading span[role] { flex: 1; }
.mq-hush { border: 1px solid var(--border-default); height: 32px; }

/* Webben (admin docs/WEBB.md): källorna under svaret — en tyst rad länkar. */
.mq-srcs { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-top: 10px; font-size: 12.5px; }
.mq-srcs-h { color: var(--text-muted); }
.mq-src { color: var(--text-secondary); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); overflow-wrap: anywhere; }
.mq-src:hover { color: var(--text-primary); text-decoration-color: currentColor; }
.mq-src-site { color: var(--text-muted); }
