/* Instagram Central — design system v3 (refine SaaS/fintech) */

:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --surface-hover: #f1f5f9;
  --border: #e8edf5;
  --border-strong: #d5dde8;
  --text: #0f172a;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --text-soft: #334155;
  --text-muted: #64748b;
  --text-faint: #94a3b8;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef2ff;
  --accent-ring: rgba(79, 70, 229, 0.16);
  --primary: var(--accent);
  --primary-hover: var(--accent-hover);
  --primary-soft: var(--accent-soft);
  --primary-ring: var(--accent-ring);
  --success: #059669;
  --success-soft: #ecfdf5;
  --success-border: #a7f3d0;
  --warning: #d97706;
  --warning-soft: #fffbeb;
  --warning-border: #fde68a;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --danger-border: #fecaca;
  --scheduled: #6366f1;
  --scheduled-soft: #eef2ff;
  --scheduled-border: #c7d2fe;
  --info: #2563eb;
  --info-soft: #eff6ff;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 14px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.1);
  --sidebar-w: 224px;
  --header-h: 56px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --transition: 160ms cubic-bezier(0.4, 0, 0.2, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body.central-app {
  margin: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 450;
  line-height: 1.55;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.central-app.nav-open {
  overflow: hidden;
}

.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 100% 0%, rgba(79, 70, 229, 0.04), transparent 40%),
    var(--bg);
}

/* ── Mobile backdrop ── */

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 1035;
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}

body.central-app.nav-open .sidebar-backdrop {
  opacity: 1;
  pointer-events: auto;
}

/* ── Sidebar ── */

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 1040;
  transition: transform var(--transition);
}

.sidebar-inner {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 14px 10px;
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 2px 8px 16px;
}

.brand-copy strong {
  display: block;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.2;
}

.brand-copy small {
  display: block;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  margin-top: 2px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, #6366f1 0%, var(--accent) 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.22);
  flex-shrink: 0;
}

.brand-mark i {
  font-size: 14px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.nav-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 12px 10px 5px;
}

.nav-label:first-child {
  padding-top: 2px;
}

.sidebar-nav a {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  gap: 9px;
  align-items: center;
  line-height: 1.25;
  transition: background var(--transition), color var(--transition);
}

.sidebar-nav a i {
  font-size: 14px;
  width: 16px;
  text-align: center;
  opacity: 0.8;
  flex-shrink: 0;
}

.sidebar-nav a:hover {
  background: var(--surface-hover);
  color: var(--text-soft);
}

.sidebar-nav a.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  box-shadow: inset 2px 0 0 var(--accent);
}

.sidebar-foot {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.hermes-status {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  padding: 9px 10px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
}

.hermes-status strong {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
}

.hermes-status small {
  display: block;
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 1px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.14);
  margin-top: 4px;
  flex-shrink: 0;
}

/* ── Main / header ── */

.content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: var(--header-h);
  padding: 8px 22px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 30;
}

.mobile-nav-toggle {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  padding: 0;
  box-shadow: var(--shadow-sm);
}

.mobile-nav-toggle:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.topbar-title {
  min-width: 0;
  flex: 1;
}

.topbar h1 {
  font-size: 18px;
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.account-picker {
  margin-left: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 3px 10px 3px 4px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-sm);
  max-width: min(280px, 46vw);
}

.account-picker:focus-within {
  border-color: #a5b4fc;
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
}

.account-picker select {
  border: 0;
  box-shadow: none;
  font-weight: 600;
  font-size: 13px;
  padding: 4px 0;
  background: transparent;
  color: var(--text-primary);
  min-width: 0;
  flex: 1;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.account-picker-chevron {
  font-size: 11px;
  color: var(--text-faint);
  pointer-events: none;
}

.page-content {
  padding: 18px 22px 36px;
  flex: 1 0 auto;
  width: 100%;
  max-width: 1480px;
  min-height: 0;
}

/* ── Ops header (compact dashboard) ── */

.hero,
.ops-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  position: relative;
}

.ops-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
  padding: 14px 18px;
  flex-wrap: wrap;
}

.hero::before,
.hero::after {
  display: none;
}

.ops-header-identity {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}

.ops-account {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.ops-handle {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--scheduled-border);
  border-radius: 999px;
  padding: 2px 9px;
}

.ops-desc {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.45;
  max-width: 520px;
}

.ops-header-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ops-chip {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 7px 12px;
  min-width: 108px;
}

.ops-chip-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 2px;
}

.ops-chip strong {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--text-soft);
  white-space: nowrap;
}

.meta-ads-token-chip {
  position: relative;
  min-width: 118px;
  max-width: 168px;
}

.meta-ads-token-chip-main {
  display: block;
  line-height: 1.2;
}

.meta-ads-token-chip-sub {
  display: block;
  font-size: 10.5px;
  color: var(--text-faint);
  line-height: 1.25;
  margin-top: 1px;
  white-space: nowrap;
}

.meta-ads-token-details {
  display: inline-block;
  margin-top: 3px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: underline;
  cursor: pointer;
}

.meta-ads-token-details:hover,
.meta-ads-token-details:focus-visible {
  color: var(--text-soft);
  outline: none;
}

