/*
 * auto — Design System
 * Light, mobile-first, card-based UI
 */

/* ── Google Fonts ───────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,400;0,500;0,600;0,700;0,800;1,400&display=swap');

/* ── Design Tokens ──────────────────────────────────── */
:root {
  /* Brand — "auto" purple (docs/logo.svg, docs/icon.svg) */
  --color-primary:           #6F44EC;
  --color-primary-hover:     #5A34D1;
  --color-primary-dark:      #4C2A99;
  --color-primary-light:     #F1ECFD;
  --color-accent:            #059669;
  --color-accent-hover:      #047857;
  --color-destructive:       #DC2626;
  --color-destructive-hover: #B91C1C;
  --color-destructive-light: #FEF2F2;
  --color-warning:           #D97706;
  --color-warning-light:     #FFFBEB;
  --color-success-light:     #ECFDF5;

  /* Surfaces */
  --color-bg:      #F7F6FD;
  --color-surface: #FFFFFF;
  --color-muted-bg:#F3F4F6;
  --color-row-hover: #FAF8FE;

  /* Text */
  --color-text:        #1E1B4B;
  --color-text-muted:  #6B7280;
  --color-text-subtle: #9CA3AF;

  /* Borders */
  --color-border:       #E5E0FB;
  --color-border-focus: #C4B5FD;

  /* Shadows — soft, brand-tinted */
  --shadow-xs: 0 1px 2px rgba(111,68,236,0.05);
  --shadow-sm: 0 1px 3px rgba(111,68,236,0.06), 0 3px 10px rgba(111,68,236,0.05);
  --shadow-md: 0 4px 16px rgba(111,68,236,0.10), 0 1px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 8px 32px rgba(111,68,236,0.14), 0 2px 8px rgba(0,0,0,0.04);
  --shadow-btn:0 2px 8px rgba(111,68,236,0.32);

  /* Rampa de calor — matiz único da marca, claro → escuro. Codifica magnitude,
     nunca identidade: dez postagens não caberiam numa paleta categórica. */
  --heat-0: #F3F4F6;
  --heat-1: #E4DBFC;
  --heat-2: #C9B8F8;
  --heat-3: #A98BF2;
  --heat-4: #8259E8;
  --heat-5: #6234C9;

  /* Radius */
  --r-sm:  8px;
  --r-md:  12px;
  --r-lg:  16px;
  --r-xl:  24px;
  --r-pill:9999px;

  /* Font */
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);

  /* Sidebar / app shell */
  --sidebar-w: 260px;
  --sidebar-w-collapsed: 76px;
}

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

/* ── Base ───────────────────────────────────────────── */
body {
  font-family: var(--font);
  color: var(--color-text);
  background: var(--color-bg);
  margin: 0;
  padding: 0;
  min-height: 100dvh;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Typography ─────────────────────────────────────── */
h1 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin: 0 0 1.25rem;
  color: var(--color-text);
  line-height: 1.2;
}

h2 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 1.5rem 0 0.75rem;
  color: var(--color-text);
  letter-spacing: -0.01em;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

/* ── Layout ─────────────────────────────────────────── */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}

@media (min-width: 768px) {
  .container { padding: 2rem 2rem 3rem; }

  /* Constrain narrow-content elements so they don't stretch at 960px */
  .container > form,
  .container > dl,
  .post-status,
  #reply-comments { max-width: 640px; }
}

/* ── Muted text ──────────────────────────────────────── */
.muted { color: var(--color-text-subtle); font-style: italic; font-size: 0.9em; }

/* ── Monospace identifiers (raw IDs shown when no readable name exists) ── */
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85em;
  color: var(--color-text-muted);
}

/* ── Status badges ───────────────────────────────────── */
.status {
  display: inline-flex;
  align-items: center;
  padding: 0.2em 0.7em;
  border-radius: var(--r-pill);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}
