/* ==========================================================================
   Admin Template — estilos base
   Construído sobre Bootstrap 5.3. Personalize a marca pelas variáveis abaixo.
   ========================================================================== */

:root {
  --app-sidebar-width: 260px;
  --app-sidebar-collapsed-width: 76px;
  --app-topbar-height: 64px;
  --app-radius: .75rem;

  /* Marca — troque aqui para adaptar a identidade visual */
  --app-brand: #2a78d6;
  --app-brand-rgb: 42, 120, 214;

  --app-body-bg: #f4f6fa;
  --app-surface: #ffffff;
  --app-border: #e6e9ef;
  --app-muted: #6b7280;
  --app-sidebar-bg: #0f172a;
  --app-sidebar-text: #cbd5e1;
  --app-sidebar-text-active: #ffffff;
  --app-sidebar-hover: rgba(255, 255, 255, .06);
  --app-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);

  --bs-primary: var(--app-brand);
  --bs-primary-rgb: var(--app-brand-rgb);
  --bs-link-color: var(--app-brand);
  --bs-link-color-rgb: var(--app-brand-rgb);
  --bs-border-radius: .5rem;
}

[data-bs-theme="dark"] {
  --app-brand: #3987e5;
  --app-brand-rgb: 57, 135, 229;
  --app-body-bg: #0b0f17;
  --app-surface: #141a24;
  --app-border: #252d3a;
  --app-muted: #9aa4b2;
  --app-sidebar-bg: #0e131c;
  --app-shadow: 0 1px 2px rgba(0, 0, 0, .3);
  --bs-body-bg: var(--app-body-bg);
  --bs-border-color: var(--app-border);
}

body {
  background: var(--app-body-bg);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: .925rem;
}

/* Botão primário respeitando a cor da marca */
.btn-primary {
  --bs-btn-bg: var(--app-brand);
  --bs-btn-border-color: var(--app-brand);
  --bs-btn-hover-bg: color-mix(in srgb, var(--app-brand) 88%, #000);
  --bs-btn-hover-border-color: color-mix(in srgb, var(--app-brand) 88%, #000);
  --bs-btn-active-bg: color-mix(in srgb, var(--app-brand) 80%, #000);
  --bs-btn-active-border-color: color-mix(in srgb, var(--app-brand) 80%, #000);
  --bs-btn-disabled-bg: var(--app-brand);
  --bs-btn-disabled-border-color: var(--app-brand);
}
.btn-outline-primary {
  --bs-btn-color: var(--app-brand);
  --bs-btn-border-color: var(--app-brand);
  --bs-btn-hover-bg: var(--app-brand);
  --bs-btn-hover-border-color: var(--app-brand);
  --bs-btn-active-bg: var(--app-brand);
  --bs-btn-active-border-color: var(--app-brand);
}
.text-primary { color: var(--app-brand) !important; }
.bg-primary { background-color: var(--app-brand) !important; }
.form-check-input:checked, .form-check-input:indeterminate { background-color: var(--app-brand); border-color: var(--app-brand); }
.btn-check:checked + .btn-outline-primary { background-color: var(--app-brand); border-color: var(--app-brand); }
.form-control:focus, .form-select:focus {
  border-color: rgba(var(--app-brand-rgb), .5);
  box-shadow: 0 0 0 .2rem rgba(var(--app-brand-rgb), .15);
}
.page-link { color: var(--app-brand); }
.active > .page-link, .page-link.active { background-color: var(--app-brand); border-color: var(--app-brand); }
.nav-pills .nav-link.active { background-color: var(--app-brand); }

/* ---------- Layout ---------- */
.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--app-sidebar-width);
  background: var(--app-sidebar-bg);
  color: var(--app-sidebar-text);
  display: flex;
  flex-direction: column;
  z-index: 1040;
  transition: width .2s ease, transform .2s ease;
}
.app-sidebar .brand {
  height: var(--app-topbar-height);
  flex: 0 0 var(--app-topbar-height); /* não encolhe: mesma altura do cabeçalho da página */
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: 0 1.25rem;
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
  white-space: nowrap;
  overflow: hidden;
}
.app-sidebar .brand-logo {
  flex: 0 0 36px;
  width: 36px; height: 36px;
  border-radius: .6rem;
  background: var(--app-brand);
  display: grid; place-items: center;
  font-size: 1.1rem;
}
.app-sidebar .brand-img { display: flex; align-items: center; min-width: 0; height: 100%; padding: 12px 0; flex: 1 1 auto; } /* respiro em volta da logo */
.app-sidebar .brand-img img { display: block; height: 100%; max-height: 56px; max-width: 100%; width: auto; object-fit: contain; filter: brightness(0) invert(1); }
.app-sidebar .nav-switch { padding: .1rem .75rem .5rem; }
.app-sidebar .nav-switch .form-select { background-color: rgba(255, 255, 255, .06); color: #fff; border-color: rgba(255, 255, 255, .15); font-weight: 600; }
.app-sidebar .nav-switch option { color: #000; }
body.sidebar-collapsed .app-sidebar .nav-switch { display: none; }
/* texto entre parênteses no menu: menor, ao lado do principal, em até 2 linhas */
.app-sidebar .nav-link .label { display: flex; align-items: center; gap: .4rem; min-width: 0; }
.app-sidebar .nav-link .label-sub { font-size: .68rem; line-height: 1.15; opacity: .75; white-space: normal; max-width: 6.5rem;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.app-sidebar .nav-scroll {
  flex: 1 1 auto;
  min-height: 0;          /* permite encolher e rolar dentro da sidebar */
  flex-wrap: nowrap;      /* .nav do Bootstrap quebra em colunas quando falta altura */
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1rem .75rem;
  /* Barra de rolagem fina e discreta (Firefox) */
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}
.app-sidebar .nav-scroll:hover,
.app-sidebar .nav-scroll:focus-within { scrollbar-color: rgba(255, 255, 255, .18) transparent; }

/* Barra de rolagem fina e discreta (Chrome, Edge, Safari) */
.app-sidebar .nav-scroll::-webkit-scrollbar { width: 6px; }
.app-sidebar .nav-scroll::-webkit-scrollbar-track { background: transparent; }
.app-sidebar .nav-scroll::-webkit-scrollbar-thumb { background: transparent; border-radius: 999px; }
.app-sidebar .nav-scroll:hover::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .18); }
.app-sidebar .nav-scroll::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, .32); }
.app-sidebar .nav-section {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #64748b;
  padding: 1rem .75rem .4rem;
  white-space: nowrap;
}
.app-sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  color: var(--app-sidebar-text);
  padding: .6rem .75rem;
  border-radius: .5rem;
  margin-bottom: 2px;
  white-space: nowrap;
}
.app-sidebar .nav-link i { font-size: 1.1rem; flex: 0 0 22px; text-align: center; }
.app-sidebar .nav-link:hover { background: var(--app-sidebar-hover); color: #fff; }
.app-sidebar .nav-link.active {
  background: rgba(var(--app-brand-rgb), .9);
  color: var(--app-sidebar-text-active);
}
.app-sidebar .nav-link .chevron { margin-left: auto; font-size: .75rem; transition: transform .2s; }
.app-sidebar .nav-link[aria-expanded="true"] .chevron { transform: rotate(90deg); }
.app-sidebar .submenu .nav-link { padding-left: 2.85rem; font-size: .875rem; }
.app-sidebar .submenu .nav-link.active { background: transparent; color: #fff; font-weight: 600; }
.app-sidebar .sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, .06);
  font-size: .8rem;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
}

