:root {
  --blue-900: #150649;
  --blue-800: #1e0e5e;
  --blue-600: #2D63F5;
  --blue-500: #4A7BF7;
  --blue-100: #E8EDFE;
  --green: #28C76F;
  --green-bg: #E1F8EC;
  --yellow: #FFB547;
  --yellow-bg: #FFF5E1;
  --red: #EA5455;
  --red-bg: #FEEDEC;
  --gray: #9CA3AF;
  --n900: #1A1A2E;
  --n700: #4A4A4A;
  --n600: #666;
  --n300: #c7cdd6;
  --n200: #E4E7EE;
  --n100: #EEF1F6;
  --n50: #F4F6FB;
  --n0: #fff;
  --sw: 64px;
  --sw-open: 236px;
}

* {
  box-sizing: border-box
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--n900);
  background: var(--n50);
  font-size: 13.5px;
  line-height: 1.4;
  overflow: hidden
}

a {
  color: var(--blue-600);
  text-decoration: none
}

a:hover {
  text-decoration: underline
}

::selection {
  background: var(--blue-100)
}

/* ---------- App shell (flex; sidebar empurra o conteudo) ---------- */
.app {
  display: flex;
  height: 100vh;
  overflow: hidden
}

.sidebar {
  flex: 0 0 var(--sw);
  height: 100vh;
  background: linear-gradient(180deg, var(--blue-900), var(--blue-800));
  color: #dfe3f7;
  overflow-y: auto;
  overflow-x: hidden;
  transition: flex-basis .18s ease;
  display: flex;
  flex-direction: column;
  scrollbar-width: none;
  -ms-overflow-style: none
}

.sidebar::-webkit-scrollbar {
  display: none
}

/* item 2: sem barra de rolagem */
.sidebar:hover,
body.pinned .sidebar {
  flex-basis: var(--sw-open)
}

.side-logo {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .55rem .7rem;
  min-height: 52px;
  border-bottom: 1px solid rgba(255, 255, 255, .08)
}

.logo-chip {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px
}

.logo-chip img {
  max-width: 100%;
  max-height: 100%
}

.side-title {
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  opacity: 0;
  transition: opacity .15s
}

.sidebar:hover .side-title,
body.pinned .side-title {
  opacity: 1
}

.side-nav {
  display: flex;
  flex-direction: column;
  padding: .4rem .45rem;
  gap: 1px
}

.side-nav a {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .46rem .55rem;
  border-radius: 9px;
  color: #c9cfec;
  white-space: nowrap
}

.side-nav a:hover {
  background: rgba(255, 255, 255, .09);
  color: #fff;
  text-decoration: none
}

.side-nav a.active {
  background: rgba(255, 255, 255, .12);
  color: #fff
}

.side-nav a svg {
  flex: 0 0 21px;
  width: 21px;
  height: 21px;
  color: var(--ic, #aeb6e0)
}

/* item 1: icone colorido */
.side-nav a.active svg {
  color: #fff
}

.side-nav a span {
  opacity: 0;
  transition: opacity .15s;
  font-size: .9rem
}

.sidebar:hover .side-nav a span,
body.pinned .side-nav a span {
  opacity: 1
}

.side-sep {
  height: 1px;
  background: rgba(255, 255, 255, .1);
  margin: .4rem .3rem
}

.side-group {
  font-size: .64rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #8b93c8;
  padding: .25rem .6rem;
  white-space: nowrap;
  opacity: 0;
  transition: opacity .15s
}

.sidebar:hover .side-group,
body.pinned .side-group {
  opacity: 1
}

.main-col {
  flex: 1;
  min-width: 0;
  height: 100vh;
  display: flex;
  flex-direction: column
}

/* item 8: min-width:0 evita vazar */

.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--n0);
  border-bottom: 1px solid var(--n200);
  padding: .45rem 1.1rem;
  min-height: 48px
}

