/* LegalSkills Parceiros: sistema visual compartilhado (parceiro e admin).
   Documentação dos componentes: public/assets/README.md.
   Regras: sem estilo inline (CSP), tokens em :root, claro por padrão, escuro pelo sistema
   ou por data-theme="dark" no <html>. Mobile primeiro: 360 px sem rolagem horizontal. */

/* ───────── Tokens ───────── */
:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #f6f7f6;
  --surface-2: #eceeec;
  --surface-raised: #ffffff;
  --text: #111111;
  --text-2: #454545;
  --text-3: #5c605d;
  --border: #d8d8d8;
  --border-strong: #b9bdba;
  --accent: #08783f;
  --accent-hover: #06612f;
  --accent-text: #08783f;
  --accent-contrast: #ffffff;
  --accent-soft: #e7f4ec;
  --focus: #08783f;

  --ok-fg: #08783f;      --ok-bg: #e7f4ec;
  --warn-fg: #7a4800;    --warn-bg: #fdf1dc;
  --danger-fg: #b3261e;  --danger-bg: #fdecea;
  --info-fg: #1d4f91;    --info-bg: #e8f0fb;
  --neutral-fg: #454545; --neutral-bg: #eeefee;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, .05), 0 4px 16px rgba(0, 0, 0, .04);
  --shadow-2: 0 12px 40px rgba(0, 0, 0, .12);

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --radius-s: 8px;
  --radius: 12px;
  --radius-l: 16px;
  --gutter: 16px;
  --sidebar-w: 248px;
  --topbar-h: 60px;
  --bottomnav-h: 64px;
  --ease: cubic-bezier(.25, .1, .25, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #090b0a;
    --surface: #111412;
    --surface-2: #161a17;
    --surface-raised: #161a17;
    --text: #f5f7f5;
    --text-2: #a5aca7;
    --text-3: #939a95;
    --border: rgba(255, 255, 255, .09);
    --border-strong: rgba(255, 255, 255, .18);
    --accent: #16d979;
    --accent-hover: #00ff88;
    --accent-text: #00ff88;
    --accent-contrast: #06130c;
    --accent-soft: rgba(0, 255, 136, .09);
    --focus: #00ff88;
    --ok-fg: #00ff88;      --ok-bg: rgba(0, 255, 136, .10);
    --warn-fg: #f6c35b;    --warn-bg: rgba(246, 195, 91, .12);
    --danger-fg: #ff8a80;  --danger-bg: rgba(255, 138, 128, .12);
    --info-fg: #93bbff;    --info-bg: rgba(147, 187, 255, .12);
    --neutral-fg: #a5aca7; --neutral-bg: rgba(255, 255, 255, .06);
    --shadow-1: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 8px 32px -8px rgba(0, 0, 0, .6);
    --shadow-2: 0 24px 60px rgba(0, 0, 0, .7);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #090b0a;
  --surface: #111412;
  --surface-2: #161a17;
  --surface-raised: #161a17;
  --text: #f5f7f5;
  --text-2: #a5aca7;
  --text-3: #939a95;
  --border: rgba(255, 255, 255, .09);
  --border-strong: rgba(255, 255, 255, .18);
  --accent: #16d979;
  --accent-hover: #00ff88;
  --accent-text: #00ff88;
  --accent-contrast: #06130c;
  --accent-soft: rgba(0, 255, 136, .09);
  --focus: #00ff88;
  --ok-fg: #00ff88;      --ok-bg: rgba(0, 255, 136, .10);
  --warn-fg: #f6c35b;    --warn-bg: rgba(246, 195, 91, .12);
  --danger-fg: #ff8a80;  --danger-bg: rgba(255, 138, 128, .12);
  --info-fg: #93bbff;    --info-bg: rgba(147, 187, 255, .12);
  --neutral-fg: #a5aca7; --neutral-bg: rgba(255, 255, 255, .06);
  --shadow-1: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 8px 32px -8px rgba(0, 0, 0, .6);
  --shadow-2: 0 24px 60px rgba(0, 0, 0, .7);
}

