/* ==========================================================================
   1. VARIABLES GLOBALES Y RESET
   ========================================================================== */
:root {
  --primary-color: #1b4332;
  --primary-light: #2d5a45;
  --secondary-color: #c5cfc9;
  --secondary-light: #f1f4f2;
  --bg-color: #f8faf9;
  --card-bg: #ffffff;
  --text-main: #1b4332;
  --text-muted: #537061;
  --error-color: #bc3a3a;
  --error-bg: #fde8e8;
  --border-radius: 12px;
  --transition-smooth: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-sm: 0 2px 4px rgba(27, 67, 50, 0.05);
  --shadow-md: 0 8px 16px rgba(27, 67, 50, 0.08);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* ==========================================================================
   2. PANTALLA DE LOGIN
   ========================================================================== */
.login-body {
  background: linear-gradient(
    135deg,
    var(--secondary-light) 0%,
    var(--secondary-color) 100%
  );
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.login-container {
  width: 100%;
  max-width: 440px;
  background-color: var(--card-bg);
  padding: 40px 30px;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-md);
  animation: fadeIn 0.4s ease-out;
}

.login-header {
  text-align: center;
  margin-bottom: 35px;
}

.brand-logo {
  max-width: 100%;
  height: auto;
  object-fit: contain;
  display: inline-block;
}

.form-title-area {
  margin-bottom: 25px;
}

.form-title-area h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 8px;
}

.form-title-area p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Campos de entrada flotantes modernos */
.input-group {
  position: relative;
  margin-bottom: 20px;
}

.input-group input {
  width: 100%;
  padding: 16px 16px 16px 48px;
  border: 1.5px solid var(--secondary-color);
  background-color: transparent;
  border-radius: var(--border-radius);
  font-size: 1rem;
  color: var(--primary-color);
  outline: none;
  transition: var(--transition-smooth);
}

/* Interacción con el label flotante */
.input-group label {
  position: absolute;
  left: 48px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  transition: var(--transition-smooth);
  font-size: 1rem;
  background-color: transparent;
  padding: 0 4px;
}

.input-group input:focus,
.input-group input:not(:placeholder-shown) {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(27, 67, 50, 0.1);
}

.input-group input:focus ~ label,
.input-group input:not(:placeholder-shown) ~ label {
  top: 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary-color);
  background-color: var(--card-bg);
}

.input-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  transition: var(--transition-smooth);
}

.input-group input:focus ~ .input-icon {
  color: var(--primary-color);
}

.password-toggle-btn {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
}

.password-toggle-btn:hover {
  color: var(--primary-color);
}

/* Mensajes de error */
.login-error-message {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--error-bg);
  color: var(--error-color);
  padding: 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 20px;
  border-left: 4px solid var(--error-color);
}

.form-utilities {
  margin-bottom: 25px;
  text-align: right;
}

.forgot-password-link {
  color: var(--primary-color);
  font-size: 0.85rem;
  text-decoration: none;
  font-weight: 500;
}

.forgot-password-link:hover {
  text-decoration: underline;
}

/* Botón Principal */
.btn-primary {
  width: 100%;
  background-color: var(--primary-color);
  color: #ffffff;
  border: none;
  padding: 16px;
  border-radius: var(--border-radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  transition: var(--transition-smooth);
  box-shadow: 0 4px 12px rgba(27, 67, 50, 0.2);
}

.btn-primary:hover {
  background-color: var(--primary-light);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(27, 67, 50, 0.3);
}

.btn-primary:active {
  transform: translateY(1px);
}

/* ==========================================================================
   3. ANIMACIONES SIMPLES
   ========================================================================== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   4. ADAPTACIÓN PARA ORDENADOR (MEDIA QUERIES)
   ========================================================================== */
@media (min-width: 768px) {
  .login-container {
    padding: 50px 40px;
  }
}

/* ==========================================================================
    5. DASHBOARD
  ========================================================================== */

:root {
  --on-primary: #ffffff;
  --amber-soft: #fff3dc;
}

body.dark {
  --on-primary: #0b2118;
  --amber-soft: #3c2d16;
}

body.dark .leaflet-popup-content-wrapper {
  color: var(--text);
  background: var(--surface);
  border-top-color: var(--primary);
}

body.dark .leaflet-popup-tip {
  background: var(--surface);
}

body.dark .leaflet-control-zoom a {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
}

body.dark .leaflet-control-zoom a:hover {
  color: var(--on-primary);
  background: var(--primary);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  transition:
    background 0.2s ease,
    color 0.2s ease;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.brand {
  display: flex;
  align-items: center;
}

.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.eyebrow {
  margin: 0 0 3px;
  font-weight: 800;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  line-height: 1.12;
}

.subtitle {
  margin: 7px 0 0;
}

.top-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 13px;
  font-size: 14px;
  white-space: nowrap;
}

.button {
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
}

.button:hover {
  border-color: color-mix(in srgb, var(--primary) 42%, var(--border));
}

.button.ghost {
  background: transparent;
  box-shadow: none;
}

.button.icon-only {
  width: 40px;
  padding: 0;
}

.button svg,
.filter-icon svg,
.section-icon svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.filters-panel {
  margin-bottom: 18px;
}

.filters-grid {
  display: grid;
  grid-template-columns: minmax(210px, 1.4fr) minmax(150px, 0.8fr) repeat(
      5,
      minmax(140px, 0.8fr)
    ) auto;
  align-items: end;
}

.field {
  min-width: 0;
}

.field label {
  display: block;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.control-wrap {
  position: relative;
}

.control,
select.control {
  width: 100%;
  color: var(--text);
  border: 1px solid var(--border);
  outline: none;
}

.control.search {
  padding-left: 40px;
}

.date-filter-control {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 7px;
}

.date-filter-input {
  min-width: 0;
  font-variant-numeric: tabular-nums;
}

.date-picker-button {
  display: grid;
  width: 44px;
  min-height: 44px;
  place-items: center;
  padding: 0;
  color: var(--primary);
  background: color-mix(in srgb, var(--surface-2) 74%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--border) 92%, var(--text));
  border-radius: 12px;
  cursor: pointer;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.date-picker-button:hover {
  background: var(--surface);
  border-color: color-mix(in srgb, var(--primary) 32%, var(--border));
}

.date-picker-button:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent);
}

.date-picker-button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.date-picker-button svg {
  width: 18px;
  height: 18px;
}

.date-picker-native {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.date-filter-input[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 12%, transparent);
}

.field-error {
  display: block;
  margin: 6px 2px 0;
  color: var(--danger);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.35;
}

.field-error[hidden] {
  display: none;
}

.control:focus,
select.control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent);
}

