/* ===== VARIAVEIS ===== */
:root {
  --primary: #F04422;
  --primary-dark: #C7341C;
  --primary-light: #FFF0E9;
  --primary-soft: #FFD8CA;
  --brand-green: #007A72;
  --brand-green-dark: #005F59;
  --brand-yellow: #F6BE24;
  --bg: #FBFAF7;
  --white: #FFFFFF;
  --surface: #FFFFFF;
  --surface-muted: #F6F4EF;
  --text: #14110F;
  --text-secondary: #5C5853;
  --text-muted: #94908A;
  --border: #ECE8E2;
  --border-light: #F4F1EC;
  --success: #007A72;
  --success-bg: #F0FDF4;
  --danger: #DC2626;
  --danger-bg: #FEF2F2;
  --warning: #D97706;
  --warning-bg: #FFFBEB;
  --info: #2563EB;
  --info-bg: #EFF6FF;
  --sidebar-width: 260px;
  --header-height: 60px;
  --radius-xl: 20px;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-xs: 0 1px 2px rgba(20,17,15,0.04);
  --shadow: 0 4px 14px rgba(20,17,15,0.06);
  --shadow-lg: 0 18px 48px -12px rgba(20,17,15,0.18);
  --shadow-primary: 0 10px 28px -8px rgba(240,68,34,0.36);
  --transition: all 0.2s cubic-bezier(.4,0,.2,1);
  --font-display: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
}

body.theme-dark {
  --primary: #FF6946;
  --primary-dark: #F04422;
  --primary-light: rgba(255,105,70,0.14);
  --primary-soft: rgba(255,105,70,0.22);
  --brand-green: #1AA69A;
  --brand-green-dark: #0B8178;
  --brand-yellow: #F6BE24;
  --bg: #0E0D0C;
  --white: #161513;
  --surface: #161513;
  --surface-muted: #1C1B19;
  --text: #F4F1EC;
  --text-secondary: #A8A39B;
  --text-muted: #6E6A63;
  --border: #2A2925;
  --border-light: #1F1E1B;
  --success: #34D399;
  --success-bg: rgba(52,211,153,0.12);
  --danger: #F87171;
  --danger-bg: rgba(248,113,113,0.12);
  --warning: #FBBF24;
  --warning-bg: rgba(251,191,36,0.12);
  --info: #60A5FA;
  --info-bg: rgba(96,165,250,0.12);
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.3);
  --shadow: 0 6px 20px rgba(0,0,0,0.35);
  --shadow-lg: 0 24px 60px -16px rgba(0,0,0,0.65);
  --shadow-primary: 0 10px 28px -8px rgba(255,105,70,0.45);
}

body.theme-dark .form-group input,
body.theme-dark .form-group select,
body.theme-dark .form-group textarea,
body.theme-dark .table-toolbar .search-input,
body.theme-dark .table-toolbar select,
body.theme-dark .fin-search,
body.theme-dark .fin-date {
  border-color: var(--border);
  background: var(--surface-muted);
  color: var(--text);
}

body.theme-dark .fin-date input::-webkit-calendar-picker-indicator {
  filter: invert(1);
}

body.theme-dark .form-group input:focus,
body.theme-dark .form-group select:focus,
body.theme-dark .form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(255,123,51,0.15);
}

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

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'ss01', 'cv11';
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  font-family: var(--font-body);
}

input, select, textarea {
  font-family: var(--font-body);
  font-size: 0.95rem;
}

/* ===== LANDING ===== */
.landing-screen {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 1.5rem clamp(1rem, 5vw, 4rem);
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
}

.landing-bg,
.login-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.landing-bg .blob,
.login-bg .blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.55;
}

.landing-bg .blob-1 {
  width: 520px; height: 520px;
  background: radial-gradient(circle at center, rgba(246,190,36,0.45) 0%, transparent 70%);
  top: -180px; right: -120px;
}

.landing-bg .blob-2 {
  width: 460px; height: 460px;
  background: radial-gradient(circle at center, rgba(0,122,114,0.18) 0%, transparent 70%);
  bottom: -160px; left: -120px;
  opacity: 0.4;
}

.landing-bg .grain {
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(20,17,15,0.04) 1px, transparent 1px);
  background-size: 3px 3px;
  opacity: 0.5;
  mix-blend-mode: multiply;
}

.login-bg .blob-1 {
  width: 420px; height: 420px;
  background: radial-gradient(circle at center, rgba(240,68,34,0.10) 0%, transparent 70%);
  top: -140px; left: -100px;
}

.login-bg .blob-2 {
  width: 380px; height: 380px;
  background: radial-gradient(circle at center, rgba(0,122,114,0.08) 0%, transparent 70%);
  bottom: -120px; right: -80px;
  opacity: 0.4;
}

/* Nav */
.landing-nav {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.25rem 0;
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
}

.landing-brand {
  display: inline-flex;
  align-items: center;
  width: min(230px, 52vw);
}

.brand-logo-img {
  width: 100%;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 8px 16px rgba(20,17,15,0.06));
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
  font-family: var(--font-body);
  transition: var(--transition);
}

.btn-ghost:hover {
  border-color: var(--text);
  background: var(--white);
  transform: translateY(-1px);
}

/* Hero */
.landing-hero {
  position: relative;
  z-index: 1;
  min-height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  max-width: 900px;
  margin: 0 auto;
  padding: 3.5rem 0 4rem;
}

.hero-logo {
  width: min(460px, 82vw);
  height: auto;
  object-fit: contain;
  margin-bottom: 1.75rem;
  filter: drop-shadow(0 16px 28px rgba(20,17,15,0.08));
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.65);
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.eyebrow-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 4px rgba(240,68,34,0.16);
}

.hero-title {
  margin-top: 1.5rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.3rem, 5.7vw, 4.6rem);
  line-height: 1.05;
  letter-spacing: -0.035em;
  color: var(--text);
}

.hero-accent {
  background: linear-gradient(135deg, var(--primary) 0%, var(--brand-green) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-sub {
  margin-top: 1.25rem;
  max-width: 680px;
  font-size: clamp(1rem, 1.6vw, 1.1rem);
  line-height: 1.6;
  color: var(--text-secondary);
}

.hero-cta {
  margin-top: 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: center;
}

.btn-primary-lg {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.9rem 1.6rem;
  border-radius: 999px;
  background: var(--text);
  color: var(--white);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1rem;
  border: 0;
  transition: var(--transition);
  box-shadow: 0 10px 28px -10px rgba(20,17,15,0.5);
}

.btn-primary-lg:hover {
  transform: translateY(-2px);
  background: var(--primary);
  box-shadow: var(--shadow-primary);
}

.btn-primary-lg svg {
  transition: transform 0.2s ease;
}

.btn-primary-lg:hover svg {
  transform: translateX(3px);
}

.btn-secondary-lg {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.9rem 1.6rem;
  border-radius: 999px;
  background: var(--white);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1rem;
  border: 1px solid var(--border);
  transition: var(--transition);
  box-shadow: var(--shadow-xs);
}

.btn-secondary-lg:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: var(--shadow);
}

.btn-secondary-lg svg { transition: transform 0.2s ease; }
.btn-secondary-lg:hover svg { transform: scale(1.08); }

.btn-link-lg {
  padding: 0.9rem 1rem;
  background: transparent;
  border: 0;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 4px;
  transition: var(--transition);
}

.btn-link-lg:hover {
  color: var(--text);
  text-decoration-color: var(--text);
}

.landing-brand-mini {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: -0.01em;
  color: var(--text);
}

/* ===== DOAÇÃO (modal) ===== */
.donation-modal { display: flex; flex-direction: column; gap: 1.1rem; }
.donation-intro { color: var(--text-secondary); font-size: 0.92rem; line-height: 1.55; }
.donation-block {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  background: var(--surface-muted);
}
.donation-block h4 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}
.donation-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.45rem 0;
  border-top: 1px solid var(--border-light);
}
.donation-row:first-of-type { border-top: 0; }
.donation-label { display: block; font-size: 0.75rem; color: var(--text-muted); }
.donation-value { font-size: 0.98rem; color: var(--text); font-weight: 600; word-break: break-all; }
.donation-copy { flex-shrink: 0; }
.donation-whats { margin-top: 0.25rem; }

/* PIX: QR + copiar */
.donation-pix {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}
.donation-pix h4 { align-self: flex-start; }
.donation-qr {
  display: grid;
  place-items: center;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
}
.donation-qr img,
.donation-qr canvas {
  display: block;
  width: 196px;
  height: 196px;
}
.donation-copy-pix { margin-top: 0.1rem; }

/* CNPJ */
.donation-cnpj {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.donation-cnpj .donation-value {
  font-size: 1.05rem;
  letter-spacing: 0.01em;
}
.donation-titular {
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.donation-empty {
  text-align: center;
  padding: 1.25rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
}
.donation-empty code {
  background: var(--surface-muted);
  padding: 0.1rem 0.35rem;
  border-radius: 6px;
  font-size: 0.82rem;
}

/* ===== SOLICITAÇÃO DE AJUDA (modal) ===== */
.request-intro { color: var(--text-secondary); font-size: 0.92rem; margin-bottom: 1rem; line-height: 1.55; }

/* Detalhe de uma solicitação (painel admin) */
.solic-detail { display: flex; flex-direction: column; gap: 1.1rem; }
.solic-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.solic-detail-head strong {
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1.25rem;
  padding: 1rem 1.1rem;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.detail-row { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.detail-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 600;
}
.detail-value { font-size: 0.95rem; color: var(--text); font-weight: 600; word-break: break-word; }
.detail-msg { display: flex; flex-direction: column; gap: 0.35rem; }
.detail-msg p {
  margin: 0;
  padding: 0.85rem 1rem;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  line-height: 1.55;
  white-space: pre-wrap;
}
.detail-status { display: flex; flex-direction: column; gap: 0.5rem; }
.status-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

@media (max-width: 480px) {
  .detail-grid { grid-template-columns: 1fr; }
}

.impact-strip {
  margin-top: 3rem;
  width: min(820px, 100%);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255,255,255,0.68);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.impact-strip div {
  padding: 1.2rem 1rem;
  border-right: 1px solid var(--border-light);
}

.impact-strip div:last-child {
  border-right: 0;
}

.impact-strip strong {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 2vw, 2rem);
  color: var(--brand-green);
  line-height: 1;
}

.impact-strip span {
  display: block;
  margin-top: 0.35rem;
  color: var(--text-secondary);
  font-size: 0.88rem;
}

.institution-section,
.programs-band {
  position: relative;
  z-index: 1;
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: clamp(3rem, 7vw, 5rem) 0;
}

.section-kicker {
  display: inline-flex;
  color: var(--primary);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.76rem;
  margin-bottom: 0.85rem;
}

.section-copy h2,
.section-heading h2 {
  font-size: clamp(3rem, 3vw, 3rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.section-copy p,
.section-heading p {
  margin-top: 1rem;
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.75;
}

.mission-section {
  display: block;
}

.section-heading {
  max-width: 760px;
  margin-bottom: 1.75rem;
}

.mission-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.mission-grid article {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255,255,255,0.72);
  padding: 1.35rem;
  box-shadow: var(--shadow-xs);
}

.mission-grid [data-lucide] {
  width: 28px;
  height: 28px;
  color: var(--primary);
  margin-bottom: 1rem;
}

.mission-grid h3 {
  font-size: 1.05rem;
}

.mission-grid p {
  margin-top: 0.55rem;
  color: var(--text-secondary);
  line-height: 1.6;
  font-size: 0.94rem;
}

.programs-band {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.program-list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

.program-list div {
  min-height: 150px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1rem;
  border-radius: 16px;
  color: #fff;
  background: var(--brand-green);
}

.program-list div:nth-child(2) { background: var(--primary); }
.program-list div:nth-child(3) { background: #E7A90D; color: #14110F; }
.program-list div:nth-child(4) { background: var(--brand-green-dark); }

.program-list strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.05rem;
}

.program-list span {
  display: block;
  margin-top: 0.45rem;
  font-size: 0.9rem;
  line-height: 1.5;
  opacity: 0.92;
}

/* Ícone do programa: fica no topo do card; texto permanece embaixo */
.program-list .program-icon {
  margin: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.28);
  opacity: 1;
  transition: transform 0.2s ease, background 0.2s ease;
}

.program-list .program-icon [data-lucide] {
  width: 24px;
  height: 24px;
}

/* Card amarelo (texto escuro): ícone com fundo escuro translúcido */
.program-list div:nth-child(3) .program-icon {
  background: rgba(20,17,15,0.1);
  border-color: rgba(20,17,15,0.18);
}

.program-list div:hover .program-icon {
  transform: translateY(-2px) scale(1.05);
  background: rgba(255,255,255,0.3);
}

.program-list div:nth-child(3):hover .program-icon {
  background: rgba(20,17,15,0.16);
}

.program-list div {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.program-list div:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}



.community-section {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: center;
}

.help-panel {
  position: relative;
  overflow: hidden;
  padding: clamp(1.75rem, 3vw, 2.5rem);
  border-radius: 24px;
  color: #fff;
  background:
    radial-gradient(120% 120% at 100% 0%, rgba(246,190,36,0.28) 0%, transparent 55%),
    linear-gradient(150deg, var(--brand-green) 0%, var(--brand-green-dark) 100%);
  box-shadow: 0 24px 48px -20px rgba(0,90,84,0.55);
}

.help-panel h3 {
  font-size: clamp(1.25rem, 2vw, 1.6rem);
  color: #fff;
}

.help-panel p {
  color: rgba(255,255,255,0.9);
  line-height: 1.6;
  font-size: 0.96rem;
}

.help-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.1rem 0 1.5rem;
}

.help-actions span {
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.28);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  font-weight: 600;
  font-size: 0.88rem;
  color: #fff;
  transition: var(--transition);
}

.help-actions span:hover {
  background: rgba(255,255,255,0.24);
  transform: translateY(-1px);
}

.help-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.2);
}