.status--ok      { background: var(--color-success-light); color: #065F46; }
.status--error   { background: var(--color-destructive-light); color: #991B1B; }
.status--warning { background: var(--color-warning-light); color: #92400E; }
.status--inactive{ background: var(--color-muted-bg); color: var(--color-text-muted); }

/* ── Alerts ──────────────────────────────────────────── */
.alert {
  padding: 0.875rem 1rem;
  border-radius: var(--r-md);
  margin-bottom: 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  border: 1px solid transparent;
}
.alert--ok      { background: var(--color-success-light); color: #065F46; border-color: #A7F3D0; }
.alert--warning { background: var(--color-warning-light); color: #92400E; border-color: #FDE68A; }
.alert--error   { background: var(--color-destructive-light); color: #991B1B; border-color: #FECACA; }

/* ── Buttons ─────────────────────────────────────────── */
.btn,
input[type="submit"],
button[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6em 1.25em;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font);
  text-decoration: none;
  line-height: 1.4;
  box-shadow: var(--shadow-btn);
  transition: background 0.15s var(--ease), box-shadow 0.15s var(--ease), transform 0.1s var(--ease);
  min-height: 44px;
  white-space: nowrap;
}
.btn:hover,
input[type="submit"]:hover,
button[type="submit"]:hover {
  background: var(--color-primary-hover);
  box-shadow: 0 4px 14px rgba(111,68,236,0.42);
  text-decoration: none;
  color: #fff;
}
.btn:active,
input[type="submit"]:active,
button[type="submit"]:active { transform: scale(0.98); }

.btn:disabled,
input[type="submit"]:disabled,
button[type="submit"]:disabled {
  cursor: wait;
  opacity: 0.65;
  box-shadow: none;
  transform: none;
}

.btn--success { background: var(--color-accent); box-shadow: 0 2px 8px rgba(5,150,105,0.32); }
.btn--success:hover { background: var(--color-accent-hover); box-shadow: 0 4px 14px rgba(5,150,105,0.42); color: #fff; }

.btn--danger { background: var(--color-destructive); box-shadow: 0 2px 8px rgba(220,38,38,0.32); }
.btn--danger:hover { background: var(--color-destructive-hover); box-shadow: 0 4px 14px rgba(220,38,38,0.42); color: #fff; }

.btn--small { padding: 0.35em 0.85em; font-size: 0.8rem; min-height: 34px; }
.btn--icon { padding: 0.35em 0.5em; min-width: 34px; justify-content: center; }
.btn:not(.btn--icon) svg { margin-right: 0.55em; }
.btn--ghost { background: transparent; box-shadow: none; color: var(--color-text-muted); border: 1.5px solid var(--color-border); }
.btn--ghost:hover { background: var(--color-primary-light); color: var(--color-primary); border-color: var(--color-primary); box-shadow: none; }

/* ── Filter search ───────────────────────────────────── */
.filter-search {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.filter-search__input {
  padding: 0.35em 0.85em;
  font-size: 0.85rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--r-pill);
  background: var(--color-surface);
  color: var(--color-text);
  min-height: 34px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.filter-search__input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(111,68,236,0.12);
}

/* ── Forms ───────────────────────────────────────────── */
.field { margin-bottom: 1.1rem; }

.field label {
  display: block;
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 0.4em;
  color: var(--color-text);
}

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 0.65em 0.9em;
  border: 1.5px solid var(--color-border);
  border-radius: var(--r-sm);
  font-size: 1rem;
  font-family: var(--font);
  color: var(--color-text);
  background: var(--color-surface);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
  min-height: 48px;
}
.field textarea { min-height: auto; }

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(111,68,236,0.14);
}
.field input::placeholder,
.field textarea::placeholder { color: var(--color-text-subtle); }

.actions { margin-top: 1.25rem; display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }

/* ── Page header actions ─────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  max-width: 640px;
  margin-bottom: 1.25rem;
}
.page-header h1 { margin-bottom: 0; }

@media (max-width: 520px) {
  .page-header { flex-direction: column; align-items: stretch; }
  .page-header .btn { width: 100%; }
}

/* ── Field hints ─────────────────────────────────────── */
.field-hint {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin: 0.3rem 0 0.5rem;
  line-height: 1.45;
}

/* ── Errors ─────────────────────────────────────────── */
.errors {
  background: var(--color-destructive-light);
  color: #991B1B;
  padding: 0.875rem 1rem;
  border-radius: var(--r-md);
  margin-bottom: 1.25rem;
  border: 1px solid #FECACA;
  font-size: 0.9rem;
}
.errors ul { margin: 0.25rem 0 0; padding-left: 1.25rem; }

/* ── Auth ────────────────────────────────────────────── */
.auth-container {
  max-width: 380px;
  margin: 3rem auto;
  background: var(--color-surface);
  padding: 2rem 1.75rem 2.25rem;
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--color-border);
}

.auth-container__brand { display: flex; justify-content: center; margin-bottom: 1.5rem; }
.auth-container__logo { height: 32px; width: auto; }

.auth-container h1 { text-align: center; margin-bottom: 1.5rem; }

.auth-container .actions { justify-content: stretch; }
.auth-container .actions input[type="submit"],
.auth-container .actions button[type="submit"] { width: 100%; }

/* ── Stats cards ─────────────────────────────────────── */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr));
  gap: 1rem;
  margin: 0 0 1.5rem;
}

.stat {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--r-lg);
  padding: 1.25rem 1.1rem 1rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  transition: box-shadow 0.2s var(--ease), transform 0.15s var(--ease);
}
.stat:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.stat__value {
  display: block;
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--color-primary);
  letter-spacing: -0.04em;
  line-height: 1;
}
.stat__value--error { color: var(--color-destructive); }
.stat__label {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  font-weight: 500;
  margin-bottom: 0.5rem;
}
.stat a {
  font-size: 0.78rem;
  color: var(--color-primary);
  font-weight: 600;
  margin-top: auto;
}
.stat a:hover { text-decoration: underline; }

