:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --text: #0f172a;
  --text-muted: #52607a;
  --primary: #1f4fd6;
  --primary-dark: #1e3a8a;
  --primary-soft: #edf3ff;
  --border: #d9e1ed;
  --shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
  --danger: #b42318;
  --bottom-nav-height: 88px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.4;
}

.container {
  width: min(100%, 1024px);
  margin: 0 auto;
  padding: 0 0.85rem;
}

.topbar-compact {
  background: var(--primary);
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.22);
  font-family: "Inter", "Segoe UI", Tahoma, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Alias / barras compatibles */
.topbar,
.navbar,
.app-header,
.topbar-compact {
  min-height: 58px;
}

.topbar-inner {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.brand {
  color: #fff;
  text-decoration: none;
  font-family: inherit;
  font-weight: 600;
  font-size: 15px;
  line-height: 1.2;
  letter-spacing: 0;
  white-space: nowrap;
  flex-shrink: 0;
  padding: 12px 0;
}

.logout-link {
  color: #e8efff;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  opacity: 0.95;
}

.logout-link:hover {
  color: #fff;
}

.nav-desktop,
.topbar-nav,
.desktop-nav {
  gap: 8px;
  align-items: center;
}

.desktop-nav {
  display: none;
}

.desktop-nav a,
.topbar-inner nav a,
.topbar a,
.navbar a,
.app-header a {
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  padding: 12px 14px;
  white-space: nowrap;
}

.desktop-nav a {
  display: inline-flex;
  align-items: center;
  color: #fff;
  text-decoration: none;
  border-radius: 7px;
}

.desktop-nav a:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.desktop-nav a.nav-link-secondary {
  opacity: 0.9;
}

.block-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.35rem;
}

.block-title-row .block-title {
  margin-bottom: 0;
}

.link-all-closed {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  white-space: nowrap;
}

.link-all-closed:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.no-margin-bottom {
  margin-bottom: 0;
}

.resumen-inline {
  font-weight: 650;
}

.main-content {
  padding-top: 0.75rem;
  padding-bottom: 4.4rem;
}

.alerts-stack {
  margin-bottom: 0.9rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 0.78rem 0.85rem;
  margin-bottom: 0.72rem;
}

.muted {
  color: var(--text-muted);
}

.meta-line {
  margin: 0.2rem 0;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.hint {
  margin-top: 1rem;
  font-size: 0.9rem;
}

.auth-card {
  max-width: 460px;
  margin: 1.2rem auto 0;
}

.form-card {
  max-width: 760px;
}

.form-grid {
  display: grid;
  gap: 0.5rem;
}

.clean-form label {
  font-size: 0.92rem;
  font-weight: 600;
  color: #1e293b;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 0.58rem 0.7rem;
  font-size: 0.94rem;
  font-family: inherit;
  color: var(--text);
  background: #fff;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid transparent;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.14);
}

.form-actions {
  display: flex;
  gap: 0.45rem;
  margin-top: 0.25rem;
  flex-wrap: wrap;
}

/* Nuevo seguimiento: vista rápida (/seguimientos/nuevo) */
.seg-form--quick {
  max-width: min(100%, 480px);
  margin-inline: auto;
}

.seg-quick-form {
  gap: 0.7rem;
}

.seg-form-more {
  margin-top: 0.25rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fafbff;
}

.seg-form-more-summary {
  list-style: none;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--primary);
  padding: 0.62rem 0.72rem;
  user-select: none;
}

.seg-form-more summary::-webkit-details-marker {
  display: none;
}

.seg-form-more-summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 0.35rem;
  transition: transform 0.15s ease;
  font-size: 0.72rem;
  opacity: 0.85;
}

.seg-form-more[open] .seg-form-more-summary::before {
  transform: rotate(90deg);
}

.seg-form-more-inner {
  padding: 0.5rem 0.72rem 0.75rem;
  border-top: 1px solid var(--border);
}

.seg-quick-actions {
  margin-top: 0.85rem;
}

.btn-primary,
.btn-secondary {
  display: inline-block;
  text-decoration: none;
  text-align: center;
  font-weight: 600;
  border-radius: 9px;
  padding: 0.5rem 0.78rem;
  cursor: pointer;
  font-size: 0.9rem;
}

