/* CRM v2 · shell e componentes (02-ia-wireframes §2.3, §3, §5). Tokens em styles.css. */

/* ——— foco e base ——— */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
h1[tabindex="-1"]:focus, .v2-view:focus { outline: none; box-shadow: none; }
.v2-skip { position: absolute; left: 8px; top: -60px; z-index: 100; padding: 8px 12px; background: var(--card); color: var(--ink); border-radius: 8px; }
.v2-skip:focus { top: 8px; }
kbd { font-family: var(--font); font-size: var(--fs-xs); padding: 1px 5px; border: 1px solid var(--line-strong); border-radius: 4px; color: var(--muted); background: var(--bg); }
.v2-faint { color: var(--faint); }
.v2-nodata { color: var(--faint); font-style: italic; }
.mono { font-family: var(--mono); font-size: 0.92em; }
a.btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.btn.primary.danger { background: #b91c1c; }
.btn.primary.danger:hover:not(:disabled) { background: #991b1b; }
.btn.sm { padding: 0.3rem 0.6rem; font-size: var(--fs-sm); }
.icon-btn:focus-visible { box-shadow: var(--focus); }

/* ——— shell: sidebar (links) ——— */
a.side-link { text-decoration: none; }
.side-link[aria-current="page"] { background: rgba(255, 15, 69, 0.12); color: var(--ink); }
.side-link[aria-current="page"] .icon { color: var(--brand); }
.side-link[aria-current="page"]::before { content: ""; position: absolute; left: -0.5rem; top: 0.45rem; bottom: 0.45rem; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand); }
.side-count { font-family: var(--font); font-variant-numeric: tabular-nums; background: var(--surface); color: var(--muted); }
.side-count.ai { background: var(--accent-bg); color: var(--accent-ink); }
.side-count.dot { width: 8px; height: 8px; padding: 0; background: var(--warn); }
.side-label.side-fold { display: flex; align-items: center; gap: 0.5rem; width: 100%; border: 0; background: none; cursor: pointer; text-align: left; font: inherit; font-size: 0.66rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); }
.side-fold[aria-expanded="false"] + .fav-list { display: none; }
.side-fold .icon { width: 14px; height: 14px; }
.fav-list { list-style: none; display: grid; gap: 2px; }
.fav-list li { display: flex; align-items: center; border-radius: 8px; }
.fav-list li.drag-over { box-shadow: inset 0 2px 0 var(--brand); }
.fav-list a { flex: 1; min-width: 0; padding: 0.4rem 0.65rem 0.4rem 1.85rem; color: var(--muted); text-decoration: none; font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-radius: 8px; }
.fav-list a:hover { background: var(--surface); color: var(--ink); }
.fav-list a[aria-current="page"] { color: var(--ink); background: var(--surface); }
@media (min-width: 900px) {
  .shell.side-collapsed .side-favs { display: none; }
  .shell.side-collapsed .side-count.dot { width: 8px; height: 8px; }
}

