:root {
    --surface: #f8f9fa;
    --surface-low: #f2f4f5;
    --surface-high: #e7e8e9;
    --surface-lowest: #ffffff;
    --primary: #297fbf;
    --primary-soft: #1f5f8f;
    --secondary: #1d6fa6;
    --text: #191c1d;
    --text-soft: #404849;
    --muted: #666666;
    --success-bg: #d9f9dc;
    --success-text: #135821;

    /* Tematización de Bootstrap: mapea las variables --bs-* al tema existente
       para que cualquier clase de Bootstrap usada de aquí en adelante combine
       con la paleta actual sin overrides manuales por componente. */
    --bs-primary: var(--primary);
    --bs-primary-rgb: 41, 127, 191;
    --bs-secondary: var(--secondary);
    --bs-secondary-rgb: 29, 111, 166;
    --bs-success: #135821;
    --bs-success-rgb: 19, 88, 33;
    --bs-danger: #dc2626;
    --bs-danger-rgb: 220, 38, 38;
    --bs-warning: #92400e;
    --bs-warning-rgb: 146, 64, 14;
    --bs-info: #14696d;
    --bs-info-rgb: 20, 105, 109;
    --bs-body-color: var(--text);
    --bs-body-bg: var(--surface);
    --bs-border-color: rgba(0, 51, 54, .12);
    --bs-border-radius: .6rem;
    --bs-border-radius-sm: .4rem;
    --bs-border-radius-lg: .9rem;
    --bs-link-color: var(--primary);
    --bs-link-color-rgb: 41, 127, 191;
    --bs-link-hover-color: var(--primary-soft);
    --bs-link-hover-color-rgb: 31, 95, 143;
    --bs-body-font-family: "Inter", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    color: var(--text);
    background: radial-gradient(circle at 0% 0%, #eef7f8 0%, var(--surface) 30%);
    font-family: "Inter", "Segoe UI", sans-serif;
}

.page { min-height: 100vh; display: flex; }
.sidebar {
    width: 250px;
    background: linear-gradient(180deg, #f6f8f9, #eef1f2);
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.brand-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
}
.brand-logo {
    width: 80%;
    height: auto;
    border-radius: .75rem;
    box-shadow: 0 4px 16px rgba(0,0,0,0.18);
    display: block;
    transition: transform .2s ease;
}
.brand-logo:hover {
    transform: scale(1.03);
}

.sr-nav-link {
    display: block;
    padding: .65rem .8rem;
    border-radius: .7rem;
    color: var(--text-soft);
    text-decoration: none;
    margin-bottom: .25rem;
    font-weight: 600;
}
.sr-nav-link.active { background: var(--surface-high); color: var(--primary); }

.content-wrap { flex: 1; display: flex; flex-direction: column; }
.topbar {
    height: 64px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1.5rem;
    background: rgba(255,255,255,.75);
    backdrop-filter: blur(14px);
}
.top-user-wrap {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.user-badge {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--primary-soft));
    color: #fff;
    font-weight: 800;
}

.user-meta { display: flex; flex-direction: column; }
.user-name { font-weight: 700; color: var(--primary); font-size: 0.95rem; }
.user-role { font-size: 0.78rem; color: var(--text-soft); }

.btn-logout {
    padding: .5rem .85rem;
    border-radius: .6rem;
    background: var(--surface-high);
    color: var(--primary);
    font-weight: 700;
    border: none;
}
.btn-logout:hover { filter: brightness(.98); }

/* Dropdown menu styles */
.user-dropdown { position: relative; }
.user-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 0.6rem;
}
.user-name-inline { font-weight:700; color:var(--primary); margin-right: 0.25rem; }
.chevron { color: var(--text-soft); font-size: 0.8rem; }
.user-dropdown-menu {
    position: absolute;
    right: 0;
    top: 44px;
    background: var(--surface-lowest);
    border: 1px solid rgba(0,0,0,0.06);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    border-radius: 0.6rem;
    padding: 0.35rem;
    min-width: 160px;
    z-index: 1000;
}
.sr-dropdown-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.6rem 0.8rem;
    background: transparent;
    border: none;
    cursor: pointer;
    font-weight: 700;
    color: var(--text);
}
.sr-dropdown-item:hover { background: var(--surface-low); }

/* Modal styles */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}
.modal {
    background: white;
    border-radius: 0.8rem;
    padding: 1.25rem;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.12);
}
.modal h3 { margin: 0 0 0.5rem 0; color: var(--primary); }
.modal p { margin: 0 0 1rem 0; color: var(--text-soft); }
.modal-actions { display:flex; justify-content:flex-end; gap:0.5rem; }
.modal-actions .sr-btn-primary { min-width: 140px; }
.search {
    width: min(520px, 100%);
    border: none;
    background: var(--surface-low);
    border-radius: 999px;
    padding: .65rem 1rem;
}
.top-user { color: var(--primary); font-weight: 700; }
.content { padding: 1.5rem; }

