:root {
  --bg: #f3f5f7; --surface: #ffffff; --surface-2: #f7f8fa; --surface-3: #eef1f4;
  --border: #e6e9ee; --border-strong: #d3d8e0;
  --text: #151a22; --text-2: #3a4250; --muted: #7a8494;
  --accent: #f05a1a; --accent-strong: #d94c10; --accent-soft: #fff2eb; --accent-border: #fbd3bf; --on-accent: #ffffff;
  --ok: #16a34a; --ok-soft: #e8f7ee; --warn: #b7791f; --warn-soft: #fdf5e1;
  --bad: #dc2626; --bad-soft: #fdecec; --new: #7c3aed; --new-soft: #f1eafe;
  --sun: #f59e0b; --sun-soft: #fff4d6;
  --side-glow: #fff1e8;
  --shadow: 0 1px 2px rgba(21,26,34,.04), 0 8px 24px rgba(21,26,34,.04);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1117; --surface: #141a22; --surface-2: #10161d; --surface-3: #1c242e;
    --border: #262f3b; --border-strong: #354152;
    --text: #e8edf3; --text-2: #c2ccd8; --muted: #8995a5;
    --accent: #f26a2a; --accent-strong: #ff8a52; --accent-soft: #2a1a12; --accent-border: #5a2e17; --on-accent: #ffffff;
    --ok: #4ade80; --ok-soft: #10301d; --warn: #fbbf24; --warn-soft: #33270c;
    --bad: #f87171; --bad-soft: #3a1517; --new: #b794ff; --new-soft: #2a1d47;
    --sun: #fbbf24; --sun-soft: #33270c; --side-glow: #1d1510;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1117; --surface: #141a22; --surface-2: #10161d; --surface-3: #1c242e;
  --border: #262f3b; --border-strong: #354152;
  --text: #e8edf3; --text-2: #c2ccd8; --muted: #8995a5;
  --accent: #f26a2a; --accent-strong: #ff8a52; --accent-soft: #2a1a12; --accent-border: #5a2e17; --on-accent: #ffffff;
  --ok: #4ade80; --ok-soft: #10301d; --warn: #fbbf24; --warn-soft: #33270c;
  --bad: #f87171; --bad-soft: #3a1517; --new: #b794ff; --new-soft: #2a1d47;
  --sun: #fbbf24; --sun-soft: #33270c; --side-glow: #1d1510;
  --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 'Geist', system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { font-family: 'DM Sans', 'Geist', sans-serif; margin: 0; letter-spacing: -.01em; }
small { color: var(--muted); }
.muted { color: var(--muted); }
.mono-label { font-family: 'Geist Mono', ui-monospace, monospace; font-size: 9.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 272px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: linear-gradient(165deg, var(--side-glow) 0%, var(--surface) 26%); border-right: 1px solid var(--border); padding: 22px 14px 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 8px; padding: 4px 8px 22px; }
.brand b { font: 800 27px/1 'DM Sans', sans-serif; letter-spacing: .02em; }
.brand span { background: var(--accent); color: #fff; font: 700 11px/1 'DM Sans', sans-serif; padding: 4px 18px 4px 6px; letter-spacing: .04em; }
.ws { display: flex; align-items: center; gap: 12px; border: 1px solid var(--border); border-radius: 14px; padding: 10px 12px; background: var(--surface); margin-bottom: 10px; }
.ws > span { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); flex: none; }
.ws strong { display: block; font-size: 14px; }
.ws small { font-size: 12px; }
.ws > svg { margin-left: auto; color: var(--muted); }
.nav-label { display: block; font-family: 'Geist Mono', ui-monospace, monospace; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .2em; color: var(--muted); padding: 18px 10px 6px; }
.nav-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 0; border-radius: 10px; background: none; color: var(--text-2); text-align: left; cursor: default; font-size: 14.5px; font-weight: 500; }
.nav-item svg { flex: none; color: var(--muted); }
.nav-item.is-link { cursor: pointer; }
.nav-item.is-link:hover { background: var(--surface-2); }
.nav-item.is-active { background: var(--accent-soft); color: var(--text); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.nav-item.is-active svg { color: var(--accent); }
.side-account { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 14px 8px 0; border-top: 1px solid var(--border); }
.side-account strong { display: block; font-size: 14px; }
.side-account small { font-size: 12px; }

.workspace { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 28px 12px; }
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.weather { display: flex; align-items: center; gap: 12px; padding: 8px 14px 8px 10px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.weather > span:first-child { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--sun-soft); color: var(--sun); }
.weather strong { display: flex; align-items: center; gap: 4px; font-size: 13px; }
.weather strong svg { color: var(--accent); }
.weather small { font-size: 12px; }
.weather b { font: 700 20px 'DM Sans', sans-serif; margin-left: 4px; }
.weather b sup { color: var(--accent); }
.theme-seg { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); }
.theme-seg button { display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 50%; background: none; color: var(--muted); }
.theme-seg button.is-active { background: var(--accent); color: #fff; }
.icon-btn { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); }
.icon-btn:hover { background: var(--surface-2); }
.menu-btn { display: none; border-radius: 10px; }
.profile { display: flex; align-items: center; gap: 10px; padding: 6px 12px 6px 6px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; font-size: 12.5px; flex: none; }
.profile strong { display: block; font-size: 13px; font-weight: 500; }
.profile small { font-size: 11.5px; }
.profile > svg { color: var(--muted); margin-left: 6px; }

