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

/* ─────────────────────────────────────────────────────────────────────────
   SISTEMA
   Cor é por tema (cada bloco [data-theme] redefine o conjunto abaixo).
   Espaçamento, tipo, raio, elevação e movimento são globais — não mudam
   com o tema, então vivem só aqui.
   ───────────────────────────────────────────────────────────────────── */
:root {
  /* Tipografia. IBM Plex Sans e Mono compartilham esqueleto: num app onde
     quase toda linha mistura prosa e dado (R$ 122,15, 01/09/2026, jt-personal)
     as duas se alinham em vez de brigar. */
  --font-ui: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, monospace;
  --fs-xs: 11px;
  --fs-sm: 12px;
  --fs-base: 13px;
  --fs-md: 14px;
  --fs-lg: 16px;
  --fs-xl: 20px;
  --fs-2xl: 28px;
  --lh-tight: 1.25;
  --lh: 1.55;

  /* Espaçamento — degraus de 4px. Todo valor solto do arquivo vem para cá. */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 32px;
  --sp-8: 48px;

  /* Raio */
  --r-sm: 4px;
  --r-md: 8px;
  --r-card: 10px;
  --r-pill: 999px;
  --radius: var(--r-md); /* nome legado, ainda usado em várias regras */

  /* Movimento */
  --dur-fast: 120ms;
  --dur: 180ms;
  --ease: cubic-bezier(.2, .6, .3, 1);

  /* Chassi */
  --rail-w: 56px;
  --rail-w-open: 208px;

  /* ── Cor (o tema padrão: dark) ── */
  --bg: #0c1014;
  --surface: #161b22;
  --surface2: #21262d;
  --border: #30363d;
  --text: #c9d1d9;
  --muted: #8b949e;
  --accent: #58a6ff;
  --green: #3fb950;
  --yellow: #d29922;
  --red: #f85149;
  --purple: #bc8cff;
  --marcio-color: #58a6ff;
  --bruno-color: #3fb950;
  --radius: 8px;
  --shadow: 0 4px 16px rgba(0,0,0,.4);
  --theme-dot: #58a6ff;
}

/* Derivados: valem para os 15 temas porque saem das cores do tema ativo.
   Antes eram ~40 rgba() fixas da paleta escura, que lavavam de cinza os
   7 temas claros. */
