
  /* ---------- Tokens ---------- */
  :root {
    --paper: #F2F4EE;
    --surface: #FFFFFF;
    --surface-2: #E7ECDF;
    --ink: #16211C;
    --ink-muted: #5B6A5D;
    --pine: #1F4A3B;
    --pine-strong: #16362A;
    --pine-ink: #F4F7F0;
    --sprout: #8AB92E;
    --sprout-ink: #16210A;
    --moss: #DCE3D0;
    --border: #D7DECA;
    --info: #2E8B7D;
    --info-bg: #DEEFEA;
    --warning: #A9720F;
    --warning-bg: #F4E7CD;
    --danger: #B8452F;
    --danger-bg: #F5DFD8;
    --danger-solid: #B8452F;
    --danger-solid-ink: #FFF6F2;
    --collab: #8B5FA8;
    --collab-bg: #EFE6F2;
    --provider: #3E6FA8;
    --provider-bg: #E1EAF4;

    --radius-s: 10px;
    --radius-m: 16px;
    --radius-full: 999px;
    --shadow-1: 0 1px 2px rgba(22,33,28,.07), 0 1px 1px rgba(22,33,28,.04);
    --shadow-2: 0 12px 32px rgba(22,33,28,.16);

    --font-display: 'Sora', system-ui, -apple-system, sans-serif;
    --font-body: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    --font-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', monospace;
  }

  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      --paper: #101A15;
      --surface: #16241D;
      --surface-2: #1D2E24;
      --ink: #ECF0E7;
      --ink-muted: #9BAB9B;
      --pine: #3E7860;
      --pine-strong: #2A5844;
      --pine-ink: #F4F7F0;
      --sprout: #A2D444;
      --sprout-ink: #10190A;
      --moss: #26382B;
      --border: #2A3C30;
      --info: #57BBA6;
      --info-bg: #17332D;
      --warning: #E0A94C;
      --warning-bg: #3A2E15;
      --danger: #E1806A;
      --danger-bg: #3A2019;
      --danger-solid: #C1573F;
      --danger-solid-ink: #FFF6F2;
      --collab: #C9A0E0;
      --collab-bg: #2E2038;
      --provider: #8FC0F0;
      --provider-bg: #1C2C3D;
      --shadow-1: 0 1px 2px rgba(0,0,0,.3);
      --shadow-2: 0 16px 40px rgba(0,0,0,.45);
    }
  }
  :root[data-theme="dark"] {
    --paper: #101A15;
    --surface: #16241D;
    --surface-2: #1D2E24;
    --ink: #ECF0E7;
    --ink-muted: #9BAB9B;
    --pine: #3E7860;
    --pine-strong: #2A5844;
    --pine-ink: #F4F7F0;
    --sprout: #A2D444;
    --sprout-ink: #10190A;
    --moss: #26382B;
    --border: #2A3C30;
    --info: #57BBA6;
    --info-bg: #17332D;
    --warning: #E0A94C;
    --warning-bg: #3A2E15;
    --danger: #E1806A;
    --danger-bg: #3A2019;
    --danger-solid: #C1573F;
    --danger-solid-ink: #FFF6F2;
    --collab: #C9A0E0;
    --collab-bg: #2E2038;
    --provider: #8FC0F0;
    --provider-bg: #1C2C3D;
    --shadow-1: 0 1px 2px rgba(0,0,0,.3);
    --shadow-2: 0 16px 40px rgba(0,0,0,.45);
  }

  /* Alternate color skin — overrides light or dark, on purpose (single fixed look) */
  :root[data-skin="esmeralda"] {
    --paper: #F8FAFC;
    --surface: #FFFFFF;
    --surface-2: #EEF2F6;
    --ink: #111827;
    --ink-muted: #64748B;
    --pine: #047857;
    --pine-strong: #065F46;
    --pine-ink: #F8FAFC;
    --sprout: #4F46E5;
    --sprout-ink: #FFFFFF;
    --moss: #E2E8F0;
    --border: #E2E8F0;
    --info: #10B981;
    --info-bg: #D1FAE5;
    --warning: #D97706;
    --warning-bg: #FEF3C7;
    --danger: #DC2626;
    --danger-bg: #FEE2E2;
    --danger-solid: #DC2626;
    --danger-solid-ink: #FFFFFF;
    --collab: #7C3AED;
    --collab-bg: #EDE9FE;
    --provider: #2563EB;
    --provider-bg: #DBEAFE;
    --shadow-1: 0 1px 2px rgba(17,24,39,.06), 0 1px 1px rgba(17,24,39,.04);
    --shadow-2: 0 12px 32px rgba(17,24,39,.14);
  }

  /* ---------- Reset-ish ---------- */
  * { box-sizing: border-box; }
  html { -webkit-text-size-adjust: 100%; }
  body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
  }
  h1, h2, h3, .display { font-family: var(--font-display); text-wrap: balance; letter-spacing: -0.01em; }
  button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
  a { color: inherit; }
  ::selection { background: var(--sprout); color: var(--sprout-ink); }
  .mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

  button { cursor: pointer; }
  button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 2px solid var(--sprout);
    outline-offset: 2px;
  }

  @media (prefers-reduced-motion: no-preference) {
    .view { animation: rise .28s ease both; }
    @keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
  }
  @media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
  }

  /* ---------- App shell ---------- */
  .app-shell {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
  }

  .topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    background: var(--paper);
    border-bottom: 1px solid var(--border);
  }
  .brand {
    display: flex; align-items: center; gap: 9px;
    font-family: var(--font-display); font-weight: 700; font-size: 17px;
  }
  .brand-mark {
    width: 28px; height: 28px; border-radius: 8px;
    background: var(--pine);
    display: grid; place-items: center; flex-shrink: 0;
  }
  .brand-mark svg { width: 16px; height: 16px; }
  .avatar-btn {
    width: 34px; height: 34px; border-radius: var(--radius-full);
    background: var(--surface-2); border: 1px solid var(--border);
    display: grid; place-items: center; padding: 0;
  }
  .avatar-btn svg { width: 17px; height: 17px; color: var(--ink-muted); }

  main.content {
    flex: 1;
    padding: 18px 16px 96px;
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
  }

  [hidden] { display: none !important; }

  /* ---------- Bottom nav (mobile) ---------- */
  .bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    display: flex; align-items: center; justify-content: space-around;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  }
  .nav-btn {
    background: none; border: none; padding: 6px 10px;
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    color: var(--ink-muted); border-radius: var(--radius-s);
    font-size: 11px; font-weight: 600;
  }
  .nav-btn svg { width: 22px; height: 22px; }
  .nav-btn[aria-current="page"] { color: var(--pine); }
  :root[data-theme="dark"] .nav-btn[aria-current="page"] { color: var(--sprout); }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .nav-btn[aria-current="page"] { color: var(--sprout); }
  }
  .nav-fab {
    width: 50px; height: 50px; border-radius: var(--radius-full);
    background: var(--sprout); color: var(--sprout-ink);
    display: grid; place-items: center; border: none;
    box-shadow: var(--shadow-2);
    margin-top: -26px;
  }
  .nav-fab svg { width: 24px; height: 24px; }

  /* ---------- Desktop sidebar ---------- */
  .sidebar { display: none; }

  @media (min-width: 900px) {
    .app-shell { flex-direction: row; }
    .topbar { display: none; }
    .bottom-nav { display: none; }
    .sidebar {
      display: flex; flex-direction: column;
      width: 240px; flex-shrink: 0;
      background: var(--pine); color: var(--pine-ink);
      padding: 22px 16px;
      position: sticky; top: 0; height: 100dvh;
    }
    .sidebar .brand { color: var(--pine-ink); font-size: 19px; margin-bottom: 28px; padding: 0 8px; }
    .sidebar .brand-mark { background: var(--sprout); }
    .sidebar .brand-mark svg { color: var(--sprout-ink); }
    .sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
    .sidebar-link {
      display: flex; align-items: center; gap: 11px;
      padding: 10px 12px; border-radius: var(--radius-s);
      background: none; border: none; text-align: left;
      color: rgba(244,247,240,.72); font-weight: 600; font-size: 14px;
    }
    .sidebar-link svg { width: 19px; height: 19px; flex-shrink: 0; }
    .sidebar-link[aria-current="page"] { background: rgba(244,247,240,.12); color: var(--pine-ink); }
    .sidebar-link:hover { color: var(--pine-ink); }
    .sidebar-cta {
      margin-top: 12px;
      display: flex; align-items: center; justify-content: center; gap: 8px;
      background: var(--sprout); color: var(--sprout-ink);
      border: none; border-radius: var(--radius-s);
      padding: 11px 14px; font-weight: 700; font-size: 13.5px;
    }
    .sidebar-cta svg { width: 16px; height: 16px; }
    .sidebar-foot { margin-top: 18px; font-size: 12px; color: rgba(244,247,240,.55); padding: 0 8px; }
    main.content { padding: 32px 40px 40px; max-width: 90%; }
  }

  /* ---------- Buttons ---------- */
  .btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border-radius: var(--radius-s); border: 1px solid transparent;
    padding: 11px 16px; font-weight: 700; font-size: 14px;
    white-space: nowrap;
  }
  .btn svg { width: 16px; height: 16px; }
  .btn-primary { background: var(--sprout); color: var(--sprout-ink); }
  .btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--border); }
  .btn-ghost { background: transparent; color: var(--ink-muted); }
  .btn-danger-ghost { background: transparent; color: var(--danger); }
  .btn-danger { background: var(--danger-solid); color: var(--danger-solid-ink); }
  .btn-block { width: 100%; }
  .icon-btn {
    width: 36px; height: 36px; border-radius: var(--radius-s);
    background: var(--surface); border: 1px solid var(--border);
    display: grid; place-items: center; padding: 0; flex-shrink: 0;
  }
  .icon-btn svg { width: 17px; height: 17px; color: var(--ink-muted); }

  /* ---------- Typography helpers ---------- */
  .eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-muted); }
  .page-title { font-size: 24px; font-weight: 700; margin: 2px 0 4px; }
  .page-sub { color: var(--ink-muted); font-size: 14px; margin: 0; }

  /* ---------- Home ---------- */
  .home-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
  .stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 22px; }
  .stat-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-m);
    padding: 14px 14px 12px; box-shadow: var(--shadow-1);
  }
  .stat-value { font-family: var(--font-mono); font-size: 24px; font-weight: 500; line-height: 1; margin-bottom: 6px; }
  .stat-label { font-size: 11.5px; color: var(--ink-muted); font-weight: 600; }
  @media (max-width: 420px) { .stat-value { font-size: 20px; } }

  .section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 26px 0 10px; }
  .section-head h2 { font-size: 15px; margin: 0; }
  .section-head a, .link-btn { font-size: 13px; font-weight: 700; color: var(--pine); background: none; border: none; padding: 0; }
  :root[data-theme="dark"] .section-head a,
  :root[data-theme="dark"] .link-btn { color: var(--sprout); }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .section-head a,
    :root:not([data-theme="light"]) .link-btn { color: var(--sprout); }
  }

  .empty-state {
    border: 1px dashed var(--border); border-radius: var(--radius-m);
    padding: 28px 18px; text-align: center; color: var(--ink-muted); font-size: 13.5px;
  }

  /* ---------- Contact rows / cards ---------- */
  .contact-row {
    display: flex; align-items: center; gap: 12px;
    width: 100%; text-align: left;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-m);
    padding: 11px 12px; margin-bottom: 8px;
    box-shadow: var(--shadow-1);
  }
  .contact-row[aria-current="true"] { border-color: var(--pine); }
  :root[data-theme="dark"] .contact-row[aria-current="true"] { border-color: var(--sprout); }
  @media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .contact-row[aria-current="true"] { border-color: var(--sprout); } }

  .avatar {
    width: 40px; height: 40px; border-radius: var(--radius-full);
    display: grid; place-items: center; flex-shrink: 0;
    background: var(--moss); color: var(--pine-strong);
    font-family: var(--font-display); font-weight: 700; font-size: 14px;
  }
  .avatar.lg { width: 58px; height: 58px; font-size: 19px; }

  .contact-row .meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
  .contact-row .name { font-weight: 700; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .contact-row .org { font-size: 12.5px; color: var(--ink-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .chevron { color: var(--ink-muted); flex-shrink: 0; }
  .chevron svg { width: 16px; height: 16px; }

  .pill {
    display: inline-flex; align-items: center; gap: 5px;
    border-radius: var(--radius-full); padding: 3px 9px;
    font-size: 11px; font-weight: 700;
  }
  .pill-cliente { background: var(--info-bg); color: var(--info); }
  .pill-lead { background: var(--warning-bg); color: var(--warning); }
  .pill-prospecto { background: var(--surface-2); color: var(--ink-muted); }
  .pill-colaborador { background: var(--collab-bg); color: var(--collab); }
  .pill-proveedor { background: var(--provider-bg); color: var(--provider); }
  .pill-ex-cliente { background: transparent; color: var(--ink-muted); border: 1px dashed var(--border); padding: 2px 8px; }
  .pill-prospeccion { background: var(--surface-2); color: var(--ink-muted); }
  .pill-propuesta { background: var(--warning-bg); color: var(--warning); }
  .pill-negociacion { background: var(--collab-bg); color: var(--collab); }
  .pill-ganada { background: var(--info-bg); color: var(--info); }
  .pill-perdida { background: var(--danger-bg); color: var(--danger); }
  .pill-tarea-pendiente { background: var(--surface-2); color: var(--ink-muted); }
  .pill-tarea-vencida { background: var(--danger-bg); color: var(--danger); }
  .pill-tarea-completada { background: var(--info-bg); color: var(--info); }
  .pill-evento-reunion { background: var(--info-bg); color: var(--info); }
  .pill-evento-llamada { background: var(--collab-bg); color: var(--collab); }
  .pill-evento-videollamada { background: var(--provider-bg); color: var(--provider); }
  .pill-evento-otro { background: var(--surface-2); color: var(--ink-muted); }
  .day-header { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-muted); margin: 18px 2px 6px; }
  .day-header:first-child { margin-top: 2px; }
  .pill-correo-vinculado { background: var(--info-bg); color: var(--info); }
  .pill-correo-sin-vincular { background: var(--surface-2); color: var(--ink-muted); }
  .pill-correo-enviado { background: var(--collab-bg); color: var(--collab); }
  .pill-correo-borrador { background: var(--surface-2); color: var(--ink-muted); }
  .pill-correo-spam { background: var(--danger-bg); color: var(--danger); }
  .pill-correo-papelera { background: transparent; color: var(--ink-muted); border: 1px dashed var(--border); padding: 2px 8px; }

  /* ---------- Filas de correo (con botón de destacado aparte del enlace) ---------- */
  .email-row {
    display: flex; align-items: center; gap: 2px;
    width: 100%; text-align: left;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-m);
    padding: 5px 6px 5px 12px; margin-bottom: 8px;
    box-shadow: var(--shadow-1);
  }
  .email-row[aria-current="true"] { border-color: var(--pine); }
  :root[data-theme="dark"] .email-row[aria-current="true"] { border-color: var(--sprout); }
  @media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .email-row[aria-current="true"] { border-color: var(--sprout); } }
  .email-row .row-link {
    display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0;
    text-decoration: none; color: inherit; padding: 6px 0;
  }
  .star-btn {
    flex-shrink: 0; background: none; border: none; padding: 8px;
    display: grid; place-items: center; color: var(--ink-muted); border-radius: var(--radius-s);
  }
  .star-btn svg { width: 18px; height: 18px; }
  .star-btn.is-starred { color: var(--warning); }

  /* ---------- Avisos (éxito / error) ---------- */
  .alert { border-radius: var(--radius-s); padding: 10px 12px; font-size: 13.5px; margin-bottom: 14px; line-height: 1.45; }
  .alert-error { background: var(--danger-bg); color: var(--danger); }
  .alert-success { background: var(--info-bg); color: var(--info); }
  .alert-neutral { background: var(--surface-2); color: var(--ink-muted); }

  /* ---------- Activity feed (home) ---------- */
  .activity-row {
    display: flex; align-items: flex-start; gap: 12px;
    width: 100%; text-align: left;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-m);
    padding: 11px 12px; margin-bottom: 8px;
    box-shadow: var(--shadow-1);
  }
  .activity-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; padding-top: 2px; }
  .activity-line { font-size: 13.5px; line-height: 1.4; }
  .activity-note { color: var(--ink-muted); }
  .activity-auto { color: var(--ink-muted); font-style: italic; }
  .activity-date { font-size: 11px; color: var(--ink-muted); }

  /* ---------- Search + filters ---------- */
  .search-field {
    display: flex; align-items: center; gap: 9px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-s);
    padding: 10px 12px; margin-bottom: 12px;
  }
  .search-field svg { width: 17px; height: 17px; color: var(--ink-muted); flex-shrink: 0; }
  .search-field input { flex: 1; border: none; background: none; outline: none; }
  .filter-row { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; }
  .filter-row::-webkit-scrollbar { display: none; }
  .chip {
    flex-shrink: 0; border-radius: var(--radius-full); border: 1px solid var(--border);
    background: var(--surface); padding: 7px 13px; font-size: 12.5px; font-weight: 700; color: var(--ink-muted);
  }
  .chip[aria-pressed="true"] { background: var(--pine); border-color: var(--pine); color: var(--pine-ink); }
  .chip-folder { display: inline-flex; align-items: center; gap: 6px; }
  .chip-folder svg { width: 15px; height: 15px; }
  .chip-count {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 17px; height: 17px; padding: 0 5px;
    border-radius: var(--radius-full); background: rgba(0,0,0,.12);
    font-size: 10.5px; font-weight: 700;
  }

  /* ---------- Contacts layout (lista → detalle a pantalla completa, en cualquier tamaño) ---------- */
  .contacts-layout .detail-pane { display: none; }
  .contacts-layout.show-detail .list-pane { display: none; }
  .contacts-layout.show-detail .detail-pane { display: block; }

  @media (min-width: 900px) {
    /* En escritorio, la lista y el detalle ocupan más espacio pero siguen sin verse a la vez:
       primero la lista completa, y al seleccionar un elemento el detalle sustituye a la lista. */
    .contacts-layout .list-pane, .contacts-layout.show-detail .list-pane { max-width: 760px; }
    .contacts-layout .detail-pane, .contacts-layout.show-detail .detail-pane { max-width: 820px; }

    /* Correos: en escritorio le damos más ancho a la lista, porque ahora incluye
       la columna de carpetas a la izquierda. */
    #emails-layout .list-pane, #emails-layout.show-detail .list-pane { max-width: 920px; }
  }

  /* ---------- Correos: carpetas en columna vertical (solo escritorio) ---------- */
  @media (min-width: 900px) {
    .emails-body { display: flex; align-items: flex-start; gap: 22px; }
    .emails-body .folder-nav.filter-row {
      flex: 0 0 180px;
      display: flex;
      flex-direction: column;
      overflow: visible;
      gap: 4px;
      margin-bottom: 0;
      position: sticky;
      top: 24px;
    }
    .emails-body .folder-nav.filter-row .chip {
      width: 100%;
      display: flex;
      justify-content: flex-start;
    }
    .emails-body .folder-nav.filter-row .chip-count { margin-left: auto; }
    .emails-body .list-pane-main { flex: 1; min-width: 0; }
  }

  .back-link {
    display: inline-flex; align-items: center; gap: 6px;
    background: none; border: none; color: var(--ink-muted); font-weight: 700; font-size: 13px;
    padding: 4px 0 14px;
  }
  .back-link svg { width: 16px; height: 16px; }

  .detail-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-m);
    padding: 20px; box-shadow: var(--shadow-1);
  }
  .detail-head { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
  .detail-name { font-size: 19px; font-weight: 700; margin: 0 0 3px; }
  .detail-org { color: var(--ink-muted); font-size: 13.5px; margin: 0 0 6px; }
  .detail-actions { display: flex; gap: 8px; margin-top: 16px; }

  .info-list { list-style: none; margin: 16px 0 0; padding: 14px 0 0; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 11px; }
  .info-list li { display: flex; align-items: center; gap: 10px; font-size: 14px; }
  .info-list svg { width: 16px; height: 16px; color: var(--ink-muted); flex-shrink: 0; }
  .info-list a { text-decoration: none; font-weight: 600; }
  .info-list a:hover { text-decoration: underline; }

  .notes-block { margin-top: 22px; }
  .notes-block h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-muted); margin-bottom: 12px; }
  .email-body-frame { width: 100%; min-height: 340px; resize: vertical; overflow: auto; background: #fff; border-radius: var(--radius-s); border: 1px solid var(--border); }
  .note-item { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
  .note-item:last-child { border-bottom: none; }
  .note-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--sprout); margin-top: 6px; flex-shrink: 0; }
  .note-dot-auto { background: var(--ink-muted); }
  .note-item-auto .note-text { color: var(--ink-muted); font-style: italic; }
  .note-date { font-size: 11px; color: var(--ink-muted); margin-bottom: 2px; }
  .note-text { font-size: 13.5px; }
  .note-form { display: flex; gap: 8px; margin-top: 12px; }
  .note-form textarea {
    flex: 1; resize: none; border: 1px solid var(--border); border-radius: var(--radius-s);
    padding: 9px 11px; background: var(--paper); min-height: 40px;
  }

  .kv-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
  .kv-list li { display: flex; justify-content: space-between; gap: 14px; font-size: 13.5px; }
  .kv-list .k { color: var(--ink-muted); flex-shrink: 0; }
  .kv-list .v { text-align: right; }
  .accesos-box { border: 1px solid var(--border); border-radius: var(--radius-s); padding: 12px; background: var(--paper); }
  .accesos-text { font-family: var(--font-mono); font-size: 12.5px; white-space: pre-wrap; word-break: break-word; margin: 0 0 10px; color: var(--ink); }

  /* ---------- Form / overlay ---------- */
  .overlay {
    position: fixed; inset: 0; z-index: 50;
    background: rgba(15, 22, 18, .45);
    display: flex; align-items: flex-end; justify-content: center;
  }
  .sheet {
    background: var(--surface); width: 100%; max-width: 480px;
    border-radius: 20px 20px 0 0;
    max-height: 92dvh; overflow-y: auto;
    padding: 18px 18px calc(20px + env(safe-area-inset-bottom));
    box-shadow: var(--shadow-2);
  }
  @media (min-width: 640px) {
    .overlay { align-items: center; }
    .sheet { border-radius: var(--radius-m); max-height: 88dvh; }
  }
  .sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
  .sheet-head h2 { font-size: 17px; margin: 0; }

  .field { margin-bottom: 14px; }
  .field label { display: block; font-size: 12.5px; font-weight: 700; color: var(--ink-muted); margin-bottom: 6px; }
  .field input, .field select, .field textarea {
    width: 100%; border: 1px solid var(--border); border-radius: var(--radius-s);
    padding: 10px 12px; background: var(--paper);
  }
  .field textarea { resize: vertical; min-height: 64px; }
  .field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .field-divider { display: flex; align-items: center; gap: 10px; margin: 18px 0 12px; }
  .field-divider span { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-muted); white-space: nowrap; }
  .field-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
  .field-hint { font-size: 11.5px; color: var(--ink-muted); margin: 6px 0 0; }
  .sheet-actions { display: flex; gap: 10px; margin-top: 6px; }
  .sheet-actions .btn { flex: 1; }

  /* ---------- Settings ---------- */
  .settings-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-m);
    padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow-1);
  }
  .settings-card h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-muted); margin: 0 0 12px; }
  .profile-row { display: flex; align-items: center; gap: 12px; }
  .profile-row .name { font-weight: 700; font-size: 15px; }
  .profile-row .role { font-size: 12.5px; color: var(--ink-muted); }
  .settings-subhead { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-muted); margin: 16px 0 8px; }
  .segmented { display: flex; background: var(--surface-2); border-radius: var(--radius-s); padding: 3px; gap: 3px; }
  .segmented button { flex: 1; border: none; background: none; padding: 8px 6px; border-radius: 7px; font-weight: 700; font-size: 12.5px; color: var(--ink-muted); }
  .segmented button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
  .about-text { font-size: 13.5px; color: var(--ink-muted); line-height: 1.55; }

  /* ---------- Placeholder modules ---------- */
  .placeholder-state { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 52px 20px; }
  .placeholder-icon { width: 46px; height: 46px; border-radius: var(--radius-full); background: var(--surface-2); display: grid; place-items: center; color: var(--ink-muted); }
  .placeholder-icon svg { width: 22px; height: 22px; }
  .placeholder-state p { max-width: 320px; margin: 0; }
  .placeholder-tag { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--pine); margin-top: 2px !important; }
  :root[data-theme="dark"] .placeholder-tag { color: var(--sprout); }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .placeholder-tag { color: var(--sprout); }
  }

  /* ---------- Confirm dialog ---------- */
  .confirm-sheet { text-align: center; }
  .confirm-icon {
    width: 52px; height: 52px; border-radius: var(--radius-full);
    background: var(--danger-bg); color: var(--danger);
    display: grid; place-items: center; margin: 4px auto 14px;
  }
  .confirm-icon svg { width: 23px; height: 23px; }
  .confirm-title { font-size: 17px; margin: 0 0 8px; }
  .confirm-message { font-size: 13.5px; color: var(--ink-muted); margin: 0 0 20px; line-height: 1.5; }

  /* ---------- Más sheet (mobile) ---------- */
  .more-list { display: flex; flex-direction: column; gap: 2px; }
  .more-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 8px; border-radius: var(--radius-s);
    background: none; border: none; text-align: left;
    font-weight: 600; font-size: 14.5px; width: 100%;
  }
  .more-item svg { width: 19px; height: 19px; color: var(--ink-muted); flex-shrink: 0; }
  .more-item:hover { background: var(--surface-2); }

