:root {
  --bg: #ffffff;
  --sidebar: #fafafa;
  --surface: #ffffff;
  --surface-2: #f4f4f5;
  --border: #ececec;
  --border-strong: #e0e0e0;
  --text: #18181b;
  --text-2: #52525b;
  --muted: #a1a1aa;
  --primary: #18181b;
  --primary-hover: #000000;
  --hover: #f1f1f2;
  --active: #ebebed;
  --danger: #dc2626;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 1px 3px rgba(0,0,0,.06);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.error { color: var(--danger); font-size: 13px; min-height: 18px; margin: 4px 0 0; }
.ico { width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Brand */
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0;
  background: var(--primary); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 15px;
}
.brand-name { font-weight: 650; font-size: 15px; letter-spacing: -.01em; }
.brand-lg { justify-content: center; margin-bottom: 4px; }
.brand-lg .brand-mark { width: 40px; height: 40px; font-size: 20px; border-radius: 11px; }
.brand-lg .brand-name { font-size: 19px; }

/* Buttons */
.btn {
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 9px 14px;
  font-size: 14px;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  font-weight: 500;
  font-family: inherit;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.ghost { background: transparent; color: var(--text-2); border-color: var(--border-strong); }
.btn.ghost:hover { background: var(--hover); color: var(--text); }
.btn.block { width: 100%; }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn.icon { display: inline-flex; padding: 8px; border: none; color: var(--text-2); }
.btn.icon:hover { background: var(--hover); }

.new-chat {
  background: transparent; color: var(--text);
  border: none; box-shadow: none;
  justify-content: flex-start; font-weight: 550; padding: 8px 8px;
}
.new-chat:hover { background: var(--hover); }

/* Badge de créditos no botão "Planos de uso" */
#btn-plans { position: relative; }
#btn-plans > span:not(.credits-badge) { flex: 1; text-align: left; }
.credits-badge {
  margin-left: auto; flex-shrink: 0;
  min-width: 30px; padding: 2px 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; line-height: 1.5;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border);
  text-align: center;
}
.credits-badge.low { background: #fef2f2; color: var(--danger); border-color: #f6d5d5; }

/* Auth */
.auth-screen {
  display: flex; align-items: center; justify-content: center;
  height: 100vh; height: 100dvh; padding: 20px; background: var(--sidebar);
}
.auth-card {
  width: 100%; max-width: 360px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 32px 28px; display: flex; flex-direction: column; gap: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.06);
}
.auth-card p { margin: 0 0 8px; }
.auth-card input {
  background: var(--surface); border: 1px solid var(--border-strong); color: var(--text);
  padding: 11px 12px; border-radius: 10px; font-size: 14px; font-family: inherit;
}
.auth-card input:focus { outline: none; border-color: var(--primary); }
.auth-actions { display: flex; flex-direction: column; gap: 8px; }

/* Layout */
.app { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }

.sidebar {
  width: 272px; flex-shrink: 0;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; justify-content: space-between;
  overflow: hidden; transition: width .22s ease, border-color .22s ease;
}
.app.collapsed .sidebar { width: 0; border-right-color: transparent; }
.sidebar-top { padding: 12px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 10px; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }

.nav-group { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.nav-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); padding: 6px 8px 2px;
}
.conversations { display: flex; flex-direction: column; gap: 1px; }
.conv-item {
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
  font-size: 13.5px; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: flex; align-items: center; gap: 8px;
}
.conv-item::before {
  content: ""; width: 15px; height: 15px; flex-shrink: 0;
  background: currentColor; opacity: .55;
  -webkit-mask: no-repeat center/contain; mask: no-repeat center/contain;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z'/%3E%3C/svg%3E");
}
.conv-item:hover { background: var(--hover); color: var(--text); }
.conv-item.active { background: var(--active); color: var(--text); font-weight: 550; }
.conv-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-del {
  display: none; flex-shrink: 0; border: none; background: transparent; cursor: pointer;
  color: var(--muted); padding: 3px; border-radius: 6px; line-height: 0;
}
.conv-item:hover .conv-del { display: inline-flex; }
.conv-del:hover { background: var(--surface); color: var(--danger); }
.conv-del .ico { width: 15px; height: 15px; }

