/* 织序 · Weavora — interface styles
   Palette: cool paper + one Klein blue. Blue is reserved for brand, send,
   active state and progress threads; everything else stays neutral. */

@font-face {
  font-family: "Bricolage";
  src: url("/fonts/bricolage.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215;
}

:root {
  color-scheme: light;
  --paper: #f1f2f5;
  --sheet: #ffffff;
  --raised: #f5f6f8;
  --hover: #eceef2;
  --ink: #15161c;
  --ink-2: #4a4d5a;
  --muted: #8a8d9a;
  --line: #e6e8ec;
  --line-strong: #d6d9e0;
  --klein: #2236d4;
  --klein-hover: #1b2cb6;
  --klein-soft: #eceeff;
  --klein-ink: #ffffff;
  --primary-bg: #15161c;
  --primary-fg: #ffffff;
  --amber: #a25b00;
  --amber-bg: #fff3de;
  --green: #11804e;
  --green-bg: #e3f6ec;
  --red: #c4314b;
  --red-bg: #fdecef;
  --shadow-sheet: 0 1px 2px rgba(21, 22, 40, .04), 0 12px 40px -20px rgba(21, 22, 40, .16);
  --shadow-pop: 0 2px 6px rgba(21, 22, 40, .06), 0 24px 60px -18px rgba(21, 22, 40, .28);
  --display: "Bricolage", "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  --text: "Segoe UI Variable Text", -apple-system, "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  /* agent tints: background / foreground */
  --t0b: #e8ebff; --t0f: #2236d4;
  --t1b: #f0e8ff; --t1f: #6a3dd0;
  --t2b: #e0f4ea; --t2f: #157a4b;
  --t3b: #fff0d4; --t3f: #93570a;
  --t4b: #ffe5ec; --t4f: #bc2a50;
  --t5b: #dcf2f6; --t5f: #0e6d85;
  font: 14px/1.6 var(--text);
  -webkit-font-smoothing: antialiased;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --paper: #0c0d12;
    --sheet: #15161d;
    --raised: #1c1e27;
    --hover: #23252f;
    --ink: #ecedf3;
    --ink-2: #b9bcc9;
    --muted: #7f8394;
    --line: #262833;
    --line-strong: #333644;
    --klein: #7d8bff;
    --klein-hover: #96a1ff;
    --klein-soft: #1d2150;
    --klein-ink: #0c0d12;
    --primary-bg: #ecedf3;
    --primary-fg: #0c0d12;
    --amber: #f0b45a;
    --amber-bg: #2d2414;
    --green: #56d394;
    --green-bg: #12281d;
    --red: #ff7d92;
    --red-bg: #33171f;
    --shadow-sheet: 0 0 0 1px #20222c;
    --shadow-pop: 0 0 0 1px #2a2c38, 0 30px 80px -20px rgba(0, 0, 0, .7);
    --t0b: #1f2452; --t0f: #a5b0ff;
    --t1b: #2a1f4a; --t1f: #c6aaff;
    --t2b: #13301f; --t2f: #74d9a4;
    --t3b: #33270f; --t3f: #f1c06e;
    --t4b: #3a1823; --t4f: #ff9cb4;
    --t5b: #102d34; --t5f: #7fd3e6;
  }
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
/* Keep scrolling behavior while hiding the scrollbar paint. */
* { scrollbar-width: none; }
*::-webkit-scrollbar { display: none; width: 0; height: 0; }
body { margin: 0; background: var(--paper); color: var(--ink); }
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
svg.ico, .nav-symbol, .btn-icon, .icon-button svg, .send svg, .profile-more {
  fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: transparent; }
button:disabled { opacity: .45; cursor: default; }
:focus-visible { outline: 2px solid var(--klein); outline-offset: 2px; }
a { color: var(--klein); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3, h4 { font-family: var(--display); letter-spacing: -.01em; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 17px; font-weight: 650; }
h4 { font-size: 14px; font-weight: 650; }
b { font-family: var(--display); font-weight: 650; color: var(--ink); }
.muted { color: var(--muted); font-size: 12.5px; }
.danger { color: var(--red) !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
::selection { background: var(--klein-soft); }

/* ---------- buttons ---------- */
.primary, .secondary, .small-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border-radius: 10px; font-weight: 550; white-space: nowrap;
  transition: background-color .15s, border-color .15s, transform .1s;
}
.primary { background: var(--primary-bg); color: var(--primary-fg); padding: 9px 16px; font-size: 13.5px; }
.primary:hover { background: color-mix(in srgb, var(--primary-bg) 86%, var(--klein)); text-decoration: none; }
.primary:active, .secondary:active, .small-button:active, .send:active { transform: scale(.97); }
.secondary { background: var(--sheet); border: 1px solid var(--line-strong); color: var(--ink); padding: 8px 14px; font-size: 13.5px; }
.secondary:hover { background: var(--raised); text-decoration: none; }
.small-button { background: var(--raised); color: var(--ink); padding: 5px 11px; font-size: 12.5px; border-radius: 8px; }
.small-button:hover { background: var(--hover); text-decoration: none; }
.btn-icon, .secondary svg.ico, .primary svg.ico { width: 16px; height: 16px; flex-shrink: 0; }
.secondary .btn-icon { color: var(--klein); }
.large { width: 100%; padding: 13px 18px; font-size: 14.5px; border-radius: 12px; }
.primary.large { background: var(--klein); color: var(--klein-ink); }
.primary.large:hover { background: var(--klein-hover); }
.icon-button { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; color: var(--muted); }
.icon-button svg { width: 18px; height: 18px; }
.icon-button:hover { background: var(--hover); color: var(--ink); }
.text-button { color: var(--klein); padding: 6px 0; font-size: 13px; font-weight: 550; }
.text-button:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- forms ---------- */
label { display: block; font-size: 13px; font-weight: 550; color: var(--ink-2); margin-bottom: 14px; }
input, select, textarea.field {
  display: block; width: 100%; min-width: 0; margin-top: 6px;
  background: var(--raised); color: var(--ink); border: 1px solid transparent; border-radius: 10px;
  padding: 10px 12px; font-size: 14px; font-weight: 400;
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
input:hover, select:hover, textarea.field:hover { border-color: var(--line-strong); }
input:focus, select:focus, textarea.field:focus { outline: none; background: var(--sheet); border-color: var(--klein); box-shadow: 0 0 0 3px var(--klein-soft); }
input[readonly] { color: var(--muted); }
input[type="file"] { padding: 9px; font-size: 13px; }
input::placeholder, textarea::placeholder { color: var(--muted); }
textarea.field { min-height: 104px; resize: vertical; line-height: 1.65; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.full { grid-column: 1 / -1; }
.input-check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 450; color: var(--ink); margin: 0; }
.input-check input { width: 16px; height: 16px; margin: 0; accent-color: var(--klein); }
.checks { display: flex; gap: 10px 18px; flex-wrap: wrap; margin: 4px 0 16px; }
.form-error { color: var(--red); font-size: 12.5px; margin-top: 10px; white-space: pre-wrap; }
.form-error:empty { display: none; }
.success-note { font-size: 12.5px; color: var(--green); margin-top: 10px; }

/* ---------- login ---------- */
.login-screen { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--sheet); }
.login-art {
  position: relative; overflow: hidden; background: #2236d4; color: #fff;
  display: flex; flex-direction: column; justify-content: space-between; padding: 40px 48px 44px; margin: 10px; border-radius: 24px;
}
.weave { position: absolute; inset: 0; width: 100%; height: 100%; }
.weave rect { fill: #fff; transform-box: fill-box; transform-origin: center; animation: weave-in .9s cubic-bezier(.2, .7, .2, 1) both; }
.weave .wv { fill: #a8b3ff; }
.weave .o0 { opacity: .035; } .weave .o1 { opacity: .06; } .weave .o2 { opacity: .11; } .weave .o3 { opacity: .22; } .weave .o4 { opacity: .42; }
.weave .wh { --sx: 0; --sy: 1; } .weave .wv { --sx: 1; --sy: 0; }
.weave .d0 { animation-delay: 0s; } .weave .d1 { animation-delay: .06s; } .weave .d2 { animation-delay: .12s; } .weave .d3 { animation-delay: .18s; } .weave .d4 { animation-delay: .24s; }
.weave .d5 { animation-delay: .3s; } .weave .d6 { animation-delay: .36s; } .weave .d7 { animation-delay: .42s; } .weave .d8 { animation-delay: .48s; } .weave .d9 { animation-delay: .54s; }
@keyframes weave-in { from { transform: scale(var(--sx), var(--sy)); } }
.login-art-top, .login-art-line, .login-art-foot { position: relative; }
.login-art-top { display: flex; align-items: center; gap: 12px; }
.login-art .mark { width: 36px; height: 36px; }
.wordmark { font-family: var(--display); font-size: 18px; font-weight: 650; letter-spacing: .04em; }
.wordmark em { font-style: normal; font-weight: 450; opacity: .7; letter-spacing: 0; margin-left: 4px; }
.login-art-line { font-family: var(--display); font-size: clamp(34px, 4.2vw, 56px); line-height: 1.18; font-weight: 650; letter-spacing: -.02em; max-width: 12em; }
.login-art-foot { font-size: 13.5px; opacity: .78; }
.login-side { display: grid; place-items: center; padding: 40px 32px; }
.login-box { width: min(100%, 360px); }
.login-box h1 { font-size: 28px; font-weight: 650; letter-spacing: -.02em; }
.login-box > p { color: var(--muted); margin: 6px 0 28px; }
#demo-entry .muted { margin-top: 10px; text-align: center; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; margin: 26px 0 20px; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.login-box form { display: grid; }
.login-box form button { margin-top: 6px; padding: 12px; border-radius: 12px; }
#login-error { color: var(--red); font-size: 13px; margin-top: 12px; }
#login-error:empty { display: none; }
#login-help { margin-top: 18px; line-height: 1.6; }
.login-links { display: flex; gap: 18px; margin-top: 8px; }

/* ---------- shell ---------- */
#app { display: grid; grid-template-columns: 244px minmax(0, 1fr); height: 100vh; min-height: 480px; padding: 10px 10px 10px 0; }
.sidebar { padding: 14px 12px 4px 14px; display: flex; flex-direction: column; overflow-y: auto; min-width: 0; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 0; margin-bottom: 22px; }
.brand img { border-radius: 8px; flex-shrink: 0; }
.brand strong { display: block; font-family: var(--display); font-size: 16px; font-weight: 650; letter-spacing: .08em; line-height: 1.2; }
.brand span { display: block; font-family: var(--display); font-size: 12px; color: var(--muted); line-height: 1.2; }
.nav {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 7px 10px; margin-bottom: 2px;
  border-radius: 10px; color: var(--ink-2); text-align: left; font-size: 13.5px; transition: background-color .15s, color .15s;
}
.nav .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav:hover { background: var(--hover); color: var(--ink); }
.nav.active { color: var(--ink); font-weight: 600; }
.nav.active:hover { background: transparent; }
.nav-symbol { width: 18px; height: 18px; flex-shrink: 0; color: var(--muted); }
.nav.active .nav-symbol { color: var(--klein); }
.nav .nav-tile { width: 22px; height: 22px; border-radius: 7px; font-size: 11px; }
.sidebar-section { display: flex; justify-content: space-between; align-items: center; margin: 20px 4px 6px 10px; color: var(--muted); font-size: 12px; min-height: 30px; }
.secondary-label { margin-top: 18px; }
.count { font-family: var(--display); font-size: 11.5px; font-weight: 600; min-width: 20px; padding: 0 6px; height: 20px; border-radius: 10px; display: inline-grid; place-items: center; background: var(--klein); color: var(--klein-ink); }
.count:empty { display: none; }
.profile { margin-top: auto; display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px; border-radius: 12px; text-align: left; transition: background-color .15s; }
.profile:hover { background: var(--hover); }
.profile-text { min-width: 0; flex: 1; }
.profile strong { display: block; font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile small { display: block; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-more { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; }

.avatar {
  width: 32px; height: 32px; border-radius: 10px; flex-shrink: 0; display: inline-grid; place-items: center;
  background: var(--raised); color: var(--ink-2); font-size: 13px; font-weight: 650; line-height: 1;
}
.avatar.xs { width: 18px; height: 18px; border-radius: 6px; font-size: 10px; }
.avatar.md { width: 38px; height: 38px; border-radius: 12px; font-size: 15px; }
.avatar.lg { width: 52px; height: 52px; border-radius: 16px; font-size: 21px; }
.t0 { background: var(--t0b); color: var(--t0f); } .t1 { background: var(--t1b); color: var(--t1f); } .t2 { background: var(--t2b); color: var(--t2f); }
.t3 { background: var(--t3b); color: var(--t3f); } .t4 { background: var(--t4b); color: var(--t4f); } .t5 { background: var(--t5b); color: var(--t5f); }

.mark .mark-bg { fill: var(--klein); }
.mark .mark-a { fill: #fff; }
.mark .mark-b { fill: #a8b3ff; }
@media (prefers-color-scheme: dark) { .mark .mark-bg { fill: #2236d4; } }
.mark-avatar { background: none; padding: 0; overflow: hidden; }
.mark-avatar .mark { width: 32px; height: 32px; display: block; }

.main {
  min-width: 0; display: flex; flex-direction: column; height: calc(100vh - 20px); min-height: 460px;
  background: var(--sheet); border-radius: var(--r-xl); box-shadow: var(--shadow-sheet); overflow: hidden;
}
.main-header { display: flex; justify-content: space-between; gap: 12px 16px; align-items: center; flex-wrap: wrap; padding: 16px 28px; border-bottom: 1px solid var(--line); }
.title-block { min-width: 0; }
.main-header p { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.header-actions .secondary { padding: 7px 13px; }
.status-pill { display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; border-radius: 999px; font-size: 12px; color: var(--ink-2); background: var(--raised); }
.status-pill:hover { background: var(--hover); }
.status-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 3px var(--amber-bg); }
.status-pill.connected::before { background: var(--green); box-shadow: 0 0 0 3px var(--green-bg); }
#view { padding: 28px; overflow: auto; flex: 1; min-height: 0; }

/* ---------- chat ---------- */
.chat-feed { max-width: 760px; margin: 0 auto; display: grid; gap: 22px; padding-bottom: 8px; }
.welcome { padding: clamp(12px, 6vh, 64px) 0 10px; display: grid; gap: 18px; justify-items: start; }
.welcome .mark { width: 52px; height: 52px; }
.welcome h3 { font-size: clamp(24px, 3vw, 32px); font-weight: 650; letter-spacing: -.025em; line-height: 1.2; }
.welcome p { color: var(--muted); font-size: 14.5px; margin-top: 6px; }
.starter { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 6px 0 12px; }
.starter button {
  display: grid; grid-template-columns: 36px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 12px; align-items: center;
  text-align: left; padding: 14px; background: var(--raised); border-radius: var(--r-lg); transition: background-color .15s;
}
.starter button:hover { background: var(--hover); }
.starter .ico { grid-row: 1 / 3; width: 36px; height: 36px; padding: 8px; border-radius: 11px; background: var(--sheet); color: var(--klein); box-shadow: 0 0 0 1px var(--line); }
.starter strong { font-size: 13.5px; font-weight: 600; }
.starter span { color: var(--muted); font-size: 12.5px; }

.message { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 12px; }
.message-content { min-width: 0; }
.message-header { display: flex; gap: 8px; align-items: center; margin: 4px 0 4px; font-size: 13px; flex-wrap: wrap; }
.message-header strong { font-weight: 650; }
.message-header time, .message-header .runtime-label { font-family: var(--display); font-size: 11.5px; color: var(--muted); }
.message-header .runtime-label { padding: 1px 7px; border-radius: 6px; background: var(--raised); }
.message-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.75; font-size: 14.5px; }
.message.human { grid-template-columns: 1fr; justify-items: end; }
.human .message-content { background: var(--raised); padding: 10px 16px 12px; border-radius: 18px 18px 6px 18px; max-width: 82%; }
.human .message-header { justify-content: flex-end; color: var(--muted); margin-top: 0; }
.human .message-header strong { font-weight: 550; }
.proactive-label { font-size: 11px; font-weight: 600; background: var(--amber-bg); color: var(--amber); border-radius: 6px; padding: 1px 7px; }
.sources { margin-top: 8px; font-size: 12.5px; color: var(--muted); padding-left: 10px; border-left: 2px solid var(--line-strong); }
.thinking { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 13px; padding-left: 3px; }
.thinking-dot { width: 18px; height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--klein) 0 30%, var(--klein-soft) 30%); background-size: 200% 100%; animation: thread-run 1.1s linear infinite; }
@keyframes thread-run { to { background-position: -200% 0; } }

/* task card + progress thread */
.task-card { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 16px 14px; margin-top: 12px; max-width: 560px; box-shadow: 0 1px 2px rgba(21, 22, 40, .04); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.task-card strong { font-size: 14.5px; font-weight: 650; min-width: 0; overflow-wrap: anywhere; }
.thread { display: flex; gap: 4px; margin: 14px 0 12px; }
.thread i { flex: 1; height: 5px; border-radius: 3px; background: var(--line); }
.thread i.done { background: var(--klein); }
.thread i.now { background: repeating-linear-gradient(-45deg, var(--klein) 0 4px, color-mix(in srgb, var(--klein) 35%, transparent) 4px 8px); }
.task-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; color: var(--muted); font-size: 12.5px; margin-bottom: 14px; }
.task-meta .who { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); font-weight: 550; }
.task-meta .steps-count, .task-meta .due { font-family: var(--display); }
.task-meta .due { margin-left: auto; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tag {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 999px; white-space: nowrap;
  background: var(--raised); color: var(--ink-2); font-size: 12px; font-weight: 550;
}
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.tag.plain { padding: 2px 9px; } .tag.plain::before { display: none; }
.tag.active, .tag.archiving { background: var(--klein-soft); color: var(--klein); } .tag.active::before, .tag.archiving::before { background: var(--klein); }
.tag.blocked, .tag.awaiting_resource, .tag.archive_failed { background: var(--amber-bg); color: var(--amber); } .tag.blocked::before, .tag.awaiting_resource::before, .tag.archive_failed::before { background: var(--amber); }
.tag.completed { background: var(--green-bg); color: var(--green); } .tag.completed::before { background: var(--green); }
.tag.cancelled { color: var(--muted); }
.block-note { color: var(--amber); background: var(--amber-bg); padding: 9px 12px; border-radius: 10px; font-size: 12.5px; margin: 0 0 12px; }

/* composer */
.composer { padding: 6px 28px 18px; flex-shrink: 0; }
.composer > div { max-width: 760px; margin-left: auto; margin-right: auto; }
.suggestions { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px !important; }
.suggestions:empty { display: none; }
.suggestions button { font-size: 12.5px; color: var(--ink-2); padding: 5px 12px; border-radius: 999px; background: var(--raised); transition: background-color .15s; }
.suggestions button:hover { background: var(--hover); color: var(--ink); }
.compose-box {
  display: flex; align-items: flex-end; gap: 10px; padding: 12px 12px 12px 16px;
  background: var(--sheet); border: 1px solid var(--line-strong); border-radius: 20px;
  box-shadow: 0 1px 2px rgba(21, 22, 40, .04), 0 10px 30px -16px rgba(21, 22, 40, .22); transition: border-color .15s, box-shadow .15s;
}
.compose-box:focus-within { border-color: var(--klein); box-shadow: 0 0 0 4px var(--klein-soft), 0 10px 30px -16px rgba(21, 22, 40, .22); }
.compose-box textarea { flex: 1; width: 100%; border: 0; resize: none; background: transparent; color: var(--ink); line-height: 1.6; padding: 4px 0; min-height: 50px; font-size: 14.5px; }
.compose-box textarea:focus { outline: none; }
.send { width: 38px; height: 38px; flex-shrink: 0; border-radius: 12px; display: grid; place-items: center; background: var(--klein); color: var(--klein-ink); transition: background-color .15s, transform .1s; }
.send:hover { background: var(--klein-hover); }
.send svg { width: 20px; height: 20px; stroke-width: 2; }
.compose-foot { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 11.5px; margin-top: 8px !important; padding: 0 6px; }
.mention-picker { display: flex; gap: 6px; flex-wrap: wrap; padding: 8px; margin-bottom: 8px !important; background: var(--sheet); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-pop); }
.mention-picker button { font-size: 13px; padding: 5px 10px; border-radius: 8px; background: var(--raised); }
.mention-picker button:hover { background: var(--klein-soft); color: var(--klein); }

/* ---------- pages ---------- */
.page-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.page-toolbar p { font-size: 13px; color: var(--muted); }
.task-grid, .knowledge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.task-grid .task-card { margin: 0; max-width: none; }
.empty { padding: 72px 20px; display: grid; justify-items: center; gap: 14px; text-align: center; color: var(--muted); font-size: 13.5px; }
.empty .mark { width: 40px; height: 40px; opacity: .35; filter: grayscale(1); }
.knowledge-card { padding: 18px 18px 14px; border-radius: var(--r-lg); background: var(--raised); display: flex; flex-direction: column; }
.knowledge-card h4 { font-size: 15px; margin-bottom: 8px; }
.knowledge-card p { font-size: 13.5px; color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.7; flex: 1; }
.knowledge-card .meta { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; margin-top: 14px; font-size: 12px; color: var(--muted); font-family: var(--display); }
.knowledge-card .tag.plain { background: var(--sheet); }
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.person-card { padding: 16px; border: 1px solid var(--line); border-radius: var(--r-lg); }
.person-card .row { align-items: flex-start; margin-bottom: 12px; flex-wrap: nowrap; }
.person-id { display: flex; gap: 11px; align-items: center; min-width: 0; }
.person-card strong { font-size: 14.5px; font-weight: 650; }
.person-card p { font-size: 12.5px; color: var(--muted); }
.person-card .avail { display: flex; align-items: center; gap: 7px; color: var(--ink-2); }
.person-card .avail::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.person-card .avail.off::before { background: var(--muted); }
.person-card .skills { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 12px; }
.person-card .skills .tag { padding: 2px 9px; font-size: 11.5px; }
.person-card .skills .tag::before { display: none; }
.settings-grid { max-width: 820px; display: grid; gap: 14px; }
.settings-panel { padding: 22px; border: 1px solid var(--line); border-radius: var(--r-lg); }
.settings-panel h3 { font-size: 16px; margin-bottom: 6px; }
.settings-panel > p { font-size: 13px; color: var(--muted); margin-bottom: 18px; max-width: 62ch; }
.settings-panel .actions { margin-top: 4px; }
.connector-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.connector-row strong { font-size: 13.5px; font-weight: 600; }
.connector-row span { font-size: 12px; color: var(--muted); background: var(--raised); padding: 2px 9px; border-radius: 999px; }
.table-scroll { overflow: auto; border: 1px solid var(--line); border-radius: var(--r-md); }
.data-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.data-table th, .data-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table th { font-weight: 550; color: var(--muted); background: var(--raised); }
.data-table td { font-family: var(--display); }

/* ---------- modal ---------- */
#modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; background: rgba(12, 14, 28, .38); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fade .18s ease-out; }
.modal { width: min(100%, 620px); max-height: 90vh; overflow: auto; background: var(--sheet); border-radius: var(--r-xl); box-shadow: var(--shadow-pop); animation: pop .22s cubic-bezier(.2, .8, .2, 1); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.985); } }
.modal-header { position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 20px 14px 24px; background: var(--sheet); }
.modal-header h3 { font-size: 18px; min-width: 0; overflow-wrap: anywhere; }
#modal-body { padding: 4px 24px 24px; }
#modal-body > .muted:first-child, #modal-body > p.muted { margin-bottom: 16px; line-height: 1.65; }
#modal-body > .row + .muted { margin-top: 12px; }
#modal-body .block-note { margin-top: 12px; }
.modal-footer { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.modal-links { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.section-title { font-size: 13px; color: var(--muted); font-weight: 600; margin: 22px 0 6px; }
details.muted { margin-top: 6px; }
details summary { cursor: pointer; color: var(--klein); font-weight: 550; width: max-content; }
details p { margin-top: 8px; padding: 10px 12px; background: var(--raised); border-radius: 10px; color: var(--ink-2); }

.step-list { display: grid; margin: 20px 0 8px; }
.step-row { position: relative; display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 12px; padding: 0 0 18px; }
.step-row:not(:last-child)::before { content: ""; position: absolute; left: 12px; top: 28px; bottom: 2px; width: 2px; border-radius: 1px; background: var(--line); }
.step-row.done:not(:last-child)::before { background: var(--klein); }
.step-index { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-family: var(--display); font-size: 12px; font-weight: 650; color: var(--muted); background: var(--sheet); box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.step-row.done .step-index { background: var(--klein); color: var(--klein-ink); box-shadow: none; }
.step-row.current .step-index { background: var(--klein-soft); color: var(--klein); box-shadow: inset 0 0 0 2px var(--klein), 0 0 0 4px var(--klein-soft); }
.step-row strong { font-size: 14px; font-weight: 600; line-height: 26px; }
.step-row.current strong { color: var(--klein); }
.step-row p { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.file-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.file-row .ico { width: 20px; height: 20px; color: var(--muted); flex-shrink: 0; }
.file-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.file-row small { display: block; color: var(--muted); font-size: 12px; }
#modal-body label:has(#task-file) { margin-top: 16px; }
.history-list { display: grid; gap: 8px; margin: 14px 0 0; padding: 12px 14px; font-size: 12.5px; color: var(--ink-2); background: var(--raised); border-radius: 12px; }
.history-list li { list-style: none; }
.profile-accounts { display: grid; gap: 6px; }
.account-choice { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-radius: 12px; text-align: left; background: var(--raised); transition: background-color .15s; }
.account-choice:hover { background: var(--klein-soft); color: var(--klein); }
.account-choice small { color: var(--muted); font-size: 12px; }
.experience { padding: 14px 16px; border-radius: 14px; background: var(--raised); margin-bottom: 10px; }
.experience p { white-space: pre-wrap; font-size: 13.5px; overflow-wrap: anywhere; }
.experience .row { margin-top: 10px; }
.experience button { font-size: 12px; }
#experience-form > .primary { margin-top: 2px; }

/* ---------- toast ---------- */
#toast {
  position: fixed; bottom: 24px; left: 50%; z-index: 200; max-width: min(90vw, 480px);
  padding: 10px 16px; border-radius: 12px; font-size: 13px; background: var(--primary-bg); color: var(--primary-fg);
  box-shadow: var(--shadow-pop); opacity: 0; pointer-events: none; transform: translate(-50%, 8px); transition: opacity .18s, transform .18s;
}
#toast.visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .login-screen { grid-template-columns: 1fr; }
  .login-art { min-height: 300px; padding: 28px 28px 30px; }
  .login-art-line { font-size: clamp(28px, 7vw, 40px); }
  .login-side { padding: 32px 20px 48px; }
}
@media (max-width: 800px) {
  #app { grid-template-columns: 200px minmax(0, 1fr); }
  .main-header { padding: 14px 20px; }
  #view { padding: 22px 20px; }
  .composer { padding: 6px 16px 14px; }
  .starter { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  #app { grid-template-columns: 58px minmax(0, 1fr); padding: 6px 6px 6px 0; }
  .main { height: calc(100vh - 12px); border-radius: 16px; }
  .sidebar { padding: 10px 7px 2px; align-items: center; }
  .brand { padding: 2px 0 0; margin-bottom: 16px; justify-content: center; }
  .brand > div, .sidebar-section > span, .nav .label, .profile-text, .profile-more, .count { display: none; }
  .sidebar-section { margin: 10px 0 4px; justify-content: center; }
  .secondary-label { margin: 10px 0 0; border-top: 1px solid var(--line-strong); width: 24px; min-height: 0; }
  .secondary-nav { margin-top: 10px; }
  .nav { width: 42px; height: 42px; padding: 0; justify-content: center; }
  .nav .nav-tile { width: 26px; height: 26px; font-size: 12px; }
  .nav-symbol { width: 20px; height: 20px; }
  .profile { padding: 8px 0; justify-content: center; }
  .main-header { padding: 12px 14px; gap: 8px; }
  .main-header h2 { font-size: 16px; }
  .main-header p { font-size: 12px; }
  .header-actions { flex-wrap: wrap; gap: 6px; }
  .status-pill { font-size: 11px; }
  #view { padding: 18px 14px; }
  .composer { padding: 4px 8px 8px; }
  .compose-box { border-radius: 16px; padding: 8px 8px 8px 12px; }
  .compose-box textarea, input, select, textarea.field { font-size: 16px; }
  .compose-foot { font-size: 11px; }
  .fields { grid-template-columns: 1fr; }
  .chat-feed { gap: 18px; }
  .message { grid-template-columns: 26px minmax(0, 1fr); gap: 9px; }
  .message > .avatar, .mark-avatar .mark { width: 26px; height: 26px; font-size: 11px; border-radius: 8px; }
  .message-text { font-size: 14px; }
  .human .message-content { max-width: 94%; }
  .thinking { padding-left: 0; gap: 10px; }
  .task-grid, .knowledge-grid, .people-grid { grid-template-columns: 1fr; }
  .task-card { padding: 14px; }
  .task-meta .due { margin-left: 0; }
  #modal-backdrop { padding: 10px; align-items: end; }
  .modal { max-height: 88vh; border-radius: 20px; }
  .modal-header { padding: 16px 16px 12px 18px; }
  #modal-body { padding: 4px 18px 20px; }
  .login-art { margin: 6px; border-radius: 18px; min-height: 260px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* finished tasks: the final step reads as done, not current */
.step-row.current.done .step-index { background: var(--klein); color: var(--klein-ink); box-shadow: none; }
.step-row.current.done strong { color: var(--ink); }
.modal-footer:empty { display: none; }
.modal-footer:empty + .modal-links { border-top: 0; padding-top: 0; margin-top: 8px; }

/* ===================================================================
   Motion. One easing family: a soft spring for things that move into
   place, a calm ease-out for things that appear. Loops only exist where
   they carry meaning (thinking, live connection).
   =================================================================== */
:root { --spring: cubic-bezier(.34, 1.56, .64, 1); --out: cubic-bezier(.2, .8, .2, 1); }

/* sliding active plate in the sidebar */
.sidebar { position: relative; }
.sidebar > :not(.nav-highlight) { position: relative; z-index: 1; }
.nav-highlight {
  position: absolute; top: 0; left: 0; z-index: 0; border-radius: 10px; pointer-events: none; opacity: 0;
  background: var(--sheet); box-shadow: 0 1px 2px rgba(21, 22, 40, .06), 0 0 0 1px var(--line), 0 6px 16px -10px rgba(21, 22, 40, .25);
}
.nav-highlight.on { opacity: 1; }
.nav-highlight.ready { transition: transform .5s var(--spring), width .35s var(--out), height .35s var(--out), opacity .2s; }

/* icon parts */
.nav-symbol *, .profile-more * { transform-box: fill-box; transform-origin: center; transition: transform .45s var(--spring), opacity .2s; }
.nav:hover .nav-symbol { color: var(--ink); }
.nav.active .nav-symbol { color: var(--klein); }
.ic-chat .dot { fill: currentColor; stroke: none; opacity: 0; }
.nav.active .ic-chat .dot { opacity: 1; }
.nav:hover .ic-chat .dot { opacity: 1; animation: typing 1s ease-in-out infinite; }
.nav:hover .ic-chat .d2 { animation-delay: .14s; } .nav:hover .ic-chat .d3 { animation-delay: .28s; }
@keyframes typing { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-1.8px); } }
.ic-tasks .chk { stroke-dasharray: 1; stroke-dashoffset: 0; }
.nav:hover .ic-tasks .c1 { animation: draw .45s var(--out) both; }
.nav:hover .ic-tasks .c2 { animation: draw .45s .14s var(--out) both; }
.nav:hover .ic-tasks .pend { transform: scale(1.3); }
@keyframes draw { from { stroke-dashoffset: 1; } }
.ic-book .pg-l { transform-origin: 100% 50%; } .ic-book .pg-r { transform-origin: 0 50%; }
.nav:hover .ic-book .pg-l { transform: skewY(6deg) scaleX(.94); }
.nav:hover .ic-book .pg-r { transform: skewY(-6deg) scaleX(.94); }
.nav:hover .ic-people .front { transform: translateY(-1.2px); }
.nav:hover .ic-people .back { transform: translateX(1.6px); }
.ic-sliders circle { fill: currentColor; }
.nav:hover .ic-sliders .k1 { transform: translateX(-6px); }
.nav:hover .ic-sliders .k2 { transform: translateX(6px); }
.profile:hover .profile-more .up { transform: translateY(-1.6px); }
.profile:hover .profile-more .down { transform: translateY(1.6px); }
.spin svg { transition: transform .45s var(--spring); }
.spin:hover svg { transform: rotate(90deg); }
.twinkle { transition: transform .5s var(--spring); }
.secondary:hover .twinkle { transform: rotate(-18deg) scale(1.2); }

/* starter icons: each does its own verb on hover */
.starter .ico use { transform-box: view-box; transform-origin: 50% 50%; transition: transform .45s var(--spring); }
.starter button:nth-child(1):hover .ico use { transform: rotate(90deg); }
.starter button:nth-child(2):hover .ico use { animation: wave .8s ease-in-out; }
.starter button:nth-child(3):hover .ico use { animation: wiggle .6s ease-in-out; }
.starter button:nth-child(4):hover .ico use { transform: rotate(-16deg) scale(1.18); }
.starter button { transition: background-color .15s, transform .35s var(--spring); }
.starter button:hover { transform: translateY(-2px); }
.starter .ico { transition: box-shadow .2s; }
.starter button:hover .ico { box-shadow: 0 0 0 1px var(--klein-soft), 0 6px 14px -8px var(--klein); }
@keyframes wave { 25% { transform: skewY(-8deg); } 50% { transform: skewY(5deg); } 75% { transform: skewY(-3deg); } }
@keyframes wiggle { 25% { transform: rotate(-14deg); } 55% { transform: rotate(10deg); } 80% { transform: rotate(-4deg); } }

/* send: arrow launches, a new one rises into place */
.send { position: relative; overflow: hidden; }
.send > svg { grid-area: 1 / 1; transition: transform .35s var(--spring); }
.send .send-next { opacity: 0; }
.send:hover > svg:first-child { transform: translateY(-2px); }
.send.launch > svg:first-child { animation: fly-out .32s var(--out) forwards; }
.send.launch .send-next { opacity: 1; animation: fly-in .5s .1s var(--spring) both; }
@keyframes fly-out { to { transform: translateY(-30px); opacity: 0; } }
@keyframes fly-in { from { transform: translateY(30px); } }

/* new messages arrive once; refreshes don't replay them */
.message.enter { animation: msg-in .5s var(--out) both; }
.message.human.enter { animation-name: msg-in-human; transform-origin: 100% 100%; }
@keyframes msg-in { from { opacity: 0; transform: translateY(12px); } }
@keyframes msg-in-human { from { opacity: 0; transform: translate(10px, 8px) scale(.97); } }
.message.enter .task-card { animation: msg-in .55s .18s var(--out) both; }
.message.enter .thread i.done, .message.enter .thread i.now { transform-origin: 0 50%; animation: fill .6s var(--out) both; }
.message.enter .thread i:nth-child(1) { animation-delay: .4s; } .message.enter .thread i:nth-child(2) { animation-delay: .52s; }
.message.enter .thread i:nth-child(3) { animation-delay: .64s; } .message.enter .thread i:nth-child(4) { animation-delay: .76s; }
@keyframes fill { from { transform: scaleX(0); } }

/* switching pages */
#view.view-enter { animation: view-in .42s var(--out); }
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } }
.view-enter .starter button { animation: msg-in .5s var(--out) both; }
.view-enter .starter button:nth-child(1) { animation-delay: .12s; } .view-enter .starter button:nth-child(2) { animation-delay: .18s; }
.view-enter .starter button:nth-child(3) { animation-delay: .24s; } .view-enter .starter button:nth-child(4) { animation-delay: .3s; }
.view-enter .welcome .mark rect, .login-art-top .mark g rect { transform-box: fill-box; animation: bar-in .7s var(--spring) both; }
.view-enter .welcome .mark .mark-a rect, .login-art-top .mark g:first-of-type rect { transform-origin: 0 50%; --bx: 0; --by: 1; }
.view-enter .welcome .mark .mark-b rect, .login-art-top .mark g:last-of-type rect { transform-origin: 50% 0; --bx: 1; --by: 0; }
.view-enter .welcome .mark rect:nth-child(2), .login-art-top .mark g rect:nth-child(2) { animation-delay: .08s; }
.view-enter .welcome .mark rect:nth-child(3), .login-art-top .mark g rect:nth-child(3) { animation-delay: .16s; }
.view-enter .welcome .mark rect:nth-child(4), .login-art-top .mark g rect:nth-child(4) { animation-delay: .24s; }
.view-enter .welcome .mark rect.mark-bg { animation: none; }
@keyframes bar-in { from { transform: scale(var(--bx), var(--by)); } }

/* thinking: the mark weaves itself */
.weaving { width: 26px; height: 26px; flex-shrink: 0; }
.weaving .mark-bg { fill: var(--klein); }
@media (prefers-color-scheme: dark) { .weaving .mark-bg { fill: #2236d4; } }
.weaving rect:not(.mark-bg) { fill: #fff; transform-box: fill-box; transform-origin: center; animation: weave-pulse 1.6s ease-in-out infinite; }
.weaving .b2, .weaving .b4 { fill: #a8b3ff; }
.weaving .b1 { animation-delay: calc(var(--phase, 0ms) + 0ms); }
.weaving .b2 { animation-delay: calc(var(--phase, 0ms) + 400ms); }
.weaving .b3 { animation-delay: calc(var(--phase, 0ms) + 800ms); }
.weaving .b4 { animation-delay: calc(var(--phase, 0ms) + 1200ms); }
@keyframes weave-pulse { 0%, 55%, 100% { opacity: .35; transform: scale(.55); } 22% { opacity: 1; transform: scale(1); } }

/* live connection, badge, current step */
.status-pill.connected::before { animation: breathe 2.8s ease-in-out infinite; }
@keyframes breathe { 50% { box-shadow: 0 0 0 6px transparent; } }
.count.pop { animation: badge-pop .55s var(--spring); }
@keyframes badge-pop { from { transform: scale(.3); } }
.step-row.current:not(.done) .step-index { animation: ring 2.4s ease-in-out infinite; }
@keyframes ring { 50% { box-shadow: inset 0 0 0 2px var(--klein), 0 0 0 7px transparent; } }

/* login: one orchestrated entrance */
.login-art-line { animation: rise .8s .35s var(--out) both; }
.login-art-foot { animation: rise .8s .5s var(--out) both; }
.login-box { animation: rise .7s .2s var(--out) both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

/* cards answer the pointer, quietly */
.task-grid .task-card, .person-card { transition: border-color .2s, box-shadow .3s, transform .35s var(--spring); }
.task-grid .task-card:hover, .person-card:hover { border-color: var(--line-strong); transform: translateY(-2px); box-shadow: 0 12px 28px -18px rgba(21, 22, 40, .35); }
.knowledge-card { transition: background-color .2s, transform .35s var(--spring); }
.knowledge-card:hover { background: var(--hover); transform: translateY(-2px); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .send .send-next { display: none; }
}
.send:disabled { opacity: 1; }

/* about: site + author */
.about .about-site {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 14px; background: var(--raised); color: var(--ink);
  transition: background-color .2s;
}
.about .about-site:hover { background: var(--hover); text-decoration: none; }
.about-site .mark { width: 40px; height: 40px; flex-shrink: 0; }
.about-site > span { flex: 1; min-width: 0; }
.about-site strong { display: block; font-family: var(--display); font-size: 17px; font-weight: 650; letter-spacing: -.01em; }
.about-site small { display: block; font-size: 12px; color: var(--muted); }
.about .ext { width: 18px; height: 18px; flex-shrink: 0; color: var(--muted); transition: transform .4s var(--spring), color .2s; }
.about a:hover .ext { transform: translate(2px, -2px); color: var(--klein); }
.author { display: flex; align-items: center; gap: 18px; margin-top: 14px; padding: 4px 4px 0; }
.author img {
  width: 96px; height: 96px; flex-shrink: 0; border-radius: 22px; background: #000; display: block;
  transition: transform .5s var(--spring); transform-origin: 50% 90%;
}
.author:hover img { transform: rotate(-4deg) scale(1.03); }
.author-body { min-width: 0; }
.author-body small { display: block; font-size: 12px; color: var(--muted); }
.author-body strong { display: block; font-family: var(--display); font-size: 20px; font-weight: 650; letter-spacing: -.01em; margin: 1px 0 10px; }
.author-links { display: flex; flex-wrap: wrap; gap: 8px; }
.author-links a {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px 6px 11px; border-radius: 999px;
  background: var(--raised); color: var(--ink); font-size: 13px; font-weight: 550; font-family: var(--display); white-space: nowrap;
  transition: background-color .2s;
}
.author-links a:hover { background: var(--hover); text-decoration: none; }
.author-links .ico { width: 16px; height: 16px; }
.author-links .ext { width: 14px; height: 14px; }
.brand-x { width: 18px; height: 18px; border-radius: 5px; display: inline-grid; place-items: center; background: var(--ink); color: var(--sheet); font-size: 11px; font-weight: 700; line-height: 1; }
@media (max-width: 560px) {
  .author { flex-direction: column; align-items: flex-start; gap: 12px; }
  .author img { width: 80px; height: 80px; border-radius: 20px; }
}