.page-header h1 { margin: 0; font-family: "Manrope", "Inter", sans-serif; color: var(--primary); font-size: 2rem; }
.page-header p { color: var(--text-soft); margin-top: .3rem; }

.panel { background: var(--surface-lowest); border-radius: 1rem; padding: 1rem; margin: 1rem 0; box-shadow: 0 8px 24px rgba(0, 51, 54, .06); }
.panel.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.ranking-grid-shell {
  display: grid;
  grid-template-rows: 1fr;
  margin-top: 1rem;
  opacity: 1;
  transition: grid-template-rows 280ms ease, opacity 180ms ease, margin-top 280ms ease;
}
.ranking-grid-shell-inner {
  min-height: 0;
  overflow: visible !important;
}
.ranking-grid-shell--collapsed {
  grid-template-rows: 0fr;
  margin-top: 0;
  opacity: 0;
}
.sr-card { background: var(--surface-low); border-radius: .9rem; padding: 1rem; }
.sr-card h3 { margin-top: 0; color: var(--primary); }

.field-grid { display: grid; gap: .55rem; }
.field-grid-2col { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; }
.form-section { margin-bottom: 1.5rem; }
.form-section-title { font-size: .76rem; font-weight: 700; color: var(--text-soft); text-transform: uppercase; letter-spacing: .08em; margin: 0 0 .5rem; }
.form-hint { display: flex; align-items: center; gap: .3rem; margin-top: .1rem; color: var(--muted); font-size: .72rem; font-weight: 400; line-height: 1.3; }
.form-hint-icon { display: inline-flex; align-items: center; justify-content: center; min-width: 13px; height: 13px; border-radius: 50%; border: 1.5px solid currentColor; font-size: .6rem; font-weight: 700; flex-shrink: 0; line-height: 1; }
.form-group { display: flex; flex-direction: column; gap: .25rem; }
label { font-weight: 700; font-size: .76rem; color: var(--text-soft); text-transform: uppercase; letter-spacing: .08em; }
input, select, textarea {
    border: none;
    border-radius: .6rem;
    background: var(--surface-lowest);
    padding: .7rem .8rem;
}

.sr-btn-primary, .sr-btn-secondary, .btn-inline {
    border: none;
    border-radius: .7rem;
    padding: .65rem 1rem;
    font-weight: 700;
    cursor: pointer;
}
.sr-btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-soft)); color: white; }
.sr-btn-secondary { background: var(--surface-high); color: var(--primary); }
.btn-inline { background: var(--primary); color: white; }
.sr-btn-primary.sr-btn-sm, .sr-btn-secondary.sr-btn-sm { padding: .4rem .75rem; font-size: .85rem; }
.panel-toggle-btn { display: inline-flex; align-items: center; gap: .45rem; white-space: nowrap; }

