@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap");

* {
  box-sizing: border-box;
}

:root {
  color-scheme: light;
  --bg-1: #f8fbff;
  --bg-2: #eaf1fb;
  --bg-3: #d9e5f5;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-strong: #ffffff;
  --surface-soft: #f4f8fe;
  --sidebar: #10243a;
  --sidebar-soft: #1a3553;
  --text: #10192b;
  --muted: #56647a;
  --line: rgba(16, 25, 43, 0.14);
  --line-soft: rgba(16, 25, 43, 0.08);
  --primary: #0b73e0;
  --primary-hover: #085eb8;
  --primary-glow: rgba(11, 115, 224, 0.28);
  --danger: #d64242;
  --danger-hover: #b83030;
  --success: #1f9f63;
  --radius-xl: 24px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --shadow-xl: 0 28px 60px rgba(13, 26, 49, 0.16);
  --shadow-lg: 0 16px 34px rgba(13, 26, 49, 0.12);
  --shadow-md: 0 10px 22px rgba(13, 26, 49, 0.1);
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: "Plus Jakarta Sans", "Segoe UI", Tahoma, sans-serif;
  color: var(--text);
  background:
    radial-gradient(50vw 50vw at -2% 10%, rgba(108, 169, 224, 0.22), transparent 70%),
    radial-gradient(45vw 45vw at 98% 95%, rgba(70, 186, 170, 0.2), transparent 72%),
    linear-gradient(150deg, var(--bg-1) 0%, var(--bg-2) 45%, var(--bg-3) 100%);
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  z-index: 0;
  pointer-events: none;
}

body::before {
  width: 34vw;
  height: 34vw;
  top: -12vw;
  left: -10vw;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 0) 68%);
}

body::after {
  width: 28vw;
  height: 28vw;
  right: -9vw;
  bottom: -8vw;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.46) 0%, rgba(255, 255, 255, 0) 70%);
}

.app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
  min-height: 100vh;
  max-width: 1520px;
  margin: 0 auto;
  padding: 18px;
}

.sidebar {
  position: sticky;
  top: 18px;
  height: calc(100vh - 36px);
  overflow-y: auto;
  background: linear-gradient(168deg, #0d2237 0%, var(--sidebar) 48%, var(--sidebar-soft) 100%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  color: #f4f8ff;
  padding: 28px 18px;
}

.sidebar h1 {
  margin: 0 0 20px;
  font-family: "Manrope", "Plus Jakarta Sans", sans-serif;
  font-size: clamp(1.3rem, 1.7vw, 1.6rem);
  font-weight: 800;
  letter-spacing: 0.01em;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nav-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 12px 14px;
  background: transparent;
  color: #dbe8f8;
  text-align: left;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.nav-btn::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(149, 198, 248, 0.6);
  box-shadow: 0 0 0 4px rgba(149, 198, 248, 0.14);
}

.nav-btn:hover,
.nav-btn.active {
  color: #ffffff;
  border-color: rgba(155, 207, 255, 0.34);
  background: linear-gradient(130deg, rgba(39, 108, 184, 0.62), rgba(47, 137, 178, 0.5));
  transform: translateX(2px);
}

.main-content {
  min-width: 0;
  padding: clamp(18px, 2vw, 30px);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-xl);
}

.section {
  display: none;
}

.section.active {
  display: block;
  animation: section-fade 0.45s ease both;
}

.section.active > * {
  animation: section-rise 0.42s ease both;
}

.section.active > *:nth-child(2) {
  animation-delay: 0.05s;
}

.section.active > *:nth-child(3) {
  animation-delay: 0.1s;
}

.section.active > *:nth-child(4) {
  animation-delay: 0.14s;
}

.section-header {
  margin-bottom: 18px;
}

.section-header h2 {
  margin: 0 0 6px;
  font-family: "Manrope", "Plus Jakarta Sans", sans-serif;
  font-size: clamp(1.45rem, 2.1vw, 1.9rem);
  font-weight: 800;
  letter-spacing: 0.01em;
}

