/* Phase 75 (stage 3, 2.7): every remaining screen on the new tokens (docs/design/NEW_LOOK.md →
   Stage 3): buttons, windows, cards, fields, the Settings window, chips and tabs, the sign-in,
   setup and AI-notice screens, and the small popups. Loaded last; colours, shapes, depth and
   motion come from theme.css, so Night and Day both follow. Nothing here changes what a screen
   says or does (the AI notice and every safety notice keep their place and words). */

/* ---------- Buttons ---------- */
button {
  border-radius: var(--r-control);
  background: var(--btn-fill);
  color: var(--on-btn);
  transition: filter var(--dur-fast), background-color var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast), box-shadow var(--dur-fast);
}
button:hover { background: var(--btn-fill); filter: brightness(1.1); }
button:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }
button.ghost {
  background: color-mix(in srgb, var(--surface-2) 55%, transparent);
  border: 1px solid var(--hairline-strong);
  color: var(--text-2);
}
button.ghost:hover { filter: none; background: color-mix(in srgb, var(--surface-3) 80%, transparent); border-color: color-mix(in srgb, var(--accent-solid) 40%, var(--hairline-strong)); color: var(--text-1); }
button:disabled, button:disabled:hover { filter: none; }
.button-link { border-radius: var(--r-control); background: var(--btn-fill); color: var(--on-btn); font-weight: 600; }
.button-link:hover { filter: brightness(1.1); }
.button-link.ghost { background: color-mix(in srgb, var(--surface-2) 55%, transparent); border: 1px solid var(--hairline-strong); color: var(--text-1); }
button.linkish { background: none; border: 0; padding: 0; color: var(--accent-text); filter: none; }
button.linkish:hover { background: none; text-decoration: underline; }
a { color: var(--accent-text); }
dialog a:not([class]), .settings-pages a:not([class]), .help-menu a, .tip-card a, .studio h3 a.small, #login-paircode a { color: var(--accent-text); }

/* ---------- Fields ---------- */
input, select, textarea { border-color: var(--hairline-strong); background: color-mix(in srgb, var(--surface-0) 55%, var(--surface-2)); }
input::placeholder, textarea::placeholder { color: var(--text-3); }
input:focus, select:focus, textarea:focus { outline: none; border-color: color-mix(in srgb, var(--accent-solid) 65%, var(--hairline-strong)); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=checkbox], input[type=radio], input[type=range] { accent-color: var(--accent-solid); }
input[type=checkbox]:focus, input[type=radio]:focus, input[type=range]:focus { box-shadow: none; }
/* Boxes that draw their own focus (the message box, the command bar's search) keep it. */
#composer #input:focus, .cmd-q:focus { box-shadow: none; }
input[type=checkbox]:focus-visible, input[type=radio]:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }

/* ---------- Windows (dialogs) ---------- */
dialog {
  border: 1px solid var(--hairline-strong);
  border-radius: 20px;
  background: linear-gradient(170deg, color-mix(in srgb, var(--surface-1) 94%, var(--accent-to)), var(--surface-1) 40%);
  box-shadow: var(--shadow-2), 0 30px 80px -40px var(--violet-glow);
}
dialog::backdrop { background: var(--scrim); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.dialog-top > .dialog-x { border: 1px solid var(--hairline-strong); background: var(--glass-strong); color: var(--text-2); }
.dialog-top > .dialog-x:hover { color: var(--text-1); }
.settings-body h2 { letter-spacing: var(--tracking-tight); font-weight: 650; }
.settings-body h3 { color: var(--text-1); font-weight: 600; letter-spacing: var(--tracking-tight); }
dialog .saved-tag { color: var(--success); }
.unsaved-bar { background: var(--glass-strong); -webkit-backdrop-filter: var(--glass-filter); backdrop-filter: var(--glass-filter); }

/* ---------- Settings: the page list and its pages ---------- */
.settings-nav-item { border-radius: var(--r-control); }
.settings-nav-item:hover { background: color-mix(in srgb, var(--surface-3) 60%, transparent); }
.settings-nav-item[aria-current="true"] { background: var(--accent-soft); color: var(--text-1); box-shadow: inset 3px 0 0 var(--accent-solid); font-weight: 600; }
.settings-nav-item[aria-current="true"]:hover { background: var(--accent-soft); }

/* ---------- Cards, lists, chips, tabs ---------- */
.sub-card, .hist-card, .pick-card, .look-card, .gallery-cards > *, .cmp-card, .team-detail, .team-tasks li button, .start-item, .tool-perm, .dev-list li, .hh-models, .ssh-row {
  border-color: var(--hairline-strong);
}
.pick-card, .look-card, .gallery-cards > *, .cmp-card, .start-item {
  border-radius: var(--r-card);
  background: linear-gradient(165deg, color-mix(in srgb, var(--surface-2) 94%, var(--accent-to)), var(--surface-1) 75%);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast), transform var(--dur-fast) var(--ease-out);
}
.pick-card:hover, .look-card:hover, .gallery-cards > *:hover, .start-item:hover:not(:disabled) { border-color: color-mix(in srgb, var(--accent-solid) 50%, var(--hairline-strong)); box-shadow: var(--glow-edge); filter: none; }
.pick-card[aria-checked="true"], .look-card.current { border-color: var(--accent-solid); box-shadow: inset 0 0 0 1px var(--accent-solid), var(--glow-edge); background: linear-gradient(165deg, var(--accent-soft), var(--surface-1) 80%); }
.chip, .tag-chip { border-color: var(--hairline-strong); }
.chip[aria-checked="true"], .chip.on, .tag-chip.on { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent-solid) 60%, transparent); color: var(--text-1); }
.tabs .tab { border-color: var(--hairline-strong); }
.tabs .tab.active { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent-solid) 60%, transparent); color: var(--text-1); box-shadow: inset 0 -2px 0 var(--accent-solid); }
.tab.active { border-bottom-color: var(--accent-solid); }
.start-item.done .start-tick { background: var(--accent-grad); border-color: transparent; color: var(--on-mine); }
.start-item.done { opacity: .72; }
.item .high, .today-row.overdue .today-side { color: var(--accent-text); }
.approval { border-color: color-mix(in srgb, var(--accent-solid) 55%, var(--hairline-strong)); }
.tip:hover, .tip:focus-visible, .tip.open { color: var(--accent-text); border-color: var(--accent-solid); }
.side-dot, .working-dot { background: var(--accent-grad); }
.empty-state, .emptystate { color: var(--text-2); }

/* Planner, Memory, Library, Moments, Your story, Team, Her page: lists and rows on the surfaces. */
.item, .task-row, .mem-item, .note-item, .lib-doc, .story-item, .team-steps > li {
  border-color: var(--hairline);
}
.team-steps > li, .team-tasks li button { border-radius: var(--r-control); }

/* ---------- Sign in, set up, the AI notice: one glass card on the page glow ---------- */
.card-screen { background: var(--page-glow), var(--surface-0); }
.card-screen .card {
  position: relative;
  border: 1px solid var(--hairline-strong);
  border-radius: 22px;
  background: var(--glass-strong);
  -webkit-backdrop-filter: var(--glass-filter);
  backdrop-filter: var(--glass-filter);
  box-shadow: var(--shadow-2), 0 40px 90px -50px var(--violet-glow);
}
.card-screen .card h1 { letter-spacing: -0.02em; font-weight: 650; }
.login-portrait { box-shadow: 0 0 0 3px var(--surface-1), 0 0 0 5px color-mix(in srgb, var(--accent-solid) 70%, var(--accent-to)), 0 12px 36px -10px var(--accent-glow); }
.login-help summary, .claim-code-row { color: var(--text-2); }
#disclosure .card { border-color: color-mix(in srgb, var(--accent-solid) 40%, var(--hairline-strong)); }
#disclosure .card ul { color: var(--text-2); }
.claimed-token { border: 1px solid var(--hairline-strong); background: var(--surface-0); }

