/* CHIKARA Health Platform — Teal · Vellum · Ivory · Mustard
   Product: CHIKARA · Configured for Tebelopele Wellness Centre (demonstration)
   Contrast: dark text on ivory/vellum; light text on teal-deep/obsidian; mesh without near-white under white labels
*/
:root {
  --teal: #0D7377;
  --teal-deep: #0A4F52;
  --teal-mid: #14919B;
  --teal-mist: #D4F1F2;
  --vellum: #F7F1E5;
  --ivory: #F5F0E4;
  --ivory-light: #FAF7F0;
  --mustard: #C9A227;
  --mustard-light: #E0BC4A;
  --mustard-ink: #8A6E12;
  --obsidian: #0A0A0A;
  --forest-deep: #0A4F52;
  --forest: #0D7377;
  --aqua: #14919B;
  --aqua-deep: #0D7377;
  --aqua-mid: #1AA6B0;
  --aqua-mist: #D4F1F2;
  --gold: #C9A227;
  --gold-light: #E0BC4A;
  --gold-ink: #8A6E12;
  --charcoal: #1A1F1E;
  --stone: #6B736F;
  --danger: #9B2430;
  --warn: #B8860B;
  --ok: #1A6B3C;
  --mesh-paint: linear-gradient(118deg,
    #0A4F52 0%, #0D7377 18%, #14919B 32%,
    #8A6E12 48%, #C9A227 58%,
    #0A0A0A 72%, #0A4F52 100%);
  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-body: "Plus Jakarta Sans", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --shadow: 0 12px 40px rgba(10, 79, 82, 0.1);
  --radius: 8px;
  --flag-stripe: linear-gradient(90deg, #0D7377 0%, #0D7377 40%, #C9A227 40%, #C9A227 48%, #0A0A0A 48%, #0A0A0A 52%, #C9A227 52%, #C9A227 60%, #0D7377 60%);
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--ivory);
  color: var(--charcoal);
  line-height: 1.55;
  min-height: 100vh;
  font-size: 15px;
}
body::after {
  content: "";
  position: fixed; inset: 0; pointer-events: none; z-index: 9990;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='320' height='320'%3E%3Cfilter id='g' x='0' y='0' width='100%25' height='100%25' color-interpolation-filters='sRGB'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' seed='11' stitchTiles='stitch' result='noise'/%3E%3CfeDiffuseLighting in='noise' lighting-color='%23ffffff' surfaceScale='2.4' result='light'%3E%3CfeDistantLight azimuth='42' elevation='52'/%3E%3C/feDiffuseLighting%3E%3CfeComponentTransfer in='light'%3E%3CfeFuncR type='linear' slope='0.86' intercept='0.07'/%3E%3CfeFuncG type='linear' slope='0.86' intercept='0.07'/%3E%3CfeFuncB type='linear' slope='0.86' intercept='0.07'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='320' height='320' filter='url(%23g)'/%3E%3C/svg%3E");
  background-size: 320px 320px;
  background-repeat: repeat;
  mix-blend-mode: overlay;
  opacity: 0.36;
}
a { color: var(--bw-blue-mid); text-decoration: none; }
::selection { background: var(--bw-blue-deep); color: var(--bw-white); }

/* Shell */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.75rem 1.25rem;
  background: var(--forest-deep); color: var(--ivory);
  border-bottom: 1px solid rgba(245,240,228,0.08);
  position: sticky; top: 0; z-index: 40;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 0.6rem; font-weight: 700; letter-spacing: 0.04em; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.55);
  background: linear-gradient(145deg, #2E7AB8, #0B3D66);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); color: var(--bw-white); font-size: 1rem;
}
.topbar-meta { display: flex; flex-wrap: wrap; gap: 0.5rem 0.85rem; align-items: center; font-size: 0.68rem; letter-spacing: 0.06em; text-transform: uppercase; color: rgba(245,240,228,0.55); }
.pill {
  display: inline-flex; align-items: center; gap: 0.3rem;
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase;
  padding: 0.28rem 0.55rem; border-radius: 999px;
  background: rgba(117,170,219,0.2); color: var(--bw-mist);
}
.pill.sim { background: rgba(255,255,255,0.12); color: var(--bw-white); border: 1px solid rgba(255,255,255,0.25); }
.pill.warn { background: rgba(155,36,48,0.2); color: #f0a8ae; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #75AADB; box-shadow: 0 0 8px rgba(117,170,219,0.7); }
.dot.amber { background: #e0b860; box-shadow: 0 0 8px #e0b860; }
.dot.grey { background: #666; box-shadow: none; }

.role-select, .view-nav select {
  background: rgba(245,240,228,0.06); color: var(--ivory);
  border: 1px solid rgba(245,240,228,0.15); border-radius: 4px;
  padding: 0.35rem 0.5rem; font: inherit; font-size: 0.78rem;
}

.main-nav {
  display: flex; flex-wrap: wrap; gap: 0.35rem;
  padding: 0.5rem 1.25rem;
  background: #071828; border-bottom: 1px solid rgba(255,255,255,0.06);
}
.main-nav button {
  background: transparent; border: 1px solid transparent; color: rgba(255,255,255,0.55);
  font: inherit; font-size: 0.72rem; font-weight: 650; letter-spacing: 0.05em; text-transform: uppercase;
  padding: 0.45rem 0.75rem; border-radius: 4px; cursor: pointer;
}
.main-nav button:hover { color: var(--bw-white); }
.main-nav button.active { color: var(--bw-white); border-color: rgba(117,170,219,0.45); background: rgba(117,170,219,0.12); }

.content { flex: 1; padding: 1.25rem; max-width: 1200px; width: 100%; margin: 0 auto; }
.view { display: none; }
.view.active { display: block; animation: fadeIn 0.35s var(--ease); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Typography */
.eyebrow { font-size: 0.65rem; letter-spacing: 0.2em; text-transform: uppercase; font-weight: 650; color: var(--gold-ink); margin-bottom: 0.5rem; }
.view-dark .eyebrow, .command .eyebrow { color: var(--gold); }
h1 { font-family: var(--font-display); font-weight: 500; font-size: clamp(1.75rem, 3.5vw, 2.4rem); line-height: 1.15; color: var(--forest); }
.view-dark h1, .command h1 { color: var(--ivory); }
h2 { font-family: var(--font-display); font-size: 1.35rem; color: var(--forest); margin-bottom: 0.65rem; }
.muted { color: var(--stone); font-size: 0.9rem; }
.mono { font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.02em; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.7rem 1.25rem; font: inherit; font-size: 0.72rem; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase; border-radius: 3px; border: 1px solid transparent;
  cursor: pointer; transition: transform 0.25s var(--ease), filter 0.25s;
}
.btn-mesh {
  background: var(--mesh-paint); background-size: 400% 400%;
  animation: sweep 28s ease-in-out infinite;
  color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.85), 0 2px 10px rgba(0,0,0,0.5);
  border-color: rgba(255,255,255,0.15);
}
@keyframes sweep { 0%,100%{background-position:0% 50%} 50%{background-position:100% 50%} }
.btn-mesh:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn-ghost-dark { background: transparent; color: var(--ivory); border-color: rgba(245,240,228,0.3); }
.btn-ghost-dark:hover { border-color: var(--gold); color: var(--gold-light); }
.btn-ghost-light { background: transparent; color: var(--forest); border-color: rgba(13,59,42,0.25); }
.btn-ghost-light:hover { border-color: var(--gold-ink); color: var(--gold-ink); }
.btn-solid { background: var(--aqua-deep); color: #fff; }
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.65rem; }

/* Cards */
.card {
  background: #fff; border: 1px solid rgba(13,59,42,0.1); border-radius: var(--radius);
  padding: 1.15rem 1.2rem; box-shadow: var(--shadow); margin-bottom: 1rem;
}
.view-dark .card, .command .card {
  background: rgba(245,240,228,0.04); border-color: rgba(245,240,228,0.1); box-shadow: none; color: var(--ivory);
}
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.75rem; }

/* Command centre */
.command {
  min-height: calc(100vh - 110px);
  background: var(--obsidian);
  color: var(--ivory);
  margin: -1.25rem; padding: 2.5rem 1.5rem 3rem;
}
.command-inner { max-width: 1000px; margin: 0 auto; text-align: center; }
.command h1 { font-size: clamp(2rem, 5vw, 3.2rem); margin-bottom: 0.5rem; }
.command .sub { color: rgba(245,240,228,0.7); max-width: 520px; margin: 0 auto 2rem; }
.domain-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin: 2rem 0; text-align: left; }
.domain-card {
  padding: 1.35rem; border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.14);
  background: linear-gradient(165deg, rgba(46,122,184,0.4), rgba(10,47,77,0.75));
  cursor: pointer; transition: border-color 0.25s, transform 0.25s;
}
.domain-card:hover { border-color: rgba(117,170,219,0.7); transform: translateY(-2px); }
.domain-card h3 { font-family: var(--font-display); font-size: 1.25rem; color: var(--bw-white); margin-bottom: 0.35rem; }
.domain-card p { font-size: 0.85rem; color: rgba(255,255,255,0.7); }