/* ── Tables ─────────────────────────────────────────── */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  background: var(--color-surface);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
}

th, td {
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--color-border);
}

th {
  background: var(--color-primary-light);
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-primary-dark);
}

tr:last-child td { border-bottom: none; }
table:not(.heatmap__grid) tr:hover td { background: var(--color-row-hover); }
td { font-size: 0.9rem; color: var(--color-text); }

.row-actions {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  flex-wrap: nowrap;
}

/* ── Pagination ─────────────────────────────────────── */
.pagination {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
  justify-content: center;
}
.pagination a {
  display: inline-flex;
  align-items: center;
  padding: 0.5em 1.1em;
  border-radius: var(--r-pill);
  border: 1.5px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-primary);
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: var(--shadow-xs);
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  text-decoration: none;
}
.pagination a:hover {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
}

/* ── Filters ─────────────────────────────────────────── */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}
.filter-group {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: var(--color-primary-light);
  padding: 0.3rem;
  border-radius: var(--r-pill);
}
.filter-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-text-muted);
  padding: 0 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.filters a {
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.35em 1em;
  border-radius: var(--r-pill);
  transition: background 0.15s, color 0.15s;
}
.filters a:hover { color: var(--color-primary); text-decoration: none; }
.filters a.active {
  background: var(--color-surface);
  color: var(--color-primary);
  box-shadow: var(--shadow-xs);
}

/* ── Definition lists ────────────────────────────────── */
dl {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin: 0 0 1.5rem;
}
dt {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  padding: 0.8rem 1rem 0.1rem;
}
dd {
  margin: 0;
  padding: 0.1rem 1rem 0.8rem;
  font-size: 0.95rem;
  color: var(--color-text);
  border-bottom: 1px solid var(--color-border);
}
dd:last-of-type { border-bottom: none; }

/* ── Post status row ─────────────────────────────────── */
.post-status {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding: 0.875rem 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-xs);
  flex-wrap: wrap;
}

/* ── Reply comment / global reply message lists ──────── */
#reply-comments,
#global-reply-messages {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
#reply-comments li,
#global-reply-messages li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--r-md);
  padding: 0.65rem 1rem;
  font-size: 0.9rem;
  box-shadow: var(--shadow-xs);
}

/* ── Empty state ──────────────────────────────────────── */
.empty-state {
  background: var(--color-muted-bg);
  border: 1px dashed var(--color-border);
  border-radius: var(--r-md);
  padding: 1rem;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  text-align: center;
}

/* ── Responsive tables → cards on mobile ─────────────── */
@media (max-width: 767px) {
  table { background: transparent; box-shadow: none; border: none; border-radius: 0; }
  thead { display: none; }
  tbody { display: block; }
  tr {
    display: block;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--r-lg);
    margin-bottom: 0.875rem;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
  }
  td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    border: none;
    border-bottom: 1px solid var(--color-border);
    padding: 0.65rem 1rem;
    font-size: 0.875rem;
  }
  td:last-child { border-bottom: none; }
  td::before {
    content: attr(data-label);
    font-weight: 700;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    white-space: nowrap;
    flex-shrink: 0;
    padding-top: 0.1em;
  }
  tr:hover td { background: var(--color-row-hover); }
}

/* ── Responsive actions ──────────────────────────────── */
@media (max-width: 540px) {
  .actions { flex-direction: column; align-items: stretch; }
  .actions .btn,
  .actions a.btn,
  .actions input[type="submit"] { text-align: center; width: 100%; }
}

