/* ============================================================
   FUNDAÇÃO — Dashboard / Admin styles
   Mesmo sistema visual do site (preto + creme + Montserrat/Lato)
   com acento roxo no painel.
   ============================================================ */

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

:root {
  --black:   #0a0908;
  --bg:      #131210;
  --bg-2:    #1a1815;
  --bg-3:    #221f1b;
  --cream:   #fffdea;
  --line:    rgba(255,253,234,.08);
  --line-2:  rgba(255,253,234,.14);
  --muted:   rgba(255,253,234,.42);
  --muted-2: rgba(255,253,234,.28);
  --muted-3: rgba(255,253,234,.18);
  --accent:  #c9a875;          /* champagne/dourado corporativo */
  --green:   #4ade80;
  --red:     #f87171;
  --yellow:  #fbbf24;
  --side-w:  260px;
}

html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--cream);
  font-family: 'Lato', sans-serif;
  font-weight: 300;
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ── LOGIN ─────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: grid; place-items: center;
  padding: 2rem; position: relative;
}
.login-wrap::before {
  content: ''; position: fixed; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none; z-index: 0; opacity: .4;
}
.login-card {
  width: 100%; max-width: 400px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  padding: 3rem 2.5rem;
  position: relative; z-index: 1;
}
.login-brand {
  font-family: 'Montserrat', sans-serif;
  font-weight: 900; font-size: 1rem;
  letter-spacing: .22em; text-transform: uppercase;
  color: var(--cream); margin-bottom: .3rem; display: block;
}
.login-brand .dot { color: var(--accent); }
.login-sub {
  font-family: 'Montserrat', sans-serif;
  font-size: .56rem; font-weight: 700;
  letter-spacing: .22em; text-transform: uppercase;
  color: var(--muted-2); margin-bottom: 2.5rem;
}
.field { margin-bottom: 1.2rem; }
.field label {
  display: block;
  font-family: 'Montserrat', sans-serif;
  font-size: .55rem; font-weight: 700;
  letter-spacing: .18em; text-transform: uppercase;
  color: var(--muted); margin-bottom: .55rem;
}
.field input {
  width: 100%; padding: .85rem 1rem;
  background: var(--bg);
  border: 1px solid var(--line-2);
  color: var(--cream);
  font-family: 'Lato', sans-serif;
  font-size: .92rem; outline: none;
  transition: border-color .18s;
}
.field input:focus { border-color: var(--accent); }

.login-btn {
  width: 100%; padding: .95rem;
  background: var(--cream); color: var(--black);
  border: none;
  font-family: 'Montserrat', sans-serif;
  font-size: .68rem; font-weight: 800;
  letter-spacing: .2em; text-transform: uppercase;
  margin-top: .6rem;
  transition: background .18s, color .18s;
}
.login-btn:hover { background: var(--accent); color: var(--cream); }
.login-btn:disabled { opacity: .5; cursor: not-allowed; }

.login-msg {
  font-size: .78rem; color: var(--red);
  margin-top: 1rem; min-height: 1.2em;
}
.login-msg.ok { color: var(--green); }
.login-back {
  display: block; text-align: center; margin-top: 2rem;
  font-family: 'Montserrat', sans-serif;
  font-size: .55rem; font-weight: 700;
  letter-spacing: .2em; text-transform: uppercase;
  color: var(--muted-2);
}
.login-back:hover { color: var(--cream); }

/* ── APP SHELL ─────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: var(--side-w) 1fr;
  min-height: 100vh;
}

/* Grain — textura sutil sobre toda a interface */
.grain::before {
  content: '';
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none; z-index: 9999; opacity: .35;
}

/* ── SIDEBAR ───────────────────────────────────── */
.side {
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  padding: 2rem 0;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
}
.side-brand {
  padding: 0 1.8rem 1.8rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.4rem;
}
.side-eyebrow {
  font-family: 'Montserrat', sans-serif;
  font-size: .52rem; font-weight: 700;
  letter-spacing: .26em; text-transform: uppercase;
  color: var(--accent);
  margin-bottom: .55rem;
}
.side-title {
  font-family: 'Montserrat', sans-serif;
  font-weight: 900; font-size: 1.35rem;
  letter-spacing: -.01em; color: var(--cream);
  line-height: 1.1;
}
.side-title .accent { color: var(--accent); }