.help-cta p {
  flex: 1;
  min-width: 180px;
  margin: 0;
  font-weight: 500;
}

.help-social {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.6rem 1rem;
  border-radius: 999px;
  background: #fff;
  color: var(--brand-green-dark);
  font-weight: 700;
  font-size: 0.9rem;
  white-space: nowrap;
  box-shadow: 0 8px 20px -8px rgba(0,0,0,0.35);
  transition: var(--transition);
}

.help-social svg {
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.help-social:hover {
  transform: translateY(-2px);
  color: #fff;
  background: linear-gradient(135deg, #F58529 0%, #DD2A7B 50%, #8134AF 100%);
  box-shadow: 0 12px 26px -8px rgba(221,42,123,0.5);
}

.help-social:hover svg {
  transform: rotate(-8deg) scale(1.08);
}

.landing-foot {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 1.5rem 0 0.5rem;
  color: var(--text-muted);
}

.landing-foot small {
  font-size: 0.78rem;
}

/* ===== LOGIN ===== */
.login-screen {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #F8F5EF;
  padding: clamp(1rem, 3vw, 2rem);
  overflow: auto;
}

.login-shell {
  --eye-x: 0px;
  --eye-y: 0px;
  --face-x: 0px;
  --face-y: 0px;
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(340px, 430px);
  align-items: stretch;
  width: min(1040px, 100%);
  min-height: min(720px, calc(100vh - 3rem));
  background: #FFFFFF;
  border: 1px solid rgba(236,232,226,0.9);
  border-radius: 26px;
  box-shadow: 0 28px 80px -30px rgba(20,17,15,0.32);
  overflow: hidden;
}

.login-card {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: #FFFFFF;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-left: 1px solid var(--border-light);
  border-radius: 0;
  box-shadow: -16px 0 48px -30px rgba(20,17,15,0.32);
  padding: clamp(2rem, 5vw, 3.5rem) clamp(1.5rem, 4vw, 2.6rem);
  width: 100%;
  max-width: none;
}

.login-character-panel {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 520px;
  padding: clamp(1.5rem, 4vw, 3rem);
  background: #F1EEE7;
  overflow: hidden;
}

.login-character-panel::before {
  content: '';
  position: absolute;
  inset: 9% 8%;
  border-radius: 32px;
  background: rgba(255,255,255,0.44);
  border: 1px solid rgba(255,255,255,0.72);
}

.creature-stage {
  position: relative;
  width: min(460px, 100%);
  aspect-ratio: 1.08;
  transform: translateY(4%);
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.creature-stage::after {
  content: '';
  position: absolute;
  left: 8%;
  right: 7%;
  bottom: 3%;
  height: 10px;
  border-radius: 999px;
  background: rgba(20,17,15,0.12);
  filter: blur(6px);
}

.login-creature {
  --look-x: 0px;
  --look-y: 0px;
  --face-x: 0px;
  --face-y: 0px;
  --body-x: 0px;
  --body-y: 0px;
  --body-rotate: 0deg;
  --body-scale: 1;
  --body-skew: 0deg;
  --base-rotate: 0deg;
  --life-look-x: 0px;
  --life-look-y: 0px;
  --life-eye-y: 0px;
  --life-eye-scale: 1;
  --life-brow-y: 0px;
  --life-brow-rotate: 0deg;
  --life-mouth-y: 0px;
  --life-mouth-rotate: 0deg;
  --life-mouth-scale: 1;
  --blink-close: 0%;
  --lid-pos: -112%;
  --eye-left-pos: 62%;
  --eye-right-pos: 79%;
  --brow-left-pos: 62%;
  --brow-right-pos: 79%;
  --mouth-pos: 68%;
  position: absolute;
  overflow: hidden;
  border: 1px solid rgba(20,17,15,0.12);
  box-shadow: 0 18px 36px -22px rgba(20,17,15,0.45), inset 0 1px 0 rgba(255,255,255,0.28);
  transform-origin: 50% 100%;
  transform: translate(var(--body-x), var(--body-y)) rotate(calc(var(--base-rotate) + var(--body-rotate))) skewX(var(--body-skew)) scale(var(--body-scale));
  transition: transform 0.22s cubic-bezier(.2,.8,.2,1), filter 0.25s ease;
  will-change: transform;
}

.login-creature::before,
.login-creature::after {
  content: '';
  position: absolute;
  z-index: 2;
  width: 18px;
  height: 4px;
  border-radius: 999px;
  background: #14110F;
  opacity: 0.38;
  transform: translate(var(--face-x), calc(var(--face-y) + var(--life-brow-y))) rotate(var(--life-brow-rotate));
  transition: left 0.32s cubic-bezier(.2,.8,.2,1), transform 0.22s ease, opacity 0.2s ease;
}

.creature-green {
  --creature-surface: #007A72;
  background: linear-gradient(160deg, #009A8F 0%, var(--brand-green) 64%, #00635D 100%);
}

.creature-charcoal {
  --creature-surface: #14110F;
  background: linear-gradient(160deg, #22211F 0%, #11100F 100%);
}

.creature-orange {
  --creature-surface: #F04422;
  background: linear-gradient(160deg, #FF8A2A 0%, var(--primary) 74%, #D63A18 100%);
}

.creature-yellow {
  --creature-surface: #F6BE24;
  background: linear-gradient(160deg, #FFD642 0%, var(--brand-yellow) 76%, #E3A810 100%);
}

.creature-tall {
  left: 30%;
  bottom: 11%;
  width: 32%;
  height: 66%;
  border-radius: 8px 8px 16px 14px;
  clip-path: polygon(8% 0, 100% 3%, 90% 100%, 0 100%);
  --base-rotate: 4deg;
}

.creature-slim {
  left: 54%;
  bottom: 9%;
  width: 18%;
  height: 48%;
  border-radius: 7px 7px 14px 14px;
  clip-path: polygon(9% 0, 100% 3%, 91% 100%, 0 100%);
  --base-rotate: 2deg;
}

.creature-round {
  left: 7%;
  bottom: 9%;
  width: 54%;
  height: 30%;
  border-radius: 999px 999px 8px 8px;
}

.creature-pill {
  right: 7%;
  bottom: 9%;
  width: 26%;
  height: 42%;
  border-radius: 999px 999px 10px 10px;
}

.creature-eye {
  position: absolute;
  z-index: 3;
  width: clamp(9px, 2vw, 15px);
  height: clamp(9px, 2vw, 15px);
  border-radius: 50%;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(20,17,15,0.18);
  transform: translate(var(--face-x), calc(var(--face-y) + var(--life-eye-y))) scaleY(var(--life-eye-scale));
  overflow: hidden;
  transition: left 0.32s cubic-bezier(.2,.8,.2,1), height 0.18s ease, transform 0.25s ease, opacity 0.2s ease;
}

.creature-eye::after {
  content: '';
  position: absolute;
  left: -2px;
  right: -2px;
  top: -2px;
  height: 65%;
  border-radius: 999px;
  background: var(--creature-surface);
  transform: translateY(calc(var(--lid-pos) + var(--blink-close)));
  transition: transform 0.22s ease;
}

.creature-eye span {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 45%;
  height: 45%;
  border-radius: 50%;
  background: #14110F;
  transform: translate(calc(-50% + var(--look-x) + var(--life-look-x)), calc(-50% + var(--look-y) + var(--life-look-y)));
  transition: transform 0.1s ease;
}

.creature-tall .eye-left { top: 10%; left: var(--eye-left-pos); }
.creature-tall .eye-right { top: 10%; left: var(--eye-right-pos); }
.creature-tall::before { top: 7%; left: var(--brow-left-pos); }
.creature-tall::after { top: 7%; left: var(--brow-right-pos); }
.creature-slim .eye-left { top: 9%; left: var(--eye-left-pos); }
.creature-slim .eye-right { top: 9%; left: var(--eye-right-pos); }
.creature-slim::before { top: 6%; left: var(--brow-left-pos); }
.creature-slim::after { top: 6%; left: var(--brow-right-pos); }
.creature-round .eye-left { top: 36%; left: var(--eye-left-pos); }
.creature-round .eye-right { top: 34%; left: var(--eye-right-pos); }
.creature-round::before { top: 30%; left: var(--brow-left-pos); }
.creature-round::after { top: 28%; left: var(--brow-right-pos); }
.creature-pill .eye-left { top: 18%; left: var(--eye-left-pos); }
.creature-pill::before { top: 14%; left: var(--brow-left-pos); }
.creature-pill::after { display: none; }

.creature-mouth {
  position: absolute;
  z-index: 3;
  width: 26px;
  height: 4px;
  border-radius: 999px;
  background: #14110F;
  opacity: 0.95;
  transform: translate(var(--face-x), calc(var(--face-y) + var(--life-mouth-y))) rotate(var(--life-mouth-rotate)) scale(var(--life-mouth-scale));
  transition: left 0.32s cubic-bezier(.2,.8,.2,1), transform 0.25s ease, width 0.25s ease, height 0.25s ease, border-radius 0.25s ease;
}

.creature-tall .creature-mouth { top: 24%; left: var(--mouth-pos); height: 28px; width: 7px; }
.creature-slim .creature-mouth { top: 26%; left: var(--mouth-pos); width: 20px; }
.creature-round .creature-mouth {
  top: 50%;
  left: var(--mouth-pos);
  width: 32px;
  height: 15px;
  border: 4px solid #14110F;
  border-top: 0;
  background: transparent;
  border-radius: 0 0 999px 999px;
}
.creature-pill .creature-mouth { top: 29%; left: var(--mouth-pos); width: 38px; }

.login-shell[data-creature-mood="email"] .login-creature,
.login-shell[data-creature-mood="curious"] .login-creature {
  filter: saturate(1.06);
}

.login-shell[data-creature-mood="email"] .creature-round .creature-mouth {
  height: 18px;
  width: 34px;
}

.login-shell[data-creature-mood="typing-email"] .creature-round .creature-mouth {
  height: 20px;
  width: 36px;
}

.login-shell[data-creature-mood="typing-email"] .creature-tall .creature-mouth,
.login-shell[data-creature-mood="typing-email"] .creature-slim .creature-mouth {
  height: 7px;
  width: 15px;
  border-radius: 999px;
}

.login-shell[data-creature-mood="email"] .creature-tall .creature-mouth {
  height: 9px;
  width: 16px;
  border-radius: 999px;
}

.login-shell[data-creature-mood="password"] .creature-tall {
  clip-path: polygon(12% 0, 98% 7%, 86% 100%, 0 100%);
}

.login-shell[data-creature-mood="password"] .creature-slim {
  clip-path: polygon(10% 0, 100% 0, 93% 100%, 0 100%);
}

.login-shell[data-creature-mood="password"] .creature-slim .creature-eye::after,
.login-shell[data-creature-mood="password"] .creature-pill .creature-eye::after {
  --lid-pos: -42%;
}

.login-shell[data-creature-mood="password"] .creature-round .creature-mouth {
  height: 4px;
  width: 30px;
  border: 0;
  background: #14110F;
  border-radius: 999px;
}

.login-shell[data-creature-mood="password"] .creature-pill .creature-mouth {
  transform: translate(var(--face-x), var(--face-y)) rotate(-4deg);
}

.login-shell[data-creature-mood="typing-password"] .creature-eye::after {
  --lid-pos: -55%;
}

.login-shell[data-creature-mood="typing-password"] .creature-round .creature-mouth,
.login-shell[data-creature-mood="typing-password"] .creature-pill .creature-mouth {
  height: 4px;
  border: 0;
  background: #14110F;
  border-radius: 999px;
}

.login-shell[data-creature-mood="typing-password"] .creature-tall .creature-mouth {
  height: 16px;
  width: 7px;
}

.login-shell[data-creature-mood="shy"] .login-creature {
  filter: saturate(0.95);
}

.login-shell[data-creature-mood="shy"] .creature-eye {
  height: 5px;
  transform: translate(var(--face-x), calc(var(--face-y) + var(--life-eye-y))) rotate(-8deg) scaleY(var(--life-eye-scale));
}

.login-shell[data-creature-mood="shy"] .creature-eye::after {
  --lid-pos: -18%;
}

.login-shell[data-creature-mood="shy"] .login-creature::before,
.login-shell[data-creature-mood="shy"] .login-creature::after {
  opacity: 0.42;
  transform: translate(calc(var(--face-x) - 2px), calc(var(--face-y) + var(--life-brow-y))) rotate(calc(-10deg + var(--life-brow-rotate)));
}

.login-shell[data-creature-mood="shy"] .creature-mouth {
  transform: translate(calc(var(--face-x) - 5px), calc(var(--face-y) + var(--life-mouth-y))) rotate(calc(-5deg + var(--life-mouth-rotate))) scale(var(--life-mouth-scale));
}

.login-shell[data-creature-mood="peek"] .login-creature {
  filter: saturate(0.98);
}

.login-shell[data-creature-mood="peek"] .creature-eye {
  height: 7px;
  transform: translate(var(--face-x), calc(var(--face-y) + var(--life-eye-y))) rotate(-5deg) scaleY(var(--life-eye-scale));
}

.login-shell[data-creature-mood="peek"] .creature-eye span {
  transform: translate(calc(-50% + 4px + var(--life-look-x)), calc(-50% + 1px + var(--life-look-y)));
}

.login-shell[data-creature-mood="peek"] .creature-eye::after {
  --lid-pos: -28%;
}

.login-shell[data-creature-mood="peek"] .login-creature::before,
.login-shell[data-creature-mood="peek"] .login-creature::after {
  opacity: 0.46;
  transform: translate(var(--face-x), calc(var(--face-y) + var(--life-brow-y))) rotate(calc(-8deg + var(--life-brow-rotate)));
}

.login-shell[data-creature-mood="peek"] .creature-mouth {
  transform: translate(var(--face-x), calc(var(--face-y) + var(--life-mouth-y))) rotate(calc(-5deg + var(--life-mouth-rotate))) scale(var(--life-mouth-scale));
}

.login-shell[data-creature-mood="peek"] .creature-round .creature-mouth {
  height: 4px;
  border: 0;
  background: #14110F;
  border-radius: 999px;
}

.login-shell[data-creature-mood="wrong"] .login-creature {
  animation: creature-wrong 0.55s cubic-bezier(.36,.07,.19,.97) both;
}

.login-shell[data-creature-mood="wrong"] .creature-tall {
  clip-path: polygon(8% 0, 100% 4%, 86% 100%, 0 78%, 13% 54%, 0 33%);
}

.login-shell[data-creature-mood="wrong"] .creature-eye {
  transform: translate(var(--face-x), calc(var(--face-y) + var(--life-eye-y) + 3px)) scaleY(var(--life-eye-scale));
}

.login-shell[data-creature-mood="wrong"] .creature-eye::after {
  --lid-pos: -38%;
}

.login-shell[data-creature-mood="wrong"] .login-creature::before,
.login-shell[data-creature-mood="wrong"] .login-creature::after {
  opacity: 0.5;
}

.login-shell[data-creature-mood="wrong"] .login-creature::before {
  transform: translate(var(--face-x), calc(var(--face-y) + var(--life-brow-y) + 2px)) rotate(calc(-14deg + var(--life-brow-rotate)));
}

.login-shell[data-creature-mood="wrong"] .login-creature::after {
  transform: translate(var(--face-x), calc(var(--face-y) + var(--life-brow-y) + 2px)) rotate(calc(14deg + var(--life-brow-rotate)));
}

.login-shell[data-creature-mood="wrong"] .creature-mouth {
  height: 12px;
  width: 24px;
  border: 3px solid #14110F;
  border-bottom: 0;
  background: transparent;
  border-radius: 999px 999px 0 0;
  transform: translate(var(--face-x), calc(var(--face-y) + var(--life-mouth-y) + 6px)) rotate(var(--life-mouth-rotate)) scale(var(--life-mouth-scale));
}

.login-shell[data-creature-mood="dizzy"] .login-creature {
  filter: saturate(0.92) contrast(0.98);
  animation: creature-dizzy-sway 0.58s ease-in-out infinite;
}

.login-shell[data-creature-mood="dizzy"] .creature-eye {
  height: clamp(10px, 2.1vw, 16px);
  transform: translate(var(--face-x), calc(var(--face-y) + var(--life-eye-y) + 1px)) rotate(var(--life-brow-rotate)) scaleY(var(--life-eye-scale));
}

.login-shell[data-creature-mood="dizzy"] .creature-eye::after {
  --lid-pos: -72%;
}

.login-shell[data-creature-mood="dizzy"] .creature-eye span {
  width: 38%;
  height: 38%;
  animation: creature-dizzy-pupil 0.46s linear infinite;
}

.login-shell[data-creature-mood="dizzy"] .eye-right span {
  animation-delay: -0.23s;
}

.login-shell[data-creature-mood="dizzy"] .login-creature::before,
.login-shell[data-creature-mood="dizzy"] .login-creature::after {
  opacity: 0.58;
}

.login-shell[data-creature-mood="dizzy"] .login-creature::before {
  transform: translate(var(--face-x), calc(var(--face-y) + var(--life-brow-y) - 1px)) rotate(calc(-22deg + var(--life-brow-rotate)));
}

.login-shell[data-creature-mood="dizzy"] .login-creature::after {
  transform: translate(var(--face-x), calc(var(--face-y) + var(--life-brow-y) + 4px)) rotate(calc(21deg + var(--life-brow-rotate)));
}

.login-shell[data-creature-mood="dizzy"] .creature-mouth {
  height: 8px;
  width: 24px;
  border: 3px solid #14110F;
  border-top: 0;
  background: transparent;
  border-radius: 0 0 999px 999px;
  transform: translate(var(--face-x), calc(var(--face-y) + var(--life-mouth-y) + 4px)) rotate(var(--life-mouth-rotate)) scale(var(--life-mouth-scale));
  animation: creature-dizzy-mouth 0.42s ease-in-out infinite;
}

.login-shell[data-creature-mood="dizzy"] .creature-round .creature-mouth,
.login-shell[data-creature-mood="dizzy"] .creature-pill .creature-mouth {
  height: 7px;
  width: 28px;
  border: 3px solid #14110F;
  border-top: 0;
  background: transparent;
  border-radius: 0 0 999px 999px;
}

.login-shell[data-creature-mood="success"] .login-creature {
  filter: saturate(1.16) contrast(1.03);
  animation: creature-celebrate 0.62s cubic-bezier(.2,1.15,.35,1) infinite;
}

.login-shell[data-creature-mood="success"] .creature-tall {
  animation-delay: 0s;
}

.login-shell[data-creature-mood="success"] .creature-slim {
  animation-delay: 0.08s;
}

.login-shell[data-creature-mood="success"] .creature-round {
  animation-delay: 0.14s;
}

.login-shell[data-creature-mood="success"] .creature-pill {
  animation-delay: 0.2s;
}

.login-shell[data-creature-mood="success"] .creature-eye {
  height: clamp(7px, 1.4vw, 11px);
  transform: translate(var(--face-x), calc(var(--face-y) + var(--life-eye-y))) rotate(var(--life-brow-rotate)) scaleY(0.72);
}

.login-shell[data-creature-mood="success"] .creature-eye::after {
  --lid-pos: -24%;
}

.login-shell[data-creature-mood="success"] .creature-eye span {
  transform: translate(calc(-50% + var(--look-x) + var(--life-look-x)), calc(-50% + var(--look-y) + var(--life-look-y) - 1px));
}

.login-shell[data-creature-mood="success"] .login-creature::before,
.login-shell[data-creature-mood="success"] .login-creature::after {
  opacity: 0.52;
}

.login-shell[data-creature-mood="success"] .login-creature::before {
  transform: translate(var(--face-x), calc(var(--face-y) + var(--life-brow-y) - 3px)) rotate(calc(-12deg + var(--life-brow-rotate)));
}

.login-shell[data-creature-mood="success"] .login-creature::after {
  transform: translate(var(--face-x), calc(var(--face-y) + var(--life-brow-y) - 3px)) rotate(calc(12deg + var(--life-brow-rotate)));
}

.login-shell[data-creature-mood="success"] .creature-mouth {
  width: 28px;
  height: 15px;
  border: 4px solid #14110F;
  border-top: 0;
  background: transparent;
  border-radius: 0 0 999px 999px;
  transform: translate(var(--face-x), calc(var(--face-y) + var(--life-mouth-y) - 1px)) rotate(var(--life-mouth-rotate)) scale(var(--life-mouth-scale));
  animation: creature-success-smile 0.5s ease-in-out infinite;
}

.login-shell[data-creature-mood="success"] .creature-tall .creature-mouth {
  width: 22px;
  height: 13px;
}

.login-shell[data-creature-mood="success"] .creature-round .creature-mouth,
.login-shell[data-creature-mood="success"] .creature-pill .creature-mouth {
  width: 32px;
  height: 17px;
  border: 4px solid #14110F;
  border-top: 0;
  background: transparent;
  border-radius: 0 0 999px 999px;
}

.login-shell[data-creature-mood="yawn"] .login-creature {
  filter: saturate(0.9);
}

.login-shell[data-creature-mood="yawn"] .creature-eye {
  height: 6px;
  transform: translate(var(--face-x), calc(var(--face-y) + var(--life-eye-y) + 2px)) scaleY(0.55);
}

.login-shell[data-creature-mood="yawn"] .creature-eye::after {
  --lid-pos: -12%;
}

.login-shell[data-creature-mood="yawn"] .login-creature::before,
.login-shell[data-creature-mood="yawn"] .login-creature::after {
  opacity: 0.34;
  transform: translate(var(--face-x), calc(var(--face-y) + var(--life-brow-y) + 3px)) rotate(calc(var(--life-brow-rotate) * 0.4));
}

.login-shell[data-creature-mood="yawn"] .creature-mouth {
  width: 24px;
  height: 28px;
  border: 4px solid #14110F;
  background: transparent;
  border-radius: 999px;
  transform: translate(var(--face-x), calc(var(--face-y) + var(--life-mouth-y) + 3px)) rotate(var(--life-mouth-rotate)) scale(var(--life-mouth-scale));
  animation: creature-yawn-mouth 1.9s ease-in-out infinite;
}

.login-shell[data-creature-mood="yawn"] .creature-round .creature-mouth,
.login-shell[data-creature-mood="yawn"] .creature-pill .creature-mouth {
  width: 28px;
  height: 24px;
  border: 4px solid #14110F;
  background: transparent;
  border-radius: 999px;
}

@keyframes creature-yawn-mouth {
  0%, 100% {
    transform: translate(var(--face-x), calc(var(--face-y) + var(--life-mouth-y) + 3px)) rotate(var(--life-mouth-rotate)) scale(0.78);
  }
  45%, 68% {
    transform: translate(var(--face-x), calc(var(--face-y) + var(--life-mouth-y) + 5px)) rotate(var(--life-mouth-rotate)) scale(1.12);
  }
}

@keyframes creature-dizzy-sway {
  0%, 100% {
    transform: translate(var(--body-x), var(--body-y)) rotate(calc(var(--base-rotate) + var(--body-rotate))) skewX(var(--body-skew)) scale(var(--body-scale));
  }
  25% {
    transform: translate(calc(var(--body-x) - 4px), calc(var(--body-y) - 2px)) rotate(calc(var(--base-rotate) + var(--body-rotate) - 3deg)) skewX(calc(var(--body-skew) - 1deg)) scale(var(--body-scale));
  }
  50% {
    transform: translate(var(--body-x), calc(var(--body-y) + 2px)) rotate(calc(var(--base-rotate) + var(--body-rotate) + 2deg)) skewX(var(--body-skew)) scale(var(--body-scale));
  }
  75% {
    transform: translate(calc(var(--body-x) + 4px), calc(var(--body-y) - 1px)) rotate(calc(var(--base-rotate) + var(--body-rotate) + 3deg)) skewX(calc(var(--body-skew) + 1deg)) scale(var(--body-scale));
  }
}

@keyframes creature-dizzy-pupil {
  0% {
    transform: translate(calc(-50% + var(--look-x) + var(--life-look-x) - 3px), calc(-50% + var(--look-y) + var(--life-look-y) - 2px));
  }
  25% {
    transform: translate(calc(-50% + var(--look-x) + var(--life-look-x) + 3px), calc(-50% + var(--look-y) + var(--life-look-y) - 1px));
  }
  50% {
    transform: translate(calc(-50% + var(--look-x) + var(--life-look-x) + 2px), calc(-50% + var(--look-y) + var(--life-look-y) + 3px));
  }
  75% {
    transform: translate(calc(-50% + var(--look-x) + var(--life-look-x) - 2px), calc(-50% + var(--look-y) + var(--life-look-y) + 2px));
  }
  100% {
    transform: translate(calc(-50% + var(--look-x) + var(--life-look-x) - 3px), calc(-50% + var(--look-y) + var(--life-look-y) - 2px));
  }
}

@keyframes creature-dizzy-mouth {
  0%, 100% {
    transform: translate(var(--face-x), calc(var(--face-y) + var(--life-mouth-y) + 4px)) rotate(calc(var(--life-mouth-rotate) - 7deg)) scaleX(0.88);
  }
  50% {
    transform: translate(var(--face-x), calc(var(--face-y) + var(--life-mouth-y) + 6px)) rotate(calc(var(--life-mouth-rotate) + 7deg)) scaleX(1.12);
  }
}

@keyframes creature-celebrate {
  0%, 100% {
    transform: translate(var(--body-x), var(--body-y)) rotate(calc(var(--base-rotate) + var(--body-rotate))) skewX(var(--body-skew)) scale(var(--body-scale));
  }
  34% {
    transform: translate(calc(var(--body-x) - 2px), calc(var(--body-y) - 18px)) rotate(calc(var(--base-rotate) + var(--body-rotate) - 5deg)) skewX(var(--body-skew)) scale(calc(var(--body-scale) + 0.035));
  }
  62% {
    transform: translate(calc(var(--body-x) + 2px), calc(var(--body-y) - 8px)) rotate(calc(var(--base-rotate) + var(--body-rotate) + 5deg)) skewX(var(--body-skew)) scale(calc(var(--body-scale) + 0.015));
  }
}

@keyframes creature-success-smile {
  0%, 100% {
    transform: translate(var(--face-x), calc(var(--face-y) + var(--life-mouth-y) - 1px)) rotate(calc(var(--life-mouth-rotate) - 2deg)) scaleX(0.96);
  }
  50% {
    transform: translate(var(--face-x), calc(var(--face-y) + var(--life-mouth-y) + 1px)) rotate(calc(var(--life-mouth-rotate) + 2deg)) scaleX(1.12);
  }
}

@keyframes creature-wrong {
  0%, 100% {
    transform: translate(var(--body-x), var(--body-y)) rotate(calc(var(--base-rotate) + var(--body-rotate))) skewX(var(--body-skew)) scale(var(--body-scale));
  }
  18% {
    transform: translate(calc(var(--body-x) - 8px), calc(var(--body-y) + 2px)) rotate(calc(var(--base-rotate) + var(--body-rotate) - 2deg)) skewX(var(--body-skew)) scale(var(--body-scale));
  }
  36% {
    transform: translate(calc(var(--body-x) + 7px), calc(var(--body-y) + 1px)) rotate(calc(var(--base-rotate) + var(--body-rotate) + 2deg)) skewX(var(--body-skew)) scale(var(--body-scale));
  }
  54% {
    transform: translate(calc(var(--body-x) - 5px), calc(var(--body-y) + 2px)) rotate(calc(var(--base-rotate) + var(--body-rotate) - 1deg)) skewX(var(--body-skew)) scale(var(--body-scale));
  }
  72% {
    transform: translate(calc(var(--body-x) + 3px), var(--body-y)) rotate(calc(var(--base-rotate) + var(--body-rotate) + 1deg)) skewX(var(--body-skew)) scale(var(--body-scale));
  }
}

.creature-tall { --wrong-rotate: 4deg; }
.creature-slim { --wrong-rotate: 2deg; }
.creature-round { --wrong-rotate: 0deg; }
.creature-pill { --wrong-rotate: 0deg; }

.login-shell.is-typing .login-creature {
  animation: creature-type-bob 0.34s ease both;
}

.login-shell.is-clicking .login-creature {
  animation: creature-click-pop 0.34s cubic-bezier(.2,1.4,.35,1) both;
}

@keyframes creature-type-bob {
  0%, 100% {
    transform: translate(var(--body-x), var(--body-y)) rotate(calc(var(--base-rotate) + var(--body-rotate))) skewX(var(--body-skew)) scale(var(--body-scale));
  }
  42% {
    transform: translate(calc(var(--body-x) + 1px), calc(var(--body-y) - 4px)) rotate(calc(var(--base-rotate) + var(--body-rotate) + 1deg)) skewX(var(--body-skew)) scale(calc(var(--body-scale) + 0.015));
  }
  72% {
    transform: translate(calc(var(--body-x) - 1px), calc(var(--body-y) + 1px)) rotate(calc(var(--base-rotate) + var(--body-rotate) - 0.7deg)) skewX(var(--body-skew)) scale(var(--body-scale));
  }
}

@keyframes creature-click-pop {
  0%, 100% {
    transform: translate(var(--body-x), var(--body-y)) rotate(calc(var(--base-rotate) + var(--body-rotate))) skewX(var(--body-skew)) scale(var(--body-scale));
  }
  45% {
    transform: translate(var(--body-x), calc(var(--body-y) - 7px)) rotate(calc(var(--base-rotate) + var(--body-rotate))) skewX(var(--body-skew)) scale(calc(var(--body-scale) + 0.045));
  }
}

.login-shell.is-arriving {
  --eye-x: 0px;
  --eye-y: 0px;
  --face-x: 0px;
  --face-y: 0px;
}

.login-shell.is-arriving .creature-stage {
  animation: creature-stage-arrive 0.9s ease both;
}

.login-shell.is-arriving .login-creature {
  filter: saturate(1.05);
}

.login-shell.is-arriving .creature-tall {
  animation: creature-arrive-tall 1.05s cubic-bezier(.16,1,.3,1) both;
}

.login-shell.is-arriving .creature-slim {
  animation: creature-arrive-slim 0.92s 0.18s cubic-bezier(.16,1,.3,1) both;
}

.login-shell.is-arriving .creature-round {
  animation: creature-arrive-round 0.95s 0.08s cubic-bezier(.16,1,.3,1) both;
}

.login-shell.is-arriving .creature-pill {
  animation: creature-arrive-pill 1s 0.22s cubic-bezier(.16,1,.3,1) both;
}

.login-shell.is-arriving .creature-eye,
.login-shell.is-arriving .creature-mouth,
.login-shell.is-arriving .login-creature::before,
.login-shell.is-arriving .login-creature::after {
  animation: creature-face-pop 0.46s 0.78s cubic-bezier(.2,1.5,.35,1) both;
}

@keyframes creature-stage-arrive {
  0% { opacity: 0; transform: translateY(10%) scale(0.96); }
  100% { opacity: 1; transform: translateY(4%) scale(1); }
}

@keyframes creature-arrive-tall {
  0% { opacity: 0; transform: translate(-34%, -70%) rotate(-13deg) scale(0.84); }
  58% { opacity: 1; transform: translate(2%, 4%) rotate(7deg) scale(1.03); }
  78% { transform: translate(-1%, -2%) rotate(2deg) scale(0.99); }
  100% { opacity: 1; transform: translate(0, 0) rotate(4deg) scale(1); }
}

@keyframes creature-arrive-slim {
  0% { opacity: 0; transform: translate(18%, -52%) rotate(12deg) scale(0.78); }
  62% { opacity: 1; transform: translate(-5%, 5%) rotate(-4deg) scale(1.04); }
  82% { transform: translate(2%, -1%) rotate(4deg) scale(0.98); }
  100% { opacity: 1; transform: translate(0, 0) rotate(2deg) scale(1); }
}

@keyframes creature-arrive-round {
  0% { opacity: 0; transform: translate(-78%, 34%) rotate(-9deg) scale(0.9); }
  56% { opacity: 1; transform: translate(8%, -4%) rotate(4deg) scale(1.04); }
  76% { transform: translate(-3%, 2%) rotate(-2deg) scale(0.99); }
  100% { opacity: 1; transform: translate(0, 0) rotate(0deg) scale(1); }
}

@keyframes creature-arrive-pill {
  0% { opacity: 0; transform: translate(82%, 22%) rotate(10deg) scale(0.88); }
  58% { opacity: 1; transform: translate(-8%, -3%) rotate(-5deg) scale(1.05); }
  78% { transform: translate(3%, 1%) rotate(2deg) scale(0.99); }
  100% { opacity: 1; transform: translate(0, 0) rotate(0deg) scale(1); }
}

@keyframes creature-face-pop {
  0%, 42% { opacity: 0; transform: translate(var(--face-x), calc(var(--face-y) + 4px)) scale(0.72); }
  72% { opacity: 1; transform: translate(var(--face-x), calc(var(--face-y) - 1px)) scale(1.18); }
  100% { opacity: 1; transform: translate(var(--face-x), var(--face-y)) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .login-shell.is-arriving .creature-stage,
  .login-shell.is-arriving .login-creature,
  .login-shell.is-arriving .creature-eye,
  .login-shell.is-arriving .creature-mouth,
  .login-shell.is-arriving .login-creature::before,
  .login-shell.is-arriving .login-creature::after {
    animation: none;
  }
}

.login-back {
  position: absolute;
  top: 1rem;
  left: 1rem;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem 0.4rem 0.5rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.72);
  border: 1px solid rgba(236,232,226,0.9);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.85rem;
  transition: var(--transition);
}

.login-back:hover {
  background: var(--surface-muted);
  color: var(--text);
}

.login-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.3rem;
  margin-bottom: 1.25rem;
  background: var(--surface-muted);
  border-radius: 999px;
}

.login-tabs button {
  flex: 1;
  padding: 0.6rem 0.75rem;
  border-radius: 999px;
  border: 0;
  background: transparent;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: var(--transition);
}

.login-tabs button.active {
  background: var(--white);
  color: var(--text);
  box-shadow: var(--shadow-xs);
}

.login-tabs button:not(.active):hover {
  color: var(--text);
}

.inline-options {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.9rem;
}

.inline-options input {
  width: auto;
}

.password-strength {
  height: 6px;
  background: var(--border);
  border-radius: 10px;
  margin-top: 0.35rem;
  overflow: hidden;
}

.password-strength #reg-strength-bar,
.password-strength #reset-strength-bar {
  height: 100%;
  width: 0%;
  background: var(--danger);
  transition: width 0.2s ease, background 0.2s ease;
}

.login-logo {
  text-align: center;
  margin-bottom: 1.75rem;
}

.login-logo-img {
  width: min(260px, 78%);
  height: auto;
  object-fit: contain;
  margin-bottom: 1rem;
  filter: drop-shadow(0 12px 20px rgba(20,17,15,0.08));
}

.login-logo h1 {
  font-size: 1.5rem;
  color: var(--text);
  line-height: 1.2;
  letter-spacing: 0;
}

.login-logo p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 0.4rem;
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 3rem;
}

.password-toggle {
  position: absolute;
  right: 0.55rem;
  top: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  transform: translateY(-50%);
  transition: var(--transition);
}

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

.password-toggle [data-lucide] {
  width: 18px;
  height: 18px;
}

/* ===== RECUPERAÇÃO DE SENHA ===== */
.forgot-link {
  display: block;
  width: 100%;
  margin-top: 0.85rem;
  background: transparent;
  border: 0;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.85rem;
  text-align: center;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: transparent;
  transition: var(--transition);
}

.forgot-link:hover {
  color: var(--primary);
  text-decoration-color: var(--primary);
}

.auth-subtext {
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text-secondary);
  margin-bottom: 1.1rem;
}

/* ===== FORMS ===== */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
  font-size: 0.875rem;
  color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--text);
  font-size: 0.95rem;
  transition: var(--transition);
  outline: none;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-muted);
}