.sidebar-bottom { border-top: 1px solid var(--border); padding: 10px; }

/* Perfil (A) + menu popover */
.profile-menu { position: relative; }
.profile-menu > summary { list-style: none; }
.profile-menu > summary::-webkit-details-marker { display: none; }
.user-row {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px;
  border-radius: 9px; cursor: pointer;
}
.user-row:hover { background: var(--hover); }
.user-avatar {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  background: var(--primary); color: #fff;
  display: grid; place-items: center; font-size: 12px; font-weight: 600;
}
.user-row #user-email { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chevron { transition: transform .18s; }
.profile-menu[open] > summary .chevron { transform: rotate(180deg); }

.profile-pop {
  position: absolute; bottom: calc(100% + 6px); left: 0; right: 0; z-index: 30;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 11px; box-shadow: 0 8px 24px rgba(0,0,0,.12);
  padding: 6px; display: flex; flex-direction: column; gap: 2px;
}
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 9px 10px; border-radius: 8px; border: none; background: transparent;
  color: var(--text-2); font-size: 13.5px; font-family: inherit; cursor: pointer;
}
.menu-item:hover { background: var(--hover); color: var(--text); }

/* Modal de configurações */
.settings-dialog {
  border: 1px solid var(--border); border-radius: 16px; padding: 0;
  width: min(440px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  background: var(--surface); color: var(--text);
  box-shadow: 0 24px 60px rgba(0,0,0,.22);
  overflow: hidden; /* só o formulário rola por dentro */
}
.settings-dialog::backdrop { background: rgba(0,0,0,.38); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; }
.dialog-head h3 { margin: 0; font-size: 16px; font-weight: 650; letter-spacing: -.01em; }

.company-form {
  display: flex; flex-direction: column; gap: 12px;
  padding: 18px 20px 20px; max-height: calc(100vh - 48px); overflow-y: auto;
}
.company-form label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.company-form input, .company-form textarea, .company-form select {
  background: var(--surface); border: 1px solid var(--border-strong); color: var(--text);
  padding: 9px 11px; border-radius: 9px; font-size: 13.5px; font-family: inherit; resize: vertical;
}
.company-form input:focus, .company-form textarea:focus, .company-form select:focus { outline: none; border-color: var(--primary); }
.company-form select {
  cursor: pointer; appearance: none; -webkit-appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2352525b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; background-size: 16px;
}

/* Campo de logo */
.logo-field { gap: 8px !important; }
.logo-row { display: flex; align-items: center; gap: 12px; }
.logo-preview {
  width: 56px; height: 56px; border-radius: 12px; flex-shrink: 0;
  background: var(--surface-2) center/cover no-repeat; border: 1px solid var(--border-strong);
  display: grid; place-items: center;
}
.logo-preview::after { content: "🏢"; font-size: 22px; opacity: .45; }
.logo-preview.has-img::after { content: ""; }
.logo-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Planos de uso */
.plans-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 14px; }
.plan-card {
  border: 1px solid var(--border); border-radius: 14px; padding: 18px;
  background: var(--surface); display: flex; flex-direction: column; gap: 14px;
}
.plan-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.plan-name { font-weight: 650; font-size: 15px; letter-spacing: -.01em; }
.plan-credits { display: flex; align-items: baseline; gap: 4px; font-weight: 700; }
.plan-credits #plan-credits-num { font-size: 26px; letter-spacing: -.02em; }
.plan-credits-total { font-size: 13px; color: var(--muted); font-weight: 600; }
.credit-bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--border); }
.credit-bar-fill { height: 100%; width: 0; border-radius: 999px; background: var(--primary); transition: width .35s ease, background .2s; }
.credit-bar-fill.low { background: var(--danger); }
.plan-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.plan-meta-item {
  display: flex; flex-direction: column; gap: 3px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px;
}
.plan-meta-item strong { font-size: 15px; font-weight: 650; }
.plan-note { line-height: 1.5; margin: 0; }