/* First-run setup (a window). */
#setup .setup-actions, .wizard .setup-actions { background: var(--glass-strong); -webkit-backdrop-filter: var(--glass-filter); backdrop-filter: var(--glass-filter); border-top-color: var(--hairline-strong); }
.setup-step { letter-spacing: .06em; text-transform: uppercase; }

/* ---------- Small popups ---------- */
.pop-menu button, .companion-menu button { border-radius: var(--r-control); }
.tour-ring { border-color: var(--accent-solid); border-radius: 14px; }

/* ---------- Phones ---------- */
/* The drawer is solid when it slides over the chat (the chat's words never show through it). */
@media (max-width: 760px) { #sidebar { background: var(--surface-1); } }
@media (max-width: 720px) {
  dialog { border-radius: 18px; }
  .card-screen .card { border-radius: 18px; }
}

/* Phase 96 (ST1): Settings → Abilities → Skills, the skill editor and import windows, and the skill
   cards in the chat. Cards on the theme tokens; 44 px targets; the editor is a full-screen sheet on
   phones. */
.skl-top { flex-wrap: wrap; gap: 8px; }
.skl-top button, .skl-editor-buttons button, #skl-recipe-go, #ski-look, #ski-accept, #ski-cancel, #ske-restore, #rc-open-skills { min-height: 44px; }
.skl-note { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0; padding: 10px 12px; border-radius: var(--r-card, 12px); border: 1px solid var(--accent); background: var(--panel-2); }
.skl-note button { min-height: 44px; }
.skl-how { margin: 4px 0 10px; padding-left: 18px; display: grid; gap: 4px; }
.skl-filter { max-width: 320px; }
.skl-list, .skl-projects, .skl-review-list { display: grid; gap: 10px; margin: 10px 0; grid-template-columns: minmax(0, 1fr); }
.skl-card, .skl-project, .skl-review { display: grid; gap: 6px; min-width: 0; padding: 12px; border-radius: var(--r-card, 12px); background: var(--glass-fill, var(--panel-2)); border: 1px solid var(--hairline); box-shadow: var(--elev-1, none); }
.skl-card.off { opacity: .72; }
.skl-card-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 10px; min-width: 0; }
.skl-icon { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-text, var(--accent)); }
.skl-icon svg { width: 20px; height: 20px; }
.skl-title { display: grid; gap: 2px; min-width: 0; min-height: 44px; padding: 4px 0; text-align: left; background: transparent; border: 0; color: var(--text); font: inherit; cursor: pointer; }
.skl-title strong { overflow-wrap: anywhere; }
.skl-desc { color: var(--muted); font-size: var(--fs-small, 13px); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; }
.skl-review .skl-desc { display: block; -webkit-line-clamp: unset; line-clamp: unset; }
.skl-switch { position: relative; display: inline-flex; align-items: center; justify-content: center; min-width: 52px; min-height: 44px; cursor: pointer; }
.skl-switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.skl-knob { position: relative; width: 40px; height: 24px; border-radius: var(--r-pill, 999px); background: var(--hairline-strong, var(--border)); transition: background var(--dur-fast, .15s) var(--ease-out, ease); }
.skl-knob::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--paper); transition: transform var(--dur-fast, .15s) var(--ease-out, ease); }
.skl-switch input:checked + .skl-knob { background: var(--accent-solid, var(--accent)); }
.skl-switch input:checked + .skl-knob::after { transform: translateX(16px); }
.skl-switch input:focus-visible + .skl-knob { outline: 2px solid var(--accent); outline-offset: 2px; }
.skl-more { min-width: 44px; min-height: 44px; font-size: 18px; }
.skl-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.skl-chip { display: inline-flex; align-items: center; font-size: var(--fs-meta, 12px); padding: 2px 10px; border-radius: var(--r-pill, 999px); background: var(--accent-soft); color: var(--text); }
.skl-chip.warn { background: var(--warn-soft); color: var(--warn); }
.skl-chip.bad { background: var(--danger-soft); color: var(--danger); }
.skl-chip.muted { background: var(--hairline); color: var(--muted); }
.skl-used { margin: 0; }
.skl-diag { margin: 0; color: var(--warn); }
.skl-warn { margin: 0; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--warn); background: var(--warn-soft); overflow-wrap: anywhere; }
.skl-warn button { margin-left: 8px; min-height: 44px; }
.skl-findings { margin: 0; padding-left: 18px; color: var(--warn); overflow-wrap: anywhere; }
.skl-files { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.skl-file { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; padding: 4px 8px; border-radius: 8px; background: var(--hairline); }
.skl-file code { overflow-wrap: anywhere; word-break: break-all; }
.skl-file.script { border: 1px solid var(--warn); background: var(--warn-soft); }
.skl-body-box summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; }
.skl-body { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 320px; overflow: auto; padding: 10px; border-radius: 10px; background: var(--hairline); font-size: var(--fs-small, 13px); }
.skl-review.bad { border-color: var(--danger); }
.skl-review-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.skl-review-head input { width: 22px; height: 22px; accent-color: var(--accent); }
.skl-info { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); margin: 6px 0; }
.skl-form { display: grid; gap: 10px; margin: 10px 0; min-width: 0; }
.skl-form textarea { width: 100%; min-width: 0; font-family: var(--font-mono, monospace); }
.skl-sources { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; margin: 10px 0; }
.skl-sources .pick-card { min-height: 64px; }
.skill-editor { width: min(760px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto; padding: 20px 24px 24px; box-sizing: border-box; }
.skill-editor > h2 { margin-top: 0; padding-right: 56px; }
.skill-editor.read-only textarea { opacity: .9; }
.skl-approval { display: grid; gap: 6px; min-width: 0; }
.skl-approval .skl-head, .skl-change .skl-head { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 280px; overflow: auto; margin: 0; padding: 10px; border-radius: 10px; background: var(--hairline); font-family: var(--font-mono, monospace); font-size: var(--fs-small, 13px); }
.approval-skill .row button { min-height: 44px; }
@media (max-width: 720px) {
  dialog.skill-editor:modal { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; padding: 16px 16px calc(24px + var(--safe-b)); }
  .skl-card-head { grid-template-columns: auto minmax(0, 1fr) auto; }
  .skl-card-head .skl-more { grid-column: 3; }
  .skl-card-head .skl-switch { grid-column: 3; grid-row: 1; }
  .skl-card-head .skl-more { grid-row: 2; }
}

/* Phase 97 (ST2): skills she learns. The "make this a skill?" and "a fix for …?" cards in the chat
   and on the Skills page, the Skills she learns settings, the check line on a skill card. Theme
   tokens only; 44 px targets; one column on phones. */
.lsk-section { display: grid; gap: 8px; margin: 12px 0; min-width: 0; }
.lsk-section h4 { margin: 8px 0 0; }
.lsk-settings { display: grid; gap: 4px; min-width: 0; }
.lsk-settings .row { min-height: 44px; align-items: center; }
.lsk-settings .row input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--accent); }
.lsk-picks { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 240px)); gap: 8px 16px; }
.lsk-picks select { min-height: 44px; }
.lsk-slider { display: grid; gap: 4px; }
.lsk-slider input[type="range"] { width: min(320px, 100%); min-height: 44px; accent-color: var(--accent); }
.lsk-list { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
.lsk-card { display: grid; gap: 8px; min-width: 0; max-width: 680px; padding: 12px 14px; border-radius: var(--r-card, 12px); border: 1px solid var(--accent); background: var(--glass-fill, var(--panel-2)); box-shadow: var(--elev-1, none); }
#messages .lsk-card { margin: 6px 0; }
.lsk-title { margin: 0; font-weight: 600; color: var(--text); }
.lsk-what, .lsk-done { margin: 0; overflow-wrap: anywhere; }
.lsk-steps { margin: 0; padding-left: 20px; display: grid; gap: 2px; font-size: var(--fs-small, 13px); overflow-wrap: anywhere; }
.lsk-draft summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; }
.lsk-name { margin: 0; font-weight: 600; font-family: var(--font-mono, monospace); overflow-wrap: anywhere; }
.lsk-desc { margin: 0; color: var(--muted); overflow-wrap: anywhere; }
.lsk-pre { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 300px; overflow: auto; margin: 0; padding: 10px; border-radius: 10px; background: var(--hairline); font-family: var(--font-mono, monospace); font-size: var(--fs-small, 13px); }
.lsk-diff .lsk-add { color: var(--success); background: var(--success-soft); }
.lsk-diff .lsk-del { color: var(--danger); background: var(--danger-soft); }
.lsk-diff .lsk-hunk { color: var(--muted); }
.lsk-edit { width: 100%; min-width: 0; box-sizing: border-box; font-family: var(--font-mono, monospace); }
.lsk-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.lsk-actions button { min-height: 44px; }
.lsk-error { margin: 0; color: var(--danger); }
#lsk-mine { min-height: 44px; }
.skl-check { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); }
.skl-check.bad { color: var(--danger); }
.skl-check button { min-height: 44px; }
@media (max-width: 720px) {
  .lsk-card { max-width: none; }
  .lsk-actions button { flex: 1 1 calc(50% - 8px); }
}

