/* =============================================================
   Compass extras — supplements portal.css with selectors it lacks.
   Loaded AFTER portal.css so any overlap intentionally overrides;
   but in practice we only add net-new classes here.
   ============================================================= */

/* Nav section grouping inside sidebar */
.cx-nav-section { padding: 8px 0; }
.cx-nav-section + .cx-nav-section { border-top: 1px solid rgba(255,255,255,.08); }
.cx-nav { flex: 1; overflow-y: auto; padding-bottom: 12px; }

/* Sidebar brand: achieva wordmark stacked above Compass + subtitle.
   Overrides portal.css's compact single-row layout. */
.cx-sidebar-logo { padding: 22px 22px 18px; }
.cx-sidebar-logo .cx-sidebar-mark {
  display: block; height: 33px; width: auto;
  margin: 0 0 14px;
}
.cx-sidebar-logo .cx-sidebar-product {
  display: flex; align-items: center; gap: 10px;
}
.cx-sidebar-logo .cx-sidebar-product > svg {
  width: 22px; height: 22px; flex-shrink: 0;
}
/* Let the text block shrink within the flex row so the subtitle can wrap
   instead of being clipped at large text sizes. */
.cx-sidebar-logo .cx-sidebar-product > div {
  min-width: 0;
}
.cx-sidebar-logo .cx-product {
  font-family: var(--c-head-font); font-weight: 800;
  font-size: 1.02rem; color: #fff; line-height: 1.15;
}
.cx-sidebar-logo .cx-product-sub {
  font-size: .62rem; letter-spacing: .12em;
  text-transform: uppercase; color: rgba(255,255,255,.55);
  margin-top: 2px; font-weight: 600;
  line-height: 1.25;
}

/* Alpine x-cloak: hide elements until Alpine initializes so x-show
   doesn't flash modal content on page load. */
[x-cloak] { display: none !important; }

/* Filled destructive button — used as the confirm action in delete dialogs. */
.cx-btn-danger-solid { background: var(--red); color: #fff; border-color: var(--red); }
.cx-btn-danger-solid:hover { background: #970a26; border-color: #970a26; transform: translateY(-1px); box-shadow: 0 6px 16px rgba(186,12,47,.32); }

/* Modal overlay/dialog */
.cx-modal-overlay {
  position: fixed; inset: 0; background: rgba(8, 25, 28, .55);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 24px;
  animation: cxFade .2s var(--ease);
}
.cx-modal {
  background: var(--c-surface); border-radius: 18px;
  box-shadow: var(--shadow-lg); overflow: hidden;
  max-height: calc(100vh - 48px); display: flex; flex-direction: column;
  animation: cxRise .22s var(--ease);
}
.cx-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--c-border);
}
.cx-modal-title { margin: 0; font-family: var(--c-head-font); font-weight: 700; font-size: 1.15rem; color: var(--teal-dark); }
.cx-modal-body { padding: 22px; overflow-y: auto; }
.cx-modal-footer {
  padding: 16px 22px; border-top: 1px solid var(--c-border);
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
}

