:root {
  --primary: #1b8fa8;
  --teal: #0ea5a4;
  --green: #12b76a;
  --red: #f04438;
  --amber: #f79009;
  --purple: #31c2aa;
  --r-lg: 18px;
  --r-md: 12px;
  --r-sm: 9px;
  --fs:
    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
html[data-theme="light"] {
  --bg: #f4f5f8;
  --surface: #ffffff;
  --surface2: #fbfcfe;
  --sidebar: #0e1526;
  --border: #e8eaef;
  --border2: #eef0f4;
  --text: #0f172a;
  --text2: #334155;
  --muted: #7a879c;
  --grid: #f1f2f6;
  --tick: #9aa5b5;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 4px 16px rgba(16, 24, 40, 0.05);
  --shadow-h: 0 8px 30px rgba(16, 24, 40, 0.1);
  --tint: 0.1;
  --side-txt: #aeb9cc;
  --side-active: #ffffff;
}
html[data-theme="dark"] {
  --bg: #0a0e16;
  --surface: #141a26;
  --surface2: #10161f;
  --sidebar: #0c111b;
  --border: #222c3c;
  --border2: #1b2432;
  --text: #eaf0f8;
  --text2: #c4cedb;
  --muted: #8593a6;
  --grid: rgba(255, 255, 255, 0.06);
  --tick: #7e8c9e;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
  --shadow-h: 0 12px 34px rgba(0, 0, 0, 0.5);
  --tint: 0.16;
  --side-txt: #8a97a8;
  --side-active: #ffffff;
}
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  font-family: var(--fs);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
  transition:
    background 0.3s,
    color 0.3s;
}
button,
input,
select {
  font-family: var(--fs);
}
a {
  color: inherit;
  text-decoration: none;
}
.app {
  display: grid;
  grid-template-columns: 250px 1fr;
  min-height: 100vh;
}
.sidebar {
  background: var(--sidebar);
  color: var(--side-txt);
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.side-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 18px;
}
.side-brand .logo {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  box-shadow: 0 6px 16px rgba(27, 143, 168, 0.4);
}
.side-brand .logo svg {
  width: 21px;
  height: 21px;
  stroke: #fff;
  fill: none;
  stroke-width: 2;
}
.side-brand b {
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.2px;
  line-height: 1.1;
}
.side-brand span {
  font-size: 11px;
  color: var(--side-txt);
}
.nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 4px;
}
.nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 13px;
  border-radius: 11px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--side-txt);
  transition: 0.16s;
  cursor: pointer;
}
.nav a svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  opacity: 0.9;
}
.nav a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}
.nav a.active {
  background: linear-gradient(135deg, var(--primary), var(--purple));
  color: var(--side-active);
  box-shadow: 0 6px 16px rgba(27, 143, 168, 0.35);
}
.side-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
}
.side-foot .tag {
  font-size: 10.5px;
  color: var(--side-txt);
  text-align: center;
  opacity: 0.7;
}
.main {
  padding: 26px 30px 60px;
  max-width: 1240px;
  width: 100%;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.topbar h2 {
  font-size: 21px;
  font-weight: 750;
  letter-spacing: -0.4px;
}
.topbar .desc {
  color: var(--muted);
  font-size: 12.5px;
  margin-top: 3px;
}
.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.selwrap {
  position: relative;
}
select,
input[type="text"],
input[type="number"],
input[type="date"],
input[type="password"] {
  appearance: none;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 500;
  outline: none;
  box-shadow: var(--shadow);
  transition: 0.16s;
  width: 100%;
}
select {
  padding-right: 34px;
  cursor: pointer;
  font-weight: 600;
}
.selwrap::after {
  content: "";
  position: absolute;
  right: 13px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}
select:focus,
input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent);
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 650;
  font-size: 13px;
  padding: 10px 16px;
  border-radius: var(--r-md);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: 0.16s;
}
.btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}
.btn:hover {
  border-color: var(--primary);
}
.btn.primary {
  background: linear-gradient(135deg, var(--primary), var(--purple));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 16px rgba(27, 143, 168, 0.35);
}
.btn.primary:hover {
  filter: brightness(1.05);
}
.btn.ghost {
  background: transparent;
  box-shadow: none;
}
.btn.sm {
  padding: 7px 11px;
  font-size: 12px;
}
.btn.danger {
  color: var(--red);
  border-color: color-mix(in srgb, var(--red) 30%, var(--border));
}
.iconbtn {
  width: 40px;
  height: 40px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow);
  transition: 0.16s;
}
.iconbtn:hover {
  border-color: var(--primary);
}
.iconbtn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  box-shadow: var(--shadow);
}
.panel .ttl {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 2px;
}
.panel h3 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.2px;
}
.panel .ph {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 16px;
}
.tag {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  padding: 4px 10px;
  border-radius: 20px;
}
.grid {
  display: grid;
  gap: 18px;
}
.g2 {
  grid-template-columns: 1fr 1fr;
}
.g3 {
  grid-template-columns: 1.35fr 1fr;
}
.mb18 {
  margin-bottom: 18px;
}
.full {
  grid-column: 1/-1;
}
.kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.kpi {
  position: relative;
  overflow: hidden;
  padding: 18px 18px 20px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}
