/* Menulogia · painel na nuvem — design system
   Base: tokens do painel do servidor local (menu-digital-local-v2), Bootstrap 5.3 tematizado por cima. */

/* =============================================================== tokens */
:root {
  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Mono", Consolas, "SF Mono", monospace;

  --brand: #7c4dff;
  --brand-2: #a66bff;
  --brand-ink: #ffffff;
  --brand-soft: rgba(124, 77, 255, .10);
  --brand-rgb: 124, 77, 255;

  --bg: #f6f7fb;
  --bg-grad: radial-gradient(1200px 600px at 100% -10%, rgba(124, 77, 255, .07), transparent 60%);
  --surface: #ffffff;
  --surface-2: #f9fafc;
  --surface-3: #f1f3f8;
  --line: #e7e9f0;
  --line-strong: #d7dae4;
  --text: #11131a;
  --text-2: #4a5065;
  --muted: #7d859c;

  --ok: #12a37a;   --ok-soft: rgba(18, 163, 122, .12);
  --warn: #d98a06; --warn-soft: rgba(217, 138, 6, .13);
  --bad: #e0455e;  --bad-soft: rgba(224, 69, 94, .12);
  --info: #2f7bf6; --info-soft: rgba(47, 123, 246, .12);

  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(17, 19, 26, .05);
  --shadow: 0 1px 2px rgba(17, 19, 26, .04), 0 8px 24px -12px rgba(17, 19, 26, .12);
  --shadow-lg: 0 24px 64px -16px rgba(17, 19, 26, .28);

  --side-w: 264px;
  --side-w-collapsed: 76px;
  --top-h: 64px;
  --ease: cubic-bezier(.2, .8, .2, 1);

  /* compatibilidade com estilos antigos que ainda referenciam estas variáveis */
  --sidebar-bg-color: var(--surface);
  --navbar-bg-color: var(--surface-2);
  --dk-dark-bg: var(--surface);
  --dk-darker-bg: var(--bg);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0b0d14;
  --bg-grad: radial-gradient(1200px 600px at 100% -10%, rgba(124, 77, 255, .14), transparent 60%);
  --surface: #12151f;
  --surface-2: #161a26;
  --surface-3: #1c2130;
  --line: #232838;
  --line-strong: #2e3448;
  --text: #eef0f6;
  --text-2: #b4bacb;
  --muted: #7a8299;
  --brand-soft: rgba(166, 107, 255, .16);
  --ok: #2fcf9e; --warn: #f2b13a; --bad: #ff6b81; --info: #6aa3ff;
  --ok-soft: rgba(47, 207, 158, .14); --warn-soft: rgba(242, 177, 58, .14); --bad-soft: rgba(255, 107, 129, .14); --info-soft: rgba(106, 163, 255, .14);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 1px 0 rgba(255, 255, 255, .02) inset, 0 8px 24px -12px rgba(0, 0, 0, .6);
  --shadow-lg: 0 24px 64px -16px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

/* =============================================================== Bootstrap → tokens */
:root, [data-bs-theme] {
  --bs-font-sans-serif: var(--font);
  --bs-font-monospace: var(--mono);
  --bs-body-font-size: 14px;
  --bs-body-line-height: 1.5;
  --bs-body-bg: var(--bg);
  --bs-body-color: var(--text);
  --bs-emphasis-color: var(--text);
  --bs-heading-color: var(--text);
  --bs-secondary-color: var(--muted);
  --bs-secondary-bg: var(--surface-3);
  --bs-tertiary-bg: var(--surface-2);
  --bs-tertiary-color: var(--muted);
  --bs-border-color: var(--line);
  --bs-border-color-translucent: var(--line);
  --bs-border-radius: var(--radius-sm);
  --bs-border-radius-sm: 8px;
  --bs-border-radius-lg: var(--radius);
  --bs-primary: var(--brand);
  --bs-primary-rgb: var(--brand-rgb);
  --bs-primary-text-emphasis: var(--brand);
  --bs-primary-bg-subtle: var(--brand-soft);
  --bs-primary-border-subtle: rgba(var(--brand-rgb), .3);
  --bs-link-color: var(--brand);
  --bs-link-color-rgb: var(--brand-rgb);
  --bs-link-hover-color: var(--brand-2);
  --bs-focus-ring-color: var(--brand-soft);
  --bs-success: var(--ok);
  --bs-danger: var(--bad);
  --bs-warning: var(--warn);
  --bs-info: var(--info);
}

/* =============================================================== base */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-grad), var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11" 1;
}
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-2); }
h1, h2, h3, h4, h5, h6 { color: var(--text); letter-spacing: -.015em; }
h1 { font-size: 24px; font-weight: 700; }
::selection { background: rgba(var(--brand-rgb), .22); }
.tnum { font-variant-numeric: tabular-nums; }
.muted, .text-muted { color: var(--muted) !important; }
.text-2 { color: var(--text-2); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.grow { flex: 1; min-width: 0; }
.hide { display: none !important; }
.nowrap { white-space: nowrap; }

/* scrollbars discretas */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }

/* =============================================================== shell */
.ml-side {
  position: fixed; z-index: 1030; inset: 0 auto 0 0;
  width: var(--side-w);
  display: flex; flex-direction: column;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(16px) saturate(1.3);
  border-right: 1px solid var(--line);
  transition: width .24s var(--ease), transform .24s var(--ease);
}
.ml-main { min-height: 100vh; margin-left: var(--side-w); display: flex; flex-direction: column; transition: margin-left .24s var(--ease); min-width: 0; }

