/* ============================================================================
   CRM Surfside — estilos de la aplicación
   ============================================================================ */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--fs-base);
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; margin: 0; line-height: 1.2; }
h1 { font-size: var(--fs-xl); letter-spacing: -.02em; }
h2 { font-size: var(--fs-lg); letter-spacing: -.01em; }
h3 { font-size: var(--fs-md); }
p  { margin: 0; }
a  { color: inherit; text-decoration: none; }

button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

::selection { background: var(--accent-soft); color: var(--text); }

/* Barras de desplazamiento discretas */
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--r-full); border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: content-box; }

/* Tamaño base de los iconos SVG. Sin esto, un icono fuera de un botón o del menú
   se estira al tamaño por defecto de un SVG sin dimensiones (300x150). */
.icon { width: 16px; height: 16px; flex: 0 0 auto; }

/* ── Utilidades ───────────────────────────────────────────────────────────── */
.u-muted    { color: var(--muted); }
.u-sm       { font-size: var(--fs-sm); }
.u-xs       { font-size: var(--fs-xs); }
.u-mono     { font-variant-numeric: tabular-nums; }
.u-right    { text-align: right; }
.u-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.u-row      { display: flex; align-items: center; gap: var(--sp-2); }
.u-spread   { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.u-stack    { display: flex; flex-direction: column; gap: var(--sp-2); }

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

.gradient-text {
  background: var(--brand-grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

/* ============================================================================
   LAYOUT
   ============================================================================ */

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ── Barra lateral ────────────────────────────────────────────────────────── */
.sidebar {
  display: flex; flex-direction: column;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  position: sticky; top: 0;
  height: 100vh; height: 100dvh;
  padding: var(--sp-4) var(--sp-3);
  gap: var(--sp-4);
}

.brand { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-1) var(--sp-2); }
.brand__mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--brand-grad);
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 15px; color: #fff;
  flex: 0 0 auto;
}
.brand__name { font-family: var(--font-display); font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.brand__sub  { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-top: -3px; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav__group-label {
  font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); padding: var(--sp-4) var(--sp-2) var(--sp-1);
}
.nav__item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px var(--sp-2);
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-size: var(--fs-base); font-weight: 500;
  transition: background var(--t-fast), color var(--t-fast);
  cursor: pointer; border: 0; background: none; width: 100%; text-align: left;
}
.nav__item:hover { background: var(--surface-2); color: var(--text); }
.nav__item.is-active { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.nav__item.is-active .icon { color: var(--accent); }
.nav__item .icon { width: 17px; height: 17px; flex: 0 0 auto; color: var(--muted); }
.nav__badge {
  margin-left: auto; font-size: 10px; font-weight: 700;
  background: var(--danger); color: #fff;
  padding: 1px 6px; border-radius: var(--r-full); min-width: 18px; text-align: center;
}

.sidebar__footer { border-top: 1px solid var(--border); padding-top: var(--sp-3); }

/* ── Zona principal ───────────────────────────────────────────────────────── */
.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: var(--header-h);
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 0 var(--sp-5);
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(10px);
  position: sticky; top: 0; z-index: 20;
}
.topbar__title { font-family: var(--font-display); font-weight: 600; font-size: var(--fs-md); }

.content { padding: var(--sp-5); flex: 1; max-width: 1500px; width: 100%; }

/* ── Búsqueda global ──────────────────────────────────────────────────────── */
.search { position: relative; margin-left: auto; width: min(340px, 40vw); }
.search__input {
  width: 100%; padding: 7px 12px 7px 32px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); font-size: var(--fs-sm);
  transition: border-color var(--t-fast), background var(--t-fast);
}
.search__input::placeholder { color: var(--muted); }
.search__input:focus { outline: none; border-color: var(--accent-border); background: var(--surface); }
.search__icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: var(--muted); pointer-events: none; }
.search__kbd {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-size: 10px; color: var(--muted); border: 1px solid var(--border);
  border-radius: 4px; padding: 1px 5px; background: var(--surface);
}

/* ============================================================================
   COMPONENTES
   ============================================================================ */

/* ── Botones ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 14px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-size: var(--fs-sm); font-weight: 500;
  cursor: pointer; white-space: nowrap;
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast), opacity var(--t-fast);
}
.btn:hover  { background: var(--surface-2); border-color: var(--accent-border); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.btn--primary {
  background: var(--accent); border-color: transparent; color: var(--on-accent); font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.btn--primary:hover { background: var(--accent-hover); border-color: transparent; }
.btn--ghost { background: none; border-color: transparent; color: var(--muted); }
.btn--ghost:hover { background: var(--surface-2); color: var(--text); }
.btn--danger { color: var(--danger); border-color: transparent; background: none; }
.btn--danger:hover { background: color-mix(in srgb, var(--danger) 12%, transparent); }
.btn--sm { padding: 5px 10px; font-size: var(--fs-xs); }
.btn--icon { padding: 7px; width: 32px; height: 32px; }
.btn .icon { width: 15px; height: 15px; }

/* ── Tarjetas ─────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.card__head {
  padding: var(--sp-4) var(--sp-4) var(--sp-3);
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  border-bottom: 1px solid var(--border-soft);
}
.card__title {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-display); font-size: var(--fs-md); font-weight: 600;
}
.card__title .icon { width: 17px; height: 17px; color: var(--accent); }
/* Enlace «Ver todos» de la cabecera: con flecha para que se vea que lleva a otra pantalla */
.card__link {
  font-size: var(--fs-sm); font-weight: 600; color: var(--accent);
  padding: 4px 6px; border-radius: var(--r-sm); white-space: nowrap;
}
.card__link::after { content: ' →'; }
.card__link:hover { background: var(--accent-soft); }
.card__body { padding: var(--sp-4); }
.card__body--flush { padding: 0; }