/* Phase 98 (ST3): plugins. The shared proposal card (STAPLES §2.1.1: the review card, a tool a
   plugin asks to use), the Plugins page, a plugin's settings and log, and plugin notes and cards in
   the chat. Theme tokens only; 44 px targets; one column on phones. */
.prop-card { display: grid; gap: 8px; min-width: 0; padding: 14px; border-radius: var(--r-card, 12px); background: var(--glass-fill, var(--panel-2)); border: 1px solid var(--accent); box-shadow: var(--elev-1, none); }
.prop-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; }
.prop-title { margin: 0; overflow-wrap: anywhere; }
.prop-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.prop-chip { display: inline-flex; align-items: center; font-size: var(--fs-meta, 12px); padding: 2px 10px; border-radius: var(--r-pill, 999px); background: var(--accent-soft); color: var(--text); }
.prop-chip.warn { background: var(--warn-soft); color: var(--warn); }
.prop-chip.new { background: var(--warn-soft); color: var(--warn); margin-left: 6px; }
.prop-why { margin: 0; overflow-wrap: anywhere; }
.prop-can-head { margin: 4px 0 0; font-weight: 600; }
.prop-can { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.prop-line { display: flex; align-items: flex-start; gap: 8px; min-width: 0; overflow-wrap: anywhere; }
.prop-dot { flex: 0 0 auto; width: 8px; height: 8px; margin-top: 7px; border-radius: 50%; background: var(--muted); }
.prop-line.risk-high .prop-dot { background: var(--danger); }
.prop-line.risk-medium .prop-dot { background: var(--warn); }
.prop-line.risk-low .prop-dot { background: var(--muted); }
.prop-line.added { padding: 4px 8px; border-radius: 8px; background: var(--warn-soft); }
.prop-warn { margin: 0; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--warn); background: var(--warn-soft); overflow-wrap: anywhere; }
.prop-args { margin: 0; max-height: 200px; overflow: auto; padding: 8px; border-radius: 8px; background: var(--hairline); white-space: pre-wrap; overflow-wrap: anywhere; }
.prop-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.prop-buttons button { min-height: 44px; min-width: 44px; }
#plg-add, #pla-look, #pla-cancel, #pls-save, #pls-refresh { min-height: 44px; }
.plg-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; min-width: 0; }
.plg-title { display: grid; gap: 2px; min-width: 0; }
.plg-title strong { overflow-wrap: anywhere; }
.plg-companions { display: grid; gap: 2px; }
.plg-on, .settings-body label.plg-on { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; min-height: 44px; color: var(--text); font-size: var(--fs-small, 13px); }
.plg-last { margin: 0; overflow-wrap: anywhere; }
.plg-sha { overflow-wrap: anywhere; word-break: break-all; }
.plg-trust { min-height: 44px; align-items: center; gap: 10px; }
.plg-trust input, .plg-field input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--accent); }
.plg-field { display: grid; gap: 4px; min-width: 0; }
.plg-field-name { display: flex; align-items: center; gap: 6px; }
.plg-field.row { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.plg-field input:not([type="checkbox"]), .plg-field select { min-height: 44px; }
.plg-log { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; max-height: 360px; overflow: auto; }
.plg-log-row { display: grid; grid-template-columns: auto auto minmax(0, 1fr); align-items: baseline; gap: 8px; padding: 4px 8px; border-radius: 8px; background: var(--hairline); }
.plg-log-text { overflow-wrap: anywhere; font-size: var(--fs-small, 13px); }
.plg-result { display: grid; gap: 4px; min-width: 0; padding: 10px 12px; border-radius: var(--r-card, 12px); border: 1px solid var(--hairline); background: var(--glass-fill, var(--panel-2)); }
.plg-result-head { display: grid; gap: 2px; }
.plg-result-title { overflow-wrap: anywhere; }
.plg-result-line { margin: 0; overflow-wrap: anywhere; }
.plg-result-img { max-width: 100%; max-height: 240px; border-radius: 8px; object-fit: contain; }
.plg-result-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.plg-result-buttons button { min-height: 44px; }
.plg-from { color: var(--muted); }
.plg-note { display: grid; gap: 2px; border-left: 3px solid var(--accent); }
.plg-note-text { margin: 0; overflow-wrap: anywhere; }
.plg-ask { margin: 0; padding: 6px 10px; border-radius: 8px; background: var(--warn-soft); color: var(--text); overflow-wrap: anywhere; }
@media (max-width: 720px) {
  .plg-log-row { grid-template-columns: minmax(0, 1fr); }
}

/* Phase 100: Settings → Connections → Other agents (web/agents.js). */
.a2a-switches, .a2a-form { display: grid; gap: 6px; min-width: 0; }
.a2a-form { padding: 12px; border-radius: var(--r-card, 12px); border: 1px solid var(--hairline); background: var(--glass-fill, var(--panel-2)); }
.a2a-form > button { justify-self: start; min-height: 44px; }
.a2a-picks { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); }
.a2a-picks select { min-height: 44px; width: 100%; }
.a2a-skills { display: grid; gap: 2px; min-width: 0; }
.a2a-skills-head { margin: 4px 0 0; font-weight: 600; }
.a2a-skill { min-width: 0; overflow-wrap: anywhere; }
.a2a-card-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.a2a-card-row code { overflow-wrap: anywhere; min-width: 0; }
.a2a-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; min-width: 0; }
.a2a-title { display: grid; gap: 2px; min-width: 0; }
.a2a-title strong { overflow-wrap: anywhere; }
.a2a-line { margin: 0; overflow-wrap: anywhere; }
.a2a-edit { display: grid; gap: 6px; padding-top: 8px; border-top: 1px solid var(--hairline); min-width: 0; }
.a2a-edit input[type=password], .a2a-key-row input { width: 100%; min-height: 44px; }
.a2a-key-row { display: grid; gap: 4px; }
.a2a-ifaces { margin: 0; padding-left: 18px; overflow-wrap: anywhere; }
.a2a-recent { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 8px; min-width: 0; }
.a2a-recent-text { min-width: 0; overflow-wrap: anywhere; }
.a2a-recent button { min-height: 44px; }
@media (max-width: 560px) {
  .a2a-recent { grid-template-columns: minmax(0, 1fr) auto; }
  .a2a-recent > .muted { grid-column: 1 / -1; order: 3; }
}

