/* Despacho de la gestoría: tareas, horas, rentabilidad, facturación, captación y cumplimiento. */

.dsp-nav { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.dsp-nav .segmented { max-width: 100%; overflow-x: auto; }
.dsp-nav .segmented a { white-space: nowrap; }
.dsp-scroll { padding: 0; overflow-x: auto; }
.dsp-scroll .table { min-width: 640px; }
.dsp-scroll .table tbody tr { cursor: default; }
.dsp-scroll .table td.num, .dsp-scroll .table th.num { text-align: right; white-space: nowrap; }
.dsp-section { margin-top: 16px; }
.dsp-section > h3, .dsp-h3 { font-size: 15px; color: var(--navy-900); margin: 0 0 10px; }
.dsp-muted { color: var(--gray-500); font-size: 13px; }
.dsp-small { font-size: 12px; }
.dsp-inline { display: inline; margin: 0; }
.dsp-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.dsp-row > .field { flex: 1 1 160px; }
.dsp-grow { flex: 1 1 auto; min-width: 0; }
.dsp-link-btn { background: none; border: 0; padding: 0; color: var(--orange-600); font: inherit; cursor: pointer; }
.dsp-link-btn:hover { text-decoration: underline; }
.dsp-danger-link { color: var(--danger); }
.dsp-empty { padding: 28px 16px; text-align: center; color: var(--gray-500); }
.dsp-pre { white-space: pre-wrap; font-size: 13px; line-height: 1.55; background: var(--gray-50); border-radius: var(--radius-md); padding: 14px; max-height: 420px; overflow: auto; }
.dsp-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; width: 100%; min-height: 84px; }
.dsp-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dsp-kpis .kpi__value { font-size: 22px; }
.dsp-badge-count { display: inline-flex; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--radius-full); background: var(--gray-100); color: var(--gray-500); font-size: 12px; font-weight: 600; align-items: center; justify-content: center; }
.dsp-warn { color: var(--danger); font-weight: 600; }
.dsp-soon { color: #B45309; font-weight: 600; }
.dsp-pos { color: var(--success); }
.dsp-neg { color: var(--danger); }

/* Cronómetro */
.dsp-timer { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 14px; margin-bottom: 16px; border-radius: var(--radius-md); background: var(--navy-900); color: #fff; }
.dsp-timer__time { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 18px; }
.dsp-timer .btn { margin-left: auto; }
.dsp-timer__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--orange-500); animation: dsp-pulse 1.4s infinite; }
@keyframes dsp-pulse { 50% { opacity: .35; } }

/* Tareas */
.dsp-task { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-top: 1px solid var(--gray-100); }
.dsp-task:first-child { border-top: 0; }
.dsp-task__main { flex: 1; min-width: 0; }
.dsp-task__title { font-weight: 600; color: var(--navy-900); }
.dsp-task__title a { color: inherit; }
.dsp-task__meta { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 12px; color: var(--gray-500); margin-top: 2px; }
.dsp-task__side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.dsp-progress { height: 6px; width: 90px; background: var(--gray-100); border-radius: var(--radius-full); overflow: hidden; }
.dsp-progress > span { display: block; height: 100%; background: var(--success); }
.dsp-board { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.dsp-col { background: var(--gray-100); border-radius: var(--radius-md); padding: 10px; min-height: 120px; }
.dsp-col__head { display: flex; justify-content: space-between; align-items: center; font-weight: 600; color: var(--navy-900); margin-bottom: 8px; }
.dsp-kcard { background: #fff; border-radius: var(--radius-sm); box-shadow: var(--shadow-card); padding: 10px; margin-bottom: 8px; }
.dsp-kcard__title { font-weight: 600; color: var(--navy-900); display: block; margin-bottom: 4px; }
.dsp-kcard select { width: 100%; margin-top: 6px; font-size: 12px; padding: 4px 6px; }
.dsp-check { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--gray-100); }
.dsp-check:first-child { border-top: 0; }
.dsp-check__box { width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--gray-300); background: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; color: #fff; flex: none; }
.dsp-check__box.is-done { background: var(--success); border-color: var(--success); }
.dsp-check__label { flex: 1; }
.dsp-check.is-done .dsp-check__label { text-decoration: line-through; color: var(--gray-500); }
.dsp-comment { padding: 10px 0; border-top: 1px solid var(--gray-100); }
.dsp-comment:first-child { border-top: 0; }
.dsp-comment__head { font-size: 12px; color: var(--gray-500); margin-bottom: 2px; }
.dsp-comment__body { white-space: pre-wrap; }

/* Embudo de captación */
.dsp-funnel { display: grid; grid-template-columns: repeat(6, minmax(190px, 1fr)); gap: 10px; overflow-x: auto; padding-bottom: 6px; }

/* Tabla de permisos */
.dsp-perms { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px 16px; }
.dsp-perms label { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; }
.dsp-chips { display: flex; flex-wrap: wrap; gap: 4px; }

/* Líneas de propuesta / factura */
.dsp-lines { display: grid; gap: 8px; }
.dsp-line { display: grid; grid-template-columns: minmax(0, 3fr) minmax(90px, 1fr) minmax(120px, 1fr) auto; gap: 8px; align-items: center; }

/* Riesgo PBC */
.dsp-factors { display: grid; gap: 6px; }
.dsp-factors label { display: flex; gap: 8px; align-items: flex-start; }
.dsp-owner { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) 80px auto; gap: 8px; align-items: center; margin-bottom: 6px; }

/* Páginas públicas (formulario, propuesta, mandato) */
.dsp-public { min-height: 100vh; background: var(--gray-50); padding: 24px 16px 48px; }
.dsp-public__box { max-width: 760px; margin: 0 auto; }
.dsp-public__brand { font-weight: 800; font-size: 20px; color: var(--navy-900); margin-bottom: 4px; }
.dsp-public .card { margin-top: 16px; }
.dsp-public table { width: 100%; border-collapse: collapse; }
.dsp-public td, .dsp-public th { padding: 8px 6px; border-bottom: 1px solid var(--gray-100); text-align: left; }
.dsp-form-embed { font-family: 'Inter', system-ui, sans-serif; font-size: 14px; color: var(--gray-900); background: transparent; margin: 0; padding: 4px; }
.dsp-form-embed .field { margin-bottom: 10px; }
.dsp-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }

@media (max-width: 1023px) {
  .dsp-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dsp-board { grid-template-columns: repeat(4, minmax(240px, 80vw)); }
  .dsp-funnel { grid-template-columns: repeat(6, minmax(220px, 78vw)); }
}
@media (max-width: 640px) {
  .dsp-line { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .dsp-line > :first-child { grid-column: span 2; }
  .dsp-owner { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .dsp-task { flex-wrap: wrap; }
  .dsp-task__side { flex-direction: row; align-items: center; width: 100%; justify-content: space-between; }
}

/* Filas de formulario en línea: los campos no ocupan el 100 % */
.dsp-row > input:not([type=checkbox]):not([type=radio]), .dsp-row > select { width: auto; min-width: 0; }
.dsp-row > input[type=date] { flex: 0 0 auto; }
