/* ==========================================================================
   LISTAGENS, TITLEBAR E TABELAS MODERNAS
   ========================================================================== */

.list-page-body {
  min-height: 100vh;
  background:
    radial-gradient(
      circle at top left,
      rgba(37, 99, 235, 0.12),
      transparent 28%
    ),
    radial-gradient(
      circle at top right,
      rgba(255, 174, 0, 0.14),
      transparent 24%
    ),
    linear-gradient(180deg, #f7fbff 0%, #edf3fb 100%);
}

.list-shell {
  width: min(1320px, calc(100% - 1.5rem));
  margin: 0 auto;
  padding-bottom: 3rem;
}

.page-titlebar {
  --page-titlebar-rgb: 31, 41, 55;
  --page-titlebar-start: #334155;
  --page-titlebar-end: #111827;
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  align-items: stretch;
  width: 100%;
  margin: 0 0 1.1rem;
  padding: 1rem;
  border-radius: 22px;
  color: #fff;
  background:
    radial-gradient(
      circle at 12% 16%,
      rgba(var(--page-titlebar-rgb), 0.34),
      transparent 28%
    ),
    radial-gradient(
      circle at 90% 0%,
      rgba(255, 255, 255, 0.16),
      transparent 30%
    ),
    linear-gradient(
      135deg,
      var(--page-titlebar-start) 0%,
      var(--page-titlebar-end) 100%
    );
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.16);
}

.page-titlebar-green {
  --page-titlebar-rgb: 55, 166, 71;
  --page-titlebar-start: #2f9e44;
  --page-titlebar-end: #14532d;
}

.page-titlebar-blue {
  --page-titlebar-rgb: 3, 89, 191;
  --page-titlebar-start: #2563eb;
  --page-titlebar-end: #143a76;
}

.page-titlebar-violet {
  --page-titlebar-rgb: 124, 58, 237;
  --page-titlebar-start: #8b5cf6;
  --page-titlebar-end: #4c1d95;
}

.page-titlebar-neutral {
  --page-titlebar-rgb: 71, 85, 105;
  --page-titlebar-start: #475569;
  --page-titlebar-end: #111827;
}

.page-titlebar-content,
.page-titlebar-side {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.page-titlebar h1 {
  margin: 0;
  color: #fff;
  font-size: clamp(1.55rem, 8vw, 2rem);
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.page-titlebar p {
  max-width: 860px;
  margin: 0.55rem 0 0;
  color: rgba(241, 245, 249, 0.92);
  font-size: 1.04rem;
  line-height: 1.52;
}

.page-titlebar-side {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.7rem;
  align-content: stretch;
}

.page-titlebar-stat,
.page-titlebar .list-stat {
  min-width: 0;
  padding: 0.85rem 0.9rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.13);
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
}

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

.page-titlebar-stat strong,
.page-titlebar .list-stat strong {
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(226, 232, 240, 0.78);
}

.page-titlebar-stat span,
.page-titlebar .list-stat span {
  margin-top: 0.28rem;
  color: #fff;
  font-size: 0.98rem;
  font-weight: 800;
  line-height: 1.28;
  overflow-wrap: anywhere;
}

.page-titlebar .list-kicker,
.page-titlebar .form-kicker {
  background: rgba(255, 255, 255, 0.16);
  color: #eff6ff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

@media (min-width: 768px) {
  .page-titlebar {
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
    gap: 1.25rem;
    margin-bottom: 1.25rem;
    padding: clamp(1.35rem, 2.4vw, 2rem);
    border-radius: 30px;
  }

  .page-titlebar h1 {
    font-size: clamp(1.85rem, 2.7vw, 2.8rem);
  }

  .page-titlebar p {
    font-size: 1rem;
    line-height: 1.6;
  }

  .page-titlebar-stat,
  .page-titlebar .list-stat {
    padding: 1rem 1.1rem;
    border-radius: 22px;
  }

  .page-titlebar-stat strong,
  .page-titlebar .list-stat strong {
    font-size: 0.82rem;
  }

  .page-titlebar-stat span,
  .page-titlebar .list-stat span {
    font-size: 1.06rem;
  }
}
.list-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.9rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.list-stat {
  padding: 1rem 1.1rem;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(10px);
}

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

.list-stat strong {
  font-size: 0.88rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
}

.list-stat span {
  margin-top: 0.35rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
}

.list-stage {
  display: grid;
  gap: 1.25rem;
}

.list-panel {
  padding: 1.35rem;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(10px);
  min-width: 0;
  overflow: hidden;
}

.list-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.list-toolbar-copy h2 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 800;
  color: #0f172a;
}

.list-toolbar-copy p {
  margin: 0.35rem 0 0;
  color: #64748b;
  line-height: 1.5;
}

.list-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 52px;
  padding: 0.9rem 1.25rem;
  border-radius: 16px;
  text-decoration: none;
  font-size: 0.98rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  box-shadow: 0 14px 26px rgba(37, 99, 235, 0.22);
  transition:
    transform 0.24s ease,
    box-shadow 0.24s ease;
}