/* ── Cifras del dashboard ─────────────────────────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: var(--sp-3); }
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: var(--sp-4);
  position: relative; overflow: hidden;
}
.stat::after {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 2px;
  background: var(--accent); opacity: .7;
}
.stat__label { font-size: var(--fs-xs); color: var(--muted); text-transform: uppercase; letter-spacing: .07em; font-weight: 600; }
.stat__value { font-family: var(--font-display); font-size: var(--fs-2xl); font-weight: 700; letter-spacing: -.02em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat__hint  { font-size: var(--fs-xs); color: var(--muted); margin-top: 2px; }
.stat--danger::after { background: var(--danger); }
.stat--danger .stat__value { color: var(--danger); }

/* ── Etiquetas de estado ──────────────────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: var(--r-full);
  font-size: var(--fs-xs); font-weight: 600; line-height: 1.6; white-space: nowrap;
  background: var(--surface-2); color: var(--text-2);
  border: 1px solid var(--border);
}
.chip--ok     { background: color-mix(in srgb, var(--ok) 14%, transparent);     color: var(--ok);     border-color: transparent; }
.chip--warn   { background: color-mix(in srgb, var(--warn) 16%, transparent);   color: var(--warn);   border-color: transparent; }
.chip--danger { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); border-color: transparent; }
.chip--info   { background: color-mix(in srgb, var(--info) 14%, transparent);   color: var(--info);   border-color: transparent; }
.chip--accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.chip__dot    { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ── Tablas ───────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th {
  text-align: left; font-weight: 600; font-size: var(--fs-xs);
  text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
  padding: var(--sp-2) var(--sp-4); border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td { padding: 11px var(--sp-4); border-bottom: 1px solid var(--border-soft); }
.table tbody tr { transition: background var(--t-fast); }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table--clickable tbody tr { cursor: pointer; }

/*
 * Listados en el móvil: cada fila pasa a ser una ficha (nombre y estado arriba, el
 * resto en una línea debajo) en vez de una tabla que obliga a desplazarse de lado.
 * `stack-end` marca la celda que va arriba a la derecha y `hide-sm` las que sobran.
 */
@media (max-width: 640px) {
  .table--stack thead { display: none; }
  .table--stack, .table--stack tbody { display: block; }
  .table--stack tr {
    display: flex; flex-wrap: wrap; align-items: center; gap: 3px 10px;
    padding: 12px var(--sp-4); border-bottom: 1px solid var(--border-soft);
  }
  .table--stack tbody tr:last-child { border-bottom: 0; }
  .table--stack td { display: block; padding: 0; border: 0; text-align: left; color: var(--muted); font-size: var(--fs-xs); }
  .table--stack td:first-child { flex: 1 1 0; min-width: 0; order: 0; color: var(--text); font-size: var(--fs-base); }
  .table--stack td.stack-end { order: 1; flex: 0 0 auto; }
  /* Salto de línea entre la cabecera de la ficha y los datos */
  .table--stack tr::after { content: ''; order: 1; flex-basis: 100%; height: 0; }
  .table--stack td:not(:first-child):not(.stack-end) { order: 2; }
  .table--stack td.hide-sm { display: none; }
}

/* ── Formularios ──────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 5px; }
.field__label { font-size: var(--fs-sm); font-weight: 500; color: var(--text-2); }
.input, .select, .textarea {
  width: 100%; padding: 9px 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-sm); font-size: var(--fs-base);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input[aria-invalid="true"] { border-color: var(--danger); }
.textarea { resize: vertical; min-height: 84px; }
.field__error { font-size: var(--fs-xs); color: var(--danger); }

/* ── Estados vacíos y de carga ────────────────────────────────────────────── */
.empty { text-align: center; padding: var(--sp-7) var(--sp-4); color: var(--muted); }
.empty__icon { width: 38px; height: 38px; margin: 0 auto var(--sp-3); opacity: .35; }
.empty__title { font-family: var(--font-display); font-weight: 600; color: var(--text-2); margin-bottom: 4px; }

.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite linear;
  border-radius: var(--r-sm);
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ── Avisos ───────────────────────────────────────────────────────────────── */
.toasts {
  position: fixed; bottom: var(--sp-5); right: var(--sp-5);
  display: flex; flex-direction: column; gap: var(--sp-2);
  z-index: 100; pointer-events: none;
}
.toast {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-md); box-shadow: var(--shadow-lg);
  padding: var(--sp-3) var(--sp-4); font-size: var(--fs-sm);
  max-width: 340px; pointer-events: auto;
  animation: toast-in 240ms var(--ease);
}
.toast--error { border-left-color: var(--danger); }
.toast--ok    { border-left-color: var(--ok); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(.97); } }

/* ── Navegación inferior, sólo en móvil ───────────────────────────────────── */
.bottomnav { display: none; }

