/* =====================================================================
   Mood Diary
   Principle: the interface is ink on paper. The only colour on screen is
   how you feel: the aura around your companion, the dots on your
   messages, the bars in Insights.
   Type: the companion speaks in Newsreader (a book serif); you write in Figtree.
   ===================================================================== */

:root, [data-theme="light"] {
  --paper: #F4F5F2;  --surface: #FFFFFF;  --sunken: #ECEEEA;
  --ink: #1C2430;    --ink-2: #3E4753;    --muted: #687280;  --faint: #9AA1AA;
  --line: #E2E4E0;   --line-strong: #CDD1CB;
  --ink-hover: #2C3644; --on-ink: #FFFFFF;
  --you-bubble: #E6E9E4;
  --danger: #C53030; --danger-soft: #FBEAEA;
  --warn-soft: #FFF4DF; --warn-ink: #7A4A00;
  --ring: rgba(28, 36, 48, .22);
  --lift: 0 1px 2px rgba(28, 36, 48, .06), 0 8px 24px rgba(28, 36, 48, .06);
  --pop: 0 16px 48px rgba(28, 36, 48, .18);
  --aura: #9AA1AA;
}
[data-theme="dark"] {
  --paper: #12161C;  --surface: #171B22;  --sunken: #1D222B;
  --ink: #E9EBEE;    --ink-2: #C7CCD3;    --muted: #9AA3AE;  --faint: #69717C;
  --line: #262C36;   --line-strong: #353C48;
  --ink-hover: #FFFFFF; --on-ink: #12161C;
  --you-bubble: #232A35;
  --danger: #F07171; --danger-soft: #2C1A1D;
  --warn-soft: #2A2214; --warn-ink: #F2C46D;
  --ring: rgba(233, 235, 238, .28);
  --lift: none;
  --pop: 0 16px 48px rgba(0, 0, 0, .55);
  --aura: #69717C;
}

/* ================= base ================= */
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink);
  font-family: Figtree, system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 6px; }
h1, h2 { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ================= buttons ================= */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px;
  border-radius: 999px; font-size: 14px; font-weight: 600; border: 1px solid transparent; transition: background .15s, border-color .15s; }
.btn-ink { background: var(--ink); color: var(--on-ink); }
.btn-ink:hover { background: var(--ink-hover); }
.btn-ink:disabled { opacity: .5; cursor: not-allowed; }
.btn-ink.big { width: 100%; height: 48px; font-size: 15px; }
.btn-quiet { background: transparent; border-color: var(--line-strong); color: var(--ink-2); font-weight: 500; }
.btn-quiet:hover { background: var(--sunken); color: var(--ink); }
.btn-danger { background: var(--danger); color: #fff; }
.btn.fit { align-self: flex-start; }
.icon-btn { width: 38px; height: 38px; border-radius: 999px; border: 0; background: transparent; color: var(--ink-2);
  display: inline-flex; align-items: center; justify-content: center; transition: background .15s; }
.icon-btn:hover { background: var(--sunken); color: var(--ink); }
.icon-btn.on { color: var(--muted); }
.link { background: none; border: 0; padding: 0; min-height: 32px; color: var(--ink); font-weight: 600; font-size: 13.5px;
  text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 4px; align-self: flex-start; }
.link:hover { text-decoration-color: var(--ink); }
.seg { display: inline-flex; background: var(--sunken); border-radius: 999px; padding: 3px; }
.seg button { height: 32px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent; font-size: 13.5px; color: var(--muted); font-weight: 500; }
.seg button:hover { color: var(--ink); }
.seg button.active { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(28, 36, 48, .12); }
.seg.wide { display: flex; } .seg.wide button { flex: 1; height: 38px; }

/* ================= layout ================= */
.app { display: flex; min-height: 100vh; }
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100vh; }
.view { flex: 1; min-height: 0; overflow-y: auto; }

/* ================= sidebar ================= */
.sidebar { width: 256px; flex: none; padding: 20px 14px 16px; display: flex; flex-direction: column; gap: 14px;
  height: 100vh; position: sticky; top: 0; border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px 6px; }
/* app icon: a speech bubble filled with blended emotion colours */
.brand-icon { width: 30px; height: 30px; flex: none; border-radius: 8px; display: block; }
.brand-name { font-family: Newsreader, Georgia, serif; font-size: 21px; font-weight: 500; letter-spacing: -.01em; }
.search { display: flex; align-items: center; gap: 8px; height: 38px; border-radius: 999px; padding: 0 12px;
  color: var(--muted); background: var(--sunken); }