.list-action:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 34px rgba(37, 99, 235, 0.28);
}

.list-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.9rem;
  margin-bottom: 1.1rem;
}

.list-summary-card {
  padding: 1rem 1.1rem;
  border-radius: 20px;
  background: linear-gradient(
    180deg,
    rgba(239, 246, 255, 0.95) 0%,
    rgba(219, 234, 254, 0.82) 100%
  );
  border: 1px solid rgba(37, 99, 235, 0.12);
}

.list-summary-card strong,
.list-summary-card span {
  display: block;
}

.list-summary-card strong {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #1d4ed8;
}

.list-summary-card span {
  margin-top: 0.35rem;
  color: #0f172a;
  font-size: 1.1rem;
  font-weight: 800;
}

.modern-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  border-radius: 24px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: #fff;
}

.modern-table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.modern-table {
  width: 100%;
  min-width: 880px;
  margin: 0;
  border-collapse: separate;
  border-spacing: 0;
}

/* Tabelas de controle geral que devem caber na tela sem scroll horizontal */
.modern-table.pelucias-control-table,
.modern-table.bolinhas-control-table,
.modern-table.consignados-control-table {
  min-width: 0;
}

.modern-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 1rem 1rem;
  border: 0;
  background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
  color: #1e3a8a;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  vertical-align: middle;
  white-space: nowrap;
}

.modern-table thead th:last-child {
  text-align: center;
}

.table-actions-heading {
  text-align: center !important;
}

.modern-table tbody td {
  padding: 0.95rem 1rem;
  border-top: 1px solid rgba(226, 232, 240, 0.9);
  color: #0f172a;
  vertical-align: middle;
  background: rgba(255, 255, 255, 0.96);
  white-space: nowrap;
}

.modern-table tbody tr {
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
}

.modern-table tbody tr:hover td {
  background: #f8fbff;
}

.table-title-cell {
  font-weight: 800;
  color: #0f172a;
}

.table-muted {
  color: #64748b;
  font-size: 0.92rem;
}

.table-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  min-width: 150px;
  justify-items: stretch;
}

.table-actions .table-btn-view {
  grid-column: 1 / -1;
}

.table-actions .table-btn,
.table-actions .delete-form,
.table-actions .delete-form .table-btn {
  width: 100%;
}

.table-actions-launch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  min-width: 150px;
}

.table-actions-launch .table-btn,
.table-actions-launch .delete-form,
.table-actions-launch .delete-form .table-btn {
  width: 100%;
}

.table-actions-launch .table-btn-view {
  grid-column: 1 / -1;
}

.table-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 38px;
  padding: 0.6rem 0.8rem;
  border-radius: 12px;
  border: 0;
  font-size: 0.85rem;
  font-weight: 800;
  text-decoration: none;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    opacity 0.2s ease;
  cursor: pointer;
}

.table-btn:hover {
  transform: translateY(-2px);
}

.table-btn-view {
  background: #e2e8f0;
  color: #1e293b;
}

.table-btn-edit {
  background: #fef3c7;
  color: #92400e;
}

.table-btn-pay {
  background: #dcfce7;
  color: #166534;
}

.table-btn-delete {
  background: #fee2e2;
  color: #b91c1c;
}

.table-btn-save {
  background: #dcfce7;
  color: #166534;
}