.side-toggle {
  border: none;
  background: transparent;
  font-size: 1.2rem;
  color: var(--n600);
  cursor: pointer;
  border-radius: 8px;
  padding: .15rem .45rem
}

.side-toggle:hover {
  background: var(--n100)
}

.topbar-title {
  font-weight: 700;
  font-size: 1rem;
  flex: 1
}

.topbar-clock {
  color: var(--n600);
  font-size: .82rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  margin-right: .4rem
}

@media(max-width:640px) {
  .topbar-clock {
    display: none
  }
}

.user {
  display: flex;
  align-items: center;
  gap: .7rem;
  color: var(--n600)
}

.user-name {
  font-weight: 600;
  color: var(--n700)
}

.content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1rem 1.2rem;
  animation: fadein .2s ease
}

/* item 10: scroll interno */
@keyframes fadein {
  from {
    opacity: 0
  }

  to {
    opacity: 1
  }
}

/* item 9: footer fixo com fundo da sidebar */
.footer {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
  padding: .5rem 1.2rem;
  background: linear-gradient(90deg, var(--blue-900), var(--blue-800));
  color: #c9cfec;
  font-size: .78rem
}

.footer .ver {
  color: #fff;
  font-weight: 600
}

.wrap-login {
  max-width: 380px;
  margin: 8vh auto;
  padding: 0 1rem;
  overflow: auto
}

body:has(.wrap-login) {
  overflow: auto
}

/* ---------- Tipografia / util ---------- */
h1 {
  font-size: 1.25rem;
  margin: .1rem 0 .8rem
}

h2 {
  font-size: .98rem;
  margin: .2rem 0 .55rem
}

.muted {
  color: var(--n600)
}

.row {
  display: flex;
  gap: .8rem;
  flex-wrap: wrap
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .8rem
}

@media(max-width:1000px) {
  .grid-2 {
    grid-template-columns: 1fr
  }
}

/* ---------- Cards / KPIs (item 5,7: baixos e alinhados, 6 por linha) ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: .7rem;
  margin: .6rem 0 .9rem
}

@media(max-width:1300px) {
  .cards {
    grid-template-columns: repeat(3, 1fr)
  }
}

@media(max-width:720px) {
  .cards {
    grid-template-columns: repeat(2, 1fr)
  }
}

.card {
  background: var(--n0);
  border: 1px solid var(--n200);
  border-radius: 11px;
  padding: .6rem .75rem;
  transition: transform .12s, box-shadow .12s;
  position: relative; /* ensure relative positioning for tooltips */
}

.card:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(20, 6, 73, .07);
  z-index: 150;
}

/* Tooltip styles for cards */
.card-tooltip {
  position: absolute;
  top: 100%;
  left: 0;
  width: 320px;
  background: rgba(30, 14, 94, 0.98);
  color: #fff;
  border-radius: 8px;
  padding: 10px 14px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 100;
  margin-top: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
}

.card:hover .card-tooltip {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.card-tooltip::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 20px;
  border: 6px solid transparent;
  border-bottom-color: rgba(30, 14, 94, 0.98);
}

.tooltip-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  color: #aeb6e0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 4px;
}

.tooltip-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 250px;
  overflow-y: auto;
}

.tooltip-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.74rem;
  color: #dfe3f7;
}

.tooltip-list li .name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tooltip-list li .val {
  font-weight: 700;
  color: #fff;
}

.tooltip-list li .dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.tooltip-list li .dot.dot-GREEN {
  background-color: var(--green);
}
.tooltip-list li .dot.dot-RED {
  background-color: var(--red);
}
.tooltip-list li .dot.dot-YELLOW {
  background-color: var(--yellow);
}
.tooltip-list li .dot.dot-GRAY {
  background-color: var(--gray);
}

.card .kpi {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.05
}

.card .lbl {
  color: var(--n600);
  font-size: .66rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  margin-bottom: .15rem
}