.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover {
  border-color: #D8D2CA;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(240,68,34,0.12);
}

.form-group input:focus-visible,
.form-group select:focus-visible,
.form-group textarea:focus-visible,
.btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.form-group textarea {
  min-height: 80px;
  resize: vertical;
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin: 0.75rem 0 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.4;
}

.checkbox-row input {
  width: 18px;
  height: 18px;
  margin-top: 0.08rem;
  accent-color: var(--primary);
  flex: 0 0 auto;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.error-message {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 0.75rem;
  text-align: center;
  min-height: 1.2em;
}

.login-form-shake {
  animation: login-form-shake 0.42s cubic-bezier(.36,.07,.19,.97);
}

@keyframes login-form-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(3px); }
}

/* ===== BOTOES ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.25rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.92rem;
  font-family: var(--font-body);
  letter-spacing: -0.01em;
  transition: var(--transition);
  border: none;
}

.btn-primary {
  background: var(--text);
  color: var(--white);
  box-shadow: 0 6px 16px -8px rgba(20,17,15,0.5);
}

.btn-primary:hover {
  background: var(--primary);
  box-shadow: var(--shadow-primary);
  transform: translateY(-1px);
}

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

.btn-secondary:hover {
  background: var(--white);
  border-color: var(--text);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 6px 16px -8px rgba(220,38,38,0.5);
}

.btn-danger:hover {
  filter: brightness(0.94);
  transform: translateY(-1px);
}

.btn-success {
  background: var(--success);
  color: #fff;
  box-shadow: 0 6px 16px -8px rgba(22,163,74,0.5);
}

.btn-success:hover {
  filter: brightness(0.94);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-outline:hover {
  background: var(--surface-muted);
  border-color: var(--text);
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
}

.btn-full {
  width: 100%;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ===== APP LAYOUT ===== */