.search:focus-within { box-shadow: 0 0 0 2px var(--ring); }
.search input { border: 0; outline: 0; background: transparent; font-size: 14px; flex: 1; min-width: 0; color: var(--ink); }
.search input::placeholder { color: var(--muted); }
kbd { font-family: inherit; font-size: 11px; color: var(--muted); white-space: nowrap; }
.history { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 1px; margin: 0 -6px; padding: 0 6px; }
.history .group { font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 14px 10px 4px; }
.history button { display: grid; grid-template-columns: 8px 1fr auto; grid-template-areas: "d t t" ". s w"; column-gap: 10px; align-items: baseline;
  padding: 8px 10px; border-radius: 10px; border: 0; background: transparent; text-align: left; width: 100%; }
.history button:hover { background: var(--sunken); }
.history button.active { background: var(--surface); box-shadow: var(--lift); }
.history .dot { grid-area: d; width: 8px; height: 8px; border-radius: 50%; align-self: center; }
.history .t { grid-area: t; font-weight: 500; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history .w { grid-area: w; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.history .s { grid-area: s; font-size: 12.5px; color: var(--muted); }
.history .empty { font-size: 13.5px; color: var(--muted); padding: 10px; line-height: 1.5; }
.nav { display: flex; flex-direction: column; gap: 2px; padding-top: 10px; border-top: 1px solid var(--line); }
.nav button { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px; border-radius: 10px; border: 0; background: transparent;
  color: var(--ink-2); font-size: 14px; font-weight: 500; }
.nav button:hover { background: var(--sunken); }
.nav button.active { color: var(--ink); font-weight: 600; background: var(--sunken); }
.credit { font-size: 12px; color: var(--faint); padding: 0 12px; }

/* ================= chat ================= */
#view-chat { display: flex; min-height: 0; overflow: hidden; }
.chat { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--surface); }
.chat-head { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 16px 28px; border-bottom: 1px solid var(--line); }
.titles { display: flex; flex-direction: column; min-width: 0; }
.title { font-family: Newsreader, Georgia, serif; font-weight: 500; font-size: 22px; letter-spacing: -.01em; line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: text; }
.title-input { font-family: Newsreader, Georgia, serif; font-weight: 500; font-size: 20px; height: 36px; padding: 0 10px; width: min(420px, 100%);
  border: 1px solid var(--line-strong); border-radius: 8px; outline: 0; box-shadow: 0 0 0 3px var(--ring); background: var(--surface); }
.sub { font-size: 13px; color: var(--muted); }
.head-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: 44px; z-index: 20; min-width: 190px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 6px; box-shadow: var(--pop); }
.menu button { display: flex; width: 100%; align-items: center; gap: 10px; height: 38px; padding: 0 10px; border: 0; border-radius: 9px;
  background: transparent; font-size: 14px; text-align: left; }
.menu button:hover { background: var(--sunken); }
.menu .danger { color: var(--danger); }
.menu .danger:hover { background: var(--danger-soft); }
.menu-sep { height: 1px; background: var(--line); margin: 5px 4px; }

.messages { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 22px;
  padding: 32px max(28px, calc((100% - 700px) / 2)) 24px; }