.section-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.section-header-with-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.card,
.panel {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.card {
  position: relative;
  overflow: hidden;
  padding: 18px;
  background: linear-gradient(150deg, #ffffff 0%, #f4f9ff 90%);
}

.card::after {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  top: -92px;
  right: -76px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(11, 115, 224, 0.2) 0%, rgba(11, 115, 224, 0) 72%);
}

.panel {
  padding: 18px;
  background: var(--surface-strong);
}

.card:hover,
.panel:hover {
  transform: translateY(-3px);
  border-color: rgba(11, 115, 224, 0.28);
  box-shadow: 0 20px 34px rgba(13, 26, 49, 0.14);
}

.card h3,
.panel h3 {
  margin: 0;
  font-family: "Manrope", "Plus Jakarta Sans", sans-serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.card p {
  margin: 10px 0 0;
  font-size: clamp(1.55rem, 2.3vw, 2rem);
  font-weight: 800;
  color: #093d74;
}

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

.panel-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.filters-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.filters-row input,
.filters-row select {
  min-width: 174px;
}

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

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

.grow {
  flex: 1;
}

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

label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #334155;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #ccdae9;
  border-radius: var(--radius-md);
  background: #ffffff;
  color: var(--text);
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 0.91rem;
  padding: 10px 12px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

input::placeholder,
textarea::placeholder {
  color: #8290a6;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #66aeea;
  box-shadow: 0 0 0 4px rgba(57, 143, 214, 0.2);
  background: #fcfeff;
  outline: none;
}

textarea {
  resize: vertical;
  min-height: 82px;
}

.actions,
.actions-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

button {
  border: 1px solid transparent;
  border-radius: 11px;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

button.primary,
button.secondary,
button.danger,
button.small {
  padding: 10px 14px;
  font-size: 0.86rem;
}

button.primary {
  color: #ffffff;
  background: linear-gradient(135deg, var(--primary) 0%, #1f87d7 100%);
  box-shadow: 0 10px 18px var(--primary-glow);
}

button.primary:hover {
  background: linear-gradient(135deg, var(--primary-hover) 0%, #156cae 100%);
  transform: translateY(-1px);
}

button.secondary {
  color: #123250;
  border-color: #ced9e7;
  background: linear-gradient(180deg, #eef3fa 0%, #e4edf8 100%);
}

button.secondary:hover {
  background: linear-gradient(180deg, #e3edf9 0%, #d8e6f7 100%);
}

button.danger {
  color: #ffffff;
  background: linear-gradient(135deg, var(--danger) 0%, #c93939 100%);
  box-shadow: 0 10px 18px rgba(214, 66, 66, 0.26);
}

button.danger:hover {
  background: linear-gradient(135deg, var(--danger-hover) 0%, #a72c2c 100%);
  transform: translateY(-1px);
}

button.small {
  padding: 7px 11px;
  font-size: 0.76rem;
  color: #1a3f62;
  border-color: #c9d7e8;
  background: #e8eff8;
}

button.small:hover {
  background: #dce7f4;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(11, 115, 224, 0.36);
  outline-offset: 1px;
}

button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  background: #ffffff;
}

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

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: top;
  font-size: 0.86rem;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eff5fd;
  color: #284666;
  font-family: "Manrope", "Plus Jakarta Sans", sans-serif;
  font-weight: 700;
}

tbody tr:hover td {
  background: #f7fbff;
}

tbody tr:last-child td {
  border-bottom: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 10px;
  border: 1px solid rgba(11, 115, 224, 0.26);
  background: rgba(11, 115, 224, 0.09);
  color: #0a57aa;
  font-size: 0.72rem;
  font-weight: 700;
}

.checkbox-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 8px;
  max-height: 230px;
  overflow-y: auto;
  border: 1px solid #d5dfeb;
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  padding: 10px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid #dae5f1;
  border-radius: 10px;
  background: #ffffff;
  padding: 8px 10px;
}

.checkbox-item input {
  width: auto;
  margin: 0;
}

.stats-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 1px solid #dbe6f2;
  border-radius: 10px;
  background: linear-gradient(180deg, #f8fbff 0%, #f1f6fd 100%);
  padding: 10px 12px;
}

.hidden {
  display: none !important;
}

.empty {
  margin: 4px 0;
  color: #6a7d96;
  font-style: italic;
}

#inputImportarDatos {
  display: none;
}

.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  width: min(360px, calc(100vw - 32px));
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
}

.toast {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 12px 14px;
  color: #0f2744;
  background: linear-gradient(180deg, #f6f9fe 0%, #edf4fc 100%);
  box-shadow: var(--shadow-md);
  transform: translateX(110%);
  opacity: 0;
  transition: transform 0.24s ease, opacity 0.24s ease;
}

.toast.show {
  transform: translateX(0);
  opacity: 1;
}

.toast.success {
  border-color: rgba(31, 159, 99, 0.28);
  background: linear-gradient(180deg, #e7f9f1 0%, #dcf4e9 100%);
  color: #166841;
}

.toast.error {
  border-color: rgba(214, 66, 66, 0.32);
  background: linear-gradient(180deg, #fdeeee 0%, #fce3e3 100%);
  color: #8d2121;
}

.toast.info {
  border-color: rgba(11, 115, 224, 0.3);
  background: linear-gradient(180deg, #eef5ff 0%, #e4effe 100%);
  color: #0f4f9b;
}

.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(8, 18, 33, 0.46);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.confirm-overlay.hidden {
  display: none;
}

.confirm-modal {
  width: min(430px, 100%);
  border: 1px solid #d5e1ef;
  border-radius: var(--radius-lg);
  background: #ffffff;
  box-shadow: var(--shadow-xl);
  padding: 18px;
  animation: modal-rise 0.26s ease both;
}

.confirm-modal h3 {
  margin: 0 0 8px;
  font-family: "Manrope", "Plus Jakarta Sans", sans-serif;
  font-size: 1.06rem;
}

.confirm-modal p {
  margin: 0 0 14px;
  color: var(--muted);
}

@keyframes section-fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes section-rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes modal-rise {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 1200px) {
  .app {
    grid-template-columns: 250px minmax(0, 1fr);
  }
}

@media (max-width: 980px) {
  .app {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 14px;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 16px;
  }

  .sidebar nav {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .nav-btn {
    flex: 1 1 calc(50% - 10px);
    min-width: 145px;
  }

  .main-content {
    padding: 16px;
  }

  .grid-2,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .section-header-with-actions,
  .panel-toolbar,
  .filters-row {
    flex-direction: column;
    align-items: stretch;
  }

  .filters-row {
    margin-left: 0;
  }

  .filters-row input,
  .filters-row select {
    min-width: 0;
  }
}

@media (max-width: 620px) {
  .sidebar nav {
    flex-direction: column;
  }

  .nav-btn {
    min-width: 0;
    width: 100%;
  }

  .actions,
  .actions-inline {
    width: 100%;
  }

  .actions button,
  .actions-inline button {
    width: 100%;
  }

  .card,
  .panel {
    padding: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