.app {
  display: flex;
  min-height: 100vh;
}

/* ===== MOBILE HEADER ===== */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: rgba(255,255,255,0.78);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid var(--border);
  align-items: center;
  padding: 0 1rem;
  z-index: 100;
  gap: 0.75rem;
}

body.theme-dark .mobile-header {
  background: rgba(22,21,19,0.78);
}




.mobile-logo {
  flex: 1;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  color: var(--text);
}

.mobile-logo img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.header-actions {
  position: relative;
}

.badge-notification {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: var(--white);
  border-radius: 999px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  font-size: 0.7rem;
  font-weight: 700;
  box-shadow: 0 4px 12px -4px rgba(240,68,34,0.45);
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--border);
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  z-index: 200;
  overflow-y: auto;
  scrollbar-width: thin;
}

.sidebar-header {
  padding: 1.25rem 1rem 0.5rem;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  width: 100%;
}

.sidebar-logo img {
  width: min(210px, 100%);
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 8px 14px rgba(20,17,15,0.05));
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  margin: 0.5rem 0.5rem 0;
  background: var(--surface-muted);
  border-radius: var(--radius);
  transition: var(--transition);
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.82rem;
  font-family: var(--font-display);
  color: #fff;
  background: linear-gradient(135deg, var(--primary) 0%, #FF8C42 100%);
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

.user-info {
  min-width: 0;
  flex: 1;
}

.user-info strong {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-info small {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.sidebar-nav {
  flex: 1;
  padding: 0.75rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.9rem;
  border-radius: 10px;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
  position: relative;
}

.nav-link:hover {
  color: var(--text);
  background: var(--surface-muted);
}

.nav-link.active {
  color: var(--primary);
  background: var(--primary-light);
  font-weight: 600;
}

.nav-link.active [data-lucide] {
  color: var(--primary);
}

.nav-link [data-lucide] {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  transition: transform 0.18s ease;
}

.nav-link:hover [data-lucide] {
  transform: scale(1.08);
}

.nav-badge {
  margin-left: auto;
  background: var(--primary);
  color: var(--white);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 20px;
  text-align: center;
}

.nav-divider {
  height: 1px;
  background: var(--border-light);
  margin: 0.6rem 0.5rem;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20,17,15,0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 150;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ===== MAIN CONTENT ===== */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  background: var(--bg);
}

.content-wrapper {
  /* --pad e herdado pelo .page-header fixo, que precisa da mesma medida. */
  --pad: 2rem;
  padding: var(--pad);
  max-width: 1400px;
  margin: 0 auto;
  animation: pageIn 0.32s cubic-bezier(.4,0,.2,1);
}

@keyframes pageIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== PAGE HEADER ===== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.page-header h2 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text);
}

.page-subtitle {
  color: var(--text-secondary);
  font-size: 0.92rem;
  margin-top: 0.2rem;
}

/* ===== CARDS DE METRICA ===== */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.metric-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-xs);
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--primary-soft);
}

