/* Signed-in app */

.app-root { min-height: 100vh; }
.boot { display: grid; place-items: center; min-height: 60vh; color: var(--text-3); padding: 24px; text-align: center; }
.boot-error { max-width: 440px; margin: 20vh auto; padding: 28px; display: grid; gap: 12px; justify-items: start; }

/* ---------- shell ---------- */
.app-shell { --sidew: 264px; min-height: 100vh; }
.app-content { padding: 16px var(--gutter) 120px; }
.app-main { max-width: 1040px; margin-inline: auto; padding-top: 8px; outline: none; }
.view { animation: view-in 0.5s var(--ease) both; }
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { .view { animation: none; } }

.sidebar { display: none; }
.topbar { position: sticky; top: max(8px, env(safe-area-inset-top, 0px)); z-index: 60; margin: max(8px, env(safe-area-inset-top, 0px)) var(--gutter) 0; padding: 8px 8px 8px 14px; display: flex; align-items: center; gap: 8px; border-radius: 22px; }
.top-brand { display: inline-flex; color: var(--text); margin-right: auto; }
.top-brand svg, .side-brand svg { width: 104px; height: 22px; }
.tabbar { position: fixed; z-index: 70; left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 6px; border-radius: 26px; box-shadow: var(--shadow-2); }
.tab-link { position: relative; display: grid; justify-items: center; gap: 2px; padding: 8px 4px 6px; border-radius: 20px; color: var(--text-3); text-decoration: none; font-size: 0.7rem; font-weight: 650; min-height: 52px; transition: color 0.2s, background-color 0.2s, transform 0.4s var(--spring); }
.tab-link .icon { width: 22px; height: 22px; }
@media (hover: hover) { .tab-link:hover { transform: translateY(-2px); } }
.tab-link[aria-current="page"] { color: var(--accent-text); background: var(--accent-soft); }
.nav-badge { position: absolute; top: 2px; right: calc(50% - 22px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 0.68rem; font-weight: 700; display: grid; place-items: center; }
:root[data-theme="dark"] .nav-badge { color: #1b0b0b; }
@media (prefers-color-scheme: dark) { :root[data-theme="dark"] .nav-badge { color: #1b0b0b; } }

/* phones and tablets: the armed pill sits just under the top bar instead of on top of the org switcher */
/* below 960 px the sticky batch bar sticks under the sticky top bar, not behind it */
@media (max-width: 959px) { .app-main .batch-bar { top: calc(max(8px, env(safe-area-inset-top, 0px)) + 64px); } }
@media (max-width: 959px) { .fx-notch:not(.fx-notch--inline) { top: calc(max(8px, env(safe-area-inset-top, 0px)) + 66px); } }

@media (min-width: 960px) {
  .sidebar { position: fixed; z-index: 50; inset: 14px auto 14px 14px; width: calc(var(--sidew) - 14px); display: flex; flex-direction: column; gap: 14px; padding: 16px 12px 12px; border-radius: 28px; overflow-y: auto; }
  .topbar, .tabbar { display: none; }
  .app-content { margin-left: var(--sidew); padding: 28px 36px 80px; }
}
.side-brand { display: inline-flex; color: var(--text); padding: 4px 8px; }
.side-nav { display: grid; gap: 2px; }
.side-link { position: relative; display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 14px; color: var(--text-2); text-decoration: none; font-weight: 600; font-size: 0.95rem; transition: background-color 0.2s, color 0.2s; }
.side-link:hover { background: var(--sunken); color: var(--text); }
.side-link[aria-current="page"] { color: var(--accent-text); }
.side-nav { position: relative; }
.side-nav > .side-link { position: relative; z-index: 1; }
.side-link .icon { width: 20px; height: 20px; }
.side-link .nav-badge { position: static; margin-left: auto; }
.side-small { min-height: 38px; font-size: 0.88rem; font-weight: 550; }
.side-foot { margin-top: auto; display: grid; gap: 4px; }
.side-user { display: grid; gap: 6px; margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 6px; min-width: 0; }
.user-text { display: grid; min-width: 0; line-height: 1.25; }
.user-name { font-weight: 650; }
.user-mail { color: var(--text-3); font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-actions { display: flex; justify-content: space-between; align-items: center; }
.setup-chip { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 16px; background: var(--accent-soft); color: var(--accent-text); font-weight: 650; font-size: 0.9rem; text-decoration: none; }
.mock-tools { font-size: 0.85rem; margin: 6px 0; }
.mock-tools summary { cursor: pointer; padding: 6px 12px; color: var(--write); font-weight: 650; }
.mock-tools-body { display: grid; gap: 6px; padding: 6px 4px; }

/* ---------- avatars, role chips ---------- */
.avatar { --hue: 250; --sz: 28px; width: var(--sz); height: var(--sz); border-radius: 50%; flex: none; display: inline-grid; place-items: center; font-size: calc(var(--sz) * 0.4); font-weight: 700; color: hsl(var(--hue) 55% 22%); background: hsl(var(--hue) 70% 86%); letter-spacing: 0.02em; }
:root[data-theme="dark"] .avatar { color: hsl(var(--hue) 80% 88%); background: hsl(var(--hue) 45% 28%); }
@media (prefers-color-scheme: dark) { :root[data-theme="dark"] .avatar { color: hsl(var(--hue) 80% 88%); background: hsl(var(--hue) 45% 28%); } }
.avatar.sys { background: var(--sunken); color: var(--text-3); }
.avatar.sys .icon { width: 60%; height: 60%; }
.who { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.who-name { font-weight: 600; overflow-wrap: anywhere; }
.role-chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px 2px 7px; border-radius: 999px; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; border: 1px solid var(--line-strong); color: var(--text-2); background: var(--sunken); white-space: nowrap; }
.role-chip .icon { width: 13px; height: 13px; }
.role-owner { color: var(--accent-text); background: var(--accent-soft); border-color: transparent; }
.role-admin { color: var(--accent-2); }
.role-viewer { color: var(--text-3); }

/* ---------- org switcher ---------- */
.org-wrap { position: relative; }
.org-switch { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--sunken); border: 1px solid var(--line); border-radius: 16px; text-align: left; transition: background-color 0.2s, border-color 0.2s, transform 0.4s var(--spring); }
.org-switch:hover { background: var(--surface-solid); border-color: var(--line-strong); }
.org-switch:active { transform: scale(0.985); }
.org-switch-text { display: grid; line-height: 1.2; min-width: 0; flex: 1; }
.org-name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.org-role { font-size: 0.76rem; color: var(--text-3); }
.org-chev { color: var(--text-3); width: 18px; height: 18px; }
.org-switch.compact { width: auto; padding: 4px 8px; min-width: 0; max-width: 46vw; }
.org-menu { position: absolute; z-index: 80; top: calc(100% + 8px); left: 0; width: min(340px, calc(100vw - 32px)); padding: 8px; display: grid; gap: 2px; border-radius: 22px; box-shadow: var(--shadow-2); background: var(--surface-solid); transform-origin: top left; }
.topbar .org-menu, .org-menu.floating { position: fixed; top: 72px; left: 16px; }
@keyframes pop { from { opacity: 0; transform: scale(0.96) translateY(-6px); } }
.org-menu-title { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; padding: 8px 12px 4px; }
.org-menu hr { border: 0; height: 1px; background: var(--line); margin: 6px 4px; }
.org-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 6px 10px; border: 0; background: transparent; border-radius: 14px; color: var(--text); text-align: left; text-decoration: none; font-weight: 600; }
.org-item:hover, .org-item:focus-visible { background: var(--sunken); }
.org-item.current { background: var(--accent-soft); }
.org-item-text { display: grid; flex: 1; min-width: 0; line-height: 1.2; }
.org-item-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.org-item-sub { font-size: 0.78rem; font-weight: 500; }
.org-check { color: var(--accent-text); }
.org-action { color: var(--text-2); }

/* ---------- banners ---------- */
.banners { position: sticky; top: 0; z-index: 90; display: grid; }
.viewas-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 10px var(--gutter); background: #b45309; color: #fff; font-weight: 600; font-size: 0.92rem; box-shadow: 0 6px 24px rgba(180, 83, 9, 0.35); border-bottom: 3px solid #fde68a; }
.viewas-banner .faint { color: rgba(255, 255, 255, 0.82); font-weight: 500; }
.viewas-banner .icon { width: 20px; height: 20px; }
.va-text { flex: 1 1 280px; }
.va-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.viewas-banner .btn { --_bg: rgba(255, 255, 255, 0.16); --_fg: #fff; --_bd: rgba(255, 255, 255, 0.5); min-height: 34px; }
.viewas-banner .btn:hover { --_bg: rgba(255, 255, 255, 0.28); }
.viewas-banner .va-exit { --_bg: #fff; --_fg: #7c2d12; }
.viewas-banner kbd { font-size: 0.72rem; padding: 1px 6px; border-radius: 6px; border: 1px solid rgba(255, 255, 255, 0.5); }
.is-viewas .app-content { box-shadow: inset 0 0 0 3px rgba(180, 83, 9, 0.35); }
.notice-banner { display: flex; align-items: center; gap: 10px; padding: 10px var(--gutter); background: var(--accent); color: #fff; font-weight: 600; font-size: 0.92rem; }
.notice-banner.warn { background: #92400e; }

/* ---------- armed pill (notch) ---------- */
.arm-pill-slot { position: fixed; z-index: 95; top: 10px; left: 50%; transform: translateX(-50%); pointer-events: none; }
.is-viewas .arm-pill-slot { top: 64px; }
.arm-pill { pointer-events: auto; display: inline-flex; align-items: center; gap: 12px; max-width: calc(100vw - 24px); padding: 8px 10px 8px 16px; border-radius: 999px; background: #111118; color: #fff; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.12), 0 0 28px rgba(251, 191, 36, 0.25); animation: notch-in 0.7s var(--spring) both; transition: padding 0.4s var(--spring); }
@keyframes notch-in { from { opacity: 0; transform: translateY(-24px) scale(0.8); } }
.arm-pill .pill-dot { width: 9px; height: 9px; border-radius: 50%; background: #fbbf24; box-shadow: 0 0 10px #fbbf24; animation: blink 1.6s ease-in-out infinite; flex: none; }
.pill-main { display: grid; line-height: 1.15; min-width: 0; }
.pill-title { font-weight: 700; font-size: 0.88rem; white-space: nowrap; }
.pill-sub { font-size: 0.74rem; color: rgba(255, 255, 255, 0.7); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 34vw; }
.pill-time { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 0.95rem; padding: 4px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.12); }
.pill-disarm { --_bg: #fff; --_fg: #111118; --_bd: transparent; min-height: 32px; display: none; }
.arm-pill:hover .pill-disarm, .arm-pill:focus-within .pill-disarm { display: inline-flex; }
@keyframes blink { 50% { opacity: 0.3; } }
@media (prefers-reduced-motion: reduce) { .arm-pill { animation: none; } .arm-pill .pill-dot { animation: none; } }

/* ---------- connections ---------- */
.conn-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.conn-card { display: grid; gap: 8px; padding: 20px; text-decoration: none; color: inherit; transition: transform 0.5s var(--spring), box-shadow 0.3s, border-color 0.3s; }
.conn-card:hover { transform: translateY(-3px); box-shadow: var(--highlight), var(--shadow-2); border-color: var(--line-strong); }
.conn-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 1.05rem; }
.conn-label { font-size: 1.3rem; font-weight: 650; letter-spacing: -0.02em; line-height: 1.2; overflow-wrap: anywhere; }
.conn-meta { font-size: 0.88rem; }
.conn-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 6px; font-size: 0.85rem; flex-wrap: wrap; }
.conn-access { display: inline-flex; align-items: center; gap: 5px; }
.conn-access .icon { width: 15px; height: 15px; }
.attention { display: flex; align-items: center; gap: 12px; padding: 14px 18px; margin-bottom: 16px; text-decoration: none; color: var(--text); border-color: var(--danger-line); background: linear-gradient(90deg, var(--danger-bg), var(--surface) 70%); }
.attention .icon:last-child { margin-left: auto; }
.attention:hover { border-color: var(--danger); }
.head-meta { display: inline-flex; align-items: center; gap: 12px; font-size: 1.05rem; }
.row-actions.center { justify-content: center; }
.center { display: flex; justify-content: center; }
.grow { flex: 1; }
.card.narrow { max-width: 560px; }
.card { padding: clamp(18px, 3vw, 28px); }

/* empty state illustration */
.illo-dialpad { display: grid; grid-template-columns: repeat(3, 16px); gap: 14px; margin: 4px auto 12px; }
.illo-dialpad i { width: 16px; height: 16px; border-radius: 50%; background: var(--accent-text); opacity: 0.85; }
.illo-dialpad i.dim { opacity: 0.2; background: var(--text); }
.illo-dialpad i.lit { background: var(--accent-2); animation: ring-pulse 2.4s var(--ease) infinite; }
@keyframes ring-pulse { 0%, 100% { box-shadow: 0 0 0 0 transparent; } 40% { box-shadow: 0 0 0 10px color-mix(in srgb, var(--accent-2) 22%, transparent); } }
@media (prefers-reduced-motion: reduce) { .illo-dialpad i.lit { animation: none; } }

/* ---------- connection detail ---------- */
.subnav { display: flex; gap: 4px; overflow-x: auto; margin: -6px 0 22px; padding: 4px; border-radius: 999px; background: var(--sunken); width: fit-content; max-width: 100%; scrollbar-width: none; }
.subnav::-webkit-scrollbar { display: none; }
.subnav a { padding: 8px 16px; border-radius: 999px; color: var(--text-2); font-weight: 600; font-size: 0.92rem; text-decoration: none; white-space: nowrap; }
.subnav a:hover { color: var(--text); }
.subnav a[aria-current="page"] { background: var(--surface-solid); color: var(--text); box-shadow: var(--shadow-1); }
.detail-body { display: grid; gap: 18px; }
.arm-card { display: grid; gap: 22px; padding: clamp(20px, 4vw, 32px); align-items: center; transition: box-shadow 0.5s, border-color 0.5s; }
@media (min-width: 720px) { .arm-card { grid-template-columns: auto 1fr; gap: 40px; } }
.arm-card.is-armed { border-color: var(--write-line); box-shadow: var(--highlight), 0 0 0 1px var(--write-line), 0 20px 60px -20px rgba(251, 191, 36, 0.35); }
.arm-ring { display: grid; place-items: center; }
.arm-side { display: grid; gap: 18px; }
.arm-state { color: var(--text-2); margin-top: 4px; }
.arm-by { font-size: 0.9rem; }
.arm-controls { display: grid; gap: 14px; justify-items: start; }
.arm-btn { min-width: 160px; }
.is-armed .arm-btn { animation: none; }

.url-row { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px; border-radius: 16px; background: var(--sunken); border: 1px solid var(--line); margin-bottom: 16px; }
.url-row code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; background: none; border: 0; padding: 0; font-size: 0.9rem; }
.tabs { display: flex; gap: 4px; overflow-x: auto; padding: 4px; border-radius: 999px; background: var(--sunken); width: fit-content; max-width: 100%; margin-bottom: 16px; scrollbar-width: none; }
.tab { padding: 8px 16px; border-radius: 999px; border: 0; background: transparent; color: var(--text-2); font-weight: 600; font-size: 0.92rem; white-space: nowrap; }
.tab[aria-selected="true"] { background: var(--surface-solid); color: var(--text); box-shadow: var(--shadow-1); }
.tab-panel { display: grid; gap: 14px; outline-offset: 6px; }
.client-steps { padding-left: 1.3em; list-style: decimal; display: grid; gap: 6px; color: var(--text-2); }
.client-steps li::marker { color: var(--accent-text); font-weight: 700; }
.consent-note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: var(--accent-soft); font-size: 0.92rem; }
.consent-note .icon { color: var(--accent-text); margin-top: 2px; }
.consent-note p { margin: 0; }
.fineprint.lock-note { display: flex; gap: 8px; align-items: flex-start; }
.last-call { padding-inline: 4px; }

.rows { display: grid; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.row:last-child { border-bottom: 0; }
.row-main { display: grid; min-width: 0; }
.row-main > code { justify-self: start; max-width: 100%; }
.token-create { display: grid; gap: 12px; align-items: end; }
@media (min-width: 640px) { .token-create { grid-template-columns: 1fr auto; } }
.token-reveal { display: grid; gap: 10px; padding: 14px; border-radius: 16px; border: 1px solid var(--write-line); background: var(--write-bg); }
.reveal-head { display: flex; gap: 8px; align-items: center; color: var(--write); }

/* tools */
.legend { display: grid; gap: 10px; padding: 16px 20px; }
.legend-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.tool-filters { display: grid; gap: 10px; }
@media (min-width: 720px) { .tool-filters { grid-template-columns: minmax(200px, 320px) 1fr; align-items: center; } }
.tool-list { display: grid; gap: 22px; }
.tool-group-title { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; font-size: 1rem; }
.tools { display: grid; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; background: var(--surface-2); }
.tool { display: grid; gap: 2px 16px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.tool:last-child { border-bottom: 0; }
@media (min-width: 720px) { .tool { grid-template-columns: minmax(200px, 280px) 1fr; align-items: baseline; } }
.tool-name { background: none; border: 0; padding: 0; font-weight: 650; color: var(--text); }
.tool-group.tg-dangerous .tools { border-color: var(--danger-line); }

/* access + danger */
.radio-stack { display: grid; gap: 12px; }
.people-pick { display: grid; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.person { align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.person:last-child { border-bottom: 0; }
.person-text { display: grid; flex: 1; min-width: 0; line-height: 1.25; }
.danger-zone { border-color: var(--danger-line); }
.delete-list { display: grid; gap: 6px; color: var(--text-2); }
.delete-list li { display: flex; gap: 10px; align-items: flex-start; }
.delete-list .icon { color: var(--text-3); margin-top: 3px; }

/* ---------- audit timeline ---------- */
.audit-filters { display: grid; gap: 12px; margin-bottom: 20px; }
.filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.filter-row .select, .filter-row .input { width: auto; min-width: 160px; flex: 1 1 180px; max-width: 320px; }
.sep { width: 1px; height: 24px; background: var(--line-strong); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.btn.on .live-dot { background: var(--read); box-shadow: 0 0 0 4px var(--read-bg); animation: blink 1.4s ease-in-out infinite; }
.timeline { display: grid; gap: 22px; }
.tl-day-title { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); margin-bottom: 10px; }
.tl-rows { position: relative; display: grid; gap: 10px; padding-left: 26px; }
.tl-rows::before { content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 2px; border-radius: 1px; background: linear-gradient(var(--line-strong), var(--line)); }
.tl-row { position: relative; }
.tl-dot { position: absolute; left: -26px; top: 18px; width: 16px; height: 16px; border-radius: 50%; background: var(--bg); border: 2px solid var(--text-3); }
.tl-row[data-tier="dangerous"] .tl-dot { border-color: var(--danger); }
.tl-row[data-tier="write"] .tl-dot { border-color: var(--write); }
.tl-row[data-tier="read"] .tl-dot { border-color: var(--read); }
.tl-card { padding: 12px 16px; border-radius: 18px; background: var(--surface-2); border: 1px solid var(--line); display: grid; gap: 6px; }
.tl-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.tl-tool { background: none; border: 0; padding: 0; font-weight: 650; color: var(--text); }
.tl-time { font-variant-numeric: tabular-nums; min-width: 78px; }
.tl-result { font-size: 0.92rem; }
.ev-details summary { cursor: pointer; font-size: 0.85rem; color: var(--text-3); width: fit-content; }
.ev-details[open] summary { margin-bottom: 8px; }
.args { margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--sunken); font-size: 0.8rem; overflow-x: auto; }
.tl-row.fresh { animation: slide-in 0.6s var(--spring) both; }
@keyframes slide-in { from { opacity: 0; transform: translateY(-14px); } }
@media (prefers-reduced-motion: reduce) { .tl-row.fresh { animation: none; } }

/* ---------- approvals ---------- */
.ap-list { display: grid; gap: 14px; }
.batch-bar { position: sticky; top: 12px; z-index: 40; display: flex; align-items: center; gap: 10px; padding: 10px 16px; margin-bottom: 14px; border-radius: 20px; flex-wrap: wrap; }
.batch-count { font-weight: 650; }
.ap-card { display: grid; gap: 12px; padding: 18px 20px; transition: transform 0.5s var(--spring), opacity 0.4s, box-shadow 0.3s; }
.ap-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ap-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; flex: 1 1 220px; min-width: 0; }
/* a tool name breaks only when it cannot fit on its own line (never control_ / campaign on a phone) */
.ap-tool { background: none; border: 0; padding: 0; font-weight: 700; font-size: 1.05rem; color: var(--text); overflow-wrap: break-word; min-width: 0; }
.ap-select input { width: 22px; height: 22px; accent-color: var(--accent); }
.ap-summary { font-size: 1.05rem; font-weight: 550; }
.ap-who { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 0.88rem; }
.ap-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 4px; }
.ap-card.dismiss { opacity: 0; transform: translateX(40px) scale(0.97); }
.ap-card.wobble-ok { animation: wobble 0.5s var(--ease); border-color: var(--read-line); }
@keyframes wobble { 0% { transform: scale(1); } 25% { transform: scale(1.015) rotate(-0.4deg); } 55% { transform: scale(0.992) rotate(0.3deg); } 100% { transform: scale(1); opacity: 0.4; } }
@media (prefers-reduced-motion: reduce) { .ap-card.wobble-ok { animation: none; opacity: 0.5; } }
.diff { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--bg-2); }
.diff-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 14px; background: var(--sunken); font-weight: 650; flex-wrap: wrap; }
.diff-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.diff-table th, .diff-table td { padding: 8px 14px; text-align: left; border-top: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
.diff-table th { color: var(--text-3); font-weight: 600; width: 28%; }
/* phones: argument name above its value, so names like list_name never split into list_nam / e */
@media (max-width: 560px) {
  .diff-table tr { display: block; padding: 8px 14px; border-top: 1px solid var(--line); }
  .diff-table th, .diff-table td { display: block; width: auto; padding: 0; border-top: 0; }
  .diff-table th { font-size: 0.82rem; }
  .diff-table td + td { margin-top: 2px; }
}
.diff-table del { color: var(--danger); text-decoration-thickness: 1px; }
.diff-table ins { color: var(--read); text-decoration: none; font-weight: 650; }
.diff-table ins::before { content: "+ "; }

/* ---------- wizard + pick tiles ---------- */
.wiz-steps { display: flex; gap: 8px; margin-bottom: 22px; flex-wrap: wrap; }
.wiz-steps li { display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; border-radius: 999px; background: var(--sunken); color: var(--text-3); font-weight: 600; font-size: 0.88rem; }
.wiz-n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-solid); font-size: 0.78rem; font-weight: 700; }
.wiz-n .icon { width: 14px; height: 14px; }
.wiz-steps li.on { background: var(--accent-soft); color: var(--accent-text); }
.wiz-steps li.on .wiz-n { background: var(--accent); color: #fff; }
.wiz-steps li.done { color: var(--read); }
.wiz-steps li.done .wiz-n { background: var(--read-bg); color: var(--read); }
.pick-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); }
.pick-tile { position: relative; display: grid; gap: 6px; align-content: end; min-height: 140px; padding: 20px; text-align: left; color: var(--text); border-radius: var(--r-l); transition: transform 0.5s var(--spring), border-color 0.25s, box-shadow 0.3s, opacity 0.3s; }
.pick-grid:hover .pick-tile:not(:hover):not(:focus-visible) { opacity: 0.72; }
.pick-tile:hover, .pick-tile:focus-visible { transform: translateY(-4px) scale(1.01); border-color: var(--accent); box-shadow: var(--highlight), var(--shadow-2); }
.pick-tile.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.pick-name { font-size: 1.5rem; line-height: 1.1; letter-spacing: -0.02em; font-weight: 650; }
.pick-sub { font-size: 0.85rem; color: var(--text-3); }
.pick-tiers { position: absolute; top: 18px; right: 18px; display: flex; gap: 4px; }
.pick-tiers i { width: 8px; height: 8px; border-radius: 50%; }
.t-read { background: var(--read); } .t-write { background: var(--write); } .t-danger { background: var(--danger); }
.pick-tile .soon-pill { position: absolute; top: 14px; right: 14px; }
.pick-request { border-style: dashed; background: transparent; }
.pick-plus { position: absolute; top: 18px; right: 18px; color: var(--accent-text); width: 24px; height: 24px; }

/* Setup ask (connect wizard and first-run guide): one card. The ask, a ruled checklist, what to paste back,
   the copy-for-admin button and one optional disclosure. Thin rules, no nested cards. */
.setup-card { display: grid; gap: 16px; min-width: 0; max-width: 100%; border: 1px solid var(--line); border-radius: var(--r-l); background: var(--bg-2); }
.setup-ask { font-size: 1.15rem; font-weight: 650; line-height: 1.35; margin: 0; }
.setup-checklist { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.setup-checklist > li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); line-height: 1.5; overflow-wrap: anywhere; }
.setup-checklist > li > .icon { flex: none; width: 16px; height: 16px; margin-top: 3px; color: var(--read); }
.setup-card code { font-family: var(--mono); font-size: 0.86em; overflow-wrap: anywhere; }
.setup-note, .setup-where { margin: 0; font-size: 0.93rem; line-height: 1.55; }
.setup-note { color: var(--text-2); }
.setup-paste h3 { font-size: 0.95rem; font-weight: 600; margin: 0 0 6px; }
.setup-paste ul, .setup-tips { margin: 0; padding-left: 1.2em; list-style: disc; display: grid; gap: 4px; line-height: 1.5; font-size: 0.93rem; }
.setup-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.setup-copy .icon { width: 16px; height: 16px; }
.setup-more { border-top: 1px solid var(--line); }
.setup-more > summary { display: flex; align-items: center; min-height: 44px; cursor: pointer; font-weight: 600; width: fit-content; }
.setup-tips { color: var(--text-2); padding-bottom: 4px; }
.setup-card .codeblock pre { max-height: 320px; max-width: 100%; }
.guide h2 { font-size: 1.1rem; margin-top: 1.4em; }
.guide h2:first-child { margin-top: 0; }

/* Multi-step loader (connect flow), after Aceternity's multi step loader, rebuilt: a hairline rail joins the marks
   and fills as each check passes; the active step is full ink, later steps wait in grey. */
.step-loader { position: relative; display: grid; gap: 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-l); background: var(--bg-2); }
.sl-item { position: relative; display: flex; align-items: center; gap: 12px; min-height: 36px; color: var(--text-3); font-weight: 500; font-size: 0.94rem; transition: color 0.25s var(--ease), opacity 0.25s var(--ease), transform 0.3s var(--ease); }
.sl-item:not(:last-child)::after { content: ""; position: absolute; left: 10.5px; top: 29px; height: 14px; width: 1px; background: var(--line-strong); transform-origin: top; }
.sl-item[data-state="done"]:not(:last-child)::after { background: var(--text); }
.sl-item[data-state="idle"] { opacity: 0.5; }
.sl-mark { width: 22px; height: 22px; display: grid; place-items: center; flex: none; border-radius: 50%; border: 1.5px solid var(--line-strong); background: var(--surface-solid); transition: background-color 0.25s var(--ease), border-color 0.25s var(--ease); }
.sl-mark > * { grid-area: 1 / 1; }
.sl-mark .icon { display: none; width: 14px; height: 14px; }
.sl-mark .spinner { display: none; width: 12px; height: 12px; border-width: 1.5px; }
.sl-item[data-state="active"] { color: var(--text); transform: translateX(2px); }
.sl-item[data-state="active"] .sl-mark { border-color: var(--text); }
.sl-item[data-state="active"] .spinner { display: block; }
.sl-item[data-state="done"] { color: var(--text-2); }
.sl-item[data-state="done"] .sl-mark { background: var(--text); border-color: var(--text); color: var(--bg); }
.sl-item[data-state="done"] .icon:nth-of-type(1) { display: block; animation: sl-pop 0.35s var(--ease) both; }
.sl-item[data-state="done"]:last-child { color: var(--text); font-weight: 600; }
.sl-item[data-state="fail"] { color: var(--danger); }
.sl-item[data-state="fail"] .sl-mark { border-color: var(--danger); background: var(--danger-bg); }
.sl-item[data-state="fail"] .icon:nth-of-type(2) { display: block; }
@keyframes sl-pop { from { opacity: 0; transform: scale(0.4); } }
@media (prefers-reduced-motion: reduce) { .sl-item, .sl-mark { transition: none; } .sl-item[data-state="done"] .icon:nth-of-type(1) { animation: none; } .sl-item[data-state="active"] { transform: none; } }

