/* ========================================================================
   NovaWayfinder — Vanilla CSS
   Aesthetic: Light & Airy · Warm sage + honey
   ======================================================================== */

/* ---- Tokens ---- */
:root {
  /* Backgrounds — warm off-whites */
  --bg-body: #FAF7F2;
  --bg-surface: #FFFFFF;
  --bg-surface-alt: #F2EDE4;
  --bg-sidebar: #F5F1E9;
  --bg-tint: #EEF3EF;

  /* Text — soft ink, not pure black */
  --text-primary: #2D3A3A;
  --text-secondary: #6B7770;
  --text-on-tint: #2D3A3A;
  --text-muted: #A5A89E;

  /* Brand — sage primary, warm honey accent */
  --brand-primary: #3F6B5C;
  --brand-primary-hover: #2F5546;
  --brand-accent: #C8945A;
  --brand-accent-hover: #B07F45;
  --brand-accent-soft: #FAEFDF;

  /* Borders — warm cream */
  --border: #E8E2D5;
  --border-strong: #C9C2B2;
  --border-tint: #D5DDD2;

  /* Semantic — softened */
  --validated: #7CA982;
  --validated-bg: #EAF3EC;
  --validated-text: #466F50;
  --pending: #D4A574;
  --pending-bg: #FAEFDF;
  --pending-text: #8B6033;
  --ai: #9788C2;
  --ai-bg: #F1EDF8;
  --ai-text: #5D4D8A;
  --danger: #C97D5D;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2.5rem;
  --space-2xl: 4rem;
  --space-3xl: 6rem;

  /* Radius — softer than Swiss */
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 14px;

  /* Shadows — feather-light */
  --shadow-sm: 0 1px 2px rgba(45, 58, 58, .04);
  --shadow-md: 0 6px 18px rgba(45, 58, 58, .06);
  --shadow-lg: 0 16px 40px rgba(45, 58, 58, .09);

  /* Type */
  --font-head: 'Fraunces', 'Cabinet Grotesk', Georgia, serif;
  --font-body: 'IBM Plex Sans', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;

  /* Layout */
  --max-w: 1280px;
  --sidebar-w: 260px;
  --header-h: 64px;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
ul, ol { list-style: none; }

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

/* ---- Typography — softer, editorial ---- */
h1, h2, h3, h4, h5 {
  font-family: var(--font-head);
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  line-height: 1.2;
}
h1 { font-size: clamp(2.25rem, 4.2vw, 3.25rem); font-weight: 500; }
h2 { font-size: clamp(1.75rem, 3.2vw, 2.35rem); font-weight: 500; }
h3 { font-size: clamp(1.4rem, 2.5vw, 1.85rem); font-weight: 500; }
h4 { font-size: clamp(1.1rem, 1.8vw, 1.35rem); font-weight: 600; }
h5 { font-size: 1rem; font-weight: 600; }

.overline {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.mono { font-family: var(--font-mono); }
.muted { color: var(--text-secondary); }
.tiny { font-size: 0.75rem; }

/* ---- Generic utilities ---- */
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 var(--space-lg); }
.stack > * + * { margin-top: var(--space-md); }
.stack-lg > * + * { margin-top: var(--space-lg); }
.row { display: flex; align-items: center; gap: var(--space-md); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--space-md); }
.row-wrap { flex-wrap: wrap; }
.grid { display: grid; gap: var(--space-lg); }
.hide-on-mobile { }
@media (max-width: 768px) { .hide-on-mobile { display: none !important; } }