:root,
[data-theme] {
  --tint-accent: color-mix(in srgb, var(--accent) 13%, transparent);
  --tint-green: color-mix(in srgb, var(--green) 13%, transparent);
  --tint-yellow: color-mix(in srgb, var(--yellow) 14%, transparent);
  --tint-red: color-mix(in srgb, var(--red) 12%, transparent);
  --tint-purple: color-mix(in srgb, var(--purple) 13%, transparent);
  --tint-marcio: color-mix(in srgb, var(--marcio-color) 14%, transparent);
  --tint-bruno: color-mix(in srgb, var(--bruno-color) 14%, transparent);
  --shadow-card: var(--shadow);
  --shadow-overlay: 0 24px 48px color-mix(in srgb, #000 45%, transparent);
  /* Anel de foco: dois anéis para destacar em cima de qualquer fundo. */
  --ring: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
}

/* ─── THEMES ──────────────────────────────────────── */
[data-theme="dracula"] {
  --bg: #282a36;
  --surface: #21222c;
  --surface2: #44475a;
  --border: #44475a;
  --text: #f8f8f2;
  --muted: #6272a4;
  --accent: #bd93f9;
  --green: #50fa7b;
  --yellow: #f1fa8c;
  --red: #ff5555;
  --purple: #bd93f9;
  --marcio-color: #8be9fd;
  --bruno-color: #50fa7b;
  --shadow: 0 4px 20px rgba(0,0,0,.6);
  --theme-dot: #bd93f9;
}

[data-theme="sepia"] {
  --bg: #f5ede0;
  --surface: #ede1cc;
  --surface2: #e0d0b8;
  --border: #c8b89a;
  --text: #3a2a1a;
  --muted: #7d6650;
  --accent: #8b5e3c;
  --green: #5a7a38;
  --yellow: #b8780a;
  --red: #a83228;
  --purple: #7b5c8a;
  --marcio-color: #8b5e3c;
  --bruno-color: #5a7a38;
  --shadow: 0 4px 16px rgba(0,0,0,.12);
  --theme-dot: #8b5e3c;
}

[data-theme="forest"] {
  --bg: #0d1a10;
  --surface: #132116;
  --surface2: #1d2f20;
  --border: #2a3f2d;
  --text: #c2d8c0;
  --muted: #6e9472;
  --accent: #54c468;
  --green: #4ed472;
  --yellow: #c8a84a;
  --red: #e05858;
  --purple: #a07bc8;
  --marcio-color: #6fb8e8;
  --bruno-color: #4ed472;
  --shadow: 0 4px 16px rgba(0,0,0,.5);
  --theme-dot: #54c468;
}

[data-theme="light"] {
  --bg: #ffffff;
  --surface: #f6f8fa;
  --surface2: #eaeef2;
  --border: #d0d7de;
  --text: #1f2328;
  --muted: #656d76;
  --accent: #0969da;
  --green: #1a7f37;
  --yellow: #9a6700;
  --red: #d1242f;
  --purple: #8250df;
  --marcio-color: #0969da;
  --bruno-color: #1a7f37;
  --shadow: 0 2px 8px rgba(0,0,0,.1);
  --theme-dot: #0969da;
}

[data-theme="paper"] {
  --bg: #faf7f0;
  --surface: #f0ece0;
  --surface2: #e6e0d0;
  --border: #c8c0a8;
  --text: #2a2420;
  --muted: #6a6050;
  --accent: #c44b1a;
  --green: #2d6e3a;
  --yellow: #9a6200;
  --red: #c0281c;
  --purple: #6b3a8a;
  --marcio-color: #c44b1a;
  --bruno-color: #2d6e3a;
  --shadow: 0 2px 8px rgba(0,0,0,.1);
  --theme-dot: #c44b1a;
}

[data-theme="nord"] {
  --bg: #2e3440;
  --surface: #3b4252;
  --surface2: #434c5e;
  --border: #4c566a;
  --text: #d8dee9;
  --muted: #93a3bc;
  --accent: #88c0d0;
  --green: #a3be8c;
  --yellow: #ebcb8b;
  --red: #bf616a;
  --purple: #b48ead;
  --marcio-color: #88c0d0;
  --bruno-color: #a3be8c;
  --shadow: 0 4px 16px rgba(0,0,0,.35);
  --theme-dot: #88c0d0;
}

[data-theme="solarized"] {
  --bg: #fdf6e3;
  --surface: #eee8d5;
  --surface2: #e4dcc3;
  --border: #d0c8ac;
  --text: #073642;
  --muted: #657b83;
  --accent: #268bd2;
  --green: #859900;
  --yellow: #b58900;
  --red: #dc322f;
  --purple: #6c71c4;
  --marcio-color: #268bd2;
  --bruno-color: #859900;
  --shadow: 0 2px 8px rgba(0,0,0,.12);
  --theme-dot: #268bd2;
}

[data-theme="rosepine"] {
  --bg: #191724;
  --surface: #1f1d2e;
  --surface2: #26233a;
  --border: #403d52;
  --text: #e0def4;
  --muted: #908caa;
  --accent: #c4a7e7;
  --green: #9ccfd8;
  --yellow: #f6c177;
  --red: #eb6f92;
  --purple: #c4a7e7;
  --marcio-color: #c4a7e7;
  --bruno-color: #9ccfd8;
  --shadow: 0 4px 20px rgba(0,0,0,.5);
  --theme-dot: #c4a7e7;
}

[data-theme="ocean"] {
  --bg: #0b1e2d;
  --surface: #102a3c;
  --surface2: #16374d;
  --border: #234b63;
  --text: #cde3f2;
  --muted: #7fa3bb;
  --accent: #38bdf8;
  --green: #34d399;
  --yellow: #fbbf24;
  --red: #f87171;
  --purple: #a78bfa;
  --marcio-color: #38bdf8;
  --bruno-color: #34d399;
  --shadow: 0 4px 16px rgba(0,0,0,.5);
  --theme-dot: #38bdf8;
}

[data-theme="synthwave"] {
  --bg: #1a1030;
  --surface: #241640;
  --surface2: #2f1d52;
  --border: #45306e;
  --text: #f0e6ff;
  --muted: #9d8ec7;
  --accent: #ff2ec4;
  --green: #3ff5b5;
  --yellow: #ffd857;
  --red: #ff5e5e;
  --purple: #b98eff;
  --marcio-color: #ff2ec4;
  --bruno-color: #3ff5b5;
  --shadow: 0 4px 24px rgba(255,46,196,.12);
  --theme-dot: #ff2ec4;
}

[data-theme="coffee"] {
  --bg: #1f1712;
  --surface: #2a1f18;
  --surface2: #362a20;
  --border: #4a3a2c;
  --text: #e8dcc8;
  --muted: #a08c72;
  --accent: #d49a6a;
  --green: #8faf5f;
  --yellow: #d9a441;
  --red: #d96a5a;
  --purple: #b08cc4;
  --marcio-color: #d49a6a;
  --bruno-color: #8faf5f;
  --shadow: 0 4px 16px rgba(0,0,0,.45);
  --theme-dot: #d49a6a;
}

/* Paleta oficial Catppuccin Latte (base/mantle/crust + mauve) */
[data-theme="latte"] {
  --bg: #eff1f5;
  --surface: #e6e9ef;
  --surface2: #dce0e8;
  --border: #bcc0cc;
  --text: #4c4f69;
  --muted: #8c8fa1;
  --accent: #1e66f5;
  --green: #40a02b;
  --yellow: #df8e1d;
  --red: #d20f39;
  --purple: #8839ef;
  --marcio-color: #1e66f5;
  --bruno-color: #40a02b;
  --shadow: 0 2px 8px rgba(76,79,105,.14);
  --theme-dot: #8839ef;
}

/* Paleta oficial Rosé Pine Dawn (base/surface/overlay + rose/pine/gold/love/iris) */
[data-theme="dawn"] {
  --bg: #faf4ed;
  --surface: #fffaf3;
  --surface2: #f2e9e1;
  --border: #dfdad9;
  --text: #575279;
  --muted: #797593;
  --accent: #d7827e;
  --green: #286983;
  --yellow: #ea9d34;
  --red: #b4637a;
  --purple: #907aa9;
  --marcio-color: #d7827e;
  --bruno-color: #286983;
  --shadow: 0 2px 8px rgba(87,82,121,.12);
  --theme-dot: #d7827e;
}

/* Paleta oficial Ayu Light (laranja de assinatura) */
[data-theme="ayulight"] {
  --bg: #fcfcfc;
  --surface: #f3f4f5;
  --surface2: #e7e8ec;
  --border: #d8dbdf;
  --text: #5c6166;
  --muted: #8a9199;
  --accent: #ff9940;
  --green: #86b300;
  --yellow: #f2ae49;
  --red: #f07171;
  --purple: #a37acc;
  --marcio-color: #399ee6;
  --bruno-color: #86b300;
  --shadow: 0 2px 8px rgba(0,0,0,.08);
  --theme-dot: #ff9940;
}

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}

/* ─── AUTH SCREEN ─────────────────────────────── */
#auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
}

.auth-logo {
  font-size: 11px;
  letter-spacing: .1em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.auth-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 32px;
  color: var(--text);
}

.auth-error {
  background: color-mix(in srgb, var(--red) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--red) 30%, transparent);
  border-radius: var(--radius);
  color: var(--red);
  font-size: 13px;
  padding: 10px 14px;
  margin-bottom: 16px;
  display: none;
}

.btn-primary {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  padding: 11px;
  cursor: pointer;
  transition: opacity .15s;
}
.btn-primary:hover { opacity: .85; }
.btn-primary:disabled { opacity: .4; cursor: not-allowed; }

/* ─── MAIN APP ────────────────────────────────── */
#app { display: none; }

/* ─── easter egg: segurar o avatar do outro = fist bump ──────────────────
   Só dá para acionar quando o outro está online (o pill nem existe fora
   disso) — bater punho sozinho não faz sentido. */
.crew-person.can-bump { cursor: pointer; user-select: none; -webkit-user-select: none; }

.crew-person.charging {
  animation: fb-charge 620ms ease-in forwards;
}

