.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 6, 23, 0.82);
  backdrop-filter: blur(4px);
  padding: 0.75rem;
}

.modal-box {
  width: 100%;
  max-width: 32rem;
  max-height: 92vh;
  overflow-y: auto;
  border-radius: 1rem;
  border: 1px solid var(--border-subtle);
  background: #0f172a;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.15rem;
}

.modal-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: #ffffff;
}

.modal-subtitle {
  margin: 0.15rem 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.modal-close {
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 0.35rem 0.5rem;
  border-radius: 0.5rem;
  font-size: 1rem;
}

.modal-close:hover {
  background: #1e293b;
  color: #ffffff;
}

.segmented-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.25rem;
  border-radius: 0.75rem;
  background: #020617;
  padding: 0.25rem;
  margin-bottom: 1rem;
}

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

.seg-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: none;
  border-radius: 0.55rem;
  background: transparent;
  padding: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.seg-btn.active-rose {
  background: rgba(244, 63, 94, 0.2);
  color: #fda4af;
  box-shadow: inset 0 0 0 1px rgba(244, 63, 94, 0.45);
}

.seg-btn.active-emerald {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.45);
}

.seg-btn.active-sky {
  background: rgba(14, 165, 233, 0.2);
  color: #7dd3fc;
  box-shadow: inset 0 0 0 1px rgba(14, 165, 233, 0.45);
}

.seg-btn.active-indigo {
  background: rgba(99, 102, 241, 0.22);
  color: #a5b4fc;
  box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.45);
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

@media (min-width: 520px) {
  .form-grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.field-group {
  margin-bottom: 0.9rem;
}

.field-label {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
}

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.3rem;
}

.link-btn {
  border: none;
  background: transparent;
  color: #818cf8;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0;
}

.link-btn:hover {
  color: #a5b4fc;
}

.alert-banner {
  border-radius: 0.75rem;
  padding: 0.65rem 0.85rem;
  font-size: 0.75rem;
  margin-bottom: 0.9rem;
}

.alert-amber {
  border: 1px solid var(--amber-border);
  background: rgba(245, 158, 11, 0.12);
  color: #fde68a;
}

.alert-rose {
  border: 1px solid var(--rose-border);
  background: var(--rose-bg);
  color: #fecdd3;
}

.alert-emerald {
  border: 1px solid var(--emerald-border);
  background: var(--emerald-bg);
  color: #a7f3d0;
}

.alert-indigo {
  border: 1px solid rgba(99, 102, 241, 0.35);
  background: rgba(99, 102, 241, 0.12);
  color: #c7d2fe;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
}

/* DatePicker */
.datepicker-wrap {
  position: relative;
}

.datepicker-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 0.75rem;
  border: 1px solid var(--border-input);
  background: var(--bg-input);
  padding: 0.55rem 0.75rem;
  font-size: 0.875rem;
  color: #ffffff;
}

.datepicker-popover {
  position: absolute;
  left: 0;
  top: 100%;
  margin-top: 0.4rem;
  z-index: 60;
  width: 18rem;
  border-radius: 1rem;
  border: 1px solid var(--border-input);
  background: #0f172a;
  padding: 0.85rem;
  box-shadow: 0 20px 35px rgba(0, 0, 0, 0.65);
}

.dp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}

.dp-nav-btn {
  border: none;
  background: transparent;
  color: #cbd5e1;
  border-radius: 0.5rem;
  padding: 0.3rem 0.55rem;
}

.dp-nav-btn:hover {
  background: #1e293b;
}

.dp-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.2rem;
  text-align: center;
}

.dp-weekday {
  font-size: 0.7rem;
  color: var(--text-muted);
  padding: 0.25rem 0;
}

.dp-day {
  border: 1px solid transparent;
  background: transparent;
  color: #e2e8f0;
  border-radius: 0.5rem;
  padding: 0.38rem 0;
  font-size: 0.75rem;
  font-weight: 500;
}

.dp-day:hover {
  background: #1e293b;
}

.dp-day.today {
  border-color: rgba(99, 102, 241, 0.55);
  color: #a5b4fc;
}

.dp-day.selected {
  background: var(--indigo);
  color: #ffffff;
}

.dp-foot {
  margin-top: 0.65rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
}

/* Cuentas y conceptos lista */
.config-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 15rem;
  overflow-y: auto;
  margin-bottom: 0.85rem;
}

.config-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border-subtle);
  background: rgba(2, 6, 23, 0.7);
  padding: 0.55rem 0.75rem;
}

.config-box {
  border-radius: 0.85rem;
  border: 1px solid var(--border-subtle);
  background: rgba(2, 6, 23, 0.55);
  padding: 0.85rem;
  margin-bottom: 0.9rem;
}

.code-preview {
  max-height: 10rem;
  overflow: auto;
  border-radius: 0.65rem;
  border: 1px solid var(--border-subtle);
  background: #020617;
  padding: 0.65rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.7rem;
  color: #cbd5e1;
  white-space: pre;
}