.card.k-total {
  border-top: 3px solid var(--blue-600)
}

.card.k-total .kpi {
  color: var(--blue-900)
}

.card.k-pend {
  border-top: 3px solid var(--red)
}

.card.k-pend .kpi {
  color: var(--red)
}

.card.k-ok {
  border-top: 3px solid var(--green)
}

.card.k-ok .kpi {
  color: var(--green)
}

.card.k-pct {
  border-top: 3px solid var(--blue-600)
}

.card.k-pct .kpi {
  color: var(--blue-600)
}

.panel {
  background: var(--n0);
  border: 1px solid var(--n200);
  border-radius: 12px;
  padding: .75rem .85rem;
  margin-bottom: .8rem
}

.panel h2 {
  margin-top: 0
}

/* ---------- Tabelas (item 10: cabecalho congelado) ---------- */
.table-wrap {
  overflow: auto;
  background: var(--n0);
  border: 1px solid var(--n200);
  border-radius: 12px;
  max-height: 52vh
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: .78rem
}

th,
td {
  text-align: left;
  padding: .34rem .55rem;
  border-bottom: 1px solid var(--n100);
  white-space: nowrap
}

th {
  background: var(--blue-900);
  color: #fff;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 2
}

tbody tr:hover td {
  background: var(--n50)
}

td.num,
th.num {
  text-align: right;
  font-variant-numeric: tabular-nums
}

/* matriz: fonte pequena + linhas de grade em todas as celulas */
.matrix table {
  font-size: .7rem
}

.matrix th,
.matrix td {
  padding: .18rem .3rem;
  border: 1px solid #d7dce6
}

.matrix .farol {
  min-width: 30px
}

.farol {
  text-align: center;
  font-weight: 700;
  color: #fff
}

.farol-RED {
  background: var(--red) !important;
  color: #fff
}

.farol-YELLOW {
  background: var(--yellow) !important;
  color: #5a3d0a
}

.farol-GREEN {
  background: var(--green) !important;
  color: #fff
}

.farol-GRAY {
  background: var(--n100) !important;
  color: var(--n600)
}

.cell-na {
  background: var(--n50);
  color: var(--n300);
  text-align: center
}

.matrix td:first-child,
.matrix th:first-child {
  position: sticky;
  left: 0;
  background: var(--n0);
  z-index: 3;
  text-align: left;
  box-shadow: 1px 0 0 var(--n200)
}

.matrix th:first-child {
  background: var(--blue-900);
  color: #fff;
  z-index: 4
}

.matrix thead th {
  vertical-align: bottom
}

.matrix .doc-col {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  height: 112px;
  max-height: 112px;
  font-weight: 600;
  font-size: .6rem;
  line-height: 1.05
}

.badge {
  display: inline-block;
  padding: .1rem .45rem;
  border-radius: 999px;
  font-size: .74rem;
  font-weight: 700
}

.b-RED,
.b-aberta {
  background: var(--red-bg);
  color: #b02a2b
}

.b-YELLOW {
  background: var(--yellow-bg);
  color: #8a5a11
}

.b-GREEN,
.b-resolvida {
  background: var(--green-bg);
  color: #1a7a44
}

.b-GRAY {
  background: var(--n100);
  color: var(--n600)
}

.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: .35rem;
  vertical-align: middle
}

.dot-RED {
  background: var(--red)
}

.dot-YELLOW {
  background: var(--yellow)
}

.dot-GREEN {
  background: var(--green)
}

.dot-GRAY {
  background: var(--gray)
}

.pill {
  background: var(--blue-100);
  color: var(--blue-900);
  padding: .08rem .4rem;
  border-radius: 6px;
  font-size: .74rem;
  font-weight: 600
}

/* ---------- Botoes ---------- */
.btn,
.btn-primary,
.btn-ghost,
.btn-danger {
  display: inline-block;
  padding: .45rem .8rem;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 600;
  font-size: .85rem;
  transition: .12s
}