.ml-side-head { display: flex; align-items: center; gap: 10px; height: var(--top-h); padding: 0 14px 0 18px; flex: none; }
.ml-brand { display: flex; align-items: center; gap: 11px; min-width: 0; color: var(--text); }
.ml-brand:hover { color: var(--text); }
.ml-brand img { width: 34px; height: 34px; border-radius: 10px; box-shadow: 0 6px 18px -6px rgba(124, 77, 255, .7); flex: none; }
.ml-brand b { display: block; font-size: 15px; letter-spacing: -.01em; line-height: 1.15; }
.ml-brand small { display: block; color: var(--muted); font-size: 12px; }
.ml-collapse {
  margin-left: auto; width: 32px; height: 32px; border-radius: 9px; border: 0; flex: none;
  display: grid; place-items: center; background: transparent; color: var(--muted); cursor: pointer;
  transition: background .15s, color .15s, transform .24s var(--ease);
}
.ml-collapse:hover { background: var(--surface-3); color: var(--text); }

.ml-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 4px 12px 16px; }
.ml-nav ul { list-style: none; margin: 0; padding: 0; }
.ml-nav-label {
  padding: 16px 12px 6px; font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); white-space: nowrap; overflow: hidden;
}
.ml-link {
  position: relative; width: 100%;
  display: flex; align-items: center; gap: 12px;
  height: 40px; padding: 0 12px; margin: 1px 0; border: 0; border-radius: 10px;
  background: transparent; color: var(--text-2); font-weight: 540; font-size: 14px; text-align: left;
  cursor: pointer; white-space: nowrap;
  transition: background .15s, color .15s;
}
.ml-link .ic { width: 19px; height: 19px; }
.ml-link:hover { background: var(--surface-3); color: var(--text); }
.ml-link.active, .ml-item.has-active > .ml-link { color: var(--text); }
.ml-link.active { background: var(--brand-soft); color: var(--brand); }
.ml-link.active::before {
  content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand);
}
.ml-item.has-active > .ml-link .ic:first-child { color: var(--brand); }
.ml-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; transition: opacity .15s; }
.ml-chev { width: 16px !important; height: 16px !important; color: var(--muted); transition: transform .2s var(--ease); }
.ml-item.open > .ml-link .ml-chev { transform: rotate(180deg); }
.ml-sub {
  display: grid; grid-template-rows: 0fr; transition: grid-template-rows .22s var(--ease);
}
.ml-item.open > .ml-sub { grid-template-rows: 1fr; }
.ml-sub > ul { overflow: hidden; position: relative; padding-left: 21px !important; }
.ml-sub > ul::before { content: ""; position: absolute; left: 21px; top: 4px; bottom: 6px; width: 1px; background: var(--line); }
.ml-sub a {
  position: relative; display: flex; align-items: center; gap: 8px;
  padding: 7px 12px 7px 18px; margin: 1px 0; border-radius: 9px;
  color: var(--text-2); font-size: 13.5px; font-weight: 500; white-space: nowrap;
}
.ml-sub a:hover { background: var(--surface-3); color: var(--text); }
.ml-sub a.active { color: var(--brand); font-weight: 600; background: var(--brand-soft); }
.ml-sub a.active::before { content: ""; position: absolute; left: -1px; top: 8px; bottom: 8px; width: 2px; border-radius: 2px; background: var(--brand); }
.ml-sub a.danger { color: var(--bad); }
.ml-sub a .ic { width: 15px; height: 15px; }
.ml-pill { margin-left: auto; font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 99px; background: var(--brand-soft); color: var(--brand); }
/* Recursos fora do plano: continuam clicáveis e mostram o plano mínimo */
.ml-lock { margin-left: auto; display: inline-flex; align-items: center; gap: 3px; flex: none; font-size: 10.5px; font-weight: 700; padding: 1px 7px 1px 5px; border-radius: 99px; background: var(--warn-soft); color: var(--warn); }
.ml-lock .ic { width: 11px !important; height: 11px !important; }
.ml-link .ml-lock + .ml-chev { margin-left: 6px; }
.ml-sub a.is-locked, .ml-link .ml-text:has(+ .ml-lock) { opacity: .85; }
html.sb-collapsed .ml-link .ml-lock { display: none; }
html.ml-hide-locked .is-locked { display: none !important; }
.ml-popover .ml-hide-locked-toggle { cursor: pointer; }