.btn-primary {
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn-secondary {
  border: 1px solid #cdd8ea;
  background: #fff;
  color: #1f2937;
}

.btn-secondary:hover {
  background: #f8fbff;
}

.btn-danger-soft,
.btn-muted-soft {
  border-radius: 9px;
  padding: 0.46rem 0.7rem;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-danger-soft {
  border: 1px solid #f6c7bf;
  background: #fef3f2;
  color: #b42318;
}

.btn-muted-soft {
  border: 1px solid #d8dee7;
  background: #f5f6f8;
  color: #344054;
}

.full-width {
  width: 100%;
}

.big-button {
  max-width: 220px;
}

.btn-compact {
  padding: 0.48rem 0.72rem;
  font-size: 0.87rem;
}

.dashboard-head h1 {
  margin: 0;
  font-size: 1.2rem;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
}

.compact {
  margin-bottom: 0.55rem;
}

.search-row {
  display: grid;
  gap: 0.45rem;
  grid-template-columns: 1fr auto;
}

.search-compact input {
  min-height: 38px;
}

.cards-list,
.dashboard-grid {
  display: grid;
  gap: 0.62rem;
}

.dashboard-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.card-item {
  margin-bottom: 0;
}

.card-item h3 {
  margin: 0 0 0.2rem;
}

.actions-row {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.actions-row form {
  margin: 0;
}

.seguimiento-card {
  padding: 0.6rem 0.7rem;
  border-color: #d3ddea;
}

.card-top {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: flex-start;
  margin-bottom: 0.2rem;
}

.cliente-title {
  margin: 0;
  font-size: 0.97rem;
  line-height: 1.15;
  font-weight: 700;
}

.cliente-title a {
  color: #0f172a;
  text-decoration: none;
}

.cliente-title a:hover {
  color: var(--primary);
}

.concepto-line {
  margin: 0.04rem 0 0.2rem;
  font-weight: 600;
  color: #1e293b;
  font-size: 0.9rem;
}

.estado-badge {
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid #c7d7ff;
  border-radius: 999px;
  padding: 0.12rem 0.44rem;
  font-size: 0.69rem;
  font-weight: 700;
  text-transform: none;
  white-space: nowrap;
}

.estado-nuevo {
  background: #f1f5f9;
  border-color: #dce4ee;
  color: #475569;
}

.estado-presupuesto_enviado,
.estado-ha_contestado {
  background: #fff6dd;
  border-color: #f6e0a2;
  color: #9a6700;
}

.estado-aceptado {
  background: #e9f9ef;
  border-color: #b8ebca;
  color: #067647;
}

.estado-programado {
  background: #f1edff;
  border-color: #daceff;
  color: #5b42c7;
}

.estado-realizado {
  background: #ebf3ff;
  border-color: #c9dcff;
  color: #1d4ed8;
}

.estado-archivado,
.estado-rechazado {
  background: #f3f4f6;
  border-color: #dfe3e8;
  color: #4b5563;
}

.estado-crm-activo {
  background: #ecfdf3;
  border-color: #abefc6;
  color: #067647;
}

.estado-crm-pendiente_contacto {
  background: #fff6dd;
  border-color: #f6e0a2;
  color: #9a6700;
}

.estado-crm-interesado {
  background: #ebf3ff;
  border-color: #c9dcff;
  color: #1d4ed8;
}

.estado-crm-no_interesado {
  background: #fef3f2;
  border-color: #fecdca;
  color: #b42318;
}

.estado-crm-cliente_conseguido {
  background: #e9f9ef;
  border-color: #b8ebca;
  color: #0f6f4f;
}

.empresa-tag {
  font-weight: 600;
  color: #334155;
}

.filter-label {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-muted);
  align-self: center;
  margin-right: 0.15rem;
}

.filter-row-spaced {
  margin-top: 0.35rem;
  align-items: center;
}

.sub-block-title {
  font-size: 0.88rem;
  margin: 0.35rem 0 0.45rem;
  color: #334155;
}

.danger-zone {
  margin-top: 0.75rem;
  border: 1px solid #f6c7bf;
  border-radius: 12px;
  background: #fffbfb;
  padding: 0.55rem 0.75rem;
}

.danger-zone summary {
  cursor: pointer;
  font-weight: 700;
  color: #b42318;
  font-size: 0.88rem;
}

.danger-zone .small-print {
  font-size: 0.82rem;
  margin: 0.45rem 0 0.55rem;
}

.checkbox-line {
  display: flex;
  gap: 0.45rem;
  align-items: flex-start;
  font-size: 0.88rem;
  color: #334155;
}

.checkbox-line input {
  width: auto;
  margin-top: 0.2rem;
}

.confirm-input {
  max-width: 220px;
}

.form-inline {
  display: inline;
  margin: 0;
}

.actions-row-head {
  justify-content: flex-end;
}

.inner-card {
  border-style: dashed;
  border-color: #e2e8f0;
  box-shadow: none;
}

.note-short {
  color: #334155;
  margin: 0.2rem 0 0.3rem;
  font-size: 0.84rem;
  line-height: 1.28;
}

.card-warning {
  border-color: #f6d98f;
  background: #fffcf3;
}

.warning-note {
  display: inline-block;
  background: #fff1c7;
  color: #8a5a00;
  border: 1px solid #f4dea0;
  border-radius: 8px;
  padding: 0.3rem 0.5rem;
  font-size: 0.82rem;
  margin: 0.05rem 0 0.25rem;
}

.quick-actions {
  display: flex;
  gap: 0.32rem;
  flex-wrap: wrap;
  margin: 0.35rem 0 0.05rem;
}

.btn-quick {
  border: 1px solid transparent;
  font-weight: 600;
  padding: 0.35rem 0.52rem;
  border-radius: 8px;
  font-size: 0.78rem;
  cursor: pointer;
  line-height: 1.15;
}

.btn-quick.btn-solid {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.btn-quick.btn-programar {
  background: #eef2ff;
  color: #4338ca;
  border-color: #cfd4ff;
}

.btn-quick.btn-muted {
  background: #f2f4f7;
  color: #344054;
  border-color: #d8dee7;
}

.filter-row {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.filter-pill {
  display: inline-block;
  text-decoration: none;
  color: #1e3a8a;
  background: #eef3ff;
  border: 1px solid #c9d7ff;
  border-radius: 999px;
  padding: 0.28rem 0.62rem;
  font-weight: 600;
  font-size: 0.79rem;
}

.filter-pill.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.block-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 0.45rem;
  font-size: 1rem;
}

.count-pill {
  display: inline-block;
  padding: 0.1rem 0.44rem;
  border-radius: 999px;
  border: 1px solid #c9d7ff;
  background: #edf3ff;
  color: #1e40af;
  font-size: 0.78rem;
  font-weight: 700;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

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

@media (min-width: 640px) {
  .kpi-grid-6 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 900px) {
  .kpi-grid-6 {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

.kpi-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem 0.6rem;
  box-shadow: var(--shadow);
}

.kpi-card span {
  display: block;
  color: var(--text-muted);
  font-size: 0.74rem;
}

.kpi-card strong {
  display: block;
  margin-top: 0.08rem;
  font-size: 1.05rem;
  line-height: 1;
}

.alert {
  border-radius: 10px;
  padding: 0.72rem 0.82rem;
  margin-bottom: 0.6rem;
  font-size: 0.94rem;
}

.alert-error {
  background: #fef3f2;
  color: var(--danger);
  border: 1px solid #fecdca;
}

.alert-danger {
  background: #fef3f2;
  color: var(--danger);
  border: 1px solid #fecdca;
}

.alert-success {
  background: #ecfdf3;
  color: #067647;
  border: 1px solid #abefc6;
}

.alert-info {
  background: #eff8ff;
  color: #175cd3;
  border: 1px solid #b2ddff;
}

@media (max-width: 760px) {
  .page-head {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-compact {
    width: 100%;
    max-width: none;
  }

  .form-actions .btn-primary,
  .form-actions .btn-secondary,
  .actions-row .btn-secondary,
  .actions-row .btn-primary,
  .actions-row .btn-danger-soft,
  .actions-row .btn-muted-soft {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .main-content {
    padding-top: 0.58rem;
    padding-bottom: 4.7rem;
  }

  .card {
    padding: 0.68rem 0.72rem;
    border-radius: 10px;
  }

  .search-row {
    grid-template-columns: 1fr;
  }

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

  .filter-row {
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 0.15rem;
  }

  .filter-pill {
    font-size: 0.77rem;
    padding: 0.25rem 0.55rem;
  }

  .quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
  }

  .quick-actions form {
    flex: 0 1 auto;
  }

  .btn-quick {
    min-height: 32px;
    padding: 0.32rem 0.5rem;
    font-size: 0.76rem;
  }
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 90;
  background: #ffffff;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  box-shadow: 0 -4px 14px rgba(15, 23, 42, 0.07);
}

.bottom-nav.bottom-nav--5 {
  grid-template-columns: repeat(5, 1fr);
}

.bottom-nav a {
  text-align: center;
  text-decoration: none;
  color: #475569;
  padding: 0.72rem 0.22rem 0.6rem;
  font-size: 17px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.18;
  min-height: 3.35rem;
}

.bottom-nav a span {
  font-size: 17px;
}

.bottom-nav a.nav-new {
  color: var(--primary);
}

@media (min-width: 769px) {
  .desktop-nav {
    display: flex;
  }

  .logout-link {
    display: none;
  }

  .bottom-nav {
    display: none;
  }

  .main-content {
    padding-bottom: 1.2rem;
  }

  .desktop-nav .nav-desktop-label--short {
    display: none;
  }
}

@media (min-width: 769px) and (max-width: 1180px) {
  .desktop-nav .nav-desktop-label--full {
    display: none;
  }

  .desktop-nav .nav-desktop-label--short {
    display: inline;
  }
}

@media (max-width: 768px) {
  .brand {
    white-space: normal;
    font-size: 0.92rem;
    line-height: 1.25;
    padding: 8px 0;
  }

  .desktop-nav {
    display: none;
  }

  .logout-link {
    display: inline-block;
  }

  .bottom-nav {
    display: grid;
  }
}

/* —— Pulido SaaS: tipografía, tablas, listas y ficha —— */

.page-title {
  margin: 0 0 0.2rem;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.page-subtitle {
  margin: 0;
  font-size: 0.88rem;
}

.page-toolbar,
.dashboard-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem;
  margin-bottom: 0.82rem;
}

.toolbar-text {
  flex: 1 1 220px;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: flex-end;
}

.btn-toolbar {
  align-self: center;
}

.card-pad {
  padding: 0.95rem 1rem;
}

.card-soft {
  background: #fafbff;
  border-style: dashed;
}

.section-title {
  margin: 0 0 0.35rem;
  font-size: 1.02rem;
  font-weight: 700;
}

.section-head {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-bottom: 0.7rem;
}

.small-print {
  font-size: 0.8rem;
  line-height: 1.35;
}

.empty-hint {
  margin: 0.35rem 0 0;
  color: #475569;
  font-size: 0.9rem;
}

.field-errors {
  margin: 0.15rem 0 0;
  padding-left: 1.1rem;
  color: var(--danger);
  font-size: 0.82rem;
}

.field-hint {
  margin: -0.15rem 0 0.25rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.input-lg {
  min-height: 44px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

@media (min-width: 720px) {
  .kpi-grid-5 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .kpi-grid-5 {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

.kpi-card-accent {
  border-color: #c7d7ff;
  background: linear-gradient(145deg, #ffffff, #f4f8ff);
}

.kpi-card-warn {
  border-color: #f6d98f;
  background: linear-gradient(145deg, #ffffff, #fffdf6);
}

.kpi-card-success {
  border-color: #b8ebca;
  background: linear-gradient(145deg, #ffffff, #f4fdf8);
}

.kpi-subtitle {
  margin: -0.35rem 0 0.4rem;
  font-size: 0.78rem;
}

.kpi-follow {
  margin-bottom: 0.65rem;
}

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

@media (min-width: 720px) {
  .kpi-grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

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

@media (min-width: 640px) {
  .kpi-grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.kpi-card-danger-soft {
  border-color: #f5c4c0;
  background: linear-gradient(145deg, #ffffff, #fff8f7);
}

.kpi-card-info-soft {
  border-color: #c5d8f0;
  background: linear-gradient(145deg, #ffffff, #f6f9ff);
}

.card-priority-block {
  border-color: #e2e8f0;
  margin-bottom: 0.78rem;
}

.active-filters-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.65rem;
  margin: 0 0 0.6rem;
  padding: 0.48rem 0.72rem;
  font-size: 0.8rem;
  line-height: 1.35;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.active-filters-label {
  font-weight: 700;
  color: var(--text-muted);
}

.active-filters-text {
  color: var(--text);
  flex: 1 1 160px;
}

.link-clear-filters {
  font-weight: 650;
  font-size: 0.78rem;
  color: var(--primary);
  text-decoration: none;
  white-space: nowrap;
}

.link-clear-filters:hover {
  text-decoration: underline;
  color: var(--primary-dark);
}

.empty-clientes-state .empty-state-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.55rem;
}

.seg-urgencia-banner {
  margin: 0.2rem 0 0.4rem;
  padding: 0.3rem 0.48rem;
  font-size: 0.74rem;
  font-weight: 700;
  border-radius: 6px;
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #e2e8f0;
}

.seg-card-vencida .seg-urgencia-banner {
  background: #fef2f2;
  color: #7f1d1d;
  border-color: #fecaca;
}

.seg-card-hoy .seg-urgencia-banner {
  background: #fffbeb;
  color: #92400e;
  border-color: #fde68a;
}

.seg-proxima-bloque {
  margin: 0.35rem 0 0.55rem;
  padding: 0.48rem 0.62rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
}

.seg-proxima-bloque--vencida {
  border-color: #f0b4ae;
  background: #fffafa;
}

.seg-proxima-bloque--hoy {
  border-color: #f6de9a;
  background: #fffef7;
}

.seg-proxima-line-main {
  margin: 0;
  font-size: 0.86rem;
}

.seg-proxima-label {
  font-weight: 700;
  color: #475569;
  margin-right: 0.35rem;
}

.seg-proxima-fecha-val {
  font-weight: 650;
  color: var(--text);
}

.seg-proxima-texto-block {
  margin: 0.4rem 0 0;
  font-size: 0.9rem;
  line-height: 1.38;
  color: var(--text);
}

.seg-proxima-muted {
  margin: 0.1rem 0 0.2rem;
}

.crm-bars {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: 0.45rem;
}

.crm-bar-row {
  display: grid;
  gap: 0.25rem;
}

.crm-bar-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.crm-bar-count {
  font-weight: 700;
  font-size: 0.85rem;
  color: #334155;
}

.crm-bar-track {
  height: 8px;
  border-radius: 999px;
  background: #e8edf5;
  overflow: hidden;
}

.crm-bar-fill {
  height: 100%;
  border-radius: 999px;
  min-width: 2px;
  transition: width 0.25s ease;
}

.crm-bar-fill.estado-crm-activo {
  background: #22c55e;
}
.crm-bar-fill.estado-crm-pendiente_contacto {
  background: #f59e0b;
}
.crm-bar-fill.estado-crm-interesado {
  background: #3b82f6;
}
.crm-bar-fill.estado-crm-no_interesado {
  background: #ef4444;
}
.crm-bar-fill.estado-crm-cliente_conseguido {
  background: #0d9488;
}

.dashboard-list {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

.dashboard-list-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid #eef2f7;
}

.dashboard-list-item:last-child {
  border-bottom: none;
}

.dl-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.55rem;
  flex: 1 1 200px;
}

.dl-date {
  font-size: 0.78rem;
  font-weight: 700;
  color: #475569;
  min-width: 7.2rem;
}

.dl-cliente {
  font-weight: 650;
  font-size: 0.88rem;
}

.dl-cliente a {
  color: #0f172a;
  text-decoration: none;
}

.dl-cliente a:hover {
  color: var(--primary);
}

.dl-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
  flex: 1 1 140px;
}

.btn-tiny {
  padding: 0.32rem 0.55rem;
  font-size: 0.78rem;
  border-radius: 8px;
}

.filter-label-inline {
  margin: 0 0 0.25rem;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-muted);
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 0.75rem;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.86rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.data-table thead th {
  text-align: left;
  background: #f8fafc;
  color: #475569;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--border);
}

.data-table tbody td {
  padding: 0.58rem 0.65rem;
  border-bottom: 1px solid #eef2f7;
  vertical-align: top;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.th-actions,
.td-actions {
  text-align: right;
  white-space: nowrap;
}

.table-link {
  color: #0f172a;
  font-weight: 650;
  text-decoration: none;
}

.table-link:hover {
  color: var(--primary);
}

.table-link-muted {
  color: #334155;
  text-decoration: none;
  word-break: break-word;
}

.table-link-muted:hover {
  color: var(--primary);
  text-decoration: underline;
}

.table-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  justify-content: flex-end;
}

.cell-wrap {
  display: block;
  max-width: 280px;
}

.muted-xs {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.cliente-hero {
  margin-bottom: 0.85rem;
}

.cliente-hero-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.eyebrow {
  margin: 0 0 0.15rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.hero-empresa {
  margin: 0.1rem 0 0.35rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #334155;
}

.hero-badges {
  margin: 0;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: flex-end;
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px solid #eef2f7;
}

.contact-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.contact-value {
  margin: 0.15rem 0 0;
  font-size: 0.9rem;
  font-weight: 600;
}

.contact-value a {
  color: var(--primary);
  text-decoration: none;
}

.contact-value a:hover {
  text-decoration: underline;
}

.seguimiento-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.seguimiento-panel {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.72rem 0.78rem;
  background: #fbfcfe;
}

.seguimiento-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.seguimiento-panel-vencida {
  border-color: #e8a8a3;
  background: linear-gradient(145deg, #fffdfd, #fff5f5);
}

.seguimiento-panel-hoy {
  border-color: #e8d48a;
  background: linear-gradient(145deg, #ffffff, #fffdf4);
}

.seg-accion-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.15rem 0 0.35rem;
}

.seg-accion-badges-panel {
  margin-top: 0;
  margin-bottom: 0.4rem;
}

.seg-proxima-line {
  margin: 0.15rem 0 0.35rem;
}

.seg-proxima-texto,
.seg-proxima-texto-inline {
  display: block;
  margin-top: 0.15rem;
  color: var(--text);
  font-size: 0.86rem;
}

.seg-proxima-texto-inline {
  display: inline;
  margin-left: 0.35rem;
}

.seg-proxima-fecha {
  font-weight: 600;
  color: #334155;
}

.seg-card-vencida {
  border-color: #e8a8a3;
}

.seg-card-hoy {
  border-color: #e8d48a;
}

.badge-prioridad,
.badge-vencimiento {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.12rem 0.4rem;
  border-radius: 6px;
  line-height: 1.2;
  border: 1px solid transparent;
}

.badge-prioridad-baja {
  color: #475569;
  background: #f1f5f9;
  border-color: #e2e8f0;
}

.badge-prioridad-normal {
  color: #334155;
  background: #f8fafc;
  border-color: #e2e8f0;
}

.badge-prioridad-alta {
  color: #9a3412;
  background: #fff7ed;
  border-color: #fed7aa;
}

.badge-prioridad-urgente {
  color: #7f1d1d;
  background: #fef2f2;
  border-color: #fecaca;
}

.badge-vencimiento-vencida {
  color: #7f1d1d;
  background: #fef2f2;
  border-color: #f87171;
}

.badge-vencimiento-hoy {
  color: #92400e;
  background: #fffbeb;
  border-color: #fcd34d;
}

.badge-vencimiento-proximos_7 {
  color: #1e40af;
  background: #eff6ff;
  border-color: #bfdbfe;
}

.badge-vencimiento-sin_fecha {
  color: #64748b;
  background: #f8fafc;
  border-color: #e2e8f0;
}

.cell-badges-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.25rem;
}

.td-proxima {
  max-width: 14rem;
}

.cell-proxima-fecha {
  font-weight: 650;
  font-size: 0.84rem;
}

.td-proxima-texto {
  margin: 0.2rem 0 0;
  font-size: 0.78rem;
}

.actions-row-seg {
  margin-top: 0.45rem;
}

/* Dashboard: zonas con fondo diferenciado y títulos claros */
.card.card-dash-zone {
  margin-bottom: 1.1rem;
  padding: 1rem 1.05rem;
}

.card-dash-urgent {
  background: linear-gradient(180deg, #fff5f5 0%, #fefbfb 100%);
  border-color: #f8d7d8;
}

.card-dash-today {
  background: linear-gradient(180deg, #fffbeb 0%, #fffdf5 100%);
  border-color: #f5e0a4;
}

.card-dash-upcoming {
  background: #f8fafc;
  border-color: #e6edf5;
}

.block-title-zone {
  margin: 0 0 0.72rem;
  padding-bottom: 0.55rem;
  font-size: 1.06rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  color: #0f172a;
}

.zone-empty-hint {
  margin: 0;
  padding: 0.4rem 0 0;
  font-size: 0.87rem;
  color: var(--text-muted);
}

/* Tarjetas seguimiento — tarjeta clicable, borde izquierdo por estado */
.seg-card {
  position: relative;
  border-left: 4px solid #e5e7eb;
  padding: 14px;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
}

.seg-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.08);
}

.seg-card.urgente {
  border-left-color: #ef4444;
}

.seg-card.hoy {
  border-left-color: #f59e0b;
}

.seg-card.normal {
  border-left-color: #e5e7eb;
}

.seg-card-hitarea {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: 10px;
}

.seg-card-hitarea:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 3px;
}

.seg-card-body {
  position: relative;
  z-index: 2;
  pointer-events: none;
  flex: 1 1 200px;
  min-width: 0;
}

.seg-card-actions {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  pointer-events: auto;
}

.simple-seg-ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.simple-seg-li.seg-card {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.85rem;
  margin-bottom: 0;
}

.card-dash-zone .simple-seg-li.seg-card {
  background: #fff;
}

.seg-card-client {
  display: block;
  margin-bottom: 0.32rem;
  font-size: 1.06rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
}

.seg-card-txt {
  margin: 0 0 0.38rem;
  font-size: 0.88rem;
  font-weight: 450;
  color: #586174;
  line-height: 1.45;
}

.simple-seg-estado-line {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.simple-seg-estado-line.seg-card-meta-line {
  margin-top: 0.1rem;
}

.simple-seg-estado {
  display: inline-flex;
  font-size: 0.74rem;
  font-weight: 650;
  padding: 0.16rem 0.5rem;
  border-radius: 999px;
}

.simple-seg-estado--urgente {
  color: #9f1239;
  background: rgba(251, 113, 133, 0.2);
}

.simple-seg-estado--hoy {
  color: #92400e;
  background: rgba(252, 211, 77, 0.32);
}

.simple-seg-estado--proxima {
  color: #1e40af;
  background: rgba(191, 219, 254, 0.55);
}

.simple-seg-estado--sinfecha {
  color: #64748b;
  background: #eef2f6;
}

.simple-seg-form {
  margin: 0;
}

.btn-hecho {
  background: #2563eb;
  color: #fff;
  border-radius: 8px;
  padding: 6px 12px;
  border: none;
  font-weight: 600;
  cursor: pointer;
}

.btn-hecho:hover {
  background: #1d4ed8;
  color: #fff;
}

.btn-hecho.is-loading,
.btn-tiny.btn-hecho.is-loading {
  opacity: 0.88;
  cursor: wait;
}

.btn-ver {
  display: inline-flex;
  align-items: center;
  background: transparent;
  color: #6b7280;
  border: none;
  text-decoration: none;
  cursor: pointer;
  font-weight: 600;
  padding: 6px 4px;
  border-radius: 6px;
  font-size: 0.8rem;
}

.btn-ver:hover {
  color: #374151;
  text-decoration: underline;
}

.btn-ver:focus-visible {
  outline: 2px solid #cbd5e1;
  outline-offset: 2px;
}

.btn-tiny.btn-hecho {
  padding: 6px 12px;
}

.btn-tiny.btn-ver {
  padding: 6px 8px;
}

/* Clientes: fila clicable (misma celda táctil seg-card) */
.clientes-simple-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.clientes-simple-item.cliente-card.seg-card {
  display: block;
  margin-bottom: 0;
}

.seg-card-sub,
.cliente-simple-sub {
  margin: 0;
  font-size: 0.86rem;
  color: #6b7380;
  line-height: 1.42;
}

.empty-inline {
  margin: 0;
  font-size: 0.84rem;
}

.filter-row-tight {
  margin-top: 0.55rem;
  padding-top: 0.55rem;
  border-top: 1px solid #eef2f7;
}

.clientes-simple-table .td-prox-solo {
  max-width: 18rem;
}

.td-prox-solo-fecha {
  font-weight: 650;
  font-size: 0.84rem;
}

.td-prox-solo-texto {
  display: block;
  margin-top: 0.18rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.cliente-hero-min {
  padding: 0.78rem 0.85rem;
}

.hero-actions-compact .btn-muted-soft {
  padding: 0.32rem 0.65rem;
  font-size: 0.8rem;
}

.contact-grid-min {
  padding-top: 0.55rem;
}

.section-title-min {
  margin: 0 0 0.55rem;
  font-size: 1rem;
  font-weight: 700;
}

.seguimiento-panel-min.seg-card {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.85rem;
}

.seguimiento-panel-min.seg-card .seg-card-txt:last-of-type {
  margin-bottom: 0;
}

.seg-min-meta {
  margin: 0;
  font-size: 0.76rem;
}

.seg-min-estado-line {
  margin: 0.12rem 0 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.42rem;
}

.seg-min-estado-line.seg-card-meta-line {
  margin-top: 0.1rem;
}

.seg-min-estado {
  display: inline-flex;
  font-size: 0.74rem;
  font-weight: 650;
  padding: 0.16rem 0.5rem;
  border-radius: 999px;
}

.seg-min-estado--urg {
  color: #9f1239;
  background: rgba(251, 113, 133, 0.2);
}

.seg-min-estado--hoy {
  color: #92400e;
  background: rgba(252, 211, 77, 0.32);
}

.seg-min-estado--prox {
  color: #1e40af;
  background: rgba(191, 219, 254, 0.55);
}

.seg-min-estado--sf {
  color: #64748b;
  background: #eef2f6;
}

.seg-min-fecha-hint {
  font-size: 0.74rem;
  color: #7c879b;
  font-weight: 500;
}

.muted-compact {
  margin: -0.1rem 0 0.4rem;
  font-size: 0.82rem;
}

.form-delete-seg {
  margin-top: 0.85rem;
  padding-top: 0.65rem;
  border-top: 1px dashed #e2e8f0;
}

.form-delete-inline {
  margin-top: 0.45rem;
}

.danger-lead {
  color: #7f1d1d;
}

@media (max-width: 720px) {
  .data-table thead {
    display: none;
  }

  .data-table tbody tr {
    display: block;
    border-bottom: 1px solid #eef2f7;
    padding: 0.55rem 0.45rem;
  }

  .data-table tbody tr:last-child {
    border-bottom: none;
  }

  .data-table tbody td {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    border: none;
    padding: 0.35rem 0.25rem;
    font-size: 0.88rem;
  }

  .data-table tbody td::before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--text-muted);
    flex: 0 0 42%;
  }

  .td-actions {
    display: block;
  }

  .td-actions::before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--text-muted);
    display: block;
    margin-bottom: 0.35rem;
  }

  .table-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .th-actions {
    display: none;
  }
}

/* Modal: nuevo seguimiento (FAB, iframe) */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px)
    env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}

.modal.hidden {
  display: none;
}

.modal-box {
  width: 90%;
  max-width: 500px;
  height: 80%;
  max-height: calc(100vh - 32px - env(safe-area-inset-bottom, 0px));
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
}

.modal-box iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* Nuevo seguimiento en iframe (sin layout app) */
.seg-form-embed-body {
  margin: 0;
  padding: 0.75rem 0.85rem 1rem;
  background: var(--bg);
  min-height: 100vh;
  box-sizing: border-box;
}

.seg-form-embed-shell {
  max-width: 480px;
  margin: 0 auto;
}

.seg-form-embed-title {
  font-size: 1.15rem;
  margin: 0 0 0.65rem;
}

.seg-form-embed-alerts {
  margin-bottom: 0.65rem;
}

.seg-form-embed-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem 0.8rem 0.85rem;
  box-shadow: var(--shadow);
}

/* FAB: acceso rápido a nuevo seguimiento */
.fab-btn {
  position: fixed;
  bottom: 80px;
  right: 16px;
  width: 56px;
  height: 56px;
  background: #2563eb;
  color: #fff;
  font-size: 28px;
  font-weight: bold;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
  z-index: 9999;
  transition: transform 0.15s ease;
}

.fab-btn:hover {
  transform: scale(1.05);
}

@media (max-width: 768px) {
  .fab-btn {
    bottom: calc(var(--bottom-nav-height) + 20px);
  }
}

/* Toast discreto (errores cliente, ej. AJAX marcar hecho) */
.toast-msg {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #111827;
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  opacity: 0;
  transition: all 0.2s ease;
  z-index: 9999;
  pointer-events: none;
}

.toast-msg.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 768px) {
  .toast-msg {
    bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px));
  }
}
