:host {
  --pg-font-sans: 'IBM Plex Sans', 'Source Sans 3', 'Manrope', 'Segoe UI', sans-serif;

  --pg-primary: #1f4fd6;
  --pg-primary-strong: #153caa;
  --pg-primary-soft: rgba(31, 79, 214, 0.12);
  --pg-primary-soft-2: rgba(31, 79, 214, 0.18);

  --pg-text: #0f172a;
  --pg-text-muted: #475569;
  --pg-text-soft: #64748b;

  --pg-bg: #f3f6fb;
  --pg-surface: #ffffff;
  --pg-surface-alt: #f8fafc;

  --pg-border: #dbe3ef;
  --pg-border-strong: #c8d4e4;

  --pg-warning: #b4690e;
  --pg-warning-soft: rgba(180, 105, 14, 0.14);
  --pg-danger: #c52929;
  --pg-danger-soft: rgba(197, 41, 41, 0.12);
  --pg-success: #1c7a3e;

  --pg-radius-sm: 10px;
  --pg-radius-md: 14px;
  --pg-radius-lg: 18px;

  --pg-shadow-sm: 0 8px 18px rgba(15, 23, 42, 0.08);
  --pg-shadow-md: 0 16px 32px rgba(15, 23, 42, 0.12);
  --pg-shadow-lg: 0 24px 56px rgba(15, 23, 42, 0.25);

  --pg-focus-ring: 0 0 0 3px rgba(31, 79, 214, 0.22);

  --brand: var(--pg-primary);
  --blue: var(--pg-primary-strong);
  --text: var(--pg-text);
  --muted: var(--pg-text-muted);
  --focus-ring: var(--pg-focus-ring);

  display: block;
  color: var(--pg-text);
  font-family: var(--pg-font-sans);
}

.parcelamentos-page {
  min-height: 100vh;
  padding: 0 12px 72px;
  display: flex;
  justify-content: center;
  position: relative;
  background:
    radial-gradient(1100px 450px at 10% -10%, rgba(31, 79, 214, 0.11), transparent 60%),
    radial-gradient(900px 420px at 100% 0%, rgba(30, 64, 175, 0.07), transparent 58%),
    linear-gradient(180deg, #f9fbff 0%, var(--pg-bg) 75%);
}

.container-geral-responsive {
  width: 100%;
  max-width: 1280px;
  position: relative;
  z-index: 1;
  margin-top: 28px;
}

.parcelamentos-shell {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.parcelamentos-shell > * {
  min-width: 0;
}

.page-header {
  display: grid;
  gap: 14px;
  border: 1px solid var(--pg-border);
  border-radius: var(--pg-radius-lg);
  padding: 18px 20px;
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.98), rgba(245, 249, 255, 0.94));
  box-shadow: var(--pg-shadow-sm);
}

.page-header-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.title-group {
  display: grid;
  gap: 8px;
}

.title-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 6px 11px;
  border-radius: 999px;
  background: var(--pg-primary-soft);
  border: 1px solid var(--pg-primary-soft-2);
  color: var(--pg-primary-strong);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;

  i {
    color: var(--pg-primary);
  }
}

.header-title h2 {
  margin: 0;
  font-size: clamp(1.35rem, 2vw, 1.65rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.header-title p {
  margin: 4px 0 0;
  font-size: 0.92rem;
  color: var(--pg-text-muted);
  font-weight: 600;
}

.header-actions {
  display: inline-flex;
  gap: 10px;
  flex-wrap: wrap;
}

.header-highlights {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.highlight-card {
  border: 1px solid var(--pg-border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.84);
  padding: 10px 12px;
  display: grid;
  gap: 4px;

  span {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--pg-text-soft);
    font-weight: 700;
  }

  strong {
    font-size: 0.95rem;
    color: var(--pg-text);
    font-weight: 800;
  }
}

.btn-primary,
.btn-ghost,
.btn-danger {
  height: 40px;
  border-radius: var(--pg-radius-sm);
  border: 1px solid transparent;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;

  &:focus-visible {
    outline: none;
    box-shadow: var(--pg-focus-ring);
  }

  &:disabled {
    opacity: 0.62;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
  }
}

.btn-primary {
  color: #fff;
  background: linear-gradient(140deg, var(--pg-primary), var(--pg-primary-strong));
  border-color: var(--pg-primary-strong);
  box-shadow: 0 10px 22px rgba(31, 79, 214, 0.28);
}

.btn-ghost {
  color: var(--pg-text);
  background: #fff;
  border-color: var(--pg-border-strong);
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.08);
}

.btn-danger {
  color: #fff;
  background: linear-gradient(145deg, #cf3131, #a91f1f);
  border-color: #a91f1f;
  box-shadow: 0 10px 20px rgba(169, 31, 31, 0.24);
}

.btn-primary:hover,
.btn-ghost:hover,
.btn-danger:hover {
  transform: translateY(-1px);
}

.btn-ghost:hover {
  border-color: var(--pg-primary);
  color: var(--pg-primary-strong);
}

.lg-backdrop {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 15% 0%, rgba(31, 79, 214, 0.16), rgba(15, 23, 42, 0.64) 42%),
    rgba(15, 23, 42, 0.6);
  z-index: 9990;
  backdrop-filter: blur(4px);
}

.lg-modal {
  position: fixed;
  inset: 0;
  z-index: 9995;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.lg-modal-card {
  width: min(1180px, 98vw);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--pg-surface);
  border: 1px solid var(--pg-border);
  border-radius: 18px;
  box-shadow: var(--pg-shadow-lg);
  animation: pop-up 0.24s ease;
}

.modal-compact {
  width: min(560px, 96vw);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--pg-border);
  background: linear-gradient(180deg, rgba(244, 248, 255, 0.96), rgba(255, 255, 255, 0.96));
}