.meta-ads-token-details-panel {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  right: 0;
  min-width: 220px;
  max-width: 280px;
  padding: 8px 10px;
  background: var(--surface, #fff);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-soft);
  white-space: normal;
}

.meta-ads-token-chip-healthy {
  border-color: #bbf7d0;
}
.meta-ads-token-chip-healthy .meta-ads-token-chip-main { color: #166534; }

.meta-ads-token-chip-warning {
  border-color: #fde68a;
}
.meta-ads-token-chip-warning .meta-ads-token-chip-main { color: #a16207; }

.meta-ads-token-chip-attention {
  border-color: #fdba74;
}
.meta-ads-token-chip-attention .meta-ads-token-chip-main { color: #c2410c; }

.meta-ads-token-chip-critical,
.meta-ads-token-chip-expired {
  border-color: #fecaca;
}
.meta-ads-token-chip-critical .meta-ads-token-chip-main,
.meta-ads-token-chip-expired .meta-ads-token-chip-main { color: #b91c1c; }

.meta-ads-token-chip-unavailable .meta-ads-token-chip-main {
  color: var(--text-faint);
  font-weight: 600;
  white-space: normal;
  font-size: 11.5px;
}

/* legacy hero fallbacks */
.hero h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 4px 0 0;
}

.hero p {
  color: var(--text-secondary);
  margin: 6px 0 0;
  font-size: 13px;
}

.hero .badge {
  font-weight: 600;
  font-size: 11px;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--scheduled-border);
  background: var(--accent-soft);
  color: var(--accent);
}

/* ── KPI cards ── */

.metric-card,
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.metric-grid > [class*="col-"] {
  display: flex;
}

.metric-card {
  padding: 12px 14px;
  width: 100%;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.metric-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.metric-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  margin-bottom: 10px;
}

.metric-value {
  font-size: clamp(1.45rem, 2.4vw, 1.75rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.045em;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.metric-label {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 5px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.panel {
  padding: 16px 18px;
}

.panel-list {
  padding-top: 14px;
  padding-bottom: 8px;
}

.central-app .ai-strategy-prompt {
  min-height: 28rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.875rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.central-app .ai-strategy-layout .panel-title {
  letter-spacing: 0.01em;
}

.ai-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 1080;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(15, 23, 32, 0.45);
}

.ai-preview-dialog {
  width: min(560px, 100%);
  max-height: min(90vh, 720px);
  overflow: auto;
  box-shadow: 0 18px 48px rgba(15, 23, 32, 0.22);
}

.ai-preview-pre,
.ai-preview-block {
  white-space: pre-wrap;
  font-size: 0.9rem;
  line-height: 1.45;
}

.ai-preview-pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: rgba(15, 23, 32, 0.04);
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
}

.ai-media-preview-wrap {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem;
  background: rgba(15, 23, 32, 0.02);
}

.ai-media-preview {
  display: block;
  width: 100%;
  max-width: 360px;
  height: auto;
  border-radius: 8px;
  margin-inline: auto;
}

.ai-acervo-preview-wrap {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem;
  background: rgba(15, 23, 32, 0.02);
  max-width: 420px;
}

.ai-acervo-preview-thumb {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: 8px;
}

.ai-acervo-picker-dialog {
  max-width: min(920px, 96vw);
  max-height: 90vh;
  overflow: auto;
}

.ai-acervo-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.75rem;
}

.ai-acervo-picker-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.35rem;
  background: var(--surface, #fff);
  cursor: pointer;
  text-align: left;
}

.ai-acervo-picker-card:hover {
  border-color: var(--accent);
}

.ai-acervo-picker-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}

.ai-acervo-picker-label {
  display: block;
  font-size: 11px;
  margin-top: 0.35rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.panel-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.panel hr {
  border-color: var(--border);
  opacity: 1;
  margin: 12px 0;
}

.link-accent,
.central-app .panel a.small,
.central-app a.link-accent {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.link-accent:hover,
.central-app .panel a.small:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.central-app .text-success {
  color: var(--success);
}

.central-app .panel a.small.text-success,
.central-app a.small.text-success {
  color: var(--accent);
}

/* ── Premium list / table ── */

.table-responsive {
  margin: 0;
  border-radius: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table,
.table-posts {
  --bs-table-bg: transparent;
  --bs-table-hover-bg: transparent;
  margin-bottom: 0;
  border-collapse: collapse;
  width: 100%;
}

.table thead th,
.table-posts thead th {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  font-weight: 700;
  border: 0;
  border-bottom: 1px solid var(--border);
  padding: 8px 12px 10px;
  background: transparent;
  white-space: nowrap;
}

.table tbody tr,
.table-posts tbody tr {
  transition: background var(--transition);
}

.table tbody td,
.table-posts tbody td {
  vertical-align: middle;
  border: 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  padding: 12px;
  color: var(--text-soft);
  background: transparent;
}

.table tbody tr:last-child td,
.table-posts tbody tr:last-child td {
  border-bottom: 0;
}

.table tbody tr:hover td,
.table-posts tbody tr:hover td {
  background: rgba(79, 70, 229, 0.03);
}

.table td strong,
.table-posts td strong,
.post-cell-copy strong {
  color: var(--text-primary);
  font-weight: 650;
  font-size: 13.5px;
  display: block;
  line-height: 1.3;
}

.request-id,
.table td small.text-secondary,
.table-posts td small.text-secondary {
  color: var(--text-faint);
  font-size: 11.5px;
  font-family: var(--font-mono);
  font-weight: 450;
  margin-top: 2px;
}

.col-muted {
  color: var(--text-secondary);
  font-size: 12.5px;
  white-space: nowrap;
}

.col-action {
  text-align: right;
  width: 1%;
  white-space: nowrap;
}

.post-thumb {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border-radius: 9px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.post-cell {
  min-width: 0;
}

.min-w-0 {
  min-width: 0;
}

/* ── Posts list: desktop table + mobile cards ── */

.posts-list-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px 12px;
  margin-bottom: 12px;
}

.posts-list-heading {
  min-width: 0;
}

.posts-count-mobile {
  display: none;
}

.post-list-mobile {
  display: none;
}

.post-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 15px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  min-height: 44px;
  transition:
    transform 0.12s ease,
    background 0.12s ease,
    border-color 0.12s ease,
    box-shadow 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.post-card:hover {
  text-decoration: none;
  color: inherit;
  border-color: var(--border-strong);
}

.post-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.post-card:active {
  transform: scale(0.99);
  background: var(--surface-muted);
}

.post-card-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}

.post-card-thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 11px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.post-card-thumb.post-thumb-empty {
  display: block;
  background:
    linear-gradient(145deg, var(--surface-hover), #e8edf5);
}

.post-card-copy {
  min-width: 0;
  flex: 1 1 auto;
}

.post-card-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.post-card-id {
  display: block;
  margin-top: 3px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 450;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.post-card-status {
  display: flex;
  align-items: center;
}

.post-card-status .badge-state {
  max-width: 100%;
}

.post-card-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.post-card-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}

.post-card-pillar,
.post-card-date {
  display: block;
  font-size: 12.5px;
  line-height: 1.35;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.post-card-pillar {
  font-weight: 550;
  color: var(--text-soft);
}

.post-card-chevron {
  flex-shrink: 0;
  font-size: 20px;
  line-height: 1;
  font-weight: 400;
  color: var(--text-faint);
  padding-bottom: 1px;
}

.format-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text-secondary);
  white-space: nowrap;
}

.format-reel {
  background: #fdf2f8;
  border-color: #fbcfe8;
  color: #be185d;
}

.format-carousel {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #15803d;
}

.format-story {
  background: #eef2ff;
  border-color: #c7d2fe;
  color: #4338ca;
}

.format-feed {
  background: var(--surface-muted);
  color: var(--text-secondary);
}

.post-card-status {
  gap: 6px;
  flex-wrap: wrap;
}

.format-fieldset {
  border: 0;
  padding: 0;
  margin: 0 0 1rem;
}

.format-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.format-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  cursor: pointer;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text-primary);
}

.format-option:has(input:checked) {
  border-color: #a5b4fc;
  background: var(--accent-soft, #eef2ff);
  box-shadow: 0 0 0 1px #a5b4fc inset;
}

.format-option input {
  margin: 0;
}

/* ── Status pills ── */

.badge-state {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  min-height: 22px;
  border-radius: 999px;
  padding: 3px 8px;
  gap: 4px;
  white-space: nowrap;
  line-height: 1.2;
  font-size: 10.5px;
  font-weight: 650;
  border: 1px solid transparent;
}

.badge-state::before {
  font-size: 9px;
  line-height: 1;
}

.state-awaiting_approval {
  background: var(--warning-soft);
  color: var(--warning);
  border-color: var(--warning-border);
}

.state-awaiting_approval::before {
  content: "◷";
}

.state-approved {
  background: var(--info-soft);
  color: var(--info);
  border-color: #bfdbfe;
}

.state-approved::before {
  content: "✓";
}

.state-scheduled,
.state-publishing,
.state-waiting_media_ready {
  background: var(--scheduled-soft);
  color: var(--scheduled);
  border-color: var(--scheduled-border);
}

.state-scheduled::before,
.state-publishing::before,
.state-waiting_media_ready::before {
  content: "◷";
}

.state-published {
  background: var(--success-soft);
  color: var(--success);
  border-color: var(--success-border);
}

.state-published::before {
  content: "✓";
}

.state-needs_review,
.state-failed {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: var(--danger-border);
}

.state-needs_review::before,
.state-failed::before {
  content: "!";
}

.state-draft,
.state-cancelled {
  background: var(--surface-hover);
  color: var(--text-secondary);
  border-color: var(--border);
}

.state-draft::before {
  content: "○";
}

.state-cancelled::before {
  content: "×";
}

/* ── Buttons ── */

.central-app .btn {
  font-weight: 600;
  font-size: 13px;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.central-app .btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.central-app .btn-primary,
.central-app .btn-success {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 1px 2px rgba(79, 70, 229, 0.18);
}

.central-app .btn-primary:hover,
.central-app .btn-success:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.central-app .btn-light,
.central-app .btn-ghost {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-soft);
}

.central-app .btn-light:hover,
.central-app .btn-ghost:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.central-app .btn-outline-primary {
  color: var(--accent);
  border-color: var(--scheduled-border);
  background: var(--surface);
}

.central-app .btn-outline-primary:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-hover);
}

.central-app .btn-outline-danger {
  color: var(--danger);
  border-color: var(--danger-border);
  background: var(--surface);
}

.central-app .btn-outline-danger:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
}

.central-app .post-delete-action {
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border);
}

