:root {
  --user-bg: #f4f8fc;
  --user-surface: rgba(255, 255, 255, 0.98);
  --user-surface-soft: rgba(248, 252, 255, 0.96);
  --user-border: rgba(184, 199, 217, 0.72);
  --user-text: #16263d;
  --user-muted: #52657a;
  --user-primary: #32b5f4;
  --user-primary-dark: #1e9fe0;
  --user-primary-soft: #ddf2ff;
  --user-danger: #d92d20;
  --user-shadow: 0 10px 24px rgba(40, 62, 92, 0.08),
    0 3px 8px rgba(40, 62, 92, 0.04);
}

* {
  box-sizing: border-box;
}

body {
  position: relative;
  min-height: 100vh;
  margin: 0;
  padding: 32px;
  color: var(--user-text);
  background:
    radial-gradient(circle at 8% 6%, rgba(214, 233, 246, 0.82) 0, transparent 27%),
    radial-gradient(circle at 92% 10%, rgba(230, 239, 247, 0.92) 0, transparent 29%),
    radial-gradient(circle at 70% 90%, rgba(217, 228, 238, 0.72) 0, transparent 34%),
    linear-gradient(135deg, #eaf6fc 0%, #f4f8fc 48%, #ffffff 100%);
  background-attachment: fixed;
  font-family: "Segoe UI", Inter, Arial, sans-serif;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background-image:
    linear-gradient(rgba(84, 110, 139, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(84, 110, 139, 0.018) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.4), transparent 78%);
}

.user-page {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
}

.page-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 22px;
  padding: 24px 28px;
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.99), rgba(248, 252, 255, 0.97));
  border: 1px solid var(--user-border);
  border-radius: 20px;
  box-shadow: var(--user-shadow);
  backdrop-filter: blur(10px);
}

.page-header-icon {
  display: grid;
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  place-items: center;
  color: var(--user-primary);
  background: linear-gradient(135deg, rgba(221, 242, 255, 0.9), rgba(236, 248, 255, 0.96));
  border: 1px solid rgba(124, 203, 255, 0.5);
  border-radius: 17px;
  font-size: 1.65rem;
  box-shadow: 0 8px 18px rgba(40, 120, 227, 0.08);
}

.page-header-icon .bi {
  display: none;
}

.page-header-icon::before {
  content: "\2637";
}

.page-eyebrow {
  display: block;
  margin-bottom: 5px;
  color: var(--user-primary-dark);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.13em;
}

.page-header h1 {
  margin: 0;
  color: var(--user-text);
  font-size: clamp(1.55rem, 3vw, 2.1rem);
  font-weight: 700;
  line-height: 1.2;
}

.page-header p {
  margin: 7px 0 0;
  color: var(--user-muted);
  font-size: 0.92rem;
}

.form-container {
  width: 100%;
  margin: 0;
  padding: 0;
  background: transparent;
}

#formRegistro {
  display: grid;
  gap: 18px;
}

.module-tabs {
  display: grid;
  gap: 16px;
}

.module-tab-toggle {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.module-tab-bar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 10px;
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.98), rgba(248, 252, 255, 0.94));
  border: 1px solid var(--user-border);
  border-radius: 20px;
  box-shadow: var(--user-shadow);
}

.module-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 56px;
  padding: 0 16px;
  color: var(--user-muted);
  background: rgba(248, 252, 255, 0.7);
  border: 1px solid transparent;
  border-radius: 14px;
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 700;
  transition: color 0.2s ease, background-color 0.2s ease,
    border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.module-tab i {
  color: var(--user-primary);
  font-size: 1rem;
}

.module-tab:hover {
  color: var(--user-text);
  background: rgba(221, 242, 255, 0.54);
  border-color: rgba(124, 203, 255, 0.32);
  transform: translateY(-1px);
}