/* ---- Buttons — softer, pillier ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 0.65rem 1.15rem;
  border-radius: var(--r-md);
  font-weight: 500;
  font-size: 0.9rem;
  letter-spacing: 0;
  border: 1px solid transparent;
  transition: background-color .18s ease, color .18s ease, border-color .18s ease, transform .12s ease, box-shadow .18s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand-primary); color: #fff; }
.btn-primary:hover { background: var(--brand-primary-hover); box-shadow: var(--shadow-md); }
.btn-secondary { background: #fff; color: var(--brand-primary); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--bg-surface-alt); border-color: var(--brand-primary); }
.btn-accent { background: var(--brand-accent); color: #fff; }
.btn-accent:hover { background: var(--brand-accent-hover); }
.btn-ghost { background: transparent; color: var(--text-primary); }
.btn-ghost:hover { background: var(--bg-surface-alt); }
.btn-dark { background: var(--brand-primary); color: #fff; border-color: var(--brand-primary); }
.btn-dark:hover { background: var(--brand-primary-hover); border-color: var(--brand-primary-hover); }
.btn-sm { padding: 0.45rem 0.85rem; font-size: 0.8125rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn .icon { width: 16px; height: 16px; }

/* ---- Inputs ---- */
.field { display: flex; flex-direction: column; gap: var(--space-xs); }
.field-label { font-size: 0.8125rem; font-weight: 500; color: var(--text-secondary); }
.input, .textarea, .select {
  width: 100%;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 0.7rem 0.9rem;
  font-size: 0.9375rem;
  color: var(--text-primary);
  transition: border-color .18s ease, box-shadow .18s ease;
}
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(63, 107, 92, 0.12);
}
.textarea { resize: vertical; min-height: 96px; line-height: 1.55; }
.field-help { font-size: 0.75rem; color: var(--text-muted); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-md); }
@media (max-width: 640px) { .field-row { grid-template-columns: 1fr; } }

/* ---- Cards ---- */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--space-lg);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.card-hover:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
/* Replaced "card-dark" with a soft warm card — no dark surfaces */
.card-dark {
  background: var(--bg-tint);
  color: var(--text-primary);
  border-color: var(--border-tint);
}
.card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-md); margin-bottom: var(--space-md); }
.card-title { font-family: var(--font-head); font-weight: 600; font-size: 1.15rem; }
.card-body > * + * { margin-top: var(--space-sm); }

/* ---- Badges & Chips ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  border: 1px solid;
}
.badge .icon { width: 12px; height: 12px; }
.badge-validated { background: var(--validated-bg); color: var(--validated-text); border-color: var(--validated); }
.badge-pending { background: var(--pending-bg); color: var(--pending-text); border-color: var(--pending); }
.badge-ai { background: var(--ai-bg); color: var(--ai-text); border-color: var(--ai); }
.badge-neutral { background: var(--bg-surface-alt); color: var(--text-secondary); border-color: var(--border); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--border);
  font-size: 0.8125rem;
  color: var(--text-primary);
  transition: background-color .15s, border-color .15s;
}
.chip .icon { width: 13px; height: 13px; }
.chip-verified {
  background: var(--validated-bg);
  border-color: var(--validated);
  color: var(--validated-text);
  font-weight: 600;
}
.chip-pending {
  background: var(--pending-bg);
  border-color: var(--pending);
  color: var(--pending-text);
  font-weight: 600;
}

/* ---- App Shell ---- */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .shell-sidebar { display: none; }
}

.shell-sidebar {
  background: var(--bg-sidebar);
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  padding: var(--space-lg);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}
/* Brand mark — Wayfinder-inspired tetrahedron with central nav fix.
   Triangular pyramid silhouette + 3 corner nodes + glowing apex + orbit ring. */