.central-app .btn-delete-post {
  color: var(--danger);
  background: var(--surface);
  border: 1px solid var(--danger-border);
  font-weight: 500;
  box-shadow: none;
}

.central-app .btn-delete-post:hover,
.central-app .btn-delete-post:focus-visible {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: var(--danger);
}

.central-app .btn-delete-post:disabled {
  opacity: 0.65;
}

.central-app .btn-outline-secondary {
  color: var(--text-soft);
  border-color: var(--border-strong);
}

.central-app .btn-danger {
  background: var(--danger);
  border-color: var(--danger);
}

.central-app .btn-danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
}

.central-app .btn-row-link {
  background: transparent;
  border: 0;
  color: var(--accent);
  font-weight: 650;
  padding: 4px 6px;
  box-shadow: none;
}

.central-app .btn-row-link:hover {
  background: var(--accent-soft);
  color: var(--accent-hover);
}

/* ── Forms ── */

.central-app .form-select,
.central-app .form-control {
  border-radius: var(--radius-sm);
  border-color: var(--border);
  font-size: 14px;
  color: var(--text-primary);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.central-app .form-select:focus,
.central-app .form-control:focus {
  border-color: #a5b4fc;
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.central-app .form-select-sm {
  padding-top: 6px;
  padding-bottom: 6px;
  font-weight: 500;
  background-color: var(--surface);
}

.central-app .form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
}

.central-app .form-text {
  color: var(--text-secondary);
  font-size: 12px;
}

.central-app fieldset.border {
  border-color: var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
}

.central-app fieldset legend.h6 {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-primary);
  padding: 0 6px;
}

/* ── Empty & loading ── */

.empty {
  padding: 28px 18px;
  text-align: center;
  color: var(--text-secondary);
  background: transparent;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  margin: 8px 0 10px;
}

.empty i {
  color: var(--text-faint);
}

.empty strong {
  color: var(--text-soft);
  font-weight: 650;
}

.loading {
  padding: 40px 18px;
  text-align: center;
  color: var(--text-secondary);
}

.loading .spinner-border {
  color: var(--accent);
  margin-right: 8px;
}

/* ── Post detail ── */

.detail-art {
  width: 100%;
  max-height: 520px;
  object-fit: contain;
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  border: 1px solid var(--border);
}

.page-content .panel .h4,
.page-content .panel h2.h4,
.page-content .panel h2.h5 {
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.page-content .panel dl dt,
.page-content .panel .text-secondary {
  color: var(--text-secondary);
  font-size: 12px;
}

.page-content .panel dl dd,
.page-content .panel strong.d-block {
  color: var(--text-primary);
  font-weight: 600;
}

#caption-display p.text-secondary {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  color: var(--text-soft);
  margin-top: 8px;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}

#caption-editor {
  max-width: 100%;
}

#caption-editor textarea,
#caption-textarea {
  font-size: 14px;
  line-height: 1.55;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow-y: auto;
  overflow-wrap: anywhere;
  word-break: break-word;
}

#caption-editor .d-flex.gap-2 {
  flex-wrap: wrap;
}

.page-content .d-flex.gap-2.mt-4,
.page-content .d-flex.flex-wrap.gap-2.mt-4 {
  padding-top: 14px;
  border-top: 1px solid var(--border);
  gap: 8px;
}

/* ── Audit ── */

.audit-line {
  border-left: 2px solid var(--border-strong);
  padding: 0 0 16px 16px;
  position: relative;
  margin-left: 4px;
}

.audit-line:last-child {
  padding-bottom: 0;
}

.audit-line::before {
  content: "";
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 2px var(--accent-soft);
  left: -5px;
  top: 4px;
}

.audit-line strong {
  font-size: 13px;
  color: var(--text-primary);
}

/* ── Calendar ── */

.calendar-day {
  min-height: 112px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.calendar-day:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.calendar-day strong {
  font-size: 12px;
  text-transform: capitalize;
  color: var(--text-primary);
  font-weight: 700;
}

.calendar-item {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-left: 3px solid var(--scheduled);
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  margin-top: 7px;
  line-height: 1.4;
  transition: background var(--transition), border-color var(--transition);
}

.calendar-item:hover {
  background: var(--accent-soft);
  border-color: var(--scheduled-border);
}

.calendar-item .badge-state {
  margin-top: 4px;
  font-size: 9.5px;
  min-height: 18px;
  padding: 2px 7px;
}

/* ── Alerts & modal ── */

.central-app .alert {
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: 13px;
}

.central-app .alert-success {
  background: var(--success-soft);
  border-color: var(--success-border);
  color: #047857;
}

.central-app .alert-danger {
  background: var(--danger-soft);
  border-color: var(--danger-border);
  color: #b91c1c;
}

.central-app pre.bg-light {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 11.5px;
  color: var(--text-soft);
}

.central-app .modal-content {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.central-app .modal-dialog {
  max-width: min(520px, calc(100% - 1.5rem));
  margin-left: auto;
  margin-right: auto;
}

.central-app .modal-header {
  border-bottom-color: var(--border);
  padding: 14px 18px;
  flex-shrink: 0;
}

.central-app .modal-body {
  padding: 14px 18px;
  overscroll-behavior: contain;
}

.central-app .modal-footer {
  border-top-color: var(--border);
  padding: 12px 18px 14px;
  flex-shrink: 0;
  gap: 8px;
  flex-wrap: wrap;
}

.central-app .modal-title {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.02em;
}

.central-app .badge.text-bg-light {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  color: var(--text-soft);
  font-weight: 600;
}

/* ── Responsive ── */

@media (max-width: 991.98px) {
  .sidebar {
    width: min(272px, 86vw);
    transform: translateX(-105%);
    box-shadow: var(--shadow-lg);
  }

  body.central-app.nav-open .sidebar {
    transform: translateX(0);
  }

  .app-shell {
    min-height: 100svh;
    min-height: 100dvh;
  }

  .content {
    margin-left: 0;
    min-height: 100svh;
    min-height: 100dvh;
  }

  .topbar {
    padding: 8px 14px;
    position: sticky;
    top: 0;
  }

  .page-content {
    padding: 14px 14px 28px;
    flex: 0 1 auto;
  }

  .page-content form.row,
  .page-content .row.g-4 {
    align-items: flex-start;
  }

  .page-content .panel,
  #new-post-form .panel {
    height: auto;
    min-height: 0;
  }

  .central-app .form-select,
  .central-app .form-control,
  .central-app textarea.form-control {
    font-size: 16px;
  }

  #new-post-caption,
  #caption-textarea,
  #caption-editor textarea {
    min-height: 6.5rem;
    max-height: min(32svh, 220px);
    height: auto;
    resize: vertical;
    font-size: 16px;
  }

  body.keyboard-open #caption-textarea,
  body.keyboard-open #caption-editor textarea,
  body.keyboard-open #new-post-caption {
    max-height: min(28svh, calc(var(--vvh, 100dvh) * 0.32), 180px);
  }

  #caption-editor .caption-save-button,
  #caption-editor .caption-cancel-button {
    flex: 1 1 auto;
    min-height: 44px;
  }

  #new-post-art-text {
    min-height: 4.5rem;
    max-height: min(24svh, 160px);
    resize: vertical;
  }

  .account-picker {
    max-width: min(220px, 42vw);
  }

  .ops-header {
    padding: 12px 14px;
  }

  body.keyboard-open .topbar {
    position: static;
  }

  body.keyboard-open .app-shell,
  body.keyboard-open .content {
    min-height: 0;
  }

  body.keyboard-open.nav-open {
    overflow: hidden;
  }

  body.keyboard-open:not(.nav-open) {
    overflow: auto;
    overflow-x: hidden;
  }
}

@media (min-width: 992px) and (max-width: 1199.98px) {
  :root {
    --sidebar-w: 210px;
  }

  .page-content {
    padding: 16px 18px 32px;
  }
}

