/* ============================================================================
   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(--grad-cta);
  -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(--grad-cta);
  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: 10px; letter-spacing: .12em; 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(--grad-cta); border-color: transparent; color: #fff; font-weight: 600;
  box-shadow: 0 2px 10px rgba(180, 124, 253, .3);
}
.btn--primary:hover { filter: brightness(1.07); 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 { font-family: var(--font-display); font-size: var(--fs-base); font-weight: 600; }
.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(--grad-cta); opacity: .8;
}
.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;
  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; }

/* ── 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: 10px; font-weight: 500;
    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); }
/* Barra roja a la izquierda cuando lleva demasiado tiempo parada */
.deal-card.is-stale { border-left: 3px solid var(--danger); }

.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__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; }
.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(--grad-cta); border-color: transparent; }
.task-check.is-done .icon { width: 12px; height: 12px; color: #fff; 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; }