.brand-mark {
  width: 38px; height: 38px;
  flex-shrink: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'><circle cx='24' cy='24' r='23' fill='%23EEF3EF'/><circle cx='24' cy='24' r='16' fill='none' stroke='%233F6B5C' stroke-width='0.6' opacity='0.3'/><path d='M24 9 L40 35 L8 35 Z' fill='none' stroke='%233F6B5C' stroke-width='2.4' stroke-linejoin='round' stroke-linecap='round'/><path d='M24 9 L24 24 M40 35 L24 24 M8 35 L24 24' stroke='%233F6B5C' stroke-width='1.5' stroke-linecap='round' opacity='0.65'/><circle cx='24' cy='9' r='2.4' fill='%233F6B5C'/><circle cx='40' cy='35' r='2.4' fill='%233F6B5C'/><circle cx='8' cy='35' r='2.4' fill='%233F6B5C'/><circle cx='24' cy='24' r='7' fill='none' stroke='%23C8945A' stroke-width='0.9' opacity='0.45'/><circle cx='24' cy='24' r='3.3' fill='%23C8945A'/></svg>");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}
.brand-mark::before, .brand-mark::after { display: none; content: none; }
.brand-tag {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
  font-weight: 500;
}
.shell-sidebar .brand { margin-bottom: var(--space-xl); }

.workspace-switcher {
  display: none;
  gap: 0.4rem;
  margin: calc(var(--space-xl) * -0.35) 0 var(--space-lg);
  padding: 0.35rem;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.5);
}
body[data-framework-access="true"] .workspace-switcher {
  display: grid;
}
.workspace-option {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 2.35rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  color: var(--text-secondary);
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
}
.workspace-option.studio {
  display: none;
}
body[data-framework-access="true"] .workspace-option.studio {
  display: flex;
}
.workspace-option:hover {
  background: #fff;
  border-color: var(--border);
  color: var(--text-primary);
}
.workspace-option.active {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.workspace-option.studio.active {
  background: #334155;
  border-color: #334155;
}
.workspace-option.studio:hover {
  color: #334155;
}
.workspace-option .icon {
  width: 17px;
  height: 17px;
}

body[data-workspace="studio"] .nav-link.active {
  color: #334155;
}
body[data-workspace="studio"] .nav-link.active .icon {
  color: #334155;
}
body[data-workspace="studio"] .topbar-title {
  color: #334155;
}

.nav-section { margin-top: var(--space-xl); }
.shell-sidebar nav,
.nav-section {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.nav-section-label {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
  padding-left: 0.6rem;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.7rem;
  border-radius: var(--r-md);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: background-color .15s, color .15s;
  cursor: pointer;
  border: 1px solid transparent;
}
.nav-link:hover { background: #fff; color: var(--text-primary); border-color: var(--border); }
.nav-link.active {
  background: #fff;
  color: var(--brand-primary);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  border-color: var(--border);
}
.nav-link.active .icon { color: var(--brand-primary); }
.nav-link .icon { width: 18px; height: 18px; }

.sidebar-footer {
  margin-top: auto;
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 0.75rem;
  font-size: 0.875rem;
}
.avatar-sm {
  width: 38px; height: 38px;
  background: var(--brand-primary);
  border-radius: 50%;
  display: grid; place-items: center;
  color: #fff;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 0.85rem;
}

.shell-main { display: flex; flex-direction: column; min-width: 0; background: var(--bg-body); }

/* ---- Top bar ---- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md) var(--space-xl);
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
  gap: var(--space-md);
}
.topbar-title { font-family: var(--font-head); font-weight: 500; font-size: 1.3rem; }
.topbar-meta { display: flex; gap: var(--space-sm); align-items: center; }
@media (max-width: 640px) {
  .topbar { padding: var(--space-sm) var(--space-md); }
  .topbar-meta .btn-text { display: none; }
}

/* ---- Page / hero ---- */
.page { padding: var(--space-xl) var(--space-xl); flex: 1; min-width: 0; }
@media (max-width: 640px) { .page { padding: var(--space-lg) var(--space-md); } }

.page-hero { margin-bottom: var(--space-xl); }
.page-hero .overline { display: block; margin-bottom: var(--space-sm); color: var(--brand-primary); }
.page-hero h1 { margin-bottom: var(--space-sm); }
.page-hero .lede { color: var(--text-secondary); max-width: 60ch; font-size: 1.0625rem; line-height: 1.6; }

/* ========================================================================
   LOGIN PAGE — Light & airy, warm sage left panel
   ======================================================================== */
.login-grid {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg-body);
}
@media (max-width: 960px) { .login-grid { grid-template-columns: 1fr; } }

.login-art {
  background: linear-gradient(160deg, #EEF3EF 0%, #F5F1E9 60%, #FAEFDF 100%);
  color: var(--text-primary);
  position: relative;
  overflow: hidden;
  padding: var(--space-xl);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
@media (max-width: 960px) { .login-art { min-height: 280px; } }

.login-art::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(63,107,92,0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(63,107,92,0.05) 1px, transparent 1px);
  background-size: 56px 56px;
  pointer-events: none;
  mask-image: radial-gradient(ellipse at 30% 40%, #000 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse at 30% 40%, #000 30%, transparent 80%);
}

.login-art-content { position: relative; z-index: 2; max-width: 480px; }
.login-art-content .overline { color: var(--brand-primary); margin-bottom: var(--space-lg); }
.login-art h1 {
  color: var(--text-primary);
  font-size: clamp(2.25rem, 4.5vw, 3.25rem);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.015em;
}
.login-art h1 em {
  font-style: italic;
  color: var(--brand-primary);
  font-weight: 500;
}
.login-art p { margin-top: var(--space-lg); color: var(--text-secondary); max-width: 42ch; font-size: 1.05rem; line-height: 1.65; }

.login-art-stats {
  position: relative; z-index: 2;
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  border-top: 1px solid var(--border);
  padding-top: var(--space-lg);
}
.login-art-stat .num {
  font-family: var(--font-head);
  font-weight: 500;
  font-size: 2.1rem;
  color: var(--brand-primary);
  line-height: 1;
}
.login-art-stat .label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  margin-top: var(--space-xs);
}

.login-art-geo {
  position: absolute;
  right: -80px; top: 25%;
  width: 540px; height: 540px;
  border: 1px solid rgba(63,107,92,0.12);
  border-radius: 50%;
  pointer-events: none;
}
.login-art-geo::before, .login-art-geo::after {
  content:"";
  position: absolute; inset: 60px;
  border: 1px solid rgba(63,107,92,0.09);
  border-radius: 50%;
}
.login-art-geo::after { inset: 140px; border-color: rgba(200,148,90,0.25); }

.login-form-wrap {
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
}
.login-form { width: 100%; max-width: 420px; }
.login-form .brand { color: var(--text-primary); margin-bottom: var(--space-xl); }
.login-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-lg);
}
.login-tab {
  padding: 0.85rem 0;
  margin-right: var(--space-lg);
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .18s, border-color .18s;
}
.login-tab.active { color: var(--text-primary); border-bottom-color: var(--brand-primary); }

.divider {
  display: flex; align-items: center; gap: var(--space-md);
  margin: var(--space-lg) 0;
  color: var(--text-muted); font-size: 0.75rem;
  font-family: var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase;
}
.divider::before, .divider::after { content:""; flex: 1; height: 1px; background: var(--border); }

.terms {
  margin-top: var(--space-lg);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.6;
}
.terms a { text-decoration: underline; color: var(--text-secondary); }

/* ========================================================================
   CHAT PAGE
   ======================================================================== */
.chat-shell-main { display: flex; flex-direction: column; height: 100vh; }
.chat-area {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-xl);
  background: var(--bg-body);
}
.chat-feed {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.msg { display: flex; gap: var(--space-md); animation: msgIn .25s ease; }
@keyframes msgIn { from { opacity: 0; transform: translateY(8px);} to { opacity: 1; transform: translateY(0);} }

.msg-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  flex-shrink: 0;
  display: grid; place-items: center;
  font-family: var(--font-head); font-weight: 600; font-size: 0.85rem;
}
.msg-ai .msg-avatar { background: var(--bg-tint); color: var(--brand-primary); position: relative; border: 1px solid var(--border-tint); }
.msg-ai .msg-avatar::after {
  content:"";
  position: absolute;
  width: 7px; height: 7px;
  background: var(--brand-accent);
  bottom: 0; right: 0;
  border-radius: 50%;
  border: 1.5px solid var(--bg-body);
}
.msg-user .msg-avatar { background: var(--brand-primary); color: #fff; }

.msg-content { flex: 1; min-width: 0; }
.msg-meta {
  display: flex; align-items: center; gap: var(--space-sm);
  margin-bottom: 0.4rem;
}
.msg-author { font-weight: 600; font-size: 0.875rem; }
.msg-time { font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-muted); }

