/* =========================================================================
   ERP Total — Design System v2 (2026)
   Paleta extraída da logo: navy profundo + teal/ciano vibrante
   ========================================================================= */

:root {
  color-scheme: light;

  /* ---------- Paleta primária (logo) ---------- */
  --navy-950: #061226;
  --navy-900: #0a1d3a;
  --navy-800: #0f2c52;   /* navy ERP da logo */
  --navy-700: #163a66;
  --navy-600: #1f4e85;
  --navy-500: #2563a8;

  --teal-700: #0c7a86;
  --teal-600: #14959f;
  --teal-500: #18b0b9;   /* teal "Total" da logo */
  --teal-400: #38c4cc;
  --teal-300: #7adde2;
  --teal-100: #d5f3f5;
  --teal-50:  #ecfafb;

  /* ---------- Neutros ---------- */
  --ink-900: #0b1626;
  --ink-800: #16223a;
  --ink-700: #243352;
  --ink-600: #3a4a6b;
  --ink-500: #5b6d8c;
  --ink-400: #8597b3;
  --ink-300: #b8c4d6;
  --ink-200: #dbe3ee;
  --ink-100: #eaf0f7;
  --ink-50:  #f5f8fc;

  /* ---------- Tokens semânticos ---------- */
  --bg: #f4f7fb;
  --bg-soft: #eef3f9;
  --surface: #ffffff;
  --surface-2: #f8fafd;
  --surface-strong: var(--teal-50);
  --ink: var(--ink-900);
  --muted: var(--ink-500);
  --line: var(--ink-200);
  --line-strong: var(--ink-300);

  --primary: var(--teal-500);
  --primary-hover: var(--teal-600);
  --primary-strong: var(--teal-700);
  --primary-soft: var(--teal-100);
  --primary-contrast: #ffffff;

  --navy: var(--navy-800);
  --navy-strong: var(--navy-900);
  --brand-blue: var(--navy-600);
  --accent: var(--teal-500);

  --success: #0f9d6e;
  --success-soft: #dff5ec;
  --warning: #c98414;
  --warning-soft: #fbf1d8;
  --danger: #d24343;
  --danger-soft: #fbe2e2;
  --info: var(--navy-500);
  --info-soft: #e3edf9;

  /* Gradientes da marca */
  --grad-brand: linear-gradient(135deg, var(--navy-800) 0%, var(--teal-500) 100%);
  --grad-brand-soft: linear-gradient(135deg, rgba(15,44,82,0.92) 0%, rgba(24,176,185,0.85) 100%);
  --grad-surface: linear-gradient(180deg, #ffffff 0%, #f6fafd 100%);

  /* ---------- Espaçamento ---------- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* ---------- Raio ---------- */
  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 18px;
  --r-2xl: 22px;
  --r-pill: 999px;

  /* ---------- Sombra ---------- */
  --shadow-xs: 0 1px 2px rgba(15, 44, 82, 0.05);
  --shadow-sm: 0 2px 6px rgba(15, 44, 82, 0.06), 0 1px 2px rgba(15, 44, 82, 0.04);
  --shadow-md: 0 6px 18px rgba(15, 44, 82, 0.08), 0 2px 4px rgba(15, 44, 82, 0.04);
  --shadow-lg: 0 18px 40px rgba(15, 44, 82, 0.12), 0 4px 10px rgba(15, 44, 82, 0.05);
  --shadow-xl: 0 30px 80px rgba(15, 44, 82, 0.18);
  --shadow-focus: 0 0 0 3px rgba(24, 176, 185, 0.28);

  /* ---------- Tipografia ---------- */
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;

  --fs-xs: 0.75rem;     /* 12 */
  --fs-sm: 0.8125rem;   /* 13 */
  --fs-md: 0.9375rem;   /* 15 */
  --fs-base: 1rem;      /* 16 */
  --fs-lg: 1.125rem;    /* 18 */
  --fs-xl: 1.375rem;    /* 22 */
  --fs-2xl: 1.75rem;    /* 28 */
  --fs-3xl: 2.125rem;   /* 34 */
  --fs-4xl: 2.625rem;   /* 42 */

  --lh-tight: 1.18;
  --lh-snug: 1.35;
  --lh-base: 1.55;
  --lh-loose: 1.7;

  --topbar-h: 64px;
  --sidebar-w: 260px;

  font-family: var(--font-sans);
  font-size: 16px;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* =========================================================================
   Reset / base
   ========================================================================= */

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: var(--fs-md);
  line-height: var(--lh-base);
}
body.modal-open { overflow: hidden; }

a { color: inherit; text-decoration: none; }
a:hover { color: var(--primary-strong); }

img, svg { max-width: 100%; display: block; }

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink-900);
  line-height: var(--lh-tight);
}
h1 { font-size: clamp(1.75rem, 3.6vw, 2.625rem); font-weight: 800; }
h2 { font-size: clamp(1.45rem, 2.6vw, 2rem); }
h3 { font-size: clamp(1.15rem, 1.8vw, 1.375rem); }
h4 { font-size: 1.05rem; }
h5 { font-size: 0.95rem; }

p { margin: 0; line-height: var(--lh-base); }

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

::selection { background: var(--teal-300); color: var(--navy-900); }

/* Scrollbar fina */
* { scrollbar-width: thin; scrollbar-color: var(--ink-300) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--ink-300); border-radius: 8px; }
*::-webkit-scrollbar-thumb:hover { background: var(--ink-400); }

/* =========================================================================
   Topbar
   ========================================================================= */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  min-height: var(--topbar-h);
  padding: 0 clamp(16px, 3vw, 28px);
  background: rgba(255, 255, 255, 0.85);
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.05rem;
  white-space: nowrap;
  color: var(--navy);
}
.brand .brand-text {
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-logo {
  display: inline-flex;
  align-items: center;
  width: clamp(140px, 14vw, 180px);
  height: 42px;
  overflow: hidden;
}
.brand-logo img {
  width: 100%; height: 100%;
  object-fit: contain; object-position: left center;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  border-radius: var(--r-md);
  overflow: hidden;
}
.brand-mark img, .brand-mark svg {
  width: 100%; height: 100%;
  object-fit: contain;
}
.compact .brand-mark { width: 32px; height: 32px; }
.compact .brand-logo { width: 152px; height: 40px; }

.nav {
  display: flex; flex-wrap: wrap;
  justify-content: center;
  gap: 2px;
}
.nav a, .nav button, .ghost-button, .nav-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--ink-600);
  cursor: pointer;
  padding: 8px 12px;
  font-size: var(--fs-sm);
  font-weight: 600;
  transition: background .15s ease, color .15s ease;
}
.nav a:hover, .nav button:hover, .ghost-button:hover, .nav-item:hover, .nav-item.active {
  background: var(--ink-100);
  color: var(--navy);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* =========================================================================
   Botões
   ========================================================================= */

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 700;
  font-size: var(--fs-sm);
  padding: 10px 16px;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .12s ease, box-shadow .15s ease;
  letter-spacing: 0.01em;
}
.primary-button:active, .secondary-button:active { transform: translateY(1px); }

.primary-button {
  background: var(--grad-brand);
  color: var(--primary-contrast);
  box-shadow: 0 6px 16px rgba(24, 176, 185, 0.28);
}
.primary-button:hover { filter: brightness(1.05); box-shadow: 0 10px 24px rgba(24, 176, 185, 0.34); }

.primary-button.is-loading,
.secondary-button.is-loading,
.ghost-button.is-loading,
.nav-item.is-loading,
.fin-tab.is-loading {
  opacity: 0.82;
  cursor: wait;
  pointer-events: none;
}
.button-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 8px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: -2px;
  animation: buttonSpin .7s linear infinite;
}
.nav-item .button-spinner,
.fin-tab .button-spinner {
  width: 12px;
  height: 12px;
  margin-right: 6px;
}
@keyframes buttonSpin {
  to { transform: rotate(360deg); }
}

.secondary-button {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--navy);
}
.secondary-button:hover { border-color: var(--primary); color: var(--primary-strong); background: var(--surface-2); }

.demo-button {
  background: var(--teal-100);
  color: var(--navy);
  border: 1px solid var(--teal-300);
}
.demo-button:hover { background: var(--teal-300); color: var(--navy-900); }

.ghost-button {
  padding: 8px 12px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--ink-600);
  font-weight: 600;
  font-size: var(--fs-sm);
  border-radius: var(--r-sm);
  cursor: pointer;
}
.ghost-button:hover { background: var(--ink-100); color: var(--navy); }
.ghost-button.danger { color: var(--danger); }
.ghost-button.danger:hover { background: var(--danger-soft); }

.link-button {
  background: none; border: 0; padding: 4px 6px;
  color: var(--primary-strong);
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--r-xs);
}
.link-button:hover { background: var(--primary-soft); }
.link-button.danger { color: var(--danger); }
.link-button.danger:hover { background: var(--danger-soft); }

/* =========================================================================
   Formulários
   ========================================================================= */

label {
  display: grid;
  gap: 6px;
  color: var(--ink-700);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

input, select, textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  padding: 9px 12px;
  font-size: var(--fs-md);
  text-transform: none;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
textarea { min-height: 88px; resize: vertical; line-height: var(--lh-snug); }
input:hover, select:hover, textarea:hover { border-color: var(--ink-400); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--shadow-focus);
  background: var(--surface);
}
input::placeholder, textarea::placeholder { color: var(--ink-400); }

input[type="checkbox"], input[type="radio"] {
  width: auto; min-height: auto;
  accent-color: var(--primary);
}
input[type="color"] {
  width: 44px; height: 36px; padding: 2px;
  border-radius: var(--r-sm);
  cursor: pointer;
}

.checkbox-row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
  text-transform: none;
  font-weight: 500;
  font-size: var(--fs-sm);
  color: var(--ink-700);
}
.checkbox-row input { width: 16px; height: 16px; }

.form-message {
  min-height: 22px;
  margin: 0;
  font-size: var(--fs-sm);
  font-weight: 600;
}
.form-message.error { color: var(--danger); }
.form-message.success { color: var(--success); }

/* =========================================================================
   Landing — Hero
   ========================================================================= */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(380px, 1.05fr);
  gap: clamp(28px, 5vw, 56px);
  align-items: center;
  min-height: calc(100vh - var(--topbar-h));
  padding: clamp(40px, 6vw, 80px) clamp(20px, 6vw, 80px);
  background:
    radial-gradient(900px 600px at 92% -10%, rgba(24, 176, 185, 0.18), transparent 60%),
    radial-gradient(700px 500px at -10% 80%, rgba(15, 44, 82, 0.10), transparent 65%),
    var(--bg);
}
.hero-copy { max-width: 720px; }
.hero h1 {
  margin: 0;
  font-size: clamp(2.25rem, 5.2vw, 4rem);
  line-height: 1.02;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.eyebrow {
  display: inline-block;
  margin: 0 0 12px;
  color: var(--primary-strong);
  font-size: var(--fs-xs);
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.lead {
  max-width: 620px;
  color: var(--ink-600);
  font-size: clamp(1rem, 1.6vw, 1.15rem);
  line-height: var(--lh-base);
  margin-top: 14px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}

.hero-proof {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
}
.hero-proof span {
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink-700);
  font-size: var(--fs-xs);
  font-weight: 700;
  padding: 6px 12px;
}

.hero-showcase {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--r-2xl);
  background: var(--grad-surface);
  box-shadow: var(--shadow-lg);
  padding: 20px;
  min-height: 460px;
  overflow: hidden;
}
.hero-showcase::before {
  content: "";
  position: absolute;
  inset: auto -60px -80px auto;
  width: 280px; height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(24, 176, 185, 0.25), transparent 70%);
  z-index: 0;
}

