:root {
  --ink: #283860;
  --muted: #6f7c91;
  --line: #d8e3ea;
  --panel: #ffffff;
  --soft: #f3f7fa;
  --soft-2: #edf4f7;
  --teal: #5090a8;
  --teal-dark: #407f97;
  --navy: #283860;
  --orange: #d58c27;
  --red: #c85662;
  --blue: #456a9b;
  --shadow: 0 10px 26px rgba(40, 56, 96, 0.08);
  --float-shadow: -7px 10px 22px rgba(31, 56, 93, 0.105), -2px 3px 6px rgba(31, 56, 93, 0.055);
  --float-shadow-soft: -4px 7px 15px rgba(31, 56, 93, 0.075), -1px 2px 4px rgba(31, 56, 93, 0.045);
  --dashboard-bottom-gap: 24px;
  --dashboard-panel-height: clamp(300px, calc(100vh - 462px), 458px);
  --admin-catalog-panel-height: clamp(390px, calc(100vh - 304px), 600px);
  --admin-hours-panel-height: clamp(560px, calc(100vh - 252px), 760px);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

[data-tooltip] {
  cursor: help;
}

html {
  min-width: 320px;
  height: 100%;
}

body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  color: var(--ink);
  background: #f5f8fa;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: min(1480px, calc(100% - 24px));
  height: 100vh;
  margin: 0 auto;
  padding: 8px 0;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 6px;
}

.admin-page .shell {
  grid-template-rows: auto auto minmax(0, 1fr);
}

.topbar {
  --session-control-height: 21px;
  --session-control-width: 118px;
  display: grid;
  grid-template-columns: minmax(205px, 0.5fr) minmax(380px, 500px) minmax(250px, 0.42fr);
  grid-template-rows: auto auto auto;
  align-items: center;
  column-gap: 10px;
  row-gap: 0;
  min-height: 88px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 10px 28px rgba(17, 38, 76, 0.06);
}

.brand {
  grid-column: 1;
  grid-row: 1 / span 2;
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  min-width: 0;
}

.brand-logo {
  display: block;
  width: 138px;
  height: 40px;
  object-fit: contain;
  object-position: left center;
  flex: 0 0 auto;
}

/* El nuevo logo ya incluye "HERMES" y el subtitulo: ocultamos el texto contiguo para no duplicarlo. */
.brand > span {
  display: none;
}

.session-user-actions {
  grid-column: 1;
  grid-row: 3;
  justify-self: start;
  align-self: start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: var(--session-control-height);
  max-width: 300px;
  min-width: 0;
  min-height: var(--session-control-height);
}

.session-user-actions[hidden] {
  display: none;
}

.admin-user-badge {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  width: 168px;
  max-width: 168px;
  height: var(--session-control-height);
  min-height: var(--session-control-height);
  margin-left: 0;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--navy);
  font-size: 0.55rem;
  font-weight: 900;
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-logout-button {
  flex: 0 0 auto;
  width: var(--session-control-width);
  height: var(--session-control-height);
  min-height: var(--session-control-height);
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--navy);
  cursor: pointer;
  font-size: 0.52rem;
  font-weight: 900;
  line-height: 1;
}

.session-logout-button:hover {
  border-color: rgba(60, 139, 169, 0.45);
  color: var(--teal-dark);
}

.session-logout-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.brand-mark {
  width: 34px;
  height: 34px;
  color: var(--teal);
  flex: 0 0 auto;
}

.brand-letter {
  position: relative;
  display: inline-block;
  width: 45px;
  height: 34px;
  color: var(--navy);
  border: 2px solid rgba(80, 144, 168, 0.72);
  border-radius: 9px;
  background: linear-gradient(145deg, #ffffff 0%, #edf7fa 100%);
  box-shadow: var(--float-shadow-soft);
}

.brand-letter span {
  position: absolute;
  top: 50%;
  left: 6px;
  transform: translateY(-53%);
  color: var(--navy);
  font-size: 1.05rem;
  font-weight: 950;
  line-height: 1;
}

.brand-letter i {
  position: absolute;
  right: 4px;
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: var(--teal);
}

.brand-letter i:nth-of-type(1) {
  top: 9px;
}

.brand-letter i:nth-of-type(2) {
  top: 15px;
}

.brand-letter i:nth-of-type(3) {
  top: 21px;
}

.brand strong {
  display: block;
  font-size: 1.16rem;
  line-height: 1;
  font-weight: 850;
}

.brand small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: normal;
}

.timebox {
  grid-column: 2;
  grid-row: 1 / span 3;
  align-self: center;
  display: grid;
  grid-template-rows: auto auto;
  align-content: center;
  gap: 0;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: none;
  width: 100%;
  min-width: 0;
  position: relative;
  overflow: visible;
}

.filter-main {
  display: grid;
  grid-template-columns: auto minmax(84px, 116px) minmax(84px, 116px) minmax(72px, 92px);
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 0;
  min-height: 0;
  width: 100%;
}

.timebox .segmented {
  flex: 0 0 auto;
}

.timebox label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  min-width: 0;
}

.timebox span {
  color: var(--muted);
  font-size: 0.61rem;
  font-weight: 900;
  text-transform: uppercase;
}

.timebox select,
.timebox button {
  height: 20px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  font-size: 0.74rem;
}

.timebox select {
  min-width: 84px;
  padding: 0 24px 0 9px;
}

.timebox .study-filter {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  width: min(100%, 610px);
  justify-self: center;
  min-width: 0;
}

.timebox .catalog-filter-row {
  display: grid;
  grid-template-columns: minmax(80px, 105px) minmax(105px, 145px) minmax(112px, 150px) minmax(230px, 1fr);
  align-items: center;
  align-self: center;
  gap: 7px;
  width: min(100%, 700px);
  justify-self: center;
  min-width: 0;
  max-height: 0;
  min-height: 0;
  margin-top: 0;
  padding: 0 2px;
  border: 0;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-3px);
  transition: max-height 220ms ease, opacity 160ms ease, transform 180ms ease, padding-top 180ms ease, visibility 160ms ease;
}

.timebox.filters-expanded .catalog-filter-row {
  max-height: 52px;
  padding-top: 8px;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.timebox.filters-expanded .catalog-filter-row:has(.study-combobox.open) {
  align-items: start;
  max-height: 390px;
  overflow: visible;
}

.timebox .catalog-filter-row label {
  min-width: 0;
}

.timebox .catalog-filter-row select {
  width: 100%;
  min-width: 0;
}

.timebox .catalog-filter-row .study-filter {
  width: 100%;
  justify-self: stretch;
}

.timebox .study-combobox {
  position: relative;
  min-width: 0;
}

.timebox .study-combobox-toggle {
  width: 100%;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 28px 0 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.74rem;
  font-weight: 800;
  text-align: left;
  position: relative;
}

.timebox .study-combobox-toggle::after {
  content: "";
  position: absolute;
  right: 10px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-60%) rotate(45deg);
  opacity: 0.7;
}

.timebox .study-combobox-toggle span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.timebox .study-combobox.open .study-combobox-toggle {
  border-color: var(--teal);
  box-shadow: 0 0 0 2px rgba(92, 163, 189, 0.14);
}

.timebox .study-combobox-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  left: auto;
  z-index: 30;
  width: min(620px, calc(100vw - 32px));
  min-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 32px rgba(18, 43, 81, 0.14);
  overflow: hidden;
}

.timebox .study-combobox.open .study-combobox-menu {
  position: static;
  width: 100%;
  margin-top: 4px;
}

.timebox .study-combobox-search-row {
  padding: 6px;
  border-bottom: 1px solid rgba(151, 190, 211, 0.35);
  background: #f8fbfe;
}

.timebox .study-search {
  width: 100%;
  min-width: 0;
  height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.74rem;
  font-weight: 700;
}

.timebox .study-search::placeholder {
  color: var(--muted);
  font-weight: 600;
}

.timebox .study-combobox-options {
  max-height: 240px;
  overflow: auto;
}

.timebox .study-option {
  width: 100%;
  height: auto;
  min-height: 42px;
  display: grid;
  gap: 1px;
  padding: 8px 12px;
  border: 0;
  border-bottom: 1px solid rgba(151, 190, 211, 0.18);
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.timebox .study-option:last-child {
  border-bottom: 0;
}

.timebox .study-option:hover,
.timebox .study-option.active {
  background: #eef7fb;
}

.timebox .study-option-label {
  font-size: 0.74rem;
  font-weight: 800;
  line-height: 1.25;
  white-space: normal;
  overflow-wrap: anywhere;
}

.timebox .study-option-code {
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--muted);
  line-height: 1.1;
}

.timebox .study-option-empty {
  padding: 8px 9px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
}

.timebox button {
  padding: 0 9px;
  color: var(--teal-dark);
  background: #e9fbfa;
}

.timebox .filter-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 78px;
  padding: 0 22px 0 10px;
  position: relative;
  font-size: 0.68rem;
  white-space: nowrap;
}

.timebox .filter-toggle::after {
  content: "";
  position: absolute;
  right: 9px;
  top: 50%;
  width: 6px;
  height: 6px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-65%) rotate(45deg);
  transition: transform 160ms ease;
}

.timebox.filters-expanded .filter-toggle::after {
  transform: translateY(-35%) rotate(225deg);
}

.timebox .filter-toggle.has-active-filters::before {
  content: attr(data-count);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  color: #fff;
  background: var(--teal);
  font-size: 0.5rem;
  font-weight: 950;
}

.client-mark {
  grid-column: 3;
  grid-row: 1 / span 3;
  align-self: center;
  justify-self: end;
  min-width: 0;
  display: grid;
  grid-template-columns: auto;
  grid-template-rows: auto;
  column-gap: 8px;
  align-items: center;
  justify-content: end;
  justify-items: end;
  max-width: 250px;
}

.client-actions {
  position: relative;
  display: grid;
  align-items: center;
  justify-items: stretch;
  min-width: 0;
  width: 100%;
}

.report-menu-toggle,
.insights-button {
  width: 100%;
  min-width: 0;
  height: 20px;
  padding: 0 22px 0 8px;
  border: 1px solid rgba(73, 149, 169, 0.35);
  border-radius: 999px;
  color: var(--teal-dark);
  background: #e9fbfa;
  font-size: clamp(0.52rem, 0.58vw, 0.58rem);
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 5px 16px rgba(17, 38, 76, 0.08);
}

.report-menu-toggle {
  position: relative;
  text-align: left;
}

.report-menu-toggle::after {
  content: "";
  position: absolute;
  right: 9px;
  top: 50%;
  width: 6px;
  height: 6px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-65%) rotate(45deg);
}

.client-actions.report-menu-open .report-menu-toggle::after {
  transform: translateY(-35%) rotate(225deg);
}

.report-menu {
  position: absolute;
  top: calc(100% + 5px);
  right: 0;
  z-index: 70;
  display: grid;
  gap: 4px;
  width: max(112px, 100%);
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 30px rgba(17, 38, 76, 0.14);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 150ms ease, transform 160ms ease, visibility 150ms ease;
}

.client-actions.report-menu-open .report-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.report-menu .insights-button {
  height: 24px;
  padding: 0 8px;
  box-shadow: none;
  text-align: center;
}

.report-menu-toggle:hover,
.insights-button:hover {
  color: #fff;
  background: var(--teal);
}

.admin-insights-placeholder {
  visibility: hidden;
  pointer-events: none;
}

.client-logo {
  grid-column: 1;
  grid-row: 1;
  display: block;
  width: 128px;
  height: 24px;
  object-fit: contain;
  border: 0;
  background: transparent;
}

.panel-tabs {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 6px;
  height: 40px;
  max-height: 40px;
  margin: 0;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  overflow: hidden;
}

.panel-tabs a {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  color: #354a67;
  text-decoration: none;
  font-size: 0.74rem;
  font-weight: 850;
  white-space: nowrap;
  transform: translateX(0) scaleX(1);
  transform-origin: center;
  transition:
    flex-basis 360ms cubic-bezier(0.2, 0.8, 0.2, 1),
    flex-grow 360ms cubic-bezier(0.2, 0.8, 0.2, 1),
    min-width 360ms cubic-bezier(0.2, 0.8, 0.2, 1),
    transform 360ms cubic-bezier(0.2, 0.8, 0.2, 1),
    background-color 200ms ease,
    color 200ms ease;
}

.panel-tabs a.active {
  color: #fff;
  background: var(--navy);
}

.panel-tabs a[aria-disabled="true"] {
  color: #9aa8b7;
}