.msg-bubble {
  padding: var(--space-md);
  border-radius: var(--r-md);
  font-size: 0.9375rem;
  line-height: 1.6;
}
.msg-ai .msg-bubble {
  background: #fff;
  border: 1px solid var(--border);
}
.msg-user .msg-bubble {
  background: var(--brand-accent-soft);
  border: 1px solid var(--pending);
  color: var(--text-primary);
}
.msg-bubble p + p { margin-top: var(--space-sm); }
.msg-bubble ul { margin: var(--space-sm) 0 var(--space-sm) 1.2rem; list-style: disc; }
.msg-bubble li { margin-bottom: 0.25rem; }
.msg-bubble strong { font-weight: 600; }
.msg-bubble em { color: var(--brand-primary); font-style: italic; }

.msg-actions { display: flex; gap: var(--space-sm); margin-top: var(--space-sm); flex-wrap: wrap; }

.suggest-card {
  border: 1px solid var(--border);
  background: #fff;
  border-left: 3px solid var(--brand-primary);
  padding: var(--space-md);
  border-radius: var(--r-md);
  cursor: pointer;
  text-align: left;
  width: 100%;
  display: block;
  transition: border-color .18s, transform .18s, box-shadow .18s;
}
.suggest-card:hover { border-color: var(--brand-primary); border-left-color: var(--brand-accent); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.suggest-card .overline { color: var(--brand-primary); display: block; margin-bottom: var(--space-xs); }
.suggest-card .title { font-weight: 500; font-size: 0.95rem; color: var(--text-primary); line-height: 1.5; }

.typing { display: inline-flex; align-items: center; gap: 4px; }
.typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-muted);
  animation: typing 1.2s infinite ease-in-out;
}
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.composer {
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
  padding: var(--space-md) var(--space-xl);
}
.composer-inner { max-width: 760px; margin: 0 auto; }
.composer-box {
  display: flex;
  align-items: flex-end;
  gap: var(--space-sm);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 0.5rem 0.5rem 0.5rem 0.9rem;
  transition: border-color .18s, box-shadow .18s;
}
.composer-box:focus-within {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(63,107,92,.12);
}
.composer-input {
  flex: 1;
  border: none;
  resize: none;
  font-size: 0.9375rem;
  line-height: 1.55;
  background: transparent;
  max-height: 150px;
  padding: 0.45rem 0;
}
.composer-input:focus { outline: none; }
.composer-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--space-sm);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.composer-foot .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--validated); display: inline-block;
  margin-right: 0.4rem;
  animation: pulse 2s infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* Conversation list */
