/* ---- filtros ---- */
.filters {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--surface);
  border: 1px solid var(--ring);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 16px;
  box-shadow: 0 1px 0 var(--ring), 0 6px 18px -14px rgba(0, 0, 0, 0.35);
}

.frow {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
}

.f {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.f label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

select,
input[type="date"],
input[type="time"],
input[type="number"],
input[type="search"] {
  background: var(--plane);
  color: var(--ink);
  border: 1px solid var(--axis);
  border-radius: 6px;
  padding: 6px 8px;
  font: inherit;
  font-size: 13px;
  min-width: 110px;
}

select[multiple] {
  min-height: 74px;
  min-width: 150px;
}

button {
  background: var(--surface);
  color: var(--ink2);
  border: 1px solid var(--axis);
  border-radius: 6px;
  padding: 7px 13px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  cursor: pointer;
}

button:hover {
  border-color: var(--acento);
  color: var(--brand);
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 6px;
  cursor: pointer;
}

.ico-sun {
  display: none;
}
.ico-moon {
  display: block;
}

:root[data-theme="dark"] .ico-sun {
  display: block;
}
:root[data-theme="dark"] .ico-moon {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .ico-sun {
    display: block;
  }
  :root:not([data-theme="light"]) .ico-moon {
    display: none;
  }
}

button.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--sobre-brand, #fff);
}

button.primary:hover {
  background: var(--brand-soft);
  border-color: var(--brand-soft);
  color: var(--sobre-brand, #fff);
  filter: brightness(1.05);
}

.seg button[aria-pressed="true"] {
  color: var(--sobre-brand, #fff);
}

.check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ink2);
  white-space: nowrap;
}

.seg {
  display: inline-flex;
  border: 1px solid var(--axis);
  border-radius: 6px;
  overflow: hidden;
}

.seg button {
  border: 0;
  border-radius: 0;
  padding: 6px 12px;
  background: var(--surface);
}

.seg button + button {
  border-left: 1px solid var(--axis);
}

.seg button[aria-pressed="true"] {
  background: var(--brand);
  border-color: var(--brand);
}

/* ---- KPIs ---- */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--ring);
  border-left: 3px solid var(--acento);
  border-radius: 10px;
  padding: 14px 16px;
}

.kpi .k {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kpi .v {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 2px;
  color: var(--brand);
}

.kpi .u {
  font-size: 11px;
  color: var(--muted);
}

/* ---- tabs ---- */
.tabs {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--grid);
  margin-bottom: 16px;
}

.tabs button {
  font-size: 12px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 9px 14px;
  color: var(--ink2);
  font-size: 13px;
}

.tabs button[aria-selected="true"] {
  color: var(--brand);
  border-bottom-color: var(--acento);
  font-weight: 700;
}

.tabs button:hover {
  color: var(--brand);
}

.panel[hidden] {
  display: none !important;
}

/* ---- tablas ---- */
.tbox {
  overflow: auto;
  max-height: 560px;
  border: 1px solid var(--ring);
  border-radius: 8px;
}

table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  font-size: 12.5px;
}

th,
td {
  padding: 7px 10px;
  text-align: right;
  white-space: nowrap;
  border-bottom: 1px solid var(--grid);
}

th:first-child,
td:first-child,
th.l,
td.l {
  text-align: left;
}

thead th {
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 2;
  color: var(--ink2);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  cursor: pointer;
  border-bottom: 1px solid var(--axis);
}

thead th:hover {
  color: var(--brand);
}

tbody tr:hover {
  background: var(--chip);
}

td.num {
  font-variant-numeric: tabular-nums;
}

.bar-cell {
  position: relative;
}

.bar-cell i {
  position: absolute;
  left: 0;
  top: 3px;
  bottom: 3px;
  background: color-mix(in srgb, var(--acento) 18%, transparent);
  border-radius: 0 3px 3px 0;
  z-index: 0;
}

.bar-cell span {
  position: relative;
  z-index: 1;
}

.tag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--ring);
  background: var(--chip);
  color: var(--ink2);
}

.tag.C {
  color: var(--s1t);
}

.tag.A {
  color: var(--s2t);
}

.tag.B {
  color: var(--s3t);
}

.flag {
  color: var(--crit);
  font-weight: 600;
}

.empty {
  padding: 28px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

/* ---- dropzone / carga de archivo ---- */
.dz {
  padding: 0;
}

.dz-in {
  text-align: center;
  padding: 56px 24px;
  border: 2px dashed var(--axis);
  border-radius: 10px;
  transition: border-color 0.15s, background 0.15s;
}

.dz-in.over {
  border-color: var(--acento);
  background: color-mix(in srgb, var(--acento) 8%, transparent);
}

.dz-in .note {
  max-width: 52ch;
}

.dz-ico {
  font-size: 34px;
  line-height: 1;
  color: var(--acento);
  margin-bottom: 10px;
}

.dz-in.busy {
  opacity: 0.6;
  pointer-events: none;
}

#dzMsg.err {
  color: var(--crit);
}