/* ——— topbar ——— */
.topbar {
  position: sticky; top: 0; z-index: var(--z-topbar);
  display: flex; align-items: center; gap: 0.6rem;
  height: var(--topbar-h); padding: 0 1rem;
  background: rgba(10, 10, 10, 0.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.tb-menu, .tb-logo { display: none; }
.tb-logo img { width: 30px; height: 30px; border-radius: 8px; display: block; }
.tb-spacer { flex: 1; }
.tb-search {
  display: flex; align-items: center; gap: 0.55rem;
  width: min(420px, 38vw); height: 36px; padding: 0 0.6rem 0 0.75rem;
  border: 1px solid var(--line-strong); border-radius: 8px; background: var(--card);
  color: var(--faint); font: inherit; font-size: var(--fs-md); text-align: left; cursor: text;
}
.tb-search:hover { border-color: var(--field-line); color: var(--muted); }
.tb-search-text { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tb-health, .tb-balance { display: inline-flex; align-items: center; gap: 0.45rem; height: 32px; padding: 0 0.6rem; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: var(--fs-sm); white-space: nowrap; }
.tb-health:hover, .tb-balance:hover { background: var(--surface); color: var(--ink); }
.tb-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.tb-health[data-tone="ok"] .tb-dot { background: var(--ok); }
.tb-health[data-tone="warn"] .tb-dot { background: var(--warn); }
.tb-health[data-tone="error"] .tb-dot { background: var(--danger); }
.tb-health[data-tone="error"] { color: var(--danger); }
.tb-balance.credits { border-left: 0; padding-left: 0.6rem; }
.tb-balance.credits span { font-size: var(--fs-xs); }
.tb-balance.credits strong { font-family: var(--font); font-variant-numeric: tabular-nums; font-weight: 600; font-size: var(--fs-md); }
.tb-copilot { display: inline-flex; align-items: center; gap: 0.3rem; height: 34px; padding: 0 0.75rem; white-space: nowrap; }
.tb-copilot kbd { background: transparent; color: #eadcff; border-color: rgba(255, 255, 255, 0.3); }
.tb-avatar { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font: inherit; font-size: var(--fs-xs); font-weight: 700; cursor: pointer; text-transform: uppercase; }
.tb-create .btn, #tbCreate .btn { height: 34px; display: inline-flex; align-items: center; gap: 0.35rem; white-space: nowrap; }

/* ——— crumbs ——— */
.crumbs { display: flex; align-items: center; gap: 0.75rem; width: min(1440px, calc(100% - 3rem)); margin: 0.9rem auto -0.6rem; font-size: var(--fs-sm); color: var(--muted); min-width: 0; }
.crumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; list-style: none; flex: 1; min-width: 0; }
.crumbs li { display: inline-flex; align-items: center; gap: 0.35rem; min-width: 0; }
.crumbs li + li::before { content: "›"; color: var(--faint); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }
.crumbs [aria-current="page"] { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60ch; }
.fav-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 8px; background: none; color: var(--faint); cursor: pointer; }
.fav-btn:hover { background: var(--surface); color: var(--ink); }
.fav-btn[aria-pressed="true"] { color: var(--st-vip); }
.fav-btn[aria-pressed="true"] .icon { fill: currentColor; }

/* ——— view / página ——— */
.v2-view { display: block; min-height: calc(100dvh - var(--topbar-h)); }
.v2-route > .screen, .v2-view > .screen { display: block; }
.v2-page { width: min(1440px, calc(100% - 3rem)); margin: 0 auto; padding: 1.5rem 0 3rem; min-width: 0; }
.v2-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 0.75rem 1rem; margin-bottom: 1rem; }
.v2-head h1 { font-size: var(--fs-h1); font-weight: 700; letter-spacing: -0.02em; line-height: 1.25; }
.v2-head .v2-title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; min-width: 0; }
.v2-sub { margin-top: 0.25rem; color: var(--muted); font-size: var(--fs-md); }
.v2-actions-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.v2-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; min-width: 0; }
.v2-card > h2, .v2-h2 { font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); margin-bottom: 0.75rem; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.v2-label { font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); }

/* ——— abas ——— */
.v2-tabs { display: flex; gap: 0.15rem; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; margin-bottom: 1rem; }
.v2-tab { flex-shrink: 0; display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.55rem 0.8rem; border-bottom: 2px solid transparent; margin-bottom: -1px; color: var(--muted); font-size: var(--fs-md); font-weight: 600; text-decoration: none; white-space: nowrap; }
.v2-tab:hover { color: var(--ink); }
.v2-tab.on { color: var(--ink); border-bottom-color: var(--brand); }
.v2-count { padding: 0 0.4rem; border-radius: 999px; background: var(--surface); color: var(--muted); font-size: var(--fs-xs); font-weight: 600; }
.v2-tab.on .v2-count { color: var(--ink); background: var(--line); }
.v2-tab.muted { color: var(--faint); }

/* ——— menus ——— */
.v2-menu-wrap { position: relative; display: inline-flex; }
.v2-menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: var(--z-dialog); min-width: 220px; max-width: min(320px, calc(100vw - 2rem)); padding: 0.35rem; background: var(--card); border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: var(--shadow); }
.v2-menu.right { left: auto; right: 0; }
.v2-menu[hidden] { display: none; }
.v2-menu-item { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; width: 100%; padding: 0.5rem 0.65rem; border: 0; border-radius: 6px; background: none; color: var(--ink); font: inherit; font-size: var(--fs-md); text-align: left; text-decoration: none; cursor: pointer; }
.v2-menu-item:hover, .v2-menu-item:focus { background: var(--surface); outline: none; box-shadow: none; }
.v2-menu-item:focus-visible { box-shadow: inset 0 0 0 2px var(--brand); }
.v2-menu-item[aria-disabled="true"] { color: var(--faint); cursor: not-allowed; }
.v2-menu-item.danger { color: var(--danger); }
.v2-menu-item.hidden { display: none; }
.v2-menu-hint { color: var(--faint); font-size: var(--fs-xs); }
.v2-menu-head { padding: 0.45rem 0.65rem; color: var(--muted); font-size: var(--fs-sm); word-break: break-all; }
.v2-menu-sep { height: 1px; margin: 0.3rem 0; background: var(--line); }