@keyframes cxFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes cxRise { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Flash messages */
.cx-flash { padding: 11px 14px; border-radius: 12px; font-size: .9rem; margin-bottom: 14px; }
.cx-flash-info    { background: #e2f0f0; color: var(--teal-dark); }
.cx-flash-success { background: #eef4d9; color: #54690a; }
.cx-flash-error   { background: #fde8ec; color: var(--red); }

/* Form group used in auth/share — portal.css has cx-field but not the input variants */
.cx-input, .cx-select, .cx-textarea {
  font-family: inherit; font-size: .95rem; color: var(--c-ink);
  padding: 10px 13px; border: 1.5px solid var(--c-border);
  border-radius: var(--c-radius-ctl); background: var(--c-surface);
  transition: border-color var(--duration-2) var(--ease);
}
.cx-input:focus, .cx-select:focus, .cx-textarea:focus {
  outline: none; border-color: var(--teal);
}
.cx-textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
.cx-field label { font-size: .82rem; font-weight: 600; color: var(--c-ink); }

/* Star section panel highlight */
.cx-point-section { padding: 14px 16px; border-radius: 14px; transition: background var(--duration-2) var(--ease); }
.cx-point-section.is-selected { background: var(--c-surface-2); }
.cx-point-head { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: .95rem; color: var(--c-ink); }
.cx-point-dot { width: 30px; height: 30px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; color: #fff; }
.cx-point-dot svg { width: 16px; height: 16px; }
.cx-point-prompt { font-style: italic; color: var(--c-ink-2); font-size: .85rem; margin: 6px 0 10px; line-height: 1.5; }

/* Chip editor */
.cx-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 8px; }
.cx-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 8px; font-size: .85rem; font-weight: 600;
  transition: box-shadow .4s ease;
}
.cx-chip.is-new { box-shadow: 0 0 0 2px var(--soft-teal); }
.cx-chip button { background: none; border: none; color: inherit; opacity: .65; cursor: pointer; padding: 0; line-height: 1; }
.cx-chip button:hover { opacity: 1; }
.cx-chip-input { display: flex; gap: 6px; }
.cx-chip-input input { flex: 1; }

/* Template glyph (colored tile w/ icon used on plan cards + template cards + landing) */
.cx-tmpl-glyph {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 15px; color: #fff;
  box-shadow: 0 6px 18px var(--glyph-glow, rgba(0,98,105,.18));
}
.cx-tmpl-glyph svg { width: 60%; height: 60%; }

/* Template gallery & plan-card details portal.css doesn't define */
.cx-plan-title { font-size: 1.05rem; font-weight: 700; color: var(--c-ink); margin: 0 0 4px; }
.cx-progress-text { font-size: .76rem; font-weight: 700; color: var(--c-ink-2); }
.cx-tmpl-start { color: var(--teal); font-weight: 700; font-size: .9rem; display: inline-flex; align-items: center; gap: 4px; }
.cx-tmpl-time { background: var(--c-surface-2); color: var(--c-ink-2); font-size: .72rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; letter-spacing: .03em; text-transform: uppercase; }

/* Side panel tabs / scroll */
.cx-side-tabs { display: flex; border-bottom: 1px solid var(--c-border); margin: 0 -22px 12px; padding: 0 22px; }
.cx-side-tabs button { flex: 1; padding: 12px 4px; background: none; border: none; font-family: inherit; font-weight: 600; color: var(--c-ink-2); cursor: pointer; border-bottom: 2px solid transparent; font-size: .9rem; }
.cx-side-tabs button.active { color: var(--teal-dark); border-bottom-color: var(--teal); }
.cx-side-footer { padding: 14px 22px; border-top: 1px solid var(--c-border); display: flex; align-items: center; gap: 10px; background: var(--c-surface-2); }

/* Star toast */
.cx-toast {
  position: fixed; left: 50%; bottom: 36px; transform: translateX(-50%);
  background: #1a2b30; color: #fff; padding: 11px 18px; border-radius: 999px;
  font-size: .88rem; z-index: 90; box-shadow: var(--shadow-md);
  animation: cxRise .25s var(--ease);
}

/* Comments */
.cx-comment { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--c-border-soft); }
.cx-comment:last-child { border-bottom: none; }
.cx-comment .cx-comment-meta { font-size: .78rem; color: var(--c-ink-2); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cx-comment .cx-comment-text { font-size: .92rem; color: var(--c-ink); line-height: 1.55; margin: 4px 0 0; }

/* Admin */
.cx-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 26px; }
@media (max-width: 900px) { .cx-stats { grid-template-columns: repeat(2, 1fr); } }
.cx-stat { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--c-radius-card); padding: 22px; }
.cx-stat-v { font-family: var(--c-head-font); font-weight: 800; font-size: 2rem; line-height: 1; }
.cx-stat-l { font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--c-ink-2); margin-top: 6px; }
.cx-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.cx-table th { text-align: left; font-weight: 700; color: var(--c-ink-2); font-size: .76rem; letter-spacing: .04em; text-transform: uppercase; padding: 12px 14px; border-bottom: 1px solid var(--c-border); }
.cx-table td { padding: 14px; border-bottom: 1px solid var(--c-border-soft); color: var(--c-ink); }
.cx-table tr { cursor: pointer; transition: background .12s var(--ease); }
.cx-table tr:hover td { background: rgba(0,98,105,.04); }