.ml-side-foot { flex: none; padding: 12px; border-top: 1px solid var(--line); }
.ml-me {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; text-align: left;
  transition: background .15s, border-color .15s;
}
.ml-me:hover { background: var(--surface-2); border-color: var(--line-strong); }
.ml-avatar {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff;
  background: linear-gradient(135deg, var(--brand-2), var(--brand));
}
.ml-me .who { min-width: 0; flex: 1; }
.ml-me .who b { display: block; font-size: 13px; font-weight: 620; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ml-me .who small { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- recolhida (desktop) */
@media (min-width: 992px) {
  html.sb-collapsed { --side-w: var(--side-w-collapsed); }
  html.sb-collapsed .ml-side-head { padding: 0 12px; justify-content: center; flex-direction: column; height: auto; gap: 8px; padding-top: 14px; padding-bottom: 8px; }
  html.sb-collapsed .ml-brand > div,
  html.sb-collapsed .ml-text,
  html.sb-collapsed .ml-chev,
  html.sb-collapsed .ml-pill,
  html.sb-collapsed .ml-me .who,
  html.sb-collapsed .ml-me > .ic { display: none; }
  html.sb-collapsed .ml-collapse { margin: 0; transform: rotate(180deg); }
  html.sb-collapsed .ml-nav { padding: 4px 14px 16px; }
  html.sb-collapsed .ml-nav-label { padding: 12px 0 6px; font-size: 0; }
  html.sb-collapsed .ml-nav-label::after { content: ""; display: block; height: 1px; margin: 0 8px; background: var(--line); }
  html.sb-collapsed .ml-link { justify-content: center; padding: 0; width: 48px; height: 44px; }
  html.sb-collapsed .ml-link.active::before { left: -14px; }
  html.sb-collapsed .ml-item.has-active > .ml-link { background: var(--brand-soft); color: var(--brand); }
  html.sb-collapsed .ml-sub { display: none; }
  html.sb-collapsed .ml-side-foot { padding: 12px 14px; }
  html.sb-collapsed .ml-me { justify-content: center; padding: 6px; border-color: transparent; background: transparent; }
}

/* ---- flyout do menu recolhido */
.ml-flyout {
  position: fixed; z-index: 1060; min-width: 220px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateX(-4px); pointer-events: none; transition: opacity .12s, transform .12s;
}
.ml-flyout.on { opacity: 1; transform: none; pointer-events: auto; }
.ml-flyout .t { padding: 8px 10px 6px; font-size: 12px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.ml-flyout a { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; color: var(--text-2); font-size: 13.5px; font-weight: 500; }
.ml-flyout a:hover { background: var(--surface-3); color: var(--text); }
.ml-flyout a.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.ml-flyout a.danger { color: var(--bad); }
.ml-flyout.tip-only { min-width: 0; padding: 7px 11px; font-weight: 600; font-size: 13px; background: var(--text); color: var(--surface); border-color: transparent; }

/* ---- menu do usuário */
.ml-popover {
  position: fixed; z-index: 1065; width: 272px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg);
  display: none;
}
.ml-popover.on { display: block; animation: ml-pop .14s ease-out; }
.ml-popover .head { display: flex; gap: 10px; align-items: center; padding: 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.ml-popover .head b { display: block; font-size: 13px; }
.ml-popover .head small { color: var(--muted); font-size: 12px; word-break: break-all; }
.ml-popover a, .ml-popover button.item {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; border-radius: 8px;
  background: transparent; color: var(--text-2); font-size: 13.5px; font-weight: 520; text-align: left; cursor: pointer;
}
.ml-popover a:hover, .ml-popover button.item:hover { background: var(--surface-3); color: var(--text); }
.ml-popover .sep { height: 1px; margin: 6px 4px; background: var(--line); }
.ml-popover .danger { color: var(--bad) !important; }
.ml-popover .seg button { padding: 0 8px; font-size: 12.5px; }
.ml-popover .seg .ic { width: 14px; height: 14px; }
.ml-popover .row-set { display: flex; align-items: center; gap: 10px; padding: 6px 10px; color: var(--text-2); font-size: 13.5px; }

/* ---- topo */
.ml-top {
  position: sticky; top: 0; z-index: 1020;
  height: var(--top-h); display: flex; align-items: center; gap: 12px; padding: 0 32px;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(14px) saturate(1.3);
  border-bottom: 1px solid transparent; transition: border-color .2s;
}
.ml-top.scrolled { border-bottom-color: var(--line); }
.icon-btn.ml-burger { display: none; }
.ml-crumb { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 13.5px; color: var(--muted); }
.ml-crumb b { color: var(--text); font-weight: 620; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ml-crumb .ic { width: 14px; height: 14px; opacity: .6; }
.ml-top-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn {
  position: relative; width: 38px; height: 38px; border-radius: 10px; border: 1px solid transparent;
  display: inline-grid; place-items: center; background: transparent; color: var(--text-2); cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn .ic { width: 19px; height: 19px; }
.icon-btn.ring::after {
  content: ""; position: absolute; inset: -3px; border-radius: 13px; border: 2px solid var(--brand);
  animation: ml-ring 1.6s ease-out infinite;
}
@keyframes ml-ring { from { opacity: .9; transform: scale(.9); } to { opacity: 0; transform: scale(1.25); } }

.ml-content { flex: 1; width: 100%; max-width: 1440px; margin: 0 auto; padding: 8px 32px 48px; }

.ml-backdrop { position: fixed; inset: 0; z-index: 1025; background: rgba(8, 10, 16, .45); backdrop-filter: blur(2px); opacity: 0; pointer-events: none; transition: opacity .2s; }

@media (max-width: 991.98px) {
  .ml-side { transform: translateX(-102%); width: min(300px, 86vw); box-shadow: var(--shadow-lg); background: var(--surface); }
  .ml-collapse { display: none; }
  .ml-main { margin-left: 0; }
  html.sb-open .ml-side { transform: none; }
  html.sb-open .ml-backdrop { opacity: 1; pointer-events: auto; }
  html.sb-open body { overflow: hidden; }
  .icon-btn.ml-burger { display: inline-grid; margin-left: -8px; }
  .ml-top { padding: 0 16px; }
  .ml-content { padding: 4px 16px 40px; }
  h1 { font-size: 21px; }
}
@media (max-width: 575.98px) {
  .ml-crumb .parent, .ml-crumb .sep { display: none; }
}

/* =============================================================== cabeçalho de página */
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 14px 0 22px; }
.page-head h1 { margin: 0; }
.page-head .lead { color: var(--muted); margin: 4px 0 0; font-size: 14px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
@media (max-width: 640px) { .page-head .actions { margin-left: 0; width: 100%; } }
.section-title { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 24px 0 10px; }

/* =============================================================== layout utilitário */
.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.two { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.halves { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.thirds { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.hstack { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
@media (max-width: 1180px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .two { grid-template-columns: 1fr; } .thirds { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .halves, .thirds { grid-template-columns: 1fr; } .kpis { gap: 10px; } }

/* =============================================================== card */
.card {
  --bs-card-bg: var(--surface);
  --bs-card-border-color: var(--line);
  --bs-card-border-radius: var(--radius);
  --bs-card-inner-border-radius: calc(var(--radius) - 1px);
  --bs-card-cap-bg: transparent;
  --bs-card-cap-padding-y: 16px;
  --bs-card-cap-padding-x: 20px;
  --bs-card-spacer-y: 18px;
  --bs-card-spacer-x: 20px;
  --bs-card-color: var(--text);
  --bs-card-title-color: var(--text);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-header { display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); font-weight: 620; }
.card-header h2, .card-header h3, .card-header h5 { margin: 0; font-size: 15px; font-weight: 650; }
.card-header .sub { color: var(--muted); font-size: 12.5px; font-weight: 450; }
.card-header .tools { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card-footer { background: var(--surface-2); border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.card-title { font-weight: 650; }
.card.flat { box-shadow: none; }
.card.pad { padding: 20px; }
@media (max-width: 640px) {
  .card { --bs-card-cap-padding-x: 16px; --bs-card-spacer-x: 16px; }
  .card-header { flex-wrap: wrap; }
  .card-header .tools { margin-left: 0; width: 100%; }
}

/* =============================================================== KPI */
.kpi { padding: 18px 20px; position: relative; overflow: hidden; }
.kpi .label { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12.5px; font-weight: 560; }
.kpi .ico { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex: none; }
.kpi .ico.ok { background: var(--ok-soft); color: var(--ok); }
.kpi .ico.info { background: var(--info-soft); color: var(--info); }
.kpi .ico.warn { background: var(--warn-soft); color: var(--warn); }
.kpi .ico.bad { background: var(--bad-soft); color: var(--bad); }
.kpi .value { margin-top: 12px; font-size: 26px; font-weight: 720; letter-spacing: -.025em; line-height: 1.15; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi .foot { margin-top: 6px; font-size: 12.5px; color: var(--muted); }
@media (max-width: 640px) { .kpi { padding: 14px; } .kpi .value { font-size: 20px; } }

/* =============================================================== botões */
.btn {
  --bs-btn-padding-x: 14px; --bs-btn-padding-y: 0; --bs-btn-font-size: 13.5px; --bs-btn-font-weight: 580;
  --bs-btn-border-radius: 10px; --bs-btn-focus-box-shadow: 0 0 0 4px var(--brand-soft);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; white-space: nowrap;
  transition: transform .06s, background .15s, border-color .15s, opacity .15s, filter .15s, color .15s;
}
.btn:active { transform: translateY(1px); }
.btn .ic { width: 16px; height: 16px; }
.btn-sm { --bs-btn-padding-x: 10px; --bs-btn-font-size: 12.5px; --bs-btn-border-radius: 9px; min-height: 32px; }
.btn-lg { --bs-btn-padding-x: 20px; --bs-btn-font-size: 15px; min-height: 46px; }
.btn-icon { width: 38px; padding: 0 !important; }
.btn-sm.btn-icon { width: 32px; }
.btn-primary {
  --bs-btn-color: #fff; --bs-btn-bg: var(--brand); --bs-btn-border-color: transparent;
  --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: transparent;
  --bs-btn-active-color: #fff; --bs-btn-active-bg: var(--brand); --bs-btn-active-border-color: transparent;
  --bs-btn-disabled-color: #fff; --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: transparent;
  background: linear-gradient(180deg, var(--brand-2), var(--brand));
  box-shadow: 0 6px 16px -8px rgba(124, 77, 255, .8);
}
.btn-primary:hover { filter: brightness(1.07); }
.btn-secondary, .btn-light, .btn-outline-secondary, .btn-outline-primary, .btn-outline-light, .btn-outline-dark, .btn-default {
  --bs-btn-color: var(--text); --bs-btn-bg: var(--surface); --bs-btn-border-color: var(--line-strong);
  --bs-btn-hover-color: var(--text); --bs-btn-hover-bg: var(--surface-3); --bs-btn-hover-border-color: var(--line-strong);
  --bs-btn-active-color: var(--text); --bs-btn-active-bg: var(--surface-3); --bs-btn-active-border-color: var(--line-strong);
  --bs-btn-disabled-color: var(--muted); --bs-btn-disabled-bg: var(--surface); --bs-btn-disabled-border-color: var(--line);
  box-shadow: var(--shadow-sm);
}
.btn-outline-primary { --bs-btn-color: var(--brand); --bs-btn-hover-color: var(--brand); --bs-btn-hover-bg: var(--brand-soft); --bs-btn-border-color: rgba(var(--brand-rgb), .35); --bs-btn-hover-border-color: rgba(var(--brand-rgb), .5); }
.btn-danger {
  --bs-btn-color: #fff; --bs-btn-bg: var(--bad); --bs-btn-border-color: transparent;
  --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--bad); --bs-btn-hover-border-color: transparent;
  --bs-btn-active-bg: var(--bad); --bs-btn-disabled-bg: var(--bad); --bs-btn-disabled-border-color: transparent;
}
.btn-danger:hover, .btn-success:hover, .btn-warning:hover, .btn-info:hover { filter: brightness(1.07); }
.btn-success {
  --bs-btn-color: #fff; --bs-btn-bg: var(--ok); --bs-btn-border-color: transparent;
  --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--ok); --bs-btn-hover-border-color: transparent;
  --bs-btn-active-bg: var(--ok); --bs-btn-disabled-bg: var(--ok); --bs-btn-disabled-border-color: transparent;
}
.btn-warning {
  --bs-btn-color: #fff; --bs-btn-bg: var(--warn); --bs-btn-border-color: transparent;
  --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--warn); --bs-btn-hover-border-color: transparent;
  --bs-btn-active-bg: var(--warn); --bs-btn-disabled-bg: var(--warn); --bs-btn-disabled-border-color: transparent;
}
.btn-info {
  --bs-btn-color: #fff; --bs-btn-bg: var(--info); --bs-btn-border-color: transparent;
  --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--info); --bs-btn-hover-border-color: transparent;
  --bs-btn-active-bg: var(--info); --bs-btn-disabled-bg: var(--info); --bs-btn-disabled-border-color: transparent;
}
.btn-outline-danger {
  --bs-btn-color: var(--bad); --bs-btn-bg: var(--surface); --bs-btn-border-color: color-mix(in srgb, var(--bad) 35%, transparent);
  --bs-btn-hover-color: var(--bad); --bs-btn-hover-bg: var(--bad-soft); --bs-btn-hover-border-color: color-mix(in srgb, var(--bad) 50%, transparent);
  --bs-btn-active-color: var(--bad); --bs-btn-active-bg: var(--bad-soft);
}
.btn-outline-success {
  --bs-btn-color: var(--ok); --bs-btn-bg: var(--surface); --bs-btn-border-color: color-mix(in srgb, var(--ok) 35%, transparent);
  --bs-btn-hover-color: var(--ok); --bs-btn-hover-bg: var(--ok-soft); --bs-btn-hover-border-color: color-mix(in srgb, var(--ok) 50%, transparent);
  --bs-btn-active-color: var(--ok); --bs-btn-active-bg: var(--ok-soft);
}
.btn-outline-warning {
  --bs-btn-color: var(--warn); --bs-btn-bg: var(--surface); --bs-btn-border-color: color-mix(in srgb, var(--warn) 35%, transparent);
  --bs-btn-hover-color: var(--warn); --bs-btn-hover-bg: var(--warn-soft); --bs-btn-hover-border-color: color-mix(in srgb, var(--warn) 50%, transparent);
}
.btn-outline-info {
  --bs-btn-color: var(--info); --bs-btn-bg: var(--surface); --bs-btn-border-color: color-mix(in srgb, var(--info) 35%, transparent);
  --bs-btn-hover-color: var(--info); --bs-btn-hover-bg: var(--info-soft); --bs-btn-hover-border-color: color-mix(in srgb, var(--info) 50%, transparent);
}
.btn-ghost, .btn-link {
  --bs-btn-color: var(--text-2); --bs-btn-bg: transparent; --bs-btn-border-color: transparent;
  --bs-btn-hover-color: var(--text); --bs-btn-hover-bg: var(--surface-3); --bs-btn-hover-border-color: transparent;
  --bs-btn-active-color: var(--text); --bs-btn-active-bg: var(--surface-3); --bs-btn-active-border-color: transparent;
  text-decoration: none;
}
.btn-ghost.danger { --bs-btn-color: var(--bad); --bs-btn-hover-color: var(--bad); --bs-btn-hover-bg: var(--bad-soft); }
.btn .spin, .spin {
  display: inline-block; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: ml-spin .7s linear infinite; flex: none;
}
.spin.lg { width: 28px; height: 28px; border-width: 3px; color: var(--brand); }
@keyframes ml-spin { to { transform: rotate(360deg); } }
.btn-close { --bs-btn-close-focus-shadow: 0 0 0 4px var(--brand-soft); border-radius: 8px; }

/* =============================================================== badges / chips */
.badge {
  --bs-badge-padding-x: 9px; --bs-badge-padding-y: 0; --bs-badge-font-size: 12px; --bs-badge-font-weight: 600; --bs-badge-border-radius: 99px;
  display: inline-flex; align-items: center; gap: 6px; height: 24px; line-height: 1;
  background: var(--surface-3); color: var(--text-2);
}
.badge.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok, .badge.bg-success, .badge.text-bg-success { background: var(--ok-soft) !important; color: var(--ok) !important; }
.badge.warn, .badge.bg-warning, .badge.text-bg-warning { background: var(--warn-soft) !important; color: var(--warn) !important; }
.badge.bad, .badge.bg-danger, .badge.text-bg-danger { background: var(--bad-soft) !important; color: var(--bad) !important; }
.badge.info, .badge.bg-info, .badge.text-bg-info { background: var(--info-soft) !important; color: var(--info) !important; }
.badge.brand, .badge.bg-primary, .badge.text-bg-primary { background: var(--brand-soft) !important; color: var(--brand) !important; }
.badge.bg-secondary, .badge.text-bg-secondary, .badge.bg-light, .badge.bg-dark { background: var(--surface-3) !important; color: var(--text-2) !important; }
.live::before { animation: ml-blink 1.6s ease-in-out infinite; }
@keyframes ml-blink { 50% { opacity: .25; } }

.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 11px; background: var(--surface-3); border: 1px solid var(--line); max-width: 100%; overflow-x: auto; }
.seg button, .seg a, .seg label {
  height: 30px; padding: 0 12px; border: 0; border-radius: 8px; display: inline-flex; align-items: center; gap: 6px;
  background: transparent; color: var(--text-2); font-weight: 580; font-size: 13px; cursor: pointer; white-space: nowrap; margin: 0;
}
.seg button.on, .seg a.on, .seg input:checked + label { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }

/* =============================================================== formulários */
.form-label, .field > span { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.form-text, .field small { color: var(--muted); font-size: 12px; }
.form-control, .form-select {
  min-height: 40px; padding: 8px 12px; font-size: 14px;
  background-color: var(--surface); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: 10px;
  transition: border-color .15s, box-shadow .15s;
}
.form-select { padding-right: 36px; }
textarea.form-control { min-height: 90px; line-height: 1.45; }
.form-control-sm, .form-select-sm { min-height: 34px; padding-top: 5px; padding-bottom: 5px; font-size: 13px; border-radius: 9px; }
.form-control-lg { min-height: 46px; font-size: 15px; }
.form-control::placeholder { color: var(--muted); opacity: .8; }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); background-color: var(--surface); color: var(--text); }
.form-control:disabled, .form-control[readonly], .form-select:disabled { background-color: var(--surface-2); color: var(--text-2); }
.form-control.is-invalid, .form-select.is-invalid { border-color: var(--bad); }
.form-control.is-invalid:focus { box-shadow: 0 0 0 4px var(--bad-soft); }
.invalid-feedback { color: var(--bad); font-size: 12px; }
.form-control-color { min-height: 40px; padding: 4px; width: 52px; }
.input-group-text { background: var(--surface-2); border-color: var(--line-strong); color: var(--muted); border-radius: 10px; font-size: 13.5px; }
.input-group > .form-control, .input-group > .form-select { min-height: 40px; }
.form-check-input { background-color: var(--surface); border-color: var(--line-strong); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.form-check-input:focus { box-shadow: 0 0 0 4px var(--brand-soft); border-color: var(--brand); }
.form-switch .form-check-input { width: 2.4em; height: 1.35em; margin-top: .05em; cursor: pointer; }
.form-check-label { cursor: pointer; }
.form-range::-webkit-slider-thumb { background: var(--brand); }
.form-range::-moz-range-thumb { background: var(--brand); }
.form-grid { display: grid; gap: 14px 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid, .form-grid.three { grid-template-columns: 1fr; } }
.search { position: relative; }
.search > .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search > .form-control { padding-left: 36px; }

/* linha de configuração com interruptor */
.setting { display: flex; align-items: center; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.setting:last-child { border-bottom: 0; }
.setting .txt { flex: 1; min-width: 0; }
.setting .txt b { display: block; font-weight: 600; font-size: 14px; }
.setting .txt small { color: var(--muted); font-size: 12.5px; }

/* upload */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center;
  padding: 24px; border: 1.5px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface-2);
  color: var(--muted); cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.dropzone .ic { width: 28px; height: 28px; }

/* =============================================================== tabelas */
.table {
  --bs-table-bg: transparent; --bs-table-color: var(--text); --bs-table-border-color: var(--line);
  --bs-table-striped-bg: var(--surface-2); --bs-table-striped-color: var(--text);
  --bs-table-hover-bg: var(--surface-2); --bs-table-hover-color: var(--text);
  --bs-table-active-bg: var(--brand-soft); --bs-table-active-color: var(--text);
  margin: 0; font-size: 14px;
}
.table > :not(caption) > * > * { padding: 12px 16px; border-bottom-color: var(--line); vertical-align: middle; }
.table > thead > tr > th, .table th.th {
  font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
  background: var(--surface-2); white-space: nowrap; padding-top: 10px; padding-bottom: 10px;
}
.table > tbody > tr:last-child > * { border-bottom: 0; }
.table-dark, .table-light { --bs-table-bg: transparent; --bs-table-color: var(--text); --bs-table-border-color: var(--line); }
.table-responsive { border-radius: inherit; }
.card > .table-responsive:last-child, .card > .table:last-child { border-bottom-left-radius: var(--radius); border-bottom-right-radius: var(--radius); }
.table td.actions { text-align: right; white-space: nowrap; width: 1%; }
.cell-title { font-weight: 600; }
.cell-sub { color: var(--muted); font-size: 12.5px; }
.thumb { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; background: var(--surface-3); flex: none; }
.thumb.ph { display: grid; place-items: center; color: var(--muted); }
tr.click { cursor: pointer; }

/* tabela vira cartões em telas pequenas */
@media (max-width: 760px) {
  table.cards thead { display: none; }
  table.cards, table.cards tbody { display: block; }
  table.cards tr { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
  table.cards tr:last-child { border-bottom: 0; }
  table.cards td { display: block; padding: 0 !important; border: 0 !important; background: none !important; }
  table.cards td[data-k]::before { content: attr(data-k) ": "; color: var(--muted); font-size: 12px; }
  table.cards td.m-hide { display: none; }
  table.cards td.m-right { grid-column: 2; grid-row: 1; text-align: right; }
  table.cards td.actions { grid-column: 1 / -1; text-align: left; padding-top: 6px !important; width: auto; }
}

/* lista */
.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-row .ico { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); flex: none; }
.list-row .ico.brand { background: var(--brand-soft); color: var(--brand); }
.list-group { --bs-list-group-bg: var(--surface); --bs-list-group-color: var(--text); --bs-list-group-border-color: var(--line); --bs-list-group-action-hover-bg: var(--surface-2); --bs-list-group-action-hover-color: var(--text); --bs-list-group-active-bg: var(--brand); --bs-list-group-active-border-color: var(--brand); --bs-list-group-border-radius: var(--radius-sm); }

/* paginação */
.pager { display: flex; align-items: center; gap: 10px; padding: 12px 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; flex-wrap: wrap; }
.pager .btns { margin-left: auto; display: flex; gap: 6px; }
.pagination { --bs-pagination-bg: var(--surface); --bs-pagination-color: var(--text-2); --bs-pagination-border-color: var(--line); --bs-pagination-hover-bg: var(--surface-3); --bs-pagination-hover-color: var(--text); --bs-pagination-hover-border-color: var(--line); --bs-pagination-active-bg: var(--brand); --bs-pagination-active-border-color: var(--brand); --bs-pagination-disabled-bg: var(--surface-2); --bs-pagination-disabled-color: var(--muted); --bs-pagination-disabled-border-color: var(--line); --bs-pagination-focus-box-shadow: 0 0 0 4px var(--brand-soft); --bs-pagination-border-radius: 9px; gap: 4px; margin: 0; }
.pagination .page-link { border-radius: 9px !important; min-width: 34px; text-align: center; font-weight: 560; font-size: 13px; }

/* =============================================================== estados */
.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty .ico { width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 16px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); }
.empty .ico .ic { width: 26px; height: 26px; }
.empty b { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }
.empty .btn { margin-top: 16px; }

.skeleton { position: relative; overflow: hidden; background: var(--surface-3); border-radius: 8px; min-height: 14px; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 60%, transparent), transparent); animation: ml-shimmer 1.3s infinite; }
@keyframes ml-shimmer { to { transform: translateX(100%); } }

.loading-veil { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; background: color-mix(in srgb, var(--surface) 70%, transparent); border-radius: inherit; backdrop-filter: blur(1px); }
.page-loader { position: fixed; inset: 0; z-index: 1090; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 55%, transparent); backdrop-filter: blur(2px); }
.page-loader .box { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg); font-weight: 560; }

/* =============================================================== alertas / callouts */
.alert {
  --bs-alert-border-radius: 12px; --bs-alert-padding-x: 16px; --bs-alert-padding-y: 12px;
  display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px;
  background: var(--info-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--info) 28%, transparent);
}
.alert > .ic, .alert > i:first-child { color: var(--info); margin-top: 2px; flex: none; }
.alert-success { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 28%, transparent); }
.alert-success > .ic, .alert-success > i:first-child { color: var(--ok); }
.alert-warning { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 28%, transparent); }
.alert-warning > .ic, .alert-warning > i:first-child { color: var(--warn); }
.alert-danger { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 28%, transparent); }
.alert-danger > .ic, .alert-danger > i:first-child { color: var(--bad); }
.alert-secondary, .alert-light, .alert-dark { background: var(--surface-2); border-color: var(--line); }
.alert-primary { background: var(--brand-soft); border-color: rgba(var(--brand-rgb), .3); }
.alert-primary > .ic { color: var(--brand); }
.alert .alert-link { color: inherit; text-decoration: underline; }
.alert-dismissible { padding-right: 44px; }

