/* The layouts of the Alani AI tab (public/js/ai/layouts.js): classic is app.css; focus, tabs, pager and feed are here. They share the same parts (head, quick actions,
   numbers, cards, chat, message bar); the tab carries data-layout and data-orient (v = tall / phone, h = wide / desktop) and, for layouts with views, data-view.
   A layout that is not classic has no handles, no minimised parts and no row of small buttons on each part: adding and editing are in the head's menu. */

.ai-nav, .ai-dots { display: none; }
.layout-v .ai-tab:not([data-layout="classic"]) .cd-grid { --fit-cols: 2; }
.ai-tab[data-layout="classic"] .lay-only { display: none; }
.ai-tab:not([data-layout="classic"]) .classic-only { display: none !important; }

/* ------------------------------------------------------------------ what every new layout shares */
.ai-tab:not([data-layout="classic"]) .ai-grip,
.ai-tab:not([data-layout="classic"]) .ai-split,
.ai-tab:not([data-layout="classic"]) .ai-chatgrip,
.ai-tab:not([data-layout="classic"]) .pane-controls,
.ai-tab:not([data-layout="classic"]) .ai-bar > .icon-btn { display: none !important; }
/* the head: the assistant, and one menu */
.ai-tab:not([data-layout="classic"]) .ai-tab-head { padding: 8px 12px; border-bottom: 0; background: none; }
.ai-tab .tools-btn, .ai-tab .music-btn { width: 40px; height: 40px; border-radius: 50%; background: var(--input); border: 1px solid var(--line); }
/* a phone, the music player hidden: its strip at the top (a pencil and a small arrow, 48 px of nothing) is gone on this tab; the button for it is in the head's row (chat.js drawHead) */
.layout-v.music-hidden[data-page="ai"] .music { display: none; }
.app.layout-v.music-hidden[data-page="ai"] { grid-template-rows: minmax(0, 1fr) auto; } /* (two children left: the page and the bar. Like .no-music in app.css: else the page takes the first, auto row and the bar lands in the tall one or in none) */
/* (no extra top room here: .app already keeps clear of the status bar; adding it again left a double gap in the phone app) */
/* a part's bar: only its name, quiet */
.ai-tab:not([data-layout="classic"]) .ai-bar { padding: 2px 6px 6px; border: 0; gap: 8px; }
.ai-tab:not([data-layout="classic"]) .ai-bar b { font-size: 0.74rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); }
.ai-tab:not([data-layout="classic"]) .ai-bar small { font-size: 0.74rem; }
.ai-tab:not([data-layout="classic"]) .ai-pane { border: 0; background: none; border-radius: 0; overflow: visible; }
.ai-tab:not([data-layout="classic"]) .ai-pane > .pane-body { min-height: 0; }
.ai-tab:not([data-layout="classic"]) .ai-pane:not([data-sized="1"]) .pane-body { flex: 1; }
.ai-tab:not([data-layout="classic"]) .cd-grid, .ai-tab:not([data-layout="classic"]) .st-grid { padding: 0; }
/* the tab bar of a layout that has views */
.ai-nav-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border: 0; border-radius: 999px; background: none; color: var(--muted); font-weight: 600; font-size: 0.9rem; }
.ai-nav-btn.on { color: #fff; }
.ai-nav-btn { transition: color 0.25s; }
.ai-nav-btn > * { position: relative; z-index: 2; } /* (the label and the count are above the highlight, the button's own background is under it) */
.ai-nav-label { display: inherit; flex-direction: inherit; align-items: inherit; justify-content: inherit; gap: inherit; }
/* the highlight under the open view's button: one element that slides to the next button (chat.js drawNav, placePill) */
.ai-nav { position: relative; }
.ai-nav-pill { position: absolute; z-index: 1; left: 0; top: 0; width: 0; height: 0; border-radius: 999px; background: var(--orange); pointer-events: none; }
.ai-nav.slide .ai-nav-pill { transition: left 0.28s cubic-bezier(0.22, 0.8, 0.26, 1), top 0.28s cubic-bezier(0.22, 0.8, 0.26, 1), width 0.28s, height 0.28s; } /* (without View Transitions) */
.layout-v .ai-tab[data-layout="tabs"] .ai-nav-pill { border-radius: 14px; }
.layout-h .ai-tab[data-layout="tabs"] .ai-nav-pill { border-radius: 16px; }
/* a layout with views: sideways moves are for switching them, up and down ones still scroll (the parts that scroll sideways say so) */
/* (a finger may pan both ways: a strip of numbers or actions that is wider than the screen must scroll sideways, and a part that cannot scroll sideways does nothing, so the swipe that switches the views still gets its touches: chat.js wireViewSwipe. pan-y alone on the tab stopped every strip inside it from scrolling sideways on a phone) */
.ai-tab[data-views="1"] { touch-action: pan-x pan-y pinch-zoom; }
.ai-tab[data-views="1"] :is(.st-grid, .st, .qa-row, .ai-actions, .qa-card, .lc-track, pre, table) { touch-action: pan-x pan-y pinch-zoom; }
/* switching views (chat.js animateView): the part that changes slides out and in, and the highlight of the tab bar moves from one button to the next */
html[data-vt-dir="1"] { --vt-from: 34%; }
html[data-vt-dir="-1"] { --vt-from: -34%; }
html[data-vt-dir] .ai-tab[data-layout="focus"] .ai-board,
html[data-vt-dir] .ai-tab[data-layout="tabs"][data-view="cards"] .ai-cards,
html[data-vt-dir] .ai-tab[data-layout="tabs"][data-view="numbers"] .ai-stats,
html[data-vt-dir] .ai-tab[data-layout="tabs"][data-view="actions"] .ai-actions,
html[data-vt-dir] .ai-tab[data-layout="tabs"][data-view="chat"] .ai-chatpane { view-transition-name: ai-view; }
html[data-vt-dir] .ai-nav-pill { view-transition-name: ai-pill; }
html[data-vt-dir] .ai-nav-btn > [style*="--vt"] { view-transition-name: var(--vt); } /* (named after the pill in the page, so they are drawn over it) */
html[data-vt-dir]::view-transition-group(root), html[data-vt-dir]::view-transition-group(ai-view), html[data-vt-dir]::view-transition-group(ai-pill) { animation-duration: 0.3s; animation-timing-function: cubic-bezier(0.22, 0.8, 0.26, 1); }
html[data-vt-dir]::view-transition-old(ai-view), html[data-vt-dir]::view-transition-new(ai-view) { mix-blend-mode: normal; animation-duration: 0.3s; animation-timing-function: cubic-bezier(0.22, 0.8, 0.26, 1); animation-fill-mode: both; }
html[data-vt-dir]::view-transition-old(ai-view) { animation-name: ai-view-out; }
html[data-vt-dir]::view-transition-new(ai-view) { animation-name: ai-view-in; }
html[data-vt-dir]::view-transition-old(ai-pill), html[data-vt-dir]::view-transition-new(ai-pill) { mix-blend-mode: normal; }
@keyframes ai-view-out { to { transform: translateX(calc(var(--vt-from) * -1)); opacity: 0; } }
@keyframes ai-view-in { from { transform: translateX(var(--vt-from)); opacity: 0; } }
.ai-nav-count { padding: 0 6px; border-radius: 999px; background: color-mix(in srgb, currentColor 22%, transparent); font-size: 0.72rem; font-weight: 700; }
.ai-dots { align-items: center; justify-content: center; gap: 8px; padding: 8px 0 2px; }
.ai-dot { width: 8px; height: 8px; padding: 0; border: 0; border-radius: 50%; background: var(--line); }
.ai-dot.on { width: 22px; border-radius: 4px; background: var(--orange); }
.ai-dot-arrow { display: none; width: 32px; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--input); color: var(--text); place-items: center; }
.ai-dot-arrow:disabled { opacity: 0.35; }