/* Journey strip */
.journey-strip {
  display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; justify-content: center;
  margin: 1.25rem 0; padding: 0.75rem; background: rgba(13,59,42,0.04); border-radius: var(--radius);
}
.journey-node {
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 0.4rem 0.65rem; border-radius: 999px; border: 1px solid rgba(13,59,42,0.15);
  color: var(--stone); background: #fff;
}
.journey-node.on { background: var(--aqua-deep); color: #fff; border-color: var(--aqua-deep); }
.journey-node.done { background: var(--aqua-mist); color: var(--aqua-deep); border-color: transparent; }
.journey-arrow { color: var(--stone); font-size: 0.75rem; }

/* Guided bar */
.guided-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  background: var(--forest-deep); color: var(--ivory);
  padding: 0.85rem 1.25rem; border-top: 1px solid rgba(201,151,58,0.3);
  display: none;
}
.guided-bar.open { display: block; }
.guided-inner { max-width: 1000px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; justify-content: space-between; }
.guided-inner p { font-size: 0.85rem; color: rgba(245,240,228,0.85); flex: 1; min-width: 200px; }
.guided-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }

/* Tables */
table.data { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
table.data th, table.data td { text-align: left; padding: 0.55rem 0.6rem; border-bottom: 1px solid rgba(13,59,42,0.1); }
table.data th { font-size: 0.65rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold-ink); }
.status-ok { color: var(--ok); font-weight: 650; }
.status-pending { color: var(--warn); font-weight: 650; }
.status-esc { color: var(--danger); font-weight: 650; }

