:root {
  --bg: #ffffff;
  --panel: #f3f4f6;
  --panel-2: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #111827;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  background: var(--bg);
  color: var(--text);
}

.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  width: 100%;
  flex: 0 0 260px;
  transition: flex-basis 420ms cubic-bezier(0.2, 0, 0, 1), box-shadow 240ms ease;
  will-change: flex-basis;
  box-shadow: 0 1px 0 rgba(17, 24, 39, 0.04);
}

.sidebar.is-collapsed {
  flex-basis: 72px;
}

.sidebar:hover {
  box-shadow: 0 10px 30px rgba(17, 24, 39, 0.06);
}

.sidebar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sidebar__brand {
  height: 44px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  column-gap: 10px;
  overflow: hidden;
}

.sidebar.is-collapsed .sidebar__brand {
  grid-template-columns: 44px 0px;
}

.sidebar__brand_logo {
  width: 44px;
  height: 44px;
  display: block;
  justify-self: center;
  transform: translateX(5px);
}

.sidebar__brand_text {
  white-space: nowrap;
  max-width: 160px;
  overflow: hidden;
  opacity: 1;
  transform: translateX(0);
  transition: max-width 260ms cubic-bezier(0.2, 0, 0, 1), opacity 200ms ease, transform 260ms cubic-bezier(0.2, 0, 0, 1);
}

.sidebar.is-collapsed .sidebar__brand_text {
  max-width: 0;
  opacity: 0;
  transform: translateX(-6px);
}

.sidebar__toggle {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  border-radius: 6px;
  padding: 4px 6px;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease;
}

.sidebar__toggle--flotante {
  position: fixed;
  top: 12px;
  left: calc(260px + 8px);
  z-index: 50;
  background: var(--bg);
  transition: left 420ms cubic-bezier(0.2, 0, 0, 1);
  will-change: left;
}

body.sidebar-colapsado .sidebar__toggle--flotante {
  left: calc(72px + 8px);
}

.sidebar__toggle_icon {
  font-size: 16px;
  line-height: 1;
}

.sidebar__toggle:hover {
  background: rgba(17, 24, 39, 0.04);
  border-color: rgba(17, 24, 39, 0.14);
}

.sidebar__toggle:focus-visible {
  background: rgba(17, 24, 39, 0.04);
  border-color: rgba(17, 24, 39, 0.18);
  outline: none;
}

.sidebar__nav {
  margin-top: 18px;
  display: grid;
  gap: 6px;
}

.sidebar__link {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  column-gap: 12px;
  padding: 10px 0;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  border: 1px solid transparent;
  transition: background 200ms ease, border-color 200ms ease, transform 200ms ease;
}

.sidebar__link_text {
  white-space: nowrap;
  max-width: 180px;
  overflow: hidden;
  opacity: 1;
  transform: translateX(0);
  transition: max-width 260ms cubic-bezier(0.2, 0, 0, 1), opacity 200ms ease, transform 260ms cubic-bezier(0.2, 0, 0, 1);
}

.sidebar__icon {
  font-size: 20px;
  line-height: 1;
  justify-self: center;
  transform: translateX(5px);
}



.sidebar__link:hover {
  border-color: var(--border);
  background: var(--panel-2);
  transform: translateY(-1px);
}

.sidebar__link--active {
  background: rgba(17, 24, 39, 0.06);
  border-color: rgba(17, 24, 39, 0.10);
}

.sidebar.is-collapsed .sidebar__link {
  grid-template-columns: 24px 0px;
}

.sidebar.is-collapsed .sidebar__link_text {
  max-width: 0;
  opacity: 0;
  transform: translateX(-6px);
}

.main {
  flex: 1;
  padding: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 14px 22px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

.topbar__app {
  font-weight: 700;
  letter-spacing: 0.2px;
}

.topbar__title {
  font-weight: 600;
  letter-spacing: 0.1px;
}

.main__content {
  padding: 22px;
}

.page__title {
  margin: 0 0 16px 0;
  font-size: 22px;
}

.filters {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}

.filters__row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.filters__row--principal {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  align-items: end;
  margin-bottom: 0;
}

.field--ancho-doble {
  grid-column: span 2;
}

.field--ancho-corto {
  min-width: 0;
}

.field--ancho-minimo {
  max-width: 190px;
}

.field__label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.field__input {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text);
}

.checklist {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}

.checklist__item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text);
}

.checklist__input {
  width: 16px;
  height: 16px;
}

.filters__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  min-width: 0;
}

.filters__actions--inline {
  justify-content: flex-end;
  justify-self: end;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--primary);
  color: #ffffff;
  text-decoration: none;
  cursor: pointer;
}

.button--secondary {
  background: transparent;
  color: var(--text);
}

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

.tarjetones--cuatro {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.tarjeton {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.tarjeton:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(17, 24, 39, 0.06);
}

.tarjeton__titulo {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.tarjeton__valor {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.tarjeton__meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.analitica__grilla {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.table_wrapper {
  margin-top: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

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

.table thead {
  position: sticky;
  top: 0;
  z-index: 1;
}

.table th,
.table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.table th {
  font-size: 12px;
  color: var(--muted);
  text-align: left;
  background: #f8fafc;
}

.table tbody tr:nth-child(2n) {
  background: rgba(17, 24, 39, 0.015);
}

.table tbody tr:hover {
  background: rgba(17, 24, 39, 0.04);
}

.table__wrap {
  max-width: 520px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.table__empty {
  text-align: center;
  color: var(--muted);
}

.table__note {
  padding: 10px 12px;
  color: var(--muted);
  font-size: 12px;
}

.table__link {
  color: var(--primary);
  text-decoration: none;
  border-bottom: 1px dashed rgba(17, 24, 39, 0.25);
}

.table__link:hover {
  border-bottom-color: rgba(17, 24, 39, 0.65);
}

.chips {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #f8fafc;
  color: var(--text);
  text-decoration: none;
  font-size: 12px;
}

.chip:hover {
  background: #eef2f7;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1;
  border: 1px solid transparent;
}

.badge--tipo {
  background: rgba(2, 132, 199, 0.1);
  border-color: rgba(2, 132, 199, 0.2);
  color: #075985;
}

.badge--solicitante {
  background: rgba(21, 128, 61, 0.1);
  border-color: rgba(21, 128, 61, 0.18);
  color: #166534;
}

.badge--estado {
  background: rgba(217, 119, 6, 0.12);
  border-color: rgba(217, 119, 6, 0.22);
  color: #92400e;
}

.empty_state {
  min-height: 180px;
  display: grid;
  place-items: center;
  gap: 10px;
  padding: 20px;
}

.empty_state__title {
  font-weight: 600;
}

.paginacion {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.paginacion__item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  background: var(--panel-2);
}

.paginacion__item--activa {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.detalle {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

.detalle__header {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
}

.detalle__titulo {
  margin: 0;
  font-size: 20px;
}

.detalle__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

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

.detalle__item {
  margin: 0;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}

.detalle__item dt {
  font-size: 12px;
  color: var(--muted);
}

.detalle__item dd {
  margin: 4px 0 0 0;
}

@media (max-width: 1100px) {
  .filters__row {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  }

  .filters__row--principal {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  }

  .field--ancho-doble {
    grid-column: auto;
  }

  .field--ancho-minimo {
    max-width: none;
  }

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

  .filters__actions--inline {
    justify-self: start;
  }

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

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

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