/* the numbers show in full wherever they have a page of their own (the classic phone layout cuts them at 300 px) */
.layout-v .ai-tab:not([data-layout="classic"]) .ai-stats .st-grid { max-height: none !important; }

/* slim strips: the quick actions as pills, the numbers as small tiles (focus, pager) */
.ai-tab[data-layout="focus"] .qa-row,
.ai-tab[data-layout="pager"] .qa-row,
.ai-tab[data-layout="feed"] .qa-row { padding: 2px 2px 6px; gap: 8px; }
.ai-tab[data-layout="focus"] .qa-card,
.ai-tab[data-layout="pager"] .qa-card,
.ai-tab[data-layout="feed"] .qa-card { min-width: 0; max-width: none; height: 40px; flex-direction: row; align-items: center; justify-content: flex-start; gap: 8px; padding: 0 16px; border-radius: 999px; background: var(--input); }
.ai-tab[data-layout="focus"] .qa-title,
.ai-tab[data-layout="pager"] .qa-title,
.ai-tab[data-layout="feed"] .qa-title { font-size: 0.86rem; }
.ai-tab[data-layout="focus"] .qa-status,
.ai-tab[data-layout="pager"] .qa-status,
.ai-tab[data-layout="feed"] .qa-status { font-size: 0.86rem; }
.ai-tab[data-layout="focus"] .qa-card.add,
.ai-tab[data-layout="pager"] .qa-card.add,
.ai-tab[data-layout="feed"] .qa-card.add { display: none; }
.ai-tab[data-layout="focus"] .qa-hint,
.ai-tab[data-layout="pager"] .qa-hint { display: none; }
.ai-tab[data-layout="focus"] .st-grid,
.ai-tab[data-layout="pager"] .st-grid { display: flex; overflow-x: auto; overflow-y: hidden; gap: 8px; padding-bottom: 4px; scrollbar-width: none; }
.ai-tab[data-layout="focus"] .st,
.ai-tab[data-layout="pager"] .st { flex: none; min-width: 132px; max-width: 200px; height: 94px; overflow: hidden; padding: 8px 12px; border: 0; border-radius: 14px; background: var(--input); }
.ai-tab[data-layout="focus"] .st-grid,
.ai-tab[data-layout="pager"] .st-grid { align-items: flex-start; }
.ai-tab[data-layout="focus"] .st-row span,
.ai-tab[data-layout="pager"] .st-row span,
.ai-tab[data-layout="focus"] .st-row b,
.ai-tab[data-layout="pager"] .st-row b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-tab[data-layout="focus"] .st-row,
.ai-tab[data-layout="pager"] .st-row { gap: 8px; font-size: 0.88em; }
.ai-tab:not([data-layout="classic"]) .st-head .icon-btn { width: 24px; height: 24px; flex: none; opacity: 0.6; }
.ai-tab[data-layout="focus"] .qa-row,
.ai-tab[data-layout="pager"] .qa-row,
.ai-tab[data-layout="feed"] .qa-row { scrollbar-width: none; }
.ai-tab[data-layout="focus"] .st-stamp,
.ai-tab[data-layout="pager"] .st-stamp,
.ai-tab[data-layout="focus"] .st .mini-chip,
.ai-tab[data-layout="pager"] .st .mini-chip { display: none; }
.ai-tab[data-layout="focus"] .st-head b,
.ai-tab[data-layout="pager"] .st-head b { font-size: 0.72rem; font-weight: 600; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-tab[data-layout="focus"] .st-head,
.ai-tab[data-layout="pager"] .st-head { margin-bottom: 2px; }
.ai-tab[data-layout="focus"] .st .st-row ~ .st-row ~ .st-row,
.ai-tab[data-layout="pager"] .st .st-row ~ .st-row ~ .st-row { display: none; }
.ai-tab[data-layout="focus"] .st-list,
.ai-tab[data-layout="pager"] .st-list { margin: 0; padding: 0; border: 0; }
.ai-tab[data-layout="focus"] .st-list .st-row ~ .st-row ~ .st-row,
.ai-tab[data-layout="pager"] .st-list .st-row ~ .st-row ~ .st-row { display: none; }
.ai-tab[data-layout="focus"] .st:has(.st-list) > .st-row,
.ai-tab[data-layout="pager"] .st:has(.st-list) > .st-row { display: none; }

/* ================================================================== FOCUS: the chat is the page */
/* (tall: the chat is the page, no bar and no toggle; wide: the chat has its bar, so it can be hidden and made big like in the other layouts) */
.layout-v .ai-tab[data-layout="focus"] .ai-chattoggle { display: none !important; }
.layout-v .ai-tab[data-layout="focus"] .ai-chatbar { display: none; }
.ai-tab[data-layout="focus"] .ai-nav { display: flex; }
.ai-tab[data-layout="focus"] .ai-nav[hidden] { display: none; }
/* tall */
.layout-v .ai-tab[data-layout="focus"] .ai-nav { gap: 4px; padding: 0 12px 8px; }
.layout-v .ai-tab[data-layout="focus"] .ai-nav-btn { flex: 1; background: var(--input); }
.layout-v .ai-tab[data-layout="focus"] .ai-board { display: flex; flex-direction: column; gap: 4px; padding: 0 12px; overflow: hidden; position: relative; }
.layout-v .ai-tab[data-layout="focus"] .ai-actions { order: 1; flex: none; height: auto; min-height: 0; }
.layout-v .ai-tab[data-layout="focus"] .ai-stats { order: 2; flex: none; height: auto; max-height: none; }
.layout-v .ai-tab[data-layout="focus"] .ai-bar { display: none; }
.layout-v .ai-tab[data-layout="focus"] .ai-chatpane { order: 3; position: static; inset: auto; display: flex; flex: 1; min-height: 0; height: auto; box-shadow: none; background: none; border: 0; }
.layout-v .ai-tab[data-layout="focus"] .ai-chatpane .ai-log { padding: 8px 2px; }
.layout-v .ai-tab[data-layout="focus"][data-view="chat"] .ai-cards { display: none; }
.layout-v .ai-tab[data-layout="focus"][data-view="cards"] .ai-cards { display: flex; flex-direction: column; position: absolute; inset: 0; z-index: 3; padding: 4px 12px 8px; background: var(--surface); overflow: hidden; }
.layout-v .ai-tab[data-layout="focus"][data-view="cards"] .ai-cards .ai-bar { display: flex; }
.layout-v .ai-tab[data-layout="focus"][data-view="cards"] .cd-grid { overflow: auto; flex: 1; min-height: 0; padding: 4px 0 12px; }
.layout-v .ai-tab[data-layout="focus"] .ai-cards .pane-body { flex: 1; min-height: 0; }
/* wide: the chat on the left, strips and cards on the right */
.layout-h .ai-tab[data-layout="focus"] .ai-board { display: grid; grid-template-columns: minmax(340px, 38%) minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr); gap: 12px 16px; padding: 4px 16px 16px; }
.layout-h .ai-tab[data-layout="focus"] .ai-left, .layout-h .ai-tab[data-layout="focus"] .ai-right { display: contents; }
.layout-h .ai-tab[data-layout="focus"] .ai-chatpane { grid-column: 1; grid-row: 1 / span 3; flex: none; height: auto; border: 1px solid var(--line); border-radius: 20px; background: var(--input); overflow: hidden; }
.layout-h .ai-tab[data-layout="focus"] .ai-actions { grid-column: 2; grid-row: 1; height: auto; }
.layout-h .ai-tab[data-layout="focus"] .ai-stats { grid-column: 2; grid-row: 2; height: auto; }
.layout-h .ai-tab[data-layout="focus"] .ai-cards { grid-column: 2; grid-row: 3; display: flex; flex-direction: column; min-height: 0; }
.layout-h .ai-tab[data-layout="focus"] .ai-bar { display: none; }
.layout-h .ai-tab[data-layout="focus"] .ai-cards .ai-bar { display: flex; }
.layout-h .ai-tab[data-layout="focus"] .cd-grid { overflow: auto; flex: 1; min-height: 0; }
.layout-h .ai-tab[data-layout="focus"] .ai-chatpane .ai-log { padding: 12px 14px; }
.layout-h .ai-tab[data-layout="focus"] .ai-chatbar { background: none; }
/* chat hidden: the strips and the cards take the whole width */
.layout-h .ai-tab[data-layout="focus"][data-chat-h="hidden"] .ai-board { grid-template-columns: minmax(0, 1fr); }
.layout-h .ai-tab[data-layout="focus"][data-chat-h="hidden"] :is(.ai-actions, .ai-stats, .ai-cards) { grid-column: 1; }

