/* Rdash Marketing — design system (sem framework; claro/escuro automático)
   Identidade visual: docs/brand (paleta, tipografia e símbolo). Os nomes das variáveis são o contrato com
   templates e JS: mude valores à vontade, mas não renomeie. */

/* Sora (OFL, ver static/fonts/Sora-OFL.txt), servida localmente por causa da CSP `font-src 'self'`.
   Singolare (fonte de títulos da marca) é licenciada e não está no repositório: para ativar, coloque o .woff2 em
   static/fonts/ e descomente o bloco abaixo; --font-display já a usa primeiro.
@font-face { font-family: "Singolare"; font-weight: 400 700; font-display: swap; src: url("/static/fonts/singolare.woff2") format("woff2"); }
*/
@font-face {
  font-family: "Sora"; font-style: normal; font-weight: 100 800; font-display: swap;
  src: url("/static/fonts/sora-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* paleta da marca (fixa nos dois temas) */
  --brand-teal: #85e0be;
  --brand-blue: #2e27f3;
  --brand-lime: #c7ff00;
  --brand-ink: #1b2c30;
  --brand-grey: #6a6e79;

  --bg: #f5f5f5;
  --surface: #ffffff;
  --surface-2: #eef1f1;
  --surface-3: #e3e8e8;
  --border: #e1e6e6;
  --border-strong: #c8d0d1;
  --text: #1b2c30;
  --text-2: #3b4d51;
  --muted: #6a6e79;
  --accent: #2e27f3;
  --accent-hover: #2019c8;
  --accent-soft: #e8e7fe;
  --accent-text: #2e27f3;
  --on-accent: #ffffff;
  /* CTA principal da marca: verde-limão com texto escuro */
  --cta: #c7ff00;
  --cta-hover: #b4e800;
  --on-cta: #1b2c30;
  --on-success: #ffffff;
  --success: #0b7a5a;
  --success-soft: #e0f6ee;
  --warning: #9a5700;
  --warning-soft: #fdf1df;
  --danger: #c4321f;
  --danger-soft: #fdeae7;
  --info: #1b65c4;
  --info-soft: #e6f0fc;
  --neutral-soft: #eceff0;
  --sidebar-bg: #1b2c30;
  --sidebar-text: #b9c6c8;
  --sidebar-active: #ffffff;
  --sidebar-hover: rgba(255, 255, 255, 0.07);
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(27, 44, 48, 0.04), 0 4px 6px rgba(27, 44, 48, 0.05);
  --shadow-lg: 0 8px 24px rgba(27, 44, 48, 0.16);
  --font-body: "Sora", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Singolare", "Sora", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1c1f;
    --surface: #162529;
    --surface-2: #1c2f33;
    --surface-3: #25393d;
    --border: #2a3f44;
    --border-strong: #3b5358;
    --text: #eef3f3;
    --text-2: #c5d1d2;
    --muted: #93a3a6;
    --accent: #85e0be;
    --accent-hover: #a0ebcf;
    --accent-soft: #1b3a39;
    --accent-text: #85e0be;
    --on-accent: #10201f;
    --on-success: #0f1c1f;
    --success: #4cd3a0;
    --success-soft: #12332a;
    --warning: #f0b25a;
    --warning-soft: #3a2c14;
    --danger: #ff8a78;
    --danger-soft: #3d1f1b;
    --info: #7db4f5;
    --info-soft: #172d44;
    --neutral-soft: #223539;
    --sidebar-bg: #0b1517;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 14px/1.55 var(--font-body);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.25; letter-spacing: -0.015em; font-family: var(--font-display); font-weight: 700; }
h1 { font-size: 1.5rem; letter-spacing: -0.025em; }
h2 { font-size: 1.1rem; }
h3 { font-size: .98rem; }
p { margin: 0 0 .75rem; }
code, pre, .mono { font-family: var(--mono); font-size: .86em; }
pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .8rem; overflow: auto; max-height: 520px; white-space: pre-wrap; word-break: break-word; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.25rem 0; }
small, .small { font-size: .84rem; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
svg.icon { width: 1.15em; height: 1.15em; vertical-align: -0.2em; flex: none; }
code { overflow-wrap: anywhere; }

/* --- Layout -------------------------------------------------------------------- */
.app { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--sidebar-bg); color: var(--sidebar-text); padding: 1rem .75rem;
  display: flex; flex-direction: column; gap: 1rem; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: .4rem; color: #fff; font-weight: 700; padding: .35rem .5rem .6rem; }
.brand:hover { text-decoration: none; }
.brand-logo { display: block; width: 150px; height: auto; aspect-ratio: 6745 / 1342; }
.brand small { display: block; color: var(--sidebar-text); font-weight: 500; font-size: .7rem; letter-spacing: .02em; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: #7f9296; padding: .7rem .6rem .25rem; }
.nav a { display: flex; align-items: center; gap: .6rem; padding: .48rem .6rem; border-radius: var(--radius-sm); color: var(--sidebar-text); }
.nav a:hover { background: var(--sidebar-hover); color: #fff; text-decoration: none; }
.nav a.active { background: rgba(133, 224, 190, .14); color: var(--sidebar-active); box-shadow: inset 3px 0 0 var(--brand-lime); }
.nav a.active svg { color: var(--brand-lime); opacity: 1; }
.nav svg { width: 18px; height: 18px; flex: none; opacity: .9; }
.nav .count { margin-left: auto; background: var(--brand-lime); color: var(--brand-ink); border-radius: 99px; font-size: .7rem; padding: 0 .45rem; font-weight: 700; }
.sidebar-footer { margin-top: auto; display: flex; flex-direction: column; gap: .6rem; font-size: .82rem; }
.sidebar-footer select { width: 100%; background: rgba(255, 255, 255, .06); color: #fff; border-color: rgba(255, 255, 255, .16); }
.sidebar-footer .advertiser strong { color: #fff; }
.sidebar-footer .user { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.sidebar-footer button.link { color: var(--sidebar-text); }
.mode-pill { display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .55rem; border-radius: 99px; font-size: .75rem; font-weight: 600; }
.mode-mock { background: rgba(240, 178, 90, .16); color: #f6c27c; }
.mode-live { background: rgba(133, 224, 190, .16); color: var(--brand-teal); }
.main { min-width: 0; padding: 1.5rem 2rem 3rem; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin: .15rem 0 0; }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.breadcrumb { font-size: .82rem; color: var(--muted); margin-bottom: .35rem; }
.breadcrumb a { color: var(--muted); }

@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: .6rem; }
  .nav { flex-direction: row; overflow-x: auto; width: 100%; }
  .nav-label { display: none; }
  .nav a { white-space: nowrap; }
  .sidebar-footer { margin-top: 0; width: 100%; flex-direction: row; flex-wrap: wrap; }
  .main { padding: 1rem; }
}

/* --- Cards / grids -------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem 1.2rem; }
.card + .card { margin-top: 1rem; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: .75rem; margin-bottom: .8rem; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }
.card.flush { padding: 0; }
.card.flush .card-head { padding: 1rem 1.2rem 0; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem 1rem; box-shadow: var(--shadow); }
.kpi .label { color: var(--muted); font-size: .8rem; }
.kpi .value { font-size: 1.45rem; font-weight: 700; letter-spacing: -0.02em; margin-top: .1rem; font-variant-numeric: tabular-nums; }
.kpi .hint { color: var(--muted); font-size: .76rem; }

.empty { text-align: center; padding: 2.2rem 1rem; color: var(--muted); }
.empty h3 { color: var(--text); }

/* --- Botões --------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; border: 1px solid transparent;
  border-radius: var(--radius-sm); padding: .5rem .9rem; font: inherit; font-weight: 600; cursor: pointer;
  background: var(--surface-2); color: var(--text); text-decoration: none; line-height: 1.2; white-space: nowrap;
}
.btn:hover { text-decoration: none; background: var(--surface-3); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--cta); color: var(--on-cta); box-shadow: inset 0 0 0 1px rgba(27, 44, 48, .14); }
.btn-primary:hover { background: var(--cta-hover); }
.btn-success { background: var(--success); color: var(--on-success); }
.btn-success:hover { filter: brightness(1.08); background: var(--success); }
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-outline { background: transparent; border-color: var(--border-strong); }
.btn-ghost { background: transparent; }
.btn-sm { padding: .3rem .6rem; font-size: .82rem; }
.btn svg { width: 16px; height: 16px; }
button.link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent-text); cursor: pointer; }
button.link:hover { text-decoration: underline; }

/* --- Badges / alertas ----------------------------------------------------------- */
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .12rem .55rem; border-radius: 99px; font-size: .76rem; font-weight: 600; white-space: nowrap; }
.badge-sm { font-size: .7rem; padding: .05rem .45rem; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-neutral { background: var(--neutral-soft); color: var(--text-2); }
.badge-muted { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.badge-accent { background: var(--accent-soft); color: var(--accent-text); }

.alert { border-radius: var(--radius-sm); padding: .7rem .9rem; border: 1px solid transparent; margin-bottom: .75rem; display: flex; gap: .6rem; align-items: flex-start; }
.alert-success { background: var(--success-soft); color: var(--success); }
.alert-warning { background: var(--warning-soft); color: var(--warning); }
.alert-danger, .alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-info { background: var(--info-soft); color: var(--info); }
.alert .close { margin-left: auto; background: none; border: 0; color: inherit; cursor: pointer; font-size: 1.1rem; line-height: 1; }
.flashes { position: sticky; top: .75rem; z-index: 30; }

/* --- Formulários ---------------------------------------------------------------- */
label { font-weight: 600; font-size: .86rem; color: var(--text-2); display: block; margin-bottom: .3rem; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=date],
input[type=datetime-local], input[type=search], input[type=color], select, textarea {
  width: 100%; padding: .5rem .65rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: inherit; transition: border-color .15s, box-shadow .15s;
}
input[type=color] { padding: .15rem; height: 38px; }
textarea { min-height: 90px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--muted); }
.field { margin-bottom: 1rem; }
.field .help { color: var(--muted); font-size: .8rem; margin-top: .25rem; }
.field.has-error input, .field.has-error textarea, .field.has-error select { border-color: var(--danger); }
.field-row { display: grid; gap: .75rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field-row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 700px) { .field-row, .field-row.three { grid-template-columns: 1fr; } }
.check { display: flex; gap: .5rem; align-items: flex-start; font-weight: 500; }
.check input { margin-top: .25rem; }
.checks { display: flex; flex-wrap: wrap; gap: .4rem .9rem; }
.checks .check { font-size: .88rem; }
.counter { font-size: .76rem; color: var(--muted); text-align: right; margin-top: .2rem; font-variant-numeric: tabular-nums; }
.counter.warn { color: var(--warning); }
.counter.over { color: var(--danger); font-weight: 700; }
.input-group { display: flex; }
.input-group .prefix { display: grid; place-items: center; padding: 0 .65rem; border: 1px solid var(--border-strong); border-right: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm); background: var(--surface-2); color: var(--muted); font-weight: 600; }
.input-group input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.repeat-row { display: grid; gap: .5rem; grid-template-columns: 1fr 1fr auto; align-items: end; margin-bottom: .5rem; }
.repeat-row.wide { grid-template-columns: 1.2fr 2fr auto; }
.repeat-block { border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); padding: .75rem; margin-bottom: .6rem; position: relative; }
.repeat-block .remove { position: absolute; top: .4rem; right: .4rem; }

/* --- Tabelas -------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; padding: .55rem .75rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: .6rem .75rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* --- Tabs ----------------------------------------------------------------------- */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; overflow-x: auto; }
.tabs a, .tabs button { padding: .55rem .85rem; border: 0; background: none; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.active, .tabs button.active { color: var(--accent-text); border-bottom-color: var(--accent); }
.tabs a:hover { text-decoration: none; color: var(--text); }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 8px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: .3rem .7rem; border-radius: 6px; font: inherit; font-size: .82rem; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* --- Criativos ------------------------------------------------------------------ */
.media-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.media-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; position: relative; }
.media-card .thumb { aspect-ratio: 4 / 5; background: var(--surface-3); display: grid; place-items: center; overflow: hidden; }
.media-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.media-card .body { padding: .6rem .7rem .7rem; display: flex; flex-direction: column; gap: .3rem; }
.media-card .title { font-weight: 600; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-card .meta { color: var(--muted); font-size: .76rem; }
.media-card .select { position: absolute; top: .5rem; left: .5rem; background: rgba(255,255,255,.92); border-radius: 6px; padding: .15rem .35rem; }
.media-card .kind { position: absolute; top: .5rem; right: .5rem; }
.player { background: #000; border-radius: var(--radius); overflow: hidden; display: grid; place-items: center; max-height: 640px; }
.player video, .player img { max-width: 100%; max-height: 640px; display: block; }
.transcript-seg { display: grid; grid-template-columns: 4.2rem 1fr; gap: .5rem; padding: .25rem 0; border-bottom: 1px dashed var(--border); font-size: .9rem; }
.transcript-seg .t { color: var(--muted); font-family: var(--mono); font-size: .78rem; padding-top: .1rem; }
.dropzone { border: 2px dashed var(--border-strong); border-radius: var(--radius); padding: 1.2rem; text-align: center; background: var(--surface-2); }
.dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.progress { height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); width: 0; transition: width .2s; }

/* --- Editor de campanha ----------------------------------------------------------- */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 1.25rem; align-items: start; }
.editor > * { min-width: 0; }
@media (max-width: 1250px) { .editor { grid-template-columns: minmax(0, 1fr); } }
.editor-side { position: sticky; top: 1rem; display: flex; flex-direction: column; gap: 1rem; }
@media (max-width: 1250px) { .editor-side { position: static; } }
.section-title { display: flex; align-items: center; gap: .5rem; margin: 0 0 .9rem; }
@media (min-width: 901px) { .save-bar { position: sticky; bottom: .5rem; z-index: 5; } }
.section-title .step { width: 26px; height: 26px; border-radius: 50%; background: var(--cta); color: var(--on-cta); display: grid; place-items: center; font-size: .8rem; font-weight: 800; }
.ai-field { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 300px); gap: .9rem; align-items: start; padding: .2rem 0; }
.ai-field + .ai-field { border-top: 1px dashed var(--border); padding-top: .8rem; margin-top: .2rem; }
@media (max-width: 900px) { .ai-field { grid-template-columns: 1fr; } }
.rationale { background: var(--accent-soft); border-radius: var(--radius-sm); padding: .55rem .7rem; font-size: .82rem; color: var(--text-2); position: relative; }
.rationale::before { content: "IA"; position: absolute; top: -.55rem; left: .55rem; background: var(--accent); color: var(--on-accent); font-size: .62rem; font-weight: 800; padding: .02rem .35rem; border-radius: 4px; letter-spacing: .05em; }
.rationale .rationale-head { display: flex; gap: .35rem; align-items: center; flex-wrap: wrap; margin-bottom: .25rem; }
.rationale .edited { display: none; }
.rationale.is-edited { background: var(--warning-soft); }
.rationale.is-edited::before { background: var(--warning); }
.rationale.is-edited .edited { display: inline-flex; }
.rationale .ai-value { margin-top: .35rem; font-size: .78rem; color: var(--muted); word-break: break-word; }
.rationale.empty { background: transparent; border: 1px dashed var(--border); color: var(--muted); }
.rationale.empty::before { display: none; }
.issues { display: flex; flex-direction: column; gap: .4rem; max-height: 420px; overflow-y: auto; }
.issue { display: flex; gap: .5rem; padding: .45rem .55rem; border-radius: var(--radius-sm); font-size: .84rem; align-items: flex-start; }
.issue .ico { font-weight: 800; width: 1.1rem; text-align: center; flex: none; }
.issue-error { background: var(--danger-soft); color: var(--danger); }
.issue-warning { background: var(--warning-soft); color: var(--warning); }
.issue-info { background: var(--info-soft); color: var(--info); }
.issue .hint { display: block; color: var(--text-2); opacity: .85; font-size: .78rem; margin-top: .15rem; }
.issue a { color: inherit; text-decoration: underline; }
.issue-counts { display: flex; gap: .4rem; flex-wrap: wrap; }
.highlight-field { animation: flash 1.6s ease-out; border-radius: 6px; }
@keyframes flash { 0% { box-shadow: 0 0 0 4px var(--warning); } 100% { box-shadow: 0 0 0 0 transparent; } }
.statusbar { display: flex; flex-direction: column; gap: .6rem; }
.statusbar .actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.timeline { list-style: none; margin: 0; padding: 0; font-size: .84rem; }
.timeline li { padding: .3rem 0 .3rem 1rem; border-left: 2px solid var(--border); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: .65rem; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }

/* --- Preview do Instagram ------------------------------------------------------------ */
.ig-phone { width: 300px; max-width: 100%; margin: 0 auto; background: #000; border-radius: 34px; padding: 10px; box-shadow: var(--shadow-lg); }
.ig-screen { background: #fff; color: #111; border-radius: 26px; overflow: hidden; position: relative; font: 13px/1.35 -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
.ig-feed .ig-head { display: flex; align-items: center; gap: .5rem; padding: .55rem .65rem; }
.ig-avatar { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, #f58529, #dd2a7b, #8134af); padding: 2px; flex: none; }
.ig-avatar span { display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%; background: #fff; color: #111; font-weight: 800; font-size: .7rem; }
.ig-user { font-weight: 700; font-size: .82rem; }
.ig-sponsored { font-size: .72rem; color: #555; }
.ig-media { background: #111; position: relative; overflow: hidden; display: grid; place-items: center; }
.ig-media img, .ig-media video { width: 100%; height: 100%; object-fit: cover; display: block; }
.ig-feed .ig-media { aspect-ratio: 4 / 5; }
.ig-cta-bar { display: flex; justify-content: space-between; align-items: center; padding: .55rem .7rem; background: #efefef; font-weight: 700; font-size: .8rem; color: #111; border-bottom: 1px solid #ddd; }
.ig-actions { display: flex; gap: .7rem; padding: .5rem .65rem .2rem; font-size: 1.05rem; }
.ig-caption { padding: .15rem .65rem .7rem; font-size: .8rem; word-break: break-word; }
.ig-caption b { margin-right: .25rem; }
.ig-more { color: #8e8e8e; }
.ig-vertical { aspect-ratio: 9 / 16; position: relative; background: #111; color: #fff; }
.ig-vertical .ig-media { position: absolute; inset: 0; }
.ig-vertical .ig-topbar { position: absolute; left: 0; right: 0; top: 0; padding: .6rem .65rem; display: flex; align-items: center; gap: .45rem; background: linear-gradient(rgba(0,0,0,.45), transparent); }
.ig-vertical .ig-user, .ig-vertical .ig-sponsored { color: #fff; }
.ig-progress { position: absolute; top: .35rem; left: .6rem; right: .6rem; height: 2px; background: rgba(255,255,255,.4); border-radius: 2px; }
.ig-progress::after { content: ""; display: block; width: 35%; height: 100%; background: #fff; }
.ig-bottom { position: absolute; left: 0; right: 0; bottom: 0; padding: .7rem .65rem .8rem; background: linear-gradient(transparent, rgba(0,0,0,.7)); }
.ig-bottom .ig-caption { padding: .3rem 0 .45rem; color: #fff; }
.ig-bottom .ig-more { color: #ddd; }
.ig-pill { display: block; text-align: center; background: #fff; color: #111; font-weight: 700; border-radius: 8px; padding: .5rem; font-size: .82rem; }
.ig-story-cta { text-align: center; font-weight: 700; font-size: .82rem; }
.ig-story-cta .chev { display: block; font-size: 1.1rem; line-height: 1; }
.ig-rail { position: absolute; right: .45rem; bottom: 5.5rem; display: flex; flex-direction: column; gap: .9rem; font-size: 1.1rem; text-align: center; }
.ig-safe { position: absolute; left: 0; right: 0; background: repeating-linear-gradient(45deg, rgba(255,0,80,.18), rgba(255,0,80,.18) 6px, transparent 6px, transparent 12px); pointer-events: none; display: none; }
.ig-safe.top { top: 0; height: 14%; }
.ig-safe.bottom { bottom: 0; height: 22%; }
.show-safe .ig-safe { display: block; }
.ig-placeholder { color: #aaa; font-size: .8rem; padding: 2rem; text-align: center; }

/* --- Login --------------------------------------------------------------------- */
/* fundo no estilo dos gradientes da marca (teal → azul sobre o preto-petróleo) */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background:
  radial-gradient(60% 55% at 10% 6%, rgba(133, 224, 190, .55), transparent 70%),
  radial-gradient(55% 60% at 94% 96%, rgba(46, 39, 243, .6), transparent 70%),
  radial-gradient(35% 35% at 88% 8%, rgba(199, 255, 0, .16), transparent 70%),
  var(--brand-ink); }
.auth .card { width: 100%; max-width: 400px; padding: 1.8rem; box-shadow: var(--shadow-lg); }
.auth .brand { color: var(--text); padding: 0; margin-bottom: 1.4rem; }
.auth .brand-logo { width: 190px; }
.auth .brand small { color: var(--muted); }

/* --- Diálogo ------------------------------------------------------------------- */
dialog { border: 0; border-radius: var(--radius); padding: 0; box-shadow: var(--shadow-lg); background: var(--surface); color: var(--text); width: min(520px, 94vw); }
dialog::backdrop { background: rgba(11, 21, 23, .6); }
dialog .dialog-body { padding: 1.3rem 1.4rem; }
dialog .dialog-actions { display: flex; justify-content: flex-end; gap: .5rem; padding: .9rem 1.4rem; border-top: 1px solid var(--border); background: var(--surface-2); }

/* --- Diversos ------------------------------------------------------------------ */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; font-size: .9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.prose { max-width: 860px; }
.prose h1 { font-size: 1.3rem; } .prose h2 { font-size: 1.1rem; margin-top: 1.4rem; } .prose h3 { font-size: 1rem; margin-top: 1rem; }
.prose ul { padding-left: 1.2rem; }
.prose blockquote { margin: .5rem 0; padding: .3rem .8rem; border-left: 3px solid var(--border-strong); color: var(--text-2); }
.copy-field { display: flex; gap: .5rem; align-items: flex-start; }
.copy-field .value { flex: 1; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .45rem .6rem; white-space: pre-wrap; word-break: break-word; font-size: .9rem; }
.sheet-section { margin-bottom: 1.2rem; }
.sheet-field { display: grid; grid-template-columns: 220px 1fr; gap: .75rem; padding: .5rem 0; border-bottom: 1px dashed var(--border); }
@media (max-width: 760px) { .sheet-field { grid-template-columns: 1fr; gap: .25rem; } }
.diff-old { background: var(--danger-soft); color: var(--danger); text-decoration: line-through; padding: 0 .2rem; border-radius: 3px; }
.diff-new { background: var(--success-soft); color: var(--success); padding: 0 .2rem; border-radius: 3px; }
/* Gráfico de colunas (série única): barras ≤24px, topo arredondado 4px, base reta, 2px de respiro */
.chart { position: relative; padding-left: 3.2rem; }
.chart-plot { position: relative; height: 170px; border-bottom: 1px solid var(--border); }
.chart-grid { position: absolute; left: 0; right: 0; border-top: 1px solid var(--border); pointer-events: none; }
.chart-tick { position: absolute; left: -3.2rem; width: 2.9rem; text-align: right; font-size: .7rem; color: var(--muted); transform: translateY(-50%); font-variant-numeric: tabular-nums; }
.chart-cols { position: absolute; inset: 0; display: flex; align-items: flex-end; gap: 2px; }
.chart-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; outline: none; cursor: default; position: relative; }
.chart-col .bar { width: 100%; max-width: 24px; min-height: 2px; background: var(--accent); border-radius: 4px 4px 0 0; transition: filter .12s; }
.chart-col:hover .bar, .chart-col:focus-visible .bar { filter: brightness(1.18); }
.chart-col:focus-visible { box-shadow: 0 0 0 2px var(--accent-soft); border-radius: 4px; }
.chart-col .peak { font-size: .7rem; color: var(--text-2); margin-bottom: .2rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.chart-x { display: flex; gap: 2px; margin-top: .3rem; font-size: .68rem; color: var(--muted); }
.chart-x span { flex: 1; text-align: center; white-space: nowrap; overflow: visible; }
.chart-tooltip { position: fixed; z-index: 50; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); border-radius: 8px; padding: .45rem .6rem; font-size: .8rem; pointer-events: none; min-width: 120px; }
.chart-tooltip strong { display: block; font-size: .95rem; color: var(--text); }
.chart-tooltip .row-key { display: flex; align-items: center; gap: .35rem; color: var(--muted); }
.chart-tooltip .row-key i { display: inline-block; width: 12px; height: 2px; background: var(--accent); }
/* Painel: filtros, variação dos KPIs, gráficos em grade e cards recolhíveis */
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem; margin-bottom: 1rem; }
.filters label { display: flex; flex-direction: column; gap: .25rem; font-size: .78rem; color: var(--muted); min-width: 0; }
.filters select { max-width: 22rem; }
.delta { font-weight: 700; font-variant-numeric: tabular-nums; }
.delta.good { color: var(--success); }
.delta.bad { color: var(--danger); }
.delta.neutral, .delta.flat { color: var(--muted); }
.charts { gap: 1.5rem 2rem; }
.chart-card h3 { font-size: .9rem; margin: 0 0 .6rem; }
.align-start { align-items: start; }
details.collapsible { padding: 0; }
details.collapsible > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: 1rem 1.2rem; border-radius: var(--radius); }
details.collapsible > summary::-webkit-details-marker { display: none; }
details.collapsible > summary h2 { margin: 0; }
details.collapsible > summary::after { content: ""; width: .55rem; height: .55rem; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s; margin-right: .25rem; flex: none; }
details.collapsible[open] > summary::after { transform: rotate(-135deg); }
details.collapsible > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
details.collapsible > .collapsible-body { padding: 0 1.2rem 1.1rem; }
.steps-list { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.steps-list li { counter-increment: s; position: relative; padding: .2rem 0 .7rem 2.2rem; }
.steps-list li::before { content: counter(s); position: absolute; left: 0; top: .1rem; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--cta); color: var(--on-cta); display: grid; place-items: center; font-weight: 800; font-size: .8rem; }
.htmx-request .htmx-indicator { opacity: 1; }
.htmx-indicator { opacity: 0; transition: opacity .2s; }
.spinner { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- WhatsApp: conversa -------------------------------------------------------- */
.chat { display: flex; flex-direction: column; gap: .55rem; max-height: 62vh; overflow-y: auto; padding: .25rem; }
.msg { display: flex; flex-direction: column; max-width: 78%; }
.msg-in { align-self: flex-start; }
.msg-out { align-self: flex-end; align-items: flex-end; }
.msg .txt { white-space: pre-wrap; }
.msg .bubble { padding: .55rem .75rem; border-radius: 12px; word-break: break-word; font-size: .92rem; line-height: 1.4; }
.msg-in .bubble { background: var(--surface-2); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg-out .bubble { background: var(--accent-soft); border: 1px solid var(--border); border-bottom-right-radius: 4px; }
.msg-auto .bubble { background: var(--success-soft); }
.msg .meta { font-size: .72rem; color: var(--muted); margin-top: .2rem; }
.msg-error { color: var(--danger); max-width: 100%; }
.msg-buttons { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .5rem; }
.msg-buttons span { border: 1px solid var(--border-strong); border-radius: 999px; padding: .15rem .6rem; font-size: .8rem; background: var(--surface); }

/* --- Funil ----------------------------------------------------------------------- */
.funnel { display: flex; flex-direction: column; gap: .5rem; }
.funnel-row { display: grid; grid-template-columns: 8.5rem 1fr 6.5rem; align-items: center; gap: .6rem; }
.funnel-label { font-size: .85rem; color: var(--text-2); }
.funnel-track { background: var(--surface-2); border-radius: 6px; height: 14px; overflow: hidden; }
.funnel-bar { background: var(--accent); height: 100%; border-radius: 6px; min-width: 2px; }
.funnel-value { text-align: right; font-variant-numeric: tabular-nums; }
.funnel.with-cost .funnel-row { grid-template-columns: 8.5rem 1fr 10rem; }
@media (max-width: 640px) { .funnel-row, .funnel.with-cost .funnel-row { grid-template-columns: 6.5rem 1fr 5.5rem; } }

/* --- YouTube: prévia aproximada -------------------------------------------------- */
.yt-preview { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.yt-thumb { position: relative; aspect-ratio: 16 / 9; background: var(--surface-3); display: flex; align-items: center; justify-content: center; color: var(--muted); }
.yt-thumb img { width: 100%; height: 100%; object-fit: cover; }
.yt-thumb .icon { width: 42px; height: 42px; }
.yt-ad { position: absolute; left: .5rem; bottom: .5rem; background: #f2c94c; color: #1b2c30; font-size: .7rem; font-weight: 700; padding: .05rem .4rem; border-radius: 3px; }
.yt-body { padding: .6rem .7rem; display: flex; flex-direction: column; gap: .15rem; }
.yt-cta { margin: 0 .7rem .7rem; text-align: center; border-radius: 999px; padding: .4rem; font-weight: 600; font-size: .85rem; background: var(--accent); color: var(--on-accent); }

/* --- CRM ---------------------------------------------------------------------------- */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(200px, 1fr); gap: .75rem; overflow-x: auto; padding-bottom: .5rem; align-items: start; }
.kanban-col { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: .6rem; min-height: 8rem; }
.kanban-col header { display: flex; justify-content: space-between; align-items: center; gap: .4rem; margin-bottom: .5rem; }
.kanban-hint, .kanban-empty { margin: .2rem 0 .4rem; }
.deal-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .6rem .65rem; margin-bottom: .5rem; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: .25rem; }
.deal-title { font-weight: 600; text-decoration: none; color: var(--text); }
.deal-title:hover { color: var(--accent-text); }
.deal-meta { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; }
.deal-next { color: var(--text-2); }
.deal-move select { width: 100%; font-size: .8rem; padding: .2rem .35rem; }
.score { margin-left: auto; font-size: .75rem; font-weight: 700; border-radius: 999px; padding: .05rem .45rem; background: var(--accent-soft); color: var(--accent-text); }
.stagebar { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.stage-step button { border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); border-radius: 999px; padding: .3rem .8rem; font: inherit; font-size: .85rem; cursor: pointer; }
.stage-step button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent-text); }
.stage-step.is-done button { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.stage-step.is-current button { background: var(--accent); color: var(--on-accent); border-color: var(--accent); cursor: default; }
.warn-dot { color: var(--warning); font-weight: 800; }
.plain-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .45rem; }
.task-row { display: flex; align-items: center; gap: .3rem; margin: 0; }
.overdue { color: var(--danger); }
.crm-timeline li { padding-bottom: .5rem; }
.crm-timeline .tl-msg.tl-in div { color: var(--text); }
.crm-timeline .tl-msg.tl-out div { color: var(--text-2); }
.crm-timeline .tl-ai div, .crm-timeline .tl-stage div { color: var(--accent-text); }
.note-form textarea { width: 100%; }

/* --- Esteiras (ADR-018) ------------------------------------------------------------ */
.step-no { display: inline-grid; place-items: center; width: 1.25rem; height: 1.25rem; border-radius: 50%; font-size: .7rem; font-weight: 800; background: var(--cta); color: var(--on-cta); flex: none; }
.step-no-lg { width: 1.9rem; height: 1.9rem; font-size: .95rem; }
.nav a .step-no { margin-right: -.15rem; }

.area-bar { margin: -.25rem 0 1.1rem; border-bottom: 1px solid var(--border); }
.area-head { display: flex; align-items: center; gap: .7rem; margin-bottom: .5rem; }
.area-name { font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.area-tagline { font-size: .85rem; color: var(--text-2); }
.area-next { margin-left: auto; font-size: .8rem; color: var(--muted); text-decoration: none; border: 1px dashed var(--border-strong); border-radius: 999px; padding: .2rem .7rem; white-space: nowrap; }
.area-next:hover { color: var(--accent-text); border-color: var(--accent); }
.area-tabs { border-bottom: 0; margin-bottom: 0; }

.subnav { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin: 0 0 1rem; }
.subnav a { font-size: .85rem; padding: .3rem .8rem; border-radius: 999px; border: 1px solid var(--border); color: var(--text-2); text-decoration: none; background: var(--surface); }
.subnav a.active { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; font-weight: 600; }
.subnav .subnav-aside { margin-left: auto; border-style: dashed; }

.rail { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; gap: 0; overflow-x: auto; }
.rail-step { flex: 1 1 0; min-width: 7.5rem; position: relative; }
.rail-step a { display: flex; flex-direction: column; gap: .1rem; padding: .7rem .9rem .7rem 1.4rem; height: 100%; text-decoration: none; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-left: 0;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%, 12px 50%); }
.rail-step:first-child a { border-left: 1px solid var(--border); border-radius: var(--radius-sm) 0 0 var(--radius-sm); padding-left: .9rem; clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%); }
.rail-step:last-child a { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 12px 50%); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.rail-step + .rail-step { margin-left: -6px; }
.rail-step a:hover { background: var(--surface-2); }
.rail-label { font-size: .75rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.rail-count { font-size: 1.35rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.2; }
.rail-hint { font-size: .75rem; color: var(--muted); }
.rail-step.needs-you a { background: var(--warning-soft); }
.rail-step.needs-you .rail-count { color: var(--warning); }
.rail-compact { margin: .6rem 0 0; }
.rail-compact .rail-step { min-width: 5.5rem; }
.rail-compact .rail-step a { padding-top: .45rem; padding-bottom: .45rem; }
.rail-compact .rail-count { font-size: 1.05rem; }
.rail-compact .rail-label { font-size: .68rem; text-transform: none; letter-spacing: 0; }

.line { display: flex; flex-direction: column; gap: 0; }
.line-row { display: grid; grid-template-columns: 15rem 1fr; gap: 1rem; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .75rem .9rem; box-shadow: var(--shadow); }
.line-head { display: flex; gap: .6rem; align-items: center; }
.line-name { font-weight: 700; display: inline-flex; align-items: center; gap: .35rem; color: var(--text); text-decoration: none; }
.line-name:hover { color: var(--accent-text); }
.line-row .rail { margin: 0; }
.line-arrow { align-self: flex-start; margin: .15rem 0 .15rem 1.55rem; font-size: .75rem; color: var(--muted); }
@media (max-width: 900px) { .line-row { grid-template-columns: 1fr; } }

.m2s { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .4rem; }
.m2s li { background: var(--surface-2); border-radius: var(--radius-sm); padding: .6rem .7rem; position: relative; }
.m2s li + li::before { content: "→"; position: absolute; left: -.55rem; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: .8rem; }
.m2s-label { font-size: .72rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.m2s-value { font-size: 1.2rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.m2s-cost { font-size: .75rem; color: var(--text-2); }
@media (max-width: 900px) { .m2s { grid-template-columns: repeat(2, minmax(0, 1fr)); } .m2s li + li::before { content: none; } }

.attention-card .plain-list li { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.ads-kanban .deal-card .badge { white-space: nowrap; }
.integration-card .kv { font-size: .88rem; }
@media (max-width: 640px) { .rail-step { min-width: 7rem; } .rail-compact .rail-step { min-width: 6.5rem; } }

/* Como conduzir a conversa (ADR-019) */
.coach summary { cursor: pointer; list-style: none; }
.coach summary::-webkit-details-marker { display: none; }
.coach-principle { margin: .4rem 0 .8rem; color: var(--muted); font-style: italic; }
.coach h3 { font-size: .95rem; margin: .6rem 0 .3rem; }
.coach-list { margin: 0 0 .4rem; padding-left: 1.1rem; }
.coach-list li { margin: .2rem 0; }
.coach blockquote { margin: .4rem 0; padding: .5rem .75rem; border-left: 3px solid var(--accent); background: var(--accent-soft); white-space: pre-wrap; border-radius: 4px; }
.coach-block { border-top: 1px solid rgba(128, 128, 128, .25); margin-top: .8rem; padding-top: .2rem; }
.coach-draft { margin-bottom: .8rem; }

/* Ações por conjunto/anúncio já publicado */
.obj-bar { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin: 0 0 .8rem; padding: .55rem .75rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2, transparent); }
.obj-bar .btn { margin-left: auto; }
.obj-auth { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin: 0 0 .8rem; }