/* ============================================================================
   MÓVIL — no es una versión reducida: cambia la navegación entera
   ============================================================================ */
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .content { padding: var(--sp-4) var(--sp-3); padding-bottom: 86px; }
  .topbar { padding: 0 var(--sp-3); }
  .search { width: 100%; }
  .search__kbd { display: none; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat__value { font-size: var(--fs-xl); }

  .bottomnav {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
    background: color-mix(in srgb, var(--bg-2) 92%, transparent);
    backdrop-filter: blur(14px) saturate(1.6);
    border-top: 1px solid var(--border);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .bottomnav__item {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 6px 2px; border: 0; background: none; cursor: pointer;
    color: var(--muted); font-size: 11px; font-weight: 600;
    border-radius: var(--r-sm);
    min-height: 44px;                    /* objetivo táctil cómodo */
    transition: color var(--t-fast);
  }
  .bottomnav__item .icon { width: 20px; height: 20px; }
  .bottomnav__item.is-active { color: var(--accent); }
}

@media (max-width: 420px) {
  .stats { grid-template-columns: 1fr; }
}

/* Respeta a quien pide menos movimiento */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ── Rejilla de bloques del dashboard ─────────────────────────────────────── */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: var(--sp-4);
  align-items: start;
}
@media (max-width: 860px) {
  .dash-grid { grid-template-columns: 1fr; }
}

/* ============================================================================
   PANEL LATERAL (drawer)
   ============================================================================ */
.drawer {
  position: fixed; inset: 0; z-index: 60;
  background: var(--overlay);
  opacity: 0; transition: opacity 200ms var(--ease);
  display: flex; justify-content: flex-end;
}
.drawer.is-open { opacity: 1; }

.drawer__panel {
  --drawer-w: 520px;
  width: min(var(--drawer-w), 100vw);
  background: var(--bg);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  transform: translateX(24px);
  transition: transform 240ms var(--ease);
  height: 100%;
}
.drawer.is-open .drawer__panel { transform: none; }

.drawer__head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--bg); z-index: 2;
}
.drawer__title { font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 600; }
.drawer__body  { padding: var(--sp-5); overflow-y: auto; flex: 1; }
.drawer__footer {
  padding: var(--sp-3) var(--sp-5);
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: var(--sp-2);
  background: var(--bg-2);
}
.drawer__danger { background: var(--danger); box-shadow: none; }

@media (max-width: 640px) {
  /* En móvil el panel sube desde abajo, así que el contenedor pasa a columna:
     `justify-content: stretch` no es un valor válido en fila y no anclaba nada. */
  .drawer { flex-direction: column; justify-content: flex-end; align-items: stretch; }
  .drawer__panel {
    width: 100%; max-height: 92dvh; height: auto;
    border-left: 0; border-top: 1px solid var(--border);
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    transform: translateY(28px);
  }
  .drawer__body { padding: var(--sp-4); }
  .drawer__head { padding: var(--sp-4); }
}

/* ── Rejilla de formulario ────────────────────────────────────────────────── */
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
@media (max-width: 520px) { .field-grid { grid-template-columns: 1fr; } }

.form-section {
  font-size: var(--fs-xs); font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted); grid-column: 1 / -1;
  padding-top: var(--sp-3); margin-top: var(--sp-2);
  border-top: 1px solid var(--border-soft);
}
.form-section:first-child { border-top: 0; padding-top: 0; margin-top: 0; }

/* ============================================================================
   KANBAN
   ============================================================================ */
.board {
  display: flex; gap: var(--sp-3);
  overflow-x: auto; overflow-y: hidden;
  padding-bottom: var(--sp-3);
  align-items: flex-start;
  scroll-snap-type: x proximity;
}

.column {
  flex: 0 0 288px; width: 288px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  display: flex; flex-direction: column;
  max-height: calc(100dvh - var(--header-h) - 100px);
  scroll-snap-align: start;
  transition: background var(--t-fast), border-color var(--t-fast);
}
/* Columna resaltada mientras se arrastra una tarjeta encima */
.column.is-dropzone { background: var(--accent-soft); border-color: var(--accent-border); }

.column__head { padding: var(--sp-3) var(--sp-3) var(--sp-2); }
.column__title { display: flex; align-items: center; gap: 7px; font-size: var(--fs-sm); font-weight: 600; }
.column__dot   { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.column__count {
  margin-left: auto; font-size: var(--fs-xs); color: var(--muted);
  background: var(--surface-2); padding: 1px 7px; border-radius: var(--r-full);
}
.column__sum { font-size: var(--fs-xs); color: var(--muted); margin-top: 3px; font-variant-numeric: tabular-nums; }

.column__list {
  padding: var(--sp-2) var(--sp-3) var(--sp-3);
  display: flex; flex-direction: column; gap: var(--sp-2);
  overflow-y: auto; flex: 1; min-height: 60px;
}

.deal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-3);
  cursor: grab;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast), opacity var(--t-fast);
  position: relative;
}
.deal-card:hover { border-color: var(--accent-border); box-shadow: var(--shadow-md); }
.deal-card:active { cursor: grabbing; }
.deal-card.is-dragging { opacity: .38; transform: scale(.97); }
/* Parada demasiado tiempo: lo dice la etiqueta «N días sin tocar», sin pintar la tarjeta entera */