/* ================================================================== TABS: one thing at a time */
.ai-tab[data-layout="tabs"] .ai-chattoggle { display: none !important; }
.ai-tab[data-layout="tabs"] .ai-chatbar { display: none; }
.ai-tab[data-layout="tabs"] .ai-nav { display: flex; }
.ai-tab[data-layout="tabs"] .ai-nav[hidden] { display: none; }
.ai-tab[data-layout="tabs"] .ai-bar { display: none; }
/* tall: a tab bar on top, the chosen part below it */
.layout-v .ai-tab[data-layout="tabs"] .ai-nav { gap: 2px; padding: 0 12px 8px; }
.layout-v .ai-tab[data-layout="tabs"] .ai-nav-btn { flex: 1; flex-direction: column; gap: 2px; padding: 6px 4px; border-radius: 14px; font-size: 0.72rem; }
.layout-v .ai-tab[data-layout="tabs"] .ai-nav-btn .ai-nav-count { position: absolute; top: 2px; right: 8px; padding: 0 5px; font-size: 0.64rem; }
.layout-v .ai-tab[data-layout="tabs"] .ai-board { display: flex; flex-direction: column; padding: 0 12px 8px; overflow: hidden; position: relative; }
.layout-v .ai-tab[data-layout="tabs"] .ai-pane { display: none; flex: 1; min-height: 0; height: auto; order: 0; }
.layout-v .ai-tab[data-layout="tabs"][data-view="cards"] .ai-cards, .layout-v .ai-tab[data-layout="tabs"][data-view="numbers"] .ai-stats, .layout-v .ai-tab[data-layout="tabs"][data-view="actions"] .ai-actions, .layout-v .ai-tab[data-layout="tabs"][data-view="chat"] .ai-chatpane { display: flex; }
.layout-v .ai-tab[data-layout="tabs"] .ai-chatpane { position: static; box-shadow: none; inset: auto; height: auto; flex-direction: column; }
.layout-v .ai-tab[data-layout="tabs"] .cd-grid, .layout-v .ai-tab[data-layout="tabs"] .st-grid { overflow: auto; flex: 1; min-height: 0; padding: 2px 0 12px; }
.layout-v .ai-tab[data-layout="tabs"] .st-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.layout-v .ai-tab[data-layout="tabs"] .ai-actions .qa-row { flex-wrap: wrap; overflow: auto; align-content: flex-start; padding: 2px 0 12px; gap: 10px; }
.layout-v .ai-tab[data-layout="tabs"] .ai-actions .qa-card { flex: 1 1 calc(50% - 10px); max-width: none; min-height: 84px; border-radius: 18px; align-items: flex-start; padding: 12px 16px; background: var(--input); }
.layout-v .ai-tab[data-layout="tabs"] .ai-actions .qa-status { font-size: 1.3rem; }
.layout-v .ai-tab[data-layout="tabs"] .ai-actions .qa-card.add { flex: 1 1 calc(50% - 10px); }
/* wide: a rail of tabs on the left, the chosen part, the chat docked on the right */
.layout-h .ai-tab[data-layout="tabs"] .ai-stage { flex-direction: row; }
.layout-h .ai-tab[data-layout="tabs"] .ai-nav { flex-direction: column; gap: 6px; padding: 8px 8px 8px 12px; width: 92px; flex: none; }
.layout-h .ai-tab[data-layout="tabs"] .ai-nav-btn { flex-direction: column; gap: 4px; padding: 12px 4px; border-radius: 16px; font-size: 0.78rem; }
.layout-h .ai-tab[data-layout="tabs"] .ai-nav-btn .ai-nav-count { position: absolute; top: 4px; right: 8px; }
.layout-h .ai-tab[data-layout="tabs"] .ai-board { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 34%); gap: 16px; padding: 8px 16px 16px 4px; }
.layout-h .ai-tab[data-layout="tabs"] .ai-left, .layout-h .ai-tab[data-layout="tabs"] .ai-right { display: contents; }
.layout-h .ai-tab[data-layout="tabs"] .ai-pane { display: none; grid-column: 1; grid-row: 1; height: auto; min-height: 0; }
.layout-h .ai-tab[data-layout="tabs"][data-view="cards"] .ai-cards, .layout-h .ai-tab[data-layout="tabs"][data-view="numbers"] .ai-stats, .layout-h .ai-tab[data-layout="tabs"][data-view="actions"] .ai-actions { display: flex; }
.layout-h .ai-tab[data-layout="tabs"] .ai-chatpane { display: flex; grid-column: 2; grid-row: 1; flex: none; height: auto; border: 1px solid var(--line); border-radius: 20px; background: var(--input); overflow: hidden; }
.layout-h .ai-tab[data-layout="tabs"] .cd-grid, .layout-h .ai-tab[data-layout="tabs"] .st-grid { overflow: auto; flex: 1; min-height: 0; padding: 2px 0 12px; }
.layout-h .ai-tab[data-layout="tabs"] .st-grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.layout-h .ai-tab[data-layout="tabs"] .ai-actions .qa-row { flex-wrap: wrap; overflow: auto; align-content: flex-start; padding: 2px 0 12px; gap: 12px; }
.layout-h .ai-tab[data-layout="tabs"] .ai-actions .qa-card { flex: 0 1 220px; max-width: none; min-height: 96px; border-radius: 18px; padding: 14px 18px; background: var(--input); }
.layout-h .ai-tab[data-layout="tabs"] .ai-actions .qa-status { font-size: 1.4rem; }