.conv-list { display: flex; flex-direction: column; gap: 0.15rem; margin-top: var(--space-sm); }
.conv-item {
  display: block;
  padding: 0.55rem 0.7rem;
  border-radius: var(--r-md);
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background-color .15s, color .15s;
  border-left: 2px solid transparent;
}
.conv-item:hover { background: #fff; color: var(--text-primary); }
.conv-item.active {
  background: #fff;
  color: var(--text-primary);
  border-left-color: var(--brand-accent);
  box-shadow: var(--shadow-sm);
}
.conv-item .title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.conv-item .meta { font-family: var(--font-mono); font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; }

/* ========================================================================
   CV PAGE
   ======================================================================== */
.cv-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: var(--space-xl);
  align-items: start;
}
@media (max-width: 1024px) { .cv-layout { grid-template-columns: 1fr; } }

.cv-hero {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 0;
  overflow: hidden;
  position: relative;
}
.cv-hero-band {
  height: 110px;
  background: linear-gradient(135deg, #EEF3EF 0%, #F5F1E9 50%, #FAEFDF 100%);
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}
.cv-hero-band::before {
  content:"";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(63,107,92,0.06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(63,107,92,0.06) 1px, transparent 1px);
  background-size: 40px 40px;
}
.cv-hero-band::after {
  content:"";
  position: absolute;
  right: -30px; top: -40px;
  width: 200px; height: 200px;
  border: 1px solid rgba(63,107,92,0.15);
  border-radius: 50%;
}
.cv-hero-content {
  padding: 0 var(--space-xl) var(--space-xl);
  display: flex;
  gap: var(--space-lg);
  align-items: flex-start;
  position: relative;
  flex-wrap: wrap;
}
@media (max-width: 640px) { .cv-hero-content { padding: 0 var(--space-lg) var(--space-lg); } }
.cv-hero-content .cv-avatar { margin-top: -48px; }
.cv-hero-content .cv-identity { padding-top: var(--space-md); }

.cv-avatar {
  width: 104px; height: 104px;
  background: #fff;
  border: 4px solid #fff;
  border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--font-head);
  font-weight: 500;
  font-size: 2.25rem;
  color: var(--brand-primary);
  box-shadow: var(--shadow-md);
  flex-shrink: 0;
}
.cv-identity { flex: 1; min-width: 200px; padding-bottom: 0.5rem; }
.cv-identity h1 { font-size: clamp(1.75rem, 3.2vw, 2.35rem); margin-bottom: 0.25rem; font-weight: 500; }
.cv-identity .title { color: var(--text-secondary); font-size: 1.0625rem; }
.cv-identity .meta {
  display: flex; gap: var(--space-md); flex-wrap: wrap;
  margin-top: var(--space-sm);
  font-size: 0.8125rem;
  color: var(--text-secondary);
}
.cv-identity .meta span { display: inline-flex; gap: 0.4rem; align-items: center; }

