/* Pilot in Command — interface styles. Tokens come from tokens.css (the design system). */
@font-face { font-family: "Inter"; font-weight: 400; src: url(fonts/inter-latin-400-normal.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Inter"; font-weight: 500; src: url(fonts/inter-latin-500-normal.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Inter"; font-weight: 600; src: url(fonts/inter-latin-600-normal.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Inter"; font-weight: 700; src: url(fonts/inter-latin-700-normal.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Orbitron"; font-weight: 500; src: url(fonts/orbitron-latin-500-normal.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Orbitron"; font-weight: 700; src: url(fonts/orbitron-latin-700-normal.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Orbitron"; font-weight: 800; src: url(fonts/orbitron-latin-800-normal.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "JetBrains Mono"; font-weight: 400; src: url(fonts/jetbrains-mono-latin-400-normal.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "JetBrains Mono"; font-weight: 600; src: url(fonts/jetbrains-mono-latin-600-normal.woff2) format("woff2"); font-display: swap; }

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: hsl(var(--background)); color: hsl(var(--foreground));
  font-family: var(--font-sans); font-size: var(--text-md); line-height: var(--leading);
  -webkit-font-smoothing: antialiased; font-feature-settings: "tnum" 1;
  background-image:
    radial-gradient(1100px 560px at 100% -10%, hsl(var(--primary) / 0.07), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, hsl(var(--primary) / 0.05), transparent 60%);
  background-attachment: fixed;
  transition: background-color var(--t-slow) var(--ease), color var(--t-slow) var(--ease);
}
::selection { background: hsl(var(--primary) / 0.3); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: hsl(var(--border)); border-radius: 6px; border: 2px solid hsl(var(--background)); }
::-webkit-scrollbar-track { background: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; padding: 0; }
button, a, [role="button"], input, select, textarea {
  transition: background-color var(--t-base) var(--ease), border-color var(--t-base) var(--ease), color var(--t-base) var(--ease),
              opacity var(--t-base) var(--ease), transform var(--t-base) var(--ease), box-shadow var(--t-base) var(--ease);
}
button:active:not(:disabled) { transform: var(--press); }
:focus-visible { outline: 2px solid hsl(var(--primary) / 0.8); outline-offset: 2px; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform var(--t-base) var(--ease-spring), color var(--t-fast) ease; }
[hidden] { display: none !important; }

/* ---- progress sweep ---- */
.progress { position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 100; background: hsl(var(--primary) / 0.15); opacity: 0; pointer-events: none; overflow: hidden; transition: opacity var(--t-base) ease; }
.progress.on { opacity: 1; }
.progress .sweep { height: 100%; width: 40%; border-radius: 999px; background: linear-gradient(90deg, transparent, hsl(var(--primary)), transparent); box-shadow: 0 0 10px hsl(var(--primary)); animation: sweep 1.1s cubic-bezier(.45,0,.55,1) infinite; }
@keyframes sweep { from { transform: translateX(-100%); } to { transform: translateX(250%); } }

/* ---- shell ---- */
#app { display: flex; height: 100%; }
.sidebar {
  position: relative; width: var(--sidebar-w); min-width: 0; flex: none; display: flex; flex-direction: column;
  background: linear-gradient(180deg, hsl(var(--surface)), hsl(var(--surface) / 0.75)); backdrop-filter: blur(16px);
  border-right: 1px solid hsl(var(--border)); transition: width var(--t-base) var(--ease), transform var(--t-slow) var(--ease);
  overflow: hidden;
}
.sidebar.hidden { width: 0 !important; border-right-color: transparent; }
.sidebar.resizing { transition: none; }
.resizer { position: absolute; inset: 0 0 0 auto; width: 6px; cursor: col-resize; z-index: 5; }
.resizer:hover, .sidebar.resizing .resizer { background: hsl(var(--primary) / 0.4); }
.side-head { display: flex; align-items: center; gap: 10px; height: var(--header-h); padding: 0 12px; border-bottom: 1px solid hsl(var(--border)); flex: none; }
.wing-btn { width: 44px; height: 32px; display: grid; place-items: center; border-radius: var(--radius-sm); }
.wing-btn img { height: 20px; width: auto; filter: drop-shadow(0 1px 2px hsl(0 0% 0% / 0.4)); transition: transform var(--t-base) var(--ease-spring); }
.wing-btn:hover { background: hsl(var(--raised)); }
.wing-btn:hover img { transform: translateY(-1.5px) scale(1.04); }
.wordmark { height: 15px; width: auto; opacity: 0.95; }
.light .wordmark, [data-appearance="light"] .wordmark { filter: brightness(0.45) contrast(1.2); opacity: 1; } /* readable on the day look (item 208) */
/* Every on/off button shows a lit "on" state (item 208): a ring as well as the tint. */
.icon-btn.on, .icon-btn[aria-pressed="true"] { color: hsl(var(--primary)); background: hsl(var(--primary-soft)); box-shadow: inset 0 0 0 1.5px hsl(var(--primary) / 0.7); }

.agent-switch { position: relative; padding: 10px 12px; border-bottom: 1px solid hsl(var(--border)); flex: none; }
.agent-current { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius); border: 1px solid hsl(var(--border)); background: hsl(var(--card) / 0.6); text-align: left; }
.agent-current:hover { border-color: hsl(var(--border-strong)); background: hsl(var(--raised)); }
.agent-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.agent-name { font-weight: 600; font-size: var(--text-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-role { font-size: var(--text-xs); color: hsl(var(--muted-foreground)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-card .agent-text .agent-role { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: break-word; }  /* the role reads in full on a card (item 130) */
.chev { width: 14px; height: 14px; color: hsl(var(--muted-foreground)); }
.menu { position: absolute; left: 12px; right: 12px; top: calc(100% - 4px); z-index: 20; padding: 6px; border-radius: var(--radius); background: hsl(var(--card) / 0.92); backdrop-filter: blur(14px) saturate(1.2); box-shadow: var(--shadow-2); animation: slide-up var(--t-slow) var(--ease) both; max-height: 60vh; overflow: auto; }
.menu .menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 8px; border-radius: var(--radius-sm); text-align: left; }
.menu .menu-item:hover { background: hsl(var(--raised)); }
.menu .menu-item.active { background: hsl(var(--primary-soft)); }
.menu .menu-item .agent-text { gap: 0; }
.menu .sep { height: 1px; margin: 6px 4px; background: hsl(var(--border)); }

.side-scroll { flex: 1; overflow: auto; padding: 6px 10px 10px; }
.group { margin-top: 10px; }
.group-head { display: flex; align-items: center; gap: 8px; padding: 6px 6px 4px; font-size: .72rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: hsl(var(--primary)); }
.group-head .rule { display: none; } /* the fading bars looked like loading bars (item 208) */
.nav-item { position: relative; display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: var(--radius-sm); text-align: left; color: hsl(var(--foreground) / 0.85); font-size: var(--text-sm); }
.nav-item:hover { background: hsl(var(--raised) / 0.8); color: hsl(var(--foreground)); }
.nav-item:hover svg { color: hsl(var(--primary)); transform: translateY(-1px); }
.nav-item.active { background: hsl(var(--primary-soft)); color: hsl(var(--foreground)); font-weight: 500; }
.nav-item.active::before { content: ""; position: absolute; left: 0; top: 18%; bottom: 18%; width: 2px; border-radius: 2px; background: linear-gradient(to bottom, transparent, hsl(var(--primary)), transparent); animation: fade-in var(--t-base) ease-out; }
.nav-item svg { width: 16px; height: 16px; color: hsl(var(--chrome)); flex: none; }
.nav-item .label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-item .meta { font-family: var(--font-mono); font-size: .7rem; color: hsl(var(--faint-foreground)); }
.nav-item .x { opacity: 0; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 6px; color: hsl(var(--muted-foreground)); }
.nav-item:hover .x { opacity: 1; }
.nav-item .x:hover { background: hsl(var(--danger) / 0.2); color: hsl(var(--danger)); }
.empty-line { padding: 10px 12px; margin: 4px 0 10px; font-size: var(--text-sm); color: hsl(var(--muted-foreground)); border: 1px dashed hsl(var(--border)); border-radius: var(--radius); } /* one place and look for every empty list (item 208) */
.side-foot { flex: none; padding: 8px 10px 10px; border-top: 1px solid hsl(var(--border)); }
.side-foot .nav-item.sub { margin-left: 18px; width: calc(100% - 18px); font-size: var(--text-sm); }
.node-line { display: flex; align-items: center; gap: 8px; padding: 6px 10px 0; font-size: var(--text-xs); color: hsl(var(--faint-foreground)); } /* ordinary text, not code (item 130, F-13) */
.node-line .about-small { white-space: normal; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: hsl(var(--faint-foreground)); }
.dot.ok { background: hsl(var(--success)); box-shadow: 0 0 8px hsl(var(--success) / 0.6); }
.dot.bad { background: hsl(var(--danger)); }

#main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: relative; display: flex; align-items: center; gap: 6px; min-height: var(--header-h); padding: 4px 12px; flex: none;
  background: hsl(var(--surface) / 0.7); backdrop-filter: blur(12px); border-bottom: 1px solid hsl(var(--border));
}
.topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: linear-gradient(90deg, transparent, hsl(var(--primary) / 0.4), transparent); pointer-events: none; }
.hist { display: flex; }
.title-wrap { flex: 1; min-width: 0; padding: 0 6px; }
.title { font-weight: 600; font-size: var(--text-md); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.subtitle { font-size: var(--text-xs); color: hsl(var(--muted-foreground)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.controls { display: flex; align-items: center; gap: 6px; }
.model-wrap { display: flex; align-items: center; gap: 6px; }
select { appearance: none; padding: 7px 28px 7px 10px; border-radius: var(--radius-sm); border: 1px solid hsl(var(--border)); background: hsl(var(--raised)) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b98a5' stroke-width='2'><path d='M6 9l6 6 6-6'/></svg>") no-repeat right 8px center / 14px; font-size: var(--text-sm); max-width: 240px; }
select:hover { border-color: hsl(var(--border-strong)); }
/* The open list of a picker takes the app's colours: a picker with a see-through background (Addressing)
   otherwise opened as light text on the browser's white list (22 Nov). */
select option, select optgroup { background-color: hsl(var(--raised)); color: hsl(var(--foreground)); }
.badge { font-size: .7rem; font-weight: 700; letter-spacing: 0.08em; padding: 3px 8px; border-radius: 999px; color: #fff; }
.badge.local { background: hsl(var(--local)); }
.badge.cloud { background: hsl(var(--cloud)); color: hsl(220 25% 8%); }
.badge.neutral { background: hsl(var(--raised)); color: hsl(var(--muted-foreground)); }
/* READY and its kind (item 129, F-44): a real pill in both themes; it had no rule, so in the light theme the white words vanished. */
.badge.ok { background: hsl(var(--success)); color: #fff; }
.badge.danger, .badge.bad { background: hsl(var(--danger)); color: #fff; }
.badge.warn { background: hsl(var(--warning)); color: hsl(220 25% 8%); }
.light .badge.neutral, [data-appearance="light"] .badge.neutral { border: 1px solid hsl(var(--border-strong)); }

.icon-btn { min-width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; gap: 4px; border-radius: var(--radius-sm); color: hsl(var(--muted-foreground)); }
.icon-btn .btn-words { font-size: .74rem; font-weight: 600; padding-right: 4px; white-space: nowrap; }
.icon-btn.on { color: hsl(var(--primary)); background: hsl(var(--primary-soft)); }
.icon-btn:hover:not(:disabled) { background: hsl(var(--raised)); color: hsl(var(--foreground)); }
.icon-btn:disabled { opacity: 0.4; cursor: default; }
.icon-btn.sm { width: 24px; height: 24px; font-size: 1rem; font-weight: 600; line-height: 1; color: hsl(var(--primary)); }
.icon-btn.sm:hover { background: hsl(var(--primary-soft)); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 36px; padding: 7px 16px; line-height: 1.25; text-align: center; max-width: 100%; border-radius: var(--radius); font-weight: 600; font-size: var(--text-sm); border: 1px solid transparent; }
.btn.primary { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); box-shadow: 0 6px 18px -8px var(--halo); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); box-shadow: var(--glow); }
.btn.secondary { background: hsl(var(--raised)); border-color: hsl(var(--border)); color: hsl(var(--foreground)); }
.btn.secondary:hover { border-color: hsl(var(--border-strong)); }
.btn.danger { background: hsl(var(--danger) / 0.15); color: hsl(var(--danger)); border-color: hsl(var(--danger) / 0.4); }
.btn.sm { min-height: 30px; padding: 5px 12px; font-size: var(--text-xs); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn svg { width: 16px; height: 16px; }

/* ---- avatars ---- */
.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: none; background: hsl(var(--raised)); display: inline-grid; place-items: center; }
.avatar.letter { font-weight: 700; font-size: .88rem; color: hsl(var(--primary)); background: hsl(var(--primary-soft)); border: 1px solid hsl(var(--primary) / 0.3); }
.avatar.lg { width: 68px; height: 68px; font-size: 1.45rem; }
.avatar.xl { width: 96px; height: 96px; font-size: 2rem; }   /* the home cards and the larger card (item 193) */
.avatar.sm { width: 36px; height: 36px; font-size: .9rem; }
#sw-avatar { width: 48px; height: 48px; font-size: 1.1rem; }
.avatar.xs { width: 18px; height: 18px; font-size: .62rem; }

/* ---- views ---- */
.view { flex: 1; min-height: 0; display: flex; flex-direction: column; animation: settle var(--t-slow) var(--ease) both; }
@keyframes settle { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes slide-in-right { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }

#view-home { overflow: auto; padding: 28px 24px 40px; }
.home-hero { text-align: center; padding: 24px 0 8px; }
.hero-logo { width: min(420px, 80vw); height: auto; filter: drop-shadow(0 12px 30px hsl(var(--primary) / 0.25)); animation: slide-up 420ms var(--ease) both; }
.hero-line { color: hsl(var(--muted-foreground)); margin: 14px 0 20px; animation: fade-in 500ms ease both 120ms; }
.agent-grid { width: 100%; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 12px; max-width: 1240px; margin: 0 auto; }
.agent-card { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: var(--radius-lg); background: var(--glass-bg); border: 1px solid var(--glass-border); box-shadow: var(--shadow-1); text-align: left; animation: slide-up 360ms var(--ease) both; }
.agent-card:hover { border-color: hsl(var(--primary) / 0.5); box-shadow: var(--glow); transform: translateY(-1px); }
.agent-card { cursor: pointer; position: relative; }
.agent-card .agent-projects { display: block; margin-top: 3px; font-size: var(--text-xs); color: hsl(var(--faint-foreground)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-card .agent-acts { display: flex; flex-direction: column; gap: 2px; margin-left: auto; opacity: .55; }
.agent-card:hover .agent-acts, .agent-card:focus-within .agent-acts { opacity: 1; }
.agent-card .agent-acts .icon-btn { width: 28px; height: 28px; }
.agent-card .agent-text .agent-name { font-size: var(--text-md); white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: break-word; } /* names wrap between words, never a letter to a line (items 53, 130) */
.agent-card .agent-more { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; opacity: .5; }
.agent-card .agent-more:hover, .agent-card:focus-within .agent-more { opacity: 1; }
.agent-card .agent-acts { margin-right: 0; }  /* the ⓘ sits above these, so no room is kept beside them (item 130) */
.agent-pop { position: fixed; z-index: 60; padding: 16px; border-radius: var(--radius-lg); background: hsl(var(--surface)); border: 1px solid hsl(var(--border-strong)); box-shadow: var(--shadow-2); animation: slide-up 200ms var(--ease) both; }
.agent-pop .agent-pop-top { display: flex; justify-content: center; margin-bottom: 8px; }
.agent-pop .agent-pop-name { font-weight: 600; font-size: var(--text-lg); text-align: center; }
.agent-pop .agent-pop-role { text-align: center; color: hsl(var(--muted-foreground)); font-size: var(--text-sm); margin-bottom: 6px; }
.agent-pop p { font-size: var(--text-sm); margin: 6px 0; }
.agent-pop .kv { font-size: var(--text-sm); grid-template-columns: 84px 1fr; }
.agent-card.add { justify-content: center; border-style: dashed; color: hsl(var(--muted-foreground)); background: transparent; box-shadow: none; }
.agent-card.add:hover { color: hsl(var(--primary)); }

/* ---- chat ---- */
.messages { flex: 1; overflow: auto; padding: 22px 18px 8px; display: flex; flex-direction: column; gap: 18px; scroll-behavior: smooth; }
.msg { display: flex; gap: 12px; max-width: min(860px, 100%); animation: slide-up var(--t-slow) var(--ease) both; }
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.msg .bubble { min-width: 0; padding: 11px 14px; border-radius: var(--radius-lg); line-height: 1.55; }
.msg.user .bubble { background: hsl(var(--primary-soft)); border: 1px solid hsl(var(--primary) / 0.25); border-bottom-right-radius: 6px; white-space: pre-wrap; word-wrap: break-word; }
.msg.assistant .bubble { background: var(--glass-bg); border: 1px solid var(--glass-border); box-shadow: var(--shadow-1); border-bottom-left-radius: 6px; }
.msg.error .bubble { background: hsl(var(--danger) / 0.12); border: 1px solid hsl(var(--danger) / 0.4); }
.msg .meta { display: flex; gap: 10px; margin-top: 6px; font-family: var(--font-mono); font-size: .72rem; color: hsl(var(--faint-foreground)); }
.msg.user .meta { justify-content: flex-end; }
.md > :first-child { margin-top: 0; } .md > :last-child { margin-bottom: 0; }
.md p { margin: 0.5em 0; } .md ul, .md ol { margin: 0.5em 0; padding-left: 1.4em; } .md li { margin: 0.15em 0; }
.md h1, .md h2, .md h3 { font-size: 1.05em; margin: 0.9em 0 0.4em; font-weight: 700; }
.md code { font-family: var(--font-mono); font-size: 0.86em; background: hsl(var(--raised)); padding: 1px 5px; border-radius: 4px; }
.md pre { background: hsl(var(--background)); border: 1px solid hsl(var(--border)); border-radius: var(--radius-sm); padding: 10px 12px; overflow: auto; margin: 0.6em 0; }
.md pre code { background: none; padding: 0; font-size: 0.85em; }
.md table { border-collapse: collapse; margin: 0.6em 0; font-size: 0.92em; } .md th, .md td { border: 1px solid hsl(var(--border)); padding: 4px 8px; }
.md a { color: hsl(var(--primary)); } .md blockquote { margin: 0.6em 0; padding-left: 10px; border-left: 2px solid hsl(var(--primary) / 0.5); color: hsl(var(--muted-foreground)); }
.md hr { border: none; border-top: 1px solid hsl(var(--border)); margin: 0.8em 0; }
.caret { display: inline-block; width: 7px; height: 1em; margin-left: 2px; vertical-align: -2px; background: hsl(var(--primary)); border-radius: 2px; animation: blink 1s steps(2, start) infinite; }
@keyframes blink { to { visibility: hidden; } }
.thinking { display: inline-flex; gap: 4px; align-items: center; height: 1.4em; }
.thinking i { width: 6px; height: 6px; border-radius: 50%; background: hsl(var(--primary)); opacity: 0.4; animation: pulse 1.2s ease-in-out infinite; }
.thinking i:nth-child(2) { animation-delay: 0.2s; } .thinking i:nth-child(3) { animation-delay: 0.4s; }
@keyframes pulse { 0%, 100% { opacity: 0.3; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-2px); } }
.chat-empty { margin: auto; text-align: center; color: hsl(var(--muted-foreground)); animation: fade-in 400ms ease both; }
.chat-empty img { width: 120px; opacity: 0.35; filter: grayscale(0.4); }
.chat-empty p { margin: 8px 0 0; }

.composer { flex: none; padding: 8px 18px calc(14px + env(safe-area-inset-bottom)); }
.composer-box { max-width: 860px; margin: 0 auto; border-radius: var(--radius-lg); background: var(--glass-bg); border: 1px solid var(--glass-border); box-shadow: var(--shadow-1); padding: 10px 10px 8px; }
.composer-box:focus-within { border-color: hsl(var(--primary) / 0.5); box-shadow: 0 0 0 3px hsl(var(--primary) / 0.18), var(--shadow-1); }
#input { width: 100%; resize: none; border: none; background: transparent; outline: none; padding: 4px 6px; max-height: 40vh; line-height: 1.5; }
#input::placeholder { color: hsl(var(--faint-foreground)); }
.composer-row { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.hint { font-size: var(--text-xs); color: hsl(var(--faint-foreground)); text-align: right; }
.row-gap { flex: 1; }
/* Enter sends (item 161): computers and the web; phones make a new line with Enter. */
.enter-send { display: inline-flex; align-items: center; gap: 5px; color: hsl(var(--muted-foreground)); cursor: pointer; white-space: nowrap; }
.enter-send input { margin: 0; accent-color: hsl(var(--primary)); }
/* Addressing (item 162): the menu that picks who answers sits against Send, as one control. */
.send-group { display: inline-flex; align-items: center; gap: 0; }
.send-group .speaker:not([hidden]) { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 4px 0 8px; margin-right: -1px; border: 1px solid hsl(var(--primary) / 0.55); border-right: 0; border-radius: var(--radius) 0 0 var(--radius); background: hsl(var(--primary) / 0.08); color: hsl(var(--foreground)); font-size: var(--text-xs); font-weight: 600; }
.send-group .speaker:not([hidden]) + .send { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.send-group .speaker .tip { margin: 0; }
.send-group .speaker select { border: 0; background-color: transparent; font-weight: 500; }
.send { min-height: 34px; padding: 0 14px; }

/* ---- dialogs ---- */
.dlg { background: hsl(var(--card) / 0.9); color: hsl(var(--foreground)); border: 1px solid hsl(var(--border)); border-radius: var(--radius-lg); padding: 22px; width: min(560px, 92vw); box-shadow: var(--shadow-2); backdrop-filter: blur(14px); animation: slide-up 240ms var(--ease) both; }
.dlg.wide { width: min(720px, 94vw); }
.dlg::backdrop { background: hsl(220 30% 4% / 0.55); backdrop-filter: blur(3px); animation: fade-in 200ms var(--ease) both; }
/* The web copy shows nothing of the app until the person is signed in (item 211): only the sign-in box on the backdrop. */
body.gated .sidebar, body.gated #main { visibility: hidden; }
body.gated #dlg-signin::backdrop { background: hsl(220 30% 6% / 0.92); }
/* Closing is as smooth as opening (item 201): the window slides down and fades while the backdrop fades. */
@keyframes slide-down-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(6px); } }
@keyframes fade-out { from { opacity: 1; } to { opacity: 0; } }
.dlg.closing { animation: slide-down-out 160ms var(--ease) both; pointer-events: none; }
.dlg.closing::backdrop { animation: fade-out 160ms var(--ease) both; }
.dlg h3 { margin: 0 0 14px; font-family: var(--font-display); font-weight: 700; font-size: 1rem; letter-spacing: 0.04em; text-transform: uppercase; color: hsl(var(--primary)); }
.dlg label { display: block; margin: 10px 0; font-size: var(--text-xs); color: hsl(var(--muted-foreground)); font-weight: 600; letter-spacing: 0.02em; }
.dlg label.check { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.dlg input:not([type=checkbox]):not([type=file]):not([type=radio]), .dlg textarea, .dlg select { display: block; width: 100%; margin-top: 5px; padding: 9px 10px; border-radius: var(--radius-sm); border: 1px solid hsl(var(--border)); background: hsl(var(--raised)); color: hsl(var(--foreground)); font-weight: 400; font-size: var(--text-sm); }
.dlg input:focus, .dlg textarea:focus, .dlg select:focus { outline: none; border-color: hsl(var(--primary) / 0.6); box-shadow: 0 0 0 3px hsl(var(--primary) / 0.2); }
.dlg select { max-width: none; }
/* Every drop-down shows its arrow, inside dialogs too (the dialog field rule above resets the background). */
.dlg select, .inline-select { background: hsl(var(--raised)) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b98a5' stroke-width='2'><path d='M6 9l6 6 6-6'/></svg>") no-repeat right 10px center / 14px; padding-right: 32px; cursor: pointer; }
.dlg menu { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 0; margin: 16px 0 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.avatar-pick { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
.tabs { flex-wrap: wrap; display: flex; gap: 4px; margin-bottom: 12px; padding: 3px; border-radius: var(--radius); background: hsl(var(--raised)); max-width: 100%; }
.tab { padding: 6px 14px; border-radius: var(--radius-sm); font-size: var(--text-sm); color: hsl(var(--muted-foreground)); }
.tab.active { background: hsl(var(--card)); color: hsl(var(--foreground)); box-shadow: 0 1px 2px hsl(0 0% 0% / 0.25); }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 12px; font-size: var(--text-sm); align-items: start; }
.kv .k { color: hsl(var(--muted-foreground)); padding-top: 2px; }
code.inline { font-family: var(--font-mono); font-size: .82rem; background: hsl(var(--raised)); padding: 1px 6px; border-radius: 4px; }
.prov { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius); border: 1px solid hsl(var(--border)); margin-bottom: 8px; background: hsl(var(--raised) / 0.5); }
.prov .name { font-weight: 600; min-width: 90px; }
.prov .url { flex: 1; font-size: .82rem; color: hsl(var(--faint-foreground)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.about { text-align: center; width: min(460px, 92vw); }
.about-logo { width: 300px; max-width: 80%; margin: 8px auto 6px; display: block; filter: drop-shadow(0 10px 24px hsl(var(--primary) / 0.25)); }
.about-tag { font-family: var(--font-display); font-weight: 500; letter-spacing: 0.06em; font-size: .82rem; color: hsl(var(--primary)); margin: 4px 0 12px; text-transform: uppercase; }
.about-line { margin: 4px 0; } .about-line a { color: hsl(var(--primary)); text-decoration: none; }
.about-small { font-size: var(--text-xs); color: hsl(var(--muted-foreground)); margin: 10px 0 0; }
.about menu { justify-content: center; }

/* Notices: top centre, clear of the composer and the controls (SOP-009 §11.28). The box is a
   top-layer popover so it shows above open dialogs; only the notices themselves take taps. */
/* Notices sit in the bottom-right corner, where nothing else lives, so they never cover a title or a
   message (item 61). On a phone they sit just above the typing box. */
.toasts { position: fixed; inset: auto; right: 24px; bottom: calc(env(safe-area-inset-bottom) + 24px); left: auto; top: auto; transform: none; margin: 0; padding: 0; border: 0; background: transparent; overflow: visible; display: flex; flex-direction: column-reverse; align-items: flex-end; gap: 6px; z-index: 200; pointer-events: none; width: max-content; max-width: min(380px, calc(100vw - 24px)); }
@media (max-width: 760px) { .toasts { right: 50%; transform: translateX(50%); align-items: center; bottom: calc(env(safe-area-inset-bottom) + 132px); } }
.toasts:not(:popover-open) { display: none; }
/* Notices (item 166): the text colour is set here; the browser's own colour for pop-ups is black, which
   was nearly invisible on the dark card. Solid background, normal reading size. */
.toast { pointer-events: auto; cursor: pointer; display: flex; align-items: flex-start; gap: 10px; padding: 11px 10px 11px 14px; border-radius: 12px; text-align: left; background: hsl(var(--card)); color: hsl(var(--foreground)); border: 1px solid hsl(var(--border)); box-shadow: var(--shadow-2); font-size: var(--text-base, .95rem); font-weight: 500; line-height: 1.4; overflow-wrap: anywhere; animation: toast-in 200ms var(--ease) both; transition: opacity 240ms var(--ease), transform 240ms var(--ease); }
.toast-text { flex: 1; min-width: 0; }
.toast-x { flex: none; width: 24px; height: 24px; margin: -2px -2px 0 0; border-radius: 6px; color: hsl(var(--muted-foreground)); font-size: 18px; line-height: 1; background: transparent; }
.toast-x:hover { background: hsl(var(--foreground) / 0.08); color: hsl(var(--foreground)); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.toast.err { border-color: hsl(var(--danger)); border-left-width: 4px; }

/* ---- responsive ---- */
.desk { display: inline-flex; }
#btn-menu { display: none; }
.scrim { display: none; }
@media (max-width: 820px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 30; width: min(320px, 86vw) !important; transform: translateX(-100%); box-shadow: var(--shadow-2); }
  .sidebar.open { transform: none; }
  .sidebar.hidden { width: min(320px, 86vw) !important; }
  .resizer { display: none; }
  .desk { display: none !important; }
  #btn-menu { display: grid; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 25; background: hsl(220 30% 4% / 0.5); opacity: 0; pointer-events: none; transition: opacity var(--t-base) ease; }
  .scrim.on { opacity: 1; pointer-events: auto; }
  .subtitle { display: none; }
  select { max-width: 150px; }
  .hint { display: none; }
  .grid2 { grid-template-columns: 1fr; }
  .messages { padding: 14px 12px 6px; }
  .composer { padding-left: 10px; padding-right: 10px; }
}

/* ---- tool cards ---- */
.tool { margin: 6px 0; border: 1px solid hsl(var(--border)); border-radius: var(--radius-sm); background: hsl(var(--raised) / 0.5); font-size: var(--text-sm); overflow: hidden; animation: slide-up var(--t-base) var(--ease) both; }
.tool summary { list-style: none; display: flex; align-items: center; gap: 8px; padding: 7px 10px; cursor: pointer; color: hsl(var(--muted-foreground)); }
.tool summary::-webkit-details-marker { display: none; }
.tool summary .tname { font-family: var(--font-mono); font-size: .82rem; color: hsl(var(--foreground)); }
.tool summary .tstate { margin-left: auto; font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; }
.tool.running summary .tstate { color: hsl(var(--primary)); }
.tool.ok summary .tstate { color: hsl(var(--success)); }
.tool.err summary .tstate { color: hsl(var(--danger)); }
.tool summary { flex-wrap: wrap; }
.tool summary .tname { font-family: inherit; }
.tool summary .treason { flex: 1 1 100%; order: 3; font-size: .8rem; color: hsl(var(--muted-foreground)); }
/* A reply that is only tool cards has no empty bubble above them. */
.bubble:empty { display: none; }
.agent-line { display: block; font-size: .72rem; margin-top: 2px; }
.agent-line.ok { color: hsl(var(--success)); }
.agent-line.off { color: hsl(var(--muted-foreground)); }
.tool .tbody { padding: 0 10px 10px; display: grid; gap: 6px; }
.tool pre { margin: 0; max-height: 240px; overflow: auto; background: hsl(var(--background)); border: 1px solid hsl(var(--border)); border-radius: 6px; padding: 8px; font-family: var(--font-mono); font-size: .78rem; white-space: pre-wrap; word-break: break-word; }
.tool .tlabel { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: hsl(var(--faint-foreground)); }
.tool summary svg { width: 14px; height: 14px; color: hsl(var(--chrome)); }
.tool.running summary svg { animation: spin 1s linear infinite; color: hsl(var(--primary)); }
@keyframes spin { to { transform: rotate(360deg); } }
.field-label { margin: 10px 0 6px; font-size: var(--text-xs); color: hsl(var(--muted-foreground)); font-weight: 600; letter-spacing: .02em; }
/* Short lists show in full; the window scrolls once (item 51). Only long lists keep their own scroll. */
.grants { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; padding: 8px 10px; border: 1px solid hsl(var(--border)); border-radius: var(--radius-sm); background: hsl(var(--raised) / 0.5); }
.grants label { display: flex; align-items: center; gap: 8px; margin: 2px 0; font-weight: 500; font-size: var(--text-sm); color: hsl(var(--foreground)); }
.grants .ghead { grid-column: 1 / -1; font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: hsl(var(--primary)); margin-top: 4px; }
.prov .actions { display: flex; gap: 6px; }
.row-actions { display: flex; gap: 8px; margin-top: 10px; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border-radius: 999px; background: hsl(var(--raised)); border: 1px solid hsl(var(--border)); font-size: var(--text-xs); max-width: 220px; }
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip button { color: hsl(var(--muted-foreground)); line-height: 1; }
.chip.up { border-color: hsl(var(--primary) / 0.5); }
.msg .att { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; justify-content: flex-end; }
.msg .att a { color: inherit; text-decoration: none; }
.keyrow { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid hsl(var(--border)); border-radius: var(--radius); margin-bottom: 6px; }
.keyrow code { font-family: var(--font-mono); font-size: .82rem; }
.newkey { font-family: var(--font-mono); font-size: .82rem; word-break: break-all; padding: 10px; border: 1px solid hsl(var(--primary) / 0.5); border-radius: var(--radius-sm); background: hsl(var(--primary-soft)); margin: 8px 0; user-select: all; }
.tab:focus { outline: none; }
.tab:focus-visible { outline: 2px solid hsl(var(--primary) / 0.6); outline-offset: 1px; }

/* Listening (item 58): the microphone becomes a red stop button that glows and pulses, with the time beside it. */
#btn-mic.rec, .ask-mic.rec { color: #fff; background: hsl(var(--danger)); border-radius: 999px; animation: rec-glow 1.3s ease-in-out infinite; }
@keyframes rec-glow { 0%, 100% { box-shadow: 0 0 0 0 hsl(var(--danger) / .6); } 50% { box-shadow: 0 0 0 7px hsl(var(--danger) / 0); } }
.rec-time { position: absolute; transform: translateX(-50%); font-variant-numeric: tabular-nums; font-size: .78rem; font-weight: 600; color: hsl(var(--danger)); padding: 1px 6px; border-radius: 999px; background: hsl(var(--card)); border: 1px solid hsl(var(--danger) / 0.4); white-space: nowrap; pointer-events: none; z-index: 2; }
.composer-row { position: relative; }
@media (prefers-reduced-motion: reduce) { #btn-mic.rec, .ask-mic.rec { animation: none; box-shadow: 0 0 0 3px hsl(var(--danger) / .35); } }
#btn-voice-mode.on { color: hsl(var(--primary)); background: hsl(var(--primary-soft)); }
.msg .say { opacity: .7; transition: opacity var(--dur) var(--ease); margin-left: 6px; color: hsl(var(--muted-foreground)); font-size: .76rem; } /* always there, not only on hover (item 197) */
.msg:hover .say, .msg .say.playing { opacity: 1; }
.try-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 10px; }
.try-btn { font: inherit; font-size: var(--text-sm); padding: 8px 12px; border-radius: 999px; border: 1px solid hsl(var(--border)); background: hsl(var(--raised) / 0.6); color: hsl(var(--foreground)); cursor: pointer; max-width: 320px; text-align: left; }
.try-btn:hover { border-color: hsl(var(--primary) / 0.6); color: hsl(var(--primary)); }
.msg .say.playing { color: hsl(var(--primary)); }

.dlg.wide { width: min(880px, 94vw); }
.logbox { font-family: var(--font-mono); font-size: .82rem; white-space: pre-wrap; max-height: 260px; overflow: auto; padding: 10px; border-radius: var(--radius-sm); background: hsl(var(--raised)); border: 1px solid hsl(var(--border)); }
textarea.mono { font-family: var(--font-mono); font-size: .82rem; }
.pbar { height: 6px; border-radius: 3px; background: hsl(var(--raised)); overflow: hidden; margin: 6px 0; }
.pbar > i { display: block; height: 100%; background: hsl(var(--primary)); transition: width var(--t-base) var(--ease); }
.row-actions { flex-wrap: wrap; }
.row-actions select { max-width: 320px; }
.row-actions .btn { white-space: nowrap; }
#ds-agent { width: 180px; }

.menu { position: absolute; right: 56px; top: 52px; z-index: 30; min-width: 220px; padding: 6px; border-radius: var(--radius); background: hsl(var(--card)); border: 1px solid hsl(var(--border)); box-shadow: 0 12px 32px hsl(0 0% 0% / 0.35); display: flex; flex-direction: column; }
.menu button { text-align: left; padding: 8px 10px; border-radius: var(--radius-sm); font-size: var(--text-sm); color: hsl(var(--foreground)); }
.menu button:hover { background: hsl(var(--raised)); }
.menu button.danger { color: hsl(var(--danger)); }
.choice { display: block; padding: 10px 12px; border: 1px solid hsl(var(--border)); border-radius: var(--radius); cursor: pointer; }
.choice:has(input:checked) { border-color: hsl(var(--primary)); background: hsl(var(--primary-soft)); }
.choice input { margin-right: 6px; }
.choice input[type="radio"] { margin: 0 8px 0 0; padding: 0; }
.choice b { vertical-align: middle; }

/* ---- Phase 2: settings shell (fixed frame, left rail, scrolling pane) ---- */
.dlg.settings { width: min(1400px, 96vw); height: min(1000px, 92vh); padding: 0; overflow: hidden; } /* most of the window, so the rail needs no scrolling (item 129, F-9) */
.dlg.settings[open] { display: block; }
.settings-shell { display: grid; grid-template-columns: minmax(220px, max-content) 1fr; grid-template-rows: minmax(0, 1fr); height: 100%; min-height: 0; }
.settings-rail { background: hsl(var(--raised) / 0.6); border-right: 1px solid hsl(var(--border)); padding: 14px 10px; overflow: auto; min-height: 0; }
.rail-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 8px 10px; font-family: var(--font-display); font-weight: 700; font-size: .94rem; letter-spacing: .06em; text-transform: uppercase; color: hsl(var(--primary)); }
.rail-group { margin: 6px 0 10px; }
/* Group titles stand out in the accent blue; their pages sit indented under them (item 38, SOP-009 rule 49). */
.rail-title { font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: hsl(var(--primary)); padding: 8px 8px 3px; }
.rail-group .rail-item { padding-left: 22px; }
.rail-item { display: block; width: 100%; text-align: left; padding: 7px 10px; border-radius: var(--radius-sm); font-size: var(--text-sm); color: hsl(var(--muted-foreground)); transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
@media (min-width: 821px) { .rail-item { white-space: nowrap; } }
.rail-item:hover { background: hsl(var(--card)); color: hsl(var(--foreground)); }
.rail-item.active { background: hsl(var(--primary) / 0.14); color: hsl(var(--foreground)); box-shadow: inset 2px 0 0 hsl(var(--primary)); }
.settings-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100%; overflow: hidden; }
.pane-head { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; padding: 16px 22px 10px; border-bottom: 1px solid hsl(var(--border)); }
.pane-head h3 { margin: 0; }
.set-hist { display: flex; gap: 2px; }
.rail-search { position: relative; padding: 0 8px 8px; }
.rail-search input { width: 100%; font: inherit; font-size: var(--text-sm); padding: 7px 10px; border-radius: var(--radius-sm); border: 1px solid hsl(var(--border)); background: hsl(var(--raised)); color: hsl(var(--foreground)); }
.rail-q-out { position: absolute; left: 8px; right: 8px; top: 100%; z-index: 5; max-height: 50vh; overflow: auto; }
.rail-q-out button { display: block; width: 100%; text-align: left; }
.rail-q-out .about-small { display: block; }
.start-list { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 6px; }
.start-list li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.start-list .btn { flex: none; margin-left: auto; }
.start-list .done { color: hsl(var(--ok, 140 60% 45%)); }
.start-list .todo { color: hsl(var(--muted-foreground)); }
.pane-body { flex: 1 1 auto; overflow: auto; padding: 16px 22px 22px; min-height: 0; }
.pane-body.anim-in, .view.anim-in, .messages.anim-in { animation: slide-in-right 220ms var(--ease) both; }
.mobile-only { display: none; }
.icon-btn.sm { width: 28px; height: 28px; }
@media (max-width: 820px) {
  .dlg.settings { width: 100vw; height: 100vh; max-height: 100vh; border-radius: 0; }
  .settings-shell { grid-template-columns: 1fr; }
  .settings-rail { border-right: 0; }
  .settings-pane { display: none; }
  .dlg.settings.pane-open .settings-rail { display: none; }
  .dlg.settings.pane-open .settings-pane { display: flex; }
  .mobile-only { display: inline-flex; }
}
/* dialogs keep their top edge where it is; only the bottom grows */
.dlg { max-height: 88vh; overflow: auto; align-self: start; margin-top: 6vh; }
.dlg.welcome { width: min(560px, 94vw); }

/* ---- tooltips: hover on desktop, tap on touch ---- */
.tip { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 50%; border: 1px solid hsl(var(--border)); color: hsl(var(--muted-foreground)); font-size: .7rem; font-weight: 700; cursor: help; position: relative; vertical-align: middle; margin-left: 4px; user-select: none; }

/* ---- feedback on replies ---- */
.fb { display: inline-flex; gap: 2px; margin-left: 8px; }
.fb-btn { color: hsl(var(--muted-foreground)); opacity: .55; padding: 2px 3px; border-radius: 4px; line-height: 0; transition: opacity var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.fb-btn.down svg { transform: rotate(180deg); }
.fb-btn:hover { opacity: 1; color: hsl(var(--foreground)); }
.fb-btn.on { opacity: 1; color: hsl(var(--primary)); }
.fb-btn.on svg path { fill: currentColor; fill-opacity: .22; }

/* ---- phone rules ---- */
.rule { border: 1px solid hsl(var(--border)); border-radius: var(--radius); padding: 8px 12px; margin: 8px 0; background: hsl(var(--raised) / 0.4); }
.page-body { font-size: var(--text-sm); line-height: 1.55; max-height: 60vh; overflow: auto; }
.page-body p { margin: 0 0 10px; }

/* ---- Phase 3 ---- */
.tipbox { position: fixed; margin: 0; inset: auto; max-width: 280px; padding: 8px 10px; border-radius: var(--radius-sm); background: hsl(var(--card)); color: hsl(var(--foreground)); border: 1px solid hsl(var(--border)); box-shadow: var(--shadow-2); font-size: .82rem; font-weight: 400; line-height: 1.4; text-transform: none; letter-spacing: 0; white-space: normal; pointer-events: none; opacity: 0; transition: opacity var(--t-fast) var(--ease); }
.tipbox:popover-open, .tipbox.on { opacity: 1; }
.tipbox::backdrop { display: none; }
details.adv { margin: 12px 0 4px; border: 1px solid hsl(var(--border)); border-radius: var(--radius); padding: 0 12px; background: hsl(var(--raised) / 0.3); }
details.adv > summary { cursor: pointer; padding: 9px 0; font-size: var(--text-xs); font-weight: 600; letter-spacing: .02em; color: hsl(var(--muted-foreground)); list-style: none; }
details.adv > summary::before { content: "▸"; display: inline-block; margin-right: 6px; transition: transform var(--t-fast) var(--ease); }
details.adv[open] > summary::before { transform: rotate(90deg); }
details.adv[open] { padding-bottom: 8px; }
h4.sec { margin: 22px 0 8px; font-size: var(--text-xs); letter-spacing: .1em; text-transform: uppercase; color: hsl(var(--primary)); display: flex; align-items: center; gap: 8px; }
h4.sec:first-child { margin-top: 0; }
/* The browser's own "Choose File" button is replaced by the app's (item 208, C5). */
input[type="file"]:not([hidden]) { font: inherit; font-size: var(--text-sm); color: hsl(var(--muted-foreground)); }
input[type="file"]:not([hidden])::file-selector-button { font: inherit; font-size: var(--text-sm); padding: 6px 12px; margin-right: 10px; border-radius: var(--radius-sm); border: 1px solid hsl(var(--border)); background: hsl(var(--raised)); color: hsl(var(--foreground)); cursor: pointer; }
input[type="file"]:not([hidden])::file-selector-button:hover { border-color: hsl(var(--primary) / 0.6); color: hsl(var(--primary)); }
.prov.mcard { flex-wrap: wrap; }
.prov .mmain { display: flex; flex-direction: column; min-width: 0; flex: 1 1 200px; gap: 2px; }
.prov .mmain .url { white-space: normal; }
.prov.sub { margin-left: 18px; padding: 6px 10px; background: transparent; }
.mlist { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.mchip { padding: 3px 9px; border-radius: 999px; border: 1px solid hsl(var(--border)); background: hsl(var(--raised)); font-size: var(--text-xs); color: hsl(var(--foreground)); }
.mchip:hover { border-color: hsl(var(--primary) / .6); }
.mchip.on { border-color: hsl(var(--primary)); background: hsl(var(--primary-soft)); }
.builtin { white-space: pre-wrap; font-size: var(--text-sm); padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid hsl(var(--border)); background: hsl(var(--raised) / .6); max-height: 160px; overflow: auto; }
.builtin.none { color: hsl(var(--muted-foreground)); font-style: italic; }
.inline-input { padding: 8px 10px; border-radius: var(--radius-sm); border: 1px solid hsl(var(--border)); background: hsl(var(--raised)); color: inherit; font-size: var(--text-sm); }
.dot.off { background: hsl(var(--faint-foreground)); }
.mark { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: hsl(var(--primary)); box-shadow: 0 0 0 3px hsl(var(--primary) / .25); margin-left: auto; }
.nav-item .mark { margin-left: auto; }
.settings-rail { display: flex; flex-direction: column; }
.rail-scroll { flex: 1 1 auto; overflow: auto; min-height: 0; }
.rail-foot { flex: 0 0 auto; padding: 10px 8px 2px; border-top: 1px solid hsl(var(--border)); font-size: var(--text-xs); color: hsl(var(--foreground)); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.rail-foot .mark { margin: 0; }
.cmp-out { margin-top: 10px; align-items: start; }
.cmp-box { min-height: 80px; max-height: 50vh; overflow: auto; padding: 10px; border: 1px solid hsl(var(--border)); border-radius: var(--radius-sm); background: hsl(var(--raised) / .4); font-size: var(--text-sm); }
.ask-text { font-size: var(--text-sm); white-space: pre-wrap; margin: 0 0 8px; }
.dlg textarea[name=vsystem] { width: 100%; margin-top: 4px; padding: 9px 10px; border-radius: var(--radius-sm); border: 1px solid hsl(var(--border)); background: hsl(var(--raised)); color: hsl(var(--foreground)); font-size: var(--text-sm); }
.dlg .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 640px) { .dlg .grid2 { grid-template-columns: 1fr; } }
.sidebar { width: var(--sidebar-w, 288px); }

/* ---- another computer opened from this device ---- */
.via-bar { display: flex; align-items: center; gap: 10px; padding: 6px 14px; font-size: var(--text-sm); background: hsl(var(--primary) / 0.14); border-bottom: 1px solid hsl(var(--primary) / 0.35); color: hsl(var(--foreground)); }
.via-bar span:nth-child(2) { flex: 1; min-width: 0; }
.via-bar .btn { white-space: nowrap; }
.node-line a { color: hsl(var(--primary)); }
@media (max-width: 820px) { .via-bar { padding: 6px 10px; font-size: .8rem; } .via-bar .wide-only { display: none; } }

/* links everywhere take the brand colour (the browser's default blue is unreadable on navy) */
a { color: hsl(var(--primary)); text-underline-offset: 2px; }
a:hover { color: hsl(var(--primary) / 0.8); }


/* ---- top bar: wing menu button, short locality badge and the ⋯ menu on a phone (0.4) ---- */
.topbar { z-index: 10; }
#chat-menu { left: auto; }
.wing-menu { width: 44px; }
.wing-menu .wing-svg { width: 32px; height: 11px; fill: currentColor; stroke: none; }
.wing-menu:hover .wing-svg { color: hsl(var(--primary)); }
#locality .short { display: none; }
#btn-chat-menu.no-chat { display: none; }
.menu.no-chat [data-chat] { display: none; }
.menu .m-only { display: none; }
@media (max-width: 820px) {
  /* The phone header (item 183) has two rows: the chat name with the buttons, then the people in
     the chat with a compact model button. Names wrap onto a second line rather than being cut. */
  .topbar { gap: 2px; padding: 4px 6px; flex-wrap: wrap; row-gap: 3px; }
  .title-wrap, .controls { display: contents; }
  #head-title { order: 1; flex: 1 1 0; min-width: 0; white-space: normal; overflow-wrap: anywhere; max-height: 2.6em; overflow-y: auto; line-height: 1.2; padding: 0 2px; }
  .set-hist { display: none; }
  #btn-tools, #btn-appearance, #btn-chat-menu, #btn-about, .topbar .me-btn, .topbar .avatar { order: 2; }
  #head-people { order: 5; flex: 1 1 0; min-width: 0; margin: 0; }
  #files-chip { order: 6; }
  #model-wrap { order: 7; margin-left: auto; max-width: 58vw; }
  #model-wrap .mp-btn { max-width: 58vw; padding: 5px 8px; min-height: 32px; font-size: .86rem; gap: 6px; }
  #model-wrap .mp-grp { max-width: 46%; }
  #locality { display: none; }
  #btn-appearance, #btn-about { display: none; }
  #btn-chat-menu.no-chat { display: grid; }
  .menu .m-only { display: block; }
  #locality { padding: 3px 7px; }
  #locality .long { display: none; }
  #locality .short { display: inline; }
  select { max-width: 120px; }
  #chat-menu { right: 8px; top: 48px; }
}
.me-pic-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.avatar.me { object-fit: cover; }
.menu.no-agent [data-agent] { display: none; }
#agent-grants.flash { animation: grants-flash 1.2s var(--ease) 1; border-radius: var(--radius-sm); }
@keyframes grants-flash { 0% { box-shadow: 0 0 0 2px hsl(var(--primary) / 0.7); } 100% { box-shadow: 0 0 0 2px transparent; } }
@media (max-width: 820px) { #btn-tools { display: none; } }
.switch-list { display: flex; flex-direction: column; gap: 2px; padding: 4px 6px 0; }
.switch-btn { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--radius-sm); font-size: var(--text-sm); color: hsl(var(--muted-foreground)); text-align: left; }
.switch-btn:hover { background: hsl(var(--raised)); color: hsl(var(--foreground)); }
.approval { margin: 6px 0; padding: 10px 12px; border: 1px solid hsl(var(--primary) / 0.45); border-radius: var(--radius-sm); background: hsl(var(--primary) / 0.08); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: var(--text-sm); animation: slide-up var(--t-base) var(--ease) both; }
.approval .ap-text { flex: 1; min-width: 200px; }
.approval .ap-actions { display: flex; gap: 8px; }

/* ---- family signature and legal pages (SOP-009 §12, BORN App Finishing Standard §3–5) ---- */
.family { margin-top: 14px; text-align: center; font-size: var(--text-xs); color: hsl(var(--faint-foreground)); line-height: 1.7; }
.family p { margin: 0; }
.family-line a { color: hsl(var(--foreground)); text-decoration: none; font-weight: 600; white-space: nowrap; }
.family-line a:hover { color: hsl(var(--primary)); }
.foil { display: inline-block; width: 2.3em; height: 0.62em; margin: 0 0.35em 0 0.25em; vertical-align: -0.02em; background: hsl(var(--primary)); -webkit-mask: url(brand/airborn-foil.png) center / contain no-repeat; mask: url(brand/airborn-foil.png) center / contain no-repeat; }
.family-links a { color: hsl(var(--muted-foreground)); text-decoration: none; letter-spacing: .04em; text-transform: uppercase; font-size: .92em; }
.family-links a:hover { color: hsl(var(--primary)); }
.family-copy { font-size: .9em; opacity: .8; }
.about-more { margin-top: 10px; }
.legal { line-height: 1.6; font-size: var(--text-sm); }
.legal h2 { font-size: var(--text-lg); margin: 0 0 4px; }
.legal h3 { font-size: var(--text-md); margin: 18px 0 6px; color: hsl(var(--primary)); }
.legal p, .legal li { color: hsl(var(--muted-foreground)); }
.legal b { color: hsl(var(--foreground)); }
.legal-meta { font-size: var(--text-xs); color: hsl(var(--faint-foreground)) !important; }
.contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 14px 0; }
.contact-card { background: hsl(var(--raised)); border: 1px solid hsl(var(--border)); border-radius: var(--radius); padding: 14px 16px; }
.contact-card h3 { margin: 0 0 4px; font-size: var(--text-sm); }
.contact-card p { margin: 2px 0; }
.contact-all { font-weight: 600; }
#page-body .legal > h2 { display: none; }
.inv-list { display: grid; gap: 6px; margin: 6px 0 10px; }
.inv-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---- Layout safety (SOP-009 §11 rule 27, checked by scripts/layout-gate.py on every build) ----
   Nothing leaves its box: long words, links and error text wrap inside their bubble; code and
   tables scroll sideways inside their own frame; rows of buttons wrap under the name instead of
   running off the edge. Every screen reaches its end: dialogs fit the visible screen (dvh, which
   follows the phone's address bar and keyboard) and scroll inside themselves. */
body { overflow-wrap: break-word; }
.messages { overflow-x: hidden; }
.msg { min-width: 0; }
.msg > div { min-width: 0; max-width: 100%; }
.msg .bubble { max-width: 100%; overflow-wrap: anywhere; }
.msg .bubble pre { max-width: 100%; overflow-x: auto; }
.md table { display: block; max-width: 100%; overflow-x: auto; }
.md img { max-width: 100%; height: auto; }
:where(input, select, textarea) { max-width: 100%; }  /* zero weight: the sized pickers above keep their width */
.dlg { max-height: 88vh; max-height: calc(100dvh - 6dvh - 12px); max-width: calc(100vw - 16px); }
.dlg .about-small, .dlg p, .dlg label, .pane-body { overflow-wrap: anywhere; }
.prov { flex-wrap: wrap; min-width: 0; }
.prov .name { min-width: 0; overflow-wrap: anywhere; }
.prov .actions { flex-wrap: wrap; margin-left: auto; }
.prov .actions .btn { white-space: nowrap; }
.kv > div { min-width: 0; }
@media (max-width: 820px) {
  .dlg.settings { margin: 0; inset: 0; width: 100vw; max-width: 100vw; height: 100vh; height: 100dvh; max-height: 100vh; max-height: 100dvh; }
  .prov .actions { flex-basis: 100%; margin-left: 0; }
  .prov .actions .btn { white-space: normal; }
  /* On the phone a dialog's buttons share the row and grow with their words; when they do not fit
     side by side they take a row each (fix-queue item 24, SOP-009 §11.46). */
  .dlg menu .btn { flex: 1 1 140px; }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
  .kv > .k { margin-top: 8px; }
}

/* ---- devices, approval, where a chat lives (SOP-009 §11.31, §14) ---- */
.ap-number { font-family: var(--font-body, system-ui, sans-serif); font-weight: 700; font-variant-numeric: tabular-nums; font-size: 3.2rem; letter-spacing: .2em; text-align: center; color: hsl(var(--primary)); margin: 8px 0 4px; }
.inline-select { display: inline-block !important; width: auto !important; margin: 0 2px !important; padding: 3px 26px 3px 8px !important; }
.dev { align-items: flex-start; }
.dev .dev-main { flex: 1 1 220px; min-width: 0; }
.dev .dev-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dev.faded { opacity: .62; }
.tip.where { width: 9px; height: 9px; border: 0; margin: 0 8px 0 0; vertical-align: 1px; cursor: help; font-size: 0; }
.tip.where.ok { background: hsl(var(--success)); box-shadow: 0 0 0 3px hsl(var(--success) / .18); }
.tip.where.off { background: hsl(var(--faint-foreground)); }
#head-title.renamable { cursor: text; }
.away-dot { width: 7px; height: 7px; border-radius: 50%; background: hsl(var(--faint-foreground)); flex: none; margin-left: 6px; }
.nav-item .x.ren, .menu .menu-item .x.ren { margin-left: auto; }
.nav-item .x.ren + .x { margin-left: 0; }
.nav-item .x.ren:hover, .menu .menu-item .x.ren:hover { background: hsl(var(--primary-soft)); color: hsl(var(--primary)); }
.menu .menu-item .x { opacity: 0; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 6px; color: hsl(var(--muted-foreground)); flex: none; }
.menu .menu-item:hover .x, .menu .menu-item:focus-within .x { opacity: 1; }
.menu .menu-item .x svg { width: 14px; height: 14px; }
.msg.notice .bubble { background: hsl(var(--raised)); border: 1px dashed hsl(var(--border-strong)); }

.nav-item .x.ren:hover { background: hsl(var(--primary) / 0.18); color: hsl(var(--primary)); }
@media (hover: none) { .nav-item.active .x { opacity: .85; } }
.err-line { color: hsl(var(--danger)); margin-top: 4px; }
.err-line:empty { display: none; }
/* Scrolling areas: a soft fade at the bottom edge while there is more below; it lifts at the end, so the
   end of a list is plain to see. Background-agnostic: a mask, not a coloured overlay. */
.scroll-more-below { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 36px), transparent); }
.side-scroll, .rail-scroll, .pane-body, #view-home { scroll-padding-bottom: 24px; }
.pane-body::after, .rail-scroll::after, .side-scroll::after { content: ""; display: block; height: 18px; }
/* Sidebar device list: switch, plus a small sign-out button beside each device. */
.switch-row { display: flex; align-items: center; gap: 2px; }
.switch-row .switch-btn { flex: 1 1 auto; min-width: 0; }
.icon-btn.xs { width: 26px; height: 26px; padding: 5px; }
.dev-out { opacity: .55; }
.switch-row:hover .dev-out, .dev-out:focus-visible { opacity: 1; }
@media (hover: none) { .dev-out { opacity: .8; } }
.pick-list { display: flex; flex-direction: column; max-height: 260px; overflow: auto; }
/* Ability and authority lists: the name on its line, the summary under it (never squeezed side by side). */
.grants label { align-items: flex-start; }
.grants label input { margin-top: 3px; flex: 0 0 auto; }
.g-text { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 560px) { .grants { grid-template-columns: 1fr; } }
.badge { white-space: nowrap; flex: 0 0 auto; }

/* A download on its line: bar, amount, percentage and speed, then Pause (fix-queue item 21). */
.prov .actions { align-items: center; }
.dl-live { display: inline-flex; flex-direction: column; min-width: 170px; max-width: 260px; flex: 1 1 170px; }
.dl-live .pbar { margin: 2px 0 3px; }
.dl-live .dl-t, .dl-why { font-variant-numeric: tabular-nums; }
.dl-why { max-width: 260px; }

/* Buttons grow with their words instead of letting them spill (fix-queue item 24, SOP-009 §6). */
.btn { overflow-wrap: anywhere; }

/* Checkboxes and radio buttons big enough to hit with a thumb; the whole label row is the target
   (fix-queue item 25, SOP-009 §6). */
input[type="checkbox"], input[type="radio"] { appearance: none; -webkit-appearance: none; flex: none; width: 22px; height: 22px; margin: 0; padding: 0; border: 2px solid hsl(var(--border-strong)); border-radius: 6px; background: hsl(var(--surface)); display: inline-grid; place-content: center; cursor: pointer; vertical-align: middle; transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease); }
input[type="radio"] { border-radius: 50%; }
input[type="checkbox"]::before { content: ""; width: 12px; height: 12px; transform: scale(0); background: hsl(var(--primary-foreground)); clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%); transition: transform var(--t-fast) var(--ease); }
input[type="radio"]::before { content: ""; width: 10px; height: 10px; border-radius: 50%; transform: scale(0); background: hsl(var(--primary-foreground)); transition: transform var(--t-fast) var(--ease); }
input[type="checkbox"]:checked, input[type="radio"]:checked { background: hsl(var(--primary)); border-color: hsl(var(--primary)); }
input[type="checkbox"]:checked::before, input[type="radio"]:checked::before { transform: scale(1); }
input[type="checkbox"]:hover:not(:disabled), input[type="radio"]:hover:not(:disabled) { border-color: hsl(var(--primary)); }
input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible { outline: none; box-shadow: 0 0 0 3px hsl(var(--primary) / 0.35); }
input[type="checkbox"]:disabled, input[type="radio"]:disabled { opacity: 0.45; cursor: default; }
label.check { display: flex; align-items: center; gap: 10px; min-height: 40px; cursor: pointer; }
label.check:has(input:disabled) { cursor: default; }
@media (max-width: 820px) {
  input[type="checkbox"], input[type="radio"] { width: 24px; height: 24px; }
  input[type="checkbox"]::before { width: 13px; height: 13px; }
  label.check { min-height: 44px; }
}

/* Small icon buttons keep their size when a long title shares the row; the thumbs under a reply
   are a thumb's size on the phone (layout gate: too small to tap). */
.icon-btn { flex: none; }
@media (max-width: 820px) { .fb-btn { min-width: 32px; min-height: 32px; display: inline-grid; place-items: center; } }

/* Your devices in the sidebar: every signed-in device, this one first (fix-queue item 27). */
.dev-head { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .08em; color: hsl(var(--faint-foreground)); padding: 6px 8px 2px; }
.switch-btn.static { cursor: default; }
.switch-btn.static:hover { background: transparent; color: hsl(var(--muted-foreground)); }
.switch-btn .dev-ico { display: inline-grid; flex: none; }
.switch-btn .dev-ico svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.switch-btn .dev-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switch-btn .dev-tag { flex: none; margin-left: auto; font-size: var(--text-xs); color: hsl(var(--faint-foreground)); }
.switch-row.off .switch-btn { color: hsl(var(--faint-foreground)); }
.switch-btn .dot { flex: none; }
.dev-err { font-size: var(--text-xs); color: hsl(var(--warning)); padding: 4px 8px; overflow-wrap: anywhere; }

/* Files held over the chat: the whole chat is the drop target (fix-queue item 22). */
#main { position: relative; }
body.dropping #main::after { content: "Drop to attach to your message"; position: absolute; inset: 10px; z-index: 40; display: grid; place-items: center; border: 2px dashed hsl(var(--primary)); border-radius: var(--radius-lg); background: hsl(var(--primary) / 0.10); color: hsl(var(--foreground)); font-weight: 600; font-size: var(--text-md); pointer-events: none; }

/* Question cards from the agent and the interview switch (Fix Queue item 34). */
#btn-interview.on { color: hsl(var(--primary)); background: hsl(var(--primary-soft)); }
.ask-card { margin: 8px 0; padding: 12px; border: 1px solid hsl(var(--border)); border-radius: var(--radius-sm); background: hsl(var(--raised) / 0.6); display: grid; gap: 14px; animation: slide-up var(--t-base) var(--ease) both; }
.ask-q { display: grid; gap: 8px; }
.ask-text { font-weight: 600; line-height: 1.45; }
.ask-opts { display: grid; gap: 6px; }
.ask-opt { display: grid; gap: 2px; text-align: left; padding: 9px 12px; min-height: 44px; border: 1px solid hsl(var(--border)); border-radius: var(--radius-sm); background: hsl(var(--background)); color: hsl(var(--foreground)); cursor: pointer; transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease); }
.ask-opt:hover { border-color: hsl(var(--primary)); }
.ask-opt.on { border-color: hsl(var(--primary)); background: hsl(var(--primary-soft)); }
.ask-label { font-weight: 500; }
.ask-desc { font-size: var(--text-sm); color: hsl(var(--muted-foreground)); line-height: 1.4; }
.ask-other { display: flex; gap: 6px; flex-wrap: wrap; }
.ask-send { justify-self: start; }
.ask-card.done { opacity: .6; }
.ask-card.done .ask-opt, .ask-card.done .ask-other, .ask-card.done .ask-send { pointer-events: none; }
.ask-card.done .ask-other, .ask-card.done .ask-send { display: none; }

/* Model cards on Get models and in the library search (Fix Queue item 11): the name on its own line,
   what the model can do as small icons with words, then the description, then size and the button. */
.mcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 10px; margin: 6px 0 12px; }
.mcards.one { grid-template-columns: 1fr; }
.mcard { display: flex; flex-direction: column; gap: 7px; padding: 12px 14px; border: 1px solid hsl(var(--border)); border-radius: var(--radius); background: hsl(var(--raised) / 0.45); min-width: 0; transition: border-color var(--t-fast) var(--ease); }
.mcard:hover { border-color: hsl(var(--primary) / 0.55); }
.mcard-top { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; min-width: 0; }
.mcard-title { font-weight: 600; font-size: 1rem; white-space: normal; overflow-wrap: anywhere; flex: 0 1 auto; min-width: 0; }
.mcard-fit { margin-left: auto; flex: none; }
.mcard-note:empty { display: none; }
.mcard-caps { display: flex; flex-wrap: wrap; gap: 5px; }
.mcard-caps:empty { display: none; }
.cap { display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px 2px 5px; border-radius: 999px; font-size: .74rem; color: hsl(var(--muted-foreground)); background: hsl(var(--background) / 0.7); border: 1px solid hsl(var(--border)); cursor: help; }
.cap svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.mcard-blurb { color: hsl(var(--muted-foreground)); line-height: 1.45; font-size: var(--text-sm); flex: 1; }
.mcard-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: space-between; }
.mcard-foot .actions { margin-left: auto; }
.mcard .hub-files:empty { display: none; }

/* One card layout for the whole app (item 91, SOP-009 rule 52). Line 1: the name and its status. Line 2:
   what it can do. Then two lines of description, a facts line, and one row of at most three buttons on the
   right; everything else is behind Details. Cards in one grid share their rows, so they line up without
   an empty middle. */
.ucards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; margin: 6px 0 14px; align-items: start; }
.ucard { display: grid; grid-row: span 5; grid-template-rows: subgrid; row-gap: 6px; padding: 12px 14px; border: 1px solid hsl(var(--border)); border-radius: var(--radius); background: hsl(var(--raised) / 0.45); min-width: 0; transition: border-color var(--t-fast) var(--ease); }
@supports not (grid-template-rows: subgrid) { .ucard { display: flex; flex-direction: column; gap: 6px; } }
.ucard:hover { border-color: hsl(var(--primary) / 0.55); }
.ucard.faded { opacity: .72; }
.ucard-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ucard-title { font-weight: 600; font-size: 1rem; white-space: normal; overflow-wrap: anywhere; min-width: 0; flex: 1 1 auto; } /* a name is never cut off (item 183) */
.ucard-badges { display: flex; gap: 5px; flex: none; margin-left: auto; }
.ucard-caps { display: flex; flex-wrap: wrap; gap: 5px; align-content: start; min-width: 0; }
.ucard-blurb { color: hsl(var(--muted-foreground)); font-size: var(--text-sm); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-width: 0; }
.ucard-facts { font-size: var(--text-xs); color: hsl(var(--muted-foreground)); white-space: normal; min-width: 0; } /* the licence and memory lines wrap instead of being cut (item 195) */
.ucard-foot { display: flex; align-items: center; gap: 8px; min-height: 32px; min-width: 0; }
.ucard-note { font-size: var(--text-xs); color: hsl(var(--muted-foreground)); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ucard-foot .actions { display: flex; gap: 6px; flex-wrap: nowrap; margin-left: auto; flex: none; }
.badge.choice { background: hsl(var(--primary) / 0.14); color: hsl(var(--primary)); border: 1px solid hsl(var(--primary) / 0.4); }
/* Default models (item 145): the account's choices and each device's own. */
.defaults-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 6px 0 4px; }
.defaults-row label { display: grid; gap: 4px; font-size: var(--text-xs); font-weight: 600; color: hsl(var(--muted-foreground)); }
.defaults-row select { max-width: none; width: 100%; }
@media (max-width: 820px) { .defaults-row { grid-template-columns: 1fr; } }

/* Deleting an agent or project (Fix Queue item 26). */
#dlg-delete { width: min(560px, 94vw); }
.del-quick { margin: 0 0 6px; align-items: center; }
.del-h { margin: 14px 0 6px; font-size: var(--text-sm); color: hsl(var(--muted-foreground)); font-weight: 600; }
.del-list { display: grid; gap: 4px; max-height: 38vh; overflow: auto; padding-right: 2px; }
.del-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--radius-sm); background: hsl(var(--raised) / 0.45); }
.del-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.del-row select { flex: none; max-width: 52%; }
.del-mem { margin-top: 12px; display: flex; align-items: center; gap: 8px; }
.del-summary { margin: 14px 0 4px; padding: 10px 12px; border-radius: var(--radius-sm); background: hsl(var(--danger) / 0.1); border: 1px solid hsl(var(--danger) / 0.35); font-weight: 500; }
#dlg-agent-delete { margin-right: auto; }
@media (max-width: 600px) { .del-row { flex-wrap: wrap; } .del-row select { max-width: 100%; width: 100%; } }

/* Whose folders a chat from another computer uses on this device (Fix Queue item 8). */
.files-chip { font-size: .78rem; padding: 4px 10px; min-height: 32px; border-radius: 999px; border: 1px solid hsl(var(--border)); background: hsl(var(--raised) / 0.6); color: hsl(var(--muted-foreground)); cursor: pointer; white-space: nowrap; }
.files-chip:hover { color: hsl(var(--foreground)); border-color: hsl(var(--primary) / 0.6); }
@media (max-width: 820px) { .files-chip { max-width: 34vw; overflow: hidden; text-overflow: ellipsis; } }

/* VR Office, coming soon (Fix Queue item 17). */
.vr-soon { display: grid; gap: 10px; max-width: 720px; }
.vr-hero { position: relative; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 9; background: hsl(var(--raised)); }
.vr-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vr-badge { position: absolute; top: 10px; left: 10px; }
.vr-thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.vr-thumb { padding: 0; border: 2px solid transparent; border-radius: var(--radius-sm); overflow: hidden; aspect-ratio: 16 / 9; cursor: pointer; background: none; min-height: 44px; }
.vr-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: .75; }
.vr-thumb.on { border-color: hsl(var(--primary)); }
.vr-thumb.on img, .vr-thumb:hover img { opacity: 1; }
.vr-cap { margin: 0; font-size: var(--text-sm); color: hsl(var(--muted-foreground)); }
.vr-soon .vr-title { margin: 10px 0 0; font-family: inherit; font-size: 1.15rem; font-weight: 600; line-height: 1.35; letter-spacing: normal; text-transform: none; color: hsl(var(--foreground)); }
.vr-soon p { margin: 4px 0; }
.vr-list { margin: 0; padding-left: 20px; display: grid; gap: 4px; line-height: 1.5; }
.vr-world { font-weight: 600; margin: 4px 0; }

/* The manual inside the app (Fix Queue item 35). */
.man-toc { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 0 0 14px; padding-bottom: 10px; border-bottom: 1px solid hsl(var(--border)); font-size: var(--text-sm); }
.man-toc a { color: hsl(var(--primary)); text-decoration: none; }
.man h1 { font-size: 1.4rem; margin-top: 0; }
.man h2 { font-size: 1.12rem; margin-top: 22px; scroll-margin-top: 8px; }
.man h3 { font-size: 1rem; margin-top: 16px; }
.man p, .man li { line-height: 1.55; }
/* Load from file (item 29): files in the picker show their size at the right. */
.pick-file .about-small { margin-left: auto; padding-left: 10px; white-space: nowrap; }
/* Interview cards (item 34): tuck away to read the chat above; a full box for your own answer, with the microphone. */
.ask-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ask-card.tucked { gap: 0; padding: 8px 12px; }
.ask-card.tucked > :not(.ask-head) { display: none; }
.ask-other { flex-direction: column; align-items: stretch; }
.ask-other textarea { width: 100%; min-height: 76px; resize: vertical; font: inherit; font-size: var(--text-sm); line-height: 1.45; padding: 9px 10px; border-radius: var(--radius-sm); border: 1px solid hsl(var(--border)); background: hsl(var(--raised)); color: hsl(var(--foreground)); }
.ask-other textarea:focus { outline: none; border-color: hsl(var(--primary) / 0.6); box-shadow: 0 0 0 3px hsl(var(--primary) / 0.2); }
.ask-other-actions { display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
.ask-card.done .ask-tuck { display: none; }

/* Helper text under a field: faint, no box (item 50). Links to other pages read "Settings › Page". */
.helper { font-size: var(--text-xs); color: hsl(var(--faint-foreground)); margin: 2px 0 8px; line-height: 1.45; }
.set-link { color: hsl(var(--primary)); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }

/* Cloud service cards (item 52): one card per service, a row per key, chips one row until "Show all". */
.svc-card .svc-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.svc-card .svc-head .actions { margin-left: auto; }
.svc-card .svc-key { margin-top: 10px; padding-top: 10px; border-top: 1px solid hsl(var(--border) / .7); padding-left: 14px; }
.svc-card .keyhead { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.svc-card .keyhead .actions { margin-left: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.mlist.collapsed { max-height: 30px; overflow: hidden; }
.link-btn { display: inline-block; white-space: nowrap; min-width: max-content; background: none; border: 0; padding: 4px 0; color: hsl(var(--primary)); font-size: var(--text-xs); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.check.sm { font-size: var(--text-xs); min-height: 0; }

/* A save in progress (item 71): the button stays pressed until the change is shown. */
button.saving { cursor: progress; opacity: .75; }
/* A failed install says why and offers Try again (item 57). */
.install-fail { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--danger, #d33) 10%, transparent); }
.install-fail span { flex: 1 1 240px; }
/* Picture, video and music models as cards that open their full information (item 64). */
.media-card { cursor: pointer; }
.media-card:focus-visible { outline: 2px solid hsl(var(--primary) / .6); outline-offset: 2px; }
.media-kind + .media-kind { margin-top: 6px; }
.inline-label { display: inline-flex; align-items: center; gap: 8px; font-size: var(--text-sm); color: hsl(var(--muted-foreground)); }
.inline-label select { width: auto; }
.info-body { max-height: min(70vh, 640px); overflow: auto; }
.info-body .kv { margin: 10px 0; }
.info-body textarea { width: 100%; }
.try-out { margin-top: 10px; }
.try-out img, .try-out video { max-width: 100%; border-radius: var(--radius); display: block; }
.try-out audio { width: 100%; }
/* The model menu (item 72): a button that opens folding groups, one per service or computer. */
select.mp-native { position: absolute !important; width: 1px !important; height: 1px !important; opacity: 0 !important; pointer-events: none !important; margin: 0 !important; padding: 0 !important; border: 0 !important; }
.mp-btn { display: inline-flex; align-items: center; gap: 8px; min-width: 0; max-width: 280px; padding: 7px 10px; border-radius: var(--radius-sm); border: 1px solid hsl(var(--border)); background: hsl(var(--raised)); color: hsl(var(--foreground)); font-size: var(--text-sm); cursor: pointer; text-align: left; }
.mp-btn:hover { border-color: hsl(var(--border-strong)); }
.mp-btn:focus-visible { outline: none; border-color: hsl(var(--primary) / .6); box-shadow: 0 0 0 3px hsl(var(--primary) / .2); }
.mp-btn[aria-expanded=true] { border-color: hsl(var(--primary) / .6); }
.mp-cur { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.mp-grp { color: hsl(var(--muted-foreground)); font-size: .76rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40%; }
.mp-down { width: 14px; height: 14px; flex: none; margin-left: auto; fill: none; stroke: currentColor; stroke-width: 2; opacity: .7; }
.dlg .mp-btn, .kv .mp-btn { display: flex; width: 100%; max-width: none; margin-top: 5px; padding: 9px 10px; }
.mp-pop { position: fixed; z-index: 300; overflow: auto; padding: 6px; border-radius: var(--radius); border: 1px solid hsl(var(--border)); background: hsl(var(--card)); box-shadow: 0 12px 32px hsl(0 0% 0% / .35); animation: fade-in 120ms ease both; }
.mp-q { width: 100%; margin: 0 0 6px; padding: 8px 10px; border-radius: var(--radius-sm); border: 1px solid hsl(var(--border)); background: hsl(var(--background)); color: inherit; font-size: var(--text-sm); }
.mp-gh { display: flex; align-items: center; gap: 6px; width: 100%; padding: 8px 8px; border: 0; background: none; color: hsl(var(--foreground)); font-weight: 600; font-size: var(--text-sm); cursor: pointer; border-radius: var(--radius-sm); text-align: left; }
.mp-gh:hover, .mp-gh:focus-visible { background: hsl(var(--primary-soft)); outline: none; }
.mp-gh svg { width: 14px; height: 14px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; transition: transform var(--t-fast, 120ms) ease; }
.mp-g.open > .mp-gh svg { transform: rotate(90deg); }
.mp-n { margin-left: auto; color: hsl(var(--muted-foreground)); font-weight: 500; font-size: .76rem; }
.mp-items { display: none; padding: 2px 0 4px 20px; }
.mp-g.open > .mp-items { display: block; }
.mp-pop > .mp-item { margin-bottom: 2px; }
.mp-item { display: flex; align-items: center; gap: 6px; width: 100%; padding: 7px 8px; border: 0; background: none; color: hsl(var(--foreground)); font-size: var(--text-sm); text-align: left; cursor: pointer; border-radius: var(--radius-sm); }
.mp-item:hover, .mp-item:focus-visible { background: hsl(var(--primary-soft)); outline: none; }
.mp-item.on { font-weight: 600; color: hsl(var(--primary)); }
.mp-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.mp-tag { flex: none; font-size: .7rem; color: hsl(var(--muted-foreground)); border: 1px solid hsl(var(--border)); border-radius: 999px; padding: 1px 6px; }
.mp-note { display: block; padding: 6px 8px; color: hsl(var(--muted-foreground)); font-size: .8rem; line-height: 1.4; }
a.mp-note { color: hsl(var(--primary)); }
@media (max-width: 760px) { .mp-btn { max-width: 52vw; } .mp-item, .mp-gh { min-height: 44px; } }
/* How full the chat is (item 78). */
.ctx-meter { display: inline-flex; align-items: center; gap: 6px; font-size: .74rem; color: hsl(var(--muted-foreground)); cursor: help; white-space: nowrap; }
.ctx-bar { width: 46px; height: 5px; border-radius: 999px; background: hsl(var(--border)); overflow: hidden; }
.ctx-bar i { display: block; height: 100%; background: hsl(var(--primary)); border-radius: inherit; transition: width .3s ease; }
.ctx-meter.warn { color: hsl(var(--warning, 36 92% 55%)); }
.ctx-meter.warn .ctx-bar i { background: hsl(var(--warning, 36 92% 55%)); }
.ctx-meter.full { color: hsl(var(--danger)); }
.ctx-meter.full .ctx-bar i { background: hsl(var(--danger)); }
/* Moving a chat (item 77). */
.move-list { display: flex; flex-direction: column; gap: 2px; }
.move-agent { margin: 10px 0 2px; font-size: .74rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: hsl(var(--primary)); }
.move-row { display: block; width: 100%; text-align: left; padding: 9px 10px; border: 0; border-radius: var(--radius-sm); background: none; color: hsl(var(--foreground)); font-size: var(--text-sm); cursor: pointer; }
.move-row:hover:not(:disabled), .move-row:focus-visible { background: hsl(var(--primary-soft)); outline: none; }
.move-row:disabled { cursor: default; opacity: 1; background: hsl(var(--primary-soft) / .5); }
.move-none { padding: 4px 10px; }
.prov .dup-note { flex-basis: 100%; order: 9; color: hsl(var(--warning, 36 92% 55%)); }
.warn-line { color: hsl(var(--warning, 36 92% 55%)); margin-top: 6px; }
.skill-agents { display: flex; flex-wrap: wrap; gap: 0 18px; margin-bottom: 6px; }
/* Cloud service cards on Your models (item 65): the same frame as the model cards, laid out for keys. */
.svc-card { padding: 12px 14px; border: 1px solid hsl(var(--border)); border-radius: var(--radius); background: hsl(var(--raised) / 0.45); margin: 6px 0 12px; }
.mcard .mlist { display: flex; flex-wrap: wrap; gap: 6px; }
.mcard-foot .actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; align-items: center; }

/* Menus never cut their own words (item 63): a menu on a settings page is as wide as its longest choice,
   up to the width of the page. */
#settings-body select { max-width: 100%; width: auto; min-width: 12ch; }
#settings-body .kv select, #settings-body label > select { max-width: min(100%, 520px); }
/* The app's own note for a field that still needs filling in, in place of the browser's bubble. */
.field-need { display: block; margin-top: 4px; font-size: .8rem; color: hsl(var(--danger)); }
input.need, select.need, textarea.need { border-color: hsl(var(--danger)) !important; }
/* The Send button keeps its word whole on a phone; the fullness bar gives way first (layout gate, 18 Nov). */
.composer-row .send { flex: none; margin-left: auto; }
.composer-row .ctx-meter { flex: 0 1 auto; min-width: 0; }
@media (max-width: 760px) { .ctx-meter .ctx-text { display: none; } .ctx-bar { width: 30px; } .rec-time { font-size: .72rem; } }
/* 0.4.8: two labels on a picture card sit apart; Try it is an ordinary button in line with the menu beside it. */
.cap + .cap { margin-left: 4px; }
.media-kind > .row-actions { align-items: flex-end; }
.media-kind > .row-actions > [data-try] { align-self: flex-end; height: auto; }
/* A message about a control sits beside that control (items 118, 120). */
.form-error { color: hsl(var(--danger)); font-size: var(--text-sm); margin: 4px 0 0; }
.beside-note { font-size: var(--text-sm); color: hsl(var(--muted-foreground)); margin-left: 8px; }
.beside-note.ok { color: hsl(var(--success)); }
.beside-note.bad { color: hsl(var(--danger)); }
.beside-out { margin: 4px 0 10px 12px; }
.beside-out:empty { display: none; }

/* Storage page (item 103): a quiet line of notice, and a figure that needs attention. */
.notice-line { margin: 10px 0; padding: 8px 12px; border-radius: 8px; background: hsl(var(--warning, 36 92% 55%) / .12); border: 1px solid hsl(var(--warning, 36 92% 55%) / .4); font-size: 13px; }
.kv b.bad { color: hsl(var(--danger)); }

/* Compaction marker (item 79): a labelled line across the chat; open it to read the summary. */
.summary-mark { margin: 14px 0; }
.summary-mark > summary { display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; font-size: var(--text-xs); color: hsl(var(--muted-foreground)); }
.summary-mark > summary::-webkit-details-marker { display: none; }
.summary-mark .line { flex: 1; height: 1px; background: hsl(var(--border)); }
.summary-mark .words::after { content: " · show"; }
.summary-mark[open] .words::after { content: " · hide"; }
.summary-text { margin: 8px auto 0; max-width: 720px; padding: 10px 14px; border: 1px dashed hsl(var(--border)); border-radius: 10px; font-size: var(--text-sm); color: hsl(var(--muted-foreground)); }

/* Several agents in one chat (item 80): small bubbles under the title, and the picker beside Send. */
.people { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 2px; }
.person { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px 2px 3px; border-radius: 999px; background: hsl(var(--raised)); border: 1px solid hsl(var(--border)); font-size: var(--text-xs); color: hsl(var(--muted-foreground)); }
.person .avatar.xs, .person .letter.xs { width: 18px; height: 18px; font-size: 10px; }
.person-out { margin: 0 -3px 0 1px; width: 18px; height: 18px; border-radius: 999px; font-size: 14px; line-height: 1; color: hsl(var(--muted-foreground)); background: transparent; }
/* On a phone the × is a full tap target (layout gate: at least 24 x 24 px). */
@media (max-width: 820px) { .person-out { width: 28px; height: 28px; margin: 0 -6px 0 0; font-size: 16px; } }
.person-out:hover { background: hsl(var(--danger) / 0.15); color: hsl(var(--danger)); }
.person.add { cursor: pointer; padding: 2px 9px; background: transparent; border-style: dashed; color: hsl(var(--muted-foreground)); font: inherit; font-size: var(--text-xs); }
.person.add:hover { color: hsl(var(--foreground)); border-color: hsl(var(--border-strong)); }
.speaker select { font: inherit; font-size: var(--text-sm); padding: 4px 26px 4px 8px; max-width: 170px; }
/* Phones: the people row scrolls sideways on one line, the invite button keeps a short label, the
   composer row may wrap and the typing box leaves room for it. */
.person.add .short { display: none; }
@media (max-width: 820px) {
  .speaker-word { display: none; } .speaker select { max-width: 112px; padding: 4px 24px 4px 6px; } .enter-send { display: none; }
  .composer-row { gap: 6px; flex-wrap: wrap; } #input { max-height: 28vh; }
  .people { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; } .people::-webkit-scrollbar { display: none; }
  .person { flex: none; white-space: nowrap; } /* a name is never cut off (item 183): the row scrolls instead */
  .person.add .long { display: none; } .person.add .short { display: inline; }
}

/* A settings snippet shown once (Connect an app, item 105). */
.inline-pre { margin: 8px 0; padding: 10px 12px; border-radius: var(--radius-sm); background: hsl(var(--raised)); border: 1px solid hsl(var(--border)); font-family: var(--font-mono); font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }

/* VR Office agent rows in one layout (item 129, F-35): name, office name, status, always in the same three columns. */
.prov.office-row { display: grid; grid-template-columns: minmax(0, 1fr) 10em minmax(11em, auto); align-items: center; gap: 10px; }
.prov.office-row .actions { justify-content: flex-end; }

/* The square for the authenticator app (item 133). */
.qr { width: 200px; height: 200px; margin: 8px 0; background: #fff; padding: 6px; border-radius: 8px; }
.qr svg { width: 100%; height: 100%; display: block; }

/* The two-step box keeps its heading clear of the row above it (first-child h4 has no top margin). */
#acct-2fa { margin-top: 16px; }

/* Help and feedback (item 165): one quiet button in the lower right corner of every screen. */
.help-fab { position: fixed; right: 16px; bottom: calc(env(safe-area-inset-bottom) + 16px); z-index: 20; width: 38px; height: 38px; border-radius: 50%; border: 1px solid hsl(var(--border-strong)); background: hsl(var(--surface) / 0.9); color: hsl(var(--primary)); font: 700 1rem var(--font-display); cursor: pointer; box-shadow: var(--shadow-1); backdrop-filter: blur(8px); transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease); }
.help-fab:hover { transform: translateY(-1px); box-shadow: var(--glow); }
@media (max-width: 820px) { .help-fab { right: 12px; bottom: calc(env(safe-area-inset-bottom) + 84px); width: 34px; height: 34px; } }
.help-pic { max-width: 100%; border: 1px solid hsl(var(--border)); border-radius: var(--radius); margin-top: 6px; }
.help-mic.on { color: hsl(var(--danger)); animation: rec-glow 1.2s ease-in-out infinite; }

/* ---- Help and feedback: speaking is the main way in (item 218) ---- */
.help-rec { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 14px 0 4px; padding: 18px 12px; border-radius: var(--radius-lg); background: hsl(var(--raised)); border: 1px solid hsl(var(--border)); }
.help-rec-btn { display: inline-flex; align-items: center; justify-content: center; gap: 12px; min-width: min(320px, 100%); min-height: 64px; padding: 14px 26px; border-radius: 999px; border: 2px solid hsl(var(--primary) / .6); background: hsl(var(--primary) / .14); color: hsl(var(--foreground)); font-size: 1.08rem; font-weight: 700; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; transition: background 160ms var(--ease), border-color 160ms var(--ease), transform 120ms var(--ease); }
.help-rec-btn:hover { background: hsl(var(--primary) / .22); border-color: hsl(var(--primary)); }
.help-rec-btn:active { transform: scale(.98); }
.help-rec-dot { width: 16px; height: 16px; border-radius: 50%; background: hsl(0 78% 58%); box-shadow: 0 0 0 4px hsl(0 78% 58% / .18); flex: none; }
.help-rec-btn.on { background: hsl(0 78% 58% / .16); border-color: hsl(0 78% 58%); }
.help-rec-btn.on .help-rec-dot { animation: help-pulse 1.1s ease-in-out infinite; }
@keyframes help-pulse { 0%, 100% { box-shadow: 0 0 0 4px hsl(0 78% 58% / .22); } 50% { box-shadow: 0 0 0 10px hsl(0 78% 58% / .06); } }
@media (prefers-reduced-motion: reduce) { .help-rec-btn.on .help-rec-dot { animation: none; } }
.help-rec-state { font-size: var(--text-sm); color: hsl(var(--muted-foreground)); text-align: center; max-width: 440px; }
.help-rec-take { width: 100%; max-width: 440px; }
.help-rec-take audio { width: 100%; }
.help-pic { display: block; max-height: 240px; width: auto; max-width: 100%; margin-top: 8px; border-radius: 8px; border: 1px solid hsl(var(--border)); }

/* Enter sends: one button beside Send, blue while on (22 Nov) */
.send-group .enter-toggle { width: 38px; height: 38px; flex: none; border-radius: 10px; border: 1px solid hsl(var(--border)); background: transparent; color: hsl(var(--muted-foreground)); display: inline-flex; align-items: center; justify-content: center; transition: background 160ms var(--ease), color 160ms var(--ease), border-color 160ms var(--ease); }
.send-group .enter-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.send-group .enter-toggle.on { background: hsl(var(--primary) / .16); border-color: hsl(var(--primary) / .7); color: hsl(var(--primary)); }
.send-group .enter-toggle:hover { border-color: hsl(var(--primary)); color: hsl(var(--foreground)); }

/* The chat's name in the header wraps onto a second line instead of being cut (the item 53 rule,
   missed here). Between the phone layout and a wide window the header is crowded, so there the
   role line steps aside and the model menu gives up some width (22 Nov). */
@media (min-width: 821px) {
  #head-title { white-space: normal; overflow-wrap: break-word; text-overflow: clip; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.2; }
}
@media (min-width: 821px) and (max-width: 1080px) {
  #head-sub { display: none; }
  #model-select { max-width: 170px; text-overflow: ellipsis; }
}

/* A page's opening line and the buttons under it had no space between them (Your models and about
   thirty other pages): the line has no bottom margin and the button row's top margin was set to 0.
   Every such pair gets the app's normal gap (22 Nov). */
.about-small + .row-actions, .about-small + .btn, .about-small + div > .btn:first-child { margin-top: 12px !important; }

/* The help button never sits on another control (22 Nov): on a chat it rides above the message box,
   whose height the app keeps in --composer-h; elsewhere it keeps its corner. */
body.composer-on .help-fab { bottom: calc(env(safe-area-inset-bottom) + var(--composer-h, 120px) + 12px); }
/* Between the phone layout and a wide window the header is short of room: the back and forward
   arrows step aside (Alt with the arrow keys still works) and the model menu gives up some width, so
   the chat's name has room to read in full over at most two lines (22 Nov). */
@media (min-width: 821px) and (max-width: 1080px) {
  .topbar .hist.desk { display: none; }
  #model-wrap .mp-btn { max-width: 170px; }
  .title-wrap { min-width: 160px; }
}
/* The chat's name stays on one line whenever it fits; only a name too long for the room wraps (22 Nov). */
#head-title { overflow-wrap: normal; word-break: normal; }
/* A person or agent in the chat's row is one chip on one line, never broken word by word. */
#head-people .person { white-space: nowrap; flex: none; }
#head-people { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
#head-people::-webkit-scrollbar { display: none; }

/* Notices on a chat sit above the message box, never over Send (22 Nov). */
body.composer-on #toasts.toasts:not(.in-dlg) { bottom: calc(env(safe-area-inset-bottom) + var(--composer-h, 120px) + 58px); }

/* In the crowded header range the chip uses its short word (22 Nov). */
@media (max-width: 1080px) { #head-people .person.add .long { display: none; } #head-people .person.add .short { display: inline; } }

/* The help button never covers a message (22 Nov). Where the messages reach the right edge, they keep
   a strip clear for it; on a phone chat it steps into the ⋯ menu instead, so the text keeps its width. */
@media (min-width: 821px) and (max-width: 1180px) { body.composer-on #messages { padding-right: 58px; } }
@media (max-width: 820px) { body.composer-on .help-fab { display: none; } }

/* People on the Agents page, and shared chats (item 231) */
.people-sec { width: 100%; max-width: 1240px; margin: 28px auto 0; }
.people-sec h3 { margin: 0 0 4px; font-size: 15px; }
.people-add { display: flex; gap: 8px; margin: 10px 0 12px; max-width: 520px; }
.people-add input { flex: 1; min-width: 0; }
.people-list { display: flex; flex-direction: column; gap: 6px; }
.person-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line, rgba(127,127,127,.25)); border-radius: 10px; }
.person-row .pr-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.person-row .pr-acts { display: flex; gap: 6px; flex-shrink: 0; }
@media (max-width: 560px) { .person-row { flex-wrap: wrap; } .person-row .pr-acts { width: 100%; justify-content: flex-end; } }
.msg.held .bubble, .msg.held .held-edit { opacity: .62; border-style: dashed; }
.msg.held .held-edit { width: 100%; min-height: 120px; opacity: 1; }
.held-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.held-bar .about-small { flex: 1 1 100%; }
.shared-del { background: none; border: 0; padding: 0 0 0 8px; cursor: pointer; opacity: 0; color: inherit; vertical-align: middle; }
.shared-del svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; }
.msg:hover .shared-del, .shared-del:focus-visible { opacity: .8; }
@media (pointer: coarse) { .shared-del { opacity: .6; } }
#shared-fullsend.on { background: var(--warn, #b7791f); color: #fff; }
.verified { color: var(--ok, #38a169); font-size: 12px; font-weight: 600; }
.safety-code { font-family: ui-monospace, monospace; font-size: 26px; letter-spacing: 2px; text-align: center; margin: 14px 0; }
.held-bar .btn { margin: 0 !important; }

/* An icon marked hidden stays hidden even where a rule gives svg a display (22 Nov: both looks showed the sun). */
svg[hidden] { display: none !important; }
.verify-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.verify-qr svg { width: 150px; height: 150px; background: #fff; border-radius: 6px; }
.safety-in { width: 100%; font-family: ui-monospace, monospace; font-size: 20px; letter-spacing: 2px; text-align: center; }
#verify-cam { width: 100%; margin-top: 10px; border-radius: 8px; }
@media (max-width: 560px) { .verify-grid { grid-template-columns: 1fr; } }
.people-add input[type=email] { flex: 1; min-width: 0; }
.mp-fam > .mp-gh { font-weight: 500; }
.voice-pick { display: flex; gap: 8px; align-items: center; }
.voice-pick select { flex: 1; min-width: 0; max-width: none; }
.agent-voices { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.av-row { display: flex; gap: 10px; align-items: center; }
.av-row .av-name { flex: 0 0 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.av-row select { flex: 1; min-width: 0; max-width: 320px; }
@media (max-width: 560px) { .av-row { flex-wrap: wrap; } .av-row .av-name { flex-basis: 100%; } }
