/* Painel inicial (painel.js). Tema escuro é o padrão; html[data-vm-theme=light] troca os tokens. */
#moduleChooser.dsh-on {
  --d-page: #0b1420; --d-surface: #122130; --d-raised: #182b3d; --d-line: #26405a; --d-text: #eaf2fa; --d-muted: #9cb2c6;
  --d-accent: #4ea4ff; --d-accent-soft: #16324b; --d-bar: #4ea4ff; --d-grid: #23394f;
  --d-side: linear-gradient(180deg, #0f1d2c, #0b1622); --d-side-text: #d6e4f2; --d-side-active: #1d3a57;
  --d-hero: linear-gradient(120deg, #123a66, #1d5fae 70%, #2a74cf);
  display: block !important; place-items: initial; padding: 0 !important; min-height: 100vh;
  background: var(--d-page) !important; color: var(--d-text);
  font: 15px/1.45 system-ui, "Segoe UI", Inter, Arial, sans-serif;
}
#moduleChooser.dsh-on.hidden { display: none !important; }
html[data-vm-theme=light] #moduleChooser.dsh-on {
  --d-page: #f2f5fb; --d-surface: #fff; --d-raised: #f6f8fc; --d-line: #dde5f0; --d-text: #14243a; --d-muted: #5b6b80;
  --d-accent: #2563eb; --d-accent-soft: #e8efff; --d-bar: #2f6fe4; --d-grid: #e6ecf4;
  --d-side: linear-gradient(180deg, #2433b8, #3a3fd6 55%, #2a35c4); --d-side-text: #eef1ff; --d-side-active: #ffffff2a;
  --d-hero: linear-gradient(120deg, #1d3fae, #2563eb 65%, #3b82f6);
  background: var(--d-page) !important;
}
.dsh { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.dsh svg { width: 20px; height: 20px; flex: none; }

/* Menu lateral */
.dsh-side { position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 6px;
  padding: 18px 12px; background: var(--d-side); color: var(--d-side-text); z-index: 30; }
.dsh-brand { padding: 4px 10px 14px; }
.dsh-brand img { width: 150px; display: block; }
.dsh-nav { display: flex; flex-direction: column; gap: 2px; }
.dsh-nav-title { margin: 14px 12px 4px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; opacity: .7; }
.dsh-link { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 0; border-radius: 10px;
  background: transparent; color: inherit; font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.dsh-link:hover, .dsh-link.active { background: var(--d-side-active); }
.dsh-link.active { font-weight: 700; }
.dsh-side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding: 12px; border-top: 1px solid #ffffff22; }
.dsh-theme { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; }
#dshLogoutSlot .module-chooser-logout { width: 100%; padding: 10px 12px; border: 1px solid #ffffff33; border-radius: 10px;
  background: transparent !important; color: var(--d-side-text) !important; font: inherit; cursor: pointer; }
.dsh-scrim { position: fixed; inset: 0; background: #0009; z-index: 25; }

/* Conteúdo */
.dsh-main { min-width: 0; padding: 22px 28px 48px; display: flex; flex-direction: column; gap: 22px; max-width: 1340px; }
.dsh-top { display: flex; align-items: center; gap: 14px; }
.dsh-top small { color: var(--d-muted); font-size: 13px; }
.dsh-top h1 { margin: 0; font-size: 24px; line-height: 1.2; color: var(--d-text) !important; }
.dsh-menu { display: none; width: 44px; height: 44px; border: 1px solid var(--d-line); border-radius: 12px;
  background: var(--d-surface); color: var(--d-text); place-items: center; cursor: pointer; }

.dsh-hero { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; padding: 22px 8px; border-radius: 18px;
  background: var(--d-hero); color: #fff; box-shadow: 0 10px 28px #1d4ed833; }
.dsh-hero > div { display: flex; flex-direction: column; gap: 4px; padding: 0 18px; border-left: 1px solid #ffffff2e; min-width: 0; }
.dsh-hero > div:first-child { border-left: 0; }
.dsh-hero span { display: flex; align-items: center; gap: 6px; font-size: 13px; opacity: .9; }
.dsh-hero span svg { width: 16px; height: 16px; }
.dsh-hero strong { font-size: 28px; line-height: 1.15; color: #fff !important; overflow-wrap: anywhere; }
.dsh-hero em { font-style: normal; font-size: 12px; opacity: .85; }

.dsh-block { display: flex; flex-direction: column; gap: 14px; }
.dsh-block-head { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; }
.dsh-block-head h2 { margin: 0 auto 0 0; font-size: 18px; color: var(--d-text) !important; }
.dsh-period { display: inline-flex; padding: 3px; border: 1px solid var(--d-line); border-radius: 11px; background: var(--d-surface); }
.dsh-period button { padding: 7px 13px; border: 0; border-radius: 8px; background: transparent; color: var(--d-muted); font: inherit; font-size: 14px; cursor: pointer; }
.dsh-period button[aria-pressed=true] { background: var(--d-accent); color: #fff; font-weight: 700; }
.dsh-step { display: inline-flex; align-items: center; gap: 6px; color: var(--d-text); font-size: 14px; }
.dsh-step span { min-width: 150px; text-align: center; text-transform: capitalize; }
.dsh-step button, .dsh-csv { height: 36px; min-width: 36px; padding: 0 12px; border: 1px solid var(--d-line); border-radius: 10px;
  background: var(--d-surface); color: var(--d-text); font: inherit; font-size: 14px; cursor: pointer; }
.dsh-step button:disabled { opacity: .35; cursor: default; }

.dsh-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.dsh-tile { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border: 1px solid var(--d-line); border-radius: 14px; background: var(--d-surface); }
.dsh-tile span { color: var(--d-muted); font-size: 12px; font-weight: 600; }
.dsh-tile strong { font-size: 22px; color: var(--d-text) !important; }
.dsh-tile small { color: var(--d-muted); font-size: 12px; }
.dsh-note { margin: 0; color: var(--d-muted); font-size: 13px; }
.dsh-note:empty { display: none; }

.dsh-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; }
.dsh-grid > :first-child { grid-row: span 2; }
.dsh-chart { position: relative; margin: 0; padding: 16px; border: 1px solid var(--d-line); border-radius: 16px; background: var(--d-surface); min-width: 0; }
.dsh-chart[hidden] { display: none; }
.dsh-chart figcaption { margin-bottom: 10px; font-weight: 700; font-size: 14px; color: var(--d-text); }
.dsh-chart-area { position: relative; }
.dsh-chart-area svg { display: block; width: 100%; height: auto; }
.dsh-grid-line { stroke: var(--d-grid); stroke-width: 1; }
.dsh-base { stroke: var(--d-line); stroke-width: 1; }
.dsh-axis { fill: var(--d-muted); font-size: 11px; }
.dsh-bar { fill: var(--d-bar); }
.dsh-hit { fill: transparent; cursor: default; outline: none; }
.dsh-hit:hover, .dsh-hit:focus-visible { fill: var(--d-accent-soft); fill-opacity: .55; }
.dsh-empty { margin: 8px 0; color: var(--d-muted); font-size: 14px; }
.dsh-over { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; pointer-events: none; }
.dsh-rank { display: flex; flex-direction: column; gap: 10px; }
.dsh-rank-text { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; color: var(--d-text); }
.dsh-rank-text span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dsh-rank-text b { white-space: nowrap; color: var(--d-text) !important; }
.dsh-rank-text small { color: var(--d-muted); font-weight: 400; }
.dsh-rank-track { height: 8px; margin-top: 4px; border-radius: 4px; background: var(--d-raised); overflow: hidden; }
.dsh-rank-track i { display: block; height: 100%; border-radius: 4px; background: var(--d-bar); }
.dsh-tip { position: fixed; z-index: 100000; padding: 8px 10px; border-radius: 8px; background: #0b1420; color: #fff; font: 13px/1.35 system-ui, sans-serif;
  box-shadow: 0 8px 22px #0006; pointer-events: none; }

/* Acesso rápido: reaproveita os botões originais */
.dsh-quick { display: flex; flex-direction: column; gap: 16px; }
.dsh-quick-group[hidden] { display: none; }
.dsh-quick .chooser-section-title { margin: 0 0 8px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--d-muted) !important; text-align: left; }
.dsh-quick .module-chooser-actions { display: grid !important; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.dsh-quick .module-chooser-option { display: flex; align-items: center; gap: 12px; min-height: 0; padding: 14px 16px; margin: 0;
  border: 1px solid var(--d-line) !important; border-radius: 14px; background: var(--d-surface) !important; color: var(--d-text) !important;
  text-decoration: none; box-shadow: none !important; transform: none !important; }
.dsh-quick .module-chooser-option:hover { border-color: var(--d-accent) !important; }
.dsh-quick .module-chooser-option strong { color: var(--d-text) !important; font-size: 15px; }
.dsh-quick .module-chooser-option small { display: block; color: var(--d-muted) !important; font-size: 12.5px; }
.dsh-quick .module-chooser-icon { display: grid; place-items: center; width: 42px; height: 42px; flex: none; border-radius: 12px;
  background: var(--d-accent-soft) !important; color: var(--d-accent) !important; border: 0 !important; }
.dsh-quick .module-chooser-option > b { margin-left: auto; color: var(--d-muted); }
.dsh-quick #financeChoices, .dsh-quick #administrativeChoices { margin: 0; }
.dsh-quick #consultDenied { color: var(--d-muted) !important; text-align: left !important; padding: 0 !important; }

@media (max-width: 1100px) {
  .dsh-hero { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 18px; }
  .dsh-hero > div:nth-child(3) { border-left: 0; }
  .dsh-grid { grid-template-columns: 1fr; }
  .dsh-grid > :first-child { grid-row: auto; }
}
@media (max-width: 860px) {
  .dsh { grid-template-columns: 1fr; }
  .dsh-side { position: fixed; left: 0; top: 0; bottom: 0; width: min(280px, 84vw); transform: translateX(-102%); transition: transform .2s ease; }
  .dsh.menu-open .dsh-side { transform: none; }
  .dsh-menu { display: grid; }
  .dsh-main { padding: 14px 16px 40px; gap: 18px; }
  .dsh-top h1 { font-size: 21px; }
  .dsh-hero { padding: 18px 4px; }
  .dsh-hero > div { padding: 0 14px; }
  .dsh-hero strong { font-size: 22px; }
  .dsh-block-head h2 { width: 100%; }
  .dsh-step span { min-width: 0; flex: 1; }
  .dsh-step { flex: 1; }
  .dsh-csv { width: 100%; }
  .dsh-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .dsh-tile strong { font-size: 19px; }
  .dsh-quick .module-chooser-actions { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .dsh-side { transition: none; } }

/* Ajustes sobre estilos antigos do seletor */
html #moduleChooser .dsh-brand img { filter: none !important; mix-blend-mode: normal !important; background: transparent !important; padding: 0 !important; }
html #moduleChooser .dsh-side .dsh-nav-title { color: var(--d-side-text) !important; opacity: .68; }
html #moduleChooser .dsh-side .dsh-theme, html #moduleChooser .dsh-side .dsh-theme span { color: var(--d-side-text) !important; }
.dsh-theme #chooserThemeSlot { margin: 0 !important; padding: 0 !important; display: flex; }
.dsh-side-foot .module-chooser-logout { margin: 0 !important; text-decoration: none !important; font: 600 14px system-ui, sans-serif !important; min-height: 40px; }
.dsh-quick .module-chooser-actions { max-width: none !important; margin: 0 !important; }
.dsh-quick .module-chooser-option, .dsh-quick .finance-choices .solo-last { width: auto !important; max-width: none !important; justify-self: stretch !important; grid-column: auto !important; min-height: 76px !important; }
.dsh-grid { grid-template-columns: 1fr 1fr; }
.dsh-grid > :first-child { grid-column: 1 / -1; grid-row: auto; }
@media (max-width: 1100px) { .dsh-grid { grid-template-columns: 1fr; } }
.dsh-step span { text-transform: none; }
html #moduleChooser .dsh-theme { display: flex !important; flex-direction: row !important; align-items: center !important; justify-content: space-between !important; margin: 0 !important; font-weight: 500; }
.dsh-chart-area svg { max-width: 100%; }
/* No computador o menu lateral já mostra tudo; o acesso rápido fica só no celular. */
@media (min-width: 861px) { .dsh-quick-block { display: none !important; } }

/* Com o menu lateral comum (vm-shell), o painel usa só a coluna de conteúdo */
body.vs-ready .dsh { grid-template-columns: minmax(0, 1fr) !important; }
body.vs-ready .dsh-side, body.vs-ready .dsh-scrim, body.vs-ready .dsh-menu { display: none !important; }
body.vs-ready .dsh-main { margin: 0 auto; width: 100%; }
a.dsh-manage { display: inline-flex; align-items: center; text-decoration: none; }
a.dsh-manage[hidden] { display: none; }