.cv-verified-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: var(--space-sm);
  padding: 0.3rem 0.7rem;
  background: var(--validated-bg);
  color: var(--validated-text);
  border: 1px solid var(--validated);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.cv-summary-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--border);
}
@media (max-width: 640px) { .cv-summary-bar { grid-template-columns: repeat(2, 1fr); } }
.cv-stat { padding: var(--space-md) var(--space-lg); border-right: 1px solid var(--border); }
.cv-stat:last-child { border-right: none; }
.cv-stat .num { font-family: var(--font-head); font-weight: 500; font-size: 1.75rem; line-height: 1; color: var(--text-primary); }
.cv-stat .label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.35rem;
}
.cv-stat .num em {
  font-style: normal;
  color: var(--validated);
  font-size: 0.8125rem;
  font-family: var(--font-mono);
  font-weight: 500;
  margin-left: 0.35rem;
  vertical-align: middle;
}

.cv-section { margin-top: var(--space-xl); }
.cv-section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid var(--border);
  padding-bottom: var(--space-sm);
  margin-bottom: var(--space-lg);
}
.cv-section-head h2 { font-size: 1.6rem; font-weight: 500; }
.cv-section-head .count { font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-muted); letter-spacing: 0.06em; text-transform: uppercase; }

.claim {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: var(--space-lg);
  padding: var(--space-lg) 0;
  border-bottom: 1px solid var(--border);
}
.claim:last-child { border-bottom: none; }
@media (max-width: 640px) { .claim { grid-template-columns: 1fr; gap: var(--space-sm); } }
.claim-date {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}
.claim-date .year { display: block; font-weight: 600; color: var(--text-primary); font-size: 0.9rem; font-family: var(--font-head); }
.claim-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
  flex-wrap: wrap;
}
.claim-title { font-family: var(--font-head); font-weight: 600; font-size: 1.15rem; line-height: 1.3; }
.claim-org { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: var(--space-sm); }
.claim-evidence { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: var(--space-sm); }

/* Side panel */
.cv-side { display: flex; flex-direction: column; gap: var(--space-lg); position: sticky; top: var(--space-md); }