/* ---------- Login ---------- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--paper);
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-2);
  padding: 32px 28px;
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  color: var(--pine-strong);
  margin-bottom: 22px;
}
.login-brand .brand-mark {
  width: 32px; height: 32px; border-radius: var(--radius-full);
  background: var(--pine); color: var(--pine-ink);
  display: grid; place-items: center;
}
.login-brand .brand-mark svg { width: 18px; height: 18px; }
.login-error {
  background: var(--danger-bg); color: var(--danger);
  border-radius: var(--radius-s); padding: 10px 12px;
  font-size: 13.5px; margin-bottom: 16px;
}
.login-hint {
  margin-top: 18px; font-size: 12.5px; color: var(--ink-muted); text-align: center;
}

/* ---------- Importar contactos desde CSV ---------- */
.import-steps {
  display: flex; flex-wrap: wrap; gap: 6px 16px;
  margin-bottom: 20px; padding-bottom: 14px; border-bottom: 1px solid var(--border);
  font-size: 12.5px; font-weight: 700; color: var(--ink-muted);
}
.import-step.is-active { color: var(--pine); }
:root[data-theme="dark"] .import-step.is-active { color: var(--sprout); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .import-step.is-active { color: var(--sprout); } }
.import-step.is-done { color: var(--ink); }