.deal-card__title   { font-size: var(--fs-sm); font-weight: 600; line-height: 1.35; margin-bottom: 3px; }
.deal-card__company { font-size: var(--fs-xs); color: var(--muted); margin-bottom: var(--sp-2); }
.deal-card__foot    { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.deal-card__value   { font-size: var(--fs-sm); font-weight: 600; font-variant-numeric: tabular-nums; }
.deal-card__stale { margin-top: var(--sp-2); }
.deal-card__stale .icon { width: 12px; height: 12px; }
.deal-card__next {
  font-size: var(--fs-xs); color: var(--text-2);
  margin-top: var(--sp-2); padding-top: var(--sp-2);
  border-top: 1px dashed var(--border);
  display: flex; align-items: center; gap: 5px;
}

/* Marcador de hueco durante el arrastre */
.drop-marker {
  height: 2px; background: var(--accent); border-radius: 2px;
  margin: -3px 0; box-shadow: 0 0 8px var(--accent);
}

/* ============================================================================
   PESTAÑAS
   ============================================================================ */
.tabs {
  display: flex; gap: 2px; overflow-x: auto;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-4);
}
.tab {
  padding: 9px var(--sp-3);
  border: 0; background: none; cursor: pointer;
  color: var(--muted); font-size: var(--fs-sm); font-weight: 500;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.tab__count {
  margin-left: 5px; font-size: 10px; color: var(--muted);
  background: var(--surface-2); padding: 1px 5px; border-radius: var(--r-full);
}

/* ============================================================================
   TIMELINE
   ============================================================================ */
.timeline { display: flex; flex-direction: column; gap: 0; position: relative; }
.timeline__item { display: flex; gap: var(--sp-3); padding-bottom: var(--sp-4); position: relative; }
/* Línea vertical que une los puntos */
.timeline__item:not(:last-child)::before {
  content: ''; position: absolute; left: 11px; top: 26px; bottom: 0;
  width: 1px; background: var(--border);
}
.timeline__dot {
  width: 23px; height: 23px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--border);
  display: grid; place-items: center; flex: 0 0 auto; z-index: 1;
}
.timeline__dot .icon { width: 12px; height: 12px; color: var(--muted); }
.timeline__dot--accent { background: var(--accent-soft); border-color: var(--accent-border); }
.timeline__dot--accent .icon { color: var(--accent); }
.timeline__content { flex: 1; min-width: 0; padding-top: 1px; }
.timeline__meta { font-size: var(--fs-xs); color: var(--muted); margin-bottom: 2px; }
.timeline__body { font-size: var(--fs-sm); color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; }

/* ============================================================================
   BÚSQUEDA GLOBAL
   ============================================================================ */
.search__results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--shadow-lg);
  max-height: 62vh; overflow-y: auto; z-index: 40;
  padding: var(--sp-1);
}
.search__item {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 8px 10px; border-radius: var(--r-sm); cursor: pointer;
  border: 0; background: none; width: 100%; text-align: left;
}
.search__item:hover, .search__item.is-highlighted { background: var(--surface-2); }
.search__item-title { font-size: var(--fs-sm); font-weight: 500; }
.search__item-sub   { font-size: var(--fs-xs); color: var(--muted); }

/* ── Barra de filtros y cabecera de sección ──────────────────────────────── */
.toolbar {
  display: flex; align-items: center; gap: var(--sp-2);
  flex-wrap: wrap; margin-bottom: var(--sp-4);
}
.toolbar__spacer { margin-left: auto; }

.segmented { display: inline-flex; background: var(--surface-2); border-radius: var(--r-sm); padding: 2px; gap: 2px; }
/* En el móvil los filtros se desplazan de lado dentro de su caja, no la página entera */
@media (max-width: 640px) {
  .segmented { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .segmented::-webkit-scrollbar { display: none; }
}
.segmented__item {
  padding: 5px 11px; border: 0; background: none; cursor: pointer;
  font-size: var(--fs-xs); font-weight: 500; color: var(--muted);
  border-radius: 6px; white-space: nowrap;
  transition: background var(--t-fast), color var(--t-fast);
}
.segmented__item.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ── Lista de datos clave/valor de una ficha ─────────────────────────────── */
.datalist { display: grid; grid-template-columns: auto 1fr; gap: 9px var(--sp-4); align-items: baseline; }
.datalist dt { font-size: var(--fs-xs); color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.datalist dd { margin: 0; font-size: var(--fs-sm); overflow-wrap: anywhere; }

@media (max-width: 860px) {
  .column { flex-basis: 82vw; width: 82vw; max-height: none; }
  .board  { padding-bottom: var(--sp-4); }
}

/* ============================================================================
   EDITOR DE PROPUESTAS
   ============================================================================ */
.editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: var(--sp-4);
  align-items: start;
}
@media (max-width: 1080px) { .editor-grid { grid-template-columns: 1fr; } }

.kicker-sm {
  font-size: 10px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--muted);
}

.notice {
  display: flex; gap: var(--sp-3); align-items: flex-start;
  padding: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-4);
  background: color-mix(in srgb, var(--warn) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--warn) 34%, transparent);
  border-radius: var(--r-md); font-size: var(--fs-sm); color: var(--text-2);
}
.notice .icon { color: var(--warn); margin-top: 2px; }

/* ── Grupos y filas de línea ──────────────────────────────────────────────── */
.line-group { border-bottom: 1px solid var(--border); }
.line-group:last-child { border-bottom: 0; }
.line-group__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-3) var(--sp-4) var(--sp-2);
  background: var(--surface-2);
}