/* ── Responsive stats ────────────────────────────────── */
@media (max-width: 540px) {
  .stats { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0.75rem; }
  .stat { padding: 1rem 0.875rem; }
  .stat__value { font-size: 1.875rem; }
  .stat-card { padding: 1rem 0.875rem; }
  .stat-card__value { font-size: 1.625rem; }
}

/* ── App shell (sidebar + content) ───────────────────── */
.app-shell {
  display: flex;
  align-items: stretch;
  min-height: 100dvh;
  background: var(--color-bg);
}

.app-shell__content {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app-shell__main { flex: 1 1 auto; }
.app-shell__main.container { max-width: none; margin: 0; }

@media (max-width: 900px) {
  .app-shell { flex-direction: column; }
}

/* ── Sidebar ──────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
}

.sidebar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.25rem 1rem;
}

.sidebar__brand { display: inline-flex; align-items: center; }
.sidebar__logo { height: 28px; width: auto; display: block; }

.sidebar__toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--r-sm);
  transition: background 0.15s var(--ease);
}
.sidebar__toggle:hover { background: var(--color-primary-light); }
.sidebar__toggle span { display: block; width: 20px; height: 2px; background: var(--color-text); border-radius: 2px; }

.sidebar__body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding-bottom: 1rem;
}

.sidebar__group { padding: 0.4rem 0.75rem; }
.sidebar__group-title {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-subtle);
  margin: 0.75rem 0.5rem 0.4rem;
}

.sidebar__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.15rem; }

.sidebar__link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6em 0.65em;
  border-radius: var(--r-md);
  color: var(--color-text-muted);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.15s var(--ease), background 0.15s var(--ease);
}
.sidebar__link:hover { background: var(--color-primary-light); color: var(--color-primary); text-decoration: none; }
.sidebar__link--active { background: var(--color-primary-light); color: var(--color-primary); }
.sidebar__link-icon { display: inline-flex; flex-shrink: 0; }
.sidebar__link-label { flex: 1 1 auto; }
.sidebar__link .badge--soon { flex-shrink: 0; }

.sidebar__footer {
  margin-top: auto;
  padding: 1rem 1rem 0.25rem;
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.account-badge {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem;
  border-radius: var(--r-md);
  text-decoration: none;
  transition: background 0.15s var(--ease);
}
.account-badge:hover { background: var(--color-muted-bg); text-decoration: none; }
.account-badge__avatar {
  width: 2.25rem;
  height: 2.25rem;
  flex-shrink: 0;
  border-radius: var(--r-pill);
  background: var(--color-primary-light);
  color: var(--color-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.95rem;
}
.account-badge__info { display: flex; flex-direction: column; min-width: 0; }
.account-badge__name { font-size: 0.85rem; font-weight: 700; color: var(--color-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-badge__status { font-size: 0.75rem; color: var(--color-text-muted); }
.account-badge--empty .account-badge__avatar { background: var(--color-muted-bg); color: var(--color-text-subtle); }

.sidebar__logout {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem;
  border-radius: var(--r-md);
  color: var(--color-text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.sidebar__logout:hover { background: var(--color-destructive-light); color: var(--color-destructive); text-decoration: none; }

@media (max-width: 900px) {
  .sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--color-border); }
  .sidebar__toggle { display: flex; }
  .sidebar__body { display: none; }
  .sidebar__body--open { display: flex; }
}

/* ── Stat card (indicator, real or mock) ─────────────── */
.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--r-lg);
  padding: 1.25rem 1.1rem 1rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
  transition: box-shadow 0.2s var(--ease), transform 0.15s var(--ease);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.stat-card__header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  flex-wrap: wrap;
}

.stat-card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--r-md);
  background: var(--color-primary-light);
  color: var(--color-primary);
  flex-shrink: 0;
}

.stat-card__label { font-size: 0.8rem; color: var(--color-text-muted); font-weight: 600; min-width: 0; overflow-wrap: break-word; }

.stat-card__value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--color-text);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.stat-card__delta { font-size: 0.78rem; font-weight: 700; display: inline-flex; align-items: center; gap: 0.2em; }
.stat-card__delta--up   { color: #047857; }
.stat-card__delta--down { color: var(--color-destructive); }
.stat-card__delta--flat { color: var(--color-text-muted); }

.stat-card__sublabel { font-size: 0.78rem; color: var(--color-text-subtle); }

/* ── Section card (dashboard block, real or mock) ────── */
.section-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem 1.25rem 1.5rem;
}