.ai-panel {
  border: 1px solid var(--ai);
  background: linear-gradient(180deg, #F8F5FD 0%, #fff 100%);
  border-radius: var(--r-md);
  padding: var(--space-lg);
}
.ai-panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-md); }
.ai-panel-title {
  display: inline-flex; align-items: center; gap: 0.45rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ai-text);
}
.ai-panel-title .icon { width: 16px; height: 16px; }
.ai-rating { display: flex; align-items: center; gap: var(--space-sm); margin: var(--space-md) 0; }
.ai-rating .score {
  font-family: var(--font-head);
  font-weight: 500;
  font-size: 2.5rem;
  color: var(--text-primary);
  line-height: 1;
}
.ai-rating .out { color: var(--text-muted); font-size: 1rem; }
.ai-feedback { font-size: 0.875rem; line-height: 1.6; color: var(--text-secondary); }

/* ========================================================================
   COMPETENCY HUB
   ======================================================================== */
.bento {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--space-lg);
}
.bento > * { grid-column: span 12; }
@media (min-width: 900px) {
  .bento-col-8 { grid-column: span 8; }
  .bento-col-4 { grid-column: span 4; }
  .bento-col-6 { grid-column: span 6; }
}

.meter { display: flex; gap: 4px; }
.meter .seg {
  flex: 1; height: 10px;
  border: 1px solid var(--border);
  background: transparent;
  border-radius: 2px;
}
.meter .seg.on { background: var(--brand-primary); border-color: var(--brand-primary); }
.meter .seg.on.validated { background: var(--validated); border-color: var(--validated); }

.comp-row {
  display: grid;
  grid-template-columns: 1fr 160px 110px;
  gap: var(--space-md);
  align-items: center;
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--border);
}
.comp-row:last-child { border-bottom: none; }
@media (max-width: 640px) {
  .comp-row { grid-template-columns: 1fr; gap: var(--space-xs); }
}
.comp-name { font-weight: 600; font-size: 0.9375rem; }
.comp-name .sub { display: block; font-size: 0.75rem; font-weight: 500; color: var(--text-secondary); text-transform: none; letter-spacing: 0; margin-top: 2px; }
.comp-status { text-align: right; font-size: 0.75rem; }

.gauge-ring {
  --p: 76;
  width: 160px; height: 160px;
  border-radius: 50%;
  background:
    conic-gradient(var(--brand-primary) calc(var(--p) * 1%), var(--bg-surface-alt) 0);
  display: grid; place-items: center;
  margin: 0 auto;
  position: relative;
}
.gauge-ring::before {
  content:"";
  position: absolute;
  inset: 14px;
  background: #fff;
  border-radius: 50%;
}
.gauge-ring-inner {
  position: relative; z-index: 1;
  font-family: var(--font-head);
  font-weight: 500;
  font-size: 2.25rem;
  text-align: center;
  line-height: 1;
  color: var(--text-primary);
}
.gauge-ring-inner small {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 0.4rem;
}

.timeline { position: relative; padding-left: var(--space-lg); }
.timeline::before {
  content:"";
  position: absolute;
  left: 5px; top: 4px; bottom: 4px;
  width: 1px;
  background: var(--border);
}
.tl-event { position: relative; padding-bottom: var(--space-md); }
.tl-event:last-child { padding-bottom: 0; }
.tl-event::before {
  content:"";
  position: absolute;
  left: -19px; top: 6px;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--bg-body);
  border: 2px solid var(--border);
}
.tl-event.verified::before { background: var(--validated); border-color: var(--validated); }
.tl-event.ai::before { background: var(--ai); border-color: var(--ai); }
.tl-date {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
}
.tl-title { font-weight: 600; font-size: 0.9375rem; margin-top: 2px; }
.tl-note { font-size: 0.85rem; color: var(--text-secondary); margin-top: 2px; line-height: 1.5; }

/* Pathway cards */
.pathway-card {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: var(--r-md);
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  transition: transform .2s, box-shadow .2s, border-color .2s;
  position: relative;
  overflow: hidden;
}
.pathway-card::before {
  content:"";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--ai);
}
.pathway-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--ai); }
.pathway-card .title { font-family: var(--font-head); font-weight: 600; font-size: 1.1rem; line-height: 1.3; }
.pathway-card .meta { font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-secondary); letter-spacing: 0.06em; text-transform: uppercase; }
.pathway-card .desc { font-size: 0.875rem; color: var(--text-secondary); line-height: 1.55; }
.pathway-card .foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--space-sm);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border);
  font-size: 0.8125rem;
}