/* Achieva opt-in callout */
.cx-achieva-optin {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px; border: 1px solid var(--soft-teal);
  background: #eef7f7; border-radius: 14px; margin-top: 16px;
}
.cx-achieva-optin .cx-tile { width: 40px; height: 40px; border-radius: 11px; background: var(--teal); color: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* Plan delete button (sits in the colored cap, owner-only) */
.cx-plan-delete { color: var(--c-ink-2); }
.cx-plan-delete:hover { background: #fde8ec !important; color: var(--red) !important; }
.cx-plan-card { cursor: pointer; }
.cx-plan-card:focus-visible { outline: 3px solid var(--soft-teal); outline-offset: 2px; }

/* Collaborator row */
.cx-collab-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--c-border-soft); }
.cx-collab-row:last-child { border-bottom: none; }
.cx-collab-row .cx-collab-meta { flex: 1; min-width: 0; }
.cx-collab-row .cx-collab-name { font-weight: 700; color: var(--c-ink); display: flex; align-items: center; }
.cx-collab-row .cx-collab-email { font-size: .85rem; color: var(--c-ink-2); margin-top: 1px; }

/* Generic horizontal row — flex row with sensible defaults. Used by the
   share-modal invite row, admin read-only page-head cluster, and the
   trajectory list rows. */
.cx-row { display: flex; align-items: center; gap: 10px; }
/* Vertical list used by the Trajectory editor (and any other "stack of rows"
   layout). Without this rule the rows had no spacing and the pills touched. */
.cx-stack { display: flex; flex-direction: column; gap: 8px; }

/* Templates-page card footer — pushes the "5 min" pill and "Start →" link
   to opposite ends of the card. Without the flex they piled up inline. */
.cx-tmpl-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; }

/* Inline label shown by the partials/_macros.html switch() macro when a
   `label=` kwarg is passed. Aligns it with the track and matches the rest
   of the form-row typography. */
.cx-switch-label { font-weight: 600; color: var(--c-ink); font-size: .9rem; }