/* Etiquetas de estado en las pestanas: (beta) (new) (prox) */
.tab-tag {
  margin-left: 4px;
  font-size: 0.7em;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.cartera-hint {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
}

.tab-tag-beta { color: #e2892f; }
.tab-tag-new { color: #21a866; }
.tab-tag-prox { color: #93a3b5; }

.panel-tabs a.active .tab-tag-beta { color: #f4b667; }
.panel-tabs a.active .tab-tag-new { color: #6fe3a6; }
.panel-tabs a.active .tab-tag-prox { color: #c3d0dd; }

.panel-tabs.admin-nav-expanded a {
  flex: 0.78 1 0;
  min-width: 58px;
}

.panel-tabs.admin-nav-expanded a.active {
  flex: 0.92 1 0;
  min-width: 86px;
}

.panel-tabs.admin-nav-expanded .admin-module-tabs {
  flex: 1.72 1 360px;
  min-width: 330px;
}

.panel-tabs.admin-nav-expanded:not(.admin-nav-ready) a {
  flex: 1 1 0;
  min-width: 72px;
}

.panel-tabs.admin-nav-expanded:not(.admin-nav-ready) .admin-module-tabs {
  flex: 0.0001 1 0;
  min-width: 0;
  padding: 0;
  border-width: 0;
  opacity: 0;
  transform: translateX(18px) scaleX(0.94);
  pointer-events: none;
}

.panel-tabs.admin-nav-closing a {
  flex: 1 1 0;
  min-width: 72px;
  transform: translateX(0) scaleX(1);
}

.panel-tabs.admin-nav-closing .admin-module-tabs {
  flex: 0.0001 1 0;
  min-width: 0;
  padding: 0;
  border-width: 0;
  opacity: 0;
  transform: translateX(18px) scaleX(0.94);
  pointer-events: none;
}

.segmented {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.segmented button {
  min-width: 56px;
  height: 30px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-size: 0.78rem;
  font-weight: 850;
}

.segmented button.active {
  color: #fff;
  background: var(--teal-dark);
}

.status {
  grid-column: 1 / -1;
  grid-row: 1;
  justify-self: end;
  max-width: 146px;
  min-height: 17px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--navy);
  background: #fff;
  font-size: 0.52rem;
  font-weight: 900;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar .status {
  display: none;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(120px, 1fr));
  gap: 8px;
  margin: 0;
}

.kpi {
  min-height: 82px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--float-shadow);
  overflow: hidden;
  cursor: help;
}

.kpi .label {
  color: #39506d;
  font-size: 0.66rem;
  font-weight: 900;
}

.kpi .value {
  margin-top: 9px;
  color: var(--ink);
  font-size: clamp(1.15rem, 1.35vw, 1.62rem);
  line-height: 1;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.kpi.accent .value {
  color: var(--teal-dark);
}

.kpi.warn .value {
  color: var(--orange);
}

.kpi .sub {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 800;
}

.spark {
  display: block;
  width: 100%;
  height: 24px;
  margin-top: 8px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.18fr 1.08fr 0.82fr;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: stretch;
  min-height: 0;
}

.general-grid {
  grid-template-columns: minmax(0, 1.56fr) minmax(340px, 0.66fr);
  grid-template-rows: auto;
  align-content: start;
  height: calc(100% - var(--dashboard-bottom-gap));
  max-height: calc(100% - var(--dashboard-bottom-gap));
  overflow: hidden;
}

.general-main,
.general-side-column,
.general-side {
  min-width: 0;
  min-height: 0;
}

.general-main {
  align-self: start;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100%;
  max-height: 100%;
  overflow: hidden;
}

.general-side-column {
  display: grid;
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: 3px;
  height: 100%;
  max-height: 100%;
  align-content: stretch;
}

.general-side {
  padding: 6px 7px;
  align-self: start;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
}

.general-side .report-head {
  gap: 6px;
  margin-bottom: 3px;
}

.general-side .report-head span {
  font-size: 0.58rem;
}

.general-side h2 {
  font-size: 0.84rem;
}

.studies-grid {
  grid-template-columns: 1fr;
  grid-template-rows: auto;
  align-content: start;
  height: var(--dashboard-panel-height);
  max-height: var(--dashboard-panel-height);
  overflow: hidden;
}

.base-quality-grid {
  grid-template-columns: 1fr;
  grid-template-rows: auto;
  align-content: start;
  height: var(--dashboard-panel-height);
  max-height: var(--dashboard-panel-height);
  overflow: hidden;
}

.agents-grid {
  grid-template-columns: minmax(310px, 0.88fr) minmax(430px, 1fr) minmax(260px, 0.68fr);
  grid-template-rows: minmax(0, 1fr);
  align-content: start;
  align-items: stretch;
  height: var(--dashboard-panel-height);
  max-height: var(--dashboard-panel-height);
  min-height: 0;
  overflow: hidden;
}

.agents-grid.has-evolution {
  grid-template-rows: auto minmax(0, 1fr);
}

.agents-grid.has-evolution .agents-cluster-report,
.agents-grid.has-evolution .agents-ranking-report,
.agents-grid.has-evolution .agents-profile-report {
  height: calc(var(--dashboard-panel-height) - 154px);
  max-height: calc(var(--dashboard-panel-height) - 154px);
}

.agent-evolution-report {
  grid-column: 1 / -1;
  padding: 6px 8px;
  align-self: start;
  max-height: 148px;
  overflow: hidden;
}

.agent-evolution-report .report-head {
  margin-bottom: 5px;
}

.agent-evolution-report .agents-metric-grid {
  grid-template-columns: repeat(6, minmax(118px, 1fr));
  gap: 5px;
}

.agent-evolution-report .metric-chart {
  padding: 4px 6px;
}

.agent-evolution-report .metric-title {
  margin-bottom: 1px;
}

.agent-evolution-report .metric-title strong {
  font-size: 0.66rem;
}

.agent-evolution-report .metric-chart svg {
  display: block;
  width: 100%;
  height: 42px;
}

.agent-evolution-report .chart-legend {
  margin-top: 4px;
}

.report {
  min-width: 0;
  min-height: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--float-shadow);
  overflow: hidden;
}

.report-wide {
  grid-column: span 2;
}

.report-full {
  grid-column: 1 / -1;
}

.report-tall {
  min-height: 0;
  grid-row: span 2;
}

.report-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.report-head span {
  display: block;
  color: var(--teal-dark);
  font-size: 0.64rem;
  font-weight: 950;
  text-transform: uppercase;
}

.report h1,
.report h2 {
  margin: 4px 0 0;
  color: var(--ink);
  line-height: 1.1;
  font-weight: 900;
}

.report h1 {
  font-size: 1.12rem;
}

.report h2 {
  font-size: 1rem;
}

.report-kicker {
  align-self: center;
  padding: 2px 7px;
  border: 1px solid #d9e7f0;
  border-radius: 999px;
  color: var(--navy);
  background: #f8fbfd;
  font-size: 0.57rem;
  font-weight: 950;
  white-space: nowrap;
}

.general-side .report-kicker {
  padding: 1px 6px;
  font-size: 0.54rem;
}

.report-actions {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f6fafc;
}

.report-actions button {
  height: 24px;
  padding: 0 8px;
  border: 0;
  border-radius: 5px;
  color: var(--muted);
  background: transparent;
  font-size: 0.66rem;
  font-weight: 900;
}

.report-actions button.active {
  color: #fff;
  background: var(--navy);
}

.chart {
  width: 100%;
  min-height: 0;
}

.general-main > .chart {
  height: 100%;
  overflow-x: hidden;
  overflow-y: hidden;
  padding-right: 0;
}

.general-main .metric-grid {
  height: calc(100% - 18px);
  grid-template-columns: repeat(4, minmax(118px, 1fr));
  grid-auto-rows: minmax(0, 1fr);
  gap: 6px;
}

.general-main .metric-chart {
  min-height: 0;
  padding: 5px 6px;
  border-radius: 7px;
  overflow: hidden;
}

.general-main .metric-title {
  gap: 6px;
  margin-bottom: 1px;
}

.general-main .metric-title strong {
  max-height: 2.2em;
  overflow: hidden;
  font-size: 0.62rem;
  line-height: 1.08;
}

.general-main .metric-title span {
  font-size: 0.6rem;
}

.general-main .chart svg {
  height: 54px;
}

.general-main .chart-legend {
  height: 14px;
  margin-top: 4px;
  gap: 10px;
  overflow: hidden;
  font-size: 0.56rem;
  line-height: 1;
  white-space: nowrap;
}

.general-main .chart-legend span::before {
  width: 12px;
  margin-right: 4px;
}

.chart svg {
  display: block;
  width: 100%;
  height: 82px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 8px;
}

.agents-metric-grid {
  grid-template-columns: repeat(2, minmax(150px, 1fr));
}

.agents-grid .metric-chart {
  padding: 6px 7px;
}

.agents-grid .chart svg {
  height: 66px;
}

.agents-cluster-report,
.agents-ranking-report,
.agents-profile-report {
  align-self: start;
  height: var(--dashboard-panel-height);
  max-height: var(--dashboard-panel-height);
  padding: 10px;
  overflow: hidden;
}

.agents-cluster-report .report-head,
.agents-ranking-report .report-head,
.agents-profile-report .report-head {
  gap: 6px;
  margin-bottom: 6px;
}

.agents-cluster-report .report-head span,
.agents-ranking-report .report-head span,
.agents-profile-report .report-head span {
  font-size: 0.58rem;
}

.agents-cluster-report h1,
.agents-ranking-report h2,
.agents-profile-report h2 {
  margin-top: 2px;
  font-size: 0.92rem;
}

.metric-chart {
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid #e8f0f6;
  border-radius: 8px;
  background: #fbfdff;
  box-shadow: var(--float-shadow-soft);
  cursor: help;
}

.metric-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 3px;
}

.metric-title strong {
  color: #243b59;
  font-size: 0.72rem;
  font-weight: 950;
}

.metric-title span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.metric-chart.single-value {
  display: flex;
  flex-direction: column;
}

.single-metric-body {
  display: flex;
  min-height: 82px;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.single-metric-value {
  color: var(--teal-dark);
  font-size: clamp(1.6rem, 2.35vw, 2.55rem);
  line-height: 0.95;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.metric-chart.single-value.warn .single-metric-value {
  color: var(--orange);
}

.single-metric-sub,
.single-metric-previous {
  color: var(--muted);
  font-size: 0.63rem;
  font-weight: 850;
}

.single-metric-previous {
  color: #536983;
}

.agent-evolution-report .single-metric-body {
  min-height: 56px;
}

.agent-evolution-report .single-metric-value {
  font-size: clamp(1.15rem, 1.55vw, 1.65rem);
}

.axis {
  stroke: #d7e2ec;
  stroke-width: 1;
}

.area {
  fill: rgba(16, 170, 164, 0.18);
}

.line-main {
  fill: none;
  stroke: var(--teal);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.line-alt {
  fill: none;
  stroke: var(--orange);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.line-prev {
  fill: none;
  stroke: #9aa9b7;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 7 6;
  opacity: 0.82;
}

.chart-legend {
  display: flex;
  gap: 14px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 850;
}

.chart-legend span::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 3px;
  margin-right: 5px;
  border-radius: 999px;
  background: var(--teal);
  vertical-align: middle;
}

.chart-legend span:last-child::before {
  background: transparent;
  border-top: 3px dashed #9aa9b7;
}

.load-jobs {
  display: grid;
  gap: 4px;
  margin-top: 4px;
  max-height: 52px;
  overflow-y: auto;
  padding-right: 2px;
}

.load-jobs:empty,
.pulse-trend-grid:empty {
  display: none;
}

.load-job {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 5px 6px;
  border: 1px solid #e8f0f6;
  border-radius: 8px;
  background: #fbfdff;
  box-shadow: var(--float-shadow-soft);
}

.load-job strong,
.load-job span,
.load-job small {
  display: block;
}

.load-job strong {
  color: var(--ink);
  font-size: 0.62rem;
  font-weight: 950;
}

.load-job span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.52rem;
  font-weight: 850;
}

.load-job small {
  color: var(--muted);
  font-size: 0.5rem;
  font-weight: 900;
  text-align: right;
}

.load-job.ok small {
  color: var(--teal-dark);
}

.load-job.warn small {
  color: var(--orange);
}

.load-job.danger small {
  color: var(--red);
}

.pulse-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px;
}

.pulse-card {
  min-width: 0;
  padding: 4px 5px;
  border: 1px solid #e8f0f6;
  border-radius: 8px;
  background: #fbfdff;
  box-shadow: var(--float-shadow-soft);
}

.pulse-card strong {
  color: var(--ink);
  display: block;
  font-size: 0.54rem;
  font-weight: 950;
  line-height: 1;
}

.pulse-card-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 6px;
  margin-top: 3px;
}

.pulse-card span {
  display: block;
  color: var(--teal-dark);
  font-size: 0.9rem;
  font-weight: 950;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.pulse-card.warn span {
  color: var(--orange);
}

.pulse-card small {
  display: block;
  color: var(--muted);
  font-size: 0.45rem;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  text-align: right;
}

.pulse-trend-grid {
  display: none;
}

.pulse-trend {
  min-width: 0;
  padding: 5px 6px;
  border: 1px solid #e8f0f6;
  border-radius: 8px;
  background: #fbfdff;
  box-shadow: var(--float-shadow-soft);
  cursor: help;
}

.pulse-trend-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 2px;
}

.pulse-trend-head strong {
  color: #243b59;
  font-size: 0.58rem;
  font-weight: 950;
}

.pulse-trend-head span {
  color: var(--muted);
  font-size: 0.54rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.pulse-trend svg {
  display: block;
  width: 100%;
  height: 46px;
}

.pulse-trend .area {
  fill: rgba(16, 170, 164, 0.16);
}

.pulse-trend .line-main {
  stroke-width: 3;
}

.heatmap-wrap {
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  max-height: 76px;
}

.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 2px;
}

.heat-cell {
  position: relative;
  min-width: 0;
  min-height: 30px;
  padding: 2px 1px;
  border: 1px solid #d9e7f0;
  border-radius: 7px;
  background: #f7fbfd;
  box-shadow: var(--float-shadow-soft);
  text-align: center;
}

.heat-cell.milestone {
  border-color: rgba(217, 136, 23, 0.45);
}

.heat-cell strong,
.heat-cell span,
.heat-cell small {
  display: block;
}

.heat-cell strong {
  color: var(--ink);
  font-size: 0.4rem;
  font-weight: 950;
}

.heat-cell span {
  margin-top: 2px;
  color: #233b59;
  font-size: 0.64rem;
  font-weight: 950;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.dot-main {
  fill: var(--teal);
}

.chart-label {
  fill: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.chart-hitbox {
  fill: transparent;
  pointer-events: all;
}

.chart-focus-line,
.chart-focus-dot {
  opacity: 0;
  transition: opacity 120ms ease;
  pointer-events: none;
}

.chart-hover-band:hover .chart-focus-line,
.chart-hover-band:hover .chart-focus-dot {
  opacity: 1;
}

.chart-focus-line {
  stroke: #c1d6e1;
  stroke-width: 1.5;
  stroke-dasharray: 4 4;
}

.chart-focus-dot {
  fill: #ffffff;
  stroke-width: 3;
}

.chart-focus-dot.main {
  stroke: var(--teal);
}

.chart-focus-dot.warn {
  stroke: var(--orange);
}

.chart-focus-dot.prev {
  stroke: #9aa9b7;
  stroke-width: 2.5;
}

.help-tooltip {
  position: fixed;
  z-index: 1000;
  width: min(360px, calc(100vw - 28px));
  padding: 10px 12px;
  border: 1px solid #cbdde8;
  border-radius: 8px;
  color: #26395d;
  background: #ffffff;
  box-shadow: 0 16px 38px rgba(40, 56, 96, 0.16);
  font-size: 0.72rem;
  font-weight: 750;
  line-height: 1.36;
  white-space: pre-line;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 120ms ease, transform 120ms ease;
}

.help-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

.legend {
  display: flex;
  gap: 16px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.rank-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f6fafc;
}

.rank-tabs button {
  height: 24px;
  padding: 0 7px;
  border: 0;
  border-radius: 5px;
  color: var(--muted);
  background: transparent;
  font-size: 0.64rem;
  font-weight: 900;
}

.rank-tabs button.active {
  color: #fff;
  background: var(--navy);
}

.rank-table-wrap {
  height: calc(100% - 55px);
  max-height: calc(100% - 55px);
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid #e1edf2;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--float-shadow-soft);
}

.rank-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.rank-table th,
.rank-table td {
  height: 17px;
  padding: 1px 3px;
  border-bottom: 1px solid #e8f0f6;
  color: #263b5c;
  font-size: 0.62rem;
  line-height: 1;
}

.rank-table tbody tr {
  cursor: pointer;
}

.rank-table tbody tr:hover,
.rank-table tbody tr.selected {
  background: #f0f7fa;
}

.rank-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: var(--muted);
  background: #fff;
  font-size: 0.6rem;
  font-weight: 950;
  text-transform: uppercase;
}

.rank-table th button {
  width: 100%;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  text-align: inherit;
  text-transform: inherit;
}

.rank-table th button.active {
  color: var(--navy);
}

.rank-table th:first-child,
.rank-table td.rank {
  width: 24px;
  text-align: right;
}

.rank-table th:nth-child(2) {
  width: 27%;
}

.rank-table th:nth-child(8) {
  width: 52px;
}

.rank-table th:nth-child(9) {
  width: 86px;
}

.rank-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.score {
  font-weight: 950;
}

.score.ok {
  color: var(--teal-dark);
}

.score.watch {
  color: var(--orange);
}

.score.risk {
  color: var(--red);
}

.state-pill {
  display: inline-block;
  max-width: 100%;
  padding: 2px 4px;
  border-radius: 6px;
  color: var(--teal-dark);
  background: #e8f6f6;
  font-size: 0.54rem;
  font-weight: 950;
  white-space: nowrap;
}

.state-pill.watch {
  color: #9b641b;
  background: #fff3df;
}

.state-pill.risk {
  color: #a6424c;
  background: #fdecef;
}

.state-pill.ok {
  color: var(--teal-dark);
  background: #e8f6f6;
}

.state-pill.warn {
  color: #9b641b;
  background: #fff3df;
}

.state-pill.danger {
  color: #a6424c;
  background: #fdecef;
}

.studies-table-report {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 6px;
  align-self: start;
  height: var(--dashboard-panel-height);
  max-height: var(--dashboard-panel-height);
  padding: 10px;
  overflow: hidden;
}

.base-quality-report {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 6px;
  align-self: start;
  height: var(--dashboard-panel-height);
  max-height: var(--dashboard-panel-height);
  padding: 10px;
  overflow: hidden;
}

.quality-layout {
  display: grid;
  grid-template-columns: minmax(210px, 0.28fr) minmax(0, 1fr);
  gap: 7px;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
}

.quality-summary {
  min-height: 0;
  padding: 7px;
  border: 1px solid #e1edf2;
  border-radius: 8px;
  background: #f8fbfd;
  box-shadow: var(--float-shadow-soft);
  overflow: hidden;
}

.quality-summary h2 {
  margin: 0 0 5px;
  color: var(--ink);
  font-size: 0.72rem;
}

.quality-summary-grid {
  display: grid;
  gap: 5px;
}

.quality-summary-card {
  padding: 5px 6px;
  border: 1px solid #dceaf0;
  border-radius: 8px;
  background: #fff;
}

.quality-summary-card span,
.quality-summary-card em {
  display: block;
  color: var(--muted);
  font-size: 0.48rem;
  font-weight: 900;
  font-style: normal;
  text-transform: uppercase;
}

.quality-summary-card strong {
  display: block;
  margin: 2px 0 1px;
  color: var(--navy);
  font-size: 0.66rem;
  line-height: 1.1;
  font-weight: 950;
}

.base-table-wrap {
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}

.base-quality-report .study-table th,
.base-quality-report .study-table td {
  height: 23px;
  padding: 2px 5px;
  font-size: 0.56rem;
}

.studies-table-report .report-head,
.base-quality-report .report-head {
  gap: 6px;
  margin-bottom: 5px;
}

.studies-table-report .report-head span,
.base-quality-report .report-head span {
  font-size: 0.58rem;
}

.studies-table-report h1,
.base-quality-report h1 {
  margin-top: 2px;
  font-size: 0.92rem;
}

.base-table th:first-child {
  width: 24%;
}

.base-table th:nth-child(2) {
  width: 92px;
}

.base-table th:nth-child(n + 3) {
  text-align: right;
}

.study-signal-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 5px;
}

.study-signal {
  min-width: 0;
  padding: 5px 7px;
  border: 1px solid #dceaf0;
  border-radius: 8px;
  background: #f6fafc;
  box-shadow: var(--float-shadow-soft);
}

.study-signal strong {
  display: block;
  color: var(--navy);
  font-size: 0.82rem;
  line-height: 1;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.study-signal span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.6rem;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.study-signal.ok strong {
  color: var(--teal-dark);
}

.study-signal.warn strong {
  color: var(--orange);
}

.study-signal.danger strong {
  color: var(--red);
}

/* HERMES table standard.
   Use hermes-data-table-wrap + hermes-data-table for operational tables:
   fixed header, vertical scroll, no horizontal scroll by default, keyboard
   navigation/selection when the JS module supplies it, sortable headers and
   optional column resize handles. Existing study-table classes are kept as
   aliases while the rest of the CM is migrated. */
.hermes-data-table-wrap,
.study-table-wrap {
  min-height: 0;
  overflow: auto;
  border: 1px solid #e1edf2;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--float-shadow-soft);
}

.studies-table-report .study-table-wrap {
  height: 100%;
  max-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}

.studies-table-report .study-table th,
.studies-table-report .study-table td {
  height: 23px;
  padding: 2px 5px;
  font-size: 0.56rem;
}

.hermes-data-table,
.study-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.hermes-data-table th,
.hermes-data-table td,
.study-table th,
.study-table td {
  height: 34px;
  padding: 5px 7px;
  border-bottom: 1px solid #e8f0f6;
  color: #263b5c;
  font-size: 0.68rem;
  line-height: 1.12;
  vertical-align: middle;
}

.hermes-data-table th,
.study-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 28px;
  color: var(--muted);
  background: #fff;
  font-size: 0.59rem;
  font-weight: 950;
  text-transform: uppercase;
}

.hermes-data-table th button,
.study-table th button {
  width: 100%;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  text-align: inherit;
  text-transform: inherit;
}

.hermes-data-table th button.active,
.study-table th button.active {
  color: var(--navy);
}

.hermes-data-table tbody tr:hover,
.study-table tbody tr:hover {
  background: #f5fafc;
}

.study-table th:first-child {
  width: 25%;
}

.study-table th:nth-child(2) {
  width: 86px;
}

.study-table th:nth-child(5) {
  width: 90px;
}

.study-table th:nth-child(n + 3) {
  text-align: right;
}

.study-table td.num {
  text-align: right;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.admin-filter-row {
  width: 100%;
  justify-content: center;
}

.admin-channel-origin button:disabled {
  cursor: default;
  opacity: 0.72;
}

.timebox .admin-search-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  width: min(100%, 610px);
  justify-self: center;
  min-width: 0;
}

.timebox .admin-search-row input {
  width: 100%;
  min-width: 0;
  height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.74rem;
  font-weight: 800;
}

.admin-kpi-grid {
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 6px;
}

.admin-kpi-grid .kpi {
  min-height: 36px;
  padding: 4px 8px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "value label"
    "value delta";
  align-items: center;
  column-gap: 8px;
  text-align: left;
  cursor: pointer;
}

.admin-kpi-grid .kpi:hover,
.admin-kpi-grid .kpi.active {
  border-color: rgba(80, 144, 168, 0.52);
  background: #eef8fb;
}

.admin-kpi-grid .kpi.active {
  box-shadow: inset 4px 0 0 var(--teal), var(--float-shadow-soft);
}

.admin-kpi-grid .kpi .label {
  grid-area: label;
  align-self: end;
  font-size: 0.56rem;
  line-height: 1.05;
}

.admin-kpi-grid .kpi .value {
  grid-area: value;
  margin: 0;
  min-width: 34px;
  font-size: clamp(0.98rem, 1.08vw, 1.22rem);
  line-height: 1;
}

.admin-kpi-grid .kpi .delta {
  grid-area: delta;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.54rem;
  font-weight: 800;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-filter-kpi {
  appearance: none;
  font: inherit;
}

.admin-module-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  padding: 2px 6px 2px 44px;
  border: 1px solid rgba(80, 144, 168, 0.34);
  border-radius: 7px;
  background: linear-gradient(180deg, rgba(232, 247, 250, 0.82), rgba(248, 252, 253, 0.92));
  opacity: 1;
  transform: translateX(0);
  transform-origin: right center;
  position: relative;
  transition:
    flex-basis 360ms cubic-bezier(0.2, 0.8, 0.2, 1),
    flex-grow 360ms cubic-bezier(0.2, 0.8, 0.2, 1),
    min-width 360ms cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity 220ms ease,
    transform 360ms cubic-bezier(0.2, 0.8, 0.2, 1),
    padding 360ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.admin-module-tabs::before {
  content: "Admin";
  position: absolute;
  left: 7px;
  top: 50%;
  width: 30px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translateY(-50%);
  transform-origin: center;
  border-radius: 999px;
  background: rgba(80, 144, 168, 0.14);
  color: var(--teal-dark);
  font-size: 0.48rem;
  font-weight: 950;
  letter-spacing: 0;
  opacity: 0.78;
}

.admin-module-tabs button {
  flex: 1 1 0;
  min-width: 0;
  height: 22px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.9);
  font: inherit;
  font-size: 0.68rem;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition:
    flex-basis 360ms cubic-bezier(0.2, 0.8, 0.2, 1),
    flex-grow 360ms cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity 220ms ease,
    transform 360ms cubic-bezier(0.2, 0.8, 0.2, 1),
    background-color 200ms ease,
    border-color 200ms ease,
    color 200ms ease;
}

.admin-module-tabs button.active {
  border-color: rgba(80, 144, 168, 0.75);
  color: var(--teal-dark);
  background: #dff4f8;
  box-shadow: inset 0 0 0 1px rgba(80, 144, 168, 0.1);
}

.admin-module-tabs button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}
 
.admin-preview-bar {
  align-items: center;
  align-self: end;
  grid-row: 3;
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 3px;
  max-width: calc(var(--session-control-width) + 25px);
  height: var(--session-control-height);
  min-width: 0;
  overflow: hidden;
  transform: none;
}

.admin-preview-bar > span {
  color: var(--teal-dark);
  font-size: 0.5rem;
  font-weight: 950;
  flex: 0 0 auto;
  max-width: 22px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-preview-bar label {
  align-items: center;
  flex: 0 1 auto;
  display: flex;
  gap: 3px;
  margin: 0;
  min-width: 0;
}

.admin-preview-bar label span {
  display: none;
}

.admin-preview-bar select {
  width: var(--session-control-width);
  min-width: var(--session-control-width);
  max-width: var(--session-control-width);
  height: var(--session-control-height);
  min-height: var(--session-control-height);
  padding: 0 18px 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--navy);
  font-size: 0.52rem;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  text-align-last: center;
}

#adminPreviewUser {
  max-width: var(--session-control-width);
}

.admin-preview-bar button {
  flex: 0 0 auto;
  height: 21px;
  min-height: 21px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--navy);
  cursor: pointer;
  font-size: 0.54rem;
  font-weight: 900;
}

.admin-interviewer-view .shell {
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
  padding: 8px 0;
}

.admin-interviewer-view .topbar,
.admin-interviewer-view .panel-tabs,
.admin-interviewer-view .admin-km-tabs,
.admin-interviewer-view [data-admin-view="clasificacion"] {
  display: none;
}

.admin-interviewer-view .admin-km-grid {
  grid-template-rows: 44px minmax(0, 1fr);
  gap: 6px;
}

.admin-interviewer-view .admin-km-entry {
  grid-row: 2;
}

.admin-interviewer-header {
  align-items: center;
  display: none;
  grid-row: 1;
  grid-column: 1 / -1;
  justify-content: space-between;
  min-height: 44px;
}

.admin-interviewer-view .admin-interviewer-header {
  display: flex;
}

.admin-interviewer-brand {
  align-items: center;
  display: inline-flex;
  gap: 10px;
  color: var(--ink);
}

.admin-interviewer-logo {
  display: block;
  width: 132px;
  height: 40px;
  object-fit: contain;
  object-position: left center;
  flex: 0 0 auto;
}

/* El nuevo logo ya incluye el nombre; ocultamos el texto contiguo del entrevistador. */
.admin-interviewer-brand > span {
  display: none;
}

.admin-interviewer-brand strong {
  display: block;
  font-size: 1.05rem;
  line-height: 1;
  font-weight: 950;
}

.admin-interviewer-brand small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.56rem;
  font-weight: 900;
  text-transform: uppercase;
}

.admin-interviewer-client {
  align-items: flex-end;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.admin-interviewer-client img {
  display: block;
  width: 146px;
  height: 24px;
  object-fit: contain;
}

.admin-interviewer-session {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 190px;
}

.admin-grid {
  grid-template-columns: minmax(0, 2.3fr) minmax(300px, 0.9fr);
}

.admin-catalog-grid {
  grid-template-columns: minmax(690px, 1fr) minmax(450px, 0.48fr);
  grid-template-rows: auto;
  align-content: start;
  height: var(--admin-catalog-panel-height);
  max-height: var(--admin-catalog-panel-height);
  min-height: 0;
  overflow: hidden;
}

.admin-main-report,
.admin-side-report,
.admin-catalog-list,
.admin-catalog-detail {
  display: flex;
  flex-direction: column;
  align-self: start;
  min-height: 0;
  overflow: hidden;
}

.admin-catalog-list {
  align-self: start;
}

.admin-catalog-list,
.admin-catalog-detail {
  height: var(--admin-catalog-panel-height);
  max-height: var(--admin-catalog-panel-height);
}

.admin-note {
  margin: -2px 0 4px;
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 800;
}

.admin-table-wrap {
  flex: 1 1 auto;
  height: auto;
  max-height: none;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  outline: none;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.admin-table-wrap:focus {
  border-color: #6fb6cc;
  box-shadow: 0 0 0 2px rgba(47, 129, 160, 0.18), var(--float-shadow-soft);
}

.admin-table th:first-child,
.admin-catalog-table th:first-child,
.admin-simple-table th:first-child {
  width: 7%;
}

.admin-table th:nth-child(2),
.admin-catalog-table th:nth-child(2),
.admin-simple-table th:nth-child(2) {
  width: 38%;
}

.admin-table th:nth-child(3),
.admin-catalog-table th:nth-child(3),
.admin-simple-table th:nth-child(3) {
  width: 9%;
}

.admin-table th:nth-child(4),
.admin-catalog-table th:nth-child(4),
.admin-simple-table th:nth-child(4) {
  width: 7%;
}

.admin-table th:nth-child(5),
.admin-catalog-table th:nth-child(5),
.admin-simple-table th:nth-child(5) {
  width: 10%;
}

.admin-table th:nth-child(6),
.admin-catalog-table th:nth-child(6),
.admin-simple-table th:nth-child(6) {
  width: 23%;
}

.admin-table th:nth-child(7),
.admin-catalog-table th:nth-child(7),
.admin-simple-table th:nth-child(7) {
  width: 6%;
}

.admin-table td {
  height: 22px;
  max-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-table td:nth-child(2) {
  white-space: normal;
}

.admin-table th button span {
  margin-left: 4px;
  color: var(--accent);
}

.admin-table th,
.admin-table td {
  padding-top: 1px;
  padding-bottom: 1px;
  text-align: left;
}

.admin-table th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #fff;
  text-align: left;
}

.admin-table th button {
  padding-right: 9px;
  text-align: left;
}

.admin-col-resizer {
  position: absolute;
  top: 6px;
  right: -3px;
  bottom: 6px;
  z-index: 4;
  width: 8px;
  cursor: col-resize;
  touch-action: none;
}

.admin-col-resizer::after {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 3px;
  width: 2px;
  border-radius: 999px;
  background: transparent;
  content: "";
}

.hermes-table-resizable th:hover .admin-col-resizer::after,
.admin-table th:hover .admin-col-resizer::after,
.admin-km-table th:hover .admin-col-resizer::after,
.admin-hours-matrix-table th:hover .admin-col-resizer::after,
.admin-hours-team-table th:hover .admin-col-resizer::after,
.admin-hours-study-table th:hover .admin-col-resizer::after,
.hermes-table-keynav:focus .admin-col-resizer::after,
.admin-table-wrap:focus .admin-col-resizer::after,
.admin-km-table-wrap:focus .admin-col-resizer::after,
.admin-hours-matrix-wrap:focus .admin-col-resizer::after,
.admin-hours-table-wrap:focus .admin-col-resizer::after,
.admin-resizing-columns .admin-col-resizer::after {
  background: #9ac9d8;
}

.admin-resizing-columns {
  cursor: col-resize;
  user-select: none;
}

.admin-table td:nth-child(7) {
  text-align: right;
}

.admin-hours-grid {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  height: calc(100vh - 236px);
  max-height: calc(100vh - 236px);
  min-height: 0;
  overflow: hidden;
}

.admin-hours-main {
  display: flex;
  flex-direction: column;
  align-self: stretch;
  height: calc(100vh - 236px);
  max-height: calc(100vh - 236px);
  min-height: 0;
  overflow: hidden;
}

.admin-hours-actions {
  display: inline-flex;
  gap: 4px;
}

.admin-hours-actions button,
.admin-hours-entry button {
  min-height: 24px;
  height: 24px;
  padding: 0 10px;
  font-size: 0.62rem;
}

.admin-hours-filters,
.admin-hours-entry {
  display: grid;
  gap: 6px;
  align-items: end;
  margin-bottom: 4px;
}

.admin-hours-filters {
  grid-template-columns: 110px 150px 220px minmax(220px, 1fr) minmax(180px, 0.6fr);
}

.admin-hours-entry {
  grid-template-columns: 120px minmax(220px, 1fr) minmax(250px, 1fr) 140px 90px 170px 88px;
}

.admin-hours-matrix-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 150px 160px 118px;
  gap: 8px;
  align-items: center;
  margin-bottom: 3px;
  min-height: 22px;
}

.admin-hours-matrix-toolbar button,
.admin-hours-matrix-toolbar select {
  width: 118px;
  min-height: 24px;
  height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--navy);
  font-size: 0.62rem;
  font-weight: 850;
}

.admin-hours-matrix-toolbar select {
  justify-self: end;
  width: 150px;
}

.admin-hours-matrix-toolbar span,
.admin-hours-matrix-toolbar strong {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 900;
}

.admin-hours-matrix-toolbar strong {
  justify-self: end;
  color: var(--teal-dark);
}

.admin-hours-filters label,
.admin-hours-entry label {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.admin-hours-filters span,
.admin-hours-entry span {
  color: var(--muted);
  font-size: 0.54rem;
  font-weight: 900;
  text-transform: uppercase;
}

.admin-hours-filters input,
.admin-hours-filters select,
.admin-hours-entry input,
.admin-hours-entry select {
  width: 100%;
  min-width: 0;
  height: 26px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--navy);
  font-size: 0.68rem;
  font-weight: 850;
}

.admin-hours-screen {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.admin-hours-table-wrap {
  flex: 1 1 auto;
  height: 100%;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.admin-hours-matrix-wrap {
  height: calc(100vh - 376px);
  max-height: calc(100vh - 376px);
  min-height: 360px;
  overscroll-behavior: contain;
}

.admin-hours-matrix-table {
  table-layout: fixed;
  --hours-col-1: 190px;
  --hours-col-2: 82px;
  --hours-col-3: 210px;
  --hours-col-4: 92px;
  --hours-left-1: 0px;
  --hours-left-2: 190px;
  --hours-left-3: 272px;
  --hours-left-4: 482px;
}

.admin-hours-table th,
.admin-hours-team-table th,
.admin-hours-study-table th,
.admin-hours-incident-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff;
  text-align: left;
}

.admin-hours-table th,
.admin-hours-table td,
.admin-hours-team-table th,
.admin-hours-team-table td,
.admin-hours-study-table th,
.admin-hours-study-table td,
.admin-hours-incident-table th,
.admin-hours-incident-table td {
  height: 23px;
  padding-top: 2px;
  padding-bottom: 2px;
  text-align: left;
  white-space: nowrap;
}

.admin-hours-matrix-table th:nth-child(1),
.admin-hours-matrix-table td:nth-child(1) {
  position: sticky;
  left: var(--hours-left-1);
  z-index: 4;
  width: var(--hours-col-1);
  min-width: var(--hours-col-1);
  max-width: var(--hours-col-1);
  background: #fff;
}

.admin-hours-matrix-table th:nth-child(2),
.admin-hours-matrix-table td:nth-child(2) {
  position: sticky;
  left: var(--hours-left-2);
  z-index: 4;
  width: var(--hours-col-2);
  min-width: var(--hours-col-2);
  max-width: var(--hours-col-2);
  background: #fff;
}

.admin-hours-matrix-table th:nth-child(3),
.admin-hours-matrix-table td:nth-child(3) {
  position: sticky;
  left: var(--hours-left-3);
  z-index: 4;
  width: var(--hours-col-3);
  min-width: var(--hours-col-3);
  max-width: var(--hours-col-3);
  background: #fff;
}

.admin-hours-matrix-table th:nth-child(4),
.admin-hours-matrix-table td:nth-child(4) {
  position: sticky;
  left: var(--hours-left-4);
  z-index: 4;
  width: var(--hours-col-4);
  min-width: var(--hours-col-4);
  max-width: var(--hours-col-4);
  background: #fff;
}

.admin-hours-matrix-table th:nth-child(-n + 4) {
  z-index: 6;
}

.admin-hours-matrix-table th button {
  width: 100%;
  min-height: 20px;
  padding: 0 7px 0 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.56rem;
  font-weight: 950;
  line-height: 1;
  text-align: left;
  text-transform: uppercase;
}

.admin-hours-team-table th,
.admin-hours-study-table th,
.admin-hours-incident-table th {
  overflow: visible;
}

.admin-hours-team-table th button,
.admin-hours-study-table th button {
  width: 100%;
  min-height: 20px;
  padding: 0 8px 0 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.56rem;
  font-weight: 950;
  line-height: 1;
  text-align: left;
  text-transform: uppercase;
}

.admin-hours-team-table th button span,
.admin-hours-study-table th button span {
  margin-left: 4px;
  color: var(--teal-dark);
  font-size: 0.54rem;
}

.admin-hours-incident-table th:nth-child(1) {
  width: 18%;
}

.admin-hours-incident-table th:nth-child(2) {
  width: 58%;
}

.admin-hours-incident-table th:nth-child(3),
.admin-hours-incident-table th:nth-child(4) {
  width: 12%;
}

.admin-hours-incident-table input[type="text"] {
  width: 100%;
  min-width: 0;
  height: 21px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: var(--navy);
  font-size: 0.62rem;
  font-weight: 850;
}

.admin-hours-incident-table input[type="checkbox"] {
  display: block;
  width: 15px;
  height: 15px;
  margin: 0 auto;
  accent-color: var(--teal-dark);
}

.admin-hours-incident-table th:nth-child(3),
.admin-hours-incident-table th:nth-child(4),
.admin-hours-incident-table td:nth-child(3),
.admin-hours-incident-table td:nth-child(4) {
  text-align: center;
}

.admin-hours-total-incident-head,
.admin-hours-total-incident-cell {
  border-left: 2px solid rgba(47, 129, 160, 0.28);
  background: rgba(80, 144, 168, 0.045);
}

.admin-hours-breakdown-head,
.admin-hours-breakdown-cell {
  background: rgba(80, 144, 168, 0.025);
}

.admin-hours-breakdown-head button {
  color: #6f7d92;
  font-size: 0.52rem;
}

.admin-hours-breakdown-cell {
  color: #5f6d82;
}

.admin-hours-matrix-table th:nth-child(-n + 4) {
  overflow: visible;
}

.admin-hours-matrix-table th button span {
  margin-left: 4px;
  color: var(--teal-dark);
  font-size: 0.54rem;
}

.admin-hours-matrix-table td:nth-child(-n + 4) {
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-hours-day-head {
  width: 38px;
  min-width: 38px;
  max-width: 38px;
  text-align: center;
}

.admin-hours-edit-cell {
  width: 38px;
  min-width: 38px;
  max-width: 38px;
  padding: 1px;
}

.admin-hours-day-head.admin-hours-weekend,
.admin-hours-edit-cell.admin-hours-weekend {
  background: linear-gradient(180deg, rgba(80, 144, 168, 0.08), rgba(80, 144, 168, 0.035));
}

.admin-hours-day-head.admin-hours-weekend {
  color: var(--teal-dark);
  box-shadow: inset 0 2px 0 rgba(80, 144, 168, 0.16);
}

.admin-hours-edit-cell.admin-hours-weekend input {
  color: #355f75;
}

.admin-hours-edit-cell input {
  width: 34px;
  height: 20px;
  padding: 0 2px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--navy);
  font-size: 0.62rem;
  font-weight: 850;
  text-align: center;
  outline: none;
}

.admin-hours-edit-cell input:focus {
  border-color: #4f9ab5;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(79, 154, 181, 0.16);
}

.admin-hours-edit-cell input.dirty {
  border-color: rgba(216, 132, 22, 0.45);
  background: #fff8e8;
}

.admin-hours-table td:nth-child(2),
.admin-hours-table td:nth-child(4),
.admin-hours-team-table td:nth-child(1),
.admin-hours-study-table td:nth-child(1) {
  max-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-client-cell,
.admin-id-cell,
.admin-group-cell,
.admin-type-cell {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-id-cell {
  color: var(--navy);
  font-weight: 950;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.hermes-data-table tbody tr[data-id],
.hermes-data-table tbody tr[data-km-validation-id],
.admin-table tbody tr {
  cursor: pointer;
}

.hermes-data-table tbody tr.selected,
.admin-table tbody tr.selected {
  background: #eaf5f8;
  box-shadow: inset 4px 0 0 var(--teal);
}

.hermes-table-keynav:focus .hermes-data-table tbody tr.selected,
.admin-table-wrap:focus .admin-table tbody tr.selected {
  background: #dff1f6;
  box-shadow: inset 4px 0 0 var(--teal), inset 0 0 0 1px rgba(47, 129, 160, 0.22);
}

.admin-code {
  max-width: 150px;
  overflow: hidden;
  color: var(--navy);
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-channel,
.admin-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 0.56rem;
  font-weight: 950;
  white-space: nowrap;
}

.admin-channel {
  color: var(--teal-dark);
  background: #e7f7fa;
}

.admin-chip.ok {
  color: #257147;
  background: #e9f7ee;
}

.admin-chip.warn {
  color: #8b5a00;
  background: #fff3d7;
}

.admin-chip.danger {
  color: #a4384b;
  background: #ffe9ee;
}

.admin-group-list {
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 310px);
  overflow: auto;
  padding-right: 2px;
}

.admin-group {
  padding: 9px;
  border: 1px solid #e2edf3;
  border-radius: 8px;
  background: #fbfdff;
  box-shadow: var(--float-shadow-soft);
}

.admin-group header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.admin-group strong {
  color: var(--navy);
  font-size: 0.78rem;
  font-weight: 950;
}

.admin-group header span {
  padding: 2px 7px;
  border-radius: 999px;
  color: var(--teal-dark);
  background: #e7f7fa;
  font-size: 0.52rem;
  font-weight: 950;
}

.admin-group p {
  margin: 5px 0 7px;
  color: #263b5c;
  font-size: 0.68rem;
  font-weight: 850;
}

.admin-group dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin: 0 0 7px;
}

.admin-group dt,
.admin-group dd {
  margin: 0;
}

.admin-group dt {
  color: var(--muted);
  font-size: 0.48rem;
  font-weight: 950;
  text-transform: uppercase;
}

.admin-group dd {
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 950;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-group small,
.admin-empty {
  display: block;
  color: var(--muted);
  font-size: 0.56rem;
  font-weight: 800;
  line-height: 1.25;
}

.admin-catalog-detail {
  overflow: hidden;
}

.admin-catalog-detail {
  padding: 6px;
}

.admin-catalog-detail .report-head {
  align-items: center;
  margin-bottom: 3px;
}

.admin-catalog-detail .report-head h2 {
  font-size: 0.86rem;
}

.admin-catalog-detail #saveCatalog {
  height: 24px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
  font-size: 0.64rem;
  font-weight: 850;
}

.admin-form {
  display: grid;
  flex: 1 1 auto;
  gap: 3px;
  min-height: 0;
  max-height: none;
  align-content: start;
  grid-auto-rows: auto;
  overflow: hidden;
  padding-right: 0;
}

.admin-source-box {
  align-self: start;
  display: grid;
  grid-template-columns: minmax(130px, 0.9fr) minmax(190px, 1.35fr) minmax(82px, 0.5fr);
  gap: 1px 6px;
  padding: 3px 6px;
  border: 1px solid #e2edf3;
  border-radius: 8px;
  background: #f8fbfe;
}

.admin-source-box div:nth-child(4) {
  grid-column: 1 / 2;
}

.admin-source-box div:nth-child(5) {
  grid-column: 2 / 4;
}

.admin-source-box span {
  display: block;
  color: var(--muted);
  font-size: 0.4rem;
  font-weight: 950;
  text-transform: uppercase;
}

.admin-source-box strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.52rem;
  font-weight: 950;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-source-box #sourceNombre {
  white-space: normal;
  overflow-wrap: anywhere;
}

.admin-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px 6px;
  align-content: start;
  grid-auto-rows: auto;
  min-height: 0;
}

.admin-form label,
.admin-textarea-label {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.admin-form label.wide,
.admin-form .wide {
  grid-column: 1 / -1;
}

.admin-form label span,
.admin-textarea-label span {
  color: var(--muted);
  font-size: 0.44rem;
  font-weight: 950;
  text-transform: uppercase;
}

.admin-form input,
.admin-form select,
.admin-form textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 800;
}

.admin-form input,
.admin-form select {
  height: 20px;
  padding: 0 7px;
  font-size: 0.56rem;
}

.admin-form textarea {
  resize: vertical;
  min-height: 38px;
  padding: 5px 8px;
  font-size: 0.64rem;
  line-height: 1.2;
}

.admin-gandia-box {
  align-self: start;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 2px;
  min-width: 0;
  min-height: 0;
}

.admin-gandia-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.admin-gandia-head span,
.admin-gandia-source {
  color: var(--muted);
  font-size: 0.44rem;
  font-weight: 950;
  text-transform: uppercase;
}

.admin-gandia-head strong {
  flex: 0 0 auto;
  color: var(--ink);
  font-size: 0.56rem;
  font-weight: 950;
  white-space: nowrap;
}

.admin-gandia-source {
  overflow: visible;
  line-height: 1.2;
  white-space: normal;
  overflow-wrap: anywhere;
  text-transform: none;
}

#entrevistadores.admin-gandia-list {
  height: 154px;
  min-height: 0;
  max-height: 154px;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.admin-gandia-empty {
  color: var(--muted);
  font-size: 0.6rem;
  font-weight: 850;
}

.admin-agent-table {
  width: 100%;
  min-width: 390px;
  border-collapse: collapse;
  table-layout: fixed;
}

.admin-agent-table th,
.admin-agent-table td {
  height: 21px;
  padding: 1px 5px;
  border-bottom: 1px solid #e8eef4;
  color: var(--ink);
  font-size: 0.52rem;
  font-weight: 850;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-agent-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  background: #f7fbfd;
  font-size: 0.52rem;
  font-weight: 950;
  text-transform: uppercase;
}

.admin-agent-table th button {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: inherit;
  text-transform: inherit;
  cursor: pointer;
}

.admin-agent-table th button span {
  margin-left: 4px;
  color: var(--accent);
}

.admin-agent-table th:nth-child(2),
.admin-agent-table td:nth-child(2) {
  width: 112px;
}

.admin-agent-table th:nth-child(3),
.admin-agent-table td:nth-child(3) {
  width: 72px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.admin-agent-table tbody tr:nth-child(even) td {
  background: #fbfdff;
}

.admin-agent-table tbody tr:hover td {
  background: #eef8fb;
}

.admin-km-grid {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 26px auto;
  align-content: start;
  height: auto;
  min-height: 0;
  overflow: hidden;
}

.admin-km-tabs {
  display: flex;
  grid-column: 1 / -1;
  gap: 5px;
}

.admin-km-tabs button {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.64rem;
  font-weight: 900;
  min-height: 25px;
  padding: 0 10px;
}

.admin-km-tabs button.active {
  border-color: #3e8aa5;
  background: #eaf8fc;
  color: #2f7792;
}

.admin-km-entry,
.admin-km-validation,
.admin-km-homes {
  display: flex;
  flex-direction: column;
  align-self: start;
  grid-column: 1 / -1;
  min-height: 0;
  overflow: hidden;
}

.admin-km-entry {
  gap: 4px;
  height: 390px;
  max-height: 390px;
}

.admin-km-validation {
  height: 326px;
  max-height: 326px;
}

.admin-km-homes {
  height: 350px;
  max-height: 350px;
}

.admin-km-form {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  min-height: 0;
}

.admin-km-entry .report-head {
  min-height: 28px;
}

.admin-km-entry .report-head h1 {
  font-size: 0.98rem;
}

.admin-km-head-actions {
  align-items: center;
  align-self: start;
  display: flex;
  gap: 6px;
}

.admin-km-head-actions button {
  min-height: 24px;
  padding: 0 10px;
  border: 1px solid #cfe2ec;
  border-radius: 6px;
  background: #fff;
  color: var(--navy);
  font-size: 0.62rem;
  font-weight: 950;
}

.admin-km-head-actions button:hover {
  border-color: #77bad0;
  background: #eaf8fb;
}

.admin-km-entry .admin-note {
  margin: -4px 0 1px;
  font-size: 0.58rem;
  line-height: 1;
}

.admin-km-form .admin-form-grid {
  grid-template-columns: 1.05fr minmax(190px, 1.6fr) 0.72fr 0.72fr 1fr 0.72fr 0.68fr 0.68fr 0.68fr;
  gap: 2px 6px;
}

.admin-km-form label.wide,
.admin-km-form .wide {
  grid-column: auto;
}

.admin-km-form label:nth-child(5),
.admin-km-form label:nth-child(6),
.admin-km-form label:nth-child(12) {
  grid-column: span 2;
}

.admin-km-form input,
.admin-km-form select {
  height: 25px;
  min-height: 25px;
  padding-top: 3px;
  padding-bottom: 3px;
}

.admin-km-return-row {
  align-self: end;
  min-height: 24px;
  padding-top: 0;
}

.admin-km-return-row span {
  font-size: 0.62rem;
  text-transform: none;
}

.admin-km-form textarea {
  height: 24px;
  min-height: 24px;
  resize: none;
}

.admin-km-form .admin-form-actions {
  align-items: center;
  gap: 8px;
  margin-top: 3px;
}

.admin-km-history {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  min-height: 0;
}

.admin-km-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 3px;
}

.admin-km-history-head span {
  color: #2f7792;
  font-size: 0.66rem;
  font-weight: 950;
  text-transform: uppercase;
}

.admin-km-history-head strong {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
}

.admin-km-history-wrap {
  flex: 0 0 158px;
  height: 158px;
  max-height: 158px;
  min-height: 158px;
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.admin-km-history-table th,
.admin-km-history-table td {
  height: 25px;
  padding: 3px 6px;
  font-size: 0.58rem;
  text-align: left;
}

.admin-km-history-table thead,
.admin-km-history-table thead tr,
.admin-km-history-table th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: #fff;
}

.admin-km-history-table th:nth-child(1) {
  width: 58px;
}

.admin-km-history-table th:nth-child(2) {
  width: 70px;
}

.admin-km-history-table th:nth-child(3) {
  width: 15%;
}
  
.admin-km-history-table th:nth-child(4) {
  width: 20%;
}
  
.admin-km-history-table th:nth-child(5),
.admin-km-history-table th:nth-child(6),
.admin-km-history-table th:nth-child(7),
.admin-km-history-table th:nth-child(8),
.admin-km-history-table th:nth-child(9),
.admin-km-history-table th:nth-child(10) {
  width: 58px;
  text-align: right;
}
  
.admin-km-history-table th:nth-child(11) {
  width: 86px;
}
  
.admin-km-history-table th:nth-child(12) {
  width: 16%;
}

.admin-km-history-table td {
  max-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-km-history-editable {
  cursor: pointer;
}

.admin-km-history-editable:hover {
  background: #fff8e9;
}

.admin-km-iv-cell {
  text-align: left;
}

.admin-km-iv-check {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: #2f7792;
  vertical-align: middle;
}

.admin-km-calc-result {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6fbfe;
  color: var(--muted);
  font-weight: 800;
  padding: 4px 8px;
  font-size: 0.58rem;
  line-height: 1.1;
}

.admin-form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.admin-check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding-top: 14px;
}

.admin-check-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--teal);
}

