/* ── Tabs (generic) ─────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--gray-light);
  border-radius: var(--r-m);
  padding: 4px;
  margin-bottom: 16px;
}
.tab {
  flex: 1;
  padding: 10px 8px;
  border-radius: calc(var(--r-m) - 2px);
  font-weight: 600;
  font-size: .85rem;
  color: var(--gray-mid);
  text-align: center;
  transition: all var(--t-fast);
  cursor: pointer;
  background: transparent;
  border: none;
}
.tab.active {
  background: var(--white);
  color: var(--orchid);
  box-shadow: var(--shadow-1);
}
.tab:active:not(.active) {
  background: rgba(0,0,0,.04);
}

@media (max-width: 360px) {
  .tabs {
    gap: 2px;
    padding: 3px;
  }
  .tab {
    padding: 8px 4px;
    font-size: .8rem;
  }
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border-radius: var(--r-m);
  font-weight: 700;
  font-size: .95rem;
  letter-spacing: .01em;
  transition: opacity var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
  width: 100%;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}
.btn:active  { transform: scale(.97); }
.btn:disabled { opacity: .45; pointer-events: none; }

.btn-primary {
  background: var(--grad-primary);
  color: var(--white);
  box-shadow: var(--shadow-orchid);
}
.btn-primary:active { box-shadow: none; }

.btn-secondary {
  background: var(--white);
  color: var(--orchid);
  border: 2px solid var(--orchid);
  box-shadow: none;
}
.btn-secondary:active { background: rgba(106,27,154,.04); }

.btn-danger {
  background: var(--danger);
  color: var(--white);
  box-shadow: 0 6px 20px rgba(211,47,47,.28);
}

.btn-ghost {
  background: transparent;
  color: var(--orchid);
  font-weight: 600;
  box-shadow: none;
}
.btn-ghost:active { background: rgba(106,27,154,.06); }

.btn-sm {
  padding: 9px 18px;
  font-size: .85rem;
  width: auto;
  border-radius: var(--r-s);
  min-height: 44px;
}

.btn-icon {
  width: 44px; height: 44px;
  padding: 0;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--r-l);
  padding: 18px;
  box-shadow: var(--shadow-1);
  margin-bottom: 12px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.card-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--cosmic);
  letter-spacing: -.01em;
}

.card-accent {
  border-left: 3px solid var(--orchid);
  padding-left: 14px;
  border-radius: 0 var(--r-m) var(--r-m) 0;
}

.card-gradient {
  background: var(--grad-primary);
  color: var(--white);
  box-shadow: var(--shadow-orchid);
}
.card-gradient .card-title,
.card-gradient p,
.card-gradient span { color: var(--white); }
.card-gradient .text-muted { color: rgba(255,255,255,.72); }

.card-tap {
  cursor: pointer;
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}
.card-tap:active { transform: scale(.99); box-shadow: var(--shadow-1); }

/* ── Forms ──────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: .775rem;
  font-weight: 700;
  color: var(--cosmic);
  margin-bottom: 7px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.form-input {
  width: 100%;
  padding: 13px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-m);
  font-size: 1rem; /* 16px — evita zoom automático al enfocar en iOS */
  color: var(--gray);
  background: var(--white);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  outline: none;
  font-weight: 500;
}
.form-input::placeholder { color: #C5C5C9; font-weight: 400; }
.form-input:focus {
  border-color: var(--orchid);
  box-shadow: 0 0 0 4px rgba(106,27,154,.10);
}
.form-input.error { border-color: var(--danger); }

.form-error {
  color: var(--danger);
  font-size: .78rem;
  margin-top: 5px;
  font-weight: 600;
}
.form-hint {
  color: var(--gray-mid);
  font-size: .78rem;
  margin-top: 5px;
}

/* ── Slider ─────────────────────────────────────────────────── */
.slider-wrap { padding: 8px 0; }
.slider {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(to right,
    var(--orchid) 0%,
    var(--orchid) var(--val, 0%),
    var(--border)  var(--val, 0%));
  outline: none;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--white);
  border: 3px solid var(--orchid);
  box-shadow: 0 2px 8px rgba(106,27,154,.28);
  cursor: pointer;
  transition: transform var(--t-fast);
}
.slider::-webkit-slider-thumb:active { transform: scale(1.15); }
.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: .72rem;
  color: var(--gray-mid);
  margin-top: 6px;
  font-weight: 600;
}

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: .70rem;
  font-weight: 700;
  letter-spacing: .03em;
}
.badge-orchid  { background: rgba(106,27,154,.10); color: var(--orchid); }
.badge-cyan    { background: rgba(0,229,255,.12);  color: #00798A; }  /* ratio 4.6:1 ✅ */
.badge-success { background: rgba(46,125,50,.10);  color: var(--success); }
.badge-warn    { background: rgba(255,87,34,.10);  color: #C84B00; }  /* ratio 4.5:1 ✅ */
.badge-danger  { background: rgba(211,47,47,.10);  color: var(--danger); }

/* ── Category Tabs ──────────────────────────────────────────── */
.tab-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 10px;
  scrollbar-width: none;
}
.tab-chips::-webkit-scrollbar { display: none; }

.tab-chip {
  flex-shrink: 0;
  padding: 5px 14px;
  border-radius: 20px;
  border: 1.5px solid #E5E5EA;
  background: #fff;
  font-size: .8rem;
  font-weight: 600;
  color: var(--gray-mid);
  cursor: pointer;
  transition: all var(--t-fast);
  white-space: nowrap;
}
.tab-chip.active {
  background: var(--orchid);
  border-color: var(--orchid);
  color: #fff;
}

/* ── Task List ──────────────────────────────────────────────── */
.task-list { list-style: none; }

.task-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid #F3F3F5;
  transition: opacity var(--t-fast);
}
.task-item:last-child { border-bottom: none; }