.page { padding: 4px 28px 48px; }

/* ---------- demo bar ---------- */
.demo-bar { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; margin-bottom: 16px; border: 1px dashed var(--border-strong); border-radius: 14px; background: var(--surface-2); font-size: 13px; }
.demo-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.demo-row > strong { display: flex; align-items: center; gap: 6px; }
.demo-desc { color: var(--text-2); }
.demo-desc b { color: var(--accent); }
.tag-new { display: inline-block; padding: 1px 6px; border-radius: 6px; background: var(--new-soft); color: var(--new); font-size: 10px; font-weight: 700; letter-spacing: .05em; vertical-align: middle; }
.grow { flex: 1 1 auto; }

.seg { display: inline-flex; padding: 4px; gap: 2px; border-radius: 12px; background: var(--surface-3); border: 1px solid var(--border); }
.seg button { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 1px solid transparent; border-radius: 9px; background: none; color: var(--text-2); font-size: 13px; font-weight: 600; white-space: nowrap; }
.seg button.is-active { background: var(--surface); color: var(--accent); border-color: var(--accent-border); box-shadow: 0 1px 2px rgba(21,26,34,.06); }
.seg .n { font-size: 11px; padding: 0 6px; border-radius: 8px; background: var(--surface-3); color: var(--muted); }
.seg button.is-active .n { background: var(--accent-soft); color: var(--accent); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 15px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 600; font-size: 13.5px; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 28%, transparent); }
.btn.primary:hover { background: var(--accent-strong); }
.btn.danger { color: var(--bad); }
.btn.danger-fill { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { border-color: transparent; background: none; }
.btn.small { padding: 6px 11px; font-size: 12.5px; border-radius: 9px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.link-btn { border: 0; background: none; padding: 0; color: var(--muted); font-size: 12.5px; text-decoration: underline; text-underline-offset: 2px; }
.link-btn:hover { color: var(--text); }
.link-accent { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 600; font-size: 13px; }

/* ---------- studio (card único com abas no topo) ---------- */
.studio { border: 1px solid var(--border); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.studio-top { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 18px; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.studio-id { display: flex; align-items: center; gap: 12px; }
.studio-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--accent-border); background: var(--accent-soft); color: var(--accent); flex: none; }
.studio-id strong { display: block; font: 700 16px 'DM Sans', sans-serif; }
.snav { flex: 1 1 520px; display: flex; gap: 6px; min-width: 0; overflow-x: auto; scrollbar-width: thin; }
.studio-top.is-wide .snav { order: 4; flex-basis: 100%; }
.studio-top.is-wide .channel-ready { margin-left: auto; }
.snav button { flex: 1 0 auto; display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid transparent; border-radius: 12px; background: none; text-align: left; color: var(--text-2); position: relative; }
.snav button:hover { background: var(--surface-2); }
.snav button .s-ico { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--surface-3); color: var(--muted); flex: none; }
.snav button.is-active { border-color: var(--accent-border); background: var(--accent-soft); }
.snav button.is-active .s-ico { background: transparent; color: var(--accent); }
.snav button.is-static { cursor: default; }
.snav button.is-static:hover { background: none; }
.snav strong { display: flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--text); white-space: nowrap; }
.snav small { display: block; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.snav .count { min-width: 19px; padding: 0 5px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; text-align: center; line-height: 19px; }
.channel-ready { display: flex; align-items: center; gap: 10px; padding-left: 6px; }
.channel-ready strong { display: block; font-size: 13px; }
.channel-ready small { font-size: 12px; }
.online { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); flex: none; }