.admin-check-row span {
  color: var(--navy);
  font-size: 0.72rem;
  font-weight: 950;
}

.admin-form-actions button,
.admin-km-actions button {
  min-height: 34px;
  border: 1px solid #cfe2ec;
  border-radius: 7px;
  background: #fff;
  color: var(--navy);
  font-weight: 950;
}

.admin-form-actions button {
  padding: 0 16px;
}

.admin-km-grid .admin-form-actions button {
  min-height: 25px;
  padding: 0 10px;
  border-radius: 6px;
  font-size: 0.62rem;
}

.admin-km-home-form .admin-form-actions {
  margin-top: 5px;
}

.admin-form-actions button:hover,
.admin-km-actions button:not(:disabled):hover {
  border-color: #77bad0;
  background: #eaf8fb;
}

.admin-km-summary {
  margin: -2px 0 8px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
}

.admin-km-validation-filters {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}

.admin-km-validation-filters select {
  height: 28px;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 850;
}

#kmSupervisorUsuario {
  width: min(310px, 30vw);
  max-width: 310px;
}

.admin-km-table-wrap {
  flex: 0 0 auto;
  height: 252px;
  max-height: 252px;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.admin-km-table th,
.admin-km-table td {
  height: 28px;
  padding: 4px 7px;
  font-size: 0.58rem;
  text-align: left;
}

.admin-km-table th button {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-weight: 950;
  padding: 0;
  text-align: left;
  text-transform: uppercase;
}

.admin-km-table th button span {
  color: #2f7792;
  font-size: 0.66rem;
}

.admin-km-table td {
    overflow: hidden;
    text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-km-table td:nth-child(2),
.admin-km-table td:nth-child(3) {
  overflow: visible;
  text-overflow: clip;
  font-variant-numeric: tabular-nums;
}

.admin-km-table td:nth-child(13) {
    max-width: none;
    overflow: visible;
    text-overflow: clip;
  white-space: nowrap;
}

.admin-km-table td:nth-child(5) {
  max-width: none;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
}

.admin-km-table td.num {
  text-align: left;
}

.admin-km-table tbody tr {
  cursor: pointer;
}

.admin-km-table tbody tr.selected {
  background: #eaf5f8;
  box-shadow: inset 4px 0 0 var(--teal);
}

.admin-km-table-wrap:focus .admin-km-table tbody tr.selected {
  background: #dff1f6;
  box-shadow: inset 4px 0 0 var(--teal), inset 0 0 0 1px rgba(47, 129, 160, 0.22);
}

.admin-km-home-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(260px, 0.3fr);
  gap: 7px;
  flex: 0 0 auto;
  height: 286px;
  max-height: 286px;
  min-height: 0;
  overflow: hidden;
}

.admin-km-homes .report-head {
  flex: 0 0 auto;
  align-items: end;
}

.admin-km-home-head-actions {
  justify-content: flex-start;
  justify-self: end;
  gap: 4px;
  min-width: min(560px, 55vw);
}

.admin-km-home-head-actions input {
  width: min(230px, 22vw);
  height: 24px;
  min-height: 24px;
  padding: 3px 7px;
  font-size: 0.56rem;
}

.admin-km-home-head-actions button {
  height: 24px;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 5px;
  font-size: 0.56rem;
}

.admin-km-home-table-wrap {
  flex: 1 1 auto;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.admin-km-home-table {
  border-collapse: separate;
  border-spacing: 0;
}

.admin-km-home-table th,
.admin-km-home-table td {
  height: 24px;
  padding: 2px 6px;
  font-size: 0.58rem;
  text-align: left;
}

.admin-km-home-table thead {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #fff;
}

.admin-km-home-table thead tr {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #fff;
}

.admin-km-home-table th {
  position: sticky;
  top: 0;
  z-index: 6;
  background: #fff;
  box-shadow: 0 1px 0 #e8f0f6;
}

.admin-km-home-table th button {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-weight: 950;
  padding: 0;
  font-size: 0.54rem;
  text-align: left;
}

.admin-km-home-table th button span {
  color: #2f7792;
  font-size: 0.52rem;
}

.admin-km-home-table td {
  max-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-km-home-table tr {
  cursor: pointer;
}

.admin-km-home-form {
  align-self: start;
  display: grid;
  gap: 3px;
  padding: 6px;
}

.admin-km-home-form label {
  gap: 1px;
}

.admin-km-home-form label span {
  font-size: 0.49rem;
  line-height: 1;
}

.admin-km-home-form input,
.admin-km-home-form select {
  height: 22px;
  min-height: 22px;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 0.6rem;
}

.admin-km-home-form .admin-km-calc-result {
  min-height: 22px;
  padding: 4px 7px;
  border-radius: 5px;
  font-size: 0.54rem;
  line-height: 1.1;
}

.admin-km-home-form .admin-form-actions {
  gap: 3px;
  margin-top: 2px;
}

.admin-km-home-form .admin-form-actions button {
  min-height: 22px;
  padding: 0 7px;
  border-radius: 5px;
  font-size: 0.52rem;
}

.admin-km-actions {
  display: table-cell;
  overflow: visible;
  text-align: left;
  white-space: nowrap;
}

.admin-km-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 23px;
  min-width: 54px;
  padding: 0 5px;
  font-size: 0.58rem;
}

.admin-km-actions button + button {
  margin-left: 3px;
}

.admin-km-actions button:disabled {
  cursor: default;
  opacity: 0.45;
}

.admin-gandia-empty {
  align-self: center;
  padding: 18px 6px;
  text-align: center;
}

#observaciones {
  min-height: 34px;
}

.admin-checks {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.admin-checks label {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 27px;
  padding: 3px 7px;
  border: 1px solid #e2edf3;
  border-radius: 8px;
  background: #f8fbfe;
  color: var(--ink);
  font-size: 0.56rem;
  font-weight: 900;
}

.admin-checks input {
  width: auto;
  height: auto;
}

.study-name {
  min-width: 0;
}

.study-name strong,
.study-name span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.study-name strong {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: var(--navy);
  font-size: 0.72rem;
  font-weight: 950;
  white-space: normal;
}

.study-name span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.56rem;
  font-weight: 850;
}

.progress-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.progress-cell strong {
  display: block;
  font-size: 0.66rem;
}

.mini-progress {
  height: 4px;
  margin-top: 3px;
  border-radius: 999px;
  background: #dce9ef;
  overflow: hidden;
}

.mini-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
}

