:root {
  --color-primary: #2563eb;
  --color-primary-dark: #1d4ed8;
  --color-primary-soft: #dbeafe;
  --color-accent: #7dd3fc;
  --color-bg: #0f172a;
  --color-surface: #ffffff;
  --color-surface-soft: #f8fbff;
  --color-text: #0f172a;
  --color-text-muted: #475569;
  --color-border: #bfdbfe;
  --color-danger: #dc2626;
  --shadow-sm: 0 8px 18px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 16px 34px rgba(15, 23, 42, 0.12);
  --radius-sm: 0.625rem;
  --radius-md: 1rem;
  --radius-lg: 1.25rem;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
  color: var(--color-text);
  background:
    radial-gradient(circle at top right, rgba(125, 211, 252, 0.22), transparent 35%),
    linear-gradient(150deg, #eff6ff 0%, #dbeafe 35%, #bfdbfe 100%);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
}

/* ====== Página comisiones (dashboard moderno) ====== */
.comisiones-page {
  padding: var(--space-4);
}

.topbar {
  position: sticky;
  top: var(--space-2);
  z-index: 10;
  margin: 0 auto var(--space-6);
  max-width: 1320px;
  border: 1px solid rgba(191, 219, 254, 0.8);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(6px);
  box-shadow: var(--shadow-sm);
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.topbar__brand strong {
  display: block;
  color: var(--color-primary-dark);
  font-size: 1.05rem;
}

.topbar__brand small {
  color: var(--color-text-muted);
}

.topbar__icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--color-primary), #3b82f6);
  color: #fff;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.25);
}

.topbar__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.btn-modern {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 0.65rem 1rem;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.btn-modern:focus-visible,
.comision-card__button:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.35);
  outline-offset: 2px;
}

.btn-modern:hover {
  transform: translateY(-1px);
}

.btn-modern--ghost {
  color: var(--color-primary-dark);
  background: #eff6ff;
  border: 1px solid #c7ddff;
}

.btn-modern--ghost:hover {
  background: #dbeafe;
}

.btn-modern--danger {
  color: #fff;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  box-shadow: 0 10px 22px rgba(220, 38, 38, 0.25);
}

.btn-modern--danger:hover {
  box-shadow: 0 12px 24px rgba(220, 38, 38, 0.32);
}

.dashboard {
  max-width: 1320px;
  margin: 0 auto;
  display: grid;
  gap: var(--space-6);
}

.alert {
  border-radius: var(--radius-md);
  padding: var(--space-4);
  border: 1px solid #fecaca;
  background: #fff1f2;
  color: #7f1d1d;
}

