:root {
  --bg: #eef2f6;
  --surface: rgba(255, 255, 255, 0.94);
  --surface-strong: #ffffff;
  --ink: #1f2937;
  --muted: #6b7280;
  --accent: #1f4f82;
  --accent-dark: #163a61;
  --danger: #b91c1c;
  --ok: #15803d;
  --ring: rgba(31, 79, 130, 0.14);
  --border: rgba(15, 23, 42, 0.1);
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  background: linear-gradient(180deg, #eef2f6 0%, #e5ebf2 100%);
  min-height: 100dvh;
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.dashboard-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  height: 100dvh;
  overflow: hidden;
}

.mobile-menu-overlay {
  display: none;
}

.sidebar {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 22px;
  padding: 22px 18px;
  background: linear-gradient(180deg, #1f3a5a 0%, #1b314c 100%);
  color: #f8fafc;
  min-height: 0;
  overflow: hidden;
}

.sidebar-brand h1,
.sidebar-brand p,
.dashboard-topbar h2,
.dashboard-topbar p,
.panel-heading h2,
.panel-heading h3,
.panel-heading p {
  margin: 0;
}

.sidebar-copy,
.muted-copy,
.panel-heading p,
.hero-copy,
.hint,
.message {
  color: var(--muted);
}

.muted-copy,
.sidebar-copy {
  color: rgba(248, 250, 252, 0.74);
}

.sidebar-nav {
  display: grid;
  gap: 10px;
  align-content: start;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.menu-button {
  border: 1px solid rgba(248, 250, 252, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: #f8fafc;
  text-align: left;
  padding: 11px 13px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 150ms ease, transform 150ms ease, border-color 150ms ease;
}

.menu-button.active,
.menu-button:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateX(2px);
}

.menu-toggle {
  display: none;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--ink);
  border-radius: 8px;
  width: 37px;
  height: 37px;
  padding: 0;
  margin-left: auto;
  cursor: pointer;
}

.menu-toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 1rem;
  line-height: 1;
}

.sidebar-footer {
  display: grid;
  gap: 12px;
}

.session-badge {
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
}

.session-badge p {
  margin: 0;
}

.dashboard-main {
  padding: 22px;
  min-width: 0;
  min-height: 0;
  overflow: auto;
}

.dashboard-topbar {
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  align-items: center;
  margin-bottom: 8px;
  position: sticky;
  top: 0;
  z-index: 5;
  padding-bottom: 4px;
  background: linear-gradient(180deg, #eef2f6 0%, #eef2f6 82%, rgba(238, 242, 246, 0));
}

.big-stat span,
.big-stat strong {
  display: block;
}

.content-section {
  display: block;
}

.content-section.hidden,
.hidden {
  display: none !important;
}

.section-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.stat-stack,
.quick-actions,
.log-card,
.network-card,
.session-card,
.stat-card {
  display: grid;
  gap: 14px;
}

.survey-list {
  display: grid;
  gap: 14px;
  max-height: min(60dvh, 720px);
  overflow: auto;
  padding-right: 4px;
}

.survey-workspace {
  display: grid;
  gap: 10px;
}

.survey-workspace .panel-heading p {
  margin-top: 4px;
}

#survey-form {
  display: grid;
  gap: 10px;
}

.big-stat,
.survey-item,
.log-entry {
  padding: 14px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid var(--border);
}

.survey-item {
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.survey-item.active {
  border-color: var(--accent);
  background: #eef5fb;
}

.survey-detail-header,
.detail-row {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.survey-detail {
  display: grid;
  gap: 12px;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 40;
}

.modal.hidden {
  display: none !important;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.modal-dialog {
  position: relative;
  z-index: 1;
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid var(--border);
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.22);
  padding: 18px;
}

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

.modal-header h3,
.modal-header p {
  margin: 0;
}

.modal-subtitle {
  margin-top: 4px;
  color: var(--muted);
}

.big-stat strong {
  margin-top: 6px;
  font-size: 1.4rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.85rem;
}

.pill.online {
  background: rgba(21, 128, 61, 0.14);
  color: var(--ok);
}

.pill.offline {
  background: rgba(185, 28, 28, 0.14);
  color: var(--danger);
}

.primary-button,
.secondary-button,
.ghost-button,
.secondary-link {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease, color 150ms ease;
}

.primary-button {
  background: var(--accent);
  color: white;
}

.secondary-button {
  background: rgba(31, 79, 130, 0.12);
  color: var(--accent-dark);
}

.ghost-button {
  background: transparent;
  border: 1px solid var(--border);
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover {
  transform: translateY(-1px);
}

.sidebar .secondary-button {
  background: rgba(255, 255, 255, 0.1);
  color: #f8fafc;
}

.quick-link {
  /* centrar el texto del boton */
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

label,
.option {
  display: grid;
  gap: 8px;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(28, 25, 23, 0.14);
  border-radius: 10px;
  background: var(--surface-strong);
}

input[type="text"]:focus,
input[type="password"]:focus {
  outline: 2px solid var(--ring);
  border-color: var(--accent);
}

.question {
  margin: 0;
  padding: 10px 0 12px;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
}

.question legend {
  padding: 0 0 6px;
  font-weight: 600;
}

.option {
  grid-template-columns: 20px 1fr;
  align-items: center;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.message {
  min-height: 22px;
}

.message[data-kind="error"] {
  color: var(--danger);
}

.message[data-kind="success"] {
  color: var(--ok);
}

.matrix {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
}

.matrix th,
.matrix td {
  border: 1px solid rgba(28, 25, 23, 0.08);
  padding: 8px;
  text-align: center;
}

.matrix th:first-child {
  text-align: left;
}

.user-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.admin-stats-section {
  margin-top: 16px;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.stat-card {
  padding: 14px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.survey-total {
  font-weight: 600;
  color: var(--accent-dark);
}

.admin-register-form {
  margin-top: 18px;
}

.page-shell {
  max-width: 1320px;
  margin: 0 auto;
  padding: 24px 16px 32px;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.hero h1 {
  margin: 0 0 10px;
  max-width: 700px;
  font-size: clamp(1.35rem, 2.5vw, 1.9rem);
  line-height: 1.15;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-weight: 600;
  letter-spacing: 0.06em;
  font-size: 0.75rem;
  text-transform: uppercase;
}

.auth-layout {
  display: grid;
  grid-template-columns: minmax(0, 520px);
  justify-content: center;
  margin-top: 16px;
}

.auth-panel-wide {
  max-width: 680px;
  width: 100%;
  justify-self: center;
}

@media (max-width: 980px) {
  .dashboard-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 260px;
    transform: translateX(-100%);
    transition: transform 180ms ease;
    z-index: 20;
    height: 100dvh;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .mobile-menu-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.28);
    z-index: 15;
  }

  .mobile-menu-overlay.hidden {
    display: none !important;
  }

  .menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .dashboard-topbar,
  .section-grid,
  .hero {
    flex-direction: column;
    grid-template-columns: 1fr;
  }

  .dashboard-main {
    padding: 16px;
    overflow: visible;
  }

  .dashboard-topbar {
    position: sticky;
    top: 0;
    margin: -16px -16px 12px;
    padding: 10px 16px;
    background: rgba(238, 242, 246, 0.96);
    backdrop-filter: blur(6px);
  }

  .survey-list {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .survey-workspace {
    gap: 8px;
  }

  .matrix {
    display: block;
    overflow-x: auto;
  }
}