.day-pill { align-self: center; font-size: 12.5px; color: var(--muted); }
/* companion: plain text in a book serif, like a letter */
.msg-bot { align-self: flex-start; max-width: 88%; display: grid; grid-template-columns: 28px 1fr; gap: 12px; align-items: start; }
.msg-bot .mini-av { width: 28px; height: 28px; border-radius: 50%; overflow: hidden; margin-top: 2px; }
.msg-bot .text { font-family: Newsreader, Georgia, serif; font-size: 18px; line-height: 1.55; color: var(--ink);
  white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-bot.typing .text { display: inline-flex; gap: 5px; align-items: center; height: 28px; }
.msg-bot.typing .text i { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); animation: blink 1.2s infinite ease-in-out; }
.msg-bot.typing .text i:nth-child(2) { animation-delay: .15s; } .msg-bot.typing .text i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }
/* you: a quiet sans bubble */
.msg-user { align-self: flex-end; max-width: min(540px, 80%); display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.bubble { background: var(--you-bubble); color: var(--ink); padding: 10px 16px; border-radius: 20px 20px 6px 20px; font-size: 15px;
  line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.pending { color: var(--muted); font-style: italic; }
.meta { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); padding-right: 4px; }
.meta .spoken { display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; }
.pill.analysing { color: var(--muted); font-weight: 400; }
.spin { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--line-strong); border-top-color: var(--ink); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.composer-wrap { padding: 8px max(28px, calc((100% - 700px) / 2)) 20px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.composer { width: 100%; display: flex; align-items: flex-end; gap: 6px; border: 1px solid var(--line-strong); border-radius: 26px;
  padding: 6px; background: var(--surface); box-shadow: var(--lift); transition: box-shadow .15s, border-color .15s; }
.composer:focus-within { border-color: var(--ink-2); }
.composer textarea { flex: 1; border: 0; outline: 0; background: transparent; font-size: 15px; line-height: 1.5; min-width: 0; resize: none;
  padding: 9px 4px; max-height: 160px; min-height: 40px; }
.composer textarea::placeholder { color: var(--muted); }
.mode-btn { width: 40px; height: 40px; flex: none; border: 0; border-radius: 999px; background: transparent; color: var(--muted);
  display: flex; align-items: center; justify-content: center; }
.mode-btn:hover { background: var(--sunken); color: var(--ink); }
.send { width: 40px; height: 40px; flex: none; border: 0; border-radius: 999px; background: var(--ink); color: var(--on-ink);
  display: flex; align-items: center; justify-content: center; }
.send:disabled { opacity: .35; cursor: not-allowed; }
.composer.voice { align-items: center; gap: 12px; }
.composer .mic-hint { flex: 1; color: var(--muted); font-size: 14px; }
.mic { width: 48px; height: 48px; flex: none; border: 0; border-radius: 999px; background: var(--ink); color: var(--on-ink);
  display: flex; align-items: center; justify-content: center; }
.mic:disabled { opacity: .35; cursor: not-allowed; }
.mic.recording { background: var(--danger); color: #fff; box-shadow: 0 0 0 6px var(--danger-soft); }
.rec-time { font-size: 14px; font-variant-numeric: tabular-nums; color: var(--danger); font-weight: 600; }
.wave { display: inline-flex; align-items: center; gap: 3px; height: 24px; }
.wave i { width: 3px; border-radius: 2px; background: var(--line-strong); height: 6px; }
.wave i:nth-child(2n) { height: 12px; } .wave i:nth-child(3n) { height: 18px; } .wave i:nth-child(5) { height: 22px; }
.wave.live i { background: var(--danger); animation: wave .9s infinite ease-in-out; }
.wave.live i:nth-child(2n) { animation-delay: .15s; } .wave.live i:nth-child(3n) { animation-delay: .3s; }
@keyframes wave { 50% { transform: scaleY(.35); } }
.hint-line { font-size: 12px; color: var(--faint); }

/* ================= mood rail ================= */
.rail { width: 320px; flex: none; padding: 28px 26px; display: flex; flex-direction: column; gap: 28px; overflow-y: auto;
  border-left: 1px solid var(--line); }
.companion { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; }
/* the one bold element: a soft halo in the colour of how you feel */
.aura { position: relative; width: 168px; height: 168px; display: grid; place-items: center; margin-bottom: 10px; }
.aura::before { content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle, var(--aura) 0%, color-mix(in srgb, var(--aura) 45%, transparent) 38%, transparent 70%);
  opacity: .55; transition: background 1.2s ease; }
.avatar { position: relative; width: 84px; height: 84px; border-radius: 50%; overflow: hidden; box-shadow: 0 0 0 4px var(--paper); }
.avatar.talking { animation: speak 1.4s infinite ease-in-out; }
@keyframes speak { 50% { box-shadow: 0 0 0 4px var(--paper), 0 0 0 10px color-mix(in srgb, var(--aura) 35%, transparent); } }
.agent-name { font-family: Newsreader, Georgia, serif; font-size: 22px; font-weight: 500; }
.agent-status { font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.agent-status .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.agent-status.speaking { color: var(--ink); } .agent-status.speaking .dot { background: var(--ink); }
.rail-sec { display: flex; flex-direction: column; gap: 12px; }
.rail-h { font-size: 13.5px; font-weight: 600; color: var(--muted); }
.emo-empty { margin: 0; color: var(--muted); font-size: 14px; }
.emo-big { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.emo-big #emoTop { font-family: Newsreader, Georgia, serif; font-size: 38px; font-weight: 500; line-height: 1; letter-spacing: -.02em; }
.emo-meta { font-size: 13px; color: var(--muted); }
.stack { display: flex; height: 8px; gap: 2px; margin-bottom: 12px; }
.stack span { height: 100%; transition: width .5s ease; }
.stack span:first-child { border-radius: 4px 0 0 4px; } .stack span:last-child { border-radius: 0 4px 4px 0; }
.stack span:only-child { border-radius: 4px; }
.legend { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; font-size: 13px; color: var(--ink-2); }
.legend .item { display: flex; align-items: center; gap: 7px; }
.legend .item b { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink); }
.legend .sw { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.legend.wrap { display: flex; flex-wrap: wrap; gap: 8px 16px; } .legend.wrap .item b { display: none; }
.emo-parts { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.parts-head { font-size: 13px; color: var(--muted); }
.part { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13.5px; }
.part-label { display: inline-flex; align-items: center; gap: 7px; color: var(--ink-2); }
.part-val { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; color: var(--muted); }
.part-val b { color: var(--ink) !important; font-weight: 600; }
.part-val .dot { width: 8px; height: 8px; border-radius: 50%; }
.model-warn { font-size: 13px; line-height: 1.5; padding: 10px 12px; border-radius: 12px; background: var(--warn-soft); color: var(--warn-ink); }
.model-warn code { font-size: 11.5px; word-break: break-word; }
/* this chat: one dot per message, size = how strong the feeling was */
.mood-line { position: relative; display: flex; align-items: center; justify-content: space-between; height: 34px; padding: 0 4px; }
.mood-line:empty { display: none; }
.mood-line::before { content: ""; position: absolute; left: 8px; right: 8px; top: 50%; height: 1px; background: var(--line-strong); }
.mdot { position: relative; width: calc(var(--s) * 1px); height: calc(var(--s) * 1px); border-radius: 50%; background: var(--c);
  box-shadow: 0 0 0 3px var(--paper); }
.summary { margin: 0; font-size: 14px; line-height: 1.55; color: var(--ink-2); }
.summary b { font-weight: 600; color: var(--ink); }

/* ================= pages ================= */
.page { padding: 40px 44px 56px; display: flex; flex-direction: column; gap: 28px; max-width: 1140px; width: 100%; margin: 0 auto; }
.page-head { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: flex-end; }
h1 { font-family: Newsreader, Georgia, serif; font-size: 40px; font-weight: 500; letter-spacing: -.02em; line-height: 1.1; }
.lede { margin: 8px 0 0; color: var(--muted); font-size: 15.5px; max-width: 72ch; text-wrap: pretty; }

/* setup */
.setup-grid { display: flex; flex-wrap: wrap; gap: 32px; align-items: flex-start; }
.setup-left { flex: 999 1 480px; min-width: 0; display: flex; flex-direction: column; gap: 28px; }
.setup-right { flex: 1 1 300px; max-width: 360px; display: flex; flex-direction: column; gap: 14px; position: sticky; top: 0; }
.gender-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.gender-card { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 28px 16px 24px; border-radius: 20px;
  background: var(--surface); border: 1px solid var(--line); transition: border-color .15s, box-shadow .15s; }
.gender-card:hover { border-color: var(--line-strong); }
.gender-card.selected { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.gender-avatar { width: 96px; height: 96px; border-radius: 50%; overflow: hidden; margin-bottom: 12px; }
.g-title { font-size: 15px; font-weight: 600; }
.g-sub { font-size: 13.5px; color: var(--muted); }
.setup-form { display: flex; flex-direction: column; gap: 10px; }
.label { font-size: 14px; font-weight: 600; }
.setup-form input { height: 46px; border: 1px solid var(--line-strong); border-radius: 12px; padding: 0 14px; font-size: 15px; background: var(--surface); outline: 0; }
.setup-form input:focus { border-color: var(--ink-2); box-shadow: 0 0 0 3px var(--ring); }
.setup-form input + .label { margin-top: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button { height: 38px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-strong); background: transparent; font-size: 14px; color: var(--ink-2); }
.chips button:hover { border-color: var(--ink-2); }
.chips button.selected { background: var(--ink); border-color: var(--ink); color: var(--on-ink); font-weight: 600; }
.hint { font-size: 13.5px; color: var(--muted); margin-bottom: 8px; }
.preview { padding: 22px; display: flex; flex-direction: column; gap: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--lift); }
.preview-who { display: flex; align-items: center; gap: 12px; }
.initial { width: 44px; height: 44px; flex: none; border-radius: 50%; overflow: hidden; background: var(--sunken); color: var(--ink);
  font-family: Newsreader, Georgia, serif; font-size: 19px; display: inline-flex; align-items: center; justify-content: center; }
.p-name { display: block; font-family: Newsreader, Georgia, serif; font-weight: 500; font-size: 19px; line-height: 1.2; }
.p-desc { font-size: 13px; color: var(--muted); }
.preview-bubble { margin: 0; font-family: Newsreader, Georgia, serif; font-size: 18px; line-height: 1.5; color: var(--ink); }
.privacy { margin: 0; display: flex; gap: 10px; font-size: 13px; line-height: 1.5; color: var(--muted); padding: 0 6px; }
.privacy svg { flex: none; margin-top: 2px; }

/* insights */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.kpi { padding: 20px 22px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kpi + .kpi { border-left: 1px solid var(--line); }
.kpi .k-label { font-size: 13.5px; color: var(--muted); }
.kpi .k-val { font-family: Newsreader, Georgia, serif; font-size: 36px; font-weight: 500; letter-spacing: -.02em; line-height: 1.15;
  display: flex; align-items: center; gap: 10px; font-variant-numeric: tabular-nums; }
.kpi .k-val small { font-family: Figtree, sans-serif; font-size: 14px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.kpi .k-sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .k-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.panel { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.panel-title { font-family: Newsreader, Georgia, serif; font-weight: 500; font-size: 23px; letter-spacing: -.01em; }
.panel-sub { font-size: 13.5px; color: var(--muted); display: block; margin: 0; }
.panel-head { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: flex-end; margin-bottom: 14px; }
.panel select { height: 38px; border: 1px solid var(--line-strong); border-radius: 999px; padding: 0 14px; background: var(--surface); max-width: 300px; font-size: 14px; }
.chart-box { position: relative; height: 300px; }
.dash-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 48px; padding-top: 28px; border-top: 1px solid var(--line); }
.mix { display: flex; flex-direction: column; gap: 2px; margin-top: 16px; }
.mix-row { display: flex; flex-direction: column; gap: 8px; border: 0; background: none; padding: 10px 12px; margin: 0 -12px; text-align: left; border-radius: 12px; }
.mix-row:hover { background: var(--sunken); }
.mix-row .top { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.mix-row .top b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mix-row .top span { color: var(--muted); white-space: nowrap; }
.mix-row .bar { display: flex; height: 10px; gap: 2px; }
.mix-row .bar span:first-child { border-radius: 5px 0 0 5px; } .mix-row .bar span:last-child { border-radius: 0 5px 5px 0; }
.mix-legend { margin-top: 16px; }
.moments { display: flex; flex-direction: column; margin-top: 12px; }
.moment { display: grid; grid-template-columns: 34px 1fr; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.moment:last-child { border-bottom: 0; }
.moment .ico { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--sunken); color: var(--ink-2); }
.moment .m-title { font-weight: 600; font-size: 15px; display: block; }
.moment .m-text { font-size: 14px; color: var(--ink-2); line-height: 1.5; display: block; margin: 2px 0 2px; }
.empty-state { display: flex; flex-direction: column; gap: 4px; padding: 20px 0; color: var(--muted); font-size: 14px; }
.empty-state svg { display: none; }

/* ================= dialog + toast ================= */
dialog.confirm { border: 0; border-radius: 22px; padding: 26px; width: min(420px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); box-shadow: var(--pop); }
dialog.confirm::backdrop { background: rgba(18, 22, 28, .4); }
dialog.confirm h2 { font-family: Newsreader, Georgia, serif; font-size: 24px; font-weight: 500; margin-bottom: 8px; }
dialog.confirm p { margin: 0 0 22px; color: var(--muted); line-height: 1.55; }
dialog.confirm .actions { display: flex; justify-content: flex-end; gap: 8px; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 50; background: var(--ink); color: var(--on-ink);
  padding: 11px 18px; border-radius: 999px; font-size: 14px; box-shadow: var(--pop); max-width: calc(100vw - 32px); }

/* ================= responsive ================= */
@media (max-width: 1180px) { .rail { width: 280px; padding: 24px 20px; } .aura { width: 140px; height: 140px; } }
@media (max-width: 900px) {
  .app { flex-direction: column; }
  .main-col { height: auto; }
  .view { overflow: visible; }
  .sidebar { width: auto; height: auto; position: static; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar > * { flex-shrink: 0; }
  .history { max-height: 150px; }
  kbd { display: none; }
  #view-chat { flex-direction: column; height: auto; }
  .chat { height: 82vh; }
  .chat-head { padding: 12px 16px; }
  .messages { padding: 22px 16px; }
  .composer-wrap { padding: 8px 12px 14px; }
  .rail { width: auto; border-left: 0; border-top: 1px solid var(--line); }
  .setup-right { max-width: none; position: static; }
  .page { padding: 26px 18px 36px; }
  h1 { font-size: 31px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi:nth-child(3) { border-left: 0; }
  .kpi:nth-child(n+3) { border-top: 1px solid var(--line); }
  .dash-row { grid-template-columns: 1fr; gap: 32px; }
}
@media (max-width: 480px) { .gender-grid { gap: 10px; } .gender-avatar { width: 72px; height: 72px; } .msg-bot .text { font-size: 17px; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