.metric-icon {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.metric-card:hover .metric-icon {
  transform: scale(1.06);
}

.metric-icon.orange { background: var(--primary-light); color: var(--primary); }
.metric-icon.green { background: var(--success-bg); color: var(--success); }
.metric-icon.red { background: var(--danger-bg); color: var(--danger); }
.metric-icon.blue { background: var(--info-bg); color: var(--info); }

.metric-info h3 {
  font-size: 1.65rem;
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-weight: 700;
}

.metric-info p {
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-top: 0.2rem;
}

/* ===== CHART CONTAINERS ===== */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.chart-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-xs);
  transition: var(--transition);
}

.chart-card:hover {
  border-color: var(--primary-soft);
}

.chart-card h4 {
  margin-bottom: 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.chart-wrapper {
  position: relative;
  height: 260px;
}

/* ===== TABELAS ===== */
.table-container {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  /* `clip` em vez de `hidden`: recorta os cantos igual, mas sem criar contexto
     de rolagem — o que anularia o `position: sticky` do cabeçalho da tabela.
     A linha `hidden` fica antes como reserva para navegador que não conhece
     `clip` (nele o cabeçalho não gruda, mas os cantos seguem recortados). */
  overflow: hidden;
  overflow: clip;
}

.table-subtitle {
  padding: 0.75rem 1.25rem 0;
  color: var(--text-secondary);
  font-size: 0.88rem;
  /* Era `display: flex; gap: 1rem`, mas o conteúdo é uma frase: cada palavra
     virava item de flex e ganhava 1rem de espaço entre si. */
  line-height: 1.5;
}

.table-toolbar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--border-light);
  flex-wrap: wrap;
}

.table-toolbar .search-input {
  flex: 1;
  min-width: 200px;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  font-size: 0.9rem;
  background: var(--white);
  color: var(--text);
  transition: var(--transition);
}

.table-toolbar .search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(240,68,34,0.12);
}

.table-toolbar select {
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition);
}

.table-toolbar select:focus {
  border-color: var(--primary);
}

.table-toolbar select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Campo de busca do financeiro */
.fin-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 200px;
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--text-light);
  transition: var(--transition);
}

.fin-search:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(240,68,34,0.12);
}

.fin-search [data-lucide] {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.fin-search input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 0.9rem;
  min-width: 0;
}

/* Botao/calendario do financeiro */
.fin-date {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--text-light);
  cursor: pointer;
  transition: var(--transition);
}

.fin-date:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(240,68,34,0.12);
}

.fin-date [data-lucide] {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.fin-date input {
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 0.9rem;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  background: var(--surface-muted);
  padding: 0.7rem 1rem;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

tbody td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.9rem;
  color: var(--text);
}

tbody tr {
  transition: background 0.15s ease;
}

tbody tr:hover {
  background: var(--surface-muted);
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr.row-warning {
  background: var(--warning-bg);
}

tbody tr.row-danger {
  background: var(--danger-bg);
}

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  line-height: 1.3;
}

.badge-green { background: var(--success-bg); color: var(--success); }
.badge-red { background: var(--danger-bg); color: var(--danger); }
.badge-orange { background: var(--primary-light); color: var(--primary); }
.badge-blue { background: var(--info-bg); color: var(--info); }
.badge-gray { background: var(--surface-muted); color: var(--text-secondary); }
.badge-purple { background: #F3E8FF; color: #7C3AED; }
.badge-black { background: var(--text); color: var(--white); }
.badge-yellow { background: var(--warning-bg); color: var(--warning); }

body.theme-dark .badge-purple {
  background: rgba(167,139,250,0.14);
  color: #A78BFA;
}

/* ===== ROLE BADGES ===== */
.role-master { background: var(--text); color: var(--white); }
.role-admin { background: var(--primary); color: var(--white); }
.role-financeiro { background: var(--success); color: #fff; }
.role-membro { background: var(--info); color: #fff; }
.role-doador { background: #7C3AED; color: #fff; }

body.theme-dark .role-master { background: var(--surface-muted); color: var(--text); border: 1px solid var(--border); }

/* ===== CARDS (Grid de membros, reunioes) ===== */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-xs);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--primary-soft);
}

body.theme-dark .card,
body.theme-dark .profile-card,
body.theme-dark .finance-card,
body.theme-dark .metric-card,
body.theme-dark .chart-card,
body.theme-dark .alerts-card,
body.theme-dark .multi-select {
  background: var(--white);
  border: 1px solid var(--border);
}

body.theme-dark .login-screen {
  background: #11100E;
}

body.theme-dark .login-shell {
  background: #181714;
  border-color: var(--border);
}

body.theme-dark .login-character-panel {
  background: #1F1D19;
}

body.theme-dark .login-character-panel::before {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.08);
}

body.theme-dark .login-card {
  background: #181714;
  border-left: 1px solid var(--border);
}

body.theme-dark .login-back {
  background: rgba(28,27,25,0.72);
  border-color: var(--border);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.card-body p {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-light);
}

/* ===== RESUMO FINANCEIRO ===== */
.finance-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.finance-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-xs);
  text-align: left;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.finance-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--primary-soft);
}

.finance-card .value {
  font-size: 1.6rem;
  font-weight: 700;
  font-family: var(--font-display);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.finance-card .label {
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-top: 0.35rem;
}

.finance-card.entrada .value { color: var(--success); }
.finance-card.saida .value { color: var(--danger); }
.finance-card.pendente .value { color: var(--warning); }

/* ===== BAZAR BENEFICENTE ===== */
.bazar-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.86fr) minmax(0, 1.4fr);
  gap: 1rem;
  align-items: start;
}

.bazar-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-light);
}

.bazar-section-header h3 {
  font-size: 1rem;
  letter-spacing: 0;
}

.bazar-section-header p {
  color: var(--text-secondary);
  font-size: 0.84rem;
  margin-top: 0.15rem;
}

.bazar-price-grid {
  display: grid;
  gap: 0;
}

.bazar-price-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 136px;
  gap: 0.8rem;
  align-items: center;
  padding: 0.82rem 1.25rem;
  border-bottom: 1px solid var(--border-light);
}

.bazar-price-item:last-child {
  border-bottom: 0;
}

.bazar-price-item > span {
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.3;
}

.bazar-money-input {
  display: flex;
  align-items: center;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  overflow: hidden;
}

.bazar-money-input span {
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  padding: 0 0.65rem;
  background: var(--surface-muted);
  color: var(--text-secondary);
  border-right: 1px solid var(--border);
  font-size: 0.78rem;
  font-weight: 700;
}

.bazar-money-input input {
  min-width: 0;
  width: 100%;
  height: 100%;
  border: 0;
  outline: none;
  padding: 0 0.65rem;
  background: transparent;
  color: var(--text);
  text-align: right;
  font-weight: 700;
}

.bazar-payment-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.bazar-payment-options label {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.62rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--text);
  font-weight: 600;
  min-height: 42px;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
}

.bazar-payment-options input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.bazar-payment-options label:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary-dark);
}

.bazar-payment-options label:has(input:focus-visible) {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.bazar-payment-options label:has(input:disabled) {
  opacity: 0.55;
  cursor: not-allowed;
}

.bazar-confirm-text {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  line-height: 1.6;
}

.bazar-sale-items {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--white);
}

.bazar-sale-head,
.bazar-sale-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 110px 84px 120px;
  gap: 0.75rem;
  align-items: center;
}

.bazar-sale-head {
  padding: 0.7rem 0.9rem;
  background: var(--surface-muted);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.bazar-sale-row {
  padding: 0.68rem 0.9rem;
  border-top: 1px solid var(--border-light);
  color: var(--text);
}

.bazar-sale-row > span {
  font-weight: 600;
  line-height: 1.25;
}

.bazar-sale-row strong {
  font-size: 0.88rem;
}

.bazar-sale-row input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--text);
  padding: 0.52rem 0.55rem;
  text-align: center;
  font-weight: 700;
}

.bazar-total-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border-radius: var(--radius);
  background: var(--text);
  color: var(--white);
}

.bazar-total-bar span {
  color: inherit;
  font-weight: 700;
}

.bazar-total-bar strong {
  color: inherit;
  font-family: var(--font-display);
  font-size: 1.35rem;
}

.bazar-close-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.bazar-close-grid div {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  padding: 0.9rem;
}

.bazar-close-grid span {
  display: block;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.bazar-close-grid strong {
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.15rem;
}

.bazar-close-table {
  margin-bottom: 1rem;
  max-height: 320px;
  overflow: auto;
}
.finance-card.saldo .value { color: var(--primary); }

/* ===== PROGRESS BAR ===== */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--border-light);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar .fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s cubic-bezier(.4,0,.2,1);
}

.progress-bar .fill.green { background: var(--success); }
.progress-bar .fill.orange { background: var(--warning); }
.progress-bar .fill.red { background: var(--danger); }

/* ===== ALERTS LIST ===== */
.alerts-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-xs);
}

.alerts-card h4 {
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.alert-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.alert-item.alert-today {
  background: var(--primary-light);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  border: 1px solid var(--primary-soft);
  color: var(--text);
}

.alert-item:last-child {
  border-bottom: none;
}

.alert-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.alert-dot.orange { background: var(--warning); }
.alert-dot.red { background: var(--danger); }
.alert-dot.blue { background: var(--info); }

/* ===== MODAL ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20,17,15,0.45);
  backdrop-filter: blur(8px) saturate(140%);
  -webkit-backdrop-filter: blur(8px) saturate(140%);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

body.theme-dark .modal-overlay {
  background: rgba(0,0,0,0.6);
}

.modal-overlay.active {
  display: flex;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.28s cubic-bezier(.4,0,.2,1);
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  font-size: 1.3rem;
  line-height: 1;
  color: var(--text-muted);
  transition: var(--transition);
}

.modal-close:hover {
  background: var(--surface-muted);
  color: var(--text);
  transform: rotate(90deg);
}

.modal-body {
  padding: 1.5rem;
}

.modal-body .form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

/* ===== COMMAND PALETTE ===== */
.command-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1800;
  padding: 12vh 1rem 1rem;
  background: rgba(20,17,15,0.35);
  backdrop-filter: blur(8px);
}

.command-overlay.active {
  display: block;
}

.command-palette {
  width: min(560px, 100%);
  margin: 0 auto;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.command-search {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-light);
}

.command-search [data-lucide] {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
}

.command-search input {
  border: 0;
  outline: 0;
  width: 100%;
  background: transparent;
  color: var(--text);
  font-size: 1rem;
}

.command-list {
  padding: 0.4rem;
}

.command-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  text-align: left;
}

.command-item:hover,
.command-item.active {
  background: var(--surface-muted);
}

.command-item [data-lucide] {
  width: 18px;
  height: 18px;
  color: var(--primary);
}

/* ===== TOAST ===== */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.85rem 1.15rem;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 500;
  background: var(--text);
  color: var(--white);
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.32s cubic-bezier(.4,0,.2,1);
  max-width: 380px;
  border-left: 3px solid var(--primary);
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.info { border-left-color: var(--info); }

.toast-action {
  margin-left: auto;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.4);
  color: #fff;
  font-weight: 700;
  font-size: 0.82rem;
  padding: 0.3rem 0.7rem;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.toast-action:hover { background: rgba(255,255,255,0.15); }
body.theme-dark .toast-action { border-color: var(--border); color: var(--text); }

/* Spinner usado no estado de carregando dos botões */
.top-doadores-list { display: flex; flex-direction: column; gap: 0.4rem; margin-top: 0.5rem; }
.top-doador-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.5rem 0.25rem;
  border-bottom: 1px solid var(--border-light);
}
.top-doador-item:last-child { border-bottom: none; }
.top-doador-rank {
  flex-shrink: 0;
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary); color: var(--white);
  border-radius: 50%; font-size: 0.75rem; font-weight: 700;
}
.top-doador-nome { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-doador-valor { color: var(--success); white-space: nowrap; }

/* Filtros recolhíveis do financeiro: no desktop fluem na toolbar; no mobile viram painel recolhível */
.fin-filtros { display: contents; }
.fin-filtros-btn { display: none; }

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.25rem;
  border-top: 1px solid var(--border-light);
  font-size: 0.85rem;
  color: var(--text-light);
}

.btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  vertical-align: -2px;
  animation: btnSpin 0.6s linear infinite;
}
@keyframes btnSpin { to { transform: rotate(360deg); } }

body.theme-dark .toast {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  color: var(--text);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(12px) scale(0.96); }
}