/* ───────── Base ───────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, video, svg { max-width: 100%; }
img, video { height: auto; display: block; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; font-weight: 650; letter-spacing: -.015em; }
h1 { font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2rem); }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.0625rem; }
p { margin: 0 0 1em; }
a { color: var(--accent-text); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
strong { font-weight: 650; }
hr { border: 0; border-top: 1px solid var(--border); margin: 24px 0; }
code, kbd, .mono { font-family: var(--font-mono); font-size: .92em; }
code { background: var(--surface-2); padding: .1em .35em; border-radius: 4px; overflow-wrap: anywhere; }
ul, ol { padding-left: 1.25rem; margin: 0 0 1em; }
li + li { margin-top: .35em; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
:focus:not(:focus-visible) { outline: none; }
/* Títulos recebem foco programático na troca de rota (leitor de tela); sem contorno visual. */
h1[tabindex="-1"]:focus, h2[tabindex="-1"]:focus, main[tabindex="-1"]:focus { outline: none; }
[hidden] { display: none !important; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 8px; top: -60px; z-index: 100;
  background: var(--accent); color: var(--accent-contrast); padding: 10px 14px; border-radius: var(--radius-s);
  font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 8px; }

.muted { color: var(--text-2); }
p > svg, .small > svg, .inline-icon { width: 1.1em; height: 1.1em; vertical-align: -.2em; display: inline-block; }
.small { font-size: .875rem; }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.break { overflow-wrap: anywhere; word-break: break-word; }
.stack > * + * { margin-top: 16px; }
.stack-s > * + * { margin-top: 8px; }
.stack-l > * + * { margin-top: 28px; }
.row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.row-between { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; }
.eyebrow {
  font-size: .75rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); margin: 0 0 6px;
}

/* ───────── Wordmark ───────── */
.wordmark {
  display: inline-flex; align-items: baseline; gap: 6px; text-decoration: none; color: var(--text);
  font-weight: 700; letter-spacing: -.02em; font-size: 1.0625rem; white-space: nowrap;
}
.wordmark__brand { color: var(--text); }
.wordmark__sub { color: var(--accent-text); font-weight: 600; }
.wordmark--lg { font-size: 1.375rem; }

/* ───────── Botões ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border-radius: 10px;
  font: inherit; font-size: .9375rem; font-weight: 600; line-height: 1.2;
  border: 1px solid transparent; cursor: pointer; text-decoration: none; text-align: center;
  transition: background-color .15s var(--ease), border-color .15s var(--ease), box-shadow .15s var(--ease), transform .1s var(--ease);
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn--primary { background: var(--accent); color: var(--accent-contrast); }
.btn--primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn--secondary { background: var(--surface-raised); color: var(--text); border-color: var(--border-strong); }
.btn--secondary:hover:not(:disabled) { border-color: var(--accent); }
.btn--ghost { background: transparent; color: var(--text); }
.btn--ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn--danger { background: var(--danger-bg); color: var(--danger-fg); border-color: transparent; }
.btn--block { width: 100%; }
.btn--sm { min-height: 44px; padding: 8px 12px; font-size: .875rem; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px;
  border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--text); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 20px; height: 20px; }

/* ───────── Cartões e grade ───────── */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-l);
  padding: 20px; min-width: 0;
}
.card--raised { background: var(--surface-raised); box-shadow: var(--shadow-1); }
.card--accent { border-color: var(--accent); }
.card__head { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; }
.card__title { font-size: 1.0625rem; font-weight: 650; margin: 0; overflow-wrap: anywhere; }
.card__meta { color: var(--text-2); font-size: .875rem; margin: 2px 0 0; }
.card__foot { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .grid--2, .grid--3, .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) {
  .grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Lista de definição compacta (chave: valor) */
.kv { display: grid; grid-template-columns: minmax(0, auto) minmax(0, 1fr); gap: 6px 16px; margin: 0; font-size: .9375rem; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.kv--left dd { text-align: left; }

/* ───────── Indicadores (stat) ───────── */
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-l); padding: 16px 18px; min-width: 0; }
.stat__label { display: flex; align-items: center; gap: 8px; font-size: .8125rem; color: var(--text-2); font-weight: 550; margin: 0 0 6px; }
.stat__value { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: clamp(1.25rem, 1.05rem + .8vw, 1.625rem); font-weight: 500; letter-spacing: -.02em; margin: 0; overflow-wrap: anywhere; }
.stat__hint { font-size: .8125rem; color: var(--text-2); margin: 4px 0 0; }