/* Chat */
.chat { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--bg); }
.chat-header {
  display: flex; align-items: center; gap: 12px;
  padding: calc(13px + env(safe-area-inset-top)) 22px 13px; border-bottom: 1px solid var(--border);
}
.chat-title { font-size: 14.5px; font-weight: 600; letter-spacing: -.01em; }

.messages { flex: 1; overflow-y: auto; padding: 28px 24px; display: flex; flex-direction: column; gap: 18px; }
.empty-state { margin: auto; text-align: center; max-width: 420px; color: var(--text-2); }
.empty-state .empty-mark {
  display: inline-grid; place-items: center; width: 48px; height: 48px; margin-bottom: 14px;
  border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border);
  font-size: 22px; color: var(--text);
}
.empty-state h2 { color: var(--text); font-weight: 650; font-size: 20px; margin: 0 0 8px; letter-spacing: -.02em; }
.empty-state p { margin: 0; line-height: 1.5; }

.msg { display: flex; }
.msg.user { justify-content: flex-end; }
.bubble {
  max-width: 640px; padding: 11px 15px; border-radius: 16px;
  font-size: 14.5px; line-height: 1.55; white-space: pre-wrap; word-wrap: break-word;
}
.msg.user .bubble { background: var(--primary); color: #fff; border-bottom-right-radius: 5px; }
.msg.assistant .bubble { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-bottom-left-radius: 5px; }
.bubble.pending { opacity: .55; }
.bubble img { max-width: 100%; border-radius: 12px; margin-top: 8px; display: block; }
.bubble .img-loading { color: var(--muted); font-size: 13px; margin-top: 8px; }

/* Ações sob a imagem (Aprovar / Editar) */
.msg-actions { display: flex; gap: 8px; margin: -6px 0 2px; padding-left: 2px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 999px; cursor: pointer;
  font-size: 13px; font-weight: 550; font-family: inherit;
  background: var(--surface); color: var(--text); border: 1px solid var(--border-strong);
  box-shadow: var(--shadow); transition: background .15s, border-color .15s, transform .05s;
}
.chip:hover { background: var(--hover); }
.chip:active { transform: translateY(1px); }
.chip .ico { width: 15px; height: 15px; }
.chip-approve { background: var(--primary); color: #fff; border-color: var(--primary); }
.chip-approve:hover { background: var(--primary-hover); }

.typing .bubble { display: inline-flex; gap: 4px; }
.typing .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite both; }
.typing .dot:nth-child(2) { animation-delay: .2s; }
.typing .dot:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }

/* Composer */
.composer { padding: 12px 24px calc(20px + env(safe-area-inset-bottom)); }
.composer-box {
  display: flex; align-items: flex-end; gap: 8px;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 16px; padding: 8px 8px 8px 14px;
  box-shadow: var(--shadow); max-width: 820px; margin: 0 auto;
  transition: border-color .15s;
}
.composer-box:focus-within { border-color: var(--primary); }
.composer textarea {
  flex: 1; background: transparent; border: none; color: var(--text);
  padding: 6px 0; font-size: 15px; font-family: inherit; resize: none; max-height: 180px; line-height: 1.5;
}
.composer textarea:focus { outline: none; }
.composer textarea::placeholder { color: var(--muted); }
.btn.send { padding: 9px; border-radius: 10px; flex-shrink: 0; }
.attach-btn { padding: 9px; border-radius: 10px; flex-shrink: 0; align-self: flex-end; color: var(--muted); }
.attach-btn:hover { color: var(--text); }
.attach-btn .ico { width: 20px; height: 20px; }

/* Botões de formato no chat (antes de gerar a imagem) */
.format-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: -2px 0 4px; padding-left: 2px; }
.chip .fmt-ico { display: inline-block; border: 1.5px solid currentColor; border-radius: 3px; opacity: .7; flex-shrink: 0; }