.showcase-top {
  display: flex; gap: 6px;
  padding: 2px 0 14px;
}
.showcase-top span {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--ink-200);
}
.showcase-top span:nth-child(1) { background: #f0747a; }
.showcase-top span:nth-child(2) { background: #f6c34a; }
.showcase-top span:nth-child(3) { background: #5fbd6d; }

.showcase-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-radius: var(--r-lg);
  background: var(--grad-brand);
  color: #fff;
  padding: 18px 20px;
  box-shadow: var(--shadow-md);
}
.showcase-header small,
.showcase-header strong,
.showcase-header em { display: block; }
.showcase-header small {
  color: rgba(255, 255, 255, 0.75);
  font-weight: 600;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.showcase-header strong {
  margin-top: 4px;
  font-size: 1.4rem;
}
.showcase-header em {
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--r-pill);
  color: #fff;
  font-style: normal;
  font-weight: 700;
  font-size: var(--fs-xs);
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.1);
}

.showcase-features {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}
.showcase-features article {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.showcase-features article:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.showcase-features strong {
  display: block;
  color: var(--navy);
  font-size: var(--fs-md);
  line-height: 1.2;
}
.showcase-features small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: var(--fs-xs);
  line-height: 1.4;
}
.feature-icon {
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  flex: 0 0 36px;
  border-radius: var(--r-md);
  background: var(--primary-soft);
  border: 1px solid var(--teal-300);
  color: var(--primary-strong);
  font-size: 1.1rem;
}

.live-strip {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
}
.live-strip span {
  border-radius: var(--r-sm);
  background: var(--surface-strong);
  color: var(--primary-strong);
  font-size: var(--fs-xs);
  font-weight: 700;
  padding: 10px;
  text-align: center;
  border: 1px solid var(--teal-100);
}

/* =========================================================================
   Sections genéricas
   ========================================================================= */

.section {
  scroll-margin-top: calc(var(--topbar-h) + 18px);
  padding: clamp(48px, 7vw, 84px) clamp(20px, 6vw, 80px);
}
.section h2 {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2.25rem);
}
.section p { color: var(--muted); line-height: var(--lh-base); }

.section-heading {
  max-width: 760px;
  margin-bottom: 28px;
}
.section-heading h2 { margin-bottom: 8px; }
.section-heading p { margin-top: 8px; color: var(--muted); }

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 1fr);
  gap: 36px;
  align-items: start;
  border-top: 1px solid var(--line);
}

.check-list {
  display: grid;
  gap: 8px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}
.check-list li {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--primary);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  color: var(--ink-700);
  font-size: var(--fs-sm);
}

/* =========================================================================
   Módulos (landing grid)
   ========================================================================= */

.modules-heading {
  max-width: none;
  display: grid;
  grid-template-columns: minmax(0, 760px) auto;
  gap: 24px;
  align-items: end;
}
.modules-summary {
  justify-self: end;
  min-width: 160px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  padding: 16px 18px;
}
.modules-summary strong {
  display: block;
  color: var(--navy);
  font-size: 1.9rem;
  line-height: 1;
}
.modules-summary span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.module-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  align-items: start;
}

.module-area {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--grad-surface);
  box-shadow: var(--shadow-sm);
  padding: 18px;
}
.module-area-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  min-height: 48px;
  margin-bottom: 14px;
}
.module-area-header h3 {
  margin: 0;
  max-width: 130px;
  font-size: 1rem;
  line-height: 1.18;
  color: var(--navy);
}
.module-area-header span {
  flex: 0 0 auto;
  border: 1px solid var(--teal-300);
  border-radius: var(--r-pill);
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: var(--fs-xs);
  font-weight: 700;
  padding: 4px 10px;
  white-space: nowrap;
}
.module-area-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  align-items: stretch;
  gap: 12px;
}

.module-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 204px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  padding: 22px 20px 20px;
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  isolation: isolate;
  transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.module-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: var(--grad-brand);
  opacity: .85;
  transition: height .25s ease, opacity .25s ease;
}
.module-card::after {
  content: "";
  position: absolute;
  top: -40px;
  right: -40px;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(24,176,185,.18) 0%, rgba(24,176,185,0) 70%);
  z-index: -1;
  opacity: 0;
  transition: opacity .3s ease, transform .3s ease;
}
.module-card:hover {
  transform: translateY(-4px);
  border-color: var(--teal-300);
  box-shadow: 0 12px 28px rgba(15,44,82,.12), 0 4px 8px rgba(15,44,82,.06);
}
.module-card:hover::before { height: 6px; opacity: 1; }
.module-card:hover::after { opacity: 1; transform: scale(1.1); }
.module-card:hover strong { color: var(--primary-strong); }
.module-card-top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.module-card-mark {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px;
  border-radius: var(--r-md);
  background: var(--grad-brand);
  color: #fff;
  font-size: var(--fs-xs);
  font-weight: 800;
  letter-spacing: 0.04em;
}
.module-card-status {
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--ink-50);
  color: var(--ink-600);
  font-size: var(--fs-xs);
  font-weight: 700;
  padding: 3px 9px;
}
.module-card strong {
  display: block;
  color: var(--navy);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  transition: color .2s ease;
}
.module-card p,
.module-card > span {
  flex: 1;
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: var(--lh-snug);
}
.module-card-chips {
  display: flex; flex-wrap: wrap; gap: 4px;
}
.module-card-chips span {
  border-radius: var(--r-pill);
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border: 1px solid var(--teal-100);
}

/* =========================================================================
   Feature section escura (IA/OCR/Workflow)
   ========================================================================= */

.feature-section {
  background:
    radial-gradient(800px 400px at 90% 10%, rgba(24, 176, 185, 0.18), transparent 60%),
    var(--navy-900);
  color: #fff;
  padding: clamp(48px, 7vw, 84px) clamp(20px, 6vw, 80px);
}
.feature-section .eyebrow { color: var(--teal-400); }
.feature-section .section-heading h2 { color: #fff; }
.feature-section .section-heading p { color: rgba(255, 255, 255, 0.72); }

.feature-bands {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.feature-bands article {
  min-height: 220px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, 0.04);
  padding: 22px;
  backdrop-filter: blur(4px);
  transition: border-color .18s ease, transform .18s ease;
}
.feature-bands article:hover {
  border-color: var(--teal-400);
  transform: translateY(-3px);
}
.feature-bands strong {
  display: block;
  color: #fff;
  font-size: 1.1rem;
  margin-bottom: 8px;
}
.feature-bands p { color: rgba(255, 255, 255, 0.72); font-size: var(--fs-sm); line-height: var(--lh-base); }

/* =========================================================================
   Onboarding steps
   ========================================================================= */

.onboarding-band {
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.onboarding-band .section-heading { max-width: 880px; }
.onboarding-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.onboarding-steps article {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface-2);
  min-height: 180px;
  padding: 22px;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.onboarding-steps article:hover {
  border-color: var(--teal-300);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}
.onboarding-steps span {
  display: inline-grid; place-items: center;
  width: 36px; height: 36px;
  border-radius: var(--r-md);
  background: var(--grad-brand);
  color: #fff;
  font-weight: 800;
  font-size: 1rem;
}
.onboarding-steps strong {
  display: block;
  margin-top: 18px;
  font-size: 1.05rem;
  color: var(--navy);
}
.onboarding-steps p { margin-top: 6px; color: var(--muted); font-size: var(--fs-sm); }

/* =========================================================================
   CTA section
   ========================================================================= */

.cta-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  border-top: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(15, 44, 82, 0.04), rgba(24, 176, 185, 0.04)),
    var(--surface);
  padding: clamp(48px, 6vw, 72px) clamp(20px, 6vw, 80px);
}
.cta-section h2 { margin: 0; font-size: clamp(1.5rem, 2.4vw, 2rem); }
.cta-section p { margin-top: 10px; color: var(--muted); max-width: 620px; }
.cta-actions { margin-top: 0; flex-shrink: 0; }

/* =========================================================================
   Painéis genéricos
   ========================================================================= */

.signup-flow,
.table-panel,
.login-panel,
.admin-panel,
.module-data-panel {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.table-panel { padding: 18px; min-height: 320px; }
.admin-panel,
.module-data-panel { padding: 20px; margin-top: 16px; }
.admin-panel[hidden] { display: none; }

.panel-header,
.workspace-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.panel-header { margin-bottom: 16px; color: var(--muted); }

/* =========================================================================
   Métricas / KPIs
   ========================================================================= */

.metric-grid, .kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.metric, .kpi {
  min-height: 108px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  padding: 14px 16px;
  box-shadow: var(--shadow-xs);
}
.metric span, .kpi span {
  display: block;
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.metric strong, .kpi strong {
  display: block;
  margin-top: 6px;
  font-size: 1.55rem;
  color: var(--navy);
  font-weight: 700;
}
.metric small, .kpi small {
  display: block;
  margin-top: 6px;
  color: var(--primary-strong);
  font-size: var(--fs-xs);
  font-weight: 600;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.summary-item {
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  padding: 14px;
}
.summary-item span, .summary-item strong { display: block; }
.summary-item span {
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
}
.summary-item strong {
  margin-top: 6px;
  color: var(--navy);
  font-size: 1.1rem;
  word-break: break-word;
}

.kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 16px; }

.dashboard-visual-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr) minmax(280px, 0.75fr);
  gap: 16px;
  margin-bottom: 16px;
}
.dashboard-chart-card {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  padding: 18px;
  min-height: 260px;
}
.dashboard-chart-card-wide { min-width: 0; }
.dashboard-chart-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}
.dashboard-chart-head h3 {
  margin: 3px 0 0;
  color: var(--navy);
  font-size: 1.2rem;
}
.dashboard-chart-head > span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--primary-strong);
  font-size: var(--fs-xs);
  font-weight: 800;
  padding: 7px 10px;
  white-space: nowrap;
}
.dashboard-bars {
  display: grid;
  gap: 14px;
}
.dashboard-bar-row {
  display: grid;
  grid-template-columns: minmax(140px, 0.8fr) minmax(160px, 1fr) auto;
  align-items: center;
  gap: 12px;
}
.dashboard-bar-row strong,
.dashboard-bar-row small {
  display: block;
}
.dashboard-bar-row strong { color: var(--navy); }
.dashboard-bar-row small {
  color: var(--muted);
  margin-top: 3px;
  font-size: var(--fs-xs);
}
.dashboard-bar-row > span {
  color: var(--primary-strong);
  font-weight: 800;
  min-width: 34px;
  text-align: right;
}
.dashboard-bar-track {
  height: 12px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}
.dashboard-bar-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--teal));
}
.dashboard-donut-wrap {
  display: grid;
  justify-items: center;
  gap: 16px;
}
.dashboard-donut {
  width: min(180px, 60vw);
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  position: relative;
  box-shadow: inset 0 0 0 1px var(--line);
}
.dashboard-donut::after {
  content: "";
  position: absolute;
  inset: 22%;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line);
}
.dashboard-donut span {
  position: relative;
  z-index: 1;
  color: var(--navy);
  font-weight: 800;
  font-size: 1.45rem;
}
.dashboard-legend {
  display: grid;
  gap: 9px;
  width: 100%;
  padding: 0;
  margin: 0;
  list-style: none;
}
.dashboard-legend li {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: var(--fs-sm);
}
.dashboard-legend i {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}
.dashboard-legend strong {
  color: var(--navy);
}
.dashboard-line-chart {
  width: 100%;
  height: 138px;
  border-radius: var(--r-md);
  background:
    linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 100% 33.33%,
    var(--surface-2);
  padding: 10px;
}
.dashboard-line-chart circle {
  fill: var(--surface);
  stroke: var(--primary);
  stroke-width: 3;
}
.dashboard-insights {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}
.dashboard-insights span {
  border-left: 3px solid var(--teal);
  background: var(--surface-2);
  border-radius: var(--r-xs);
  color: var(--muted);
  font-size: var(--fs-sm);
  padding: 9px 10px;
}
.dashboard-highlight-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.dashboard-highlight {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  padding: 14px;
  min-height: 92px;
}
.dashboard-highlight span,
.dashboard-highlight strong,
.dashboard-highlight small {
  display: block;
}
.dashboard-highlight span {
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.dashboard-highlight strong {
  color: var(--navy);
  font-size: 1.15rem;
  margin-top: 6px;
  word-break: break-word;
}
.dashboard-highlight small {
  color: var(--primary-strong);
  font-size: var(--fs-xs);
  font-weight: 700;
  margin-top: 5px;
}

.session-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.session-strip div {
  border-radius: var(--r-md);
  background: var(--grad-brand);
  color: #fff;
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}
.session-strip span, .session-strip strong { display: block; }
.session-strip span {
  color: rgba(255, 255, 255, 0.72);
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.session-strip strong { margin-top: 4px; word-break: break-word; font-size: 1rem; }

/* =========================================================================
   Workspace / Sidebar (app)
   ========================================================================= */

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  align-items: start;
  min-height: calc(100vh - var(--topbar-h));
  background: var(--bg);
  position: relative;
}
.app-shell.sidebar-collapsed {
  grid-template-columns: 76px minmax(0, 1fr);
}

body.app-mode header.topbar { display: none; }
body.app-mode .app-shell { min-height: 100vh; }
body.app-mode .sidebar { top: 0; height: 100vh; }

.sidebar {
  position: sticky;
  top: var(--topbar-h);
  align-self: start;
  height: calc(100vh - var(--topbar-h));
  display: flex; flex-direction: column;
  gap: 12px;
  padding: 18px 12px 12px;
  border-right: 1px solid var(--line);
  background: var(--surface);
  overflow-y: auto; overflow-x: hidden;
  z-index: 15;
}
.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 38px;
}
.sidebar .brand { margin-bottom: 4px; padding: 0 8px; min-width: 0; }
.sidebar-collapse-button {
  display: grid;
  place-items: center;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--primary-strong);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
}
.sidebar-collapse-button:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--navy);
}
.sidebar-collapse-button span {
  font-size: 1.35rem;
  line-height: 1;
  transition: transform .18s ease;
}
.app-shell.sidebar-collapsed .sidebar {
  padding-inline: 10px;
}
.app-shell.sidebar-collapsed .sidebar-head {
  justify-content: center;
}
.app-shell.sidebar-collapsed .sidebar .brand {
  display: none;
}
.app-shell.sidebar-collapsed .sidebar-collapse-button span {
  transform: rotate(180deg);
}