.side-cat {
  font-family: 'Montserrat', sans-serif;
  font-size: .52rem; font-weight: 700;
  letter-spacing: .26em; text-transform: uppercase;
  color: var(--muted-2);
  padding: 1.4rem 1.8rem .6rem;
}

.side-link {
  display: flex; align-items: center; gap: .9rem;
  padding: .85rem 1.8rem;
  font-family: 'Montserrat', sans-serif;
  font-size: .82rem; font-weight: 600;
  color: var(--muted);
  border-left: 2px solid transparent;
  transition: background .18s, color .18s, border-color .18s;
  cursor: pointer; user-select: none;
}
.side-link:hover { color: var(--cream); background: rgba(255,253,234,.025); }
.side-link.active {
  color: var(--cream); font-weight: 800;
  background: var(--bg-3);
  border-left-color: var(--accent);
}
.side-link .ic {
  width: 18px; height: 18px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted-2);
}
.side-link.active .ic { color: var(--accent); }
.side-link .side-txt { /* text label — wraps in desktop, truncates in mobile */ }

/* Badge de notificação no menu lateral */
.side-badge {
  margin-left: auto;
  background: var(--red);
  color: var(--cream);
  font-family: 'Montserrat', sans-serif;
  font-size: .58rem; font-weight: 800;
  letter-spacing: .04em;
  padding: .15rem .45rem;
  border-radius: 9px;
  min-width: 18px;
  text-align: center;
  line-height: 1.2;
  animation: pulse 2s ease-in-out infinite;
}
.side-badge.warn { background: var(--yellow); color: var(--bg); }
.side-badge.info { background: var(--accent); color: var(--bg); }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .65; }
}

.side-bottom {
  margin-top: auto; padding: 1.4rem 1.8rem 0;
  border-top: 1px solid var(--line);
}
.side-user {
  font-size: .76rem; color: var(--muted);
  margin-bottom: .8rem; line-height: 1.4;
  word-break: break-word;
}
.side-user strong { color: var(--cream); font-weight: 600; display: block; }
.logout {
  display: block; width: 100%; text-align: left;
  background: none; border: none;
  font-family: 'Montserrat', sans-serif;
  font-size: .56rem; font-weight: 700;
  letter-spacing: .2em; text-transform: uppercase;
  color: var(--muted-2); padding: .6rem 0;
  transition: color .18s;
}
.logout:hover { color: var(--red); }

/* ── MAIN ──────────────────────────────────────── */
.main { padding: 2.5rem 3rem; min-width: 0; }

.page-head {
  display: flex; justify-content: space-between; align-items: flex-end;
  flex-wrap: wrap; gap: 1.4rem;
  margin-bottom: 2.5rem;
  padding-bottom: 1.6rem; border-bottom: 1px solid var(--line);
}
.page-eyebrow {
  font-family: 'Montserrat', sans-serif;
  font-size: .55rem; font-weight: 700;
  letter-spacing: .24em; text-transform: uppercase;
  color: var(--muted-2); margin-bottom: .55rem;
}
.page-title {
  font-family: 'Montserrat', sans-serif;
  font-weight: 900; font-size: 1.85rem;
  letter-spacing: -.01em; line-height: 1.05;
}

/* hide all sections, show .active */
.page { display: none; }
.page.active { display: block; }

/* ── KPIs ──────────────────────────────────────── */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  margin-bottom: 2rem;
}
.kpi {
  background: var(--bg-2);
  padding: 1.4rem 1.4rem;
  min-width: 0; overflow: hidden;
}
.kpi-lbl {
  font-family: 'Montserrat', sans-serif;
  font-size: .52rem; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted-2); margin-bottom: .55rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kpi-val {
  font-family: 'Montserrat', sans-serif;
  font-size: 1.75rem; font-weight: 900;
  color: var(--cream); line-height: 1;
}
.kpi-sub {
  font-size: .72rem; color: var(--muted);
  margin-top: .45rem;
}
.kpi-sub.up { color: var(--green); }
.kpi-sub.down { color: var(--red); }

