/* Blobworks — a crew of blobs. Dark first, warm light mode. */
:root {
  --bg: #f7f4ee;
  --bg-2: #efebe3;
  --card: #ffffff;
  --card-2: #f3f0ea;
  --line: #e6e1d8;
  --text: #17151c;
  --muted: #6f6a78;
  --faint: #a29dab;
  --chip: #ece8e0;
  --accent: #ff6b4a;
  --accent-2: #7c5cff;
  --accent-ink: #ffffff;
  --good: #1fb86a;
  --warn: #f2a100;
  --bad: #e5484d;
  --glass: rgba(255, 255, 255, 0.72);
  --shadow: 0 10px 30px rgba(40, 30, 20, 0.12), 0 2px 6px rgba(40, 30, 20, 0.06);
  --bubble-me: linear-gradient(135deg, #ff7a59, #ff5f8a);
  --radius: 22px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: 'Nunito', ui-rounded, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Fredoka', 'Nunito', ui-rounded, system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0b0b0d;
    --bg-2: #111114;
    --card: #19191d;
    --card-2: #222227;
    --line: #2a2a31;
    --text: #f4f3f7;
    --muted: #9b99a7;
    --faint: #66646f;
    --chip: #26262c;
    --glass: rgba(28, 28, 33, 0.72);
    --shadow: 0 12px 40px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #0b0b0d;
  --bg-2: #111114;
  --card: #19191d;
  --card-2: #222227;
  --line: #2a2a31;
  --text: #f4f3f7;
  --muted: #9b99a7;
  --faint: #66646f;
  --chip: #26262c;
  --glass: rgba(28, 28, 33, 0.72);
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; border-radius: 10px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Desktop: a phone-width column floating between doodle blobs */
#app {
  position: relative;
  height: 100%;
  max-width: 620px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
@media (min-width: 900px) {
  body::before, body::after {
    content: '';
    position: fixed;
    width: 420px; height: 420px;
    border-radius: 42% 58% 63% 37% / 41% 44% 56% 59%;
    filter: blur(70px);
    opacity: 0.22;
    z-index: -1;
    animation: drift 18s ease-in-out infinite alternate;
  }
  body::before { background: var(--accent); left: -120px; top: 10%; }
  body::after { background: var(--accent-2); right: -140px; bottom: 5%; animation-delay: -6s; }
  #app { box-shadow: 0 0 0 1px var(--line); }
  body { background: var(--bg-2); }
}
@keyframes drift { to { transform: translate(60px, -40px) rotate(40deg); } }

.view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.pad { padding: 0 16px; }

/* ---------- avatars ---------- */
.bw-av { display: block; overflow: visible; flex: none; }
.bw-av .body-wrap { transform-origin: 50% 90%; transform: rotate(var(--tilt)); }
.bw-av .body { transform-origin: 50% 90%; transform-box: view-box; }
.bw-av .eyes-inner { transform-box: fill-box; transform-origin: center; }
.bw-av.alive .eyes-inner { animation: blink 5.5s infinite; }
.bw-av.alive .bulb { animation: glow 1.6s ease-in-out infinite alternate; }
.bw-av.mood-think .body { animation: bob 0.9s ease-in-out infinite; }
.bw-av.mood-think .eyes { animation: look 2.4s ease-in-out infinite; }
.bw-av.mood-happy .body { animation: hop 0.6s ease-out 2; }
.bw-av.boing .body { animation: boing 0.55s cubic-bezier(.3,1.6,.5,1); }
@keyframes blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(0.1); } }
@keyframes bob { 50% { transform: translateY(-4px) scale(1.02, 0.98); } }
@keyframes look { 0%, 100% { transform: translateX(0); } 30% { transform: translateX(-4px); } 65% { transform: translateX(4px); } }
@keyframes hop { 40% { transform: translateY(-10px) scale(0.96, 1.05); } 80% { transform: translateY(0) scale(1.05, 0.95); } }
@keyframes boing { 0% { transform: scale(1); } 30% { transform: scale(1.18, 0.82); } 60% { transform: scale(0.9, 1.12); } 100% { transform: scale(1); } }
@keyframes glow { to { filter: drop-shadow(0 0 4px #ffe14d); } }
@media (prefers-reduced-motion: reduce) {
  .bw-av * { animation: none !important; }
  body::before, body::after { animation: none; }
}

/* ---------- top bar ---------- */
.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  padding: calc(var(--safe-top) + 12px) 16px 6px;
}
.topbar .left { display: flex; gap: 10px; align-items: center; }
.topbar .right { display: flex; gap: 10px; justify-content: flex-end; }
.round-btn {
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--card-2);
  display: grid; place-items: center;
  box-shadow: inset 0 0 0 1px var(--line);
  transition: transform .15s ease, background .2s;
  position: relative;
}
.round-btn:active { transform: scale(0.92); }
.round-btn svg { width: 22px; height: 22px; }
.round-btn.primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 45%, transparent); }
.me-btn {
  width: 46px; height: 46px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #fff; font-family: var(--display); font-weight: 600; font-size: 18px;
  display: grid; place-items: center;
  box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--line);
}
.hero-bot { display: flex; flex-direction: column; align-items: center; gap: 0; position: relative; margin-top: -6px; }
.hero-bot .glow {
  position: absolute; width: 120px; height: 120px; top: -10px; border-radius: 50%;
  filter: blur(34px); opacity: .55; z-index: 0; pointer-events: none;
}
.hero-bot button { position: relative; z-index: 1; }
.hero-bot .star {
  position: absolute; right: -4px; bottom: 6px; width: 24px; height: 24px; border-radius: 50%;
  background: #8a5a00; color: #ffc83d; display: grid; place-items: center; font-size: 13px;
  box-shadow: 0 0 0 3px var(--bg);
}
.hero-bot .name { font-family: var(--display); color: var(--muted); font-size: 15px; z-index: 1; margin-top: -2px; }
.badge {
  position: absolute; top: -2px; right: -2px; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 10px; background: var(--bad); color: #fff; font-size: 12px; font-weight: 800;
  display: grid; place-items: center; box-shadow: 0 0 0 2px var(--bg);
}

/* ---------- greeting / banners ---------- */
.greet { padding: 4px 16px 0; font-family: var(--display); font-size: 26px; font-weight: 600; letter-spacing: -0.01em; }
.greet small { display: block; font-family: var(--font); font-size: 14px; font-weight: 600; color: var(--muted); letter-spacing: 0; margin-top: 2px; }
.banner {
  margin: 12px 16px 0; padding: 12px 14px; border-radius: 18px;
  display: flex; align-items: center; gap: 12px;
  background: color-mix(in srgb, var(--warn) 16%, var(--card));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--warn) 35%, transparent);
  text-align: left; width: calc(100% - 32px);
}
.banner .emoji { font-size: 22px; animation: wiggle 1.4s ease-in-out infinite; }
.banner b { display: block; }
.banner span { color: var(--muted); font-size: 14px; }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-12deg); } 75% { transform: rotate(12deg); } }

/* ---------- chat list ---------- */
.section-head {
  display: flex; align-items: center; gap: 6px;
  padding: 22px 16px 6px; color: var(--muted); font-weight: 700; font-size: 15px;
  width: 100%; text-align: left;
}
.section-head svg { width: 16px; height: 16px; transition: transform .2s; }
.section-head.collapsed svg { transform: rotate(-90deg); }
.section-head .count { color: var(--faint); font-weight: 600; }
.row-wrap { position: relative; overflow: hidden; }
.row-actions {
  position: absolute; inset: 0 0 0 auto; display: flex; align-items: center; gap: 10px; padding-right: 14px;
}
.row-actions button {
  width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; color: #fff;
}
.row-actions .pin { background: #4a4a52; }
.row-actions .hide { background: var(--bad); }
.row-actions svg { width: 22px; height: 22px; }
.row {
  position: relative; z-index: 1; background: var(--bg);
  display: flex; gap: 14px; align-items: center; width: 100%;
  padding: 12px 16px; text-align: left;
  transition: transform .25s cubic-bezier(.2,.8,.2,1), background .15s;
  touch-action: pan-y;
}
.row:active { background: var(--bg-2); }
.row .av-slot { position: relative; width: 56px; height: 56px; display: grid; place-items: center; flex: none; }
.row .meta { flex: 1; min-width: 0; }
.row .line1 { display: flex; align-items: center; gap: 8px; min-width: 0; }
.row .title { font-weight: 700; font-size: 17.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 0; max-width: 62%; }
.row .time { margin-left: auto; color: var(--faint); font-size: 13.5px; white-space: nowrap; padding-left: 6px; }
.row .preview { color: var(--muted); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; gap: 6px; align-items: center; }
.row .preview svg { width: 16px; height: 16px; flex: none; opacity: .8; }
.row.unread .title { color: var(--text); }
.row.unread .preview { color: var(--text); font-weight: 600; }
.row .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); flex: none; }
.row .pinmark { color: var(--faint); width: 14px; height: 14px; flex: none; }
.role-tag {
  background: var(--chip); color: var(--muted); font-size: 13.5px; font-weight: 700;
  padding: 2px 10px; border-radius: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-width: 0; flex-shrink: 1;
}
.working { color: var(--accent); font-weight: 700; display: inline-flex; gap: 6px; align-items: center; }
.dots i { display: inline-block; width: 5px; height: 5px; margin: 0 1px; border-radius: 50%; background: currentColor; animation: dot 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.group-av { position: relative; width: 56px; height: 56px; }
.group-av > * { position: absolute; }
.group-av > :nth-child(1) { left: -2px; top: -2px; }
.group-av > :nth-child(2) { right: -2px; bottom: -2px; }
.group-av > :nth-child(3) { right: 6px; top: -6px; }

.empty { text-align: center; color: var(--muted); padding: 40px 24px; }
.empty .big { font-family: var(--display); font-size: 22px; color: var(--text); margin: 10px 0 4px; }
.empty .art { display: flex; justify-content: center; gap: 4px; }

/* ---------- tab bar ---------- */
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: max(6px, calc(var(--safe-bottom) - 24px));
  display: flex; gap: 4px; padding: 6px;
  background: var(--glass); backdrop-filter: blur(18px) saturate(1.6); -webkit-backdrop-filter: blur(18px) saturate(1.6);
  border-radius: 30px; box-shadow: var(--shadow), inset 0 0 0 1px var(--line);
  z-index: 20;
}
.tabbar button {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 7px 14px 5px; border-radius: 24px; color: var(--muted); font-size: 11.5px; font-weight: 800;
  transition: color .2s, background .2s;
}
.tabbar button svg { width: 23px; height: 23px; }
.tabbar button.on { color: var(--text); background: var(--card-2); }
.tabbar button.on svg { color: var(--accent); }
.tabbar .badge { top: 2px; right: 8px; }
.list-bottom-space { height: calc(var(--safe-bottom) + 110px); }