.sidebar-section-label {
  margin: 6px 10px 4px;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-400);
}
.app-shell.sidebar-collapsed .sidebar-section-label,
.app-shell.sidebar-collapsed .sidebar-footer {
  display: none;
}
.sidebar-footer {
  margin-top: auto;
  padding: 10px;
  border-top: 1px solid var(--line);
  color: var(--ink-400);
  font-size: 0.7rem;
  text-align: center;
}

.module-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.module-nav .nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--ink-700);
  text-align: left;
  position: relative;
}
.app-shell.sidebar-collapsed .module-nav .nav-item {
  justify-content: center;
  padding: 9px;
}
.app-shell.sidebar-collapsed .module-nav .nav-item span,
.app-shell.sidebar-collapsed .module-nav .module-nav-group {
  display: none;
}
.app-shell.sidebar-collapsed .module-nav .nav-item.active {
  box-shadow: inset 0 -3px 0 var(--primary);
}
.module-nav .nav-item::before {
  content: attr(data-icon);
  display: grid; place-items: center;
  width: 26px; height: 26px;
  flex: 0 0 26px;
  border-radius: var(--r-xs);
  background: var(--ink-100);
  color: var(--navy);
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0;
  transition: background .15s ease, color .15s ease;
}
.module-nav .nav-item:hover {
  background: var(--ink-50);
  color: var(--navy);
}
.module-nav .nav-item.active {
  background: var(--primary-soft);
  color: var(--navy);
  font-weight: 700;
  box-shadow: inset 3px 0 0 var(--primary);
}
.module-nav .nav-item.active::before {
  background: var(--grad-brand);
  color: #fff;
}

.help-center {
  display: grid;
  gap: 18px;
}

.help-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
  gap: 18px;
  align-items: stretch;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: linear-gradient(135deg, rgba(15, 44, 82, 0.06), rgba(28, 185, 184, 0.1));
}

.help-hero h4,
.help-card h4,
.help-checklist h4 {
  margin: 0 0 8px;
  color: var(--navy);
}

.help-hero p,
.help-card p {
  margin: 0;
  color: var(--ink-600);
}

.help-context {
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 16px;
  border: 1px solid rgba(28, 185, 184, 0.25);
  border-radius: var(--r-sm);
  background: var(--surface);
}

.help-context span,
.help-context small {
  color: var(--ink-500);
}

.help-context strong {
  color: var(--navy);
  font-size: var(--fs-lg);
}

.help-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.help-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
}

.help-card ul {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--ink-600);
}

.help-card li + li {
  margin-top: 6px;
}

.help-checklist {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--ink-50);
}

.help-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.help-check-grid div {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-radius: var(--r-xs);
  background: var(--surface);
  border: 1px solid var(--line);
}

.help-check-grid strong {
  color: var(--navy);
}

.help-check-grid span {
  color: var(--ink-600);
  font-size: var(--fs-sm);
}

.sidebar-toggle {
  display: none;
  position: fixed;
  top: calc(var(--topbar-h) + 12px);
  left: 12px;
  z-index: 30;
  width: 42px; height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
}
.sidebar-toggle span {
  display: block;
  width: 20px; height: 2px;
  background: var(--navy);
  border-radius: 2px;
  transition: transform .2s ease, opacity .2s ease;
}
.sidebar-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.sidebar-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.sidebar-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: var(--topbar-h) 0 0 0;
  background: rgba(11, 22, 38, 0.5);
  z-index: 14;
  animation: fadeBackdrop 0.18s ease-out;
}
@keyframes fadeBackdrop { from { opacity: 0; } to { opacity: 1; } }

/* Workspace */
.workspace {
  padding: clamp(20px, 3vw, 32px);
  min-width: 0;
}
.workspace-header { margin-bottom: 22px; gap: 12px; flex-wrap: wrap; }
.workspace-header h2 { font-size: clamp(1.35rem, 2.4vw, 1.85rem); }
.workspace-header .eyebrow { margin-bottom: 4px; }

.workspace-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.workspace-actions select { min-width: 240px; }

/* Account button */
.account-button {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 40px;
  max-width: 240px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink);
  padding: 4px 12px 4px 4px;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.account-button:hover { border-color: var(--primary); box-shadow: var(--shadow-xs); }
.account-avatar, .account-photo {
  display: grid; place-items: center;
  overflow: hidden;
  border-radius: var(--r-sm);
  background: var(--grad-brand);
  color: #fff;
  font-weight: 800;
}
.account-avatar { width: 32px; height: 32px; flex: 0 0 32px; font-size: var(--fs-xs); }
.account-avatar img, .account-photo img { width: 100%; height: 100%; object-fit: cover; }
.account-label { display: grid; min-width: 0; text-align: left; }
.account-label strong, .account-label small {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.account-label strong { color: var(--navy); font-size: var(--fs-sm); }
.account-label small { color: var(--muted); font-size: 0.72rem; }

/* =========================================================================
   Tabs admin
   ========================================================================= */

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 18px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  width: max-content;
  max-width: 100%;
}
.admin-tab {
  min-height: 36px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--ink-600);
  cursor: pointer;
  font-weight: 600;
  font-size: var(--fs-sm);
  padding: 8px 14px;
  transition: background .15s ease, color .15s ease;
}
.admin-tab:hover { background: var(--ink-100); color: var(--navy); }
.admin-tab.active {
  background: var(--grad-brand);
  color: #fff;
  box-shadow: var(--shadow-xs);
}

/* =========================================================================
   Demo access band
   ========================================================================= */

.demo-access {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
  border: 1px solid var(--warning);
  border-radius: var(--r-md);
  background: var(--warning-soft);
  padding: 14px 16px;
}
.demo-access[hidden] { display: none; }
.demo-access span, .demo-access strong { display: block; }
.demo-access span {
  color: var(--ink-700);
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
}
.demo-access strong { margin-top: 4px; word-break: break-word; color: var(--navy); font-size: var(--fs-sm); }

/* =========================================================================
   Login panel
   ========================================================================= */

.login-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.9fr);
  gap: 22px;
  margin-bottom: 18px;
  padding: 24px;
  box-shadow: var(--shadow-md);
}
.login-panel[hidden], .admin-area[hidden] { display: none; }
.login-panel h3 { margin: 0; font-size: clamp(1.35rem, 2.4vw, 1.75rem); color: var(--navy); }
.login-panel p { color: var(--muted); line-height: var(--lh-base); margin-top: 6px; }

.login-form { display: grid; align-content: start; gap: 12px; }

/* =========================================================================
   Tabelas / Listings
   ========================================================================= */

.data-table { width: 100%; overflow-x: auto; }
.data-table + .data-table { margin-top: 14px; }
.data-table table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
  font-size: var(--fs-sm);
}
.data-table th, .data-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}
.data-table th {
  color: var(--ink-600);
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--surface-2);
}
.data-table tr:hover td { background: var(--ink-50); }
.data-table td { font-size: var(--fs-sm); color: var(--ink-700); }

.listing-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: var(--r-md) var(--r-md) 0 0;
}
.listing-toolbar-left, .listing-view-toggle, .listing-pagination {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.listing-toolbar-left span, .listing-pagination span {
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 600;
}
.listing-toolbar select, .listing-toolbar input[type="search"] {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  padding: 5px 10px;
  font-size: var(--fs-sm);
}
.listing-toolbar input[type="search"] { min-width: min(240px, 100%); }
.listing-view-toggle {
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  gap: 0;
}
.listing-view-toggle button, .listing-pagination button, .icon-button {
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: var(--r-xs);
  background: transparent;
  color: var(--ink-600);
  cursor: pointer;
  font-size: var(--fs-xs);
  font-weight: 700;
  padding: 0;
  width: 32px;
  min-height: 30px;
  height: 32px;
  line-height: 1;
}
.icon-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--primary-strong);
  box-shadow: var(--shadow-xs);
}
.icon-button:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--navy);
}
.icon-button.danger {
  color: var(--danger);
}
.icon-button.danger:hover {
  border-color: var(--danger);
  background: rgba(224, 76, 76, 0.08);
}
.primary-icon-button {
  border-color: var(--primary);
  background: var(--grad-brand);
  color: #fff;
}
.listing-view-toggle button.active {
  background: var(--grad-brand);
  color: #fff;
}
.listing-view-toggle button[data-listing-export] {
  border-left: 1px solid var(--line);
  border-radius: 0 var(--r-xs) var(--r-xs) 0;
  color: var(--primary-strong);
}
.listing-pagination {
  justify-content: flex-end;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  border-radius: 0 0 var(--r-md) var(--r-md);
}
.listing-pagination button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-700);
}
.listing-pagination button:disabled { cursor: not-allowed; opacity: 0.45; }
.listing-pagination button:not(:disabled):hover { border-color: var(--primary); color: var(--primary-strong); }

.listing-table-wrap { overflow-x: auto; }
.listing-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  padding: 14px;
  background: var(--surface-2);
}
.listing-card {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  padding: 14px;
  box-shadow: var(--shadow-xs);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.listing-card:hover { border-color: var(--teal-300); box-shadow: var(--shadow-sm); }
.listing-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}
.listing-card-head h4 { margin: 0; color: var(--navy); font-size: var(--fs-md); line-height: 1.2; }
.listing-card-head p { margin: 4px 0 0; color: var(--muted); font-size: var(--fs-xs); }
.listing-card-actions { display: flex; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.listing-card-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding-top: 12px;
}
.listing-card-meta { min-width: 0; }
.listing-card-meta span, .listing-card-meta strong { display: block; }
.listing-card-meta span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
}
.listing-card-meta strong {
  margin-top: 2px;
  color: var(--ink);
  font-size: var(--fs-sm);
  word-break: break-word;
}

#platformGlobalUsersTable .listing-card-grid {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
  background: linear-gradient(180deg, rgba(217, 230, 246, 0.45), rgba(247, 250, 253, 0.72));
}
#platformGlobalUsersTable .listing-card {
  position: relative;
  min-height: 260px;
  border-color: rgba(20, 107, 82, 0.16);
  border-radius: var(--r-lg);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.88), rgba(255,255,255,0.68)),
    var(--surface);
  box-shadow: 0 12px 28px rgba(15, 44, 82, 0.08);
  overflow: hidden;
}
#platformGlobalUsersTable .listing-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--teal));
}
#platformGlobalUsersTable .listing-card[data-user-active="0"]::before {
  background: linear-gradient(90deg, var(--muted), var(--line));
}
#platformGlobalUsersTable .listing-card[data-user-current="1"] {
  border-color: rgba(30, 181, 196, 0.42);
}
#platformGlobalUsersTable .listing-card-head {
  gap: 12px;
  border-bottom: 1px solid rgba(15, 44, 82, 0.08);
  padding-top: 4px;
}
#platformGlobalUsersTable .listing-card-head h4 {
  font-size: var(--fs-sm);
}
#platformGlobalUsersTable .listing-card-head p {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.platform-user-card-title,
.platform-user-identity {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}
.platform-user-card-title strong,
.platform-user-card-title small,
.platform-user-identity strong,
.platform-user-identity small {
  display: block;
}
.platform-user-card-title strong,
.platform-user-identity strong {
  color: var(--navy);
  line-height: 1.18;
}
.platform-user-card-title small,
.platform-user-identity small {
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 600;
  margin-top: 3px;
  overflow-wrap: anywhere;
}
.platform-user-avatar {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--primary), var(--teal));
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(20, 107, 82, 0.18);
}
.platform-user-status {
  display: inline-flex;
  align-items: center;
  border-radius: var(--r-pill);
  font-size: var(--fs-xxs);
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 5px 8px;
}
.platform-user-status.is-active {
  background: var(--success-soft);
  color: var(--success);
}
.platform-user-status.is-inactive {
  background: var(--danger-soft);
  color: var(--danger);
}
.platform-user-card-company {
  color: var(--primary-strong);
  font-size: var(--fs-xs);
  font-weight: 800;
}
.platform-user-company {
  display: grid;
  gap: 3px;
}
.platform-user-company strong {
  color: var(--ink);
  font-size: var(--fs-sm);
}
.platform-user-company small {
  color: var(--muted);
  font-size: var(--fs-xs);
}
#platformGlobalUsersTable .listing-card-body {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
#platformGlobalUsersTable .listing-card-meta {
  border: 1px solid rgba(15, 44, 82, 0.08);
  border-radius: var(--r-sm);
  background: rgba(247, 250, 253, 0.72);
  padding: 10px;
}
#platformGlobalUsersTable .listing-card-actions {
  max-width: 96px;
}