.kpi:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-h);
}
.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 13px;
}
.chip {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
}
.chip svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke-width: 2;
}
.delta {
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 20px;
}
.delta.up {
  color: var(--green);
  background: color-mix(in srgb, var(--green) 12%, transparent);
}
.delta.down {
  color: var(--red);
  background: color-mix(in srgb, var(--red) 12%, transparent);
}
.delta.flat {
  color: var(--muted);
  background: color-mix(in srgb, var(--muted) 12%, transparent);
}
.kpi .lab {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}
.kpi .val {
  font-size: 24px;
  font-weight: 750;
  letter-spacing: -0.6px;
  margin-top: 5px;
  line-height: 1.05;
}
.kpi .foot {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 8px;
}
.chartbox {
  position: relative;
  height: 280px;
}
.chartbox.sm {
  height: 250px;
}
.tablewrap {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th,
td {
  padding: 12px 12px;
  text-align: right;
  border-bottom: 1px solid var(--border2);
  white-space: nowrap;
}
th:first-child,
td:first-child {
  text-align: left;
}
th {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 650;
}
td {
  font-weight: 500;
}
tbody tr {
  transition: background 0.15s;
}
tbody tr:hover {
  background: var(--surface2);
}
.pill {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 700;
}
.rowbtns {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}
.linkbtn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 5px;
  border-radius: 7px;
  transition: 0.15s;
}
.linkbtn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  display: block;
}
.linkbtn:hover {
  color: var(--primary);
  background: var(--surface2);
}
.linkbtn.del:hover {
  color: var(--red);
}
.bud {
  display: flex;
  flex-direction: column;
  gap: 15px;
}
.bud .top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 12.5px;
  margin-bottom: 7px;
}
.bud .cat {
  font-weight: 650;
}
.bud .amt {
  color: var(--muted);
  font-size: 12px;
}
.bud .amt b {
  font-weight: 700;
}
.track {
  height: 8px;
  border-radius: 6px;
  background: var(--border2);
  overflow: hidden;
}
.fillbar {
  height: 100%;
  border-radius: 6px;
  width: 0;
  transition: width 1s cubic-bezier(0.22, 0.8, 0.24, 1);
}
.seg {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
  box-shadow: var(--shadow);
}
.seg button {
  border: none;
  background: transparent;
  color: var(--muted);
  font-weight: 650;
  font-size: 13px;
  padding: 8px 16px;
  border-radius: 9px;
  cursor: pointer;
  transition: 0.18s;
}
.seg button.active {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--purple));
}
.formgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
}
.field .hint {
  font-size: 11px;
  color: var(--muted);
}
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}
.overlay.show {
  display: flex;
  animation: fade 0.2s ease;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-h);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow: auto;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border2);
}
.modal-head h3 {
  font-size: 16px;
  font-weight: 700;
}
.modal-body {
  padding: 22px;
}
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 22px;
  border-top: 1px solid var(--border2);
}
.empty {
  text-align: center;
  padding: 56px 20px;
  color: var(--muted);
}
.empty .ic {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  background: color-mix(in srgb, var(--primary) 10%, transparent);
}
.empty .ic svg {
  width: 30px;
  height: 30px;
  stroke: var(--primary);
  fill: none;
  stroke-width: 1.8;
}
.empty h3 {
  color: var(--text);
  font-size: 17px;
  margin-bottom: 6px;
}
.empty p {
  font-size: 13px;
  max-width: 420px;
  margin: 0 auto 18px;
  line-height: 1.6;
}
#toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--green);
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: var(--shadow-h);
  font-size: 13px;
  font-weight: 600;
  min-width: 220px;
  animation: slideup 0.25s ease;
}
.toast.err {
  border-left-color: var(--red);
}
@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes slideup {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.view-anim {
  animation: va 0.35s ease;
}
@keyframes va {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (max-width: 980px) {
  .app {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    left: -260px;
    z-index: 60;
    transition: left 0.25s;
    width: 250px;
  }
  .sidebar.open {
    left: 0;
  }
  .kpis {
    grid-template-columns: repeat(2, 1fr);
  }
  .g2,
  .g3 {
    grid-template-columns: 1fr;
  }
  .menu-toggle {
    display: grid !important;
  }
}
.menu-toggle {
  display: none;
}
body {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
input,
textarea,
select,
option,
[contenteditable=""],
[contenteditable="true"] {
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  user-select: text;
}
img {
  -webkit-user-drag: none;
  user-drag: none;
}
#lock {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(900px 500px at 10% -10%, rgba(27, 143, 168, 0.18), transparent 60%),
    radial-gradient(800px 500px at 110% 10%, rgba(122, 90, 248, 0.2), transparent 55%), var(--bg);
}
.lock-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow-h);
  width: 100%;
  max-width: 400px;
  padding: 34px 30px;
  text-align: center;
  animation: va 0.4s ease;
}
.lock-ic {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  box-shadow: 0 10px 26px rgba(27, 143, 168, 0.4);
}
.lock-ic svg {
  width: 32px;
  height: 32px;
  stroke: #fff;
}
.lock-card h1 {
  font-size: 20px;
  font-weight: 750;
  letter-spacing: -0.4px;
  margin-bottom: 6px;
}
.lock-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  margin-bottom: 20px;
}
.lock-card input {
  margin-bottom: 12px;
  text-align: center;
  font-size: 15px;
  padding: 13px;
}
.lock-err {
  color: var(--red);
  font-size: 12.5px;
  font-weight: 600;
  min-height: 18px;
  margin-bottom: 8px;
}
.lock-foot {
  color: var(--muted);
  font-size: 11.5px;
  margin-top: 16px;
  line-height: 1.5;
}
.filtros {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.filtros input {
  flex: 1;
  min-width: 170px;
  max-width: 280px;
}
.filtros .selwrap {
  flex: 0 0 auto;
  min-width: 150px;
}
td .sub {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}
.pill-ok {
  color: var(--green);
  background: color-mix(in srgb, var(--green) 14%, transparent);
}
.pill-pend {
  color: var(--amber);
  background: color-mix(in srgb, var(--amber) 16%, transparent);
  cursor: help;
}
.parc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
  margin-top: 4px;
}
.parc-mes {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  background: color-mix(in srgb, var(--amber) 5%, transparent);
}
.parc-mes-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
}
.parc-mes-top b {
  color: var(--amber);
}
.parc-mes ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.parc-mes li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
}
.parc-mes li b {
  color: var(--text);
  font-weight: 650;
  white-space: nowrap;
}
.parc-mes li em {
  font-style: normal;
  opacity: 0.7;
}
.parc-hint {
  display: none;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text);
  padding: 10px 12px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--primary) 22%, transparent);
}
.parc-hint.on {
  display: block;
}
.parc-hint span {
  color: var(--muted);
  font-size: 11.5px;
}
.pill-now {
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 15%, transparent);
}
.thf {
  margin-top: 6px;
}
.thf input,
.thf select {
  font-size: 12px;
  font-weight: 500;
  padding: 6px 8px;
  box-shadow: none;
  text-transform: none;
  letter-spacing: 0;
  min-width: 128px;
}
.thf .selwrap.sm select {
  padding-right: 26px;
}
.thf .selwrap.sm::after {
  right: 10px;
  width: 6px;
  height: 6px;
}
.tbl-filtros thead th {
  vertical-align: top;
}
.msel {
  position: relative;
  min-width: 128px;
}
.msel-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 7px 9px;
  font-size: 12px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
  box-shadow: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.msel-btn:hover {
  border-color: var(--primary);
}
.msel-car {
  color: var(--muted);
  font-size: 9px;
  flex: 0 0 auto;
}
.msel-pop {
  position: absolute;
  z-index: 60;
  top: calc(100% + 4px);
  left: 0;
  min-width: 190px;
  max-height: 280px;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-h);
  padding: 6px;
}
.msel-opt {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.msel-opt:hover {
  background: color-mix(in srgb, var(--primary) 8%, transparent);
}
.msel-opt input {
  width: auto;
  min-width: 0;
  margin: 0;
  box-shadow: none;
  accent-color: var(--primary);
  cursor: pointer;
}
.msel-todos {
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  margin-bottom: 4px;
  font-weight: 700;
}
.dupbanner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: color-mix(in srgb, var(--amber) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--amber) 35%, transparent);
  color: var(--text);
  border-radius: var(--r-md);
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 600;
}
.dup-lista {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 56vh;
  overflow: auto;
}
.dup-grupo {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.dup-head {
  background: var(--surface2);
  padding: 8px 12px;
  font-size: 12.5px;
  border-bottom: 1px solid var(--border);
}
.dup-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  font-size: 12.5px;
  border-bottom: 1px solid var(--border2);
}
.dup-item:last-child {
  border-bottom: none;
}
.dup-item.dup-keep {
  background: color-mix(in srgb, var(--green) 7%, transparent);
}
.dup-tag {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--green);
  background: color-mix(in srgb, var(--green) 14%, transparent);
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
}