/* ---------- chat view ---------- */
.chat-head {
  display: flex; align-items: center; gap: 10px;
  padding: calc(var(--safe-top) + 10px) 12px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.chat-head .who { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; text-align: left; }
.chat-head .who .n { font-weight: 800; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head .who .s { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.icon-btn:active { background: var(--card-2); }
.icon-btn svg { width: 24px; height: 24px; }
.msgs { padding: 14px 14px 8px; display: flex; flex-direction: column; gap: 4px; }
.msg { display: flex; gap: 8px; align-items: flex-end; max-width: 100%; }
.msg.me { justify-content: flex-end; }
.msg .av-col { width: 34px; flex: none; }
.bubble {
  max-width: min(82%, 520px); padding: 10px 14px; border-radius: 20px;
  background: var(--card); box-shadow: inset 0 0 0 1px var(--line);
  overflow-wrap: anywhere; position: relative;
}
.msg.me .bubble { background: var(--bubble-me); color: #fff; box-shadow: none; border-bottom-right-radius: 6px; }
.msg.bot .bubble { border-bottom-left-radius: 6px; }
.msg.first { margin-top: 10px; }
.msg .sender { font-size: 12.5px; font-weight: 800; margin: 0 0 2px 2px; }
.bubble.err { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--bad) 50%, transparent); }
.bubble .errline { color: var(--bad); font-size: 14px; font-weight: 700; }
.bubble.quiet { background: transparent; box-shadow: none; border: 1.5px dashed var(--line); color: var(--muted); font-size: 14px; padding: 6px 12px; }
.trigger-tag { display: inline-flex; gap: 4px; align-items: center; font-size: 12px; font-weight: 800; color: var(--muted); margin-bottom: 4px; }
.md p { margin: 0 0 8px; }
.md p:last-child, .md ul:last-child, .md ol:last-child, .md pre:last-child { margin-bottom: 0; }
.md ul, .md ol { margin: 4px 0 8px; padding-left: 22px; }
.md li { margin: 2px 0; }
.md code { font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; font-size: .88em; background: var(--chip); padding: 1px 5px; border-radius: 6px; }
.msg.me .md code { background: rgba(255,255,255,.22); }
.md pre { background: var(--bg-2); padding: 10px 12px; border-radius: 12px; overflow-x: auto; margin: 6px 0 8px; box-shadow: inset 0 0 0 1px var(--line); }
.md pre code { background: none; padding: 0; font-size: 13px; }
.md h1, .md h2, .md h3, .md h4 { font-size: 1em; margin: 6px 0 4px; font-weight: 800; }
.md blockquote { margin: 4px 0; padding-left: 10px; border-left: 3px solid var(--line); color: var(--muted); }
.md a { word-break: break-all; }
.md table { border-collapse: collapse; font-size: 14px; display: block; overflow-x: auto; margin: 6px 0; }
.md th, .md td { border: 1px solid var(--line); padding: 4px 8px; text-align: left; }
.msg.me .md a { color: #fff; }

.steps { margin-top: 8px; }
.steps summary { list-style: none; cursor: pointer; font-size: 13px; font-weight: 800; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.steps summary::-webkit-details-marker { display: none; }
.steps ul { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.step { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); min-width: 0; }
.step .k { flex: none; font-weight: 800; color: var(--text); background: var(--chip); border-radius: 8px; padding: 1px 7px; font-size: 12px; }
.step .v { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.live-tool { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 13.5px; font-weight: 700; margin-top: 6px; }
.live-tool .spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.event { align-self: center; font-size: 13px; color: var(--muted); font-weight: 700; padding: 6px 12px; margin: 8px 0; background: var(--card-2); border-radius: 14px; text-align: center; max-width: 90%; }
.event.click { cursor: pointer; }

/* relay = a little postcard from another bot */
.postcard {
  align-self: center; width: min(92%, 460px); margin: 12px 0 6px;
  background: var(--card); border-radius: 18px; padding: 12px 14px 12px;
  box-shadow: var(--shadow), inset 0 0 0 1px var(--line);
  position: relative; transform: rotate(-0.6deg);
  background-image: repeating-linear-gradient(135deg, var(--accent) 0 8px, transparent 8px 16px, var(--accent-2) 16px 24px, transparent 24px 32px);
  background-size: 100% 5px; background-repeat: no-repeat; background-position: top;
}
.postcard .from { display: flex; gap: 8px; align-items: center; font-size: 13px; font-weight: 800; color: var(--muted); margin: 4px 0 6px; }
.postcard .from b { color: var(--text); }
.postcard .stamp { margin-left: auto; font-size: 18px; }

.approval {
  align-self: stretch; margin: 10px 0; padding: 14px; border-radius: 20px;
  background: color-mix(in srgb, var(--warn) 12%, var(--card));
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--warn) 55%, transparent);
  animation: pop .35s cubic-bezier(.3,1.5,.5,1);
}
.approval .h { display: flex; gap: 10px; align-items: center; font-weight: 800; }
.approval .h .tool { margin-left: auto; font-size: 12px; background: var(--chip); padding: 2px 8px; border-radius: 8px; }
.approval pre { margin: 10px 0; padding: 10px; background: var(--bg-2); border-radius: 12px; font-size: 12.5px; white-space: pre-wrap; word-break: break-all; max-height: 200px; overflow: auto; font-family: ui-monospace, Consolas, monospace; }
.approval .btns { display: flex; gap: 8px; flex-wrap: wrap; }
@keyframes pop { from { transform: scale(.9); opacity: 0; } }

.typing { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 14px; font-weight: 700; }

.composer {
  display: flex; gap: 8px; align-items: flex-end;
  padding: 8px 12px calc(var(--safe-bottom) + 10px);
  border-top: 1px solid var(--line); background: var(--bg);
}
.composer textarea {
  flex: 1; resize: none; max-height: 160px; min-height: 46px;
  padding: 11px 16px; border-radius: 23px; border: 0;
  background: var(--card-2); box-shadow: inset 0 0 0 1px var(--line); line-height: 1.4;
}
.composer textarea:focus { outline: none; box-shadow: inset 0 0 0 1.5px var(--accent-2); }
.send { width: 46px; height: 46px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; transition: transform .15s; }
.send:active { transform: scale(.9); }
.send:disabled { opacity: .4; }
.send.stop { background: var(--text); color: var(--bg); }
.send svg { width: 22px; height: 22px; }
.mention-bar { display: flex; gap: 6px; padding: 8px 12px 0; overflow-x: auto; }
.mention-bar button { display: flex; gap: 4px; align-items: center; padding: 3px 10px 3px 4px; border-radius: 16px; background: var(--chip); font-size: 13px; font-weight: 700; white-space: nowrap; }

/* ---------- generic UI ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: 16px; font-weight: 800;
  background: var(--card-2); box-shadow: inset 0 0 0 1px var(--line);
  transition: transform .12s, filter .2s;
}
.btn:active { transform: scale(.96); }
.btn.primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn.good { background: var(--good); color: #fff; box-shadow: none; }
.btn.bad { background: transparent; color: var(--bad); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--bad) 50%, transparent); }
.btn.ghost { background: transparent; box-shadow: none; color: var(--muted); }
.btn.sm { padding: 7px 12px; border-radius: 12px; font-size: 14px; }
.btn.block { width: 100%; }
.sheet-foot .btn:not(.block) { flex: none; white-space: nowrap; }
.btn:disabled { opacity: .5; }
.btn svg { width: 18px; height: 18px; }
.fun { background: linear-gradient(135deg, var(--accent-2), #ff5fa2 60%, var(--accent)); color: #fff; box-shadow: 0 6px 20px color-mix(in srgb, var(--accent-2) 35%, transparent); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label, .label { font-size: 13px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.input, .field input, .field textarea, .field select {
  width: 100%; padding: 12px 14px; border-radius: 14px; border: 0;
  background: var(--card-2); box-shadow: inset 0 0 0 1px var(--line);
}
.field textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
.input:focus, .field input:focus, .field textarea:focus, .field select:focus { outline: none; box-shadow: inset 0 0 0 1.5px var(--accent-2); }
.hint { font-size: 13px; color: var(--faint); }
.group { background: var(--card); border-radius: 20px; box-shadow: inset 0 0 0 1px var(--line); margin-bottom: 18px; overflow: hidden; }
.group .item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; width: 100%; text-align: left; }
.group .item + .item { border-top: 1px solid var(--line); }
.group .item .grow { flex: 1; min-width: 0; }
.group .item .sub { color: var(--muted); font-size: 14px; }
.group .item .val { color: var(--muted); }
.group-title { font-size: 14px; font-weight: 700; color: var(--muted); margin: 0 4px 8px; }
.chev { width: 18px; height: 18px; color: var(--faint); }

.switch { position: relative; width: 52px; height: 32px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 16px; background: var(--chip); transition: .2s; box-shadow: inset 0 0 0 1px var(--line); }
.switch span::after { content: ''; position: absolute; width: 26px; height: 26px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: .25s cubic-bezier(.3,1.4,.5,1); box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.switch input:checked + span { background: var(--good); box-shadow: none; }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent-2); outline-offset: 2px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 7px 13px; border-radius: 14px; background: var(--chip); font-weight: 700; font-size: 14px; box-shadow: inset 0 0 0 1px transparent; transition: .15s; }
.chip.on { background: color-mix(in srgb, var(--accent-2) 22%, var(--card)); box-shadow: inset 0 0 0 1.5px var(--accent-2); }
.seg { display: flex; background: var(--chip); border-radius: 14px; padding: 3px; gap: 2px; }
.seg button { flex: 1; padding: 8px 6px; border-radius: 11px; font-weight: 800; font-size: 14px; color: var(--muted); }
.seg button.on { background: var(--card); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.15); }

input[type='range'] { width: 100%; accent-color: var(--accent-2); }
.slider-row { display: grid; grid-template-columns: 76px 1fr 76px; gap: 10px; align-items: center; font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 10px; }
.slider-row span:last-child { text-align: right; }

/* ---------- sheets ---------- */
.sheet-back {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50;
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .2s ease;
}
.sheet {
  width: 100%; max-width: 620px; max-height: calc(100% - var(--safe-top) - 24px);
  background: var(--bg); border-radius: 30px 30px 0 0;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow);
  animation: up .32s cubic-bezier(.2,.9,.25,1.05);
}
.sheet.full { height: calc(100% - var(--safe-top) - 12px); }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 16px 16px 8px; }
.sheet-head h2 { margin: 0; font-family: var(--display); font-weight: 600; font-size: 22px; flex: 1; }
.sheet-body { padding: 8px 16px calc(var(--safe-bottom) + 24px); overflow-y: auto; flex: 1; min-height: 0; overscroll-behavior: contain; }
.sheet-foot { padding: 10px 16px calc(var(--safe-bottom) + 14px); border-top: 1px solid var(--line); display: flex; gap: 10px; }
.close-x { width: 44px; height: 44px; border-radius: 50%; background: var(--card-2); display: grid; place-items: center; box-shadow: inset 0 0 0 1px var(--line); }
.close-x svg { width: 20px; height: 20px; }
@keyframes up { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }
.menu {
  position: fixed; z-index: 60; min-width: 220px; padding: 6px;
  background: var(--glass); backdrop-filter: blur(20px) saturate(1.6); -webkit-backdrop-filter: blur(20px) saturate(1.6);
  border-radius: 22px; box-shadow: var(--shadow), inset 0 0 0 1px var(--line);
  animation: pop .2s cubic-bezier(.3,1.4,.5,1); transform-origin: top right;
}
.menu button { display: flex; gap: 12px; align-items: center; width: 100%; padding: 12px 14px; border-radius: 16px; font-size: 17px; font-weight: 600; text-align: left; }
.menu button:active, .menu button:hover { background: var(--card-2); }
.menu button.danger { color: var(--bad); }
.menu-back { position: fixed; inset: 0; z-index: 59; }

/* ---------- designer ---------- */
.stage {
  position: relative; height: 210px; margin: 0 -16px 14px; display: grid; place-items: center; overflow: hidden;
  background: radial-gradient(circle at 50% 60%, color-mix(in srgb, var(--c) 40%, transparent), transparent 62%);
}
.stage .floor { position: absolute; bottom: 30px; width: 120px; height: 16px; border-radius: 50%; background: rgba(0,0,0,.18); filter: blur(4px); }
.stage button.av { position: relative; z-index: 1; }
.stage .say {
  position: absolute; top: 18px; right: 18%; max-width: 46%; background: var(--card); padding: 8px 12px; border-radius: 16px 16px 16px 4px;
  font-weight: 700; font-size: 14px; box-shadow: var(--shadow); animation: pop .3s cubic-bezier(.3,1.5,.5,1);
}
.stage .tools { position: absolute; bottom: 10px; display: flex; gap: 8px; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { width: 36px; height: 36px; border-radius: 50%; box-shadow: inset 0 0 0 2px rgba(0,0,0,.08); transition: transform .15s; }
.swatch.on { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--text); transform: scale(1.08); }
.swatch.custom { background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); position: relative; overflow: hidden; }
.swatch.custom input { position: absolute; inset: -6px; opacity: 0; cursor: pointer; }
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; }
.pick { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px 6px; border-radius: 16px; background: var(--card-2); font-size: 12px; font-weight: 700; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.pick.on { box-shadow: inset 0 0 0 2px var(--accent-2); color: var(--text); background: color-mix(in srgb, var(--accent-2) 14%, var(--card)); }
.tabs { display: flex; gap: 4px; overflow-x: auto; margin: 0 -16px 16px; padding: 0 16px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { padding: 8px 14px; border-radius: 14px; font-weight: 800; font-size: 14px; color: var(--muted); white-space: nowrap; }
.tabs button.on { background: var(--text); color: var(--bg); }
.dream { display: flex; gap: 8px; margin-bottom: 18px; }
.dream textarea { flex: 1; min-height: 52px; resize: none; }
.sched { padding: 12px 14px; border-radius: 16px; background: var(--card-2); box-shadow: inset 0 0 0 1px var(--line); margin-bottom: 10px; }
.sched .top { display: flex; align-items: center; gap: 10px; }
.sched .when { font-weight: 800; }
.sched .next { font-size: 13px; color: var(--muted); }
.sched .p { font-size: 14px; color: var(--muted); margin-top: 6px; white-space: pre-wrap; }
.presets { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }

/* ---------- tasks ---------- */
.page-head { padding: calc(var(--safe-top) + 14px) 16px 6px; display: flex; align-items: center; gap: 10px; }
.page-head h1 { margin: 0; font-family: var(--display); font-weight: 600; font-size: 30px; flex: 1; letter-spacing: -0.01em; }
.filters { display: flex; gap: 6px; overflow-x: auto; padding: 8px 16px 4px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filters .chip { white-space: nowrap; }
.filters .chip .n { opacity: .6; margin-left: 4px; }
.task {
  display: flex; gap: 12px; align-items: flex-start; width: calc(100% - 32px); margin: 10px 16px 0;
  padding: 14px; border-radius: 20px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line); text-align: left;
  transition: transform .12s;
}
.task:active { transform: scale(.985); }
.task .grow { flex: 1; min-width: 0; }
.task .t { font-weight: 800; }
.task .d { color: var(--muted); font-size: 14px; margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.task .foot { display: flex; gap: 8px; align-items: center; margin-top: 8px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.task .id { font-weight: 800; color: var(--faint); }
.status { font-size: 12px; font-weight: 800; padding: 2px 9px; border-radius: 9px; text-transform: uppercase; letter-spacing: .03em; }
.status.todo { background: var(--chip); color: var(--muted); }
.status.doing { background: color-mix(in srgb, var(--accent-2) 22%, transparent); color: var(--accent-2); }
.status.blocked { background: color-mix(in srgb, var(--bad) 18%, transparent); color: var(--bad); }
.status.review { background: color-mix(in srgb, var(--warn) 22%, transparent); color: var(--warn); }
.status.done { background: color-mix(in srgb, var(--good) 20%, transparent); color: var(--good); }
.prio-high { color: var(--bad); font-weight: 800; }
.you-chip { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-family: var(--display); font-weight: 600; color: #fff; background: linear-gradient(135deg, var(--accent-2), var(--accent)); flex: none; font-size: 14px; }
.note { padding: 10px 12px; border-radius: 14px; background: var(--card-2); margin-bottom: 8px; font-size: 14.5px; }
.note .by { font-size: 12.5px; font-weight: 800; color: var(--muted); margin-bottom: 2px; }
.check { width: 26px; height: 26px; border-radius: 9px; box-shadow: inset 0 0 0 2px var(--line); flex: none; display: grid; place-items: center; margin-top: 1px; transition: .2s; }
.check.done { background: var(--good); box-shadow: none; color: #fff; }
.check svg { width: 16px; height: 16px; }

/* ---------- org chart ---------- */
.mission {
  margin: 8px 16px 0; padding: 14px 16px; border-radius: 20px; text-align: left; width: calc(100% - 32px);
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent-2) 18%, var(--card)), color-mix(in srgb, var(--accent) 14%, var(--card)));
  box-shadow: inset 0 0 0 1px var(--line);
}
.mission .label { margin-bottom: 4px; }
.mission p { margin: 0; font-weight: 700; }
.mission.empty { padding: 10px 16px; background: none; box-shadow: inset 0 0 0 1px var(--line); display: flex; align-items: center; gap: 10px; }
.mission.empty .label { margin: 0; flex: none; }
.mission.empty p { font-weight: 600; color: var(--muted); font-size: 13.5px; }
.org { padding: 16px 16px 0; }
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul { margin-left: 14px; padding-left: 14px; }
.tree li { position: relative; padding: 8px 0 0; }
.tree ul > li::before { content: ''; position: absolute; left: -14px; top: 0; bottom: 0; border-left: 1.5px solid var(--line); }
.tree ul > li:last-child::before { bottom: auto; height: 48px; }
.tree ul > li::after { content: ''; position: absolute; left: -14px; top: 48px; width: 12px; border-top: 1.5px solid var(--line); }
.org-card {
  position: relative; display: flex; align-items: center; gap: 12px; text-align: left;
  width: 100%; min-width: 0; padding: 10px 14px 10px 10px; border-radius: 16px;
  background: var(--card); box-shadow: var(--shadow), inset 0 0 0 1px var(--line);
  transition: transform .15s;
}
.org-card:active { transform: scale(.98); }
.org-card > :first-child { flex: none; }
.org-card .oc-body { min-width: 0; flex: 1; }
.org-card .n { font-weight: 800; display: flex; align-items: center; gap: 6px; min-width: 0; }
.org-card .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.org-card .n .lvl { flex: none; }
.org-card .r { color: var(--muted); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.org-card .st { font-size: 12px; font-weight: 800; margin-top: 3px; display: flex; align-items: center; gap: 8px; min-width: 0; }
.org-card .st .stt { white-space: nowrap; }
.org-card .st .oc-brain { color: var(--faint); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.org-card .st .bar { margin-left: auto; flex: none; }
.org-card.you { background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: #fff; }
.org-card.you .r { color: rgba(255,255,255,.8); }
.org-card .bar { height: 4px; background: var(--chip); border-radius: 2px; overflow: hidden; width: 44px; }
.org-card .bar i { display: block; height: 100%; background: var(--good); border-radius: 2px; }
.org-card .bar i.hot { background: var(--warn); }

/* ---------- activity ---------- */
.meter { margin-bottom: 14px; }
.meter .top { display: flex; justify-content: space-between; font-weight: 800; font-size: 14px; margin-bottom: 6px; }
.meter .top span:last-child { color: var(--muted); }
.meter .track { height: 12px; border-radius: 6px; background: var(--chip); overflow: hidden; }
.meter .track i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--good), var(--warn) 70%, var(--bad)); background-size: 300px 100%; }
.log { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; align-items: flex-start; }
.log .em { width: 26px; text-align: center; flex: none; }
.log .grow { flex: 1; min-width: 0; }
.log .when { color: var(--faint); font-size: 12.5px; white-space: nowrap; }
.log .sub { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.runcard { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 18px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line); margin-bottom: 10px; width: 100%; text-align: left; }
.runcard .grow { flex: 1; min-width: 0; }
.runcard .sub { color: var(--muted); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.stat { background: var(--card); border-radius: 18px; padding: 12px; box-shadow: inset 0 0 0 1px var(--line); }
.stat b { font-family: var(--display); font-size: 26px; font-weight: 600; display: block; }
.stat span { font-size: 12.5px; color: var(--muted); font-weight: 700; }

/* ---------- login ---------- */
.login { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; text-align: center; gap: 6px; }
.login h1 { font-family: var(--display); font-weight: 700; font-size: 38px; margin: 8px 0 0; letter-spacing: -0.02em; }
.login p { color: var(--muted); margin: 0 0 18px; }
.login form { width: min(340px, 100%); display: flex; flex-direction: column; gap: 10px; }
.login input { text-align: center; letter-spacing: .12em; font-weight: 800; font-size: 18px; text-transform: uppercase; }
.login .err { color: var(--bad); font-weight: 700; min-height: 22px; }
.login .crowd { display: flex; align-items: flex-end; gap: 0; }
.login .crowd > :nth-child(2) { margin: 0 -10px; z-index: 1; }

/* ---------- toasts & confetti ---------- */
#toasts { position: fixed; left: 50%; transform: translateX(-50%); top: calc(var(--safe-top) + 10px); z-index: 80; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 460px); pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: 20px;
  background: var(--glass); backdrop-filter: blur(20px) saturate(1.6); -webkit-backdrop-filter: blur(20px) saturate(1.6);
  box-shadow: var(--shadow), inset 0 0 0 1px var(--line); font-weight: 700; font-size: 14.5px;
  animation: drop .4s cubic-bezier(.3,1.5,.5,1); text-align: left; width: 100%;
}
.toast .tx { flex: 1; min-width: 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.toast.out { animation: rise .3s ease forwards; }
@keyframes drop { from { transform: translateY(-30px) scale(.9); opacity: 0; } }
@keyframes rise { to { transform: translateY(-30px); opacity: 0; } }
.confetti { position: fixed; top: -12px; width: 10px; height: 14px; z-index: 90; pointer-events: none; border-radius: 3px; animation: fall linear forwards; }
@keyframes fall { to { transform: translate(var(--dx), 105vh) rotate(var(--rot)); } }

.checkcard { align-self: center; width: min(92%, 460px); margin: 8px 0 2px; padding: 8px 12px; border-radius: 14px; background: var(--card-2); box-shadow: inset 0 0 0 1px var(--line); font-size: 13.5px; }
.checkcard summary { cursor: pointer; font-weight: 800; color: var(--muted); list-style: none; }
.checkcard summary::-webkit-details-marker { display: none; }
.checkcard pre { margin: 8px 0 0; white-space: pre-wrap; word-break: break-word; font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; max-height: 260px; overflow: auto; }
/* growth */
.fb { display: flex; gap: 2px; align-items: center; margin: 2px 0 0 6px; opacity: 0; transition: opacity .2s; }
.msg:hover .fb, .fb:focus-within, .fb:has(.on) { opacity: 1; }
@media (pointer: coarse) { .fb { opacity: .85; } }
.fb button { font-size: 15px; padding: 3px 7px; border-radius: 12px; filter: grayscale(.9); opacity: .65; transition: .15s; }
.fb button:active { transform: scale(.85); }
.fb button.on { filter: none; opacity: 1; background: var(--chip); }
.growthcard { border-style: dashed; }
.banner.idea { background: color-mix(in srgb, var(--accent-2) 14%, var(--card)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent-2) 35%, transparent); }
.proposal { align-self: stretch; margin: 10px 0; padding: 12px 14px; border-radius: 20px; background: color-mix(in srgb, var(--accent-2) 9%, var(--card)); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent-2) 40%, transparent); animation: pop .35s cubic-bezier(.3,1.5,.5,1); }
.proposal.approved { background: color-mix(in srgb, var(--good) 8%, var(--card)); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--good) 40%, transparent); }
.proposal.declined, .proposal.undone { opacity: .75; background: var(--card-2); box-shadow: inset 0 0 0 1px var(--line); }
.proposal .ph { display: flex; gap: 10px; align-items: center; }
.proposal .pt { font-weight: 800; }
.proposal .pdetail { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.proposal .pd { margin-top: 8px; padding: 9px 11px; border-radius: 12px; background: var(--bg-2); font-size: 14.5px; overflow-wrap: anywhere; }
.proposal .btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.proposal .pstamp { margin-top: 8px; font-weight: 800; font-size: 14px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.proposal-wrap { align-self: stretch; }
.lvl { display: inline-block; font-size: 12px; font-weight: 800; padding: 1px 7px; border-radius: 9px; background: color-mix(in srgb, var(--good) 18%, transparent); color: var(--good); margin-left: 4px; vertical-align: 1px; }
.growth-hero { display: flex; gap: 14px; align-items: center; padding: 14px; border-radius: 20px; margin-bottom: 16px; background: linear-gradient(135deg, color-mix(in srgb, var(--good) 14%, var(--card)), color-mix(in srgb, var(--accent-2) 12%, var(--card))); box-shadow: inset 0 0 0 1px var(--line); }
.growth-hero .gicon { font-size: 40px; line-height: 1; animation: bob 2.4s ease-in-out infinite; }
.growth-hero .gname { font-family: var(--display); font-weight: 600; font-size: 20px; margin-bottom: 6px; }
.growth-hero .bar { background: var(--chip); border-radius: 4px; overflow: hidden; }
.growth-hero .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--good), #7bdc6a); border-radius: 4px; }
/* sign-in + setup wizard */
.login { overflow-y: auto; padding-top: max(24px, var(--safe-top)); padding-bottom: max(24px, var(--safe-bottom)); }
.login input.plain { text-transform: none; letter-spacing: 0; font-weight: 600; font-size: 17px; text-align: left; }
.login.wizard { justify-content: flex-start; padding-top: calc(var(--safe-top) + 28px); }
.login.wizard > p { max-width: 480px; }
.meter-pw { height: 6px; border-radius: 3px; background: var(--chip); overflow: hidden; margin: -2px 0 2px; }
.meter-pw i { display: block; height: 100%; width: 0; border-radius: 3px; transition: width .25s, background .25s; }
.forgot { margin-top: 18px; max-width: 340px; color: var(--muted); font-size: 14px; text-align: left; }
.forgot summary { cursor: pointer; text-align: center; font-weight: 700; }
.forgot p { margin: 8px 0 0; }
.wiz-foot { display: flex; gap: 10px; width: min(480px, 100%); margin-top: 18px; justify-content: center; flex-wrap: wrap; }
.brain-list { width: min(520px, 100%); display: flex; flex-direction: column; gap: 10px; text-align: left; }
.brain { background: var(--card); border-radius: 20px; padding: 12px 14px; box-shadow: inset 0 0 0 1px var(--line); }
.brain.ok { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--good) 55%, transparent); }
.brain .bh { display: flex; gap: 12px; align-items: center; }
.brain .bi { font-size: 26px; }
.brain .bn { font-weight: 800; }
.brain .bs { font-size: 12.5px; font-weight: 800; padding: 3px 10px; border-radius: 10px; white-space: nowrap; background: var(--chip); color: var(--muted); }
.brain .bs.ok { background: color-mix(in srgb, var(--good) 20%, transparent); color: var(--good); }
.brain .bs.warn { background: color-mix(in srgb, var(--warn) 22%, transparent); color: var(--warn); }
.bsteps { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.bstep > span { font-size: 13.5px; color: var(--muted); font-weight: 700; }
.cmd { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.cmd code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; background: var(--bg-2); padding: 8px 10px; border-radius: 10px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; box-shadow: inset 0 0 0 1px var(--line); }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; width: min(560px, 100%); margin-top: 6px; }
.tpl-grid .tpl { width: auto; }