/* Table */
.table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.table th, .table td {
  text-align: left;
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--border);
}
.table th {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-secondary);
  background: var(--bg-surface-alt);
}
.table tr:hover td { background: rgba(63,107,92,0.04); }

.form-card .field { margin-bottom: var(--space-md); }
.form-card .field:last-child { margin-bottom: 0; }

/* ========================================================================
   CV SHARE
   ======================================================================== */
.share-topbar {
  background: var(--bg-sidebar);
  color: var(--text-primary);
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border);
}
.share-wrap {
  max-width: 820px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-lg) var(--space-3xl);
}
.share-stamp {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding-bottom: var(--space-md);
  margin-bottom: var(--space-xl);
}
.share-stamp .label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.share-stamp .hash {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
}

.lock-card {
  max-width: 460px;
  margin: var(--space-3xl) auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--space-xl);
  text-align: center;
}
.lock-card .icon-wrap {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--bg-surface-alt);
  display: grid; place-items: center;
  margin: 0 auto var(--space-md);
}
.lock-card h3 { margin-bottom: var(--space-sm); }
.lock-card p { color: var(--text-secondary); margin-bottom: var(--space-md); font-size: 0.95rem; }

/* Action bar */
.action-bar { display: flex; gap: var(--space-sm); flex-wrap: wrap; margin-top: var(--space-md); }

/* Loader */
.loader-dots { display: inline-flex; gap: 4px; }
.loader-dots span {
  width: 6px; height: 6px; background: var(--text-muted); border-radius: 50%;
  animation: typing 1.2s infinite ease-in-out;
}
.loader-dots span:nth-child(2) { animation-delay: 0.15s; }
.loader-dots span:nth-child(3) { animation-delay: 0.3s; }

/* Mobile bar — light */
.mobile-bar {
  display: none;
  background: var(--bg-sidebar);
  color: var(--text-primary);
  padding: var(--space-sm) var(--space-md);
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
@media (max-width: 960px) { .mobile-bar { display: flex; } }
.mobile-bar .brand { font-size: 0.95rem; }
.mobile-bar .nav-toggle { background: transparent; color: var(--text-primary); padding: 0.4rem; border-radius: var(--r-sm); }
.mobile-bar .nav-toggle:hover { background: var(--bg-surface-alt); }

.mobile-sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(45,58,58,0.35);
  z-index: 99;
}
.mobile-sidebar-overlay.open { display: block; }
@media (max-width: 960px) {
  html,
  body {
    overflow-x: hidden;
  }

  .shell {
    display: block;
    min-height: calc(100vh - 57px);
    width: 100%;
  }

  .shell > .shell-sidebar:not(.mobile-open) {
    display: none !important;
  }

  .shell-main {
    display: flex;
    width: 100%;
    min-width: 0;
    min-height: calc(100vh - 57px);
  }

  .page {
    width: 100%;
    min-width: 0;
  }

  .topbar {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .topbar-meta {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .shell-sidebar.mobile-open {
    display: flex !important;
    position: fixed;
    top: 0; left: 0;
    width: 280px;
    height: 100vh;
    max-width: 88vw;
    overflow-y: auto;
    z-index: 100;
    animation: slideIn .2s ease;
  }
}

@media (max-width: 640px) {
  .card,
  .lt-card,
  .plar-shell-card,
  .ai-panel,
  .cv-hero {
    max-width: 100%;
  }

  .topbar-meta {
    width: 100%;
  }

  .topbar-meta .btn {
    min-width: 2.5rem;
  }

  .chat-shell-main {
    height: calc(100vh - 57px);
  }
}
@keyframes slideIn { from { transform: translateX(-100%);} to { transform: translateX(0);} }