.usuario-acoes,
.platform-row-actions,
.mod-row-actions,
.fin-parcela-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.compact-table {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  padding: 8px;
}

.empty-state {
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
  color: var(--muted);
  font-weight: 600;
  font-size: var(--fs-sm);
  padding: 24px;
  text-align: center;
  background: var(--surface-2);
}

/* =========================================================================
   Workflow / alertas
   ========================================================================= */

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
  gap: 16px;
}

.workflow-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
}
.workflow-row:last-child { border-bottom: 0; }
.workflow-row strong, .workflow-row small { display: block; }
.workflow-row small { margin-top: 4px; color: var(--muted); }
.workflow-row span { color: var(--primary-strong); font-weight: 700; }

.alert-list {
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}
.alert-list li {
  border-left: 3px solid var(--warning);
  border-radius: var(--r-xs);
  background: var(--warning-soft);
  padding: 12px 14px;
  font-size: var(--fs-sm);
  color: var(--ink-700);
}

.demo-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.demo-band div { max-width: 720px; }

.overview-health {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.overview-readiness {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.readiness-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 12px 0;
}

.readiness-summary div {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  padding: 12px;
}

.readiness-summary span {
  display: block;
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 800;
  text-transform: uppercase;
}

.readiness-summary strong {
  display: block;
  margin-top: 4px;
  color: var(--navy);
  font-size: var(--fs-xl);
}

.readiness-actions {
  display: flex;
  justify-content: flex-end;
  margin: 8px 0 12px;
}

.production-checklist-table {
  margin-top: 16px;
}

.company-homologation-section {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  border-radius: var(--r-pill);
  background: var(--surface-strong);
  color: var(--primary-strong);
  padding: 4px 9px;
  font-size: var(--fs-xs);
  font-weight: 800;
}

/* =========================================================================
   Module data forms / records
   ========================================================================= */

.module-data-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.module-data-header h3 { margin: 0; color: var(--navy); }
.module-data-header span {
  border-radius: var(--r-pill);
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-weight: 700;
  font-size: var(--fs-xs);
  padding: 6px 12px;
  border: 1px solid var(--teal-100);
}
.module-data-header.compact { margin-bottom: 8px; }
.module-data-header.compact h3 { font-size: 1rem; }

.module-data-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.module-record-form {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(200px, 1.6fr) minmax(120px, 0.8fr) minmax(120px, 0.8fr) minmax(110px, 0.7fr) auto;
  gap: 8px;
  margin-bottom: 10px;
}
.module-record-form[hidden] { display: none; }
.module-record-form input, .module-record-form select, .module-record-form button { min-height: 40px; }

.module-record {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  min-height: 140px;
  padding: 14px;
}
.module-record strong, .module-record span, .module-record small { display: block; }
.module-record strong { font-size: 1rem; color: var(--navy); }
.module-record span { margin-top: 6px; color: var(--muted); line-height: 1.4; font-size: var(--fs-sm); }
.module-record small { margin-top: 10px; color: var(--primary-strong); font-weight: 700; font-size: var(--fs-xs); }

/* =========================================================================
   Modals (signup / auth / account)
   ========================================================================= */

.signup-modal {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  padding: 20px;
}
.signup-modal[hidden] { display: none; }
.signup-backdrop {
  position: absolute; inset: 0;
  background: rgba(11, 22, 38, 0.55);
  backdrop-filter: blur(8px);
}
.signup-dialog {
  position: relative;
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(340px, 1fr);
  gap: 22px;
  width: min(1040px, 100%);
  max-height: min(840px, calc(100vh - 40px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-2xl);
  background: var(--surface);
  box-shadow: var(--shadow-xl);
  padding: 28px;
}
.signup-intro { padding: 12px 0; }
.signup-intro h2 {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  line-height: 1.1;
}

.signup-flow {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.modal-close {
  position: absolute;
  top: 12px; right: 12px;
  display: grid; place-items: center;
  width: 36px; height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink-700);
  cursor: pointer;
  font-size: 1.3rem;
  line-height: 1;
  transition: background .15s ease, color .15s ease;
}
.modal-close:hover { background: var(--ink-100); color: var(--navy); }

.company-preview {
  display: grid; gap: 8px;
  border: 1px solid var(--teal-300);
  border-radius: var(--r-md);
  background: var(--teal-50);
  padding: 14px 16px;
}
.preview-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 10px;
  color: var(--muted);
  font-size: var(--fs-sm);
}
.preview-row strong { color: var(--ink); }

.admin-fields { display: grid; gap: 12px; }

/* Auth modal (login) */
.auth-modal {
  position: fixed; inset: 0; z-index: 110;
  display: grid; place-items: center;
  padding: 20px;
}
.auth-modal[hidden] { display: none; }
.auth-backdrop {
  position: absolute; inset: 0;
  background: var(--grad-brand-soft);
  backdrop-filter: blur(10px);
}
.auth-dialog {
  position: relative;
  width: min(420px, 100%);
  padding: 32px 28px 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-2xl);
  box-shadow: var(--shadow-xl);
  display: grid;
  gap: 18px;
  animation: authPop 0.22s ease-out;
}
@keyframes authPop {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.auth-header {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 8px;
}
.auth-header .brand-mark { width: 56px; height: 56px; }
.auth-header .auth-logo {
  width: 200px; height: 60px;
  justify-content: center;
}
.auth-header .auth-logo img { object-position: center; }
.auth-header h2 { margin: 4px 0 0; font-size: 1.4rem; color: var(--navy); }
.auth-header p { margin: 0; color: var(--muted); font-size: var(--fs-sm); }
.auth-form { display: grid; gap: 12px; }
.auth-form label {
  font-size: 0.72rem;
  color: var(--ink-700);
}
.auth-form input { font-size: var(--fs-md); }
.auth-reset-panel {
  display: grid; gap: 8px;
  padding: 12px;
  border: 1px solid var(--teal-300);
  border-radius: var(--r-md);
  background: var(--teal-50);
}
.auth-password { position: relative; }
.auth-password input { padding-right: 84px; }
.auth-toggle-password {
  position: absolute;
  right: 6px; top: 50%;
  transform: translateY(-50%);
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-xs);
  background: var(--ink-100);
  color: var(--navy);
  font-size: var(--fs-xs);
  font-weight: 700;
  cursor: pointer;
}
.auth-toggle-password:hover { background: var(--primary-soft); color: var(--primary-strong); }
.auth-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px; flex-wrap: wrap;
  font-size: var(--fs-sm);
}
.auth-row .checkbox-row { color: var(--muted); font-weight: 500; text-transform: none; }
.auth-link {
  background: none; border: 0; padding: 0;
  color: var(--primary-strong);
  font-weight: 600;
  cursor: pointer;
}
.auth-link:hover { text-decoration: underline; }
.auth-footer { margin: 0; text-align: center; font-size: var(--fs-sm); color: var(--muted); }
.auth-dialog .modal-close { top: 12px; right: 12px; }

/* Account dialog */
.account-dialog {
  width: min(980px, 100%);
  border-radius: var(--r-xl);
  padding: 24px;
}
.account-dialog-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.account-dialog-header h3 {
  margin: 4px 0 0;
  color: var(--navy);
  font-size: 1.35rem;
}
.account-dialog-header small { color: var(--muted); }
.account-photo { width: 68px; height: 68px; flex: 0 0 68px; font-size: 1.2rem; }
.account-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.72fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  margin-top: 16px;
}
.account-card {
  display: grid;
  gap: 12px;
  align-content: start;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  padding: 18px;
  box-shadow: var(--shadow-xs);
}
.account-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.account-card h4 {
  margin: 0;
  color: var(--navy);
  font-size: 1rem;
}
.account-card p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: var(--fs-xs);
  line-height: 1.45;
}
.account-card label { gap: 6px; }
.account-card input { width: 100%; }
.account-summary-card {
  grid-row: span 2;
  background:
    linear-gradient(180deg, rgba(20, 107, 82, 0.08), rgba(30, 181, 196, 0.06)),
    var(--surface);
}
.account-summary-photo {
  display: grid;
  gap: 14px;
  justify-items: start;
}
.account-photo-large {
  width: 112px;
  height: 112px;
  flex-basis: 112px;
  border-radius: var(--r-lg);
  font-size: 2rem;
  box-shadow: 0 18px 38px rgba(15, 44, 82, 0.18);
}
.account-summary-card h4 {
  margin: 0;
  color: var(--navy);
  font-size: 1.12rem;
}
.account-summary-card p {
  overflow-wrap: anywhere;
}
#accountSummaryRole {
  display: inline-flex;
  width: fit-content;
  border-radius: var(--r-pill);
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: var(--fs-xs);
  font-weight: 800;
  padding: 6px 10px;
}
.account-photo-uploader {
  display: grid;
  gap: 10px;
  margin-top: 4px;
}
.account-upload-drop {
  position: relative;
  display: grid !important;
  gap: 5px !important;
  border: 1px dashed var(--teal-300);
  border-radius: var(--r-md);
  background: rgba(30, 181, 196, 0.08);
  color: var(--ink);
  padding: 14px;
  cursor: pointer;
}
.account-upload-drop span {
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 800;
  text-transform: uppercase;
}
.account-upload-drop strong {
  color: var(--primary-strong);
}
.account-upload-drop small {
  color: var(--muted);
  line-height: 1.4;
}
.account-upload-drop input {
  margin-top: 6px;
}
.account-access-card {
  grid-column: 2 / -1;
}
.account-access-list {
  display: grid;
  gap: 8px;
  max-height: 190px;
  overflow: auto;
}
.account-access-list > div,
.account-access-list p:not(.form-message) {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  padding: 9px 10px;
}

/* Impersonation banner */
.impersonation-banner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 12px 16px; margin: 0 0 16px 0;
  background: var(--warning-soft);
  border: 1px solid var(--warning);
  border-radius: var(--r-md);
  color: #6b4d00;
}
.impersonation-banner strong { display: block; font-size: var(--fs-md); }
.impersonation-banner small { display: block; opacity: 0.85; margin-top: 2px; font-size: var(--fs-xs); }
.impersonation-banner .secondary-button {
  background: #fff;
  border-color: var(--warning);
  color: #6b4d00;
}

/* =========================================================================
   Platform admin (SaaS)
   ========================================================================= */