/* Anexo de imagem no composer */
.composer-attach { max-width: 820px; margin: 0 auto 8px; }
.attach-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 8px 6px 6px; background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: var(--shadow);
}
.attach-chip img { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; display: block; }
.attach-name { font-size: 13px; color: var(--muted); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-x {
  display: inline-flex; padding: 4px; border: none; background: transparent;
  color: var(--muted); cursor: pointer; border-radius: 6px;
}
.attach-x:hover { background: var(--hover); color: var(--text); }
.attach-x .ico { width: 15px; height: 15px; }

/* Calendário */
.calendar-view { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.cal-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 22px; border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.cal-nav { display: flex; align-items: center; gap: 8px; }
.cal-range { font-weight: 600; font-size: 14px; margin-left: 6px; text-transform: capitalize; }
.cal-views { display: flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 2px; }
.seg {
  border: none; background: transparent; padding: 6px 14px; border-radius: 7px;
  font-size: 13px; font-weight: 550; color: var(--text-2); cursor: pointer; font-family: inherit;
}
.seg.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.cal-grid { flex: 1; overflow: auto; }
.cal-empty { padding: 48px 20px; text-align: center; color: var(--muted); }

/* Semana */
.cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--border); min-height: 100%; }
.cal-day { background: var(--bg); display: flex; flex-direction: column; min-height: 220px; }
.cal-day-head { padding: 8px 6px; text-align: center; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg); z-index: 1; }
.cal-dow { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.cal-daynum { font-size: 16px; font-weight: 650; margin-top: 2px; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; }
.cal-day.today .cal-daynum { background: var(--primary); color: #fff; }
.cal-day-body { padding: 8px; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; }
.cal-post {
  border: 1px solid var(--border-strong); border-left-width: 3px; border-radius: 9px;
  padding: 7px 9px; background: var(--surface);
}
.cal-post.state-QUEUE { border-left-color: #f59e0b; }
.cal-post.state-PUBLISHED { border-left-color: #16a34a; }
.cal-post.state-ERROR { border-left-color: var(--danger); }
.cal-post.state-DRAFT { border-left-color: var(--muted); }
.cal-time { font-size: 11px; font-weight: 700; color: var(--text-2); }
.cal-text { font-size: 12px; color: var(--text); margin-top: 3px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.cal-chan { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; color: var(--muted); margin-top: 5px; }
.cal-chan .cal-avatar { width: 14px; height: 14px; border-radius: 50%; background: var(--surface-2) center/cover no-repeat; border: 1px solid var(--border); flex-shrink: 0; }

/* Mês */
.cal-dow-row { display: grid; grid-template-columns: repeat(7, 1fr); position: sticky; top: 0; background: var(--bg); z-index: 1; border-bottom: 1px solid var(--border); }
.cal-dow-row span { padding: 8px 6px; text-align: center; font-size: 11px; font-weight: 600; text-transform: uppercase; color: var(--muted); }
.cal-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--border); }
.cal-cell { background: var(--bg); min-height: 104px; padding: 6px; display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.cal-cell.other { background: var(--sidebar); }
.cal-cell-num { font-size: 12px; font-weight: 600; align-self: flex-start; display: grid; place-items: center; min-width: 22px; height: 22px; padding: 0 4px; }
.cal-cell.other .cal-cell-num { color: var(--muted); }
.cal-cell.today .cal-cell-num { background: var(--primary); color: #fff; border-radius: 999px; }
.cal-chip { font-size: 11px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 2px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: default; }
.cal-chip b { font-weight: 700; }
.cal-more { font-size: 10.5px; color: var(--muted); padding-left: 2px; }

/* ===== Publicações (grade do mês) ===== */
.posts-legend { display: flex; align-items: center; gap: 12px; font-size: 11px; color: var(--text-2); }
.posts-legend .lg { display: inline-flex; align-items: center; gap: 5px; }
.posts-legend .lg::before { content: ""; width: 9px; height: 9px; border-radius: 3px; background: var(--muted); }
.posts-legend .lg-queue::before { background: #f59e0b; }
.posts-legend .lg-pub::before { background: #16a34a; }
.posts-legend .lg-draft::before { background: var(--muted); }

.posts-grid { flex: 1; overflow: auto; padding: 16px; }
.posts-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 10px; }
.post-cell {
  aspect-ratio: 1; min-height: 132px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow);
}
.post-cell.empty { background: var(--sidebar); box-shadow: none; }
.post-cell.has-posts { background: #ece5ff; border: 2px solid #7c3aed; box-shadow: 0 2px 5px rgba(124,58,237,.18); }
.post-cell.has-posts .post-cell-head { border-bottom-color: #c4b5fd; }
.post-cell.has-posts .post-cell-num { color: #5b21b6; }
.post-cell.has-posts .post-cell-dow { color: #7c3aed; }
.post-cell.today { outline: 2px solid var(--primary); outline-offset: -1px; }
.post-cell-head { display: flex; align-items: center; justify-content: space-between; padding: 7px 10px; border-bottom: 1px solid var(--border); }
.post-cell-num { font-size: 15px; font-weight: 700; color: var(--text); }
.post-cell.today .post-cell-num {
  display: grid; place-items: center; width: 24px; height: 24px; margin: -2px 0;
  background: var(--primary); color: #fff; border-radius: 999px; font-size: 12.5px;
}
.post-cell-dow { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.post-cell-count { font-size: 10px; font-weight: 700; color: var(--muted); }
.post-cell-body { flex: 1; padding: 8px; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; }
.post-cell-empty { margin: auto; color: var(--border-strong); font-size: 20px; line-height: 1; }
.post-chip {
  display: flex; align-items: center; gap: 6px; font-size: 11px; cursor: default;
  background: var(--surface-2); border: 1px solid var(--border); border-left-width: 3px;
  border-radius: 7px; padding: 4px 7px;
}
.post-chip.state-QUEUE { border-left-color: #f59e0b; }
.post-chip.state-PUBLISHED { border-left-color: #16a34a; }
.post-chip.state-ERROR { border-left-color: var(--danger); }
.post-chip.state-DRAFT { border-left-color: var(--muted); }
.post-order {
  flex-shrink: 0; display: grid; place-items: center; min-width: 17px; height: 17px; padding: 0 4px;
  background: var(--primary); color: #fff; border-radius: 999px; font-size: 9.5px; font-weight: 700;
}
.post-chip-time { flex-shrink: 0; font-weight: 700; color: var(--text-2); }
.post-chip-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }

/* chip de rascunho (cronograma planejado, clicável) */
.post-chip.plan { cursor: pointer; border-style: dashed; border-left: 3px solid var(--text-2); background: var(--surface); }
.post-chip.plan:hover { background: var(--hover); border-color: var(--text-2); }
.post-chip.plan .post-order { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border-strong); }

.posts-toolbar-right { display: flex; align-items: center; gap: 14px; }
.posts-legend .lg-idea::before { background: transparent; border: 1.5px dashed var(--text-2); }
#btn-gen-plan { white-space: nowrap; }

/* modal editar rascunho */
.plan-edit-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 2px; }
.plan-edit-main { display: flex; gap: 8px; }
.btn.ghost.danger { color: var(--danger); border-color: #f0caca; }
.btn.ghost.danger:hover { background: #fef2f2; color: var(--danger); }

/* Mobile */
@media (max-width: 720px) {
  .sidebar { position: absolute; z-index: 20; height: 100%; width: 272px; transform: translateX(0); transition: transform .22s ease; box-shadow: 0 0 40px rgba(0,0,0,.12); }
  .app.collapsed .sidebar { width: 272px; transform: translateX(-100%); border-right-color: var(--border); }
  .conv-del { display: inline-flex; }
  .composer { padding: 10px 14px calc(16px + env(safe-area-inset-bottom)); }
  .messages { padding: 20px 16px; }
  .cal-toolbar { padding: 10px 14px; }
  .cal-week, .cal-month, .cal-dow-row { min-width: 660px; }
  .posts-grid { padding: 12px; }
  .posts-board { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
  .posts-legend { display: none; }
}

/* iOS Safari: campos com fonte < 16px disparam zoom automatico ao focar (e nao volta).
   Em telas pequenas (iPhone/tablets) forcamos 16px nos campos para evitar isso. */
@media (max-width: 820px) {
  .auth-card input,
  .company-form input, .company-form textarea, .company-form select,
  .composer textarea { font-size: 16px; }
}