.filter-icon {
  position: absolute;
  top: 50%;
  left: 12px;
  display: grid;
  place-items: center;
  color: var(--muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.filter-actions {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.filter-count {
  display: inline-flex;
  align-items: center;
  padding: 8px 11px;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 11px;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.filter-count strong {
  margin-right: 3px;
  color: var(--text);
  font-size: 14px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(145px, 1fr));
}

.kpi-card {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
}

.kpi-card::after {
  content: "";
  position: absolute;
  background: var(--kpi-soft, var(--primary-soft));
  border-radius: 50%;
}

.kpi-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.kpi-label {
  color: var(--muted);
  font-weight: 800;
  text-transform: uppercase;
}

.kpi-icon {
  display: grid;
  place-items: center;
  color: var(--kpi-color, var(--primary));
  background: var(--kpi-soft, var(--primary-soft));
}

.kpi-icon svg {
  width: 17px;
  height: 17px;
}

.kpi-value {
  position: relative;
  z-index: 1;
  margin: 12px 0 2px;
  line-height: 1;
}

.kpi-note {
  position: relative;
  z-index: 1;
}

body.dark .kpi-note {
  color: #c2cad7;
}

.kpi-note strong {
  color: var(--kpi-color, var(--primary));
}

.kpi-card.alert-card {
  box-shadow: 0 5px 18px color-mix(in srgb, var(--danger) 10%, transparent);
}

.kpi-card.alert-card::after {
  opacity: 0.5;
}

.kpi-card.alert-card .kpi-note strong {
  font-size: 14px;
  font-weight: 900;
}

.kpi-card.alert-card .kpi-value {
  color: var(--danger);
}

.dashboard-grid {
  display: grid;
}

.stack {
  display: grid;
  min-width: 0;
}

.chart-panel,
.map-panel,
.table-panel,
.insights-panel {
  min-width: 0;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.section-title-wrap {
  display: flex;
}

.section-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--primary);
  background: var(--primary-soft);
}

.section-title {
  margin: 0;
}

.section-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.mini-select {
  min-height: 34px;
  padding: 6px 9px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  font-size: 12px;
  font-weight: 700;
}

.charts-two {
  display: grid;
  grid-template-columns: minmax(260px, 0.72fr) minmax(0, 1.28fr);
  gap: 18px;
  align-items: stretch;
}

.chart-box {
  min-width: 0;
  border: 1px solid var(--border);
}

.chart-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.chart-caption h3 {
  margin: 0;
}

.chart-caption span {
  color: var(--muted);
}

.donut-layout {
  display: grid;
  place-items: center;
}

.donut-visual {
  display: grid;
  grid-template-columns: minmax(88px, 1fr) 175px minmax(88px, 1fr);
  align-items: center;
  width: 100%;
  gap: 8px;
}

.donut-wrap {
  position: relative;
  max-width: 100%;
  aspect-ratio: 1;
}

.donut-wrap svg {
  width: 100%;
  height: 100%;
  transform: rotate(90deg);
}

.donut-track,
.donut-segment {
  fill: none;
}

.donut-track {
  stroke: var(--border);
}

.donut-segment {
  cursor: help;
  pointer-events: stroke;
  stroke-linecap: round;
  transition:
    stroke-dasharray 0.35s ease,
    stroke-dashoffset 0.35s ease;
}

.donut-segment:focus-visible {
  outline: none;
  filter: drop-shadow(
    0 0 5px color-mix(in srgb, currentColor 42%, transparent)
  );
  stroke-width: 22;
}

.donut-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  pointer-events: none;
}

.donut-center strong {
  letter-spacing: -0.04em;
}

.donut-center span {
  color: var(--muted);
  font-size: 11px;
}

.donut-direct-label {
  display: grid;
  gap: 2px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
  cursor: help;
  outline: none;
}

.donut-direct-label:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--primary) 72%, white);
  outline-offset: 4px;
  border-radius: 8px;
}

.donut-direct-label strong {
  color: var(--text);
}

.donut-direct-label::after {
  content: "";
  position: absolute;
  top: 50%;
  border-top: 1.5px solid currentColor;
}

.donut-direct-label.onsite {
  align-self: start;
  margin-top: 42px;
  text-align: right;
}

.donut-direct-label.onsite::after {
  right: 1px;
  transform: rotate(13deg);
  transform-origin: right;
}

.donut-direct-label.remote {
  align-self: end;
  margin-bottom: 42px;
  text-align: left;
}

.donut-direct-label.remote::after {
  left: 1px;
  transform: rotate(13deg);
  transform-origin: left;
}

.type-swatch {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  background: var(--type-color);
  border-radius: 50%;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--type-color) 14%, transparent);
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.legend-dot.punctual {
  background: var(--green);
}

.legend-dot.late {
  background: var(--amber-chart);
}

.legend-dot.severe {
  background: var(--danger-chart);
}

.hour-chart-frame {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 8px;
}

.y-axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 198px;
  margin-top: 16px;
  padding-bottom: 1px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  text-align: right;
}

.hour-chart {
  position: relative;
  display: grid;
  grid-template-columns: repeat(9, minmax(22px, 1fr));
  align-items: end;
  gap: 8px;
  height: 225px;
  padding-top: 16px;
  border-bottom: 1px solid var(--border);
  isolation: isolate;
}

.hour-chart::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 16px 0 27px;
  background: repeating-linear-gradient(
    to top,
    color-mix(in srgb, var(--border) 82%, transparent) 0 1px,
    transparent 1px calc(100% / var(--grid-intervals, 7))
  );
  pointer-events: none;
}

.hour-column {
  display: grid;
  grid-template-rows: 1fr auto;
  align-items: end;
  gap: 8px;
  height: 100%;
  min-width: 0;
  border-radius: 9px;
  cursor: help;
  outline: none;
}

.hour-column:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--primary) 72%, white);
  outline-offset: 3px;
}

.bar-area {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: 100%;
  border-radius: 8px 8px 0 0;
}

.hour-bar {
  width: min(30px, 72%);
  min-height: 3px;
  border-radius: 7px 7px 2px 2px;
  transition:
    height 0.35s ease,
    opacity 0.2s ease;
}

.hour-column:hover .hour-bar {
  opacity: 0.76;
}

.bar-value {
  position: absolute;
  top: -18px;
  left: 50%;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  transform: translateX(-50%);
}

.bar-label {
  color: var(--muted);
  font-size: 10px;
  text-align: center;
  white-space: nowrap;
}

.department-chart {
  display: grid;
  gap: 13px;
}

.department-row,
.department-chart-header {
  display: grid;
  grid-template-columns: minmax(130px, 0.8fr) minmax(130px, 1.7fr) 72px 82px;
  align-items: center;
  gap: 12px;
}

.department-chart-header {
  padding: 0 0 8px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  font-weight: 850;
}

.department-chart-header span:nth-last-child(-n + 2) {
  text-align: right;
}

.department-name {
  overflow: hidden;
  font-size: 13.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stacked-track {
  display: flex;
  overflow: hidden;
  background: var(--border);
  border-radius: 999px;
}

.stacked-segment {
  min-width: 0;
  height: 100%;
  cursor: help;
  outline: none;
  transition: width 0.35s ease;
}

.stacked-segment.punctual {
  background: var(--green);
}

.stacked-segment.late {
  background: var(--amber-chart);
}

.stacked-segment.severe {
  background: var(--danger-chart);
}

.dept-value {
  color: var(--text);
  font-size: 11.5px;
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
}

.chart-legend-inline {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 14px;
  color: var(--muted);
  font-size: 11px;
}

.chart-legend-inline span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.map-shell {
  position: relative;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

#map {
  width: 100%;
  height: 100%;
}

.map-legend {
  position: absolute;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  max-width: calc(100% - 28px);
  color: var(--muted);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border: 1px solid color-mix(in srgb, var(--border) 88%, transparent);
  font-size: 12.5px;
  font-weight: 650;
  pointer-events: none;
  backdrop-filter: blur(6px);
}

.map-legend-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.map-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.map-dot {
  width: 12px;
  height: 12px;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
}

.map-dot.onsite {
  background: var(--primary);
}

.map-dot.remote {
  background: var(--blue);
}

.attendance-dot-wrapper {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
}

.attendance-dot {
  width: 13px;
  height: 13px;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.28),
    0 0 0 3px rgba(0, 0, 0, 0.08);
  transition: transform 0.15s ease;
}

