/* nio · app */
:root {
  --bg: #f0ede7;
  --bg-2: #e6e1d8;
  --panel: #f8f6f2;
  --fg: #272224;
  --fg-muted: #69615c;
  --accent: #f46a3b;
  --border: #cec7bd;
  --white: #fffefd;
  --moss: #5b6551;
  --lemon: #e7e66a;
  --red: #e2382b;
  --blue: #2b5bd8;
  --code: #ebe7df;
  --font: "Manrope", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --radius: 12px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --ease: cubic-bezier(.22, 1, .36, 1);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { background: var(--bg); color: var(--fg); font: 400 15px/1.5 var(--font); letter-spacing: -.015em; -webkit-font-smoothing: antialiased; overscroll-behavior-y: none; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
::selection { background: var(--lemon); }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--fg-muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); font-size: .9em; letter-spacing: 0; }
.ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack { display: grid; gap: 10px; }
.stack-lg { display: grid; gap: 20px; }

/* ---------- Estructura ---------- */
* { -webkit-tap-highlight-color: transparent; }
.shell { transition: grid-template-columns .34s var(--ease); display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.side { overflow: hidden; white-space: nowrap; position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; gap: 24px; padding: 22px 14px; border-right: 1px solid var(--border); }
.brand { display: flex; align-items: baseline; justify-content: space-between; }
.brand .word { font-size: 26px; font-weight: 600; letter-spacing: -.07em; line-height: 1; text-decoration: none; }
.side nav { display: grid; gap: 2px; }
.side nav a { position: relative; overflow: hidden; display: flex; align-items: center; gap: 10px; padding: 9px 13px; border-radius: 10px; font-size: 14px; font-weight: 500; color: var(--fg-muted); text-decoration: none; transition: background-color .2s, color .2s; }
.side nav a .ico { width: 18px; height: 18px; }
.side nav a span.l { flex: 1 0 auto; }
.side nav a:hover { color: var(--fg); background: color-mix(in srgb, var(--bg-2) 60%, transparent); }
.side nav a[aria-current="page"] { color: var(--fg); background: var(--bg-2); }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--lemon); color: var(--fg); font-size: 11px; font-weight: 600; display: inline-grid; place-items: center; }
.side .foot { margin-top: auto; display: grid; gap: 8px; }
.conn { display: flex; align-items: center; gap: 8px; padding-left: 18px; overflow: hidden; font-size: 13px; color: var(--fg-muted); min-width: 0; }
.conn span { flex: none; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); flex: none; }
.dot.on { background: var(--moss); box-shadow: 0 0 0 3px color-mix(in srgb, var(--moss) 18%, transparent); }
.dot.wait { background: var(--accent); }
.kbd { display: flex; gap: 10px; align-items: center; overflow: hidden; width: 100%; padding: 9px 13px; border: 0; border-radius: 10px; background: none; color: var(--fg-muted); font-size: 14px; font-weight: 500; text-align: left; cursor: pointer; transition: background-color .2s, color .2s; }
.kbd:hover { color: var(--fg); background: color-mix(in srgb, var(--bg-2) 60%, transparent); }
.kbd .ico { width: 18px; height: 18px; }
.kbd kbd { border: 0; background: none; padding: 0; font: 500 12px var(--font); letter-spacing: .02em; color: var(--fg-muted); opacity: .7; }
.kbd .l { flex: 1 0 auto; white-space: nowrap; }
kbd { font: 600 11px var(--font); padding: 1px 6px; border: 1px solid var(--border); border-radius: 6px; background: var(--white); color: var(--fg-muted); }
.main { min-width: 0; display: flex; flex-direction: column; }
.page { padding: 32px 40px 96px; max-width: 1080px; width: 100%; }
.top { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; margin-bottom: 24px; }
.top h1 { font-size: 30px; font-weight: 500; letter-spacing: -.05em; line-height: 1.1; }
.top p { margin-top: 4px; color: var(--fg-muted); }
.mbar, .scrim { display: none; }

/* Menú plegable (escriptori): només es mou l'amplada de la barra. El contingut no s'anima: la vora el talla i el botó viatja amb ella. */
.main { min-width: 0; }
.brand { position: relative; align-items: center; height: 34px; padding: 0; }
.brand .word { margin-left: 13px; }
.brand .collapse { position: absolute; left: 0; top: 0; width: 34px; height: 34px; color: var(--fg-muted); transform: translateX(163px); transition: transform .34s var(--ease), color .2s; }
.brand .collapse svg { transition: transform .34s var(--ease); }
.brand .collapse:hover { color: var(--fg); }
@media (min-width: 821px) {
  body.side-collapsed .shell { grid-template-columns: 72px minmax(0, 1fr); }
  body.side-collapsed .brand .collapse { transform: translateX(4px); }
  body.side-collapsed .brand .collapse svg { transform: scaleX(-1); }
  body.side-collapsed .brand .word { visibility: hidden; }
  body.side-collapsed .side nav a .l, body.side-collapsed .kbd .l, body.side-collapsed .kbd kbd, body.side-collapsed .conn span, body.side-collapsed .conn svg { display: none; }
  body.side-collapsed .conn { padding-left: 0; justify-content: center; }
  body.side-collapsed .side nav .grp { font-size: 0; margin-top: 8px; padding: 8px 0 0; }
  body.side-collapsed .side nav .grp::before { left: 10px; right: 10px; }
  body.side-collapsed .side nav .grp:first-child { display: none; }
  body.side-collapsed .side nav a .badge { position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; font-size: 9px; padding: 0 4px; }
}

/* ---------- Controls ---------- */
.btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 15px; border: 1px solid var(--border); border-radius: 10px; background: var(--white); font-size: 14px; font-weight: 600; white-space: nowrap; transition: background-color .2s, border-color .2s, transform .12s; }
.btn:hover { border-color: var(--fg); }
.btn:active { transform: scale(.98); }
.btn .ico { width: 17px; height: 17px; }
.btn.ink { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.btn.ink:hover { background: color-mix(in srgb, var(--fg) 86%, var(--bg)); }
.btn.ok { background: var(--moss); color: var(--white); border-color: var(--moss); }
.btn.danger { color: var(--red); }
.btn.danger:hover { border-color: var(--red); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { border-color: var(--border); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.icon-btn { position: relative; display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 12px; background: none; color: var(--fg); }
.icon-btn:hover { background: color-mix(in srgb, var(--bg-2) 80%, transparent); }
.icon-btn .badge { position: absolute; top: 3px; right: 1px; min-width: 18px; height: 18px; font-size: 10px; }
input[type="text"], input[type="password"], input[type="url"], input[type="search"], select, textarea.field { width: 100%; min-width: 0; height: 42px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--white); color: var(--fg); outline: none; }
textarea.field { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--fg); }
select { appearance: none; -webkit-appearance: none; padding-right: 40px; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2369615c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 16px 16px; }
label.f { display: grid; gap: 6px; font-size: 13px; color: var(--fg-muted); align-content: start; }
.seg { display: flex; padding: 3px; border-radius: 11px; background: var(--bg-2); }
.seg button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; border: 0; border-radius: 8px; background: none; font-size: 13px; font-weight: 600; color: var(--fg-muted); white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--white); color: var(--fg); }