.roteiro-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dias-sangria-top {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.dias-sangria-top .form-label {
  text-align: center;
  width: 100%;
}

.modern-table th,
.modern-table td {
  text-align: center;
  vertical-align: middle;
}

.modern-table td:first-child {
  text-align: left;
}

@media (max-width: 767.98px) {
  body.list-page-body .modern-table-wrap {
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  body.list-page-body .modern-table-scroll {
    overflow-x: visible;
  }

  body.list-page-body .modern-table {
    display: block;
    min-width: 0;
    width: 100%;
    border-spacing: 0;
  }

  body.list-page-body .modern-table thead {
    display: none;
  }

  body.list-page-body .modern-table tbody {
    display: grid;
    gap: 0.85rem;
  }

  body.list-page-body .modern-table tbody tr {
    display: grid;
    gap: 0;
    padding: 0.78rem;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.06);
  }

  body.list-page-body .modern-table tbody tr.is-mobile-table-card {
    cursor: pointer;
  }

  body.list-page-body .modern-table tbody tr.is-mobile-table-card:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.28);
    outline-offset: 3px;
  }

  body.list-page-body .modern-table tbody tr.is-mobile-table-card:not(.is-mobile-card-open) {
    padding-block: 0.62rem;
  }

  body.list-page-body .modern-table tbody tr.is-mobile-table-card:not(.is-mobile-card-open) td:not(:first-child) {
    display: none !important;
  }

  body.list-page-body .modern-table tbody tr.is-mobile-table-card td:first-child {
    position: relative;
    padding-right: 2.4rem;
  }

  body.list-page-body .modern-table tbody tr.is-mobile-table-card.is-mobile-card-with-days td:first-child {
    padding-right: 7.4rem !important;
  }

  body.list-page-body .modern-table tbody tr.is-mobile-table-card td:first-child::after {
    content: "v";
    position: absolute;
    top: 50%;
    right: 0.35rem;
    display: grid;
    width: 1.55rem;
    height: 1.55rem;
    place-items: center;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.08);
    color: #1d4ed8;
    font-size: 1rem;
    font-weight: 900;
    line-height: 1;
    transform: translateY(-50%);
    transition: transform 0.18s ease;
  }

  body.list-page-body .modern-table tbody tr.is-mobile-table-card.is-mobile-card-open td:first-child::after {
    transform: translateY(-50%) rotate(180deg);
  }

  body.list-page-body .modern-table tbody tr.is-mobile-table-card .mobile-card-days-summary {
    position: absolute;
    top: 0.04rem;
    right: 2.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    max-width: 5.4rem;
    color: #64748b;
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 1.15;
    text-align: right;
    text-transform: none;
  }

  body.list-page-body .modern-table tbody tr.is-mobile-table-card .dias-passados {
    display: none !important;
  }

  body.list-page-body
    :is(.bolinhas-control-shell, .pelucias-control-shell, .consignados-control-shell)
    .modern-table
    tbody
    tr.is-mobile-table-card
    td:not(:first-child),
  body.list-page-body
    :is(.bolinhas-control-shell, .pelucias-control-shell, .consignados-control-shell)
    .modern-table
    tbody
    tr.is-mobile-table-card
    .dias-passados {
    display: revert !important;
  }

  body.list-page-body
    :is(.bolinhas-control-shell, .pelucias-control-shell, .consignados-control-shell)
    .modern-table
    tbody
    tr.is-mobile-table-card
    td:first-child {
    padding-right: 0 !important;
  }

  body.list-page-body
    :is(.bolinhas-control-shell, .pelucias-control-shell, .consignados-control-shell)
    .modern-table
    tbody
    tr.is-mobile-table-card
    td:first-child::after,
  body.list-page-body
    :is(.bolinhas-control-shell, .pelucias-control-shell, .consignados-control-shell)
    .modern-table
    tbody
    tr.is-mobile-table-card
    .mobile-card-days-summary {
    content: none !important;
    display: none !important;
  }

  body.list-page-body .modern-table tbody tr:hover td {
    background: transparent;
  }

  body.list-page-body .modern-table tbody td {
    display: grid;
    grid-template-columns: minmax(7rem, 38%) minmax(0, 1fr);
    align-items: center;
    gap: 0.75rem;
    min-height: 44px;
    padding: 0.62rem 0;
    border-top: 0;
    border-bottom: 1px solid rgba(226, 232, 240, 0.82);
    background: transparent;
    text-align: right;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  body.list-page-body .modern-table tbody td:first-child {
    text-align: right;
  }

  body.list-page-body .modern-table tbody td:last-child {
    border-bottom: 0;
  }

  body.list-page-body .modern-table tbody td::before {
    content: attr(data-label);
    color: #64748b;
    font-size: var(--vm-font-label);
    font-weight: 900;
    letter-spacing: 0.04em;
    text-align: left;
    text-transform: uppercase;
  }

  body.list-page-body .modern-table tbody td[colspan] {
    display: block;
    min-height: 0;
    padding: 1.1rem;
    text-align: center;
  }

  body.list-page-body .modern-table tbody td[colspan]::before {
    content: none;
  }

  body.list-page-body .modern-table .table-title-cell,
  body.list-page-body .modern-table .table-muted,
  body.list-page-body .modern-table .table-cell-wrap {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  body.list-page-body .modern-table .table-badge {
    justify-self: end;
    min-height: 28px;
    font-size: 0.8rem;
    line-height: 1.1;
    white-space: normal;
    text-align: center;
  }

  body.list-page-body .modern-table .table-actions,
  body.list-page-body .modern-table .table-actions-launch {
    min-width: 0;
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.list-page-body .modern-table .table-btn {
    min-height: 42px;
    font-size: var(--vm-font-button);
  }

  body.list-page-body .modern-table td.mobile-table-actions-cell {
    display: block;
    text-align: left;
  }

  body.list-page-body .modern-table td.mobile-table-actions-cell::before {
    display: block;
    margin-bottom: 0.55rem;
  }
}

/* ==========================================================================
   MOBILE TYPE NORMALIZATION
   ========================================================================== */

@media (max-width: 767.98px) {
  body.list-page-body :is(.list-toolbar-copy p, .modern-table tbody td, .table-title-cell, .table-muted, .table-cell-wrap) {
    font-size: var(--vm-mobile-system-text) !important;
    line-height: var(--vm-mobile-system-line) !important;
  }

  body.list-page-body :is(.table-badge, .list-action, .table-btn) {
    font-size: var(--vm-mobile-system-small) !important;
    line-height: var(--vm-mobile-system-line-compact) !important;
  }

  body.list-page-body .modern-table tbody td::before,
  body.list-page-body :is(.list-kicker, .form-section-tag) {
    font-size: var(--vm-mobile-system-micro) !important;
    line-height: var(--vm-mobile-system-line-compact) !important;
  }
}

/* ==========================================================================
   FILTER BAR — barra de filtros nas listagens de sangria
   ========================================================================== */

.list-filter-bar {
  margin-bottom: 1rem;
}

.list-filter-fields {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.62rem;
  padding: 0.75rem 1rem;
  background: #f0f6ff;
  border: 1px solid rgba(37, 99, 235, 0.13);
  border-radius: 10px;
}

.list-filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
}

.list-filter-field label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #4b6683;
}