/* Phase 117 (BRIDGES3 §6.3): a chat-app plugin's connection card, linking, Test, groups; the Signal page. */
.plg-bridge:empty { display: none; }
.plg-bridge { display: grid; gap: var(--s-2, 8px); }
.plg-linked, .plg-steps, .plg-setup { margin: 0; padding: 0 0 0 var(--s-4, 16px); display: grid; gap: var(--s-1, 4px); }
.plg-linked, .plg-steps { list-style: none; padding: 0; }
.plg-linked-row { display: flex; align-items: center; gap: var(--s-2, 8px); min-height: 44px; min-width: 0; }
.plg-linked-row code { flex: 1; min-width: 0; }
.icon-x { min-width: 44px; min-height: 44px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.plg-step { font-size: var(--fs-small, 13px); overflow-wrap: anywhere; }
.plg-step.ok { color: var(--ok, var(--accent-text)); }
.plg-step.bad { color: var(--warn); }
.plg-code { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.plg-code:empty { display: none; }
.plg-identity { display: grid; gap: var(--s-1, 4px); }
.plg-identity p { margin: 0; }
.plg-signal { display: grid; gap: var(--s-2, 8px); justify-items: start; }
.plg-signal > button { min-height: 44px; }
.plg-bridge .card-head { padding-right: 52px; }

/* Phase 122 (WHATSAPP §6.3): the WhatsApp setup card. Two columns at 1440 (stepper ≈ 560, the Meta
   screen ≈ 420), one at 390 with the step's help above its fields. */
.wa-box { display: grid; gap: var(--s-3, 12px); }
.wa-grid { display: grid; grid-template-columns: minmax(0, 560px) minmax(0, 420px); gap: var(--s-4, 16px); align-items: start; }
.wa-side { display: grid; gap: var(--s-3, 12px); }
.wa-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-1, 4px); }
.wa-step-head { min-height: 44px; width: 100%; text-align: start; background: none; border: 0; color: var(--text-1); font: inherit; padding: var(--s-1, 4px) 0; cursor: pointer; }
.wa-step.done .wa-step-head { color: var(--success); }
.wa-step.open .wa-step-head { font-weight: 600; }
.wa-step-body { display: grid; gap: var(--s-2, 8px); padding: 0 0 var(--s-3, 12px) var(--s-4, 16px); justify-items: start; }
.wa-step-body > button, .wa-nav > button, .wa-copy > button, .wa-box .add-row > button { min-height: 44px; }
.wa-path { margin: 0; padding-inline-start: 1.4em; display: grid; gap: 2px; overflow-wrap: anywhere; }
.wa-path li::marker { color: var(--text-2); }
.wa-step-body { min-width: 0; }
.wa-diag { display: grid; gap: var(--s-1, 4px); justify-self: stretch; min-width: 0; max-width: 100%; box-sizing: border-box; overflow-wrap: anywhere; padding: var(--s-2, 8px) var(--s-3, 12px); border-radius: 8px; background: var(--surface-2); }
.wa-diag > span { display: block; }
.wa-diag:empty { display: none; }
.wa-diag[data-state="warn"] { border-inline-start: 3px solid var(--warn); }
.wa-diag[data-state="ok"] { border-inline-start: 3px solid var(--success); }
.wa-copy { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s-1, 4px) var(--s-2, 8px); align-items: center; width: 100%; }
.wa-copy .plg-field-name { grid-column: 1 / -1; }
.wa-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-wrap: anywhere; white-space: pre-wrap; }
.wa-nav { display: flex; gap: var(--s-2, 8px); flex-wrap: wrap; }
.wa-terms .row { align-items: center; min-height: 44px; }
.wa-test { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-1, 4px); }
.wa-test .grey { color: var(--text-3); }
.wa-test .bad { font-weight: 600; }
.wa-details code { overflow-wrap: anywhere; }
@media (max-width: 760px) {
  .wa-grid { grid-template-columns: minmax(0, 1fr); }
  .wa-side { order: -1; }
  .wa-step-body { padding-inline-start: 0; }
  .wa-nav { padding: var(--s-2, 8px) 0 var(--safe-b); }
}