.attendance-dot-wrapper:hover .attendance-dot {
  transform: scale(1.5);
}

.custom-cluster-icon {
  background: transparent;
  border: 0;
}

.cluster-bubble {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  color: #172033;
  background: conic-gradient(
    var(--primary) 0 var(--onsite-share, 70%),
    var(--blue) var(--onsite-share, 70%) 100%
  );
  border: 4px solid rgba(255, 255, 255, 0.96);
  border-radius: 50%;
  font-size: 15px;
  font-weight: 850;
  transition: transform 0.15s ease;
}

.cluster-count {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(23, 32, 51, 0.14);
  border-radius: 50%;
}

.cluster-bubble.medium {
  width: 60px;
  height: 60px;
}

.cluster-bubble.large {
  width: 68px;
  height: 68px;
  font-size: 17px;
}

.cluster-bubble.large .cluster-count {
  width: 37px;
  height: 37px;
}

.leaflet-cluster-spider-leg {
  stroke: var(--primary-dark);
  stroke-width: 1.8;
  stroke-opacity: 0.62;
}

.leaflet-tooltip.spiderfy-name-label {
  max-width: 170px;
  overflow: hidden;
  padding: 4px 7px;
  color: #17231f;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(19, 90, 66, 0.2);
  border-radius: 7px;
  box-shadow: 0 3px 10px rgba(13, 51, 40, 0.14);
  font-family: var(--body-font);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  pointer-events: auto;
}

.leaflet-tooltip.spiderfy-name-label::before {
  display: none;
}

body.dark .leaflet-tooltip.spiderfy-name-label {
  color: var(--text);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
  box-shadow: 0 4px 13px rgba(0, 0, 0, 0.3);
}

.leaflet-popup-content-wrapper {
  color: #202635;
  background: #fff;
  border-radius: 14px;
  border-top: 4px solid var(--primary);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.leaflet-popup-content {
  min-width: 230px;
  margin: 14px 16px;
  font-size: 13px;
  line-height: 1.55;
}

.popup-title {
  display: block;
  margin-bottom: 3px;
  font-size: 16px;
  font-weight: 800;
}

.popup-subtitle {
  display: block;
  margin-bottom: 9px;
  color: #6d7482;
  font-size: 11px;
}

.popup-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 0;
  border-bottom: 1px solid #edf0f4;
}

.popup-row:last-child {
  border-bottom: 0;
}

.popup-row span:first-child {
  color: #6d7482;
}

.popup-row strong {
  text-align: right;
}

.popup-catalog-value {
  display: flex;
  max-width: 175px;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
}

.popup-catalog-value small {
  margin-top: 1px;
  color: #6d7482;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.35;
}

.leaflet-control-zoom {
  border: 0 !important;
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2) !important;
}

.leaflet-control-zoom a {
  width: 35px !important;
  height: 35px !important;
  line-height: 35px !important;
}

.insights-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.insight-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  border: 1px solid var(--border);
}

.insight-marker {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 9px;
  font-size: 13px;
  font-weight: 900;
}

.insight-item strong {
  display: block;
  margin-bottom: 2px;
}

.insight-item p {
  margin: 0;
}

body.dark .insight-item p {
  color: #c2cad7;
}

.quality-meter {
  margin-top: 15px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--green) 25%, transparent);
}

.quality-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
  font-size: 12px;
  font-weight: 800;
}

.quality-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.quality-info-button {
  display: inline-grid;
  width: 19px;
  height: 19px;
  padding: 0;
  place-items: center;
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--primary) 28%, var(--border));
  border-radius: 50%;
  font: inherit;
  font-size: 10px;
  font-weight: 850;
  line-height: 1;
  cursor: help;
  outline: none;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    transform 0.15s ease;
}

.quality-info-button:hover,
.quality-info-button:focus-visible {
  background: color-mix(in srgb, var(--primary) 18%, var(--surface));
  border-color: var(--primary);
  transform: translateY(-1px);
}

.quality-info-button:focus-visible {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}

.meter-track {
  overflow: hidden;
  height: 9px;
  background: color-mix(in srgb, var(--green) 18%, var(--surface));
  border-radius: 999px;
}

.meter-fill {
  width: 0;
  height: 100%;
  background: var(--green);
  border-radius: inherit;
  transition: width 0.35s ease;
}

.table-panel {
  margin-bottom: 22px;
}

.records-legend-toggle {
  min-height: 38px;
  padding: 0 12px;
  font-size: 12px;
}

.records-legend-toggle.is-active {
  color: var(--primary);
  background: var(--primary-soft);
  border-color: color-mix(in srgb, var(--primary) 38%, var(--border));
}

.records-legend-panel {
  margin: -2px 0 18px;
  padding: 16px;
  background: color-mix(in srgb, var(--surface-2) 78%, var(--surface));
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: inset 3px 0 0 color-mix(in srgb, var(--primary) 72%, transparent);
}

.records-legend-panel[hidden] {
  display: none;
}

.records-legend-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.records-legend-heading h3,
.records-legend-group h4 {
  margin: 0;
  color: var(--text);
}

.records-legend-heading h3 {
  font-size: 14px;
  font-weight: 850;
  letter-spacing: -0.015em;
}

.records-legend-heading p,
.records-legend-note {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.records-legend-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 14px;
}

.records-legend-group {
  min-width: 0;
  padding: 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 13px;
}