/* Stateful button (connect flow): idle, working (spinner and what is happening), done (drawn check, "Connected").
   It stays full strength while working (aria-busy, clicks ignored) instead of greying out. */
.btn[data-state] { transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease), width 0.3s var(--ease); }
.sb-icon { display: inline-grid; place-items: center; width: 0; height: 1.1em; margin-right: -8px; overflow: hidden; opacity: 0; transition: width 0.25s var(--ease), margin 0.25s var(--ease), opacity 0.2s var(--ease); }
.sb-icon > * { grid-area: 1 / 1; display: none; }
.btn[data-state="working"] .sb-icon, .btn[data-state="done"] .sb-icon { width: 1.1em; margin-right: 0; opacity: 1; }
.btn[data-state="working"] .sb-icon .spinner { display: block; width: 1em; height: 1em; }
.btn[data-state="done"] .sb-icon .sb-ok { display: block; width: 1.1em; height: 1.1em; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 0; animation: sb-draw 0.36s var(--ease) both; }
.btn[data-state="working"] { cursor: progress; }
.btn-primary[data-state="done"] { --_bg: var(--signal); --_bd: var(--signal); --_fg: #fff; }
:root[data-theme="dark"] .btn-primary[data-state="done"] { --_fg: #06140c; }
@keyframes sb-draw { from { stroke-dashoffset: 1; } }
@media (prefers-reduced-motion: reduce) { .btn[data-state], .sb-icon { transition: none; } .btn[data-state="done"] .sb-icon .sb-ok { animation: none; } }
.creds-form { max-width: 520px; }

.thanks { display: grid; gap: 12px; justify-items: center; text-align: center; padding: 8px; }
.vote-count { display: inline-flex; align-items: baseline; gap: 6px; padding: 6px 18px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-text); }
.vote-count strong { font-size: 1.6rem; }
.radio-set { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.radio-set legend { font-weight: 600; font-size: 0.92rem; margin-bottom: 6px; }
.radio { display: inline-flex; align-items: center; gap: 8px; margin-right: 16px; }
.radio input { width: 20px; height: 20px; accent-color: var(--accent); }
.req-popular { display: grid; gap: 10px; margin-top: 12px; }
.req-list { display: grid; }
.req-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.req-name { flex: 1; font-weight: 600; display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.req-votes { color: var(--text-3); font-size: 0.88rem; }

/* gated controls */
.gated { opacity: 0.55; cursor: not-allowed; }
.gate-lock { width: 14px; height: 14px; }
.btn.gated:hover { transform: none; }

@media (max-width: 559px) {
  .app-content { padding-bottom: 110px; }
  .arm-pill-slot { top: 6px; }
  .pill-sub { max-width: 40vw; }
}

.pick-logo { display: flex; align-items: center; min-height: 34px; }
.app-foot { padding: 8px var(--gutter) calc(104px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 8px; color: var(--text-3); font-size: 0.78rem; max-width: 1040px; margin-inline: auto; }
.app-foot nav { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.app-foot a { color: var(--text-3); }
@media (pointer: coarse) { .app-foot a { display: inline-flex; align-items: center; min-height: 44px; } .app-foot nav { gap: 0 18px; } }
/* phones: toasts sit above the floating tab bar, not on top of it */
@media (max-width: 959px) { body:has(.tabbar) .toast-region[popover] { inset: auto 0 calc(96px + env(safe-area-inset-bottom, 0px)) 0; } }
@media (min-width: 960px) { .app-foot { margin-left: 300px; padding: 0 36px 28px; } }

/* ---------- team ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.members { padding: 6px 8px; border-radius: var(--r-l); }
.member-list { display: grid; }
.member { display: flex; align-items: center; gap: 14px; padding: 12px 10px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.member:last-child { border-bottom: 0; }
.member-main { display: grid; flex: 1 1 200px; min-width: 0; line-height: 1.3; }
.member-mail { font-size: 0.86rem; overflow-wrap: anywhere; }
.member-seen { font-size: 0.82rem; white-space: nowrap; }
.member-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.invite-cta { margin-bottom: 18px; }
.org-activity { display: grid; padding: 6px 10px; border-radius: var(--r-l); }
.org-activity li { display: flex; gap: 14px; align-items: center; padding: 12px 6px; border-bottom: 1px solid var(--line); }
.org-activity li:last-child { border-bottom: 0; }
.narrow-form { max-width: 460px; }
.modal-wide { width: min(780px, calc(100vw - 2 * var(--gutter))); }
.modal-icon.danger { background: var(--danger-bg); color: var(--danger); }
.conn-picks { display: grid; gap: 8px; margin-top: 8px; padding: 12px; border-radius: 14px; background: var(--sunken); }
.access-set { margin-top: 4px; padding-top: 6px; }
.switch-list { display: grid; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.switch-row:last-child { border-bottom: 0; }
.switch-text { display: grid; gap: 4px; max-width: 560px; }
.switch { position: relative; flex: none; width: 52px; height: 32px; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.switch-knob { position: absolute; inset: 0; border-radius: 16px; background: var(--line-strong); transition: background-color 0.25s; }
.switch-knob::after { content: ""; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); transition: transform 0.45s var(--spring); }
.switch input:checked + .switch-knob { background: var(--accent); }
.switch input:checked + .switch-knob::after { transform: translateX(20px); }
.switch input:focus-visible + .switch-knob { outline: 2.5px solid var(--accent-text); outline-offset: 3px; }
.switch input:disabled + .switch-knob { opacity: 0.5; }

/* ---------- welcome / setup guide ---------- */
.welcome { max-width: 860px; margin-inline: auto; }
.wl { padding: clamp(20px, 4vw, 36px); display: grid; gap: 18px; border-radius: var(--r-xl); box-shadow: var(--highlight), var(--shadow-2); }
.wl-top { display: flex; justify-content: space-between; align-items: center; }
.wl-count { font-size: 0.82rem; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; }
.wl-progress { height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; }
.wl-progress i { display: block; height: 100%; width: var(--w, 10%); border-radius: 3px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 0.7s var(--spring); }
.wl-body { display: grid; gap: 18px; }
.wl-title { font-family: var(--font-display); font-size: clamp(1.7rem, 3.4vw, 2.5rem); line-height: 1.16; letter-spacing: -0.03em; font-weight: 700; text-wrap: balance; }
.wl-title:focus { outline: none; }
.wl-hero { display: grid; place-items: center; padding: 8px 0; }
.wl-center { display: grid; justify-items: center; }
.tier-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.tier-chips .tier { font-size: 0.82rem; padding: 6px 14px 6px 10px; }
.prompt-list { display: grid; gap: 10px; }
.prompt { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 12px 12px 18px; border-radius: 16px; background: var(--sunken); border: 1px solid var(--line); }
.prompt-text { font-weight: 550; }
.waiting { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: 18px; border: 1px dashed var(--line-strong); color: var(--text-2); flex-wrap: wrap; }
.waiting.ok { border-style: solid; border-color: var(--read-line); background: var(--read-bg); color: var(--text); }
.wait-dots { display: inline-flex; gap: 5px; }
.wait-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-text); animation: dot-bounce 1.2s ease-in-out infinite; }
.wait-dots i:nth-child(2) { animation-delay: 0.15s; } .wait-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes dot-bounce { 0%, 80%, 100% { transform: translateY(0); opacity: 0.4; } 40% { transform: translateY(-6px); opacity: 1; } }
.success-panel { display: grid; gap: 12px; justify-items: center; text-align: center; padding: 8px; }
.summary { padding: 18px 20px; }
.tip { display: flex; gap: 12px; padding: 14px 16px; border-radius: 16px; background: var(--write-bg); border: 1px solid var(--write-line); }
.tip .icon { color: var(--write); margin-top: 2px; }
.tip p { margin: 0; }

.check-burst { position: relative; display: inline-grid; place-items: center; width: 64px; height: 64px; }
.check-draw { width: 56px; height: 56px; overflow: visible; }
.cd-circle { fill: var(--read-bg); stroke: var(--read); stroke-width: 2.5; stroke-dasharray: 145; stroke-dashoffset: 145; animation: cd-draw 0.6s var(--ease) forwards; }
.cd-tick { fill: none; stroke: var(--read); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 40; animation: cd-draw 0.4s 0.45s var(--ease) forwards; }
.check-ripple { position: absolute; inset: 4px; border-radius: 50%; border: 2px solid var(--read); opacity: 0; animation: cd-ripple 1.1s 0.5s var(--ease) 1 forwards; }
.check-ripple.r2 { animation-delay: 0.75s; }
@keyframes cd-draw { to { stroke-dashoffset: 0; } }
@keyframes cd-ripple { 0% { opacity: 0.6; transform: scale(0.8); } 100% { opacity: 0; transform: scale(2); } }
@media (prefers-reduced-motion: reduce) { .cd-circle, .cd-tick { animation: none; stroke-dashoffset: 0; } .check-ripple { display: none; } .wait-dots i { animation: none; } }

/* ---------- blocked-action landing ---------- */
.landing { max-width: 760px; margin-inline: auto; }
.land-card { display: grid; gap: 16px; padding: clamp(22px, 4vw, 36px); border-radius: var(--r-xl); box-shadow: var(--highlight), var(--shadow-2); justify-items: start; }
.land-card.ok { justify-items: center; text-align: center; }
.land-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.land-tool { font-size: clamp(1.4rem, 3vw, 2rem); letter-spacing: -0.02em; line-height: 1.1; }
.land-tool code { background: none; border: 0; padding: 0; font-weight: 700; }
.land-card .diff, .land-card .ap-summary, .land-card .statusMsg { width: 100%; }
.big-actions { display: grid; gap: 12px; width: 100%; }
@media (min-width: 680px) { .big-actions { grid-template-columns: 1fr 1fr; } }
.big-btn { height: auto; min-height: 92px; padding: 16px 20px; border-radius: 22px; justify-content: flex-start; gap: 14px; text-align: left; white-space: normal; align-items: center; }
.big-btn:not(.btn-primary) { --_bg: var(--surface-solid); }
.big-icon { width: 30px; height: 30px; flex: none; }
.big-text { display: grid; gap: 4px; line-height: 1.25; }
.big-title { font-size: 1.1rem; font-weight: 700; letter-spacing: -0.01em; }
.big-sub { font-size: 0.85rem; font-weight: 500; opacity: 0.85; }
.arm-pick { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; width: 100%; justify-content: center; }
.center-text { text-align: center; width: 100%; }
.retry-box { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; padding: 12px 14px; border-radius: 16px; background: var(--sunken); border: 1px solid var(--line); }
.retry-box code { background: none; border: 0; font-size: 0.95rem; }

/* ---------- safety presets ---------- */
.preset-grid { display: grid; gap: 14px; margin-bottom: 18px; }
@media (min-width: 900px) { .preset-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.preset-card { position: relative; display: grid; gap: 12px; align-content: start; padding: 22px; cursor: pointer; border-radius: var(--r-l); transition: transform 0.5s var(--spring), border-color 0.25s, box-shadow 0.3s; }
.preset-card:hover { transform: translateY(-3px); box-shadow: var(--highlight), var(--shadow-2); }
.preset-card input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; border-radius: inherit; }
.preset-card:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset, var(--shadow-1); }
.preset-card:has(input:focus-visible) { outline: 2.5px solid var(--accent-text); outline-offset: 3px; }
.preset-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.preset-icon { width: 40px; height: 40px; border-radius: 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.preset-title { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.02em; margin-right: auto; }
.preset-line { font-weight: 600; font-size: 1.02rem; line-height: 1.35; }
.preset-points { display: grid; gap: 8px; color: var(--text-2); font-size: 0.93rem; }
.preset-points li { display: flex; gap: 10px; align-items: flex-start; }
.preset-points .icon { color: var(--read); margin-top: 3px; width: 16px; height: 16px; flex: none; }
.preset-best { font-size: 0.85rem; }
.floor-list { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.floor-list li { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: 14px; background: var(--danger-bg); color: var(--text); font-weight: 550; font-size: 0.92rem; }
.floor-list .icon { color: var(--danger); flex: none; }

/* ---------- trust (Hands-on) ---------- */
.tier-mixed { color: var(--text-2); background: var(--sunken); border-color: var(--line-strong); }
.tier-trusted { color: var(--accent-text); background: var(--accent-soft); border-color: transparent; }
.tool.is-trusted { background: linear-gradient(90deg, var(--accent-soft), transparent 55%); }
.tool-actions { grid-column: 1 / -1; display: grid; gap: 6px; margin: 6px 0 2px; padding-left: 14px; border-left: 2px solid var(--line-strong); }
.tool-action { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; }
.tool-action code { background: none; border: 0; padding: 0; min-width: 72px; font-weight: 600; }
.trust-ctl { grid-column: 1 / -1; display: inline-flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-left: auto; }
.tool-action .trust-ctl { grid-column: auto; }
.trust-switch { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-size: 0.88rem; cursor: pointer; }
.switch.sm { width: 42px; height: 26px; }
.switch.sm .switch-knob { border-radius: 13px; }
.switch.sm .switch-knob::after { width: 18px; height: 18px; top: 4px; left: 4px; }
.switch.sm input:checked + .switch-knob::after { transform: translateX(16px); }
.lock-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 650; color: var(--text-3); border: 1px dashed var(--line-strong); cursor: help; }
.lock-chip .icon { width: 14px; height: 14px; }
.trusted-by { font-size: 0.82rem; }
.limit-note { display: block; font-size: 0.82rem; }
.tool { grid-template-columns: 1fr; }
@media (min-width: 720px) { .tool { grid-template-columns: minmax(200px, 280px) 1fr auto; } .tool > .trust-ctl { grid-column: 1 / -1; } }
.view > section.panel + section.panel, .view > .row-actions + section.panel { margin-top: 16px; }
.view > .row-actions { margin: 4px 0 18px; }
[tabindex="-1"]:focus, [tabindex="-1"]:focus-visible { outline: none; }

/* grid children may shrink below their content, so nothing pushes past a 375px screen */
.detail-body, .land-card, .wl, .wl-body, .view { grid-template-columns: minmax(0, 1fr); min-width: 0; }
.view > *, .detail-body > *, .land-card > * { min-width: 0; max-width: 100%; }
.land-card { justify-items: stretch; }
.land-card.ok { justify-items: center; }
.app-main, .app-content { min-width: 0; }
.diff { overflow-x: auto; }

body:has(.is-viewas) .fx-notch { top: 66px; }
.guide, .success-panel, .wl-body > * { min-width: 0; max-width: 100%; }
.guide .codeblock pre, .guide pre { max-width: 100%; }
.sidebar .org-menu { width: 100%; } .org-menu .role-chip { display: none; }

/* approval landing: full request (masked), click to reveal */
.args-details pre.args-full { margin: 10px 0 0; padding: 12px 14px; max-height: 280px; overflow: auto; border-radius: 12px; background: var(--surface-2, rgba(127,127,127,.08)); border: 1px solid var(--line, rgba(127,127,127,.18)); font: 12.5px/1.55 var(--mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace); white-space: pre-wrap; word-break: break-word; }
.args-details .args-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.args-details .args-note { margin: 0; }

/* ---------- design v2 overrides (docs/DESIGN-DIRECTION.md): no gradients, no glow, no glass, hairlines ---------- */
.attention { background: var(--danger-bg); }
.tl-rows::before { background: var(--line); }
.wl-progress i { background: var(--text); }
.tool.is-trusted { background: var(--sunken); }
.arm-card.is-armed { box-shadow: 0 0 0 1px var(--write-line); }
.app-shell .sidebar, .sidebar { box-shadow: none; }
/* no lifts or tilts anywhere in the app */
.app-shell .glass:hover, .conn-card:hover, .tile:hover { transform: none; }
.tab-link:hover, .conn-card:hover, .pick-tile:hover, .pick-tile:focus-visible, .preset-card:hover { transform: none; box-shadow: none; }
.conn-card:hover, .pick-tile:hover, .preset-card:hover { border-color: var(--line-strong); }
@keyframes pop { from { opacity: 0; filter: blur(4px); } }
@keyframes notch-in { from { opacity: 0; filter: blur(6px); } }
@keyframes slide-in { from { opacity: 0; filter: blur(4px); } }
@keyframes wobble { from { transform: none; } to { transform: none; } }
/* design v2: flush sidebar with a hairline edge, quiet weights, monochrome avatars, flat cards */
@media (min-width: 960px) {
  .sidebar { inset: 0 auto 0 0; width: var(--sidew); border-radius: 0; border-width: 0 1px 0 0; background: var(--bg-2); }
}
.topbar { border-radius: var(--r-l); top: 8px; }
.tabbar { border-radius: var(--r-l); box-shadow: none; }
.tab-link { border-radius: var(--r-m); font-weight: 550; }
.side-link { border-radius: var(--r-m); font-weight: 500; }
.side-link[aria-current="page"] { background: var(--sunken); color: var(--text); }
.avatar, :root[data-theme="dark"] .avatar { color: var(--text); background: var(--surface-2); border: 1px solid var(--line); }
.role-chip { border-radius: var(--r-s); letter-spacing: 0.01em; text-transform: none; font-weight: 600; }
.org-menu-title, .tl-day-title, .wl-count { letter-spacing: 0; text-transform: none; font-weight: 600; }
.land-card { box-shadow: none; border-radius: var(--r-l); }
.view { animation: view-in 0.35s var(--ease) both; }
@keyframes view-in { from { opacity: 0; filter: blur(4px); } }

/* ---------- design v3: account menu, org menu motion, chevrons ---------- */
.account-wrap { position: relative; }
.user-chip { width: 100%; border: 1px solid transparent; border-radius: var(--r-m); background: none; text-align: left; color: inherit; font: inherit; cursor: pointer; transition: background-color 0.15s var(--ease), border-color 0.15s var(--ease); }
.user-chip:hover, .user-chip[aria-expanded="true"] { background: var(--sunken); border-color: var(--line); }
.user-chip .user-text { flex: 1; min-width: 0; }
.user-chip .org-chev { margin-left: auto; }
.account-menu { top: auto; bottom: calc(100% + 8px); --pop-origin: bottom left; }
.org-menu { border-radius: var(--r-l); }
.org-menu .org-item { transition: background-color 0.15s var(--ease); }
.org-chev { transition: transform 0.2s var(--ease); }
[aria-expanded="true"] > .org-chev { transform: rotate(180deg); }
.org-menu.floating { position: fixed; top: 64px; left: 12px; z-index: 120; }
@media (prefers-reduced-motion: reduce) { .org-chev { transition: none; } }
.sb-icon .spinner { border-color: color-mix(in srgb, currentColor 30%, transparent); border-top-color: currentColor; }

/* ---------- connected AI apps (settings, connection access) ---------- */
.app-rows .app-row { align-items: center; }
.app-name { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.app-name .pill { font-size: 0.72rem; }
.app-name .pill .icon { width: 12px; height: 12px; }
.app-times { font-size: 0.8rem; }

/* ---------- two-step sign in (settings) ---------- */
.tf { display: grid; gap: 16px; }
.tf-lead { max-width: 62ch; }
.tf-required { grid-template-columns: auto minmax(0, 1fr); display: grid; gap: 8px; align-items: start; }
.tf-steps { display: grid; gap: 22px; margin: 0; padding: 0; list-style: none; counter-reset: tf; }
.tf-steps > li { counter-increment: tf; display: grid; gap: 6px; padding-left: 40px; position: relative; max-width: 560px; }
.tf-steps > li::before { content: counter(tf); position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line-strong); display: grid; place-items: center; font: 600 0.8rem/1 var(--font); color: var(--text-2); }
.tf-qr { margin-top: 6px; width: 188px; padding: 8px; border: 1px solid var(--line); border-radius: var(--r-m); background: #fff; }
.qr { display: block; width: 100%; height: auto; }
.qr .qr-bg { fill: #fff; }
.qr .qr-fg { fill: #0a0a0a; }
.tf-keyrow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tf-key { font-size: 0.92rem; letter-spacing: 0.04em; padding: 6px 10px !important; overflow-wrap: anywhere; }
.tf-on-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--text-2); }
.tf-kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 0; }
.tf-kv > div { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-m); }
.tf-kv dt { font-size: 0.8rem; color: var(--text-3); }
.tf-kv dd { margin: 2px 0 0; font-weight: 550; }
.tf-low { color: var(--write); }
.tf-codes-box { display: grid; gap: 12px; padding: 16px; border: 1px solid var(--line-strong); border-radius: var(--r-l); background: var(--bg-2); max-width: 560px; }
.tf-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 18px; margin: 0; padding: 0 0 0 22px; font-variant-numeric: tabular-nums; }
.tf-codes code { font-size: 0.92rem; background: none; border: 0; padding: 0; }
@media (max-width: 520px) { .tf-codes { grid-template-columns: 1fr; } .tf-steps > li { padding-left: 34px; } }

/* ---------- connection settings ---------- */
.set-form .hint { max-width: 62ch; }

/* picker tiles: the shared logo fits the tile (no clipping), product names sit beside company marks */
.pick-tile { min-width: 0; }
.pick-logo { min-width: 0; max-width: 100%; }
.pick-logo .ww-mark { flex-wrap: wrap; justify-content: flex-start; gap: 4px 8px; }
.pick-logo .ww-logo-label { font-size: 0.95rem; white-space: nowrap; }
.pick-request .pick-name { font-size: 1.05rem; line-height: 1.25; font-weight: 600; letter-spacing: -0.01em; padding-right: 28px; }
/* rows with a leading icon (connected AI apps, passkeys): icon, text, actions */
.rows .app-row, .rows .pk-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px 14px; }
.pk-row .row-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 560px) { .rows .app-row, .rows .pk-row { grid-template-columns: auto minmax(0, 1fr); } .rows .app-row > :last-child, .rows .pk-row > :last-child { grid-column: 2; justify-self: start; } }
/* page frames drawn inside an overlay lose their own card chrome (the overlay is the card) */
.ov-bare .landing { border: 0; box-shadow: none; background: none; padding: 0; margin: 0; max-width: none; }
.ov-bare .land-card, .ov-bare > .ov-body > .empty.glass { border: 0; box-shadow: none; background: none; padding: 0; }