.import-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-s); }
.import-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.import-table th, .import-table td { padding: 10px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.import-table thead th { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-muted); background: var(--surface-2); white-space: nowrap; }
.import-table tbody tr:last-child td { border-bottom: none; }
.import-table select { width: 100%; min-width: 160px; border: 1px solid var(--border); border-radius: var(--radius-s); padding: 7px 9px; background: var(--paper); }
.import-col-title { color: var(--ink-muted); font-size: 12px; margin-top: 2px; }
.import-examples { color: var(--ink-muted); max-width: 260px; }

.import-checkbox { display: flex; align-items: center; gap: 9px; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.import-checkbox input { width: auto; }

.import-summary { display: flex; flex-wrap: wrap; gap: 20px; margin-bottom: 18px; }
.import-summary-item { display: flex; flex-direction: column; gap: 2px; min-width: 120px; }
.import-summary-num { font-size: 24px; font-weight: 700; font-family: var(--font-display); line-height: 1; }
.import-summary-item span:last-child { font-size: 12.5px; color: var(--ink-muted); }

.import-radio-group { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; margin-bottom: 18px; }
.import-radio {
  display: flex; align-items: center; gap: 10px; font-size: 13.5px;
  border: 1px solid var(--border); border-radius: var(--radius-s); padding: 10px 12px; cursor: pointer;
}
.import-radio input { width: auto; }

.pill-import-nuevo { background: var(--info-bg); color: var(--info); }
.pill-import-existe { background: var(--warning-bg); color: var(--warning); }

/* ---------- Enlaces usados como botones de navegación (sin subrayado) ---------- */
.sidebar-link, .sidebar-cta, .nav-btn, .nav-fab, .avatar-btn, .more-item, .back-link, .link-btn,
.activity-row, .contact-row {
  text-decoration: none;
}
.link-btn, .btn { cursor: pointer; }

