/* =========================================================
   CONTROL PAPELETAS - APP.CSS
   Ordenado por: base, navbar, componentes, dashboard,
   cierre, talonarios, modal y responsive.
========================================================= */


/* =========================================================
   1. Variables y base
========================================================= */

:root {
  --brand-color: #1f3b68;
  --brand-color-dark: #172f56;
  --brand-accent: #8fcd6b;

  --surface-border: #dfe6ee;
  --muted: #6f7683;
  --soft-bg: #f5f7fa;

  --success-soft: #ecf7eb;
  --warning-soft: #fff4df;
  --danger-soft: #fdeaea;
}

body {
  background-color: var(--soft-bg);
  color: #1f2937;
}

.card {
  border-color: var(--surface-border);
  border-radius: 1rem;
}

.table > :not(caption) > * > * {
  border-bottom-color: #e7ebf0;
}

.btn-primary {
  background-color: var(--brand-color);
  border-color: var(--brand-color);
}

.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--brand-color-dark);
  border-color: var(--brand-color-dark);
}

.badge.text-bg-success {
  background-color: #ddefd8 !important;
  color: #4d7e36 !important;
}


/* =========================================================
   2. Navbar / cabecera
========================================================= */

.navbar-brand {
  color: inherit !important;
}

.app-navbar {
  background: var(--brand-color) !important;
  border-bottom: 0 !important;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .06);
}

.app-logo {
  height: 44px;
  width: auto;
  display: block;
}

.app-brand-title {
  font-weight: 700;
  font-size: 1.9rem;
  line-height: 1;
  letter-spacing: .02em;
  color: #fff;
}

.app-brand-subtitle {
  font-size: .95rem;
  line-height: 1.1;
  color: var(--brand-accent);
  margin-top: .15rem;
}

.app-user-email {
  white-space: nowrap;
  color: rgba(255, 255, 255, .78) !important;
}

.app-navbar .btn-outline-secondary {
  color: #fff;
  border-color: rgba(255, 255, 255, .18);
  background: rgba(255, 255, 255, .04);
}

.app-navbar .btn-outline-secondary:hover,
.app-navbar .btn-outline-secondary:focus {
  color: #fff;
  border-color: rgba(255, 255, 255, .32);
  background: rgba(255, 255, 255, .08);
}


/* =========================================================
   3. Componentes comunes
========================================================= */

.grid-checks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
  gap: .5rem;
}

.check-tile {
  border: 1px solid #ddd;
  border-radius: .6rem;
  padding: .35rem .45rem;
  display: flex;
  align-items: center;
  gap: .4rem;
  background: #fff;
}

.close-info-note {
  color: #8b5cf6;
}

.season-badge {
  display: inline-flex;
  align-items: center;
  padding: .4rem .8rem;
  border-radius: 999px;
  background: #ddefd8;
  color: #4d7e36;
  font-weight: 600;
  font-size: .92rem;
}

.admin-person-meta {
  border-top: 1px solid #edf1f5;
  margin-top: 1rem;
  padding-top: 1rem;
}


/* =========================================================
   4. Dashboard entidad
========================================================= */

.board-hero-title {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.05;
  color: #22335b;
  margin: 0;
}

.board-hero-subtitle {
  color: var(--muted);
  margin-top: .2rem;
}

.dashboard-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.dashboard-kpi {
  background: #f2f1ec;
  border: 1px solid #ebe8e0;
  border-radius: .9rem;
  padding: 1rem 1.05rem;
}

.dashboard-kpi__label {
  text-transform: uppercase;
  letter-spacing: .03em;
  font-size: .76rem;
  font-weight: 700;
  color: #8a857b;
}

.dashboard-kpi__value {
  margin-top: .35rem;
  font-size: 1.9rem;
  line-height: 1;
  font-weight: 700;
  color: #24305f;
}

.dashboard-kpi__value--success {
  color: #45a046;
}

.dashboard-kpi__sub {
  margin-top: .2rem;
  font-size: .92rem;
  color: #7a7a7a;
}


/* =========================================================
   5. Tabla de talonarios en dashboard
========================================================= */

.talonario-table {
  background: #fff;
  border: 1px solid var(--surface-border);
  border-radius: 1rem;
  overflow: hidden;
}

.talonario-table table {
  margin-bottom: 0;
  table-layout: auto;
}

.talonario-table thead th {
  font-size: .79rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: #8b857c;
  background: #fff;
  padding-top: .75rem;
  padding-bottom: .75rem;
  vertical-align: middle;
}

.talonario-table tbody td {
  padding-top: .55rem;
  padding-bottom: .55rem;
  vertical-align: middle;
}

.talonario-table thead th:first-child,
.talonario-table tbody td:first-child {
  padding-left: 1rem;
}

.talonario-table thead th:last-child,
.talonario-table tbody td:last-child {
  padding-right: 1rem;
}

.talonario-col-num,
.talonario-num {
  width: 92px;
  white-space: nowrap;
}

.talonario-num strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 28px;
  border-radius: 999px;
  background: #f3f6fa;
  color: #24305f;
  font-weight: 800;
}