#tab-registro:checked ~ .module-tab-bar label[for="tab-registro"],
#tab-consulta:checked ~ .module-tab-bar label[for="tab-consulta"] {
  color: var(--user-text);
  background: linear-gradient(135deg, rgba(221, 242, 255, 0.9), rgba(236, 248, 255, 0.96));
  border-color: rgba(124, 203, 255, 0.6);
  box-shadow: inset 0 0 0 1px rgba(124, 203, 255, 0.2);
}

.module-panels {
  display: grid;
}

.module-panel {
  display: none;
}

#tab-registro:checked ~ .module-panels .module-panel-registro {
  display: block;
}

#tab-consulta:checked ~ .module-panels .module-panel-consulta {
  display: block;
}

.consult-shell {
  display: grid;
  gap: 18px;
}

.consult-summary {
  margin: 0;
}

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

.consult-card {
  padding: 18px 16px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(184, 199, 217, 0.72);
  border-radius: 16px;
  box-shadow: 0 8px 18px rgba(40, 62, 92, 0.06);
}

.consult-card h3 {
  margin: 0 0 8px;
  color: var(--user-text);
  font-size: 0.95rem;
  font-weight: 700;
}

.consult-card p {
  margin: 0;
  color: var(--user-muted);
  font-size: 0.85rem;
  line-height: 1.45;
}

.consult-placeholder {
  display: grid;
  gap: 12px;
  padding: 18px;
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.98), rgba(248, 252, 255, 0.96));
  border: 1px dashed rgba(184, 199, 217, 0.8);
  border-radius: 18px;
}

.consult-placeholder-bar {
  height: 14px;
  width: 42%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(50, 181, 244, 0.18), rgba(50, 181, 244, 0.08));
}

.consult-placeholder-list {
  display: grid;
  gap: 10px;
}

.consult-placeholder-list div {
  height: 46px;
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(233, 240, 247, 0.92), rgba(245, 248, 252, 0.96));
  border: 1px solid rgba(199, 214, 229, 0.65);
}

.form-section {
  padding: 24px 26px 9px;
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.995), rgba(248, 252, 255, 0.97));
  border: 1px solid var(--user-border);
  border-radius: 18px;
  box-shadow: var(--user-shadow);
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(199, 214, 229, 0.6);
}

.section-icon {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  color: var(--user-primary);
  background: linear-gradient(135deg, rgba(221, 242, 255, 0.9), rgba(236, 248, 255, 0.96));
  border: 1px solid rgba(124, 203, 255, 0.4);
  border-radius: 11px;
  font-size: 0.9rem;
  font-weight: 800;
  box-shadow: 0 6px 14px rgba(40, 120, 227, 0.06);
}

.section-icon .bi {
  display: none;
}

.section-icon::before {
  content: "\2022";
  font-size: 1.4rem;
}

.form-section-security .section-icon::before {
  content: "\2713";
  font-size: 1rem;
}

.section-heading h2 {
  margin: 0;
  color: var(--user-text);
  font-size: 1.02rem;
  font-weight: 700;
}

.section-heading p {
  margin: 3px 0 0;
  color: var(--user-muted);
  font-size: 0.78rem;
}

.form-label {
  margin-bottom: 7px;
  color: var(--user-text);
  font-size: 0.82rem;
  font-weight: 650;
}

.form-control,
.form-select {
  min-height: 44px;
  padding: 10px 12px;
  color: var(--user-text);
  background-color: var(--user-surface-soft);
  border: 1px solid var(--user-border);
  border-radius: 10px;
  box-shadow: none;
  font-size: 0.9rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease,
    background-color 0.2s ease;
}

.form-control:hover,
.form-select:hover {
  border-color: rgba(124, 203, 255, 0.78);
}

.form-control:focus,
.form-select:focus {
  color: var(--user-text);
  background-color: #fff;
  border-color: #7ccbff;
  box-shadow: 0 0 0 3px rgba(50, 181, 244, 0.14);
}

