:root {
  --primary: #002e9f;
  --primary-dark: #001f73;
  --cyan: #2db9d6;
  --cyan-dark: #158fa9;
  --bg: #f2f6fd;
  --text: #17233d;
  --muted: #68748c;
  --border: #dbe4f2;
  --white: #ffffff;
  --danger: #b83e3e;
  --success: #267853;
  --warning: #a66a0a;
  --info: #2d638d;
  --purple: #714c9e;
  --font-body: "Inter", "Segoe UI", Arial, sans-serif;
  --font-display: "Montserrat", "Arial Black", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html {
  width: 100%;
  max-width: 100%;
  -webkit-text-size-adjust: 100%;
}
body {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0;
  overflow-x: clip;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
}
main, aside, section, article, form, fieldset, div { min-width: 0; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; height: auto; }
button, input, textarea, select { font: inherit; font-size: 16px; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
input, textarea, select { min-width: 0; max-width: 100%; }

.admin-shell {
  min-height: 100svh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}
.sidebar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 100svh;
  display: flex;
  flex-direction: column;
  padding: max(20px, env(safe-area-inset-top)) 18px max(20px, env(safe-area-inset-bottom));
  color: var(--white);
  background: linear-gradient(180deg, var(--primary), var(--primary-dark));
  overflow-y: auto;
}
.sidebar-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding-bottom: 21px;
  border-bottom: 1px solid rgba(255,255,255,.14);
}
.brand { min-width: 0; flex: 1; }
.brand-logo {
  width: min(205px, 100%);
  height: auto !important;
  object-fit: contain;
  margin-inline: auto;
}
.brand-caption {
  font-family: var(--font-display);
  display: block;
  margin: 8px 4px 0;
  color: rgba(255,255,255,.68);
  font-size: 11px;
  letter-spacing: .5px;
  overflow-wrap: anywhere;
}
.sidebar-close {
  display: none;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  color: var(--white);
  background: rgba(255,255,255,.12);
  border: 0;
  border-radius: 10px;
  font-size: 22px;
  cursor: pointer;
}
.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 24px;
}
.sidebar nav a {
  font-family: var(--font-display);
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 11px 14px;
  color: rgba(255,255,255,.78);
  border-radius: 11px;
  font-size: 14px;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.sidebar nav a:hover,
.sidebar nav a.active {
  color: var(--white);
  background: rgba(255,255,255,.14);
}
.logout-form { margin-top: auto; padding-top: 24px; }
.sidebar-backdrop { display: none; }

.admin-main {
  min-width: 0;
  width: 100%;
  padding: clamp(20px, 3vw, 28px);
}
.topbar {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 26px;
}
.topbar > div { min-width: 0; }
.topbar h1 {
  font-family: var(--font-display);
  max-width: 100%;
  margin: 0;
  font-size: clamp(22px, 3vw, 28px);
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.topbar p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}
.menu-button {
  display: none;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: var(--primary);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 21px;
  box-shadow: 0 5px 18px rgba(0,46,159,.08);
  cursor: pointer;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 18px;
  margin-bottom: 22px;
}
.stat-card {
  min-width: 0;
  padding: 22px;
  background: var(--white);
  border: 1px solid var(--border);
  border-top: 4px solid var(--primary);
  border-radius: 16px;
  box-shadow: 0 8px 22px rgba(0,46,159,.05);
}
.stat-card.success { border-top-color: var(--success); }
.stat-card.info { border-top-color: var(--info); }
.stat-card.warning { border-top-color: var(--warning); }
.stat-card.danger { border-top-color: var(--danger); }
.stat-card.purple { border-top-color: var(--purple); }
.stat-card span,
.stat-card small {
  display: block;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.stat-card strong {
  font-family: var(--font-display);
  display: block;
  margin: 8px 0;
  font-size: clamp(30px, 4vw, 36px);
}

.panel {
  min-width: 0;
  width: 100%;
  padding: 22px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 8px 22px rgba(0,46,159,.04);
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}
.panel-header.wrap { flex-wrap: wrap; }
.panel-header > div:first-child { min-width: 0; }
.panel-header h2 {
  font-family: var(--font-display);
  margin: 0;
  font-size: 19px;
  overflow-wrap: anywhere;
}
.panel-header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.actions,
.row-actions,
.form-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}
.row-actions { flex-wrap: wrap; }
.row-actions form { margin: 0; }
.btn {
  font-family: var(--font-display);
  max-width: 100%;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
  white-space: normal;
  cursor: pointer;
}
.btn-primary { color: var(--white); background: var(--primary); }
.btn-excel { color: var(--white); background: #217346; border-color: #1b603a; box-shadow: 0 6px 16px rgba(33,115,70,.16); }
.btn-excel:hover { background: #1b603a; }
.btn-dark { color: var(--white); background: #263b62; }
.btn-light { color: var(--text); background: var(--white); border-color: var(--border); }
.btn-danger { color: var(--danger); background: #fff0f0; border-color: #efc2c2; }
.btn-small { min-height: 36px; padding: 7px 10px; font-size: 12px; }
.btn-block { width: 100%; }
.btn:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
.menu-button:focus-visible,
.sidebar-close:focus-visible {
  outline: 3px solid rgba(45,185,214,.32);
  outline-offset: 2px;
}

.table-responsive {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}
th, td {
  padding: 13px 10px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid #edf1f7;
  font-size: 13px;
  overflow-wrap: anywhere;
}
th {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .5px;
  text-transform: uppercase;
  white-space: nowrap;
}
tbody tr:hover { background: #f9fbff; }
.badge {
  display: inline-flex;
  max-width: 100%;
  padding: 6px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}
.badge-success { color: #1d6847; background: #e5f5ed; }
.badge-warning { color: #8a5a06; background: #fff3d8; }
.badge-danger { color: #9b3434; background: #ffe9e9; }
.table-note {
  display: block;
  max-width: 260px;
  margin-top: 5px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.empty { padding: 30px; color: var(--muted); text-align: center; }

.filters {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) minmax(150px, 1fr) auto auto;
  gap: 10px;
  margin-bottom: 18px;
}
.filters input,
.filters select,
.admin-form input,
.admin-form textarea,
.admin-form select,
.auth-card input {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 44px;
  padding: 11px 12px;
  color: var(--text);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 9px;
  outline: none;
}
input[type="datetime-local"] { min-width: 0; }
.admin-form textarea { resize: vertical; }
.filters input:focus,
.filters select:focus,
.admin-form input:focus,
.admin-form textarea:focus,
.admin-form select:focus,
.auth-card input:focus {
  border-color: var(--cyan-dark);
  box-shadow: 0 0 0 3px rgba(45,185,214,.12);
}
.admin-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}
.form-group {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.form-group label {
  font-size: 13px;
  font-weight: 800;
  overflow-wrap: anywhere;
}
.span-2 { grid-column: 1 / -1; }
.checkbox-line {
  display: flex !important;
  align-items: center;
  gap: 9px;
  line-height: 1.45;
}
.checkbox-line input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  flex: 0 0 auto;
}
.form-actions {
  justify-content: flex-end;
  margin-top: 6px;
}
.alert {
  margin-bottom: 18px;
  padding: 13px 15px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.alert ul { margin: 0; padding-left: 18px; }
.alert-success { color: #1d6847; background: #e5f5ed; border: 1px solid #b7dfcc; }
.alert-danger { color: #9b3434; background: #fff0f0; border: 1px solid #efc2c2; }

.auth-body {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding:
    max(24px, env(safe-area-inset-top))
    16px
    max(24px, env(safe-area-inset-bottom));
  background: radial-gradient(circle at top, #0b4ac2, var(--primary-dark));
}
.auth-card {
  width: min(430px, 100%);
  min-width: 0;
  padding: 30px;
  background: var(--white);
  border-radius: 20px;
  box-shadow: 0 30px 90px rgba(0,0,0,.3);
}
.auth-brand {
  margin: -10px -10px 22px;
  padding: 14px;
  background: var(--primary);
  border-radius: 14px;
}
.auth-logo {
  width: min(300px, 82%);
  height: auto !important;
  object-fit: contain;
  margin-inline: auto;
}
.auth-card h1 {
  font-family: var(--font-display);
  margin: 0 0 8px;
  font-size: 25px;
  overflow-wrap: anywhere;
}
.auth-card > p {
  margin: 0 0 22px;
  color: var(--muted);
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.auth-card form { display: flex; flex-direction: column; gap: 16px; }
.auth-card label { font-size: 13px; font-weight: 800; }
.back-link {
  display: block;
  margin-top: 20px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

@media (max-width: 1120px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .filters { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 1080px) {
  .admin-shell { display: block; }
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: -320px;
    width: min(300px, 88vw);
    height: 100dvh;
    transition: left .22s ease;
    box-shadow: 18px 0 50px rgba(0,0,0,.24);
  }
  .sidebar.open { left: 0; }
  .sidebar-close { display: grid; }
  .sidebar-backdrop {
    position: fixed;
    z-index: 35;
    inset: 0;
    display: block;
    visibility: hidden;
    opacity: 0;
    background: rgba(5,15,40,.52);
    border: 0;
    transition: opacity .22s ease, visibility .22s ease;
  }
  .sidebar-backdrop.open { visibility: visible; opacity: 1; }
  .admin-main { padding: 18px; }
  .topbar {
    position: sticky;
    z-index: 25;
    top: 0;
    margin: -18px -18px 20px;
    padding: 14px 18px;
    background: rgba(242,246,253,.94);
    border-bottom: 1px solid rgba(219,228,242,.9);
    backdrop-filter: blur(12px);
  }
  .menu-button { display: inline-flex; }
  .admin-form { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
}

@media (max-width: 820px) {
  .panel { padding: 17px; }
  .panel-header {
    align-items: flex-start;
    flex-direction: column;
  }
  .panel-header .btn { width: 100%; }
  .actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .filters { grid-template-columns: 1fr; }
  .filters .btn { width: 100%; }
  .form-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }
  .form-actions .btn { width: 100%; }

  .responsive-card-table { min-width: 0; }
  .responsive-card-table thead { display: none; }
  .responsive-card-table,
  .responsive-card-table tbody,
  .responsive-card-table tr,
  .responsive-card-table td {
    display: block;
    width: 100%;
  }
  .responsive-card-table tbody { display: grid; gap: 12px; }
  .responsive-card-table tr {
    padding: 14px;
    background: #f9fbff;
    border: 1px solid var(--border);
    border-radius: 13px;
  }
  .responsive-card-table td {
    min-height: 35px;
    display: grid;
    grid-template-columns: minmax(90px, 34%) minmax(0, 1fr);
    align-items: start;
    gap: 12px;
    padding: 8px 0;
    text-align: right;
    border-bottom: 1px dashed #dde5f1;
    overflow-wrap: anywhere;
  }
  .responsive-card-table td > * { min-width: 0; }
  .responsive-card-table td:last-child {
    padding-bottom: 0;
    border-bottom: 0;
  }
  .responsive-card-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .5px;
    text-align: left;
    text-transform: uppercase;
  }
  .responsive-card-table td[data-empty] {
    display: block;
    padding: 20px 8px;
    text-align: center;
    border: 0;
  }
  .responsive-card-table td[data-empty]::before { display: none; }
  .responsive-card-table .table-note { max-width: 100%; }
  .responsive-card-table .row-actions { justify-content: flex-end; }
  .responsive-card-table td[data-label="Invitado"] strong { font-size: 15px; }
  .table-responsive { overflow: visible; }
}

@media (max-width: 560px) {
  .admin-main { padding: 12px; }
  .topbar {
    margin: -12px -12px 15px;
    padding: 11px 12px;
  }
  .topbar p { display: none; }
  .topbar h1 { font-size: 20px; }
  .panel {
    padding: 14px;
    border-radius: 13px;
  }
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .stat-card { padding: 16px; }
  .stat-card strong { font-size: 30px; }
  .stat-card small { font-size: 11px; }
  .actions { grid-template-columns: 1fr; }
  .responsive-card-table td {
    grid-template-columns: minmax(78px, 31%) minmax(0, 1fr);
    gap: 10px;
  }
  .responsive-card-table .row-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }
  .responsive-card-table .row-actions .btn,
  .responsive-card-table .row-actions form,
  .responsive-card-table .row-actions form .btn { width: 100%; }
  .auth-card {
    padding: 22px 17px;
    border-radius: 17px;
  }
  .auth-brand { margin: -4px -2px 20px; }
  .auth-logo { width: min(250px, 86%); }
}

@media (max-width: 360px) {
  .admin-main { padding: 9px; }
  .topbar {
    margin: -9px -9px 12px;
    padding: 9px;
    gap: 10px;
  }
  .menu-button {
    width: 40px;
    height: 40px;
  }
  .topbar h1 { font-size: 18px; }
  .panel { padding: 12px; }
  .responsive-card-table tr { padding: 11px; }
  .responsive-card-table td {
    display: block;
    text-align: left;
  }
  .responsive-card-table td::before {
    display: block;
    margin-bottom: 4px;
  }
  .responsive-card-table .row-actions { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; }
}

/* ===== Jerarquía tipográfica final del panel administrativo ===== */
body,
input,
textarea,
select,
table {
  font-family: var(--font-body);
  font-weight: 400;
}

h1, h2, h3, h4, h5, h6,
.sidebar nav a,
.brand-caption,
.btn,
.stat-card strong,
.badge {
  font-family: var(--font-display);
}

h1, h2, h3, h4, h5, h6,
.topbar h1,
.panel-header h2,
.auth-card h1,
.stat-card strong {
  font-weight: 700;
}

.sidebar nav a,
.brand-caption,
.form-group label,
.auth-card label,
th {
  font-weight: 600;
}

.btn,
.badge {
  font-weight: 700;
}

th {
  font-family: var(--font-display);
  letter-spacing: 0.06em;
}

td,
.panel-header p,
.topbar p,
.auth-card > p,
.table-note,
.alert {
  font-family: var(--font-body);
}