/* ───────── Selos de estado ───────── */
.badge {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  padding: 3px 10px; border-radius: 999px; font-size: .8125rem; font-weight: 600; line-height: 1.35;
  background: var(--neutral-bg); color: var(--neutral-fg); white-space: nowrap;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.badge--plain::before { display: none; }
.badge--ok { background: var(--ok-bg); color: var(--ok-fg); }
.badge--warn { background: var(--warn-bg); color: var(--warn-fg); }
.badge--danger { background: var(--danger-bg); color: var(--danger-fg); }
.badge--info { background: var(--info-bg); color: var(--info-fg); }
.badge--neutral { background: var(--neutral-bg); color: var(--neutral-fg); }
.badge--outline { background: transparent; border: 1px solid var(--border-strong); color: var(--text-2); }

/* ───────── Alertas ───────── */
.alert {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius);
  background: var(--info-bg); color: var(--text); border: 1px solid transparent;
}
.alert > svg { width: 20px; height: 20px; flex: none; margin-top: 2px; color: var(--info-fg); }
.alert__body { min-width: 0; }
.alert__body > :last-child { margin-bottom: 0; }
.alert__title { font-weight: 650; margin: 0 0 4px; }
.alert--ok { background: var(--ok-bg); }
.alert--ok > svg { color: var(--ok-fg); }
.alert--warn { background: var(--warn-bg); }
.alert--warn > svg { color: var(--warn-fg); }
.alert--danger { background: var(--danger-bg); }
.alert--danger > svg { color: var(--danger-fg); }
.alert--neutral { background: var(--surface-2); }
.alert--neutral > svg { color: var(--text-2); }

/* ───────── Formulários ───────── */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: .875rem; font-weight: 600; color: var(--text); }
.hint { font-size: .8125rem; color: var(--text-2); margin: 0; }
.field-error { font-size: .8125rem; color: var(--danger-fg); margin: 0; font-weight: 550; }
.input, .select, .textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--border-strong); background: var(--bg); color: var(--text);
  font: inherit; font-size: 1rem;
}
.textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-right: 36px; background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; border-color: var(--accent); }
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger-fg); }
.check { display: flex; gap: 10px; align-items: flex-start; min-height: 44px; padding: 10px 0; cursor: pointer; font-size: .9375rem; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.form-row { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .form-row--inline { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); align-items: end; } }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips .badge { white-space: normal; overflow-wrap: anywhere; }
.chip {
  min-height: 44px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border-strong);
  background: transparent; color: var(--text); font: inherit; font-size: .875rem; font-weight: 550; cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }

/* ───────── Tabela que vira cartões no celular ───────── */
.table-wrap { width: 100%; }
.data-table { width: 100%; border-collapse: collapse; font-size: .9375rem; }
.data-table th {
  text-align: left; font-size: .75rem; letter-spacing: .05em; text-transform: uppercase; color: var(--text-2);
  font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.data-table td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.data-table td.is-num, .data-table th.is-num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.data-table tbody tr:hover { background: var(--surface); }
@media (max-width: 859px) {
  .data-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table tr {
    border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
    padding: 6px 14px; margin-bottom: 12px;
  }
  .data-table tbody tr:hover { background: var(--surface); }
  .data-table td {
    display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--border);
    text-align: right;
  }
  .data-table td:last-child { border-bottom: 0; }
  .data-table td::before {
    content: attr(data-label); color: var(--text-2); font-size: .8125rem; font-weight: 550; text-align: left;
    font-family: var(--font-sans); flex: none; max-width: 50%;
  }
  .data-table td > * { min-width: 0; }
}
@media (min-width: 860px) {
  /* Rolagem horizontal só como último recurso, e visível: sombras nas bordas indicam que há
     colunas escondidas (a sombra some quando se chega ao fim) e a barra fica sempre à mostra. */
  .table-wrap {
    overflow-x: auto; scrollbar-width: auto; scrollbar-gutter: stable;
    background:
      linear-gradient(to right, var(--table-cover, var(--bg)), var(--table-cover, var(--bg))) left / 24px 100% no-repeat local,
      linear-gradient(to left, var(--table-cover, var(--bg)), var(--table-cover, var(--bg))) right / 24px 100% no-repeat local,
      radial-gradient(farthest-side at 0 50%, rgba(0, 0, 0, .22), transparent) left / 12px 100% no-repeat scroll,
      radial-gradient(farthest-side at 100% 50%, rgba(0, 0, 0, .22), transparent) right / 12px 100% no-repeat scroll;
  }
  .card .table-wrap { --table-cover: var(--surface); }
  /* Cabeçalho e selos quebram linha em vez de alargar a coluna (tabelas de 10 a 12 colunas). */
  .data-table th { white-space: normal; padding: 10px 8px; vertical-align: bottom; }
  .data-table td { padding: 10px 8px; }
  .data-table td .badge { white-space: normal; text-align: left; }
  /* Em tabela, "anywhere" reduz a largura mínima da coluna a 1 caractere e quebra nomes no meio
     ("Contado/res"). Aqui só quebra palavra que não cabe; a área rola na horizontal se precisar. */
  .data-table td .break { overflow-wrap: break-word; word-break: normal; }
}
@media (min-width: 860px) and (max-width: 1279px) {
  .data-table { font-size: .875rem; }
}

/* ───────── Linha do tempo ───────── */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 20px 34px; margin: 0; }
.timeline li::before {
  content: ""; position: absolute; left: 8px; top: 20px; bottom: -2px; width: 2px; background: var(--border);
}
.timeline li:last-child { padding-bottom: 0; }
.timeline li:last-child::before { display: none; }
.timeline__dot {
  position: absolute; left: 0; top: 2px; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--border-strong); background: var(--bg);
}
.timeline__title { font-weight: 600; margin: 0; }
.timeline__meta { font-size: .8125rem; color: var(--text-2); margin: 2px 0 0; }
.timeline li.is-done .timeline__dot { background: var(--accent); border-color: var(--accent); }
.timeline li.is-done::before { background: var(--accent); }
.timeline li.is-current .timeline__dot { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.timeline li.is-current .timeline__title { color: var(--accent-text); }
.timeline li.is-todo .timeline__title { color: var(--text-2); font-weight: 550; }
.timeline li.is-cancel .timeline__dot { background: var(--danger-fg); border-color: var(--danger-fg); }

/* ───────── Checklist ───────── */
.checklist { list-style: none; padding: 0; margin: 0; border: 1px solid var(--border); border-radius: var(--radius-l); background: var(--surface); }
.checklist li { margin: 0; border-bottom: 1px solid var(--border); }
.checklist li:last-child { border-bottom: 0; }
.checklist__item { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; color: inherit; text-decoration: none; min-height: 44px; }
a.checklist__item:hover { background: var(--surface-2); }
.checklist__icon { width: 24px; height: 24px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--neutral-bg); color: var(--neutral-fg); }
.checklist__icon svg { width: 14px; height: 14px; }
.checklist__icon.is-ok { background: var(--accent); color: var(--accent-contrast); }
.checklist__icon.is-warn { background: var(--warn-bg); color: var(--warn-fg); }
.checklist__main { flex: 1; min-width: 0; }
.checklist__title { font-weight: 600; margin: 0; }
.checklist__desc { font-size: .875rem; color: var(--text-2); margin: 2px 0 0; }
.checklist__side { flex: none; display: flex; align-items: center; gap: 6px; color: var(--text-2); }
.checklist__side svg { width: 18px; height: 18px; }
@media (max-width: 520px) {
  .checklist__item { flex-wrap: wrap; }
  .checklist__side { width: 100%; padding-left: 36px; }
}