.records-legend-group h4 {
  margin-bottom: 11px;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.records-legend-items {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px 16px;
}

.records-legend-item {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: start;
  gap: 9px;
}

.records-legend-item strong,
.records-legend-item small {
  display: block;
}

.records-legend-item strong {
  color: var(--text);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
}

.records-legend-item small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.records-legend-swatch {
  width: 32px;
  height: 10px;
  margin-top: 2px;
  background: var(--legend-color);
  border: 1px solid color-mix(in srgb, var(--legend-color) 72%, var(--border));
  border-radius: 999px;
}

.records-legend-swatch.is-planned {
  --legend-color: var(--timeline-planned);
}

.records-legend-swatch.is-paid {
  --legend-color: var(--timeline-paid);
}

.records-legend-swatch.is-unpaid {
  --legend-color: var(--timeline-unpaid);
}

.records-legend-swatch.is-outside {
  --legend-color: var(--timeline-outside);
}

.records-legend-swatch.is-overtime {
  --legend-color: var(--timeline-overtime);
}

.records-legend-swatch.is-missing {
  --legend-color: var(--timeline-missing);
}

.records-status-list {
  display: grid;
  gap: 9px;
}

.records-status-item {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.records-status-item .badge {
  width: max-content;
}

.records-status-item p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.records-legend-note {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

@media (max-width: 980px) {
  .records-legend-grid,
  .records-legend-items {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .records-legend-toggle,
  .table-panel .mini-select {
    flex: 1;
  }

  .records-legend-panel {
    padding: 12px;
  }

  .records-status-item {
    grid-template-columns: 1fr;
    gap: 5px;
  }
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 1380px;
  border-collapse: collapse;
  background: var(--surface);
}

th,
td {
  padding: 12px 13px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
  font-size: 12px;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  background: var(--surface-2);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}

th.sortable {
  cursor: pointer;
  user-select: none;
}

th.sortable:hover {
  color: var(--text);
}

tbody tr:last-child td {
  border-bottom: 0;
}

.person-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 190px;
}

.avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  color: #fff;
  background: var(--avatar, var(--primary));
  border-radius: 10px;
  font-size: 11px;
  font-weight: 850;
}

.person-name {
  display: block;
  font-weight: 800;
}

.person-id {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.catalog-cell {
  display: block;
  min-width: 150px;
}

.assignment-cell {
  display: grid;
  gap: 8px;
  min-width: 170px;
}

.assignment-cell .catalog-cell + .catalog-cell {
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.catalog-kind {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 850;
  letter-spacing: 0.075em;
  text-transform: uppercase;
}

.catalog-cell > strong {
  display: block;
  font-weight: 750;
}

.catalog-schedule {
  display: block;
  max-width: 180px;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 10px;
  white-space: nowrap;
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  background: currentColor;
  border-radius: 50%;
}

.badge.presencial {
  color: var(--primary);
  background: var(--primary-soft);
}

.badge.remoto {
  color: var(--blue);
  background: var(--blue-soft);
}

.badge.puntual {
  color: var(--green);
  background: var(--green-soft);
}

.badge.retraso {
  color: var(--amber);
  background: var(--amber-soft);
}

.badge.incidencia,
.badge.retraso-grave {
  color: var(--danger);
  background: var(--danger-soft);
}

.timeline-cell {
  display: grid;
  gap: 4px;
  min-width: 360px;
}

.timeline-ruler {
  position: relative;
  height: 16px;
  margin-left: 34px;
  color: var(--muted);
  font-size: 8.5px;
  font-variant-numeric: tabular-nums;
}

.timeline-tick {
  position: absolute;
  top: 0;
  left: var(--tick-left);
  transform: translateX(-50%);
  white-space: nowrap;
}

.timeline-tick::after {
  position: absolute;
  top: 11px;
  left: 50%;
  width: 1px;
  height: 4px;
  background: var(--border-strong);
  content: "";
}

.timeline-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
}

.timeline-row-label {
  overflow: hidden;
  color: var(--muted);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.timeline-track {
  position: relative;
  overflow: hidden;
  height: 14px;
  background:
    linear-gradient(
      90deg,
      transparent 24.7%,
      var(--border) 25%,
      transparent 25.3%
    ),
    linear-gradient(
      90deg,
      transparent 49.7%,
      var(--border) 50%,
      transparent 50.3%
    ),
    linear-gradient(
      90deg,
      transparent 74.7%,
      var(--border) 75%,
      transparent 75.3%
    ),
    color-mix(in srgb, var(--surface-2) 88%, var(--border));
  border: 1px solid var(--border);
  border-radius: 999px;
}

.timeline-track-planned {
  height: 10px;
  background: color-mix(in srgb, var(--surface-2) 90%, var(--border));
  border-style: dashed;
}

.timeline-planned-segment {
  position: absolute;
  top: 1px;
  bottom: 1px;
  left: var(--segment-left);
  width: var(--segment-width);
  min-width: 4px;
  background: var(--timeline-planned);
  border: 0;
  border-radius: 999px;
  box-shadow: none;
  cursor: help;
  outline: none;
  transition:
    background 0.15s ease,
    transform 0.15s ease;
}

.timeline-planned-segment:hover,
.timeline-planned-segment:focus-visible {
  z-index: 2;
  background: var(--timeline-planned);
  transform: scaleY(1.35);
}

.timeline-planned-segment:focus-visible {
  box-shadow:
    0 0 0 2px var(--surface),
    0 0 0 4px var(--primary);
}

.timeline-segment {
  position: absolute;
  z-index: 1;
  top: 1px;
  bottom: 1px;
  left: var(--segment-left);
  width: var(--segment-width);
  min-width: 4px;
  background: var(--segment-color);
  border-radius: 999px;
  box-shadow: inset 0 -1px 0 rgba(17, 24, 39, 0.2);
  cursor: help;
  outline: none;
  transition:
    filter 0.15s ease,
    transform 0.15s ease;
}

.timeline-missing-segment {
  position: absolute;
  z-index: 0;
  top: 1px;
  bottom: 1px;
  left: var(--segment-left);
  width: var(--segment-width);
  min-width: 4px;
  background: var(--timeline-missing);
  border: 1px solid
    color-mix(in srgb, var(--timeline-missing) 78%, var(--danger));
  border-radius: 999px;
  cursor: help;
  outline: none;
  transition:
    filter 0.15s ease,
    transform 0.15s ease;
}

.timeline-missing-segment:hover,
.timeline-missing-segment:focus-visible {
  z-index: 3;
  filter: saturate(1.12) brightness(1.03);
  transform: scaleY(1.35);
}

.timeline-missing-segment:focus-visible {
  box-shadow:
    0 0 0 2px var(--surface),
    0 0 0 4px var(--timeline-missing);
}

.timeline-segment:hover,
.timeline-segment:focus-visible {
  z-index: 2;
  filter: saturate(1.15) brightness(1.04);
  transform: scaleY(1.35);
}

.timeline-segment:focus-visible {
  box-shadow:
    0 0 0 2px var(--surface),
    0 0 0 4px var(--segment-color);
}

.timeline-segment.is-open {
  background: repeating-linear-gradient(
    135deg,
    var(--segment-color) 0 5px,
    color-mix(in srgb, var(--segment-color) 62%, white) 5px 9px
  );
}

.timeline-segment.is-muted {
  opacity: 0.2;
  filter: saturate(0.35);
}

.detail-toggle-cell {
  width: 58px;
  text-align: right;
}

.detail-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 92px;
  min-height: 36px;
  padding: 6px 9px;
  color: var(--primary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    transform 0.15s ease;
}

.detail-toggle:hover {
  background: var(--primary-soft);
  border-color: color-mix(in srgb, var(--primary) 36%, var(--border));
}

.detail-toggle:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 24%, transparent);
  outline-offset: 2px;
}

.detail-toggle-count {
  display: grid;
  place-items: center;
  min-width: 19px;
  height: 19px;
  padding-inline: 4px;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 999px;
  font-size: 9px;
}

.record-row.is-expanded td {
  background: color-mix(in srgb, var(--primary-soft) 42%, var(--surface));
  border-bottom-color: transparent;
}

.record-detail-row:hover,
.record-detail-row td {
  background: color-mix(in srgb, var(--primary-soft) 27%, var(--surface));
}

.record-detail-row td {
  padding: 0 14px 14px;
}

.record-detail-panel {
  padding: 15px;
  background: color-mix(in srgb, var(--surface) 88%, var(--surface-2));
  border: 1px solid color-mix(in srgb, var(--primary) 20%, var(--border));
  border-radius: 14px;
  box-shadow: inset 3px 0 0 color-mix(in srgb, var(--primary) 70%, transparent);
}

.record-detail-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 12px;
}

.record-detail-title {
  display: grid;
  gap: 2px;
}

.record-detail-heading-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.record-detail-heading strong {
  font-family: var(--display-font);
  font-size: 13px;
}

.record-detail-heading span {
  color: var(--muted);
  font-size: 10.5px;
}

.record-detail-total {
  padding: 6px 9px;
  color: var(--primary) !important;
  background: var(--primary-soft);
  border-radius: 999px;
  font-weight: 800;
  white-space: nowrap;
}

.detail-list {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 11px;
}

.detail-list-header,
.detail-list-row {
  display: grid;
  grid-template-columns: 76px 86px 100px minmax(155px, 0.7fr) 104px minmax(
      220px,
      1.3fr
    );
  align-items: center;
  gap: 12px;
  padding: 9px 11px;
}

.detail-list-header {
  color: var(--muted);
  background: var(--surface-2);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.detail-list-row {
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.detail-list-row.is-muted {
  opacity: 0.48;
}

.detail-time,
.detail-type,
.detail-type > span:last-child {
  display: grid;
  gap: 1px;
}

.detail-time strong,
.detail-duration {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.detail-type small {
  color: var(--muted);
  font-size: 9px;
}

.detail-type {
  grid-template-columns: 9px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
}

.detail-location {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-map-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 6px 12px;
  color: var(--primary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  font: inherit;
  font-size: 10.5px;
  font-weight: 800;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.detail-map-button:hover {
  background: var(--primary-soft);
  border-color: color-mix(in srgb, var(--primary) 34%, var(--border));
}

.detail-map-button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 22%, transparent);
  outline-offset: 2px;
}

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 13px;
  color: var(--muted);
  font-size: 12px;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 6px;
}

.page-button {
  display: grid;
  place-items: center;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  font-size: 12px;
  font-weight: 800;
}

.page-button.active {
  color: var(--on-primary);
  background: var(--primary);
  border-color: var(--primary);
}

.page-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.empty-state {
  display: none;
  padding: 40px 20px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  display: block;
  margin-bottom: 5px;
  color: var(--text);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1280px) {
  .filters-grid {
    grid-template-columns: repeat(3, minmax(180px, 1fr));
  }

  .filter-actions {
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .kpi-grid {
    grid-template-columns: repeat(3, minmax(160px, 1fr));
  }

  .stack.side {
    grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  }
}

@media (max-width: 880px) {
  .topbar {
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .filters-grid {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(145px, 1fr));
  }

  .charts-two,
  .stack.side {
    grid-template-columns: 1fr;
  }

  .donut-visual {
    max-width: 470px;
  }

  .map-shell {
    height: 430px;
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding: 11px;
  }

  .brand {
    align-items: flex-start;
  }

  .filters-grid {
    grid-template-columns: 1fr;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-actions {
    justify-content: stretch;
    align-items: stretch;
    flex-direction: column;
  }

  .filter-actions .button {
    flex: 1;
  }

  .filter-count {
    justify-content: center;
  }

  .section-head,
  .table-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .section-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .hour-chart {
    gap: 4px;
  }

  .department-row {
    grid-template-columns: 96px 1fr 54px 64px;
    gap: 7px;
  }

  .department-chart-header {
    grid-template-columns: 96px 1fr 54px 64px;
    gap: 7px;
  }

  .department-name {
    font-size: 12px;
  }

  .map-shell {
    height: 360px;
  }

  .chart-panel,
  .map-panel,
  .table-panel,
  .insights-panel {
    padding: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}
/* Professional UI edition */
:root {
  --bg: #f4f7f5;
  --surface: #ffffff;
  --surface-2: #f7faf8;
  --text: #17221e;
  --muted: #56645e;
  --border: #dce5e0;
  --primary: #176b4c;
  --primary-dark: #0d4f38;
  --primary-soft: #e5f3ec;
  --blue: #2f6fed;
  --blue-soft: #e9f0ff;
  --green: #0f8877;
  --green-soft: #e3f5f1;
  --slate: #536471;
  --slate-soft: #edf1f3;
  --amber: #a96000;
  --amber-chart: #e09a00;
  --danger: #b4232d;
  --danger-chart: #c21f44;
  --danger-soft: #fdecee;
  --timeline-planned: #9aa6a0;
  --timeline-missing: #d5656d;
  --timeline-paid: #10b981;
  --timeline-unpaid: #f59e0b;
  --timeline-outside: #8b5cf6;
  --timeline-overtime: #f472b6;
  --shadow: 0 18px 50px rgba(28, 55, 44, 0.075);
  --shadow-soft: 0 7px 22px rgba(28, 55, 44, 0.065);
  --radius-lg: 22px;
  --display-font: "Manrope", "Inter", ui-sans-serif, system-ui, sans-serif;
}

body.dark {
  --bg: #0d1512;
  --surface: #14201b;
  --surface-2: #192720;
  --text: #eef6f2;
  --muted: #b9c8c1;
  --border: #2a3c34;
  --primary: #72d2a8;
  --primary-dark: #42b987;
  --primary-soft: #183b2d;
  --blue: #81a9ff;
  --blue-soft: #1e3156;
  --green: #67d9c7;
  --green-soft: #163d36;
  --slate: #aabac5;
  --slate-soft: #28353d;
  --amber: #f0ad32;
  --amber-chart: #f0ad32;
  --danger: #ff6f86;
  --danger-chart: #ff6f86;
  --danger-soft: #48252b;
  --timeline-planned: #aab6b0;
  --timeline-missing: #df7d86;
  --timeline-paid: #34d399;
  --timeline-unpaid: #fbbf24;
  --timeline-outside: #a78bfa;
  --timeline-overtime: #f9a8d4;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.25);
  --shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.2);
}

html {
  scroll-behavior: smooth;
}

body {
  background:
    radial-gradient(
      circle at 8% 2%,
      color-mix(in srgb, var(--primary) 8%, transparent) 0,
      transparent 28rem
    ),
    radial-gradient(
      circle at 92% 14%,
      color-mix(in srgb, var(--blue) 5%, transparent) 0,
      transparent 31rem
    ),
    var(--bg);
  font-family:
    "Inter",
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-size: 14px;
  letter-spacing: -0.006em;
  line-height: 1.5;
}

body.modal-open {
  overflow: hidden;
}

h1,
h2,
h3,
.kpi-value,
.quality-head,
.person-name {
  font-family: var(--display-font);
}

button,
input,
select {
  letter-spacing: -0.006em;
}

:where(button, input, select, [tabindex]):focus-visible {
  outline: 3px solid color-mix(in srgb, var(--blue) 38%, transparent);
  outline-offset: 2px;
}

.app-shell {
  width: min(1680px, 100%);
  padding: 24px clamp(16px, 2.2vw, 36px) 40px;
}

.dashboard-loading {
  position: fixed;
  z-index: 5000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(8px);
}

.dashboard-loading-card {
  display: flex;
  align-items: center;
  gap: 16px;
  width: min(390px, 100%);
  padding: 20px 22px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 22px 70px rgba(13, 51, 40, 0.18);
}

.dashboard-loading-card div {
  display: grid;
  gap: 3px;
}

.dashboard-loading-card strong {
  font-family: var(--display-font);
  font-size: 15px;
  font-weight: 800;
}

.dashboard-loading-card span:last-child {
  color: var(--muted);
  font-size: 12px;
  font-weight: 550;
}

.dashboard-spinner {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border: 3px solid color-mix(in srgb, var(--primary) 18%, var(--border));
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: dashboard-spin 0.75s linear infinite;
}

@keyframes dashboard-spin {
  to {
    transform: rotate(360deg);
  }
}

.dashboard-notice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
}

.dashboard-notice-error {
  background: color-mix(in srgb, var(--danger-soft) 72%, var(--surface));
  border-color: color-mix(in srgb, var(--danger) 34%, var(--border));
}

.dashboard-notice-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--danger) 22%, var(--border));
  border-radius: 11px;
  font-size: 16px;
  font-weight: 850;
}

.dashboard-notice-copy {
  min-width: 0;
}

.dashboard-notice-copy strong {
  display: block;
  color: var(--text);
  font-family: var(--display-font);
  font-size: 14px;
  font-weight: 800;
}

.dashboard-notice-copy p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

@media (max-width: 640px) {
  .dashboard-notice {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .dashboard-notice .button {
    grid-column: 1 / -1;
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dashboard-spinner {
    animation-duration: 1.5s;
  }
}

.topbar {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 128px;
  margin: 0;
  padding: clamp(21px, 2.4vw, 30px);
  color: #f5fbf8;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.035), transparent 38%),
    linear-gradient(135deg, #0d3328 0%, #15513d 54%, #176349 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 28px;
  box-shadow: 0 24px 65px rgba(13, 51, 40, 0.2);
}

.topbar::before,
.topbar::after {
  content: "";
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  pointer-events: none;
}

.topbar::before {
  top: -170px;
  right: -40px;
  width: 420px;
  height: 420px;
  background: radial-gradient(
    circle,
    rgba(122, 226, 181, 0.18),
    transparent 68%
  );
}

.topbar::after {
  bottom: -145px;
  left: 36%;
  width: 330px;
  height: 260px;
  background: radial-gradient(
    circle,
    rgba(86, 141, 255, 0.12),
    transparent 68%
  );
}

.brand {
  gap: 17px;
}

.brand-mark {
  width: 58px;
  height: 58px;
  overflow: hidden;
  padding: 3px;
  background: #091b11;
  border: 1px solid rgba(185, 235, 211, 0.24);
  border-radius: 19px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 12px 32px rgba(0, 0, 0, 0.22);
}

.brand-mark img {
  border-radius: 15px;
}

.eyebrow {
  margin-bottom: 7px;
  color: #9ee1c2;
  font-size: 11px;
  letter-spacing: 0.15em;
}

h1 {
  color: #ffffff;
  font-size: clamp(27px, 2.7vw, 37px);
  font-weight: 800;
  letter-spacing: -0.052em;
}

.subtitle {
  max-width: 720px;
  margin-top: 9px;
  color: #cfdfd8;
  font-size: 13.5px;
  font-weight: 500;
}

.top-actions {
  align-self: center;
  gap: 10px;
}

.top-actions .button {
  color: #f5fbf8;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.17);
  box-shadow: none;
  backdrop-filter: blur(10px);
}

.top-actions .button:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.3);
}

.session-control {
  display: flex;
  align-items: stretch;
  min-width: 0;
  max-width: 320px;
  min-height: 45px;
  overflow: hidden;
  color: #f5fbf8;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.17);
  border-radius: 14px;
  backdrop-filter: blur(10px);
}

.session-identity {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 9px;
  padding: 6px 11px 6px 7px;
}

.session-avatar {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  flex: 0 0 auto;
  color: #0d3b2c;
  background: #b9ebd3;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.035em;
}

.session-copy {
  display: flex;
  align-items: center;
  min-width: 0;
  line-height: 1.15;
}

.session-copy strong {
  overflow: hidden;
  font-size: 12px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-json-button {
  min-height: 30px;
  padding: 5px 10px;
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
  border-radius: 9px;
  font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono",
    monospace;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.record-json-button:hover {
  color: var(--primary);
  background: var(--primary-soft);
  border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
}

.session-logout-button {
  flex: 0 0 auto;
  padding: 0 12px;
  color: #f5fbf8;
  background: rgba(0, 0, 0, 0.08);
  border: 0;
  border-left: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 11px;
  font-weight: 750;
  transition:
    color 0.18s ease,
    background 0.18s ease;
}

.session-logout-button:hover {
  color: #ffffff;
  background: rgba(190, 24, 58, 0.38);
}

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

.button {
  min-height: 41px;
  border-radius: 12px;
  font-weight: 750;
  transition:
    transform 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(0);
}

.filters-panel {
  position: relative;
  z-index: 3;
  margin: -18px 18px 22px;
  padding: 18px;
  border-color: color-mix(in srgb, var(--border) 86%, transparent);
  border-radius: 19px;
  box-shadow: 0 17px 45px rgba(24, 54, 42, 0.105);
}

.filters-grid {
  gap: 13px;
}

.field label {
  margin: 0 0 7px 2px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.085em;
}

.control,
select.control {
  min-height: 44px;
  padding: 10px 13px;
  background: color-mix(in srgb, var(--surface-2) 74%, var(--surface));
  border-color: color-mix(in srgb, var(--border) 92%, var(--text));
  border-radius: 12px;
  font-size: 13px;
  font-weight: 550;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.control:hover,
select.control:hover {
  background: var(--surface);
  border-color: color-mix(in srgb, var(--primary) 32%, var(--border));
}

.filter-count {
  min-height: 44px;
  padding-inline: 13px;
  background: var(--primary-soft);
  border-color: color-mix(in srgb, var(--primary) 18%, var(--border));
}

.panel,
.kpi-card {
  border-color: color-mix(in srgb, var(--border) 92%, transparent);
  box-shadow: var(--shadow-soft);
}

.kpi-grid {
  gap: 15px;
  margin-bottom: 20px;
}

.kpi-card {
  isolation: isolate;
  min-height: 148px;
  padding: 18px;
  border-radius: 17px;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease;
}

.kpi-card:hover {
  transform: none;
  border-color: color-mix(in srgb, var(--border) 92%, transparent);
  box-shadow: var(--shadow-soft);
}

.kpi-card::before {
  content: "";
  position: absolute;
  z-index: 2;
  top: 0;
  right: 18px;
  left: 18px;
  height: 3px;
  background: linear-gradient(
    90deg,
    var(--kpi-color, var(--primary)),
    transparent
  );
  border-radius: 0 0 4px 4px;
  opacity: 0.82;
}

.kpi-card::after {
  right: -20px;
  bottom: -42px;
  width: 112px;
  height: 112px;
  opacity: 0.62;
}

.kpi-label {
  font-size: 10.5px;
  letter-spacing: 0.085em;
}

.kpi-icon {
  width: 35px;
  height: 35px;
  border: 1px solid
    color-mix(in srgb, var(--kpi-color, var(--primary)) 13%, transparent);
  border-radius: 11px;
}

.kpi-value {
  margin-top: 14px;
  font-size: clamp(28px, 2.65vw, 38px);
  font-weight: 800;
  letter-spacing: -0.055em;
}

.kpi-note {
  margin-top: 9px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.4;
}

.kpi-card.alert-card {
  background: linear-gradient(
    145deg,
    color-mix(in srgb, var(--danger-soft) 72%, var(--surface)),
    var(--surface)
  );
  border-color: color-mix(in srgb, var(--danger) 27%, var(--border));
}

.dashboard-grid {
  grid-template-columns: minmax(0, 1.15fr) minmax(500px, 0.85fr);
  gap: 20px;
  margin-bottom: 20px;
}

.stack {
  gap: 20px;
}

.chart-panel,
.map-panel,
.table-panel,
.insights-panel {
  padding: 21px;
}

.section-head {
  align-items: center;
  margin-bottom: 18px;
}

.section-title-wrap {
  align-items: center;
  gap: 12px;
}

.section-title-wrap > div {
  display: flex;
  align-items: center;
  min-height: 38px;
}

.section-icon {
  width: 38px;
  height: 38px;
  border: 1px solid color-mix(in srgb, var(--primary) 12%, transparent);
  border-radius: 12px;
}

.section-title {
  font-size: 17px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.chart-box {
  padding: 16px;
  background: linear-gradient(
    145deg,
    color-mix(in srgb, var(--surface-2) 78%, var(--surface)),
    var(--surface-2)
  );
  border-radius: 16px;
}

.chart-caption h3 {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.018em;
}

.chart-caption span {
  font-size: 10.5px;
  font-weight: 600;
}

.donut-track,
.donut-segment {
  stroke-width: 18;
}

.donut-center strong {
  font-family: var(--display-font);
  font-size: 31px;
  font-weight: 800;
}

.donut-direct-label strong {
  font-family: var(--display-font);
  font-weight: 800;
}

.hour-bar {
  background: linear-gradient(to top, #0d4f38, #229269);
  box-shadow: 0 6px 14px rgba(23, 107, 76, 0.2);
}

.department-name {
  font-family: var(--display-font);
  font-weight: 700;
}

.stacked-track {
  height: 13px;
  box-shadow: inset 0 1px 2px rgba(23, 34, 30, 0.08);
}

.stacked-segment + .stacked-segment {
  box-shadow: inset 1px 0 rgba(255, 255, 255, 0.42);
}

.stacked-segment:focus-visible {
  box-shadow:
    inset 0 0 0 2px var(--surface),
    inset 0 0 0 4px currentColor;
}

.chart-tooltip {
  --tooltip-accent: var(--primary);
  --tooltip-arrow-x: 50%;
  position: fixed;
  z-index: 3000;
  display: grid;
  gap: 3px;
  width: max-content;
  max-width: min(270px, calc(100vw - 24px));
  padding: 11px 13px 12px;
  color: var(--text);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border: 1px solid color-mix(in srgb, var(--tooltip-accent) 24%, var(--border));
  border-radius: 12px;
  box-shadow:
    0 14px 34px rgba(20, 35, 29, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(14px);
  pointer-events: none;
}

.chart-tooltip[hidden] {
  display: none;
}

.chart-tooltip::before {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 0;
  width: 3px;
  background: var(--tooltip-accent);
  border-radius: 0 999px 999px 0;
}

.chart-tooltip::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: var(--tooltip-arrow-x);
  width: 10px;
  height: 10px;
  background: var(--surface);
  border-right: 1px solid
    color-mix(in srgb, var(--tooltip-accent) 24%, var(--border));
  border-bottom: 1px solid
    color-mix(in srgb, var(--tooltip-accent) 24%, var(--border));
  transform: translateX(-50%) rotate(45deg);
}

.chart-tooltip[data-placement="bottom"]::after {
  top: -6px;
  bottom: auto;
  border: 0;
  border-top: 1px solid
    color-mix(in srgb, var(--tooltip-accent) 24%, var(--border));
  border-left: 1px solid
    color-mix(in srgb, var(--tooltip-accent) 24%, var(--border));
}

.chart-tooltip[data-tone="blue"] {
  --tooltip-accent: var(--blue);
}

.chart-tooltip[data-tone="amber"] {
  --tooltip-accent: var(--amber-chart);
}

.chart-tooltip[data-tone="danger"] {
  --tooltip-accent: var(--danger-chart);
}

.chart-tooltip[data-tone="neutral"] {
  --tooltip-accent: var(--muted);
}

.chart-tooltip-title {
  padding-left: 2px;
  font-family: var(--display-font);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.chart-tooltip-body {
  padding-left: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.45;
}

.department-chart-header {
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.map-panel {
  overflow: hidden;
}

.map-shell {
  height: 480px;
  border-radius: 18px;
  box-shadow: inset 0 0 0 1px rgba(23, 34, 30, 0.05);
}

.map-legend {
  bottom: 16px;
  left: 16px;
  padding: 10px 12px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(23, 34, 30, 0.14);
}

.insight-item {
  padding: 13px;
  background: color-mix(in srgb, var(--surface-2) 74%, var(--surface));
  border-radius: 13px;
  transition:
    border-color 0.18s ease,
    transform 0.18s ease;
}

.insight-item:hover {
  transform: none;
  border-color: var(--border);
}

.insight-item strong {
  font-family: var(--display-font);
  font-size: 12.5px;
}

.insight-item p {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.48;
}

.quality-meter {
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--green-soft) 84%, var(--surface)),
    var(--green-soft)
  );
  border-radius: 14px;
}

.table-panel {
  overflow: hidden;
}

.table-wrap {
  border: 1px solid var(--border);
  border-radius: 14px;
}

table {
  font-size: 12.5px;
}

thead th {
  position: sticky;
  z-index: 2;
  top: 0;
  padding-top: 13px;
  padding-bottom: 13px;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface-2) 93%, var(--surface));
  font-size: 10px;
  letter-spacing: 0.075em;
  text-transform: uppercase;
}

tbody td {
  padding-top: 13px;
  padding-bottom: 13px;
}

tbody tr {
  transition: background 0.15s ease;
}

tbody tr:hover {
  background: color-mix(in srgb, var(--primary-soft) 46%, var(--surface));
}

.badge {
  border-width: 1px;
  font-weight: 750;
}

/* Expanded map dialog */
.map-modal {
  width: min(1520px, calc(100vw - 40px));
  height: min(920px, calc(100vh - 40px));
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 24px;
  overflow: visible;
}

.map-modal::backdrop {
  background: rgba(7, 18, 14, 0.72);
  backdrop-filter: blur(9px);
}

.map-modal-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  width: 100%;
  height: 100%;
  padding: 14px;
  background: color-mix(in srgb, var(--surface) 97%, transparent);
  border: 1px solid color-mix(in srgb, #ffffff 18%, var(--border));
  border-radius: 24px;
  box-shadow: 0 34px 110px rgba(0, 0, 0, 0.38);
}

.map-modal[open] .map-modal-card {
  animation: map-modal-enter 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes map-modal-enter {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.map-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 9px 8px 17px 10px;
}

.map-modal-title-wrap {
  min-width: 0;
}

.map-modal-title {
  margin: 0;
  color: var(--text);
  font-family: var(--display-font);
  font-size: clamp(19px, 2vw, 26px);
  font-weight: 800;
  letter-spacing: -0.035em;
}

.map-modal-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
}

.map-modal-close {
  color: var(--text);
  background: var(--surface-2);
  box-shadow: none;
}

.map-modal-close span {
  font-size: 24px;
  font-weight: 400;
  line-height: 1;
  transform: translateY(-1px);
}

.map-modal-host {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 18px;
}

.map-modal-host .map-shell {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
}

.json-modal {
  width: min(920px, calc(100vw - 40px));
  height: min(780px, calc(100vh - 40px));
}

.json-modal-card {
  padding: 14px;
}

.json-modal-head {
  border-bottom: 1px solid var(--border);
}

.json-modal-context {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 650;
}

.json-modal-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: #111a17;
  border: 1px solid color-mix(in srgb, var(--primary) 30%, #26342f);
  border-radius: 16px;
}

.json-code {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: auto;
  padding: 20px;
  color: #d7e7df;
  background: transparent;
  font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono",
    monospace;
  font-size: 12px;
  font-variant-ligatures: none;
  line-height: 1.62;
  tab-size: 2;
  white-space: pre;
}

.json-code code {
  font: inherit;
}

.map-shell-slot {
  min-width: 0;
}

@media (max-width: 1280px) {
  .topbar {
    min-height: 124px;
  }

  .filters-panel {
    margin-inline: 12px;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 880px) {
  .app-shell {
    padding: 14px;
  }

  .topbar {
    padding: 24px;
    border-radius: 22px;
  }

  .filters-panel {
    margin: -12px 10px 20px;
  }

  .dashboard-grid {
    gap: 16px;
  }

  .map-shell-slot .map-shell {
    height: 440px;
  }

  .map-modal {
    width: calc(100vw - 20px);
    height: calc(100vh - 20px);
  }

  .map-modal-card {
    border-radius: 19px;
  }
}

@media (max-width: 560px) {
  .topbar {
    padding: 20px;
  }

  .brand-mark {
    width: 46px;
    height: 46px;
    padding: 2px;
    border-radius: 15px;
  }

  .brand-mark img {
    border-radius: 12px;
  }

  .top-actions .button:not(.icon-only) {
    flex: 1 1 auto;
  }

  .session-control {
    width: 100%;
    max-width: none;
  }

  .session-identity {
    flex: 1 1 auto;
  }

  .filters-panel {
    margin-inline: 6px;
    padding: 14px;
  }

  .section-actions {
    gap: 7px;
  }

  .map-modal-head {
    align-items: flex-start;
    padding: 6px 4px 13px;
  }

  .map-modal-actions .button:not(.icon-only) {
    display: none;
  }

  .map-modal-card {
    padding: 10px;
  }

  .map-shell-slot .map-shell {
    height: 380px;
  }
}

/* Focused operational layout */
[hidden] {
  display: none !important;
}

.filter-toggle-button {
  min-width: 108px;
}

.filter-toggle-count {
  display: inline-grid;
  place-items: center;
  min-width: 21px;
  height: 21px;
  margin-left: 2px;
  padding: 0 6px;
  color: #0b3427;
  background: #9ee1c2;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 850;
}

.active-filter-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 15px 18px 20px;
}

.active-filter-chips {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 1 1 auto;
  flex-wrap: wrap;
}

.active-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 31px;
  padding: 5px 9px 5px 11px;
  color: var(--primary-dark);
  background: var(--primary-soft);
  border: 1px solid color-mix(in srgb, var(--primary) 20%, var(--border));
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.active-filter-chip::after {
  content: "\00D7";
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
}

body.dark .active-filter-chip {
  color: var(--text);
}

.clear-active-filters {
  min-height: 31px;
  padding: 5px 10px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 750;
}

.clear-active-filters:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

#filtersPanel[hidden] ~ .kpi-grid {
  margin-top: 20px;
}

.active-filter-strip:not([hidden]) + .kpi-grid {
  margin-top: 0;
}

.dashboard-grid {
  align-items: start;
}

.stack {
  align-content: start;
}

.chart-panel {
  align-self: start;
}

.donut-layout {
  min-height: 224px;
}

.donut-visual {
  position: relative;
  display: flex;
  justify-content: center;
  min-height: 206px;
  overflow: hidden;
}

.donut-wrap {
  width: clamp(142px, 50%, 170px);
  flex: 0 0 auto;
}

.donut-direct-label {
  position: absolute;
  z-index: 2;
  width: 82px;
  max-width: 28%;
}

.donut-direct-label.onsite {
  top: 44px;
  left: 0;
  margin: 0;
  padding-right: 20px;
}

.donut-direct-label.remote {
  right: 0;
  bottom: 44px;
  margin: 0;
  padding-left: 20px;
}

.donut-direct-label strong {
  font-size: 11.5px;
  white-space: nowrap;
}

.donut-direct-label::after {
  width: 15px;
}

.map-panel .section-head {
  align-items: center;
  flex-flow: row nowrap;
}

.map-panel .section-title-wrap {
  min-width: 138px;
  flex: 1 1 auto;
}

.map-panel .section-actions {
  width: auto;
  flex: 0 0 auto;
  flex-flow: row nowrap;
  gap: 8px;
}

.map-panel .section-actions .button {
  min-height: 39px;
  padding-inline: 11px;
  font-size: 12px;
}

.map-legend {
  width: auto;
}

.map-modal-head {
  min-height: 65px;
}

.cluster-bubble {
  border-width: 3px;
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.22),
    0 0 0 4px color-mix(in srgb, var(--primary) 14%, transparent);
}

.cluster-count {
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.12);
}

.cluster-bubble:hover {
  transform: scale(1.05);
}

@media (max-width: 560px) {
  .active-filter-strip {
    margin-inline: 6px;
  }

  .donut-visual {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "chart chart"
      "onsite remote";
    gap: 8px 12px;
    min-height: 0;
    overflow: visible;
  }

  .donut-wrap {
    grid-area: chart;
    justify-self: center;
    width: 148px;
  }

  .donut-direct-label {
    position: static;
    width: auto;
    max-width: none;
    padding: 8px 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
  }

  .donut-direct-label.onsite {
    grid-area: onsite;
    text-align: left;
  }

  .donut-direct-label.remote {
    grid-area: remote;
    text-align: left;
  }

  .donut-direct-label::after {
    display: none;
  }
}

@media (max-width: 420px) {
  .map-panel .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .map-panel .section-actions {
    width: 100%;
  }

  .map-panel .section-actions .button {
    flex: 1;
  }
}

@media (max-width: 560px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .kpi-card {
    min-height: 140px;
    padding: 14px;
  }

  .kpi-card::before {
    right: 14px;
    left: 14px;
  }

  .kpi-card::after {
    right: -26px;
    bottom: -42px;
    width: 96px;
    height: 96px;
  }

  .kpi-label {
    font-size: 9.5px;
  }

  .kpi-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
  }

  .kpi-icon svg {
    width: 16px;
    height: 16px;
  }

  .kpi-value {
    margin-top: 12px;
    font-size: clamp(27px, 8vw, 32px);
  }

  .kpi-note {
    margin-top: 8px;
    font-size: 10.5px;
  }

  .kpi-card.alert-card .kpi-note strong {
    font-size: 12px;
  }

  .section-head,
  .map-panel .section-head {
    width: 100%;
    align-items: flex-start;
    justify-content: flex-start;
    flex-direction: column;
    text-align: left;
  }

  .section-title-wrap,
  .map-panel .section-title-wrap {
    width: 100%;
    min-width: 0;
    align-items: center;
    justify-content: flex-start;
    margin: 0;
    text-align: left;
  }

  .section-title-wrap > div {
    justify-content: flex-start;
    text-align: left;
  }

  .section-title {
    width: 100%;
    text-align: left;
  }

  .section-actions,
  .map-panel .section-actions {
    width: 100%;
    justify-content: flex-start;
  }
}