.section-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.25rem;
}

.section-card__title { font-size: 1rem; font-weight: 700; color: var(--color-text); margin: 0; }
.section-card__subtitle { font-size: 0.8rem; color: var(--color-text-muted); margin: 0.15rem 0 0; }

.section-card__metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1rem;
  margin: 1.1rem 0;
}
.section-card__metric-label { font-size: 0.72rem; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.section-card__metric-value { font-size: 1.35rem; font-weight: 800; color: var(--color-text); }

.section-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--color-border);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-primary);
}

/* ── Badges (status = color + label, never color alone) ─ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  padding: 0.25em 0.75em;
  border-radius: var(--r-pill);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.badge--active   { background: var(--color-success-light); color: #065F46; }
.badge--filters  { background: var(--color-primary-light); color: var(--color-primary-dark); }
.badge--soon     { background: var(--color-warning-light); color: #92400E; }

/* ── Dashboard grid (section cards) ──────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

/* ── Follow-confirmed posts ──────────────────────────── */
.follow-confirmed-posts__list {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
}

.follow-confirmed-posts__list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--color-border);
}

.follow-confirmed-posts__list li:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.follow-confirmed-posts__label {
  min-width: 0;
  overflow: hidden;
  color: var(--color-text);
  font-size: 0.875rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.follow-confirmed-posts__label:hover {
  color: var(--color-primary);
}

.follow-confirmed-posts__count {
  min-width: 2.25rem;
  padding: 0.2em 0.7em;
  border-radius: var(--r-pill);
  background: var(--color-success-light);
  color: #065F46;
  font-size: 0.78rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.follow-confirmed-posts__empty {
  margin: 1rem 0 0;
}

/* ── Mock / "coming soon" areas ──────────────────────── */
.mock {
  position: relative;
  background: repeating-linear-gradient(135deg, var(--color-surface), var(--color-surface) 10px, #FBFAFE 10px, #FBFAFE 20px);
  border: 1px dashed var(--color-border-focus);
}
.mock .stat-card__value,
.mock .section-card__metric-value { color: var(--color-text-muted); }

/* ── Raw JSON inspector ──────────────────────────────── */
.raw-json {
  background: var(--surface, #f6f8fa);
  border: 1px solid var(--border, #d0d7de);
  border-radius: 6px;
  color: var(--text, #24292f);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8125rem;
  line-height: 1.6;
  max-height: 24rem;
  overflow: auto;
  padding: 1rem;
  white-space: pre;
}

/* ── Followers chart (30-day series) ─────────────────── */
.followers-chart-wrap {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--r-lg);
}
.followers-chart-wrap__caption {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  margin: 0 0 0.5rem;
}
.followers-chart {
  width: 100%;
  height: 6rem;
  display: block;
}
.followers-chart__line {
  fill: none;
  stroke: var(--color-primary);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

/* ── Screen-reader only ──────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Turbo frames são inline por padrão. */
.dashboard-panel { display: block; margin-bottom: 1.5rem; }

/* ── Dashboard header ────────────────────────────────── */
.dashboard-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.dashboard-header h1 { margin-bottom: 0.25rem; }
.dashboard-header p { margin: 0; }
.dashboard-header form { flex: none; margin: 0; }

@media (max-width: 520px) {
  .dashboard-header { flex-direction: column; }
}

/* ── Period switch (segmented control) ───────────────── */
.period-switch {
  display: inline-flex;
  flex: none;
  gap: 2px;
  padding: 2px;
  background: var(--color-muted-bg);
  border-radius: var(--r-pill);
}

.period-switch__option {
  padding: 0.2rem 0.62rem;
  border-radius: var(--r-pill);
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.5;
  color: var(--color-text-muted);
}
.period-switch__option:hover { color: var(--color-text); text-decoration: none; }
.period-switch__option--on {
  background: var(--color-surface);
  color: var(--color-primary);
  box-shadow: var(--shadow-xs);
}

/* ── Heatmap (top posts × day) ───────────────────────── */
.heatmap { position: relative; margin-top: 1rem; }
.heatmap__scroll { overflow-x: auto; padding-bottom: 0.25rem; }

.heatmap__grid {
  width: 100%;
  border-collapse: separate;
  /* O vão de 2px na cor da superfície é o que separa as células. Nunca uma
     borda em volta de cada uma — isso somaria tinta que não é dado. */
  border-spacing: 2px;
}

.heatmap__caption {
  caption-side: top;
  padding: 0 2px 0.6rem;
  font-size: 0.74rem;
  line-height: 1.4;
  color: var(--color-text-muted);
  text-align: left;
}

.heatmap__corner,
.heatmap__post {
  position: sticky;
  left: 0;
  z-index: 2;
  max-width: 190px;
  min-width: 150px;
  background: var(--color-surface);
  text-align: left;
}

.heatmap__corner,
.heatmap__total-head {
  padding-bottom: 0.35rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.heatmap__total-head { text-align: center; }

.heatmap__post {
  overflow: hidden;
  padding-right: 0.7rem;
  font-size: 0.78rem;
  font-weight: 500;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--color-text);
}
.heatmap__post a { color: inherit; font-weight: 600; }
.heatmap__post--foot {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.heatmap__day {
  min-width: 28px;
  padding: 0 0 0.35rem;
  border-radius: 3px;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  color: var(--color-text-muted);
}
.heatmap__day-num { display: block; font-size: 0.74rem; color: var(--color-text); }
.heatmap__day--weekend .heatmap__day-num { color: var(--color-text-muted); }
.heatmap__day-month {
  display: block;
  font-size: 0.56rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.heatmap__cell {
  min-width: 28px;
  height: 28px;
  border-radius: 3px;
  background: var(--heat-0);
  font-size: 0.68rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: var(--color-text);
  outline: 2px solid transparent;
  outline-offset: -2px;
  transition: outline-color 120ms var(--ease);
}
.heatmap__cell--l0 { background: var(--heat-0); }
.heatmap__cell--l1 { background: var(--heat-1); }
.heatmap__cell--l2 { background: var(--heat-2); }
.heatmap__cell--l3 { background: var(--heat-3); }
.heatmap__cell--l4 { background: var(--heat-4); color: #FFFFFF; }
.heatmap__cell--l5 { background: var(--heat-5); color: #FFFFFF; }

/* A célula sob o cursor responde com um anel na cor da superfície seguido de
   um fio de tinta — o mesmo mecanismo do vão, nunca uma borda no lugar dele. */
.heatmap__cell:hover {
  box-shadow: 0 0 0 2px var(--color-surface), 0 0 0 3px var(--color-text);
  position: relative;
  z-index: 1;
}
.heatmap__cell.is-hovered-column { outline-color: rgba(111, 68, 236, 0.32); }

.heatmap__day.is-hovered-column,
.heatmap__day-total.is-hovered-column {
  background: var(--color-primary-light);
  color: var(--color-primary);
}
.heatmap__day.is-hovered-column .heatmap__day-num { color: var(--color-primary); }

.heatmap__grid tbody tr:hover .heatmap__post { color: var(--color-primary); }
.heatmap__grid tbody tr:hover .heatmap__total {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.heatmap__day-total {
  min-width: 28px;
  padding-top: 0.3rem;
  border-radius: 3px;
  font-size: 0.62rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: var(--color-text-muted);
}

.heatmap__total {
  min-width: 44px;
  border-radius: 3px;
  background: var(--color-muted-bg);
  font-size: 0.78rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: var(--color-text);
}
.heatmap__total--grand { background: var(--color-primary-light); color: var(--color-primary-dark); }

.heatmap__tooltip {
  position: absolute;
  z-index: 5;
  transform: translate(-50%, -100%);
  padding: 0.4rem 0.6rem;
  border-radius: var(--r-sm);
  background: var(--color-text);
  box-shadow: var(--shadow-md);
  color: #FFFFFF;
  font-size: 0.72rem;
  line-height: 1.35;
  white-space: nowrap;
  pointer-events: none;
}
.heatmap__tooltip--below { transform: translate(-50%, 0); }
.heatmap__tooltip-value { display: block; font-size: 0.84rem; font-weight: 800; }
.heatmap__tooltip-post { display: block; opacity: 0.85; }
.heatmap__tooltip-day { display: block; font-size: 0.66rem; opacity: 0.7; }

.heatmap__scale {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 0.9rem;
  font-size: 0.7rem;
  color: var(--color-text-muted);
}
.heatmap__swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
}
.heatmap__scale-peak { margin-left: auto; padding-left: 0.75rem; }

.heatmap__empty { margin: 1rem 0 0; }

/* ── Reduced motion ──────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