/* ——— selos ——— */
.v2-status { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.15rem 0.45rem; border-radius: 6px; font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap; background: var(--surface); color: var(--muted); }
.v2-status[data-tone="ok"] { background: var(--ok-bg); color: var(--ok); }
.v2-status[data-tone="live"] { background: var(--ok-bg); color: var(--ok); }
.v2-status[data-tone="live"]::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: v2-pulse 1.6s ease-in-out infinite; }
.v2-status[data-tone="warn"] { background: var(--warn-bg); color: var(--warn); }
.v2-status[data-tone="info"] { background: var(--info-bg); color: var(--info); }
.v2-status[data-tone="danger"] { background: var(--danger-bg); color: var(--danger); }
.v2-status[data-tone="ai"] { background: var(--accent-bg); color: var(--accent-ink); }
@keyframes v2-pulse { 50% { opacity: 0.35; } }
.v2-tip { position: relative; display: inline-flex; vertical-align: middle; }
.v2-tip-btn { width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--line-strong); background: none; color: var(--muted); font-size: 10px; font-weight: 700; cursor: help; line-height: 1; }
.v2-tip [role="tooltip"] { position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); z-index: var(--z-dialog); width: max-content; max-width: 260px; padding: 0.4rem 0.55rem; border-radius: 6px; background: var(--ink); color: var(--bg); font-size: var(--fs-sm); font-weight: 500; text-transform: none; letter-spacing: 0; white-space: normal; visibility: hidden; opacity: 0; pointer-events: none; }
.v2-tip:hover [role="tooltip"], .v2-tip-btn:focus-visible + [role="tooltip"] { visibility: visible; opacity: 1; }

/* ——— estados ——— */
.v2-skel { display: grid; grid-template-columns: repeat(var(--cols, 5), minmax(0, 1fr)); gap: 0.9rem 1rem; padding: 0.9rem var(--cell-px); }
.v2-skel-card { display: grid; gap: 0.6rem; }
.v2-empty { padding: 2.5rem 1rem; }
.v2-empty .icon { width: 24px; height: 24px; }
.v2-error, .v2-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; padding: 0.7rem 0.9rem; border-radius: 8px; background: var(--danger-bg); border: 1px solid rgba(248, 113, 113, 0.35); color: var(--ink); font-size: var(--fs-md); margin: 0 0 1rem; }
.v2-error .icon, .v2-banner .icon { color: var(--danger); }
.v2-error p, .v2-banner p { flex: 1 1 16rem; min-width: 0; }
.v2-banner[data-kind="info"] { background: var(--info-bg); border-color: rgba(125, 211, 252, 0.3); }
.v2-banner[data-kind="info"] .icon { color: var(--info); }
.v2-banner[data-kind="warn"] { background: var(--warn-bg); border-color: rgba(253, 186, 116, 0.35); }
.v2-banner[data-kind="warn"] .icon { color: var(--warn); }
.v2-offline { position: sticky; top: var(--topbar-h); z-index: var(--z-sticky); padding: 0.4rem 1rem; background: var(--warn-bg); color: var(--warn); font-size: var(--fs-sm); text-align: center; }

/* ——— toasts ——— */
.v2-toasts { position: fixed; right: 16px; bottom: 16px; z-index: var(--z-toast); display: grid; gap: 0.5rem; width: min(360px, calc(100vw - 32px)); }
.v2-toast { display: flex; align-items: center; gap: 0.5rem; padding: 0.65rem 0.5rem 0.65rem 0.85rem; background: var(--card); border: 1px solid var(--line-strong); border-left: 3px solid var(--info); border-radius: 8px; box-shadow: var(--shadow); font-size: var(--fs-md); animation: v2-toast-in 160ms var(--ease); }
.v2-toast p { flex: 1; min-width: 0; }
.v2-toast[data-kind="ok"] { border-left-color: var(--ok); }
.v2-toast[data-kind="error"] { border-left-color: var(--danger); }
@keyframes v2-toast-in { from { transform: translateY(8px); opacity: 0; } }

/* ——— diálogo e gaveta ——— */
.v2-dialog { margin: auto; width: min(480px, calc(100vw - 2rem)); padding: 1.25rem; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.v2-dialog::backdrop, .v2-drawer::backdrop, .v2-palette::backdrop { background: rgba(0, 0, 0, 0.6); }
.v2-dialog h2 { font-size: var(--fs-h2); margin-bottom: 0.6rem; }
.v2-dialog-body { display: grid; gap: 0.4rem; color: var(--muted); font-size: var(--fs-md); line-height: 1.45; margin-bottom: 0.9rem; }
.v2-dialog .field { margin-bottom: 0.9rem; }
.v2-dialog-actions { display: flex; justify-content: flex-end; gap: 0.5rem; flex-wrap: wrap; }
.v2-drawer { position: fixed; inset: var(--topbar-h) 0 0 auto; margin: 0; height: calc(100dvh - var(--topbar-h)); max-height: none; width: min(480px, 100vw); padding: 0; border: 0; border-left: 1px solid var(--line-strong); background: var(--card); color: var(--ink); display: none; flex-direction: column; animation: v2-drawer-in 200ms var(--ease); }
.v2-drawer[open] { display: flex; }
.v2-drawer.lg { width: min(720px, 100vw); }
@keyframes v2-drawer-in { from { transform: translateX(24px); opacity: 0; } }
.v2-drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.9rem 1rem; border-bottom: 1px solid var(--line); }
.v2-drawer-head h2 { font-size: var(--fs-h2); min-width: 0; overflow-wrap: anywhere; }
.v2-drawer-body { flex: 1; overflow-y: auto; padding: 1rem; display: grid; gap: 0.9rem; align-content: start; }
.v2-drawer-foot { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 0.5rem; padding: 0.75rem 1rem; border-top: 1px solid var(--line); }
.v2-drawer-foot .grow { margin-right: auto; }