/* PL2a (POLISH2 §4.1, N1, N2, N8): the one setup card (web/setup-card.js) for every chat app. */
.setup-card { display: grid; gap: var(--s-2, 8px); justify-items: start; }
.setup-card > h3, .setup-card > p, .setup-card > h4 { margin: 0; }
.setup-facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s-1, 4px) var(--s-3, 12px); margin: 0; }
.setup-facts dt { color: var(--text-2); }
.setup-facts dd { margin: 0; overflow-wrap: anywhere; }
.setup-rules { display: grid; gap: var(--s-1, 4px); justify-self: stretch; padding: var(--s-2, 8px) var(--s-3, 12px); border-radius: 8px; border-inline-start: 3px solid var(--warn); background: var(--surface-1); }
.setup-rules h4, .setup-rules ul { margin: 0; }
.setup-rules ul { padding-inline-start: 1.2em; display: grid; gap: 2px; }
.setup-card > button, .setup-consent button, .setup-folded > button, .setup-os > button { min-height: 44px; }
.setup-consent { display: grid; gap: var(--s-2, 8px); justify-items: start; }
.setup-consent > h3, .setup-consent > p { margin: 0; }
.setup-consent-details { justify-self: stretch; }
.setup-folded { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-2, 8px); color: var(--success); }
.setup-folded > span { overflow-wrap: anywhere; min-width: 0; }
.setup-os { display: flex; flex-wrap: wrap; gap: var(--s-1, 4px); }
.setup-qr { width: min(240px, 100%); height: auto; border-radius: 8px; }
.setup-host:empty { display: none; }
.setup-host { margin-bottom: var(--s-3, 12px); }
.setup-more > summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 600; }
.setup-more[open] > summary { margin-bottom: var(--s-2, 8px); }
/* N8: one card level on phones: the cards inside a page's card lose their own frame. */
@media (max-width: 480px) {
  .wa-box .kit-card, .plg-signal .kit-card, .setup-host .kit-card { border: 0; background: none; box-shadow: none; padding-inline: 0; }
  .wa-grid { gap: var(--s-2, 8px); }
}