/* ── CARDS / TABELAS ───────────────────────────── */
.card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  margin-bottom: 1.4rem;
}
.card-head {
  padding: 1.2rem 1.4rem;
  border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; flex-wrap: wrap;
}
.card-title {
  font-family: 'Montserrat', sans-serif;
  font-size: .78rem; font-weight: 800;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--cream);
}
.card-body { padding: 1.4rem; }
.card-body.flush { padding: 0; }

.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td {
  padding: .9rem 1.2rem;
  font-size: .82rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
.tbl th {
  font-family: 'Montserrat', sans-serif;
  font-size: .55rem; font-weight: 700;
  letter-spacing: .18em; text-transform: uppercase;
  color: var(--muted-2);
  background: var(--bg-3);
}
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: rgba(255,253,234,.018); }
.tbl td.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl td.entrada { color: var(--green); font-weight: 600; }
.tbl td.saida { color: var(--red); font-weight: 600; }

/* badges */
.badge {
  display: inline-block;
  font-family: 'Montserrat', sans-serif;
  font-size: .56rem; font-weight: 800;
  letter-spacing: .14em; text-transform: uppercase;
  padding: .26rem .6rem;
  border: 1px solid var(--line-2);
  color: var(--muted);
}
.badge.alta     { color: var(--red);    border-color: rgba(248,113,113,.4); }
.badge.media    { color: var(--yellow); border-color: rgba(251,191,36,.4); }
.badge.baixa    { color: var(--muted);  border-color: var(--line-2); }
.badge.pendente   { color: var(--muted); }
.badge.andamento  { color: var(--accent); border-color: rgba(192,132,252,.4); }
.badge.concluida  { color: var(--green); border-color: rgba(74,222,128,.4); }
.badge.ativo, .badge.realizada    { color: var(--green); border-color: rgba(74,222,128,.4); }
.badge.inativo, .badge.cancelada  { color: var(--red); border-color: rgba(248,113,113,.4); }
.badge.prospecto, .badge.agendada { color: var(--accent); border-color: rgba(192,132,252,.4); }

/* progress bar */
.bar-row { margin-bottom: 1.1rem; }
.bar-row:last-child { margin-bottom: 0; }
.bar-info {
  display: flex; justify-content: space-between;
  font-size: .76rem; color: var(--muted); margin-bottom: .45rem;
}
.bar-info strong { color: var(--cream); font-weight: 600; }
.bar-track {
  height: 4px; background: var(--bg-3); border-radius: 2px; overflow: hidden;
}
.bar-fill {
  height: 100%; background: var(--accent); border-radius: 2px;
  transition: width .5s;
}