/* ================================================================== PAGER: big swipeable cards */
.ai-tab[data-layout="pager"] .ai-dots { display: flex; }
.ai-tab[data-layout="pager"] .cd-grid { display: flex; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; gap: 10px; padding: 2px 0 !important; scrollbar-width: none; align-items: stretch; flex: 1; min-height: 0; }
.ai-tab[data-layout="pager"] .cd-grid::-webkit-scrollbar { display: none; }
.ai-tab[data-layout="pager"] .cd { grid-column: auto; grid-row: auto; flex: 0 0 min(84%, 560px); scroll-snap-align: center; height: calc(var(--h, 2) * 110px + 80px); max-height: 100%; align-self: center; border-radius: 22px; }
.ai-tab[data-layout="pager"] .ai-cards .ai-bar { display: none; }
.ai-tab[data-layout="pager"] .ai-cards { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ai-tab[data-layout="pager"] .ai-cards .pane-body { flex: 1; min-height: 0; justify-content: center; }
.ai-tab[data-layout="pager"] .ai-bar { display: none; }
/* tall */
.layout-v .ai-tab[data-layout="pager"] .ai-board { display: flex; flex-direction: column; gap: 10px; padding: 0 12px 58px; overflow: hidden; }
.layout-v .ai-tab[data-layout="pager"] .ai-actions { order: 1; flex: none; height: auto; min-height: 0; }
.layout-v .ai-tab[data-layout="pager"] .ai-stats { order: 2; flex: none; height: auto; max-height: none; }
.layout-v .ai-tab[data-layout="pager"] .ai-cards { order: 3; height: auto; min-height: 0; }
.layout-v .ai-tab[data-layout="pager"] .cd-grid { flex: 1; }
/* wide: the pager is the stage; numbers, actions and the chat are a column beside it */
.layout-h .ai-tab[data-layout="pager"] .ai-board { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 30%); grid-template-rows: auto auto minmax(0, 1fr); gap: 12px 18px; padding: 4px 16px 16px; }
.layout-h .ai-tab[data-layout="pager"] .ai-left, .layout-h .ai-tab[data-layout="pager"] .ai-right { display: contents; }
.layout-h .ai-tab[data-layout="pager"] .ai-cards { grid-column: 1; grid-row: 1 / span 3; }
.layout-h .ai-tab[data-layout="pager"] .ai-stats { grid-column: 2; grid-row: 1; height: auto; }
.layout-h .ai-tab[data-layout="pager"] .ai-actions { grid-column: 2; grid-row: 2; height: auto; }
.layout-h .ai-tab[data-layout="pager"] .ai-chatpane { grid-column: 2; grid-row: 3; flex: none; height: auto; border: 1px solid var(--line); border-radius: 20px; background: var(--input); overflow: hidden; }
.layout-h .ai-tab[data-layout="pager"] .ai-chatbar { background: none; }
.layout-h .ai-tab[data-layout="pager"] .ai-dot-arrow { display: grid; }
.layout-h .ai-tab[data-layout="pager"] .ai-dots { gap: 12px; padding: 12px 0 0; }
.layout-h .ai-tab[data-layout="pager"] .cd { flex-basis: min(46%, 560px); height: calc(var(--h, 2) * 140px + 100px); }
.layout-h .ai-tab[data-layout="pager"] .st-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: visible; }
.layout-h .ai-tab[data-layout="pager"] .st { max-width: none; }
.layout-h .ai-tab[data-layout="pager"] .qa-row { flex-wrap: wrap; overflow: visible; }

