/* ============================================================
   Dr.Niko — Massage Connecté · design system
   Anchored to the partner's session-report design:
   deep navy + medical blue, champagne-gold accent, teal for
   recovery / amber for heart rate. Brand fonts from the Dr.Niko
   landing page: Plus Jakarta Sans headings, Montserrat body,
   JetBrains Mono for figures. Logo: company mascot mark.
   ============================================================ */

:root {
  --navy:    #0A1F3C;
  --blue:    #2D7DD2;
  --sky:     #4A9FE8;
  --skyl:    #9EC9F0;
  --mist:    #EBF3FB;
  --pale:    #F7FAFD;
  --champ:   #C2A063;
  --champl:  #E7D6B0;
  --teal:    #0FA68A;
  --teall:   #CDEDE6;
  --amber:   #E8804D;
  --amberl:  #F7D9C8;
  --grey:    #7FB3D3;
  --line:    rgba(10, 31, 60, 0.10);

  --ink:     #0A1F3C;   /* headings / strong text */
  --body:    #33476A;   /* body copy */
  --muted:   #7FB3D3;
  --card:    #FFFFFF;

  /* metric / chart roles, kept consistent with the report */
  --hr:      #E8804D;   /* heart rate — amber */
  --spo2:    #2D7DD2;   /* SpO₂ — blue */
  --relax:   #0FA68A;   /* relaxation / recovery — teal */

  --radius:    18px;
  --radius-sm: 12px;
  --pill:      9999px;
  --shadow:    0 30px 80px -40px rgba(10, 31, 60, 0.40);
  --shadow-sm: 0 14px 30px -18px rgba(10, 31, 60, 0.45);

  --font-head: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font:      "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--body);
  /* Brand signature gradient, ported from the Dr.Niko landing hero. */
  background: linear-gradient(180deg, #0463EE 0%, #3B94FD 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

a { color: var(--blue); text-decoration: none; }
.mono { font-family: var(--font-mono); }

/* ---- Layout shell ---- */
.shell {
  max-width: 1040px;
  margin: 0 auto;
  padding: 22px 22px 80px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 4px 22px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
  font-size: 22px;
}
/* Dr.Niko company mascot mark on a white badge (shows on any background). */
.brand .logo {
  width: 42px; height: 42px; flex: none;
  border-radius: 50%;
  background: #fff url("../img/logo.svg") center 56% / 56% no-repeat;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
  font-size: 0; color: transparent;
}
.brand small {
  display: block; font-weight: 600; font-size: 11px;
  color: #CFE2FF; letter-spacing: 0.04em; text-transform: none;
}

/* ---- Language toggle ---- */
.langtoggle { display: inline-flex; gap: 2px; background: #fff; border: 1px solid var(--line);
  border-radius: var(--pill); padding: 3px; margin-left: 12px; box-shadow: var(--shadow-sm); }
.langtoggle a { padding: 5px 12px; border-radius: var(--pill); font-size: 12px; font-weight: 700;
  color: var(--grey); }
.langtoggle a.on { background: var(--navy); color: #fff; }

/* ---- Stepper ---- */
.steps { display: flex; gap: 8px; align-items: center; }
.step {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600; color: rgba(255, 255, 255, 0.72);
}
.step .dot {
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.22); color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.4); font-size: 12px; font-family: var(--font-mono);
}
.step.active { color: #fff; }
.step.active .dot {
  background: #fff; color: var(--blue); border-color: #fff;
}
.step.done .dot { background: rgba(255, 255, 255, 0.92); color: var(--blue); border-color: rgba(255, 255, 255, 0.92); }
.step .bar { width: 22px; height: 2px; background: rgba(255, 255, 255, 0.4); }

/* ---- Cards ---- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px;
}
.card + .card { margin-top: 20px; }
.grid { display: grid; gap: 20px; }
/* Inside a grid, spacing is handled by `gap` — cancel the stacked-card margin
   so side-by-side cards line up at the same top edge. */
.grid > .card { margin-top: 0; }
.grid.cols-2 { grid-template-columns: 1fr 1fr; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 820px) {
  .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; }
}

h1, h2, h3 { font-family: var(--font-head); font-weight: 700; }
h1 { font-size: 30px; color: var(--navy); margin: 0 0 6px; letter-spacing: -0.02em; }
h2 { font-size: 21px; color: var(--navy); margin: 0 0 14px; letter-spacing: -0.01em; }
h3 { font-size: 15px; color: var(--navy); margin: 0 0 10px; }
.lead { color: var(--body); font-size: 16px; margin: 0 0 22px; opacity: .85; }
.eyebrow { color: var(--blue); font-weight: 700; font-size: 12px;
  letter-spacing: 0.08em; text-transform: uppercase; font-family: var(--font); }

/* ---- Forms ---- */
label.field { display: block; margin-bottom: 16px; }
label.field > span { display: block; font-size: 13px; font-weight: 600;
  color: var(--navy); margin-bottom: 6px; }
input[type=text], input[type=number], select, textarea {
  width: 100%; padding: 12px 14px;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 15px; color: var(--body);
  background: #fff; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(45, 125, 210, 0.15);
}
textarea { resize: vertical; min-height: 84px; }

/* chip multi-select */
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { position: relative; cursor: pointer; user-select: none; }
.chip input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.chip span {
  display: inline-block; padding: 9px 16px; border-radius: var(--pill);
  border: 1.5px solid var(--line); background: #fff;
  font-size: 14px; font-weight: 600; color: var(--body);
  transition: all .15s;
}
.chip input:checked + span {
  background: var(--mist); border-color: var(--blue); color: var(--navy);
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 20px; border-radius: var(--radius-sm); border: none;
  font-family: var(--font); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: transform .15s, box-shadow .15s, background .15s;
  text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--navy); color: #fff; box-shadow: 0 14px 30px -16px rgba(10, 31, 60, .5); }
.btn-primary:hover { transform: translateY(-2px); }
.btn-coral { background: var(--blue); color: #fff; box-shadow: 0 14px 30px -16px rgba(45, 125, 210, .5); }
.btn-coral:hover { transform: translateY(-2px); }
.btn-ghost { background: #fff; color: var(--navy); border: 1.5px solid var(--line); }
.btn-ghost:hover { border-color: var(--blue); color: var(--blue); }
.btn-lg { padding: 15px 28px; font-size: 16px; }
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

/* ---- Speech bubble (insight motif) ---- */
.bubble {
  background: var(--navy); color: #fff;
  padding: 16px 18px; border-radius: 14px 14px 14px 4px;
  font-size: 14.5px; box-shadow: var(--shadow-sm); max-width: 560px;
  border-left: 3px solid var(--champ);
}
.bubble b { font-weight: 700; color: var(--champl); }

/* ---- Live metrics ---- */
.metric {
  border-radius: var(--radius); padding: 20px; background: #fff;
  box-shadow: var(--shadow-sm); border: 1px solid var(--line);
}
.metric .head { display: flex; justify-content: space-between; align-items: baseline; }
.metric .name { font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--grey); }
.metric .val { font-size: 38px; font-weight: 700; line-height: 1; letter-spacing: -0.02em;
  font-family: var(--font-mono); }
.metric .unit { font-size: 14px; font-weight: 600; color: var(--grey); }
.metric.hr   .val { color: var(--hr); }
.metric.spo2 .val { color: var(--spo2); }
.metric.relax .val { color: var(--relax); }
.metric canvas { width: 100%; height: 64px; display: block; margin-top: 10px; }
.metric .dotpulse { width: 10px; height: 10px; border-radius: 50%;
  background: var(--hr); display: inline-block; margin-left: 8px;
  animation: pulse 1s infinite; }
@keyframes pulse { 0%,100%{opacity:.3} 50%{opacity:1} }

/* progress + clock */
.sessbar { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.progress { flex: 1; height: 10px; background: var(--mist);
  border-radius: var(--pill); overflow: hidden; }
.progress > div { height: 100%; width: 0; background: var(--blue);
  border-radius: var(--pill); transition: width .25s linear; }
.clock { font-family: var(--font-mono); font-weight: 700; color: var(--navy); }

/* insight feed */
.insight {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px; border-radius: 12px; background: var(--mist);
  border: 1px solid var(--line); border-left: 3px solid var(--blue);
  color: var(--navy); font-size: 14.5px; font-weight: 600;
  animation: fadein .4s ease;
}
.insight .ic { flex: 0 0 auto; font-size: 18px; }
.feed { display: flex; flex-direction: column; gap: 10px; }
.feed .insight.old { background: var(--pale); color: var(--grey); font-weight: 500;
  border-left-color: var(--skyl); }
@keyframes fadein { from { opacity: 0; transform: translateY(6px);} to {opacity:1; transform: none;} }

/* mode toggle */
.toggle { display: inline-flex; background: var(--mist); border-radius: var(--pill); padding: 4px; }
.toggle button { border: none; background: none; padding: 8px 18px; border-radius: var(--pill);
  font-weight: 700; font-size: 13px; color: var(--grey); cursor: pointer; }
.toggle button.on { background: #fff; color: var(--navy); box-shadow: var(--shadow-sm); }

/* stat pills */
.statgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 720px){ .statgrid{ grid-template-columns: repeat(2,1fr);} }
.stat { background: var(--pale); border: 1px solid var(--line); border-radius: 12px; padding: 14px; text-align: center; }
.stat .k { font-size: 11px; color: var(--grey); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.stat .v { font-size: 24px; font-weight: 700; color: var(--navy); font-family: var(--font-mono); }
.stat .v small { font-size: 12px; color: var(--grey); font-weight: 600; }
.trend-up { color: var(--amber); }
.trend-down { color: var(--teal); }

/* chat */
.chatwrap { display: grid; grid-template-columns: 1fr; gap: 14px; }
.chatlog { display: flex; flex-direction: column; gap: 14px; min-height: 260px;
  max-height: 52vh; overflow-y: auto; padding: 4px; }
.msg { max-width: 78%; padding: 14px 16px; border-radius: 16px; font-size: 14.5px; }
.msg.user { align-self: flex-end; background: var(--navy); color: #fff;
  border-bottom-right-radius: 4px; }
.msg.assistant { align-self: flex-start; background: var(--pale); color: var(--body);
  border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.assistant.typing { color: var(--grey); font-style: italic; }
.chatform { display: flex; gap: 10px; }
.chatform input { flex: 1; }
.suggest { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
.suggest button { background: #fff; border: 1.5px solid var(--line); color: var(--body);
  border-radius: var(--pill); padding: 8px 14px; font-size: 13px; font-weight: 600; cursor: pointer; }
.suggest button:hover { border-color: var(--blue); color: var(--blue); }

.muted { color: var(--grey); }
.right { text-align: right; }
.mt { margin-top: 18px; }
hr.sep { border: none; border-top: 1px solid var(--line); margin: 20px 0; }
