:root {
  --bg: #f7f4f8;
  --panel: #ffffff;
  --side: #0d0a12;
  --side-text: #cdbdd6;
  --text: #17121c;
  --muted: #6f6680;
  --line: #ece6ef;
  --brand: #E0397A;
  --brand-3: #8B4DFF;
  --grad: linear-gradient(135deg, #FF7A59 0%, #F0457E 52%, #8B4DFF 100%);
  --brand-2: #FF7A59;
  --ok: #12a150;
  --warn: #d98a00;
  --err: #d93a3a;
  --radius: 12px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: 'Source Sans 3', system-ui, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
.layout { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar { background: var(--side); color: var(--side-text); padding: 20px 14px; display: flex; flex-direction: column; gap: 10px; }
.brand { color: #fff; font-weight: 700; font-size: 20px; display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.logo { background: var(--grad); border-radius: 10px; width: 34px; height: 34px; display: grid; place-items: center; }
.side-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; opacity: .6; margin: 6px 6px 0; }
.side-bottom { margin-top: auto; }
#accounts { display: flex; flex-direction: column; gap: 4px; }
.acc { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; cursor: pointer; color: var(--side-text); border: 0; background: none; text-align: left; font: inherit; width: 100%; }
.acc:hover { background: #1e1522; }
.acc.active { background: #2a1b2e; color: #fff; }
.acc img, .avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: #333; flex: none; }
.acc small { display: block; opacity: .65; font-size: 11px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--ok); }
.dot.off { background: #888; } .dot.err { background: var(--err); }

.main { padding: 28px 32px; max-width: 1200px; width: 100%; }
h1 { font-size: 22px; margin: 0; } h2 { font-size: 16px; margin: 0 0 12px; } h3 { font-size: 14px; margin: 0 0 8px; }
.muted { color: var(--muted); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.head { margin-bottom: 20px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.grid { display: grid; gap: 14px; }
.stats { grid-template-columns: repeat(4, 1fr); margin-bottom: 20px; }
.stat b { font-size: 24px; display: block; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tab { padding: 10px 14px; border: 0; background: none; font: inherit; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; }
.tab.active { color: var(--text); border-color: var(--brand); font-weight: 600; }

.btn { border: 1px solid var(--line); background: var(--panel); color: var(--text); padding: 9px 14px; border-radius: 9px; cursor: pointer; font: inherit; font-weight: 500; }
.btn:hover { border-color: #c8cbe0; }
.btn.primary { background: var(--grad); color: #fff; border: 0; }
.btn.danger { color: var(--err); }
.btn.ghost { background: transparent; color: inherit; border: 1px dashed #3a3e5c; }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn.full { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }

.auto-list { display: grid; gap: 10px; }
.auto { display: grid; grid-template-columns: auto 1fr auto auto; gap: 16px; align-items: center; }
.auto .thumbs { display: flex; }
.auto .thumbs img, .auto .thumbs span { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; border: 2px solid #fff; margin-left: -10px; background: #eceefa; display: grid; place-items: center; font-size: 12px; }
.auto .thumbs :first-child { margin-left: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: #ffeef4; color: var(--brand); padding: 3px 9px; border-radius: 99px; font-size: 12px; font-weight: 500; }
.chip.gray { background: #eff0f5; color: var(--muted); }
.chip button { border: 0; background: none; color: inherit; cursor: pointer; padding: 0 0 0 4px; }
.mini-stats { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.mini-stats b { color: var(--text); }

.switch { position: relative; width: 40px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #cfd2e0; border-radius: 99px; cursor: pointer; transition: .2s; }
.switch span::after { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(18px); }

/* Editor */
.editor { display: grid; grid-template-columns: 1fr 320px; gap: 18px; align-items: start; }
.flow { display: grid; gap: 0; }
.step { position: relative; padding-left: 38px; padding-bottom: 18px; }
.step::before { content: ""; position: absolute; left: 13px; top: 30px; bottom: 0; width: 2px; background: var(--line); }
.step:last-child::before { display: none; }
.step-n { position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
label { display: block; font-weight: 500; margin: 12px 0 6px; }
input[type=text], input[type=url], input[type=password], input[type=email], input[type=search], textarea, select { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; font: inherit; background: #fff; color: var(--text); }
textarea { resize: vertical; min-height: 76px; }
input:focus, textarea:focus, select:focus { outline: 2px solid #ffd3e2; border-color: var(--brand); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 8px 12px; font: inherit; cursor: pointer; color: var(--muted); }
.seg button.on { background: #ffeef4; color: var(--brand); font-weight: 600; }
.check { display: flex; gap: 10px; align-items: center; margin: 10px 0; font-weight: 500; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; max-height: 330px; overflow: auto; padding: 2px; }
.media { position: relative; aspect-ratio: 1; border-radius: 9px; overflow: hidden; cursor: pointer; border: 3px solid transparent; background: #eceefa; padding: 0; }
.media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media.sel { border-color: var(--brand); }
.media.sel::after { content: "✓"; position: absolute; top: 4px; right: 4px; background: var(--brand); color: #fff; border-radius: 50%; width: 20px; height: 20px; font-size: 12px; display: grid; place-items: center; }
.media .badge { position: absolute; left: 4px; bottom: 4px; background: rgba(0,0,0,.6); color: #fff; font-size: 10px; padding: 1px 5px; border-radius: 4px; }
.variation { display: flex; gap: 6px; margin-bottom: 6px; }

/* Prévia */
.phone { position: sticky; top: 20px; background: #fff; border: 1px solid var(--line); border-radius: 26px; padding: 16px; }
.phone .ph-head { display: flex; gap: 8px; align-items: center; font-weight: 600; padding-bottom: 10px; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.bubble { max-width: 85%; padding: 9px 12px; border-radius: 16px; margin: 6px 0; white-space: pre-wrap; word-break: break-word; font-size: 13px; }
.bubble.in { background: #efefef; }
.bubble.out { background: linear-gradient(135deg, #E0397A, #a855f7); color: #fff; margin-left: auto; }
.bubble .bbtn { display: block; text-align: center; background: rgba(255,255,255,.2); border-radius: 9px; padding: 6px; margin-top: 8px; font-weight: 600; }
.ph-comment { font-size: 12px; background: #fafafa; border-radius: 10px; padding: 8px; margin-bottom: 8px; }
.ph-sep { text-align: center; font-size: 11px; color: var(--muted); margin: 10px 0 4px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 13px; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
.ok { color: var(--ok); } .err { color: var(--err); } .warn { color: var(--warn); }
.empty { text-align: center; padding: 50px 20px; }
.empty .big { font-size: 42px; }
.copy { display: flex; gap: 6px; } .copy input { font-family: ui-monospace, monospace; font-size: 12px; }
.alert { padding: 10px 14px; border-radius: 10px; background: #fff7e6; color: #7a4d00; border: 1px solid #f5d9a1; margin-bottom: 14px; }

dialog { border: 0; border-radius: 16px; padding: 0; width: min(640px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(10,10,30,.45); }
.dlg-body { padding: 22px; max-height: 80vh; overflow: auto; }
.dlg-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.toast { position: fixed; top: 18px; right: 18px; background: #1b1d2b; color: #fff; padding: 12px 16px; border-radius: 10px; z-index: 50; max-width: 420px; box-shadow: 0 8px 30px rgba(0,0,0,.2); }
.toast.error { background: var(--err); }
.hidden { display: none !important; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .sidebar { padding: 14px 16px; }
  .side-bottom { margin-top: 0; }
  .main { padding: 18px 16px; }
  .editor { grid-template-columns: 1fr; }
  .phone { position: static; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .auto { grid-template-columns: 1fr auto; }
  .auto .thumbs, .auto .mini-stats { display: none; }
  table { display: block; overflow-x: auto; }
}

/* ───────── Editor em etapas (estilo ManyChat) ───────── */
.title-input { font-size: 16px; font-weight: 600; border: 1px solid transparent !important; background: transparent !important; max-width: 460px; }
.title-input:hover, .title-input:focus { border-color: var(--line) !important; background: #fff !important; }
.builder { display: grid; grid-template-columns: minmax(340px, 440px) 1fr; gap: 24px; align-items: start; }
.steps { display: grid; gap: 14px; }
.step-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; scroll-margin-top: 16px; animation: rise .25s ease; }
.step-card h2 { font-size: 17px; margin-bottom: 12px; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.opt { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; background: #f7f8fc; border: 1px solid transparent; border-radius: 10px; padding: 11px 12px; margin: 0 0 8px; font-weight: 500; cursor: pointer; }
.opt.on { background: #fff0f5; border-color: #ffd3e2; }
.opt input { margin-top: 2px; accent-color: var(--brand); }
#media-box { margin: -2px 0 10px; }
.toggle-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: #f7f8fc; border-radius: 10px; padding: 11px 12px; margin: 12px 0 8px; font-weight: 500; }
.step-card textarea, .step-card input[type=text], .step-card input[type=url], .step-card select { margin-bottom: 6px; }
.btn.next { margin-top: 12px; }
.link-btn { border: 0; background: none; color: var(--brand); font: inherit; font-weight: 600; cursor: pointer; padding: 0; }
.chip.ex { border: 0; cursor: pointer; font: inherit; font-size: 12px; }
.link-row { display: grid; grid-template-columns: 130px 1fr auto; gap: 6px; margin-top: 8px; }
.link-row input { margin: 0 !important; }
.pub-row { display: grid; grid-template-columns: 1fr auto; gap: 6px; margin-bottom: 6px; }
.pub-row input { margin: 0 !important; }
.switch input:disabled + span { opacity: .6; cursor: not-allowed; }

.preview-wrap { position: sticky; top: 16px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.phone.dark { position: relative; width: 300px; height: 590px; background: #000; color: #f5f5f5; border: 10px solid #1d1f2b; border-radius: 42px; padding: 34px 0 0; overflow: hidden; box-shadow: 0 18px 50px rgba(20,20,50,.18); }
.phone .notch { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); width: 90px; height: 20px; border-radius: 12px; background: #1d1f2b; }
.phone .avatar { width: 28px; height: 28px; }
.phone .avatar.sm { width: 26px; height: 26px; background: #555; }
.ig-head { display: flex; gap: 8px; align-items: center; padding: 8px 12px; font-size: 13px; }
.ig-head.dm { border-bottom: 1px solid #222; }
.ig-media { aspect-ratio: 4/5; background: #111; display: grid; place-items: center; overflow: hidden; }
.ig-media img { width: 100%; height: 100%; object-fit: cover; }
.ig-ph { color: #888; font-size: 13px; padding: 20px; text-align: center; border: 1px dashed #444; border-radius: 12px; }
.ig-cap { padding: 10px 12px; font-size: 12px; color: #ddd; }
.ig-sheet { background: #1a1a1a; border-radius: 16px 16px 0 0; margin-top: 60px; min-height: 480px; padding: 10px 12px; }
.ig-sheet-t { text-align: center; font-weight: 600; font-size: 13px; padding-bottom: 10px; border-bottom: 1px solid #2c2c2c; margin-bottom: 10px; }
.ig-c { display: flex; gap: 8px; font-size: 12px; margin-bottom: 12px; line-height: 1.4; }
.ig-c.reply { margin-left: 34px; }
.ig-c .muted { color: #888; }
.dm-list { padding: 10px 10px 20px; height: 500px; overflow-y: auto; }
.phone.dark .bubble { font-size: 12px; max-width: 82%; }
.phone.dark .bubble.in { background: #262626; color: #f5f5f5; }
.phone.dark .bubble.out { background: #3797f0; color: #fff; }
.phone.dark .bubble .bbtn { background: #3a3a3a; color: #fff; }
.sys { text-align: center; font-size: 10px; color: #8e8e8e; margin: 8px 0; }
.ptabs button.on { background: #fff; color: var(--text); font-weight: 600; }
.ptabs { background: #eef0f6; border: 0; padding: 3px; }
.ptabs button { background: transparent; border-radius: 7px; }

@media (max-width: 900px) {
  .builder { grid-template-columns: 1fr; }
  .preview-wrap { position: static; order: -1; }
  .phone.dark { width: 260px; height: 500px; }
  .dm-list { height: 420px; }
  .link-row { grid-template-columns: 1fr; }
}

/* ───────── Login e usuário ───────── */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(circle at 20% 10%, #ffe9f1, transparent 50%), radial-gradient(circle at 90% 90%, #ffe4ef, transparent 45%), var(--bg); }
.auth-card { width: min(400px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 28px; box-shadow: 0 20px 60px rgba(40, 30, 90, .08); }
.brand.dark { color: var(--text); margin-bottom: 4px; }
.auth-tabs { display: flex; width: 100%; background: #eef0f6; border: 0; padding: 3px; }
.auth-tabs button { flex: 1; background: transparent; border-radius: 7px; }
.auth-tabs button.on { background: #fff; color: var(--text); font-weight: 600; }
.side-link { display: block; width: 100%; text-align: left; border: 0; background: none; color: var(--side-text); font: inherit; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.side-link:hover { background: #1e1522; color: #fff; }
.me { display: flex; gap: 10px; align-items: center; padding: 10px 8px; border-top: 1px solid #2a1b2e; margin-top: 8px; }
.me-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--grad); color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; }
.me-info { min-width: 0; }
.me-info b, .me-info small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #fff; }
.me-info small { color: var(--side-text); opacity: .7; font-size: 11px; }
tr.muted td { opacity: .55; }

/* ───────── Botão do Instagram ───────── */
.btn.ig { display: inline-flex; align-items: center; justify-content: center; gap: 8px; color: #fff; border: 0; text-decoration: none;
  background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%); }
.btn.ig:hover { filter: brightness(1.06); }
.btn.big { padding: 13px 16px; font-size: 15px; font-weight: 600; border-radius: 11px; }
.auth-points { margin: 18px 0 6px; padding-left: 18px; color: var(--muted); font-size: 13px; line-height: 1.7; }

.chip.warn-chip { background: #fff4e0; color: #9a5b00; }

/* ───────── Gatilho de stories ───────── */
.seg.trig { display: flex; width: 100%; margin-bottom: 14px; background: #eef0f6; border: 0; padding: 3px; }
.seg.trig button { flex: 1; background: transparent; border-radius: 7px; font-size: 13px; }
.seg.trig button.on { background: #fff; color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.media-grid.stories { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); }
.media.story { aspect-ratio: 9/16; }
.ig-story { position: relative; height: 540px; background: #111; overflow: hidden; }
.ig-story img { width: 100%; height: 100%; object-fit: cover; }
.ig-story .ig-ph { position: absolute; inset: 0; margin: auto; height: fit-content; width: 70%; }
.ig-story-head { position: absolute; top: 10px; left: 10px; display: flex; gap: 8px; align-items: center; font-size: 13px; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.ig-story-reply { position: absolute; bottom: 14px; left: 12px; right: 12px; border: 1px solid rgba(255,255,255,.6); border-radius: 22px; padding: 9px 14px; font-size: 12px; color: #ddd; }
@media (max-width: 900px) { .ig-story { height: 450px; } }

/* ───────── Explicações simples, contatos e envios ───────── */
.explain { background: #fff5f8; border: 1px solid #ffdbe7; border-radius: 10px; padding: 10px 12px; font-size: 12.5px; line-height: 1.55; color: #5a2a3e; margin: 6px 0 10px; }
.explain.big { font-size: 13.5px; padding: 14px 16px; margin-bottom: 16px; }
.explain.tip { background: #fffaf0; border-color: #f5e3bf; color: #5c4210; margin-bottom: 16px; }
.window-rule { display: grid; gap: 4px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed #ffd3e2; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.pill.open { background: #e6f7ee; color: #0f7a3f; }
.pill.closed { background: #eff0f5; color: var(--muted); }
.stat.center { display: flex; flex-direction: column; justify-content: center; gap: 6px; }
.audience-count { margin: 10px 0 4px; padding: 10px 12px; border-radius: 10px; background: #eef6ff; color: #1e4f8a; font-size: 13px; }
#ct-filter button { font-size: 12px; padding: 6px 10px; }

/* ───────── Resultado dos envios para a lista ───────── */
.dlg-body.wide { max-width: 100%; }
dialog:has(.dlg-body.wide) { width: min(820px, calc(100vw - 32px)); }
.result-bar { display: flex; height: 12px; border-radius: 99px; overflow: hidden; background: #eef0f6; margin: 14px 0; }
.result-bar span { display: block; height: 100%; }
.result-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.result-card { text-align: left; border: 2px solid transparent; border-radius: 12px; padding: 10px 12px; cursor: pointer; font: inherit; display: flex; flex-direction: column; gap: 2px; }
.result-card b { font-size: 22px; }
.result-card span { font-weight: 600; font-size: 13px; }
.result-card small { color: var(--muted); font-size: 11px; line-height: 1.35; }
.result-card.on { border-color: var(--brand); }
.g-click { background: #e6f7ee; } .result-bar .g-click { background: #12a150; }
.g-seen { background: #eaf2ff; } .result-bar .g-seen { background: #3b82f6; }
.g-unseen { background: #f3f4f8; } .result-bar .g-unseen { background: #b8bccb; }
.g-fail { background: #fff1f0; } .result-bar .g-fail { background: #e5484d; }
.bc-table td { vertical-align: middle; }
@media (max-width: 700px) { .result-cards { grid-template-columns: repeat(2, 1fr); } }

/* Agendar: cores da aba, no tema claro do InstaFlow */
:root { --ink: var(--text); --line2: #c8cbe0; --ig-line: #ffc2d6; --ig2: var(--brand-2); --gold: var(--warn); --red: var(--err); --igg: var(--grad); --body: 'Source Sans 3', system-ui, sans-serif; }

/* Agendar postagens */
[hidden] { display: none !important; }
.ag-sem, .ag-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.ag-sem span { text-align: center; font-size: .72rem; color: var(--muted); padding-bottom: 4px; }
.ag-dia { position: relative; height: 66px; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: var(--ink); cursor: pointer; overflow: hidden; padding: 0; font: inherit; }
.ag-dia:hover { border-color: var(--ig-line); }
.ag-dia.fora { opacity: .4; }
.ag-dia.hoje { border-color: var(--ig2); }
.ag-dia.sel { outline: 2px solid var(--ig2); outline-offset: 1px; }
.ag-dia img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .5; }
.ag-dia .n { position: absolute; top: 3px; left: 6px; font-size: .78rem; font-weight: 700; z-index: 1; }
.ag-dia .q { position: absolute; right: 4px; bottom: 4px; z-index: 1; min-width: 18px; height: 18px; line-height: 18px; border-radius: 9px; background: var(--ig2); color: #fff; font-size: .68rem; font-weight: 700; text-align: center; padding: 0 4px; }
.ag-dia .q.al { background: var(--gold); color: #111; }
.ag-gt { font-size: .9rem; color: var(--muted); margin: 16px 0 8px; text-transform: capitalize; }
.ag-linha { display: flex; gap: 12px; margin-bottom: 8px; align-items: flex-start; }
.ag-mini { width: 72px; height: 90px; object-fit: cover; border-radius: 8px; flex: none; background: rgba(255, 255, 255, .06); }
.ag-mini.vazio { display: grid; place-items: center; font-size: .72rem; color: var(--muted); }
.ag-info { min-width: 0; flex: 1; display: grid; gap: 6px; }
.ag-leg { margin: 0; font-size: .9rem; overflow-wrap: anywhere; }
.ag-acoes { flex-wrap: wrap; gap: 6px; }
.chip.ok-chip { background: rgba(52, 199, 123, .16); color: #5fd79b; }
.ag-tipos { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.ag-itens { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
.ag-item { position: relative; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; min-width: 0; }
.ag-item img, .ag-ph { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; display: grid; place-items: center; background: rgba(255, 255, 255, .05); color: var(--muted); font-size: .8rem; }
.ag-num { position: absolute; top: 6px; left: 6px; background: rgba(0, 0, 0, .7); color: #fff; font-size: .72rem; font-weight: 700; border-radius: 9px; min-width: 20px; text-align: center; padding: 1px 5px; }
.ag-prog { height: 4px; background: var(--line); }
.ag-prog span { display: block; height: 100%; background: var(--igg); transition: width .2s; }
.ag-item-erro { font-size: .75rem; color: var(--red); padding: 6px; }
.ag-item-b { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; }
.ag-item-b .btn { flex: 1 1 auto; padding: 4px 6px; min-height: 32px; }
.ag-add { aspect-ratio: 4 / 5; border: 1px dashed var(--line2); border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; font: 600 .9rem var(--body); }
.ag-add:hover { border-color: var(--ig-line); color: var(--ink); }
.ag-check { display: flex; align-items: center; gap: 8px; }
.ag-modos { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 6px; }
.ag-modos .btn { padding-left: 6px; padding-right: 6px; white-space: normal; line-height: 1.15; }
.ag-check input { width: auto; }
.ag-fim { margin-top: 14px; flex-wrap: wrap; gap: 8px; }
.ag-foto { position: relative; cursor: crosshair; line-height: 0; max-width: 340px; margin: 0 auto; }
.ag-foto img { width: 100%; border-radius: 8px; }
.ag-pino { position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: var(--ig2); border: 2px solid #fff; }
@media (max-width: 520px) { .ag-tipos { grid-template-columns: repeat(2, minmax(0, 1fr)); } .ag-dia { height: 50px; } .ag-dia .q { min-width: 15px; height: 15px; line-height: 15px; } }

.ag-mini, .ag-item img, .ag-ph { background: #eff0f5; }
.chip.ok-chip { background: #e3f6ec; color: var(--ok); }
.ag-dia .n { background: rgba(255, 255, 255, .78); border-radius: 6px; padding: 0 4px; }
.btn.big { padding: 11px 18px; font-size: 15px; }
#ag-novo:disabled, #ag-salvar:disabled, #ag-ja:disabled { opacity: .5; cursor: default; }

/* Etiquetas e contatos */
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px 2px 7px; border-radius: 99px; font-size: 12px; font-weight: 500;
  background: color-mix(in srgb, var(--tc) 13%, #fff); color: color-mix(in srgb, var(--tc) 75%, #000); white-space: nowrap; }
.tag i, .tagbtn i, .tagopt i { width: 8px; height: 8px; border-radius: 50%; background: var(--tc); display: inline-block; flex: none; }
.tagbar { display: flex; flex-wrap: wrap; gap: 8px; }
.tagbtn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 6px 12px;
  font: inherit; font-size: 13px; cursor: pointer; color: var(--text); }
.tagbtn small { color: var(--muted); font-size: 11px; }
.tagbtn:hover { border-color: var(--tc); }
.tagbtn.on { background: color-mix(in srgb, var(--tc) 14%, #fff); border-color: var(--tc); font-weight: 600; }
.tagbtn.off { background: #f3f3f6; border-style: dashed; text-decoration: line-through; color: var(--muted); }
.tagpick { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0 6px; }
.tagopt { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 99px; padding: 5px 11px; cursor: pointer; font-size: 13px; background: #fff; margin: 0; font-weight: 500; }
.tagopt input { display: none; }
.tagopt:has(input:checked) { background: color-mix(in srgb, var(--tc) 14%, #fff); border-color: var(--tc); font-weight: 600; }
.colors { display: flex; gap: 8px; margin: 6px 0; }
.colors button { width: 28px; height: 28px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.colors button.on { box-shadow: 0 0 0 2px var(--text); }
.ct-tools { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.ct-tools input[type=search] { flex: 1; min-width: 220px; margin: 0; }
.ct-tools select { width: auto; margin: 0; }
.ct-active { font-size: 13px; color: var(--muted); margin: -2px 0 8px; }
.ct-active:empty { display: none; }
.ct-bulk { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; background: #ffeef4; border: 1px solid #ffd6e4; border-radius: 10px; padding: 9px 12px; margin-bottom: 10px; }
.ct-table tbody tr[data-c] { cursor: pointer; }
.ct-table tbody tr[data-c]:hover { background: #fffafc; }
.ct-table tbody tr.sel { background: #fff4f8; }
.ct-table .chips { gap: 4px; }
.audience-to { background: #f7f8fc; border-radius: 9px; padding: 10px 12px; font-weight: 600; }
.cd-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.cd-hist { list-style: none; padding: 0; margin: 4px 0 0; font-size: 13px; max-height: 220px; overflow: auto; }
.cd-hist li { padding: 6px 0; border-bottom: 1px solid var(--line); }
@media (max-width: 760px) { .cd-grid { grid-template-columns: 1fr; } }

/* Fluxos: lista */
.tab-novo { background: var(--brand-2); color: #fff; font-size: 9px; font-weight: 700; padding: 1px 5px; border-radius: 99px; vertical-align: 2px; text-transform: uppercase; }
.fx-lista { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.fx-item { display: flex; flex-direction: column; gap: 10px; }
.fx-item-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.fx-nums { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.fx-nums b { color: var(--text); }
.fx-gat .opt { margin-bottom: 6px; }

/* Fluxos: construtor */
.fx-topo { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.fx-topo .title-input { flex: 1; min-width: 180px; }
.fx-sujo { font-size: 12px; color: var(--warn); }
.fx-liga { display: inline-flex; gap: 8px; align-items: center; font-weight: 600; font-size: 13px; }
.fx-avisos .fx-erro, .fx-avisos .fx-aviso { border-radius: 9px; padding: 8px 12px; font-size: 13px; margin-bottom: 6px; }
.fx-erro { background: #fdecec; color: #8f1d1d; }
.fx-aviso { background: #fff6e0; color: #6b4a00; }
.fx-area { display: grid; grid-template-columns: 1fr 360px; gap: 12px; height: calc(100vh - 150px); min-height: 520px; }
.fx-canvas { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); cursor: grab; touch-action: none; user-select: none;
  background-color: #fbfbfe; background-image: radial-gradient(#d9dbe8 1px, transparent 1px); background-size: 22px 22px; }
.fx-mundo { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.fx-setas { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: visible; pointer-events: none; }
.fx-seta { fill: none; stroke: #9aa0b8; stroke-width: 2.2; pointer-events: stroke; cursor: pointer; }
.fx-seta:hover { stroke: var(--err); stroke-width: 3.5; }
.fx-seta.temp { stroke: var(--brand); stroke-dasharray: 6 5; pointer-events: none; }
.fx-no { position: absolute; width: 260px; background: #fff; border: 1.5px solid var(--line); border-radius: 12px; box-shadow: 0 2px 8px rgba(20,20,60,.06); cursor: default; }
.fx-no.sel { border-color: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 22%, transparent); }
.fx-no-cab { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; font-weight: 600; font-size: 13px; cursor: move;
  background: color-mix(in srgb, var(--c) 10%, #fff); border-radius: 11px 11px 0 0; color: color-mix(in srgb, var(--c) 70%, #000); }
.fx-n { font-size: 11px; background: #fff; border-radius: 99px; padding: 1px 7px; color: var(--text); }
.fx-no-corpo { padding: 9px 12px; font-size: 12.5px; line-height: 1.45; color: #3b3e52; word-break: break-word; }
.fx-sub { color: var(--muted); font-size: 11.5px; margin-top: 4px; }
.fx-link { margin-top: 5px; font-size: 12px; color: var(--brand); }
.fx-saidas { padding: 0 0 8px; }
.fx-saida { display: flex; justify-content: flex-end; align-items: center; gap: 6px; padding: 3px 0; font-size: 11.5px; color: var(--muted); position: relative; min-height: 18px; }
.fx-saida span { background: #f3f4f9; border-radius: 6px; padding: 1px 7px; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-saida.sim span { background: #e6f7ee; color: #0f7a3f; }
.fx-saida.nao span { background: #fdecec; color: #8f1d1d; }
.fx-porta { width: 14px; height: 14px; border-radius: 50%; border: 2.5px solid var(--c); background: #fff; margin-right: -8px; cursor: crosshair; flex: none; }
.fx-porta.lig { background: var(--c); }
.fx-porta:hover { transform: scale(1.3); }
.fx-entrada { position: absolute; left: -7px; top: 19px; width: 12px; height: 12px; border-radius: 50%; background: #c9ccdc; border: 2px solid #fff; }
.fx-barra { position: absolute; left: 10px; top: 10px; display: flex; flex-direction: column; gap: 4px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 6px; box-shadow: 0 2px 8px rgba(20,20,60,.06); }
.fx-add { border: 0; background: none; font: inherit; font-size: 12px; text-align: left; padding: 5px 8px; border-radius: 7px; cursor: pointer; display: flex; gap: 6px; align-items: center; }
.fx-add:hover { background: #fff0f5; }
.fx-zoom { position: absolute; right: 10px; bottom: 10px; display: flex; background: #fff; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.fx-zoom button { border: 0; background: none; width: 34px; height: 32px; font-size: 16px; cursor: pointer; }
.fx-zoom button:hover { background: #fff0f5; }
.fx-dica { position: absolute; left: 10px; bottom: 10px; right: 140px; font-size: 11.5px; color: var(--muted); pointer-events: none; }
.fx-menu { position: fixed; z-index: 50; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(20,20,60,.15); padding: 4px; display: flex; flex-direction: column; min-width: 200px; }
.fx-menu button { border: 0; background: none; text-align: left; padding: 8px 10px; border-radius: 7px; font: inherit; cursor: pointer; }
.fx-menu button:hover { background: #fff0f5; }
.fx-painel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; }
.fx-p-cab { position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between; align-items: center; padding: 12px 14px;
  background: color-mix(in srgb, var(--c) 10%, #fff); border-bottom: 1px solid var(--line); }
.fx-p-corpo { padding: 4px 14px 16px; }
.fx-p-corpo label { margin-top: 12px; }
.fx-p-corpo label.opt, .fx-p-corpo label.check { margin-top: 6px; }
.fx-op { background: #f7f8fc; border-radius: 9px; padding: 8px; margin-bottom: 6px; display: flex; flex-direction: column; gap: 6px; }
.fx-op select, .fx-op input { margin: 0; }
.fx-vars { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.fx-midias { max-height: 260px; }
@media (max-width: 900px) {
  .fx-area { grid-template-columns: 1fr; height: auto; }
  .fx-canvas { height: 62vh; }
  .fx-dica { display: none; }
}
.main:has(.fx-area) { max-width: none; padding: 18px 20px; }
.fx-area { height: calc(100vh - 120px); }

/* Fluxos: IA e modelos */
.nf-audio { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.btn.gravando { background: #fdecec; border-color: #f2b8b8; color: #8f1d1d; font-weight: 600; }
.nf-modelos { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.nf-modelos .opt { margin: 0; }
.fx-ia { position: relative; background: #fff0f5; border: 1px solid #ffd3e2; color: #5a1f3a; border-radius: 9px; padding: 10px 34px 10px 12px; font-size: 13px; margin-bottom: 6px; }
.fx-ia ul { margin: 6px 0 2px; padding-left: 18px; }
.fx-ia #fx-ia-x { position: absolute; right: 10px; top: 8px; }
@media (max-width: 760px) { .nf-modelos { grid-template-columns: 1fr; } }

/* ───────── Celular (mesma lógica do HubFlow): barra de cima, barra de baixo, gavetas ───────── */
.m-top, .m-tabbar { display: none; }
.mi { width: 22px; height: 22px; flex: none; }
@media (max-width: 900px) {
  .layout { display: block; }
  .sidebar { display: none; }
  .m-top { display: flex; position: sticky; top: 0; z-index: 30; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 10px;
    background: rgba(17, 19, 34, .96); backdrop-filter: blur(10px); color: #fff; }
  .m-top .brand { flex: 1; margin: 0; font-size: 18px; }
  .m-top .logo { width: 30px; height: 30px; }
  .m-perfil { display: inline-flex; align-items: center; gap: 7px; max-width: 58vw; padding: 5px 10px 5px 5px; border-radius: 999px; border: 1px solid #3a2a3e;
    background: #1e1522; color: #fff; font: 600 13px 'Source Sans 3', system-ui, sans-serif; cursor: pointer; }
  .m-perfil img, .m-perfil .avatar, .m-perfil .me-avatar { width: 26px; height: 26px; font-size: 12px; }
  .m-perfil span:not(.me-avatar):not(.avatar) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .m-perfil .mi { width: 16px; height: 16px; opacity: .7; }
  .m-tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; z-index: 30; left: 0; right: 0; bottom: 0;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px)); background: rgba(17, 19, 34, .97); backdrop-filter: blur(10px); border-top: 1px solid #2a1b2e; }
  .m-tabbar button { display: grid; justify-items: center; gap: 3px; padding: 6px 2px; border: 0; border-radius: 12px; background: none; color: #8a8db0;
    font: 600 11px 'Source Sans 3', system-ui, sans-serif; position: relative; cursor: pointer; }
  .m-tabbar button[aria-current="page"] { color: #fff; }
  .m-tabbar button[aria-current="page"]::before { content: ""; position: absolute; top: -6px; width: 28px; height: 3px; border-radius: 0 0 3px 3px;
    background: var(--grad); }
  .m-tabbar .m-acao { color: #fff; }
  .m-tabbar .m-acao .fab { display: grid; place-items: center; width: 50px; height: 50px; margin-top: -24px; border-radius: 50%;
    background: var(--grad); color: #fff; box-shadow: 0 6px 18px rgba(0, 0, 0, .4); border: 3px solid rgba(17, 19, 34, .97); }
  .main { padding: 16px 14px calc(96px + env(safe-area-inset-bottom, 0px)); }
  .toast { top: auto; bottom: calc(88px + env(safe-area-inset-bottom, 0px)); left: 14px; right: 14px; max-width: none; }
  /* as abas viram a barra de baixo; o "Nova automação" vira o botão do meio */
  .tabs { display: none; }
  #btn-new { display: none; }
  .head.row { gap: 10px; }
  .head.row > .row:first-child { width: 100%; }
  .head h1 { font-size: 21px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat b { font-size: 21px; }
  /* janelas sobem do rodapé (gaveta) */
  dialog { margin: auto 0 0; width: 100%; max-width: 100%; max-height: 90dvh; border-radius: 20px 20px 0 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
  dialog[open] { animation: sobeGaveta .22s ease-out; }
  dialog:has(.dlg-body.wide) { width: 100%; }
  .dlg-body { max-height: calc(90dvh - 70px); padding: 18px 16px; }
  .dlg-foot { padding: 12px 16px; flex-wrap: wrap; }
  /* construtor de fluxos */
  .fx-area { height: auto; }
  .fx-canvas { height: 58dvh; }
  .fx-barra { flex-direction: row; left: 8px; right: 8px; top: 8px; overflow-x: auto; }
  .fx-add { white-space: nowrap; }
  .fx-topo .fx-sujo { width: 100%; order: 9; }
}
@keyframes sobeGaveta { from { transform: translateY(100%); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { dialog[open] { animation: none; } }
.m-gaveta h2 { margin: 4px 0 12px; }
.m-alca { width: 40px; height: 4px; border-radius: 4px; background: #d6d8e4; margin: -6px auto 12px; }
.m-lista { display: grid; gap: 6px; }
.m-lista button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: #fff;
  font: 600 14px 'Source Sans 3', system-ui, sans-serif; color: var(--text); text-align: left; cursor: pointer; }
.m-lista button.on { border-color: #ffc2d6; background: #fff4f8; }
.m-lista button small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.m-lista button img, .m-lista button .avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex: none; }
.m-lista .m-novo { justify-content: center; border-style: dashed; color: var(--brand); }
.m-lista .mi { color: var(--brand); }
/* contatos em cartões no celular */
@media (max-width: 720px) {
  .ct-table thead { display: none; }
  .ct-table, .ct-table tbody { display: block; }
  .ct-table tr[data-c] { display: grid; grid-template-columns: 26px 1fr auto; gap: 4px 8px; padding: 10px 4px; border-bottom: 1px solid var(--line); align-items: center; }
  .ct-table td { border: 0; padding: 0; }
  .ct-table td:nth-child(1) { grid-row: 1 / span 2; }
  .ct-table td:nth-child(3) { grid-column: 2 / -1; }
  .ct-table td:nth-child(4), .ct-table td:nth-child(5) { grid-column: 2 / -1; font-size: 12px; }
  .ct-table td:nth-child(6) { grid-column: 3; grid-row: 1; }
  .ct-table td:nth-child(7) { display: none; }
  .ct-tools input[type=search] { min-width: 100%; }
  .ct-bulk { position: sticky; top: 56px; z-index: 5; }
  .fx-lista { grid-template-columns: 1fr; }
}

.foto-vazia { display: inline-block; border-radius: 50%; background: linear-gradient(135deg, var(--brand), var(--brand-2)) !important; flex: none; }

/* Entrar com Google */
.btn-google { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 11px 14px; border-radius: 10px; border: 1px solid #dadce0;
  background: #fff; color: #3c4043; font: 600 14px 'Source Sans 3', system-ui, sans-serif; text-decoration: none; margin: 4px 0 6px; }
.btn-google:hover { background: #f8f9fb; border-color: #c6c9d0; }
.ou { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 12px 0 4px; }
.ou::before, .ou::after { content: ""; flex: 1; border-top: 1px solid var(--line); }

/* ───────── Identidade HubInsta (H2): hub + balão de direct + insta ───────── */
h1, h2, h3, .stat b, .fx-p-cab b, .m-gaveta h2 { font-family: 'Bricolage Grotesque', 'Source Sans 3', sans-serif; letter-spacing: -.01em; }
h1 { font-weight: 800; }
.brand { display: flex; align-items: flex-end; gap: 0; font: 800 26px/0.9 'Bricolage Grotesque', sans-serif; letter-spacing: -1px; color: #F4EFF6; margin-bottom: 16px; }
.brand .hb-pt { display: inline-block; width: 15px; height: 15px; margin: 0 3px 2px 3px; flex: none; }
.brand .hb-pt svg { width: 100%; height: 100%; display: block; }
.brand.dark { color: var(--text); font-size: 30px; }
.brand.dark .hb-pt { width: 17px; height: 17px; }
.side-label, .tab-novo { font-family: 'IBM Plex Mono', ui-monospace, monospace; letter-spacing: .12em; }
.m-top .brand { font-size: 22px; margin: 0; }
.m-top .brand .hb-pt { width: 13px; height: 13px; }
.auth-card { box-shadow: 0 24px 60px rgba(40, 10, 40, .14); }
.btn.primary { box-shadow: 0 6px 18px rgba(224, 57, 122, .22); }
.btn.primary:hover { filter: brightness(1.04); }
.tab.active { border-color: var(--brand); }

/* Tempo de acesso (usuários) */
.acesso-fixos { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.acesso-cont { display: flex; align-items: center; gap: 6px; }
.acesso-cont .acesso-n { width: 90px; text-align: center; }
.acesso-prev { margin-top: 6px; }
.main { min-width: 0; } /* tabelas largas rolam dentro do cartão, sem alargar a página */