/* the chat as a sheet over the board (pager and feed on a phone): its own background, since parts of these layouts have none */
.layout-v .ai-tab[data-layout="pager"] .ai-chatpane, .layout-v .ai-tab[data-layout="feed"] .ai-chatpane { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; overflow: hidden; }

/* ================================================================== FEED: no frames, one calm page */
.ai-tab[data-layout="feed"] .ai-pane { margin-bottom: 4px; }
.ai-tab[data-layout="feed"] .st { border: 0; border-radius: 16px; background: var(--input); }
.ai-tab[data-layout="feed"] .cd { border: 0; border-radius: 20px; box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04), 0 8px 22px rgba(0, 0, 0, 0.18); }
.ai-tab[data-layout="feed"] .st-grid { gap: 10px; }
.ai-tab[data-layout="feed"] .cd-grid { gap: 12px; }
/* tall */
.layout-v .ai-tab[data-layout="feed"] .ai-board { display: flex; flex-direction: column; gap: 14px; padding: 4px 14px 88px; overflow-y: auto; }
.layout-v .ai-tab[data-layout="feed"] .ai-actions { order: 1; height: auto; min-height: 0; }
.layout-v .ai-tab[data-layout="feed"] .ai-stats { order: 2; height: auto; max-height: none; }
.layout-v .ai-tab[data-layout="feed"] .ai-cards { order: 3; height: auto; min-height: 0; }
.layout-v .ai-tab[data-layout="feed"] .ai-actions .ai-bar { display: none; }
.layout-v .ai-tab[data-layout="feed"] .st-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: none !important; overflow: visible; }
.ai-tab[data-layout="feed"] .st { padding: 10px 14px 12px; font-size: 0.92em; }
.ai-tab[data-layout="feed"] .st .st-row ~ .st-row ~ .st-row ~ .st-row ~ .st-row { display: none; }
.ai-tab[data-layout="feed"] .st-list .st-row ~ .st-row ~ .st-row ~ .st-row { display: none; }
.ai-tab[data-layout="feed"] .st-stamp { display: none; }
.ai-tab[data-layout="feed"] .st-row span, .ai-tab[data-layout="feed"] .st-row b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* wide: numbers and actions across the top, then cards beside the chat */
.layout-h .ai-tab[data-layout="feed"] .ai-board { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 30%); grid-template-rows: auto auto minmax(0, 1fr); gap: 14px 20px; padding: 4px 20px 16px; }
.layout-h .ai-tab[data-layout="feed"] .ai-left, .layout-h .ai-tab[data-layout="feed"] .ai-right { display: contents; }
.layout-h .ai-tab[data-layout="feed"] .ai-actions { grid-column: 1; grid-row: 1; height: auto; min-height: 0; }
.layout-h .ai-tab[data-layout="feed"] .ai-stats { grid-column: 1; grid-row: 2; height: auto; }
.layout-h .ai-tab[data-layout="feed"] .ai-actions .ai-bar { display: none; }
.layout-h .ai-tab[data-layout="feed"] .st-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); max-height: none; overflow: visible; }
.layout-h .ai-tab[data-layout="feed"] .ai-cards { grid-column: 1; grid-row: 3; display: flex; flex-direction: column; min-height: 0; }
.layout-h .ai-tab[data-layout="feed"] .cd-grid { overflow: auto; flex: 1; min-height: 0; padding-bottom: 12px; }
.layout-h .ai-tab[data-layout="feed"] .ai-chatpane { grid-column: 2; grid-row: 1 / span 3; flex: none; height: auto; border: 0; border-radius: 22px; background: var(--input); overflow: hidden; }
/* chat hidden: numbers, actions and cards take the whole width */
.layout-h .ai-tab[data-layout="feed"][data-chat-h="hidden"] .ai-board { grid-template-columns: minmax(0, 1fr); }