.talonario-col-money,
.talonario-money {
  width: 150px;
  white-space: nowrap;
}

.talonario-money {
  font-weight: 600;
  color: #334155;
}

.talonario-col-action {
  width: 120px;
  white-space: nowrap;
}

.talonario-table .btn-sm {
  padding: .22rem .45rem;
  font-size: .78rem;
}

.talonario-row {
  cursor: pointer;
  transition: background .15s ease;
}

.talonario-row:hover td {
  background: #f8fbff !important;
}

.talonario-row:active td {
  background: #eef5ff !important;
}

.talonario-name-cell {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.talonario-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .74rem;
  font-weight: 700;
  flex: 0 0 auto;
  color: #45628d;
  background: #d8e5f8;
}

.talonario-avatar--green {
  background: #ddead2;
  color: #628347;
}

.talonario-avatar--pink {
  background: #f0dfdf;
  color: #a56b6b;
}

.talonario-avatar--sand {
  background: #eee3cf;
  color: #8e7341;
}

.talonario-avatar--gray {
  background: #edf0f2;
  color: #7b848d;
}

.talonario-responsable strong {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  color: #2b3444;
}

.talonario-responsable small {
  color: #8c8c8c;
}

.progress-line {
  position: relative;
  width: 82px;
  height: 4px;
  border-radius: 999px;
  background: #e7e7e7;
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
  margin-right: .6rem;
}

.progress-line > span {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 999px;
}

.progress-line--empty > span {
  background: #d6d6d6;
}

.progress-line--partial > span {
  background: #c88521;
}

.progress-line--full > span {
  background: #3bab44;
}

.talonario-vendidas {
  white-space: nowrap;
  font-weight: 600;
  color: #5b5b5b;
}


/* =========================================================
   6. Panel cierre / acta
========================================================= */

.close-panel-card {
  border-radius: 1rem;
}

.close-teaser {
  background: #efeee8;
  border: 1px solid #e2ddd3;
  border-radius: .9rem;
  padding: 1rem 1.1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.close-teaser__title {
  font-size: 1.3rem;
  font-weight: 700;
  color: #2a3240;
  margin: 0;
}

.close-teaser__subtitle {
  color: #6f7683;
  font-size: .95rem;
}

.close-panel-card .stat-card {
  border: 1px solid #dfe4ea;
  border-radius: .85rem;
  padding: 1rem;
  background: #fff;
  height: 100%;
}

.close-panel-card .stat-card__label {
  color: #6f7683;
  font-size: .95rem;
}

.close-panel-card .stat-card__value {
  color: #1f2937;
  font-size: 1.1rem;
  font-weight: 700;
  margin-top: .25rem;
}

.close-option-card {
  border: 1px solid #dfe6ee;
  border-radius: .95rem;
  padding: 1rem;
  background: #fff;
}

.close-option-card--info {
  background: #fbfcff;
  border-color: #dbe4f0;
}

.close-option-card--extra {
  background: #fff;
}

.close-option-label {
  font-weight: 700;
  color: #2a3240;
  margin-bottom: .45rem;
}

.close-extra-input {
  max-width: 220px;
  font-weight: 700;
}

.close-payment-box {
  background: #f8fafc;
  border: 1px solid #e1e8f0;
  border-radius: .85rem;
  padding: .85rem .95rem;
}

.close-payment-title {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 700;
  color: #7b8491;
  margin-bottom: .35rem;
}

.close-panel-card .form-label {
  color: #2f3948;
}

.close-panel-card .small {
  line-height: 1.45;
}

.close-panel-card .alert-danger {
  margin: 0 0 .85rem;
}

#close-board-form .btn-primary {
  font-weight: 700;
}


/* =========================================================
   7. Responsable y firma en cierre
========================================================= */

.responsable-box {
  background: #f8fafc;
  border: 1px solid #dbe4f0;
  border-radius: 1rem;
  padding: 1rem 1rem .25rem;
}

.responsable-box__title {
  font-weight: 700;
  color: #24305f;
  margin-bottom: .2rem;
}

.responsable-box__subtitle {
  font-size: .92rem;
  color: #60708f;
  margin-bottom: 1rem;
}

.firma-resumen-box {
  background: #f8fafc;
  border: 1px solid #dbe4f0;
  color: #43516a;
  border-radius: .85rem;
  padding: .7rem .9rem;
  font-size: .9rem;
}


/* =========================================================
   8. Pantalla editar talonario
========================================================= */

.talonario-back-btn {
  border-radius: .8rem;
  padding: .6rem 1rem;
  font-weight: 600;
}

.talonario-shell {
  background: #fff;
  border: 1px solid var(--surface-border);
  border-radius: 1rem;
  overflow: hidden;
}

.talonario-shell__head {
  padding: 1.4rem 1.5rem 1rem;
  border-bottom: 1px solid #e8ebf0;
}

.talonario-shell__title {
  font-size: 2rem;
  line-height: 1.05;
  color: #24305f;
  font-weight: 700;
  margin: 0 0 .2rem;
}