/* ───────── Estados vazios e carregamento ───────── */
.empty {
  text-align: center; padding: 36px 20px; border: 1px dashed var(--border-strong); border-radius: var(--radius-l);
  background: transparent;
}
.empty > svg { width: 32px; height: 32px; color: var(--text-2); margin: 0 auto 10px; }
.empty__title { font-weight: 650; font-size: 1.0625rem; margin: 0 0 6px; }
.empty__text { color: var(--text-2); max-width: 52ch; margin: 0 auto 12px; }
.empty__text:last-child { margin-bottom: 0; }

.skeleton { display: grid; gap: 12px; }
.skeleton__line, .skeleton__block {
  border-radius: 8px; background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface) 50%, var(--surface-2) 75%);
  background-size: 200% 100%; animation: shimmer 1.4s linear infinite;
}
.skeleton__line { height: 14px; }
.skeleton__line--title { height: 26px; width: 40%; }
.skeleton__line--short { width: 60%; }
.skeleton__block { height: 96px; border-radius: var(--radius-l); }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ───────── Legenda de estados ───────── */
.legend { display: grid; gap: 10px; margin: 0; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 720px) { .legend { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .legend { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.legend__item { display: flex; flex-direction: column; gap: 4px; }
.legend__item dt { margin: 0; }
.legend__item dd { margin: 0; font-size: .875rem; color: var(--text-2); }

/* ───────── Texto longo (markdown) ───────── */
.prose { max-width: 72ch; }
.prose h1 { font-size: 1.375rem; }
.prose h2 { font-size: 1.125rem; margin-top: 1.6em; }
.prose h3 { font-size: 1rem; margin-top: 1.4em; }
.prose p, .prose li { color: var(--text); }
.prose > :first-child { margin-top: 0; }

.copy-block {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px;
  white-space: pre-wrap; overflow-wrap: anywhere; font-size: .9375rem; margin: 0;
}
.url-box {
  display: block; font-family: var(--font-mono); font-size: .8125rem; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-s); padding: 10px 12px; overflow-wrap: anywhere; word-break: break-all; color: var(--text);
}

.media-preview { border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-2); overflow: hidden; }
.media-preview img, .media-preview video { width: 100%; max-height: 320px; object-fit: contain; }

/* ───────── Página de autenticação (/, /convite) ───────── */
.auth {
  min-height: 100vh; display: grid; grid-template-rows: auto 1fr auto; padding: 0 var(--gutter);
}
.auth__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; max-width: 1080px; width: 100%; margin: 0 auto; }
.auth__main { display: grid; place-items: center; padding: 24px 0 48px; }
.auth__card { width: 100%; max-width: 440px; }
.auth__card h1 { margin-bottom: 10px; }
.auth__lead { color: var(--text-2); margin-bottom: 24px; }
.auth__foot { text-align: center; font-size: .8125rem; color: var(--text-2); padding: 16px 0 24px; }
.auth__panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-l); padding: 24px; }
@media (max-width: 400px) { .auth__panel { padding: 18px; } }
.details { border-top: 1px solid var(--border); padding-top: 8px; margin-top: 20px; }
.details summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 600; font-size: .9375rem; list-style: none; }
.details summary::-webkit-details-marker { display: none; }
.details summary::after { content: "+"; margin-left: auto; font-family: var(--font-mono); color: var(--text-2); }
.details[open] summary::after { content: "−"; }
.details p { color: var(--text-2); font-size: .9375rem; }