.studio-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 22px 30px 20px; border-bottom: 1px solid var(--border); }
.studio-heading .mono-label { display: inline-flex; align-items: center; gap: 6px; }
.studio-heading h1 { font: 500 24px 'DM Sans', sans-serif; margin: 6px 0 4px; }
.studio-heading p { margin: 0; color: var(--text-2); font-size: 13px; max-width: 700px; }
.studio-body { background: var(--surface-2); padding: 26px 30px 32px; display: flex; flex-direction: column; gap: 18px; }

.edit-banner { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 12px; background: var(--warn-soft); color: var(--warn); font-size: 13px; border: 1px solid color-mix(in srgb, var(--warn) 25%, transparent); }
.edit-banner strong { color: var(--text); }

.card { border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.compose-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 22px; align-items: start; }
.compose-card { padding: 22px 24px; display: flex; flex-direction: column; gap: 16px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-weight: 600; font-size: 13px; }
.field-label small { font-weight: 400; margin-left: 6px; }
.control { width: 100%; padding: 11px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); outline: none; font-size: 14.5px; }
.control:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select.control { appearance: none; padding-right: 34px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 52%, calc(100% - 13px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
.field-mini { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }

.recipient-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.recipient-heading label { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.recipient-heading label svg { color: var(--accent); }
.recipient-heading > small { font-size: 12px; }

.audience { display: flex; flex-direction: column; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); }
.note { display: flex; gap: 10px; padding: 11px 13px; border-radius: 11px; font-size: 13px; }
.note svg { flex: none; margin-top: 2px; }
.note strong { display: block; color: var(--text); }
.note small { color: var(--text-2); }
.note.info { background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-border); }
.note.plain { background: var(--surface-3); color: var(--muted); }
.note.warn { background: var(--warn-soft); color: var(--warn); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 30px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px 4px 11px; border-radius: 999px; background: var(--surface); border: 1px solid var(--accent-border); color: var(--text); font-size: 12.5px; font-weight: 500; }
.chip button { display: grid; place-items: center; width: 18px; height: 18px; border: 0; border-radius: 50%; background: none; color: var(--muted); }
.chip button:hover { background: var(--accent-soft); color: var(--accent); }
.chip.static { padding-right: 11px; border-color: var(--border-strong); }

.fase-list { display: grid; gap: 8px; }
.fase { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); overflow: hidden; }
.fase-head { display: flex; align-items: center; gap: 10px; padding: 0 0 0 14px; }
.fase-toggle { flex: 1; display: flex; align-items: center; gap: 10px; padding: 11px 14px 11px 0; border: 0; background: none; text-align: left; min-width: 0; }
.fase-toggle strong { font-size: 13.5px; }
.fase-toggle small { flex: 1; font-size: 12px; }
.fase-toggle svg { color: var(--muted); transition: transform .15s; }
.fase.is-open .fase-toggle svg { transform: rotate(180deg); }
.fase-cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px; padding: 0 12px 12px; }
.col-row { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; font-size: 13px; background: var(--surface); }
.col-row:hover { border-color: var(--accent-border); }
.col-row span { flex: 1; min-width: 0; }
.col-row em { font-style: normal; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.col-row.is-checked { border-color: var(--accent); background: var(--accent-soft); }
.cb { width: 17px; height: 17px; accent-color: var(--accent); flex: none; margin: 0; cursor: pointer; }

.aud-summary { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 2px; }
.aud-summary strong { display: block; font-size: 13.5px; }
.aud-summary small { font-size: 12.5px; }
.aud-summary .actions { display: flex; gap: 6px; flex-wrap: wrap; }

.aud-filters { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.aud-filters .search { grid-column: 1 / -1; }
.search { position: relative; }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search .control { padding-left: 40px; }
.lead-results { display: flex; flex-direction: column; gap: 6px; max-height: 330px; overflow-y: auto; padding-right: 4px; }
.lead-row { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 1.2fr); align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer; }
.lead-row:hover { border-color: var(--accent-border); }
.lead-row.is-checked { border-color: var(--accent); background: var(--accent-soft); }
.lead-row strong { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lead-row small { font-size: 12px; font-variant-numeric: tabular-nums; }
.lead-row em { font-style: normal; font-size: 12px; color: var(--muted); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lead-more { padding: 10px; text-align: center; font-size: 12.5px; color: var(--muted); }
.manual-input { min-height: 120px; font-family: 'Geist Mono', monospace; font-size: 13px; }

.msg-heading { display: flex; justify-content: space-between; align-items: baseline; font-weight: 600; }
.msg-heading em { color: var(--accent); font-style: normal; }
.msg-heading small { font-weight: 400; font-variant-numeric: tabular-nums; }
.variable-bar { display: flex; flex-wrap: wrap; gap: 8px; }
.variable-bar button { padding: 5px 11px; border-radius: 999px; border: 1px solid var(--accent-border); background: var(--surface); font-size: 12px; font-weight: 600; color: var(--accent); }
.variable-bar button:hover { background: var(--accent-soft); }
textarea { width: 100%; min-height: 150px; resize: vertical; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); line-height: 1.5; outline: none; font-size: 13.5px; }

.send-timing { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; }
.when { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 600; }
.when .control { width: 230px; max-width: 100%; font-size: 13.5px; padding: 9px 12px; }
.timing-hint { flex: 1 1 220px; font-size: 12.5px; color: var(--muted); padding-bottom: 10px; }

.compose-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-top: 16px; border-top: 1px solid var(--border); }
.compose-foot > div { display: flex; gap: 8px; color: var(--ok); max-width: 470px; }
.compose-foot > div svg { flex: none; margin-top: 2px; }
.compose-foot strong { display: block; color: var(--text); font-size: 13px; }
.compose-foot small { font-size: 12px; }

.templates { display: flex; flex-direction: column; position: sticky; top: 16px; overflow: hidden; }
.templates > header { display: flex; justify-content: space-between; align-items: center; padding: 16px 16px 12px; border-bottom: 1px solid var(--border); }
.templates > header strong { display: block; font-size: 13.5px; margin-top: 2px; }
.templates > header svg { color: var(--accent); }
.tpl-list { display: flex; flex-direction: column; max-height: 420px; overflow-y: auto; padding: 6px; }
.tpl { display: flex; gap: 12px; padding: 12px 10px; border: 0; border-radius: 12px; background: none; text-align: left; }
.tpl:hover { background: var(--accent-soft); }
.tpl > span { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); flex: none; }
.tpl strong { display: block; font-size: 12.5px; }
.tpl small { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font-size: 12px; }
.templates > footer { padding: 12px 16px 16px; border-top: 1px solid var(--border); }
.templates > footer .btn { width: 100%; font-size: 12.5px; }

