/* ============================================================
   Bienestar ERP — Jobie-style design system (v1.1.7)
   Adapted from prototype design into WordPress theme
   ============================================================ */

/* ── Design tokens ────────────────────────────────────────────────────────── */
:root {
  /* Brand */
  --primary:        #5D5FEF;
  --primary-deep:   #4B3EE3;
  --primary-darker: #3B2FB8;
  --primary-50:     #F4F3FF;
  --primary-100:    #ECEAFD;
  --primary-200:    #D8D4FB;
  --primary-300:    #B6B0F7;

  /* Sidebar */
  --sb-bg:          linear-gradient(180deg, #5D5FEF 0%, #4B3EE3 100%);
  --sb-text:        rgba(255,255,255,0.78);
  --sb-text-strong: #ffffff;
  --sb-active-bg:   #ffffff;
  --sb-active-text: #4B3EE3;

  /* Surfaces */
  --bg:         #F7F7FB;
  --surface:    #ffffff;
  --surface-2:  #FAFAFE;
  --surface-3:  #F3F3F8;
  --border:     #ECECF3;
  --border-strong: #DCDCE6;

  /* Text */
  --ink:   #11142D;
  --ink-2: #1B1D2A;
  --muted: #808191;
  --muted-2: #B2B3BD;

  /* Accents */
  --accent-orange: #FF7A50;
  --accent-green:  #29B473;
  --accent-teal:   #2EC4B6;
  --accent-pink:   #E84393;
  --accent-blue:   #3E7BFA;
  --accent-yellow: #FFB547;
  --accent-red:    #FF5252;

  /* Status pills */
  --st-confirmed-bg:  #E4F8EE;
  --st-confirmed-fg:  #1F9D60;
  --st-pending-bg:    #FFF4DE;
  --st-pending-fg:    #B7791F;
  --st-cancel-bg:     #FFE3E3;
  --st-cancel-fg:     #C0392B;
  --st-hold-bg:       #FFEFD6;
  --st-hold-fg:       #C57A1B;
  --st-candidate-bg:  #22C55E;
  --st-candidate-fg:  #ffffff;

  /* Radii */
  --r-xs:   6px;
  --r-sm:   10px;
  --r-md:   14px;
  --r-lg:   20px;
  --r-xl:   28px;
  --r-pill: 999px;

  /* Shadows */
  --shadow-sm:      0 2px 6px  rgba(38,42,78,0.04);
  --shadow-md:      0 8px 24px rgba(38,42,78,0.06);
  --shadow-lg:      0 20px 60px rgba(38,42,78,0.10);
  --shadow-sidebar: 18px 0 60px rgba(75,62,227,0.18);

  /* Density */
  --density-row: 64px;
  --density-pad: 22px;
  --density-card-pad: 22px;

  /* Fonts */
  --font-sans: "Plus Jakarta Sans", "Inter", system-ui, -apple-system, sans-serif;

  /* CB legacy aliases — used in existing PHP components */
  --cb-primary:       var(--primary);
  --cb-primary-dark:  var(--primary-deep);
  --cb-primary-light: var(--primary-100);
  --cb-secondary:     #F45CC4;
  --cb-bg:            var(--bg);
  --cb-card:          var(--surface);
  --cb-text:          var(--ink);
  --cb-muted:         var(--muted);
  --cb-border:        var(--border);
  --cb-success:       var(--accent-green);
  --cb-warning:       var(--accent-yellow);
  --cb-danger:        var(--accent-red);
  --cb-info:          var(--accent-blue);
  --cb-radius:        var(--r-lg);
  --cb-shadow:        var(--shadow-sm);
  --cb-shadow-lg:     var(--shadow-lg);
  --cb-text-muted:    var(--muted);
  --cb-surface:       var(--surface);
}

/* ── Dark mode ────────────────────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg:          #14152B;
  --surface:     #1B1D36;
  --surface-2:   #20223F;
  --surface-3:   #262849;
  --border:      #2A2D52;
  --border-strong:#353869;
  --ink:         #F4F5FB;
  --ink-2:       #E1E3F1;
  --muted:       #8C8FB2;
  --muted-2:     #6A6D90;
  --st-confirmed-bg: rgba(31,157,96,0.18);
  --st-pending-bg:   rgba(183,121,31,0.18);
  --st-cancel-bg:    rgba(192,57,43,0.18);
  --st-hold-bg:      rgba(197,122,27,0.18);
}

/* ── Density ──────────────────────────────────────────────────────────────── */
[data-density="compact"]     { --density-row:48px; --density-pad:14px; --density-card-pad:16px; }
[data-density="comfortable"] { --density-row:72px; --density-pad:26px; --density-card-pad:28px; }

/* ── Reset ────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { margin-top: 0 !important; }
html, body { height: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: geometricPrecision;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; }

/* ============================================================
   APP SHELL
   ============================================================ */
.app,
.cb-app-shell {
  display: grid;
  grid-template-columns: 232px 1fr;
  min-height: 100vh;
  background: var(--bg);
}
.app[data-collapsed="true"],
.cb-app-shell[data-collapsed="true"] {
  grid-template-columns: 84px 1fr;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar,
.cb-sidebar {
  background: var(--sb-bg);
  color: var(--sb-text);
  padding: 22px 16px 16px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  box-shadow: var(--shadow-sidebar);
  z-index: 5;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Logo / brand */
.sb-logo,
.cb-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 22px;
  flex-shrink: 0;
}
.sb-logo .glyph {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: #fff;
  display: grid; place-items: center;
  color: var(--primary-deep);
  font-size: 22px; font-weight: 800;
  flex-shrink: 0;
}
.sb-logo .word {
  font-size: 20px; font-weight: 800;
  color: #fff; letter-spacing: 0.5px;
  white-space: nowrap;
}
.cb-brand span {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: grid; place-items: center;
  font-size: 18px; font-weight: 800;
  flex-shrink: 0;
}
.cb-brand strong { color: #fff; font-size: 16px; font-weight: 800; white-space: nowrap; }
.cb-brand-logo {
  width: 38px; height: 38px;
  border-radius: 50%; object-fit: cover;
  background: rgba(255,255,255,0.2);
  flex-shrink: 0;
}

/* Nav */
.sb-nav {
  list-style: none;
  display: flex; flex-direction: column;
  gap: 2px;
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
}
.sb-nav::-webkit-scrollbar { width: 4px; }
.sb-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }

.cb-sidebar nav {
  display: flex; flex-direction: column;
  gap: 2px; flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
}
.cb-sidebar nav::-webkit-scrollbar { width: 4px; }
.cb-sidebar nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }

/* Nav items */
.sb-item,
.cb-sidebar a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 14px;
  color: var(--sb-text);
  font-weight: 500;
  font-size: 13px;
  transition: background 0.18s, color 0.18s, box-shadow 0.18s;
  text-decoration: none;
  white-space: nowrap;
}
.sb-item:hover,
.cb-sidebar a:not(.is-active):hover {
  background: rgba(255,255,255,0.10);
  color: var(--sb-text-strong);
}
.sb-item.active,
.cb-sidebar a.is-active {
  background: var(--sb-active-bg);
  color: var(--sb-active-text);
  font-weight: 700;
  box-shadow: 0 10px 22px rgba(0,0,0,0.10), 0 2px 6px rgba(0,0,0,0.06);
}
.sb-item .icon {
  width: 20px; height: 20px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.sb-item.active .icon { color: var(--primary-deep); }

.cb-sidebar-icon {
  width: 18px; height: 18px;
  flex: 0 0 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.cb-sidebar a.is-active .cb-sidebar-icon { color: var(--primary-deep); }

/* Sidebar footer */
.sb-foot,
.cb-help {
  margin-top: auto;
  padding: 14px 4px 0;
  color: rgba(255,255,255,0.55);
  font-size: 11px;
  line-height: 1.6;
  flex-shrink: 0;
}
.sb-foot strong { color: rgba(255,255,255,0.85); font-weight: 600; display: block; margin-bottom: 4px; }
.sb-heart { color: #FF5C8A; }
.cb-help {
  display: block;
  padding: 12px 8px;
  border-radius: 12px;
  background: rgba(255,255,255,0.1);
  text-align: center;
  font-weight: 600;
  font-size: 12px;
  transition: background 0.15s;
  text-decoration: none;
}
.cb-help:hover { background: rgba(255,255,255,0.18); color: rgba(255,255,255,0.85); }

/* ── Collapsed state ─────────────────────────────────────────────────────── */
[data-collapsed="true"] .sidebar,
[data-collapsed="true"] .cb-sidebar { padding: 22px 12px; }

[data-collapsed="true"] .sb-logo .word,
[data-collapsed="true"] .sb-item .label,
[data-collapsed="true"] .sb-item span:not(.icon),
[data-collapsed="true"] .sb-foot,
[data-collapsed="true"] .cb-help,
[data-collapsed="true"] .cb-brand strong { display: none; }

[data-collapsed="true"] .sb-item .icon,
[data-collapsed="true"] .cb-sidebar a .icon { display: grid; width: 20px; height: 20px; }

[data-collapsed="true"] .sb-item,
[data-collapsed="true"] .cb-sidebar a { justify-content: center; padding: 12px; border-radius: 12px; }

[data-collapsed="true"] .sb-logo,
[data-collapsed="true"] .cb-brand { justify-content: center; padding-left: 0; padding-right: 0; }

/* ============================================================
   MAIN
   ============================================================ */
.main,
.cb-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar,
.cb-topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 18px 32px;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 4;
}

/* Burger button — toggle sidebar */
.tb-burger {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: grid; place-items: center;
  color: var(--ink);
  transition: background 0.15s;
  flex-shrink: 0;
}
.tb-burger:hover { background: var(--surface-3); }
.tb-burger svg { width: 22px; height: 22px; stroke: currentColor; stroke-width: 2; stroke-linecap: round; fill: none; }

/* Title */
.tb-title { font-size: 20px; font-weight: 700; color: var(--ink); margin: 0; flex-shrink: 0; }
.cb-topbar h1 { font-size: 20px; font-weight: 700; color: var(--ink); }
.cb-topbar p { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* Search pill */
.tb-search,
.cb-search {
  flex: 1;
  max-width: 520px;
  background: var(--surface);
  border-radius: var(--r-pill);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  height: 48px;
  box-shadow: var(--shadow-sm);
  color: var(--muted);
  border: 1px solid var(--border);
}
.tb-search input,
.cb-search input {
  border: none; background: transparent; outline: none;
  flex: 1; font-size: 14px; color: var(--ink);
}
.tb-search input::placeholder,
.cb-search input::placeholder { color: var(--muted-2); }
.cb-search-icon,
.tb-search svg { width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; flex-shrink: 0; }
.cb-search span { display: none; } /* visually hidden label */

/* Actions */
.tb-actions,
.cb-topbar-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; position: relative; }

/* Icon buttons in topbar */
.tb-icon {
  position: relative;
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--surface);
  display: grid; place-items: center;
  box-shadow: var(--shadow-sm);
  color: var(--ink-2);
  border: 1px solid var(--border);
  transition: border-color 0.15s, color 0.15s;
}
.tb-icon:hover { border-color: var(--primary); color: var(--primary-deep); }
.tb-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* cb-icon-btn alias */
.cb-icon-btn {
  position: relative;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--surface);
  display: grid; place-items: center;
  box-shadow: var(--shadow-sm);
  color: var(--ink-2);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.cb-icon-btn:hover { border-color: var(--primary); color: var(--primary-deep); }
.cb-icon-btn svg, .cb-row-actions svg {
  width: 16px; height: 16px;
  fill: none; stroke: currentColor;
  stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
}

/* Badge on icon buttons */
.tb-icon .badge,
.cb-badge-dot {
  position: absolute;
  top: -4px; right: -4px;
  min-width: 22px; height: 22px;
  padding: 0 5px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 10px; font-weight: 700;
  display: grid; place-items: center;
  border: 2px solid var(--bg);
}
.tb-icon .badge.pink { background: #E84393; }
.cb-badge-dot { min-width: 9px; height: 9px; padding: 0; background: var(--accent-red); top: 6px; right: 6px; }

/* User meta in topbar */
.tb-user { display: flex; align-items: center; gap: 12px; padding-left: 8px; }
.tb-user .avatar {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FFB547, #FF7A50);
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 16px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  flex-shrink: 0;
}
.tb-user .name { font-weight: 700; color: var(--ink); font-size: 14px; line-height: 1.2; }
.tb-user .role { color: var(--muted); font-size: 12px; }

/* cb-avatar alias */
.cb-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #E0DEFF, #C7C4FF);
  display: grid; place-items: center;
  color: var(--primary-deep);
  font-weight: 700; font-size: 14px;
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(93,95,239,0.18);
  overflow: hidden;
  flex-shrink: 0;
}
.cb-avatar img { width: 100%; height: 100%; object-fit: cover; }
.cb-avatar-button { border: 0; }
.cb-user-meta { display: grid; gap: 1px; line-height: 1.2; cursor: pointer; }
.cb-user-meta strong { font-size: 12px; font-weight: 700; color: var(--ink); }
.cb-user-meta span { font-size: 11px; color: var(--muted); }

/* ============================================================
   CONTENT WRAPPER
   ============================================================ */
.content,
.cb-content-wrap { padding: 8px 32px 36px; }
.cb-content { display: grid; gap: 20px; padding: 0 32px 36px; }

/* Page head */
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-head h2 { margin: 0; font-size: 20px; font-weight: 700; color: var(--ink); }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* cb-topbar used as page head inside content */
.cb-main > .cb-topbar { margin-bottom: 0; padding: 18px 32px; }

/* ============================================================
   CARDS
   ============================================================ */
.card,
.cb-card,
.cb-integration-card,
.cb-automation-card,
.cb-auth-card {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: var(--density-card-pad);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
}
.card-hover:hover,
.cb-card-hover:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.card-flat,
.cb-card-flat { box-shadow: none; border: 1px solid var(--border); }

/* ── Subscription / billing screen ──────────────────────────────────────── */
.cb-billing-screen { display: flex; flex-direction: column; gap: 18px; }
.cb-card-danger { border: 1px solid #FCA5A5; background: #FEF2F2; }
.cb-card-warning { border: 1px solid #FCD34D; background: #FFFBEB; }

/* Period toggle (Mensual / Anual) */
.cb-billing-period-toggle {
  display: inline-flex;
  align-items: center;
  background: var(--surface-alt, #f3f4f6);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
  align-self: center;
}
.cb-billing-period-btn {
  padding: 7px 20px;
  border-radius: 999px;
  border: none;
  background: transparent;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-muted, #6b7280);
  cursor: pointer;
  transition: background .18s, color .18s, box-shadow .18s;
  white-space: nowrap;
}
.cb-billing-period-btn:hover { color: var(--ink); }
.cb-billing-period-btn.is-active {
  background: #fff;
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0,0,0,.12);
}
.cb-billing-period-badge {
  display: inline-block;
  background: #dcfce7;
  color: #16a34a;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  margin-left: 5px;
  vertical-align: middle;
}
.cb-billing-period-btn.is-active .cb-billing-period-badge {
  background: #bbf7d0;
}

.cb-billing-plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.cb-billing-plan-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cb-billing-plan-card.is-popular { border-color: var(--primary); box-shadow: 0 8px 28px rgba(0,0,0,.08); }
.cb-billing-plan-card.is-current { border-color: #10B981; }
.cb-billing-plan-tag {
  position: absolute; top: -11px; left: 18px;
  background: var(--primary); color: #fff; font-size: 11px; font-weight: 700;
  padding: 4px 10px; border-radius: 999px;
}
.cb-billing-plan-card h3 { margin: 6px 0 0; }
.cb-billing-plan-price { font-size: 22px; margin: 6px 0 4px; }
.cb-billing-plan-price strong { font-size: 28px; }
.cb-billing-plan-card .cb-btn { margin-top: auto; width: 100%; }
.cb-billing-plan-btns { display: flex; flex-direction: column; gap: 8px; margin-top: auto; }
.cb-billing-plan-features { list-style: none; padding: 0; margin: 4px 0 0; font-size: 13.5px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.cb-billing-plan-features li { display: flex; align-items: flex-start; gap: 7px; line-height: 1.4; }
.cb-feat-ck { flex-shrink: 0; width: 15px; height: 15px; color: #16a34a; margin-top: 1px; }
.cb-feat-inc { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding-bottom: 2px; }

.cb-card h2,
.cb-integration-card h3,
.cb-automation-card h3 {
  font-size: 16px; font-weight: 700;
  color: var(--ink); margin-bottom: 14px;
  letter-spacing: -0.01em;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--r-pill);
  font-weight: 700;
  font-size: 13px;
  transition: all 0.15s;
  white-space: nowrap;
  cursor: pointer;
}
.btn-primary {
  background: var(--primary-deep);
  color: #fff;
  box-shadow: 0 8px 20px rgba(75,62,227,0.25);
}
.btn-primary:hover { background: var(--primary-darker); transform: translateY(-1px); }
.btn-ghost {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface-3); }
.btn-light {
  background: var(--primary-50);
  color: var(--primary-deep);
}
.btn-light:hover { background: var(--primary-100); }

/* cb-btn aliases */
.cb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 20px;
  border: 0;
  border-radius: var(--r-pill);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s;
}
.cb-btn:active { transform: scale(0.97); }
.cb-btn-primary { background: var(--primary-deep); color: #fff; box-shadow: 0 8px 20px rgba(75,62,227,0.25); }
.cb-btn-primary:hover { background: var(--primary-darker); }
.cb-btn-soft { background: var(--primary-50); color: var(--primary-deep); }
.cb-btn-soft:hover { background: var(--primary-100); }
.cb-btn-full { width: 100%; }

/* ============================================================
   CHIPS / FILTERS
   ============================================================ */
.chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border-radius: var(--r-pill);
  font-weight: 600;
  font-size: 13px;
  color: var(--primary-deep);
  background: var(--primary-50);
  cursor: pointer;
  transition: all 0.15s;
}
.chip:hover { background: var(--primary-100); }
.chip.active { background: var(--primary-deep); color: #fff; }
.chip.muted { color: var(--muted); background: transparent; cursor: default; }

/* cb-chips */
.cb-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cb-chip {
  display: inline-flex; align-items: center;
  padding: 6px 14px;
  border: 1.5px solid var(--primary);
  border-radius: var(--r-pill);
  background: transparent; color: var(--primary-deep);
  font-size: 12px; font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.cb-chip:hover { background: var(--primary-deep); color: #fff; }

/* ============================================================
   PILLS (status badges)
   ============================================================ */
.pill {
  display: inline-flex; align-items: center;
  padding: 5px 13px;
  border-radius: var(--r-pill);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.pill.confirmed { background: var(--st-confirmed-bg); color: var(--st-confirmed-fg); }
.pill.pending   { background: var(--st-pending-bg);   color: var(--st-pending-fg); }
.pill.cancel    { background: var(--st-cancel-bg);     color: var(--st-cancel-fg); }
.pill.hold      { background: var(--st-hold-bg);       color: var(--st-hold-fg); }
.pill.candidate { background: var(--st-candidate-bg);  color: var(--st-candidate-fg); }
.pill.remote    { background: var(--primary-100);      color: var(--primary-deep); }

/* cb-badge aliases */
.cb-badge {
  display: inline-flex; align-items: center;
  min-height: 22px; padding: 0 11px;
  border-radius: var(--r-pill);
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.3px; text-transform: uppercase;
}
.cb-badge-success { background: var(--st-confirmed-bg); color: var(--st-confirmed-fg); }
.cb-badge-warning { background: var(--st-pending-bg); color: var(--st-pending-fg); }
.cb-badge-danger  { background: var(--st-cancel-bg); color: var(--st-cancel-fg); }
.cb-badge-neutral { background: var(--primary-100); color: var(--primary-deep); }
.cb-badge-info    { background: #DBEAFE; color: #1D4ED8; }

/* ============================================================
   LOGO TILES (Jobie company tiles — patient avatars)
   ============================================================ */
.logo-tile {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: grid; place-items: center;
  color: #fff;
  font-weight: 700; font-size: 18px;
  flex-shrink: 0;
}
.logo-tile.sm { width: 40px; height: 40px; border-radius: 10px; font-size: 14px; }
.logo-tile.lg { width: 72px; height: 72px; border-radius: 18px; font-size: 26px; }

.lt-orange { background: var(--accent-orange); }
.lt-green  { background: var(--accent-green); }
.lt-teal   { background: var(--accent-teal); }
.lt-pink   { background: var(--accent-pink); }
.lt-blue   { background: var(--accent-blue); }
.lt-yellow { background: var(--accent-yellow); }
.lt-purple { background: var(--primary); }
.lt-red    { background: var(--accent-red); }

/* cb-person alias */
.cb-person { display: inline-flex; align-items: center; gap: 10px; min-width: 140px; }
.cb-person-avatar {
  display: grid; width: 36px; height: 36px;
  flex: 0 0 36px; place-items: center;
  border-radius: 10px;
  background: var(--primary-100);
  color: var(--primary-deep);
  font-size: 13px; font-weight: 700;
}
.cb-person strong { display: block; font-size: 13px; font-weight: 600; color: var(--ink); }
.cb-person small  { display: block; margin-top: 1px; color: var(--muted); font-size: 11px; }

/* ============================================================
   STAT CARDS
   ============================================================ */
.stat-grid,
.cb-kpi-grid,
.cb-dashboard-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 22px;
  margin-bottom: 22px;
}

.stat,
.cb-kpi {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  box-shadow: var(--shadow-sm);
  border: 0;
}
.stat .ico,
.cb-kpi-icon {
  width: 56px; height: 56px;
  border-radius: 18px;
  display: grid; place-items: center;
  background: var(--primary-100);
  color: var(--primary-deep);
  flex-shrink: 0;
  font-weight: 800; font-size: 22px;
}
.stat .ico svg,
.cb-kpi-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; }

.stat .num,
.cb-kpi strong { font-size: 28px; font-weight: 800; color: var(--ink); line-height: 1.1; display: block; }
.stat .lbl,
.cb-kpi p { color: var(--muted); font-size: 13px; margin-top: 4px; }
.stat .delta,
.cb-kpi small { font-size: 12px; color: var(--accent-green); font-weight: 700; margin-top: 4px; display: block; }
.stat .delta.neg { color: var(--accent-red); }

/* Gradient stat cards */
.stat.grad-blue,
.cb-dashboard-kpis .cb-kpi:nth-child(1) { background: linear-gradient(135deg, #6BB1FF 0%, #3E7BFA 100%); color: #fff; }
.stat.grad-green,
.cb-dashboard-kpis .cb-kpi:nth-child(2) { background: linear-gradient(135deg, #5BE3A6 0%, #29B473 100%); color: #fff; }
.stat.grad-orange,
.cb-dashboard-kpis .cb-kpi:nth-child(3) { background: linear-gradient(135deg, #FFB070 0%, #FF7A50 100%); color: #fff; }
.stat.grad-purple,
.cb-dashboard-kpis .cb-kpi:nth-child(4) { background: linear-gradient(135deg, #8A7BFF 0%, #4B3EE3 100%); color: #fff; }

.stat.grad-blue .num, .stat.grad-blue .lbl, .stat.grad-blue .delta,
.stat.grad-green .num, .stat.grad-green .lbl, .stat.grad-green .delta,
.stat.grad-orange .num, .stat.grad-orange .lbl, .stat.grad-orange .delta,
.stat.grad-purple .num, .stat.grad-purple .lbl, .stat.grad-purple .delta,
.cb-dashboard-kpis .cb-kpi strong,
.cb-dashboard-kpis .cb-kpi p,
.cb-dashboard-kpis .cb-kpi small { color: #fff; }
.stat.grad-blue .lbl, .stat.grad-green .lbl, .stat.grad-orange .lbl, .stat.grad-purple .lbl,
.cb-dashboard-kpis .cb-kpi p { opacity: 0.9; }
.cb-dashboard-kpis .cb-kpi small { opacity: 0.82; }
.cb-dashboard-kpis .cb-kpi .cb-kpi-icon { background: rgba(255,255,255,0.22); color: #fff; }
.cb-dashboard-kpis .cb-kpi .cb-kpi-icon svg { stroke: #fff; }

/* ============================================================
   TOOLBAR
   ============================================================ */
.cb-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}
.cb-toolbar-meta { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.cb-toolbar-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.cb-toolbar-count { font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }

/* ============================================================
   SEARCHBAR (page-level)
   ============================================================ */
.searchbar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border-radius: var(--r-pill);
  padding: 8px 12px 8px 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  margin-bottom: 20px;
}
.searchbar .loc {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; color: var(--ink);
  padding: 0 14px; border-right: 1px solid var(--border);
  height: 36px; white-space: nowrap; font-size: 13px;
}
.searchbar input {
  flex: 1; border: none; outline: none; background: transparent;
  font-size: 14px; color: var(--ink); padding: 0 8px;
}
.searchbar input::placeholder { color: var(--muted-2); }

/* ============================================================
   TABLES
   ============================================================ */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.table thead th {
  text-align: left;
  font-weight: 600; font-size: 12px;
  color: var(--muted);
  padding: 14px 18px;
  background: transparent;
  border-bottom: 1px solid var(--border);
}
.table tbody td {
  padding: 18px;
  font-size: 14px;
  color: var(--ink-2);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  background: var(--surface);
}
.table tbody tr { transition: background 0.15s; }
.table tbody tr:hover td { background: var(--primary-50); }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:first-child td:first-child { border-top-left-radius: var(--r-md); }
.table tbody tr:first-child td:last-child  { border-top-right-radius: var(--r-md); }
.table tbody tr:last-child td:first-child  { border-bottom-left-radius: var(--r-md); }
.table tbody tr:last-child td:last-child   { border-bottom-right-radius: var(--r-md); }

.table-wrap,
.cb-table-wrap {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 8px;
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid var(--border);
}

/* cb-table aliases */
.cb-table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 680px; }
.cb-table th {
  text-align: left; font-weight: 600; font-size: 12px;
  color: var(--muted); padding: 14px 18px;
  background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.cb-table td {
  padding: 16px 18px; font-size: 14px;
  color: var(--ink-2); border-bottom: 1px solid var(--border);
  vertical-align: middle; background: var(--surface);
  height: var(--density-row);
}
.cb-table tbody tr { transition: background 0.15s; }
.cb-table tbody tr:hover td { background: var(--primary-50); }
.cb-table tbody tr:last-child td { border-bottom: none; }

/* Row actions */
.cb-row-actions { display: inline-flex; align-items: center; gap: 6px; }
.cb-row-actions button {
  display: grid; width: 34px; height: 34px;
  place-items: center;
  border: 1.5px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  position: relative;
  transition: border-color 0.15s, color 0.15s, background 0.15s, box-shadow 0.15s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.cb-row-actions button:hover {
  border-color: var(--primary);
  color: var(--primary-deep);
  background: var(--primary-50);
  box-shadow: 0 2px 8px rgba(93,95,239,0.15);
}
.cb-row-actions svg {
  width: 16px; height: 16px;
  fill: none; stroke: currentColor;
  stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
  pointer-events: none;
}

/* Tooltip on action buttons */
.cb-row-actions button[title]::after {
  content: attr(title);
  position: absolute;
  bottom: calc(100% + 7px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--ink);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-sans);
  padding: 4px 9px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s, transform 0.15s;
  z-index: 200;
}
.cb-row-actions button[title]:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================================================
   TILE GRID (grid view for patients, etc.)
   ============================================================ */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}
.tile {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 12px;
  transition: all 0.2s;
  cursor: pointer;
  border: 1px solid var(--border);
}
.tile:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }

/* ============================================================
   PATIENT DETAIL DRAWER
   ============================================================ */
.drawer-back {
  position: fixed; inset: 0;
  background: rgba(17,20,45,0.40);
  z-index: 50;
  animation: fadeIn 0.2s ease;
}
.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 480px; max-width: 96vw;
  background: var(--bg);
  z-index: 51;
  box-shadow: -20px 0 60px rgba(0,0,0,0.16);
  display: flex; flex-direction: column;
  animation: slideIn 0.25s ease;
  overflow-y: auto;
}
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
@keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }

/* ============================================================
   TOGGLE SWITCH
   ============================================================ */
.toggle {
  position: relative;
  width: 38px; height: 22px;
  border-radius: var(--r-pill);
  background: var(--border-strong);
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
}
.toggle.on { background: var(--primary-deep); }
.toggle::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: left 0.18s;
}
.toggle.on::after { left: 19px; }
.toggle-row { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 13px; font-weight: 600; }

/* ============================================================
   CALENDAR
   ============================================================ */
.cb-calendar-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 20px;
}

.cal-grid,
.cb-calendar-grid {
  display: grid;
  grid-template-columns: 72px repeat(7, minmax(86px, 1fr));
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.cal-head, .cal-cell, .cal-hour,
.cb-calendar-grid > * {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 10px 12px;
  font-size: 12px;
  min-height: var(--density-row);
  position: relative;
}
.cal-head {
  background: var(--surface-2);
  font-weight: 700; color: var(--ink);
  min-height: auto; padding: 14px 12px;
  text-align: center;
}
.cal-head .dnum { font-size: 18px; font-weight: 800; margin-top: 4px; color: var(--ink); }
.cal-head.today .dnum { color: var(--primary-deep); }
.cal-hour {
  background: var(--surface-2);
  color: var(--muted); font-weight: 600;
  text-align: right;
  display: flex; align-items: flex-start; justify-content: flex-end;
}
.cb-hour { color: var(--muted); font-size: 11px; }

.cal-event,
.cb-event {
  position: absolute;
  left: 6px; right: 6px;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 11px; font-weight: 700;
  color: #fff; overflow: hidden; cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}
.cal-event .who { opacity: 0.9; font-weight: 500; }
.cal-event.purple, .cb-event-purple { background: linear-gradient(135deg,#8A7BFF,#4B3EE3); }
.cal-event.orange { background: linear-gradient(135deg,#FFB070,#FF7A50); }
.cal-event.green, .cb-event-green  { background: linear-gradient(135deg,#5BE3A6,#29B473); }
.cal-event.teal   { background: linear-gradient(135deg,#71E6DD,#2EC4B6); }
.cal-event.pink, .cb-event-pink   { background: linear-gradient(135deg,#FF6BAA,#E84393); }

.cb-calendar-grid--day { grid-template-columns: 72px minmax(200px,1fr); }

.cb-calendar-month { border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.cb-month-header { display: grid; grid-template-columns: repeat(7,1fr); background: var(--surface-2); border-bottom: 1px solid var(--border); }
.cb-month-header span { padding: 10px; font-size: 11px; font-weight: 700; color: var(--muted); text-align: center; text-transform: uppercase; letter-spacing: 0.04em; }
.cb-month-grid { display: grid; grid-template-columns: repeat(7,1fr); }
.cb-month-cell { min-height: 80px; padding: 8px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--surface); }
.cb-month-cell--empty { background: var(--surface-2); }
.cb-month-cell.is-today { background: var(--primary-100); }
.cb-month-day { display: block; font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.cb-month-events { display: inline-block; font-size: 11px; background: var(--primary); color: #fff; border-radius: var(--r-pill); padding: 2px 8px; }

.cb-mini-calendar, .cb-upload {
  display: grid; min-height: 128px; place-items: center;
  margin-bottom: 16px; border: 1.5px dashed var(--border);
  border-radius: 14px; background: var(--surface-2);
  color: var(--primary); font-size: 28px; font-weight: 800;
}

/* ============================================================
   FORMS / FIELDS
   ============================================================ */
.cb-field {
  display: grid; gap: 6px;
  margin-bottom: 14px;
  color: var(--muted); font-size: 12px; font-weight: 600;
}
.cb-field input,
.cb-field select,
.cb-field textarea,
.cb-input {
  min-height: 44px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  padding: 0 12px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}
.cb-field input:focus,
.cb-field select:focus,
.cb-field textarea:focus,
.cb-input:focus { border-color: var(--primary); }
.cb-field textarea { min-height: 100px; padding: 10px 12px; resize: vertical; }

/* ============================================================
   MODAL
   ============================================================ */
.cb-modal {
  position: fixed; z-index: 99999; inset: 0;
  display: grid; place-items: center; padding: 20px;
  background: rgba(17,20,45,0.42);
  backdrop-filter: blur(4px);
}
.cb-modal[hidden] { display: none; }
.cb-modal-panel {
  position: relative;
  width: min(580px, 100%);
  max-height: min(760px, 90vh);
  overflow: auto;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}
.cb-modal-panel h2 { font-size: 18px; font-weight: 700; color: var(--ink); margin-bottom: 18px; }
.cb-modal-close {
  display: grid; width: 32px; height: 32px;
  place-items: center; flex-shrink: 0;
  border: 0; border-radius: 8px;
  background: var(--primary-100); color: var(--primary-deep);
  cursor: pointer; font-size: 18px; line-height: 1;
}
/* Only the legacy single-panel modal floats its close button in the corner —
   the header-based modals (.cb-modal-header) lay it out inline so it can't
   stack on top of another absolutely-positioned close button. */
.cb-modal-panel > .cb-modal-close { position: absolute; top: 16px; right: 16px; }
.cb-modal-close:hover { background: var(--primary-200); }
.cb-modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ============================================================
   TABS / SEGMENTED
   ============================================================ */
.cb-tabs, .cb-segmented {
  display: flex; flex-wrap: wrap; gap: 4px;
  padding: 5px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow-sm);
}
.cb-tabs { margin-bottom: 18px; }
.cb-tabs button, .cb-segmented button {
  min-height: 34px; padding: 0 14px;
  border: 0; border-radius: 10px;
  background: transparent; color: var(--muted);
  cursor: pointer; font-size: 13px; font-weight: 600;
  transition: background 0.15s, color 0.15s;
}
.cb-tabs .is-active, .cb-segmented .is-active {
  background: var(--primary-100); color: var(--primary-deep); font-weight: 700;
}
.cb-tab-panel { display: none; }
.cb-tab-panel.is-active { display: block; }

/* ============================================================
   INTEGRATIONS / AUTOMATIONS
   ============================================================ */
.cb-integration-grid, .cb-automation-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 18px;
}
.cb-automation-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
.cb-integration-card { display: grid; min-height: 200px; padding: 20px; align-content: start; gap: 9px; }
.cb-integration-icon, .cb-automation-icon {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--primary-100); color: var(--primary-deep);
  display: grid; place-items: center;
}
.cb-integration-card p { margin: 0 0 14px; color: var(--muted); font-size: 13px; }
.cb-integration-card .cb-btn { margin-top: auto; width: 100%; }
.cb-integration-actions { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: auto; }
.cb-integration-actions .cb-btn { margin-top: 0; width: 100%; }
.cb-integration-actions .cb-btn:last-child { background: transparent; border: 1px solid var(--border); color: var(--muted); font-size: 12px; padding: 0 12px; }
.cb-automation-card { display: flex; align-items: flex-start; gap: 14px; min-height: 90px; padding: 18px; }
.cb-automation-tile { display: grid; gap: 10px; }
.cb-automation-actions { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; }
.cb-automation-actions .cb-btn { width: 100%; min-height: 36px; }
.cb-automation-card p { margin: 0; color: var(--muted); font-size: 12px; }

/* ============================================================
   TWO-COL / LAYOUT HELPERS
   ============================================================ */
.cb-two-col { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 20px; }
.row { display: flex; align-items: center; gap: 12px; }
.col { display: flex; flex-direction: column; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.bold { font-weight: 700; }
.divider { height: 1px; background: var(--border); margin: 18px 0; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.dotgrid {
  background-image: radial-gradient(circle, var(--primary-200) 1px, transparent 1.5px);
  background-size: 10px 10px;
}

/* ============================================================
   PAGINATION
   ============================================================ */
.cb-pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; color: var(--muted); font-size: 12px;
}
.cb-pagination div { display: flex; gap: 6px; }
.cb-pagination button {
  min-width: 32px; height: 32px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--muted);
  font-weight: 700; cursor: pointer;
}
.cb-pagination button.is-active { background: var(--primary-deep); color: #fff; border-color: var(--primary-deep); }

/* ============================================================
   TOAST
   ============================================================ */
.cb-toast {
  position: fixed; z-index: 100000;
  right: 22px; bottom: 22px;
  max-width: 360px; padding: 14px 18px;
  border-radius: 14px;
  background: var(--primary-deep); color: #fff;
  box-shadow: var(--shadow-lg); font-weight: 600; font-size: 13px;
}
.cb-toast[data-tone="error"]   { background: var(--accent-red); }
.cb-toast[data-tone="success"] { background: var(--accent-green); }

/* ============================================================
   MISC
   ============================================================ */
.cb-inline-search { min-height: 34px !important; margin-top: -4px; background: var(--surface-2) !important; font-size: 12px !important; }
.cb-message-detail { display: block; max-width: 360px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.cb-message-detail strong { color: var(--ink); font-weight: 600; }
.cb-card-link { display: inline-block; margin-top: 10px; color: var(--primary); font-size: 12px; font-weight: 700; }
.cb-detail-toolbar { box-shadow: none; }
.cb-detail-toolbar > div { display: flex; gap: 10px; }
.cb-patient-profile { margin-bottom: 16px; }
.cb-flow-toolbar { justify-content: flex-end; box-shadow: none; background: transparent; border: 0; padding: 0; }
.cb-reminder-list { display: grid; gap: 12px; }
.cb-reminder-list p { margin: 0; }
.cb-settings-form { display: grid; gap: 18px; }
.cb-settings-actions { display: flex; align-items: center; gap: 14px; }
.cb-inline-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.cb-settings-status, .cb-muted-text { color: var(--muted); }
.cb-eyebrow { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--primary); margin: 0 0 6px; }

.cb-plan-card { display: flex; align-items: center; gap: 14px; padding: 18px; margin-bottom: 14px; border-radius: 14px; background: var(--primary-100); }
.cb-plan-card h3 { margin: 0; color: var(--primary-deep); font-size: 20px; }
.cb-plan-card p { margin: 3px 0 0; color: var(--muted); }

.cb-clean-list { display: grid; gap: 8px; margin: 0 0 16px; padding: 0; list-style: none; color: var(--muted); font-weight: 600; }
.cb-clean-list li::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 8px; border-radius: 50%; background: var(--primary); }

/* Header popover */
.cb-header-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 9999;
  width: 220px; padding: 16px;
  border: 1px solid var(--border); border-radius: 16px;
  background: var(--surface); box-shadow: var(--shadow-lg);
  white-space: nowrap;
}
.cb-header-popover[hidden] { display: none; }
.cb-header-popover h3 { margin: 0 0 10px; color: var(--ink); font-size: 14px; font-weight: 700; }
.cb-header-popover p  { display: block; margin: 6px 0; color: var(--muted); font-size: 12px; }
.cb-header-popover a  { display: block; margin: 6px 0; color: var(--primary); font-size: 12px; font-weight: 700; }

/* Empty state */
.cb-empty-state { display: grid; place-items: center; padding: 48px 20px; text-align: center; color: var(--muted); }
.cb-empty-state p { margin: 6px 0 0; font-size: 13px; }

/* Module locked / upgrade screen */
.cb-module-locked {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 420px; text-align: center; padding: 48px 24px; gap: 10px;
}
.cb-module-locked-icon {
  width: 80px; height: 80px; border-radius: 50%;
  background: var(--surface-alt, #f4f4f5);
  display: grid; place-items: center; margin-bottom: 12px;
  color: var(--muted);
}
.cb-module-locked h2 { font-size: 22px; font-weight: 700; color: var(--ink); margin: 0; }
.cb-module-locked p { font-size: 14px; color: var(--muted); margin: 2px 0; max-width: 340px; }
.cb-module-locked .cb-btn { margin-top: 12px; min-width: 200px; }

/* Charts */
.cb-donut-card { display: flex; align-items: center; justify-content: center; gap: 34px; min-height: 180px; }
.cb-donut { width: 120px; height: 120px; border-radius: 50%; background: conic-gradient(var(--primary) 0 52%, #EC4899 52% 66%, var(--accent-blue) 66% 78%, #D8CCFF 78% 100%); position: relative; }
.cb-donut::after { content: ""; position: absolute; inset: 28px; border-radius: 50%; background: var(--surface); }
.cb-chart-legend { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; color: var(--muted); font-size: 12px; font-weight: 600; }
.cb-chart-legend li::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: var(--primary); }
.cb-chart-legend li:nth-child(2)::before { background: #EC4899; }
.cb-chart-legend li:nth-child(3)::before { background: var(--accent-blue); }
.cb-chart-legend li:nth-child(4)::before { background: #D8CCFF; }
.cb-chart-bars { display: flex; align-items: flex-end; gap: 14px; height: 150px; }
.cb-chart-bars span { display: block; width: 30px; border-radius: 8px 8px 0 0; background: linear-gradient(180deg,#8A7BFF,var(--primary-deep)); }
.cb-chart-bars span:nth-child(1){height:50%} .cb-chart-bars span:nth-child(2){height:70%} .cb-chart-bars span:nth-child(3){height:82%} .cb-chart-bars span:nth-child(4){height:64%} .cb-chart-bars span:nth-child(5){height:94%} .cb-chart-bars span:nth-child(6){height:74%}
.cb-chart-labels { display: flex; gap: 14px; margin-top: 8px; color: var(--muted); font-size: 11px; font-weight: 600; }
.cb-dashboard-controls { display: flex; justify-content: flex-end; margin-top: -54px; margin-bottom: 22px; pointer-events: none; }
.cb-period { width: 110px; min-height: 34px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--muted); font-size: 12px; font-weight: 600; pointer-events: auto; }

/* ============================================================
   DASHBOARD — new design
   ============================================================ */
.cb-dash-greeting {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 20px;
}
.cb-dash-hi  { font-size: 1.5rem; font-weight: 800; color: var(--ink); margin: 0 0 2px; }
.cb-dash-sub { font-size: 13px; color: var(--muted); margin: 0; }

/* 60/40 main row */
.cb-dash-main {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  align-items: start;
}

/* Period tabs (Semana / Mes / Año) */
.cb-period-tabs { display: flex; gap: 4px; }
.cb-period-tab {
  padding: 6px 14px; border-radius: 999px; border: none;
  font-size: 12px; font-weight: 600; cursor: pointer;
  background: var(--bg); color: var(--muted);
  transition: background 0.15s, color 0.15s;
}
.cb-period-tab.is-active { background: var(--primary); color: #fff; }
.cb-period-tab:not(.is-active):hover { background: var(--primary-100); color: var(--primary-deep); }

/* Chart container */
.cb-chart-card { overflow: hidden; }
.cb-dash-chart { margin-top: 8px; overflow: hidden; border-radius: 8px; }

/* Upcoming appointments list */
.cb-appt-list { display: flex; flex-direction: column; gap: 14px; }
.cb-appt-item { display: flex; align-items: center; gap: 12px; }
.cb-appt-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 12px;
  font-weight: 700; font-size: 15px; color: #fff; flex-shrink: 0;
}
.cb-appt-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.cb-appt-info strong { font-size: 14px; font-weight: 700; color: var(--ink); }
.cb-appt-info span   { font-size: 12px; color: var(--muted); }
.cb-appt-time { font-size: 13px; font-weight: 700; color: var(--primary); white-space: nowrap; flex-shrink: 0; }

/* Recent patients grid */
.cb-recent-patients {
  display: flex; flex-wrap: wrap; gap: 16px;
}
.cb-recent-patient-card {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  min-width: 64px;
}
.cb-recent-patient-card small {
  font-size: 11px; font-weight: 600; color: var(--muted);
  text-align: center; max-width: 72px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Recent messages list */
.cb-recent-messages { display: flex; flex-direction: column; gap: 14px; }
.cb-recent-msg-item { display: flex; align-items: center; gap: 12px; }
.cb-msg-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.cb-msg-info strong { font-size: 14px; font-weight: 700; color: var(--ink); }
.cb-msg-info span   { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 900px) {
  .cb-dash-main { grid-template-columns: 1fr; }
}

/* ============================================================
   REPORTES — redesigned layout
   ============================================================ */
.cb-report-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; flex-wrap: wrap; }
.cb-report-title  { font-size: 1.35rem; font-weight: 800; color: var(--ink); margin: 0 0 2px; }
.cb-report-sub    { font-size: 13px; color: var(--muted); margin: 0; }

/* Report gradient KPI cards */
.cb-report-kpis .cb-kpi:nth-child(1) { background: linear-gradient(135deg, #818CF8 0%, #4F46E5 100%); }
.cb-report-kpis .cb-kpi:nth-child(2) { background: linear-gradient(135deg, #67E8F9 0%, #0891B2 100%); }
.cb-report-kpis .cb-kpi:nth-child(3) { background: linear-gradient(135deg, #6EE7B7 0%, #059669 100%); }
.cb-report-kpis .cb-kpi:nth-child(4) { background: linear-gradient(135deg, #FCD34D 0%, #F59E0B 100%); }
.cb-report-kpis .cb-kpi strong,
.cb-report-kpis .cb-kpi p,
.cb-report-kpis .cb-kpi small { color: #fff; }
.cb-report-kpis .cb-kpi p     { opacity: .9; }
.cb-report-kpis .cb-kpi small { opacity: .82; }
.cb-report-kpis .cb-kpi .cb-kpi-icon { background: rgba(255,255,255,.22); color: #fff; }
.cb-report-kpis .cb-kpi .cb-kpi-icon svg { stroke: #fff; }

/* Card sub-header row */
.cb-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.cb-card-header h2 { margin: 0; }
.cb-card-sub { font-size: 12px; color: var(--muted); margin: 3px 0 0; }
.cb-select-sm { width: auto !important; min-width: 90px; padding: 5px 10px !important; font-size: 12px !important; height: auto !important; }

/* Donut with center text */
.cb-donut-wrap { position: relative; width: 150px; height: 150px; flex-shrink: 0; }
.cb-donut { width: 150px; height: 150px; border-radius: 50%; position: relative; }
.cb-donut::after { content: ""; position: absolute; inset: 34px; border-radius: 50%; background: var(--surface); }
.cb-donut-total { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 1; pointer-events: none; }
.cb-donut-total span { font-size: 11px; color: var(--muted); font-weight: 600; }
.cb-donut-total strong { font-size: 24px; font-weight: 800; color: var(--ink); line-height: 1.1; }

/* Legend with aligned counts */
.cb-chart-legend li { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 160px; }
.cb-chart-legend b  { font-weight: 700; color: var(--ink); margin-left: auto; }

/* New columnar bar chart */
.cb-bar-chart-v2 { display: flex; align-items: flex-end; gap: 6px; min-height: 160px; padding-top: 8px; }
.cb-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.cb-bar-val { font-size: 11px; font-weight: 700; color: var(--ink); }
.cb-bar-fill { width: 100%; border-radius: 6px 6px 0 0; background: linear-gradient(180deg, #818CF8, #4F46E5); min-height: 4px; }
.cb-bar-lbl { font-size: 10px; color: var(--muted); font-weight: 600; }

/* Trend line chart */
.cb-trend-card { margin-top: 0; }
.cb-trend-legend { display: flex; align-items: center; gap: 6px; margin-bottom: 14px; font-size: 12px; color: var(--muted); font-weight: 600; }
.cb-trend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.cb-trend-dot--blue  { background: #6366F1; }
.cb-trend-dot--green { background: #22C55E; }
.cb-line-chart-wrap { border-radius: 8px; overflow: hidden; }

/* Automation editor badge */
.cb-auto-badge { display: inline-flex; align-items: center; gap: 6px; background: var(--primary-100); color: var(--primary-deep); font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 8px; }

/* ============================================================
   PRINT / EXPORT PDF
   ============================================================ */
@media print {
  .cb-sidebar, .cb-header, .cb-report-header .cb-inline-actions,
  .cb-row-actions, [data-cb-action], .cb-toolbar { display: none !important; }
  body, .cb-app-shell { display: block !important; background: #fff !important; }
  .cb-content { padding: 0 !important; }
  .cb-kpi, .cb-card { box-shadow: none !important; border: 1px solid #e5e7eb !important; }
  .cb-report-kpis .cb-kpi { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Chart animations */
@keyframes dashIn { from { stroke-dashoffset: 2000; } to { stroke-dashoffset: 0; } }
.chart-line { stroke-dasharray: 2000; animation: dashIn 1.6s ease-out forwards; }
@keyframes growUp { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.bar-grow { transform-origin: bottom; animation: growUp 0.8s cubic-bezier(.2,.7,.3,1) both; }

/* ============================================================
   LOGIN / AUTH
   ============================================================ */
.cb-login-shell { display: grid; grid-template-columns: minmax(360px,0.95fr) minmax(480px,1.05fr); min-height: 100vh; background: var(--surface); overflow: hidden; }
.cb-login-panel { display: grid; place-items: center; padding: 32px 48px; }
.cb-login-panel .cb-auth-card { width: min(390px,100%); padding: 0; border: 0; box-shadow: none; }
.cb-login-panel .cb-auth-card h1 { margin-top: 32px; font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.cb-login-panel .cb-auth-card p { margin-bottom: 24px; color: var(--muted); }
.cb-login-visual {
  display: grid; place-items: center; position: relative; overflow: hidden; padding: 40px;
  background: linear-gradient(135deg, #7C84F5, var(--primary-deep)); color: #fff;
  clip-path: polygon(13% 0, 100% 0, 100% 100%, 0 100%);
}
.cb-login-visual::before { content: ""; position: absolute; width: 170px; height: 70px; right: 90px; top: 160px; border: 1px solid rgba(255,255,255,0.14); border-radius: 22px; }
.cb-login-visual::after  { content: ""; position: absolute; width: 96px;  height: 96px;  right: 190px; bottom: 130px; border: 1px dashed rgba(255,255,255,0.14); border-radius: 22px; }
.cb-public-shell { display: grid; place-items: center; min-height: 100vh; padding: 36px; background: var(--bg); }
.cb-auth-card { width: min(100%,460px); padding: 34px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.cb-auth-card h1 { margin: 12px 0 6px; font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.cb-auth-card p { color: var(--muted); }
.cb-register-card, .cb-booking-card { width: min(960px,100%); }
.cb-login-row, .cb-social-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 14px 0; font-size: 13px; }
.cb-social-row button { flex: 1; min-height: 40px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); font-size: 13px; font-weight: 600; cursor: pointer; }
.cb-check { display: flex; gap: 8px; margin: 14px 0; color: var(--muted); }
.cb-phone-mockup { width: 190px; min-height: 310px; padding: 22px; border: 8px solid rgba(255,255,255,0.7); border-radius: 32px; background: #fff; color: var(--ink); box-shadow: var(--shadow-lg); transform: rotate(-10deg) translateX(-30px); }
.cb-phone-mockup strong { font-size: 14px; }
.cb-phone-mockup div { margin: 24px 0; padding: 14px; border-radius: 14px; background: var(--primary); color: #fff; font-size: 12px; }
.cb-system-table strong { font-weight: 700; }

/* ============================================================
   WIZARD STYLES (template wizard — preserve exactly)
   ============================================================ */
.cb-wizard-steps { display: flex; align-items: center; margin-bottom: 20px; }
.cb-wizard-step { display: flex; align-items: center; gap: 7px; flex: 1; font-size: 0.78rem; color: var(--muted); font-weight: 500; white-space: nowrap; }
.cb-wizard-step::before { content: attr(data-n); display: flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: var(--border); color: var(--muted); font-size: 0.73rem; font-weight: 700; flex-shrink: 0; transition: background 0.2s, color 0.2s; }
.cb-wizard-step.is-active { color: var(--primary); }
.cb-wizard-step.is-active::before { background: var(--primary); color: #fff; }
.cb-wizard-step.is-done::before { background: var(--primary-100); color: var(--primary-deep); content: '✓'; }
.cb-wizard-connector { flex: 0 0 20px; height: 2px; background: var(--border); margin: 0 4px; border-radius: 2px; transition: background 0.2s; }
.cb-wizard-connector.is-done { background: var(--primary-100); }

.cb-type-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 8px; }
.cb-type-card { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: 10px; cursor: pointer; background: none; text-align: left; transition: border-color 0.15s, background 0.15s; width: 100%; box-sizing: border-box; }
.cb-type-card:hover { border-color: var(--primary-200); background: color-mix(in srgb, var(--primary) 4%, transparent); }
.cb-type-card.is-selected { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, transparent); }
.cb-type-card__icon { font-size: 1.3rem; line-height: 1; flex-shrink: 0; margin-top: 1px; }
.cb-type-card__body { display: flex; flex-direction: column; gap: 2px; }
.cb-type-card__title { font-size: 0.82rem; font-weight: 600; color: var(--ink); }
.cb-type-card__desc  { font-size: 0.74rem; color: var(--muted); line-height: 1.3; }

.cb-wizard-head {
  padding: 20px 24px 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 8px;
}
.cb-wizard-title { flex: 1; font-size: 1.05rem; font-weight: 700; color: var(--ink); }
.cb-wizard-close {
  flex-shrink: 0;
  display: grid; place-items: center;
  width: 32px; height: 32px;
  border: 0; border-radius: 8px;
  background: var(--primary-100); color: var(--primary-deep);
  cursor: pointer; font-size: 18px; line-height: 1;
  transition: background 0.15s;
}
.cb-wizard-close:hover { background: var(--primary-200); }
.cb-wizard-steps { width: 100%; margin-top: 14px; margin-bottom: 20px; }
.cb-wizard-body { padding: 16px 24px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 14px; }
.cb-wizard-foot { padding: 12px 24px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.cb-wizard-label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.cb-wizard-hint  { font-size: 0.74rem; color: var(--muted); margin-top: 4px; }

.cb-suggest-loading { display: flex; align-items: center; gap: 10px; padding: 32px 0; color: var(--muted); font-size: 0.85rem; }
.cb-suggest-spinner { width: 20px; height: 20px; border: 2.5px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: cb-spin 0.7s linear infinite; flex-shrink: 0; }
@keyframes cb-spin { to { transform: rotate(360deg); } }

.cb-char-count { font-size: 0.73rem; text-align: right; margin-top: 3px; color: var(--muted); transition: color 0.15s; }
.cb-char-count.is-warn { color: #D97706; }
.cb-char-count.is-over { color: #DC2626; font-weight: 600; }

.cb-validation-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.cb-validation-item { display: flex; align-items: flex-start; gap: 10px; font-size: 0.85rem; color: var(--muted); }
.cb-validation-icon { flex-shrink: 0; width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.72rem; font-weight: 700; background: var(--border); color: var(--muted); }
.cb-validation-item.is-ok { color: var(--ink); }
.cb-validation-item.is-ok .cb-validation-icon { background: #D1FAE5; color: #065F46; }
.cb-validation-item.is-error { color: #991B1B; }
.cb-validation-item.is-error .cb-validation-icon { background: #FEE2E2; color: #991B1B; }

/* ============================================================
   AUTOMATION EDITOR (preserve exactly)
   ============================================================ */
.cb-auto-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 16px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.cb-auto-title { font-size: 1.05rem; font-weight: 700; color: var(--ink); }
.cb-auto-body { flex: 1; overflow-y: auto; padding: 0; display: flex; flex-direction: column; gap: 0; }
.cb-auto-foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--border); flex-shrink: 0; background: var(--surface); }
.cb-auto-section { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 14px; }
.cb-auto-section-last { border-bottom: none; }
.cb-auto-section-title { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 2px; }
.cb-auto-field { display: flex; flex-direction: column; gap: 5px; }
.cb-auto-label { font-size: 0.84rem; font-weight: 600; color: var(--ink); }
.cb-auto-hint  { font-size: 0.78rem; color: var(--muted); line-height: 1.4; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) {
  .stat-grid, .cb-kpi-grid, .cb-dashboard-kpis { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .cb-integration-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

/* ── Mobile chrome — hidden on desktop, revealed by media query ─────────── */
.sb-close       { display: none; }
.bottom-nav     { display: none; }
.tb-search-mobile { display: none !important; }
.cal-scroll     { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--r-lg); }
.bn-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  border-radius: 12px;
  transition: color 0.15s, background 0.15s;
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: none;
}
.bn-item svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.bn-item.active, .bn-item.is-active { color: var(--primary-deep); background: var(--primary-50); }

/* ── Mobile sidebar backdrop ─────────────────────────────────────────────── */
.cb-mobile-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(17,20,45,.50);
  z-index: 199;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: fadeIn 0.22s ease;
}
.cb-mobile-backdrop.is-visible { display: block; }

@media (max-width: 980px) {
  .app, .cb-app-shell, .cb-login-shell, .cb-two-col, .cb-calendar-layout { grid-template-columns: 1fr; }

  /* Off-canvas sidebar drawer */
  .sidebar, .cb-sidebar {
    position: fixed;
    left: 0; top: 0;
    width: 264px;
    height: 100vh;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(.2,.8,.2,1);
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    border-radius: 0;
  }
  .cb-app-shell[data-mobile-open="true"] .sidebar,
  .cb-app-shell[data-mobile-open="true"] .cb-sidebar {
    transform: translateX(0);
    box-shadow: 8px 0 40px rgba(75,62,227,.28);
  }

  /* Reset collapsed state so drawer always shows full labels */
  .cb-app-shell[data-collapsed="true"] .sidebar,
  .cb-app-shell[data-collapsed="true"] .cb-sidebar { padding: 22px 16px; }
  .cb-app-shell[data-collapsed="true"] .sb-logo .word { display: flex; }
  .cb-app-shell[data-collapsed="true"] .sb-item .label,
  .cb-app-shell[data-collapsed="true"] .sb-item span:not(.icon),
  .cb-app-shell[data-collapsed="true"] .cb-brand strong { display: inline; }
  .cb-app-shell[data-collapsed="true"] .sb-foot,
  .cb-app-shell[data-collapsed="true"] .cb-help { display: block; }
  .cb-app-shell[data-collapsed="true"] .sb-item,
  .cb-app-shell[data-collapsed="true"] .cb-sidebar a { justify-content: flex-start; padding: 10px 14px; border-radius: 14px; }
  .cb-app-shell[data-collapsed="true"] .sb-logo,
  .cb-app-shell[data-collapsed="true"] .cb-brand { justify-content: flex-start; padding-left: 8px; padding-right: 8px; }

  .cb-help, .sb-foot { position: static; margin-top: 4px; }
  .cb-login-visual { clip-path: none; }

  /* Sidebar close button — shown on mobile */
  .sb-close {
    display: grid;
    place-items: center;
    margin-left: auto;
    width: 36px; height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    color: #fff;
    cursor: pointer;
    flex-shrink: 0;
    border: none;
  }
  .sb-close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

  /* Hide hamburger on mobile — bottom nav already has "Más" to open the drawer */
  .tb-burger { display: none; }

  /* Compact topbar */
  .topbar, .cb-topbar { padding: 14px 16px; gap: 12px; }
  .tb-title, .cb-topbar h1 { font-size: 18px; }

  /* Hide search bar, user text, and language switcher */
  .tb-search, .cb-search { display: none !important; }
  .tb-user .name, .tb-user .role { display: none; }
  .cb-user-meta { display: none; }
  .cb-topbar .cb-lang-switch { display: none; }
  .tb-actions, .cb-topbar-actions { gap: 8px; margin-left: auto; }
  .tb-icon, .cb-icon-btn { width: 42px; height: 42px; }
  .tb-user .avatar, .cb-avatar { width: 40px; height: 40px; font-size: 14px; }

  /* Content — bottom padding for fixed bottom nav */
  .content, .cb-content-wrap { padding: 4px 16px 90px; }
  .cb-content { padding: 0 16px 90px; }
  .cb-main { padding: 0; }
  .page-head { margin-bottom: 16px; }
  .page-head h2 { font-size: 17px; }
  .page-head .sub { font-size: 12px; }

  /* Stat cards — 2 columns */
  .stat-grid, .cb-kpi-grid, .cb-dashboard-kpis { grid-template-columns: repeat(2,1fr); gap: 14px; margin-bottom: 16px; }
  .stat, .cb-kpi { padding: 16px; gap: 12px; flex-direction: column; align-items: flex-start; }
  .stat .ico, .cb-kpi-icon { width: 44px; height: 44px; border-radius: 14px; }
  .stat .num, .cb-kpi strong { font-size: 22px; }
  .stat .lbl, .cb-kpi p { font-size: 12px; }

  /* Two-col and dashboard layouts → single column */
  .cb-dash-main { grid-template-columns: 1fr; }
  .cb-integration-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .cb-automation-grid { grid-template-columns: 1fr; }

  /* Inline-style grids from PHP/JSX screens → stack */
  .content > div[style*="grid-template-columns"],
  .cb-content > div[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }

  /* Tile grid — 2 columns on tablet */
  .tile-grid { grid-template-columns: repeat(2,1fr) !important; }

  /* Calendar — horizontal scroll */
  .cal-grid, .cb-calendar-grid {
    grid-template-columns: 56px repeat(7, minmax(110px,1fr));
    min-width: 760px;
    border-radius: 0;
    box-shadow: none;
  }
  .cb-calendar-layout > .card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .cb-month-cell { min-height: 60px; }

  /* Searchbars — wrapping layout */
  .searchbar { flex-wrap: wrap; padding: 10px 14px; border-radius: var(--r-lg); }
  .searchbar input { order: -1; width: 100%; min-width: 0; padding: 8px; }
  .searchbar .loc { border-right: none; }

  /* Tables → stacked cards (data-label columns) */
  .table-wrap, .cb-table-wrap { background: transparent; box-shadow: none; padding: 0; border: none; overflow-x: visible; }
  .table thead, .cb-table thead { display: none; }
  .table, .table tbody, .table tr, .table td,
  .cb-table, .cb-table tbody, .cb-table tr, .cb-table td { display: block; width: 100%; min-width: 0; }
  .table tbody tr, .cb-table tbody tr {
    background: var(--surface);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    padding: 14px 16px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
  }
  .table tbody tr:hover td, .cb-table tbody tr:hover td { background: transparent; }
  .table tbody td, .cb-table td {
    border: none !important;
    padding: 7px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: transparent !important;
    border-radius: 0 !important;
    height: auto !important;
    min-height: unset;
  }
  .table tbody td::before, .cb-table td::before {
    content: attr(data-label);
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    flex-shrink: 0;
  }
  .table tbody td[data-label=""]::before,
  .table tbody td.cell-full::before,
  .cb-table td[data-label=""]::before { content: none; }
  .table tbody td.cell-full, .cb-table td.cell-full { justify-content: flex-start; }
  .table tbody td.cell-check, .cb-table td.cell-check { display: none; }

  /* Patient detail drawer → full-screen */
  .drawer { width: 100%; max-width: 100%; }

  /* Bottom nav — stays fixed at bottom on all scroll positions */
  .bottom-nav {
    display: flex;
    position: fixed !important;
    bottom: 0 !important; left: 0 !important; right: 0 !important;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 8px 6px calc(8px + env(safe-area-inset-bottom, 0px));
    z-index: 99990;
    box-shadow: 0 -8px 24px rgba(38,42,78,0.08);
    /* GPU layer — prevents scroll-induced drift on mobile browsers */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    will-change: transform;
  }

  /* Floating elements above bottom nav */
  .cb-toast { bottom: 80px; right: 16px; }
  .om-tweaks-launcher, .tweaks-launcher { bottom: 80px !important; }
}

@media (max-width: 640px) {
  .content, .cb-content-wrap { padding: 4px 12px 90px; }
  .cb-content { padding: 0 12px 90px; }
  .topbar, .cb-topbar { padding: 12px 14px; }
  .tb-search, .cb-search { display: none !important; }
  .cb-toolbar { align-items: stretch; flex-direction: column; }
  .stat-grid, .cb-kpi-grid, .cb-dashboard-kpis { grid-template-columns: 1fr; }
  .cb-integration-grid, .cb-automation-grid { grid-template-columns: 1fr; }
  .tile-grid { grid-template-columns: 1fr !important; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .page-head > div:last-child { flex-wrap: wrap; }
  .bn-item span { font-size: 9px; }
  .cb-modal-panel, .cb-modal-box { width: min(calc(100% - 24px), 580px) !important; }
}

/* ── Login topbar (brand + lang switch) ─────────────────────────────────── */
.cb-login-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.cb-login-topbar .cb-brand { margin-bottom: 0; }

/* ── Home page lang switcher position ───────────────────────────────────── */
.nav-cta .cb-lang-switch { background: transparent; border-color: rgba(0,0,0,.12); }

/* ── Language switcher ───────────────────────────────────────────────────── */
.cb-lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg);
  border-radius: 999px;
  padding: 3px 6px;
  border: 1px solid var(--border);
}
.cb-lang-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  font-size: 18px;
  line-height: 1;
  text-decoration: none;
  transition: background .15s, transform .1s;
  opacity: .55;
}
.cb-lang-btn:hover { opacity: .85; transform: scale(1.1); }
.cb-lang-btn.is-active { opacity: 1; background: var(--primary-100, #ede9fe); }

/* ── Giro sidebar badge ──────────────────────────────────────────────────── */
.sb-giro-badge {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: var(--r-sm);
  background: rgba(255,255,255,.12);
  margin-bottom: 10px; font-size: 12px; font-weight: 600;
  color: rgba(255,255,255,.85);
}
.sb-giro-emoji { font-size: 16px; }

/* ── Onboarding / Multi-step register ───────────────────────────────────── */
.cb-onboarding-shell {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--primary-50) 0%, #fff 60%);
  display: flex; align-items: center; justify-content: center;
  padding: 24px 16px 48px;
}
.cb-onboarding-card {
  width: 100%; max-width: 820px;
  background: #fff; border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  padding: 40px 48px;
}
.cb-ob-lang {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  margin: -14px 0 20px;
  color: var(--muted); font-size: 12px; font-weight: 700;
}

/* Step progress indicator */
.cb-ob-steps {
  display: flex; align-items: center;
  margin-bottom: 36px;
}
.cb-ob-step {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600; color: var(--muted);
}
.cb-ob-step-num {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--surface-3); color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; flex-shrink: 0;
  transition: background .25s, color .25s;
}
.cb-ob-step.active .cb-ob-step-num { background: var(--primary); color: #fff; }
.cb-ob-step.active { color: var(--primary-deep); }
.cb-ob-step.done .cb-ob-step-num { background: var(--accent-green); color: #fff; }
.cb-ob-step-line { flex: 1; height: 2px; background: var(--border); margin: 0 12px; }

.cb-ob-title { font-size: 22px; font-weight: 800; margin: 0 0 6px; color: var(--ink); }
.cb-ob-sub   { font-size: 14px; color: var(--muted); margin: 0 0 28px; }
.cb-eyebrow  {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; letter-spacing: .04em;
  color: var(--primary); text-transform: uppercase; margin: 0 0 10px;
}

/* Giro tile grid */
.cb-giro-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.cb-giro-tile {
  display: flex; flex-direction: column; align-items: center;
  gap: 8px; padding: 18px 10px;
  border: 2px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  cursor: pointer;
  transition: border-color .2s, background .2s, transform .15s, box-shadow .2s;
  font-family: var(--font-sans);
}
.cb-giro-tile:hover {
  border-color: var(--primary); background: var(--primary-50);
  transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.08);
}
.cb-giro-tile.selected {
  border-color: var(--primary); background: var(--primary-50);
  box-shadow: 0 0 0 3px var(--primary-100);
}
.cb-giro-tile-emoji { font-size: 28px; line-height: 1; }
.cb-giro-tile-label {
  font-size: 11px; font-weight: 700; color: var(--ink-2);
  text-align: center; line-height: 1.3;
}

/* Step 2 — AI suggestion */
.cb-ob-giro-badge {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 8px 18px; border-radius: var(--r-pill);
  background: var(--primary-50); border: 1px solid var(--primary-100);
  font-weight: 700; font-size: 15px; color: var(--primary-deep);
  margin-bottom: 18px;
}
.cb-ob-giro-emoji { font-size: 22px; }
.cb-ai-text-wrap {
  background: var(--primary-50); border-radius: var(--r-md);
  padding: 16px 20px; margin-bottom: 22px; min-height: 56px;
}
.cb-ai-loading {
  display: flex; align-items: center; gap: 10px;
  color: var(--muted); font-size: 13px;
}
.cb-spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--border); border-top-color: var(--primary);
  animation: spin .7s linear infinite; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
.cb-ai-text { font-size: 14px; line-height: 1.65; color: var(--ink-2); margin: 0; }

/* Module chips */
.cb-modules-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.cb-module-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: var(--r-pill);
  background: var(--surface-3); border: 1px solid var(--border);
  font-size: 12px; font-weight: 600; color: var(--ink-2);
}
.cb-module-chip .cb-chip-check {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent-green); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 9px; flex-shrink: 0;
}

/* Selectable module chips (registration step 3) */
.cb-module-chip.selectable {
  cursor: pointer; user-select: none; background: var(--surface-1);
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.cb-module-chip.selectable .cb-chip-check {
  background: transparent; color: transparent; border: 1.5px solid var(--border);
}
.cb-module-chip.selectable.is-selected {
  background: var(--primary-50); border-color: var(--primary); color: var(--primary-deep);
}
.cb-module-chip.selectable.is-selected .cb-chip-check {
  background: var(--primary); color: #fff; border-color: var(--primary);
}
.cb-module-chip.selectable.is-locked {
  cursor: default; opacity: .8;
}
.cb-module-chip.selectable.is-locked .cb-chip-check {
  background: var(--ink-3); color: #fff; border-color: var(--ink-3);
}
.cb-modules-hint { font-size: 12px; color: var(--ink-3); margin: -4px 0 12px; }

/* Shared actions row */
.cb-ob-actions {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-top: 20px;
}

/* Onboarding mobile */
@media (max-width: 680px) {
  .cb-onboarding-card { padding: 28px 20px; }
  .cb-ob-lang { margin-top: -4px; }
  .cb-giro-grid       { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .cb-giro-tile       { padding: 14px 6px; }
  .cb-giro-tile-emoji { font-size: 22px; }
  .cb-ob-step-lbl     { display: none; }
}
@media (max-width: 420px) {
  .cb-giro-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Step 2: Login/bottom link ────────────────────────────────────────── */
.cb-ob-login-link { text-align: center; font-size: 13px; color: var(--muted); margin-top: 20px; }

/* ── Step 2: Logo upload dropzone ────────────────────────────────────── */
.cb-logo-upload-area {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: var(--r-md);
  padding: 24px 20px;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  min-height: 96px;
  display: flex; align-items: center; justify-content: center;
}
.cb-logo-upload-area:hover,
.cb-logo-upload-area.cb-drag-over {
  border-color: var(--primary);
  background: var(--primary-50);
}
.cb-logo-placeholder {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  color: var(--muted); font-size: 13px; pointer-events: none;
}
.cb-logo-placeholder svg {
  width: 36px; height: 36px; stroke: var(--muted); opacity: .6;
}
.cb-logo-placeholder small { font-size: 11px; opacity: .8; }
.cb-logo-preview {
  max-height: 80px; max-width: 220px;
  object-fit: contain; border-radius: var(--r-sm);
}
.cb-logo-remove {
  position: absolute; top: 8px; right: 10px;
  background: rgba(0,0,0,.45); color: #fff;
  border: none; border-radius: 50%;
  width: 22px; height: 22px; font-size: 12px;
  cursor: pointer; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.cb-logo-remove:hover { background: var(--danger); }

/* ── Step 2: Toggle (yes/no) ──────────────────────────────────────────── */
.cb-toggle-row {
  display: flex; gap: 8px; margin-bottom: 10px;
}
.cb-toggle-opt {
  flex: 1; padding: 9px 16px;
  border: 2px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface); cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--muted);
  transition: border-color .18s, background .18s, color .18s;
  font-family: var(--font-sans);
}
.cb-toggle-opt.active {
  border-color: var(--primary); background: var(--primary-50); color: var(--primary-deep);
}

/* ── Step 2: Website URL row ─────────────────────────────────────────── */
.cb-web-url-row {
  display: flex; gap: 8px; align-items: center; margin-bottom: 8px;
}
.cb-web-url-row .cb-input { flex: 1; }
.cb-btn-soft {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 14px; border-radius: var(--r-sm);
  border: 1.5px solid var(--primary-200); background: var(--primary-50);
  color: var(--primary-deep); font-size: 13px; font-weight: 600;
  cursor: pointer; white-space: nowrap; font-family: var(--font-sans);
  transition: background .15s, border-color .15s;
}
.cb-btn-soft:hover  { background: var(--primary-100); border-color: var(--primary); }
.cb-btn-soft:disabled { opacity: .5; cursor: not-allowed; }
.cb-web-status {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--muted); padding: 4px 0;
}
.cb-web-result {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; color: var(--accent-green);
  padding: 4px 0;
}

/* ── Step 3: AI analysis card ────────────────────────────────────────── */
.cb-ai-card {
  background: var(--primary-50); border: 1px solid var(--primary-100);
  border-radius: var(--r-md); padding: 18px 20px;
  margin-bottom: 20px; min-height: 72px;
}
.cb-ai-loading-full {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 8px 0; color: var(--muted); font-size: 13px;
}
.cb-spinner-lg {
  width: 28px; height: 28px;
  border: 3px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; animation: spin .7s linear infinite;
}
.cb-ob-section-label {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted); margin: 0 0 10px;
}

/* ── Step 4: Two-column form ─────────────────────────────────────────── */
.cb-two-col-fields {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px;
}
@media (max-width: 560px) {
  .cb-two-col-fields { grid-template-columns: 1fr; }
  .cb-web-url-row    { flex-wrap: wrap; }
}

/* ── Password eye toggle ─────────────────────────────────────────────── */
.cb-input-eye { position: relative; }
.cb-input-eye .cb-input { padding-right: 40px; }
.cb-eye-btn {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; padding: 4px;
  color: var(--muted); display: flex; align-items: center;
  transition: color .15s;
}
.cb-eye-btn:hover { color: var(--primary); }

/* ── Button size variant ─────────────────────────────────────────────── */
.cb-btn-lg  { padding: 12px 28px; font-size: 15px; }
.cb-btn-sm  { padding: 6px 14px;  font-size: 12px; }

/* ── Onboarding 2026: unified Lime design ─────────────────────────────── */
.cb-onboarding-shell {
  --ob-lime: #d7df12;
  --ob-lime-soft: #f4f7bf;
  --ob-ink: #171811;
  --ob-ink-2: #292a23;
  --ob-paper: #f4f3ec;
  --ob-white: #fff;
  --ob-muted: #7f8178;
  --ob-line: #deddd3;
  min-height: 100vh;
  padding: 32px;
  background:
    radial-gradient(circle at 4% 8%, rgba(215,223,18,.18), transparent 22%),
    radial-gradient(circle at 92% 90%, rgba(23,24,17,.08), transparent 26%),
    var(--ob-paper);
  align-items: center;
}
.cb-onboarding-frame {
  width: min(1240px, 100%);
  min-height: 760px;
  display: grid;
  grid-template-columns: 350px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid rgba(23,24,17,.1);
  border-radius: 28px;
  background: var(--ob-white);
  box-shadow: 0 34px 90px rgba(23,24,17,.17);
}
.cb-ob-aside {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 34px 32px 30px;
  color: #fff;
  background:
    radial-gradient(circle at 78% 16%, rgba(215,223,18,.3), transparent 24%),
    linear-gradient(155deg, #202119 0%, #11120e 70%);
  overflow: hidden;
}
.cb-ob-aside::before,
.cb-ob-aside::after {
  content: "";
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  pointer-events: none;
}
.cb-ob-aside::before {
  width: 280px;
  height: 280px;
  right: -150px;
  bottom: 70px;
  border: 1px solid rgba(215,223,18,.18);
  box-shadow: 0 0 0 45px rgba(215,223,18,.025), 0 0 0 90px rgba(215,223,18,.018);
}
.cb-ob-aside::after {
  width: 8px;
  height: 8px;
  left: 34px;
  bottom: 126px;
  background: var(--ob-lime);
  box-shadow: 28px 18px 0 rgba(215,223,18,.28), 54px -14px 0 rgba(215,223,18,.14);
}
.cb-ob-brand {
  width: fit-content;
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  padding: 8px 13px;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(0,0,0,.14);
}
.cb-ob-brand img {
  display: block;
  width: auto;
  max-width: 142px;
  height: auto;
  max-height: 36px;
  object-fit: contain;
}
.cb-ob-aside-content {
  margin: auto 0;
  padding: 54px 0 40px;
}
.cb-ob-aside-kicker {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 18px;
  color: rgba(255,255,255,.65);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .13em;
}
.cb-ob-aside-kicker i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ob-lime);
  box-shadow: 0 0 0 5px rgba(215,223,18,.12);
}
.cb-ob-aside h2 {
  max-width: 270px;
  margin: 0 0 17px;
  color: #fff;
  font-size: clamp(32px, 3vw, 44px);
  font-weight: 800;
  letter-spacing: -.045em;
  line-height: 1.03;
}
.cb-ob-aside-content > p {
  max-width: 275px;
  margin: 0 0 34px;
  color: rgba(255,255,255,.62);
  font-size: 14px;
  line-height: 1.65;
}
.cb-ob-benefits {
  display: grid;
  gap: 11px;
}
.cb-ob-benefits > div {
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(255,255,255,.88);
  font-size: 13px;
}
.cb-ob-benefits span,
.cb-ob-aside-note > span {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border: 1px solid rgba(215,223,18,.28);
  border-radius: 12px;
  color: var(--ob-lime);
  background: rgba(215,223,18,.08);
}
.cb-ob-benefits svg,
.cb-ob-aside-note svg {
  width: 19px;
  height: 19px;
}
.cb-ob-aside-note {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 16px;
  background: rgba(255,255,255,.055);
  backdrop-filter: blur(8px);
}
.cb-ob-aside-note div {
  display: grid;
  gap: 2px;
}
.cb-ob-aside-note b {
  color: #fff;
  font-size: 13px;
}
.cb-ob-aside-note small {
  color: rgba(255,255,255,.52);
  font-size: 10px;
  line-height: 1.4;
}
.cb-onboarding-frame .cb-onboarding-card {
  width: 100%;
  max-width: none;
  min-width: 0;
  min-height: 760px;
  padding: 28px 46px 38px;
  border-radius: 0;
  background: #fff;
  box-shadow: none;
}
.cb-ob-topbar {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-bottom: 18px;
}
.cb-ob-mobile-brand {
  display: none;
}
.cb-onboarding-frame .cb-ob-lang {
  margin: 0;
  color: var(--ob-muted);
}
.cb-onboarding-frame .cb-lang-switch {
  padding: 3px;
  border: 1px solid var(--ob-line);
  border-radius: 999px;
  background: var(--ob-paper);
}
.cb-onboarding-frame .cb-lang-btn {
  min-width: 34px;
  min-height: 29px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
}
.cb-onboarding-frame .cb-lang-btn.is-active {
  background: #fff;
  box-shadow: 0 3px 9px rgba(23,24,17,.1);
}

/* Progress */
.cb-onboarding-frame .cb-ob-steps {
  margin: 0 0 32px;
}
.cb-onboarding-frame .cb-ob-step {
  min-width: max-content;
  gap: 8px;
  color: #999a92;
  font-size: 12px;
  font-weight: 700;
}
.cb-onboarding-frame .cb-ob-step-num {
  position: relative;
  width: 38px;
  height: 38px;
  color: #8c8e85;
  border: 1px solid var(--ob-line);
  background: var(--ob-paper);
}
.cb-ob-step-num svg {
  width: 17px;
  height: 17px;
}
.cb-ob-step-num em {
  position: absolute;
  top: -5px;
  right: -4px;
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 50%;
  color: #fff;
  background: #a3a49d;
  font-size: 8px;
  font-style: normal;
  line-height: 1;
}
.cb-onboarding-frame .cb-ob-step.active {
  color: var(--ob-ink);
}
.cb-onboarding-frame .cb-ob-step.active .cb-ob-step-num {
  color: var(--ob-ink);
  border-color: var(--ob-lime);
  background: var(--ob-lime);
}
.cb-onboarding-frame .cb-ob-step.active .cb-ob-step-num em {
  color: var(--ob-ink);
  background: #fff;
}
.cb-onboarding-frame .cb-ob-step.done .cb-ob-step-num {
  color: var(--ob-lime);
  border-color: var(--ob-ink);
  background: var(--ob-ink);
}
.cb-onboarding-frame .cb-ob-step.done .cb-ob-step-num em {
  color: var(--ob-ink);
  background: var(--ob-lime);
}
.cb-onboarding-frame .cb-ob-step-line {
  height: 1px;
  margin: 0 11px;
  background: var(--ob-line);
}

/* Typography and panels */
.cb-onboarding-frame .cb-ob-panel {
  max-width: 100%;
  animation: cbObPanelIn .32s ease both;
}
@keyframes cbObPanelIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.cb-onboarding-frame .cb-eyebrow {
  margin-bottom: 9px;
  color: #777a19;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .1em;
}
.cb-onboarding-frame .cb-eyebrow::before {
  content: "";
  width: 18px;
  height: 3px;
  border-radius: 999px;
  background: var(--ob-lime);
}
.cb-onboarding-frame .cb-ob-title {
  margin: 0 0 8px;
  color: var(--ob-ink);
  font-size: clamp(27px, 3vw, 38px);
  font-weight: 800;
  letter-spacing: -.04em;
  line-height: 1.08;
}
.cb-onboarding-frame .cb-ob-sub {
  max-width: 650px;
  margin: 0 0 26px;
  color: var(--ob-muted);
  font-size: 14px;
  line-height: 1.55;
}

/* Business type cards */
.cb-onboarding-frame .cb-giro-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 11px;
}
.cb-onboarding-frame .cb-giro-tile {
  position: relative;
  min-height: 112px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 15px;
  overflow: hidden;
  border: 1px solid var(--ob-line);
  border-radius: 17px;
  color: var(--ob-ink);
  background: #fff;
  box-shadow: 0 1px 0 rgba(23,24,17,.025);
  text-align: left;
}
.cb-onboarding-frame .cb-giro-tile::after {
  content: "";
  position: absolute;
  width: 58px;
  height: 58px;
  right: -30px;
  bottom: -30px;
  border-radius: 50%;
  background: var(--ob-lime);
  opacity: 0;
  transform: scale(.6);
  transition: opacity .2s, transform .2s;
}
.cb-onboarding-frame .cb-giro-tile:hover {
  border-color: #bfc615;
  background: #fcfdf1;
  box-shadow: 0 12px 26px rgba(23,24,17,.09);
  transform: translateY(-2px);
}
.cb-onboarding-frame .cb-giro-tile:hover::after {
  opacity: .35;
  transform: scale(1);
}
.cb-onboarding-frame .cb-giro-tile.selected {
  color: #fff;
  border-color: var(--ob-ink);
  background: var(--ob-ink);
  box-shadow: 0 0 0 3px rgba(215,223,18,.35), 0 14px 30px rgba(23,24,17,.18);
}
.cb-giro-tile-icon {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 13px;
  color: var(--ob-ink);
  background: var(--ob-lime-soft);
  transition: color .2s, background .2s;
}
.cb-giro-tile-icon svg {
  width: 23px;
  height: 23px;
}
.cb-giro-tile.selected .cb-giro-tile-icon {
  color: var(--ob-ink);
  background: var(--ob-lime);
}
.cb-onboarding-frame .cb-giro-tile-label {
  max-width: 100%;
  color: inherit;
  font-size: 12px;
  font-weight: 750;
  text-align: left;
}
.cb-giro-tile-check {
  position: absolute;
  top: 13px;
  right: 13px;
  width: 23px;
  height: 23px;
  display: grid;
  place-items: center;
  border: 1px solid var(--ob-line);
  border-radius: 50%;
  color: transparent;
  background: #fff;
  opacity: 0;
  transform: scale(.75);
  transition: opacity .2s, transform .2s;
}
.cb-giro-tile-check svg {
  width: 13px;
  height: 13px;
}
.cb-giro-tile.selected .cb-giro-tile-check {
  z-index: 1;
  color: var(--ob-ink);
  border-color: var(--ob-lime);
  background: var(--ob-lime);
  opacity: 1;
  transform: scale(1);
}
.cb-onboarding-frame .cb-ob-login-link {
  margin-top: 22px;
  color: var(--ob-muted);
}
.cb-onboarding-frame .cb-ob-login-link a {
  color: var(--ob-ink);
  font-weight: 800;
  text-decoration-color: var(--ob-lime);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

/* Forms and controls */
.cb-onboarding-frame .cb-field {
  margin-bottom: 18px;
}
.cb-onboarding-frame .cb-label {
  display: block;
  margin: 0 0 8px;
  color: var(--ob-ink);
  font-size: 12px;
  font-weight: 750;
}
.cb-onboarding-frame .cb-input {
  min-height: 48px;
  padding: 12px 15px;
  border: 1px solid var(--ob-line);
  border-radius: 13px;
  color: var(--ob-ink);
  background: #fbfbf8;
  font-size: 14px;
  box-shadow: none;
}
.cb-onboarding-frame .cb-input:hover {
  border-color: #c7c7bd;
}
.cb-onboarding-frame .cb-input:focus {
  border-color: #aeb410;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(215,223,18,.18);
}
.cb-onboarding-frame .cb-logo-upload-area {
  min-height: 130px;
  padding: 22px;
  border: 1px dashed #bcbdaf;
  border-radius: 16px;
  background: #fafaf6;
}
.cb-onboarding-frame .cb-logo-upload-area:hover,
.cb-onboarding-frame .cb-logo-upload-area.cb-drag-over {
  border-color: #aeb410;
  background: #fbfddf;
}
.cb-onboarding-frame .cb-logo-placeholder {
  color: var(--ob-muted);
}
.cb-onboarding-frame .cb-logo-placeholder svg {
  width: 42px;
  height: 42px;
  padding: 10px;
  border-radius: 13px;
  color: var(--ob-ink);
  background: var(--ob-lime);
  stroke: currentColor;
  opacity: 1;
}
.cb-onboarding-frame .cb-toggle-row {
  width: fit-content;
  padding: 4px;
  border: 1px solid var(--ob-line);
  border-radius: 13px;
  background: var(--ob-paper);
}
.cb-onboarding-frame .cb-toggle-opt {
  min-width: 110px;
  border: 0;
  border-radius: 9px;
  background: transparent;
}
.cb-onboarding-frame .cb-toggle-opt.active {
  color: var(--ob-ink);
  border: 0;
  background: #fff;
  box-shadow: 0 4px 12px rgba(23,24,17,.1);
}
.cb-onboarding-frame .cb-web-url-row {
  padding-top: 4px;
}
.cb-onboarding-frame .cb-web-status,
.cb-onboarding-frame .cb-web-result {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 11px;
  background: var(--ob-paper);
}
.cb-onboarding-frame .cb-web-result {
  color: #537600;
  background: #f3f8df;
}
.cb-onboarding-frame .cb-spinner {
  border-color: #d7d8ce;
  border-top-color: var(--ob-ink);
}
.cb-onboarding-frame .cb-ob-giro-badge {
  min-height: 36px;
  margin-bottom: 15px;
  padding: 6px 12px 6px 7px;
  gap: 8px;
  color: var(--ob-ink);
  border: 1px solid #e1e3a2;
  background: #fafbdc;
  font-size: 12px;
}
.cb-ob-giro-badge > span:first-child {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: var(--ob-ink);
  background: var(--ob-lime);
}
.cb-ob-giro-badge > span:first-child svg {
  width: 16px;
  height: 16px;
}

/* AI and selectable modules */
.cb-onboarding-frame .cb-ai-card {
  position: relative;
  min-height: 116px;
  padding: 22px 22px 22px 76px;
  overflow: hidden;
  border: 0;
  border-radius: 18px;
  color: #fff;
  background:
    radial-gradient(circle at 100% 0, rgba(215,223,18,.24), transparent 35%),
    var(--ob-ink);
}
.cb-onboarding-frame .cb-ai-card::before {
  content: "✦";
  position: absolute;
  top: 22px;
  left: 22px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--ob-ink);
  background: var(--ob-lime);
  font-size: 20px;
}
.cb-onboarding-frame .cb-ai-loading-full {
  min-height: 68px;
  align-items: flex-start;
  justify-content: center;
  padding: 0;
  color: rgba(255,255,255,.72);
}
.cb-onboarding-frame .cb-ai-text {
  color: rgba(255,255,255,.83);
}
.cb-onboarding-frame .cb-spinner-lg {
  border-color: rgba(255,255,255,.2);
  border-top-color: var(--ob-lime);
}
.cb-onboarding-frame .cb-ob-section-label {
  margin: 20px 0 10px;
  color: var(--ob-ink);
  font-size: 11px;
}
.cb-onboarding-frame .cb-modules-hint {
  color: var(--ob-muted);
  line-height: 1.5;
}
.cb-onboarding-frame .cb-modules-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}
.cb-onboarding-frame .cb-module-chip {
  min-height: 39px;
  padding: 8px 10px;
  border: 1px solid var(--ob-line);
  border-radius: 11px;
  color: var(--ob-ink-2);
  background: #fafaf7;
  font-size: 11px;
}
.cb-onboarding-frame .cb-module-chip .cb-chip-check {
  width: 17px;
  height: 17px;
  color: var(--ob-ink);
  background: var(--ob-lime);
}
.cb-onboarding-frame .cb-module-chip.selectable.is-selected {
  color: var(--ob-ink);
  border-color: #bdc415;
  background: #fbfddf;
}
.cb-onboarding-frame .cb-module-chip.selectable.is-selected .cb-chip-check {
  color: var(--ob-ink);
  border-color: var(--ob-lime);
  background: var(--ob-lime);
}
.cb-onboarding-frame .cb-module-chip.selectable.is-locked .cb-chip-check {
  color: var(--ob-lime);
  border-color: var(--ob-ink);
  background: var(--ob-ink);
}

/* Account and actions */
.cb-onboarding-frame .cb-two-col-fields {
  gap: 0 14px;
}
.cb-onboarding-frame .cb-check {
  align-items: flex-start;
  color: var(--ob-muted);
  font-size: 12px;
  line-height: 1.5;
}
.cb-onboarding-frame .cb-check input {
  accent-color: var(--ob-lime);
}
.cb-onboarding-frame .cb-check a {
  color: var(--ob-ink);
  font-weight: 700;
}
.cb-onboarding-frame .cb-ob-actions {
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--ob-line);
}
.cb-onboarding-frame .cb-btn {
  min-height: 46px;
  padding: 11px 20px;
  border-radius: 999px;
  font-weight: 750;
  box-shadow: none;
}
.cb-onboarding-frame .cb-btn-primary {
  color: var(--ob-lime);
  border-color: var(--ob-ink);
  background: var(--ob-ink);
}
.cb-onboarding-frame .cb-btn-primary:hover {
  color: var(--ob-ink);
  border-color: var(--ob-lime);
  background: var(--ob-lime);
  transform: translateY(-1px);
}
.cb-onboarding-frame .cb-btn-ghost {
  color: var(--ob-ink);
  border: 1px solid var(--ob-line);
  background: #fff;
}
.cb-onboarding-frame .cb-btn-ghost:hover {
  border-color: var(--ob-ink);
  background: var(--ob-paper);
}
.cb-onboarding-frame .cb-btn-soft {
  color: var(--ob-ink);
  border-color: var(--ob-lime);
  background: var(--ob-lime);
}
.cb-onboarding-frame .cb-eye-btn:hover {
  color: #7a8009;
}

@media (max-width: 1040px) {
  .cb-onboarding-shell {
    padding: 20px;
    align-items: flex-start;
  }
  .cb-onboarding-frame {
    grid-template-columns: 280px minmax(0, 1fr);
  }
  .cb-ob-aside {
    padding: 28px 24px;
  }
  .cb-ob-aside h2 {
    font-size: 34px;
  }
  .cb-onboarding-frame .cb-onboarding-card {
    padding: 26px 30px 34px;
  }
  .cb-onboarding-frame .cb-ob-step-lbl {
    display: none;
  }
}
@media (max-width: 820px) {
  .cb-onboarding-shell {
    padding: 0;
    background: #fff;
  }
  .cb-onboarding-frame {
    min-height: 100vh;
    display: block;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .cb-ob-aside {
    min-height: auto;
    padding: 22px 22px 24px;
    border-radius: 0 0 24px 24px;
  }
  .cb-ob-brand,
  .cb-ob-aside-content > p,
  .cb-ob-benefits,
  .cb-ob-aside-note {
    display: none;
  }
  .cb-ob-aside-content {
    margin: 0;
    padding: 0;
  }
  .cb-ob-aside-kicker {
    margin-bottom: 10px;
  }
  .cb-ob-aside h2 {
    max-width: 520px;
    margin: 0;
    font-size: 28px;
  }
  .cb-onboarding-frame .cb-onboarding-card {
    min-height: auto;
    padding: 20px 22px 36px;
  }
  .cb-ob-topbar {
    justify-content: space-between;
    margin-bottom: 16px;
  }
  .cb-ob-mobile-brand {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 11px;
    border: 1px solid var(--ob-line);
    background: #fff;
  }
  .cb-ob-mobile-brand img {
    width: auto;
    max-width: 105px;
    max-height: 27px;
    object-fit: contain;
  }
  .cb-onboarding-frame .cb-giro-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 560px) {
  .cb-onboarding-frame .cb-ob-lang > span {
    display: none;
  }
  .cb-onboarding-frame .cb-ob-steps {
    margin-bottom: 25px;
  }
  .cb-onboarding-frame .cb-ob-step-line {
    margin: 0 5px;
  }
  .cb-onboarding-frame .cb-ob-step-num {
    width: 34px;
    height: 34px;
  }
  .cb-onboarding-frame .cb-ob-title {
    font-size: 29px;
  }
  .cb-onboarding-frame .cb-giro-tile {
    min-height: 104px;
    padding: 13px;
  }
  .cb-giro-tile-icon {
    width: 38px;
    height: 38px;
  }
  .cb-onboarding-frame .cb-modules-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .cb-onboarding-frame .cb-ob-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }
  .cb-onboarding-frame .cb-ob-actions .cb-btn {
    width: 100%;
    justify-content: center;
  }
  .cb-onboarding-frame .cb-web-url-row {
    align-items: stretch;
  }
  .cb-onboarding-frame .cb-web-url-row .cb-btn {
    width: 100%;
    justify-content: center;
  }
}
@media (max-width: 380px) {
  .cb-onboarding-frame .cb-onboarding-card {
    padding-inline: 16px;
  }
  .cb-onboarding-frame .cb-giro-grid {
    gap: 8px;
  }
  .cb-onboarding-frame .cb-giro-tile-label {
    font-size: 11px;
  }
}

/* ════════════════════════════════════════════════════════════════════════════
   EXPEDIENTE CLÍNICO — NOM-004-SSA3-2012
   ════════════════════════════════════════════════════════════════════════════ */

/* ── List toolbar ───────────────────────────────────────────────────────── */
.cb-exp-toolbar {
  align-items: center; flex-wrap: wrap; gap: 10px;
}
.cb-exp-patient-id {
  flex: 1; display: flex; flex-direction: column; gap: 2px;
}
.cb-exp-patient-id strong { font-size: 15px; font-weight: 700; }
.cb-exp-patient-id small  { font-size: 12px; color: var(--muted); }

/* ── Tab panel reset ─────────────────────────────────────────────────────── */
.cb-exp-tab-panel { padding-top: 20px; }

/* ── Historia clínica form ───────────────────────────────────────────────── */
.cb-exp-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 20px 24px;
  margin-bottom: 16px;
}
.cb-exp-section-title {
  font-size: 13px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .05em; color: var(--primary-deep);
  margin: 0 0 16px; padding-bottom: 10px;
  border-bottom: 2px solid var(--primary-100);
}
.cb-exp-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 0 20px;
}
.cb-textarea-sm  { min-height: 90px;  resize: vertical; }
.cb-textarea-md  { min-height: 120px; resize: vertical; }
.cb-textarea-lg  { min-height: 320px; resize: vertical; font-family: var(--font-mono, monospace); font-size: 12px; line-height: 1.7; }
.cb-exp-actions  {
  display: flex; align-items: center; gap: 14px;
  padding: 20px 0 4px;
}
.cb-field-hint   { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* ── Modals (expediente) ─────────────────────────────────────────────────── */
/* These reuse the [data-cb-modal] header pattern instead of .cb-modal-panel —
   give the wrapper its own overlay/box/header rules so the close button only
   renders once, laid out inline next to the title. */
[data-cb-modal] {
  position: fixed; z-index: 99999; inset: 0;
  display: grid; place-items: center; padding: 20px;
}
[data-cb-modal][hidden] { display: none; }
.cb-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(17,20,45,0.42);
  backdrop-filter: blur(4px);
}
.cb-modal-box {
  position: relative; z-index: 1;
  width: min(580px, 100%);
  max-height: min(760px, 90vh);
  overflow: auto;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}
.cb-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 18px;
}
.cb-modal-header h3 { font-size: 18px; font-weight: 700; color: var(--ink); margin: 0; }
.cb-exp-modal    { max-width: 640px; width: 100%; }
.cb-exp-soap-modal { max-width: 720px; }
.cb-escala-modal { max-width: 680px; }

/* ── SOAP timeline ───────────────────────────────────────────────────────── */
.cb-exp-panel-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; flex-wrap: wrap; gap: 8px;
}
.cb-exp-panel-title {
  font-size: 14px; font-weight: 700; color: var(--ink); margin: 0;
}
.cb-soap-timeline {
  display: flex; flex-direction: column; gap: 16px;
}
.cb-soap-note {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.cb-soap-header {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--surface-3); padding: 10px 16px;
  font-size: 12px; font-weight: 600;
}
.cb-soap-sesion { color: var(--primary-deep); font-weight: 800; }
.cb-soap-date   { color: var(--muted); }
.cb-soap-autor  { margin-left: auto; color: var(--muted); }
.cb-soap-body   { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.cb-soap-field  { display: flex; gap: 10px; }
.cb-soap-field p { margin: 0; font-size: 13px; line-height: 1.6; color: var(--ink-2); }
.cb-soap-task   { background: var(--surface-3); border-radius: var(--r-sm); padding: 8px 10px; }
.cb-soap-task span { font-size: 12px; font-weight: 700; color: var(--ink-2); }

.cb-soap-label {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  font-size: 11px; font-weight: 900; color: #fff;
  flex-shrink: 0; margin-top: 1px;
}
.cb-soap-s { background: #6366F1; }
.cb-soap-o { background: #0EA5E9; }
.cb-soap-a { background: #F59E0B; }
.cb-soap-p { background: #22C55E; }

/* ── Scale (escala) questionnaire ────────────────────────────────────────── */
.cb-escala-instruccion {
  background: var(--primary-50); border-radius: var(--r-sm);
  padding: 10px 14px; font-size: 13px; margin-bottom: 16px; color: var(--ink-2);
}
.cb-escala-items { display: flex; flex-direction: column; gap: 14px; }
.cb-escala-item  { border-bottom: 1px solid var(--border); padding-bottom: 12px; }
.cb-escala-item:last-child { border-bottom: none; }
.cb-escala-pregunta { font-size: 13px; color: var(--ink); margin: 0 0 8px; }
.cb-escala-opciones {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.cb-escala-opcion {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 10px; border: 1px solid var(--border);
  border-radius: var(--r-pill); cursor: pointer; font-size: 12px;
  transition: border-color .15s, background .15s;
}
.cb-escala-opcion:has(input:checked) {
  border-color: var(--primary); background: var(--primary-50); color: var(--primary-deep); font-weight: 600;
}
.cb-escala-opcion input { display: none; }
.cb-escala-result { background: var(--surface-3); border-radius: var(--r-md); padding: 14px 18px; margin: 12px 0; }
.cb-escala-total-display {
  display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap;
}
.cb-escala-total-num {
  font-size: 36px; font-weight: 900; color: var(--primary);
}
.cb-escala-nivel-display {
  font-size: 14px; font-weight: 700; margin-left: 8px;
}

/* ── Scale history (escalas panel) ───────────────────────────────────────── */
.cb-escalas-history { display: flex; flex-direction: column; gap: 10px; }
.cb-escala-row      { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 12px 16px; }
.cb-escala-meta     { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; font-size: 12px; flex-wrap: wrap; }
.cb-escala-tipo     { font-weight: 800; color: var(--primary-deep); background: var(--primary-100); padding: 2px 8px; border-radius: var(--r-pill); }
.cb-escala-fecha    { color: var(--muted); }
.cb-escala-total    { font-weight: 700; }
.cb-escala-nivel    { font-weight: 700; }
.cb-escala-bar-wrap { background: var(--surface-3); border-radius: 99px; height: 8px; overflow: hidden; }
.cb-escala-bar      { height: 100%; border-radius: 99px; transition: width .4s; }

/* Nivel color coding */
.cb-nivel-mínimo,    .cb-nivel-minimo    { color: #15803d; }
.cb-nivel-leve                           { color: #b45309; }
.cb-nivel-moderado                       { color: #c2410c; }
.cb-nivel-moderado-severo                { color: #b91c1c; }
.cb-nivel-severo                         { color: #7f1d1d; font-weight: 900; }

.cb-escala-bar.cb-nivel-mínimo,
.cb-escala-bar.cb-nivel-minimo    { background: #22c55e; }
.cb-escala-bar.cb-nivel-leve      { background: #f59e0b; }
.cb-escala-bar.cb-nivel-moderado  { background: #f97316; }
.cb-escala-bar.cb-nivel-moderado-severo { background: #ef4444; }
.cb-escala-bar.cb-nivel-severo    { background: #7f1d1d; }
/* Fallback para las 12 escalas nuevas (2026-06-25) — sus etiquetas de nivel
   ("Bajo riesgo", "Cribado positivo…", etc.) no coinciden con las clases
   cb-nivel-* de arriba (esas son específicas de PHQ-9/GAD-7), así que sin
   este fallback la barra se quedaría sin color de fondo. */
.cb-escala-bar { background: var(--primary); }
.cb-escala-row-alerta { border-color: #ef4444; border-width: 2px; background: #fef2f2; }

.cb-escala-instruccion-warn {
  background: #fef2f2; border: 1px solid #fecaca; color: #991b1b;
  border-radius: var(--r-md); padding: 10px 14px; font-weight: 600;
}

/* ── Banner de alerta clínica (riesgo suicida/autolesión) ─────────────────── */
.cb-exp-alert-banner {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: #fef2f2; border: 2px solid #ef4444; color: #7f1d1d;
  border-radius: var(--r-md); padding: 12px 18px; margin-bottom: 16px;
  font-size: 13px;
}
.cb-exp-alert-banner a { color: #b91c1c; font-weight: 700; text-decoration: underline; }

/* ── Badges adicionales (consentimientos, derivaciones) ───────────────────── */
.cb-badge-muted   { background: var(--surface-3); color: var(--muted); }
.cb-badge-soft    { background: var(--primary-100); color: var(--primary-deep); }

/* ── Evolución de escalas (mini-gráficas SVG inline) ──────────────────────── */
.cb-exp-evolucion { margin: 16px 0 20px; }
.cb-exp-evolucion-title { font-size: 14px; font-weight: 700; margin: 0 0 10px; }
.cb-exp-evolucion-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.cb-exp-evolucion-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 12px 14px;
}
.cb-exp-evolucion-card-title { font-size: 12px; font-weight: 800; color: var(--primary-deep); margin-bottom: 6px; }
.cb-exp-evolucion-svg { width: 100%; height: 60px; color: var(--primary); }
.cb-exp-evolucion-svg circle { fill: currentColor; }
.cb-exp-evolucion-card-footer {
  display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 4px;
}

/* ── Consentimientos múltiples (accordion) ─────────────────────────────────── */
.cb-exp-consent-tabs { display: flex; flex-direction: column; gap: 10px; max-width: 820px; }
.cb-exp-consent-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); overflow: hidden;
}
.cb-exp-consent-card summary {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 16px; cursor: pointer; font-weight: 700; font-size: 13px;
  list-style: none;
}
.cb-exp-consent-card summary::-webkit-details-marker { display: none; }
.cb-exp-consent-card-body { padding: 4px 16px 16px; }

/* ── Consentimiento ──────────────────────────────────────────────────────── */
.cb-exp-consent        { max-width: 820px; }
.cb-consent-signed-banner {
  display: flex; align-items: center; gap: 10px;
  background: #f0fdf4; border: 1px solid #bbf7d0;
  border-radius: var(--r-md); padding: 12px 16px;
  font-size: 13px; color: #15803d; margin-bottom: 16px;
}
.cb-consent-sign-section {
  background: var(--surface-3); border-radius: var(--r-md);
  padding: 16px 20px; margin: 8px 0 14px;
}
.cb-consent-sign-section h4 {
  font-size: 14px; font-weight: 700; margin: 0 0 12px;
}
.cb-consent-signed-note { font-size: 12px; color: var(--muted); }

/* ── New expediente modal ─────────────────────────────────────────────────── */
/* (uses existing .cb-modal-box sizing) */

/* ── Asistente IA (atención por WhatsApp) ─────────────────────────────────── */
.cb-ai-agent-form { display: flex; flex-direction: column; gap: 18px; max-width: 760px; }
.cb-ai-agent-status-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 14px; margin: 12px 0 16px;
}
.cb-ai-agent-status-item {
  border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 12px 14px; display: flex; flex-direction: column; gap: 6px;
}
.cb-ai-agent-status-item .cb-badge { align-self: flex-start; }
.cb-ai-agent-toggle {
  display: flex; align-items: center; gap: 10px;
  font-size: 14px; color: var(--ink); margin: 4px 0 6px;
}
.cb-ai-agent-mode-tabs { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }
.cb-radio-pill {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--border); border-radius: 999px;
  padding: 9px 16px; font-size: 13px; font-weight: 600; color: var(--ink-2);
  cursor: pointer; transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.cb-radio-pill:has(input:checked) {
  border-color: var(--primary); color: var(--primary-deep); background: var(--primary-50);
}
.cb-radio-pill input { accent-color: var(--primary); }
.cb-ai-agent-mode-panel { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.cb-form-status-msg[data-tone="success"] { color: var(--st-confirmed-fg, #1a7f4f); }
.cb-form-status-msg[data-tone="error"]   { color: var(--st-cancelled-fg, #c0392b); }

/* ── Sub-navegación de pantallas con pestañas (p.ej. Asistente IA) ────────── */
.cb-subnav { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.cb-subnav-item {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border); border-radius: 999px;
  padding: 9px 18px; font-size: 13px; font-weight: 600; color: var(--ink-2);
  text-decoration: none; transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.cb-subnav-item:hover { color: var(--primary-deep); border-color: var(--primary-200); }
.cb-subnav-item.is-active { border-color: var(--primary); color: var(--primary-deep); background: var(--primary-50); }

/* CRM WhatsApp tab — se ve como botón CTA cuando no está activo */
.cb-subnav-item--crm:not(.is-active) {
  background: #25D366; border-color: #25D366; color: #fff;
  box-shadow: 0 2px 8px rgba(37,211,102,.35);
}
.cb-subnav-item--crm:not(.is-active):hover {
  background: #1ebe5d; border-color: #1ebe5d; color: #fff;
  box-shadow: 0 4px 14px rgba(37,211,102,.45);
}
.cb-subnav-item--crm.is-active {
  background: var(--primary); border-color: var(--primary); color: #fff;
  box-shadow: 0 2px 8px rgba(118,103,240,.35);
}

/* ── CRM WhatsApp — horario de atención ────────────────────────────────────── */
.cb-crm-availability { margin-bottom: 18px; }
.cb-crm-availability-grid { display: flex; flex-direction: column; gap: 8px; margin: 14px 0 4px; }
.cb-crm-avail-row {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  border: 1px solid var(--border); border-radius: var(--r-md); padding: 10px 14px;
}
.cb-crm-avail-row.is-disabled { opacity: .55; }
.cb-crm-avail-day { display: flex; align-items: center; gap: 8px; min-width: 150px; font-weight: 600; font-size: 13.5px; }
.cb-crm-avail-times { display: flex; align-items: center; gap: 8px; flex: 1; flex-wrap: wrap; }
.cb-crm-avail-times input[type="time"] {
  border: 1px solid var(--border); border-radius: var(--r-sm, 8px); padding: 7px 10px; font-size: 13px;
  background: var(--surface, #fff); color: var(--ink);
}
.cb-crm-avail-times span { color: var(--ink-2); font-size: 12.5px; }

/* ── CRM WhatsApp — tablero Kanban (estilo Trello) ─────────────────────────── */
.cb-crm-intro { margin-bottom: 18px; }
.cb-crm-empty-card { padding: 8px; }
.cb-crm-board {
  display: flex; gap: 16px; overflow-x: auto; padding-bottom: 8px;
  align-items: flex-start;
}
.cb-crm-column {
  flex: 0 0 280px; display: flex; flex-direction: column;
  background: var(--surface-2, #F6F7FB); border: 1px solid var(--border);
  border-radius: var(--r-lg); max-height: calc(100vh - 320px); min-height: 220px;
}
.cb-crm-column-head {
  display: flex; align-items: center; gap: 8px; padding: 14px 14px 10px;
  position: sticky; top: 0; background: inherit; border-radius: var(--r-lg) var(--r-lg) 0 0; z-index: 1;
}
.cb-crm-column-dot {
  width: 10px; height: 10px; border-radius: 50%; background: var(--cb-crm-color, var(--primary));
  flex: 0 0 auto;
}
.cb-crm-column-head h3 { margin: 0; font-size: 14px; flex: 1; }
.cb-crm-column-count {
  font-size: 12px; font-weight: 700; color: var(--ink-2);
  background: var(--surface, #fff); border: 1px solid var(--border);
  border-radius: 999px; min-width: 22px; height: 22px; display: inline-flex;
  align-items: center; justify-content: center; padding: 0 6px;
}
.cb-crm-column-body {
  display: flex; flex-direction: column; gap: 10px; padding: 4px 12px 14px;
  overflow-y: auto; flex: 1;
}
.cb-crm-column-body.is-drop-target { background: var(--primary-50); border-radius: var(--r-md); }
.cb-crm-column-empty { font-size: 12px; color: var(--ink-3, var(--ink-2)); text-align: center; padding: 18px 6px; }

.cb-crm-card {
  background: var(--surface, #fff); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 12px 14px; cursor: grab; display: flex; flex-direction: column; gap: 8px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04); transition: box-shadow .15s ease, transform .15s ease, opacity .15s ease;
}
.cb-crm-card:hover { box-shadow: 0 6px 18px rgba(15, 23, 42, .08); }
.cb-crm-card.is-dragging { opacity: .5; transform: scale(.98); cursor: grabbing; }
.cb-crm-card-head { display: flex; align-items: center; gap: 10px; }
.cb-crm-card-avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--primary-100); color: var(--primary-deep);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex: 0 0 auto;
}
.cb-crm-card-name { display: block; font-size: 13.5px; color: var(--ink); line-height: 1.2; }
.cb-crm-card-phone { display: block; font-size: 11.5px; color: var(--ink-2); }
.cb-crm-card-summary { font-size: 12.5px; color: var(--primary-deep); font-weight: 600; margin: 0; }
.cb-crm-card-preview {
  font-size: 12px; color: var(--ink-2); margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.cb-crm-card-appointment-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 600; line-height: 1.3;
  padding: 3px 9px; margin: 2px 0 0; border-radius: 999px;
  background: var(--primary-100); color: var(--primary-deep); width: fit-content;
}
.cb-crm-card-source-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 600; line-height: 1.3;
  padding: 3px 9px; margin: 4px 0 0; border-radius: 999px;
  background: #fef3c7; color: #92400e; width: fit-content;
}
.cb-crm-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cb-crm-card-time { font-size: 11px; color: var(--ink-3, var(--ink-2)); }
.cb-crm-card-badge { font-size: 10.5px; padding: 3px 9px; }

.cb-crm-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-bottom: 14px; flex-wrap: wrap;
}
.cb-crm-toolbar p { margin: 0; }

.cb-crm-card-modal,
.cb-crm-add-modal {
  position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center;
  background: rgba(15, 23, 42, .45); padding: 20px;
}
.cb-crm-card-modal[hidden],
.cb-crm-add-modal[hidden] { display: none; }
.cb-crm-card-modal-inner {
  background: var(--surface, #fff); border-radius: var(--r-lg); padding: 28px;
  max-width: 480px; width: 100%; position: relative; display: flex; flex-direction: column; gap: 12px;
  max-height: 90vh; overflow-y: auto;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .cb-exp-grid     { grid-template-columns: 1fr; }
  .cb-escala-opciones { flex-direction: column; }
  .cb-exp-section  { padding: 14px 14px; }
  .cb-ai-agent-status-grid { grid-template-columns: 1fr; }
  .cb-crm-column { flex-basis: 240px; }
}

/* ── Marketing CRM Module ────────────────────────── */

/* ── Kanban board layout ── */
.cb-mkt-board {
  display: flex;
  flex-direction: row;
  overflow-x: auto;
  gap: 12px;
  padding-bottom: 16px;
  min-height: 60vh;
}

.cb-mkt-col {
  flex: 0 0 auto;
  min-width: 260px;
  max-width: 280px;
  display: flex;
  flex-direction: column;
  background: #f1f5f9;
  border-radius: 10px;
  padding: 0;
}

.cb-mkt-col-header {
  padding: 12px 14px;
  font-weight: 600;
  font-size: 13px;
  border-radius: 10px 10px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cb-mkt-col-header .cb-mkt-count {
  background: rgba(255,255,255,0.4);
  border-radius: 20px;
  padding: 2px 8px;
  font-size: 11px;
}

.cb-mkt-col-body {
  flex: 1;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 80px;
  transition: background 0.15s;
}

.cb-mkt-col-body.cb-drag-over {
  background: rgba(118,103,240,0.08);
  border-radius: 6px;
}

.cb-mkt-col-add {
  padding: 8px;
  border-top: 1px solid rgba(0,0,0,0.06);
}

/* ── Prospect cards ── */
.cb-mkt-card {
  background: #fff;
  border-radius: 8px;
  padding: 12px;
  border: 1px solid #e2e8f0;
  cursor: grab;
  transition: box-shadow 0.15s;
  user-select: none;
}

.cb-mkt-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.cb-mkt-card.cb-dragging {
  opacity: 0.4;
  cursor: grabbing;
}

.cb-mkt-card-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--cb-text, var(--ink, #1e293b));
  margin-bottom: 4px;
}

.cb-mkt-card-phone {
  font-size: 12px;
  color: var(--cb-muted, var(--muted, #64748b));
  font-family: monospace;
}

.cb-mkt-card-meta {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 8px;
  flex-wrap: wrap;
}

.cb-mkt-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
}

.cb-mkt-badge-campaign {
  background: #ede9fe;
  color: #7c3aed;
}

.cb-mkt-badge-bot {
  background: #d1fae5;
  color: #065f46;
}

.cb-mkt-badge-followup {
  background: #fff7ed;
  color: #c2410c;
}

.cb-mkt-card-days {
  font-size: 11px;
  color: var(--cb-muted, var(--muted, #64748b));
  margin-left: auto;
}

.cb-mkt-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #f1f5f9;
}

.cb-mkt-card-actions button {
  flex: 1;
  font-size: 11px;
  padding: 4px 6px;
}

/* ── Toolbar ── */
.cb-mkt-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.cb-mkt-toolbar .cb-mkt-title {
  font-size: 20px;
  font-weight: 700;
  margin-right: auto;
}

/* ── Search panel (slide-in) ── */
.cb-mkt-search-panel {
  position: fixed;
  right: 0;
  top: 0;
  height: 100vh;
  width: 420px;
  background: #fff;
  box-shadow: -4px 0 24px rgba(0,0,0,0.1);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s ease;
}

.cb-mkt-search-panel.open {
  transform: translateX(0);
}

.cb-mkt-search-panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--cb-border, var(--border, #e2e8f0));
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cb-mkt-search-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

.cb-mkt-search-results {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.cb-mkt-result-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--cb-border, var(--border, #e2e8f0));
  border-radius: 8px;
  font-size: 13px;
}

.cb-mkt-result-item input[type="checkbox"] {
  margin-top: 2px;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.cb-mkt-result-name {
  font-weight: 600;
}

.cb-mkt-result-phone {
  color: var(--cb-muted, var(--muted, #64748b));
  font-family: monospace;
  font-size: 12px;
}

/* ── Campaign modal ── */
.cb-mkt-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cb-mkt-modal-overlay[hidden] {
  display: none;
}

.cb-mkt-modal {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  width: 90%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
}

/* ── Prospect detail side panel ── */
.cb-mkt-detail-panel {
  position: fixed;
  right: 0;
  top: 0;
  height: 100vh;
  width: 420px;
  background: #fff;
  box-shadow: -4px 0 24px rgba(0,0,0,0.1);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s ease;
}

.cb-mkt-detail-panel.open {
  transform: translateX(0);
}

/* ── Spinner utility ── */
.cb-mkt-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(118,103,240,0.2);
  border-top-color: #7667f0;
  border-radius: 50%;
  animation: cb-mkt-spin 0.7s linear infinite;
  margin: 12px auto;
}

@keyframes cb-mkt-spin {
  to { transform: rotate(360deg); }
}

.cb-mkt-board-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 32px 16px;
  text-align: center;
  color: var(--om-muted, #6c7789);
  font-size: 13px;
}

/* ── Inline notes textarea on card ── */
.cb-mkt-card-notes {
  width: 100%;
  font-size: 12px;
  border: 1px solid var(--cb-border, var(--border, #e2e8f0));
  border-radius: 6px;
  padding: 6px 8px;
  resize: vertical;
  min-height: 60px;
  margin-top: 8px;
  font-family: inherit;
  color: var(--ink, #11142d);
}

/* ── Stage dropdown on card ── */
.cb-mkt-card-stage-select {
  font-size: 11px;
  border: 1px solid var(--cb-border, var(--border, #e2e8f0));
  border-radius: 4px;
  padding: 3px 6px;
  cursor: pointer;
  background: #fff;
  max-width: 100%;
}

/* ── Mobile: full-width panels ── */
@media (max-width: 640px) {
  .cb-mkt-search-panel,
  .cb-mkt-detail-panel {
    width: 100%;
  }
  .cb-mkt-col {
    min-width: 220px;
    max-width: 240px;
  }
}