@keyframes fb-charge {
  0%   { transform: scale(1);    box-shadow: 0 0 0 0 transparent; }
  60%  { transform: scale(1.08); box-shadow: 0 0 14px 3px color-mix(in srgb, var(--accent) 45%, transparent); }
  100% { transform: scale(1.14); box-shadow: 0 0 22px 6px color-mix(in srgb, var(--accent) 70%, transparent); }
}

.fb-stage {
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  overflow: hidden;
}

.fb-fist {
  position: absolute;
  top: 50%;
  left: 50%;
  font-size: clamp(3rem, 13vw, 7rem);
  line-height: 1;
  filter: drop-shadow(0 6px 14px rgba(0,0,0,.5));
}

.fb-fist.left  { animation: fb-in-left  900ms cubic-bezier(.22,.9,.3,1) forwards; }
.fb-fist.right { animation: fb-in-right 900ms cubic-bezier(.22,.9,.3,1) forwards; }

/* entram voando, encostam no centro e recuam de leve no impacto */
@keyframes fb-in-left {
  0%   { transform: translate(-60vw, -50%) rotate(-12deg); opacity: 0; }
  15%  { opacity: 1; }
  55%  { transform: translate(calc(-100% - 2px), -50%) rotate(0deg); }
  66%  { transform: translate(calc(-100% - 26px), -50%) rotate(-6deg); }
  100% { transform: translate(calc(-100% - 14px), -50%) rotate(0deg); opacity: 0; }
}

@keyframes fb-in-right {
  0%   { transform: translate(60vw, -50%) rotate(12deg); opacity: 0; }
  15%  { opacity: 1; }
  55%  { transform: translate(2px, -50%) rotate(0deg); }
  66%  { transform: translate(26px, -50%) rotate(6deg); }
  100% { transform: translate(14px, -50%) rotate(0deg); opacity: 0; }
}

/* clarão elétrico no ponto do encontro */
.fb-flash {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0%, #9fd0ff 35%, transparent 70%);
  opacity: 0;
  animation: fb-flash 520ms ease-out forwards;
}

@keyframes fb-flash {
  0%   { opacity: 0; transform: scale(.4); }
  12%  { opacity: 1; transform: scale(4); }
  40%  { opacity: .8; transform: scale(9); }
  100% { opacity: 0; transform: scale(15); }
}

/* faíscas: cada uma é girada por --a e arremessada por --d */
.fb-spark {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3px;
  height: 22px;
  margin: -11px 0 0 -1.5px;
  border-radius: 2px;
  background: linear-gradient(to bottom, #fff, #58a6ff 45%, color-mix(in srgb, var(--yellow) 90%, transparent));
  transform: rotate(var(--a)) translateY(0) scaleY(.4);
  opacity: 0;
  animation: fb-spark 620ms cubic-bezier(.15,.8,.3,1) forwards;
}

@keyframes fb-spark {
  0%   { opacity: 0; transform: rotate(var(--a)) translateY(0) scaleY(.3); }
  15%  { opacity: 1; }
  100% { opacity: 0; transform: rotate(var(--a)) translateY(calc(var(--d) * -1)) scaleY(1.5); }
}

.fb-bolt {
  position: absolute;
  top: 50%;
  left: 50%;
  font-size: 1.8rem;
  opacity: 0;
  animation: fb-bolt 700ms ease-out forwards;
}

@keyframes fb-bolt {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(.3) rotate(var(--a)); }
  20%  { opacity: 1; transform: translate(-50%, -50%) scale(1.15) rotate(var(--a)); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) scale(.7) rotate(var(--a)); }
}

/* o chacoalhão do impacto */
.fb-shake { animation: fb-shake 380ms cubic-bezier(.36,.07,.19,.97); }

@keyframes fb-shake {
  0%, 100% { transform: translate(0, 0); }
  20%      { transform: translate(-6px, 3px); }
  40%      { transform: translate(5px, -4px); }
  60%      { transform: translate(-4px, -2px); }
  80%      { transform: translate(3px, 3px); }
}

@media (prefers-reduced-motion: reduce) {
  .fb-fist, .fb-flash, .fb-spark, .fb-bolt { animation-duration: 1ms; }
  .fb-shake { animation: none; }
}

@keyframes heartbeat {
  0%   { transform: scale(1); }
  14%  { transform: scale(1.25); }
  28%  { transform: scale(1); }
  42%  { transform: scale(1.18); }
  70%  { transform: scale(1); }
  100% { transform: scale(1); }
}

.user-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}

/* ─────────────────────────────────────────────────────────────────────────
   CHASSI — rail lateral + coluna de conteúdo
   Substitui o header de 56px + a barra de abas. Com a navegação na vertical
   as onze abas param de disputar uma fila só, e os iframes de página cheia
   deixam de depender do calc(100vh - 105px) mágico.
   ───────────────────────────────────────────────────────────────────── */
.shell { display: flex; align-items: flex-start; min-height: 100vh; }

/* Fixa e sobreposta: se a rail empurrasse o conteúdo, a tabela inteira
   refluiria a cada passada do mouse. Ela cobre, e a coluna não se mexe. */
.rail {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 20;
  width: var(--rail-w);
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-2);
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow: hidden;
  transition: width var(--dur) var(--ease);
}
/* focus-within é o que faz a rail abrir no teclado, não só no mouse. */
.rail:hover,
.rail:focus-within { width: var(--rail-w-open); box-shadow: var(--shadow-overlay); }

/* Marca */
.rail-brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-1) var(--sp-2);
  margin-bottom: var(--sp-2);
}
.rail-mark {
  flex: 0 0 auto;
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  background: var(--accent);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: -.02em;
}
.rail-brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.rail-brand-text strong { font-size: var(--fs-sm); font-weight: 600; color: var(--text); }
.rail-brand-text small { font-size: var(--fs-xs); color: var(--muted); }

/* Navegação */
.rail-nav { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; min-height: 0; overflow-y: auto; }