.ledger-table { width: 100%; border-collapse: separate; border-spacing: 0 .45rem; }
.ledger-table th { text-align: left; color: var(--text-soft); font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; }
.ledger-table td { background: var(--surface-low); padding: .65rem .6rem; }
.status { padding: .2rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 700; }
.status.publicado   { background: #a3ecf0; color: #004f53; }
.status.borrador    { background: #e7e8e9; color: #404849; }
.status.cerrado     { background: #dce1e2; color: #404849; }
.status.confirmada  { background: #d9f9dc; color: #135821; }
.status.anulada     { background: #ffd9d9; color: #8b1e1e; }
.status.premiado    { background: #fef3c7; color: #92400e; }
.sc-chip-val--sin-limite { color: var(--muted); font-style: italic; }

/* VentaDetalle */
.page-header-row { display: flex; align-items: center; gap: 1rem; margin-bottom: 0.5rem; }
.btn-back { display: inline-flex; align-items: center; gap: .4rem; background: var(--surface-high); border: none; border-radius: .7rem; padding: .45rem .85rem; font-weight: 700; color: var(--primary); cursor: pointer; font-size: .85rem; text-decoration: none; }
.btn-back:hover { filter: brightness(.96); }
.kpi-status-wrap { margin: .4rem 0 .15rem 0; }
.panel-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.panel-title-row h3 { margin: 0; color: var(--primary); font-size: 1rem; }
.count-badge { font-size: .75rem; font-weight: 700; color: var(--text-soft); background: var(--surface-low); border-radius: 999px; padding: .2rem .7rem; }
.map-wrap { border-radius: .9rem; overflow: hidden; border: 1px solid rgba(0,51,54,.09); }
.map-wrap iframe { display: block; width: 100%; height: 340px; border: none; }
.map-coords { font-size: .78rem; color: var(--muted); font-family: "Consolas","Courier New",monospace; }
.sin-ubicacion-msg { color: var(--muted); font-size: .88rem; margin: 0; padding: .35rem 0 .1rem; }

/* Boleto cards (VentaDetalle) */
.boletos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 0.7rem; }
.boleto-card {
    background: var(--surface-lowest);
    border: 1px solid rgba(0,51,54,.09);
    border-radius: 0.85rem;
    padding: 1rem 0.6rem 0.85rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.32rem;
    box-shadow: 0 2px 8px rgba(0,51,54,.05);
    transition: box-shadow 150ms ease;
}
.boleto-card:hover { box-shadow: 0 4px 14px rgba(0,51,54,.1); }
.boleto-numero { font-size: 1.2rem; font-weight: 800; color: var(--primary); line-height: 1; font-family: "Consolas","Courier New",monospace; }
.boleto-label { font-size: 0.58rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.boleto-card.ganador { background: linear-gradient(145deg, #fffbeb, #fef3c7); border: 2px solid #f59e0b; box-shadow: 0 4px 18px rgba(245,158,11,.28); }
.boleto-card.ganador .boleto-numero { color: #78350f; }
.boleto-crown { font-size: 1.3rem; line-height: 1; }
.ganador-badge { display: inline-block; background: #f59e0b; color: #422006; font-size: 0.57rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.1em; padding: 0.2rem 0.55rem; border-radius: 2rem; margin-top: 0.1rem; }

.kpi-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.kpi-card { background: var(--surface-lowest); border-radius: 1rem; padding: 1rem; box-shadow: 0 8px 24px rgba(0, 51, 54, .06); }
.kpi-card.accent { background: linear-gradient(145deg, var(--primary), var(--primary-soft)); color: #fff; }
.kpi-card h3 { margin: 0; font-size: .9rem; }
.kpi-card strong { font-size: 1.65rem; display: block; margin: .35rem 0; }
.kpi-card span { font-size: .8rem; }

.table-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:.4rem; }
.sr-toast { margin-top: .8rem; background: #d9f9dc; color: #135821; padding: .6rem .8rem; border-radius: .6rem; font-weight: 600; }

/* Utility classes for layout and themeable backgrounds/texts */
.bg-surface { background: var(--surface); }
.bg-surface-low { background: var(--surface-low); }
.bg-surface-high { background: var(--surface-high); }
.bg-primary { background: var(--primary); }
.bg-primary-soft { background: var(--primary-soft); }
.text-primary { color: var(--primary); }
.text-secondary { color: var(--secondary); }
.sr-text-muted { color: var(--muted); }
.icon-muted { color: #999; font-size: 1.2rem; }

.table-header-flex { display:flex; justify-content:space-between; align-items:center; gap:1rem; }
.controls-row { display:flex; gap:0.5rem; align-items:center; }
.controls-row.gap-lg { gap: 1rem; align-items: center; }
/* ── Sorteo Card ── */
.sc-card {
  border: 1px solid rgba(0,51,54,.09);
  border-radius: 14px;
  background: var(--surface-lowest);
  margin-bottom: .5rem;
  overflow: hidden;
  transition: box-shadow 180ms ease;
}
.sc-card--open,
.sc-card:hover { box-shadow: 0 4px 20px rgba(0,51,54,.08); }

.sc-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .7rem 1rem;
  cursor: pointer;
  user-select: none;
  transition: background 120ms;
}
.sc-header:hover { background: rgba(41,127,191,.03); }
.sc-card--open .sc-header {
  border-bottom: 1px solid rgba(0,51,54,.07);
  background: linear-gradient(180deg, rgba(41,127,191,.05), transparent);
}

.sc-header-body { flex: 1; min-width: 0; }
.sc-title-row { display: flex; align-items: baseline; gap: .45rem; flex-wrap: wrap; }
.sc-nombre { font-weight: 700; font-size: .95rem; color: var(--text); }
.sc-desc {
  font-size: .8rem;
  color: var(--text-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 280px;
}
.sc-meta-row {
  display: flex;
  align-items: center;
  gap: .3rem;
  margin-top: .18rem;
  font-size: .76rem;
  color: var(--muted);
  flex-wrap: wrap;
}
.sc-sep, .sc-bullet { color: rgba(0,51,54,.28); }
.sc-header-end { display: flex; align-items: center; gap: .55rem; flex-shrink: 0; }
.sc-chevron {
  color: var(--muted);
  font-size: 1.1rem;
  display: inline-block;
  transform: rotate(0deg);
  transition: transform 200ms ease;
  line-height: 1;
}
.sc-chevron--open { transform: rotate(90deg); }

.sc-body {
  padding: .8rem 1rem .95rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

/* Info strip */
.sc-info-strip {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem .95rem;
  background: linear-gradient(180deg, #f6f8f9, #f0f3f4);
  border: 1px solid rgba(0,51,54,.07);
  border-radius: 10px;
  padding: .75rem 1rem;
}
.sc-info-chip { display: flex; flex-direction: column; gap: .22rem; min-width: 72px; }
.sc-info-chip--wide { flex: 1; min-width: 200px; }
.sc-chip-label {
  font-size: .6rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  font-weight: 800;
  color: var(--primary);
}
.sc-chip-val { font-size: .8rem; font-weight: 600; color: var(--text); }
.sc-chip-mono { font-family: "Consolas","Courier New",monospace; font-size: .76rem; color: var(--text-soft); }

/* Sections */
.sc-section { display: flex; flex-direction: column; gap: .35rem; }
.sc-section-header { display: flex; align-items: center; justify-content: space-between; }
.sc-section-eyebrow {
  font-size: .65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--primary);
}
.sc-add-btn {
  background: none;
  border: 1px solid rgba(41,127,191,.28);
  border-radius: 6px;
  padding: .15rem .5rem;
  font-size: .72rem;
  font-weight: 700;
  color: var(--primary);
  cursor: pointer;
  transition: background 120ms, border-color 120ms;
}
.sc-add-btn:hover { background: rgba(41,127,191,.07); border-color: var(--primary); }
.sc-empty { font-size: .78rem; color: var(--muted); margin: 0; padding: .2rem 0; }

/* Horarios pills */
.sc-horario-pills { display: flex; flex-wrap: wrap; gap: .3rem; }
.sc-horario-pill {
  display: inline-flex;
  align-items: center;
  gap: .28rem;
  background: rgba(41,127,191,.07);
  border: 1px solid rgba(41,127,191,.16);
  border-radius: 999px;
  padding: .2rem .65rem .2rem .5rem;
}
.sc-horario-dia {
  font-weight: 800;
  color: var(--primary);
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.sc-horario-horas { font-size: .72rem; color: var(--text-soft); font-weight: 500; }

/* 2-col */
.sc-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }

/* Premio list */
.sc-list { display: flex; flex-direction: column; gap: .2rem; }
.sc-list-row {
  display: flex;
  align-items: center;
  gap: .45rem;
  background: var(--surface-low);
  border-radius: 8px;
  padding: 0 .55rem;
  font-size: .8rem;
  min-height: 2.25rem;
}
.sc-pos-badge {
  font-size: .65rem;
  font-weight: 800;
  color: var(--primary);
  background: rgba(41,127,191,.1);
  border-radius: 999px;
  padding: .08rem .38rem;
  flex-shrink: 0;
}
.sc-list-desc { flex: 1; color: var(--text); font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-list-meta { font-size: .75rem; color: var(--text-soft); flex-shrink: 0; }
.sc-row-actions { display: flex; gap: .2rem; flex-shrink: 0; }
.sc-btn-danger { color: #dc2626 !important; }

/* Series chips */
.sc-series-chips { display: flex; flex-direction: column; gap: .2rem; }
.sc-serie-chip {
  display: flex;
  align-items: center;
  gap: .45rem;
  background: var(--surface-low);
  border-radius: 8px;
  padding: 0 .55rem;
  font-size: .8rem;
  min-height: 2.25rem;
}
.sc-serie-codigo { font-weight: 800; color: var(--primary); font-size: .78rem; }
.sc-serie-range { font-family: "Consolas","Courier New",monospace; font-size: .74rem; color: var(--text-soft); flex: 1; }
.sc-serie-count {
  font-size: .68rem;
  font-weight: 700;
  color: var(--text-soft);
  background: var(--surface-high);
  border-radius: 999px;
  padding: .08rem .38rem;
}

/* Footer */
.sc-footer { display: flex; justify-content: flex-end; padding-top: .5rem; border-top: 1px solid rgba(0,51,54,.06); }

/* Premios Grid */
.sc-premios-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: .5rem;
}

/* PremioCard Component */
.premio-card {
  position: relative;
  width: 220px;
  height: 150px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 51, 54, .1);
  background: var(--surface-high);
  transition: box-shadow 200ms, transform 200ms;
  flex-shrink: 0;
}
.premio-card:hover {
  box-shadow: 0 6px 20px rgba(0, 51, 54, .16);
  transform: translateY(-2px);
}

.premio-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.premio-image-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #dbdfe0, #d2dbdd);
  color: #3e6668;
  font-size: 2rem;
}

/* Badge de posición — esquina superior izquierda */
.premio-pos-badge {
  position: absolute;
  top: .45rem;
  left: .45rem;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: .68rem;
  font-weight: 800;
  padding: .18rem .42rem;
  border-radius: 999px;
  letter-spacing: .02em;
  line-height: 1.4;
}

/* Corona de boleto ganador — esquina superior derecha */
.premio-ganador-crown {
  position: absolute;
  top: .45rem;
  right: .45rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: rgba(245, 158, 11, .92);
  backdrop-filter: blur(6px);
  box-shadow: 0 2px 8px rgba(245, 158, 11, .45);
  cursor: pointer;
  line-height: 1;
  text-decoration: none;
}
.premio-ganador-crown .boleto-crown {
  font-size: .85rem;
}

/* Barra inferior semitransparente */
.premio-info-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0,0,0,.72) 0%, rgba(0,0,0,.45) 70%, transparent 100%);
  padding: .9rem .6rem .5rem;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: .3rem;
}

.premio-info-main {
  display: flex;
  flex-direction: column;
  gap: .1rem;
  min-width: 0;
  flex: 1;
}

.premio-desc-text {
  font-size: .74rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.premio-monto-text {
  font-size: .68rem;
  font-weight: 600;
  color: rgba(255, 255, 255, .80);
  white-space: nowrap;
}

.premio-actions {
  display: flex;
  gap: .15rem;
  flex-shrink: 0;
}

.btn-icon-small {
  background: rgba(0, 51, 54, .70);
  border: none;
  cursor: pointer;
  padding: .2rem .28rem;
  border-radius: 5px;
  color: #ffffff;
  font-size: .72rem;
  transition: background 120ms;
  line-height: 1;
}
.btn-icon-small:hover {
  background: rgba(0, 51, 54, .88);
}
.btn-icon-small.btn-danger:hover {
  background: rgba(220, 38, 38, .55);
  color: #fff;
}

/* btn-icon */
.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: .22rem .32rem;
  border-radius: 6px;
  color: var(--text-soft);
  font-size: .88rem;
  transition: background 120ms, color 120ms;
}
.btn-icon:hover { background: var(--surface-high); color: var(--primary); }

.panel-actions-right { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid #eee; display:flex; justify-content:flex-end; }

@media (max-width: 680px) {
  .sc-two-col { grid-template-columns: 1fr; }
  .sc-desc { max-width: 140px; }
}
.pagination-controls { display:flex; justify-content:center; gap:0.5rem; margin-top:1rem; }

.dialog-error-message { margin-bottom: 1rem; padding: 0.85rem 1rem; border-radius: 12px; background: rgba(239, 68, 68, 0.08); color: #b91c1c; border: 1px solid rgba(239, 68, 68, 0.18); }
.toast-error { margin-top: .8rem; background: #ffe0e0; color: #8b1e1e; padding: .6rem .8rem; border-radius: .6rem; font-weight: 600; }
.toast-eyebrow { letter-spacing: .05em; }
.split-panel { display:grid; grid-template-columns: 1.15fr .85fr; gap: 1rem; align-items:start; }
.claim-hero { display:grid; gap: 1rem; }
.hero-card { background: linear-gradient(145deg, rgba(0, 51, 54, .04), rgba(20, 105, 109, .08)); }
.helper-copy { color: var(--text-soft); margin-bottom: 0; }
.action-strip { display:grid; grid-template-columns: 1fr auto; gap: .75rem; align-items:center; }
.eyebrow { font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; color: var(--secondary); font-weight: 800; }
.highlight-card { border: 1px solid rgba(0, 51, 54, .08); }
.highlight-card.valid { background: linear-gradient(180deg, #f9fffd, #eef8f8); }
.highlight-card.invalid { background: linear-gradient(180deg, #fff8f8, #fff0f0); }
.detail-grid { display:grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; margin-top: 1rem; }
.detail-grid strong { display:block; font-size: 1rem; color: var(--primary); }
.metric-grid-4 { display:grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin: 1rem 0; }
.metric-bento { background: var(--surface-lowest); border-radius: 1rem; padding: 1rem; box-shadow: 0 8px 24px rgba(0, 51, 54, .06); min-height: 126px; display:flex; flex-direction:column; justify-content:space-between; }
.metric-bento strong { font-size: 2rem; color: var(--primary); }
.metric-bento span { color: var(--text-soft); font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 800; }
.metric-bento.danger { background: linear-gradient(180deg, #fff4f4, #ffe7e7); }
.metric-bento.warning { background: linear-gradient(180deg, #fff8ea, #fff0c8); }
.metric-bento.accent-soft { background: linear-gradient(180deg, #eef8f8, #dff2f3); }
.action-filter-bar { display:flex; gap: 1rem; align-items:end; flex-wrap: wrap; }
.action-filter-bar > div { min-width: 180px; }
.muted-row { color: var(--text-soft); font-size: .82rem; margin-top: .25rem; }
.status.critical { background: #ffd9d9; color: #8b1e1e; }
.compact-table td, .compact-table th { font-size: .88rem; }
.selectable-row { cursor: pointer; }
.selectable-row:hover td { filter: brightness(.98); }

/* Small utilities */
.card-title { margin: 0 0 0.25rem 0; }
.meta { font-size: 0.85rem; color: var(--text-soft); }
.label-block { display: block; color: var(--text-soft); margin-bottom: 0.25rem; }
.flex-col-gap { display:flex; flex-direction: column; gap: 0.75rem; }
.flex-wrap-gap { margin-top: .8rem; display:flex; gap:.6rem; flex-wrap:wrap; }
.mt-08 { margin-top: .8rem; }
.min-h-0 { min-height: 0; }

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}
#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

@media (max-width: 980px) {
    .sidebar { display: none; }
    .panel.two-col, .two-col, .kpi-grid, .split-panel, .metric-grid-4, .detail-grid { grid-template-columns: 1fr; }
}

/* User Management Styles */
.panel-users .ledger-container { background: #fff; border-radius: 0.75rem; border: 1px solid #e2e8f0; position: relative; }
.panel-users .ledger-table { width: 100%; border-collapse: collapse; }
.panel-users .ledger-table th { background: #f8fafc; text-align: left; padding: 1rem; border-bottom: 2px solid #e2e8f0; color: #64748b; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05rem; }
.panel-users .ledger-table td { padding: 1rem; border-bottom: 1px solid #e2e8f0; vertical-align: middle; background: inherit; }
.panel-users .ledger-table tr:nth-child(even) { background: #f8fafc; }
.panel-users .ledger-table tr:nth-child(odd) { background: #ffffff; }
.panel-users .ledger-table tr:hover { background: #f1f5f9; }
.panel-users .ledger-table tr:last-child td { border-bottom: none; }

.user-identity { display: flex; flex-direction: column; }
.user-handle { font-weight: 600; color: #1e293b; }
.user-email { font-size: 0.8rem; color: #64748b; }

.badge-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.sr-badge { padding: 0.25rem 0.6rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 600; }
.badge-role { background: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; }

.status-badge { padding: 0.25rem 0.75rem; border-radius: 6px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; }
.status-badge.activo { background: #dcfce7; color: #15803d; }
.status-badge.inactivo { background: #fef2f2; color: #b91c1c; }
.status-badge.bloqueado { background: #f1f5f9; color: #475569; }

.text-right { text-align: right !important; }
.actions-flex { display: flex; justify-content: flex-end; align-items: center; gap: 0.5rem; }

.select-wrapper { display: flex; align-items: center; gap: 0.5rem; color: #64748b; font-size: 0.85rem; font-weight: 500; }
.form-control-sm { padding: 0.4rem 0.75rem; border: 1.5px solid #e2e8f0; border-radius: 0.4rem; background: #f8fafc; color: #1e293b; outline: none; }
.form-control-sm:focus { border-color: #3b82f6; }

.sr-form-control, .search-input {
    width: 100%; padding: 0.75rem 1rem; font-size: 0.95rem; border: 1.5px solid #e2e8f0; border-radius: 0.5rem;
    background-color: #f8fafc; color: #1e293b; transition: all 0.2s ease; box-sizing: border-box;
}
.sr-form-control:focus, .search-input:focus { border-color: #3b82f6; background-color: #fff; box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15); outline: none; }
.sr-form-control:disabled { background: #f1f5f9; color: #94a3b8; cursor: not-allowed; }

.form-group label { display: block; margin-bottom: 0.5rem; font-weight: 500; color: #475569; font-size: 0.85rem; }

.modal-content.wider { max-width: 650px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.modal-body { max-height: 70vh; overflow-y: auto; padding-right: 0.5rem; }
.modal-footer { display: flex; justify-content: flex-end; gap: 1rem; margin-top: 2rem; border-top: 1px solid #e2e8f0; padding-top: 1.5rem; }
.close-btn { background: none; border: none; font-size: 1.25rem; color: #94a3b8; cursor: pointer; }

.roles-selection-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; background: #f1f5f9; padding: 1.25rem; border-radius: 0.75rem; border: 1px dashed #cbd5e1; }
.checkbox-container { display: flex; align-items: center; gap: 0.75rem; background: #fff; padding: 0.75rem 1rem; border-radius: 0.5rem; cursor: pointer; border: 1.5px solid #e2e8f0; transition: all 0.2s; }
.checkbox-container:hover { border-color: #3b82f6; background: #eff6ff; }
.checkbox-container input { display: none; }
.checkbox-custom { width: 1.25rem; height: 1.25rem; border: 2px solid #cbd5e1; border-radius: 4px; position: relative; flex-shrink: 0; }
.checkbox-container input:checked + .checkbox-custom { background: #3b82f6; border-color: #3b82f6; }
.checkbox-container input:checked + .checkbox-custom::after { content: "✓"; position: absolute; color: white; font-size: 0.8rem; left: 50%; top: 50%; transform: translate(-50%, -50%); }

.role-label { display: flex; flex-direction: column; }
.role-name { font-weight: 600; color: #1e293b; font-size: 0.9rem; }
.role-desc { font-size: 0.75rem; color: #64748b; }
.role-badge-exclusivo {
    display: inline-block;
    margin-top: 0.3rem;
    font-size: 0.68rem;
    font-weight: 600;
    color: #92400e;
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: 4px;
    padding: 0.1rem 0.45rem;
    letter-spacing: 0.01em;
}
.sr-dropdown { position: relative; display: inline-block; }
.dropdown-content { display: none; position: absolute; background-color: white; min-width: 160px; box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.15); z-index: 100; border-radius: 6px; right: 0; border: 1px solid #e2e8f0; }
.dropdown-content.open {display: block;}
.dropdown-content button { width: 100%; padding: 10px 14px; text-align: left; border: none; background: none; cursor: pointer; font-size: 0.85rem; color: #475569; }
.dropdown-content button:hover { background-color: #f8fafc; color: #3b82f6; }
.dropdown-content hr { border: 0; border-top: 1px solid #f1f5f9; margin: 4px 0; }

/* CustomGrid Component */
.app-grid-container { background: #fff; border-radius: .75rem; border: 1px solid #e2e8f0; }
.app-grid-scroll { overflow-x: auto; }
.app-grid-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.app-grid-table th { background: #f8fafc; padding: 1rem; border-bottom: 2px solid #e2e8f0; color: #64748b; font-size: .8rem; text-transform: uppercase; letter-spacing: .05rem; text-align: left; }
.app-grid-table td { padding: 1rem; border-bottom: 1px solid #e2e8f0; vertical-align: middle; background: inherit; }
.app-grid-table tr:nth-child(even) { background: #f8fafc; }
.app-grid-table tr:nth-child(odd) { background: #fff; }
.app-grid-table tr:hover { background: #f1f5f9; }
.app-grid-table tr:last-child td { border-bottom: none; }
.app-grid-table thead tr:first-child th:first-child { border-top-left-radius: calc(.75rem - 1px); }
.app-grid-table thead tr:first-child th:last-child { border-top-right-radius: calc(.75rem - 1px); }
.app-grid-container:not(:has(.app-grid-footer)) .app-grid-table tbody tr:last-child td:first-child { border-bottom-left-radius: calc(.75rem - 1px); }
.app-grid-container:not(:has(.app-grid-footer)) .app-grid-table tbody tr:last-child td:last-child { border-bottom-right-radius: calc(.75rem - 1px); }
.app-grid-loading, .app-grid-empty { padding: 2.5rem 1rem; text-align: center; color: #94a3b8; font-size: .9rem; }
.app-grid-footer { display: flex; justify-content: space-between; align-items: center; padding: .75rem 1rem; border-top: 1px solid #e2e8f0; background: #f8fafc; border-radius: 0 0 .75rem .75rem; }
.app-grid-page-info { color: #64748b; font-size: .85rem; }
.app-grid-table tfoot td { padding: .85rem 1rem; border-top: 2px solid #e2e8f0; background: #f8fafc; font-size: .85rem; color: #64748b; }
.app-grid-total { display: flex; flex-direction: column; gap: .2rem; }
.app-grid-total-label { font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06rem; color: #94a3b8; }
.app-grid-total-value { font-size: 1.1rem; font-weight: 700; color: #1e293b; }

/* CopyableId Component */
.copyable-id { display: inline-flex; align-items: center; gap: .35rem; }
.copyable-id-text { font-family: "Consolas", "Courier New", monospace; font-size: .78rem; color: #475569; font-weight: 600; cursor: default; }
.copyable-id-btn { background: none; border: none; cursor: pointer; padding: .15rem .25rem; border-radius: 4px; color: #94a3b8; display: flex; align-items: center; transition: background 120ms, color 120ms; }
.copyable-id-btn:hover { background: #f1f5f9; color: #1d4ed8; }
.copyable-id-btn.copiado { color: #15803d; }

/* Tooltip flotante (montado en body via JS, position: fixed) */
.app-floating-tooltip { display: none; position: fixed; background: #1e293b; color: #f1f5f9; font-size: .72rem; font-family: "Consolas", "Courier New", monospace; padding: .3rem .6rem; border-radius: 6px; white-space: nowrap; z-index: 9999; pointer-events: none; }
.app-floating-tooltip::after { content: ""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); border: 5px solid transparent; border-top-color: #1e293b; }
.app-floating-tooltip.wrap { white-space: normal; max-width: 260px; font-family: inherit; font-size: .78rem; text-align: left; line-height: 1.35; }

/* InfoTooltip Component */
.info-tooltip-icon { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 50%; border: 1px solid #94a3b8; color: #64748b; font-size: .68rem; font-weight: 700; cursor: help; user-select: none; flex-shrink: 0; }
.info-tooltip-icon:hover, .info-tooltip-icon:focus-visible { border-color: var(--primary); color: var(--primary); outline: none; }

tr:last-child .dropdown-content, tr:nth-last-child(2) .dropdown-content { bottom: 100%; top: auto; margin-bottom: 8px; }

/* ═══════════════════════════════════════
   MOBILE NAVIGATION
   ═══════════════════════════════════════ */

/* ── Hamburger button (hidden on desktop) ── */
.hamburger-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    border-radius: 0.6rem;
    cursor: pointer;
    padding: 0.4rem;
    flex-shrink: 0;
    transition: background 150ms ease;
}
.hamburger-btn:hover { background: var(--surface-high); }
.hamburger-line {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text-soft);
    border-radius: 2px;
    transition: background 150ms ease;
}
.hamburger-btn:hover .hamburger-line { background: var(--primary); }

/* ── Mobile nav drawer ── */
.mobile-nav {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: 270px;
    background: linear-gradient(180deg, #f6f8f9, #eef1f2);
    z-index: 1500;
    display: flex;
    flex-direction: column;
    gap: 0;
    transform: translateX(-100%);
    transition: transform 280ms cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 24px rgba(0,0,0,0.12);
    overflow-y: auto;
    /* Hidden by default on desktop via display:none below */
    visibility: hidden;
}
.mobile-nav--open {
    transform: translateX(0);
    visibility: visible;
}
.mobile-nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1rem 1rem;
    border-bottom: 1px solid rgba(0,51,54,.08);
}
.mobile-nav-logo {
    width: 55%;
    height: auto;
    border-radius: .6rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.14);
}
.mobile-nav-close {
    background: transparent;
    border: none;
    font-size: 1.1rem;
    color: var(--text-soft);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 150ms ease, color 150ms ease;
}
.mobile-nav-close:hover {
    background: var(--surface-high);
    color: var(--primary);
}
.mobile-nav-links {
    display: flex;
    flex-direction: column;
    padding: 0.75rem 0.75rem;
    gap: 0.25rem;
}
/* nav-link inside mobile drawer gets a slightly larger tap target */
.mobile-nav-links .sr-nav-link {
    padding: 0.75rem 1rem;
    font-size: 0.97rem;
}

/* ── Backdrop ── */
.mobile-nav-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.38);
    z-index: 1499;
    animation: fadeInBackdrop 200ms ease forwards;
}
@keyframes fadeInBackdrop {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ══ Show hamburger & drawer only on mobile ══ */
@media (max-width: 980px) {
    .hamburger-btn {
        display: flex;
    }
    .mobile-nav {
        visibility: hidden; /* closed state */
    }
    .mobile-nav--open {
        visibility: visible;
    }
    /* Give the topbar a bit more padding on mobile */
    .topbar {
        gap: 0.5rem;
        padding: 0 0.85rem;
    }
    /* Search shrinks gracefully */
    .search {
        flex: 1;
        min-width: 0;
    }
}

/* ══ On desktop the mobile nav should never appear ══ */
@media (min-width: 981px) {
    .mobile-nav,
    .mobile-nav-backdrop,
    .hamburger-btn {
        display: none !important;
    }
}