.empty-cell {
  height: 140px !important;
  color: var(--muted);
  text-align: center;
  font-weight: 900;
}

.cluster-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px;
  margin-bottom: 4px;
}

.cluster-summary-panel {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.cluster-total {
  min-width: 0;
  min-height: 26px;
  padding: 3px 5px;
  border: 1px solid #e2edf3;
  border-radius: 7px;
  background: #fbfdff;
  box-shadow: var(--float-shadow-soft);
  text-align: left;
}

.cluster-total.active,
.cluster-total[data-clear-cluster]:hover,
.cluster-row.active {
  border-color: #b8d5df;
  background: #eef8fa;
}

.cluster-total strong {
  display: block;
  color: var(--teal-dark);
  font-size: 0.7rem;
  line-height: 1;
  font-weight: 950;
}

.cluster-total.warn strong {
  color: var(--orange);
}

.cluster-total span {
  display: block;
  margin-top: 1px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.44rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cluster-chip {
  min-width: 0;
  min-height: 38px;
  padding: 4px 5px;
  border: 1px solid #e2edf3;
  border-radius: 7px;
  color: #263b5c;
  background: #fbfdff;
  box-shadow: var(--float-shadow-soft);
  text-align: left;
}

.cluster-chip strong {
  display: block;
  color: var(--teal-dark);
  font-size: 0.86rem;
  line-height: 1;
  font-weight: 950;
}

.cluster-chip span {
  display: block;
  margin-top: 1px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.52rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cluster-chip small {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: #435a76;
  font-size: 0.48rem;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cluster-detail {
  display: grid;
  gap: 3px;
  max-height: none;
  overflow: hidden;
  padding-right: 0;
}

.cluster-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.9fr) minmax(150px, 1.35fr);
  gap: 5px;
  align-items: center;
  min-height: 27px;
  padding: 2px 5px;
  border: 1px solid #e8f0f6;
  border-radius: 7px;
  background: #fbfdff;
  box-shadow: var(--float-shadow-soft);
  cursor: pointer;
}

.cluster-row:hover {
  background: #f0f7fa;
}

.cluster-row strong {
  display: block;
  color: var(--ink);
  font-size: 0.54rem;
  font-weight: 950;
}

.cluster-row span {
  display: none;
}

.cluster-row dl {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 3px;
  margin: 0;
}

.cluster-row dl div {
  min-width: 0;
}

.cluster-row dt {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.4rem;
  font-weight: 900;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.cluster-row dd {
  margin: 1px 0 0;
  color: var(--ink);
  font-size: 0.48rem;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.agent-profile {
  display: grid;
  height: calc(100% - 48px);
  max-height: calc(100% - 48px);
  gap: 4px;
  overflow: hidden;
  padding-right: 0;
}

.profile-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid #e8f0f6;
}

.profile-head strong {
  display: block;
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 950;
}

.profile-head span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.52rem;
  font-weight: 850;
}

.profile-cluster {
  display: inline-block;
  margin-top: 3px;
  padding: 3px 6px;
  border-radius: 7px;
  color: var(--teal-dark);
  background: #e8f6f6;
  font-size: 0.52rem;
  font-weight: 950;
}

.profile-dates {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

.profile-dates div {
  min-width: 0;
  padding: 3px 5px;
  border: 1px solid #e8f0f6;
  border-radius: 7px;
  background: #fbfdff;
  box-shadow: var(--float-shadow-soft);
}

.profile-dates span,
.profile-dates small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-dates span {
  color: var(--muted);
  font-size: 0.46rem;
  font-weight: 900;
  text-transform: uppercase;
}

.profile-dates strong {
  display: block;
  margin-top: 1px;
  color: var(--ink);
  font-size: 0.56rem;
  font-weight: 950;
}

.profile-dates small {
  margin-top: 1px;
  color: var(--muted);
  font-size: 0.44rem;
  font-weight: 800;
}

.profile-block {
  display: grid;
  gap: 2px;
  padding-top: 1px;
  border-top: 1px solid #e8f0f6;
}

.profile-block header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
}

.profile-block header strong {
  overflow: hidden;
  color: var(--teal-dark);
  font-size: 0.47rem;
  font-weight: 950;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.profile-block header span {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.4rem;
  font-weight: 850;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px;
}

.history-summary div,
.history-empty {
  min-width: 0;
  padding: 2px 4px;
  border: 1px solid #e8f0f6;
  border-radius: 7px;
  background: #fbfdff;
  box-shadow: var(--float-shadow-soft);
}

.history-summary span,
.history-summary small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-summary span {
  color: var(--muted);
  font-size: 0.4rem;
  font-weight: 900;
  text-transform: uppercase;
}

.history-summary strong {
  display: block;
  margin-top: 1px;
  color: var(--ink);
  font-size: 0.56rem;
  font-weight: 950;
}

.history-summary small,
.history-empty {
  color: var(--muted);
  font-size: 0.4rem;
  font-weight: 800;
}

.history-charts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 3px;
}

.history-spark {
  min-width: 0;
  padding: 2px 3px 1px;
  border: 1px solid #e8f0f6;
  border-radius: 7px;
  background: #fbfdff;
  box-shadow: var(--float-shadow-soft);
}

.history-spark div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 5px;
}

.history-spark strong {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.38rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-spark span {
  color: var(--ink);
  font-size: 0.42rem;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.history-spark svg {
  display: block;
  width: 100%;
  height: 14px;
}

.history-spark .line-main {
  stroke-width: 3;
}

.profile-status {
  display: grid;
  justify-items: end;
  gap: 2px;
  flex: 0 0 auto;
}

.profile-status span {
  color: var(--muted);
  font-size: 0.5rem;
  font-weight: 900;
  text-transform: uppercase;
}

.profile-status strong {
  color: var(--ink);
  font-size: 1.05rem;
  line-height: 1;
  font-weight: 950;
}

.profile-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 3px;
}

.profile-metrics div {
  min-width: 0;
  min-height: 27px;
  padding: 2px 3px;
  border: 1px solid #e8f0f6;
  border-radius: 7px;
  background: #fbfdff;
  box-shadow: var(--float-shadow-soft);
}

.profile-metrics span,
.profile-metrics small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-metrics span {
  color: var(--muted);
  font-size: 0.4rem;
  font-weight: 900;
}

.profile-metrics strong {
  display: block;
  margin-top: 1px;
  color: var(--ink);
  font-size: 0.56rem;
  font-weight: 950;
}

.profile-metrics small {
  margin-top: 1px;
  color: var(--muted);
  font-size: 0.36rem;
  font-weight: 800;
}

.health-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.general-side .health-grid {
  gap: 3px;
}

.health-item {
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid #e5eef5;
  border-radius: 8px;
  background: var(--soft);
  box-shadow: var(--float-shadow-soft);
}

.general-side .health-item {
  padding: 4px 6px;
}

.health-item strong {
  display: block;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.general-side .health-item strong {
  font-size: 0.69rem;
  line-height: 1;
}

.health-item span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.6rem;
  font-weight: 850;
  line-height: 1.18;
}

.general-side .health-item span {
  margin-top: 1px;
  font-size: 0.47rem;
  line-height: 1.05;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.health-item.good strong {
  color: var(--teal-dark);
}

.health-item.warn strong {
  color: var(--orange);
}

.health-item.danger strong {
  color: var(--red);
}

.legend span::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 4px;
  margin-right: 6px;
  border-radius: 10px;
  vertical-align: middle;
  background: var(--teal);
}

.legend span:last-child::before {
  background: var(--orange);
}

.project-list {
  display: grid;
  gap: 8px;
}

.funnel-report {
  display: grid;
  gap: 14px;
}

.funnel-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.55fr) minmax(220px, 1.4fr) minmax(90px, 0.35fr);
  gap: 12px;
  align-items: center;
  min-height: 48px;
  padding: 8px 10px;
  border: 1px solid #e8f0f6;
  border-radius: 8px;
  background: #fbfdff;
}