.text-muted {
  display: block;
  margin-top: 6px;
  color: var(--user-muted) !important;
  font-size: 0.74rem;
}

.input-group .form-control {
  border-radius: 10px 0 0 10px;
}

.input-group .btn {
  min-width: 46px;
  color: #396184;
  background: linear-gradient(135deg, rgba(221, 242, 255, 0.8), rgba(236, 248, 255, 0.95));
  border-color: var(--user-border);
  border-radius: 0 10px 10px 0;
}

.input-group .btn:hover {
  color: var(--user-primary);
  background: linear-gradient(135deg, rgba(221, 242, 255, 0.96), rgba(236, 248, 255, 1));
  border-color: rgba(124, 203, 255, 0.72);
}

.input-group .btn .bi-eye::before {
  content: "\25C9";
  font-size: 1rem;
}

.form-section-security .row > .col-md-4:last-child > .form-label {
  visibility: hidden;
}

#guardar {
  min-height: 44px;
  margin-bottom: 0 !important;
  color: #fff;
  background: linear-gradient(135deg, #008fef, #16b7f5);
  border: 1px solid rgba(50, 181, 244, 0.9);
  border-radius: 10px;
  box-shadow: 0 8px 18px rgba(40, 120, 227, 0.18);
  font-size: 0.88rem;
  font-weight: 700;
  transition: transform 0.18s ease, background-color 0.18s ease,
    box-shadow 0.18s ease;
}

#guardar:hover {
  transform: translateY(-1px);
  background: linear-gradient(135deg, #1e9fe0, #0f9fe7);
  border-color: #1e9fe0;
  box-shadow: 0 10px 20px rgba(40, 120, 227, 0.22);
}

.button-group {
  gap: 10px;
  padding: 5px 0 15px;
}

.button-group .btn {
  flex: 1;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 650;
  transition: transform 0.18s ease, filter 0.18s ease;
}

.button-group .btn:hover {
  transform: translateY(-1px);
  filter: brightness(0.97);
}

.btn-warning {
  color: #8a4b08;
  background: #fff4db;
  border-color: #efd4a7;
}

.btn-danger {
  color: #b42318;
  background: #fdeceb;
  border-color: #f3c4be;
}

.btn-info {
  color: #175cd3;
  background: #eaf4ff;
  border-color: #cfe1f6;
}

.invalid-feedback,
.valid-feedback {
  font-size: 0.74rem;
}

#loadingOverlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  visibility: hidden;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  color: #fff;
  background: rgba(15, 23, 42, 0.52);
  opacity: 0;
  backdrop-filter: blur(3px);
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

#loadingOverlay.show {
  visibility: visible;
  opacity: 1;
}

.spinner {
  width: 52px;
  height: 52px;
  margin-bottom: 14px;
  border: 4px solid rgba(255, 255, 255, 0.24);
  border-top-color: #32b5f4;
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}

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

@media (max-width: 767px) {
  body {
    padding: 20px;
  }

  .page-header {
    align-items: flex-start;
    padding: 21px;
  }

  .page-header-icon {
    width: 52px;
    height: 52px;
    flex-basis: 52px;
  }

  .form-section {
    padding: 21px 20px 8px;
  }

  .module-tab-bar {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 480px) {
  body {
    padding: 12px;
  }

  .page-header {
    gap: 13px;
    padding: 18px;
    border-radius: 16px;
  }

  .page-header-icon {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
    border-radius: 12px;
    font-size: 1.2rem;
  }

  .page-header p {
    font-size: 0.8rem;
  }

  .form-section {
    padding: 18px 16px 5px;
    border-radius: 15px;
  }

  .section-heading {
    align-items: flex-start;
    margin-bottom: 18px;
  }

  .button-group {
    flex-direction: column;
  }

  .module-tab {
    min-height: 52px;
    font-size: 0.88rem;
  }
}