.platform-filters {
  display: grid;
  grid-template-columns: 2fr 1fr auto;
  gap: 10px;
  margin: 14px 0;
}
.platform-status-pill {
  display: inline-flex; align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.platform-status-pill[data-status="ATIVA"],
.platform-status-pill[data-status="ATIVO"],
.platform-status-pill[data-status="PAGA"],
.platform-status-pill[data-status="COMPLETO"] { background: var(--success-soft); color: var(--success); }
.platform-status-pill[data-status="TRIAL"],
.platform-status-pill[data-status="EM_TESTE"],
.platform-status-pill[data-status="ABERTA"],
.platform-status-pill[data-status="PARCIAL"] { background: var(--info-soft); color: var(--navy); }
.platform-status-pill[data-status="SUSPENSA"],
.platform-status-pill[data-status="VENCIDA"],
.platform-status-pill[data-status="PENDENTE"] { background: var(--warning-soft); color: var(--warning); }
.platform-status-pill[data-status="CANCELADA"],
.platform-status-pill[data-status="CANCELADO"] { background: var(--danger-soft); color: var(--danger); }

.platform-row-actions { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.platform-row-actions button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-700);
  padding: 5px 10px;
  border-radius: var(--r-sm);
  font-size: var(--fs-xs);
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.platform-row-actions button:hover { border-color: var(--primary); color: var(--primary-strong); }
.platform-row-actions button[data-action="suspend"]:hover { border-color: var(--danger); color: var(--danger); }
.platform-row-actions button[data-action="activate"]:hover { border-color: var(--success); color: var(--success); }

.platform-modules {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.platform-modules-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.platform-modules-header h4 { margin: 0; color: var(--navy); font-size: 1.05rem; }
.platform-modules-header span { display: block; margin-top: 4px; color: var(--muted); font-size: var(--fs-sm); }
.platform-modules-tools {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 8px;
  padding: 12px 18px 0;
  align-items: center;
}
.platform-modules-tools input { background: var(--surface-2); }
.platform-modules-status {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding: 10px 18px 0;
}
.platform-modules-status span {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 30px;
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 700;
}
.platform-modules-status strong { color: var(--navy); font-size: var(--fs-sm); }

.platform-modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  padding: 14px 18px 18px;
}
.platform-module-card {
  position: relative;
  display: flex; align-items: flex-start; gap: 12px;
  min-height: 96px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  cursor: pointer;
  font-size: var(--fs-sm);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.platform-module-card:hover { border-color: var(--teal-300); box-shadow: var(--shadow-xs); }
.platform-module-card:has(input:checked) { border-color: var(--primary); background: var(--teal-50); }
.platform-module-check { position: absolute; opacity: 0; pointer-events: none; }
.platform-module-toggle {
  position: relative;
  flex: 0 0 40px;
  width: 40px; height: 22px;
  margin-top: 2px;
  border-radius: var(--r-pill);
  background: var(--ink-200);
  box-shadow: inset 0 0 0 1px rgba(15, 44, 82, 0.08);
  transition: background .18s ease;
}
.platform-module-toggle::before {
  content: "";
  position: absolute;
  left: 3px; top: 3px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgba(15, 44, 82, 0.18);
  transition: transform .18s ease;
}
.platform-module-card:has(input:checked) .platform-module-toggle { background: var(--primary); }
.platform-module-card:has(input:checked) .platform-module-toggle::before { transform: translateX(18px); }
.platform-module-copy { display: grid; gap: 4px; min-width: 0; flex: 1; }
.platform-module-title {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.platform-module-copy strong { color: var(--navy); font-size: var(--fs-sm); line-height: 1.2; }
.platform-module-copy small {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.platform-module-title em {
  flex: 0 0 auto;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: var(--ink-100);
  color: var(--muted);
  font-style: normal;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
}
.platform-module-card:has(input:checked) .platform-module-title em {
  background: var(--primary-soft);
  color: var(--primary-strong);
}
.platform-module-copy > span:not(.platform-module-title) {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}
.platform-modules-actions {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 12px; flex-wrap: wrap;
  min-height: 60px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}
.platform-modules-actions .form-message { margin: 0 auto 0 0; }

.platform-section-tabs {
  display: inline-flex;
  gap: 4px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--r-md);
  padding: 4px;
  margin: 4px 0 16px;
}
.platform-section-tabs button {
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--ink-600);
  cursor: pointer;
  font-weight: 700;
  font-size: var(--fs-sm);
  min-height: 32px;
  padding: 6px 14px;
  transition: background .15s ease, color .15s ease;
}
.platform-section-tabs button:hover { background: var(--ink-100); color: var(--navy); }
.platform-section-tabs button.active { background: var(--grad-brand); color: #fff; }

.platform-subsection { margin-top: 4px; }
.platform-admin-grid { display: grid; gap: 14px; margin-top: 14px; }
.platform-admin-panel {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 16px;
  box-shadow: var(--shadow-xs);
}
.platform-admin-panel-header {
  display: flex; justify-content: space-between;
  gap: 16px; align-items: flex-start;
  margin-bottom: 14px;
}
.platform-admin-panel-header h4 { margin: 4px 0 0; color: var(--navy); }
.platform-panel-actions {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  justify-content: flex-end;
}
.platform-panel-actions input[type="month"] {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 6px 10px;
  background: var(--surface-2);
}
.compact-kpis { margin: 12px 0 14px; }
.platform-split { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.platform-split h5, .platform-settings-group h5 {
  margin: 0 0 10px;
  color: var(--navy);
  font-size: var(--fs-md);
}

.billing-inline-editor {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) 96px 76px 108px auto;
  gap: 6px; align-items: center;
  min-width: 540px;
}
.billing-inline-editor input, .billing-inline-editor select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--r-xs);
  padding: 6px 8px;
  background: var(--surface-2);
  font-size: var(--fs-xs);
}
.platform-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.platform-settings-group {
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: var(--r-md);
  padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.platform-settings-health-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}
.platform-setting-health {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--r-md);
  padding: 12px;
  display: grid; gap: 4px;
}
.platform-setting-health span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}
.platform-setting-health strong { color: var(--navy); font-size: var(--fs-sm); }
.platform-setting-health small { color: var(--muted); line-height: 1.35; font-size: var(--fs-xs); }
.platform-settings-group-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
}
.platform-settings-group-head h5 { margin: 0; }
.platform-setting-field small, .platform-setting-check small {
  color: var(--muted); line-height: 1.35; font-size: var(--fs-xs);
}
.platform-setting-field em {
  display: inline-block; margin-left: 6px;
  color: var(--primary-strong);
  font-size: 0.65rem;
  font-style: normal; font-weight: 800;
  text-transform: uppercase;
}
.platform-setting-check {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 8px;
  align-items: start;
  color: var(--ink-700);
  font-size: var(--fs-sm);
}
.platform-setting-check input { margin-top: 2px; }
.platform-setting-check small { grid-column: 2; }

.platform-invoice-dialog,
.platform-action-dialog,
.perfil-dialog {
  width: min(720px, 100%);
  border-radius: var(--r-xl);
}
.platform-invoice-dialog { width: min(680px, 100%); }
.invoice-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: var(--r-md);
  padding: 12px;
}
.invoice-summary span {
  display: block;
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  font-weight: 700;
}
.invoice-summary strong {
  display: block;
  color: var(--ink);
  font-size: var(--fs-sm);
  margin-top: 2px;
}
.platform-action-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.platform-action-copy { margin: 0; color: var(--muted); line-height: var(--lh-base); font-size: var(--fs-sm); }

/* Usuário dialog */
.usuario-dialog { width: min(820px, 100%); border-radius: var(--r-xl); }
.usuario-dialog-header {
  display: flex; justify-content: space-between;
  gap: 16px; align-items: flex-start;
}
.usuario-dialog-header h3 { margin: 4px 0 0; color: var(--navy); }
#usuarioModalStatus, #platformActionStatus {
  border: 1px solid var(--line);
  background: var(--primary-soft);
  color: var(--primary-strong);
  border-radius: var(--r-pill);
  padding: 4px 12px;
  font-size: 0.7rem;
  font-weight: 700;
}
.usuario-form { display: grid; gap: 12px; }
.usuario-form select[multiple] { min-height: 112px; }
.usuario-modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.usuario-danger-zone {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  display: grid; gap: 10px;
}
.usuario-danger-zone h4 { margin: 0; color: var(--danger); }
.usuario-danger-zone p { margin: 2px 0 0; color: var(--muted); font-size: var(--fs-sm); }
.usuario-danger-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.usuario-security-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(260px, 0.75fr);
  gap: 12px;
}
.usuario-security-card {
  display: grid;
  gap: 10px;
  align-content: start;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  padding: 12px;
}
.usuario-security-card strong {
  display: block;
  color: var(--navy);
  font-size: var(--fs-sm);
}
.usuario-security-card span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: var(--fs-xs);
  line-height: var(--lh-snug);
}
.usuario-security-card-danger {
  border-color: color-mix(in srgb, var(--danger) 28%, var(--line));
  background: var(--danger-soft);
}
.usuario-security-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}
.usuario-security-row input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--r-xs);
  padding: 10px 12px;
  font: inherit;
  background: var(--surface);
  color: var(--ink);
}

/* Platform users list */
.platform-users-list { display: flex; flex-direction: column; gap: 8px; }
.platform-user-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.platform-user-row:hover { border-color: var(--teal-300); box-shadow: var(--shadow-xs); }
.platform-user-row strong { color: var(--navy); }
.platform-user-row small { display: block; color: var(--muted); margin-top: 2px; font-size: var(--fs-xs); }
.platform-user-row .user-meta {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-top: 6px;
  font-size: var(--fs-xs);
  color: var(--muted);
}
.platform-user-row .user-pill, .user-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: var(--ink-100);
  border: 1px solid var(--line);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.platform-user-row .user-pill[data-tipo="ADMIN_EMPRESA"],
.user-pill[data-tipo="ADMIN_EMPRESA"] {
  background: var(--success-soft); border-color: var(--success); color: var(--success);
}
.platform-user-row .user-pill[data-tipo="SUPERADMIN"],
.user-pill[data-tipo="SUPERADMIN"] {
  background: var(--danger-soft); border-color: var(--danger); color: var(--danger);
}
.platform-user-row .user-pill[data-inativo="1"] { background: var(--ink-100); color: var(--ink-400); }

/* =========================================================================
   Perfis e permissões
   ========================================================================= */

.perfis-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
  margin-top: 12px;
}
.perfis-sidebar {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 14px;
}
.perfis-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px;
}
.perfis-toolbar h4 { margin: 0; font-size: var(--fs-md); color: var(--navy); }
.perfis-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.perfis-empty { color: var(--muted); font-size: var(--fs-sm); padding: 6px 0; }
.perfil-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  cursor: pointer;
  display: flex; flex-direction: column; gap: 2px;
  transition: border-color .15s ease, background .15s ease;
}
.perfil-item:hover { border-color: var(--teal-300); background: var(--surface-2); }
.perfil-item.active {
  background: var(--grad-brand);
  color: #fff;
  border-color: transparent;
}
.perfil-item.active .perfil-item-meta { color: rgba(255,255,255,0.85); }
.perfil-item-nome { font-weight: 700; font-size: var(--fs-sm); }
.perfil-item-meta { color: var(--muted); font-size: 0.72rem; }

.perfis-editor {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px;
  display: flex; flex-direction: column;
  gap: 14px;
}
.perfil-editor-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: start;
}
.perfil-editor-header > div:first-child { display: flex; flex-direction: column; gap: 8px; }
#perfilNomeInput {
  font-size: 1.05rem;
  font-weight: 700;
}
#perfilDescricaoInput { font-family: inherit; }
.perfil-editor-actions { display: flex; flex-direction: column; gap: 6px; }
.perfil-editor-message {
  margin: 0;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
}
.perfil-editor-message[data-type="error"] { background: var(--danger-soft); color: var(--danger); }
.perfil-editor-message[data-type="success"] { background: var(--success-soft); color: var(--success); }