.talonario-shell__meta {
  color: #5d6470;
  font-size: 1.1rem;
}

.talonario-shell__body {
  display: grid;
  grid-template-columns: 280px 1fr;
}

.talonario-side {
  border-right: 1px solid #e8ebf0;
  padding: 1.25rem 1.35rem;
}

.talonario-main {
  padding: 1.25rem 1.35rem;
}

.talonario-side__avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #d8e5f8;
  color: #45628d;
  font-weight: 700;
  font-size: 1.2rem;
  margin-bottom: 1rem;
}

.talonario-side__avatar--empty {
  background: #edf2f7;
  color: #607086;
  font-size: 1.05rem;
}

.talonario-section-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #7a7a72;
  text-transform: uppercase;
  letter-spacing: .03em;
  margin-bottom: .8rem;
}

.talonario-summary {
  border-top: 1px solid #e8ebf0;
  margin-top: 1.25rem;
  padding-top: 1rem;
}

.talonario-summary__row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .45rem;
}

.talonario-summary__row strong {
  font-weight: 700;
}

.talonario-summary__row strong.is-success {
  color: #3c9c42;
}


/* =========================================================
   9. Papeletas vendidas / grid
========================================================= */

.talonario-actions {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-bottom: .75rem;
  flex-wrap: wrap;
}

.talonario-sold-count {
  font-size: .95rem;
  font-weight: 600;
  color: #5f6b7a;
  white-space: nowrap;
}

.talonario-sold-count strong {
  color: #223a63;
  font-size: 1.05rem;
  font-weight: 800;
}

.talonario-sold-count span {
  color: #6f7683;
}

.ticket-grid-wrapper {
  max-height: 430px;
  overflow: auto;
  padding-right: .35rem;
  margin-top: .5rem;
}

.ticket-grid-wrapper::-webkit-scrollbar {
  width: 10px;
}

.ticket-grid-wrapper::-webkit-scrollbar-thumb {
  background: #cfd9e6;
  border-radius: 999px;
}

.ticket-grid-wrapper::-webkit-scrollbar-track {
  background: transparent;
}

.grid-checks--talonario {
  grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
  gap: .45rem;
}

.check-tile--talonario {
  min-height: 42px;
  border-radius: .7rem;
  justify-content: center;
  padding: .35rem .35rem;
  border: 1px solid #d8e1ee;
  font-weight: 800;
  background: #edf2f7;
  color: #607086;
  transition: transform .12s ease, background .12s ease, border-color .12s ease, box-shadow .12s ease;
}

.check-tile--talonario input {
  display: none;
}

.check-tile--talonario.is-checked {
  background: #284a7d;
  color: #fff;
  border-color: #284a7d;
  box-shadow: 0 2px 6px rgba(40, 74, 125, .14);
}

.check-tile--talonario:not(.is-checked):hover {
  background: #e4ebf4;
}

.check-tile--talonario:hover {
  transform: translateY(-1px);
}


/* =========================================================
   10. Footer guardar talonario / sticky
========================================================= */

.talonario-form-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .75rem;
}

.talonario-save-btn {
  font-weight: 700;
  min-width: 180px;
}

.talonario-save-bar {
  position: sticky;
  bottom: 0;
  z-index: 25;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(8px);
  border-top: 1px solid #dfe6ee;
  padding-top: .9rem;
  margin-top: 1rem;
}


/* =========================================================
   11. Modal confirmación
========================================================= */

.ct-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.ct-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .65);
}

.ct-modal__box {
  position: relative;
  width: min(560px, 100%);
  background: #fff;
  border-radius: 18px;
  padding: 1.5rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
}

.ct-modal__box h2 {
  margin: 0 0 1rem;
  color: #1e3a5f;
  font-size: 1.5rem;
}

.ct-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: .75rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}


/* =========================================================
   12. Responsive
========================================================= */

@media (max-width: 991px) {
  .dashboard-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .talonario-shell__body {
    grid-template-columns: 1fr;
  }

  .talonario-side {
    border-right: 0;
    border-bottom: 1px solid #e8ebf0;
  }
}

@media (max-width: 768px) {
  .app-brand-title {
    font-size: 1.35rem;
  }

  .app-brand-subtitle {
    font-size: .85rem;
  }

  .app-logo {
    height: 36px;
  }

  .dashboard-kpis {
    grid-template-columns: 1fr;
  }

  .board-hero-title {
    font-size: 1.55rem;
  }

  .close-teaser {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 575px) {
  .talonario-form-footer {
    flex-direction: column;
    align-items: stretch;
    gap: .65rem;
  }

  .talonario-form-footer .btn {
    width: 100%;
  }

  .talonario-save-bar {
    padding:
      .85rem
      1rem
      calc(.85rem + env(safe-area-inset-bottom));
    margin-left: -1.35rem;
    margin-right: -1.35rem;
    margin-bottom: -1.35rem;
    box-shadow: 0 -10px 24px rgba(15, 23, 42, .10);
  }
}