/* Share-modal "copy link" pill — cream surface, link icon prefix, truncated URL */
.cx-share-link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 12px;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border-soft);
}
.cx-share-link-url {
  flex: 1; min-width: 0;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: .85rem; color: var(--c-ink-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Landing nav (portal.css doesn't fully define) */
.cx-landing-nav {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 40px; background: rgba(255,255,255,.9);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--c-border-soft);
}
.cx-landing-nav-left { display: flex; align-items: center; gap: 14px; }
.cx-landing-nav-left img { height: 30px; }
.cx-landing-nav-divider { width: 1px; height: 22px; background: var(--c-border); }
.cx-landing-wordmark { font-family: var(--c-head-font); font-weight: 800; font-size: 1.15rem; color: var(--teal-dark); }
.cx-landing-nav-links { display: flex; gap: 22px; }
.cx-landing-nav-links a { color: var(--c-ink-2); font-size: .92rem; font-weight: 600; }
.cx-landing-nav-links a:hover { color: var(--teal-dark); }
.cx-landing-nav-right { display: flex; gap: 10px; align-items: center; }

/* How-it-works step circle */
.cx-step { display: flex; gap: 14px; align-items: flex-start; padding: 14px 0; }
.cx-step-num {
  width: 42px; height: 42px; border-radius: 50%;
  border: 2px solid var(--teal); color: var(--teal-dark);
  font-family: var(--c-head-font); font-weight: 800; font-size: 1.05rem;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.cx-step h4 { margin: 0 0 4px; font-size: 1rem; color: var(--c-ink); }
.cx-step p { margin: 0; font-size: .9rem; color: var(--c-ink-2); line-height: 1.5; }

/* Testimonial card */
.cx-testimonial {
  background: var(--c-surface-2); border-radius: 18px; padding: 28px;
  border: 1px solid var(--c-border-soft);
}
.cx-testimonial-quote { font-family: var(--font-serif); font-style: italic; color: var(--c-ink); line-height: 1.55; font-size: 1.05rem; margin: 14px 0; }
.cx-testimonial-author { color: var(--c-ink-2); font-size: .9rem; }

/* Notifications bell */
.cx-bell-btn { position: relative; }
.cx-bell-badge {
  position: absolute; top: -4px; right: -4px;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--red, #ba0c2f); color: #fff;
  font-size: .68rem; font-weight: 700; line-height: 18px; text-align: center;
  box-shadow: 0 0 0 2px var(--c-surface);
}
.cx-bell-badge[hidden] { display: none; }
.cx-bell-panel {
  position: absolute; top: 100%; right: 0; margin-top: 8px;
  width: 360px; max-height: 480px; overflow-y: auto;
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: 14px; box-shadow: 0 14px 40px rgba(0,0,0,.12);
  z-index: 60;
}
.cx-bell-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px 10px; border-bottom: 1px solid var(--c-border-soft);
  font-size: .92rem;
}
.cx-bell-empty { padding: 22px 16px; color: var(--c-ink-2); font-size: .88rem; line-height: 1.5; }
.cx-bell-list { list-style: none; margin: 0; padding: 4px 0; }
.cx-bell-item { border-bottom: 1px solid var(--c-border-soft); }
.cx-bell-item:last-child { border-bottom: 0; }
.cx-bell-item.is-unread { background: rgba(0, 98, 105, .045); }
.cx-bell-item.is-unread .cx-bell-line::before {
  content: ''; display: inline-block; width: 6px; height: 6px;
  border-radius: 50%; background: var(--teal, #006269); margin-right: 6px;
  vertical-align: middle;
}
.cx-bell-link { display: block; padding: 10px 16px; color: inherit; text-decoration: none; }
.cx-bell-link:hover { background: rgba(0,0,0,.03); text-decoration: none; }
.cx-bell-line { font-size: .9rem; color: var(--c-ink); line-height: 1.4; }
.cx-bell-on { color: var(--c-ink-2); }
.cx-bell-plan { color: var(--c-accent-ink, #004d52); font-weight: 600; }
.cx-bell-detail { color: var(--c-ink-2); font-size: .84rem; margin-top: 3px; font-style: italic; }
.cx-bell-when  { color: var(--c-ink-3, #889096); font-size: .74rem; margin-top: 4px; }

/* History panel (editor side-drawer) */
.cx-history-drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: 380px;
  background: var(--c-surface); border-left: 1px solid var(--c-border);
  box-shadow: -16px 0 40px rgba(0,0,0,.12);
  display: flex; flex-direction: column; z-index: 70;
}
.cx-history-head {
  padding: 18px 18px 12px; border-bottom: 1px solid var(--c-border-soft);
  display: flex; justify-content: space-between; align-items: center;
}
.cx-history-body { flex: 1; overflow-y: auto; padding: 6px 0 14px; }
.cx-history-item {
  padding: 12px 18px; border-bottom: 1px solid var(--c-border-soft);
  display: flex; flex-direction: column; gap: 4px;
}
.cx-history-item:last-child { border-bottom: 0; }
.cx-history-label  { font-size: .92rem; color: var(--c-ink); font-weight: 600; }
.cx-history-meta   { font-size: .78rem; color: var(--c-ink-2); }
.cx-history-actions { margin-top: 6px; display: flex; gap: 8px; }
.cx-history-empty  { padding: 22px 18px; color: var(--c-ink-2); font-size: .9rem; line-height: 1.5; }