.mdot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); vertical-align: middle; }
.mdot.on { background: var(--good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 25%, transparent); }

/* templates */
.tpl-strip { display: flex; gap: 10px; overflow-x: auto; margin: 0 -16px 18px; padding: 4px 16px 6px; scrollbar-width: none; scroll-snap-type: x proximity; }
.tpl-strip::-webkit-scrollbar { display: none; }
.tpl {
  flex: none; width: 112px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 8px 10px;
  border-radius: 20px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line); scroll-snap-align: start; text-align: center;
  transition: transform .15s;
}
.tpl:active { transform: scale(.95); }
.tpl b { font-size: 13.5px; margin-top: 4px; line-height: 1.2; }
.tpl span { font-size: 11.5px; color: var(--muted); font-weight: 700; line-height: 1.2; }
.tpl.on { box-shadow: inset 0 0 0 2px var(--accent-2); background: color-mix(in srgb, var(--accent-2) 12%, var(--card)); }

/* attachments */
.attach-btn { width: 40px; height: 46px; display: grid; place-items: center; color: var(--muted); flex: none; }
.attach-btn svg { width: 22px; height: 22px; transform: rotate(40deg); }
.attach-btn:active { color: var(--accent); }
.att-bar { display: none; gap: 8px; padding: 8px 12px 0; overflow-x: auto; border-top: 1px solid var(--line); }
.att-chip { display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 4px; border-radius: 14px; background: var(--card-2); box-shadow: inset 0 0 0 1px var(--line); flex: none; max-width: 220px; }
.att-chip img, .att-chip .ext { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; flex: none; }
.att-chip .ext { display: grid; place-items: center; background: var(--chip); font-size: 11px; font-weight: 800; color: var(--muted); }
.att-chip .nm { font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-chip button { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--chip); flex: none; }
.att-chip button svg { width: 12px; height: 12px; }
.att-chip .spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; flex: none; margin-right: 4px; }
.att-grid { display: flex; flex-wrap: wrap; gap: 6px; margin: -2px -6px 6px; }
.att-grid:last-child { margin-bottom: -4px; }
.att-img { display: block; max-width: 220px; max-height: 260px; border-radius: 14px; object-fit: cover; }
.att-file { display: inline-flex; padding: 6px 10px; border-radius: 12px; background: rgba(255,255,255,.2); color: inherit; font-weight: 700; font-size: 14px; text-decoration: none; }