/* ===== SKELETON LOADING ===== */
.skeleton {
  background: linear-gradient(90deg, var(--border-light) 25%, var(--border) 50%, var(--border-light) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

body.theme-dark .skeleton {
  background: linear-gradient(90deg, #1f2937 25%, #111827 50%, #1f2937 75%);
}

.skeleton-text {
  height: 1rem;
  margin-bottom: 0.5rem;
}

.skeleton-card {
  height: 100px;
}

.skeleton-chart {
  height: 260px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===== EMPTY STATE ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-secondary);
}

.empty-state [data-lucide] {
  width: 40px;
  height: 40px;
  margin-bottom: 0.9rem;
  opacity: 0.4;
}

.empty-state strong {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--text);
}

.empty-state p {
  /* Uma linha explicando para que serve a tela: quem chega na primeira vez
     precisa saber o que fazer, não só que a lista está vazia. */
  max-width: 42ch;
  margin-top: 0.3rem;
  font-size: 0.89rem;
  line-height: 1.5;
}

.empty-state .btn {
  margin-top: 1.25rem;
}

/* Em grade de cards o estado vazio ocupa a linha toda. */
.cards-grid .empty-state {
  grid-column: 1 / -1;
}

/* ===== GLOBAIS / UTILS ===== */
::selection {
  background: var(--primary-soft);
  color: var(--text);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
  border: 2px solid var(--bg);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

button:focus:not(:focus-visible) {
  outline: none;
}

/* Dark-mode adjustments para landing/login */
body.theme-dark .landing-bg .blob-1 {
  background: radial-gradient(circle at center, rgba(255,123,51,0.35) 0%, transparent 70%);
}

body.theme-dark .landing-bg .blob-2 {
  background: radial-gradient(circle at center, rgba(255,123,51,0.18) 0%, transparent 70%);
}

body.theme-dark .landing-bg .grain {
  background-image: radial-gradient(rgba(255,255,255,0.04) 1px, transparent 1px);
  mix-blend-mode: screen;
}

body.theme-dark .login-bg .blob-1,
body.theme-dark .login-bg .blob-2 {
  background: radial-gradient(circle at center, rgba(255,123,51,0.25) 0%, transparent 70%);
}

body.theme-dark .btn-ghost,
body.theme-dark .eyebrow,
body.theme-dark .feature {
  background: rgba(255,255,255,0.04);
}

body.theme-dark .feature:hover {
  background: rgba(255,255,255,0.08);
}

/* Animações suaves nas page sections */
.metrics-grid,
.charts-grid,
.cards-grid,
.finance-summary,
.table-container,
.alerts-card {
  animation: pageIn 0.32s cubic-bezier(.4,0,.2,1);
}

/* Stagger sutil entre cards */
.metrics-grid > *:nth-child(1) { animation-delay: 0ms; }
.metrics-grid > *:nth-child(2) { animation-delay: 40ms; }
.metrics-grid > *:nth-child(3) { animation-delay: 80ms; }
.metrics-grid > *:nth-child(4) { animation-delay: 120ms; }
.metrics-grid > * { animation: cardIn 0.4s cubic-bezier(.4,0,.2,1) backwards; }

.cards-grid > * { animation: cardIn 0.35s cubic-bezier(.4,0,.2,1) backwards; }
.cards-grid > *:nth-child(1) { animation-delay: 0ms; }
.cards-grid > *:nth-child(2) { animation-delay: 30ms; }
.cards-grid > *:nth-child(3) { animation-delay: 60ms; }
.cards-grid > *:nth-child(4) { animation-delay: 90ms; }
.cards-grid > *:nth-child(5) { animation-delay: 120ms; }
.cards-grid > *:nth-child(6) { animation-delay: 150ms; }

@keyframes cardIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Respeita preferência do usuário */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.empty-state p {
  font-size: 0.95rem;
}

/* ===== MULTI SELECT ===== */
.multi-select {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  max-height: 150px;
  overflow-y: auto;
  padding: 0.4rem;
  background: var(--white);
}

.multi-select label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.55rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.15s ease;
}

.multi-select label:hover {
  background: var(--surface-muted);
}

.multi-select input[type="checkbox"] {
  width: auto;
  accent-color: var(--primary);
}

/* ===== PERFIL ===== */
.profile-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2rem;
  box-shadow: var(--shadow-xs);
  max-width: 600px;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-light);
}

.profile-avatar {
  width: 72px;
  height: 72px;
  font-size: 1.5rem;
}

.avatar-upload {
  position: relative;
  display: inline-block;
}

.avatar-clickable {
  cursor: pointer;
}

.avatar-camera {
  position: absolute;
  bottom: -4px;
  right: -4px;
  background: var(--primary);
  color: var(--white);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  pointer-events: none;
}

.avatar-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
}

.avatar-overlay.show {
  opacity: 1;
  pointer-events: all;
}

.avatar-upload:hover .avatar-overlay {
  opacity: 1;
  pointer-events: all;
}

.overlay-icon {
  width: 22px;
  height: 22px;
  opacity: 0.9;
}

.avatar-menu {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translate(-50%, 10px);
  background: #fff;
  color: var(--text);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 0.35rem 0;
  min-width: 140px;
  display: none;
  z-index: 5;
}

.avatar-menu.show {
  display: block;
}

.avatar-menu button {
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.9rem;
  background: transparent;
  border: none;
  font-weight: 600;
  font-size: 0.9rem;
  color: inherit;
}

.avatar-menu button:hover {
  background: var(--primary-light);
}

.avatar-menu button.danger {
  color: var(--danger);
}

.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  background: var(--white);
  cursor: pointer;
  transition: var(--transition);
}

.dropzone.drag {
  border-color: var(--primary);
  background: var(--primary-light);
}

.dropzone [data-lucide] {
  width: 28px;
  height: 28px;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.or-separator {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0.75rem 0;
}

.upload-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}

.profile-info h3 {
  font-size: 1.25rem;
}

.profile-info p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.profile-section {
  margin-top: 2rem;
}

.profile-section h4 {
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-light);
}

/* ===== APROVAÇÕES DE MEMBROS ===== */
.approvals-panel {
  border: 1px solid var(--primary-soft);
  background: var(--primary-light);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin-bottom: 1.25rem;
}

.approvals-head { margin-bottom: 0.85rem; }

.approvals-title {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  color: var(--text);
}

.approvals-title [data-lucide] { width: 18px; height: 18px; color: var(--primary); }

.approvals-count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--primary);
  color: var(--white);
  font-size: 0.72rem;
  font-weight: 700;
}

.approvals-list { display: flex; flex-direction: column; gap: 0.5rem; }

.approval-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.9rem;
}

.approval-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.approval-info strong { font-size: 0.95rem; letter-spacing: -0.01em; }
.approval-info span { font-size: 0.85rem; color: var(--text-secondary); word-break: break-word; }
.approval-info small { font-size: 0.76rem; color: var(--text-muted); }

.approval-actions { display: flex; gap: 0.4rem; flex-shrink: 0; }

/* Modal de aprovação */
.approve-summary {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-light);
}
.approve-summary strong { display: block; font-size: 1.05rem; letter-spacing: -0.01em; }
.approve-summary span { font-size: 0.88rem; color: var(--text-secondary); }
.approve-hint { font-size: 0.88rem; color: var(--text-secondary); margin-bottom: 1rem; }

@media (max-width: 560px) {
  .approval-item { flex-wrap: wrap; }
  .approval-actions { width: 100%; }
  .approval-actions .btn { flex: 1; }
}

/* ===== AGENDA DE REUNIÕES ===== */
.agenda-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
}

.agenda-chip {
  padding: 0.45rem 0.95rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.85rem;
  transition: var(--transition);
}

.agenda-chip:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

.agenda-chip.active {
  background: var(--text);
  color: var(--white);
  border-color: var(--text);
}

.agenda-group {
  margin-bottom: 1.75rem;
}

.agenda-group-muted .meeting-card {
  opacity: 0.72;
}

.agenda-group-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
}

.agenda-group-title [data-lucide] {
  width: 16px;
  height: 16px;
  color: var(--primary);
}

.agenda-count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 700;
}

/* Card de reunião */
.meeting-card {
  display: flex;
  gap: 1rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  padding: 1rem 1.1rem;
  margin-bottom: 0.75rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.meeting-card:hover {
  border-color: var(--primary-soft);
  box-shadow: var(--shadow);
}

.meeting-card.is-today {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.meeting-card.status-cancelada { opacity: 0.6; }

/* Bloco de data (chip calendário) */
.meeting-date {
  flex-shrink: 0;
  width: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0;
  border-radius: 12px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  line-height: 1;
}

.meeting-card.is-today .meeting-date {
  background: var(--primary-light);
  border-color: var(--primary-soft);
}

.meeting-date-dow {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 700;
}

.meeting-date-day {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.03em;
  margin: 2px 0;
}

.meeting-card.is-today .meeting-date-day { color: var(--primary); }

.meeting-date-mon {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
}

.meeting-main { flex: 1; min-width: 0; }

.meeting-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.meeting-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-right: auto;
}

.meeting-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.meeting-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.meeting-meta [data-lucide] {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
}

.meeting-link {
  color: var(--primary);
  font-weight: 600;
}

.meeting-progress {
  height: 5px;
  background: var(--border-light);
  border-radius: 999px;
  overflow: hidden;
  margin: 0.7rem 0 0.2rem;
}

.meeting-progress-fill {
  height: 100%;
  background: var(--success);
  border-radius: 999px;
  transition: width 0.4s cubic-bezier(.4,0,.2,1);
}

/* Bloco "sua presença" */
.meeting-presence {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
}

.meeting-presence span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.meeting-presence [data-lucide] { width: 16px; height: 16px; }

.meeting-presence.is-confirmed { background: var(--success-bg); color: var(--success); }
.meeting-presence.is-declined { background: var(--danger-bg); color: var(--danger); }
.meeting-presence.is-pending { background: var(--warning-bg); color: var(--warning); }

.presence-actions { display: flex; gap: 0.4rem; }

.presence-link {
  background: transparent;
  border: 0;
  color: inherit;
  font-weight: 700;
  font-size: 0.8rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  opacity: 0.85;
}
.presence-link:hover { opacity: 1; }

/* Expandir detalhes */
.meeting-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.75rem;
  padding: 0.3rem 0;
  background: transparent;
  border: 0;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.85rem;
  transition: color 0.2s ease;
}

.meeting-toggle:hover { color: var(--primary); }
.meeting-toggle [data-lucide] { width: 15px; height: 15px; transition: transform 0.2s ease; }
.meeting-toggle.open [data-lucide] { transform: rotate(180deg); }

.meeting-details {
  display: none;
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-light);
}
.meeting-details.open { display: block; animation: pageIn 0.25s ease; }

.meeting-subtitle {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.meeting-pauta { margin-bottom: 1rem; }
.meeting-pauta p { font-size: 0.9rem; color: var(--text-secondary); line-height: 1.55; white-space: pre-line; }
.meeting-details .muted { color: var(--text-muted); font-size: 0.88rem; }

.conv-list { list-style: none; display: flex; flex-direction: column; gap: 0.1rem; }
.conv-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.88rem;
}
.conv-list li:last-child { border-bottom: 0; }
.conv-list small { color: var(--text-muted); }

.meeting-creator { margin-top: 0.6rem; font-size: 0.8rem; color: var(--text-muted); }

/* Ações (ícones) */
.meeting-actions {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex-shrink: 0;
}

.btn-icon {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--text-secondary);
  transition: var(--transition);
}

.btn-icon [data-lucide] { width: 16px; height: 16px; }
.btn-icon:hover { border-color: var(--text); color: var(--text); }
.btn-icon-danger:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-bg); }

@media (max-width: 560px) {
  /* O cartao ficava em LINHA com `flex-wrap`, e a quebra nunca acontecia: as duas
     colunas laterais (data 101px + acoes 94px) comiam 195 dos 351px, e
     `.meeting-main`, que tem `flex: 1; min-width: 0`, encolhia para 87px em vez
     de empurrar alguem para a linha de baixo. O titulo saia com UMA palavra por
     linha e o cartao passava de 450px de altura.

     Empilhado, o conteudo fica com a largura inteira: a data vira uma faixa
     curta no topo e as acoes uma barra no rodape. */
  .meeting-card {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .meeting-date {
    flex-direction: row;
    align-items: baseline;
    align-self: flex-start;   /* faixa do tamanho do texto, nao coluna esticada */
    width: auto;
    gap: 0.4rem;
    padding: 0.35rem 0.6rem;
  }
  .meeting-date-day { font-size: 1.1rem; margin: 0; }

  .meeting-actions {
    flex-direction: row;
    justify-content: flex-end;
    padding-top: 0.6rem;
    border-top: 1px solid var(--border-light);
  }
}

/* ===== RESPONSIVE ===== */
/* ============================================================
   RESPONSIVIDADE
   Camadas: 1024 -> 900 -> 768 -> 600 -> 480 -> 380 + landscape
   ============================================================ */

/* ---- Tablets em paisagem / laptops pequenos ---- */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 220px;
  }

  .content-wrapper {
    --pad: 1.5rem;
  }

  .landing-nav,
  .institution-section,
  .programs-band {
    width: 100%;
  }

  .program-list {
    grid-template-columns: repeat(2, 1fr);
  }

  .mission-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .charts-grid {
    grid-template-columns: 1fr;
  }

  .community-section {
    gap: 1.5rem;
  }
}