.list-filter-field .form-control,
.list-filter-field .form-select {
  height: 36px;
  font-size: 0.82rem;
  padding: 0.26rem 0.6rem;
  border-radius: 7px;
  border: 1px solid #c7d9ee;
  background: #fff;
}

.list-filter-field-select .form-select {
  min-width: 180px;
  max-width: 260px;
}

.list-filter-actions {
  display: flex;
  align-items: flex-end;
  gap: 0.42rem;
  padding-bottom: 0;
}

.btn-filter-apply {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  height: 36px;
  padding: 0 0.9rem;
  border: 0;
  border-radius: 7px;
  background: #2563eb;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s, transform 0.15s;
}

.btn-filter-apply:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

.btn-filter-reset {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  height: 36px;
  padding: 0 0.8rem;
  border-radius: 7px;
  color: #b91c1c;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  border: 1px solid rgba(185, 28, 28, 0.2);
  background: transparent;
}

.btn-filter-reset:hover {
  background: rgba(185, 28, 28, 0.06);
  color: #7f1d1d;
}

@media (max-width: 767.98px) {
  .list-filter-fields {
    flex-direction: column;
    align-items: stretch;
  }

  .list-filter-field,
  .list-filter-field-select,
  .list-filter-actions {
    width: 100%;
  }

  .list-filter-field .form-control,
  .list-filter-field .form-select,
  .list-filter-field-select .form-select {
    width: 100%;
    max-width: 100%;
  }

  .btn-filter-apply,
  .btn-filter-reset {
    flex: 1;
    justify-content: center;
  }
}

/* --------------------------------------------------------------------------
   Badge de frequência média de visita
   -------------------------------------------------------------------------- */

.freq-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  color: #475569;
  background: rgba(148, 163, 184, 0.15);
  border-radius: 4px;
  padding: 1px 6px;
  white-space: nowrap;
}