.rail-item,
.rail-action {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  padding: var(--sp-2);
  border: none;
  border-radius: var(--r-md);
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: var(--fs-base);
  font-weight: 500;
  text-align: left;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.rail-item:hover,
.rail-action:hover { background: var(--surface2); color: var(--text); }
.rail-item.active { background: var(--tint-accent); color: var(--text); font-weight: 600; }

.rail-icon,
.rail-action-icon {
  flex: 0 0 auto;
  width: 24px;
  font-size: var(--fs-lg);
  line-height: 1;
  text-align: center;
}
/* Os rótulos só aparecem com a rail aberta. Transiciona opacity, nunca
   font-size ou padding — isso é o que faz o texto tremer. */
.rail-label {
  flex: 1 1 auto;
  white-space: nowrap;
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease);
}
.rail:hover .rail-label,
.rail:focus-within .rail-label { opacity: 1; }
.rail-brand-text { opacity: 0; transition: opacity var(--dur-fast) var(--ease); white-space: nowrap; }
.rail:hover .rail-brand-text,
.rail:focus-within .rail-brand-text { opacity: 1; }

/* Rodapé: a dupla + ações */
.rail-foot { display: flex; flex-direction: column; gap: var(--sp-2); padding-top: var(--sp-2); border-top: 1px solid var(--border); }

.crew { display: flex; flex-direction: column; gap: 2px; }
.crew-person {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-1) var(--sp-2);
  border: none;
  border-radius: var(--r-md);
  background: none;
  cursor: default;
  font-family: var(--font-ui);
  text-align: left;
}
.crew-dot {
  position: relative;
  flex: 0 0 auto;
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border-radius: var(--r-pill);
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--bg);
  background: var(--muted);
  transition: background var(--dur) var(--ease);
}
.crew-person[data-who="marcio"].is-online .crew-dot { background: var(--marcio-color); }
.crew-person[data-who="bruno"].is-online .crew-dot { background: var(--bruno-color); }
/* O ponto de estado fica na quina do avatar: com a rail fechada é a única
   coisa visível, e já diz quem está aqui. */
.crew-dot::after {
  content: '';
  position: absolute;
  right: -1px; bottom: -1px;
  width: 8px; height: 8px;
  border-radius: var(--r-pill);
  background: var(--muted);
  border: 2px solid var(--surface);
  transition: background var(--dur) var(--ease);
}
.crew-person.is-online .crew-dot::after { background: var(--green); }
.crew-person.is-me .crew-name::after { content: ' · você'; color: var(--muted); font-weight: 400; }

.crew-text { display: flex; flex-direction: column; line-height: 1.2; opacity: 0; white-space: nowrap; transition: opacity var(--dur-fast) var(--ease); }
.rail:hover .crew-text,
.rail:focus-within .crew-text { opacity: 1; }
.crew-name { font-size: var(--fs-sm); font-weight: 600; color: var(--text); }
.crew-state { font-size: var(--fs-xs); color: var(--muted); }
.crew-person.is-online .crew-state { color: var(--green); }

.rail-actions { display: flex; flex-direction: column; gap: 2px; }
.rail-action { font-size: var(--fs-sm); }

/* Coluna de conteúdo */
.app-main { flex: 1 1 auto; min-width: 0; margin-left: var(--rail-w); }

/* ── Cabeçalho de página ──
   A .action-bar de cada aba já era um cabeçalho de página; só não parecia.
   O título deixa de ser uma legenda em versalete e vira título de verdade. */
.action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  flex-wrap: wrap;
  padding-bottom: var(--sp-4);
  margin-bottom: var(--sp-5);
  border-bottom: 1px solid var(--border);
}
.section-title {
  font-size: var(--fs-xl);
  font-weight: 600;
  letter-spacing: -.01em;
  text-transform: none;
  color: var(--text);
  line-height: var(--lh-tight);
}
/* Legenda de subseção — o que o .section-title era antes. */
.history-title,
.eyebrow {
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: var(--sp-3);
}

/* ─── CONTENT ─────────────────────────────────── */
.tab-panel { display: none; padding: 24px; max-width: 860px; margin: 0 auto; }
/* Leads: tabela com muitas colunas, panel mais largo que os demais */
#tab-leads { max-width: 1200px; }
/* Despesas: tabela de fatura, mesma largura extra */
#tab-despesas { max-width: 1200px; }
/* Medusa / Judge Dredd: iframe de página cheia (a página traz o próprio tema/scroll) */
#tab-medusa, #tab-judge { max-width: none; padding: 0; }
#tab-medusa iframe, #tab-judge iframe { display: block; width: 100%; height: calc(100vh - 105px); border: 0; }
.tab-panel.active { display: block; }

/* ─── NOTIFICATION BAR ────────────────────────── */
.notif-bar {
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
  border-radius: var(--radius);
  color: var(--accent);
  font-size: 12px;
  padding: 8px 14px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.notif-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .3; }
}

/* ─── ASSIGNMENT CARDS ────────────────────────── */
.assignments-list { display: flex; flex-direction: column; gap: 28px; }

.assignment-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .15s;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}

.assignment-card.is-open { border-left: 3px solid var(--yellow); }
.assignment-card.is-closed { border-left: 3px solid var(--green); opacity: .7; }
.assignment-card.is-mine-open { border-left: 3px solid var(--accent); }
.assignment-card.is-working { border-left: 3px solid var(--yellow); border-color: color-mix(in srgb, var(--yellow) 50%, transparent); }

/* Working On Ribbon */
.working-ribbon {
  background: linear-gradient(90deg, color-mix(in srgb, var(--yellow) 25%, transparent) 0%, color-mix(in srgb, var(--yellow) 10%, transparent) 100%);
  border-bottom: 1px solid color-mix(in srgb, var(--yellow) 35%, transparent);
  color: var(--yellow);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 6px 16px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.working-ribbon-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--yellow);
  animation: pulse 1.5s infinite;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.creator-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
}

.creator-tag.marcio { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--marcio-color); }
.creator-tag.bruno { background: color-mix(in srgb, var(--green) 15%, transparent); color: var(--bruno-color); }

.arrow-tag { color: var(--muted); font-size: 12px; }

.target-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
}

.status-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .05em;
  padding: 3px 8px;
  border-radius: 20px;
  text-transform: uppercase;
}

.status-badge.open { background: color-mix(in srgb, var(--yellow) 15%, transparent); color: var(--yellow); }
.status-badge.closed { background: color-mix(in srgb, var(--green) 10%, transparent); color: var(--green); }

.card-date {
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: .01em;
}

.btn-copy {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 13px;
  line-height: 1;
  transition: color .15s, background .15s;
}
.btn-copy:hover { color: var(--text); background: var(--surface2); }
.btn-copy.copied { color: var(--green); }