@media (min-width: 1440px) {
  .page-content {
    padding-left: 28px;
    padding-right: 28px;
  }
}

@media (max-width: 767.98px) {
  .topbar h1 {
    font-size: 16px;
  }

  .page-content {
    padding: 12px 12px 24px;
  }

  .ops-header {
    flex-direction: column;
    align-items: stretch;
  }

  .ops-header-meta {
    width: 100%;
  }

  .ops-chip {
    flex: 1 1 calc(50% - 8px);
    min-width: 0;
  }

  .metric-value {
    font-size: 1.35rem;
  }

  .detail-art {
    max-height: 280px;
  }

  .panel {
    padding: 12px 14px;
  }

  /* Posts: tabela desktop some; cards app-like */
  .posts-count-desktop {
    display: none;
  }

  .posts-count-mobile {
    display: inline;
  }

  .posts-list-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 14px;
  }

  .panel-posts .state-filter,
  .panel-posts #state-filter {
    width: 100%;
    max-width: none;
    min-height: 44px;
    font-size: 16px;
  }

  .panel-list.panel-posts,
  .panel-list:has(.post-list-mobile) {
    background: transparent;
    border: 0;
    box-shadow: none;
    padding-left: 0;
    padding-right: 0;
  }

  .panel-list.panel-posts .posts-list-header,
  .panel-list:has(.post-list-mobile) > .d-flex {
    padding-left: 2px;
    padding-right: 2px;
  }

  .post-list-desktop {
    display: none !important;
  }

  .post-list-mobile {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .post-list-mobile-item {
    min-width: 0;
  }

  .table thead,
  .table-posts thead {
    display: none;
  }

  /* Users / outras tabelas: empilhamento legado (posts usam cards) */
  .table:not(.table-posts) tbody tr {
    display: block;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    background: var(--surface);
    overflow: hidden;
  }

  .table:not(.table-posts) tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
  }

  .table:not(.table-posts) tbody td:first-child {
    display: block;
    border-bottom: 1px solid var(--border);
  }

  .table:not(.table-posts) tbody td:last-child {
    border-bottom: 0;
    justify-content: flex-end;
  }

  .table:not(.table-posts) tbody tr:last-child td {
    border-bottom: 1px solid var(--border);
  }

  .table:not(.table-posts) tbody tr:last-child td:last-child {
    border-bottom: 0;
  }

  .table:not(.table-posts) tbody td:nth-child(2)::before {
    content: "Status";
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-faint);
  }

  .panel .table:not(.table-posts) tbody td:nth-child(3)::before {
    content: "Empresas";
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-faint);
  }

  .panel .table:not(.table-posts) tbody td:nth-child(4)::before {
    content: "";
  }

  .calendar-day {
    min-height: auto;
  }

  .page-content .d-flex.gap-2.mt-4 .btn,
  .page-content .d-flex.flex-wrap.gap-2.mt-4 .btn {
    flex: 1 1 auto;
    min-height: 42px;
  }
}

@media (max-width: 575.98px), (max-width: 430px) {
  .topbar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px;
  }

  .topbar-title {
    order: 2;
    flex: 1 1 calc(100% - 48px);
  }

  .mobile-nav-toggle {
    order: 1;
  }

  .account-picker {
    order: 3;
    width: 100%;
    max-width: none;
    margin-left: 0;
  }

  .metric-card {
    padding: 10px 12px;
  }

  .metric-icon {
    width: 26px;
    height: 26px;
    font-size: 12px;
    margin-bottom: 8px;
  }

  .panel .d-flex.flex-wrap {
    flex-direction: column;
    align-items: stretch;
  }

  .panel #state-filter,
  .panel .form-select-sm[style] {
    width: 100%;
    max-width: none;
  }

  .ops-chip {
    flex: 1 1 100%;
  }
}

@media (min-width: 390px) and (max-width: 429.98px) {
  .ops-chip {
    flex: 1 1 calc(50% - 8px);
  }
}

.media-upload-preview {
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: 420px;
  display: block;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-soft, #f8fafc);
}

.media-upload-drop {
  border: 1px dashed var(--border);
  border-radius: 14px;
  padding: 18px;
  background: var(--surface-soft, #f8fafc);
}

.media-upload-drop.is-dragging {
  border-color: var(--accent, #16a34a);
  background: #f0fdf4;
}

#image-editor .media-upload-preview {
  max-height: 360px;
}

/* ── Login page ── */

body.login-page {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background:
    radial-gradient(circle at 12% 18%, rgba(79, 70, 229, 0.08), transparent 42%),
    radial-gradient(circle at 88% 82%, rgba(99, 102, 241, 0.06), transparent 38%),
    var(--bg);
  color: var(--text-primary);
}

body.login-page .login-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
}

.login-layout {
  width: min(960px, 100%);
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 28px 40px;
  align-items: center;
}

.login-aside {
  padding: 8px 8px 8px 4px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.login-brand strong {
  display: block;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.login-brand small {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.login-aside-title {
  margin: 0;
  font-size: clamp(1.45rem, 2.2vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.25;
  color: var(--text-primary);
  max-width: 18ch;
}

.login-aside-copy {
  margin: 12px 0 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-secondary);
  max-width: 36ch;
}

.login-benefits {
  list-style: none;
  margin: 28px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.login-benefits li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-soft);
}

.login-benefits i {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 14px;
  flex-shrink: 0;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md), 0 24px 48px rgba(15, 23, 42, 0.04);
  padding: 28px 28px 22px;
  width: 100%;
  max-width: 420px;
  justify-self: end;
}

.login-card-header {
  margin-bottom: 22px;
}

.login-card-mark {
  margin-bottom: 16px;
}

.login-card-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.login-card-subtitle {
  margin: 6px 0 0;
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.login-alert {
  margin-bottom: 16px;
  font-size: 13px;
  border-radius: var(--radius-md);
}

.login-field {
  margin-bottom: 14px;
}

.login-field .form-label {
  margin-bottom: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-soft);
}

.login-input-wrap {
  position: relative;
}

.login-input-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  font-size: 15px;
  pointer-events: none;
}

.login-page .login-form .form-control {
  height: 46px;
  padding: 10px 44px 10px 40px;
  border-radius: var(--radius-md);
  border-color: var(--border);
  font-size: 14px;
  background: var(--surface);
}

.login-page .login-form .form-control:focus {
  border-color: #a5b4fc;
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.login-toggle-password {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
}

.login-toggle-password:hover {
  background: var(--surface-hover);
  color: var(--text-soft);
}

.login-toggle-password:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.login-submit {
  margin-top: 8px;
  width: 100%;
  height: 46px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-md);
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 1px 2px rgba(79, 70, 229, 0.2);
}