.line-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: var(--sp-3); align-items: center;
  padding: var(--sp-2) var(--sp-4);
  border-top: 1px solid var(--border-soft);
}
.line-row:first-of-type { border-top: 0; }
.line-row--read { padding: var(--sp-3) var(--sp-4); }
.line-row__nums { display: flex; gap: var(--sp-2); }
.line-row__end  { display: flex; align-items: center; gap: var(--sp-1); min-width: 118px; justify-content: flex-end; }

/* Campos sin marco dentro de la fila: se edita en el sitio, sin abrir nada */
.input--flush {
  border: 1px solid transparent; background: transparent;
  padding: 5px 7px; border-radius: var(--r-sm);
}
.input--flush:hover { background: var(--surface-2); }
.input--flush:focus { background: var(--surface); border-color: var(--accent); }
.input--sub { font-size: var(--fs-xs); color: var(--muted); }
.input--num { width: 78px; padding: 5px 7px; text-align: right; font-variant-numeric: tabular-nums; }

.field-mini { display: flex; flex-direction: column; gap: 2px; }
.field-mini__label { font-size: 9px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); text-align: right; }

.nowrap { white-space: nowrap; }

/* ── Totales ──────────────────────────────────────────────────────────────── */
.totals-row {
  display: flex; justify-content: space-between; gap: var(--sp-3);
  font-size: var(--fs-sm); color: var(--text-2);
}
.totals-row--grand {
  border-top: 1px solid var(--border); margin-top: 6px; padding-top: 9px;
  font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 700; color: var(--text);
}
.totals-recurring {
  margin-top: var(--sp-4); padding-top: var(--sp-3);
  border-top: 1px dashed var(--border);
}

/* ── Catálogo dentro del panel ────────────────────────────────────────────── */
.catalog-item {
  display: flex; align-items: center; gap: var(--sp-3);
  width: 100%; padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-sm); cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.catalog-item:hover { border-color: var(--accent-border); background: var(--surface-2); }

.copy-link { display: flex; gap: var(--sp-2); align-items: center; }
.copy-link .input { flex: 1; min-width: 0; }

@media (max-width: 720px) {
  .line-row { grid-template-columns: 1fr; gap: var(--sp-2); }
  .line-row__nums { justify-content: flex-start; }
  .line-row__end { justify-content: space-between; min-width: 0; }
}

/* ============================================================================
   TAREAS Y CRONÓMETRO
   ============================================================================ */
.task-row {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 11px var(--sp-4);
  border-top: 1px solid var(--border-soft);
  cursor: pointer;
  transition: background var(--t-fast);
}
.task-row:first-child { border-top: 0; }
.task-row:hover { background: var(--surface-2); }
.task-row__title { font-size: var(--fs-sm); font-weight: 500; }
.task-row__title.is-done { text-decoration: line-through; color: var(--muted); }

.task-check {
  width: 19px; height: 19px; flex: 0 0 auto;
  border: 1.8px solid var(--border); border-radius: 6px;
  background: var(--surface); cursor: pointer;
  display: grid; place-items: center; padding: 0;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.task-check:hover { border-color: var(--accent); }
.task-check.is-done { background: var(--accent); border-color: transparent; }
.task-check.is-done .icon { width: 12px; height: 12px; color: var(--on-accent); stroke-width: 3; }

.check-item {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: var(--fs-sm); cursor: pointer;
}
.check-item input { width: 15px; height: 15px; flex: 0 0 auto; }
.check-item span { flex: 1; }
.check-item .is-done { text-decoration: line-through; color: var(--muted); }

.timer {
  text-align: center; padding: var(--sp-3);
  background: var(--accent-soft); border-radius: var(--r-md);
}
.timer__display {
  font-family: var(--font-display); font-size: 30px; font-weight: 700;
  font-variant-numeric: tabular-nums; letter-spacing: -.02em; color: var(--accent);
}

/* ── Bloques de código y endpoints en Ajustes ─────────────────────────────── */
.code-block {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: var(--fs-xs); line-height: 1.6;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: var(--sp-3);
  overflow-x: auto; margin: var(--sp-2) 0 0; white-space: pre;
}
.endpoint { padding: var(--sp-2) 0; border-bottom: 1px solid var(--border-soft); }
.endpoint:last-of-type { border-bottom: 0; }

/* ============================================================================
   APP INSTALABLE · HOY · CAPTURA RÁPIDA
   ============================================================================ */

.icon--flip { transform: scaleX(-1); }
.btn--block { width: 100%; padding: 12px; font-size: var(--fs-base); }

/* ── Barra superior: botón de apuntar ─────────────────────────────────────── */
.topbar__capture { flex: 0 0 auto; }
@media (max-width: 860px) { .topbar__capture { display: none; } }

/* ── Barra inferior con botón central ─────────────────────────────────────── */
@media (max-width: 860px) {
  .bottomnav { align-items: center; }
  .bottomnav__item { border: 0; background: none; font: inherit; }
  .bottomnav__capture {
    justify-self: center;
    width: 54px; height: 54px; margin-top: -22px;
    border-radius: 50%; border: 4px solid var(--bg);
    background: var(--accent); color: var(--on-accent);
    display: grid; place-items: center; cursor: pointer;
    box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 40%, transparent);
    transition: transform var(--t-fast);
  }
  .bottomnav__capture:active { transform: scale(.94); }
  .bottomnav__capture .icon { width: 24px; height: 24px; stroke-width: 2.4; }
}