.btn-delete {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 13px;
  line-height: 1;
  transition: color .15s, background .15s;
}
.btn-delete:hover { color: var(--red); background: color-mix(in srgb, var(--red) 8%, transparent); }

.card-body { padding: 14px 16px; }

.card-content {
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.card-reply {
  background: var(--surface2);
  border-radius: 6px;
  margin-top: 12px;
  padding: 12px 14px;
}

.text-block-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.text-block-label .btn-copy { margin-left: auto; }

.reply-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.reply-label .btn-copy { margin-left: auto; }

.reply-text {
  color: var(--text);
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.card-footer { padding: 10px 16px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: 8px; }

.card-footer-left { display: flex; gap: 8px; }
.card-footer-right { display: flex; gap: 8px; }

.btn-reply {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 14px;
  transition: all .15s;
}
.btn-reply:hover { border-color: var(--green); color: var(--green); }

.btn-working {
  background: none;
  border: 1px solid color-mix(in srgb, var(--yellow) 30%, transparent);
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 14px;
  transition: all .15s;
  display: flex;
  align-items: center;
  gap: 5px;
}
.btn-working:hover { border-color: var(--yellow); color: var(--yellow); }
.btn-working.active { background: color-mix(in srgb, var(--yellow) 12%, transparent); border-color: var(--yellow); color: var(--yellow); font-weight: 600; }

.empty-state {
  color: var(--muted);
  font-size: 14px;
  padding: 48px 0;
  text-align: center;
}

/* ─── REPORTS ─────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

.stat-label { font-size: 11px; color: var(--muted); font-weight: 600; letter-spacing: .05em; text-transform: uppercase; margin-bottom: 8px; }
.stat-value { font-size: 28px; font-weight: 700; }
.stat-value.green { color: var(--green); }
.stat-value.yellow { color: var(--yellow); }
.stat-value.blue { color: var(--accent); }
.stat-value.purple { color: var(--purple); }

.history-title { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }

.history-table { width: 100%; border-collapse: collapse; }
.history-table th {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .05em;
  padding: 10px 14px;
  text-align: left;
  text-transform: uppercase;
}
.history-table td {
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  padding: 10px 14px;
  vertical-align: top;
}
.history-table tr:last-child td { border-bottom: none; }
.history-table tr:hover td { background: var(--surface); }

.td-content { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-lead-msg { min-width: 320px; max-width: 520px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-mono { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }

/* ─── DESPESAS CORPORATIVAS ──────────────────── */
.desp-fatura { margin-bottom: 26px; }
.desp-fatura-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  border-bottom: none; padding: 12px 14px;
}
.desp-fatura-mes { font-size: 14px; font-weight: 700; }
.desp-fatura-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.desp-saldo { font-family: var(--font-mono); font-size: 15px; font-weight: 700; }
.desp-saldo.receber { color: var(--green); }
.desp-saldo.pagar { color: var(--yellow); }
.desp-fatura .history-table { border: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius); }
.td-valor { font-family: var(--font-mono); font-size: 12px; text-align: right; white-space: nowrap; }
.td-valor.metade { font-weight: 700; }
.desp-quitada td { opacity: .5; }
.desp-obs { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; }
.desp-anexos { display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; vertical-align: middle; }
.desp-anexo {
  width: 22px; height: 22px; object-fit: cover; cursor: zoom-in;
  border: 1px solid var(--border); border-radius: 4px;
}
.desp-anexo:hover { border-color: var(--accent); }
.desp-anexo-doc { text-decoration: none; font-size: 13px; line-height: 1; }
.desp-hint { font-size: 11px; color: var(--muted); margin-bottom: 14px; }
.desp-acoes { white-space: nowrap; text-align: right; }
.desp-fatura .history-table th, .desp-fatura .status-badge { white-space: nowrap; }
.desp-acoes .btn-add, .desp-acoes .btn-delete { display: inline-flex; vertical-align: middle; }
/* Quitar aparece em toda linha: fica discreto para não competir com o
   "Quitar fatura", que é a ação principal. */
.btn-quitar {
  background: transparent; border: 1px solid var(--border); color: var(--muted);
  font-size: 11px; padding: 5px 9px;
}
.btn-quitar:hover { border-color: var(--green); color: var(--green); }

/* ─── USEFUL INFO KEEP CARDS ─────────────────── */
.keep-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 8px;
}

/* ── Instruções de pagamento (PIX) ──────────────────────────────
   Usado tanto no bloco fixo da aba Despesas quanto dentro do modal
   "Quanto eu preciso pagar?" — as duas superfícies mostram a mesma linha. */
.pix-box {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
  margin-bottom: 26px;
}

.pix-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.pix-card.destaque { border-color: var(--accent); }

.pix-nome {
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pix-eu {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1px 7px;
}

.pix-chave-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

.pix-chave {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: .02em;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 4px 8px;
}

.pix-tipo {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--muted);
}

/* Destaque do valor dentro do modal de pagamento. */
.pix-hero {
  text-align: center;
  padding: 6px 0 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}
.pix-hero-value {
  font-family: var(--font-mono);
  font-size: 34px;
  font-weight: 700;
  line-height: 1.1;
}
.pix-hero-value.pagar { color: var(--yellow); }
.pix-hero-value.receber { color: var(--green); }

.pix-faturas {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  font-size: 12px;
}
.pix-faturas li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 0;
  border-bottom: 1px dashed var(--border);
}
.pix-faturas li:last-child { border-bottom: none; }
.pix-faturas .pix-fat-valor { font-family: var(--font-mono); }
.pix-faturas .contra { color: var(--muted); }

.keep-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: box-shadow .15s;
}
.keep-card:hover { box-shadow: var(--shadow); }

.keep-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.keep-card-icon {
  font-size: 15px;
  line-height: 1;
}

.keep-card-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.keep-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.keep-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}

.keep-value {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 4px 8px;
  cursor: pointer;
  user-select: all;
  transition: background .12s;
}
.keep-value:hover { background: var(--border); }

.keep-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  align-self: flex-start;
}

.keep-copy-hint {
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
}

/* Aviso de vocabulário: {slug} aparece em vários cards/itens e não é óbvio
   que é o mesmo que "tenant". Vai no topo de toda aba onde a palavra aparece. */
.slug-note {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 8px 12px;
  margin-bottom: 14px;
}
.slug-note code {
  color: var(--accent);
  background: var(--surface2);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 11px;
}