.login-page .login-submit.btn-primary:hover,
.login-page .login-submit.btn-primary:focus {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.login-card-foot {
  margin: 18px 0 0;
  text-align: center;
  font-size: 12px;
  color: var(--text-faint);
}

@media (max-width: 1024px) {
  body.login-page .login-shell {
    padding: 28px 20px;
  }

  .login-layout {
    gap: 24px 28px;
  }

  .login-card {
    padding: 24px;
  }
}

@media (max-width: 768px) {
  body.login-page .login-shell {
    align-items: flex-start;
    padding: 20px 16px 28px;
  }

  .login-layout {
    grid-template-columns: 1fr;
    gap: 0;
    width: min(440px, 100%);
  }

  .login-aside {
    display: none;
  }

  .login-card {
    max-width: none;
    justify-self: stretch;
    padding: 22px 18px 18px;
    border-radius: var(--radius-lg);
  }

  .login-card-title {
    font-size: 1.25rem;
  }

  .login-page .login-form .form-control,
  .login-submit {
    height: 48px;
  }
}

@media (max-width: 430px) {
  body.login-page .login-shell {
    padding: 16px 16px 24px;
  }

  .login-card {
    padding: 20px 16px 16px;
  }
}

@media (max-height: 640px) and (min-width: 769px) {
  body.login-page .login-shell {
    align-items: flex-start;
    padding-top: 24px;
    padding-bottom: 24px;
  }
}

/* ── Password change + mobile keyboard helpers ── */

.password-change-page {
  min-height: 100vh;
  min-height: 100dvh;
  padding: 20px 16px;
  background: var(--bg);
}

.password-change-card {
  width: min(92vw, 440px);
  height: auto;
}

:root {
  --vvh: 100dvh;
}

@media (max-width: 991.98px) {
  html {
    height: auto;
  }

  body.central-app {
    min-height: 100svh;
    min-height: 100dvh;
    overflow-x: hidden;
  }

  .media-upload-preview {
    max-height: min(40svh, 280px);
  }
}

/* ── Global mobile stability (keyboard / iOS / forms / modals) ── */

.state-filter {
  width: 190px;
  max-width: 100%;
}

.central-app .form-control,
.central-app .form-select,
.central-app textarea.form-control {
  max-width: 100%;
  box-sizing: border-box;
}

.central-app pre.bg-light,
.central-app pre {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.detail-art {
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

@media (max-width: 991.98px) {
  .state-filter,
  .panel #state-filter,
  .panel .form-select-sm.state-filter,
  .panel .form-select-sm[style] {
    width: 100%;
    max-width: none;
  }

  .central-app .form-select-sm {
    font-size: 16px;
    min-height: 44px;
  }

  .central-app .modal-dialog {
    max-width: calc(100% - 1.25rem);
    margin: 0.625rem auto;
    max-height: calc(var(--vvh, 100dvh) - 1.25rem);
  }

  .central-app .modal-dialog-scrollable .modal-content,
  .central-app .modal-content {
    max-height: calc(var(--vvh, 100dvh) - 1.25rem);
  }

  .central-app .modal-dialog-scrollable .modal-body,
  .central-app .modal-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  body.keyboard-open .modal-dialog-centered {
    align-items: flex-start;
    padding-top: 0.5rem;
  }

  .sidebar {
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .topbar {
    padding-top: max(8px, env(safe-area-inset-top, 0px));
  }

  .page-content {
    padding-bottom: max(28px, calc(16px + env(safe-area-inset-bottom, 0px)));
  }

  .central-app .modal-footer {
    padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
  }

  #user-form .form-control,
  #user-form .form-select,
  .password-change-page .form-control,
  #caption-textarea,
  #schedule-datetime,
  #publish-confirmation {
    font-size: 16px;
  }

  #caption-textarea {
    min-height: 6.5rem;
    max-height: min(32svh, 220px);
    height: auto;
    font-size: 16px;
    resize: vertical;
  }

  body.keyboard-open #caption-textarea {
    max-height: min(28svh, calc(var(--vvh, 100dvh) * 0.32), 180px);
  }

  .central-app fieldset.border {
    padding: 12px;
  }

  .central-app fieldset .form-check-inline {
    display: flex;
    margin-right: 0;
    margin-bottom: 0.35rem;
  }

  .table-responsive,
  .table-responsive.post-list,
  .post-list-desktop {
    overflow-x: visible;
  }

  .page-content > .row.g-4.post-detail {
    display: flex;
    flex-direction: column;
  }

  /* Mobile: detalhes → foto → histórico (histórico nunca acima da arte) */
  .page-content > .row.g-4.post-detail > .post-detail-meta {
    order: 1;
  }

  .page-content > .row.g-4.post-detail > .post-detail-art-col {
    order: 2;
  }

  .page-content > .row.g-4.post-detail > .post-detail-audit {
    order: 3;
  }

  .page-content > .row.g-4 > [class*="col-"] {
    width: 100%;
    max-width: 100%;
  }

  #image-editor,
  .post-detail-art {
    max-width: 100%;
  }

  #image-editor .form-control,
  #image-update-file {
    font-size: 16px;
  }

  #image-editor .media-upload-preview {
    max-width: 100%;
    max-height: min(36svh, 240px);
    height: auto;
  }

  body.keyboard-open #image-editor .media-upload-preview {
    max-height: min(28svh, 180px);
  }

  #image-editor .image-save-button,
  #image-editor .image-cancel-button,
  .image-edit-button {
    min-height: 44px;
  }

  .detail-art-empty {
    display: grid;
    place-items: center;
    min-height: 160px;
    color: var(--text-faint);
    font-size: 13px;
  }

  .login-page .login-form .form-control,
  .password-change-page .form-control {
    font-size: 16px;
  }

  .password-change-page {
    min-height: 100svh;
    min-height: 100dvh;
    align-items: flex-start;
    padding-top: max(24px, env(safe-area-inset-top, 0px));
    padding-bottom: max(24px, env(safe-area-inset-bottom, 0px));
  }

  body.login-page.keyboard-open .login-shell,
  body.password-change-page.keyboard-open {
    align-items: flex-start;
    min-height: 0;
  }

  .login-card,
  .password-change-card {
    height: auto;
    max-height: none;
  }

  .calendar-item {
    word-break: break-word;
  }

  .media-upload-drop {
    max-width: 100%;
  }

  .app-shell,
  .content,
  .page-content {
    max-width: 100%;
    overflow-x: clip;
  }
}

@media (max-width: 575.98px) {
  .central-app .modal-footer .btn {
    flex: 1 1 auto;
    min-height: 44px;
  }

  .account-picker {
    max-width: 100%;
  }
}

/* ── SweetAlert2 (confirmações Centrais) ── */

.central-swal-popup {
  border-radius: 14px !important;
  font-family: inherit;
}

.central-swal-popup .swal2-actions {
  gap: 8px;
}

.central-swal-popup .swal2-actions .btn {
  min-height: 44px;
  min-width: 7.5rem;
  margin: 0 !important;
}

.central-swal-toast {
  border-radius: 12px !important;
  font-family: inherit;
  font-size: 0.92rem;
}

/* ── Image framer (enquadramento Feed/Story) ── */

body.image-framer-open {
  overflow: hidden;
}

.image-framer-overlay {
  position: fixed;
  inset: 0;
  z-index: 1080;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(2px);
}

.image-framer-dialog {
  display: flex;
  flex-direction: column;
  width: min(960px, 100%);
  max-height: 100%;
  margin: auto;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.28);
  overflow: hidden;
}

.image-framer-header,
.image-framer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border, #e2e8f0);
  flex-shrink: 0;
}

.image-framer-footer {
  border-bottom: 0;
  border-top: 1px solid var(--border, #e2e8f0);
  flex-wrap: wrap;
}

.image-framer-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 650;
}

.image-framer-sub {
  margin: 2px 0 0;
  color: #64748b;
  font-size: 0.85rem;
}

.image-framer-body {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(220px, 0.7fr);
  gap: 16px;
  padding: 16px;
  overflow: auto;
  min-height: 0;
  flex: 1;
}

.image-framer-stage-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.image-framer-stage {
  position: relative;
  touch-action: none;
  user-select: none;
  cursor: grab;
  background: #0f172a;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.image-framer-stage.is-dragging {
  cursor: grabbing;
}

.image-framer-stage-story {
  aspect-ratio: 9 / 16;
}

.image-framer-stage-feed {
  aspect-ratio: 4 / 5;
}

.image-framer-canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

.image-framer-frame-guide {
  pointer-events: none;
  position: absolute;
  inset: 0;
  border: 2px solid rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.35);
  border-radius: 2px;
}

.image-framer-stage-story .image-framer-frame-guide::after {
  content: "9:16";
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.7);
  color: #f8fafc;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.image-framer-hint {
  margin: 0;
  color: #64748b;
  font-size: 0.8rem;
  text-align: center;
}