/* ── Hoja «Más» ───────────────────────────────────────────────────────────── */
.more-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-2); }
.more-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 78px; padding: var(--sp-3) var(--sp-2);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  color: var(--text-2); font: inherit; font-size: var(--fs-xs); font-weight: 500; text-align: center;
  cursor: pointer; transition: border-color var(--t-fast), background var(--t-fast);
}
.more-tile .icon { width: 22px; height: 22px; color: var(--accent); }
.more-tile:active, .more-tile:hover { border-color: var(--accent-border); background: var(--surface-2); }
.more-tile--danger .icon { color: var(--danger); }

/* ── Hoy ──────────────────────────────────────────────────────────────────── */
.today { max-width: 1100px; }
.today__head { margin-bottom: var(--sp-4); }
.today__date {
  font-size: var(--fs-xs); font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent);
}
.today__greeting { font-size: var(--fs-xl); letter-spacing: -.02em; margin-top: 2px; }
.today__summary { margin-top: 6px; font-size: var(--fs-md); color: var(--text-2); max-width: 62ch; }

.today__quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-2); margin-bottom: var(--sp-5); max-width: 560px; }
.quick-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 var(--sp-3);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  color: var(--text); font: inherit; font-size: var(--fs-sm); font-weight: 600; cursor: pointer;
  transition: border-color var(--t-fast), transform var(--t-fast);
}
.quick-btn .icon { color: var(--accent); }
/* En el móvil, icono encima y texto debajo: «Nota a cliente» no cabe en una línea a lo ancho */
@media (max-width: 520px) {
  .quick-btn { flex-direction: column; gap: 4px; min-height: 64px; padding: 8px 4px; font-size: var(--fs-xs); white-space: nowrap; }
  .quick-btn .icon { width: 18px; height: 18px; }
}
.quick-btn:hover { border-color: var(--accent-border); }
.quick-btn:active { transform: scale(.97); }

/* En columnas de periódico y no en rejilla: una tarjeta alta (tareas) ya no deja
   huecos en blanco al lado de las bajas. Se lee de arriba abajo, columna a columna. */
.today__grid { columns: 3 320px; column-gap: var(--sp-4); }
.today__grid > * { break-inside: avoid; margin-bottom: var(--sp-4); display: block; }
@media (max-width: 860px) { .today__grid { columns: 1; } .today__grid > * { margin-bottom: var(--sp-3); } }
/* Sin esto, un texto truncado (white-space:nowrap) impone su ancho completo a la
   columna: en un iPhone de 390 px la página se maquetaba a 429 y el navegador
   alejaba el zoom. Las celdas de una rejilla tienen min-width:auto por defecto. */
.today__grid > *, .dash-grid > * { min-width: 0; }

.today__empty {
  display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-2);
  padding: var(--sp-4); font-size: var(--fs-sm); color: var(--muted);
}
.today__group {
  padding: var(--sp-3) var(--sp-4) 4px;
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.today__group--danger { color: var(--danger); }
.today__note {
  display: flex; align-items: center; gap: 8px;
  padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--border-soft);
  font-size: var(--fs-xs); color: var(--warn);
}
.today__hint { padding: var(--sp-3) var(--sp-4) 0; font-size: var(--fs-xs); color: var(--muted); }
.today__more {
  display: inline-flex; align-items: center; gap: 6px; margin-top: var(--sp-5);
  font-size: var(--fs-sm); color: var(--muted);
}
.today__more:hover { color: var(--accent); }

.agenda-row {
  display: grid; grid-template-columns: 96px 1fr; gap: var(--sp-3); align-items: center;
  padding: 11px var(--sp-4); border-top: 1px solid var(--border-soft);
}
.agenda-row:first-child { border-top: 0; }
.agenda-row__time { font-size: var(--fs-sm); font-weight: 600; font-variant-numeric: tabular-nums; color: var(--accent); }

/* Tarea que se marca como hecha: se va sin esperar a la red */
.task-row.is-leaving { opacity: .35; text-decoration: line-through; transition: opacity 180ms var(--ease); }
a.task-row { color: inherit; }

/* ── Captura rápida ───────────────────────────────────────────────────────── */
.capture { display: flex; flex-direction: column; gap: var(--sp-4); }
.capture__types { align-self: flex-start; }
.input--big { font-size: 17px; padding: 12px 14px; }   /* 16px o más evita el zoom automático de iOS */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-toggle {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 12px; border-radius: var(--r-full);
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-2); font: inherit; font-size: var(--fs-sm); font-weight: 500; cursor: pointer;
}
.chip-toggle .icon { width: 14px; height: 14px; }
.chip-toggle.is-active { background: var(--accent-soft); border-color: var(--accent-border); color: var(--text); }

.picker { display: flex; flex-direction: column; gap: 6px; }
.picker__results { display: flex; flex-direction: column; }
.picker__item {
  display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2);
  padding: 10px 12px; border: 0; border-radius: var(--r-sm);
  background: none; color: var(--text); font: inherit; font-size: var(--fs-sm); text-align: left; cursor: pointer;
}
.picker__item:hover, .picker__item:active { background: var(--surface-2); }
.picker__chosen {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 8px 8px 12px; border: 1px solid var(--accent-border);
  background: var(--accent-soft); border-radius: var(--r-sm); font-size: var(--fs-sm);
}