.perfil-editor-body {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 18px;
}
.perfil-permissoes h5, .perfil-usuarios h5 { margin: 0 0 8px; font-size: var(--fs-md); color: var(--navy); }
.perfil-hint { color: var(--muted); font-size: var(--fs-xs); margin: 0 0 8px; }
.perfil-matriz-wrap {
  max-height: 380px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  margin-bottom: 10px;
}
.perfil-matriz {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
.perfil-matriz th, .perfil-matriz td {
  padding: 8px 10px;
  text-align: center;
  border-bottom: 1px solid var(--line);
}
.perfil-matriz th {
  background: var(--surface-2);
  position: sticky; top: 0;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  font-weight: 700;
  color: var(--ink-600);
}
.perfil-matriz td:first-child, .perfil-matriz th:first-child { text-align: left; }
.perfil-matriz td small { color: var(--muted); display: block; font-size: 0.68rem; }

.perfil-usuarios-list {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column;
  gap: 6px;
  max-height: 380px; overflow: auto;
}
.perfil-usuarios-list li {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  display: flex; flex-direction: column;
  gap: 2px;
}
.perfil-usuarios-list li small { color: var(--muted); font-size: var(--fs-xs); }
.perfil-usuarios-empty { color: var(--muted); font-size: var(--fs-sm); }

.perfis-vinculos { margin-top: 14px; }
.perfis-vinculos summary { cursor: pointer; font-weight: 700; padding: 8px 0; color: var(--navy); }
.perfis-select {
  min-width: 180px; min-height: 70px;
  padding: 6px; border: 1px solid var(--line);
  border-radius: var(--r-sm); font-size: var(--fs-xs);
}

/* =========================================================================
   Aparência por empresa
   ========================================================================= */

.aparencia-message {
  margin: 0 0 12px;
  padding: 8px 14px;
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
}
.aparencia-message[data-type="error"] { background: var(--danger-soft); color: var(--danger); }
.aparencia-message[data-type="success"] { background: var(--success-soft); color: var(--success); }

.aparencia-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 18px;
  margin-top: 10px;
}
.aparencia-form {
  display: flex; flex-direction: column; gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px;
}
.aparencia-form .field { display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-sm); }
.aparencia-form .field > span { color: var(--muted); font-weight: 600; text-transform: none; letter-spacing: 0; font-size: var(--fs-xs); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.color-row { display: flex; gap: 8px; align-items: center; }
.color-row input[type="color"] { width: 48px; height: 38px; padding: 0; }
.color-row input[type="text"] { flex: 1; }
.aparencia-actions { display: flex; gap: 10px; margin-top: 6px; }
.company-config-actions { flex-wrap: wrap; margin: 14px 0 0; }
.company-active-card { margin: 0 0 16px; }
.company-summary-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.aparencia-preview {
  --prev-cor1: var(--navy-800);
  --prev-cor2: var(--teal-500);
  background: linear-gradient(135deg, var(--prev-cor1) 0%, var(--prev-cor2) 100%);
  color: #fff;
  border-radius: var(--r-lg);
  padding: 18px;
  display: flex; flex-direction: column;
  gap: 14px;
  min-height: 280px;
}
.aparencia-preview-header { display: flex; gap: 12px; align-items: center; }
.aparencia-preview-logo {
  width: 56px; height: 56px;
  border-radius: var(--r-md);
  background: rgba(255,255,255,0.15);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.aparencia-preview-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.aparencia-preview-logo span { font-size: 0.7rem; opacity: 0.7; text-align: center; }
.aparencia-preview h4 { margin: 0; font-size: 1.05rem; color: #fff; }
.aparencia-preview small { opacity: 0.85; font-size: var(--fs-xs); }
.aparencia-preview-card {
  background: rgba(255,255,255,0.12);
  border-radius: var(--r-md);
  padding: 12px;
  display: flex; gap: 8px; flex-wrap: wrap;
}
.aparencia-chip {
  padding: 4px 12px;
  border-radius: var(--r-pill);
  font-size: var(--fs-xs);
  font-weight: 700;
}
.aparencia-chip-primary { background: var(--prev-cor1); color: #fff; border: 1px solid rgba(255,255,255,0.2); }
.aparencia-chip-secondary { background: var(--prev-cor2); color: var(--navy-900); }
.aparencia-preview-cta {
  align-self: flex-start;
  background: #fff; color: var(--prev-cor1);
  border: none; border-radius: var(--r-pill);
  padding: 8px 18px;
  font-weight: 700;
  cursor: default;
}

.module-nav-group {
  margin: 14px 8px 6px;
  color: var(--muted);
  font-size: var(--fs-xxs);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.company-config-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.company-config-card,
.company-menu-section {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.company-contact-card { grid-column: 1 / -1; }

.compact-header {
  align-items: flex-start;
  margin-bottom: 12px;
}

.compact-header h4 {
  margin: 2px 0 0;
  color: var(--ink);
  font-size: var(--fs-lg);
}

.checkbox-field {
  flex-direction: row !important;
  align-items: center;
  gap: 8px !important;
}

.checkbox-field input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.small-field { max-width: 160px; }

.company-menu-section { margin-top: 18px; }

.company-menu-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.company-menu-builder {
  display: grid;
  gap: 10px;
}

.company-menu-item {
  display: grid;
  grid-template-columns: 132px 96px minmax(180px, 1fr) minmax(160px, 0.8fr) minmax(120px, 0.5fr);
  gap: 10px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 10px;
  background: var(--surface-2);
}

.company-menu-order {
  display: grid;
  grid-template-columns: 32px 1fr 32px;
  gap: 6px;
  align-items: end;
}

.company-menu-order input {
  width: 100%;
  min-width: 0;
}

.reports-free-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: end;
  border: 1px solid rgba(20, 107, 82, 0.22);
  border-radius: var(--r-lg);
  background:
    linear-gradient(135deg, rgba(20, 107, 82, 0.12), rgba(30, 181, 196, 0.1)),
    var(--surface);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  margin: 14px 0 16px;
}
.reports-free-hero h4 {
  margin: 4px 0 6px;
  color: var(--navy);
  font-size: 1.25rem;
}
.reports-free-hero p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  line-height: var(--lh-base);
  max-width: 860px;
}
.reports-free-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-pill);
  background: var(--success-soft);
  color: var(--success);
  font-size: var(--fs-xs);
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 6px 10px;
  margin-bottom: 8px;
}
.reports-free-badge.compact {
  margin: 0 0 6px;
  padding: 4px 9px;
  font-size: var(--fs-xxs);
}
.reports-free-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.reports-workbench {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 14px 0 16px;
}
.reports-workbench-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background:
    linear-gradient(135deg, rgba(20, 107, 82, 0.08), rgba(30, 181, 196, 0.08)),
    var(--surface);
  box-shadow: var(--shadow-sm);
  padding: 18px;
}
.reports-workbench-card h4 {
  margin: 4px 0 6px;
  color: var(--navy);
  font-size: 1.1rem;
}
.reports-workbench-card p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: var(--lh-base);
}
.reports-workbench-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: var(--r-md);
  background: var(--primary);
  color: #fff;
  font-weight: 900;
  margin-bottom: 10px;
}
.reports-designer-shell {
  border: 1px solid var(--teal-300);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  padding: 16px;
  margin: 14px 0 16px;
}
.reports-designer-shell[hidden] { display: none; }
.report-pro-features {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}
.report-pro-features span {
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--primary-strong);
  font-size: var(--fs-xs);
  font-weight: 800;
  padding: 6px 10px;
}
.reports-library-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0 8px;
}
.reports-library-head h4 {
  margin: 2px 0 0;
  color: var(--navy);
  font-size: 1rem;
}
.reports-library-head > span {
  border-radius: var(--r-pill);
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: var(--fs-xs);
  font-weight: 800;
  padding: 7px 11px;
}
.report-model-cell {
  display: grid;
  gap: 4px;
}
.report-model-cell strong {
  color: var(--navy);
  font-size: var(--fs-sm);
}
.report-model-cell small {
  color: var(--muted);
  line-height: 1.35;
}
.report-model-kind {
  justify-self: start;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--primary-strong);
  font-size: var(--fs-xxs);
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 4px 8px;
}
#platformReportsTable .listing-card {
  min-height: 220px;
  border-color: rgba(20, 107, 82, 0.18);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.68), rgba(255,255,255,0)),
    var(--surface);
}
#platformReportsTable .listing-card[data-report-kind="tabela-cruzada"] {
  border-color: rgba(216, 163, 31, 0.38);
}
#platformReportsTable .listing-card-head h4 {
  font-size: 1rem;
  line-height: 1.25;
}
#platformReportsTable .listing-card-body {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.icon-button {
  width: 32px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

.icon-button:hover {
  border-color: var(--primary);
  color: var(--primary-strong);
}

.company-menu-original {
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-self: center;
  color: var(--muted);
  font-size: var(--fs-xs);
}

.company-menu-original strong {
  color: var(--ink);
  font-size: var(--fs-sm);
}

/* =========================================================================
   Usuários
   ========================================================================= */

.usuarios-toolbar { display: flex; gap: 10px; margin: 6px 0 14px; flex-wrap: wrap; }
.usuario-acoes { display: flex; gap: 4px; flex-wrap: wrap; }
.usuario-acoes .ghost-button { padding: 4px 10px; font-size: var(--fs-xs); }
.perfil-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: var(--ink-100);
  border: 1px solid var(--line);
  font-size: 0.68rem;
  font-weight: 600;
  margin-right: 4px;
}
.status-on { color: var(--success); font-weight: 700; }
.status-off { color: var(--danger); font-weight: 700; }
.usuarios-legado { margin-top: 14px; font-size: var(--fs-sm); }
.usuarios-legado summary { cursor: pointer; color: var(--muted); padding: 6px 0; }

/* Dev quick login */
.dev-quick-login {
  margin-top: -4px;
  display: inline-flex;
  align-items: center; justify-content: center;
  gap: 6px;
  font-size: var(--fs-xs);
  border-style: dashed;
  color: var(--primary-strong);
  background: var(--teal-50);
  border-color: var(--teal-300);
}
.dev-quick-login:hover { background: var(--primary-soft); }
.dev-quick-login[hidden] { display: none; }

/* =========================================================================
   Start screen / resource catalog
   ========================================================================= */

.start-screen {
  min-height: calc(100vh - var(--topbar-h));
  padding: clamp(24px, 4vw, 40px) clamp(20px, 4vw, 40px);
  background: var(--bg);
}
.start-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  padding: 24px;
}
.start-hero h1 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 2.75rem);
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.start-hero p {
  max-width: 880px;
  color: var(--muted);
  font-size: var(--fs-md);
  line-height: var(--lh-base);
  margin-top: 8px;
}
.start-actions {
  display: flex; flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.start-login { margin-top: 14px; }

.resource-catalog { margin-top: 18px; }
.resource-catalog .section-heading { margin-bottom: 14px; }
.resource-catalog h2 { margin: 0; font-size: clamp(1.4rem, 2.4vw, 1.85rem); }
.resource-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}
.resource-card {
  min-height: 160px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  padding: 16px;
  box-shadow: var(--shadow-xs);
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.resource-card:hover {
  border-color: var(--teal-300);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}
.resource-card strong, .resource-card p { display: block; }
.resource-card strong { font-size: var(--fs-md); color: var(--navy); }
.resource-card p { margin: 8px 0 0; color: var(--muted); font-size: var(--fs-sm); line-height: var(--lh-base); }

/* =========================================================================
   Módulo Financeiro
   ========================================================================= */

#financeiroPanel { display: flex; flex-direction: column; gap: 18px; }
.fin-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
.fin-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.fin-tabs {
  display: flex; gap: 2px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.fin-tab {
  background: transparent;
  color: var(--muted);
  border: none;
  padding: 10px 16px;
  cursor: pointer;
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.fin-tab:hover { color: var(--navy); }
.fin-tab.active { color: var(--primary-strong); border-bottom-color: var(--primary); font-weight: 700; }
.fin-tab-panel { display: flex; flex-direction: column; gap: 14px; }

.fin-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
}
.fin-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  display: flex; flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-xs);
}
.fin-card > h3 { margin: 0; font-size: 1rem; color: var(--navy); }
.fin-card-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.fin-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}
.fin-kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--primary);
  border-radius: var(--r-md);
  padding: 12px 14px;
  display: flex; flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow-xs);
}
.fin-kpi span { font-size: var(--fs-xs); color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.fin-kpi strong { font-size: 1.3rem; color: var(--navy); }
.fin-kpi[data-tone="danger"] { border-left-color: var(--danger); }
.fin-kpi[data-tone="warn"]   { border-left-color: var(--warning); }
.fin-kpi[data-tone="info"]   { border-left-color: var(--info); }
.fin-kpi[data-tone="muted"]  { border-left-color: var(--ink-400); }

.fin-line {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
}
.fin-line:last-child { border-bottom: none; }
.fin-line small { display: block; color: var(--muted); font-size: var(--fs-xs); }
.fin-pos { color: var(--success); font-weight: 700; }
.fin-neg { color: var(--danger); font-weight: 700; }
.fin-empty { color: var(--muted); margin: 0; font-style: italic; font-size: var(--fs-sm); }

.fin-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px; flex-wrap: wrap;
  padding: 8px 0;
  margin-bottom: 4px;
}
.fin-toolbar h4 { margin: 0; font-size: 1rem; color: var(--navy); }

.fin-grid {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
.fin-grid th, .fin-grid td {
  padding: 9px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
.fin-grid th {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 700;
  background: var(--surface-2);
}
.fin-grid tbody tr:hover { background: var(--ink-50); }

.fin-status {
  display: inline-block;
  padding: 2px 10px;
  border-radius: var(--r-pill);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.fin-status-aberto    { background: var(--info-soft); color: var(--info); }
.fin-status-parcial   { background: var(--warning-soft); color: var(--warning); }
.fin-status-quitado   { background: var(--success-soft); color: var(--success); }
.fin-status-cancelado { background: var(--danger-soft); color: var(--danger); }

.fin-tag-demo {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: var(--r-xs);
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
}

.fin-dialog {
  width: min(960px, calc(100vw - 28px));
  max-width: 960px;
  max-height: calc(100vh - 48px);
  overflow: auto;
}
.fin-form { display: flex; flex-direction: column; gap: 12px; }
.fin-form label {
  display: flex; flex-direction: column;
  gap: 4px;
  font-size: var(--fs-xs);
  color: var(--ink-700);
}
.fin-form input, .fin-form select, .fin-form textarea { padding: 9px 12px; }
.fin-form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}
.fin-form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.fin-parcela-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.fin-titulo-header {
  display: flex; justify-content: space-between; align-items: center;
  padding-bottom: 12px; margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
}
.fin-titulo-header small { display: block; color: var(--muted); margin-top: 2px; font-size: var(--fs-xs); }

#finMessage { padding: 8px 14px; border-radius: var(--r-sm); font-size: var(--fs-sm); }
#finMessage[data-type="error"]   { background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger); }
#finMessage[data-type="success"] { background: var(--success-soft); color: var(--success); border: 1px solid var(--success); }

/* =========================================================================
   Framework genérico de módulos — mod-*
   ========================================================================= */

.mod-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  padding: 12px 0;
}
.mod-kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--primary);
  border-radius: var(--r-md);
  padding: 12px 14px;
  display: flex; flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow-xs);
}
.mod-kpi span { font-size: var(--fs-xs); color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.mod-kpi strong { font-size: 1.3rem; color: var(--navy); }
.mod-kpi-danger { border-left-color: var(--danger) !important; }

.mod-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: var(--ink-100);
  color: var(--ink-600);
}
.mod-badge-green  { background: var(--success-soft); color: var(--success); }
.mod-badge-blue   { background: var(--info-soft);    color: var(--info); }
.mod-badge-yellow { background: var(--warning-soft); color: var(--warning); }
.mod-badge-orange { background: #fdebd1; color: #b96108; }
.mod-badge-red    { background: var(--danger-soft);  color: var(--danger); }
.mod-badge-gray   { background: var(--ink-100);      color: var(--ink-600); }

.mod-table-wrap { overflow-x: auto; }
.mod-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
.mod-table th {
  text-align: left;
  padding: 9px 12px;
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-600);
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.mod-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  color: var(--ink-700);
}
.mod-table tr:last-child td { border-bottom: none; }
.mod-table tr:hover td { background: var(--ink-50); }