.image-framer-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.image-framer-meta {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid var(--border, #e2e8f0);
  font-size: 0.85rem;
}

.image-framer-meta > div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.image-framer-meta span {
  color: #64748b;
}

.image-framer-crop-note {
  display: block;
  margin-top: 4px;
  color: #475569;
}

.image-framer-crop-note.is-warn {
  color: #b45309;
  font-weight: 500;
}

.image-framer-tools {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.image-framer-zoom-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: #475569;
}

.image-framer-zoom {
  width: 100%;
}

.image-framer-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.image-framer-mode.is-active {
  border-color: #86efac;
  background: #f0fdf4;
  box-shadow: 0 0 0 1px #86efac inset;
}

.image-framer-preview-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}

.image-framer-preview-label {
  font-size: 0.8rem;
  color: #64748b;
}

.image-framer-preview {
  display: block;
  max-width: 120px;
  width: 100%;
  height: auto;
  border-radius: 8px;
  background: #0f172a;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.12);
}

.aspect-action {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin-top: 8px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid #fde68a;
  background: #fffbeb;
  color: #92400e;
  font-size: 0.9rem;
}

.aspect-action.is-ready {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.aspect-action strong {
  display: block;
}

.aspect-action .aspect-action-dims {
  font-size: 0.85rem;
  opacity: 0.9;
}

@media (max-width: 767.98px) {
  .image-framer-body {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .image-framer-dialog {
    border-radius: 12px;
    max-height: 100%;
  }

  .image-framer-footer .btn {
    flex: 1 1 auto;
    min-height: 44px;
  }

  .image-framer-preview {
    max-width: 96px;
  }
}

/* Acervo de Mídia */
.ml-filters .form-control,
.ml-filters .form-select {
  font-size: 0.9rem;
}
.ml-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 1.25rem;
  align-items: start;
}
.ml-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 0.85rem;
}
.ml-card {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 0;
  text-align: left;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.ml-card:hover {
  border-color: var(--border-strong);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  transform: translateY(-1px);
}
.ml-card.is-inactive {
  opacity: 0.62;
}
.ml-card.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.ml-card-thumb-wrap {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--surface-muted);
  overflow: hidden;
}
.ml-card-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ml-fav {
  position: absolute;
  top: 8px;
  right: 8px;
  color: #ca8a04;
  font-size: 0.95rem;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}
.ml-card-body {
  padding: 0.65rem 0.75rem 0.8rem;
}
.ml-card-cat {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-soft);
  margin-bottom: 0.25rem;
}
.ml-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  min-height: 1.35rem;
}
.ml-tag {
  font-size: 0.68rem;
  color: var(--text-secondary);
  background: var(--surface-muted);
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
}
.ml-card-meta {
  margin-top: 0.35rem;
  font-size: 0.7rem;
  color: var(--text-faint);
}
.ml-detail-panel,
.ml-detail-empty {
  position: sticky;
  top: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
}
.ml-detail-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}
.ml-focal-stage {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #0b1220;
  cursor: crosshair;
}
.ml-focal-stage img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 320px;
  object-fit: contain;
  margin: 0 auto;
}
.ml-focal-stage--upload {
  min-height: 160px;
  display: grid;
  place-items: center;
}
.ml-focal-stage--upload img {
  grid-area: 1 / 1;
  max-height: 280px;
  width: auto;
  max-width: 100%;
  height: auto;
  object-fit: contain;
  background: transparent;
  z-index: 1;
}
.ml-focal-stage--upload .ml-focal-placeholder {
  grid-area: 1 / 1;
  z-index: 0;
}
.ml-focal-stage--upload .ml-focal-dot {
  z-index: 2;
}
.ml-focal-placeholder {
  color: #94a3b8;
  font-size: 0.85rem;
  padding: 1rem;
  text-align: center;
}
.ml-focal-dot {
  position: absolute;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  background: #f8fafc;
  border: 2px solid #0f172a;
  box-shadow: 0 0 0 2px rgba(248, 250, 252, 0.7);
  pointer-events: none;
}
@media (max-width: 991.98px) {
  .ml-layout {
    grid-template-columns: 1fr;
  }
  .ml-detail-panel,
  .ml-detail-empty {
    position: static;
  }
}

/* ==========================================================================
   Analytics Dashboard Styles
   ========================================================================== */

.analytics-shell {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.analytics-header-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.analytics-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.analytics-kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.2rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}

.analytics-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.analytics-kpi-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--accent);
  opacity: 0.8;
}

.analytics-kpi-card.kpi-accent::before { background: var(--accent); }
.analytics-kpi-card.kpi-success::before { background: var(--success); }
.analytics-kpi-card.kpi-warning::before { background: var(--warning); }
.analytics-kpi-card.kpi-info::before { background: var(--info); }

.analytics-kpi-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.analytics-kpi-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.analytics-kpi-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.analytics-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.analytics-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.analytics-card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.analytics-svg-container {
  width: 100%;
  position: relative;
  overflow: hidden;
}

.analytics-chart-svg {
  width: 100%;
  height: 220px;
  overflow: visible;
}

.analytics-funnel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.analytics-funnel-item {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.875rem;
  text-align: center;
}

.analytics-funnel-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.analytics-funnel-val {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.analytics-funnel-bar {
  height: 4px;
  border-radius: 2px;
  background: var(--accent);
  margin-top: 0.5rem;
}

.analytics-signal-badge {
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.signal-above {
  background: var(--success-soft);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.signal-average {
  background: var(--surface-muted);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.signal-below {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}

.analytics-rank-badge {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 700;
}

.rank-1 { background: #fef08a; color: #854d0e; }
.rank-2 { background: #e2e8f0; color: #475569; }
.rank-3 { background: #fed7aa; color: #9a3412; }
.rank-other { background: var(--surface-muted); color: var(--text-secondary); }

.analytics-table-thumb {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--surface-muted);
  border: 1px solid var(--border);
}

.analytics-table-thumb-placeholder {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  font-size: 1.25rem;
}

.analytics-intel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.analytics-intel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
}

.analytics-intel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  gap: 0.5rem;
}

.analytics-confidence-badge {
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
  border-radius: 9999px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.confidence-high {
  background: var(--success-soft);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.confidence-medium {
  background: var(--info-soft);
  color: var(--info);
  border: 1px solid var(--scheduled-border);
}

.confidence-low {
  background: var(--warning-soft);
  color: var(--warning);
  border: 1px solid var(--warning-border);
}

.analytics-growth-card {
  margin-bottom: 1.25rem;
}

.analytics-growth-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
}

.analytics-growth-kpi {
  background: var(--surface-muted, rgba(0, 0, 0, 0.03));
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.analytics-growth-kpi-label {
  font-size: 0.72rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.analytics-growth-kpi strong {
  font-size: 1.15rem;
  color: var(--text);
}

.analytics-growth-funnel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.35rem;
}

.analytics-growth-funnel-step {
  flex: 1 1 100px;
  min-width: 100px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.8rem;
  text-align: center;
}

.analytics-growth-funnel-title {
  display: block;
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-bottom: 0.2rem;
}

.analytics-growth-funnel-rate {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--info);
  padding: 0 0.35rem;
  white-space: nowrap;
}

.analytics-growth-diag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
}

.analytics-growth-diag {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.9rem;
  background: var(--surface);
}

.analytics-growth-diag-label {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
}

.analytics-growth-bottleneck {
  border-top: 1px solid var(--border);
  padding-top: 0.85rem;
}

.growth-status-strong {
  border-left: 3px solid var(--success);
}

.growth-status-healthy {
  border-left: 3px solid var(--info);
}

.growth-status-weak {
  border-left: 3px solid var(--warning);
}

.growth-status-muted {
  border-left: 3px solid var(--border);
}

.analytics-content-growth-card {
  margin-bottom: 1.25rem;
}

.analytics-content-growth-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
}

.analytics-content-growth-stat {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.analytics-content-mix-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.5rem;
}

.analytics-content-mix-item {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
}

.analytics-content-plan-table th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
}

.analytics-content-profile-rec {
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
}

.analytics-hermes-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 1.25rem;
}

.analytics-hermes-header {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(168, 85, 247, 0.08) 100%);
  border-bottom: 1px solid var(--border);
  padding: 1.15rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.analytics-hermes-summary-box {
  background: rgba(99, 102, 241, 0.04);
  border: 1px solid rgba(99, 102, 241, 0.15);
  border-radius: var(--radius-sm);
  padding: 1rem 1.15rem;
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--text);
  margin-bottom: 1.25rem;
}

