/* Ficha Cliente 360 */
.c360 {
  width: 100%;
  padding: 8px 24px 48px;
  box-sizing: border-box;
}
.c360-two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
.c360-two-col .c360-block { margin-bottom: 0; }
@media print {
  .sidebar, .topbar, .c360-back, .c360-actions, .c360-tabs, .c360-panel:not(.active) { display: none !important; }
  .c360-panel.active { display: block !important; }
  #detail-view { display: block !important; }
}

.c360-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 12px;
}
.c360-back { margin-bottom: 16px; }
.c360-identity { display: flex; gap: 16px; align-items: center; min-width: 0; }
.c360-avatar {
  width: 64px; height: 64px; border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 600; flex-shrink: 0;
}
.c360-identity h1 { margin: 0; font-size: 28px; font-weight: 650; letter-spacing: -0.02em; }
.c360-meta { color: #6b7280; font-size: 13px; margin-top: 4px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.c360-salud {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block;
}
.c360-salud.verde { background: #22c55e; }
.c360-salud.ambar { background: #f59e0b; }
.c360-salud.rojo { background: #ef4444; }
.c360-etapa-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 980px; font-size: 12px; font-weight: 500;
  background: rgba(0,0,0,0.06); cursor: pointer; border: none;
}
.c360-etapa-dot { width: 8px; height: 8px; border-radius: 50%; }
.c360-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.c360-franja {
  background: #fff; border: 1px solid rgba(0,0,0,0.06); border-radius: 14px;
  padding: 14px 18px; margin: 16px 0 20px; font-size: 14px; font-weight: 550;
  color: #1f2937; display: flex; flex-wrap: wrap; gap: 8px 18px;
}
.c360-franja span { color: #6b7280; font-weight: 400; }
.c360-tabs {
  display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid rgba(0,0,0,0.08);
  margin-bottom: 20px; padding-bottom: 0;
}
.c360-tab {
  border: none; background: transparent; padding: 10px 14px; font-size: 13px;
  font-weight: 500; color: #6b7280; cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.c360-tab:hover { color: #111; }
.c360-tab.active { color: #111; border-bottom-color: #111; }
.c360-panel { display: none; }
.c360-panel.active { display: block; animation: c360fade 0.2s ease; }
@keyframes c360fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.c360-cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px;
}
.c360-card {
  background: #fff; border-radius: 14px; padding: 16px 18px; border: 1px solid rgba(0,0,0,0.07);
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.c360-card .lbl { font-size: 12px; color: #6b7280; margin-bottom: 4px; }
.c360-card .val { font-size: 22px; font-weight: 650; letter-spacing: -0.02em; }
.c360-card .val.danger { color: #ef4444; }
.c360-card .val.ok { color: #16a34a; }

.c360-block {
  background: #fff; border-radius: 16px; border: 1px solid rgba(0,0,0,0.07);
  padding: 20px 22px; margin-bottom: 16px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.c360-datos-form .edc-block {
  background: #fff; border-radius: 16px; border: 1px solid rgba(0,0,0,0.07);
  padding: 20px 22px; margin-bottom: 16px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.c360-block h3 { margin: 0 0 12px; font-size: 15px; font-weight: 600; }
.c360-rec-list { list-style: none; padding: 0; margin: 0 0 12px; }
.c360-rec-list li {
  display: flex; justify-content: space-between; padding: 8px 0;
  border-bottom: 1px solid rgba(0,0,0,0.04); font-size: 14px;
}
.c360-rec-list li:last-child { border-bottom: none; }
.c360-mrr { font-size: 28px; font-weight: 650; margin-bottom: 8px; }

.c360-historia .leads-timeline-item { background: #fff; border: 1px solid rgba(0,0,0,0.06); }
.c360-tl-actions { display: flex; gap: 4px; flex-shrink: 0; margin-top: 2px; }
.c360-tl-btn {
  border: none; background: transparent; padding: 6px; border-radius: 8px;
  color: #9ca3af; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.c360-tl-btn:hover { background: #f3f4f6; color: #374151; }
.c360-tl-btn-danger:hover { background: #fef2f2; color: #dc2626; }
.c360-tl-tipo { font-weight: 550; color: #6b7280; }
.leads-timeline-icon.factura { background: #ede9fe; color: #7c3aed; }
.leads-timeline-icon.pago { background: #dcfce7; color: #16a34a; }
.leads-timeline-icon.presupuesto { background: #ffedd5; color: #ea580c; }
.leads-timeline-icon.sepa { background: #fee2e2; color: #dc2626; }
.leads-timeline-icon.tarea { background: #e0f2fe; color: #0284c7; }
.leads-timeline-icon.cambio { background: #f3f4f6; color: #6b7280; }
.leads-timeline-icon.lead { background: #fce7f3; color: #db2777; }
.leads-timeline-icon.calendario { background: #eef2ff; color: #4f46e5; }

.c360-timeline { position: relative; padding-left: 28px; }
.c360-tl-item { position: relative; padding: 0 0 20px 0; }
.c360-tl-item::before {
  content: ''; position: absolute; left: -22px; top: 6px; width: 10px; height: 10px;
  border-radius: 50%; background: #d1d5db; border: 2px solid #fff; box-shadow: 0 0 0 1px #e5e7eb;
}
.c360-tl-item::after {
  content: ''; position: absolute; left: -18px; top: 18px; bottom: 0; width: 2px; background: #f3f4f6;
}
.c360-tl-item:last-child::after { display: none; }
.c360-tl-item.interaccion::before { background: #3b82f6; }
.c360-tl-item.factura::before { background: #8b5cf6; }
.c360-tl-item.pago::before { background: #22c55e; }
.c360-tl-item.sepa_devolucion::before { background: #ef4444; }
.c360-tl-item.presupuesto::before { background: #f59e0b; }
.c360-tl-item.tarea::before { background: #06b6d4; }
.c360-tl-item.cambio_perfil::before { background: #6b7280; }
.c360-tl-item.conversion_lead::before { background: #ec4899; }
.c360-tl-title { font-size: 14px; font-weight: 550; }
.c360-tl-meta { font-size: 12px; color: #9ca3af; margin-top: 2px; }
.c360-tl-detail { font-size: 13px; color: #4b5563; margin-top: 4px; }

.c360-composer { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }

.c360-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.c360-table th {
  text-align: left; padding: 10px 12px; font-size: 11px; color: #9ca3af; font-weight: 500;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}
.c360-table td { padding: 12px; border-bottom: 1px solid rgba(0,0,0,0.04); }
.c360-badge {
  display: inline-flex; padding: 3px 8px; border-radius: 980px; font-size: 11px; font-weight: 500;
}
.c360-badge.pagada { background: rgba(34,197,94,0.12); color: #15803d; }
.c360-badge.pendiente { background: rgba(245,158,11,0.14); color: #b45309; }
.c360-badge.vencida { background: rgba(239,68,68,0.12); color: #b91c1c; }
.c360-badge.parcial { background: rgba(59,130,246,0.12); color: #1d4ed8; }
.c360-badge.aceptado { background: rgba(34,197,94,0.12); color: #15803d; }
.c360-badge.rechazado { background: rgba(239,68,68,0.12); color: #b91c1c; }
.c360-badge.enviado { background: rgba(59,130,246,0.12); color: #1d4ed8; }

.c360-empty { text-align: center; padding: 40px 20px; color: #6b7280; }
.c360-chart { min-height: 260px; }

/* Kanban clientes */
.c360-kanban { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 16px; min-height: 420px; }
.c360-col {
  min-width: 260px; max-width: 280px; background: #f3f4f6; border-radius: 14px; padding: 12px;
  display: flex; flex-direction: column; gap: 10px;
}
.c360-col-head { display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 600; }
.c360-col-count { background: #fff; border-radius: 980px; padding: 2px 8px; font-size: 11px; color: #6b7280; }
.c360-card-k {
  background: #fff; border-radius: 12px; padding: 12px; cursor: grab;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04); border: 1px solid rgba(0,0,0,0.04);
}
.c360-card-k:active { cursor: grabbing; }
.c360-card-k .name { font-weight: 550; font-size: 14px; }
.c360-card-k .sub { font-size: 12px; color: #6b7280; margin-top: 4px; }

/* Portal de cliente (tab 360) */
.c360-portal { display: flex; flex-direction: column; gap: 16px; }
.c360-portal-status {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 18px 20px; border-radius: 16px; border: 1px solid rgba(0,0,0,0.06); background: #fff;
}
.c360-portal-status--ok { background: linear-gradient(135deg, #f0fdf4 0%, #fff 55%); }
.c360-portal-status--warn { background: linear-gradient(135deg, #fffbeb 0%, #fff 55%); }
.c360-portal-status--off { background: #fff; }
.c360-portal-status-main { display: flex; align-items: center; gap: 14px; min-width: 0; }
.c360-portal-status-text { display: flex; flex-direction: column; gap: 2px; }
.c360-portal-status-text strong { font-size: 15px; }
.c360-portal-status-text span { font-size: 13px; color: #6b7280; }
.c360-portal-badge {
  display: inline-flex; align-items: center; padding: 5px 10px; border-radius: 980px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.c360-portal-badge.ok { background: rgba(34,197,94,0.14); color: #15803d; }
.c360-portal-badge.warn { background: rgba(245,158,11,0.16); color: #b45309; }
.c360-portal-badge.off { background: #f3f4f6; color: #6b7280; }
.c360-portal-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px;
}
.c360-portal-card h3 { margin: 0 0 6px; font-size: 15px; font-weight: 600; }
.c360-portal-hint { margin: 0 0 12px; font-size: 13px; color: #6b7280; line-height: 1.4; }
.c360-portal-label {
  display: block; font-size: 12px; font-weight: 500; color: #6b7280; margin-bottom: 6px;
}
.c360-portal-row { display: flex; gap: 8px; align-items: center; }
.c360-portal-row .form-input { flex: 1; min-width: 0; }
.c360-portal-meta {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 16px;
}
.c360-portal-email { font-size: 14px; font-weight: 500; word-break: break-word; }
.c360-portal-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.c360-portal-empty {
  text-align: center; padding: 48px 24px; background: #fff; border: 1px solid rgba(0,0,0,0.06);
  border-radius: 16px;
}
.c360-portal-empty-icon {
  width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 14px;
  background: #f3f4f6; color: #6b7280; display: flex; align-items: center; justify-content: center;
}
.c360-portal-empty h3 { margin: 0 0 8px; font-size: 18px; }
.c360-portal-empty p { margin: 0 0 18px; color: #6b7280; font-size: 14px; max-width: 420px; margin-left: auto; margin-right: auto; }

/* Modales 360: apilar campos (el .leads-modal-body base es flex en fila) */
.c360-modal-body {
  display: grid !important;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  overflow-x: hidden;
}
.c360-modal-body .leads-form-group.full {
  grid-column: 1 / -1;
}
.c360-modal-body .leads-form-group input,
.c360-modal-body .leads-form-group select,
.c360-modal-body .leads-form-group textarea {
  width: 100%;
  box-sizing: border-box;
  max-width: 100%;
}

.c360-tramos-editor {
  min-width: 0;
  width: 100%;
}
.c360-tramos-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.c360-tramos-head strong {
  font-size: 13px;
  color: #111827;
}
.c360-tramos-head .btn {
  flex-shrink: 0;
}
.c360-tramos-hint {
  margin: 0 0 12px;
  font-size: 12px;
  color: #6b7280;
  line-height: 1.45;
}
.c360-tramo-row {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.2fr) minmax(0, 1fr) 72px minmax(0, 1fr) 36px;
  gap: 8px;
  align-items: end;
  margin-bottom: 10px;
  min-width: 0;
}
.c360-tramo-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  font-size: 12px;
  color: #6b7280;
  font-weight: 500;
}
.c360-tramo-field .form-input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.c360-tr-del {
  padding: 8px;
  min-height: 38px;
  justify-content: center;
}

@media (max-width: 768px) {
  .c360-modal-overlay.leads-modal {
    align-items: flex-end;
    padding: 0;
  }
  .c360-modal-overlay .leads-modal-content {
    width: 100%;
    max-width: 100% !important;
    max-height: min(92vh, 100%);
    border-radius: 16px 16px 0 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
  }
  .c360-modal-overlay .leads-modal-header {
    padding: 16px;
    flex-shrink: 0;
  }
  .c360-modal-overlay .c360-modal-body {
    grid-template-columns: 1fr !important;
    padding: 16px;
    gap: 14px;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    min-height: 0;
  }
  .c360-modal-overlay .leads-modal-footer {
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    flex-shrink: 0;
    justify-content: stretch;
  }
  .c360-modal-overlay .leads-modal-footer .leads-btn {
    flex: 1;
    justify-content: center;
    min-height: 44px;
  }
  .c360-modal-body .leads-form-group input,
  .c360-modal-body .leads-form-group select,
  .c360-modal-body .leads-form-group textarea,
  .c360-tramo-field .form-input {
    font-size: 16px;
    min-height: 44px;
  }
  .c360-tramos-head {
    flex-wrap: wrap;
  }
  .c360-tramo-row {
    grid-template-columns: 1fr 1fr;
    gap: 10px 8px;
    padding: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #f9fafb;
    margin-bottom: 12px;
  }
  .c360-tramo-field--iva,
  .c360-tramo-row .c360-tr-del {
    grid-column: auto;
  }
  .c360-tramo-row .c360-tr-del {
    grid-column: 1 / -1;
    width: 100%;
  }
}

.c360-stage-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.c360-stage-pick {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 12px;
  background: #fff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.c360-stage-pick:hover {
  border-color: var(--stage-color, #6b7280);
  background: #fafafa;
}
.c360-stage-pick.active {
  border-color: var(--stage-color, #111);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--stage-color, #111) 25%, transparent);
  background: color-mix(in srgb, var(--stage-color, #111) 8%, #fff);
}
.c360-stage-pick .c360-etapa-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Tab Datos editable */
.c360-datos-form { display: flex; flex-direction: column; gap: 16px; }
.c360-notas-block {
  border-color: rgba(17, 17, 17, 0.08);
  background: linear-gradient(180deg, #fffef8 0%, #fff 55%);
}
.c360-notas-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.c360-notas-head h3 { margin: 0 0 4px; }
.c360-notas-textarea {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  line-height: 1.45;
  font-size: 14px;
  box-sizing: border-box;
}
.c360-datos-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.c360-datos-toolbar--bottom {
  justify-content: flex-end;
  padding-top: 4px;
}
.c360-datos-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
  margin-top: 8px;
}
.c360-datos-fields--4 {
  grid-template-columns: repeat(4, 1fr);
}
.c360-datos-fields .leads-form-group {
  margin: 0;
}
.c360-datos-fields .leads-form-group.full {
  grid-column: 1 / -1;
}
.c360-datos-fields .leads-form-group input,
.c360-datos-fields .leads-form-group select {
  width: 100%;
  box-sizing: border-box;
}
.c360-toggle-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  margin: 0;
}
.c360-toggle-row strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
}
.c360-toggle-row small {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: #6b7280;
  font-weight: 400;
}
@media (max-width: 900px) {
  .c360-datos-fields,
  .c360-datos-fields--4 {
    grid-template-columns: 1fr;
  }
}

.c360-view-toggle { display: flex; gap: 4px; }
.c360-view-toggle button {
  border: 1px solid rgba(0,0,0,0.1); background: #fff; padding: 6px 12px; border-radius: 8px;
  font-size: 12px; cursor: pointer;
}
.c360-view-toggle button.active { background: #111; color: #fff; border-color: #111; }

/* Tareas módulo */
#tareas.container {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
#tareas .content-header {
  width: auto;
  box-sizing: border-box;
  flex-shrink: 0;
}
.tareas-page {
  padding: 20px 32px 32px;
  box-sizing: border-box;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.tareas-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.tareas-toolbar #tareas-search {
  flex: 1;
  min-width: 180px;
  max-width: 280px;
}
.tareas-toolbar #tareas-estado {
  width: 160px;
}
.tareas-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #374151;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
.tareas-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  gap: 20px;
  align-items: start;
  flex: 1;
  min-height: 0;
}
.tareas-list-pane {
  min-width: 0;
}
.tareas-detail-pane {
  position: sticky;
  top: 16px;
  background: #fff;
  border: 1px solid rgba(0,0,0,0.07);
  border-radius: 16px;
  min-height: 280px;
  box-sizing: border-box;
}
.tareas-detail-inner {
  padding: 20px 22px 22px;
}
.tareas-detail-top {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.tareas-detail-title {
  margin: 0 0 12px;
  font-size: 20px;
  font-weight: 650;
  line-height: 1.25;
  color: #111;
}
.tareas-detail-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: #374151;
  margin-bottom: 14px;
}
.tareas-detail-meta .label {
  display: inline-block;
  min-width: 72px;
  color: #9ca3af;
  font-size: 12px;
  font-weight: 500;
}
.tarea-asignado-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.tarea-asignado-row .form-input {
  flex: 1;
  min-width: 0;
  padding: 4px 8px;
  font-size: 13px;
}
.tareas-detail-desc {
  margin: 0 0 16px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  color: #374151;
}
.tareas-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.tareas-detail-section {
  margin: 20px 0 10px;
  font-size: 13px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.tareas-comentarios {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tarea-comentario {
  padding: 10px 12px;
  background: #f9fafb;
  border-radius: 10px;
}
.tarea-comentario-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  margin-bottom: 4px;
}
.tarea-comentario-head span { color: #9ca3af; }
.tarea-comentario-body {
  font-size: 13px;
  white-space: pre-wrap;
  color: #111;
}
.tareas-comentario-form {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}
.tareas-comentario-form .form-input { flex: 1; min-width: 0; }

.tareas-grupo { margin-bottom: 20px; }
.tareas-grupo h3 {
  font-size: 12px;
  color: #6b7280;
  margin: 0 0 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.tarea-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.tarea-row:hover {
  border-color: rgba(0,0,0,0.12);
  box-shadow: 0 2px 10px rgba(0,0,0,0.04);
}
.tarea-row.is-active {
  border-color: #111;
  box-shadow: 0 0 0 2px rgba(17,17,17,0.08);
}
.tarea-row .prio {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.tarea-row .prio.alta { background: #ef4444; }
.tarea-row .prio.media { background: #f59e0b; }
.tarea-row .prio.baja { background: #94a3b8; }
.tarea-row-body {
  flex: 1;
  min-width: 0;
}
.tarea-row .titulo {
  font-size: 14px;
  font-weight: 550;
  color: #111;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tarea-row .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 12px;
  color: #9ca3af;
  margin-top: 2px;
}
.tarea-row .meta a { color: #4b5563; text-decoration: none; }
.tarea-row .meta a:hover { text-decoration: underline; }
.tarea-row .btn-done {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1;
}

.tarea-estado-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
  white-space: nowrap;
}
.tarea-estado-badge.estado-pendiente {
  background: rgba(245, 158, 11, 0.16);
  color: #b45309;
}
.tarea-estado-badge.estado-en_progreso {
  background: rgba(59, 130, 246, 0.14);
  color: #1d4ed8;
}
.tarea-estado-badge.estado-completada {
  background: rgba(34, 197, 94, 0.14);
  color: #15803d;
}
.tarea-estado-badge.estado-cancelada {
  background: #f3f4f6;
  color: #6b7280;
}
.tarea-prio-label {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: #f3f4f6;
  color: #4b5563;
}
.tarea-prio-label.prio-alta { background: rgba(239, 68, 68, 0.12); color: #b91c1c; }
.tarea-prio-label.prio-media { background: rgba(245, 158, 11, 0.14); color: #b45309; }
.tarea-prio-label.prio-baja { background: #f3f4f6; color: #6b7280; }

.tareas-empty {
  padding: 40px 20px;
  text-align: center;
  color: #6b7280;
  font-size: 14px;
}
.tareas-empty--sm { padding: 16px; }

@media (max-width: 900px) {
  .tareas-page { padding: 16px; }
  .tareas-layout {
    grid-template-columns: 1fr;
  }
  .tareas-detail-pane {
    position: static;
  }
}

.tareas-detail-back {
  display: none;
}

@media (max-width: 768px) {
  #tareas .content-header,
  #tareas .tareas-toolbar {
    display: none;
  }

  #tareas.container {
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    padding: 0 !important;
  }

  #tareas .tareas-page,
  #tareas .tareas-layout,
  #tareas .tareas-list-pane {
    overflow: visible;
    flex: none;
    height: auto;
    min-height: 0;
  }

  #tareas .tareas-page {
    padding: 0;
    gap: 0;
  }

  #tareas .tareas-list-pane {
    padding: 0 16px 16px;
  }

  #tareas .docs-mobile-header {
    flex-shrink: 0;
  }

  #tareas .docs-mobile-icon-btn.is-active {
    background: #1d1d1f;
    color: #fff;
  }

  #tareas-detalle {
    display: none;
  }

  #tareas-detalle.is-open {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 8500;
    background: #fff;
    border: none;
    border-radius: 0;
    min-height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: calc(12px + env(safe-area-inset-top, 0px)) 16px calc(24px + env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
  }

  #tareas-detalle.is-open .tareas-detail-inner {
    padding: 0 6px 8px;
  }

  .tareas-detail-back {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 0 0 12px;
    padding: 8px 0;
    border: none;
    background: none;
    color: #0071e3;
    font-size: 16px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
}

/* Ajustes menores ficha Proveedor 360 */
#proveedores-detail-view .c360-avatar {
  background: linear-gradient(135deg, #0f766e, #14b8a6);
}