.search-box { display: flex; gap: 8px; padding: 0 0 12px; }
.hit { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); width: 100%; text-align: left; align-items: center; }
.hit .grow { flex: 1; min-width: 0; }
.hit .sub { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
mark { background: color-mix(in srgb, var(--warn) 40%, transparent); color: inherit; border-radius: 3px; padding: 0 2px; }
.kbd { font-family: ui-monospace, Consolas, monospace; background: var(--chip); padding: 2px 8px; border-radius: 8px; font-size: 14px; word-break: break-all; }
.rule { display: flex; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.rule code { flex: 1; font-size: 13px; word-break: break-all; }
.loading { flex: 1; display: grid; place-items: center; }

/* health, wake-ups, usage, voice */
.banner.warn { background: color-mix(in srgb, var(--bad) 12%, var(--card)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--bad) 40%, transparent); }
.issue { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.issue .dot { font-size: 16px; line-height: 1.4; }
.issue .sub, .log .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.daybars { display: flex; align-items: flex-end; gap: 4px; height: 54px; margin-bottom: 14px; }
.daybars i { flex: 1; min-width: 3px; border-radius: 4px 4px 2px 2px; background: linear-gradient(180deg, var(--accent), var(--accent-2)); opacity: .85; }
.usage-row { margin-bottom: 11px; }
.usage-row .top { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; font-weight: 700; }
.usage-row .top span:last-child { color: var(--muted); font-weight: 600; font-size: 13px; text-align: right; }
.usage-row .track { height: 8px; border-radius: 6px; background: var(--chip); overflow: hidden; margin-top: 5px; }
.usage-row .track i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.mic-btn { flex: none; width: 40px; height: 40px; border-radius: 50%; font-size: 18px; background: var(--chip); display: grid; place-items: center; transition: transform .15s, background .15s; }
.mic-btn.live { background: var(--bad); color: #fff; animation: pulse-mic 1.1s ease-in-out infinite; }
@keyframes pulse-mic { 50% { transform: scale(1.12); } }
.speak-btn { opacity: .55; font-size: 14px; padding: 2px 6px; border-radius: 10px; }
.speak-btn.on { opacity: 1; background: var(--chip); }
.group .item > svg { width: 22px; height: 22px; flex: none; }

/* =====================================================================
   QUIET style (the default): neutral greys, system font, flat controls, no wobble.
   Avatars keep their colour: they are the personality. Everything around them calms down.
   "Playful" (the original look) is the same app without data-style="quiet".
   ===================================================================== */
:root[data-style='quiet'] {
  --bg: #f6f6f4; --bg-2: #eeeeec; --card: #ffffff; --card-2: #f1f1ef; --line: #e3e3e0;
  --text: #161618; --muted: #6b6b73; --faint: #9a9aa2; --chip: #ebebe8;
  --accent: #3b6fe0; --accent-2: #3b6fe0; --accent-ink: #ffffff;
  --good: #2f9d63; --warn: #c98a14; --bad: #d4504c;
  --glass: rgba(246, 246, 244, 0.86);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  --bubble-me: #e9e9e6;
  --radius: 14px;
  --font: ui-sans-serif, -apple-system, 'SF Pro Text', 'Inter', system-ui, 'Segoe UI', Roboto, sans-serif;
  --display: ui-sans-serif, -apple-system, 'SF Pro Display', 'Inter', system-ui, 'Segoe UI', Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root[data-style='quiet']:not([data-theme='light']) {
    --bg: #111113; --bg-2: #161618; --card: #1a1a1d; --card-2: #212124; --line: #2a2a2e;
    --text: #ececee; --muted: #8e8e96; --faint: #5e5e66; --chip: #232327;
    --accent: #6c93f0; --accent-2: #6c93f0;
    --good: #43b57a; --warn: #d9a13a; --bad: #e0605c;
    --glass: rgba(17, 17, 19, 0.86);
    --shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    --bubble-me: #26262a;
  }
}
:root[data-style='quiet'][data-theme='dark'] {
  --bg: #111113; --bg-2: #161618; --card: #1a1a1d; --card-2: #212124; --line: #2a2a2e;
  --text: #ececee; --muted: #8e8e96; --faint: #5e5e66; --chip: #232327;
  --accent: #6c93f0; --accent-2: #6c93f0;
  --good: #43b57a; --warn: #d9a13a; --bad: #e0605c;
  --glass: rgba(17, 17, 19, 0.86);
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  --bubble-me: #26262a;
}

/* calm the page */
:root[data-style='quiet'] body::before, :root[data-style='quiet'] body::after { display: none; }
:root[data-style='quiet'] .hero-bot .glow { display: none; }
:root[data-style='quiet'] .banner .emoji { animation: none; filter: grayscale(1); opacity: .85; }
:root[data-style='quiet'] .growth-hero .gicon { animation: none; }

/* type */
:root[data-style='quiet'] .greet, :root[data-style='quiet'] .page-head h1, :root[data-style='quiet'] .sheet-head h2, :root[data-style='quiet'] .empty .big { font-weight: 700; letter-spacing: -0.02em; }
:root[data-style='quiet'] .greet { font-size: 24px; }
:root[data-style='quiet'] .hero-bot .name { font-weight: 500; font-size: 14px; }
:root[data-style='quiet'] .row .title { font-weight: 600; }
:root[data-style='quiet'] .field > label, :root[data-style='quiet'] .label { font-weight: 600; }
:root[data-style='quiet'] .section-head, :root[data-style='quiet'] .group-title { font-weight: 600; }

/* flat buttons: white on dark / black on light, like a calm app */
:root[data-style='quiet'] .btn { font-weight: 600; border-radius: 12px; }
:root[data-style='quiet'] .btn.primary, :root[data-style='quiet'] .fun { background: var(--text); color: var(--bg); box-shadow: none; }
:root[data-style='quiet'] .round-btn.primary { background: var(--card-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
:root[data-style='quiet'] .send { background: var(--text); color: var(--bg); }
:root[data-style='quiet'] .send.stop { background: var(--bad); color: #fff; }
:root[data-style='quiet'] .btn.sm { border-radius: 10px; }
:root[data-style='quiet'] .chip, :root[data-style='quiet'] .seg, :root[data-style='quiet'] .seg button { border-radius: 10px; font-weight: 600; }
:root[data-style='quiet'] .chip.on { background: var(--card-2); box-shadow: inset 0 0 0 1.5px var(--text); }
:root[data-style='quiet'] .seg button.on { box-shadow: none; background: var(--card-2); }
:root[data-style='quiet'] .pick.on { box-shadow: inset 0 0 0 1.5px var(--text); background: var(--card-2); }
:root[data-style='quiet'] .tabs button { font-weight: 600; border-radius: 10px; }
:root[data-style='quiet'] .switch input:checked + span { background: var(--text); }
:root[data-style='quiet'] .switch input:checked + span::after { background: var(--bg); }
:root[data-style='quiet'] .composer textarea { border-radius: 22px; background: var(--card-2); }
:root[data-style='quiet'] .composer textarea:focus, :root[data-style='quiet'] .field input:focus, :root[data-style='quiet'] .field textarea:focus, :root[data-style='quiet'] .field select:focus, :root[data-style='quiet'] .input:focus { box-shadow: inset 0 0 0 1.5px var(--muted); }
:root[data-style='quiet'] input[type='range'] { accent-color: var(--muted); }

/* surfaces: smaller radii, no floaty shadows, no tilt */
:root[data-style='quiet'] .group, :root[data-style='quiet'] .task, :root[data-style='quiet'] .mission, :root[data-style='quiet'] .proposal, :root[data-style='quiet'] .approval, :root[data-style='quiet'] .org-card, :root[data-style='quiet'] .growth-hero { border-radius: 14px; }
:root[data-style='quiet'] .sched, :root[data-style='quiet'] .banner, :root[data-style='quiet'] .runcard, :root[data-style='quiet'] .checkcard { border-radius: 12px; }
:root[data-style='quiet'] .sheet { border-radius: 20px 20px 0 0; }
:root[data-style='quiet'] .menu { border-radius: 14px; }
:root[data-style='quiet'] .menu button { border-radius: 10px; font-weight: 500; }
:root[data-style='quiet'] .tabbar { border-radius: 22px; box-shadow: inset 0 0 0 1px var(--line); }
:root[data-style='quiet'] .tabbar button { border-radius: 16px; font-weight: 600; }
:root[data-style='quiet'] .tabbar button.on svg { color: var(--text); }
:root[data-style='quiet'] .org-card { transform: none; box-shadow: inset 0 0 0 1px var(--line); }
:root[data-style='quiet'] .org-card:active { transform: scale(.98); }
:root[data-style='quiet'] .org-card .clip { display: none; }
:root[data-style='quiet'] .org-card.you { background: var(--card-2); color: var(--text); }
:root[data-style='quiet'] .org-card.you .r { color: var(--muted); }
:root[data-style='quiet'] .postcard { transform: none; background-image: none; box-shadow: inset 0 0 0 1px var(--line); border-radius: 12px; }
:root[data-style='quiet'] .mission, :root[data-style='quiet'] .growth-hero { background: var(--card); box-shadow: inset 0 0 0 1px var(--line); }
:root[data-style='quiet'] .growth-hero .bar i { background: var(--good); }
:root[data-style='quiet'] .daybars i { background: var(--muted); opacity: .6; }
:root[data-style='quiet'] .usage-row .track i { background: var(--text); opacity: .7; }
:root[data-style='quiet'] .stage { background: radial-gradient(circle at 50% 62%, color-mix(in srgb, var(--c) 16%, transparent), transparent 62%); }

/* you, the human: a plain initial, not a rainbow */
:root[data-style='quiet'] .me-btn, :root[data-style='quiet'] .you-chip { background: var(--card-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); font-weight: 600; }
:root[data-style='quiet'] .me-btn { box-shadow: inset 0 0 0 1px var(--line); }

/* banners: quiet cards, colour only where it means something */
:root[data-style='quiet'] .banner { background: var(--card-2); box-shadow: inset 0 0 0 1px var(--line); }
:root[data-style='quiet'] .banner.idea { background: var(--card-2); box-shadow: inset 0 0 0 1px var(--line); }
:root[data-style='quiet'] .banner.warn { background: color-mix(in srgb, var(--bad) 10%, var(--card)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--bad) 40%, transparent); }

/* chat: your messages in a soft grey bubble, bot replies as plain text */
:root[data-style='quiet'] .msg.me .bubble { background: var(--bubble-me); color: var(--text); border-radius: 18px; border-bottom-right-radius: 18px; }
:root[data-style='quiet'] .msg.me .md code { background: rgba(127,127,127,.2); }
:root[data-style='quiet'] .msg.me .md a { color: var(--accent); }
:root[data-style='quiet'] .msg.bot .bubble { background: transparent; box-shadow: none; padding: 2px 0; border-radius: 0; max-width: 100%; }
:root[data-style='quiet'] .msg.bot .bubble.err { padding: 8px 12px; border-radius: 12px; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--bad) 50%, transparent); }
:root[data-style='quiet'] .bubble.quiet { border: 0; padding: 2px 0; }
:root[data-style='quiet'] .view.chat.dm .msg .av-col { display: none; }
:root[data-style='quiet'] .view.chat.dm .msg.bot > div { max-width: 100% !important; }
:root[data-style='quiet'] .msg.first { margin-top: 14px; }
:root[data-style='quiet'] .event { background: transparent; font-weight: 600; }
:root[data-style='quiet'] .msgs { padding-left: 16px; padding-right: 16px; }

.mic-btn svg { width: 20px; height: 20px; }
.speak-btn svg { width: 16px; height: 16px; display: block; }
:root[data-style='quiet'] .ei { filter: grayscale(1); opacity: .75; }
:root[data-style='quiet'] .mic-btn.live { background: var(--bad); color: #fff; }

/* notebook */
.nb-entry { padding: 12px 14px; border-radius: 12px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line); margin-bottom: 8px; }
.nb-entry .top { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 13px; color: var(--muted); }
.nb-entry .top .grow { flex: 1; }
.nb-mood { font-size: 18px; line-height: 1; }
.nb-date { margin-top: 14px; }
.icon-btn.sm { width: 30px; height: 30px; }
.icon-btn.sm svg { width: 18px; height: 18px; }
.nb-moods { display: flex; gap: 8px; }
.nb-moods button { width: 46px; height: 46px; border-radius: 12px; font-size: 24px; background: var(--chip); }
.nb-moods button.on { box-shadow: inset 0 0 0 2px var(--text); background: var(--card-2); }
.quick-row { display: flex; gap: 8px; overflow-x: auto; padding: 8px 12px 0; scrollbar-width: none; }
.quick-row::-webkit-scrollbar { display: none; }
.quick-row button { flex: none; padding: 7px 13px; border-radius: 14px; background: var(--chip); font-weight: 600; font-size: 14px; color: var(--muted); white-space: nowrap; }
.quick-row button:active { background: var(--card-2); color: var(--text); }

a.btn { color: var(--text); text-decoration: none; }

/* projects */
.proj-tile { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; background: var(--card-2); box-shadow: inset 0 0 0 1px var(--line); font-size: 26px; flex: none; }
.proj-tile.new { font-size: 24px; color: var(--muted); background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); }
.proj-tile.sm { width: 36px; height: 36px; border-radius: 10px; font-size: 19px; }
.proj-card { display: block; width: 100%; text-align: left; padding: 14px 16px; border-radius: 14px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line); }
.proj-card .label { margin-bottom: 4px; }
.chat-head .who .proj-tile.sm { margin-right: 2px; }

/* ---------- side panel ---------- */
#side { position: fixed; z-index: 70; top: 0; bottom: 0; left: 0; width: min(320px, 86vw); display: flex; flex-direction: column; background: var(--bg); box-shadow: var(--shadow), inset -1px 0 0 var(--line); padding-top: var(--safe-top); padding-bottom: var(--safe-bottom); transform: translateX(-103%); transition: transform .26s cubic-bezier(.2,.8,.2,1); }
body.side-open #side { transform: none; }
#side-back { position: fixed; inset: 0; z-index: 69; background: rgba(0,0,0,.45); opacity: 0; pointer-events: none; transition: opacity .2s; }
body.side-open #side-back { opacity: 1; pointer-events: auto; }
.side-top { display: flex; align-items: center; gap: 8px; padding: 14px 12px 8px 14px; }
.side-brand { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; text-align: left; font-family: var(--display); font-weight: 700; font-size: 20px; letter-spacing: -0.02em; }
.side-x { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); }
.side-x svg { width: 20px; height: 20px; }
.side-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 8px 14px; }
.side-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 10px; border-radius: 12px; font-weight: 600; text-align: left; }
.side-row svg { width: 20px; height: 20px; flex: none; }
.side-row:hover, .side-item:hover, .side-nav:hover { background: var(--card-2); }
.side-sec { margin-top: 14px; }
.side-sec-head { display: flex; align-items: center; padding: 0 4px 0 6px; }
.side-sec-t { flex: 1; display: flex; align-items: center; gap: 6px; padding: 6px 4px; text-align: left; font-size: 13px; font-weight: 700; color: var(--muted); }
.side-sec-t svg { width: 14px; height: 14px; transition: transform .2s; }
.side-sec-t.collapsed svg { transform: rotate(-90deg); }
.side-sec-t .count { color: var(--faint); font-weight: 600; }
.side-mini { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); }
.side-mini svg { width: 16px; height: 16px; }
.side-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 10px; min-height: 40px; border-radius: 10px; text-align: left; }
.side-item.on, .side-prow.on { background: var(--card-2); }
.side-item .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.side-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.side-t small { display: block; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.side-ico { width: 26px; text-align: center; font-size: 17px; flex: none; }
.side-tile { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-size: 15px; flex: none; background: var(--card-2); box-shadow: inset 0 0 0 1px var(--line); }
.side-prow { display: flex; align-items: center; border-radius: 10px; }
.side-ptog { width: 24px; height: 36px; display: grid; place-items: center; color: var(--faint); flex: none; }
.side-ptog svg { width: 14px; height: 14px; transition: transform .2s; }
.side-ptog .open svg { transform: rotate(90deg); }
.side-item.grow { flex: 1; min-width: 0; padding-left: 4px; }
.side-kids { margin: 0 0 4px 22px; padding-left: 6px; border-left: 1px solid var(--line); }
.side-more { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 10px; border-radius: 8px; font-size: 13.5px; color: var(--muted); text-align: left; }
.side-more svg { width: 14px; height: 14px; }
.side-more:hover { background: var(--card-2); color: var(--text); }
.side-n { color: var(--faint); font-size: 12.5px; }
.side-empty { padding: 6px 12px; font-size: 13px; color: var(--faint); }
.side-foot { display: flex; gap: 2px; padding: 8px; border-top: 1px solid var(--line); }
.side-nav { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 2px 6px; border-radius: 12px; position: relative; font-size: 11.5px; font-weight: 700; color: var(--muted); }
.side-nav svg { width: 21px; height: 21px; }
.side-nav span:last-of-type { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-nav.on { color: var(--text); background: var(--card-2); }
.side-nav b { position: absolute; top: 1px; right: 8px; min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; display: grid; place-items: center; }
.side-me { width: 21px; height: 21px; border-radius: 50%; background: var(--card-2); box-shadow: inset 0 0 0 1px var(--line); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--text); }
@media (min-width: 900px) {
  body { display: flex; }
  #side { position: static; transform: none; width: 292px; flex: none; box-shadow: inset -1px 0 0 var(--line); transition: none; }
  #side-back { display: none; }
  #app { flex: 1 1 auto; width: 100%; max-width: 780px; margin: 0 auto; }
  .menu-btn, .side-x { display: none !important; }
  .tabbar { display: none; }
}
@media (max-width: 899px) { .menu-btn { display: grid; } }

.page-head .menu-btn { width: 42px; height: 42px; margin-right: 2px; }
.page-head .menu-btn svg { width: 20px; height: 20px; }
.side-row.on { background: var(--card-2); }
.side-row b { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--bad); color: #fff; font-size: 12px; display: grid; place-items: center; }
#nb-page .sheet-body { display: block; }

#nb-page { margin-top: 10px; }

.side-row-wrap { display: flex; align-items: center; gap: 2px; }
.side-row-wrap .side-row { flex: 1; min-width: 0; }
.side-row-wrap .side-mini { width: 38px; height: 38px; border-radius: 10px; flex: none; }

/* ---------- sharing: join, members, brains ---------- */
.or { display: flex; align-items: center; gap: 10px; margin: 14px 0 10px; color: var(--faint); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.gbtn { display: flex; align-items: center; justify-content: center; gap: 10px; background: #fff; color: #1f1f1f; font-weight: 700; text-decoration: none; border: 1px solid #dadce0; }
.fine { font-size: 12px; color: var(--faint); margin: 16px 6px 0; line-height: 1.5; text-align: left; }
.mrow { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; padding: 12px; border-radius: 14px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line); margin-bottom: 8px; }
.mrow .grow { min-width: 0; }
.mrow .n { font-weight: 800; }
.mrow .stt { font-size: 11.5px; font-weight: 800; margin-left: 6px; }
.mrow .sub { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mav { position: relative; flex: none; width: 42px; height: 42px; border-radius: 50%; background: var(--chip); display: grid; place-items: center; font-weight: 800; }
.mav .live { position: absolute; right: 0; bottom: 0; width: 11px; height: 11px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 2px var(--card); }
.gbtn, .gbtn span { color: #1f1f1f !important; }

/* ---------- the journal: cover, opening, first page ---------- */
.jempty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 28px 14px 0; }
.jlead { font-family: Georgia, 'Iowan Old Style', 'Palatino Linotype', serif; font-size: 22px; font-style: italic; margin: 6px 0 8px; }
.jsub { color: var(--muted); max-width: 31ch; line-height: 1.5; margin: 0 0 18px; font-size: 14.5px; }
.jscene { margin: 38px 0 10px; perspective: 1300px; padding: 0 0 26px; width: 100%; display: flex; justify-content: center; overflow: visible; }
.jbook { --bw: 208px; --bh: 290px; position: relative; width: var(--bw); height: var(--bh); cursor: pointer; transform-style: preserve-3d; transform-origin: left center; transition: transform 1.2s cubic-bezier(.5, .05, .2, 1); -webkit-tap-highlight-color: transparent; }
.jbook:focus-visible { outline: 2px solid var(--accent); outline-offset: 8px; }
.jbook::after { content: ''; position: absolute; left: 8px; right: -6px; bottom: -16px; height: 22px; background: radial-gradient(ellipse at center, rgba(0, 0, 0, .6), transparent 70%); filter: blur(7px); transform: translateZ(-3px); pointer-events: none; }
@media (hover: hover) { .jbook:not(.opening):hover { transform: rotateY(-7deg) rotateX(2deg); } }
.jbook.opening { transform: translateX(calc(var(--bw) / 2)) scale(.8); cursor: default; }
.jb-pages { position: absolute; inset: 3px 0 -5px 4px; border-radius: 3px 7px 7px 3px; background: repeating-linear-gradient(to bottom, #ebe4d2 0 2px, #cfc8b4 2px 3px); transform: translateZ(-1px); }
.jb-inside { position: absolute; inset: 6px 4px 4px 8px; border-radius: 2px 7px 7px 2px; background: linear-gradient(90deg, #d6cfba, #f1ebda 14%, #f4efe0); color: #2b2a26; padding: 28px 20px; overflow: hidden; text-align: left; }
.jb-hand { font-family: 'Segoe Script', 'Bradley Hand', 'Snell Roundhand', 'Brush Script MT', cursive; opacity: 0; transition: opacity .6s .7s; }
.jbook.opening .jb-hand { opacity: 1; }
.jb-hand small { display: block; font-size: 12px; opacity: .7; }
.jb-hand b { display: block; font-size: 30px; font-weight: 500; margin: 12px 0 14px; }
.jb-line { display: block; height: 2px; background: #2b2a26; width: 0; transition: width .9s 1s; opacity: .5; }
.jbook.opening .jb-line { width: 70%; }
.jb-cover { position: absolute; inset: 0; transform-origin: left center; transform-style: preserve-3d; transition: transform 1.15s cubic-bezier(.55, .05, .25, 1); }
.jbook.opening .jb-cover { transform: rotateY(-170deg); }
.jb-front, .jb-back { position: absolute; inset: 0; border-radius: 3px 11px 11px 3px; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.jb-front { background: radial-gradient(120% 90% at 30% 8%, #2a2a2f 0%, #121215 55%, #09090b 100%); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .07), inset 7px 0 11px rgba(0, 0, 0, .65), inset -2px 0 0 rgba(255, 255, 255, .04); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.jb-front::before { content: ''; position: absolute; left: 13px; top: 0; bottom: 0; width: 2px; background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, .08) 8%, rgba(255, 255, 255, .08) 92%, transparent); box-shadow: 3px 0 0 rgba(0, 0, 0, .55); }
.jb-front::after { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(115deg, rgba(255, 255, 255, .014) 0 2px, transparent 2px 5px); pointer-events: none; }
.jb-band { position: absolute; right: 30px; top: -2px; bottom: -2px; width: 12px; background: linear-gradient(90deg, #303036, #1a1a1e); box-shadow: -1px 0 0 rgba(255, 255, 255, .06), 2px 0 7px rgba(0, 0, 0, .65); }
.jb-title { position: relative; text-align: center; color: #cdbf9b; font-family: Georgia, 'Iowan Old Style', 'Palatino Linotype', serif; line-height: 1.1; text-shadow: 0 1px 0 rgba(0, 0, 0, .85), 0 0 1px rgba(255, 235, 180, .25); margin-right: 22px; max-width: 120px; }
.jb-title small { display: block; font-size: 11px; letter-spacing: .38em; text-transform: uppercase; opacity: .75; margin-bottom: 10px; }
.jb-title b { display: block; font-size: 24px; font-weight: 600; letter-spacing: .02em; overflow-wrap: anywhere; }
.jb-title i { display: block; font-size: 17px; font-weight: 400; letter-spacing: .3em; text-transform: uppercase; margin-top: 9px; border-top: 1px solid rgba(205, 191, 155, .35); padding-top: 9px; font-style: normal; }
.jb-back { transform: rotateY(180deg); background: linear-gradient(90deg, #141416, #1d1d21 30%, #18181b); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .05); }
.jwelcome { padding: 6px 2px 0; }
.jwelcome.arrive { animation: jarrive .95s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes jarrive { from { opacity: 0; transform: translateY(16px) scale(.985); } to { opacity: 1; transform: none; } }
.jhello { font-family: Georgia, 'Iowan Old Style', 'Palatino Linotype', serif; font-size: 27px; font-style: italic; margin: 6px 4px 2px; }
.jhello-sub { color: var(--muted); margin: 0 4px 14px; font-size: 14px; }
.jpage { position: relative; border-radius: 6px 14px 14px 6px; padding: 18px 18px 12px 28px; margin-bottom: 12px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line), 0 10px 24px rgba(0, 0, 0, .22); overflow: hidden; }
.jpage::before { content: ''; position: absolute; left: 15px; top: 0; bottom: 0; width: 1px; background: rgba(229, 72, 77, .35); }
.jdate { font-family: Georgia, 'Iowan Old Style', 'Palatino Linotype', serif; font-style: italic; color: var(--muted); font-size: 13px; }
.jdear { font-family: 'Segoe Script', 'Bradley Hand', 'Snell Roundhand', cursive; font-size: 22px; margin: 10px 0 4px; }
.jtext { display: block; width: 100%; min-height: 196px; border: 0; outline: 0; resize: none; background: repeating-linear-gradient(to bottom, transparent 0 31px, var(--line) 31px 32px); background-attachment: local; color: var(--text); font: inherit; font-size: 16px; line-height: 32px; padding: 0; }
.jtext::placeholder { color: var(--faint); }
.jmoods { display: flex; gap: 6px; margin-top: 8px; }
.jstart { margin: 0 0 12px; }
.jlinks { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
@media (prefers-reduced-motion: reduce) { .jbook, .jb-cover { transition-duration: .01s; } .jwelcome.arrive { animation: none; } }

/* ---------- the notebook: talking, and days filed into the book ---------- */
.tk-intro, .tk-sess { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 12px 14px; border-radius: 14px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line); margin-bottom: 10px; }
.tk-sess { background: color-mix(in srgb, var(--accent) 10%, var(--card)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent); }
.tk-intro > div, .tk-sess > div { min-width: 0; flex: 1; }
.tk-intro b, .tk-sess b { display: block; }
.tk-intro span, .tk-sess span { display: block; color: var(--muted); font-size: 13px; line-height: 1.4; margin-top: 2px; }
.tk-intro .btn, .tk-sess .btn { flex: none; }
.tk-list { max-height: 50vh; min-height: 160px; overflow-y: auto; padding: 4px 2px 8px; display: flex; flex-direction: column; gap: 6px; overscroll-behavior: contain; }
.tk-list .msg { margin: 0; }
.tk-day { display: flex; align-items: center; gap: 8px; margin: 10px 0 4px; font-size: 12px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; }
.tk-day::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.tk-day em { order: 3; font-style: normal; text-transform: none; letter-spacing: 0; font-weight: 600; color: var(--muted); }
.tk-day em + ::after { display: none; }
.tk-compose { display: flex; gap: 8px; align-items: flex-end; margin-top: 8px; }
.tk-compose textarea { flex: 1; min-height: 44px; max-height: 140px; resize: none; border-radius: 14px; padding: 11px 14px; font-size: 16px; line-height: 1.35; background: var(--card); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); border: 0; outline: none; }
.tk-compose textarea:focus { box-shadow: inset 0 0 0 1.5px var(--faint); }
.tk-compose .btn { width: 44px; height: 44px; padding: 0; display: grid; place-items: center; border-radius: 50%; flex: none; }
.tk-compose .btn svg { width: 20px; height: 20px; }
.tk-dots { display: inline-flex; gap: 4px; padding: 4px 2px; }
.tk-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); animation: tkdot 1.1s infinite ease-in-out; }
.tk-dots i:nth-child(2) { animation-delay: .15s; }
.tk-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes tkdot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.nb-today { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 9%, var(--card)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 28%, transparent); margin-bottom: 10px; font-size: 13.5px; }
.nb-today .btn { flex: none; }
.nb-auto { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 4px 4px 12px; font-size: 14px; }
.nb-auto small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.nb-entry.day { box-shadow: inset 3px 0 0 color-mix(in srgb, var(--accent) 55%, transparent), inset 0 0 0 1px var(--line); }
.nb-from { font-size: 12px; color: var(--muted); margin-left: 8px; }
.nb-actions { display: flex; gap: 6px; margin-top: 8px; }
.nb-chatlog:not(:empty) { margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: var(--bg); box-shadow: inset 0 0 0 1px var(--line); }
.tk-line { padding: 6px 0; font-size: 14px; }
.tk-line + .tk-line { border-top: 1px solid var(--line); }
.tk-line b { font-weight: 800; }
.tk-line span { color: var(--faint); font-size: 12px; }

/* ---------- the opening screen: Tockbot with your bots around it ---------- */
.hero { position: relative; width: 100%; max-width: 420px; height: 372px; margin: 6px auto 4px; }
.hero .hc { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 0 60px; z-index: 1; pointer-events: none; }
.hero .hc h1 { margin: 0; font-size: 36px; letter-spacing: -.01em; }
.hero .hc p { margin: 8px 0 0; color: var(--muted); font-size: 14.5px; line-height: 1.45; }
.hero .orbit { position: absolute; left: 50%; top: 50%; width: 0; height: 0; animation: horbit 90s linear infinite; }
.hero .hb { position: absolute; left: 0; top: 0; transform: translate(var(--x), var(--y)); }
.hero .hu { display: block; transform: translate(-50%, -50%); animation: hunrot 90s linear infinite; }
.hero .hu svg { display: block; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .35)); animation: hbob 3.8s ease-in-out infinite; animation-delay: var(--d, 0s); }
@keyframes horbit { to { transform: rotate(360deg); } }
@keyframes hunrot { from { transform: translate(-50%, -50%) rotate(0deg); } to { transform: translate(-50%, -50%) rotate(-360deg); } }
@keyframes hbob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
.loading.splash { display: flex; align-items: center; justify-content: center; min-height: 100dvh; }
.login .hero { margin-bottom: 0; }
@media (prefers-reduced-motion: reduce) { .hero .orbit, .hero .hu, .hero .hu svg { animation: none; } }

.loading.splash .hero .hc p { white-space: nowrap; }

.cn-steps { margin: 0 0 14px; padding-left: 20px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.cn-steps li { margin-bottom: 6px; }
.cn-steps b { color: var(--text); }