/* Tags das notas: chips clicáveis que filtram a lista */
.note-tag {
  cursor: pointer;
  align-self: auto;
  transition: background .12s, border-color .12s;
}
.note-tag:hover { background: color-mix(in srgb, var(--accent) 25%, transparent); }
.note-tag.active {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}
.note-tagcloud {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.note-tagcloud .note-tag { line-height: 1.5; }
.note-tag .tag-count { opacity: .65; font-weight: 400; margin-left: 3px; }

/* ─── CAMPO DE TEXTO ──────────────────────────── */
.field {
  flex: 1;
  min-width: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 13px;
  padding: 8px 12px;
  transition: border-color .15s;
}
.field:focus { border-color: var(--accent); }
.field::placeholder { color: var(--muted); }

/* ─── MODAL ───────────────────────────────────── */
.modal-overlay {
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.7);
  inset: 0;
  padding: 24px;
  position: fixed;
  z-index: 100;
  backdrop-filter: blur(2px);
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-width: 540px;
  width: 100%;
  box-shadow: 0 24px 48px rgba(0,0,0,.6);
  animation: modal-in .15s ease;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to { opacity: 1; transform: none; }
}

.modal-header {
  border-bottom: 1px solid var(--border);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title { font-weight: 600; font-size: 15px; }
.modal-close { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 20px; line-height: 1; padding: 0 2px; transition: color .15s; }
.modal-close:hover { color: var(--text); }

.modal-body { padding: 20px; }
.modal-label { display: block; font-size: 12px; color: var(--muted); font-weight: 500; letter-spacing: .05em; text-transform: uppercase; margin-bottom: 8px; }
.modal-target { font-size: 13px; color: var(--text); margin-bottom: 16px; }
.modal-target span { font-weight: 600; color: var(--green); }

.modal-original {
  background: var(--surface2);
  border-radius: 6px;
  border-left: 3px solid var(--accent);
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 120px;
  overflow-y: auto;
}

.modal-textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.6;
  min-height: 140px;
  padding: 12px 14px;
  resize: vertical;
  outline: none;
  transition: border-color .15s;
}
.modal-textarea:focus { border-color: var(--accent); }
.modal-textarea::placeholder { color: var(--muted); }

.char-count { text-align: right; font-size: 11px; color: var(--muted); margin-top: 4px; }

.modal-footer {
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 14px 20px;
}

.btn-cancel {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 13px;
  padding: 8px 16px;
  transition: all .15s;
}
.btn-cancel:hover { border-color: var(--text); color: var(--text); }

.btn-submit {
  background: var(--accent);
  border: none;
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 18px;
  transition: opacity .15s;
}
.btn-submit:hover { opacity: .85; }
.btn-submit:disabled { opacity: .4; cursor: not-allowed; }

.btn-close-green {
  background: var(--green);
  border: none;
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 18px;
  transition: opacity .15s;
}
.btn-close-green:hover { opacity: .85; }
.btn-close-green:disabled { opacity: .4; cursor: not-allowed; }

/* ─── THREAD & ACK ────────────────────────────── */
.card-thread {
  margin-top: 12px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}
.thread-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.thread-msg {
  background: var(--surface2);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 6px;
}
.thread-msg-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.thread-author { font-size: 11px; font-weight: 600; }
.thread-author.marcio { color: var(--marcio-color); }
.thread-author.bruno  { color: var(--bruno-color); }
.thread-time { font-size: 11px; color: var(--muted); }
.thread-msg-text {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.ack-row { display: flex; align-items: center; margin-top: 6px; }
.ack-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.ack-label.acked { color: var(--green); }
.ack-checkbox { accent-color: var(--green); width: 13px; height: 13px; cursor: pointer; }
.btn-reply:disabled { opacity: .4; cursor: not-allowed; }
.btn-reply:disabled:hover { border-color: var(--border); color: var(--text); }

/* ─── MARKDOWN ────────────────────────────────── */
.md { line-height: 1.6; word-break: break-word; }
.md > *:first-child { margin-top: 0; }
.md > *:last-child { margin-bottom: 0; }
.md p, .md ul, .md ol, .md blockquote, .md pre, .md table { margin: 0 0 10px; }
.md h1, .md h2, .md h3, .md h4 { margin: 14px 0 8px; line-height: 1.3; font-weight: 700; }
.md h1 { font-size: 18px; } .md h2 { font-size: 16px; } .md h3 { font-size: 14px; } .md h4 { font-size: 13px; }
.md ul, .md ol { padding-left: 22px; }
.md li { margin-bottom: 3px; }
.md li > input[type="checkbox"] { margin-right: 6px; accent-color: var(--green); }
.md a { color: var(--accent); }
.md code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
}
.md pre {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  overflow-x: auto;
}
.md pre code { background: none; border: none; padding: 0; font-size: 12px; }
.md blockquote {
  border-left: 3px solid var(--accent);
  color: var(--muted);
  padding: 4px 12px;
}
.md table { border-collapse: collapse; display: block; overflow-x: auto; max-width: 100%; }
.md th, .md td { border: 1px solid var(--border); padding: 5px 10px; font-size: 13px; text-align: left; }
.md th { background: var(--surface2); font-weight: 600; }
.md hr { border: none; border-top: 1px solid var(--border); margin: 12px 0; }
.md img { max-width: 100%; border-radius: 6px; }

/* ─── COLLAPSIBLE CARD BODY ───────────────────── */
.card-collapsible { position: relative; }
.card-collapsible.collapsed { max-height: 220px; overflow: hidden; }
.card-collapsible.collapsed::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 70px;
  background: linear-gradient(to bottom, transparent, var(--surface));
  pointer-events: none;
}
.btn-expand {
  display: block;
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--accent);
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  padding: 6px;
  margin-top: 10px;
  transition: all .15s;
}
.btn-expand:hover { border-color: var(--accent); }

