/* css/components.css — filtros, KPIs, painéis, gráficos, tabelas, expansíveis, badges */
/* FILTROS FIXOS, ARREDONDADOS E COM SOMBRA */
.filters { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin-bottom: 24px; box-shadow: 0 4px 16px rgba(0,0,0,0.15); }

/* Ícones de legenda e explicativos (Tooltips e Toggles) */
.ui-tip-icon { display: inline-flex; align-items: center; justify-content: center; width: 13px; height: 13px; color: var(--muted, #8aa0bd); margin-left: 5px; cursor: help; vertical-align: -1px; flex-shrink: 0; opacity: 0.82; transition: opacity .15s, color .15s, transform .15s; outline: none; }
.ui-tip-icon:hover, .ui-tip-icon:focus-visible { opacity: 1; color: var(--accent, #3b82f6); transform: scale(1.18); }
.ui-tip-icon svg { width: 100%; height: 100%; display: block; }
#tip { position: fixed; display: none; background: rgba(11, 20, 36, 0.96); color: #f1f5f9; border: 1px solid var(--line, #24344d); padding: 8px 12px; border-radius: 8px; font-size: 11.5px; font-weight: 500; line-height: 1.45; white-space: pre-line; z-index: 99999; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55); max-width: 380px; backdrop-filter: blur(6px); pointer-events: none; }

.frow { display: flex; gap: 10px 20px; flex-wrap: wrap; align-items: flex-end; }
.fgroup { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.fgroup > span { font-size: 12px; color: var(--muted); font-weight: 500; }
.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.chip { border: 0; background: var(--chip); padding: 6px 10px; border-radius: 5px; cursor: pointer; font-size: 13px; min-width: 38px; text-align: center; }
.chip:hover { filter: brightness(.96); }
.chip[aria-pressed="true"] { background: var(--chip-on); color: var(--chip-on-ink); font-weight: 600; }
.chip.c-inc[aria-pressed="true"] { background: var(--inc-col); color: #fff; }
.chip.c-ritm[aria-pressed="true"] { background: var(--main); color: #fff; }
.sel { border: 1px solid var(--line); background: var(--bg); padding: 6px 8px; border-radius: 5px; max-width: 220px; }
.clear { border: 0; background: none; color: var(--accent); text-decoration: underline; cursor: pointer; padding: 6px 2px; font-weight: 500; }
.clear[hidden] { display: none; }
.count { margin-left: auto; color: var(--muted); font-size: 13px; padding: 6px 0; }

.headline { margin: 0 0 4px; font-size: 22px; font-weight: 600; letter-spacing: -.01em; }
.sub { margin: 0 0 16px; color: var(--muted); font-size: 13px; }
.ribbon { display: grid; grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; margin-bottom: 22px; }
.kpi { padding: 14px 16px; border-left: 1px solid var(--line); position: relative; }
.kpi:first-child { border-left: 0; }
.kpi .l { font-size: 12px; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.kpi .v { font-size: 26px; font-weight: 600; letter-spacing: -.02em; line-height: 1.15; margin: 4px 0 2px; }
.kpi .s { font-size: 11.5px; color: var(--muted); }
.kpi[data-act] { cursor: pointer; }
.kpi[data-act]:hover { background: var(--soft); }
.kpi.highlight { background: color-mix(in srgb, var(--mel) 8%, var(--panel)); border-top: 3px solid var(--mel); }
.kpi.highlight .v { color: var(--mel); }
.kpi.attention { background: color-mix(in srgb, var(--warn) 8%, var(--panel)); border-top: 3px solid var(--warn); }
.kpi.inc-kpi { background: color-mix(in srgb, var(--inc-col) 8%, var(--panel)); border-top: 3px solid var(--inc-col); }
.kpi.inc-kpi .v { color: var(--inc-col); }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; min-width: 0; }
.panel.wide { grid-column: 1 / -1; }
.panel h3 { margin: 0; font-size: 15px; font-weight: 600; }
.panel .cap { margin: 2px 0 10px; color: var(--muted); font-size: 12.5px; }
.chart { width: 100%; min-height: 60px; }
.empty { color: var(--muted); padding: 26px 0; text-align: center; }

.panel-header-with-actions { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.chart-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.btn-trend { display: inline-flex; align-items: center; gap: 5px; background: var(--panel); border: 1px solid var(--line); color: var(--muted); padding: 4px 10px; border-radius: 6px; font-size: 11.5px; font-weight: 500; cursor: pointer; transition: all .15s ease; }
.btn-trend:hover { border-color: var(--accent); color: var(--ink); }
.btn-trend.active { background: color-mix(in srgb, var(--accent) 15%, var(--panel)); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.trend-badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; background: var(--soft); border: 1px solid var(--line); color: var(--ink); }
.trend-badge.up { background: color-mix(in srgb, var(--warn) 15%, transparent); border-color: var(--warn); color: var(--warn); }
.trend-badge.down { background: color-mix(in srgb, var(--ext) 15%, transparent); border-color: var(--ext); color: var(--ext); }
.trend-badge.stable { background: color-mix(in srgb, var(--main) 15%, transparent); border-color: var(--main); color: var(--main); }

svg { display: block; overflow: visible; }
svg text { font-family: inherit; font-size: 11.5px; fill: var(--muted); }
svg .ax { stroke: var(--line); stroke-width: 1; }
svg .gl { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 3; }
svg .lbl { fill: var(--ink); }
svg .val { fill: var(--ink); font-weight: 500; }
svg [data-act] { cursor: pointer; }
svg .hit { fill: transparent; }
svg .hit:hover { fill: var(--main); fill-opacity: .07; }
svg .on { stroke: var(--ink); stroke-width: 1.5; }

.legend { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 0; font-size: 12.5px; color: var(--muted); }
.legend-btn { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; font-size: 12px; color: var(--ink); transition: all .15s; user-select: none; }
.legend-btn:hover { border-color: var(--accent); }
.legend-btn.active { background: var(--chip-on); color: var(--chip-on-ink); border-color: var(--chip-on); font-weight: 600; }
.legend-btn i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; flex: none; }

.donut { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.donut ul { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 160px; }
.donut li { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 4px; cursor: pointer; }
.donut li:hover { background: var(--soft); }
.donut li i { width: 10px; height: 10px; border-radius: 2px; flex: none; }
.donut li b { margin-left: auto; font-weight: 600; }
.donut li em { font-style: normal; color: var(--muted); width: 46px; text-align: right; }

.tablewrap { overflow: auto; max-width: 100%; border: 1px solid var(--line); border-radius: 6px; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 7px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { text-align: left; }
thead th { background: var(--soft); font-weight: 600; position: sticky; top: 0; z-index: 1; }
tbody tr:last-child td { border-bottom: 0; }
.painel td:first-child, .painel th:first-child { position: sticky; left: 0; background: var(--panel); z-index: 2; border-right: 1px solid var(--line); }
.painel thead th:first-child { background: var(--soft); z-index: 3; }
.painel th[data-act] { cursor: pointer; }
.painel th[data-act]:hover { color: var(--accent); }
.painel .mon { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.painel .geral { font-weight: 600; }
.reqtools { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.reqtools input { border: 1px solid var(--line); background: var(--panel); padding: 6px 8px; border-radius: 5px; flex: 1; min-width: 140px; }
.reqtools span { color: var(--muted); font-size: 12.5px; }
.reqtable { max-height: 340px; }
.reqtable td:first-child { white-space: normal; min-width: 140px; }
.reqtable th, .reqtable td { padding: 7px 8px; }
.reqtable th[data-act] { cursor: pointer; }
.reqtable tbody tr { cursor: pointer; }
.reqtable tbody tr:hover { background: var(--soft); }
.reqtable tr.sel td { background: color-mix(in srgb, var(--accent) 14%, transparent); font-weight: 600; }
.err { background: color-mix(in srgb, var(--warn) 14%, transparent); border: 1px solid var(--warn); color: var(--ink); padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; }
.err[hidden] { display: none; }

.exp-panel { margin-top: 20px; padding: 0; overflow: hidden; }
.exp-summary { list-style: none; padding: 14px 18px; cursor: pointer; background: var(--soft); user-select: none; }
.exp-summary::-webkit-details-marker { display: none; }
.exp-summary:hover { background: color-mix(in srgb, var(--main) 6%, var(--soft)); }
details[open] .exp-summary { border-bottom: 1px solid var(--line); }
details:not([open]) .exp-summary { border-bottom: none; }
.exp-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.exp-title { display: flex; align-items: center; gap: 10px; }
.exp-title h3 { margin: 0; font-size: 15px; font-weight: 600; }
.exp-badge { background: var(--main); color: #fff; padding: 2px 8px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.exp-hint { font-size: 12px; color: var(--muted); }
.exp-body { padding: 16px 18px; }
.exp-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.exp-toolbar input { border: 1px solid var(--line); background: var(--panel); padding: 7px 10px; border-radius: 6px; flex: 1; min-width: 240px; }
.btn-export { border: 1px solid var(--line); background: var(--panel); padding: 6px 14px; border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.btn-export:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary-action { border: none; background: var(--accent); color: #fff; padding: 6px 14px; border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; transition: filter .15s; }
.btn-primary-action:hover { filter: brightness(1.15); }

.filtered-wrap { max-height: 480px; }
.tbl-filtered th { cursor: pointer; }
.tbl-filtered th:hover { color: var(--accent); }
.tbl-filtered td { font-size: 13px; }
.badge-kind { display: inline-block; padding: 2px 6px; border-radius: 3px; font-size: 11px; font-weight: 700; }
.badge-kind.inc { background: color-mix(in srgb, var(--inc-col) 15%, transparent); color: var(--inc-col); border: 1px solid color-mix(in srgb, var(--inc-col) 35%, transparent); }
.badge-kind.ritm { background: color-mix(in srgb, var(--main) 15%, transparent); color: var(--main); border: 1px solid color-mix(in srgb, var(--main) 35%, transparent); }
.badge-st { display: inline-block; padding: 2px 7px; border-radius: 4px; font-size: 11.5px; font-weight: 600; }
.badge-st.novo { background: #FEF3C7; color: #92400E; }
.badge-st.resolvido { background: #D1FAE5; color: #065F46; }
.badge-st.encerrado { background: #E0E7FF; color: #3730A3; }
.badge-st.cancelado { background: #F3F4F6; color: #4B5563; }
/* Estado visível dos popovers (Notificações, Idioma, etc) */
.popover {
  display: none;
  position: absolute;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 1000;
}

.popover.show {
  display: block;
  animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Ajuste específico para a janela de Notificações */
.notif-menu {
  width: 320px;
  top: calc(100% + 8px);
  right: 16px;
  padding: 0;
  overflow: hidden;
}

/* Wrapper e botão de alternância de visibilidade de senha (mobile e desktop) */
.input-password-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}
.input-password-wrap input {
  width: 100%;
  padding-right: 44px !important;
  box-sizing: border-box;
}
.btn-toggle-pass {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  background: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  cursor: pointer;
  color: var(--muted, #8aa0bd);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  z-index: 10;
  border-radius: 6px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  transition: color 0.15s ease, background-color 0.15s ease;
}
.btn-toggle-pass:hover,
.btn-toggle-pass:active {
  color: var(--ink, #ffffff);
  background: rgba(148, 163, 184, 0.15) !important;
}
.btn-toggle-pass svg {
  pointer-events: none;
  display: block;
}