.task-icon {
  width: 38px; height: 38px;
  border-radius: var(--r-s);
  background: rgba(106,27,154,.08);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--orchid);
  font-size: .95rem;
}

.task-info { flex: 1; min-width: 0; }
.task-name {
  font-weight: 600;
  font-size: .9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -.01em;
}
.task-meta {
  font-size: .74rem;
  color: var(--gray-mid);
  margin-top: 2px;
  font-weight: 500;
}

/* ── Distribution Bar ───────────────────────────────────────── */
.dist-bar {
  height: 7px;
  border-radius: 4px;
  background: #EBEBF0;
  overflow: hidden;
  margin: 5px 0;
}
.dist-bar-fill {
  height: 100%;
  background: var(--grad-primary);
  border-radius: 4px;
  transition: width .55s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Streak Badge ───────────────────────────────────────────── */
.streak-badge {
  background: var(--grad-warm);
  color: var(--white);
  border-radius: var(--r-l);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  box-shadow: 0 6px 20px rgba(194,24,91,.22);
  font-size: .925rem;
}

/* ── Divider ────────────────────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

/* ── Loader ─────────────────────────────────────────────────── */
.loader-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 55vh;
  gap: 16px;
  color: var(--gray-mid);
}
.loader-screen .spinner {
  border-color: rgba(106,27,154,.15);
  border-top-color: var(--orchid);
  width: 36px; height: 36px;
  border-width: 3px;
}

/* ── Skeleton ───────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, #F0F0F0 25%, #E8E8E8 50%, #F0F0F0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--r-s);
}
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

/* ── Empty State ────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--gray-mid);
}
.empty-state .icon {
  font-size: 2.5rem;
  margin-bottom: 14px;
  display: block;
  opacity: .45;
}
.empty-state h3 { color: var(--gray); margin-bottom: 6px; font-size: 1rem; }
.empty-state p  { font-size: .875rem; line-height: 1.6; }

/* ── Modals ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 1000;
  padding: 0 0 env(safe-area-inset-bottom);
}
.modal {
  background: var(--white);
  border-radius: var(--r-l) var(--r-l) 0 0;
  padding: 24px 20px 32px;
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
  color: var(--text);
}
.modal-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--gray);
  padding: 4px 8px;
  line-height: 1;
}

@media (min-width: 768px) {
  .modal-overlay {
    align-items: center;
    padding: 24px;
  }
  .modal {
    border-radius: var(--r-l);
    max-height: 80vh;
  }
}

/* ── Selector tipo miembro (modal agregar) ───────────────────── */
.am-tipo-opcion {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-m);
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.am-tipo-opcion input[type="radio"] { accent-color: var(--orchid); width: 18px; height: 18px; flex-shrink: 0; }
.am-tipo-opcion.selected { border-color: var(--orchid); background: rgba(106,27,154,.05); }
.am-tipo-texto { display: flex; flex-direction: column; gap: 2px; }
.am-tipo-titulo { font-weight: 600; font-size: .9rem; color: var(--gray); }
.am-tipo-desc   { font-size: .78rem; color: var(--gray-mid); }


.btn-icon-save {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--orchid);
  color: #fff;
  border: none;
  border-radius: var(--r-s);
  width: 44px;
  height: 44px;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity .15s, transform .1s;
}
.btn-icon-save:hover  { opacity: .85; }
.btn-icon-save:active { transform: scale(.93); }

/* ── Banner Free/Plus ─────────────────────────────────────────── */
.banner-free {
  background: linear-gradient(135deg, rgba(106,27,154,0.08) 0%, rgba(233,30,99,0.08) 100%);
  border: 1px solid rgba(106,27,154,0.2);
}

/* ── Plan states ──────────────────────────────────────────────── */
.badge-info {
  background: rgba(33,150,243,0.12);
  color: #1976d2;
}

.badge-danger {
  background: rgba(211,47,47,0.12);
  color: #d32f2f;
}

/* ── Controversy styles ───────────────────────────────────────── */
.controversy-card {
  border-left: 3px solid var(--orchid);
}

.controversy-pending {
  background: rgba(255,193,7,0.08);
  border: 1px solid rgba(255,193,7,0.3);
}

.controversy-resolved {
  background: rgba(76,175,80,0.08);
  border: 1px solid rgba(76,175,80,0.3);
}

/* ── Icon buttons (plan tasks) ────────────────────────────────── */
.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--r-s);
  border: 1.5px solid var(--border);
  background: var(--white);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .9rem;
  transition: background .15s, border-color .15s, color .15s;
  flex-shrink: 0;
}
.icon-btn:hover {
  background: var(--orchid);
  color: var(--white);
  border-color: var(--orchid);
}
.icon-btn:active { transform: scale(.93); }

.plan-task-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-left: auto;
}