/* ---------- versão 2: faixa e seção "seus disparos" ---------- */
.v2-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--accent-border); background: var(--surface); font-size: 13px; }
.v2-strip > svg { color: var(--accent); }
.v2-strip .grow { color: var(--text-2); }
.my-campaigns { overflow: hidden; scroll-margin-top: 16px; }
.mc-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.mc-head h2 { font: 600 17px 'DM Sans', sans-serif; margin-top: 4px; }
.mc-body { padding: 18px 22px 22px; background: var(--surface-2); display: flex; flex-direction: column; gap: 12px; }

/* ---------- programados ---------- */
.list { display: flex; flex-direction: column; gap: 10px; }
.sched-card { display: grid; grid-template-columns: 78px minmax(0, 1fr) auto; gap: 18px; padding: 16px 18px; align-items: start; }
.sched-card.is-highlight { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.date-block { display: flex; flex-direction: column; align-items: center; padding: 9px 4px; border-radius: 12px; background: var(--accent-soft); border: 1px solid var(--accent-border); }
.date-block small { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); font-weight: 600; }
.date-block strong { font: 700 24px/1.1 'DM Sans', sans-serif; }
.date-block b { margin-top: 4px; font-size: 13px; font-variant-numeric: tabular-nums; }
.sched-main { min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.sched-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sched-title strong { font-size: 14.5px; }
.sched-msg { margin: 0; color: var(--text-2); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sched-aud { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.sched-aud .chip { padding: 2px 10px; font-size: 12px; }
.mode-pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--accent-soft); color: var(--accent); }
.mode-pill.fixed { background: var(--surface-3); color: var(--text-2); }
.sched-meta { font-size: 12.5px; color: var(--muted); }
.sched-meta b { color: var(--text-2); font-weight: 600; }
.sched-actions { display: flex; flex-direction: column; align-items: stretch; gap: 6px; min-width: 140px; }
.sched-actions .sep { height: 1px; background: var(--border); margin: 2px 0; }
.progress { height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--ok); transition: width .1s linear; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.badge.info { background: var(--accent-soft); color: var(--accent); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.muted { background: var(--surface-3); color: var(--muted); }

.empty { padding: 36px 20px; text-align: center; color: var(--muted); }
.empty svg { color: var(--border-strong); margin-bottom: 8px; }
.empty strong { display: block; color: var(--text); margin-bottom: 4px; }

/* ---------- histórico ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.hist { overflow: hidden; }
.hist-head, .hist-row { display: grid; grid-template-columns: 124px minmax(0, 1fr) 84px 84px 84px 172px; gap: 12px; align-items: center; padding: 12px 18px; }
.hist-head { font-family: 'Geist Mono', monospace; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--border); }
.hist-row { width: 100%; border: 0; border-bottom: 1px solid var(--border); background: none; text-align: left; }
.hist-row:last-child { border-bottom: 0; }
.hist-row:hover { background: var(--accent-soft); }
.hist-row strong { display: block; font-size: 13.5px; }
.hist-row small { display: block; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.num { font-variant-numeric: tabular-nums; }
.num strong { font-size: 15px; }
.num.is-bad strong { color: var(--bad); }
.num-label { display: none; }

/* ---------- versão 3: central de disparos ---------- */
.hub-group { display: flex; flex-direction: column; gap: 8px; }
.hub-section-title { display: flex; align-items: center; gap: 8px; font: 600 15px 'DM Sans', sans-serif; margin-top: 6px; }
.hub-section-title small { font: 400 12.5px 'Geist', sans-serif; }
.hub-day { font-family: 'Geist Mono', monospace; font-size: 10.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); padding: 6px 2px 0; }
.hub-day.is-future { color: var(--accent); }
.hub-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) 210px 168px 18px; gap: 14px; align-items: center; width: 100%; padding: 12px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); text-align: left; }
.hub-row:hover { border-color: var(--accent-border); background: var(--accent-soft); }
.hub-row.is-highlight { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.hub-time { font: 600 15px 'DM Sans', sans-serif; font-variant-numeric: tabular-nums; }
.hub-main { min-width: 0; }
.hub-main strong { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hub-main small { display: block; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hub-nums { font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.hub-nums b { color: var(--bad); font-weight: 600; }
.hub-row > svg { color: var(--muted); }

/* ---------- drawer / modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(8, 12, 20, .42); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(600px, 100%); z-index: 41; background: var(--surface); border-left: 1px solid var(--border); display: flex; flex-direction: column; }
.drawer > header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 20px 22px 16px; border-bottom: 1px solid var(--border); }
.drawer > header small { display: flex; align-items: center; gap: 8px; }
.drawer > header h2 { font-size: 19px; margin-top: 6px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 22px 28px; display: flex; flex-direction: column; gap: 16px; }
.drawer-foot { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.metric { padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); }
.metric small { display: block; font-size: 11.5px; }
.metric strong { font: 700 22px 'DM Sans', sans-serif; font-variant-numeric: tabular-nums; }
.metric.is-bad strong { color: var(--bad); }
.metric.is-ok strong { color: var(--ok); }
.meta { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 6px 12px; margin: 0; font-size: 13px; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; }
.msg-box { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; white-space: pre-wrap; }
.msg-box b { display: block; margin-bottom: 4px; }
.drawer h3 { font-size: 15px; }
.rcpt { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.rcpt small { font-size: 12px; }
.rcpt .r-right { text-align: right; }
.rcpt .r-right small { display: block; }

.modal { position: fixed; z-index: 51; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(420px, calc(100% - 32px)); padding: 22px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal h2 { font-size: 17px; margin-bottom: 6px; }
.modal p { margin: 0 0 16px; color: var(--text-2); font-size: 13.5px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; }
.modal-overlay { z-index: 50; }

.toasts { position: fixed; z-index: 60; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; width: min(390px, calc(100% - 32px)); }
.toast { display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--text); color: var(--bg); font-size: 13px; box-shadow: 0 10px 30px rgba(0,0,0,.2); animation: rise .2s ease-out; }
.toast.error { background: var(--bad); color: #fff; }
.toast svg { flex: none; margin-top: 1px; }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- responsive ---------- */
@media (max-width: 1280px) {
  .compose-layout { grid-template-columns: minmax(0, 1fr); }
  .templates { position: static; }
  .tpl-list { max-height: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
  .hub-row { grid-template-columns: 60px minmax(0, 1fr) 168px 18px; }
  .hub-row .hub-nums { display: none; }
}
@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; z-index: 45; left: 0; top: 0; width: 280px; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(0,0,0,.2); }
  .shell.nav-open .sidebar { transform: none; }
  .menu-btn { display: grid; }
  .profile-copy, .weather-copy { display: none; }
  .channel-ready { display: none; }
  .snav { flex-basis: 100%; }
  .snav button { flex: none; min-width: 0; }
  .hist-head { display: none; }
  .hist-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hist-row > .h-when, .hist-row > .h-name, .hist-row > .h-status { grid-column: 1 / -1; }
  .num-label { display: inline; font-size: 12px; color: var(--muted); margin-left: 4px; }
}
@media (max-width: 640px) {
  .page { padding: 4px 16px 40px; }
  .topbar { padding: 12px 16px; }
  .studio-top { padding: 12px 16px; }
  .snav small { display: none; }
  .studio-heading, .studio-body { padding-left: 16px; padding-right: 16px; }
  .compose-card { padding: 16px; }
  .aud-filters { grid-template-columns: minmax(0, 1fr); }
  .lead-row { grid-template-columns: auto minmax(0, 1fr); }
  .lead-row em { grid-column: 2; text-align: left; }
  .sched-card { grid-template-columns: 64px minmax(0, 1fr); }
  .sched-actions { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; min-width: 0; }
  .sched-actions .sep { display: none; }
  .hub-row { grid-template-columns: 52px minmax(0, 1fr); }
  .hub-row > :nth-child(4) { grid-column: 2; }
  .hub-row > svg { display: none; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .meta { grid-template-columns: minmax(0, 1fr); }
  .meta dd { margin-bottom: 6px; }
  .studio-heading { flex-direction: column; align-items: flex-start; }
  .seg { flex-wrap: wrap; }
}

/* =========================================================
   Disparo IPM: extensões do protótipo
   ========================================================= */
[x-cloak] { display: none !important; }
.brand span { padding: 4px 10px 4px 6px; }
.nav-item { cursor: pointer; }
.nav-item:hover { background: var(--surface-2); }
.side-account .icon-btn { margin-left: auto; width: 34px; height: 34px; }
.topbar-title { display: flex; flex-direction: column; min-width: 0; }
.topbar-title strong { font: 600 15px 'DM Sans', sans-serif; }
.topbar-title small { font-size: 12px; }
.profile { cursor: default; }
.sidebar-overlay { display: none; }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(1200px 500px at 0% 0%, var(--side-glow), transparent 60%), var(--bg); }
.login-card { width: min(380px, 100%); padding: 30px 28px; display: flex; flex-direction: column; gap: 14px; }
.login-card .brand { justify-content: center; padding: 0 0 4px; }
.login-card p { margin: 0 0 6px; text-align: center; color: var(--muted); font-size: 13px; }
.form-error { color: var(--bad); font-size: 13px; }

/* seletor de instância no topo do público */
.inline-select { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.inline-select .control { width: auto; min-width: 180px; padding: 7px 34px 7px 12px; font-size: 13px; }

/* grupos */
.group-row { grid-template-columns: auto minmax(0, 1fr) auto; }
.group-row.is-disabled { opacity: .55; }
.chip.more { border-style: dashed; padding-right: 11px; color: var(--muted); }

/* conteúdo */
.type-seg { flex-wrap: wrap; }
.dropzone { display: flex; align-items: center; gap: 14px; padding: 16px; border: 1.5px dashed var(--border-strong); border-radius: 14px; background: var(--surface-2); cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input { display: none; }
.dz-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); flex: none; }
.dz-copy { min-width: 0; flex: 1; }
.dz-copy strong { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dz-copy small { font-size: 12px; }
.dz-thumb { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; flex: none; background: var(--surface-3); }
.dz-progress { height: 4px; border-radius: 4px; background: var(--surface-3); overflow: hidden; margin-top: 6px; }
.dz-progress span { display: block; height: 100%; background: var(--accent); }
.check-row { display: flex; align-items: flex-start; gap: 10px; padding: 11px 13px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); cursor: pointer; font-size: 13px; }
.check-row.is-checked { border-color: var(--accent); background: var(--accent-soft); }
.check-row strong { display: block; font-size: 13px; }
.check-row small { font-size: 12px; }
.check-row .cb { margin-top: 2px; }

/* topo do estúdio: status do canal sempre à direita */
.channel-ready { margin-left: auto; }

/* detalhe */
.drawer-media { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); font-size: 13px; color: var(--text); text-decoration: none; }
.drawer-media:hover { border-color: var(--accent-border); }
.drawer-media img, .drawer-media video { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; }

/* templates e configurações */
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 22px; align-items: start; }
.item-card { display: flex; gap: 14px; padding: 16px 18px; align-items: flex-start; }
.item-card .tpl-ico { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: var(--accent-soft); color: var(--accent); flex: none; }
.item-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.item-main strong { font-size: 14px; }
.item-main p { margin: 0; color: var(--text-2); font-size: 13px; white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.item-main small { font-size: 12px; word-break: break-all; }
.item-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.side-form { padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; position: sticky; top: 16px; }
.side-form h3 { font-size: 15px; }
.status-line { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.status-dot.ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.status-dot.bad { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.status-dot.warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.online.is-off { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.online.is-unknown { background: var(--muted); box-shadow: 0 0 0 3px var(--surface-3); }
.modal .control { margin-bottom: 16px; }
.two-col.single { grid-template-columns: minmax(0, 1fr); }
.conn-error { color: var(--bad); }
/* Fundo branco também no tema escuro: o leitor precisa do contraste do QR Code */
.qr-box { display: grid; place-items: center; width: 264px; max-width: 100%; aspect-ratio: 1; margin: 0 auto 16px; padding: 12px; border-radius: 12px; background: #fff; border: 1px solid var(--border); color: #3a4250; font-size: 13.5px; text-align: center; }
.qr-box img { display: block; width: 100%; height: 100%; object-fit: contain; }
.qr-state { display: flex; flex-direction: column; align-items: center; gap: 12px; }

@media (max-width: 1280px) {
  .two-col { grid-template-columns: minmax(0, 1fr); }
  .side-form { position: static; }
}
@media (max-width: 960px) {
  .sidebar-overlay { display: block; position: fixed; inset: 0; z-index: 44; background: rgba(8, 12, 20, .42); }
  .profile-copy { display: none; }
}
@media (max-width: 640px) {
  .inline-select { width: 100%; }
  .inline-select .control { flex: 1; min-width: 0; }
  .item-card { flex-wrap: wrap; }
  .item-actions { width: 100%; justify-content: flex-start; }
  .compose-foot .btn.primary { width: 100%; }
}