.mod-row-actions {
  display: flex; gap: 4px;
  justify-content: flex-end;
  white-space: nowrap;
}
.mod-row-actions .ghost-button { padding: 4px 10px; font-size: var(--fs-xs); }
.mod-action-status {
  align-self: center;
  padding: 3px 8px;
  border-radius: var(--r-xs);
  background: var(--success-soft);
  color: var(--success);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
}
.mod-action-wait     { background: var(--warning-soft); color: var(--warning); }
.mod-action-rejected { background: var(--danger-soft);  color: var(--danger); }
.mod-danger { color: var(--danger) !important; }
.mod-danger:hover { background: var(--danger-soft) !important; }

.mod-header-actions { display: flex; gap: 8px; }
.mod-tabs-nav { padding-top: 6px; }

.mod-painel-extra { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; }
.mod-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px 18px;
  box-shadow: var(--shadow-xs);
}
.mod-card h4 {
  margin: 0 0 10px;
  font-size: var(--fs-sm);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.report-designer {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
  gap: 14px;
  align-items: start;
}
.report-designer-builder,
.report-designer-preview {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}
.report-designer-builder { padding: 16px; }
.report-designer-preview {
  min-height: 520px;
  max-height: 76vh;
  overflow: auto;
  padding: 14px;
}
.report-designer-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}
.report-designer-head h3 {
  margin: 2px 0 0;
  color: var(--navy);
  font-size: 1.12rem;
}
.report-designer-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.report-designer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.report-designer-grid .wide { grid-column: 1 / -1; }
.report-designer label,
.report-designer-section label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 700;
}
.report-designer input,
.report-designer select,
.report-designer textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--r-xs);
  background: var(--surface-2);
  color: var(--ink);
  padding: 9px 10px;
  font: inherit;
  font-size: var(--fs-sm);
}
.report-designer textarea { resize: vertical; }
.report-designer-section {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.report-section-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 10px;
}
.report-section-title h4 {
  margin: 0;
  color: var(--navy);
  font-size: 0.96rem;
}
.report-section-title span {
  color: var(--muted);
  font-size: var(--fs-xs);
}
.report-field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 8px;
}
.report-field-option {
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px !important;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--r-xs);
  background: var(--surface-2);
  padding: 8px 10px;
}
.report-field-option input {
  width: 16px;
  height: 16px;
  padding: 0;
}
.report-field-option span {
  min-width: 0;
  color: var(--ink);
  font-size: var(--fs-sm);
  font-weight: 700;
  overflow-wrap: anywhere;
}
.report-field-option small {
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
}
.report-designer-triple {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.report-designer-triple > div {
  display: grid;
  align-content: start;
  gap: 8px;
}
.report-pivot-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.report-inline-check {
  display: flex !important;
  align-items: center;
  gap: 8px !important;
  color: var(--ink) !important;
  font-size: var(--fs-sm) !important;
}
.report-inline-check input {
  width: 16px;
  height: 16px;
  padding: 0;
}
.report-preview-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.report-preview-header span,
.report-preview-kpis span {
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
}
.report-preview-header h4 {
  margin: 3px 0 0;
  color: var(--navy);
  font-size: 1rem;
}
.report-preview-kpis {
  display: grid;
  grid-template-columns: auto auto;
  gap: 2px 8px;
  text-align: right;
}
.report-preview-kpis strong {
  color: var(--navy);
  font-size: 1rem;
}

.mod-workflow-center {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  padding: 16px;
  box-shadow: var(--shadow-xs);
}
.mod-workflow-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; margin-bottom: 12px;
}
.mod-workflow-head h4 { margin: 4px 0 0; font-size: 1rem; color: var(--navy); }
.mod-workflow-head > span {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 4px 12px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 700;
}
.mod-workflow-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.mod-workflow-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: 1fr auto;
  gap: 10px 12px;
  min-height: 150px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  padding: 14px;
}
.mod-workflow-step {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
  border-radius: var(--r-pill);
  background: var(--grad-brand);
  color: #fff;
  font-size: var(--fs-xs);
  font-weight: 800;
}
.mod-workflow-card strong { display: block; margin-bottom: 4px; color: var(--navy); font-size: var(--fs-sm); }
.mod-workflow-card p { margin: 0; color: var(--muted); font-size: var(--fs-xs); line-height: var(--lh-snug); }
.mod-workflow-card button { grid-column: 2; justify-self: start; align-self: end; }

.mod-funil { display: flex; flex-direction: column; gap: 8px; }
.mod-funil-row {
  display: grid;
  grid-template-columns: 120px 1fr 40px 110px;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-sm);
}
.mod-funil-label { color: var(--muted); font-size: var(--fs-xs); font-weight: 600; }
.mod-funil-bar-wrap {
  background: var(--ink-100);
  border-radius: var(--r-xs);
  height: 10px; overflow: hidden;
}
.mod-funil-bar {
  background: var(--grad-brand);
  height: 100%; border-radius: var(--r-xs);
  transition: width .4s ease;
}
.mod-funil-count { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; color: var(--navy); }
.mod-funil-val { text-align: right; font-size: var(--fs-xs); color: var(--muted); }

.mod-loading {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  font-size: var(--fs-sm);
}
.mod-loading.mod-error { color: var(--danger); }

/* Pedidos completos */
.mod-order-form,
.mod-order-detail { display: grid; gap: 14px; }
.mod-order-header,
.mod-order-footer {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap;
}
.mod-order-header h4 { margin: 0; color: var(--navy); }
.mod-order-items { display: grid; gap: 8px; }
.mod-order-item {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(110px, .45fr) minmax(130px, .55fr) minmax(96px, auto) auto;
  align-items: end;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 12px;
  background: var(--surface-2);
}
.mod-order-line-total { display: grid; gap: 2px; padding-bottom: 4px; }
.mod-order-line-total span,
.mod-order-footer span {
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
}
.mod-order-line-total strong,
.mod-order-footer strong {
  color: var(--navy);
  font-variant-numeric: tabular-nums;
}
.mod-order-footer {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.mod-stock-form,
.mod-stock-history { display: grid; gap: 14px; }
.mod-stock-impact {
  border: 1px solid var(--teal-300);
  border-radius: var(--r-md);
  background: var(--teal-50);
  color: var(--primary-strong);
  padding: 10px 14px;
  font-size: var(--fs-sm);
}
.mod-stock-impact[data-type="error"] {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger);
}

.mod-ocr-review { display: grid; gap: 14px; }
.mod-contract-form { display: grid; gap: 14px; }

.mod-ticket-timeline { display: grid; gap: 14px; }
.mod-ticket-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.mod-ticket-summary div {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 10px 12px;
  background: var(--surface-2);
  min-width: 0;
}
.mod-ticket-summary span,
.mod-ticket-entry-head span,
.mod-ticket-entry-head time {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  font-weight: 700;
}
.mod-ticket-summary strong {
  display: block; margin-top: 4px;
  color: var(--navy);
  overflow-wrap: anywhere;
}
.mod-ticket-controls {
  display: grid;
  grid-template-columns: minmax(180px, 260px) 1fr;
  gap: 10px;
  align-items: end;
}
.inline-check {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--ink-700);
  font-size: var(--fs-sm);
  min-height: 36px;
}
.inline-check input { width: 16px; height: 16px; }
.mod-ticket-entries {
  display: grid;
  gap: 10px;
  max-height: min(42vh, 420px);
  overflow: auto;
  padding-right: 4px;
}
.mod-ticket-entry {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 12px;
  background: var(--surface-2);
}
.mod-ticket-entry-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}
.mod-ticket-entry-head strong { color: var(--navy); overflow-wrap: anywhere; }
.mod-ticket-entry p {
  margin: 8px 0 0;
  color: var(--ink-700);
  line-height: var(--lh-base);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: var(--fs-sm);
}
.mod-empty-state {
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
  padding: 16px;
  color: var(--muted);
  text-align: center;
  font-size: var(--fs-sm);
}
.mod-ocr-copy { margin: 0; color: var(--muted); font-size: var(--fs-sm); line-height: var(--lh-base); }

/* mod- helpers */
#modMessage { padding: 8px 14px; border-radius: var(--r-sm); font-size: var(--fs-sm); }
#modMessage[data-type="error"]   { background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger); }
#modMessage[data-type="success"] { background: var(--success-soft); color: var(--success); border: 1px solid var(--success); }
#modModalMessage { padding: 6px 12px; border-radius: var(--r-sm); font-size: var(--fs-xs); min-height: 1.4em; }
#modModalMessage[data-type="error"]   { background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger); }
#modModalMessage[data-type="success"] { background: var(--success-soft); color: var(--success); border: 1px solid var(--success); }

.mod-check-wrap { padding: 4px 0; }
.mod-check-label {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-sm);
  color: var(--ink-700) !important;
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
}
.mod-check-label input[type="checkbox"] { width: 15px; height: 15px; }

.mod-form-section {
  grid-column: 1 / -1;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.mod-form-section:first-child {
  padding-top: 0;
  border-top: 0;
}
.mod-form-section h4 {
  margin: 0;
  color: var(--navy);
  font-size: var(--fs-md);
}
.mod-form-section p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: var(--fs-xs);
  line-height: 1.45;
}
#modModalForm.mod-dynamic-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
#modModalForm.mod-dynamic-form .mod-field:has(textarea),
#modModalForm.mod-dynamic-form .mod-check-wrap,
#modModalForm.mod-dynamic-form .fin-form-actions {
  grid-column: 1 / -1;
}

.mod-field {
  display: flex; flex-direction: column;
  gap: 4px;
  font-size: var(--fs-xs);
  color: var(--ink-700);
}
.mod-field em { font-style: normal; color: var(--danger); }
.mod-field input,
.mod-field select,
.mod-field textarea {
  padding: 9px 12px;
}

/* =========================================================================
   Responsivo
   ========================================================================= */

@media (max-width: 1100px) {
  .platform-split,
  .platform-settings-grid,
  .platform-settings-health-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .topbar {
    flex-wrap: wrap;
    align-items: center;
    padding: 10px 16px;
    gap: 10px;
  }
  .nav { display: none; }

  .hero,
  .split,
  .start-hero,
  .modules-heading,
  .app-shell,
  .workspace-grid,
  .login-panel,
  .module-record-form,
  .module-data-grid,
  .feature-bands,
  .onboarding-steps,
  .signup-dialog,
  .account-grid,
  .dashboard-visual-grid,
  .aparencia-grid,
  .company-config-grid,
  .company-menu-item,
  .readiness-summary,
  .perfis-layout,
  .perfil-editor-body,
  .help-hero,
  .help-card-grid,
  .help-check-grid,
  .reports-free-hero,
  .reports-workbench,
  .report-designer,
  .report-designer-triple,
  .report-pivot-grid,
  .usuario-security-grid {
    grid-template-columns: 1fr;
  }
  .account-summary-card,
  .account-access-card {
    grid-column: auto;
    grid-row: auto;
  }

  .hero { min-height: auto; padding-top: 36px; }
  .hero-showcase { min-height: auto; }

  .start-actions { justify-content: flex-start; }
  .modules-summary { justify-self: start; }

  .kpi-grid,
  .session-strip,
  .dashboard-highlight-grid,
  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-shell { grid-template-columns: 1fr; }
  .app-shell.sidebar-collapsed { grid-template-columns: 1fr; }
  .sidebar-toggle { display: flex; }
  .sidebar-collapse-button { display: none; }
  .workspace { padding-top: 72px; }

  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0; bottom: 0;
    height: auto;
    width: min(280px, 84vw);
    border-right: 1px solid var(--line);
    box-shadow: 16px 0 40px rgba(15, 44, 82, 0.18);
    transform: translateX(-105%);
    transition: transform .22s ease;
    z-index: 20;
  }
  body.app-mode .sidebar { top: 0; }
  .sidebar.open { transform: translateX(0); }
  .app-shell.sidebar-collapsed .sidebar {
    padding: 18px 12px 12px;
  }
  .app-shell.sidebar-collapsed .sidebar .brand {
    display: flex;
  }
  .app-shell.sidebar-collapsed .sidebar-section-label,
  .app-shell.sidebar-collapsed .sidebar-footer {
    display: block;
  }
  .app-shell.sidebar-collapsed .module-nav .nav-item {
    justify-content: flex-start;
    padding: 9px 12px;
  }
  .app-shell.sidebar-collapsed .module-nav .nav-item span,
  .app-shell.sidebar-collapsed .module-nav .module-nav-group {
    display: block;
  }
  .sidebar-backdrop[data-open="true"] { display: block; }

  .cta-section { flex-direction: column; align-items: flex-start; }
  .cta-actions { width: 100%; }

  .feature-section { padding: 48px 16px; }

  .platform-section-tabs { display: flex; flex-wrap: wrap; width: 100%; }
}