/* =============================================================== progress */
.progress { --bs-progress-bg: var(--surface-3); --bs-progress-bar-bg: var(--brand); --bs-progress-border-radius: 99px; --bs-progress-height: 8px; --bs-progress-font-size: 11px; }
.progress-bar { background: linear-gradient(90deg, var(--brand-2), var(--brand)); }
.progress-bar.bg-success { background: var(--ok) !important; }
.progress-bar.bg-danger { background: var(--bad) !important; }
.progress-bar.bg-warning { background: var(--warn) !important; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 180px) 1fr 64px; gap: 12px; align-items: center; padding: 6px 0; font-size: 13px; }
.bar-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .val { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.bar { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brand-2), var(--brand)); transition: width .5s var(--ease); }

/* =============================================================== nav tabs / pills */
.nav-tabs {
  --bs-nav-tabs-border-color: var(--line); --bs-nav-tabs-link-active-color: var(--brand); --bs-nav-tabs-link-active-bg: transparent;
  --bs-nav-tabs-link-active-border-color: transparent; --bs-nav-tabs-link-hover-border-color: transparent; --bs-nav-link-color: var(--text-2); --bs-nav-link-hover-color: var(--text);
  gap: 4px; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden;
}
.nav-tabs .nav-link { border: 0; border-bottom: 2px solid transparent; font-weight: 580; font-size: 13.5px; padding: 10px 12px; white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; }
.nav-tabs .nav-link.active { border-bottom-color: var(--brand); }
.nav-pills { --bs-nav-pills-link-active-bg: var(--brand-soft); --bs-nav-pills-link-active-color: var(--brand); --bs-nav-link-color: var(--text-2); --bs-nav-link-hover-color: var(--text); --bs-nav-pills-border-radius: 9px; gap: 4px; }
.nav-pills .nav-link { font-weight: 580; font-size: 13.5px; }