/* ─── ATTACHMENTS ─────────────────────────────── */
.attach-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.attach-img {
  max-height: 140px;
  max-width: 220px;
  border-radius: 8px;
  border: 1px solid var(--border);
  cursor: zoom-in;
  object-fit: cover;
  transition: filter .15s;
}
.attach-img:hover { filter: brightness(1.1); }
.attach-video {
  max-height: 240px;
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #000;
}
.attach-pdf {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  padding: 10px 14px;
  max-width: 260px;
  transition: border-color .15s, color .15s;
}
.attach-pdf:hover { border-color: var(--accent); color: var(--accent); }
.attach-pdf-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.btn-attach {
  background: var(--surface2);
  border: 1px dashed var(--border);
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  transition: all .15s;
}
.btn-attach:hover { border-color: var(--accent); color: var(--accent); }
.attach-hint { font-size: 11px; color: var(--muted); }
.attach-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.attach-chip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 11px;
  color: var(--muted);
  max-width: 180px;
}
.attach-chip img { width: 34px; height: 34px; object-fit: cover; border-radius: 4px; }
.attach-chip .chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-chip .chip-x {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: 13px; line-height: 1; padding: 0 2px;
}
.attach-chip .chip-x:hover { color: var(--red); }
.attach-chip.uploading { opacity: .6; }
.drop-active { outline: 2px dashed var(--accent); outline-offset: -4px; border-radius: var(--radius); }

/* ─── THREAD NESTING & COMPOSER ───────────────── */
.thread-children {
  margin: 6px 0 6px 14px;
  border-left: 2px solid var(--border);
  padding-left: 12px;
}
.btn-thread-reply {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 4px;
  border-radius: 4px;
  margin-left: auto;
  transition: color .15s;
}
.btn-thread-reply:hover { color: var(--accent); }
.thread-composer {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  margin: 8px 0;
}
.thread-composer.replying { border-color: var(--accent); }
.thread-composer-to { font-size: 11px; color: var(--accent); font-weight: 600; margin-bottom: 6px; }
.composer-textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.5;
  min-height: 64px;
  padding: 8px 10px;
  resize: vertical;
  outline: none;
  transition: border-color .15s;
}
.composer-textarea:focus { border-color: var(--accent); }
.composer-actions { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.composer-actions .btn-submit { padding: 6px 14px; font-size: 12px; }
.composer-actions .btn-cancel { padding: 6px 12px; font-size: 12px; }
.btn-comment {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 14px;
  transition: all .15s;
}
.btn-comment:hover { border-color: var(--accent); color: var(--accent); }

/* ─── LIGHTBOX ────────────────────────────────── */
#lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.88);
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 32px;
  cursor: zoom-out;
}
#lightbox.open { display: flex; }
#lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; box-shadow: 0 12px 48px rgba(0,0,0,.8); }

/* ─── GO TO TOP / BOTTOM ──────────────────────── */
#fab-stack {
  position: fixed;
  bottom: 24px;
  left: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  z-index: 150;
}
#goto-top, #goto-bottom, #goto-next-open {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--accent);
  font-size: 18px;
  cursor: pointer;
  box-shadow: var(--shadow);
  display: none;
  transition: border-color .15s;
}
#goto-next-open { font-size: 15px; }
#goto-top.show, #goto-bottom.show, #goto-next-open.show { display: block; }
#goto-top:hover, #goto-bottom:hover, #goto-next-open:hover { border-color: var(--accent); }
@keyframes jump-flash-kf {
  0% { box-shadow: 0 0 0 3px var(--accent); }
  100% { box-shadow: 0 0 0 3px transparent; }
}
.assignment-card.jump-flash { animation: jump-flash-kf 1.2s ease-out 1; }

/* ─── TOAST ───────────────────────────────────── */
#toast {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  bottom: 24px;
  box-shadow: var(--shadow);
  color: var(--text);
  display: none;
  font-size: 13px;
  padding: 12px 18px;
  position: fixed;
  right: 24px;
  z-index: 200;
  max-width: 300px;
  animation: toast-in .2s ease;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ─── THEME SWITCHER ──────────────────────────────── */
.theme-switcher { position: relative; }

.theme-btn {
  align-items: center;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  gap: 5px;
  padding: 4px 8px;
  transition: border-color .15s;
}
.theme-btn:hover { border-color: var(--accent); }

.theme-btn-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--theme-dot);
  transition: background .2s;
}

.theme-btn-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}

.theme-menu {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  display: none;
  padding: 6px;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 50;
  width: 148px;
  max-height: 340px;
  overflow-y: auto;
  animation: modal-in .12s ease;
}
.theme-menu.open { display: block; }

.theme-option {
  align-items: center;
  background: none;
  border: 2px solid transparent;
  border-radius: 7px;
  cursor: pointer;
  display: flex;
  gap: 9px;
  padding: 6px 8px;
  transition: background .1s;
  width: 100%;
}
.theme-option:hover { background: var(--surface2); }
.theme-option.active { border-color: var(--accent); }

.theme-swatch {
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
  height: 16px;
  width: 16px;
}

.theme-name {
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
}

/* ─── DIGEST ──────────────────────────────────── */
.digest-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.digest-date-label {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.btn-refresh {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 12px;
  transition: all .15s;
  display: flex;
  align-items: center;
  gap: 5px;
}
.btn-refresh:hover { border-color: var(--accent); color: var(--accent); }
.btn-refresh:disabled { opacity: .4; cursor: not-allowed; }

.digest-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 640px) { .digest-grid { grid-template-columns: 1fr; } }

.digest-user-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.digest-user-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.digest-user-header.marcio { border-top: 3px solid var(--marcio-color); }
.digest-user-header.bruno  { border-top: 3px solid var(--bruno-color); }

.digest-user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; flex-shrink: 0;
}
.digest-user-header.marcio .digest-user-avatar { background: color-mix(in srgb, var(--accent) 20%, transparent); color: var(--marcio-color); }
.digest-user-header.bruno  .digest-user-avatar { background: color-mix(in srgb, var(--green) 20%, transparent);  color: var(--bruno-color); }

.digest-user-name  { font-weight: 700; font-size: 15px; }
.digest-user-count { font-size: 12px; color: var(--muted); margin-top: 1px; }

