/* ============================================================================= */
/* Crescer — Design System (foundational kit)                                    */
/* Tokens de cor (--crescer-*) + componentes base + shell + login.               */
/* Rebrand: troque --crescer-brand e derivados (ver references/tokens.md).       */
/* ============================================================================= */

/* Todo o kit vive na cascade layer `crescer` — ver a ordem declarada em
   application.css. Isso deixa os utilitários do Tailwind sobreporem o kit. */
@layer crescer {
:root {
  /* --- Superfícies ---------------------------------------------------------- */
  --crescer-bg:         #F0F0F5;
  --crescer-surface:    #ffffff;
  --crescer-surface-2:  #F7F7FA;
  --crescer-border:     #D3D4DD;
  --crescer-text:       #24252E;
  --crescer-text-soft:  #515162;
  --crescer-text-faint: #696979;

  /* --- Marca (troque estes para rebrandar por app) -------------------------- */
  --crescer-brand:        #007AF0;
  --crescer-brand-light:  #498FFF;
  --crescer-brand-dark:   #0069D0;  /* fill que carrega texto pequeno — 5,3:1 c/ branco */
  --crescer-brand-darker: #0056AC;  /* hover desses fills */
  --crescer-accent:       #02786D;
  --crescer-secondary:    #515162;

  /* --- Semânticas ----------------------------------------------------------- */
  --crescer-ok:     #217B00;  --crescer-ok-bg:     #E4F4E0;
  --crescer-warn:   #E76F00;  --crescer-warn-bg:   #FDEEDF;
  --crescer-danger: #D01E29;  --crescer-danger-bg: #FBE2E4;
  --crescer-info:   #007AF0;  --crescer-info-bg:   #E3F0FE;

  /* --- Sidebar (slate escuro) ----------------------------------------------- */
  --crescer-sb-bg:     #1e293b;
  --crescer-sb-hover:  #334155;
  --crescer-sb-active: #1e40af;
  --crescer-sb-text:   #e2e8f0;
  --crescer-sb-muted:  #94a3b8;
  --crescer-sb-accent: #60a5fa;

  /* --- Forma e sombra ------------------------------------------------------- */
  --crescer-radius:       8px;
  --crescer-radius-lg:    12px;
  --crescer-shadow-card:  0 1px 3px 0 rgb(0 0 0 / 0.08), 0 1px 2px -1px rgb(0 0 0 / 0.08);
  --crescer-shadow-hover: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --crescer-shadow-modal: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --crescer-sidebar-w:      264px;
  --crescer-sidebar-w-rail: 64px;
  --crescer-font: "IBM Plex Sans", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* --- Gradiente de marca + séries de dados --------------------------------- */
  --crescer-ai-grad: linear-gradient(90deg,#007AF0,#6D4AE0);
  --crescer-cat-1:#007AF0; --crescer-cat-2:#0EA5A0; --crescer-cat-3:#C98500; --crescer-cat-4:#6D4AE0;
  --crescer-cat-5:#E85AA0; --crescer-cat-6:#00A46B; --crescer-cat-7:#EB6834;
}

* { box-sizing: border-box; }

body.crescer-body {
  margin: 0;
  background: var(--crescer-bg);
  color: var(--crescer-text);
  font-family: var(--crescer-font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Cor padrão de link. Envolvida em :where() para ter especificidade ZERO: qualquer
   classe do markup (utilitário do Tailwind como .text-white, ou um .crescer-btn)
   vence sem precisar de !important. Sem isso, `a:hover` (0,1,1) sobrepunha
   `.text-white` (0,1,0) e o texto de botões-link sumia no hover. */
:where(a) { color: var(--crescer-brand); text-decoration: none; }
:where(a:hover) { color: var(--crescer-brand-dark); }

:focus-visible { outline: 2px solid var(--crescer-brand); outline-offset: 2px; border-radius: 4px; }

/* ============================================================================= */
/* SHELL — grade sidebar + main                                                  */
/* ============================================================================= */
.crescer-shell {
  display: grid; grid-template-columns: var(--crescer-sidebar-w) 1fr; min-height: 100vh;
  transition: grid-template-columns .2s ease;
}

.crescer-sidebar {
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, #0b1220 0%, #0f172a 42%, #16233b 100%);
  color: var(--crescer-sb-text);
  padding: 20px 14px 16px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  border-right: 1px solid rgba(255,255,255,.06);
  transition: padding .2s ease;
}
.crescer-sidebar::-webkit-scrollbar { width: 6px; }
.crescer-sidebar::-webkit-scrollbar-thumb { background: rgba(148,163,184,.35); border-radius: 3px; }
.crescer-sidebar::-webkit-scrollbar-thumb:hover { background: rgba(148,163,184,.6); }

.crescer-brand {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 2px 8px 18px; margin-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.crescer-brand__txt { min-width: 0; }
.crescer-brand__mark {
  width: 40px; height: 40px; border-radius: 11px; flex: none;
  background: var(--crescer-ai-grad); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(0,122,240,.4), inset 0 1px 0 rgba(255,255,255,.25);
}
.crescer-brand__name { font-weight: 700; font-size: 17px; color: #fff; letter-spacing: -.02em; line-height: 1.1; }
.crescer-brand__sub  { font-size: 10px; color: var(--crescer-sb-muted); text-transform: uppercase; letter-spacing: .9px; margin-top: 2px; }

.crescer-nav-wrap { flex: 1 1 auto; }
.crescer-nav { list-style: none; margin: 0; padding: 0; }
.crescer-nav__section { font-size: 9.5px; text-transform: uppercase; letter-spacing: .12em; color: #64748b; margin: 18px 12px 7px; font-weight: 700; }
.crescer-nav li { margin: 1px 0; }
.crescer-nav a {
  position: relative; display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 10px;
  color: #cbd5e1; font-weight: 500; font-size: 13.5px;
  transition: background-color .18s ease, color .18s ease, transform .18s ease;
}
.crescer-nav a .ico { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; color: #8b9bb4; flex: none; transition: color .18s ease, transform .18s ease; }
.crescer-nav a:hover { background: rgba(255,255,255,.06); color: #fff; transform: translateX(3px); }
.crescer-nav a:hover .ico { color: #cbd5e1; }
.crescer-nav a.is-active {
  background: linear-gradient(90deg, rgba(0,122,240,.22), rgba(109,74,224,.16));
  color: #fff; box-shadow: inset 0 0 0 1px rgba(96,165,250,.25);
}
.crescer-nav a.is-active .ico { color: #7dd3fc; }
.crescer-nav a.is-active::before {
  content: ""; position: absolute; left: -14px; top: 50%; transform: translateY(-50%);
  width: 4px; height: 22px; border-radius: 0 4px 4px 0;
  background: linear-gradient(180deg, #38bdf8, #6d4ae0); box-shadow: 0 0 10px rgba(56,189,248,.7);
}

/* Botão de recolher para "rail" (só no desktop) */
.crescer-rail-toggle {
  margin-left: auto; flex: none; width: 26px; height: 26px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.06); color: var(--crescer-sb-muted);
  border: 1px solid rgba(255,255,255,.10); border-radius: 7px; cursor: pointer;
  transition: background-color .15s ease, color .15s ease, transform .2s ease;
}
.crescer-rail-toggle:hover { background: rgba(255,255,255,.14); color: #fff; }
/* O ícone gira para indicar o estado. Agnóstico de biblioteca: pega o SVG do kit
   (.crescer-ico), um <svg> solto ou um <i> de icon-font (FontAwesome). */
.crescer-rail-toggle > :is(.crescer-ico, svg, i) { transition: transform .2s ease; transform: rotate(180deg); }

/* Card do operador no rodapé da sidebar */
.crescer-sidebar__foot { margin-top: 18px; padding: 12px 4px 2px; border-top: 1px solid rgba(255,255,255,.07); }
.crescer-op-card {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: 11px; background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.06); transition: background-color .15s ease;
}
.crescer-op-card:hover { background: rgba(255,255,255,.07); }
.crescer-op-card__avatar {
  flex: none; width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
  background: var(--crescer-ai-grad); box-shadow: inset 0 1px 0 rgba(255,255,255,.25);
}
.crescer-op-card__info { flex: 1 1 auto; min-width: 0; line-height: 1.25; }
.crescer-op-card__info b { display: block; font-size: 13px; color: #fff; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crescer-op-card__info span { display: block; font-size: 11px; color: var(--crescer-sb-muted); text-transform: capitalize; }
.crescer-op-card__sair {
  flex: none; width: 32px; height: 32px; padding: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--crescer-sb-muted);
  border: 1px solid rgba(255,255,255,.10); border-radius: 8px;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.crescer-op-card__sair:hover { background: rgba(208,30,41,.18); color: #fecaca; border-color: rgba(208,30,41,.4); }

/* Scrim (fundo escurecido) do off-canvas no mobile */
.crescer-scrim {
  display: none; position: fixed; inset: 0; z-index: 55; border: 0; padding: 0;
  background: rgba(2,6,23,.5); cursor: pointer; -webkit-appearance: none; appearance: none;
}

/* --- Main / topbar / content ------------------------------------------------ */
.crescer-main { display: flex; flex-direction: column; min-width: 0; }

.crescer-topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 28px; background: var(--crescer-surface); border-bottom: 1px solid var(--crescer-border);
  position: sticky; top: 0; z-index: 20;
}
.crescer-topbar__title h1 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.crescer-topbar__title p  { margin: 2px 0 0; font-size: 12.5px; color: var(--crescer-text-faint); }
.crescer-topbar__right { display: flex; align-items: center; gap: 14px; }
.crescer-topbar__meta { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--crescer-text-faint); }
.crescer-user-link { display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit; border-radius: 8px; padding: 4px 6px; margin: -4px -6px; transition: background .12s ease; }
.crescer-user-link:hover { background: var(--crescer-surface-2); }
.crescer-user { text-align: right; line-height: 1.25; }
.crescer-user b { font-size: 13px; }
.crescer-user span { display: block; font-size: 11.5px; color: var(--crescer-text-faint); }
.crescer-avatar {
  width: 38px; height: 38px; border-radius: 50%; background: var(--crescer-brand);
  color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px;
}
.crescer-breadcrumb { font-size:12px; color:var(--crescer-text-faint); margin-bottom:2px; }
.crescer-breadcrumb b { color:var(--crescer-text-soft); font-weight:600; }
.crescer-status-dot { width:8px; height:8px; border-radius:50%; background:var(--crescer-ok); display:inline-block; }
.crescer-status-dot--off { background:var(--crescer-text-faint); }
#crescer-menu-toggle { display: none; }

.crescer-content { padding: 26px 28px 48px; animation: crescer-fade .18s ease; }
@keyframes crescer-fade { from { opacity:.5; } to { opacity:1; } }
.crescer-content-actions { display: flex; justify-content: flex-end; margin-bottom: 16px; }

/* ============================================================================= */
/* BOTÕES                                                                        */
/* ============================================================================= */
.crescer-btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 8px;
  border: 1px solid transparent; font-weight: 500; font-size: 13px; letter-spacing: .02em;
  cursor: pointer; line-height: 1; transition: background-color .15s, border-color .15s; text-decoration: none;
}
.crescer-btn:hover { text-decoration: none; box-shadow: none; }
/* Fills que carregam texto pequeno usam o passo ESCURO: --crescer-brand puro (#007AF0)
   dá só 4,17:1 com branco, abaixo do mínimo AA de 4,5:1 — em rótulo de 13px o texto
   lava. A marca pura segue nas superfícies grandes (gradiente do login, logo, links). */
.crescer-btn--primary { background: var(--crescer-brand-dark); color: #fff; }
.crescer-btn--primary:hover { background: var(--crescer-brand-darker); color: #fff; }
.crescer-btn--ghost { background: var(--crescer-surface); color: var(--crescer-text); border-color: var(--crescer-border); }
.crescer-btn--ghost:hover { background: var(--crescer-surface-2); color: var(--crescer-text); border-color: var(--crescer-brand); }
.crescer-btn--ok { background: var(--crescer-ok); color: #fff; }
.crescer-btn--danger { background: var(--crescer-danger); color: #fff; }
.crescer-btn--danger:hover { background: #A4151E; color: #fff; }
.crescer-btn--ia { background: var(--crescer-ai-grad); color: #fff; border-color: transparent; }
.crescer-btn--ia:hover { filter: brightness(1.05); color: #fff; }
.crescer-btn--sm { padding: 6px 11px; font-size: 12px; }
.crescer-btn--icon {
  padding: 0; width: 36px; height: 36px; justify-content: center;
  background: var(--crescer-surface); border: 1px solid var(--crescer-border); color: var(--crescer-text-soft); border-radius: 8px;
}
.crescer-btn--icon:hover { background: var(--crescer-surface-2); border-color: var(--crescer-brand); color: var(--crescer-brand); }
.crescer-btn.is-loading { pointer-events:none; opacity:.85; }

/* Segmented control */
.crescer-segmented { display: inline-flex; border: 1px solid var(--crescer-border); border-radius: 8px; overflow: hidden; background: var(--crescer-surface); }
.crescer-segmented > * {
  padding: 8px 14px; font-size: 13px; font-weight: 500; border: 0; background: transparent;
  color: var(--crescer-text-soft); cursor: pointer; border-right: 1px solid var(--crescer-border); display: inline-flex; align-items: center; gap: 7px; text-decoration: none;
}
.crescer-segmented > *:last-child { border-right: 0; }
.crescer-segmented > *:hover { background: var(--crescer-surface-2); color: var(--crescer-text); text-decoration: none; }
.crescer-segmented > .is-active { background: var(--crescer-brand-dark); color: #fff; }
.crescer-segmented > .is-active:hover { background: var(--crescer-brand-darker); color: #fff; }

/* ============================================================================= */
/* PILLS / BADGES                                                                */
/* ============================================================================= */
.crescer-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 8px; font-size: 11.5px; font-weight: 500; line-height: 1.6; white-space: nowrap; }
.crescer-pill--vermelho { background: var(--crescer-danger-bg); color: var(--crescer-danger); }
.crescer-pill--laranja  { background: var(--crescer-warn-bg);   color: var(--crescer-warn); }
.crescer-pill--azul     { background: var(--crescer-info-bg);   color: var(--crescer-info); }
.crescer-pill--verde    { background: var(--crescer-ok-bg);     color: var(--crescer-ok); }
.crescer-pill--cinza    { background: #ECEDF2;                  color: var(--crescer-text-soft); }
.crescer-pill--roxo     { background: #EBE9FB;                  color: #5B3FC4; }
.crescer-tag-soft { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 8px; font-size: 11.5px; font-weight: 500; color: var(--crescer-text-soft); background: var(--crescer-surface-2); border: 1px solid var(--crescer-border); }

/* Selo / superfície de IA */
.crescer-ai-badge {
  display:inline-flex; align-items:center; gap:5px; font-size:11px; font-weight:700; letter-spacing:.02em;
  color:var(--crescer-brand); background:linear-gradient(90deg,#E3F0FE,#EDE9FB);
  border:1px solid var(--crescer-brand-light); padding:2px 9px; border-radius:8px; line-height:1.6;
}
.crescer-ai-badge .crescer-ico { width:12px; height:12px; }
.crescer-ai-surface { position:relative; border:1px solid var(--crescer-brand-light); background:linear-gradient(180deg,#F5F8FF 0,var(--crescer-surface) 64px); }
.crescer-ai-surface::before { content:""; position:absolute; inset:0 0 auto 0; height:3px; background:var(--crescer-ai-grad); border-radius:var(--crescer-radius) var(--crescer-radius) 0 0; }

/* ============================================================================= */
/* CARDS + KPI                                                                   */
/* ============================================================================= */
.crescer-card {
  background: var(--crescer-surface); border: 1px solid var(--crescer-border); border-radius: var(--crescer-radius);
  box-shadow: var(--crescer-shadow-card); margin-bottom: 22px; transition: box-shadow .2s ease;
}
.crescer-card:hover { box-shadow: var(--crescer-shadow-hover); }
.crescer-card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--crescer-border); }
.crescer-card__head h2 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.crescer-card__head p  { margin: 2px 0 0; font-size: 12.5px; color: var(--crescer-text-faint); }
.crescer-card__body { padding: 20px; }
.crescer-card__body--flush { padding: 0; }
.crescer-card__foot { display: flex; gap: 12px; padding: 16px 20px; border-top: 1px solid var(--crescer-border); background: var(--crescer-surface-2); border-radius: 0 0 var(--crescer-radius) var(--crescer-radius); }

.crescer-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 24px; align-items: stretch; }
/* Bloco de KPIs em 2 colunas fixas — para quando ele divide a linha com um gráfico. */
.crescer-kpis--2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width:460px){ .crescer-kpis--2 { grid-template-columns: 1fr; } }
.crescer-kpi {
  background: var(--crescer-surface); border: 1px solid var(--crescer-border); border-radius: var(--crescer-radius);
  padding: 18px; box-shadow: var(--crescer-shadow-card); transition: box-shadow .2s ease;
}
.crescer-kpi:hover { box-shadow: var(--crescer-shadow-hover); }
.crescer-kpi__top { display: flex; align-items: center; justify-content: space-between; }
.crescer-kpi__label { font-size: 11.5px; color: var(--crescer-text-faint); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.crescer-kpi__value { font-size: 30px; font-weight: 700; margin: 8px 0 2px; letter-spacing: -.02em; }
.crescer-kpi__hint  { font-size: 12px; color: var(--crescer-text-faint); }
.crescer-kpi__icon { width: 34px; height: 34px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; }
.crescer-kpi__icon--brand  { background: #E3F0FE; color: var(--crescer-brand); }
.crescer-kpi__icon--ok     { background: var(--crescer-ok-bg); color: var(--crescer-ok); }
.crescer-kpi__icon--warn   { background: var(--crescer-warn-bg); color: var(--crescer-warn); }
.crescer-kpi__icon--danger { background: var(--crescer-danger-bg); color: var(--crescer-danger); }
.crescer-kpi--brand  { border-top: 3px solid var(--crescer-brand); }
.crescer-kpi--ok     { border-top: 3px solid var(--crescer-ok); }
.crescer-kpi--warn   { border-top: 3px solid var(--crescer-warn); }
.crescer-kpi--danger { border-top: 3px solid var(--crescer-danger); }

/* Detalhe (definição/valor) */
.crescer-dl { display: grid; grid-template-columns: 180px 1fr; gap: 10px 18px; }
.crescer-dl dt { color: var(--crescer-text-faint); font-weight: 600; font-size: 12.5px; }
.crescer-dl dd { margin: 0; font-size: 13.5px; }

.crescer-callout { border-left: 3px solid var(--crescer-brand); background: var(--crescer-info-bg); padding: 12px 16px; border-radius: 8px; font-size: 13px; color: #0B3D91; }

/* Details genérico (expandível nativo) */
.crescer-details { background: var(--crescer-surface); border: 1px solid var(--crescer-border); border-radius: var(--crescer-radius); margin-bottom: 12px; overflow: hidden; }
.crescer-details > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 14px 18px; font-weight: 600; font-size: 14px; }
.crescer-details > summary::-webkit-details-marker { display: none; }
.crescer-details > summary .crescer-chevron { margin-left: auto; transition: transform .15s; }
.crescer-details[open] > summary .crescer-chevron { transform: rotate(90deg); }
.crescer-details[open] > summary { border-bottom: 1px solid var(--crescer-border); }
.crescer-details__body { padding: 18px; }

/* ============================================================================= */
/* CAMPOS / FORMULÁRIOS                                                          */
/* ============================================================================= */
.crescer-filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.crescer-field { display: flex; flex-direction: column; gap: 5px; }
.crescer-field label { font-size: 11.5px; font-weight: 600; color: var(--crescer-text-soft); }
.crescer-field input, .crescer-field select, .crescer-field textarea, .crescer-input {
  padding: 9px 11px; border: 1px solid var(--crescer-border); border-radius: 8px; font-size: 13px;
  background: var(--crescer-surface); color: var(--crescer-text); min-width: 170px; font-family: inherit;
}
.crescer-field input:focus, .crescer-field select:focus, .crescer-field textarea:focus, .crescer-input:focus {
  outline: none; border-color: var(--crescer-brand); box-shadow: 0 0 0 3px rgba(0,122,240,.15);
}
.crescer-input--sm, .crescer-field .crescer-input--sm { height: 32px; padding: 4px 8px; font-size: 13px; width: auto; min-width: 64px; }
.crescer-field-inline { display: flex; align-items: center; gap: 6px; }
.crescer-field-inline .crescer-input--sm { width: 70px; min-width: 0; }
.crescer-field-inline__sep { color: var(--crescer-text-faint); }

.crescer-form { max-width: 860px; }
.crescer-form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.crescer-form-grid .crescer-field { min-width: 0; }
.crescer-form-grid .crescer-field input,
.crescer-form-grid .crescer-field select,
.crescer-form-grid .crescer-field textarea { width: 100%; min-width: 0; }
.crescer-field--full { grid-column: 1 / -1; }
.crescer-field__hint { font-size: 11.5px; color: var(--crescer-text-faint); margin: 2px 0 0; }
.crescer-field__hint code { background: var(--crescer-surface-2); border: 1px solid var(--crescer-border); border-radius: 4px; padding: 0 4px; font-size: 11px; }
.crescer-form-actions { display: flex; gap: 12px; margin-top: 4px; }
.crescer-check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--crescer-text); font-weight: 500; cursor: pointer; }
.crescer-check input { width: 16px; height: 16px; accent-color: var(--crescer-brand); }

/* Switch (toggle Sim/Não) */
.crescer-switch { display: inline-flex; align-items: center; gap: 10px; font-size: 13px; color: var(--crescer-text); font-weight: 500; cursor: pointer; user-select: none; }
.crescer-switch__input { position: absolute; opacity: 0; width: 0; height: 0; }
.crescer-switch__track { position: relative; flex: none; width: 42px; height: 24px; border-radius: 999px; background: var(--crescer-surface-2); border: 1px solid var(--crescer-border); transition: background .15s ease, border-color .15s ease; }
.crescer-switch__track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s ease; }
.crescer-switch__input:checked + .crescer-switch__track { background: var(--crescer-brand); border-color: var(--crescer-brand); }
.crescer-switch__input:checked + .crescer-switch__track::after { transform: translateX(18px); }
.crescer-switch__input:focus-visible + .crescer-switch__track { outline: 2px solid var(--crescer-brand); outline-offset: 2px; }
.crescer-switch__state { min-width: 26px; color: var(--crescer-text-faint); font-weight: 600; }
.crescer-switch__state::after { content: "Não"; }
.crescer-switch__input:checked ~ .crescer-switch__state { color: var(--crescer-brand); }
.crescer-switch__input:checked ~ .crescer-switch__state::after { content: "Sim"; }

/* Toolbar de filtros (acima das grids) */
.crescer-toolbar {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end;
  padding: 14px 16px; border-bottom: 1px solid var(--crescer-border); background: var(--crescer-surface-2);
}
.crescer-toolbar__right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.crescer-toolbar__count { font-size: 12.5px; color: var(--crescer-text-faint); font-weight: 600; white-space: nowrap; }
.crescer-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 16px 0; }
.crescer-chip-filtro {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px 4px 10px;
  border-radius: 8px; font-size: 12px; font-weight: 600; background: var(--crescer-info-bg); color: var(--crescer-info);
}
.crescer-chip-filtro a { color: inherit; opacity: .7; line-height: 1; font-weight: 700; }
.crescer-chip-filtro a:hover { opacity: 1; text-decoration: none; }

/* ============================================================================= */
/* TABELAS                                                                       */
/* ============================================================================= */
.crescer-table-wrap { width:100%; overflow-x:auto; -webkit-overflow-scrolling:touch; }
.crescer-table, table.crescer-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.crescer-table thead th { background: var(--crescer-surface-2); color: var(--crescer-text-faint); text-transform: uppercase; font-size: 11px; letter-spacing: .04em; padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--crescer-border); font-weight: 600; }
.crescer-table tbody td { padding: 11px 14px; border-bottom: 1px solid var(--crescer-border); vertical-align: middle; }
.crescer-table tbody tr:nth-child(even) { background: rgba(0,0,0,.015); }
.crescer-table tbody tr:hover { background: var(--crescer-surface-2); }
.crescer-num { text-align: right; font-variant-numeric: tabular-nums; }
.crescer-mono { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--crescer-text); }

/* Detalhe key/value + JSON */
.crescer-kv { width: 100%; border-collapse: collapse; font-size: 13px; }
.crescer-kv th { text-align: left; width: 230px; color: var(--crescer-text-faint); font-weight: 600; padding: 8px 12px 8px 0; vertical-align: top; border-bottom: 1px solid var(--crescer-border); }
.crescer-kv td { padding: 8px 0; border-bottom: 1px solid var(--crescer-border); vertical-align: top; }
.crescer-json { background: var(--crescer-surface-2); border: 1px solid var(--crescer-border); border-radius: var(--crescer-radius); padding: 12px; font-size: 12px; line-height: 1.5; overflow-x: auto; margin: 0; }

/* ============================================================================= */
/* PAGINAÇÃO                                                                     */
/* ============================================================================= */
.crescer-pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 16px; border-top: 1px solid var(--crescer-border); }
.crescer-pagination__left { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.crescer-pagination__info { font-size: 12.5px; color: var(--crescer-text-faint); }
.crescer-pagination__nav { display: flex; align-items: center; gap: 4px; }
.crescer-perpage { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.crescer-perpage label { font-size: 12.5px; color: var(--crescer-text-faint); font-weight: 500; }
.crescer-page-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; height: 32px; padding: 0 8px;
  border: 1px solid var(--crescer-border); border-radius: 8px; background: var(--crescer-surface);
  color: var(--crescer-text-soft); font-size: 13px; font-weight: 600; text-decoration: none;
  cursor: pointer; transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.crescer-page-btn:hover { background: var(--crescer-surface-2); color: var(--crescer-text); border-color: var(--crescer-brand-light); }
.crescer-page-btn.is-active { background: var(--crescer-brand-dark); border-color: var(--crescer-brand-dark); color: #fff; cursor: default; }
/* Extremos da paginação (primeira/última página): presentes, mas inertes. */
.crescer-page-btn.is-disabled { color: var(--crescer-border); border-color: var(--crescer-border); background: var(--crescer-surface); cursor: not-allowed; pointer-events: none; }
.crescer-page-ellipsis { padding: 0 4px; color: var(--crescer-text-faint); }

/* ============================================================================= */
/* MEDIDOR (meter) + BARRAS                                                      */
/* ============================================================================= */
.crescer-meter { display: inline-flex; align-items: center; gap: 8px; }
.crescer-meter__track { width: 64px; height: 6px; border-radius: 3px; background: var(--crescer-border); overflow: hidden; }
.crescer-meter__fill { height: 100%; border-radius: 3px; }
.crescer-meter__fill--alto  { background: var(--crescer-danger); }
.crescer-meter__fill--medio { background: var(--crescer-warn); }
.crescer-meter__fill--baixo { background: var(--crescer-ok); }
.crescer-bars { display: flex; flex-direction: column; gap: 12px; }
.crescer-bar__top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.crescer-bar__track { height: 8px; border-radius: 4px; background: var(--crescer-surface-2); overflow: hidden; }
.crescer-bar__fill { height: 8px; border-radius: 4px; background: var(--crescer-brand); }

/* ============================================================================= */
/* EMPTY STATE                                                                   */
/* ============================================================================= */
.crescer-empty { text-align: center; padding: 48px 20px; color: var(--crescer-text-faint); }
.crescer-empty__icon { color: var(--crescer-text-faint); margin-bottom: 8px; opacity: .55; font-size: 40px; }
.crescer-empty h3 { margin: 0 0 4px; color: var(--crescer-text-soft); font-size: 16px; }
.crescer-empty__action { margin-top: 14px; }

/* ============================================================================= */
/* FLASH + TOAST                                                                 */
/* ============================================================================= */
.crescer-flash { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; border-radius: 8px; margin-bottom: 18px; font-size: 13.5px; font-weight: 500; border: 1px solid transparent; }
.crescer-flash--notice { background: var(--crescer-ok-bg); color: #14532d; border-color: #BBE6B0; }
.crescer-flash--alert  { background: var(--crescer-danger-bg); color: #7f1d1d; border-color: #F3C2C6; }
.crescer-flash--info   { background: var(--crescer-info-bg); color: #0B3D91; border-color: #BBD9FB; }
.crescer-toast-wrap { position: fixed; top: 16px; right: 16px; z-index: 100; display: flex; flex-direction: column; gap: 10px; max-width: 380px; }
.crescer-toast { box-shadow: var(--crescer-shadow-modal); cursor: pointer; margin: 0; align-items: center; transition: opacity .3s ease, transform .3s ease; }
.crescer-toast > span { flex: 1 1 auto; min-width: 0; }
.crescer-toast--leaving { opacity: 0; transform: translateX(12px); }
.crescer-toast__close { flex: none; border: 0; background: transparent; color: inherit; opacity: .55; cursor: pointer; font-size: 20px; line-height: 1; padding: 0 2px; margin: -2px -4px -2px 4px; transition: opacity .12s ease; }
.crescer-toast__close:hover { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .crescer-toast { transition: none; } }

/* ============================================================================= */
/* MODAL (<dialog> nativo)                                                       */
/* ============================================================================= */
.crescer-modal { border: 0; padding: 0; width: min(640px, calc(100vw - 32px)); position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); margin: 0; border-radius: var(--crescer-radius-lg); background: var(--crescer-surface); color: var(--crescer-text); box-shadow: var(--crescer-shadow-modal); }
.crescer-modal::backdrop { background: rgba(15, 23, 42, .45); }
.crescer-modal__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--crescer-border); }
.crescer-modal__head h2 { margin: 0; font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.crescer-modal__close { border: 0; background: transparent; color: var(--crescer-text-faint); font-size: 22px; line-height: 1; cursor: pointer; padding: 2px 8px; border-radius: 6px; }
.crescer-modal__close:hover { background: var(--crescer-surface-2); color: var(--crescer-text); }
.crescer-modal__body { padding: 20px; max-height: 70vh; overflow-y: auto; }

/* ============================================================================= */
/* POPOVER DE AÇÕES (position: fixed via Stimulus acoes)                         */
/* ============================================================================= */
.crescer-actions-pop-wrap { display: inline-block; }
.crescer-actions-pop {
  position: fixed; top: 0; left: 0; z-index: 1000; width: 328px;
  max-height: min(74vh, 580px); overflow-y: auto;
  background: var(--crescer-surface); border: 1px solid var(--crescer-border);
  border-radius: var(--crescer-radius-lg); box-shadow: var(--crescer-shadow-modal);
  padding: 14px; text-align: left;
}
.crescer-actions-pop[hidden] { display: none; }
.crescer-actions-pop__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 2px; }
.crescer-actions-pop__head > span { font-weight: 600; font-size: 13px; color: var(--crescer-text); }
.crescer-actions-pop__close {
  border: 0; background: transparent; color: var(--crescer-text-faint); font-size: 20px;
  line-height: 1; cursor: pointer; padding: 2px 6px; border-radius: 6px;
}
.crescer-actions-pop__close:hover { color: var(--crescer-text); background: var(--crescer-surface-2); }
.crescer-actions-pop__hint { font-size: 11px; color: var(--crescer-text-faint); margin: 0 0 12px; }
.crescer-act {
  background: var(--crescer-surface-2); border: 1px solid var(--crescer-border); border-left-width: 3px;
  border-radius: var(--crescer-radius); padding: 12px; margin-bottom: 12px;
}
.crescer-act:last-child { margin-bottom: 0; }
.crescer-act__head { display: flex; align-items: center; gap: 7px; font-weight: 600; font-size: 13px; margin-bottom: 10px; }
.crescer-act__head .crescer-ico { flex: none; }
.crescer-act .crescer-field { margin-bottom: 8px; }
.crescer-act__submit { width: 100%; margin-top: 2px; justify-content: center; }

/* ============================================================================= */
/* ÍCONES + LOGO + SKELETON                                                      */
/* ============================================================================= */
.crescer-ico { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
.crescer-ico--lg { width: 20px; height: 20px; vertical-align: -4px; }
.crescer-ico--xl { width: 44px; height: 44px; stroke-width: 1.4; }
.crescer-btn .crescer-ico { vertical-align: middle; }
.crescer-logo { display: block; }
.crescer-brand__mark .crescer-logo, .crescer-auth__mark .crescer-logo { color: #fff; }

.crescer-skeleton { border-radius:6px; background:#E9EAF0; position:relative; overflow:hidden; }
.crescer-skeleton::after { content:""; position:absolute; inset:0; background:linear-gradient(90deg,transparent,rgba(255,255,255,.65),transparent); transform:translateX(-100%); animation:crescer-shimmer 1.3s infinite; }
@keyframes crescer-shimmer { 100% { transform:translateX(100%); } }
.crescer-skeleton--line { height:12px; margin:8px 0; }
.crescer-spin { display:inline-block; width:14px; height:14px; border:2px solid rgba(255,255,255,.4); border-top-color:#fff; border-radius:50%; animation:crescer-spin .7s linear infinite; vertical-align:-2px; }
@keyframes crescer-spin { to { transform:rotate(360deg); } }
@media (prefers-reduced-motion: reduce){ .crescer-skeleton::after, .crescer-spin, .crescer-content { animation:none; } }

/* ============================================================================= */
/* GRIDS UTILITÁRIOS                                                             */
/* ============================================================================= */
.crescer-grid-2 { display:grid; grid-template-columns:1.1fr 1fr; gap:22px; align-items:start; }
.crescer-grid-3 { display:grid; grid-template-columns:repeat(3,1fr); gap:16px; }
@media (max-width:900px){ .crescer-grid-2, .crescer-grid-3 { grid-template-columns:1fr; } }
/* Degraus de coluna dos KPIs: 4 -> 2 -> 1, PULANDO o passo de 3.
   Com os blocos de 4 KPIs (o caso comum) três colunas deixam um item órfão sozinho na
   segunda linha, e a linha vizinha desalinha. `auto-fit` sozinho passa por esse estado,
   por isso os degraus são explícitos. */
@media (max-width:1240px){ .crescer-kpis { grid-template-columns: repeat(2, 1fr); } }
@media (max-width:460px){ .crescer-kpis { grid-template-columns: 1fr; gap:10px; } }
@media (max-width:640px){ .crescer-kpi__value { font-size:24px; } }
@media (max-width: 640px) { .crescer-form-grid { grid-template-columns: 1fr; } }

/* ============================================================================= */
/* MODO RAIL (sidebar recolhida) + RESPONSIVO (off-canvas ≤900px)                */
/* ============================================================================= */
.crescer-shell--rail { --crescer-sidebar-w: var(--crescer-sidebar-w-rail); }
.crescer-shell--rail .crescer-sidebar { padding-left: 8px; padding-right: 8px; }
.crescer-shell--rail .crescer-brand { justify-content: center; padding-left: 0; padding-right: 0; }
.crescer-shell--rail .crescer-brand__txt,
.crescer-shell--rail .crescer-nav__label,
.crescer-shell--rail .crescer-nav__section,
.crescer-shell--rail .crescer-op-card__info { display: none; }
.crescer-shell--rail .crescer-rail-toggle { position: absolute; top: -4px; right: -2px; }
.crescer-shell--rail .crescer-rail-toggle > :is(.crescer-ico, svg, i) { transform: rotate(0deg); }
.crescer-shell--rail .crescer-nav a { justify-content: center; gap: 0; padding: 10px 0; position: relative; }
.crescer-shell--rail .crescer-nav a.is-active::before { left: -8px; }
/* Rail: rodapé empilha em COLUNA (avatar em cima, Sair embaixo) — cabe na largura
   estreita e mantém o botão Sair visível e CLICÁVEL. */
.crescer-shell--rail .crescer-op-card { flex-direction: column; justify-content: center; padding: 8px 4px; gap: 8px; }
/* Tooltip dos itens no modo rail (usa data-tip) */
.crescer-shell--rail .crescer-nav a::after {
  content: attr(data-tip);
  position: absolute; left: calc(100% + 14px); top: 50%; transform: translateY(-50%);
  padding: 6px 10px; border-radius: 7px; font-size: 12px; font-weight: 500; white-space: nowrap;
  background: #0f172a; color: #fff; box-shadow: var(--crescer-shadow-modal);
  opacity: 0; pointer-events: none; transition: opacity .12s ease; z-index: 70;
}
.crescer-shell--rail .crescer-nav a:hover::after { opacity: 1; }

@media (max-width: 900px) {
  .crescer-shell { grid-template-columns: 1fr; }
  .crescer-sidebar { position: fixed; left: -100%; width: var(--crescer-sidebar-w); z-index: 60; transition: left .2s; }
  .crescer-shell--nav-open .crescer-sidebar { left: 0; }
  #crescer-menu-toggle { display: inline-flex; }
  .crescer-rail-toggle { display: none; }
  /* Neutraliza o rail no mobile: sempre largura cheia e textos visíveis */
  .crescer-shell--rail { --crescer-sidebar-w: 264px; }
  .crescer-shell--rail .crescer-brand__txt,
  .crescer-shell--rail .crescer-nav__label,
  .crescer-shell--rail .crescer-nav__section,
  .crescer-shell--rail .crescer-op-card__info { display: block; }
  .crescer-shell--rail .crescer-nav a { justify-content: flex-start; gap: 11px; padding: 9px 12px; }
  .crescer-shell--rail .crescer-nav a::after { display: none; }
  .crescer-shell--rail .crescer-op-card { flex-direction: row; justify-content: flex-start; gap: 10px; padding: 8px; }
  .crescer-shell--nav-open .crescer-scrim { display: block; }
}

/* ============================================================================= */
/* LOGIN / AUTH (não autenticado)                                                */
/* ============================================================================= */
.crescer-auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--crescer-bg); }
.crescer-auth__card { width: 100%; max-width: 400px; background: var(--crescer-surface); border: 1px solid var(--crescer-border); border-radius: var(--crescer-radius-lg); box-shadow: var(--crescer-shadow-card); padding: 28px; }
.crescer-auth__brand { text-align: center; margin-bottom: 22px; }
.crescer-auth__brand h1 { margin: 8px 0 2px; font-size: 22px; font-weight: 700; color: var(--crescer-brand); letter-spacing: -.02em; }
.crescer-auth__brand p { margin: 0; font-size: 12.5px; color: var(--crescer-text-faint); }
.crescer-auth__mark { width: 46px; height: 46px; border-radius: 12px; margin: 0 auto; background: var(--crescer-ai-grad); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 14px rgba(0,122,240,.4); }

/* Login split — painel de marca (gradiente) + card do formulário */
.crescer-login {
  width: 100%; max-width: 960px; min-height: 560px;
  display: grid; grid-template-columns: 1.02fr 1fr;
  background: var(--crescer-surface); border: 1px solid var(--crescer-border);
  border-radius: 18px; overflow: hidden; box-shadow: var(--crescer-shadow-modal);
}
.crescer-login__brand {
  position: relative; display: flex; flex-direction: column;
  padding: 34px 38px; color: #fff;
  background: linear-gradient(150deg, #007AF0 0%, #3f5fe6 46%, #6D4AE0 100%);
  overflow: hidden;
}
.crescer-login__brand::before {
  content: ""; position: absolute; top: -80px; right: -80px;
  width: 320px; height: 320px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.20), transparent 68%);
  pointer-events: none;
}
.crescer-login__brand::after {
  content: ""; position: absolute; bottom: -120px; left: -60px;
  width: 300px; height: 300px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.10), transparent 70%);
  pointer-events: none;
}
.crescer-login__brand-top { position: relative; display: flex; align-items: center; gap: 11px; }
.crescer-login__logo {
  width: 44px; height: 44px; border-radius: 12px; flex: none; color: #fff;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.28);
  backdrop-filter: blur(2px);
}
.crescer-login__brand-name { font-size: 19px; font-weight: 700; letter-spacing: -.02em; }
.crescer-login__hero { position: relative; margin: auto 0; padding: 24px 0; }
.crescer-login__tagline { margin: 0 0 12px; font-size: 27px; line-height: 1.18; font-weight: 700; letter-spacing: -.02em; }
.crescer-login__lead { margin: 0 0 26px; font-size: 14px; line-height: 1.55; color: rgba(255,255,255,.88); max-width: 34ch; }
.crescer-login__points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.crescer-login__points li { display: flex; gap: 12px; font-size: 13px; line-height: 1.45; color: rgba(255,255,255,.9); }
.crescer-login__points li b { color: #fff; font-weight: 600; }
.crescer-login__point-ico {
  flex: none; width: 32px; height: 32px; border-radius: 9px; color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.24);
}
.crescer-login__brand-foot { position: relative; font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase; color: rgba(255,255,255,.72); }

.crescer-login__form-wrap { display: flex; align-items: center; justify-content: center; padding: 40px 44px; }
.crescer-login__card { width: 100%; max-width: 340px; }
.crescer-login__card-mark { display: none; margin-bottom: 16px; }
.crescer-login__title { margin: 0 0 4px; font-size: 24px; font-weight: 700; letter-spacing: -.02em; color: var(--crescer-text); }
.crescer-login__subtitle { margin: 0 0 24px; font-size: 13px; color: var(--crescer-text-faint); }
.crescer-login__field { margin-bottom: 14px; }
.crescer-login__field label { margin-bottom: 2px; }
.crescer-login__remember { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--crescer-text-soft); margin-bottom: 18px; cursor: pointer; }
.crescer-login__submit { width: 100%; justify-content: center; padding: 12px 16px; font-size: 14px; }
.crescer-login__sso { margin-top: 22px; }
.crescer-login__divider { position: relative; text-align: center; margin-bottom: 16px; }
.crescer-login__divider::before { content: ""; position: absolute; top: 50%; left: 0; right: 0; height: 1px; background: var(--crescer-border); }
.crescer-login__divider span { position: relative; background: var(--crescer-surface); padding: 0 12px; font-size: 12px; color: var(--crescer-text-faint); }
.crescer-login__sso-form { display: flex; gap: 8px; }

@media (max-width: 820px) {
  .crescer-login { grid-template-columns: 1fr; max-width: 440px; min-height: 0; }
  .crescer-login__brand { padding: 26px 28px; }
  .crescer-login__hero { margin: 20px 0 4px; padding: 0; }
  .crescer-login__tagline { font-size: 22px; }
  .crescer-login__lead { margin-bottom: 20px; }
  .crescer-login__brand-foot { display: none; }
  .crescer-login__form-wrap { padding: 30px 28px; }
  .crescer-login__card { max-width: none; }
}
@media (max-width: 480px) {
  .crescer-login__points { display: none; }
  .crescer-login__hero { margin: 16px 0 2px; }
}
}