/* ---------- home: four calm blocks ---------- */
.home-block { display: grid; gap: 12px; margin-top: 28px; }
.home-block:first-of-type { margin-top: 8px; }
.home-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.home-head .h3 { display: inline-flex; align-items: center; gap: 8px; }
.home-note { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--r-l); color: var(--text); text-decoration: none; }
.home-note > span { flex: 1; }
.home-note.warn { border-color: var(--write-line); background: var(--write-bg); }
.home-conn { position: relative; }
.home-conn .conn-top { align-items: center; }
.home-quick { margin-left: auto; }
.home-conn-link { display: block; color: var(--text); text-decoration: none; }
.home-conn-link:hover { text-decoration: underline; }
.home-conn-link::after { content: ""; position: absolute; inset: 0; z-index: 0; }
.home-conn .home-quick { position: relative; z-index: 1; }
.home-list .row { padding: 10px 0; }
.home-ev { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.member-open { font: inherit; font-weight: 600; color: var(--text); }
.tool-about { margin-left: 2px; vertical-align: middle; }

/* ---------- permissions rows: name, info button, description, badge (Ryan 10/13: short descriptions drifted right) ---------- */
/* The info button sat in the 1fr column, which pushed short descriptions into the far right auto column. Every
   piece now has its own column, so descriptions always start at the same left edge. */
.tool { grid-template-columns: minmax(0, 1fr) auto; }
.tool > .tool-name { grid-column: 1; }
.tool > .tool-about { grid-column: 2; grid-row: 1; justify-self: end; margin-left: 0; }
.tool > .tool-desc, .tool > .tier, .tool > .lock-chip { grid-column: 1 / -1; }
.tool > .tier, .tool > .lock-chip { justify-self: start; }
@media (min-width: 720px) {
  .tool { grid-template-columns: minmax(200px, 280px) auto minmax(0, 1fr) auto; align-items: start; }
  .tool > .tool-name { grid-column: 1; padding-top: 2px; }
  .tool > .tool-about { grid-column: 2; grid-row: 1; justify-self: start; }
  .tool > .tool-desc { grid-column: 3; text-align: left; }
  .tool > .tier, .tool > .lock-chip { grid-column: 4; grid-row: 1; justify-self: end; }
}
.tool > .tool-actions, .tool > .trust-ctl { grid-column: 1 / -1; }

/* ---------- Settings, Plan and billing (views/billing.js) and the quiet sidebar plan link ---------- */
.plan-now { display: grid; gap: 6px; }
.plan-name { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 1.15rem; }
.usage-list { list-style: none; margin: 0; padding: 0; display: grid; border-top: 1px solid var(--line); }
.usage-row { display: grid; gap: 6px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.usage-top { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.usage-label { color: var(--text-2); }
.usage-value { font-variant-numeric: tabular-nums; font-weight: 600; }
.usage-bar { height: 4px; border-radius: 999px; background: var(--sunken); overflow: hidden; }
.usage-bar > i { display: block; height: 100%; width: var(--w, 0%); background: var(--text-2); border-radius: inherit; }
.usage-row.is-full .usage-bar > i { background: var(--write); }
.usage-hint { margin: 0; font-size: 0.86rem; }
.plan-adds { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.plan-adds li { display: flex; align-items: flex-start; gap: 10px; }
.plan-adds .icon { width: 16px; height: 16px; margin-top: 3px; flex: none; color: var(--text-2); }
.plan-thanks { display: flex; align-items: flex-start; gap: 10px; padding: 14px 16px; margin-bottom: 18px; border: 1px solid var(--signal-line); border-radius: var(--r-m, 10px); }
.plan-thanks .icon { color: var(--signal); margin-top: 2px; flex: none; }
.plan-thanks p { margin: 0; }
.side-plan { color: var(--text-3); }
.side-plan:hover { color: var(--text); }
.upgrade-link { color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