.digest-empty {
  padding: 24px 16px;
  font-size: 13px;
  color: var(--muted);
  font-style: italic;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.digest-empty img {
  width: 100px;
  opacity: .85;
}

.digest-repo {
  border-top: 1px solid var(--border);
}
.digest-repo-name {
  font-size: 11px; font-weight: 600; color: var(--accent);
  padding: 10px 16px 4px;
  font-family: var(--font-mono);
  letter-spacing: .02em;
}
.digest-commits { padding: 0 16px 10px; }
.digest-commit {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  align-items: start;
  gap: 8px;
  padding: 4px 0;
  font-size: 13px;
}
.digest-commit-hash {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  padding-top: 1px;
}
.digest-commit-subject {
  color: var(--text);
  word-break: break-word;
  line-height: 1.4;
}
.digest-commit-time {
  font-size: 11px;
  color: var(--muted);
  font-family: var(--font-mono);
  white-space: nowrap;
}

.digest-day-off {
  text-align: center;
  padding: 40px 0;
  color: var(--muted);
  font-size: 14px;
}
.digest-day-off-emoji { font-size: 36px; display: block; margin-bottom: 10px; }

/* ─────────────────────────────────────────────────────────────────────────
   NORMALIZAÇÃO
   As classes abaixo nasceram separadas e foram divergindo. Aqui elas voltam
   a compartilhar as decisões que deveriam ser uma só; cada uma segue com o
   que de fato a diferencia (cor, peso, estado).
   ───────────────────────────────────────────────────────────────────── */

/* Botões — eram 15 classes sem base comum. */
.btn-primary, .btn-add, .btn-copy, .btn-delete, .btn-reply, .btn-working,
.btn-cancel, .btn-submit, .btn-close-green, .btn-expand, .btn-attach,
.btn-comment, .btn-quitar, .btn-refresh, .btn-thread-reply, .btn-ghost {
  font-family: var(--font-ui);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease),
              opacity var(--dur-fast) var(--ease);
}

/* O botão secundário existia de fato — só nunca ganhou classe. Estava escrito
   à mão em ~13 lugares como style="background:transparent;border:1px solid…". */
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: 600;
  padding: var(--sp-2) var(--sp-3);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--text); }
.btn-sm { font-size: var(--fs-sm); padding: 6px var(--sp-3); }
.btn-xs { font-size: var(--fs-xs); padding: var(--sp-1) var(--sp-2); }

/* Superfícies elevadas — eram 5 raios e 6 sombras para o mesmo conceito. */
.assignment-card, .keep-card, .stat-card, .digest-user-card, .desp-fatura-head,
.desp-fatura .history-table, .modal, .auth-card {
  border-radius: var(--r-card);
}
.assignment-card, .keep-card, .digest-user-card { box-shadow: var(--shadow-card); }
.modal { box-shadow: var(--shadow-overlay); }
.desp-fatura-head { border-radius: var(--r-card) var(--r-card) 0 0; }
.desp-fatura .history-table { border-radius: 0 0 var(--r-card) var(--r-card); }

/* Pills */
.status-badge, .presence-pill, .badge-count, .creator-tag, .target-tag,
.keep-tag, .note-tag { border-radius: var(--r-pill); }

/* Dado é mono. Este app é um console: valor, data, hash, slug, id. */
.td-mono, .td-valor, .desp-saldo, .digest-commit-hash, .card-date,
.thread-time, .keep-value { font-family: var(--font-mono); }

/* Tabelas mais densas, com cabeçalho que acompanha o scroll. */
.history-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  font-size: var(--fs-xs);
  letter-spacing: .07em;
  padding: var(--sp-2) var(--sp-3);
}
.history-table td { padding: var(--sp-2) var(--sp-3); font-size: var(--fs-base); }
.table-wrap { overflow-x: auto; }

/* Utilitários — dissolvem os clusters de style="display:flex;gap:8px". */
.row { display: flex; align-items: center; gap: var(--sp-2); }
.row-end { display: flex; gap: var(--sp-2); justify-content: flex-end; }
.stack { display: flex; flex-direction: column; gap: var(--sp-2); }
.text-right { text-align: right; }

/* ─── FOCO DE TECLADO ─────────────────────────────
   Não existia uma única regra de foco em todo o arquivo, e três inputs ainda
   matavam o outline nativo sem repor nada. Quem navega por teclado não
   enxergava onde estava. */
:where(button, a, input, textarea, select, [tabindex]):focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: var(--r-sm);
}
.rail-item:focus-visible,
.rail-action:focus-visible,
.crew-person:focus-visible { border-radius: var(--r-md); }
.field:focus-visible,
.modal-textarea:focus-visible,
.composer-textarea:focus-visible { border-color: var(--accent); border-radius: var(--r-md); }

/* O FAB ficava em left:24px e passou a cair por baixo da rail. */
#fab-stack { left: calc(var(--rail-w) + var(--sp-6)); z-index: 15; }

/* Mais ar no topo: sem o header de 56px, o título encostava na borda. */
.tab-panel { padding: var(--sp-7) var(--sp-6) var(--sp-8); }
#tab-medusa, #tab-judge { padding: 0; }
#tab-medusa iframe, #tab-judge iframe { height: 100vh; }

/* ─── MOVIMENTO REDUZIDO ──────────────────────────
   Antes só o easter egg respeitava a preferência; as animações infinitas
   (coração da presença, pulso do aviso, varredura) não. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}

/* ─── TELA ESTREITA ───────────────────────────────
   Não é layout de celular: é garantir que nada estoure. No toque não existe
   hover, então a rail vira uma faixa horizontal rolável no topo. */
@media (max-width: 900px) {
  /* align-items do .shell é flex-start (para a rail fixa não esticar); no
     estreito a faixa precisa ir de ponta a ponta. */
  .shell { flex-direction: column; align-items: stretch; }
  .rail {
    position: static;
    flex-direction: row;
    align-items: center;
    width: 100%;
    height: auto;
    gap: var(--sp-1);
    padding: var(--sp-2);
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .rail:hover, .rail:focus-within { width: 100%; }
  .rail-brand, .rail-actions .rail-label { display: none; }
  .rail-nav { flex-direction: row; flex: 0 0 auto; overflow: visible; }
  .rail-item { width: auto; }
  .rail-label { opacity: 1; }
  .rail-item .rail-label { display: none; }
  .rail-foot { flex-direction: row; margin-left: auto; padding-top: 0; border-top: none; border-left: 1px solid var(--border); padding-left: var(--sp-2); }
  .crew { flex-direction: row; }
  .crew-text { display: none; }
  .rail-actions { flex-direction: row; }
  .app-main { margin-left: 0; }
  .tab-panel { padding: var(--sp-5) var(--sp-4) var(--sp-7); }
  #tab-medusa iframe, #tab-judge iframe { height: calc(100vh - 56px); }
  #fab-stack { left: var(--sp-4); }
}