/* tall: peek (the last words), open (a part of the screen), big (all of it) */

/* wide: the board fills the page; the chat is a panel that slides in from the right */


/* ================================================================== the layout chooser (public/js/ai/layoutChooser.js): swipeable slides */
.lc-stage { position: relative; }
.lc-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; border-radius: 16px; outline: none; }
.lc-track::-webkit-scrollbar { display: none; }
.lc-slide { flex: 0 0 100%; scroll-snap-align: center; scroll-snap-stop: always; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 2px 44px 4px; text-align: center; min-width: 0; }
.lc-pic { display: grid; place-items: center; width: 100%; }
.lc-img { display: block; max-width: 100%; border: 1px solid var(--line); border-radius: 14px; background: var(--input); user-select: none; -webkit-user-drag: none; }
.lc-track.tall .lc-img { height: min(calc(36vh / var(--ui-scale, 1)), 340px); width: auto; }
.lc-track.wide .lc-img { width: min(100%, 520px); height: auto; }
.lc-name { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 1.1rem; }
.lc-text { margin: 0; max-width: 46ch; font-size: 0.9rem; }
.lc-fits { max-width: 46ch; }
.lc-use { margin-top: 4px; min-width: 160px; }
.lc-arrow { position: absolute; top: 38%; z-index: 2; width: 38px; height: 38px; padding: 0; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: var(--input); color: var(--text); }
.lc-arrow.prev { left: 0; }
.lc-arrow.next { right: 0; }
.lc-arrow:disabled { opacity: 0.3; }
.lc-dots { display: flex; justify-content: center; gap: 8px; padding: 2px 0; }
.lc-dot { width: 8px; height: 8px; padding: 0; border: 0; border-radius: 50%; background: var(--line); }
.lc-dot.on { width: 22px; border-radius: 4px; background: var(--orange); }

/* ================================================================== the chat made big (wide): it covers the whole board, whatever grid the layout has */
.layout-h .ai-tab[data-layout][data-chat-h="full"] .ai-chatpane { grid-column: 1 / -1; grid-row: 1 / -1; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; }

/* the layout chooser: under the slides a dot for each layout with an arrow on each side (a finger swipes; the dots and arrows are for taps and a mouse) */
.lc .lc-arrow { display: none; }
.lc-pager { display: flex; align-items: center; justify-content: center; gap: 16px; }
.lc-pager .lc-dots { flex: 0 1 auto; gap: 10px; }
.lc-pager .lc-dot { width: 10px; height: 10px; }
.lc-pager .lc-dot.on { width: 26px; background: var(--acc, var(--orange)); }
.lc-nav { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border-radius: 50%; }
.lc-nav:disabled { opacity: 0.3; }