/* botões */
.btn {
  display: inline-block;
  font-family: 'Montserrat', sans-serif;
  font-size: .6rem; font-weight: 800;
  letter-spacing: .18em; text-transform: uppercase;
  padding: .7rem 1.2rem;
  border: 1px solid var(--line-2);
  background: transparent; color: var(--cream);
  transition: background .18s, border-color .18s, color .18s;
}
.btn:hover { background: var(--cream); color: var(--black); border-color: var(--cream); }
.btn.solid { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.btn.solid:hover { background: var(--cream); color: var(--bg); border-color: var(--cream); }
.btn.sm { padding: .45rem .8rem; font-size: .55rem; }
.btn.danger { color: var(--red); border-color: rgba(248,113,113,.3); }
.btn.danger:hover { background: var(--red); color: var(--cream); border-color: var(--red); }

/* empty state */
.empty {
  padding: 3rem 1rem; text-align: center;
  color: var(--muted-2); font-size: .85rem;
}

/* gráficos */
.chart-wrap { padding: 1rem 1.4rem 1.4rem; }
.chart-wrap canvas { width: 100% !important; height: 280px !important; }

/* grid de 2 col */
.grid-2 {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 1.4rem;
}

/* form / modal */
.modal-bg {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 100; display: none;
  align-items: center; justify-content: center; padding: 2rem;
  backdrop-filter: blur(4px);
}
.modal-bg.open { display: flex; }
.modal {
  width: 100%; max-width: 520px;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  max-height: 90vh; overflow-y: auto;
}
.modal-head {
  padding: 1.4rem; border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
}
.modal-title {
  font-family: 'Montserrat', sans-serif;
  font-size: .78rem; font-weight: 800;
  letter-spacing: .14em; text-transform: uppercase;
}
.modal-close {
  background: none; border: none; color: var(--muted);
  font-size: 1.2rem; line-height: 1;
}
.modal-close:hover { color: var(--cream); }
.modal-body { padding: 1.4rem; }
.field select, .field textarea {
  width: 100%; padding: .85rem 1rem;
  background: var(--bg); border: 1px solid var(--line-2);
  color: var(--cream);
  font-family: 'Lato', sans-serif; font-size: .92rem; outline: none;
  resize: vertical;
}
.field select:focus, .field textarea:focus { border-color: var(--accent); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* mobile menu toggle */
.side-toggle {
  display: none;
  position: fixed; top: 1rem; left: 1rem; z-index: 60;
  background: var(--bg-2); border: 1px solid var(--line-2);
  padding: .6rem .9rem; color: var(--cream);
  font-family: 'Montserrat', sans-serif;
  font-size: .55rem; font-weight: 700;
  letter-spacing: .2em; text-transform: uppercase;
}

/* ── NICHE SHOWCASE (rich layout — Claude Design) ─── */

.eyebrow {
  font-family: 'Montserrat', sans-serif;
  font-size: .55rem; font-weight: 700;
  letter-spacing: .24em; text-transform: uppercase;
  color: var(--muted-2);
}
.mono { font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace; font-variant-numeric: tabular-nums; }

/* Pills (chips com dot) */
.pill {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .25rem .55rem;
  border: 1px solid var(--line-2);
  font-family: 'Montserrat', sans-serif;
  font-size: .58rem; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.pill.green   { color: #4ade80; border-color: rgba(74,222,128,.4); }
.pill.red     { color: #f87171; border-color: rgba(248,113,113,.4); }
.pill.yellow  { color: #fbbf24; border-color: rgba(251,191,36,.4); }
.pill.blue    { color: #60a5fa; border-color: rgba(96,165,250,.4); }
.pill .dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--muted);
}
.pill.green .dot  { background: #4ade80; }
.pill.red .dot    { background: #f87171; }
.pill.yellow .dot { background: #fbbf24; }
.pill.blue .dot   { background: #60a5fa; }
.pill .dot.live { animation: pulseDot 1.6s ease-in-out infinite; }
@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .5; transform: scale(.85); }
}

/* Niche switcher */
.niche-bar {
  display: flex; gap: .35rem; flex-wrap: wrap;
}
.niche-chip {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .35rem .7rem;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: 'Montserrat', sans-serif;
  font-size: .58rem; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.niche-chip:hover { color: var(--cream); border-color: var(--line-2); }
.niche-chip.active { color: var(--cream); border-color: var(--accent); background: var(--bg-3); }
.niche-chip .swatch {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
}

/* Header da Visão Geral (rich) */
.main-head {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem;
}
.main-head h1 {
  font-family: 'Montserrat', sans-serif;
  font-weight: 900; font-size: clamp(1.4rem, 3vw, 2.2rem);
  letter-spacing: -.02em; line-height: 1; margin-top: .35rem;
  color: var(--cream);
}

/* KPI grid rich (com sparkline) */
.kpi-grid {
  display: grid; gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  margin-bottom: 1rem;
}
.kpi-grid .kpi {
  background: var(--bg-2);
  padding: 1rem 1.1rem;
  position: relative;
  min-height: 96px;
}
.kpi-grid .kpi-lbl {
  font-family: 'Montserrat', sans-serif;
  font-size: .52rem; font-weight: 700;
  letter-spacing: .18em; text-transform: uppercase;
  color: var(--muted-2); margin-bottom: .55rem;
}
.kpi-grid .kpi-val {
  font-family: 'Montserrat', sans-serif;
  font-size: 1.5rem; font-weight: 900;
  color: var(--cream); line-height: 1;
  display: flex; align-items: baseline; gap: .25rem;
}
.kpi-grid .kpi-val .unit {
  font-size: .7rem; font-weight: 700;
  color: var(--muted); margin-left: .15rem;
}
.kpi-grid .kpi-sub {
  font-size: .68rem; color: var(--muted);
  margin-top: .35rem; font-weight: 500;
}
.kpi-grid .kpi-sub.up   { color: #4ade80; }
.kpi-grid .kpi-sub.down { color: #f87171; }
.kpi-grid .kpi-sub.flat { color: var(--muted); }
.kpi-spark {
  position: absolute; right: .9rem; top: .9rem;
  width: 56px; height: 22px;
  opacity: .85;
}

/* Charts inline SVG */
.chart-area { animation: areaIn .9s cubic-bezier(.2,.8,.2,1) both; }
.chart-line { animation: lineIn 1.2s cubic-bezier(.2,.8,.2,1) both; stroke-dasharray: 1500; stroke-dashoffset: 1500; }
.chart-dot  { animation: fadeIn .3s ease both; }
.chart-bar  { animation: barIn .5s cubic-bezier(.2,.8,.2,1) both; transform-origin: left; transform: scaleX(0); }
@keyframes areaIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes lineIn { to { stroke-dashoffset: 0; } }
@keyframes barIn  { to { transform: scaleX(1); } }

/* Bar tracks (widgets pipeline/utilização) */
.bar-track {
  height: 4px; background: rgba(255,253,234,.06);
  border-radius: 2px; overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width .8s cubic-bezier(.2,.8,.2,1);
}
.bar-fill.green  { background: #4ade80; }
.bar-fill.yellow { background: #fbbf24; }
.bar-fill.red    { background: #f87171; }

/* Linha entre title e info */
.between { display: flex; justify-content: space-between; align-items: center; }

/* Anim row pra widgets (slide-up cascata) */
.anim-row { animation: fadeUp .35s ease both; }

/* Grids de layout dos widgets */
.grid-43 {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 1rem;
}
.grid-32 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 980px) {
  .grid-43, .grid-32 { grid-template-columns: 1fr; }
}

/* Tabela compacta (widgets) */
.tbl tbody tr td.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }

/* Login split-panel */
.login-split {
  background: var(--bg);
  position: relative;
}
.login-split .login-pitch {
  /* já tem inline */
}
.login-niche-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
}
.login-niche-chip {
  padding: 10px 4px;
  background: var(--bg);
  border: 1px solid var(--line-2);
  color: var(--muted);
  font-family: 'Montserrat', sans-serif;
  font-size: .55rem; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.login-niche-chip:hover { color: var(--cream); }
.login-niche-chip.active {
  background: rgba(201,168,117,.1);
  border-color: var(--accent);
  color: var(--cream);
}

/* ── ANIMAÇÕES ─────────────────────────────────── */

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

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

@keyframes scaleIn {
  from { opacity: 0; transform: translateY(16px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Página entra com fade-up quando ativa */
.page.active {
  animation: fadeUp .35s ease-out;
}

/* KPIs em cascata */
.kpis .kpi {
  animation: fadeUp .45s ease-out backwards;
}
.kpis .kpi:nth-child(1) { animation-delay: .04s; }
.kpis .kpi:nth-child(2) { animation-delay: .10s; }
.kpis .kpi:nth-child(3) { animation-delay: .16s; }
.kpis .kpi:nth-child(4) { animation-delay: .22s; }
.kpis .kpi:nth-child(5) { animation-delay: .28s; }
.kpis .kpi:nth-child(6) { animation-delay: .34s; }

/* Cards principais */
.card {
  animation: fadeUp .5s ease-out .12s backwards;
}

/* Banner de alertas (overview) */
.alerts .alert {
  animation: fadeUp .4s ease-out backwards;
}
.alerts .alert:nth-child(1) { animation-delay: .02s; }
.alerts .alert:nth-child(2) { animation-delay: .07s; }
.alerts .alert:nth-child(3) { animation-delay: .12s; }
.alerts .alert:nth-child(4) { animation-delay: .17s; }

/* Linhas de tabela (sutil) */
.tbl tbody tr {
  animation: fadeIn .35s ease-out backwards;
}
.tbl tbody tr:nth-child(1) { animation-delay: .05s; }
.tbl tbody tr:nth-child(2) { animation-delay: .08s; }
.tbl tbody tr:nth-child(3) { animation-delay: .11s; }
.tbl tbody tr:nth-child(4) { animation-delay: .14s; }
.tbl tbody tr:nth-child(n+5) { animation-delay: .17s; }

/* Modal */
.modal-bg.open {
  animation: fadeIn .18s ease-out;
}
.modal-bg.open .modal {
  animation: scaleIn .28s cubic-bezier(.22,.9,.32,1.1);
}

/* Sidebar links (micro-deslocamento no hover) */
.side-link {
  transition: background .18s, color .18s, border-color .18s, padding-left .18s;
}
.side-link:hover { padding-left: calc(1.8rem + 4px); }

/* Botões */
.btn, .login-btn, .cta-btn {
  transition: background .18s, color .18s, border-color .18s, transform .12s, box-shadow .18s;
}
.btn:active, .login-btn:active, .cta-btn:active {
  transform: scale(.97);
}

/* Linhas de tabela hover mais suave */
.tbl tbody tr {
  transition: background .15s;
}

/* Bar fills entram suaves */
.bar-fill {
  transition: width .9s cubic-bezier(.2,.8,.2,1);
}

/* Login card aparece com escala */
.login-card {
  animation: scaleIn .45s cubic-bezier(.2,.9,.3,1.05);
}

/* Toggle de aba (login/cadastro/forgot) */
.auth-form.active {
  animation: fadeUp .25s ease-out;
}

/* Acessibilidade: 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;
  }
}

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

/* ── RESPONSIVE ────────────────────────────────── */
@media (max-width: 1100px) {
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 880px) {
  .app { grid-template-columns: 1fr; }
  .side {
    position: fixed; top: 0; left: 0;
    width: 280px; height: 100vh; z-index: 50;
    transform: translateX(-100%);
    transition: transform .25s;
  }
  .side.open { transform: translateX(0); box-shadow: 0 0 40px rgba(0,0,0,.6); }
  .side-toggle { display: block; }
  .main { padding: 5rem 1.4rem 2rem; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .field-row { grid-template-columns: 1fr; }

  /* Tabelas: scroll horizontal preservando legibilidade */
  .card-body.flush { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tbl { min-width: 540px; }
  .tbl th, .tbl td { padding: .7rem .8rem; font-size: .76rem; white-space: nowrap; }

  /* Card heads: stack quando o título e botão não cabem */
  .card-head {
    flex-direction: column;
    align-items: flex-start;
    gap: .7rem;
  }

  /* DRE rows: melhor leitura */
  .dre-row { padding: .65rem 1rem; font-size: .82rem; }
  .dre-row.sub .lbl { padding-left: .8rem; font-size: .75rem; }

  /* Toolbar admin */
  .toolbar input { min-width: 100%; }

  /* Touch targets — WCAG 2.5.5 mínimo 44px */
  .btn { min-height: 44px; min-width: 44px; }
  .btn.sm { min-height: 36px; } /* tolerável em contexto de tabela */

  /* Legibilidade — mínimo .6rem para labels de interface */
  .kpi-lbl { font-size: .6rem; }
}

@media (max-width: 580px) {
  /* KPIs em 2 colunas (em vez de 1) */
  .kpis { grid-template-columns: 1fr 1fr !important; }

  .main { padding: 4.5rem 1rem 1.5rem; }
  .page-title { font-size: 1.4rem; line-height: 1.1; }
  .page-eyebrow { font-size: .6rem; }

  /* Modal full-width em telas pequenas */
  .modal-bg { padding: .8rem; }
  .modal { max-width: 100%; }
  .modal-head, .modal-body { padding: 1rem; }
  .field input, .field select, .field textarea { font-size: 16px; } /* impede zoom no iOS */

  /* Charts não esticam demais */
  .chart-wrap canvas { height: 240px !important; }

  /* KPI tipografia escalonada */
  .kpi { padding: 1rem .9rem; }
  .kpi-val { font-size: 1.35rem; }

  /* Login form */
  .login-card { padding: 2rem 1.5rem; }
  .login-wrap { padding: 1rem; }

  /* Side mais compacta */
  .side { width: 86vw; max-width: 320px; }

  /* Card-head botões cabem certinho */
  .card-head .btn { font-size: .55rem; padding: .55rem .8rem; }
}