.btn-primary {
  background: var(--blue-600);
  color: #fff
}

.btn-primary:hover {
  background: #1E4AD9;
  text-decoration: none
}

.btn {
  background: var(--n0);
  border-color: var(--n200);
  color: var(--n700)
}

.btn:hover {
  background: var(--n100);
  text-decoration: none
}

.btn-ghost {
  color: var(--n600)
}

.btn-ghost:hover {
  color: var(--blue-600)
}

.btn-danger {
  background: var(--red);
  color: #fff
}

.btn-sm {
  padding: .25rem .5rem;
  font-size: .78rem
}

/* ---------- Forms / filtros ---------- */
form.stack {
  display: flex;
  flex-direction: column;
  gap: .8rem;
  max-width: 560px
}

label {
  font-weight: 600;
  color: var(--n700);
  display: block;
  margin-bottom: .2rem
}

input,
select,
textarea {
  width: 100%;
  padding: .42rem .55rem;
  border: 1px solid var(--n200);
  border-radius: 8px;
  font: inherit;
  background: var(--n0)
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--blue-100);
  border-color: var(--blue-600)
}

.card-form {
  background: var(--n0);
  border: 1px solid var(--n200);
  border-radius: 12px;
  padding: 1.1rem
}

.toolbar {
  display: flex;
  gap: .5rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: .8rem
}

.toolbar .spacer {
  flex: 1
}

.toolbar select,
.toolbar input {
  width: auto
}

.filterbar {
  display: flex;
  gap: .55rem;
  flex-wrap: wrap;
  align-items: end;
  background: var(--n0);
  border: 1px solid var(--n200);
  border-radius: 12px;
  padding: .6rem .75rem;
  margin-bottom: .7rem
}

.filterbar .fld {
  display: flex;
  flex-direction: column;
  gap: .15rem
}

.filterbar .fld select,
.filterbar .fld input {
  max-width: 180px
}

.filterbar label {
  font-size: .66rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--n600);
  margin: 0
}

/* ---------- Callout (caixa de ajuda) ---------- */
.callout {
  background: var(--blue-100);
  border: 1px solid #c7d5fb;
  border-left: 4px solid var(--blue-600);
  border-radius: 10px;
  padding: .7rem .9rem;
  margin: .6rem 0 1rem;
  color: var(--n900)
}

.callout strong {
  color: var(--blue-900)
}

.callout ul {
  margin: .4rem 0 0;
  padding-left: 1.1rem
}

.callout li {
  margin: .2rem 0;
  font-size: .86rem
}

/* ---------- Flash ---------- */
.flash {
  padding: .55rem .85rem;
  border-radius: 9px;
  margin-bottom: .55rem;
  font-weight: 500
}

.flash-ok {
  background: var(--green-bg);
  color: #1a7a44
}

.flash-erro {
  background: var(--red-bg);
  color: #b02a2b
}

.flash-info {
  background: var(--blue-100);
  color: var(--blue-900)
}

/* ---------- Multiselect (estilo Power BI: busca + checkboxes) ---------- */
.ms {
  position: relative
}