.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); }
.panel > header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 18px; }
.panel > header h2 { font-size: 15px; font-weight: 600; letter-spacing: -.02em; }
.panel .body { padding: 0 18px 18px; }
.card { display: block; width: 100%; text-align: left; padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); transition: border-color .2s, transform .12s; }
button.card:hover, a.card:hover { border-color: var(--fg); }
button.card:active { transform: scale(.995); }
.list { display: grid; gap: 10px; }
.card.row { display: flex; }
.sheet-foot { position: sticky; bottom: -24px; margin: 0 -24px -24px; padding: 14px 24px 24px; background: linear-gradient(to bottom, transparent, var(--bg) 30%); }
.section-title { font-size: 12px; font-weight: 600; color: var(--fg-muted); margin: 22px 0 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--white); font-size: 12px; font-weight: 600; white-space: nowrap; color: var(--fg); }
button.chip:hover { border-color: var(--fg); }
.chip.running { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.chip.waiting { background: var(--lemon); border-color: var(--lemon); }
.chip.error { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, transparent); }
.chip.usage { gap: 6px; }
.chip.usage .uw + .uw::before { content: '//'; margin-right: 6px; color: var(--fg-muted); font-weight: 400; opacity: .7; }
.chip.usage .ring { width: 15px; height: 15px; stroke-width: 3; }
.chip.usage .ring .rt { stroke: color-mix(in srgb, currentColor 18%, transparent); }
.chip.usage .ring .rv { stroke: var(--moss); }
.chip.usage[data-hi="1"] .ring .rv { stroke: var(--red); }
.chip.usage .uw[data-hi="1"] { color: var(--red); font-weight: 600; }
/* Al mòbil, l'ús va a la barra de dalt (a la barra de xips quedava fora de la pantalla, per la dreta). */
.chip.usage.mini { height: 32px; padding: 0 10px 0 8px; font-size: 12px; white-space: nowrap; flex: none; cursor: pointer; }
#mRight { display: flex; align-items: center; gap: 4px; }
@media (max-width: 820px) { .mode-bar .chip.usage { display: none; } }
.chip.beta { height: 20px; padding: 0 7px; font-size: 10px; color: var(--fg-muted); }
.pulse { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.agent-tag { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; }
.agent-tag::before { content: ""; width: 8px; height: 8px; border-radius: 3px; background: var(--c, var(--fg-muted)); }
[data-agent="claude"] { --c: #e8602c; } [data-agent="codex"] { --c: #2b5bd8; } [data-agent="grok"] { --c: var(--fg); }
[data-agent="antigravity"] { --c: #0f9d8a; } [data-agent="ollama"] { --c: #b08a5a; } [data-agent="demo"] { --c: var(--lemon); } [data-agent="browser"] { --c: #8a5cf6; }
.agent-tag.nosq::before { display: none; }
.abot { display: inline-flex; color: var(--c, var(--fg)); }
.abot .bot { --s: 20px; --bw: .15; }
.chat-head .abot .bot { --s: 30px; --bw: .14; }
.typing .abot .bot { --s: 22px; --bw: .15; }
.empty { padding: 48px 20px; text-align: center; color: var(--fg-muted); display: grid; justify-items: center; gap: 8px; }
.empty .bot { --s: 56px; --bw: .13; color: var(--fg); margin-bottom: 8px; }
.empty h2 { font-size: 20px; font-weight: 500; letter-spacing: -.04em; color: var(--fg); }
.empty p { max-width: 42ch; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 14px; }
.kv dt { color: var(--fg-muted); }
.kv dd { overflow-wrap: anywhere; }

/* ---------- Connecta ---------- */
.connect { display: grid; gap: 24px; min-width: 0; }
.connect-head h1 { font-size: clamp(30px, 4vw, 40px); font-weight: 500; letter-spacing: -.05em; line-height: 1.08; }
.connect-head .lead { color: var(--fg-muted); font-size: 16px; max-width: 58ch; margin-top: 10px; }
.connect-grid { display: grid; grid-template-columns: minmax(0, 720px); gap: 16px; align-items: start; }
.conn-main { padding: 22px; display: grid; gap: 16px; min-width: 0; }
.stepper { list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.stepper li { display: flex; gap: 10px; align-items: flex-start; }
.stepper .n { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--fg); color: var(--bg); display: grid; place-items: center; font-size: 12px; font-weight: 600; }
.stepper b { display: block; font-weight: 600; font-size: 14px; }
.stepper p { font-size: 13px; color: var(--fg-muted); margin-top: 2px; line-height: 1.4; }
.cmd { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 14px; border-radius: 12px; background: var(--code); font-family: var(--mono); font-size: 14px; min-width: 0; }
.cmd code { flex: 1; min-width: 0; overflow-wrap: anywhere; line-height: 1.4; padding: 6px 0; }
.cmd .btn { flex: none; font-family: var(--font); }
.cmd.big { font-size: 16px; padding: 8px 8px 8px 18px; }
.reqs { display: flex; gap: 6px; flex-wrap: wrap; }
.chip.ghost { background: transparent; color: var(--fg-muted); }
.paste { border-top: 1px solid var(--border); padding-top: 12px; }
.paste summary { cursor: pointer; font-size: 14px; font-weight: 600; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.paste summary::-webkit-details-marker { display: none; }
.paste summary::after { content: "+"; font-size: 18px; font-weight: 400; color: var(--fg-muted); }
.paste[open] summary::after { content: "−"; }
.paste .pair-form { display: flex; gap: 8px; margin: 12px 0 6px; }
.try { padding: 22px; display: grid; gap: 12px; justify-items: start; }
.try .bot { --s: 44px; --bw: .13; }
.try h2 { font-size: 18px; font-weight: 600; letter-spacing: -.03em; }
.side nav .grp { display: block; padding: 14px 13px 4px; font-size: 11px; font-weight: 600; color: var(--fg-muted); letter-spacing: .02em; }
.side nav .grp:first-child { padding-top: 0; }
/* Cada apartat comença amb una línia fina, alineada amb el text dels enllaços. */
.side nav .grp:not(:first-child) { position: relative; margin-top: 10px; padding-top: 18px; }
.side nav .grp:not(:first-child)::before { content: ''; position: absolute; top: 0; left: 13px; right: 13px; height: 1px; background: color-mix(in srgb, var(--border) 85%, transparent); }

/* ---------- Sessions ---------- */
.session-card .title { font-size: 16px; font-weight: 500; letter-spacing: -.02em; margin-top: 8px; }
.session-card .last.err { color: var(--red); }
.session-card .last { color: var(--fg-muted); font-size: 14px; margin-top: 4px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.session-card .meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; font-size: 12px; color: var(--fg-muted); }
#termSessions:not(:empty) { margin-bottom: 16px; }
.old-sessions { margin-top: 8px; }
.old-sessions > summary { cursor: pointer; padding: 8px 0; list-style: none; }
.old-sessions > summary::-webkit-details-marker { display: none; }
.old-sessions > .list { margin-top: 8px; }
.fab { position: fixed; right: 24px; bottom: calc(24px + var(--safe-b)); z-index: 15; display: inline-flex; align-items: center; gap: 8px; height: 50px; padding: 0 20px 0 16px; border: 0; border-radius: 16px; background: var(--fg); color: var(--bg); font-weight: 600; box-shadow: 0 14px 30px -14px color-mix(in srgb, var(--fg) 70%, transparent); transition: transform .15s; }
.fab:active { transform: scale(.97); }

/* ---------- Xat de sessió ---------- */
.chat { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 14px 24px; border-bottom: 1px solid var(--border); }
.chat-head h1 { font-size: 17px; font-weight: 600; letter-spacing: -.03em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-head .sub { font-size: 12px; color: var(--fg-muted); }
.mode-bar { display: flex; gap: 6px; padding: 10px 24px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent); }
.mode-bar::-webkit-scrollbar { display: none; }
.feed { flex: 1; overflow-y: auto; padding: 22px 24px 30px; display: flex; flex-direction: column; gap: 12px; overscroll-behavior: contain; }
.feed > * { max-width: 760px; width: 100%; margin-left: auto; margin-right: auto; }
.msg-user { align-self: flex-end; width: auto !important; max-width: min(85%, 620px) !important; margin-right: max(0px, calc((100% - 760px) / 2)) !important; padding: 10px 14px; border-radius: 16px 16px 4px 16px; background: var(--fg); color: var(--bg); white-space: pre-wrap; overflow-wrap: anywhere; animation: rise .25s var(--ease); }
.msg-ai { line-height: 1.6; overflow-wrap: anywhere; animation: rise .25s var(--ease); }
.msg-ai p + p, .msg-ai ul, .msg-ai ol, .msg-ai pre, .msg-ai h3 { margin-top: .6em; }
.msg-ai ul, .msg-ai ol { padding-left: 1.3em; }
.msg-ai h3 { font-size: 16px; font-weight: 600; }
.msg-ai code { font-family: var(--mono); font-size: .88em; padding: 1px 5px; border-radius: 6px; background: var(--code); }
.msg-ai pre { padding: 12px 14px; border-radius: 10px; background: var(--code); overflow-x: auto; }
.msg-ai pre code { padding: 0; background: none; font-size: 13px; }
.msg-ai a { text-underline-offset: 3px; text-decoration-color: var(--accent); }
.msg-ai.cursor > :last-child::after, .msg-ai.cursor:empty::after { content: ""; display: inline-block; width: 7px; height: 1.05em; margin-left: 2px; vertical-align: -.15em; background: var(--accent); animation: pulse 1s steps(1) infinite; }
.tool { border: 1px solid var(--border); border-radius: 10px; background: var(--panel); font-size: 13px; }
.tool summary { display: flex; align-items: center; gap: 10px; padding: 9px 12px; cursor: pointer; list-style: none; }
.tool summary::-webkit-details-marker { display: none; }
.tool .name { font-weight: 600; flex: none; }
.tool .arg { flex: 1; min-width: 0; font-family: var(--mono); font-size: 12px; color: var(--fg-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool .st { flex: none; font-size: 12px; font-weight: 700; color: var(--fg-muted); }
.tool .st.ok { color: var(--moss); } .tool .st.err { color: var(--red); }
.tool pre { margin: 0 12px 12px; padding: 10px 12px; max-height: 320px; overflow: auto; border-radius: 8px; background: var(--code); font: 12px/1.5 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.ev-info, .ev-result { text-align: center; font-size: 12px; color: var(--fg-muted); }
.ev-result { display: flex; justify-content: center; gap: 6px; }
.ev-error { display: grid; gap: 2px; padding: 10px 14px; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--red) 35%, transparent); background: color-mix(in srgb, var(--red) 6%, var(--white)); color: var(--red); font-size: 14px; white-space: pre-wrap; }
.ev-logs { font-size: 12px; color: var(--fg-muted); }
.ev-logs summary { cursor: pointer; }
.ev-logs pre { margin-top: 6px; padding: 10px; border-radius: 8px; background: var(--code); font: 11px/1.5 var(--mono); max-height: 220px; overflow: auto; white-space: pre-wrap; }
.typing { display: flex; align-items: center; gap: 10px; color: var(--fg-muted); font-size: 13px; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

.approval { padding: 16px; border-radius: var(--radius); border: 1.5px solid var(--accent); background: var(--white); display: grid; gap: 10px; animation: rise .25s var(--ease); }
.approval.done { border-color: var(--border); background: var(--panel); }
.approval .q { font-weight: 600; }
.approval pre { padding: 10px 12px; border-radius: 8px; background: var(--code); font: 12px/1.5 var(--mono); max-height: 260px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.approval .actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.approval .actions .btn { height: 44px; font-size: 15px; }
.verdict { font-size: 13px; font-weight: 600; }
#feed .approval.done { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel); font-size: 13px; animation: none; }
#feed .approval.done .verdict { flex: none; padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, currentColor 10%, transparent); }
#feed .approval.done .what { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#feed .approval.done .what .mono { color: var(--fg-muted); font-size: 12px; }
.approval.leaving { transition: opacity .4s .7s, transform .4s .7s; opacity: 0; transform: translateY(-4px); }
.verdict.allowed { color: var(--moss); } .verdict.denied { color: var(--red); }

.composer { display: flex; gap: 8px; align-items: flex-end; padding: 12px 24px calc(14px + var(--safe-b)); border-top: 1px solid var(--border); background: var(--bg); }
.composer > * { max-width: 760px; }
.composer .inner { flex: 1; display: flex; gap: 8px; align-items: flex-end; max-width: 760px; margin: 0 auto; width: 100%; }
.composer textarea { flex: 1; min-height: 46px; max-height: 180px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--white); resize: none; outline: none; line-height: 1.4; }
.composer textarea:focus { border-color: var(--fg); }
.send { display: grid; place-items: center; width: 46px; height: 46px; flex: none; border: 0; border-radius: 14px; background: var(--fg); color: var(--bg); transition: transform .12s, background-color .2s; }
.send:active { transform: scale(.95); }
.send.stop { background: var(--red); }

/* ---------- Full (nova sessió, opcions) ---------- */
dialog.sheet { border: 0; padding: 0; margin: auto; width: min(560px, 100% - 32px); max-height: min(86vh, 860px); border-radius: 18px; background: var(--bg); color: var(--fg); overflow: auto; }
dialog.sheet::backdrop { background: color-mix(in srgb, var(--fg) 40%, transparent); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
dialog.sheet[open] { animation: pop .22s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.sheet-in { padding: 24px; display: grid; gap: 18px; }
.sheet-in h2 { font-size: 22px; font-weight: 500; letter-spacing: -.045em; }
.sheet-in .grab { display: none; }
.picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.pick { display: grid; gap: 2px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--white); text-align: left; }
.pick .sub { font-size: 12px; color: var(--fg-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick[aria-pressed="true"] { border-color: var(--fg); box-shadow: inset 0 0 0 1px var(--fg); }
.pick.off { opacity: .5; }
.proj-list { display: grid; gap: 6px; max-height: 220px; overflow-y: auto; }
.proj { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--white); text-align: left; }
.proj .p { font: 11px var(--mono); color: var(--fg-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj[aria-pressed="true"] { border-color: var(--fg); box-shadow: inset 0 0 0 1px var(--fg); }
.proj .ic { flex: none; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--bg-2); font-size: 11px; font-weight: 700; }

/* ---------- Al mòbil ---------- */
.progress { height: 6px; border-radius: 999px; background: var(--bg-2); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--fg); border-radius: inherit; transition: width .2s; }
.model-card[aria-pressed="true"] { border-color: var(--fg); box-shadow: inset 0 0 0 1px var(--fg); }

/* ---------- Màquina ---------- */
.agent-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid color-mix(in srgb, var(--border) 70%, transparent); }
.agent-row:first-child { border-top: 0; }
.grid2 { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; align-items: start; }

/* ---------- Avisos, paleta, tutorial ---------- */
.toasts { position: fixed; right: 20px; bottom: calc(20px + var(--safe-b)); display: grid; gap: 8px; z-index: 60; }
.toast { max-width: 380px; padding: 12px 16px; border-radius: 12px; background: var(--fg); color: var(--bg); font-size: 14px; animation: rise .25s var(--ease); }
#palette { border: 0; padding: 0; width: min(560px, 100% - 32px); margin: 12vh auto auto; border-radius: 16px; background: var(--bg); color: var(--fg); }
#palette::backdrop { background: color-mix(in srgb, var(--fg) 40%, transparent); }
#palette input { height: 52px; border: 0; border-bottom: 1px solid var(--border); border-radius: 16px 16px 0 0; padding: 0 18px; font-size: 16px; }
#palette ul { list-style: none; max-height: 340px; overflow: auto; padding: 6px; }
#palette li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 10px; cursor: pointer; font-size: 14px; }
#palette li[aria-selected="true"] { background: var(--bg-2); }
#palette li span { color: var(--fg-muted); font-size: 12px; }
/* Al mòbil, la paleta és un full de baix com els altres, i es tanca lliscant cap avall. */
@media (max-width: 820px) {
  #palette { width: 100%; max-width: none; margin: auto 0 0; border-radius: 20px 20px 0 0; padding-bottom: var(--safe-b); max-height: 82dvh; }
  #palette[open] { display: flex; flex-direction: column; animation: sheet-up .3s var(--ease); }
  #palette::before { content: ''; display: block; width: 36px; height: 4px; margin: 8px auto 2px; border-radius: 4px; background: var(--border); flex: none; }
  #palette input { border-radius: 0; flex: none; }
  #palette ul { max-height: none; flex: 1; min-height: 0; }
  #palette li { min-height: 46px; align-items: center; font-size: 15px; }
}

.tour { position: fixed; inset: 0; z-index: 40; pointer-events: none; }
.tour-spot { position: fixed; border-radius: 12px; box-shadow: 0 0 0 9999px color-mix(in srgb, var(--fg) 42%, transparent), 0 0 0 2px var(--white) inset; transition: left .35s var(--ease), top .35s var(--ease), width .35s var(--ease), height .35s var(--ease); }
.tour-card { position: fixed; width: 340px; pointer-events: auto; background: var(--bg); border-radius: 16px; padding: 18px; display: grid; gap: 10px; transition: left .35s var(--ease), top .35s var(--ease); }
.tour-card.center { width: min(420px, calc(100% - 32px)); padding: 28px; gap: 14px; text-align: center; justify-items: center; }
.tour-head { display: flex; align-items: center; gap: 12px; width: 100%; }
.tour-head .bot { --s: 34px; --bw: .13; }
.tour-card.center .tour-head { flex-direction: column; }
.tour-card.center .tour-head .bot { --s: 72px; }
.tour-step { font-size: 12px; color: var(--fg-muted); }
.tour-x { margin-left: auto; width: 28px; height: 28px; border: 0; border-radius: 8px; background: none; font-size: 18px; line-height: 1; color: var(--fg-muted); }
.tour-card.center .tour-x { position: absolute; top: 12px; right: 12px; }
.tour-card h3 { font-size: 19px; font-weight: 500; letter-spacing: -.035em; line-height: 1.2; }
.tour-card.center h3 { font-size: 26px; letter-spacing: -.045em; }
.tour-card p { font-size: 14px; color: var(--fg-muted); }
.tour-card { transition: left .35s var(--ease), top .35s var(--ease), opacity .25s; }
.tour-card.swap { opacity: .0; pointer-events: none; }
.tour-spot.fade { box-shadow: 0 0 0 9999px color-mix(in srgb, var(--fg) 42%, transparent); }
.tour-dots { display: flex; gap: 5px; width: 100%; }
.tour-card.center .tour-dots { display: none; }
.tour-dots i { flex: 1; height: 3px; border-radius: 2px; background: color-mix(in srgb, var(--fg) 14%, transparent); transition: background .3s; }
.tour-dots i.done { background: color-mix(in srgb, var(--fg) 45%, transparent); }
.tour-dots i.on { background: var(--fg); }
.tour-tap { position: fixed; left: 0; top: 0; width: 28px; height: 28px; margin: -14px 0 0 -14px; border-radius: 50%; background: rgba(255,255,255,.95); box-shadow: 0 0 0 2px var(--fg), 0 6px 16px rgba(0,0,0,.3); opacity: 0; pointer-events: none; z-index: 2; transition: translate .6s var(--ease), opacity .25s, scale .15s; }
.tour-tap.on { opacity: 1; }
.tour-tap.press { scale: .76; }
.tour-tap.nomove { transition: none; }
.tour-tap::after { content: ''; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid var(--fg); opacity: 0; }
.tour-tap.press::after { animation: tourRipple .5s ease-out; }
@keyframes tourRipple { from { opacity: .7; transform: scale(1); } to { opacity: 0; transform: scale(2.8); } }
.tour-pressed { scale: .97; transition: scale .15s; }
@media (prefers-reduced-motion: reduce) { .tour-tap, .tour-card, .tour-spot { transition: none !important; } .tour-tap.press::after { animation: none; } }
.tour-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding-top: 4px; }
.tour-card.center .tour-foot { justify-content: center; }

/* ---------- Pissarra ---------- */
body.board-mode .page { padding: 0; max-width: none; }
body.board-mode { overflow: hidden; overscroll-behavior: none; }
body.board-mode .view-enter { animation: none; }

@media (prefers-reduced-motion: no-preference) {
  .view-enter { animation: view-in .25s var(--ease); }
  @keyframes view-in { from { opacity: 0; } }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

@media (max-width: 1000px) { .grid2, .connect-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  body.side-collapsed .shell { grid-template-columns: minmax(0, 1fr); }
  .brand .collapse { display: none; }
  .mbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 6px; min-height: calc(56px + var(--safe-t)); padding: var(--safe-t) 8px 0; background: color-mix(in srgb, var(--bg) 72%, transparent); -webkit-backdrop-filter: blur(18px) saturate(160%); backdrop-filter: blur(18px) saturate(160%); border-bottom: 1px solid color-mix(in srgb, var(--border) 65%, transparent); }
  .mbar .word { font-size: 24px; font-weight: 600; letter-spacing: -.07em; line-height: 1; text-decoration: none; padding-left: 4px; }
  .mbar .here { font-size: 14px; color: var(--fg-muted); padding-left: 10px; margin-left: 2px; border-left: 1px solid var(--border); line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  .burger span { position: absolute; left: 11px; width: 18px; height: 2px; border-radius: 2px; background: currentColor; transition: transform .4s var(--ease), opacity .2s; }
  .burger span:nth-child(1) { transform: translateY(-5px); } .burger span:nth-child(3) { transform: translateY(5px); }
  body.nav-open .burger span:nth-child(1) { transform: rotate(45deg); }
  body.nav-open .burger span:nth-child(2) { opacity: 0; }
  body.nav-open .burger span:nth-child(3) { transform: rotate(-45deg); }
  .side { position: fixed; z-index: 50; top: 0; left: 0; bottom: 0; width: min(304px, 86vw); padding: calc(20px + var(--safe-t)) 14px calc(20px + var(--safe-b)); overflow-y: auto; overscroll-behavior: contain; border-right: 1px solid color-mix(in srgb, var(--border) 60%, transparent); background: color-mix(in srgb, var(--bg) 70%, transparent); -webkit-backdrop-filter: blur(20px) saturate(160%); backdrop-filter: blur(20px) saturate(160%); transform: translateX(-104%); transition: transform .3s var(--ease), box-shadow .3s; will-change: transform; }
  body.nav-open .side { transform: none; box-shadow: 24px 0 60px -30px color-mix(in srgb, var(--fg) 45%, transparent); }
  .side.dragging { transition: none; }
  .side nav a { padding: 12px; font-size: 16px; }
  .side nav, .side .foot { flex-shrink: 0; } /* el calaix fa scroll; la llista no s'encongeix sota el peu */
  .side .foot .kbd kbd { display: none; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 45; background: color-mix(in srgb, var(--fg) 30%, transparent); opacity: 0; pointer-events: none; transition: opacity .3s ease-out; }
  body.nav-open .scrim { opacity: 1; pointer-events: auto; }
  body.nav-open { overflow: hidden; }
  .page { padding: 20px 16px calc(100px + var(--safe-b)); }
  .stepper { grid-template-columns: minmax(0, 1fr); }
  .conn-main, .try { padding: 18px; }
  .cmd.big { flex-direction: column; align-items: stretch; gap: 8px; padding: 12px; font-size: 13.5px; }
  .cmd.big code { white-space: nowrap; overflow-x: auto; padding: 4px 2px; }
  .cmd.big .btn { height: 38px; }
  .paste .pair-form { flex-direction: column; }
  .side nav .grp { padding: 16px 12px 4px; }
  .side nav .grp:not(:first-child) { margin-top: 12px; padding-top: 20px; }
  .side nav .grp:not(:first-child)::before { left: 12px; right: 12px; }
  .top h1 { font-size: 26px; }
  /* Al mòbil només fa scroll el document: res de contenidors amb scroll propi. */
  .chat { height: auto; min-height: calc(100dvh - 56px - var(--safe-t)); }
  .mode-bar { position: sticky; top: calc(56px + var(--safe-t)); z-index: 20; background: color-mix(in srgb, var(--bg) 82%, transparent); -webkit-backdrop-filter: blur(18px) saturate(160%); backdrop-filter: blur(18px) saturate(160%); }
  .feed { flex: 1 0 auto; overflow: visible; overscroll-behavior: auto; }
  .composer { position: sticky; bottom: var(--kb, 0px); z-index: 20; background: var(--bg); }
  body.kb .composer { padding-bottom: 10px; }
  .tool pre, .approval pre, .ev-logs pre, .proj-list { max-height: none; overflow-y: visible; }
  .composer textarea, input[type="text"], input[type="password"], input[type="url"], input[type="search"], select, textarea.field { font-size: 16px; }
  .chat-head { display: none; }
  .mode-bar { padding: 10px 16px; }
  .feed { padding: 18px 16px 24px; }
  .composer { padding: 10px 12px calc(10px + var(--safe-b)); }
  .fab { right: 16px; bottom: calc(16px + var(--safe-b)); }
  dialog.sheet { width: 100%; max-width: none; max-height: 92dvh; margin: auto 0 0; border-radius: 20px 20px 0 0; }
  dialog.sheet[open] { animation: sheet-up .3s var(--ease); }
  @keyframes sheet-up { from { transform: translateY(100%); } }
  .sheet-in { padding: 10px 18px calc(22px + var(--safe-b)); }
  .sheet-foot { bottom: calc(-22px - var(--safe-b)); margin: 0 -18px calc(-22px - var(--safe-b)); padding: 14px 18px calc(22px + var(--safe-b)); }
  .sheet-in .grab { display: block; width: 36px; height: 4px; margin: 0 auto 4px; border-radius: 4px; background: var(--border); }
  .toasts { left: 12px; right: 12px; bottom: calc(12px + var(--safe-b)); }
  .toast { max-width: none; }
  body.chat-mode .toasts { bottom: calc(84px + var(--safe-b)); }
  .tour-card.top, .tour-card.bottom { left: 12px; right: 12px; width: auto; max-height: 46vh; overflow-y: auto; padding: 16px; transition: none; }
  .tour-card.bottom { top: auto; bottom: calc(12px + var(--safe-b)); }
  .tour-card.top { top: calc(12px + var(--safe-t)); bottom: auto; }
  .tour-card.center { max-height: calc(100dvh - 32px); overflow-y: auto; }
  .tour-card h3 { font-size: 18px; }
  .tour-foot .btn { height: 36px; padding: 0 14px; font-size: 13px; }
  .board-root { height: calc(100dvh - 56px - var(--safe-t)) !important; }
}

/* Ordinadors, QR i git */
.conn.switch { cursor: pointer; border-radius: 8px; transition: color .2s; }
.conn.switch:hover { color: var(--fg); }
.conn.switch .ico { width: 14px; height: 14px; flex: none; }
.switch-chip { margin-top: 10px; cursor: pointer; }
.switch-chip .ico { width: 14px; height: 14px; }
.panel.hint { margin-bottom: 20px; padding: 16px 18px; }
.qr-box { width: min(260px, 100%); margin: 0 auto; padding: 14px; border-radius: 16px; background: #fffefd; border: 1px solid var(--border); }
.qr-box svg { display: block; width: 100%; height: auto; }
#ghWrap input[type="search"] { margin-bottom: 4px; }

/* Connexió: dues opcions a l'ordinador; explorador de carpetes a Nova sessió */
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.choice .body { min-width: 0; }
@media (max-width: 820px) { .choice-grid { grid-template-columns: 1fr; } }
.fs-bar { display: flex; align-items: center; gap: 8px; min-width: 0; }
.crumbs { flex: 1; min-width: 0; display: flex; align-items: center; gap: 2px; overflow: hidden; white-space: nowrap; }
.crumb { background: none; border: 0; padding: 6px 6px; margin: 0; border-radius: 8px; color: var(--muted, #8a8f98); font: inherit; cursor: pointer; flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.crumb:hover { background: color-mix(in srgb, currentColor 10%, transparent); color: inherit; }
.crumb.cur { color: inherit; font-weight: 600; cursor: default; }
.crumbs .sl { opacity: .4; flex: none; }
.fs-list { max-height: 240px; overflow: auto; }

/* Assistent «Nova sessió»: drawer fix al telèfon, capçalera i peu fixos, cos amb scroll */
body:has(dialog.sheet[open]) { overflow: hidden; }
dialog.sheet { overscroll-behavior: contain; }
dialog.sheet.wiz { height: min(680px, 88dvh); overflow: hidden; }
dialog.sheet.wiz[open] { display: flex; flex-direction: column; }
dialog.sheet.wiz .sheet-in { padding: 0; gap: 0; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.wiz-head { flex: none; display: grid; gap: 8px; padding: 20px 24px 12px; }
.wiz-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 6px 24px 18px; display: grid; gap: 14px; align-content: start; }
.wiz-foot { flex: none; display: flex; justify-content: space-between; gap: 10px; padding: 12px 24px calc(16px + var(--safe-b)); border-top: 1px solid var(--border); background: var(--bg); }
.wiz-foot .btn { min-width: 110px; justify-content: center; }
.wiz-q { font-size: 18px; font-weight: 500; letter-spacing: -.03em; }
.wiz-dots { display: flex; gap: 6px; }
.wiz-dot { flex: 1; height: 18px; border: 0; background: var(--border) content-box; background-clip: content-box; padding: 7px 0; border-radius: 4px; }
.wiz-dot.on { background-color: var(--fg); }
.wiz-dot.done { background-color: var(--moss); }
.wiz-dot:disabled { cursor: default; }
.wiz .card[aria-pressed="true"] { border-color: var(--fg); box-shadow: inset 0 0 0 1px var(--fg); }
.fs-pick { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; border-radius: 10px; background: var(--bg-2); }
.fs-pick b { overflow-wrap: anywhere; }
.fs-list { max-height: none; }
@media (max-width: 820px) {
  /* Al mòbil, els assistents (Nova sessió, Afegeix ordinador…) fan l'alçada del contingut, no la de tota la pantalla. */
  dialog.sheet.wiz { height: auto; max-height: min(92dvh, calc(var(--vvh, 100dvh) - 8px - var(--safe-t))); }
  dialog.sheet.wiz .sheet-in, dialog.sheet.wiz .wiz-body { flex: 0 1 auto; }
  .wiz-head { padding: 10px 18px 8px; }
  .wiz-body { padding: 4px 18px 14px; }
  .wiz-foot { padding: 12px 18px calc(14px + var(--safe-b)); }
  .wiz-foot .btn { flex: 1; }
}
#fsForm { display: flex; gap: 8px; }
#fsForm input { flex: 1; min-width: 0; }
.pair-code { display: grid; gap: 4px; text-align: center; }
.pair-code b { font-size: 30px; letter-spacing: .14em; font-weight: 600; cursor: copy; }

/* Enllaços-targeta sense subratllat, camps de text sense barra mínima, animació de «Copiat» */
a.card, a.card:hover { text-decoration: none; color: inherit; }
.composer textarea { overflow-y: hidden; }
.copied { color: var(--moss); }
.copied .tick { stroke-dasharray: 24; stroke-dashoffset: 24; animation: tick .38s var(--ease) forwards; }
@keyframes tick { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { .copied .tick { animation: none; stroke-dashoffset: 0; } }

/* Ordinadors: targetes per nom, estat i accions; passos d'un servidor; barra inferior al mòbil */
.computers { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; margin-bottom: 8px; }
.card.computer { display: grid; gap: 14px; cursor: default; }
.card.computer.active { border-color: var(--fg); box-shadow: inset 0 0 0 1px var(--fg); }
.c-ico { flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--bg-2); }
.c-actions { gap: 8px; }
.chip.ok { color: var(--moss); }
.sec { font-size: 18px; font-weight: 500; letter-spacing: -.03em; margin: 28px 0 12px; }
.steps { list-style: none; display: grid; gap: 6px; font-size: 14px; }
.steps li { display: flex; gap: 8px; align-items: baseline; color: var(--fg-muted); }
.steps li::before { content: '✓'; color: var(--moss); font-weight: 700; }
.steps li.on { color: var(--fg); }
.steps li.on::before { content: '…'; color: var(--fg-muted); }
.steps li.err { color: var(--red); }
.steps li.err::before { content: '✕'; color: var(--red); }
video.scan { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 14px; background: #000; }
.tabbar { display: none; }
@media (max-width: 820px) {
  .burger { display: none; }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 6px 8px calc(6px + var(--safe-b)); background: color-mix(in srgb, var(--bg) 94%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-top: 1px solid var(--border); }
  .tabbar > * { flex: 1; position: relative; display: grid; justify-items: center; gap: 2px; padding: 6px 0; border: 0; background: none; border-radius: 10px; font-size: 11px; font-weight: 600; color: var(--fg-muted); text-decoration: none; }
  .tabbar [aria-current="page"] { color: var(--accent); }
  .tabbar .badge { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--accent); color: #fff; font-size: 10px; line-height: 16px; text-align: center; }
  body:not(.no-tabs):not(.kb) .main { padding-bottom: calc(64px + var(--safe-b)); }
  body.no-tabs .tabbar, body.kb .tabbar { display: none; }
  .computers { grid-template-columns: 1fr; }
}

/* Ajuda («Com es fa») */
.help { margin-top: 28px; }
.help details { border-bottom: 1px solid var(--border); }
.help details:last-of-type { border-bottom: 0; margin-bottom: 14px; }
.help summary { cursor: pointer; padding: 12px 0; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.help summary::-webkit-details-marker { display: none; }
.help summary::after { content: '+'; color: var(--fg-muted); font-weight: 400; }
.help details[open] summary::after { content: '−'; }
.help-body { display: grid; gap: 8px; padding: 0 0 14px; font-size: 14px; color: var(--fg-muted); }
.help-body ul { padding-left: 18px; display: grid; gap: 4px; }
.help-body b { color: var(--fg); font-weight: 600; }
.help-body .mono { padding: 2px 7px; border-radius: 6px; background: var(--code); color: var(--fg); white-space: nowrap; }
.help-body .cmdb { margin: 2px 0; padding: 12px 14px; border-radius: 10px; background: var(--code); color: var(--fg); font: 14px/1.4 var(--mono); overflow-x: auto; }
.help-body .cmdlist { display: grid; gap: 6px; margin: 2px 0; }
.help-body .cmdlist > div { display: grid; grid-template-columns: minmax(0, 15rem) minmax(0, 1fr); gap: 4px 14px; align-items: baseline; padding: 8px 10px; border-radius: 10px; background: color-mix(in srgb, var(--code) 45%, transparent); }
.help-body .cmdlist .mono { justify-self: start; white-space: normal; overflow-wrap: anywhere; }
.help-grp { margin: 22px 0 2px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--fg-muted); }
.help-grp:first-child { margin-top: 0; }
@media (max-width: 620px) { .help-body .cmdlist > div { grid-template-columns: 1fr; } }
.empty .stepper { text-align: left; max-width: 640px; margin: 16px auto 18px; }
a.kbd { text-decoration: none; color: inherit; }

/* Comandes amb «/» */
.composer { position: relative; }
.slash { position: absolute; left: 24px; right: 24px; bottom: 100%; max-width: 760px; margin: 0 auto 6px; max-height: min(320px, 45dvh); overflow-y: auto; overscroll-behavior: contain; display: grid; padding: 6px; border: 1px solid var(--border); border-radius: 14px; background: var(--white); box-shadow: 0 10px 30px rgba(39, 34, 36, .12); z-index: 5; }
.slash button { display: grid; grid-template-columns: minmax(0, auto) minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; text-align: left; padding: 9px 10px; border: 0; border-radius: 9px; background: none; width: 100%; }
.slash button[aria-selected="true"] { background: var(--bg-2); }
.slash .n { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slash .h { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg-muted); font-size: 13px; }
.slash .t { display: inline-flex; align-items: center; justify-content: center; height: 20px; padding: 0 8px; border-radius: 10px; background: var(--bg-2); color: var(--fg-muted); font-size: 11px; font-weight: 600; line-height: 1; white-space: nowrap; }
.slash button[aria-selected="true"] .t { background: var(--white); }
.slash .t.ag { background: color-mix(in srgb, var(--lemon) 60%, var(--bg)); color: var(--fg); }
@media (max-width: 820px) { .slash { left: 12px; right: 12px; } .slash button { grid-template-columns: minmax(0, 1fr) auto; } .slash .h { grid-column: 1 / -1; grid-row: 2; } .slash .t { grid-column: 2; grid-row: 1; } }
/* ---------- Veu ---------- */
.ev-error b { font-size: 12px; letter-spacing: .02em; text-transform: uppercase; }
.speak { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; height: 28px; padding: 0 10px; border: 1px solid var(--border); border-radius: 999px; background: none; color: var(--fg-muted); font-size: 12px; font-weight: 600; }
.speak:hover { color: var(--fg); border-color: var(--fg); }
.speak .ico { width: 15px; height: 15px; }
.speak.wait { opacity: .6; } .speak.on { color: var(--accent); border-color: var(--accent); }
.composer .mic { flex: none; display: grid; place-items: center; width: 46px; height: 46px; border: 1px solid var(--border); border-radius: 14px; background: var(--white); color: var(--fg-muted); }
.composer .mic:hover { color: var(--fg); border-color: var(--fg); }
.composer .mic.rec { background: var(--red); border-color: var(--red); color: #fff; animation: pulse 1.1s ease-in-out infinite; }
.composer .mic.wait { opacity: .5; }

/* ---------- Ordre i text net ---------- */
.grid2.one { grid-template-columns: minmax(0, 1fr); max-width: 760px; }
.cols { max-width: 760px; }
/* Pantalla ampla: els panells d'una sola columna (Ajustos, Ordinadors, Pantalla) es reparteixen en dues, sense forats. */
@media (min-width: 1180px) {
  .grid2.one, .cols { max-width: none; }
  .cols, .grid2.one > .stack { display: block; columns: 2; column-gap: 16px; }
  .cols > *, .grid2.one > .stack > * { break-inside: avoid; margin: 0 0 16px; }
}
.top h1, .top p, .panel.empty h2, .panel.empty p, .stepper p, .stepper b, .help-body p, .card p, .sheet h2, .sheet p, .tour-card h3, .tour-card p, .muted.small { text-wrap: balance; }
@media (max-width: 820px) {
  .side nav a[href="#/models"] { display: none; }
  .top p, .panel.empty p, .stepper p, .help-body p, .sheet p, .tour-card p, .computer .muted { text-wrap: balance; }
  .panel.empty { text-align: center; }
  .panel.empty .stepper { text-align: left; }
}

/* ---------- Afegeix un ordinador ---------- */
dialog.sheet.wiz.compact { height: fit-content; max-height: min(86dvh, 720px); }
dialog.sheet.wiz.compact[open] { display: flex; flex-direction: column; }
.compact .wiz-body { min-height: 330px; padding-top: 12px; gap: 18px; }
.compact .wiz-head { gap: 14px; }
.compact .wiz-head .icon-btn { margin-right: -8px; }
.compact .wiz-head h2 { font-size: 22px; font-weight: 500; letter-spacing: -.045em; }
.compact .seg button svg { width: 16px; height: 16px; }
.compact .seg button[aria-pressed="true"] { box-shadow: 0 1px 2px color-mix(in srgb, var(--fg) 12%, transparent); }
.add-intro { display: grid; gap: 4px; }
.add-intro h3 { font-size: 18px; font-weight: 500; letter-spacing: -.03em; line-height: 1.25; }
.add-intro p, .hint { font-size: 14px; color: var(--fg-muted); text-wrap: pretty; }
.hint { font-size: 13px; }
.field-row { display: flex; gap: 8px; }
.field-row input { flex: 1; min-width: 0; height: 46px; }
.field-row .btn { height: 46px; padding: 0 18px; flex: none; }
.hosts { display: grid; gap: 8px; font-size: 12px; font-weight: 600; letter-spacing: .02em; color: var(--fg-muted); }
.hosts .row { gap: 6px; }
.todo { list-style: none; display: grid; gap: 14px; counter-reset: t; }
.todo li { display: grid; grid-template-columns: 24px 1fr; gap: 12px; align-items: start; font-size: 14px; }
.todo .n { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: var(--bg-2); font-size: 12px; font-weight: 600; margin-top: -1px; }
.todo li > div { display: grid; gap: 8px; min-width: 0; }
.todo .cmd { margin-top: 2px; }
.live { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 10px; background: var(--panel); border: 1px solid var(--border); font-size: 13px; color: var(--fg-muted); }
.live .pulse { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--accent); animation: pulse 1.4s ease-in-out infinite; }
.checks { list-style: none; display: grid; gap: 8px; padding-top: 16px; border-top: 1px solid var(--border); font-size: 13px; color: var(--fg-muted); }
.checks li { display: flex; gap: 10px; align-items: baseline; }
.checks li::before { content: '✓'; color: var(--moss); font-weight: 700; }
.or { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--fg-muted); }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.scan { width: 100%; border-radius: 12px; background: #000; aspect-ratio: 4 / 3; object-fit: cover; }
.sheet p { text-wrap: pretty; }
@media (max-width: 820px) {
  .compact .wiz-body { min-height: 300px; }
  .compact .seg button span { white-space: nowrap; }
}
dialog.sheet.wiz.compact .sheet-in, .compact .wiz-body { flex: 0 1 auto; }
.compact .wiz-body { overflow-y: auto; }

/* Alertes: capa superior (popover) i gest de lliscar */
.toasts[popover] { inset: auto 20px calc(20px + var(--safe-b)) auto; margin: 0; padding: 0; border: 0; background: none; color: inherit; overflow: visible; width: auto; height: auto; max-width: calc(100vw - 24px); display: none; }
.toasts[popover]:popover-open { display: grid; }
@media (max-width: 820px) { .toasts[popover] { inset: auto 12px calc(12px + var(--safe-b)) 12px; max-width: none; } body.chat-mode .toasts[popover] { bottom: calc(84px + var(--safe-b)); } }
.toast { touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: grab; box-shadow: 0 8px 24px color-mix(in srgb, var(--fg) 22%, transparent); }
.toast.out { opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; }

/* Bot de l'agent dins la pastilla: enganxat a l'esquerra, centrat en vertical */
.chip:has(.abot) { padding: 0 11px 0 3px; }
.chip .abot { line-height: 0; align-items: center; }
.chip .abot .bot { --s: 20px; --bw: .15; }
.chip .agent-tag { gap: 7px; }
.sheet .list + .or { margin-top: 18px; }
.sheet #modelForm { margin-top: 4px; }

@media (max-width: 820px) {
  .new-fab { position: fixed; right: 16px; bottom: calc(72px + var(--safe-b)); z-index: 25; height: 48px; padding: 0 18px 0 14px; border-radius: 16px; box-shadow: 0 14px 30px -14px color-mix(in srgb, var(--fg) 70%, transparent); }
  body:not(.no-tabs):not(.kb) .main:has(.new-fab) { padding-bottom: calc(130px + var(--safe-b)); }
}

.skel { display: block; height: 14px; border-radius: 8px; background: linear-gradient(90deg, var(--border) 25%, color-mix(in srgb, var(--border) 45%, var(--white)) 50%, var(--border) 75%) 0 0 / 200% 100%; animation: skel 1.3s linear infinite; }
.skel.tall { height: 22px; }
.skel.r { margin-left: auto; }
.skel-card { display: grid; gap: 12px; padding: 18px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--white); }
.skel-feed { display: grid; gap: 14px; padding: 8px 16px; max-width: 760px; margin: 0 auto; width: 100%; box-sizing: border-box; }
@keyframes skel { to { background-position: -200% 0; } }
.chip.fav { border-color: color-mix(in srgb, var(--lemon) 70%, var(--border)); }
.chip[data-fav][aria-pressed="true"] { background: var(--lemon); border-color: var(--lemon); }
.manage-bar { position: sticky; top: 0; z-index: 5; display: grid; gap: 10px; margin: 0 0 12px; padding: 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--bg); }
.manage-bar .row { flex-wrap: wrap; }
.session-card.pick-mode { cursor: pointer; position: relative; padding-left: 46px; user-select: none; }
.session-card.pick-mode::before { content: ""; position: absolute; left: 14px; top: 16px; width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--border); background: var(--white); }
.session-card.picked { border-color: var(--fg); }
.session-card.picked::before { background: var(--fg); border-color: var(--fg); }
.session-card.picked::after { content: ""; position: absolute; left: 21px; top: 20px; width: 6px; height: 11px; border: solid var(--bg); border-width: 0 2px 2px 0; transform: rotate(45deg); }

.mode-bar .chip { height: 30px; gap: 7px; padding: 0 12px 0 10px; }
.mode-bar .chip > .ico, .mode-bar .chip > .agent-tag .ico { width: 15px; height: 15px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.mode-bar .chip > span:not(.agent-tag) { line-height: 1; }
.mode-bar .chip .abot { --s: 18px; display: inline-grid; place-items: center; }
.mode-bar .chip .agent-tag { gap: 7px; line-height: 1; }

/* lliscar entre pàgines: es mou només el contingut; barres i botons fixos no es toquen */
@media (max-width: 820px) {
  .main { overflow-x: clip; }
  #view.swiping .page, #view.swipe-anim .page { position: relative; left: var(--sx, 0); opacity: var(--so, 1); will-change: left, opacity; }
  #view.swipe-anim .page { transition: left .18s var(--ease), opacity .18s ease-out; }
}

/* ---------- Motiu i captura a les aprovacions ---------- */
.approval .why { display: grid; gap: 2px; padding: 10px 12px; border-radius: 8px; background: color-mix(in srgb, var(--lemon) 22%, var(--white)); }
.approval .why p { font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.approval .shot, .screen-img { width: 100%; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-2); display: block; }

/* ---------- Activitat ---------- */
.act-filter { margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.act-filter button { padding: 0 12px; }
.act { display: grid; }
.act-day { font-size: 12px; font-weight: 600; color: var(--fg-muted); margin: 18px 0 6px; text-transform: capitalize; }
.act-day:first-child { margin-top: 0; }
.act-row { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid color-mix(in srgb, var(--border) 70%, transparent); }
.act-t { flex: none; width: 44px; font-size: 12px; color: var(--fg-muted); padding-top: 2px; }
.act-row .row { gap: 8px; }
.act-what { overflow-wrap: anywhere; color: var(--fg); margin-top: 2px; }
.act-row .verdict { font-size: 12px; }

/* ---------- Feines ---------- */
.job .title { font-size: 16px; font-weight: 500; letter-spacing: -.02em; margin-top: 8px; }
.job .meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; font-size: 12px; color: var(--fg-muted); }
.chip.ok { color: var(--moss); border-color: color-mix(in srgb, var(--moss) 40%, transparent); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { gap: 10px; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--fg); }
@media (max-width: 520px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- Aturada d'emergència (sempre a la vista amb el control actiu) ---------- */
.panic { position: fixed; z-index: 35; right: 16px; top: calc(66px + var(--safe-t)); display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px 0 9px; border: 0; border-radius: 999px; background: var(--red); color: #fff; font: 600 13px var(--font); box-shadow: 0 8px 20px -10px color-mix(in srgb, var(--red) 80%, transparent); }
.panic .ico { width: 17px; height: 17px; }
@media (min-width: 821px) { .panic { top: 16px; right: 20px; } }

/* Memòria */
.mem-search { display: flex; gap: 10px; align-items: stretch; margin: 0 0 24px; }
.mem-search input { flex: 1; height: 46px; color: var(--fg); }
.mem-search input::placeholder { color: var(--fg-muted); opacity: 1; }
.mem-search .btn { height: 46px; padding: 0 22px; flex: none; }
.mem-list { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.mem-list .card { color: var(--fg); }
.mem-list .card b { color: var(--fg); }
.section-title + .mem-list { margin-bottom: 8px; }
.mem-learn { gap: 10px; margin-bottom: 20px; }
.mem-conflict { display: grid; gap: 8px; color: var(--fg); cursor: default; }
.mem-conflict .mem-old, .mem-conflict .mem-new { display: grid; gap: 2px; padding: 8px 10px; border-radius: 10px; background: var(--bg-2, rgba(127, 127, 127, .08)); }
.mem-conflict .mem-old s { text-decoration-color: var(--fg-muted); }
.mem-learned { color: var(--fg); cursor: default; align-items: flex-start; }
.mem-auto { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 14px 16px; margin: 0 0 24px; }
.mem-auto .check { align-items: flex-start; flex: 1 1 260px; flex-wrap: nowrap; }
.mem-auto .check input { margin-top: 2px; flex: none; }
.mem-auto .block { display: block; margin-top: 2px; }

/* Capçalera d'una secció dins d'una pàgina */
.sec-head { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; margin: 36px 0 14px; }
.sec-head .sec { margin: 0; }
.sec-head p { margin-top: 4px; max-width: 640px; }

/* Pantalla remota */
html.rd-open, html.rd-open body { overflow: hidden; }
.rd { position: fixed; inset: 0; z-index: 200; display: flex; flex-direction: column; background: #0b0b0c; color: #f2f1ee; padding: var(--safe-t, 0px) 0 var(--safe-b, 0px); }
.rd-bar { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: #161617; border-bottom: 1px solid #2a2a2c; flex: none; }
.rd-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rd-stat { font-size: 12px; color: #8d8c88; white-space: nowrap; }
.rd-bar .grow { flex: 1; }
.rd-btn { appearance: none; border: 1px solid #36363a; background: #232326; color: #f2f1ee; font: inherit; font-size: 13px; line-height: 1; padding: 9px 12px; border-radius: 9px; cursor: pointer; white-space: nowrap; flex: none; }
.rd-btn:hover { background: #2d2d31; }
.rd-btn[aria-pressed=true] { background: #f2f1ee; color: #161617; border-color: #f2f1ee; }
.rd-seg { display: flex; border: 1px solid #36363a; border-radius: 10px; overflow: hidden; flex: none; }
.rd-seg button { appearance: none; border: 0; background: transparent; color: #b9b8b3; font: inherit; font-size: 13px; padding: 9px 14px; cursor: pointer; }
.rd-seg button[aria-pressed=true] { background: #f2f1ee; color: #161617; font-weight: 600; }
.rd-stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; background: #000; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; overflow: hidden; }
.rd-stage img { max-width: 100%; max-height: 100%; display: block; object-fit: contain; -webkit-user-drag: none; }
.rd.rd-ctl .rd-stage { cursor: crosshair; }
.rd-msg { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); max-width: min(560px, calc(100% - 32px)); padding: 12px 16px; border-radius: 12px; background: rgba(22, 22, 23, .92); border: 1px solid #36363a; color: #f2f1ee; font-size: 13px; line-height: 1.45; text-align: center; pointer-events: none; }
.rd-msg[hidden] { display: none; }
.rd-keys { display: flex; gap: 8px; padding: 10px 12px; background: #161617; border-top: 1px solid #2a2a2c; overflow-x: auto; flex: none; -webkit-overflow-scrolling: touch; }
.rd-keys[hidden] { display: none; }
.rd-type { position: fixed; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; border: 0; padding: 0; resize: none; font-size: 16px; pointer-events: none; }
@media (max-width: 560px) { .rd-bar { padding: 8px 10px; gap: 8px; } .rd-stat, #rdFull { display: none; } .rd-seg button { padding: 9px 11px; } }

.rd-stage img { transform-origin: center; will-change: transform; }
.rd-tools { position: absolute; left: 50%; bottom: calc(14px + var(--safe-b, 0px)); transform: translateX(-50%); display: flex; align-items: center; gap: 6px; padding: 6px; border-radius: 14px; background: rgba(22, 22, 23, .86); border: 1px solid #36363a; backdrop-filter: blur(8px); z-index: 2; max-width: calc(100% - 20px); }
.rd-tools .rd-btn { padding: 10px 12px; min-width: 40px; }
.rd-pct { min-width: 56px !important; font-variant-numeric: tabular-nums; }
.rd-sep { width: 1px; align-self: stretch; background: #36363a; }
.rd-msg { bottom: 84px; }
@media (max-width: 560px) { .rd-tools { gap: 4px; padding: 5px; } .rd-tools .rd-btn { padding: 12px 10px; min-width: 44px; font-size: 14px; } .rd-pct { min-width: 52px !important; } }

.session-card { padding: 14px 16px; }
.session-card .meta { margin-top: 8px; }
#jobWhen { flex-wrap: wrap; }
#jobWhen button { flex: 1 0 auto; padding: 0 12px; }
#jobTimes .chip[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
#jobMinsU { flex: 1; }

/* Demo: avís d'ordinador simulat */
.demo-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; margin: 16px 40px 0; max-width: 1000px; padding: 10px 12px 10px 16px; border: 1px dashed var(--accent); border-radius: var(--radius); background: var(--panel); font-size: 13px; }
.demo-bar b { color: var(--accent); }
body.chat-mode .demo-bar, body.board-mode .demo-bar { display: none; }
@media (max-width: 820px) { .demo-bar { margin: 12px 16px 0; } }

/* Sense ordinador: seccions de mostra desactivades */
.panel.off { opacity: .55; }
.panel.off .btn[disabled] { cursor: not-allowed; }
.card.off-note { display: flex; flex-direction: row; align-items: center; gap: 12px 16px; flex-wrap: wrap; border-style: dashed; }

/* Primer ordinador: ordre d'instal·lació, passos i botons alineats a la mateixa amplada */
.first-run > p:first-of-type { max-width: 34em; margin-inline: auto; }
.first-run .cmd { width: 100%; max-width: 640px; margin: 18px auto 0; text-align: left; }
.first-run .stepper { margin: 22px auto 20px; }
.first-run > .muted.small { margin-top: 12px; }
.first-run > .muted.small { max-width: none; }
.first-run .stepper { max-width: 680px; }
@media (max-width: 820px) { .first-run .cmd.big code { white-space: normal; overflow-wrap: anywhere; } }

/* Mòbil: la barra de dalt ja ocupa 56 px, així que la carcassa no ha de fer tota la pantalla (si no, sobra scroll
   i la conversa puja en obrir-la). El camp de text queda enganxat a baix encara que tingui position: relative més amunt. */
@media (max-width: 820px) {
  .shell { min-height: calc(100dvh - 56px - var(--safe-t)); }
  body.chat-mode .composer { position: sticky; bottom: var(--kb, 0px); }
}
/* Referència per mesurar els missatges (offsetTop) dins la conversa. */
.feed { position: relative; }

/* Totes les seccions, amb controls còmodes de tocar. */
.more-sections { display: grid; gap: 0; margin-top: 16px; }
.more-sections section + section { margin-top: 14px; padding-top: 16px; border-top: 1px solid color-mix(in srgb, var(--border) 85%, transparent); }
.more-sections h3 { margin: 0 0 4px; padding-left: 12px; font-size: 12px; font-weight: 600; color: var(--fg-muted); }
.more-sections section > div { display: grid; }
.more-link { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 10px 12px; border-radius: 10px; text-decoration: none; }
.more-link > span:first-of-type { flex: 1; }
.more-link > .ico:first-child { width: 20px; height: 20px; color: var(--fg-muted); }
.more-link[aria-current="page"] > .ico:first-child { color: var(--fg); }
.more-link > .ico:last-child { width: 14px; color: var(--fg-muted); }
.more-link:hover, .more-link[aria-current="page"] { background: var(--bg-2); }
.voice-extras { border: 1px solid var(--border); border-radius: 12px; padding: 0 14px; }
.voice-extras summary { min-height: 48px; padding-block: 13px; cursor: pointer; font-weight: 600; }
.voice-extras > div { padding: 6px 0 16px; }
@media (max-width: 820px) { .tabbar > * { min-height: 48px; } .side nav a { min-height: 46px; } }

/* Llistes i formularis també han d’encaixar amb text llarg o el teclat obert. */
.side nav { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.side > .brand, .side > .foot { flex-shrink: 0; }
:where(.panel, .card, .stack, .stack-lg, .grid-2, .grid-2 > *, label.f) { min-width: 0; }
:where(.top, .panel .body, .mem-list, .job, .sheet-in h2, .conn span) { overflow-wrap: anywhere; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.conn span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
:where(button, a, input, textarea, select, summary):focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }
@media (max-width: 820px) {
  dialog.sheet { max-height: min(92dvh, calc(var(--vvh, 100dvh) - 8px)); }
  .btn, .btn.sm, .icon-btn, .seg button { min-height: 44px; }
  input[type="text"], input[type="password"], input[type="url"], input[type="search"], select, textarea.field { font-size: 16px; }
  .sheet-foot { bottom: calc(-22px - var(--safe-b)); }
}
@media (max-width: 520px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }
.sheet-in { position: relative; }
.sheet-close { position: absolute; top: 14px; right: 14px; z-index: 1; }
.sheet-in > h2 { padding-right: 42px; }
.form-error { color: var(--red); font-size: 13px; overflow-wrap: anywhere; }
dialog.sheet:has(#memForm) { width: min(780px, calc(100% - 32px)); }
@media (max-width: 820px) {
  .sheet-close { top: 16px; right: 10px; }
  dialog.sheet:has(#memForm) { width: 100%; }
}
@media (max-width: 520px) {
  #jobWhen { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px; }
  #jobWhen button { white-space: normal; padding: 6px 8px; }
}
@media (max-width: 820px) {
  dialog.sheet { top: auto; bottom: var(--kb, 0px); margin: 0; }
}

/* Sessions obertes al terminal de l'ordinador */
.term-sessions { margin-bottom: 22px; }
.term-sessions h2.sec { margin: 0 0 8px; }
.term-card { width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; border-style: dashed; }
.term-card:disabled { opacity: .6; cursor: progress; }
.term-go { margin-left: auto; display: inline-flex; align-items: center; gap: 2px; font-weight: 600; color: var(--fg); }

/* Pas a pas de la clau d'ElevenLabs */
.el-guide { margin: -4px 0 4px; padding: 10px 12px; border-radius: 10px; background: var(--bg-2); font-size: 13.5px; }
.el-guide summary { cursor: pointer; font-weight: 600; }
.el-guide ol { margin: 10px 0 6px; padding-left: 20px; display: grid; gap: 8px; line-height: 1.45; }
.el-guide ul { margin: 6px 0 0; padding-left: 16px; display: grid; gap: 4px; }
.el-guide a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.el-on, .el-off { display: inline-block; padding: 0 6px; border-radius: 6px; font-size: 12px; font-weight: 600; }
.el-on { background: color-mix(in srgb, var(--moss) 18%, transparent); color: var(--moss); }
.el-off { background: color-mix(in srgb, var(--fg) 8%, transparent); color: var(--fg-muted); }
.linkish { border: 0; background: none; padding: 0; font: inherit; color: inherit; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.main:has(.nt) .demo-bar { max-width: 1160px; }