/* Phase 128 (PL2b, N30): Settings search: *Elsewhere* (Planner tabs, chat commands) and the
   "moved to …" line for the old group names, above the matching pages. */
.settings-elsewhere { margin: 0 0 14px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-control); background: var(--surface-2); }
.settings-elsewhere .se-head { margin: 0 0 6px; font-size: var(--fs-small, 13px); text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-2); }
.settings-elsewhere .se-moved { margin: 0 0 6px; }
.se-list { display: flex; flex-direction: column; gap: 4px; }
.se-item { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; justify-content: flex-start; min-height: 44px; text-align: start; white-space: normal; }
.se-label { font-weight: 600; }
.se-detail { flex: 1 1 14em; min-width: 0; overflow-wrap: anywhere; }

/* ---------- Phase 128 PL2c (POLISH2.md N32): disabled buttons ---------- */
/* A disabled gradient button was pale pink on near-white in Day. Now: its own fill, grey text and a
   border, all from theme tokens (≥ 3:1 against the card in both themes; checked in ui-look.test). */
button:disabled:not(.ghost, .tip, .linkish, .icon, .tab), button:disabled:not(.ghost, .tip, .linkish, .icon, .tab):hover {
  background: var(--btn-off-fill);
  color: var(--btn-off-text);
  border: 1px solid var(--btn-off-line);
  box-shadow: none;
  opacity: 1;
  cursor: not-allowed;
}
button.ghost:disabled, button.ghost:disabled:hover { color: var(--btn-off-text); border-color: var(--btn-off-line); opacity: 1; cursor: not-allowed; }