/* =============================================================== dropdown / modal / offcanvas */
.dropdown-menu {
  --bs-dropdown-bg: var(--surface); --bs-dropdown-color: var(--text); --bs-dropdown-border-color: var(--line);
  --bs-dropdown-border-radius: 12px; --bs-dropdown-link-color: var(--text-2); --bs-dropdown-link-hover-color: var(--text);
  --bs-dropdown-link-hover-bg: var(--surface-3); --bs-dropdown-link-active-bg: var(--brand-soft); --bs-dropdown-link-active-color: var(--brand);
  --bs-dropdown-divider-bg: var(--line); --bs-dropdown-item-border-radius: 8px; --bs-dropdown-padding-x: 6px; --bs-dropdown-padding-y: 6px; --bs-dropdown-font-size: 13.5px;
  box-shadow: var(--shadow-lg);
}
.dropdown-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; font-weight: 520; }
.dropdown-item.danger, .dropdown-item.text-danger { color: var(--bad) !important; }

.modal {
  --bs-modal-bg: var(--surface); --bs-modal-color: var(--text); --bs-modal-border-color: var(--line);
  --bs-modal-border-radius: 18px; --bs-modal-inner-border-radius: 17px; --bs-modal-box-shadow: var(--shadow-lg);
  --bs-modal-header-padding: 18px 22px; --bs-modal-header-border-color: var(--line); --bs-modal-padding: 20px 22px;
  --bs-modal-footer-border-color: var(--line); --bs-modal-footer-bg: var(--surface-2); --bs-modal-footer-gap: 8px;
}
.modal-backdrop { --bs-backdrop-bg: #080a10; --bs-backdrop-opacity: .5; }
.modal-header .modal-title { font-size: 16px; font-weight: 650; display: flex; align-items: center; gap: 10px; }
.modal-header .sub { display: block; font-size: 12.5px; color: var(--muted); font-weight: 450; }
.modal-footer { background: var(--surface-2); border-bottom-left-radius: var(--bs-modal-inner-border-radius); border-bottom-right-radius: var(--bs-modal-inner-border-radius); }
.modal.fade .modal-dialog { transform: translateY(10px) scale(.98); transition: transform .2s var(--ease); }
.modal.show .modal-dialog { transform: none; }
@media (max-width: 575.98px) {
  .modal-dialog:not(.modal-fullscreen) { margin: 0; position: fixed; left: 0; right: 0; bottom: 0; max-width: none; align-items: flex-end; min-height: 0; }
  .modal-dialog:not(.modal-fullscreen) .modal-content { border-radius: 20px 20px 0 0; max-height: 92vh; padding-bottom: env(safe-area-inset-bottom); }
  .modal-dialog-scrollable .modal-content { max-height: 92vh; }
  .modal.fade .modal-dialog { transform: translateY(40px); }
}
.offcanvas { --bs-offcanvas-bg: var(--surface); --bs-offcanvas-color: var(--text); --bs-offcanvas-border-color: var(--line); --bs-offcanvas-width: 560px; }

.accordion { --bs-accordion-bg: var(--surface); --bs-accordion-color: var(--text); --bs-accordion-border-color: var(--line); --bs-accordion-border-radius: 12px; --bs-accordion-inner-border-radius: 11px; --bs-accordion-btn-color: var(--text); --bs-accordion-btn-bg: var(--surface); --bs-accordion-active-bg: var(--surface-2); --bs-accordion-active-color: var(--text); --bs-accordion-btn-focus-box-shadow: 0 0 0 4px var(--brand-soft); }
.accordion-button { font-weight: 600; }

.tooltip { --bs-tooltip-bg: var(--text); --bs-tooltip-color: var(--surface); --bs-tooltip-border-radius: 8px; --bs-tooltip-font-size: 12px; }

/* =============================================================== toasts */
.ml-toasts { position: fixed; z-index: 1100; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.ml-toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px;
  min-width: 260px; max-width: 420px; padding: 12px 14px; border-radius: 12px;
  background: var(--text); color: var(--surface); box-shadow: var(--shadow-lg); font-weight: 520; font-size: 13.5px;
  animation: ml-pop .18s ease-out;
}
.ml-toast .i { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--ok); color: #fff; flex: none; }
.ml-toast .i .ic { width: 13px; height: 13px; }
.ml-toast.bad .i { background: var(--bad); }
.ml-toast.warn .i { background: var(--warn); }
.ml-toast.info .i { background: var(--info); }
.ml-toast.out { opacity: 0; transform: translateY(6px); transition: all .2s; }
@media (max-width: 640px) { .ml-toasts { left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); } .ml-toast { max-width: none; } }
@keyframes ml-pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }

/* =============================================================== ajuda contextual */
.ml-help-tip {
  position: fixed; z-index: 1085; width: min(320px, calc(100vw - 32px)); padding: 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg);
  animation: ml-pop .18s ease-out;
}
.ml-help-tip::before { content: ""; position: absolute; top: -7px; right: 18px; width: 12px; height: 12px; background: var(--surface); border-left: 1px solid var(--line); border-top: 1px solid var(--line); transform: rotate(45deg); }
.ml-help-tip b { display: block; font-size: 14px; margin-bottom: 4px; }
.ml-help-tip p { color: var(--text-2); font-size: 13px; margin: 0 0 12px; }

/* =============================================================== diversos */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.dot.bad { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.dot.info { background: var(--info); box-shadow: 0 0 0 3px var(--info-soft); }
.kbd, kbd { font-family: var(--mono); font-size: 12px; padding: 2px 6px; border-radius: 6px; background: var(--surface-3); border: 1px solid var(--line); color: var(--text-2); }
code { color: var(--brand); font-size: 12.5px; }
hr { border-color: var(--line); opacity: 1; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.chart-box { position: relative; height: 280px; }
.chart-box.sm { height: 220px; }
.chart-box.lg { height: 340px; }
@media (max-width: 640px) { .chart-box { height: 240px; } }

.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.summary-grid > div { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); min-width: 0; }
.summary-grid span { display: block; font-size: 12px; color: var(--muted); }
.summary-grid b { font-size: 17px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

.hero {
  position: relative; overflow: hidden;
  padding: 22px 24px; border-radius: var(--radius); color: #fff;
  background: linear-gradient(135deg, #6b3df5 0%, #8f5bff 55%, #b37bff 100%);
  box-shadow: 0 18px 40px -20px rgba(107, 61, 245, .8);
}
.hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 240px; height: 240px; border-radius: 50%; background: rgba(255, 255, 255, .08); pointer-events: none; }
.hero h2, .hero h3 { color: #fff; }
.hero p { opacity: .85; margin: 4px 0 0; }
.hero .stats { display: flex; gap: 28px; margin-top: 16px; flex-wrap: wrap; position: relative; z-index: 1; }
.hero .stats b { display: block; font-size: 18px; letter-spacing: -.02em; }
.hero .stats span { font-size: 12px; opacity: .8; }
.hero .btn {--bs-btn-color: #fff; --bs-btn-hover-color: #fff; --bs-btn-bg: rgba(255,255,255,.16); --bs-btn-hover-bg: rgba(255,255,255,.26); --bs-btn-border-color: rgba(255,255,255,.22); --bs-btn-hover-border-color: rgba(255,255,255,.3); box-shadow: none; background: var(--bs-btn-bg); }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 22px; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.timeline li::after { content: ""; position: absolute; left: 7.5px; top: 18px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }

.fade-in { animation: ml-fade .25s ease-out; }
@keyframes ml-fade { from { opacity: 0; transform: translateY(4px); } }

/* utilitários Bootstrap que não acompanham o tema escuro por padrão */
.bg-light, .bg-body-tertiary { background-color: var(--surface-2) !important; color: var(--text); }
.bg-white { background-color: var(--surface) !important; }
.text-dark:not(.badge) { color: var(--text) !important; }
.text-primary { color: var(--brand) !important; }
.text-success { color: var(--ok) !important; }
.text-danger { color: var(--bad) !important; }
.text-warning { color: var(--warn) !important; }
.text-info { color: var(--info) !important; }
.border-primary { border-color: rgba(var(--brand-rgb), .4) !important; }

/* Font Awesome legado dentro de componentes novos */
.btn > .fa, .btn > .fas, .btn > .far, .btn > .fab { font-size: 14px; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