.modal-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  color: var(--pg-text);
}

.icon-bg {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--pg-primary-soft);
  color: var(--pg-primary-strong);
}

.icon-bg.danger-soft {
  background: var(--pg-danger-soft);
  color: var(--pg-danger);
}

.modal-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-icon {
  width: 34px;
  height: 34px;
  border: 1px solid var(--pg-border-strong);
  border-radius: 10px;
  background: #fff;
  color: var(--pg-text-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;

  &:hover {
    color: var(--pg-primary-strong);
    border-color: var(--pg-primary);
    transform: translateY(-1px);
  }

  &:focus-visible {
    outline: none;
    box-shadow: var(--pg-focus-ring);
  }
}

.modal-body {
  padding: 18px;
  background: linear-gradient(180deg, #f8fbff, #ffffff 80%);
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.modal-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--pg-border);
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  background: #fff;
}

.detail-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 180px;
  color: var(--pg-text-muted);
  font-weight: 700;
}

.detail-state.error {
  color: var(--pg-danger);
}

.text-brand {
  color: var(--pg-primary);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.detail-card {
  border: 1px solid var(--pg-border);
  border-radius: 12px;
  padding: 11px 12px;
  background: #fff;
  display: grid;
  gap: 6px;
  color: var(--pg-text-muted);

  small {
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.66rem;
    font-weight: 800;
  }

  span {
    color: var(--pg-text);
    font-size: 0.88rem;
    font-weight: 700;
  }
}

.detail-card.highlight {
  grid-column: span 2;
  background: linear-gradient(180deg, #ffffff, #f4f8ff);
}

.detail-strong {
  font-weight: 800;
}

.text-blue {
  color: var(--pg-primary-strong);
}

.money-strong {
  color: var(--pg-primary);
}

.text-danger {
  color: var(--pg-danger);
}

.status-pill {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--pg-primary-soft-2);
  background: var(--pg-primary-soft);
  color: var(--pg-primary-strong);
  font-size: 0.74rem;
  font-weight: 800;
}

.annual-section {
  margin-top: 16px;
  border: 1px solid var(--pg-border);
  border-radius: 14px;
  padding: 12px;
  background: #fff;
  display: grid;
  gap: 10px;
}

.annual-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.section-title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 800;
  color: var(--pg-text);
}

.annual-table-shell {
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid var(--pg-border);
  border-radius: 12px;
}

.annual-table {
  width: max-content;
  min-width: 1220px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;

  th,
  td {
    border-bottom: 1px solid #e7edf6;
    padding: 8px 10px;
    white-space: nowrap;
  }

  thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--pg-text-soft);
    background: #f6f9fe;
    font-size: 10px;
    font-weight: 800;
  }
}

.annual-section .sticky-col {
  position: sticky;
  left: 0;
  z-index: 3;
  background: #fff;
  box-shadow: 2px 0 0 #eef3fb;
}

.annual-section .col-1 {
  left: 0;
  min-width: 90px;
}

.annual-section .col-2 {
  left: 90px;
  min-width: 128px;
}

.annual-empty {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--pg-border-strong);
  border-radius: 10px;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--pg-text-muted);
  background: var(--pg-surface-alt);
}

.confirm-delete {
  min-height: 150px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 10px;
  text-align: center;
  color: var(--pg-text-muted);

  p {
    margin: 0;
    color: var(--pg-text);
    font-weight: 600;
  }
}

.confirm-icon {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--pg-danger);
  border: 1px solid rgba(197, 41, 41, 0.22);
  background: rgba(197, 41, 41, 0.1);
  font-size: 1.15rem;
}

@keyframes pop-up {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 1100px) {
  .header-highlights {
    grid-template-columns: 1fr;
  }

  .detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 780px) {
  .container-geral-responsive {
    margin-top: 18px;
  }

  .page-header,
  .modal-body,
  .modal-header,
  .modal-footer {
    padding-left: 14px;
    padding-right: 14px;
  }

  .header-actions {
    width: 100%;
  }

  .header-actions .btn-primary,
  .header-actions .btn-ghost {
    flex: 1;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .detail-card.highlight {
    grid-column: span 1;
  }

  .modal-footer {
    justify-content: stretch;
  }

  .modal-footer .btn-primary,
  .modal-footer .btn-ghost,
  .modal-footer .btn-danger {
    flex: 1;
  }
}