/* ---- Tablets em retrato ---- */
@media (max-width: 900px) {
  .login-screen {
    align-items: flex-start;
    background: var(--bg);
  }

  .login-shell {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .login-character-panel {
    min-height: 280px;
    padding: 3.75rem 1.5rem 0.75rem;
  }

  .creature-stage {
    width: min(330px, 82vw);
  }

  .login-card {
    border-left: 0;
    border-top: 1px solid var(--border-light);
    box-shadow: 0 -16px 48px -34px rgba(20,17,15,0.36);
  }

  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .finance-summary {
    grid-template-columns: repeat(2, 1fr);
  }

  .section-copy h2,
  .section-heading h2 {
    font-size: clamp(1.9rem, 4.5vw, 2.6rem);
  }
}

/* ---- Sidebar vira off-canvas; layout mobile principal ---- */
@media (max-width: 768px) {
  /* Landing */
  .landing-screen {
    padding: 1rem;
  }

  .landing-nav {
    gap: 0.5rem;
  }

  .landing-brand {
    width: 150px;
  }

  .landing-brand-mini {
    font-size: 0.82rem;
  }

  .landing-hero {
    min-height: auto;
    padding: 2.5rem 0 3rem;
  }

  .hero-cta {
    width: 100%;
  }

  .impact-strip {
    margin-top: 2.25rem;
  }

  .impact-strip div {
    border-right: 0;
    border-bottom: 1px solid var(--border-light);
  }

  .impact-strip div:last-child {
    border-bottom: 0;
  }

  .program-list div {
    min-height: 120px;
  }

  .community-section {
    grid-template-columns: 1fr;
  }

  /* App shell */
  .mobile-header {
    display: flex;
  }

  .sidebar {
    width: min(280px, 84vw);
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(.4,0,.2,1);
    box-shadow: var(--shadow-lg);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.active {
    display: block;
  }

  .main-content {
    margin-left: 0;
    padding-top: var(--header-height);
  }

  .content-wrapper {
    --pad: 1rem;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .page-header .btn-group,
  .page-header > div {
    width: 100%;
  }

  .charts-grid {
    grid-template-columns: 1fr;
  }

  /* Formulários */
  .form-row {
    grid-template-columns: 1fr;
  }

  /* Toolbar de tabelas */
  .table-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .table-toolbar .search-input,
  .table-toolbar select,
  .table-toolbar .btn,
  .fin-search,
  .fin-date {
    width: 100%;
  }

  /* No mobile, o botão Filtros aparece e os selects viram painel recolhível */
  .fin-filtros-btn {
    display: inline-flex;
    justify-content: center;
    width: 100%;
  }
  .fin-filtros {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    width: 100%;
  }
  .fin-filtros.collapsed {
    display: none;
  }

  .bazar-layout {
    grid-template-columns: 1fr;
  }

  .bazar-price-item {
    grid-template-columns: 1fr;
    gap: 0.45rem;
  }

  .bazar-sale-head {
    display: none;
  }

  .bazar-sale-row {
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem 0.75rem;
    padding: 0.82rem;
  }

  .bazar-sale-row > span {
    grid-column: 1 / -1;
  }

  .bazar-sale-row input {
    min-height: 40px;
  }

  .bazar-close-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Tabela: rolagem horizontal por padrão */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Tabela responsiva: vira cards */
  .responsive-table {
    min-width: 0;
  }

  .responsive-table thead {
    display: none;
  }

  .responsive-table tbody tr {
    display: block;
    margin: 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.75rem;
    background: var(--white);
  }

  .responsive-table tbody td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.45rem 0;
    border-bottom: 1px solid var(--border-light);
    text-align: right;
  }

  .responsive-table tbody td:last-child {
    border-bottom: none;
  }

  .responsive-table tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: left;
    margin-right: 1rem;
    flex-shrink: 0;
  }

  .mobile-hide {
    display: none !important;
  }

  .cards-grid {
    grid-template-columns: 1fr;
  }

  /* Sobreposições */
  .toast-container {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
  }

  .toast {
    max-width: none;
  }

  .modal {
    max-width: none;
    margin: 0.5rem;
  }

  .command-overlay {
    padding: 8vh 0.75rem 1rem;
  }
}

/* ---- Telefones grandes ---- */
@media (max-width: 600px) {
  .mission-grid,
  .program-list,
  .finance-summary,
  .bazar-close-grid {
    grid-template-columns: 1fr;
  }

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

  .bazar-section-header .btn {
    width: 100%;
  }

  .program-list div {
    min-height: 96px;
  }

  .page-header h2 {
    font-size: 1.45rem;
  }

  /* Perfil empilha */
  .profile-card {
    padding: 1.5rem;
  }

  .profile-header {
    flex-direction: column;
    text-align: center;
    gap: 0.85rem;
  }

  /* Doação: botão copiar abaixo do valor em telas estreitas */
  .donation-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .donation-copy {
    align-self: flex-start;
  }

  .modal-header {
    padding: 1rem 1.1rem;
  }

  .modal-body {
    padding: 1.1rem;
  }

  .modal-body .form-actions {
    flex-direction: column-reverse;
  }

  .modal-body .form-actions .btn {
    width: 100%;
  }
}

/* ---- Telefones ---- */
@media (max-width: 480px) {
  .hero-title {
    font-size: clamp(2rem, 8vw, 2.4rem);
  }

  .hero-logo {
    width: min(320px, 90vw);
    margin-bottom: 1.25rem;
  }

  .hero-sub {
    font-size: 0.96rem;
  }

  /* CTAs ocupam largura total e empilham */
  .hero-cta {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-primary-lg,
  .btn-secondary-lg,
  .btn-link-lg {
    width: 100%;
    justify-content: center;
  }

  .metrics-grid {
    grid-template-columns: 1fr;
  }

  /* Topo da landing: esconde o nome (o logo do hero já marca) e mantém só o acesso */
  .landing-brand-mini {
    display: none;
  }

  .landing-nav {
    justify-content: flex-end;
  }

  .btn-ghost {
    white-space: nowrap;
  }

  .login-card {
    padding: 1.75rem 1.25rem;
  }

  .login-shell {
    border-radius: 18px;
  }

  .login-character-panel {
    min-height: 230px;
  }

  .creature-stage {
    width: min(270px, 82vw);
  }

  .login-logo .login-logo-img {
    max-width: 200px;
  }

  .eyebrow {
    font-size: 0.7rem;
    text-align: center;
  }

  .section-copy h2,
  .section-heading h2 {
    font-size: clamp(1.7rem, 6.5vw, 2.1rem);
  }

  /* Métrica: número um pouco menor pra não estourar */
  .metric-info h3 {
    font-size: 1.45rem;
  }
}

/* ---- Telefones pequenos ---- */
@media (max-width: 380px) {
  .content-wrapper {
    --pad: 0.75rem;
  }

  .landing-screen {
    padding: 0.75rem;
  }

  .sidebar {
    width: min(300px, 90vw);
  }

  .mobile-logo {
    font-size: 0.85rem;
  }

  .login-card {
    padding: 1.5rem 1rem;
  }

  .login-character-panel {
    min-height: 210px;
  }

  .login-tabs button {
    font-size: 0.82rem;
    padding: 0.55rem 0.5rem;
  }

  .metric-card,
  .card,
  .chart-card,
  .finance-card {
    padding: 1rem;
  }

  .btn {
    font-size: 0.88rem;
  }
}

/* ---- Paisagem em telas baixas (login/landing não cortar) ---- */
@media (max-height: 560px) and (orientation: landscape) {
  .login-screen {
    align-items: flex-start;
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
    overflow-y: auto;
  }

  .login-shell {
    min-height: 0;
  }

  .login-character-panel {
    min-height: 230px;
  }

  .landing-hero {
    min-height: auto;
    padding: 1.5rem 0;
  }
}

/* === Recortador de imagem (cropper) === */
.cropper-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20,17,15,0.55);
  backdrop-filter: blur(8px) saturate(140%);
  -webkit-backdrop-filter: blur(8px) saturate(140%);
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.cropper-box {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  max-width: 360px;
  width: 100%;
  text-align: center;
}

.cropper-box h3 {
  margin: 0 0 0.25rem;
  font-family: var(--font-display);
}

.cropper-hint {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  color: var(--text-muted, #94908A);
}

.cropper-stage {
  margin: 0 auto 1rem;
  border-radius: var(--radius);
  overflow: hidden;
  background: #14110F;
  box-shadow: inset 0 0 0 2px var(--border-light), inset 0 0 0 9999px rgba(0,0,0,0);
}

.cropper-stage #crop-canvas {
  display: block;
  cursor: grab;
  touch-action: none;
}

.cropper-stage #crop-canvas:active {
  cursor: grabbing;
}

.cropper-controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
  color: var(--text-muted, #94908A);
}

.cropper-controls input[type="range"] {
  flex: 1;
  accent-color: var(--primary);
}

.cropper-box .form-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
}

body.theme-dark .cropper-box {
  background: var(--surface, #1f1b18);
}

/* ===== BARRA DE STATUS OFFLINE ===== */
/* Fica no topo para nao brigar com os toasts (canto inferior direito). */
.offline-bar {
  position: fixed;
  top: calc(0.75rem + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translate(-50%, calc(-100% - 1.5rem));
  z-index: 1900;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  /* Com apenas `left: 50%`, o cálculo de largura só enxerga metade da tela e o
     texto quebra cedo. `max-content` faz a pílula caber no conteúdo. */
  width: max-content;
  max-width: min(92vw, 520px);
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  font-size: 0.85rem;
  color: var(--text-secondary);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.28s cubic-bezier(.4,0,.2,1), opacity 0.28s ease;
}

.offline-bar.visivel {
  transform: translate(-50%, 0);
  opacity: 1;
  pointer-events: auto;
}

.offline-bar-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}

.offline-bar.offline .offline-bar-dot { background: var(--warning); }
.offline-bar.pendente .offline-bar-dot { background: var(--info); }
.offline-bar.sincronizando .offline-bar-dot {
  background: var(--brand-green);
  animation: offlinePulse 1.1s ease-in-out infinite;
}

@keyframes offlinePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.7); }
}

.offline-bar-text {
  flex: 1;
  min-width: 0;
  line-height: 1.35;
}

.offline-bar-action {
  flex: none;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  background: var(--text);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  transition: var(--transition);
}

.offline-bar-action:hover { background: var(--primary); }
.offline-bar-action[hidden] { display: none; }

@media (max-width: 768px) {
  .offline-bar {
    top: calc(var(--header-height) + 0.5rem + env(safe-area-inset-top, 0px));
    font-size: 0.8rem;
  }
}

/* ===== CONVITE PARA INSTALAR O APP ===== */
.pwa-banner {
  position: fixed;
  left: 50%;
  bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, calc(100% + 2rem));
  z-index: 1950;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  width: min(94vw, 460px);
  padding: 0.9rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transition: transform 0.32s cubic-bezier(.4,0,.2,1), opacity 0.32s ease;
}

.pwa-banner.visivel {
  transform: translate(-50%, 0);
  opacity: 1;
}

.pwa-banner-icon {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  object-fit: contain;
  padding: 4px;
}

.pwa-banner-copy {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.pwa-banner-copy strong {
  font-family: var(--font-display);
  font-size: 0.92rem;
  color: var(--text);
}

.pwa-banner-copy span {
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--text-secondary);
}

.pwa-banner-actions {
  flex: none;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.pwa-banner-cta {
  padding: 0.5rem 0.95rem;
  border-radius: 999px;
  background: var(--text);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 0.83rem;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 6px 16px -8px rgba(20,17,15,0.5);
  transition: var(--transition);
}

.pwa-banner-cta:hover {
  background: var(--primary);
  box-shadow: var(--shadow-primary);
}

.pwa-banner-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.35rem;
  line-height: 1;
  transition: var(--transition);
}

.pwa-banner-close:hover {
  background: var(--surface-muted);
  color: var(--text);
}

/* Com o banner na tela, os toasts sobem para nao ficar por baixo. */
body.tem-pwa-banner .toast-container {
  bottom: calc(6.5rem + env(safe-area-inset-bottom, 0px));
}

@media (max-width: 560px) {
  .pwa-banner {
    flex-wrap: wrap;
    row-gap: 0.75rem;
  }

  .pwa-banner-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

/* Aviso neutro na tela de login (ex: sessao expirada), reaproveitando o slot de erro. */
.error-message.info-message {
  color: var(--text-secondary);
}

@media (prefers-reduced-motion: reduce) {
  .offline-bar,
  .pwa-banner {
    transition: opacity 0.2s ease;
  }

  .offline-bar.visivel { transform: translate(-50%, 0); }
  .pwa-banner.visivel { transform: translate(-50%, 0); }
  .offline-bar.sincronizando .offline-bar-dot { animation: none; }
}

/* ===== TELA HOJE ===== */
.hoje-saudacao {
  margin-bottom: 1.75rem;
}

.hoje-saudacao h2 {
  font-size: 1.75rem;
  letter-spacing: -0.025em;
}

.hoje-saudacao p {
  margin-top: 0.15rem;
  color: var(--text-secondary);
  font-size: 0.92rem;
}

/* Só a primeira letra: `capitalize` viraria "Segunda-Feira, 24 De Agosto". */
.hoje-saudacao p::first-letter {
  text-transform: uppercase;
}

.hoje-secao {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 1.75rem 0 0.75rem;
}

#hoje-pendencias > .hoje-secao:first-child {
  margin-top: 0;
}

.hoje-lista {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.hoje-item {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.95rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  /* A faixa colorida à esquerda dá a urgência sem precisar ler o texto. */
  border-left: 3px solid var(--text-muted);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  transition: var(--transition);
}

.hoje-item:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.hoje-item.tom-alta { border-left-color: var(--primary); }
.hoje-item.tom-media { border-left-color: var(--warning); }
.hoje-item.tom-baixa { border-left-color: var(--text-muted); }

.hoje-item-icone {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  color: var(--text-secondary);
}

.hoje-item.tom-alta .hoje-item-icone {
  background: var(--primary-light);
  color: var(--primary);
}

.hoje-item.tom-media .hoje-item-icone {
  background: var(--warning-bg);
  color: var(--warning);
}

.hoje-item-icone [data-lucide] {
  width: 20px;
  height: 20px;
}

.hoje-item-copy {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.hoje-item-copy strong {
  font-family: var(--font-display);
  font-size: 0.97rem;
  line-height: 1.3;
  color: var(--text);
}

.hoje-item-copy span {
  font-size: 0.84rem;
  line-height: 1.4;
  color: var(--text-secondary);
}

.hoje-item-acao {
  flex: none;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.84rem;
  font-weight: 600;
  white-space: nowrap;
  transition: var(--transition);
}

.hoje-item-acao:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--white);
}