/* ───────── Estrutura do app autenticado ───────── */
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--topbar-h);
  display: flex; align-items: center; gap: 8px; padding: 0 8px 0 var(--gutter);
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar__who { margin-left: auto; min-width: 0; text-align: right; font-size: .8125rem; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar__actions { display: flex; align-items: center; gap: 2px; flex: none; }
@media (max-width: 420px) { .topbar__who { display: none; } .topbar__actions { margin-left: auto; } }

.layout { display: block; }
.sidenav { display: none; }
.main {
  min-width: 0; padding: 20px var(--gutter) calc(var(--bottomnav-h) + 32px + env(safe-area-inset-bottom));
  max-width: 1120px; margin: 0 auto;
}
.main:focus { outline: none; }
.page-head { margin-bottom: 20px; }
.page-head h1 { margin-bottom: 6px; }
.page-head p { color: var(--text-2); margin: 0; max-width: 70ch; }
.section { margin-top: 32px; }
.section > h2 { margin-bottom: 12px; }

.navlist { list-style: none; margin: 0; padding: 0; }
.navlist li { margin: 0; }
.navlink {
  display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 8px 12px; border-radius: 10px;
  color: var(--text-2); text-decoration: none; font-weight: 550; font-size: .9375rem;
}
.navlink svg { width: 20px; height: 20px; flex: none; }
.navlink:hover { background: var(--surface-2); color: var(--text); }
.navlink[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); }
.navlink.is-locked { opacity: .6; }

.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: var(--bg); border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottomnav ul { list-style: none; margin: 0; padding: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.bottomnav li { margin: 0; }
.bottomnav a, .bottomnav button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  width: 100%; min-height: var(--bottomnav-h); padding: 6px 2px; border: 0; background: none; cursor: pointer;
  color: var(--text-2); font: inherit; font-size: .6875rem; font-weight: 600; text-decoration: none; text-align: center; line-height: 1.15;
}
.bottomnav svg { width: 22px; height: 22px; }
.bottomnav [aria-current="page"], .bottomnav button[aria-expanded="true"] { color: var(--accent-text); }

@media (min-width: 960px) {
  .layout { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .sidenav {
    display: block; position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); overflow-y: auto;
    padding: 16px 12px;
  }
  .sidenav__label { padding: 12px 12px 6px; font-size: .6875rem; font-weight: 650; text-transform: uppercase; letter-spacing: .07em; color: var(--text-3); }
  .bottomnav { display: none; }
  .main { padding: 32px 40px 64px; margin: 0; border-left: 1px solid var(--border); min-height: calc(100vh - var(--topbar-h)); }
}

/* Painel "Mais" (dialog) */
.sheet {
  border: 1px solid var(--border); border-radius: var(--radius-l) var(--radius-l) 0 0; padding: 0;
  background: var(--surface-raised); color: var(--text); width: 100%; max-width: 560px;
  margin: auto auto 0; box-shadow: var(--shadow-2);
}
.sheet::backdrop { background: rgba(0, 0, 0, .45); }
.sheet__head { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 8px 20px; border-bottom: 1px solid var(--border); }
.sheet__head h2 { margin: 0; font-size: 1rem; }
.sheet__body { padding: 8px 12px calc(16px + env(safe-area-inset-bottom)); max-height: 70vh; overflow-y: auto; }

/* Mensagens temporárias */
.toast-region { position: fixed; z-index: 60; left: 50%; transform: translateX(-50%); bottom: calc(var(--bottomnav-h) + 16px + env(safe-area-inset-bottom)); display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
@media (min-width: 960px) { .toast-region { bottom: 24px; } }
.toast { background: var(--text); color: var(--bg); padding: 12px 16px; border-radius: 10px; font-size: .9375rem; font-weight: 550; box-shadow: var(--shadow-2); animation: toast-in .2s var(--ease); }
.toast--error { background: #b3261e; color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.fade-in { animation: fade-in .35s var(--ease) both; }
@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Página de erro */
.center-page { min-height: 100vh; display: grid; place-items: center; padding: 24px var(--gutter); text-align: center; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .skeleton__line, .skeleton__block { animation: none; }
}

@media print {
  .topbar, .sidenav, .bottomnav, .toast-region, .skip-link { display: none !important; }
  .main { padding: 0; }
}