.app-main {
  margin-left: var(--app-sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left .2s ease;
}

.app-topbar {
  position: sticky;
  top: 0;
  height: var(--app-topbar-height);
  background: var(--app-surface);
  border-bottom: 1px solid var(--app-border);
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 0 1.5rem;
  z-index: 1030;
}
.app-topbar .search { max-width: 340px; }
.app-topbar .icon-btn {
  width: 40px; height: 40px;
  display: inline-grid; place-items: center;
  border-radius: .5rem;
  border: 0;
  background: transparent;
  color: inherit;
  position: relative;
  font-size: 1.15rem;
}
.app-topbar .icon-btn:hover { background: rgba(var(--app-brand-rgb), .08); }
.app-topbar .icon-btn .dot {
  position: absolute; top: 8px; right: 9px;
  width: 8px; height: 8px; border-radius: 50%;
  background: #e34948; border: 2px solid var(--app-surface);
}

.app-content { flex: 1; padding: 1.5rem; }
.app-footer {
  padding: 1rem 1.5rem;
  color: var(--app-muted);
  font-size: .825rem;
  border-top: 1px solid var(--app-border);
  background: var(--app-surface);
}

/* Sidebar recolhida (desktop) */
body.sidebar-collapsed .app-sidebar { width: var(--app-sidebar-collapsed-width); }
body.sidebar-collapsed .app-main { margin-left: var(--app-sidebar-collapsed-width); }
body.sidebar-collapsed .app-sidebar .label,
body.sidebar-collapsed .app-sidebar .chevron,
body.sidebar-collapsed .app-sidebar .nav-section,
body.sidebar-collapsed .app-sidebar .submenu,
body.sidebar-collapsed .app-sidebar .sidebar-footer { display: none !important; }
body.sidebar-collapsed .app-sidebar .nav-link { justify-content: center; }

/* Mobile: sidebar vira off-canvas */
.sidebar-backdrop { display: none; }
@media (max-width: 991.98px) {
  .app-sidebar { transform: translateX(-100%); width: var(--app-sidebar-width) !important; }
  .app-main { margin-left: 0 !important; }
  body.sidebar-open .app-sidebar { transform: none; }
  body.sidebar-open .sidebar-backdrop {
    display: block; position: fixed; inset: 0;
    background: rgba(15, 23, 42, .5); z-index: 1035;
  }
  body.sidebar-collapsed .app-sidebar .label,
  body.sidebar-collapsed .app-sidebar .chevron,
  body.sidebar-collapsed .app-sidebar .nav-section,
  body.sidebar-collapsed .app-sidebar .sidebar-footer { display: revert !important; }
  .app-topbar { padding: 0 1rem; }
  .app-content { padding: 1rem; }
}

/* ---------- Componentes ---------- */
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.page-header h1 { font-size: 1.5rem; font-weight: 700; margin: 0; }
.page-header .breadcrumb { margin: .25rem 0 0; font-size: .825rem; }

.card {
  --bs-card-border-color: var(--app-border);
  --bs-card-bg: var(--app-surface);
  --bs-card-cap-bg: transparent;
  border-radius: var(--app-radius);
  box-shadow: var(--app-shadow);
}
.card-header { padding: 1rem 1.25rem; display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.card-header h5, .card-header .card-title { font-size: 1rem; font-weight: 600; margin: 0; }
.card-body { padding: 1.25rem; }

.stat-card .stat-label { color: var(--app-muted); font-size: .825rem; margin-bottom: .35rem; }
.stat-card .stat-value { font-size: 1.75rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-card .stat-icon {
  width: 48px; height: 48px; border-radius: .75rem;
  display: grid; place-items: center; font-size: 1.35rem;
}
.stat-card .stat-delta { font-size: .8rem; font-weight: 600; }

.soft-primary { background: rgba(var(--app-brand-rgb), .12); color: var(--app-brand); }
.soft-success { background: rgba(25, 135, 84, .12); color: #198754; }
.soft-warning { background: rgba(237, 161, 0, .15); color: #b57900; }
.soft-danger  { background: rgba(227, 73, 72, .12); color: #d03b3a; }
.soft-info    { background: rgba(27, 175, 122, .12); color: #128a5f; }
[data-bs-theme="dark"] .soft-success { color: #4ade80; }
[data-bs-theme="dark"] .soft-warning { color: #fbbf24; }
[data-bs-theme="dark"] .soft-danger  { color: #f87171; }
[data-bs-theme="dark"] .soft-info    { color: #34d399; }

.badge-status { font-weight: 600; padding: .35em .65em; border-radius: 999px; display: inline-flex; align-items: center; gap: .3rem; }

.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: inline-grid; place-items: center;
  font-weight: 600; font-size: .8rem; flex: 0 0 auto;
  background: rgba(var(--app-brand-rgb), .12); color: var(--app-brand);
  object-fit: cover;
}
.avatar-lg { width: 96px; height: 96px; font-size: 1.75rem; }

.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table > thead th {
  font-size: .75rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--app-muted); font-weight: 600; white-space: nowrap;
  background: rgba(var(--app-brand-rgb), .03);
}
.table td, .table th { vertical-align: middle; padding: .8rem 1rem; }
.table th[data-sort] { cursor: pointer; user-select: none; }
.table th[data-sort]::after { content: "\F127"; font-family: "bootstrap-icons"; margin-left: .35rem; opacity: .35; font-size: .7rem; }
.table th[data-sort].asc::after { content: "\F148"; opacity: 1; }
.table th[data-sort].desc::after { content: "\F128"; opacity: 1; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }

.chart-box { position: relative; height: 300px; }
.chart-box.sm { height: 220px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 1rem; font-size: .8rem; color: var(--app-muted); }
.chart-legend span::before {
  content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px;
  background: var(--c); margin-right: .4rem; vertical-align: -1px;
}

.activity { list-style: none; padding: 0; margin: 0; }
.activity li { display: flex; gap: .85rem; padding: .75rem 0; border-bottom: 1px dashed var(--app-border); }
.activity li:last-child { border-bottom: 0; }

/* ---------- Páginas de autenticação ---------- */
.auth-wrapper { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-aside {
  /* Degradê derivado do tema: fundo do menu → cor do sistema */
  background: linear-gradient(135deg,
    var(--app-sidebar-bg) 0%,
    color-mix(in srgb, var(--app-brand) 40%, var(--app-sidebar-bg)) 60%,
    var(--app-brand) 100%);
  color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between;
}
.auth-aside h2 { font-weight: 700; font-size: 2rem; max-width: 420px; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 2rem 1rem; background: var(--app-surface); }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h1 { font-size: 1.6rem; font-weight: 700; }
.password-toggle { cursor: pointer; }
@media (max-width: 991.98px) {
  .auth-wrapper { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
}

/* ---------- Aparência (perfil › Sistema) ---------- */
.option-grid { display: grid; gap: .75rem; }
.option-grid.modes { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.option-grid.colors { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }

.option-card {
  position: relative;
  display: block;
  border: 2px solid var(--app-border);
  border-radius: var(--app-radius);
  padding: .6rem;
  cursor: pointer;
  background: var(--app-surface);
  transition: border-color .15s, box-shadow .15s;
}
.option-card:hover { border-color: rgba(var(--app-brand-rgb), .5); }
.option-card input { position: absolute; opacity: 0; pointer-events: none; }
.option-card:has(input:checked) { border-color: var(--app-brand); box-shadow: 0 0 0 .2rem rgba(var(--app-brand-rgb), .15); }
.option-card:has(input:focus-visible) { outline: 2px solid var(--app-brand); outline-offset: 2px; }
.option-card .check {
  position: absolute; top: .45rem; right: .45rem;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--app-brand); color: #fff;
  display: none; place-items: center; font-size: .75rem;
}
.option-card:has(input:checked) .check { display: grid; }
.option-card .option-label { font-size: .85rem; font-weight: 600; margin-top: .5rem; display: flex; align-items: center; gap: .35rem; }

/* Miniatura do layout usada nos cards de modo */
.mini-ui { height: 78px; border-radius: .45rem; overflow: hidden; display: flex; border: 1px solid rgba(0,0,0,.08); }
.mini-ui .mini-side { width: 28%; background: var(--mini-side); padding: 6px 5px; display: flex; flex-direction: column; gap: 4px; }
.mini-ui .mini-side i { display: block; height: 5px; border-radius: 3px; background: rgba(255,255,255,.25); }
.mini-ui .mini-side i:first-child { background: var(--mini-brand); }
.mini-ui .mini-main { flex: 1; background: var(--mini-bg); padding: 6px; display: flex; flex-direction: column; gap: 5px; }
.mini-ui .mini-bar { height: 8px; border-radius: 3px; background: var(--mini-card); }
.mini-ui .mini-cards { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.mini-ui .mini-cards span { border-radius: 3px; background: var(--mini-card); position: relative; }
.mini-ui .mini-cards span:first-child::after { content: ""; position: absolute; left: 4px; right: 40%; bottom: 5px; height: 5px; border-radius: 3px; background: var(--mini-brand); }
.mini-ui.light { --mini-bg: #f4f6fa; --mini-card: #ffffff; }
.mini-ui.dark  { --mini-bg: #0b0f17; --mini-card: #1c2431; }
.mini-ui.auto  { background: linear-gradient(135deg, #f4f6fa 50%, #0b0f17 50%); }
.mini-ui.auto .mini-main { background: linear-gradient(135deg, #f4f6fa 50%, #0b0f17 50%); --mini-card: rgba(128,128,128,.35); }

/* Amostras de cor: metade clara (clean) e metade escura (dark) */
.swatch { height: 44px; border-radius: .45rem; display: flex; overflow: hidden; }
.swatch span { flex: 1; display: grid; place-items: center; }
.swatch .sw-light { background: var(--sw-light); }
.swatch .sw-dark { background: var(--sw-sidebar); }
.swatch .sw-dark::after { content: ""; width: 16px; height: 16px; border-radius: 50%; background: var(--sw-dark); }

/* Cor personalizada */
.swatch.custom-swatch {
  background: conic-gradient(from 180deg at 50% 50%, #e34948, #eda100, #1baf7a, #2a78d6, #6250d6, #e87ba4, #e34948);
  display: grid; place-items: center; color: #fff; font-size: 1.1rem; text-shadow: 0 1px 3px rgba(0,0,0,.45);
}

.custom-panel { border: 1px solid var(--app-border); border-radius: var(--app-radius); padding: 1rem; margin-top: .75rem; background: rgba(var(--app-brand-rgb), .03); }
.custom-side { width: 230px; flex: 0 0 auto; }

/* ColorPicker (assets/js/colorpicker.js) — estilo do seletor do Windows */
.cpk { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-start; }
.cpk-picker { display: flex; gap: 10px; flex: 1 1 260px; max-width: 420px; }
.cpk-field {
  position: relative; flex: 1; height: 210px; cursor: crosshair; touch-action: none;
  border: 1px solid var(--app-border); border-radius: 4px;
  background:
    linear-gradient(to bottom, rgba(128,128,128,0), #808080),
    linear-gradient(to right, #f00 0%, #ff0 16.66%, #0f0 33.33%, #0ff 50%, #00f 66.66%, #f0f 83.33%, #f00 100%);
}
.cpk-cross { position: absolute; width: 19px; height: 19px; transform: translate(-50%, -50%); pointer-events: none; }
/* mira em cruz com centro vazado, como no Windows */
.cpk-cross::before, .cpk-cross::after { content: ""; position: absolute; }
.cpk-cross::before { left: 8px; top: 0; width: 3px; height: 19px; background: linear-gradient(to bottom, #000 0 7px, transparent 7px 12px, #000 12px); }
.cpk-cross::after { top: 8px; left: 0; height: 3px; width: 19px; background: linear-gradient(to right, #000 0 7px, transparent 7px 12px, #000 12px); }
.cpk-lum {
  position: relative; width: 16px; height: 210px; cursor: ns-resize; touch-action: none; margin-right: 14px;
  border: 1px solid var(--app-border); border-radius: 3px;
  background: linear-gradient(to bottom, #fff, var(--cpk-mid, #808080), #000);
}
.cpk-arrow {
  position: absolute; left: calc(100% + 3px); width: 0; height: 0; transform: translateY(-50%); pointer-events: none;
  border-top: 6px solid transparent; border-bottom: 6px solid transparent; border-right: 8px solid var(--bs-body-color);
}
.cpk-field:focus-visible, .cpk-lum:focus-visible { outline: 2px solid var(--app-brand); outline-offset: 2px; }
.cpk-form { flex: 0 1 230px; display: grid; gap: .45rem; }
.cpk-row { display: grid; grid-template-columns: 112px 1fr; align-items: center; gap: .5rem; font-size: .85rem; }
.cpk-row .form-control, .cpk-row .form-select { max-width: 120px; }
.cpk-preview { display: block; width: 120px; height: 28px; border-radius: 4px; border: 1px solid var(--app-border); }
@media (max-width: 575.98px) { .cpk-picker, .cpk-form { flex-basis: 100%; max-width: none; } }
@media (max-width: 767.98px) { .custom-side { width: 100%; } }
.variant-chip { display: flex; align-items: center; gap: .5rem; font-size: .8rem; }
.variant-chip i { width: 22px; height: 22px; border-radius: 6px; flex: 0 0 auto; border: 1px solid rgba(128,128,128,.25); }

/* ==========================================================================
   Módulo de e-mail
   ========================================================================== */
.mail-app { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 1rem; align-items: start; }
@media (min-width: 992px) {
  .mail-side {
    background: var(--app-surface); border: 1px solid var(--app-border); border-radius: var(--app-radius);
    box-shadow: var(--app-shadow); padding: 1rem .75rem;
    position: sticky; top: calc(var(--app-topbar-height) + 1rem);
  }
}
@media (max-width: 991.98px) {
  .mail-app { grid-template-columns: minmax(0, 1fr); }
  .mail-side .offcanvas-body { padding: 1rem; }
}
.mail-folders { display: flex; flex-direction: column; gap: 2px; }
.mail-folder {
  display: flex; align-items: center; gap: .7rem; padding: .5rem .75rem; border-radius: .5rem;
  color: var(--bs-body-color); text-decoration: none; font-size: .9rem;
}
.mail-folder i { width: 18px; text-align: center; color: var(--app-muted); }
.mail-folder:hover { background: rgba(var(--app-brand-rgb), .06); }
.mail-folder.active { background: rgba(var(--app-brand-rgb), .12); color: var(--app-brand); font-weight: 600; }
.mail-folder.active i { color: var(--app-brand); }
.mail-folder .count { margin-left: auto; font-size: .75rem; color: var(--app-muted); font-variant-numeric: tabular-nums; }
.mail-folder .count.strong { background: var(--app-brand); color: #fff; border-radius: 999px; padding: .05rem .5rem; font-weight: 600; }
.mail-nav-title { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--app-muted); padding: 1.1rem .75rem .4rem; }
.mail-account { display: flex; align-items: center; gap: .6rem; padding: .5rem .5rem; border-radius: .5rem; text-decoration: none; color: inherit; }
.mail-account:hover { background: rgba(var(--app-brand-rgb), .06); }

/* Barra de ferramentas da lista/leitura */
.mail-toolbar { display: flex; align-items: center; gap: .25rem; padding: .6rem 1rem; border-bottom: 1px solid var(--app-border); flex-wrap: wrap; }
.mail-toolbar .tb-btn {
  border: 0; background: transparent; color: var(--bs-body-color); width: 36px; height: 36px; border-radius: .5rem;
  display: inline-grid; place-items: center; font-size: 1.05rem;
}
.mail-toolbar .tb-btn:hover:not(:disabled) { background: rgba(var(--app-brand-rgb), .08); }
.mail-toolbar .tb-btn:disabled { opacity: .35; }

/* Lista de mensagens */
.mail-list { list-style: none; margin: 0; padding: 0; }
.mail-row {
  display: flex; align-items: center; gap: .65rem; padding: .65rem 1rem; border-bottom: 1px solid var(--app-border);
  cursor: pointer; position: relative; background: rgba(128, 128, 128, .035);
}
.mail-row.unread { background: var(--app-surface); }
.mail-row.unread::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--app-brand); }
.mail-row:hover { background: rgba(var(--app-brand-rgb), .05); box-shadow: inset 0 -1px 0 var(--app-border); }
.mail-row.selected { background: rgba(var(--app-brand-rgb), .1); }
.mail-row .form-check-input { margin: 0; flex: 0 0 auto; }
.mail-star { border: 0; background: none; padding: 0 .1rem; color: var(--app-muted); font-size: 1rem; line-height: 1; }
.mail-star.on { color: #eda100; }
.mail-row .avatar { width: 34px; height: 34px; font-size: .75rem; }
.mail-meta { flex: 1; min-width: 0; display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: .75rem; align-items: center; }
.mail-from { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--app-muted); }
.mail-line .mail-subject { color: var(--bs-body-color); }
.mail-row.unread .mail-from, .mail-row.unread .mail-subject { font-weight: 700; }
.mail-end { display: flex; align-items: center; gap: .5rem; flex: 0 0 auto; }
.mail-date { font-size: .8rem; color: var(--app-muted); white-space: nowrap; font-variant-numeric: tabular-nums; min-width: 48px; text-align: right; }
.mail-row.unread .mail-date { color: var(--bs-body-color); font-weight: 600; }
.mail-hover-actions { display: none; gap: 2px; }
@media (hover: hover) and (min-width: 768px) {
  .mail-row:hover .mail-hover-actions { display: flex; }
  .mail-row:hover .mail-date { display: none; }
}
.mail-hover-actions button { border: 0; background: transparent; width: 30px; height: 30px; border-radius: 6px; color: var(--app-muted); }
.mail-hover-actions button:hover { background: rgba(var(--app-brand-rgb), .1); color: var(--bs-body-color); }
@media (max-width: 767.98px) {
  .mail-meta { grid-template-columns: minmax(0, 1fr); gap: .1rem; }
  .mail-row { align-items: flex-start; }
  .mail-row .avatar { display: none; }
  .mail-end { flex-direction: column; align-items: flex-end; gap: .25rem; }
}
.mail-label {
  display: inline-flex; align-items: center; gap: .3rem; font-size: .7rem; font-weight: 600; white-space: nowrap;
  padding: .1rem .45rem; border-radius: 999px; background: color-mix(in srgb, var(--c) 14%, transparent); color: var(--bs-body-color);
}
.mail-label::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.mail-empty { text-align: center; padding: 4rem 1rem; color: var(--app-muted); }
.mail-empty i { font-size: 2.5rem; display: block; margin-bottom: .5rem; opacity: .6; }

/* Leitura */
.mail-read-header { padding: 1.25rem 1.5rem .5rem; }
.mail-read-header h2 { font-size: 1.35rem; font-weight: 700; margin: 0; word-break: break-word; }
.mail-sender { display: flex; gap: .85rem; align-items: flex-start; padding: .75rem 1.5rem; }
.mail-sender .avatar { width: 44px; height: 44px; font-size: .9rem; }
.mail-body { padding: .5rem 1.5rem 1.5rem; line-height: 1.65; font-size: .95rem; word-break: break-word; }
.mail-body blockquote { border-left: 3px solid var(--app-border); padding-left: 1rem; color: var(--app-muted); margin: 1rem 0; }
.mail-attachments { display: flex; flex-wrap: wrap; gap: .75rem; padding: 0 1.5rem 1.5rem; }
.attach-card {
  display: flex; align-items: center; gap: .65rem; border: 1px solid var(--app-border); border-radius: .6rem;
  padding: .6rem .75rem; width: 240px; max-width: 100%; text-decoration: none; color: inherit; background: var(--app-surface);
}
.attach-card:hover { border-color: rgba(var(--app-brand-rgb), .5); }
.attach-card > i { font-size: 1.6rem; }
.attach-card .remove { margin-left: auto; border: 0; background: none; color: var(--app-muted); }
.quick-reply { margin: 0 1.5rem 1.5rem; border: 1px solid var(--app-border); border-radius: .6rem; }
.quick-reply textarea { border: 0; resize: vertical; box-shadow: none !important; }
@media (max-width: 575.98px) {
  .mail-read-header, .mail-sender, .mail-body { padding-left: 1rem; padding-right: 1rem; }
  .mail-attachments { padding: 0 1rem 1rem; }
  .quick-reply { margin: 0 1rem 1rem; }
}

/* Escrever */
.compose-field { display: flex; align-items: flex-start; gap: .5rem; padding: .45rem 1rem; border-bottom: 1px solid var(--app-border); }
.compose-field > label { color: var(--app-muted); font-size: .875rem; padding-top: .3rem; width: 52px; flex: 0 0 auto; }
.compose-field input.bare { border: 0; outline: 0; background: transparent; color: inherit; flex: 1; min-width: 140px; padding: .3rem 0; }
.recipients { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; flex: 1; min-width: 0; }
.chip {
  display: inline-flex; align-items: center; gap: .25rem; max-width: 100%;
  background: rgba(var(--app-brand-rgb), .1); border-radius: 999px; padding: .15rem .3rem .15rem .65rem; font-size: .85rem;
}
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.invalid { background: rgba(227, 73, 72, .14); color: #d03b3a; }
.chip button { border: 0; background: none; color: inherit; opacity: .6; padding: 0 .15rem; line-height: 1; }
.chip button:hover { opacity: 1; }
.editor-toolbar { display: flex; flex-wrap: wrap; gap: 2px; padding: .35rem .6rem; border-bottom: 1px solid var(--app-border); }
.editor-toolbar button {
  border: 0; background: transparent; color: inherit; width: 34px; height: 34px; border-radius: 6px; display: inline-grid; place-items: center;
}
.editor-toolbar button:hover { background: rgba(var(--app-brand-rgb), .08); }
.editor-toolbar button.on { background: rgba(var(--app-brand-rgb), .16); color: var(--app-brand); }
.editor-toolbar .sep { width: 1px; background: var(--app-border); margin: 6px 4px; }
.editor { min-height: 300px; padding: 1rem; outline: 0; line-height: 1.6; overflow-wrap: anywhere; }
.editor:empty::before { content: attr(data-placeholder); color: var(--app-muted); }
.editor blockquote { border-left: 3px solid var(--app-border); padding-left: 1rem; color: var(--app-muted); }
.dropzone { border: 2px dashed transparent; transition: border-color .15s, background .15s; }
.dropzone.dragover { border-color: var(--app-brand); background: rgba(var(--app-brand-rgb), .05); }

/* Configurações de conta */
.provider-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .6rem; }
.provider-grid .option-card { text-align: center; padding: .75rem .5rem; }
.provider-grid .option-card > i { font-size: 1.5rem; color: var(--app-brand); }
.test-steps { list-style: none; padding: 0; margin: 0; }
.test-steps li { display: flex; align-items: center; gap: .6rem; padding: .4rem 0; font-size: .875rem; }
.test-steps li .st { width: 20px; text-align: center; }
.test-steps li.wait { color: var(--app-muted); }

/* ==========================================================================
   Página de ícones
   ========================================================================== */
.icon-cats {
  display: flex; gap: .4rem; padding: .75rem 1.25rem; border-bottom: 1px solid var(--app-border);
  overflow-x: auto; scrollbar-width: thin;
}
.icon-cat {
  display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap; flex: 0 0 auto;
  border: 1px solid var(--app-border); background: var(--app-surface); color: var(--bs-body-color);
  border-radius: 999px; padding: .3rem .8rem; font-size: .8rem;
}
.icon-cat:hover { border-color: rgba(var(--app-brand-rgb), .5); }
.icon-cat.active { background: var(--app-brand); border-color: var(--app-brand); color: #fff; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: .5rem; }
.icon-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem;
  min-height: 96px; padding: .75rem .35rem; border-radius: .6rem; border: 1px solid var(--app-border);
  background: var(--app-surface); color: var(--bs-body-color); transition: border-color .12s, background .12s, transform .12s;
}
.icon-tile i { font-size: 1.6rem; line-height: 1; }
.icon-tile span { font-size: .7rem; color: var(--app-muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-tile:hover, .icon-tile:focus-visible { border-color: var(--app-brand); background: rgba(var(--app-brand-rgb), .06); color: var(--app-brand); transform: translateY(-1px); }
@media (max-width: 575.98px) {
  .icon-grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
  .icon-tile { min-height: 80px; }
}
.icon-preview {
  height: 170px; border-radius: var(--app-radius); display: grid; place-items: center; border: 1px solid var(--app-border);
  background-color: var(--app-body-bg);
  background-image: linear-gradient(rgba(128,128,128,.08) 1px, transparent 1px), linear-gradient(90deg, rgba(128,128,128,.08) 1px, transparent 1px);
  background-size: 16px 16px;
}
.icon-preview i { line-height: 1; }
.icon-code {
  background: var(--app-body-bg); border: 1px solid var(--app-border); border-radius: .5rem;
  padding: .6rem .75rem; font-size: .78rem; white-space: pre-wrap; word-break: break-all;
}
.icon-code code { color: var(--bs-body-color); }

/* ==========================================================================
   FormKit (assets/js/form-components.js)
   ========================================================================== */
/* Editor rico */
.rte { border: 1px solid var(--bs-border-color); border-radius: var(--bs-border-radius); background: var(--bs-body-bg); overflow: hidden; }
.rte:focus-within { border-color: rgba(var(--app-brand-rgb), .5); box-shadow: 0 0 0 .2rem rgba(var(--app-brand-rgb), .15); }
.rte-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: .35rem .5rem; border-bottom: 1px solid var(--bs-border-color); background: rgba(128,128,128,.04); }
.rte-toolbar button, .rte-color {
  border: 0; background: transparent; color: inherit; width: 32px; height: 32px; border-radius: 6px;
  display: inline-grid; place-items: center; position: relative; cursor: pointer; margin: 0;
}
.rte-toolbar button:hover, .rte-color:hover { background: rgba(var(--app-brand-rgb), .08); }
.rte-toolbar button.on { background: rgba(var(--app-brand-rgb), .16); color: var(--app-brand); }
.rte-toolbar .disabled { opacity: .35; pointer-events: none; }
.rte-toolbar .sep { width: 1px; height: 22px; background: var(--bs-border-color); margin: 0 4px; }
.rte-block { width: auto; min-width: 120px; }
.rte-color .bar { position: absolute; left: 8px; right: 8px; bottom: 4px; height: 3px; border-radius: 2px; }
.rte-color input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.rte-bar { display: flex; align-items: center; gap: .5rem; padding: .5rem; border-bottom: 1px solid var(--bs-border-color); background: rgba(var(--app-brand-rgb), .04); }
.rte-bar input { flex: 1; }
.rte-content { position: relative; padding: 1rem; outline: 0; line-height: 1.6; overflow-wrap: anywhere; overflow-y: auto; max-height: 520px; }
.rte.is-empty .rte-content::before { content: attr(data-placeholder); color: var(--app-muted); pointer-events: none; position: absolute; }
.rte-content h2 { font-size: 1.5rem; } .rte-content h3 { font-size: 1.25rem; } .rte-content h4 { font-size: 1.1rem; }
.rte-content blockquote { border-left: 3px solid var(--app-brand); padding-left: 1rem; color: var(--app-muted); margin: .75rem 0; }
.rte-content pre { background: rgba(128,128,128,.1); padding: .75rem; border-radius: .4rem; font-size: .85rem; white-space: pre-wrap; }
.rte-content img { max-width: 100%; border-radius: .4rem; }
.rte-content table { width: auto; min-width: 50%; }
.rte-content table td, .rte-content table th { min-width: 60px; }
.rte-source { width: 100%; border: 0; outline: 0; padding: 1rem; font-family: var(--bs-font-monospace); font-size: .8rem; background: rgba(128,128,128,.04); color: inherit; resize: vertical; display: block; }
.rte-footer { display: flex; justify-content: space-between; padding: .3rem .75rem; border-top: 1px solid var(--bs-border-color); font-size: .75rem; color: var(--app-muted); }
.rte-full { position: fixed; inset: 0; z-index: 1080; border-radius: 0; display: flex; flex-direction: column; }
.rte-full .rte-content, .rte-full .rte-source { flex: 1; max-height: none; }
.was-validated .rte.required.is-empty, .rte.is-invalid { border-color: var(--bs-form-invalid-border-color); }

/* Upload */
.filedrop-zone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .35rem; text-align: center;
  padding: 1.75rem 1rem; border: 2px dashed var(--bs-border-color); border-radius: var(--app-radius); cursor: pointer;
  background: rgba(var(--app-brand-rgb), .02); transition: border-color .15s, background .15s; margin: 0;
}
.filedrop-zone:hover, .filedrop-zone:focus-visible, .filedrop-zone.dragover { border-color: var(--app-brand); background: rgba(var(--app-brand-rgb), .06); outline: 0; }
.filedrop-icon { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-size: 1.5rem; background: rgba(var(--app-brand-rgb), .12); color: var(--app-brand); }
.filedrop-list { list-style: none; margin: .75rem 0 0; padding: 0; display: grid; gap: .5rem; }
.filedrop-list:empty { display: none; }
.filedrop-item { display: flex; align-items: center; gap: .75rem; padding: .5rem .6rem; border: 1px solid var(--app-border); border-radius: .6rem; }
.filedrop-thumb { width: 44px; height: 44px; border-radius: .4rem; object-fit: cover; flex: 0 0 auto; display: grid; place-items: center; font-size: 1.5rem; background: rgba(128,128,128,.08); }
.avatar-upload { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.avatar-upload-img {
  width: 84px; height: 84px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; font-size: 2rem;
  background: rgba(var(--app-brand-rgb), .12); color: var(--app-brand); border: 3px solid var(--app-surface); box-shadow: 0 0 0 1px var(--app-border);
}
.avatar-upload-img img { width: 100%; height: 100%; object-fit: cover; grid-area: 1 / 1; }
.avatar-upload-img i { grid-area: 1 / 1; }

/* Select com busca */
.ss-native { position: absolute !important; opacity: 0; pointer-events: none; height: 0 !important; width: 0 !important; }
.ss { position: relative; }
.ss-control { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; min-height: calc(1.5em + .75rem + 2px); cursor: pointer; text-align: left; }
.ss-control:focus { border-color: rgba(var(--app-brand-rgb), .5); box-shadow: 0 0 0 .2rem rgba(var(--app-brand-rgb), .15); outline: 0; }
.ss-ph { color: var(--app-muted); }
.ss-chip { display: inline-flex; align-items: center; gap: .15rem; background: rgba(var(--app-brand-rgb), .12); border-radius: 999px; padding: .05rem .25rem .05rem .6rem; font-size: .8rem; }
.ss-chip button { border: 0; background: none; color: inherit; opacity: .6; padding: 0 .1rem; line-height: 1; }
.ss-chip button:hover { opacity: 1; }
.ss-panel {
  position: absolute; z-index: 1060; left: 0; right: 0; top: calc(100% + 4px); background: var(--app-surface);
  border: 1px solid var(--app-border); border-radius: .6rem; box-shadow: 0 10px 30px rgba(0,0,0,.12); overflow: hidden;
}
.ss-search { display: flex; align-items: center; gap: .5rem; padding: .5rem .75rem; border-bottom: 1px solid var(--app-border); color: var(--app-muted); }
.ss-search input { border: 0; outline: 0; background: transparent; color: var(--bs-body-color); flex: 1; }
.ss-options { list-style: none; margin: 0; padding: .3rem; max-height: 240px; overflow-y: auto; }
.ss-option { display: flex; align-items: center; gap: .5rem; padding: .45rem .6rem; border-radius: .4rem; cursor: pointer; font-size: .9rem; }
.ss-option.active { background: rgba(var(--app-brand-rgb), .08); }
.ss-option.selected { font-weight: 600; }
.ss-option.disabled { opacity: .45; pointer-events: none; }
.ss-group { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--app-muted); padding: .5rem .6rem .2rem; }
.ss-footer { display: flex; align-items: center; gap: .75rem; padding: .5rem .75rem; border-top: 1px solid var(--app-border); background: rgba(128,128,128,.03); }
.ss-empty { padding: .75rem; text-align: center; color: var(--app-muted); font-size: .85rem; }

/* Tags */
.tag-input { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; cursor: text; min-height: calc(1.5em + .75rem + 2px); padding-top: .3rem; padding-bottom: .3rem; }
.tag-input input { border: 0; outline: 0; background: transparent; color: inherit; flex: 1; min-width: 140px; padding: .1rem 0; }
.tag-input:focus-within { border-color: rgba(var(--app-brand-rgb), .5); box-shadow: 0 0 0 .2rem rgba(var(--app-brand-rgb), .15); }

/* Avaliação */
.rating { display: inline-flex; align-items: center; }
.rating button { border: 0; background: none; padding: .1rem; font-size: 1.5rem; color: var(--app-muted); line-height: 1; transition: transform .1s; }
.rating button.on { color: #eda100; }
.rating button:hover { transform: scale(1.15); }

/* OTP */
.otp { display: flex; gap: .5rem; flex-wrap: wrap; }
.otp input { width: 48px; height: 56px; text-align: center; font-size: 1.4rem; font-weight: 700; padding: 0; }
.otp input.filled { border-color: rgba(var(--app-brand-rgb), .6); }
@media (max-width: 400px) { .otp input { width: 40px; height: 48px; } }

/* Número */
.number-stepper { max-width: 180px; }
.number-stepper input::-webkit-outer-spin-button, .number-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.number-stepper input { -moz-appearance: textfield; appearance: textfield; }

/* Range com balão */
.range-wrap { position: relative; padding-top: 1.9rem; }
.range-bubble {
  position: absolute; top: 0; transform: translateX(-50%); background: var(--app-brand); color: #fff;
  font-size: .75rem; font-weight: 600; padding: .1rem .45rem; border-radius: .35rem; white-space: nowrap;
}
.range-bubble::after { content: ""; position: absolute; left: 50%; bottom: -4px; transform: translateX(-50%); border: 4px solid transparent; border-top-color: var(--app-brand); border-bottom: 0; }
.range-wrap .form-range::-webkit-slider-runnable-track { background: linear-gradient(to right, var(--app-brand) var(--fill, 50%), var(--bs-secondary-bg) var(--fill, 50%)); }
.range-wrap .form-range::-moz-range-progress { background: var(--app-brand); }
.form-range::-webkit-slider-thumb { background: var(--app-brand); }
.form-range::-moz-range-thumb { background: var(--app-brand); }

/* Força da senha */
.strength-bars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.strength-bars i { height: 4px; border-radius: 2px; background: var(--bs-secondary-bg); transition: background .2s; }
.strength[data-level="1"] .strength-bars i:nth-child(-n+1) { background: #e34948; }
.strength[data-level="2"] .strength-bars i:nth-child(-n+2) { background: #eda100; }
.strength[data-level="3"] .strength-bars i:nth-child(-n+3) { background: #1baf7a; }
.strength[data-level="4"] .strength-bars i { background: #198754; }

/* Wizard */
.wizard-steps { list-style: none; padding: 0; margin: 0 0 1.5rem; display: flex; gap: .5rem; counter-reset: s; }
.wizard-steps li { flex: 1; display: flex; align-items: center; gap: .6rem; cursor: pointer; position: relative; min-width: 0; }
.wizard-steps li:not(:last-child)::after { content: ""; flex: 1; height: 2px; background: var(--app-border); margin-left: .25rem; min-width: 12px; }
.wizard-steps li.done:not(:last-child)::after { background: var(--app-brand); }
.wizard-steps .num {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto; font-weight: 600; font-size: .85rem;
  border: 2px solid var(--app-border); color: var(--app-muted); background: var(--app-surface);
}
.wizard-steps li.active .num { border-color: var(--app-brand); color: var(--app-brand); }
.wizard-steps li.done .num { background: var(--app-brand); border-color: var(--app-brand); color: #fff; }
.wizard-steps .lbl { font-size: .85rem; font-weight: 600; white-space: nowrap; color: var(--app-muted); }
.wizard-steps li.active .lbl, .wizard-steps li.done .lbl { color: var(--bs-body-color); }
@media (max-width: 767.98px) { .wizard-steps .lbl { display: none; } .wizard-steps li.active .lbl { display: inline; } }
.wizard-footer { display: flex; justify-content: space-between; align-items: center; gap: .5rem; border-top: 1px solid var(--app-border); padding-top: 1rem; margin-top: 1.5rem; }

/* Cartões de opção (checkbox/radio) */
.choice-card { display: flex; gap: .75rem; align-items: flex-start; padding: .9rem 1rem; border: 1.5px solid var(--app-border); border-radius: var(--app-radius); cursor: pointer; height: 100%; margin: 0; }
.choice-card:hover { border-color: rgba(var(--app-brand-rgb), .5); }
.choice-card:has(input:checked) { border-color: var(--app-brand); background: rgba(var(--app-brand-rgb), .05); }
.choice-card .form-check-input { margin-top: .2rem; flex: 0 0 auto; }

/* Navegação da página de formulários */
.section-nav { position: sticky; top: calc(var(--app-topbar-height) + 1rem); }
.section-nav a { display: block; padding: .35rem .75rem; border-left: 2px solid var(--app-border); color: var(--app-muted); text-decoration: none; font-size: .85rem; }
.section-nav a:hover { color: var(--bs-body-color); }
.section-nav a.active { border-left-color: var(--app-brand); color: var(--app-brand); font-weight: 600; }
.form-section { scroll-margin-top: calc(var(--app-topbar-height) + 1rem); }
.form-section > h2 { font-size: 1.1rem; font-weight: 700; margin-bottom: .25rem; }
.form-section > p { color: var(--app-muted); font-size: .875rem; margin-bottom: 1rem; }
.demo-code { font-size: .75rem; color: var(--app-muted); }

/* ==========================================================================
   Cronograma (Gantt)
   ========================================================================== */
.sched-tabs { gap: .25rem; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.sched-tabs .nav-link { white-space: nowrap; color: var(--bs-body-color); }
.sched-tabs .nav-link.active { color: #fff; }

.proj-summary { display: flex; flex-wrap: wrap; gap: 1.25rem 2rem; align-items: center; }
.proj-summary .k { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--app-muted); }
.proj-summary .v { font-weight: 700; font-variant-numeric: tabular-nums; }

/* Faixa de ferramentas (ribbon) */
.ribbon { display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; align-items: stretch; gap: .25rem; padding: .5rem .75rem; border-bottom: 1px solid var(--app-border); background: rgba(128,128,128,.03); }
.ribbon-group { display: flex; flex-direction: column; align-items: center; padding: 0 .5rem; border-right: 1px solid var(--app-border); flex: 0 0 auto; }
.ribbon-group:last-child { border-right: 0; }
.ribbon-group .rg-items { display: flex; gap: 2px; align-items: center; flex: 1; }
.ribbon-group .rg-label { font-size: .65rem; color: var(--app-muted); text-transform: uppercase; letter-spacing: .05em; margin-top: 2px; }
.rb {
  border: 0; background: transparent; color: var(--bs-body-color); border-radius: .4rem; padding: .25rem .45rem;
  display: inline-flex; flex-direction: column; align-items: center; gap: 1px; font-size: .7rem; min-width: 48px; line-height: 1.1;
}
.rb i { font-size: 1.15rem; }
.rb:hover:not(:disabled) { background: rgba(var(--app-brand-rgb), .08); }
.rb.on { background: rgba(var(--app-brand-rgb), .14); color: var(--app-brand); }
.rb:disabled { opacity: .35; }
@media (max-width: 767.98px) {
  .rb span { display: none; }
  .rb { min-width: 36px; padding: .35rem; }
  .ribbon-group .rg-label { display: none; }
  .ribbon-group { padding: 0 .25rem; }
}

/* Estrutura do Gantt */
.gantt { --row: 34px; --head: 56px; display: flex; height: max(440px, calc(100vh - 330px)); position: relative; user-select: none; }
.gantt-left { width: var(--gl-w, 560px); flex: 0 0 auto; display: flex; min-width: 0; max-width: 85%; }
.gl-scroll { overflow-x: auto; overflow-y: hidden; flex: 1; }
.gl-inner { display: flex; flex-direction: column; height: 100%; }
.gl-head, .gl-row { display: grid; grid-template-columns: var(--gl-cols); }
.gl-head { height: var(--head); flex: 0 0 auto; border-bottom: 1px solid var(--app-border); background: rgba(128,128,128,.05); }
.gl-head > div { display: flex; align-items: flex-end; padding: 0 .5rem .45rem; font-size: .72rem; font-weight: 600; color: var(--app-muted); text-transform: uppercase; letter-spacing: .03em; border-right: 1px solid var(--app-border); white-space: nowrap; overflow: hidden; }
.gl-body { flex: 1; overflow-y: auto; overflow-x: hidden; scrollbar-width: none; }
.gl-body::-webkit-scrollbar { display: none; }
.gl-row { height: var(--row); border-bottom: 1px solid var(--app-border); font-size: .84rem; cursor: default; }
.gl-row > div { display: flex; align-items: center; padding: 0 .5rem; border-right: 1px solid var(--app-border); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.gl-row .c-idx { justify-content: flex-end; color: var(--app-muted); font-size: .75rem; background: rgba(128,128,128,.05); }
.gl-row .c-ind { justify-content: center; gap: 2px; padding: 0; font-size: .8rem; }
.gl-row .c-name { gap: .3rem; }
.gl-row .c-name .nm { overflow: hidden; text-overflow: ellipsis; }
.gl-row .num { justify-content: flex-end; font-variant-numeric: tabular-nums; }
.gl-row.summary { font-weight: 700; }
.gl-row.summary.lvl0 { background: rgba(var(--app-brand-rgb), .05); }
.gl-row.sel, .gr-row.sel { background: rgba(var(--app-brand-rgb), .12) !important; }
.gl-row:hover { background: rgba(128,128,128,.05); }
.caret { border: 0; background: none; padding: 0; width: 16px; color: var(--app-muted); font-size: .75rem; flex: 0 0 auto; }
.caret-sp { width: 16px; flex: 0 0 auto; }
.gl-row .cell-edit { width: 100%; height: 26px; padding: 0 .35rem; font-size: .84rem; border: 1px solid var(--app-brand); border-radius: 4px; outline: 0; background: var(--app-surface); color: inherit; }
.gl-row [data-edit] { cursor: text; }
.res-chips { display: flex; gap: 2px; }
.res-chips .avatar { width: 22px; height: 22px; font-size: .6rem; }

.gantt-split { width: 7px; flex: 0 0 auto; cursor: col-resize; background: var(--app-border); position: relative; touch-action: none; }
.gantt-split::after { content: ""; position: absolute; left: 2px; top: 50%; width: 3px; height: 28px; transform: translateY(-50%); border-left: 1px dotted var(--app-muted); border-right: 1px dotted var(--app-muted); }
.gantt-split:hover, .gantt-split.drag { background: rgba(var(--app-brand-rgb), .5); }

.gantt-right { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.gr-head { height: var(--head); overflow: hidden; flex: 0 0 auto; border-bottom: 1px solid var(--app-border); background: rgba(128,128,128,.05); position: relative; }
.gr-head-inner { position: relative; height: 100%; }
.gr-tier { position: absolute; left: 0; right: 0; height: 28px; }
.gr-tier.top { top: 0; border-bottom: 1px solid var(--app-border); }
.gr-tier.bottom { top: 28px; }
.gr-unit { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--app-border); font-size: .72rem; display: flex; align-items: center; padding-left: 5px; white-space: nowrap; overflow: hidden; color: var(--app-muted); }
.gr-tier.top .gr-unit { font-weight: 600; color: var(--bs-body-color); text-transform: capitalize; }
.gr-unit.today { color: var(--app-brand); font-weight: 700; }
.gr-unit.center { justify-content: center; padding: 0; }
.gr-body { flex: 1; overflow: auto; position: relative; }
.gr-canvas { position: relative; }
.gr-row { position: absolute; left: 0; right: 0; height: var(--row); border-bottom: 1px solid rgba(128,128,128,.12); }
.g-vline { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(128,128,128,.14); }
.g-off { position: absolute; top: 0; bottom: 0; background: rgba(128,128,128,.08); }
.g-off.hol { background: repeating-linear-gradient(135deg, rgba(227,73,72,.07) 0 4px, transparent 4px 8px); }
.g-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--app-brand); z-index: 3; opacity: .8; }
.g-today::before { content: "Hoje"; position: absolute; top: 2px; left: 4px; font-size: .65rem; font-weight: 700; color: var(--app-brand); }
.g-links { position: absolute; inset: 0; pointer-events: none; z-index: 2; overflow: visible; }
.g-links path { fill: none; stroke: var(--app-muted); stroke-width: 1.4; }
.g-links path.crit { stroke: #e34948; }

.gb, .gb-sum, .gb-ms { position: absolute; z-index: 4; }
.gb {
  height: 18px; margin-top: 8px; border-radius: 4px; background: rgba(var(--app-brand-rgb), .35);
  border: 1px solid var(--app-brand); cursor: grab; touch-action: none; overflow: hidden;
}
.gb .pg { position: absolute; left: 0; top: 0; bottom: 0; background: var(--app-brand); }
.gb .hd { position: absolute; right: 0; top: 0; bottom: 0; width: 8px; cursor: ew-resize; }
.gb .hd::after { content: ""; position: absolute; right: 2px; top: 4px; bottom: 4px; width: 2px; border-radius: 1px; background: rgba(255,255,255,.8); opacity: 0; }
.gb:hover .hd::after { opacity: 1; }
.gb.crit { border-color: #e34948; background: rgba(227,73,72,.28); }
.gb.crit .pg { background: #e34948; }
.gb.done { opacity: .75; }
.gb.dragging { cursor: grabbing; box-shadow: 0 4px 12px rgba(0,0,0,.2); opacity: .9; }
.gb.sel { outline: 2px solid var(--bs-body-color); outline-offset: 1px; }
.gb-sum { height: 8px; margin-top: 11px; background: var(--bs-body-color); border-radius: 1px; cursor: pointer; }
.gb-sum::before, .gb-sum::after { content: ""; position: absolute; top: 0; border: 5px solid transparent; border-top: 7px solid var(--bs-body-color); }
.gb-sum::before { left: 0; border-left: 0; }
.gb-sum::after { right: 0; border-right: 0; }
.gb-sum .pg { position: absolute; left: 0; top: 2px; height: 4px; background: rgba(var(--app-brand-rgb), .9); }
.gb-ms { width: 14px; height: 14px; margin-top: 10px; transform: translateX(-7px) rotate(45deg); background: var(--bs-body-color); border-radius: 2px; cursor: pointer; }
.gb-ms.crit { background: #e34948; }
.gb-ms.done { background: #198754; }
/* Linha de base */
.gb-bl { position: absolute; z-index: 3; height: 6px; margin-top: 25px; border-radius: 2px; background: rgba(128,128,128,.55); pointer-events: none; }
.gb-blms { position: absolute; z-index: 3; width: 8px; height: 8px; margin-top: 24px; transform: translateX(-4px) rotate(45deg); background: rgba(128,128,128,.7); }
.with-bl .gb { margin-top: 4px; }
.with-bl .gb-sum { margin-top: 8px; }
.with-bl .gb-ms { margin-top: 6px; }
.with-bl .gb-label { line-height: 26px; }
.lg-bl { width: 22px; height: 5px; border-radius: 2px; background: rgba(128,128,128,.55); }
.gb-label { position: absolute; z-index: 4; font-size: .72rem; color: var(--app-muted); white-space: nowrap; line-height: var(--row); pointer-events: none; }
.g-tip {
  position: fixed; z-index: 1090; pointer-events: none; background: #0f172a; color: #fff; border-radius: .5rem;
  padding: .55rem .7rem; font-size: .78rem; box-shadow: 0 8px 24px rgba(0,0,0,.25); max-width: 300px; line-height: 1.45;
}
[data-bs-theme="dark"] .g-tip { background: #f0efec; color: #0b0b0b; }
.g-tip .t { font-weight: 700; margin-bottom: .2rem; }

.gantt[data-view="grid"] .gantt-right, .gantt[data-view="grid"] .gantt-split { display: none; }
.gantt[data-view="grid"] .gantt-left { width: 100%; max-width: none; }
.gantt[data-view="chart"] .gantt-left, .gantt[data-view="chart"] .gantt-split { display: none; }

/* Legenda */
.gantt-legend { display: flex; flex-wrap: wrap; gap: 1rem; font-size: .75rem; color: var(--app-muted); padding: .6rem .9rem; border-top: 1px solid var(--app-border); }
.gantt-legend span { display: inline-flex; align-items: center; gap: .35rem; }
.lg-bar { width: 22px; height: 10px; border-radius: 3px; background: linear-gradient(90deg, var(--app-brand) 50%, rgba(var(--app-brand-rgb), .35) 50%); border: 1px solid var(--app-brand); }
.lg-bar.crit { background: linear-gradient(90deg, #e34948 50%, rgba(227,73,72,.28) 50%); border-color: #e34948; }
.lg-sum { width: 22px; height: 6px; background: var(--bs-body-color); }
.lg-ms { width: 9px; height: 9px; background: var(--bs-body-color); transform: rotate(45deg); }
.lg-off { width: 14px; height: 10px; background: rgba(128,128,128,.15); }

/* Uso de recursos (mapa de calor) */
.heat { border-collapse: separate; border-spacing: 2px; font-size: .75rem; }
.heat th { font-weight: 600; color: var(--app-muted); white-space: nowrap; padding: .25rem .4rem; text-align: center; }
.heat th.rn { text-align: left; position: sticky; left: 0; background: var(--app-surface); z-index: 1; min-width: 170px; }
.heat td { min-width: 52px; height: 34px; text-align: center; border-radius: 4px; font-variant-numeric: tabular-nums; }
.heat td.over { outline: 2px solid #e34948; outline-offset: -2px; font-weight: 700; }

/* Utilitários */
[hidden] { display: none !important; } /* garante que hidden vença .d-flex etc. */
.text-muted-2 { color: var(--app-muted) !important; }
.fw-semibold { font-weight: 600 !important; }
.min-w-0 { min-width: 0; }
.cursor-pointer { cursor: pointer; }

/* Crédito de desenvolvimento no rodapé */
.dev-credit { display: inline-flex; align-items: center; gap: .5rem; color: inherit; text-decoration: none; }
.dev-credit img { height: 30px; width: auto; opacity: .8; transition: opacity .15s; }
.dev-credit:hover { color: var(--bs-body-color); }
.dev-credit:hover img { opacity: 1; }
[data-bs-theme="dark"] .dev-credit img { filter: invert(1); } /* logo preta vira branca no modo escuro */

/* Ícone em caixa (fora dos cartões de indicador também) */
.stat-icon { display: grid; place-items: center; border-radius: .75rem; flex: 0 0 auto; font-size: 1.2rem; }