/* Estado vazio é uma boa notícia, não um buraco na tela. */
.hoje-tudo-certo {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 1.35rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--success-bg);
}

.hoje-tudo-certo [data-lucide] {
  flex: none;
  width: 26px;
  height: 26px;
  color: var(--success);
}

.hoje-tudo-certo div {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.hoje-tudo-certo strong {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--text);
}

.hoje-tudo-certo span {
  font-size: 0.86rem;
  color: var(--text-secondary);
}

/* Registrar rápido */
.hoje-atalhos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.65rem;
}

.hoje-atalho {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 600;
  text-align: left;
  box-shadow: var(--shadow-xs);
  transition: var(--transition);
}

.hoje-atalho [data-lucide] {
  flex: none;
  width: 19px;
  height: 19px;
  color: var(--primary);
}

.hoje-atalho:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

/* Seu mês até aqui */
.hoje-impacto {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.65rem;
}

.hoje-impacto > div {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  background: var(--surface-muted);
}

.hoje-impacto strong {
  font-family: var(--font-display);
  font-size: 1.5rem;
  line-height: 1;
  color: var(--brand-green);
  font-variant-numeric: tabular-nums;
}

.hoje-impacto span {
  font-size: 0.8rem;
  line-height: 1.3;
  color: var(--text-secondary);
}

.hoje-modal-titulo {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.hoje-modal-sub {
  margin-top: 0.2rem;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

/* ===== RELATÓRIO DO MÊS ===== */
.rel-preview {
  max-height: 46vh;
  overflow-y: auto;
  padding: 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 560px) {
  .hoje-item {
    flex-wrap: wrap;
    row-gap: 0.75rem;
  }

  .hoje-item-copy {
    /* Ícone + texto ocupam a primeira linha; o botão desce inteiro. */
    flex: 1 1 calc(100% - 3.4rem);
  }

  .hoje-item-acao {
    width: 100%;
    padding: 0.6rem 1rem;
  }

  .hoje-saudacao h2 {
    font-size: 1.45rem;
  }
}

/* ===== ÍCONES ===== */
/* O lucide troca <i data-lucide="x"> por <svg data-lucide="x"> com width/height
   de 24 nos atributos. Dimensionar pelo contexto em CSS mantém a escala
   consistente e tira o style="width:18px" repetido de dentro do JS.
   Seletor tem que ser [data-lucide]: a tag `i` deixa de existir. */
.btn [data-lucide] {
  width: 18px;
  height: 18px;
  flex: none;
}

.btn-sm [data-lucide] {
  width: 15px;
  height: 15px;
}

.toast [data-lucide] {
  width: 16px;
  height: 16px;
  flex: none;
}

.metric-icon [data-lucide] {
  width: 24px;
  height: 24px;
}

/* Cabeçalho de página: título + subtítulo à esquerda, ação primária à direita. */
.page-header-copy {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.page-header-copy .page-subtitle {
  margin: 0;
  max-width: 60ch;
}

/* Toolbar usada fora de .table-container (ex: Membros, que lista em cards). */
.table-toolbar-solta {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

/* Foto de perfil nunca distorce, independente do recorte enviado. */
img.avatar {
  object-fit: cover;
}

/* Algarismos de largura fixa em tudo que é número: coluna de valores alinha
   pela vírgula e o total não "dança" quando a lista recarrega. */
table,
.metric-info h3,
.finance-card .value,
.table-subtitle strong {
  font-variant-numeric: tabular-nums;
}

@media (max-width: 768px) {
  /* No modo card, a célula de ações fica com o rótulo em cima e os botões
     numa linha própria — antes o rótulo ficava centralizado ao lado de um
     grupo de botões que quebrava em duas linhas. */
  .responsive-table tbody td:has(.btn-group) {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .responsive-table tbody td:has(.btn-group)::before {
    margin-right: 0;
  }

  .responsive-table tbody td .btn-group {
    justify-content: flex-start;
  }

  .table-subtitle {
    font-size: 0.82rem;
  }
}

/* ===== BOTTOM SHEET (celular) =====
   Padrao do Sheet/Drawer do shadcn, feito em CSS puro. No celular um dialogo
   centralizado fica longe do polegar e o teclado empurra tudo; ancorar embaixo
   resolve os dois. No desktop segue sendo um modal normal. */
.sheet-handle {
  display: none;
  padding: 0.65rem 0 0.15rem;
  cursor: grab;
  touch-action: none;
}

.sheet-handle span {
  display: block;
  width: 38px;
  height: 4px;
  margin: 0 auto;
  border-radius: 999px;
  background: var(--border);
}

.sheet-handle:active {
  cursor: grabbing;
}

@media (max-width: 768px) {
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .modal {
    max-width: none;
    max-height: 92vh;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    border-bottom: 0;
    animation: sheetIn 0.32s cubic-bezier(.32,.72,0,1);
    /* Enquanto o dedo arrasta, o JS escreve --sheet-y aqui. */
    transform: translateY(var(--sheet-y, 0px));
  }

  .modal.arrastando {
    animation: none;
    transition: none;
  }

  .modal.voltando {
    animation: none;
    transition: transform 0.22s cubic-bezier(.32,.72,0,1);
  }

  .sheet-handle {
    display: block;
  }

  /* Título continua visível ao rolar um formulário longo. */
  .modal-header {
    position: sticky;
    top: 0;
    z-index: 1;
    padding-top: 0.5rem;
    background: var(--white);
  }

  .modal-body {
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
  }
}

@keyframes sheetIn {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .modal { animation: none; }
}

/* Entrada escalonada da lista de pendências (padrão Animated Content do
   ReactBits, em CSS). `backwards` mantém o item invisível durante o atraso,
   senão ele pisca antes de animar. O índice vem do JS em --i. */
.hoje-lista .hoje-item {
  animation: itemEntra 0.34s cubic-bezier(.4,0,.2,1) backwards;
  animation-delay: calc(var(--i, 0) * 55ms);
}

@keyframes itemEntra {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* Controle segmentado: os chips soltos viram um grupo único sobre um trilho,
   com a opção ativa em relevo (padrão Toggle Group do shadcn). Deixa claro que
   são alternativas de um mesmo filtro, não botões independentes. */
.agenda-filters {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 1.5rem;
  padding: 0.25rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-muted);
}

.agenda-chip {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.agenda-chip:hover {
  background: var(--surface);
  color: var(--text);
}

.agenda-chip.active {
  box-shadow: var(--shadow-xs);
}

@media (prefers-reduced-motion: reduce) {
  .hoje-lista .hoje-item {
    animation: none;
  }
}

/* Barra de tempo do toast (padrão do Sonner). Mostra quanto falta para sumir e
   pausa junto com o temporizador quando o ponteiro está em cima. */
.toast {
  position: relative;
  overflow: hidden;
  touch-action: pan-y;
}

.toast-tempo {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 100%;
  transform-origin: left;
  background: currentColor;
  opacity: 0.35;
  animation: toastTempo var(--duracao, 4000ms) linear forwards;
}

.toast.pausado .toast-tempo {
  animation-play-state: paused;
}

@keyframes toastTempo {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

@media (prefers-reduced-motion: reduce) {
  .toast-tempo { display: none; }
}

/* ===== MENU LATERAL: SEÇÕES E MODO COMPACTO ===== */
.nav-secao {
  padding: 0.9rem 0.8rem 0.3rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-muted);
  user-select: none;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.sidebar-logo-mini {
  display: none;
  width: 30px;
  height: 30px;
}

.sidebar-recolher {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  transition: var(--transition);
}

.sidebar-recolher:hover {
  background: var(--surface-muted);
  color: var(--text);
}

.sidebar-recolher [data-lucide] {
  width: 17px;
  height: 17px;
}

/* Recolhido: só os ícones, e o nome vira tooltip no hover. */
body.sidebar-compacta {
  --sidebar-width: 76px;
}

body.sidebar-compacta .sidebar-logo img:not(.sidebar-logo-mini),
body.sidebar-compacta .nav-link > span:not(.nav-badge),
body.sidebar-compacta .sidebar-user .user-info {
  display: none;
}

/* Recolhido, o título da seção não cabe — mas o agrupamento continua útil.
   Vira um traço separando os blocos. */
body.sidebar-compacta .nav-secao {
  height: 1px;
  padding: 0;
  margin: 0.55rem 0.9rem;
  background: var(--border-light);
  font-size: 0;
  overflow: hidden;
}

body.sidebar-compacta .sidebar-logo-mini {
  display: block;
  margin: 0 auto;
}

body.sidebar-compacta .sidebar-header {
  flex-direction: column;
  gap: 0.6rem;
  padding: 1rem 0.5rem 0.5rem;
}

body.sidebar-compacta .sidebar-user {
  justify-content: center;
  padding: 0.6rem 0.5rem;
}

body.sidebar-compacta .nav-link {
  justify-content: center;
  padding: 0.65rem 0;
}

body.sidebar-compacta .nav-link .nav-badge {
  position: absolute;
  top: 3px;
  right: 12px;
}

body.sidebar-compacta .nav-link {
  position: relative;
}

/* Tooltip do modo compacto: sem o rótulo visível, o nome precisa aparecer
   no hover, senão o menu vira adivinhação. */
body.sidebar-compacta .nav-link::after {
  content: attr(data-titulo);
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%) scale(0.94);
  transform-origin: left center;
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-sm);
  background: var(--text);
  color: var(--white);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  box-shadow: var(--shadow);
  transition: opacity 0.14s ease, transform 0.14s ease;
  z-index: 300;
}

body.sidebar-compacta .nav-link:hover::after,
body.sidebar-compacta .nav-link:focus-visible::after {
  opacity: 1;
  transform: translateY(-50%) scale(1);
}

/* No celular a barra já é uma gaveta: recolher não faz sentido. */
@media (max-width: 768px) {
  .sidebar-recolher {
    display: none;
  }

  body.sidebar-compacta {
    --sidebar-width: 260px;
  }

  body.sidebar-compacta .nav-link > span:not(.nav-badge),
  body.sidebar-compacta .sidebar-user .user-info,
  body.sidebar-compacta .sidebar-logo img:not(.sidebar-logo-mini) {
    display: revert;
  }

  /* Desfaz o "vira separador" do modo compacto: na gaveta o rótulo cabe e
     display:revert sozinho deixaria um bloco de 1px com font-size 0. */
  body.sidebar-compacta .nav-secao {
    height: auto;
    padding: 0.9rem 0.8rem 0.3rem;
    margin: 0;
    background: none;
    font-size: 0.68rem;
    overflow: visible;
  }

  body.sidebar-compacta .sidebar-logo-mini {
    display: none;
  }

  body.sidebar-compacta .nav-link {
    justify-content: flex-start;
    padding: 0.6rem 0.8rem;
  }

  body.sidebar-compacta .nav-link::after {
    content: none;
  }
}

/* ===== CABEÇALHO DE PÁGINA FIXO =====
   Com 40 itens na tabela, rolar até o fim escondia o título e a ação primária:
   para cadastrar era preciso voltar ao topo. Agora ele acompanha a rolagem. */
.page-header {
  position: sticky;
  top: 0;
  z-index: 90;
  /* Cobre o conteúdo que passa por baixo, respeitando o padding do wrapper. */
  margin: calc(var(--pad, 2rem) * -1) calc(var(--pad, 2rem) * -1) 1.25rem;
  padding: calc(var(--pad, 2rem) * 0.75) var(--pad, 2rem) 1rem;
  background: var(--bg);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* A borda só aparece depois que a página rola, para não desenhar uma linha
   solta no topo. A classe é aplicada pelo JS. */
.page-header.rolado {
  border-bottom-color: var(--border);
  box-shadow: 0 6px 16px -14px rgba(20,17,15,0.5);
}

@media (max-width: 768px) {
  .page-header {
    top: var(--header-height);
    margin-bottom: 1rem;
  }
}

/* ===== TABELAS: DENSIDADE E LEITURA =====
   Com 40 linhas na tela, cada pixel de altura custa uma linha a menos visível.
   Só vale no desktop: no celular a tabela vira card e a folga é bem-vinda. */
@media (min-width: 769px) {
  tbody td {
    padding: 0.62rem 1rem;
  }

  thead th {
    padding: 0.55rem 1rem;
    /* O cabeçalho acompanha a rolagem: sem isso, na linha 30 já não se sabe
       qual coluna é qual. Fica abaixo do cabeçalho de página (z-index 90). */
    position: sticky;
    top: var(--altura-page-header, 0px);
    z-index: 2;
    box-shadow: inset 0 -1px 0 var(--border);
  }

  /* A barra de progresso da quantidade não precisa empurrar a linha. */
  .responsive-table .progress-bar {
    display: inline-block;
    width: 72px;
    vertical-align: middle;
    margin: 0 0 0 0.5rem;
  }

  /* Linha inteira destacada no hover, para o olho não se perder ao atravessar
     sete colunas. */
  tbody tr:hover {
    background: var(--primary-light);
  }

  body.theme-dark tbody tr:hover {
    background: var(--surface-muted);
  }
}

/* Coluna de ações encosta à direita e não quebra em duas linhas. */
.responsive-table td .btn-group {
  flex-wrap: nowrap;
  justify-content: flex-end;
}

.responsive-table th:last-child,
.responsive-table td:last-child {
  text-align: right;
}

@media (max-width: 768px) {
  .responsive-table th:last-child,
  .responsive-table td:last-child {
    text-align: left;
  }
}

/* A busca é a ferramenta principal da barra: fica primeiro e ocupa o espaço
   livre; exportar encosta na direita. */
.table-toolbar .btn {
  margin-left: auto;
}

.table-toolbar .search-input + select {
  margin-left: 0;
}