/* En el móvil todos los campos a 16px: por debajo, iOS hace zoom al enfocarlos. */
@media (max-width: 860px) {
  .input, .select, .textarea { font-size: 16px; }
}

/* ── App instalada en el iPhone ───────────────────────────────────────────── */
/* Con la barra de estado translúcida, el contenido quedaría debajo de la hora y la batería. */
@media (display-mode: standalone) {
  .topbar {
    height: calc(var(--header-h) + env(safe-area-inset-top));
    padding-top: env(safe-area-inset-top);
  }
  .sidebar { padding-top: calc(var(--sp-4) + env(safe-area-inset-top)); }
}
.drawer__footer { padding-bottom: calc(var(--sp-3) + env(safe-area-inset-bottom)); }
@media (max-width: 640px) {
  .drawer__body { padding-bottom: calc(var(--sp-4) + env(safe-area-inset-bottom)); }
}

/* ── Sin conexión ─────────────────────────────────────────────────────────── */
.offline {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--sp-3); padding: var(--sp-5); text-align: center;
}
.offline p { max-width: 36ch; }

/* ============================================================================
   HÁBITOS
   ============================================================================ */
.habit-row {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 10px var(--sp-4); border-top: 1px solid var(--border-soft);
}
.habit-row:first-child { border-top: 0; }

.habit-check {
  --habit: var(--accent);
  width: 40px; height: 40px; flex: 0 0 auto; border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--habit) 55%, var(--border));
  background: transparent; color: transparent; cursor: pointer;
  display: grid; place-items: center; padding: 0;
  transition: background 160ms var(--ease), transform 120ms var(--ease), color 160ms var(--ease);
}
.habit-check .icon { width: 20px; height: 20px; stroke-width: 3; }
.habit-check:active { transform: scale(.9); }
.habit-check.is-done { background: var(--habit); border-color: var(--habit); color: #fff; }

.habit-card__name { border: 0; background: none; padding: 0; color: inherit; font: inherit; cursor: pointer; gap: 10px; }
.habit-emoji { font-size: 24px; line-height: 1; }

.habit-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-2); margin: var(--sp-4) 0 var(--sp-3); }
.habit-stats__value { font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 700; font-variant-numeric: tabular-nums; }

.habit-strip { display: grid; grid-template-columns: repeat(30, 1fr); gap: 3px; }
.habit-day {
  aspect-ratio: 1; border-radius: 3px; border: 0; padding: 0;
  background: var(--surface-3);
}
.habit-day.is-done { background: var(--habit, var(--accent)); }
.habit-day.is-today { outline: 2px solid var(--text-2); outline-offset: 1px; }

.habit-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: var(--sp-3); }
.habit-week__day {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  min-height: 48px; padding: 6px 0; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  font: inherit; cursor: pointer; transition: background 140ms var(--ease);
}
.habit-week__day.is-done { background: var(--habit, var(--accent)); border-color: transparent; color: #fff; }
.habit-week__day.is-today { border-color: var(--text-2); }
.habit-week__label { font-size: 10px; font-weight: 600; opacity: .8; }
.habit-week__num { font-size: var(--fs-sm); font-weight: 700; font-variant-numeric: tabular-nums; }

.swatch { width: 30px; height: 30px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; padding: 0; }
.swatch.is-active { border-color: var(--text); }

/* ── Calendario ───────────────────────────────────────────────────────────── */
.u-center { text-align: center; }

/* ── Acciones rápidas de la ficha de cliente ──────────────────────────────── */
.contact-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: calc(var(--sp-2) * -1) 0 var(--sp-4); }
@media (max-width: 640px) {
  .contact-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }
  .contact-actions .btn { padding: 10px 6px; }
  .contact-actions__who { display: none; }
}
.steps { padding-left: 20px; line-height: 1.9; color: var(--text-2); margin: 0; }
.agenda-row__dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; vertical-align: 1px; }

/* ============================================================================
   MOTIVACIÓN · puntos del día, racha, objetivo del mes, celebraciones y semana
   ============================================================================ */
.motivation { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-4); max-width: 1100px; }
@media (max-width: 760px) { .motivation { grid-template-columns: 1fr; } }

.motivation__card {
  display: flex; gap: var(--sp-4); align-items: center;
  padding: var(--sp-4); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm); color: inherit;
  transition: border-color var(--t-fast), transform var(--t-fast);
}
a.motivation__card:hover { border-color: var(--accent-border); }
a.motivation__card:active { transform: scale(.99); }
.motivation__body { flex: 1; min-width: 0; }
.motivation__title { font-family: var(--font-display); font-weight: 600; font-size: var(--fs-md); }
.motivation__text { font-size: var(--fs-sm); color: var(--text-2); margin-top: 2px; }
.motivation__card .input { max-width: 160px; }

.motivation__ring { position: relative; width: 76px; height: 76px; flex: 0 0 auto; }
.motivation__ring-label {
  position: absolute; inset: 0; display: flex; align-items: baseline; justify-content: center;
  padding-top: 26px; font-variant-numeric: tabular-nums;
}
.motivation__ring-label strong { font-family: var(--font-display); font-size: 22px; line-height: 1; }
.motivation__ring-label span { font-size: 11px; color: var(--muted); margin-left: 1px; }