@media (max-width: 720px) {
  .platform-filters { grid-template-columns: 1fr; }
  .account-button { max-width: none; width: 100%; }
  .listing-toolbar, .listing-pagination { align-items: stretch; flex-direction: column; }
  .listing-toolbar-left, .listing-view-toggle, .listing-toolbar select, .listing-pagination button { width: 100%; }
  .listing-view-toggle button { flex: 1; }
  .listing-card-grid { grid-template-columns: 1fr; }
  .listing-card-head, .listing-card-actions { align-items: stretch; flex-direction: column; }
  .platform-modules-header, .platform-modules-actions { align-items: stretch; flex-direction: column; }
  .platform-modules-tools { grid-template-columns: 1fr; }
  .platform-modules-tools button { width: 100%; }
  .showcase-features { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .section, .feature-section, .cta-section, .start-screen, .workspace {
    padding: 28px 16px;
  }
  .metric-grid,
  .showcase-features,
  .kpi-grid,
  .session-strip,
  .dashboard-highlight-grid,
  .summary-grid,
  .module-data-grid,
  .live-strip,
  .demo-access,
  .field-row,
  .invoice-summary {
    grid-template-columns: 1fr;
  }
  .dashboard-bar-row {
    grid-template-columns: 1fr;
    gap: 7px;
  }
  .dashboard-bar-row > span {
    text-align: left;
  }
  .reports-workbench-card {
    grid-template-columns: 1fr;
  }
  .reports-free-actions,
  .reports-free-actions button {
    width: 100%;
  }
  .platform-action-summary { grid-template-columns: 1fr; }
  .preview-row { grid-template-columns: 1fr; }
  .modules-heading { gap: 14px; }
  .modules-summary { width: 100%; }
  .module-area { padding: 14px; }
  .module-area-header { align-items: flex-start; flex-direction: column; gap: 8px; }
  .module-area-grid { grid-template-columns: 1fr; }
  .report-designer-grid,
  .report-field-grid {
    grid-template-columns: 1fr;
  }
  .report-designer-head,
  .report-preview-header {
    align-items: stretch;
    flex-direction: column;
  }
  .report-designer-actions {
    justify-content: stretch;
  }
  .report-designer-actions button {
    flex: 1;
  }
  .report-designer-preview {
    min-height: 360px;
    max-height: none;
  }
  .usuario-security-row {
    grid-template-columns: 1fr;
  }

  .demo-band, .cta-section, .workspace-header, .workspace-actions {
    align-items: stretch; flex-direction: column;
  }
  .workspace-actions select { min-width: 0; }

  h1 { font-size: 1.85rem; }
  h2 { font-size: 1.35rem; }
  .session-strip div { padding: 12px 14px; }

  .mod-workflow-grid { grid-template-columns: 1fr; }
  .mod-workflow-card { min-height: 0; }
  .mod-order-item { grid-template-columns: 1fr 1fr; }
  .mod-order-item .ghost-button { grid-column: 1 / -1; }
  .mod-ticket-summary, .mod-ticket-controls, .mod-ticket-entry-head { grid-template-columns: 1fr; }

  .billing-inline-editor { min-width: 0; grid-template-columns: 1fr 1fr; }
  .billing-inline-editor .secondary-button { grid-column: 1 / -1; }
}

@media (max-width: 480px) {
  .auth-dialog { padding: 24px 18px 18px; border-radius: var(--r-xl); }
  .signup-dialog { padding: 20px; }
  .start-hero { padding: 18px; }
}

/* =========================================================================
   Tema escuro
   ========================================================================= */

body[data-tema="escuro"] {
  --bg: #07111e;
  --bg-soft: #0a1525;
  --surface: #101d33;
  --surface-2: #0a1726;
  --surface-strong: #14304a;
  --ink: #e5edf8;
  --ink-900: #f1f5fb;
  --ink-800: #e5edf8;
  --ink-700: #cfdaeb;
  --ink-600: #a8b7d0;
  --ink-500: #889ab8;
  --ink-400: #6a7d9c;
  --ink-300: #4a5d7f;
  --ink-200: #243352;
  --ink-100: #1a2a44;
  --ink-50:  #14233a;
  --muted: #a8b7d0;
  --line: #233357;
  --line-strong: #2c4068;
  --primary-soft: rgba(24, 176, 185, 0.18);
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-sm: 0 4px 12px rgba(0,0,0,0.35);
  --shadow-md: 0 10px 26px rgba(0,0,0,0.45);
  --shadow-lg: 0 22px 50px rgba(0,0,0,0.55);
  --grad-surface: linear-gradient(180deg, #14233a 0%, #0e1c30 100%);
}

body[data-tema="escuro"] .topbar {
  background: rgba(7, 17, 30, 0.88);
  border-bottom: 1px solid var(--line);
}
body[data-tema="escuro"] .sidebar {
  background: var(--surface-2);
  border-right: 1px solid var(--line);
}
body[data-tema="escuro"] .module-nav .nav-item { color: var(--ink-700); }
body[data-tema="escuro"] .module-nav .nav-item:hover { background: var(--ink-100); color: var(--ink); }
body[data-tema="escuro"] .module-nav .nav-item.active { background: rgba(24, 176, 185, 0.16); color: var(--ink); }
body[data-tema="escuro"] .module-nav .nav-item::before { background: var(--ink-100); color: var(--teal-300); }

body[data-tema="escuro"] .table-panel,
body[data-tema="escuro"] .admin-panel,
body[data-tema="escuro"] .login-panel,
body[data-tema="escuro"] .module-data-panel,
body[data-tema="escuro"] .perfis-sidebar,
body[data-tema="escuro"] .perfis-editor,
body[data-tema="escuro"] .aparencia-form,
body[data-tema="escuro"] .auth-dialog,
body[data-tema="escuro"] .signup-dialog,
body[data-tema="escuro"] .account-card,
body[data-tema="escuro"] .usuario-dialog,
body[data-tema="escuro"] .platform-invoice-dialog,
body[data-tema="escuro"] .platform-action-dialog,
body[data-tema="escuro"] .perfil-dialog,
body[data-tema="escuro"] .platform-admin-panel,
body[data-tema="escuro"] .platform-modules,
body[data-tema="escuro"] .module-card,
body[data-tema="escuro"] .module-area,
body[data-tema="escuro"] .resource-card,
body[data-tema="escuro"] .start-hero,
body[data-tema="escuro"] .hero-showcase,
body[data-tema="escuro"] .feature-bands article,
body[data-tema="escuro"] .onboarding-steps article,
body[data-tema="escuro"] .showcase-features article,
body[data-tema="escuro"] .cta-section,
body[data-tema="escuro"] .platform-module-card,
body[data-tema="escuro"] .platform-user-row,
body[data-tema="escuro"] .perfis-list .perfil-item,
body[data-tema="escuro"] .mod-card,
body[data-tema="escuro"] .mod-workflow-center,
body[data-tema="escuro"] .fin-card,
body[data-tema="escuro"] .fin-kpi,
body[data-tema="escuro"] .mod-kpi,
body[data-tema="escuro"] .help-card,
body[data-tema="escuro"] .help-context,
body[data-tema="escuro"] .help-check-grid div {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

body[data-tema="escuro"] .mod-workflow-card,
body[data-tema="escuro"] .mod-ticket-entry,
body[data-tema="escuro"] .mod-ticket-summary div,
body[data-tema="escuro"] .module-record,
body[data-tema="escuro"] .summary-item,
body[data-tema="escuro"] .compact-table,
body[data-tema="escuro"] .listing-card-grid,
body[data-tema="escuro"] .empty-state,
body[data-tema="escuro"] .platform-settings-group,
body[data-tema="escuro"] .mod-order-item,
body[data-tema="escuro"] .onboarding-steps article,
body[data-tema="escuro"] .help-checklist {
  background: var(--surface-2);
  border-color: var(--line);
}

body[data-tema="escuro"] input,
body[data-tema="escuro"] select,
body[data-tema="escuro"] textarea {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--ink);
}
body[data-tema="escuro"] input::placeholder,
body[data-tema="escuro"] textarea::placeholder { color: var(--ink-400); }

body[data-tema="escuro"] table { color: var(--ink); }
body[data-tema="escuro"] th,
body[data-tema="escuro"] .data-table th,
body[data-tema="escuro"] .mod-table th,
body[data-tema="escuro"] .fin-grid th { background: var(--ink-100); color: var(--ink-600); }
body[data-tema="escuro"] tr:hover td { background: rgba(255,255,255,0.03); }

body[data-tema="escuro"] .secondary-button {
  background: var(--surface-2);
  color: var(--ink);
  border-color: var(--line);
}
body[data-tema="escuro"] .secondary-button:hover { border-color: var(--primary); color: var(--teal-300); }
body[data-tema="escuro"] .ghost-button { color: var(--ink-700); }
body[data-tema="escuro"] .ghost-button:hover { background: var(--ink-100); color: var(--ink); }
body[data-tema="escuro"] .icon-button {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--teal-300);
}
body[data-tema="escuro"] .icon-button:hover {
  background: var(--ink-100);
  color: var(--ink);
}
body[data-tema="escuro"] .primary-icon-button {
  background: var(--grad-brand);
  color: #fff;
}
body[data-tema="escuro"] .admin-tab { color: var(--ink-700); }
body[data-tema="escuro"] .admin-tab:hover { background: var(--ink-100); color: var(--ink); }

body[data-tema="escuro"] .check-list li,
body[data-tema="escuro"] .alert-list li { color: var(--ink-700); }

body[data-tema="escuro"] .modules-summary {
  background: var(--surface);
  color: var(--ink);
}

body[data-tema="escuro"] .modal-close { background: var(--surface-2); color: var(--ink-700); border-color: var(--line); }
body[data-tema="escuro"] .modal-close:hover { background: var(--ink-100); color: var(--ink); }

body[data-tema="escuro"] .impersonation-banner {
  background: linear-gradient(135deg, #3a2c08, #5e4410);
  color: #ffe69c;
  border-color: #b8901a;
}
body[data-tema="escuro"] .impersonation-banner .secondary-button {
  background: #2a1f04;
  color: #ffe69c;
  border-color: #b8901a;
}

body[data-tema="escuro"] .auth-backdrop {
  background: linear-gradient(135deg, rgba(7, 17, 30, 0.85), rgba(14, 78, 90, 0.6));
}

body[data-tema="escuro"] .demo-access {
  background: rgba(201, 132, 20, 0.12);
  border-color: rgba(201, 132, 20, 0.45);
  color: var(--ink);
}
body[data-tema="escuro"] .demo-access span { color: var(--ink-600); }

body[data-tema="escuro"] .company-preview {
  background: rgba(24, 176, 185, 0.10);
  border-color: rgba(24, 176, 185, 0.4);
}
body[data-tema="escuro"] .auth-reset-panel {
  background: rgba(24, 176, 185, 0.10);
  border-color: rgba(24, 176, 185, 0.4);
}

body[data-tema="escuro"] .auth-toggle-password {
  background: var(--surface-2);
  color: var(--teal-300);
  border-color: var(--line);
}

body[data-tema="escuro"] .perfis-list .perfil-item.active {
  background: var(--grad-brand);
  color: #fff;
}

body[data-tema="escuro"] .listing-toolbar { background: var(--surface-2); }
body[data-tema="escuro"] .listing-card { background: var(--surface); }
body[data-tema="escuro"] .listing-pagination { background: var(--surface); }

body[data-tema="escuro"] code,
body[data-tema="escuro"] pre { background: var(--surface-2); color: var(--ink); }