.funnel-meta strong,
.funnel-value strong {
  display: block;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 950;
}

.funnel-meta span,
.funnel-value span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 850;
}

.funnel-track {
  height: 12px;
  border-radius: 999px;
  background: #dce8f0;
  overflow: hidden;
}

.funnel-track div {
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
}

.funnel-value {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.project-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(120px, 1.4fr) 54px 72px;
  gap: 10px;
  align-items: center;
  min-height: 23px;
}

.project-name {
  min-width: 0;
  color: #233b59;
  font-size: 0.7rem;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  height: 8px;
  border-radius: 20px;
  background: #dce8f0;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
}

.project-row.low .bar-fill {
  background: var(--orange);
}

.project-pct,
.project-total {
  color: #435a76;
  font-size: 0.72rem;
  font-weight: 900;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.sla-list {
  display: grid;
  gap: 7px;
}

.sla-item {
  display: grid;
  grid-template-columns: 4px 1fr auto;
  gap: 12px;
  align-items: center;
  min-height: 39px;
  padding: 6px 10px 6px 0;
  border-radius: 8px;
  background: var(--soft);
  overflow: hidden;
}

.sla-item::before {
  content: "";
  width: 4px;
  height: 100%;
  border-radius: 8px;
  background: var(--blue);
}

.sla-item.warn::before {
  background: var(--orange);
}

.sla-item.danger::before {
  background: var(--red);
}

.sla-item.ok::before {
  background: var(--teal);
}

.sla-label {
  color: #243b59;
  font-size: 0.7rem;
  font-weight: 900;
}

.sla-label span {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 850;
}

.sla-value {
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.table-wrap {
  overflow: hidden;
  max-height: none;
}

.monthly-table-wrap {
  height: 100%;
  max-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid #e1edf2;
  border-radius: 8px;
  background: #fff;
}

.monthly-table-wrap th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff;
}

.monthly-table-wrap th,
.monthly-table-wrap td {
  height: 24px;
  padding: 3px 6px;
  font-size: 0.6rem;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 6px 8px;
  border-bottom: 1px solid #edf2f7;
  text-align: right;
  font-size: 0.73rem;
  white-space: nowrap;
}

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

th {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 950;
  text-transform: uppercase;
}

td {
  color: #233b59;
  font-weight: 780;
  font-variant-numeric: tabular-nums;
}

.agent-name {
  max-width: 230px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 900;
}

.empty {
  padding: 36px 12px;
  color: var(--muted);
  text-align: center;
  font-weight: 850;
}

@media (max-width: 1280px) {
  .topbar {
    grid-template-columns: minmax(170px, 0.42fr) minmax(340px, 1fr) minmax(240px, 0.34fr);
    gap: 8px;
  }

  .brand {
    gap: 8px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .brand strong {
    font-size: 1.1rem;
  }

  .brand small {
    font-size: 0.56rem;
  }

  .timebox {
    justify-self: center;
    max-width: 100%;
    padding: 6px;
  }

  .filter-main {
    grid-template-columns: auto minmax(80px, 1fr) minmax(80px, 1fr) minmax(72px, 90px);
  }

  .timebox select {
    min-width: 0;
    width: 96px;
  }

  .timebox .catalog-filter-row {
    grid-template-columns: minmax(80px, 0.8fr) minmax(100px, 1fr) minmax(110px, 1fr) minmax(210px, 1.6fr);
  }

  .timebox .study-filter select {
    width: 100%;
  }

  .timebox span {
    font-size: 0.58rem;
  }

  .timebox button {
    padding: 0 8px;
  }

  .client-logo {
    width: 118px;
  }
}

@media (max-width: 980px) {
  body {
    height: auto;
    min-height: 100vh;
    overflow: auto;
  }

  .shell {
    height: auto;
    min-height: 100vh;
  }

  .topbar {
    grid-template-columns: 1fr;
  }

  .timebox {
    justify-self: start;
  }

  .client-mark {
    justify-self: start;
    text-align: left;
  }

  .client-actions {
    justify-content: flex-start;
  }

  .panel-tabs {
    flex-wrap: wrap;
  }

  .panel-tabs a {
    flex: 1 1 calc(25% - 6px);
  }

  .panel-tabs.admin-nav-expanded .admin-module-tabs {
    order: 8;
    flex: 1 1 100%;
    min-width: 100%;
  }

  .kpi-grid {
    grid-template-columns: repeat(4, minmax(130px, 1fr));
  }

  .dashboard-grid {
    grid-template-columns: 1fr 1fr;
  }

  .quality-layout {
    grid-template-columns: 1fr;
  }

  .agent-evolution-report .agents-metric-grid {
    grid-template-columns: repeat(3, minmax(130px, 1fr));
  }

  .general-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 18px, 1480px);
    padding-top: 14px;
  }

  .brand strong {
    font-size: 1.25rem;
  }

  .timebox,
  .segmented {
    width: 100%;
  }

  .filter-main {
    width: 100%;
  }

  .timebox .catalog-filter-row {
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .timebox .catalog-filter-row .study-filter {
    grid-column: 1 / -1;
  }

  .timebox label {
    flex: 1 1 130px;
  }

  .status {
    text-align: left;
  }

  .panel-tabs {
    flex-wrap: wrap;
  }

  .panel-tabs a {
    flex: 1 1 calc(50% - 6px);
  }

  .panel-tabs.admin-nav-expanded a,
  .panel-tabs.admin-nav-expanded a.active {
    flex: 1 1 calc(50% - 6px);
    min-width: 90px;
  }

  .panel-tabs.admin-nav-expanded .admin-module-tabs {
    order: 8;
    flex: 1 1 100%;
    min-width: 100%;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .general-side-column,
  .pulse-grid,
  .pulse-trend-grid {
    grid-template-columns: 1fr;
  }

  .heatmap-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .report-wide {
    grid-column: auto;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .agent-evolution-report .agents-metric-grid {
    grid-template-columns: 1fr;
  }

  .project-row {
    grid-template-columns: minmax(0, 1fr) 64px;
  }

  .project-row .bar-track,
  .project-row .project-total {
    grid-column: 1 / -1;
  }
}

/* Responsive hardening: layout-only overrides, preserving colors and component styling. */
@media (max-width: 1280px) {
  .topbar {
    grid-template-rows: auto auto auto;
    min-height: 0;
  }

  .timebox {
    align-self: stretch;
    height: auto;
    min-height: 0;
    grid-template-rows: auto auto;
    align-content: center;
    overflow: visible;
  }

  .filter-main,
  .timebox .catalog-filter-row {
    align-self: stretch;
  }
}

@media (max-width: 980px) {
  .shell,
  .admin-page .shell {
    grid-template-rows: auto auto auto auto;
    gap: 8px;
  }

  .topbar {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    align-items: stretch;
    min-height: 0;
    row-gap: 8px;
  }

  .brand,
  .timebox,
  .client-mark,
  .session-user-actions {
    grid-column: 1;
    grid-row: auto;
    justify-self: stretch;
  }

  .brand {
    justify-content: flex-start;
  }

  .session-user-actions {
    align-self: center;
    max-width: 100%;
    width: 100%;
  }

  .admin-user-badge,
  .session-logout-button {
    width: auto;
    max-width: none;
    flex: 1 1 0;
  }

  .timebox {
    width: 100%;
  }

  .filter-main {
    justify-content: flex-start;
  }

  .timebox .catalog-filter-row {
    width: 100%;
  }

  .client-mark {
    max-width: none;
    grid-template-rows: auto;
    grid-auto-flow: row;
    justify-items: stretch;
    gap: 6px;
  }

  .status,
  .client-actions {
    grid-column: 1;
    grid-row: auto;
    justify-self: stretch;
    max-width: none;
    width: 100%;
  }

  .client-actions {
    justify-content: flex-start;
  }

  .panel-tabs {
    height: auto;
    max-height: none;
    align-items: stretch;
  }

  .panel-tabs a {
    min-width: 0;
    min-height: 32px;
  }

  .report,
  .general-main,
  .general-side,
  .general-side-column,
  .agents-cluster-report,
  .agents-ranking-report,
  .agents-profile-report,
  .agents-grid.has-evolution .agents-cluster-report,
  .agents-grid.has-evolution .agents-ranking-report,
  .agents-grid.has-evolution .agents-profile-report {
    height: auto;
    max-height: none;
  }

  .general-grid,
  .dashboard-grid {
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .rank-table-wrap,
  .base-table-wrap,
  .studies-table-report .study-table-wrap,
  .monthly-table-wrap,
  .hermes-data-table-wrap,
  .study-table-wrap {
    max-height: min(68vh, 620px);
    overflow: auto;
  }

  .admin-catalog-grid,
  .admin-km-home-layout,
  .admin-km-grid,
  .admin-km-validation-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 14px, 1480px);
    padding: 8px 0 14px;
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr) minmax(110px, auto);
    grid-template-rows: auto auto auto auto auto;
    padding: 8px;
  }

  .brand {
    gap: 8px;
    grid-column: 1;
    grid-row: 1;
  }

  .brand-logo {
    width: 118px;
    height: 36px;
  }

  .session-user-actions {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .client-mark {
    display: contents;
  }

  .client-logo {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
    justify-self: end;
    width: min(142px, 36vw);
    height: 32px;
    object-position: right center;
  }

  .status {
    grid-column: 1 / -1;
    grid-row: 3;
    justify-self: stretch;
    max-width: none;
    width: 100%;
    text-align: center;
  }

  .client-actions {
    grid-column: 1 / -1;
    grid-row: 4;
    justify-self: stretch;
    width: 100%;
  }

  .admin-preview-bar {
    grid-column: 1 / -1;
    grid-row: auto;
    justify-self: stretch;
    max-width: none;
    width: 100%;
    transform: none;
  }

  .timebox {
    grid-column: 1 / -1;
    grid-row: 5;
  }

  .brand small {
    white-space: normal;
  }

  .filter-main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .filter-main .segmented,
  .filter-main label,
  .filter-main button {
    width: 100%;
  }

  .filter-main .segmented {
    grid-column: 1 / -1;
  }

  .timebox .filter-toggle {
    grid-column: 2;
  }

  .filter-main .client-actions {
    grid-column: 1;
    grid-row: auto;
    width: 100%;
  }

  .timebox label {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    flex: initial;
  }

  .timebox select,
  .timebox button,
  .timebox .study-combobox-toggle,
  .timebox .study-search {
    width: 100%;
    min-height: 36px;
    height: 36px;
  }

  .timebox .catalog-filter-row {
    grid-template-columns: 1fr;
    position: static;
    width: 100%;
    max-height: 0;
    padding: 0 2px;
    border: 0;
    box-shadow: none;
    background: transparent;
    overflow: hidden;
    transform: none;
    transition: max-height 220ms ease, opacity 160ms ease, padding-top 180ms ease;
  }

  .timebox.filters-expanded .catalog-filter-row {
    max-height: 430px;
    padding-top: 8px;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
  }

  .timebox .catalog-filter-row label,
  .timebox .catalog-filter-row .study-filter,
  .timebox .admin-search-row {
    grid-column: 1 / -1;
  }

  .timebox .study-filter,
  .timebox .admin-search-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .timebox .study-combobox-menu {
    position: fixed;
    left: 7px;
    right: 7px;
    width: auto;
    min-width: 0;
  }

  .insights-button {
    width: 100%;
    max-width: none;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .panel-tabs {
    gap: 5px;
    padding: 5px;
  }

  .panel-tabs a,
  .panel-tabs.admin-nav-expanded a,
  .panel-tabs.admin-nav-expanded a.active {
    flex: 1 1 calc(50% - 5px);
    min-width: 0;
    padding: 0 6px;
    white-space: normal;
    text-align: center;
    line-height: 1.05;
  }

  .panel-tabs.admin-nav-expanded .admin-module-tabs,
  .panel-tabs.admin-nav-expanded:not(.admin-nav-ready) .admin-module-tabs,
  .panel-tabs.admin-nav-closing .admin-module-tabs {
    min-width: 100%;
  }

  .admin-module-tabs,
  .admin-km-tabs {
    width: 100%;
    overflow-x: auto;
  }

  .kpi-grid,
  .admin-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kpi {
    min-width: 0;
  }

  .report {
    padding: 10px;
  }

  .report-head {
    flex-wrap: wrap;
    gap: 6px;
  }

  .report-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .report-actions button {
    flex: 1 1 auto;
  }

  .admin-main-report,
  .admin-side-report,
  .admin-catalog-list,
  .admin-catalog-detail,
  .admin-km-entry,
  .admin-km-homes,
  .admin-km-validation {
    min-width: 0;
  }
}

@media (max-width: 520px) {
  .shell {
    width: min(100% - 10px, 1480px);
  }

  .topbar {
    border-radius: 7px;
  }

  .brand strong {
    font-size: 1.08rem;
  }

  .brand small {
    font-size: 0.52rem;
  }

  .filter-main {
    grid-template-columns: 1fr;
  }

  .timebox .filter-toggle {
    grid-column: 1;
  }

  .filter-main .client-actions {
    grid-column: 1;
  }

  .segmented {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .segmented button {
    min-width: 0;
    padding: 0 4px;
  }

  .timebox label,
  .timebox .study-filter,
  .timebox .admin-search-row {
    grid-template-columns: 1fr;
    gap: 3px;
    height: auto;
  }

  .timebox span {
    line-height: 1;
  }

  .timebox select,
  .timebox button,
  .timebox .study-combobox-toggle,
  .timebox .study-search {
    min-height: 38px;
    height: 38px;
  }

  .timebox .filter-toggle::after {
    right: 12px;
  }

  .client-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .insights-button {
    max-width: none;
  }

  .panel-tabs a,
  .panel-tabs.admin-nav-expanded a,
  .panel-tabs.admin-nav-expanded a.active {
    flex-basis: calc(50% - 5px);
    font-size: 0.68rem;
  }

  .kpi-grid,
  .admin-kpi-grid,
  .metric-grid,
  .pulse-grid,
  .pulse-trend-grid {
    grid-template-columns: 1fr;
  }

  .heatmap-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .project-row {
    grid-template-columns: 1fr;
  }

  .project-row > * {
    grid-column: 1 / -1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .timebox .catalog-filter-row,
  .timebox .filter-toggle::after {
    transition: none;
  }
}

/* Header refinement: keep secondary filters inside the header flow. */
.topbar {
  align-items: center;
}

.timebox {
  grid-template-rows: auto auto;
  align-self: center;
  overflow: visible;
}

.timebox .catalog-filter-row {
  position: static;
  max-height: 0;
  margin-top: 0;
  overflow: hidden;
  transform: translateY(-3px);
}

.timebox.filters-expanded .catalog-filter-row {
  max-height: 58px;
  padding-top: 8px;
  transform: translateY(0);
}

.timebox.filters-expanded .catalog-filter-row:has(.study-combobox.open) {
  max-height: 390px;
  overflow: visible;
}

.client-actions {
  width: 100%;
}

.client-actions .insights-button {
  width: 100%;
  min-width: 0;
}

.admin-page .topbar .client-actions {
  display: none;
}

.topbar .client-logo {
  grid-column: 1;
  grid-row: 1;
  justify-self: end;
}

.topbar .client-actions {
  justify-self: stretch;
}

.topbar .status {
  display: none !important;
}

@media (max-width: 760px) {
  .topbar {
    padding-inline: 12px;
  }

  .brand {
    min-width: 0;
  }

  .brand > span {
    min-width: 0;
  }

  .brand strong,
  .brand small {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .timebox.filters-expanded .catalog-filter-row {
    max-height: 430px;
  }

  .timebox.filters-expanded .catalog-filter-row:has(.study-combobox.open) {
    max-height: 620px;
    overflow: visible;
  }

  .topbar .client-logo {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
    justify-self: end;
    width: clamp(112px, 34vw, 142px);
    height: 32px;
  }

  .topbar .client-actions {
    grid-column: auto;
    grid-row: auto;
    justify-items: stretch;
    justify-self: stretch;
    width: 100%;
  }

  .topbar .report-menu-toggle {
    width: 100%;
    height: 38px;
    padding-inline: 12px 34px;
    text-align: center;
  }

  .topbar .report-menu {
    position: static;
    width: 100%;
    margin-top: 6px;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    display: none;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
  }

  .topbar .client-actions.report-menu-open .report-menu {
    display: grid;
  }

  .topbar .report-menu .insights-button {
    height: 38px;
  }

  .admin-preview-bar {
    grid-row: 3;
  }

  .timebox {
    grid-row: 5;
  }

  .panel-tabs {
    max-height: none;
  }

  .studies-table-report .study-table-wrap,
  .hermes-data-table-wrap,
  .study-table-wrap {
    overflow-x: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .studies-table-report .study-table,
  .hermes-data-table,
  .study-table {
    min-width: 760px;
    table-layout: auto;
  }

  .studies-table-report .study-table th,
  .studies-table-report .study-table td,
  .hermes-data-table th,
  .hermes-data-table td,
  .study-table th,
  .study-table td {
    min-width: 72px;
    white-space: nowrap;
  }

  .studies-table-report .study-table th:first-child,
  .studies-table-report .study-table td:first-child,
  .study-table th:first-child,
  .study-table td:first-child {
    min-width: 128px;
    white-space: normal;
    overflow-wrap: anywhere;
  }
}

/* Study selector: the results list needs room to be readable and must float
   above the dashboard content when opened from the compact header. */
.topbar:has(.study-combobox.open) {
  position: relative;
  z-index: 2000;
}

.timebox:has(.study-combobox.open) {
  z-index: 2001;
}

.timebox .study-combobox.open {
  z-index: 2002;
}

@media (min-width: 761px) {
  .timebox .study-combobox.open .study-combobox-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    left: auto;
    z-index: 2003;
    width: min(840px, calc(100vw - 48px));
    min-width: min(620px, calc(100vw - 48px));
    margin-top: 0;
  }

  .timebox .study-combobox-options {
    max-height: 300px;
  }

  .timebox .study-option {
    min-height: 38px;
  }

  .timebox .study-option-label,
  .timebox .study-option-code {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    overflow-wrap: normal;
  }
}

/* Report actions: visible buttons beside the client logo, outside filters. */
.filter-main {
  grid-template-columns: auto minmax(84px, 112px) minmax(84px, 112px) minmax(72px, 90px);
}

.client-mark {
  grid-template-columns: minmax(96px, 126px) minmax(112px, 142px);
  grid-template-rows: auto auto;
  gap: 4px 8px;
  max-width: 284px;
}

.client-mark .client-actions {
  grid-column: 1;
  grid-row: 1;
  display: grid;
  gap: 4px;
  width: 100%;
  align-self: center;
  justify-self: stretch;
}

.client-mark .client-logo {
  grid-column: 2;
  grid-row: 1;
  align-self: center;
  justify-self: end;
}

.client-mark .admin-preview-bar {
  grid-column: 1 / -1;
  grid-row: 2;
  justify-self: end;
}

.client-mark .insights-button {
  width: 100%;
  height: 20px;
  padding: 0 8px;
  text-align: center;
}

@media (max-width: 1280px) {
  .filter-main {
    grid-template-columns: auto minmax(80px, 1fr) minmax(80px, 1fr) minmax(72px, 90px);
  }
}

@media (max-width: 760px) {
  .client-mark {
    grid-template-columns: minmax(0, 1fr) minmax(112px, 34vw);
    gap: 6px 8px;
    max-width: none;
    width: 100%;
  }

  .client-mark .client-actions {
    grid-column: 1;
    grid-row: 1;
    align-self: center;
  }

  .client-mark .client-logo {
    grid-column: 2;
    grid-row: 1;
    width: clamp(112px, 34vw, 142px);
    height: 32px;
  }

  .client-mark .insights-button {
    min-height: 34px;
    height: 34px;
  }
}

/* ============================================================
   Mantenimiento de estudios HERMES (modal .ehm-*)
   ============================================================ */
body.ehm-open {
  overflow: hidden;
}

.ehm-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  background: rgba(23, 38, 66, 0.42);
  overflow-y: auto;
}

.ehm-overlay[hidden] {
  display: none;
}

.ehm-dialog {
  width: 100%;
  max-width: 900px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--float-shadow);
  padding: 18px 20px 20px;
}

.ehm-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  margin-bottom: 14px;
}

.ehm-head span {
  color: var(--teal-dark);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ehm-head h2 {
  margin: 2px 0 2px;
  color: var(--ink);
  font-size: 1.24rem;
  font-weight: 850;
}

.ehm-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.ehm-close {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  color: var(--ink);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.ehm-close:hover {
  background: var(--soft-2);
}

.ehm-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
}

.ehm-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.ehm-grid .ehm-wide {
  grid-column: 1 / -1;
}

.ehm-grid label > span {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.ehm-grid input,
.ehm-grid select,
.ehm-grid textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 9px;
  font-size: 0.86rem;
  color: var(--ink);
  background: #fff;
  width: 100%;
  min-width: 0;
}

.ehm-grid input:focus,
.ehm-grid select:focus,
.ehm-grid textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 2px rgba(80, 144, 168, 0.18);
}

.ehm-grid textarea {
  resize: vertical;
}

.ehm-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.ehm-actions .ehm-msg {
  margin-right: auto;
  font-size: 0.8rem;
  font-weight: 700;
}

.ehm-msg[data-tone="ok"] { color: #2f8f5b; }
.ehm-msg[data-tone="error"] { color: var(--red); }
.ehm-msg[data-tone="info"] { color: var(--blue); }

.ehm-primary,
.ehm-secondary {
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 0.84rem;
  font-weight: 800;
  cursor: pointer;
  border: 1px solid transparent;
}

.ehm-primary {
  background: var(--teal-dark);
  color: #fff;
}

.ehm-primary:hover {
  background: var(--navy);
}

.ehm-primary:disabled {
  opacity: 0.6;
  cursor: default;
}

.ehm-secondary {
  background: var(--soft);
  color: var(--ink);
  border-color: var(--line);
}

.ehm-secondary:hover {
  background: var(--soft-2);
}

.ehm-list-box {
  margin-top: 20px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.ehm-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.ehm-list-head strong {
  color: var(--ink);
  font-size: 0.92rem;
}

.ehm-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
}

.ehm-table-wrap {
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.ehm-table thead th {
  position: sticky;
  top: 0;
  background: var(--soft);
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  text-align: left;
  padding: 7px 9px;
  border-bottom: 1px solid var(--line);
}

.ehm-table tbody td {
  padding: 7px 9px;
  border-bottom: 1px solid var(--soft-2);
  color: var(--ink);
  vertical-align: middle;
}

.ehm-table .ehm-num {
  text-align: right;
  white-space: nowrap;
}

.ehm-table tr.ehm-archived td {
  color: var(--muted);
  background: var(--soft);
}

.ehm-empty {
  text-align: center;
  color: var(--muted);
  padding: 18px 9px;
}

.ehm-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  background: var(--soft-2);
  color: var(--ink);
  white-space: nowrap;
}

.ehm-estado-business_case { background: #eef3fb; color: var(--blue); }
.ehm-estado-aprobado { background: #e8f4ee; color: #2f8f5b; }
.ehm-estado-en_gandia { background: #e7f0f4; color: var(--teal-dark); }
.ehm-estado-rechazado { background: #fbecee; color: var(--red); }
.ehm-estado-cerrado { background: #eceff4; color: var(--muted); }

.ehm-row-actions {
  white-space: nowrap;
  text-align: right;
}

.ehm-row-actions button {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font-size: 0.74rem;
  font-weight: 700;
  padding: 4px 9px;
  margin-left: 5px;
  cursor: pointer;
}

.ehm-row-actions button:hover {
  background: var(--soft);
}

.ehm-row-actions .ehm-danger {
  color: var(--red);
  border-color: #f0cdd2;
}

.ehm-row-actions .ehm-danger:hover {
  background: #fbecee;
}

.ehm-tag {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
}

@media (max-width: 640px) {
  .ehm-grid {
    grid-template-columns: 1fr;
  }
}