.ms-btn {
  background: var(--n0);
  border: 1px solid var(--n200);
  border-radius: 8px;
  padding: .42rem .55rem;
  cursor: pointer;
  font: inherit;
  text-align: left;
  min-width: 140px;
  max-width: 190px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

.ms-btn:hover {
  background: var(--n100)
}

.ms-btn[disabled] {
  background: var(--n100);
  color: var(--n500);
  cursor: not-allowed;
  border-color: var(--n200);
}

.ms-pop {
  position: absolute;
  z-index: 80;
  top: calc(100% + 4px);
  left: 0;
  background: var(--n0);
  border: 1px solid var(--n200);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(20, 6, 73, .18);
  width: 270px;
  padding: .5rem;
  display: flex;
  flex-direction: column;
  gap: .4rem
}

.ms-pop[hidden] {
  display: none
}

.ms-list {
  max-height: 240px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 1px
}

.ms-item {
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .24rem .3rem;
  border-radius: 6px;
  font-weight: 400;
  margin: 0;
  cursor: pointer;
  font-size: .82rem
}

.ms-item:hover {
  background: var(--n100)
}

.ms-item input {
  width: auto;
  flex: 0 0 auto
}

.ms-item.hide {
  display: none
}

.ms-n {
  color: var(--n600);
  font-style: normal;
  font-size: .74rem
}

.ms-actions {
  display: flex;
  justify-content: space-between;
  gap: .4rem
}

/* ---------- Charts (item 5: mais baixos) ---------- */
.chart-box {
  position: relative;
  height: 168px
}

.chart-box.sm {
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.donut-center-label {
  position: absolute;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}

.donut-center-label .pct {
  display: block;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--green);
  line-height: 1.1;
}

.donut-center-label .lbl {
  display: block;
  font-size: 0.65rem;
  color: var(--n600);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 1px;
}

.donut-center-label.gauge {
  top: 76%;
}

.donut-center-label.gauge .pct {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--green);
}


.panel-header-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
}

.panel-header-actions h2 {
  margin: 0;
}

.chart-toggle {
  font-size: 0.76rem;
  color: var(--n600);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  user-select: none;
  font-weight: 500;
}

.chart-toggle input[type="checkbox"] {
  cursor: pointer;
  margin: 0;
  width: 13px;
  height: 13px;
}

.trend-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 0.4rem;
}
.trend-badge.up {
  color: #10B981;
  background: #E1F8EC;
}
.trend-badge.down {
  color: #EF4444;
  background: #FEEDEC;
}

.progress-bar-container {
  background: var(--n200);
  height: 5px;
  border-radius: 3px;
  overflow: hidden;
  width: 100%;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}
.progress-bar-fill.blue {
  background: var(--blue-600);
}



/* ---------- Dropzone ---------- */
.dropzone {
  border: 2px dashed var(--blue-600);
  border-radius: 12px;
  background: var(--blue-100);
  padding: 2rem;
  text-align: center;
  color: var(--blue-900);
  cursor: pointer;
  transition: .15s
}

.dropzone.drag {
  background: #dbe6fe;
  border-color: #1E4AD9
}

.dropzone strong {
  display: block;
  font-size: 1.02rem;
  margin-bottom: .3rem
}

#filelist {
  list-style: none;
  padding: 0;
  margin: .8rem 0
}

#filelist li {
  background: var(--n0);
  border: 1px solid var(--n200);
  border-radius: 8px;
  padding: .45rem .65rem;
  margin-bottom: .35rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem
}

.tag {
  font-size: .74rem;
  color: var(--n600)
}

.login-logo {
  text-align: center;
  margin-bottom: 1.5rem
}

/* Dashboard view tabs / segment controls */
.dashboard-tabs {
  display: flex;
  gap: .5rem;
  margin-bottom: 1.2rem;
  background: var(--n200);
  padding: .3rem;
  border-radius: 9px;
  width: fit-content;
  border: 1px solid var(--n300);
}

.dashboard-tab {
  padding: .5rem 1.2rem;
  border-radius: 7px;
  font-weight: 600;
  font-size: .84rem;
  color: var(--n700);
  transition: background .12s, color .12s;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
}

.dashboard-tab:hover {
  color: var(--blue-600);
  text-decoration: none;
}

.dashboard-tab.active {
  background: var(--n0);
  color: var(--blue-600);
  box-shadow: 0 2px 6px rgba(20, 6, 73, .05);
}

.dashboard-tab .badge {
  font-size: .7rem;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--n100);
  color: var(--n600);
  font-weight: 700;
}

.dashboard-tab.active .badge {
  background: var(--blue-100);
  color: var(--blue-600);
}