.hero-card {
  border-radius: var(--radius-lg);
  border: 1px solid rgba(191, 219, 254, 0.8);
  background: linear-gradient(140deg, #ffffff 0%, #eff6ff 65%, #e0f2fe 100%);
  box-shadow: var(--shadow-md);
  padding: var(--space-6);
  display: grid;
  gap: var(--space-5);
}

.hero-card__profile {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.hero-card__avatar {
  width: 6.25rem;
  height: 6.25rem;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid #fff;
  box-shadow: 0 10px 25px rgba(37, 99, 235, 0.2);
  background: #f1f5f9;
}

.hero-card h1 {
  margin: 0;
  font-size: clamp(1.25rem, 3vw, 1.8rem);
  color: var(--color-primary-dark);
}

.hero-card__subtitle {
  margin: var(--space-1) 0;
  color: var(--color-text-muted);
}

.hero-card__meta {
  margin: 0;
  font-size: 0.95rem;
  color: #1e3a8a;
}

.hero-card__stats {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: 1fr;
}

.stat-pill {
  background: #ffffff;
  border: 1px solid #dbeafe;
  border-radius: var(--radius-md);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
}

.stat-pill__label {
  display: block;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.stat-pill__value {
  display: block;
  color: var(--color-primary-dark);
  margin-top: var(--space-1);
  font-size: 1.2rem;
}

.cards-section {
  display: grid;
  gap: var(--space-5);
}

.section-heading h2 {
  margin: 0;
  font-size: 1.5rem;
  color: var(--color-primary-dark);
}

.section-heading p {
  margin: var(--space-1) 0 0;
  color: var(--color-text-muted);
}

.empty-state {
  background: var(--color-surface);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  text-align: center;
  color: var(--color-text-muted);
}

.comisiones-grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: 1fr;
}

.comision-card {
  border-radius: var(--radius-md);
}

.comision-card__form {
  margin: 0;
}

.comision-card__button {
  width: 100%;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  padding: 0;
  display: block;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.comision-card__button:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.comision-card__button:hover .comision-card__image,
.comision-card__button:focus-visible .comision-card__image {
  transform: scale(1.04);
}

.comision-card__image {
  width: 100%;
  height: clamp(150px, 18vw, 220px);
  object-fit: cover;
  border-radius: var(--radius-md);
  border: 1px solid #dbeafe;
  background: #e2e8f0;
  display: block;
  transition: transform 0.25s ease, filter 0.25s ease;
}

/* ====== Sección legacy (otras pantallas del sistema) ====== */
.tabla {
  position: relative;
  margin: 0 auto;
  padding: 20px;
  text-align: center;
}

.tabla .thumbnail,
.form .thumbnail {
  width: 40%;
  height: auto;
  margin: 0 auto 30px;
  border-radius: 100%;
}

.tabla .thumbnail img {
  display: block;
  width: 10%;
}

.tabla h1 {
  color: #0f172a;
  font-size: 30px;
}

.tabla h2 {
  color: #1e293b;
  font-size: 20px;
  font-family: sans-serif;
}

.tabla button,
.form button {
  background: var(--color-primary);
  width: 30%;
  min-width: 160px;
  border: 2px solid var(--color-primary-dark);
  padding: 10px;
  border-radius: 12px;
  color: #fff;
  font-size: 16px;
  transition: background 0.2s ease;
  cursor: pointer;
}

.tabla button:hover,
.form button:hover {
  background: var(--color-primary-dark);
}

.form {
  position: relative;
  z-index: 1;
  background: #ffffff;
  border: 4px solid var(--color-primary);
  border-radius: 16px;
  max-width: 70%;
  margin: 20px auto;
  padding: 30px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(37, 99, 235, 0.25);
}

.form .thumbnail img {
  display: block;
  width: 100%;
}

.form input,
.form select {
  outline: 0;
  background: #eff6ff;
  width: 100%;
  border: 2px solid #93c5fd;
  margin: 0 0 15px;
  padding: 14px;
  border-radius: 12px;
  color: #0f172a;
  font-size: 18px;
}

.form .message {
  margin: 15px 0 0;
  color: #64748b;
  font-size: 12px;
}

.form .message a {
  color: var(--color-primary);
  text-decoration: none;
}

.container {
  position: relative;
  z-index: 1;
  max-width: 300px;
  margin: 0 auto;
}

.container .info {
  margin: 20px auto;
  text-align: center;
}

.container .info h1 {
  margin: 0 0 15px;
  font-size: 36px;
  font-weight: 500;
  color: #0f172a;
}

.container .info span {
  color: #334155;
  font-size: 12px;
}

.container .info span a {
  color: var(--color-primary-dark);
  text-decoration: none;
}

/* ====== Responsive ====== */
@media (min-width: 640px) {
  .comisiones-page {
    padding: var(--space-5);
  }

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

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

@media (min-width: 980px) {
  .comisiones-page {
    padding: var(--space-6);
  }

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

@media (min-width: 1280px) {
  .comisiones-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .form {
    max-width: 92%;
    padding: 18px;
    border-radius: 12px;
  }

  .form .thumbnail,
  .tabla .thumbnail {
    width: 70%;
  }

  .tabla {
    padding: 10px;
  }

  .form button,
  .tabla button {
    width: 100%;
    min-width: 0;
  }

  .container .info h1 {
    font-size: 28px;
  }
}


/* Consulta de expedientes y controles seguros */
.topbar__logout-form {
  margin: 0;
}

.topbar__logout-form .btn-modern {
  border: 0;
  cursor: pointer;
  font: inherit;
}

.consulta-page {
  background: #eef4ff;
  color: #0f172a;
}

.consulta-topbar {
  width: min(1500px, calc(100% - 2rem));
  margin: 1rem auto;
  padding: 1rem 1.2rem;
  border-radius: 20px;
  background: linear-gradient(135deg, #0f3b8f, #2563eb);
  box-shadow: 0 18px 38px rgba(15, 23, 42, .16);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.consulta-topbar h1 {
  flex: 1;
  margin: 0;
  color: #fff;
  text-align: center;
  font-size: clamp(1.2rem, 2vw, 2rem);
}

.consulta-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: .7rem 1rem;
  border-radius: 999px;
  font-weight: 800;
  text-decoration: none;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}

.consulta-action:hover {
  transform: translateY(-1px);
}

.consulta-action--back {
  background: #fff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
  box-shadow: 0 10px 22px rgba(15, 23, 42, .15);
}

.consulta-action--back:hover {
  background: #eff6ff;
  box-shadow: 0 14px 28px rgba(15, 23, 42, .22);
}

.consulta-shell {
  width: min(1500px, calc(100% - 2rem));
  margin: 0 auto 2rem;
}

.consulta-table-wrap {
  overflow-x: auto;
  background: #fff;
  border: 1px solid #dbeafe;
  border-radius: 20px;
  box-shadow: 0 14px 32px rgba(15, 23, 42, .10);
}

.consulta-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1050px;
  table-layout: fixed;
}

.consulta-table th:nth-child(1),
.consulta-table td:nth-child(1) {
  width: 4%;
}

.consulta-table th:nth-child(2),
.consulta-table td:nth-child(2) {
  width: 15%;
}

.consulta-table th:nth-child(3),
.consulta-table td:nth-child(3) {
  width: 18%;
}

.consulta-table th:nth-child(4),
.consulta-table td:nth-child(4) {
  width: 45%;
}

.consulta-table th:nth-child(5),
.consulta-table td:nth-child(5) {
  width: 9%;
}

.consulta-table th:nth-child(6),
.consulta-table td:nth-child(6) {
  width: 9%;
}

.consulta-table th {
  background: #2563eb;
  color: #fff;
  padding: .8rem;
  text-align: center;
}

.consulta-table td {
  padding: .75rem;
  border-bottom: 1px solid #e2e8f0;
  color: #0f172a;
  vertical-align: middle;
  text-align: center;
}

.consulta-table tr:hover td {
  background: #f8fbff;
}

.consulta-view-form {
  margin: 0;
}

.consulta-date {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.consulta-view-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 86px;
  min-height: 42px;
  box-sizing: border-box;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  padding: .65rem 1rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(37, 99, 235, .24);
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}

.consulta-view-button:hover,
.consulta-view-button:focus-visible {
  transform: translateY(-1px);
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
  box-shadow: 0 10px 22px rgba(37, 99, 235, .32);
}

.password-page,
.logout-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #0f172a, #1e3a8a);
  color: #fff;
}

.password-topbar {
  width: min(900px, calc(100% - 2rem));
  margin: 1rem auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.password-avatar {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid #fff;
}

.password-shell {
  width: min(520px, calc(100% - 2rem));
  margin: 2rem auto;
}

.password-card {
  background: #fff;
  color: #0f172a;
  padding: 2rem;
  border-radius: 24px;
  box-shadow: 0 22px 55px rgba(0, 0, 0, .25);
}

.password-card h1 {
  margin-top: 0;
}

.password-card form {
  display: grid;
  gap: .7rem;
  margin-top: 1.2rem;
}

.password-card label {
  font-weight: 800;
}

.password-card input {
  width: 100%;
  box-sizing: border-box;
  padding: .85rem 1rem;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
}

.password-card button {
  margin-top: .5rem;
  border: 0;
  border-radius: 999px;
  padding: .85rem 1rem;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.password-error {
  padding: .8rem 1rem;
  border-radius: 12px;
  background: #fee2e2;
  color: #991b1b;
  font-weight: 700;
}

.logout-card {
  width: min(520px, calc(100% - 2rem));
  margin: 4rem auto;
  padding: 2rem;
  text-align: center;
  background: #fff;
  color: #0f172a;
  border-radius: 24px;
  box-shadow: 0 22px 55px rgba(0, 0, 0, .25);
}

.logout-card img {
  width: 150px;
  height: 150px;
  object-fit: cover;
  border-radius: 50%;
  border: 5px solid #dbeafe;
}

@media (max-width: 700px) {
  .consulta-topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .consulta-topbar h1 {
    order: -1;
  }

  .consulta-action {
    width: 100%;
    box-sizing: border-box;
  }
}

/* ====== Ingreso y seguridad ====== */
.login-page {
  display: grid;
  place-items: center;
  padding: 1rem;
}

.login-card {
  width: min(460px, calc(100% - 2rem));
  max-width: 460px;
}

.login-thumbnail {
  width: 100% !important;
  margin-bottom: 1.25rem !important;
  border-radius: 0 !important;
}

.login-title {
  margin: 0 0 1rem;
  color: #0f172a;
  font-size: clamp(2rem, 7vw, 2.5rem);
}

.login-logo {
  display: block;
  width: 200px;
  max-width: 70%;
  height: auto;
  margin: 0 auto;
}

.login-alert {
  margin: 0 0 1rem;
  padding: .85rem 1rem;
  border-radius: 12px;
  font-weight: 700;
  text-align: left;
}

.login-alert--error {
  color: #991b1b;
  background: #fee2e2;
  border: 1px solid #fecaca;
}

.login-alert--success,
.alert--success {
  color: #14532d;
  background: #dcfce7;
  border: 1px solid #86efac;
}

.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;
}

.password-help {
  margin: .35rem 0;
  color: #475569;
  font-size: .95rem;
}

.secondary-form {
  margin-top: 1rem !important;
}

.password-card .button-secondary {
  width: 100%;
  background: #e2e8f0;
  color: #0f172a;
}
