/* CCOS — brand tokens lifted from the Conflict Coach website stylesheet. */

:root {
  --ink:        #2d2926;
  --ink-deep:   #1a1817;
  --red:        #fe4338;
  --red-deep:   #c9241b;
  --paper:      #ffffff;
  --paper-warm: #f6f3f0;
  --paper-line: #e4ded9;
  --mute:       #6b625c;

  /* Category accents, reused for domain colour-coding. */
  --coaching:   #f37021;
  --culture:    #4e83d8;
  --seminars:   #f4c44e;
  --direction:  #7f2fdd;

  --ok:      #2f7d51;
  --ok-bg:   #e8f3ec;
  --warn:    #a86a12;
  --warn-bg: #fdf3e2;
  --bad:     #c9241b;
  --bad-bg:  #fdeceb;

  --font: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;

  --radius:    14px;
  --radius-sm: 9px;
  --shadow:    0 1px 2px rgba(26,24,23,.05), 0 8px 24px -16px rgba(26,24,23,.28);
  --sidebar:   248px;
  --ease:      cubic-bezier(.22,.61,.36,1);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper-warm);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--red-deep); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5rem; font-weight: 700; letter-spacing: -.015em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
p  { margin: 0 0 .9rem; }

hr { border: 0; border-top: 1px solid var(--paper-line); margin: 1.5rem 0; }

code, pre { font-family: var(--mono); font-size: .86em; }
code { background: var(--paper-warm); padding: .1em .35em; border-radius: 4px; color: var(--red-deep); }
pre {
  background: var(--ink-deep); color: #f2ede8; padding: 1rem 1.1rem;
  border-radius: var(--radius-sm); overflow-x: auto; line-height: 1.55;
}
pre code { background: none; color: inherit; padding: 0; }

/* ------------------------------------------------------------------ layout */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar); flex: 0 0 var(--sidebar);
  background: var(--ink-deep); color: #fff;
  padding: 1.4rem 1rem; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 1.5rem; overflow-y: auto;
}

.brand { display: flex; align-items: center; gap: .6rem; padding: 0 .4rem; }
.brand__mark {
  width: 30px; height: 30px; border-radius: 8px; flex: 0 0 auto;
  display: block; object-fit: contain;
}
.brand__name { font-weight: 800; font-size: .95rem; letter-spacing: -.02em; line-height: 1.15; }
.brand__sub { font-size: .68rem; color: rgba(255,255,255,.55); letter-spacing: .06em; text-transform: uppercase; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: .6rem;
  padding: .5rem .7rem; border-radius: var(--radius-sm);
  color: rgba(255,255,255,.72); font-size: .88rem; font-weight: 500;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.nav a.is-active { background: var(--red); color: #fff; font-weight: 600; }
.nav__label {
  font-size: .66rem; text-transform: uppercase; letter-spacing: .1em;
  color: rgba(255,255,255,.38); padding: .9rem .7rem .3rem; font-weight: 700;
}

.sidebar__foot { margin-top: auto; font-size: .75rem; color: rgba(255,255,255,.45); }
.sidebar__foot a { color: rgba(255,255,255,.7); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  background: var(--paper); border-bottom: 1px solid var(--paper-line);
  padding: .85rem 1.75rem; display: flex; align-items: center; gap: 1rem;
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { margin: 0; font-size: 1.05rem; }
.topbar .spacer { flex: 1; }

.content { padding: 1.75rem; max-width: 1360px; width: 100%; }
.content--narrow { max-width: 880px; }

/* ------------------------------------------------------------------- cards */

.card {
  background: var(--paper); border: 1px solid var(--paper-line);
  border-radius: var(--radius); padding: 1.25rem 1.35rem; box-shadow: var(--shadow);
}
.card + .card { margin-top: 1.1rem; }
.card__head {
  display: flex; align-items: center; gap: .75rem; margin: -.25rem 0 1rem;
}
.card__head h2, .card__head h3 { margin: 0; }
.card__head .spacer { flex: 1; }
.card__sub { color: var(--mute); font-size: .85rem; margin: -.35rem 0 1rem; }

.grid { display: grid; gap: 1.1rem; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.grid--sidebar { grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); align-items: start; }

@media (max-width: 1080px) {
  .grid--sidebar { grid-template-columns: 1fr; }
}

/* -------------------------------------------------------------------- stats */

.stat { background: var(--paper); border: 1px solid var(--paper-line); border-radius: var(--radius); padding: 1rem 1.1rem; }
.stat__label { font-size: .7rem; text-transform: uppercase; letter-spacing: .09em; color: var(--mute); font-weight: 700; }
.stat__value { font-size: 1.7rem; font-weight: 800; letter-spacing: -.03em; margin-top: .2rem; line-height: 1.1; }
.stat__note { font-size: .78rem; color: var(--mute); margin-top: .15rem; }

/* ------------------------------------------------------------------ buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .5rem .95rem; border-radius: 999px; border: 1px solid var(--ink);
  background: transparent; color: var(--ink); font: inherit; font-size: .86rem; font-weight: 600;
  cursor: pointer; transition: all .15s var(--ease); text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--ink); color: #fff; text-decoration: none; }
.btn--solid { background: var(--red); border-color: var(--red); color: #fff; }
.btn--solid:hover { background: var(--red-deep); border-color: var(--red-deep); color: #fff; }
.btn--ghost { border-color: var(--paper-line); color: var(--mute); }
.btn--ghost:hover { background: var(--paper-warm); color: var(--ink); border-color: var(--ink); }
.btn--danger { border-color: var(--bad); color: var(--bad); }
.btn--danger:hover { background: var(--bad); color: #fff; }
.btn--sm { padding: .3rem .7rem; font-size: .78rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

/* ------------------------------------------------------------------- forms */

label { display: block; font-size: .78rem; font-weight: 700; color: var(--mute); margin-bottom: .3rem; }
label.inline { display: flex; align-items: center; gap: .5rem; font-weight: 500; color: var(--ink); font-size: .88rem; margin: 0; }
label.inline input { margin: 0; }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; padding: .55rem .7rem; font: inherit; font-size: .9rem;
  border: 1px solid var(--paper-line); border-radius: var(--radius-sm);
  background: var(--paper); color: var(--ink); transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--red); box-shadow: 0 0 0 3px rgba(254,67,56,.13);
}
textarea { resize: vertical; min-height: 90px; line-height: 1.55; }
textarea.mono { font-family: var(--mono); font-size: .82rem; line-height: 1.6; }

.field { margin-bottom: .9rem; }
.field__hint { font-size: .76rem; color: var(--mute); margin-top: .25rem; font-weight: 400; }
.field-row { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

fieldset { border: 1px solid var(--paper-line); border-radius: var(--radius-sm); padding: 1rem; margin: 0 0 1rem; }
legend { font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--mute); padding: 0 .4rem; }

/* ------------------------------------------------------------------ tables */

.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th {
  text-align: left; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--mute); font-weight: 800; padding: .5rem .65rem; border-bottom: 1px solid var(--paper-line);
}
.table td { padding: .6rem .65rem; border-bottom: 1px solid var(--paper-line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--paper-warm); }
.table--fixed { table-layout: fixed; }
.table-scroll { overflow-x: auto; margin: 0 -.35rem; }