/* Chat / WA */
.chat-layout { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 900px) {
  .chat-layout.split { grid-template-columns: 1fr 320px; }
}
.bubbles { display: flex; flex-direction: column; gap: 0.55rem; max-height: 360px; overflow-y: auto; padding: 0.25rem 0; }
.bubble { max-width: 92%; padding: 0.7rem 0.9rem; border-radius: 10px; font-size: 0.88rem; }
.bubble.user { align-self: flex-end; background: var(--aqua-deep); color: #fff; }
.bubble.bot { align-self: flex-start; background: var(--ivory-light); border: 1px solid rgba(13,59,42,0.1); color: var(--charcoal); }
.bubble.gate { align-self: flex-start; background: rgba(155,36,48,0.07); border: 1px solid rgba(155,36,48,0.25); color: var(--danger); }
.wa-frame {
  max-width: 360px; margin: 0 auto; border-radius: 16px; overflow: hidden;
  border: 1px solid rgba(13,59,42,0.15); background: #e5ddd5; box-shadow: var(--shadow);
}
.wa-head { background: #075e54; color: #fff; padding: 0.75rem 1rem; font-weight: 650; font-size: 0.9rem; }
.wa-body { padding: 0.75rem; min-height: 320px; display: flex; flex-direction: column; gap: 0.45rem; }
.wa-body .bubble.bot { background: #fff; }
.wa-quick { display: flex; flex-wrap: wrap; gap: 0.35rem; padding: 0.5rem 0.75rem 0.85rem; background: #f0f0f0; }
.wa-quick button { font-size: 0.72rem; padding: 0.4rem 0.65rem; border-radius: 999px; border: 1px solid #ccc; background: #fff; cursor: pointer; }

/* Safety panel */
.safety-panel {
  border-left: 3px solid var(--danger); background: rgba(155,36,48,0.04);
  padding: 0.85rem 1rem; border-radius: 0 var(--radius) var(--radius) 0; margin-top: 0.75rem;
}
.safety-panel h4 { color: var(--danger); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 0.4rem; }
.trace { display: flex; flex-direction: column; gap: 0; }
.trace-step {
  display: grid; grid-template-columns: 24px 1fr; gap: 0.65rem;
  padding: 0.65rem 0; border-left: 2px solid rgba(13,59,42,0.12); margin-left: 10px; padding-left: 1rem; position: relative;
}
.trace-step::before {
  content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--aqua);
  position: absolute; left: -6px; top: 0.85rem;
}
.trace-step.hot::before { background: var(--danger); box-shadow: 0 0 0 3px rgba(155,36,48,0.2); }
.trace-step strong { display: block; font-size: 0.85rem; color: var(--forest); }
.trace-step span { font-size: 0.8rem; color: var(--stone); }

/* Stack / architecture */
.stack-layer {
  padding: 0.75rem 1rem; margin-bottom: 0.4rem; border-radius: 4px;
  border: 1px solid rgba(13,59,42,0.12); background: #fff;
  display: grid; grid-template-columns: 100px 1fr; gap: 0.75rem; align-items: center;
}
.stack-layer .layer-id { font-family: var(--font-mono); font-size: 0.68rem; color: var(--gold-ink); font-weight: 700; }
.arch-box {
  border: 1px solid rgba(245,240,228,0.15); border-radius: 6px; padding: 0.85rem;
  background: rgba(0,0,0,0.25); text-align: center; font-size: 0.8rem;
}
.arch-box strong { display: block; color: var(--gold-light); margin-bottom: 0.25rem; font-size: 0.85rem; }

/* Metrics */
.metric {
  background: #fff; border: 1px solid rgba(13,59,42,0.1); border-radius: var(--radius); padding: 1rem;
  text-align: center;
}
.metric .n { font-family: var(--font-display); font-size: 2rem; color: var(--aqua-deep); line-height: 1; }
.metric .l { font-size: 0.65rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--stone); margin-top: 0.35rem; font-weight: 650; }
.bar-row { display: grid; grid-template-columns: 110px 1fr 36px; gap: 0.5rem; align-items: center; margin: 0.35rem 0; font-size: 0.8rem; }
.bar-track { height: 8px; background: rgba(13,59,42,0.08); border-radius: 99px; overflow: hidden; }
.bar-track i { display: block; height: 100%; background: var(--aqua-deep); border-radius: 99px; }

/* Timeline */
.timeline { border-left: 2px solid rgba(13,59,42,0.12); margin-left: 0.5rem; padding-left: 1.25rem; }
.tl-item { position: relative; padding-bottom: 1.1rem; }
.tl-item::before {
  content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--aqua);
  position: absolute; left: -1.55rem; top: 0.25rem;
}
.tl-item .t { font-family: var(--font-mono); font-size: 0.7rem; color: var(--gold-ink); }
.tl-item .a { font-weight: 650; font-size: 0.9rem; color: var(--forest); }
.tl-item .d { font-size: 0.8rem; color: var(--stone); }

/* Funnel */
.funnel-step {
  text-align: center; padding: 0.65rem; margin: 0 auto 0.35rem;
  background: var(--aqua-deep); color: #fff; border-radius: 4px; font-size: 0.8rem;
}
.funnel-step small { display: block; opacity: 0.85; font-size: 0.65rem; letter-spacing: 0.06em; text-transform: uppercase; }

/* Trust */
.trust-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.75rem; }
.trust-card { padding: 1rem; border-radius: var(--radius); border: 1px solid rgba(13,59,42,0.1); background: #fff; }
.trust-card h4 { font-family: var(--font-display); color: var(--forest); margin-bottom: 0.35rem; }

/* Event micro */
.event-meta { font-family: var(--font-mono); font-size: 0.68rem; color: var(--stone); display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; margin-top: 0.35rem; }

/* Roadmap */
.phase {
  border-left: 3px solid var(--aqua); padding: 0.75rem 1rem; margin-bottom: 0.65rem; background: #fff;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.phase h4 { color: var(--forest); font-size: 0.9rem; }
.phase .ph { font-family: var(--font-mono); font-size: 0.65rem; color: var(--gold-ink); font-weight: 700; }

.banner-sim {
  font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 700;
  color: var(--gold-ink); background: rgba(201,151,58,0.12); padding: 0.45rem 0.75rem;
  border-radius: 4px; margin-bottom: 1rem; display: inline-block;
}

footer.site {
  padding: 1rem 1.25rem; font-size: 0.72rem; color: var(--stone);
  border-top: 1px solid rgba(13,59,42,0.08); text-align: center;
}
@media (max-width: 640px) {
  .stack-layer { grid-template-columns: 1fr; }
  .content { padding: 1rem 0.85rem 5rem; }
}