.ring { width: 100%; height: 100%; }
.ring circle { fill: none; stroke-width: 8; stroke-linecap: round; }
.ring__track { stroke: var(--surface-3); }
.ring__value { stroke: var(--accent); transition: stroke-dasharray 600ms var(--ease); }
.ring--done .ring__value { stroke: var(--ok); }

.mini-bars { display: flex; align-items: flex-end; gap: 3px; height: 26px; }
.mini-bars__bar { width: 8px; height: var(--h); min-height: 4px; border-radius: 3px; background: color-mix(in srgb, var(--accent) 35%, var(--surface-3)); }
.mini-bars__bar.is-done { background: var(--ok); }
.mini-bars__bar:last-child:not(.is-done) { background: var(--accent); }

.goal__numbers { margin-top: 6px; font-variant-numeric: tabular-nums; }
.goal__numbers strong { font-family: var(--font-display); font-size: var(--fs-xl); letter-spacing: -.02em; }
.goal__numbers span { color: var(--muted); font-size: var(--fs-sm); }
.goal__bar { position: relative; height: 10px; background: var(--surface-3); border-radius: var(--r-full); margin: 8px 0 6px; overflow: visible; }
.goal__fill { display: block; height: 100%; border-radius: var(--r-full); background: var(--accent); transition: width 600ms var(--ease); }
.goal__today { position: absolute; top: -4px; width: 2px; height: 18px; background: var(--text-2); border-radius: 1px; transform: translateX(-1px); }

.week-banner {
  display: flex; align-items: center; gap: 10px; margin-bottom: var(--sp-4); max-width: 1100px;
  padding: 12px var(--sp-4); border-radius: var(--r-md);
  background: var(--accent-soft); border: 1px solid var(--accent-border); color: var(--text);
  font-weight: 600; font-size: var(--fs-sm);
}
.week-banner span { flex: 1; }
.week-banner .icon { color: var(--accent); }

/* Aviso de puntos y celebraciones */
.cheer-host { position: fixed; left: 50%; top: calc(var(--header-h) + 14px); transform: translateX(-50%); z-index: 120; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.cheer {
  padding: 8px 16px; border-radius: var(--r-full); background: var(--text); color: var(--bg);
  box-shadow: var(--shadow-lg); text-align: center;
  opacity: 0; transform: translateY(-10px) scale(.96); transition: opacity 220ms var(--ease), transform 220ms var(--ease);
}
.cheer.is-in { opacity: 1; transform: none; }
.cheer__title { font-weight: 700; font-size: var(--fs-sm); }
.cheer__sub { font-size: var(--fs-xs); opacity: .8; }
.cheer--big { padding: 14px 26px; border-radius: var(--r-lg); background: var(--accent); color: var(--on-accent); }
.cheer--big .cheer__title { font-family: var(--font-display); font-size: var(--fs-lg); }
.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 119; }
@media (max-width: 860px) { .cheer-host { top: calc(env(safe-area-inset-top) + 12px); } }

/* Tu semana */
.week { max-width: 1100px; }
.week .stats { margin-bottom: var(--sp-4); }
.week__grid { columns: 2 380px; column-gap: var(--sp-4); }
.week__grid > * { break-inside: avoid; margin-bottom: var(--sp-4); display: block; min-width: 0; }
.week-bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; height: 150px; align-items: end; }
.week-bars__col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.week-bars__bar { width: 100%; max-width: 34px; height: var(--h); border-radius: 6px 6px 3px 3px; background: var(--accent); opacity: .55; }
.week-bars__bar.is-done { background: var(--ok); opacity: 1; }
.week-bars__value { font-size: var(--fs-xs); color: var(--muted); font-variant-numeric: tabular-nums; min-height: 1em; }
.week-bars__day { font-size: var(--fs-xs); font-weight: 600; color: var(--text-2); }
.focus-row__n {
  width: 26px; height: 26px; border-radius: 50%; flex: 0 0 auto; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: var(--fs-sm);
}
.done-list, .rules-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-sm); }
.done-list strong { font-family: var(--font-display); font-size: var(--fs-md); }
.rules-list li { display: flex; justify-content: space-between; gap: var(--sp-3); color: var(--text-2); }
.rules-list strong { color: var(--accent); font-variant-numeric: tabular-nums; }

/* Pulso de la ficha de cliente: último contacto y próxima cita */
.pulse { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--sp-3); }
.pulse__item { display: flex; flex-direction: column; gap: 2px; padding: 12px var(--sp-4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); min-width: 0; }
.pulse__label { font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.pulse__value { font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Bloque plegable de Ajustes */
.fold > summary { cursor: pointer; font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); padding: 6px 2px; }
.fold[open] > summary { margin-bottom: var(--sp-3); }
.notice--info { background: var(--accent-soft); border-color: var(--accent-border); margin-bottom: 0; }
.notice--info .icon { color: var(--accent); }

/* ── Correo en la ficha ─────────────────────────────────────────────────── */
.email-row { color: inherit; align-items: flex-start; }
.email-row__dir { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto; background: var(--surface-2); }
.email-row__dir .icon { width: 14px; height: 14px; }
.email-row__dir--in { color: var(--accent); background: var(--accent-soft); }
.email-row__dir--out { color: var(--muted); }