/* ------------------------------------------------------------------- pills */

.pill {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .15rem .55rem; border-radius: 999px; font-size: .7rem; font-weight: 700;
  letter-spacing: .02em; background: var(--paper-warm); color: var(--mute);
  border: 1px solid var(--paper-line); white-space: nowrap;
}
.pill--ok      { background: var(--ok-bg);   color: var(--ok);   border-color: transparent; }
.pill--pending { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.pill--review  { background: #eaf1fb;        color: #2f5ea8;     border-color: transparent; }
.pill--bad     { background: var(--bad-bg);  color: var(--bad);  border-color: transparent; }
.pill--red     { background: var(--red);     color: #fff;        border-color: transparent; }

.scarf {
  display: inline-block; padding: .1rem .45rem; border-radius: 5px;
  font-size: .68rem; font-weight: 800; letter-spacing: .03em; margin-right: .25rem;
  background: var(--paper-warm); color: var(--mute);
}
.scarf--status      { background: #fdecea; color: #b5322a; }
.scarf--certainty   { background: #eaf1fb; color: #2f5ea8; }
.scarf--autonomy    { background: #f3ecfd; color: #6b2fbf; }
.scarf--relatedness { background: #e9f4ee; color: #2f7d51; }
.scarf--fairness    { background: #fdf3e2; color: #a86a12; }

/* ------------------------------------------------------------------- lists */

.stack { display: flex; flex-direction: column; gap: .7rem; }
.stack--tight { gap: .4rem; }

.item {
  border: 1px solid var(--paper-line); border-radius: var(--radius-sm);
  padding: .75rem .9rem; background: var(--paper); transition: border-color .15s var(--ease);
}
.item:hover { border-color: #d5cec8; }
.item__title { font-weight: 700; font-size: .93rem; }
.item__meta { font-size: .78rem; color: var(--mute); margin-top: .1rem; }
.item__body { font-size: .87rem; margin-top: .4rem; }

.chain {
  font-family: var(--mono); font-size: .78rem; color: var(--ink);
  background: var(--paper-warm); padding: .4rem .6rem; border-radius: 6px;
  border-left: 3px solid var(--red); line-height: 1.55; word-break: break-word;
}

.quote {
  border-left: 3px solid var(--red); padding: .35rem 0 .35rem .85rem;
  font-style: italic; color: var(--ink);
}

.empty {
  text-align: center; padding: 2.25rem 1rem; color: var(--mute);
  border: 1px dashed var(--paper-line); border-radius: var(--radius); background: var(--paper);
}
.empty strong { display: block; color: var(--ink); margin-bottom: .3rem; font-size: .95rem; }

/* -------------------------------------------------------------------- tabs */

.tabs {
  display: flex; gap: .2rem; border-bottom: 1px solid var(--paper-line);
  margin: 0 0 1.4rem; overflow-x: auto; padding-bottom: 0;
}
.tabs a {
  padding: .55rem .85rem; font-size: .87rem; font-weight: 600; color: var(--mute);
  border-bottom: 2px solid transparent; white-space: nowrap; margin-bottom: -1px;
}
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.is-active { color: var(--red-deep); border-bottom-color: var(--red); }

/* ------------------------------------------------------------------- flash */

.flash {
  padding: .7rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1.1rem;
  font-size: .88rem; font-weight: 500; border: 1px solid transparent;
}
.flash--ok  { background: var(--ok-bg);  color: var(--ok);  border-color: #cbe4d5; }
.flash--bad { background: var(--bad-bg); color: var(--bad); border-color: #f5cfcc; }

/* ------------------------------------------------------------------- prose */

.prose { font-size: .95rem; line-height: 1.7; max-width: 74ch; }
.prose h1 { font-size: 1.45rem; color: var(--red-deep); margin-top: 1.8rem; }
.prose h2 { font-size: 1.15rem; color: var(--red-deep); margin-top: 1.6rem; }
.prose h3 { font-size: 1rem; margin-top: 1.3rem; }
.prose h1:first-child, .prose h2:first-child { margin-top: 0; }
.prose ul, .prose ol { padding-left: 1.3rem; margin: 0 0 .9rem; }
.prose li { margin-bottom: .3rem; }
.prose blockquote {
  margin: 1rem 0; padding: .5rem 0 .5rem 1rem;
  border-left: 3px solid var(--red); color: var(--mute); font-style: italic;
}
.prose table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: .87rem; }
.prose th { background: var(--paper-warm); text-align: left; }
.prose th, .prose td { border: 1px solid var(--paper-line); padding: .45rem .6rem; vertical-align: top; }
.prose--full { max-width: none; }

/* --------------------------------------------------------------- streaming */

.stream {
  background: var(--paper); border: 1px solid var(--paper-line); border-radius: var(--radius);
  padding: 1.2rem 1.35rem; min-height: 220px; max-height: 65vh; overflow-y: auto;
  font-size: .92rem; line-height: 1.7; white-space: pre-wrap; word-wrap: break-word;
}
.stream:empty::before { content: "Output will stream here."; color: var(--mute); font-style: italic; }
.stream.is-live { border-color: var(--red); box-shadow: 0 0 0 3px rgba(254,67,56,.09); }

.stream-status {
  display: flex; align-items: center; gap: .5rem; font-size: .83rem;
  color: var(--mute); margin-bottom: .7rem; min-height: 1.3rem;
}
.spinner {
  width: 13px; height: 13px; border: 2px solid var(--paper-line);
  border-top-color: var(--red); border-radius: 50%; animation: spin .7s linear infinite;
  flex: 0 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- chat/ask */

.chat { display: flex; flex-direction: column; gap: 1rem; }
.msg { display: flex; gap: .75rem; }
.msg__who {
  flex: 0 0 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  font-size: .68rem; font-weight: 800; color: #fff; background: var(--ink);
}
.msg--assistant .msg__who { background: var(--red); }
.msg__body { flex: 1; min-width: 0; }
.msg__text { font-size: .92rem; line-height: 1.65; }

/* Inference the model flagged as SPECULATIVE. Amber rather than the brand red,
   which already means "risk" elsewhere in the app — this is "unconfirmed",
   not "danger". */
mark.speculative {
  background: #fdf3d8;
  color: var(--ink);
  border-bottom: 1px solid #e0b64b;
  border-radius: 2px;
  padding: .05rem .15rem;
}
.ask-legend { font-size: .74rem; color: var(--mute); margin-top: .5rem; }
.ask-legend mark { margin-right: .3rem; }

.citations { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .55rem; }
.citation {
  font-size: .72rem; padding: .2rem .5rem; border-radius: 6px;
  background: var(--paper-warm); border: 1px solid var(--paper-line); color: var(--mute);
}
.citation strong { color: var(--ink); }

.suggestions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
.suggestion {
  font-size: .8rem; padding: .3rem .7rem; border-radius: 999px; cursor: pointer;
  background: var(--paper); border: 1px solid var(--paper-line); color: var(--mute); font: inherit; font-size: .8rem;
}
.suggestion:hover { border-color: var(--red); color: var(--red-deep); }

/* --------------------------------------------------------------- utilities */

.muted   { color: var(--mute); }
.small   { font-size: .82rem; }
.tiny    { font-size: .74rem; }
.mono    { font-family: var(--mono); }
.right   { text-align: right; }
.center  { text-align: center; }
.nowrap  { white-space: nowrap; }
.mt0 { margin-top: 0; }  .mt1 { margin-top: .6rem; }  .mt2 { margin-top: 1.2rem; }
.mb0 { margin-bottom: 0; } .mb1 { margin-bottom: .6rem; } .mb2 { margin-bottom: 1.2rem; }
.flex { display: flex; gap: .6rem; align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.inline-form { display: inline; }

/* ---- Session evolution map -------------------------------------------- */

.stale { color: var(--warn); }

/* Sessions run down the page; threads hang off each one. The left rule is the
   spine, so the eye follows the engagement rather than reading a list. */
.evo { position: relative; }
.evo-session {
  position: relative; padding: 0 0 1.4rem 1.15rem;
  border-left: 2px solid var(--paper-line);
}
.evo-session:last-child { border-left-color: transparent; padding-bottom: 0; }
.evo-session::before {
  content: ""; position: absolute; left: -7px; top: .35rem;
  width: 12px; height: 12px; border-radius: 50%;
  background: #fff; border: 2px solid var(--paper-line);
}
.evo-session--turning_point::before { border-color: var(--ok); background: var(--ok); }
.evo-session--setback::before       { border-color: var(--bad); background: var(--bad); }

.evo-session__head { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.evo-session__title { font-weight: 700; font-size: .95rem; color: var(--ink); }
.evo-session__title:hover { color: var(--red); }
.evo-session__note { font-size: .84rem; color: var(--mute); margin: .3rem 0 .6rem; max-width: 74ch; }

.evo-threads { display: flex; flex-direction: column; gap: .55rem; }
.evo-thread {
  border-left: 3px solid var(--paper-line); padding: .5rem .75rem;
  background: var(--paper-warm); border-radius: 0 6px 6px 0;
}
.evo-thread--new      { border-left-color: var(--red); }
.evo-thread--shifted  { border-left-color: var(--ok); }
.evo-thread--resolved { border-left-color: var(--ok); opacity: .8; }
.evo-thread--parked   { opacity: .7; }
/* A reading the extraction record does not confirm is shown, but never with the
   same weight as something the record holds. */
.evo-thread--unverified { background: transparent; border-left-style: dashed; }

.evo-thread__head { display: flex; flex-wrap: wrap; gap: .4rem; align-items: baseline; }
.evo-thread__name { font-weight: 600; font-size: .87rem; color: var(--ink); }
.evo-thread__reading { font-size: .83rem; line-height: 1.6; margin-top: .3rem; max-width: 74ch; }

.evo-quote {
  margin: .4rem 0 0; padding: .25rem 0 .25rem .7rem;
  border-left: 2px solid var(--paper-line);
  font-size: .82rem; font-style: italic; color: var(--mute); max-width: 70ch;
}

.evo-int {
  margin-top: .45rem; padding: .35rem .6rem; background: #fff;
  border: 1px solid var(--paper-line); border-radius: 6px; font-size: .82rem;
}
.evo-int__note { color: var(--mute); font-size: .78rem; margin-top: .2rem; }

.evo-tag {
  display: inline-block; padding: .05rem .4rem; border-radius: 999px;
  font-size: .68rem; font-weight: 700; text-transform: lowercase;
  background: var(--paper-line); color: var(--mute);
}
.evo-tag--new        { background: #fde8e6; color: var(--red-deep); }
.evo-tag--shifted,
.evo-tag--worked     { background: var(--ok-bg);   color: var(--ok); }
.evo-tag--resolved   { background: var(--ok-bg);   color: var(--ok); }
.evo-tag--partial    { background: var(--warn-bg); color: var(--warn); }
.evo-tag--not_done   { background: var(--bad-bg);  color: var(--bad); }
.evo-tag--unverified { background: transparent; color: var(--mute); border: 1px dashed var(--paper-line); }

.evo-group { padding: .6rem 0; border-top: 1px solid var(--paper-line); }
.evo-group:first-of-type { border-top: 0; }
.evo-group__head { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .4rem; }

/* The overview strip. */
.evo-strip { display: flex; flex-wrap: wrap; gap: 1.1rem; align-items: baseline; }
.evo-strip__n { font-size: 1.25rem; font-weight: 700; line-height: 1; }
.evo-strip__l { font-size: .72rem; color: var(--mute); text-transform: uppercase; letter-spacing: .04em; }
.mr1 { margin-right: .6rem; }

/* Session picker on the client-level generate page. */
.session-picker {
  border: 1px solid var(--paper-line); border-radius: 8px;
  max-height: 320px; overflow-y: auto; background: #fff;
}
.session-pick {
  display: flex; gap: .65rem; align-items: flex-start;
  padding: .6rem .75rem; border-bottom: 1px solid var(--paper-line); cursor: pointer;
}
.session-pick:last-child { border-bottom: 0; }
.session-pick:hover { background: var(--paper-warm); }
.session-pick input { margin-top: .25rem; flex: none; }
.session-pick__body { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.session-pick__title { font-size: .88rem; font-weight: 600; }
.session-pick__meta { font-size: .76rem; color: var(--mute); }
.session-pick--empty { opacity: .55; cursor: not-allowed; }

.nav__badge {
  display: inline-block; min-width: 1.25rem; padding: 0 .35rem;
  background: var(--red); color: #fff; border-radius: 999px;
  font-size: .7rem; font-weight: 700; text-align: center; line-height: 1.25rem;
}
.inbox-item { border-bottom: 1px solid var(--paper-line); padding: 1rem 0; }
.inbox-item:last-child { border-bottom: 0; }
.inbox-item__preview {
  font-size: .84rem; color: var(--mute); line-height: 1.6;
  margin: .5rem 0 .7rem; max-width: 70ch;
}
.inbox-file { display: flex; flex-wrap: wrap; gap: .6rem; align-items: end; }

/* Two-factor pages. */
.code-input {
  font-family: var(--mono); font-size: 1.35rem; letter-spacing: .32em;
  text-align: center; max-width: 11ch;
}
.qr-wrap {
  display: inline-block; padding: .8rem; margin: .7rem 0;
  background: #fff; border: 1px solid var(--paper-line); border-radius: 8px;
}
.qr-wrap img { display: block; image-rendering: pixelated; }
.secret-key {
  display: inline-block; font-family: var(--mono); font-size: .95rem;
  letter-spacing: .08em; padding: .45rem .6rem;
  background: var(--paper-warm); border: 1px solid var(--paper-line); border-radius: 6px;
  user-select: all;
}
.steps { padding-left: 1.2rem; line-height: 1.7; }
.steps > li { margin-bottom: .7rem; }
.recovery-codes {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .5rem;
  padding: 1rem; background: var(--paper-warm);
  border: 1px solid var(--paper-line); border-radius: 8px;
}
.recovery-codes code {
  font-family: var(--mono); font-size: .95rem; letter-spacing: .05em;
  text-align: center; padding: .3rem; user-select: all;
}

/* AI proposals waiting on the coach: visually distinct from work the client
   actually has, so the two are never confused at a glance. */
.card--review { border-left: 3px solid #2f5ea8; }
.assign-form { display: inline-flex; align-items: center; gap: .4rem; }
.input--inline { padding: .25rem .5rem; font-size: .78rem; width: auto; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }

details.disclosure { border: 1px solid var(--paper-line); border-radius: var(--radius-sm); padding: .6rem .85rem; background: var(--paper); }
details.disclosure + details.disclosure { margin-top: .5rem; }
details.disclosure summary { cursor: pointer; font-weight: 700; font-size: .87rem; }
details.disclosure[open] summary { margin-bottom: .7rem; }

.auth-page {
  min-height: 100vh; display: grid; place-items: center; padding: 2rem;
  background: linear-gradient(150deg, var(--ink-deep) 0%, #332e2a 100%);
}
.auth-card { width: 100%; max-width: 430px; background: var(--paper); border-radius: var(--radius); padding: 2rem; box-shadow: 0 24px 70px -30px rgba(0,0,0,.6); }
.auth-mark { display: block; width: 44px; height: 44px; border-radius: 11px; margin-bottom: .9rem; }
.auth-card h1 { font-size: 1.35rem; }

@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; padding: .8rem 1rem; gap: .8rem; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav__label, .sidebar__foot { display: none; }
  .content { padding: 1.1rem; }
  .topbar { padding: .75rem 1.1rem; }
}

@media print {
  .sidebar, .topbar, .btn, .tabs, .no-print { display: none !important; }
  body { background: #fff; }
  .content { padding: 0; max-width: none; }
  .card { border: 0; box-shadow: none; padding: 0; }
}

/* ------------------------------------------------------------------ mind map
   The client's file drawn as a graph. Colours are per branch and used in three
   places — the chip, the node, the link — so the eye can follow one branch
   across the whole drawing without reading a label. */

.map-wrap { position: relative; display: flex; gap: .9rem; align-items: stretch; margin-bottom: 1.1rem; }

.map {
  flex: 1 1 auto;
  min-width: 0;
  height: min(74vh, 760px);
  background:
    radial-gradient(circle at 50% 50%, #fff 0%, var(--paper-warm) 78%);
  border: 1px solid var(--paper-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}
.map.is-panning { cursor: grabbing; }
.map__svg { width: 100%; height: 100%; display: block; }

/* Branch colours. */
.map-b--people        { --branch: var(--culture); }
.map-b--episodes      { --branch: #b8532f; }
.map-b--triggers      { --branch: var(--direction); }
.map-b--patterns      { --branch: var(--red); }
.map-b--communication { --branch: #2f8f8f; }
.map-b--interventions { --branch: var(--ok); }
.map-b--goals         { --branch: var(--coaching); }
.map-b--open_loops    { --branch: var(--warn); }

/* Paths. Tree links hold the shape; the three cross links each say something
   different about how strong the claim behind them is, so none of them look
   alike. */
.map-path { fill: none; stroke-linecap: round; pointer-events: none; }
.map-path--tree      { stroke: var(--paper-line); stroke-width: 1.6; }
.map-path--triggers  { stroke: #7f2fdd; stroke-width: 1.2; opacity: .45; }
.map-path--involves  { stroke: #4e83d8; stroke-width: 1.1; opacity: .45; stroke-dasharray: 5 5; }
.map-path--addresses { stroke: #2f7d51; stroke-width: 1.1; opacity: .45; stroke-dasharray: 2 6; }
.map-path.is-lit     { opacity: 1; stroke-width: 2.4; }
.map-path.is-dim     { opacity: .07; }

/* Nodes. */
.map-node { cursor: pointer; }
.map-node__box {
  fill: #fff;
  stroke: color-mix(in srgb, var(--branch, var(--mute)) 45%, transparent);
  stroke-width: 1.4;
  transition: stroke-width .12s var(--ease), fill .12s var(--ease);
}
.map-node__dot   { fill: var(--branch, var(--mute)); opacity: .9; }
.map-node__title { font: 600 12px/1 var(--font); fill: var(--ink); }
.map-node__meta  { font: 500 10px/1 var(--font); fill: var(--mute); }
.map-node__flag  { font: 700 10px/1 var(--font); fill: var(--bad); }

.map-node--root .map-node__box  { fill: var(--ink); stroke: var(--ink); }
.map-node--root .map-node__title { fill: #fff; font-size: 14px; font-weight: 800; }
.map-node--root .map-node__meta  { fill: rgba(255,255,255,.7); }

.map-node--branch .map-node__box   { fill: var(--branch); stroke: var(--branch); }
.map-node--branch .map-node__title { fill: #fff; font-weight: 700; }
.map-node--branch .map-node__meta  { fill: rgba(255,255,255,.78); }

.map-node--more .map-node__box   { fill: var(--paper-warm); stroke-dasharray: 4 4; }
.map-node--more .map-node__title { fill: var(--mute); }

/* Status. A resolved pattern stays on the map, faded: a case that got better
   should still show what it got better from. */
.map-node.is-resolved { opacity: .5; }
.map-node.is-resolved .map-node__box { stroke-dasharray: 5 4; }
.map-node.is-parked   { opacity: .74; }
.map-node.is-dormant  { opacity: .45; }

/* New since the last session. A red border was the obvious choice and the
   wrong one: the patterns branch is already red, so every pattern read as new. */
.map-node__new { fill: var(--red); stroke: #fff; stroke-width: 1.5; }

.map-node:hover .map-node__box,
.map-node:focus .map-node__box { stroke-width: 2.6; }
.map-node.is-selected .map-node__box { stroke-width: 3; fill: #fffaf9; }
.map-node.is-dim   { opacity: .12; }
.map-node.is-hidden { display: none; }

/* Legend and filter chips. */
.map-legend { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-top: .8rem; }
.map-chip {
  display: inline-flex; align-items: center; gap: .35rem;
  border: 1px solid var(--paper-line); background: #fff; color: var(--ink);
  border-radius: 999px; padding: .25rem .6rem; font: 600 .76rem var(--font);
  cursor: pointer; transition: opacity .12s var(--ease);
}
.map-chip:not(.is-on) { opacity: .42; }
.map-chip__dot { width: 9px; height: 9px; border-radius: 50%; background: var(--branch, var(--mute)); }
.map-chip__count { color: var(--mute); font-weight: 500; }

/* The side panel: what a node actually is, without leaving the map. */
.map-panel {
  flex: 0 0 288px;
  background: #fff;
  border: 1px solid var(--paper-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.1rem;
  position: relative;
  overflow-y: auto;
}
.map-panel[hidden] { display: none; }
.map-panel__close {
  position: absolute; top: .4rem; right: .6rem;
  border: 0; background: none; font-size: 1.3rem; line-height: 1;
  color: var(--mute); cursor: pointer;
}
.map-panel__kind { text-transform: uppercase; letter-spacing: .08em; font-size: .68rem; font-weight: 700; }
.map-panel__flag {
  background: var(--bad-bg); color: var(--bad); border-radius: var(--radius-sm);
  padding: .4rem .55rem; font-size: .78rem; font-weight: 600; margin: .5rem 0;
}
.map-panel__detail { font-size: .85rem; white-space: pre-wrap; }
.map-panel__links { font-size: .8rem; color: var(--mute); margin-bottom: .7rem; }
.map-panel__links a { display: block; }

/* The key under the map. */
.map-key { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: .6rem; font-size: .82rem; }
.map-key__swatch { display: inline-block; width: 26px; height: 3px; border-radius: 2px; margin-right: .45rem; vertical-align: middle; background: var(--paper-line); }
.map-key__swatch--dot { width: 10px; height: 10px; border-radius: 50%; background: var(--mute); }
.map-key__swatch--tree { background: var(--paper-line); }
.map-key__swatch--triggers { background: var(--direction); }
.map-key__swatch--involves { background: var(--culture); }
.map-key__swatch--addresses { background: var(--ok); }
.map-key__swatch--flag { background: var(--bad); }

@media (max-width: 900px) {
  .map-wrap { flex-direction: column; }
  .map { height: 60vh; }
  .map-panel { flex: 1 1 auto; }
}


/* ------------------------------------------------------------- mood meter */
/*
   Four quadrant colours, five tones each: the further a word sits from the
   middle of the grid, the stronger the colour, exactly as on the printed
   chart. The tone is decoration — the position on the grid is the data — but
   it is what makes a client's drift out of the red half readable at a glance.

   Colours are carried as RGB triples so the same hue can be laid down at four
   different strengths (grid cell, chip, border, ink) without four variables.
*/
.mood-q--red    { --mood-rgb: 201 36 27;  --mood-ink: #a01a13; }
.mood-q--blue   { --mood-rgb: 47 94 168;  --mood-ink: #27508f; }
.mood-q--green  { --mood-rgb: 47 125 81;  --mood-ink: #26643f; }
.mood-q--yellow { --mood-rgb: 197 148 16; --mood-ink: #8a6208; }

.is-t1 { --mood-a: .16; }
.is-t2 { --mood-a: .30; }
.is-t3 { --mood-a: .46; }
.is-t4 { --mood-a: .62; }
.is-t5 { --mood-a: .80; }

/* One reading, wherever it appears. */
.mood-chip {
  display: inline-flex; align-items: baseline; gap: .3rem;
  padding: .14rem .5rem; border-radius: 999px;
  font-size: .78rem; font-weight: 700; line-height: 1.5;
  color: var(--mood-ink, var(--mute));
  background: rgb(var(--mood-rgb, 107 98 92) / calc(var(--mood-a, .3) * .35));
  border: 1px solid rgb(var(--mood-rgb, 107 98 92) / .35);
  white-space: nowrap;
}
.mood-chip__phase {
  font-size: .62rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; opacity: .68;
}
.mood-chip--empty {
  color: var(--mute); background: var(--paper-warm);
  border: 1px dashed var(--paper-line); font-weight: 600;
}

.mood-arc { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.mood-arc--tight { margin: .3rem 0 0; }
.mood-arc__to { color: var(--mute); font-weight: 700; }
.mood-arc__shift { font-size: .78rem; color: var(--mute); }

/* In the history table the arc is a glance, not a sentence. */
.table .mood-arc { margin: 0; gap: .25rem; }
.table .mood-arc__shift { display: none; }

/* The picker. */
.field-row--mood { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin-bottom: .9rem; }
.mood-picker { position: relative; min-width: 0; }
.mood-picker > label {
  display: block; font-size: .78rem; font-weight: 700; color: var(--mute); margin-bottom: .3rem;
}
.mood-trigger {
  width: 100%; text-align: left; cursor: pointer;
  padding: .5rem .65rem; border-radius: var(--radius-sm);
  border: 1px solid var(--paper-line); background: #fff;
  font-family: var(--font); font-size: .88rem; line-height: 1.3;
  display: flex; flex-direction: column; gap: .1rem;
}
.mood-trigger:hover { border-color: var(--mute); }
.mood-trigger.is-set {
  border-color: rgb(var(--mood-rgb) / .55);
  background: rgb(var(--mood-rgb) / calc(var(--mood-a) * .22));
}
.mood-trigger__word { font-weight: 700; color: var(--ink); }
.mood-trigger.is-set .mood-trigger__word { color: var(--mood-ink); }
.mood-trigger__hint { font-size: .7rem; color: var(--mute); }

/*
   Anchored to the right edge, not the left: both pickers live in a narrow
   right-hand column, and a wide panel opening rightwards from there would run
   off the page. Opening leftwards it lands over the main column, which is
   empty space while the popover is up.
*/
.mood-pop {
  position: absolute; z-index: 40; top: calc(100% + .35rem); right: 0; left: auto;
  width: min(680px, 78vw); max-width: calc(100vw - 2rem);
  background: #fff; border: 1px solid var(--paper-line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: .7rem;
}
.mood-pop[hidden] { display: none; }
.mood-pop__head { display: flex; align-items: center; gap: .4rem; margin-bottom: .5rem; }
.mood-pop__close {
  border: 0; background: none; font-size: 1.2rem; line-height: 1;
  color: var(--mute); cursor: pointer;
}
.mood-pop__scroll { overflow-x: auto; }
.mood-grid {
  display: grid; grid-template-columns: repeat(10, minmax(60px, 1fr));
  gap: 2px; min-width: 620px;
}
.mood-cell {
  border: 0; cursor: pointer; padding: .32rem .12rem;
  border-radius: 3px; font-family: var(--font); font-size: .62rem; font-weight: 700;
  line-height: 1.15; color: var(--ink);
  background: rgb(var(--mood-rgb) / var(--mood-a));
}
.mood-cell:hover { outline: 2px solid var(--ink); outline-offset: -2px; }
.mood-cell:focus-visible { outline: 2px solid var(--ink); outline-offset: 0; }
.mood-cell.is-picked { outline: 3px solid var(--ink); outline-offset: -1px; }
.mood-cell.is-t4, .mood-cell.is-t5 { color: #fff; }
/* Yellow never goes dark enough to carry white text. */
.mood-cell.mood-q--yellow.is-t4, .mood-cell.mood-q--yellow.is-t5 { color: var(--ink); }
.mood-pop__axes {
  display: flex; justify-content: space-between; gap: .5rem;
  font-size: .68rem; color: var(--mute); margin-top: .45rem; min-width: 620px;
}

/* The emotion evolution map. */
.mood-evo { display: grid; grid-template-columns: minmax(280px, 380px) 1fr; gap: 1.2rem; align-items: start; }
.mood-evo__map { min-width: 0; }
.mood-evo__key { margin-top: .5rem; }
.mood-evo__summary {
  background: var(--paper-warm); border-radius: var(--radius-sm);
  padding: .6rem .75rem; font-size: .85rem; margin-bottom: .7rem;
}
.mood-evo__list { min-width: 0; }
.mood-evo__row.is-latest { border-color: var(--ink); }

.mood-map { width: 100%; height: auto; display: block; }
.mood-sq { fill: rgb(var(--mood-rgb)); fill-opacity: var(--mood-a); stroke: #fff; stroke-width: .6; }
.mood-map__frame { fill: none; stroke: var(--paper-line); stroke-width: 1; }
.mood-map__axis { font: 700 8px/1 var(--font); fill: var(--mute); letter-spacing: .04em; }

/* Older sessions stay legible but recede; the last one is the current answer. */
.mood-track { opacity: .5; }
.mood-track.is-latest { opacity: 1; }
.mood-track__arrow { fill: none; stroke: var(--ink); stroke-width: 1.4; stroke-linecap: round; }
.mood-track.is-latest .mood-track__arrow { stroke-width: 2.2; }
/* The marker lives in <defs>, outside the tracks group it is used from. */
.mood-map marker path { fill: var(--ink); }
.mood-dot { stroke: var(--ink); stroke-width: 1.4; }
.mood-dot--start { fill: #fff; }
.mood-dot--end   { fill: var(--ink); }
.mood-track.is-held .mood-dot--end { fill: var(--mute); }
.mood-track__no {
  font: 700 7px/1 var(--font); fill: var(--ink);
  paint-order: stroke; stroke: #fff; stroke-width: 2.5;
}

@media (max-width: 900px) {
  .mood-evo { grid-template-columns: 1fr; }
  .field-row--mood { grid-template-columns: 1fr; }
  .mood-pop { width: min(680px, 92vw); }
}

/* --------------------------------------------------------------- the diary */
/*
   Six rows of seven, always, so the page does not change height as the coach
   pages through the year — the grid is a map he navigates by position.
*/
.cal { border: 1px solid var(--paper-line); border-radius: var(--radius-sm); overflow: hidden; }
.cal__head, .cal__week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal__weekday {
  padding: .4rem .5rem; font-size: .68rem; font-weight: 800; letter-spacing: .08em;
  text-transform: uppercase; color: var(--mute); background: var(--paper-warm);
  border-bottom: 1px solid var(--paper-line);
}
.cal__day {
  min-height: 92px; padding: .3rem .35rem; background: var(--paper);
  border-right: 1px solid var(--paper-line); border-bottom: 1px solid var(--paper-line);
  display: flex; flex-direction: column; gap: 2px; overflow: hidden;
}
.cal__week:last-child .cal__day { border-bottom: 0; }
.cal__day:last-child { border-right: 0; }
.cal__day.is-outside { background: var(--paper-warm); }
.cal__day.is-outside .cal__date { opacity: .45; }
.cal__day.is-weekend:not(.is-outside) { background: #fbf9f8; }
.cal__day.is-today { box-shadow: inset 0 0 0 2px var(--red); }
.cal__date { font-size: .72rem; font-weight: 700; color: var(--mute); }
.cal__day.is-today .cal__date { color: var(--red-deep); }

.cal__event {
  display: flex; gap: .3rem; align-items: baseline; min-width: 0;
  padding: .12rem .3rem; border-radius: 4px; font-size: .68rem; line-height: 1.35;
  background: var(--ok-bg); color: var(--ink); text-decoration: none;
  border-left: 3px solid var(--ok);
}
.cal__event:hover { text-decoration: none; filter: brightness(.97); }
.cal__time { font-weight: 700; color: var(--mute); flex: 0 0 auto; }
.cal__who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
/* An event nobody has claimed reads as a question, not as a session. */
.cal__event.is-unmatched { background: var(--warn-bg); border-left-color: var(--warn); }
.cal__event.is-cancelled {
  background: var(--paper-warm); border-left-color: var(--paper-line);
  color: var(--mute); text-decoration: line-through;
}

.item--muted { opacity: .72; }

@media (max-width: 900px) {
  .cal__day { min-height: 64px; }
  .cal__who { display: none; }
}

/* ------------------------------------------------------------- the ledger */
/*
   The balance is one number and the coach should read it before anything else
   on the page — including, and especially, when it is negative.
*/
.ledger { display: flex; align-items: center; gap: 1rem; }
.ledger__count {
  flex: 0 0 auto; min-width: 92px; text-align: center;
  border-radius: var(--radius-sm); padding: .6rem .5rem;
  background: var(--paper-warm);
}
.ledger__n { font-size: 2rem; font-weight: 800; line-height: 1; letter-spacing: -.03em; }
.ledger__l { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--mute); }
.ledger__detail { font-size: .85rem; min-width: 0; }
.ledger__warn { color: var(--bad); font-weight: 700; }

.ledger--ok .ledger__count        { background: var(--ok-bg);   color: var(--ok); }
.ledger--low .ledger__count       { background: var(--warn-bg); color: var(--warn); }
.ledger--empty .ledger__count     { background: var(--warn-bg); color: var(--warn); }
.ledger--overdrawn .ledger__count { background: var(--bad-bg);  color: var(--bad); }
.ledger--ok .ledger__l, .ledger--low .ledger__l,
.ledger--empty .ledger__l, .ledger--overdrawn .ledger__l { color: inherit; opacity: .8; }
.ledger--untracked { color: var(--mute); }

.ledger-pill {
  display: inline-block; min-width: 28px; text-align: center;
  padding: .1rem .45rem; border-radius: 999px;
  font-weight: 800; font-size: .8rem;
  background: var(--paper-warm); color: var(--mute);
}
.ledger-pill--ok        { background: var(--ok-bg);   color: var(--ok); }
.ledger-pill--low       { background: var(--warn-bg); color: var(--warn); }
.ledger-pill--empty     { background: var(--warn-bg); color: var(--warn); }
.ledger-pill--overdrawn { background: var(--bad-bg);  color: var(--bad); }

tr.is-void { opacity: .5; text-decoration: line-through; }

/* Stored Take Flight graphs, on the assessments tab. Shown rather than
   described: a coach who uploaded the wrong page of the PDF should see that
   here, not in a finished report. */
.disc-graphs { display: flex; flex-wrap: wrap; gap: .8rem; margin: .7rem 0 .4rem; }
.disc-graph { margin: 0; max-width: 260px; }
.disc-graph img {
  display: block; width: 100%; height: auto;
  border: 1px solid var(--paper-line); border-radius: var(--radius-sm);
  background: #fff;
}
.disc-graph figcaption { margin-top: .25rem; }

/* Figures inside a report preview. A 1.3 MB quadrant diagram at natural size
   pushes the prose off the screen; the export sizes them to the page and the
   preview should do the same. */
.prose img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.1rem auto;
  border: 1px solid var(--paper-line);
  border-radius: var(--radius-sm);
  background: #fff;
}

/* The client profile: fifty-three fields, most of them one word. A grid keeps
   the page scannable; a stack of full-width rows would run for two screens. */
.profile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .8rem 1rem; }
.profile-field label { display: block; font-size: .78rem; font-weight: 600; margin-bottom: .2rem; }
.profile-field select, .profile-field input { width: 100%; }
.profile-field.is-set label { color: var(--red-deep); }

/* A reading can hold several words, so the trigger has to be able to show them
   without the row growing every time the coach adds one. */
.mood-trigger__word { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mood-pop__axes--note { color: var(--mute); font-size: .74rem; padding-bottom: .3rem; }
.mood-cell.is-picked { outline: 2px solid var(--ink); outline-offset: -2px; }
.mood-arc__words { margin-top: .3rem; }

/* ------------------------------------------------------------------- guide */
.guide-index { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .35rem; }
.guide-index__item {
  display: flex; align-items: center; gap: .5rem;
  padding: .45rem .6rem; border-radius: var(--radius-sm);
  color: var(--ink); font-size: .87rem; font-weight: 500;
}
.guide-index__item:hover { background: var(--paper-warm); text-decoration: none; }
.guide-tag {
  font-size: .62rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700;
  padding: .16rem .42rem; border-radius: 5px; flex: 0 0 auto;
  background: var(--paper-warm); color: var(--mute);
}
.guide-tag--ai { background: rgba(254,67,56,.12); color: var(--red); }
.guide-tag--records { background: rgba(45,41,38,.08); color: var(--ink); }
.guide-where { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .9rem; }
.guide-points { display: grid; gap: .75rem; }
.guide-point { border-left: 2px solid var(--paper-line); padding-left: .8rem; }
.guide-point__head { font-weight: 700; font-size: .88rem; margin-bottom: .15rem; }
.guide-point__body { font-size: .88rem; color: var(--mute); line-height: 1.55; }

/* ---------------------------------------------------------------- Willow */

.check { display: flex; gap: .45rem; align-items: center; font-size: .86rem; margin: .3rem 0; }
.wa-thread { display: flex; flex-direction: column; gap: .55rem; max-height: 70vh; overflow-y: auto; padding: .2rem; }
.wa-msg { max-width: 78%; padding: .55rem .75rem; border-radius: 12px; background: var(--paper-warm); align-self: flex-start; }
.wa-msg--out { align-self: flex-end; background: #fdecea; }
.wa-msg--kline { background: #eaf1fb; }
.wa-msg__body { font-size: .9rem; line-height: 1.55; overflow-wrap: anywhere; }
.wa-msg__meta { font-size: .72rem; color: var(--mute); margin-top: .25rem; }
.wa-media { margin-top: .4rem; }
.wa-media img, .wa-media video { display: block; max-width: 100%; max-height: 320px; border-radius: 8px; }
.wa-media audio { width: 100%; max-width: 320px; }
.wa-note { align-self: center; max-width: 92%; font-size: .74rem; color: var(--mute); background: var(--paper-warm); border: 1px dashed var(--paper-line); border-radius: 8px; padding: .3rem .6rem; text-align: center; }
.wa-note span { opacity: .8; }

/* Willow's pages read like WhatsApp Web: chats down the left, the open one on
   the right, filling the screen below the topbar. */
.wa-app {
  display: grid; grid-template-columns: 340px minmax(0, 1fr);
  height: calc(100vh - 7.6rem); min-height: 480px;
  background: var(--paper); border: 1px solid var(--paper-line); border-radius: var(--radius); overflow: hidden;
}
.wa-side { border-right: 1px solid var(--paper-line); display: flex; flex-direction: column; min-height: 0; background: var(--paper); }
.wa-side__head { display: flex; align-items: center; gap: .5rem; padding: .85rem 1rem; border-bottom: 1px solid var(--paper-line); }
.wa-side > [data-live] { overflow-y: auto; flex: 1; }
.wa-side__alert { display: block; margin: .6rem .8rem 0; padding: .5rem .7rem; border-radius: var(--radius-sm); font-size: .8rem; background: var(--warn-bg); color: var(--warn); }
.wa-side__alert--red { background: var(--red); color: #fff; }
.wa-side__empty { padding: 1.2rem 1rem; font-size: .84rem; color: var(--mute); }
.wa-chat { display: flex; gap: .7rem; align-items: center; padding: .7rem 1rem; color: inherit; border-bottom: 1px solid var(--paper-warm); }
.wa-chat:hover { background: var(--paper-warm); text-decoration: none; }
.wa-chat.is-active { background: var(--paper-warm); box-shadow: inset 3px 0 0 var(--red); }
.wa-chat__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .15rem; }
.wa-chat__top { display: flex; align-items: baseline; gap: .5rem; }
.wa-chat__name { font-weight: 700; font-size: .9rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-chat__time { font-size: .7rem; color: var(--mute); white-space: nowrap; }
.wa-chat__preview { font-size: .8rem; color: var(--mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-badge { min-width: 1.3rem; height: 1.3rem; padding: 0 .35rem; border-radius: 999px; background: var(--red); color: #fff; font-size: .7rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.wa-avatar { width: 2.4rem; height: 2.4rem; flex: none; border-radius: 50%; background: var(--paper-line); color: var(--ink); font-weight: 700; font-size: .8rem; display: inline-flex; align-items: center; justify-content: center; }
.wa-avatar--tasks { background: var(--red); color: #fff; }

.wa-main { position: relative; display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--paper-warm); }
.wa-main--pane { overflow-y: auto; padding: 1rem; gap: 1rem; display: block; }
.wa-main--pane > .card + .card { margin-top: 1rem; }
.wa-head { display: flex; align-items: center; gap: .7rem; padding: .65rem 1rem; background: var(--paper); border-bottom: 1px solid var(--paper-line); flex-wrap: wrap; }
.wa-head__back { display: none; font-size: 1.6rem; line-height: 1; color: var(--ink); padding: 0 .2rem; }
.wa-head__who { min-width: 0; }
.wa-head__name { font-weight: 700; display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.wa-head__sub { font-size: .75rem; color: var(--mute); }
.wa-state { font-size: .8rem; padding: .45rem 1rem; background: var(--paper); border-bottom: 1px solid var(--paper-line); color: var(--mute); }
.wa-state--kline { background: var(--warn-bg); color: var(--warn); }
.wa-thread--full { flex: 1; max-height: none; padding: 1rem 1.2rem; }
.wa-msg { box-shadow: 0 1px 1px rgba(45,41,38,.06); }
.wa-msg--in { background: var(--paper); }
.wa-compose { display: flex; gap: .6rem; align-items: flex-end; padding: .65rem 1rem .3rem; background: var(--paper); border-top: 1px solid var(--paper-line); }
.wa-compose textarea { flex: 1; resize: none; min-height: 2.5rem; max-height: 9rem; border-radius: 20px; padding: .55rem .9rem; }
.wa-compose__hint { font-size: .7rem; color: var(--mute); padding: 0 1rem .55rem; background: var(--paper); }

.wa-details > summary { list-style: none; cursor: pointer; }
.wa-details > summary::-webkit-details-marker { display: none; }
.wa-details__panel {
  position: absolute; top: 3.6rem; right: 0; bottom: 0; width: min(380px, 100%); z-index: 5;
  overflow-y: auto; padding: .8rem; background: var(--paper-warm); border-left: 1px solid var(--paper-line);
  box-shadow: -8px 0 24px rgba(45,41,38,.08);
}
.wa-details__panel > .card + .card { margin-top: .8rem; }

/* On a phone, a chat fills the screen; /willow stacks the list over the tasks. */
@media (max-width: 860px) {
  .wa-app { grid-template-columns: 1fr; height: calc(100vh - 11rem); }
  .wa-app--chat .wa-side { display: none; }
  .wa-app:not(.wa-app--chat) { height: auto; }
  .wa-app:not(.wa-app--chat) .wa-side { border-right: 0; border-bottom: 1px solid var(--paper-line); }
  .wa-head__back { display: inline-block; }
}