/* ——— medidor, prévia ——— */
.v2-meter { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.75rem; font-size: var(--fs-sm); color: var(--muted); }
.v2-meter-bar { width: 80px; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.v2-meter-bar i { display: block; height: 100%; background: var(--ok); }
.v2-meter[data-level="warn"] .v2-meter-bar i { background: var(--warn); }
.v2-meter[data-level="bad"] .v2-meter-bar i { background: var(--danger); }
.v2-phone { width: min(280px, 100%); padding: 0.75rem; border: 1px solid var(--line-strong); border-radius: 18px; background: var(--bg); }
.v2-phone-head { display: flex; justify-content: space-between; color: var(--faint); font-size: var(--fs-xs); margin-bottom: 0.5rem; }
.v2-phone-bubble { padding: 0.6rem 0.75rem; border-radius: 14px 14px 14px 4px; background: var(--surface); font-size: var(--fs-md); line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ——— paleta ——— */
.v2-palette { margin: 15vh auto auto; width: min(640px, calc(100vw - 2rem)); max-height: 70vh; padding: 0; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--card); color: var(--ink); box-shadow: var(--shadow); overflow: hidden; }
.v2-palette[open] { display: flex; flex-direction: column; }
.pal-top { display: flex; align-items: center; gap: 0.6rem; padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--line); }
.pal-top .icon { color: var(--faint); }
.pal-input { flex: 1; min-width: 0; border: 0 !important; background: none; color: var(--ink); font: inherit; font-size: var(--fs-lg); outline: none; padding: 0.2rem 0; }
.pal-input:focus-visible { box-shadow: none; }
.pal-scope { display: flex; gap: 0.25rem; padding: 0.45rem 0.9rem; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.pal-scope button { flex-shrink: 0; padding: 0.2rem 0.55rem; border: 1px solid var(--line); border-radius: 999px; background: none; color: var(--muted); font: inherit; font-size: var(--fs-sm); cursor: pointer; }
.pal-scope button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.pal-list { flex: 1; overflow-y: auto; padding: 0.35rem; list-style: none; }
.pal-group { padding: 0.55rem 0.6rem 0.25rem; font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
.pal-item { display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem 0.6rem; border-radius: 8px; cursor: pointer; min-width: 0; }
.pal-item[aria-selected="true"] { background: var(--surface); box-shadow: inset 2px 0 0 var(--brand); }
.pal-item .icon { color: var(--faint); }
.pal-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-sub { color: var(--faint); font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
.pal-actions { display: flex; gap: 0.25rem; padding: 0.15rem 0.6rem 0.4rem 2.4rem; flex-wrap: wrap; }
.pal-note { padding: 0.75rem 0.9rem; color: var(--muted); font-size: var(--fs-sm); }
.pal-foot { display: flex; flex-wrap: wrap; gap: 0.35rem 0.9rem; padding: 0.5rem 0.9rem; border-top: 1px solid var(--line); color: var(--faint); font-size: var(--fs-xs); }

/* ——— índice (mountIndex) ——— */
.ix-views { margin-bottom: 0.75rem; }
.ix-views .v2-tab[data-mod]::after { content: "•"; color: var(--warn); }
.ix-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.ix-search { flex: 1 1 260px; max-width: 360px; height: 36px; padding: 0 0.7rem; border: 1px solid var(--field-line); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; font-size: var(--fs-md); }
.ix-search:focus { outline: none; border-color: var(--brand); }
.ix-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.ix-chip { display: inline-flex; align-items: center; gap: 0.3rem; height: 28px; padding: 0 0.25rem 0 0.6rem; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--card); font-size: var(--fs-sm); }
.ix-chip b { font-weight: 600; color: var(--muted); }
.ix-chip button { display: grid; place-items: center; width: 22px; height: 22px; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; }
.ix-chip button:hover { background: var(--line); color: var(--ink); }
.ix-chip .icon { width: 13px; height: 13px; }
.ix-quick select { height: 32px; padding: 0 0.5rem; font-size: var(--fs-sm); }
.ix-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.5rem; color: var(--muted); font-size: var(--fs-sm); }
.ix-meta .v2-actions-row { gap: 0.25rem; }
.ix-mod { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--warn); }
.ix-layout { display: flex; gap: 1rem; align-items: flex-start; }
.ix-main { flex: 1; min-width: 0; }
.ix-table-wrap { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); overflow-x: auto; }
.ix-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-sm); }
.ix-table th { position: sticky; top: 0; z-index: 1; height: 36px; padding: 0 var(--cell-px); background: var(--surface); border-bottom: 1px solid var(--line); text-align: left; font-size: var(--fs-xs); font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); white-space: nowrap; }
.ix-table th.num, .ix-table td.num { text-align: right; }
.ix-sort { display: inline-flex; align-items: center; gap: 0.3rem; border: 0; background: none; color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; padding: 0; }
.ix-sort:hover { color: var(--ink); }
.ix-sort .arrow { font-size: 0.8em; color: var(--muted); }
.ix-table td { height: var(--row-h); padding: 0 var(--cell-px); border-bottom: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.ix-dense .ix-table td { height: var(--row-h-compact); }
.ix-table tbody tr:last-child td { border-bottom: 0; }
.ix-table tbody tr { cursor: pointer; }
.ix-table tbody tr:hover { background: var(--surface); }
.ix-table tbody tr.sel { background: rgba(255, 15, 69, 0.07); }
.ix-table .ix-check { width: 40px; padding-right: 0; }
.ix-table input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; }
.ix-table td.ix-name { color: var(--ink); font-weight: 500; }
.ix-name a { color: inherit; text-decoration: none; }
.ix-name a:hover { text-decoration: underline; }
.ix-name .ix-prev { opacity: 0; margin-left: 0.35rem; vertical-align: middle; width: 26px; height: 26px; }
tr:hover .ix-prev, .ix-prev:focus-visible { opacity: 1; }
.ix-table td .sub { margin-left: 0.35rem; color: var(--faint); font-size: var(--fs-xs); }
.ix-bulk { position: sticky; bottom: 0; z-index: var(--z-sticky); display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; padding: 0.6rem 0.75rem; margin-top: 0.5rem; background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.35); font-size: var(--fs-sm); }
.ix-bulk[hidden] { display: none; }
.ix-bulk .grow { flex: 1; }
.ix-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.75rem 0.25rem; color: var(--muted); font-size: var(--fs-sm); }
.ix-pager select { height: 32px; padding: 0 0.4rem; font-size: var(--fs-sm); }
.ix-panel { position: sticky; top: calc(var(--topbar-h) + 12px); width: 360px; flex-shrink: 0; max-height: calc(100dvh - var(--topbar-h) - 24px); overflow-y: auto; display: grid; gap: 0.75rem; align-content: start; padding: 1rem; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--card); }
.ix-panel[hidden] { display: none; }
.ix-panel-head { display: flex; align-items: center; justify-content: space-between; }
.ix-panel-head h2 { font-size: var(--fs-h2); }
.ix-cond { display: grid; grid-template-columns: 1fr auto; gap: 0.35rem; padding: 0.6rem; border: 1px solid var(--line); border-radius: 8px; }
.ix-cond select, .ix-cond input { width: 100%; height: 34px; font-size: var(--fs-sm); }
.ix-cond input { padding: 0 0.5rem; border: 1px solid var(--field-line); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; }
.ix-cond .ix-cond-row { grid-column: 1 / -1; display: flex; gap: 0.35rem; align-items: center; flex-wrap: wrap; }
.ix-cond .ix-cond-row > * { flex: 1 1 120px; }
.ix-stage-pick { display: flex; flex-wrap: wrap; gap: 0.25rem 0.75rem; font-size: var(--fs-sm); }
.ix-stage-pick label { display: inline-flex; align-items: center; gap: 0.3rem; cursor: pointer; }
.ix-panel-foot { display: grid; gap: 0.5rem; padding-top: 0.75rem; border-top: 1px solid var(--line); }
.ix-cols { display: grid; gap: 0.15rem; }
.ix-cols li { display: flex; align-items: center; gap: 0.5rem; padding: 0.3rem 0.4rem; border-radius: 6px; list-style: none; }
.ix-cols li:hover { background: var(--surface); }
.ix-cols li .grip { cursor: grab; color: var(--faint); }
.ix-cards { display: none; list-style: none; }
.ix-card { display: grid; grid-template-columns: auto 1fr auto; gap: 0.15rem 0.6rem; align-items: center; padding: 0.75rem; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.ix-card:last-child { border-bottom: 0; }
.ix-card .t { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ix-card .s { grid-column: 2; color: var(--muted); font-size: var(--fs-sm); }
.ix-card .r { grid-row: 1 / span 2; grid-column: 3; text-align: right; font-size: var(--fs-sm); color: var(--muted); }
.ix-card input { grid-row: 1 / span 2; }
@media (max-width: 1279px) {
  .ix-panel { position: fixed; top: var(--topbar-h); right: 0; bottom: 0; z-index: var(--z-drawer); max-height: none; border-radius: 0; width: min(360px, 100vw); box-shadow: var(--shadow); }
}

/* ——— registro (mountRecord) ——— */
.rec-head { display: grid; gap: 0.5rem; margin-bottom: 1rem; }
.rec-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; }
.rec-top h1 { font-size: var(--fs-h1); font-weight: 700; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.rec-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.6rem; color: var(--muted); font-size: var(--fs-md); }
.rec-sub .dot::before { content: "·"; margin-right: 0.6rem; color: var(--faint); }
.rec-path { display: flex; flex-wrap: wrap; align-items: center; gap: 0; margin-top: 0.25rem; list-style: none; }
.rec-path li { display: flex; align-items: center; font-size: var(--fs-sm); color: var(--faint); }
.rec-path li + li::before { content: ""; width: 18px; height: 2px; margin: 0 0.35rem; background: var(--line-strong); }
.rec-path li.done { color: var(--muted); }
.rec-path li.done + li::before, .rec-path li.cur::before { background: var(--brand); }
.rec-path li.cur { color: var(--ink); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.rec-guide { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; padding: 0.55rem 0.8rem; border-radius: 8px; background: var(--surface); color: var(--muted); font-size: var(--fs-md); }
.rec-hl { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.75rem; margin-bottom: 1rem; }
.rec-hl > div { padding: 0.8rem 0.9rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.rec-hl .v { display: block; margin-top: 0.3rem; font-size: var(--fs-h2); font-weight: 650; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.rec-hl .s { display: block; margin-top: 0.15rem; color: var(--muted); font-size: var(--fs-sm); }
.rec-hl [data-tone="warn"] .v { color: var(--warn); }
.rec-hl [data-tone="bad"] .v { color: var(--danger); }
.rec-hl [data-tone="good"] .v { color: var(--ok); }
.rec-grid { display: grid; grid-template-columns: 280px minmax(0, 1fr) 320px; gap: 1rem; align-items: start; }
.rec-about dl { display: grid; gap: 0.55rem; }
.rec-about dl > div { display: grid; grid-template-columns: 110px 1fr; gap: 0.5rem; font-size: var(--fs-md); }
.rec-about dt { color: var(--faint); font-size: var(--fs-sm); }
.rec-about dd { min-width: 0; overflow-wrap: anywhere; }
.rec-tl-filters { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-bottom: 0.75rem; }
.rec-tl { list-style: none; display: grid; gap: 0; }
.rec-tl .day { padding: 0.75rem 0 0.35rem; font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
.rec-tl .ev { display: grid; grid-template-columns: 14px 1fr auto; gap: 0.6rem; padding: 0.45rem 0; border-bottom: 1px solid var(--line); font-size: var(--fs-md); }
.rec-tl .ev::before { content: ""; width: 8px; height: 8px; margin-top: 0.4rem; border-radius: 50%; background: var(--c, var(--faint)); }
.rec-tl .ev[data-kind="deposit"] { --c: var(--ok); }
.rec-tl .ev[data-kind="sms"] { --c: var(--info); }
.rec-tl .ev[data-kind="click"] { --c: var(--accent-ink); }
.rec-tl .ev[data-kind="reply"] { --c: var(--warn); }
.rec-tl .ev[data-kind="optout"], .rec-tl .ev[data-kind="failed"] { --c: var(--danger); }
.rec-tl .ev[data-kind="signup"] { --c: var(--brand); }
.rec-tl .ev p { min-width: 0; overflow-wrap: anywhere; }
.rec-tl .ev .t { font-weight: 600; color: var(--ink); }
.rec-tl .ev .d { color: var(--muted); font-size: var(--fs-sm); }
.rec-tl .ev .m { margin-top: 0.25rem; padding: 0.4rem 0.55rem; border-radius: 6px; background: var(--surface); font-size: var(--fs-sm); color: var(--ink); white-space: pre-wrap; }
.rec-tl .ev time { color: var(--faint); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.rec-assoc { display: grid; gap: 1rem; }
.rec-assoc ul { list-style: none; display: grid; gap: 0.15rem; }
.rec-assoc li a, .rec-assoc li span.it { display: block; padding: 0.35rem 0.45rem; border-radius: 6px; color: var(--ink); text-decoration: none; font-size: var(--fs-md); }
.rec-assoc li a:hover { background: var(--surface); }
.rec-assoc li small { display: block; color: var(--muted); font-size: var(--fs-sm); }
.rec-assoc .empty { color: var(--faint); font-size: var(--fs-sm); padding: 0.2rem 0.45rem; }
.rec-col { display: grid; gap: 1rem; align-content: start; min-width: 0; }
@media (max-width: 1279px) {
  .rec-grid { grid-template-columns: 280px minmax(0, 1fr); }
  .rec-grid > .rec-col-assoc { grid-column: 1; grid-row: 2; }
  .rec-grid > .rec-col-tl { grid-column: 2; grid-row: 1 / span 2; }
}

/* ——— formulários v2 ——— */
.v2-form { display: grid; gap: 0.75rem; }
.v2-form .field { margin: 0; }
.v2-form textarea, .v2-form input[type="text"], .v2-form input[type="email"], .v2-form select { width: 100%; }
.v2-choice { display: grid; gap: 0.4rem; }
.v2-choice label { display: flex; align-items: flex-start; gap: 0.5rem; padding: 0.55rem 0.7rem; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.v2-choice label:has(input:checked) { border-color: var(--brand); background: rgba(255, 15, 69, 0.06); }
.v2-checks { display: flex; flex-wrap: wrap; gap: 0.35rem 0.9rem; font-size: var(--fs-sm); }
.v2-checks span { display: inline-flex; align-items: center; gap: 0.3rem; }
.v2-checks .ok { color: var(--ok); }
.v2-checks .bad { color: var(--danger); }
.v2-checks .warn { color: var(--warn); }

/* ——— segmentos / construtor / config ——— */
.v2-split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1rem; align-items: start; }
.v2-sticky { position: sticky; top: calc(var(--topbar-h) + 12px); }
.sg-rules { display: grid; gap: 0.5rem; }
.sg-and { font-size: var(--fs-xs); font-weight: 700; color: var(--faint); letter-spacing: 0.08em; }
.sg-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; padding: 0.5rem; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
.sg-row select, .sg-row input[type="number"], .sg-row input[type="text"] { height: 34px; font-size: var(--fs-sm); }
.sg-row input[type="text"] { padding: 0 0.5rem; border: 1px solid var(--field-line); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; }
.sg-row .grow { flex: 1 1 140px; }
.sg-row.locked { color: var(--muted); font-size: var(--fs-sm); background: var(--surface); }
.sg-big { font-size: var(--fs-kpi); font-weight: 650; font-variant-numeric: tabular-nums; }
.sg-sample { list-style: none; display: grid; gap: 0.1rem; margin-top: 0.5rem; }
.sg-sample li { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.3rem 0; border-bottom: 1px solid var(--line); font-size: var(--fs-sm); }
.sg-sample li > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sg-models { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.75rem; margin-top: 1rem; text-align: left; }
.cfg { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.cfg-nav { position: sticky; top: calc(var(--topbar-h) + 12px); display: grid; gap: 2px; }
.cfg-nav .v2-label { padding: 0 0.65rem 0.4rem; }
.cfg-nav a { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.5rem 0.65rem; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: var(--fs-md); font-weight: 550; }
.cfg-nav a:hover { background: var(--surface); color: var(--ink); }
.cfg-nav a[aria-current="page"] { background: rgba(255, 15, 69, 0.12); color: var(--ink); }
.cfg-body { display: grid; gap: 1rem; min-width: 0; }
.cfg-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; }
.cfg-row h3 { font-size: var(--fs-lg); font-weight: 650; }
.cfg-kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0.75rem; margin-top: 0.75rem; }
.cfg-kv div span { display: block; color: var(--faint); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.cfg-kv div strong { display: block; margin-top: 0.2rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.cfg-spark { display: flex; align-items: flex-end; gap: 2px; height: 40px; margin-top: 0.75rem; }
.cfg-spark i { flex: 1; min-height: 2px; background: var(--info); border-radius: 2px 2px 0 0; opacity: 0.85; }
.cfg-rules { list-style: none; display: grid; gap: 0.35rem; }
.cfg-rules li { display: flex; gap: 0.5rem; align-items: baseline; font-size: var(--fs-md); }
.cfg-rules li::before { content: "✓"; color: var(--ok); font-weight: 700; }
.v2-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.v2-table th { padding: 0.5rem 0.6rem; text-align: left; font-size: var(--fs-xs); font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); border-bottom: 1px solid var(--line); }
.v2-table td { padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--line); color: var(--muted); }
.v2-table td:first-child { color: var(--ink); }
.v2-table .num { text-align: right; }
.v2-scroll-x { overflow-x: auto; }

/* ——— bottombar (celular) ——— */
.bottombar { display: none; }

/* ——— responsivo ——— */
@media (max-width: 1100px) {
  .tb-copilot kbd, .tb-search kbd { display: none; }
  .tb-health-text { display: none; }
}
@media (max-width: 899px) {
  .mobile-bar { display: none !important; }
  .tb-menu { display: inline-grid; }
  .tb-search { width: 36px; padding: 0; justify-content: center; }
  .tb-search-text { display: none; }
  .tb-copilot-text { display: none; }
  .crumbs, .v2-page { width: calc(100% - 2rem); }
  .v2-split, .cfg { grid-template-columns: minmax(0, 1fr); }
  .cfg-nav { position: static; display: flex; overflow-x: auto; scrollbar-width: none; }
  .cfg-nav .v2-label { display: none; }
  .cfg-nav a { flex-shrink: 0; }
  .v2-sticky { position: static; }
  .rec-grid { grid-template-columns: minmax(0, 1fr); }
  .rec-grid > .rec-col-assoc, .rec-grid > .rec-col-tl { grid-column: auto; grid-row: auto; }
  .rec-hl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 719px) {
  .tb-menu, .tb-health, .tb-balance, #btnSearch { display: none; }
  .tb-logo { display: block; }
  .topbar { padding: 0 0.75rem; gap: 0.4rem; }
  .bottombar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-topbar);
    display: grid; grid-template-columns: repeat(5, 1fr);
    height: calc(58px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: var(--card); border-top: 1px solid var(--line);
  }
  .bottombar a, .bottombar button { display: grid; place-items: center; align-content: center; gap: 2px; min-height: 48px; border: 0; background: none; color: var(--muted); font: inherit; font-size: var(--fs-xs); font-weight: 600; text-decoration: none; cursor: pointer; }
  .bottombar [aria-current="page"] { color: var(--ink); }
  .bottombar [aria-current="page"] .icon { color: var(--brand); }
  .v2-view { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .v2-toasts { bottom: calc(70px + env(safe-area-inset-bottom)); }
  .v2-palette { margin: 0; width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; }
  .v2-drawer, .v2-drawer.lg { inset: 0; width: 100vw; height: 100dvh; border-left: 0; }
  .ix-table-wrap.has-cards .ix-table { display: none; }
  .ix-table-wrap.has-cards .ix-cards { display: block; }
  .ix-search { max-width: none; }
  .ix-bulk { bottom: calc(62px + env(safe-area-inset-bottom)); }
  .rec-about dl > div { grid-template-columns: 100px 1fr; }
  .v2-head h1, .rec-top h1 { font-size: 1.3rem; }
}
@media (prefers-reduced-motion: reduce) {
  .v2-status[data-tone="live"]::before { animation: none; }
}
@media (max-width: 899px) {
  .sidebar { z-index: 36; }
  body.nav-open .side-backdrop { z-index: 35; }
}
.side-favs[hidden], .crumbs[hidden] { display: none; }
@media (min-width: 1100px) { .ix-table-wrap:not(.narrow) { overflow: visible; } .ix-table-wrap:not(.narrow) .ix-table th { top: var(--topbar-h); } }
@media (max-width: 719px) { .rec-grid.tl-first > .rec-col-tl { order: -1; } }
.rec-tl .ev .d a { color: var(--info); }
.rec-tl-filters { align-items: center; }
[hidden] { display: none !important; }
a.chip { text-decoration: none; display: inline-flex; align-items: center; }
.ix-table td { max-width: 360px; overflow: hidden; text-overflow: ellipsis; }
.ix-table td.ix-name { max-width: 420px; }
.sg-row > select { flex: 0 1 220px; width: auto; min-width: 0; }
.sg-row > .grow, .sg-row > span.grow { flex: 1 1 160px; min-width: 0; }
.sg-row input[type="number"] { width: 100px; }
.sg-sample li > span:first-child { flex: 1; min-width: 0; }
.v2-sticky { max-height: calc(100dvh - var(--topbar-h) - 24px); overflow-y: auto; }
.v2-split > * { min-width: 0; }
@media (max-width: 719px) {
  .sg-table th:nth-child(3), .sg-table td:nth-child(3), .sg-table th:nth-child(4), .sg-table td:nth-child(4) { display: none; }
  .sg-table td.ix-name { white-space: normal; max-width: none; }
  .sg-table td .sub { display: block; margin: 0; }
}
.ix-card { grid-template-columns: minmax(0, 1fr) auto; }
.ix-card .t { grid-column: 1; grid-row: 1; }
.ix-card .r { grid-column: 2; grid-row: 1; }
.ix-card .s { grid-column: 1 / -1; grid-row: 2; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
button.v2-tab { border: 0; border-bottom: 2px solid transparent; background: none; font: inherit; font-size: var(--fs-md); font-weight: 600; cursor: pointer; }
/* QA-18: sessão salva sendo conferida — não mostra o login piscando */
.tc-checking #authGate { display: none !important; }
.tc-checking body::after { content: "Verificando sessão…"; position: fixed; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: var(--fs-md); background: var(--bg); }