.analytics-hermes-chips {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.analytics-hermes-chip {
  font-size: 0.78rem;
  padding: 0.25rem 0.65rem;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 9999px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.analytics-hermes-chip:hover {
  background: var(--primary-soft, rgba(99, 102, 241, 0.1));
  color: var(--primary);
  border-color: var(--primary);
}

.analytics-hermes-answer-box {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 1rem 1.15rem;
  font-size: 0.92rem;
  line-height: 1.5;
  margin-top: 1rem;
}

.analytics-strategist-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 1.25rem;
}

.analytics-strategist-header {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(59, 130, 246, 0.08) 100%);
  border-bottom: 1px solid var(--border);
  padding: 1.15rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.growth-hook-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.85rem;
}

.growth-hook-card {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.growth-hook-card.hook-a {
  border-top: 3px solid var(--warning);
}

.growth-hook-card.hook-b {
  border-top: 3px solid var(--info);
}

.growth-hook-card.hook-c {
  border-top: 3px solid var(--success);
}

.growth-role-badge {
  font-size: 0.72rem;
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.role-discovery {
  background: rgba(59, 130, 246, 0.12);
  color: #2563eb;
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.role-authority {
  background: rgba(139, 92, 246, 0.12);
  color: #7c3aed;
  border: 1px solid rgba(139, 92, 246, 0.25);
}

.role-identification {
  background: rgba(236, 72, 153, 0.12);
  color: #db2777;
  border: 1px solid rgba(236, 72, 153, 0.25);
}

.role-sharing {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.role-conversion {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.growth-context-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  font-size: 0.82rem;
  line-height: 1.5;
}

.growth-source-badge {
  font-size: 0.68rem;
  padding: 0.15rem 0.45rem;
  border-radius: 9999px;
  font-weight: 500;
  text-transform: none;
}

.source-operator {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.source-profile {
  background: rgba(59, 130, 246, 0.12);
  color: #2563eb;
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.source-ai {
  background: rgba(107, 114, 128, 0.12);
  color: #4b5563;
  border: 1px solid rgba(107, 114, 128, 0.25);
}

.growth-quality-pill {
  font-size: 0.68rem;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
  color: var(--text-muted);
}

/* Growth Hook Selection Modal */
.growth-hook-modal-dialog {
  max-width: 720px;
  width: min(720px, calc(100vw - 32px));
  margin: 1.75rem auto;
}

.growth-hook-modal-content {
  border-radius: var(--radius-md, 8px);
  border: 1px solid var(--border, #e2e8f0);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.growth-hook-modal-body {
  max-height: calc(85vh - 120px);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.25rem;
}

.hook-select-card {
  background: #ffffff;
  transition: all 0.15s ease-in-out;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm, 6px);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  min-width: 0;
  width: 100%;
  position: relative;
  user-select: none;
}

.hook-select-card:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.hook-select-card.hook-a {
  border-left: 4px solid var(--warning, #f59e0b);
}

.hook-select-card.hook-b {
  border-left: 4px solid var(--info, #06b6d4);
}

.hook-select-card.hook-c {
  border-left: 4px solid var(--success, #10b981);
}

.hook-select-card:has(.growth-hook-radio:checked) {
  background: #f0fdf4;
  border-color: #86efac;
}

.hook-select-card.hook-a:has(.growth-hook-radio:checked) {
  background: #fffbeb;
  border-color: #fde68a;
  border-left-color: var(--warning, #f59e0b);
}

.hook-select-card.hook-b:has(.growth-hook-radio:checked) {
  background: #ecfeff;
  border-color: #a5f3fc;
  border-left-color: var(--info, #06b6d4);
}

.hook-select-card.hook-c:has(.growth-hook-radio:checked) {
  background: #f0fdf4;
  border-color: #bbf7d0;
  border-left-color: var(--success, #10b981);
}

.growth-hook-radio {
  position: static;
  float: none;
  margin: 3px 0 0 0;
  flex: 0 0 auto;
  cursor: pointer;
  width: 1.05em;
  height: 1.05em;
  accent-color: var(--primary, #2563eb);
}

.hook-select-content {
  flex: 1 1 auto;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
}

.hook-scroll-stop-box {
  background: #f1f5f9;
  border-radius: var(--radius-sm, 6px);
  padding: 0.4rem 0.65rem;
  border: 1px solid #e2e8f0;
}

.hook-rationale-text {
  font-size: 0.78rem;
  line-height: 1.4;
  color: #475569;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
  min-width: 0;
}

.hook-quote-box {
  background: #ffffff;
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius-sm, 6px);
}

.hook-text-content {
  font-size: 0.83rem;
  line-height: 1.4;
  color: #1e293b;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
  min-width: 0;
}







/* Meta Ads — read-only badge */
.meta-ads-readonly-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #f59e0b;
}
.meta-ads-empty {
  padding: 28px 16px;
  text-align: center;
}
.meta-ads-delta {
  display: block;
  font-size: 11px;
  font-weight: 600;
  margin-top: 2px;
}
.meta-ads-delta.up { color: #16a34a; }
.meta-ads-delta.down { color: #dc2626; }
.meta-ads-delta.neutral { color: #6b7280; }
.meta-ads-chart { display: flex; flex-direction: column; gap: 4px; }
.meta-ads-chart-row { display: flex; align-items: center; gap: 8px; }
.meta-ads-chart-label { width: 50px; font-size: 11px; text-align: right; flex-shrink: 0; color: var(--muted, #6b7280); }
.meta-ads-chart-bar-wrap { flex: 1; background: var(--border, #e5e7eb); border-radius: 4px; height: 18px; overflow: hidden; }
.meta-ads-chart-bar { height: 100%; background: var(--accent, #2563eb); border-radius: 4px; min-width: 0; }
.meta-ads-chart-val { width: 80px; font-size: 11px; text-align: right; flex-shrink: 0; }
.meta-ads-sortable { cursor: pointer; white-space: nowrap; }
.meta-ads-sortable:hover,
.meta-ads-sortable:focus { text-decoration: underline; outline: 2px solid var(--accent, #2563eb); outline-offset: 2px; }

.meta-ads-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.meta-ads-kpi-col { min-width: 0; }
.meta-ads-kpi-card { padding: 12px; }

.meta-ads-health-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px 14px;
}
.meta-ads-health-label {
  display: block;
  font-size: 11px;
  color: var(--muted, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.meta-ads-health-value {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}
.meta-ads-health-value.ok::before,
.meta-ads-health-value.attention::before,
.meta-ads-health-value.error::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.meta-ads-health-value.ok::before { background: #16a34a; }
.meta-ads-health-value.attention::before { background: #d97706; }
.meta-ads-health-value.error::before { background: #dc2626; }
.meta-ads-health-value.ok { color: #166534; }
.meta-ads-health-value.attention { color: #92400e; }
.meta-ads-health-value.error { color: #991b1b; }

.meta-ads-alert {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  margin-bottom: 8px;
  font-size: 13px;
}
.meta-ads-alert-level { font-weight: 700; white-space: nowrap; }
.meta-ads-alert-info { background: #eff6ff; border-color: #bfdbfe; color: #1e3a8a; }
.meta-ads-alert-attention { background: #fffbeb; border-color: #fcd34d; color: #92400e; }
.meta-ads-alert-critical { background: #fef2f2; border-color: #fecaca; color: #991b1b; }

.meta-ads-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.meta-ads-table thead th {
  position: sticky;
  top: 0;
  background: var(--panel, #fff);
  z-index: 1;
}

.meta-ads-tech-details summary {
  list-style: none;
}
.meta-ads-tech-details summary::-webkit-details-marker { display: none; }
.meta-ads-tech-details summary::before {
  content: "▸ ";
  color: var(--muted, #6b7280);
}
.meta-ads-tech-details[open] summary::before { content: "▾ "; }

.meta-ads-skel {
  background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
  background-size: 200% 100%;
  animation: meta-ads-skel 1.2s ease-in-out infinite;
  border-radius: 8px;
}
.meta-ads-skel-title { height: 22px; width: 180px; }
.meta-ads-skel-line { height: 12px; width: 70%; }
.meta-ads-skel-block { height: 96px; width: 100%; }
.meta-ads-skel-chip { height: 28px; width: 72px; }
.meta-ads-skel-kpi { height: 96px; }
.meta-ads-skel-row { display: flex; flex-wrap: wrap; gap: 8px; }
@keyframes meta-ads-skel {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@media (max-width: 1199.98px) {
  .meta-ads-kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .meta-ads-health-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 767.98px) {
  .meta-ads-kpi-grid { grid-template-columns: 1fr; }
  .meta-ads-health-grid { grid-template-columns: 1fr 1fr; }
  .meta-ads-chart-label { width: 40px; }
  .meta-ads-chart-val { width: 64px; }
}
@media (max-width: 399.98px) {
  .meta-ads-health-grid { grid-template-columns: 1fr; }
}

.meta-ads-intel-score {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.meta-ads-intel-card {
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
  background: var(--panel, #fff);
}
.meta-ads-intel-card-info { border-left: 3px solid #2563eb; }
.meta-ads-intel-card-attention { border-left: 3px solid #d97706; }
.meta-ads-intel-card-critical { border-left: 3px solid #dc2626; }
.meta-ads-intel-sev {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.meta-ads-intel-metrics { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.meta-ads-intel-metric { font-size: 12px; color: var(--muted, #6b7280); }
.meta-ads-narrative h2 { margin-bottom: 0.35rem; }
.meta-ads-narrative ul { padding-left: 1.1rem; }
.meta-ads-opp-list { display: grid; gap: 0.75rem; }
.meta-ads-opp-card {
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 6px;
  padding: 0.85rem 1rem;
  background: #fff;
}
.meta-ads-opp-card-high { border-left: 3px solid #dc2626; }
.meta-ads-opp-card-medium { border-left: 3px solid #d97706; }
.meta-ads-opp-card-low { border-left: 3px solid #2563eb; }
.meta-ads-opp-card-info { border-left: 3px solid #6b7280; }
.meta-ads-opp-sev {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: #374151;
}
.meta-ads-row-highlight {
  background: rgba(217, 119, 6, 0.12);
  outline: 1px solid rgba(217, 119, 6, 0.35);
}
.meta-ads-temporal-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: #374151;
  background: rgba(0,0,0,.05);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  margin-bottom: 0.35rem;
}
.meta-ads-evolution-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.35rem 0.75rem;
}
.meta-ads-evolution-timeline { padding-left: 1.1rem; }
.meta-ads-compare-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
}
.meta-ads-compare-metric {
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 6px;
  padding: 0.75rem;
  background: #fff;
}
.meta-ads-compare-value {
  font-size: 1.15rem;
  font-weight: 700;
}

.meta-ads-targets-disclaimer {
  border-left: 3px solid #64748b;
  padding-left: 0.75rem;
}
.meta-ads-target-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
}
.meta-ads-target-badge-on_target { color: #15803d; }
.meta-ads-target-badge-warning { color: #b45309; }
.meta-ads-target-badge-off_target { color: #c2410c; }
.meta-ads-target-badge-critical { color: #b91c1c; }
.meta-ads-target-badge-insufficient_data { color: #64748b; }

.meta-ads-related-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  margin-left: 0.35rem;
  color: #475569;
}
.meta-ads-related-badge-on { color: #15803d; }
.meta-ads-related-row-on { background: rgba(22, 163, 74, 0.06); }

.meta-ads-drafts-disclaimer {
  border-left: 3px solid #64748b;
  padding-left: 0.75rem;
}
.meta-ads-draft-list {
  display: grid;
  gap: 0.75rem;
}
.meta-ads-draft-card {
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 6px;
  padding: 0.85rem 1rem;
  background: #fff;
}
.meta-ads-draft-card-high { border-left: 3px solid #dc2626; }
.meta-ads-draft-card-medium { border-left: 3px solid #d97706; }
.meta-ads-draft-card-low { border-left: 3px solid #2563eb; }
.meta-ads-draft-diff-row {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(0,0,0,.06);
}
.meta-ads-draft-ba {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.9rem;
}

/* ── Página pública: Política de Privacidade ── */
.legal-page {
  min-height: 100vh;
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(79, 70, 229, 0.08), transparent 55%),
    radial-gradient(900px 400px at 100% 0%, rgba(14, 165, 233, 0.06), transparent 50%),
    var(--bg);
}

.legal-skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 8px 12px;
  z-index: 1000;
  border-radius: 0 0 8px 0;
}
.legal-skip:focus {
  left: 0;
}

.legal-header {
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(8px);
}
.legal-header-inner,
.legal-footer-inner,
.legal-shell {
  width: min(820px, calc(100% - 32px));
  margin-inline: auto;
}
.legal-header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 0;
}
.legal-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.legal-brand strong {
  display: block;
  font-size: 15px;
  color: var(--text);
}
.legal-brand small {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
}
.legal-header-meta {
  color: var(--text-muted);
  font-size: 12px;
}

.legal-shell {
  padding: 28px 0 48px;
}
.legal-article {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: clamp(20px, 4vw, 40px);
}
.legal-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 8px;
}
.legal-intro h1 {
  font-size: clamp(1.55rem, 2.4vw, 2rem);
  line-height: 1.25;
  margin-bottom: 12px;
  color: var(--text);
}
.legal-lead {
  color: var(--text-secondary, #475569);
  font-size: 1.05rem;
  line-height: 1.6;
}
.legal-updated {
  margin-top: 12px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.legal-toc {
  margin: 28px 0;
  padding: 16px 18px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.legal-toc-title {
  font-size: 0.95rem;
  margin-bottom: 10px;
}
.legal-toc ol {
  margin: 0;
  padding-left: 1.2rem;
}
.legal-toc li {
  margin: 4px 0;
}
.legal-toc a {
  color: var(--accent);
  text-decoration: none;
}
.legal-toc a:hover,
.legal-toc a:focus {
  text-decoration: underline;
}

.legal-article section {
  margin-top: 28px;
  scroll-margin-top: 20px;
}
.legal-article h2 {
  font-size: 1.2rem;
  margin-bottom: 10px;
  color: var(--text);
}
.legal-article p,
.legal-article li {
  color: #334155;
  line-height: 1.65;
}
.legal-article ul {
  padding-left: 1.2rem;
  margin-bottom: 12px;
}
.legal-article code {
  font-size: 0.9em;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
}
.legal-contact-list {
  list-style: none;
  padding-left: 0;
}
.legal-contact-list li {
  margin: 8px 0;
}
.legal-article a {
  color: var(--accent);
}
.legal-article a:hover,
.legal-article a:focus-visible {
  text-decoration: underline;
}

.legal-footer-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
}
.legal-footer-nav a {
  color: var(--accent);
  text-decoration: none;
}
.legal-footer-nav a:hover,
.legal-footer-nav a:focus-visible {
  text-decoration: underline;
}
.legal-footer-nav span {
  color: var(--text-muted);
}
@media (max-width: 640px) {
  .legal-header-inner {
    align-items: flex-start;
  }
}
