/* 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 color-mix(in srgb, var(--t-shadow, rgb(31 36 32)) calc(12% * var(--t-depth, 1)), transparent); }
/* 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 color-mix(in srgb, var(--t-shadow, rgb(31 36 32)) calc(4% * var(--t-depth, 1)), transparent); } }
@media (min-width: 90.0625rem) { #myceon-shell[data-ask][data-side] > .mq { position: static; width: auto; z-index: auto; box-shadow: -8px 0 24px color-mix(in srgb, var(--t-shadow, rgb(31 36 32)) calc(4% * var(--t-depth, 1)), transparent); } }
.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: calc(10px * var(--t-space, 1)); padding: calc(14px * var(--t-space, 1)) calc(10px * var(--t-space, 1)) calc(8px * var(--t-space, 1)) calc(18px * var(--t-space, 1)); }
.mq-mark { display: inline-flex; color: var(--lugn-lingon, var(--accent)); }
.mq-mark svg { width: 20px; height: 20px; }
.mq-h { margin: 0; font-size: calc(16px * var(--t-text-scale, 1)); 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: calc(6px * var(--t-space, 1)); min-width: 40px; height: 40px; padding: 0 calc(8px * var(--t-space, 1)); border: 0; border-radius: calc(10px * var(--t-radius, 1));
  background: transparent; color: var(--text-muted); font: inherit; font-size: calc(13px * var(--t-text-scale, 1)); 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 calc(18px * var(--t-space, 1)) calc(10px * var(--t-space, 1)); }
.mq-ctx:empty { display: none; }
.mq-chip { display: inline-flex; align-items: center; gap: calc(6px * var(--t-space, 1)); max-width: 100%; padding: calc(4px * var(--t-space, 1)) calc(4px * var(--t-space, 1)) calc(4px * var(--t-space, 1)) calc(12px * var(--t-space, 1)); border-radius: calc(999px * var(--t-radius, 1)); background: var(--bg-inset, var(--bg-hover)); font-size: calc(13px * var(--t-text-scale, 1)); 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: calc(12px * var(--t-space, 1)); }
.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: calc(13px * var(--t-text-scale, 1)); color: var(--text-muted); }

.mq-log { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: calc(6px * var(--t-space, 1)) calc(18px * var(--t-space, 1)) calc(12px * var(--t-space, 1)); display: flex; flex-direction: column; gap: calc(16px * var(--t-space, 1)); scrollbar-width: thin; }
/* Ta in i samtalet (admin docs/SAMTAL-MITTPUNKT.md S4): saken som ett kort vid frågan. */
.mq-ref { align-self: flex-end; display: flex; flex-wrap: wrap; gap: calc(2px * var(--t-space, 1)) calc(8px * var(--t-space, 1)); max-width: 88%; padding: calc(6px * var(--t-space, 1)) calc(10px * var(--t-space, 1)); border: 1px solid var(--border-default); border-radius: calc(10px * var(--t-radius, 1)); font-size: calc(13px * var(--t-text-scale, 1)); overflow-wrap: anywhere; }
.mq-ref-k { color: var(--text-muted); }
.mq-ref-t { font-weight: 600; min-inline-size: 0; }
.mq-q { align-self: flex-end; max-width: 88%; padding: calc(9px * var(--t-space, 1)) calc(13px * var(--t-space, 1)); border-radius: calc(16px * var(--t-radius, 1)) calc(16px * var(--t-radius, 1)) calc(4px * var(--t-radius, 1)) calc(16px * var(--t-radius, 1)); background: var(--bg-inset, var(--bg-hover)); font-size: calc(14.5px * var(--t-text-scale, 1)); line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.mq-a { font-size: calc(14.5px * var(--t-text-scale, 1)); 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: calc(13.5px * var(--t-text-scale, 1)); }
.mq-blk { margin: 6px 0; }
.mq-link { display: inline-flex; align-items: center; min-height: 36px; padding: 0 calc(12px * var(--t-space, 1)); border: 1px solid var(--border-default); border-radius: calc(10px * var(--t-radius, 1)); background: transparent; color: var(--text-primary); font: inherit; font-size: calc(13.5px * var(--t-text-scale, 1)); cursor: pointer; }
.mq-link:hover { background: var(--bg-hover); }
.mq-choices { display: flex; flex-wrap: wrap; gap: calc(8px * var(--t-space, 1)); }
.mq-choice { min-height: 36px; padding: 0 calc(12px * var(--t-space, 1)); border: 1px solid var(--border-default); border-radius: calc(999px * var(--t-radius, 1)); background: transparent; color: var(--text-secondary); font: inherit; font-size: calc(13.5px * var(--t-text-scale, 1)); cursor: pointer; }
.mq-choice:hover { background: var(--bg-hover); color: var(--text-primary); }

.mq-listen { flex: none; display: flex; align-items: center; gap: calc(12px * var(--t-space, 1)); padding: calc(6px * var(--t-space, 1)) calc(18px * var(--t-space, 1)); font-size: calc(13.5px * var(--t-text-scale, 1)); color: var(--text-secondary); }
.mq-listen[hidden] { display: none; }
.mq-bars { display: inline-flex; align-items: center; gap: calc(4px * var(--t-space, 1)); height: 28px; }
.mq-bars i { display: block; width: 4px; height: 26px; border-radius: calc(2px * var(--t-radius, 1)); 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: calc(6px * var(--t-space, 1)); margin: 4px 14px 8px; padding: calc(6px * var(--t-space, 1)) calc(6px * var(--t-space, 1)) calc(6px * var(--t-space, 1)) calc(14px * var(--t-space, 1)); border: 1px solid var(--border-default); border-radius: calc(14px * var(--t-radius, 1)); 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: calc(15px * var(--t-text-scale, 1)); 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: calc(10px * var(--t-radius, 1)); background: var(--accent); color: var(--t-on-strong, #fff); cursor: pointer; }
.mq-send:disabled { opacity: .35; cursor: default; }
.mq-foot { flex: none; margin: 0; padding: calc(2px * var(--t-space, 1)) calc(18px * var(--t-space, 1)) calc(14px * var(--t-space, 1)); font-size: calc(13px * var(--t-text-scale, 1)); 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: calc(6px * var(--t-space, 1)); }
@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: calc(10px * var(--t-space, 1)); margin: 0 0 8px; font-size: calc(13px * var(--t-text-scale, 1)); 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: calc(4px * var(--t-space, 1)) calc(12px * var(--t-space, 1)); margin-top: 10px; font-size: calc(12.5px * var(--t-text-scale, 1)); }
.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); }

/* Det pågående samtalet (admin docs/SAMTAL-MITTPUNKT.md): de senaste turerna, lugnt — samma samtal som i Samtal. */
.mq-prev { display: flex; flex-direction: column; gap: calc(8px * var(--t-space, 1)); padding-bottom: calc(10px * var(--t-space, 1)); border-bottom: 1px solid var(--border-subtle, var(--border)); opacity: .78; }
.mq-prev-h { margin: 0; font-size: calc(12.5px * var(--t-text-scale, 1)); color: var(--text-muted); }
.mq-prev .mq-a { font-size: calc(13.5px * var(--t-text-scale, 1)); }
