:root {
  --app-bg: #f6f8fb;
  --app-surface: #ffffff;
  --app-border: #e2e8f0;
  --app-sidebar: #102a43;
  --app-sidebar-muted: #aebed0;
  --app-primary: #2563eb;
  --app-primary-dark: #1d4ed8;
  --app-text: #172033;
  --app-muted: #64748b;
  --app-radius: 0.65rem;
  --app-sidebar-width: 252px;
}

html {
  font-size: 15px;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--app-bg);
  color: var(--app-text);
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
}

a {
  color: var(--app-primary);
}

.app-shell {
  min-height: 100vh;
}

.app-sidebar {
  --bs-offcanvas-width: var(--app-sidebar-width);
  width: var(--app-sidebar-width);
  color: #fff;
  background: var(--app-sidebar);
  border: 0;
}

.app-sidebar-header {
  min-height: 72px;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.app-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: #fff;
  font-size: 1.18rem;
  font-weight: 700;
  text-decoration: none;
}

.app-brand:hover,
.app-brand:focus {
  color: #fff;
}

.brand-mark {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 0.5rem;
  background: var(--app-primary);
  font-size: 1rem;
}

.app-sidebar-body {
  display: flex;
  flex-direction: column;
  padding: 1rem 0.85rem;
  overflow-y: auto;
}

.sidebar-nav {
  display: grid;
  gap: 0.3rem;
}

.sidebar-link {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 0.8rem;
  padding: 0.7rem 0.85rem;
  border-radius: 0.5rem;
  color: var(--app-sidebar-muted);
  font-weight: 500;
  text-decoration: none;
}

.sidebar-link i {
  width: 1.2rem;
  font-size: 1.05rem;
  text-align: center;
}

a.sidebar-link:hover,
a.sidebar-link:focus-visible {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-link.active {
  color: #fff;
  background: var(--app-primary);
}

.sidebar-link.disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.app-main {
  min-height: 100vh;
}

.app-topbar {
  display: flex;
  min-height: 64px;
  align-items: center;
  padding: 0.75rem 1.5rem;
  background: var(--app-surface);
  border-bottom: 1px solid var(--app-border);
}

.user-icon {
  display: inline-grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--app-border);
  border-radius: 50%;
  background: #f8fafc;
}

.app-content {
  padding: 1.5rem;
}

.page-container {
  width: 100%;
  max-width: 1500px;
  margin: 0 auto;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.page-title {
  margin: 0;
  font-size: clamp(1.55rem, 2vw, 1.9rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.page-subtitle {
  margin: 0.3rem 0 0;
  color: var(--app-muted);
}

.surface-card {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
}

.filter-card {
  padding: 1rem;
  margin-bottom: 1.25rem;
}

.form-card {
  padding: 1.25rem;
}

.form-section + .form-section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--app-border);
}

.form-section-title {
  margin-bottom: 1rem;
  font-size: 1rem;
  font-weight: 700;
}

.validation-summary-errors {
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  color: #991b1b;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 0.5rem;
}

.validation-summary-errors ul {
  margin-bottom: 0;
}

.field-validation-error {
  display: block;
  margin-top: 0.25rem;
  color: #b91c1c;
  font-size: 0.78rem;
}

.json-input {
  min-height: 90px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.82rem;
}

.form-label {
  margin-bottom: 0.35rem;
  color: #334155;
  font-size: 0.82rem;
  font-weight: 600;
}

.form-control,
.form-select {
  min-height: 40px;
  border-color: #cbd5e1;
}

.form-control:focus,
.form-select:focus,
.btn:focus-visible,
.page-link:focus-visible,
.sidebar-link:focus-visible {
  border-color: var(--app-primary);
  box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.2);
  outline: 0;
}

.btn-primary {
  background: var(--app-primary);
  border-color: var(--app-primary);
}

.btn-primary:hover {
  background: var(--app-primary-dark);
  border-color: var(--app-primary-dark);
}

.table-card {
  overflow: hidden;
}

.table-responsive {
  min-height: 180px;
}

.admin-table {
  min-width: 760px;
  margin-bottom: 0;
  vertical-align: middle;
}

.admin-table thead th {
  padding: 0.85rem 1rem;
  background: #f1f5f9;
  border-bottom-color: var(--app-border);
  color: #334155;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.admin-table tbody td {
  height: 52px;
  padding: 0.75rem 1rem;
  border-color: #edf1f5;
}

.admin-table tbody tr:hover > * {
  background-color: #f8fbff;
}

.numeric-value {
  font-variant-numeric: tabular-nums;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.55rem;
  border: 1px solid transparent;
  border-radius: 50rem;
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: capitalize;
}

.status-active {
  color: #166534;
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.status-cancelled {
  color: #991b1b;
  background: #fef2f2;
  border-color: #fecaca;
}

.status-default {
  color: #475569;
  background: #f8fafc;
  border-color: #e2e8f0;
}

.action-group {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
}

.btn-icon {
  display: inline-grid;
  width: 34px;
  height: 34px;
  padding: 0;
  place-items: center;
}

.empty-state {
  padding: 3.5rem 1.5rem;
  color: var(--app-muted);
  text-align: center;
}

.empty-state i {
  display: block;
  margin-bottom: 0.75rem;
  color: #94a3b8;
  font-size: 2rem;
}

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border-top: 1px solid var(--app-border);
}

.pagination {
  margin-bottom: 0;
}

.page-link {
  color: var(--app-primary);
}

.page-item.active .page-link {
  background: var(--app-primary);
  border-color: var(--app-primary);
}

@media (min-width: 992px) {
  .app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1030;
    visibility: visible !important;
    transform: none !important;
  }

  .app-sidebar .offcanvas-body {
    height: calc(100vh - 72px);
  }

  .app-main {
    margin-left: var(--app-sidebar-width);
  }
}

@media (max-width: 767.98px) {
  .app-topbar,
  .app-content {
    padding-right: 1rem;
    padding-left: 1rem;
  }

  .page-header,
  .table-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .page-header .btn {
    width: 100%;
  }
}

.login-page {
  display: grid;
  min-height: 100vh;
  padding: 1rem;
  place-items: center;
}

.login-card {
  width: 100%;
  max-width: 380px;
  padding: 2rem;
}

.status-warning {
  color: #92400e;
  background: #fffbeb;
  border-color: #fde68a;
}

.numero-premio {
  font-family: Consolas, "Courier New", monospace;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.numero-input {
  font-family: Consolas, "Courier New", monospace;
  font-size: 1.6rem;
  font-weight: 700;
}

/* Acceso con banner a sangre sobre el formulario. */
.login-card {
  max-width: 420px;
  padding: 0 2rem 2rem;
  overflow: hidden;
}

.login-banner {
  display: block;
  width: calc(100% + 4rem);
  max-width: none;
  height: auto;
  margin: 0 -2rem 1.5rem;
}
