:root {
  color-scheme: dark;
  --ink: #071015;
  --panel: rgba(12, 22, 28, 0.86);
  --line: rgba(232, 196, 154, 0.18);
  --text: #e7f1ef;
  --muted: #8ea4a6;
  --copper: #e4b07a;
  --copper-deep: #8c5a32;
  --signal: #7ddec8;
  --danger: #ff8b7a;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.38);
  --display: "Didot", "Bodoni 72", "Bodoni MT", "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body, #app { margin: 0; height: 100%; }
body {
  color: var(--text);
  background:
    radial-gradient(900px 420px at 8% -10%, rgba(228, 176, 122, 0.18), transparent 60%),
    radial-gradient(800px 480px at 110% 0%, rgba(125, 222, 200, 0.12), transparent 55%),
    var(--ink);
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.gate {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
  perspective: 1200px;
}
.card {
  width: min(440px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(20, 34, 40, 0.95), rgba(8, 14, 18, 0.92));
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transform: rotateX(6deg) translateZ(0);
  animation: lift 0.6s ease forwards;
}
@keyframes lift { to { transform: rotateX(0); } }
.mark {
  width: 46px; height: 46px; display: grid; place-items: center;
  border-radius: 16px;
  background: linear-gradient(160deg, var(--copper), var(--copper-deep));
  color: #1a1008; font-weight: 700;
  box-shadow: 0 10px 24px rgba(228, 176, 122, 0.28);
}
h1 { margin: 14px 0 6px; font-size: 32px; letter-spacing: -0.04em; }
.lede, .note { color: var(--muted); line-height: 1.45; }
label { display: grid; gap: 6px; margin: 12px 0; font-size: 13px; color: var(--muted); }
input, textarea {
  width: 100%; border: 1px solid rgba(255,255,255,0.08); border-radius: 14px;
  background: rgba(0,0,0,0.28); padding: 12px 14px; outline: none;
}
input:focus, textarea:focus { border-color: rgba(125, 222, 200, 0.7); }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.primary, .ghost, .danger {
  border: 0; border-radius: 999px; padding: 11px 16px;
}
.primary { background: linear-gradient(180deg, #f0c89a, var(--copper)); color: #24160c; font-weight: 700; }
.ghost { background: rgba(255,255,255,0.06); border: 1px solid var(--line); }
.danger { background: rgba(255, 139, 122, 0.16); color: var(--danger); }
.tabs { display: flex; gap: 8px; margin: 18px 0; }
.tabs button[aria-selected="true"] { background: rgba(125, 222, 200, 0.16); color: var(--signal); }

.shell {
  height: 100%;
  height: 100dvh;
  display: grid;
  grid-template-columns: var(--rail-w, 300px) 10px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0;
}
body.rail-slim .shell { grid-template-columns: 76px minmax(0, 1fr); }
body.rail-slim .stage { grid-column: 2; }
.identity { flex: 1; min-width: 0; display: grid; gap: 4px; }
.who-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.crest { display: flex; flex-wrap: nowrap; align-items: center; gap: 2px; }
.top-btn {
  position: relative; flex: 0 1 auto; border: 0; background: transparent; color: var(--muted);
  display: flex; justify-content: center; align-items: center; gap: 3px;
  padding: 3px 4px 6px; font-size: 10px; letter-spacing: 0.03em; text-transform: uppercase;
  white-space: nowrap;
}
.top-btn svg { width: 12px; height: 12px; }
.top-btn[aria-selected="true"] { color: var(--text); }
.top-btn[aria-selected="true"]::after {
  content: ""; position: absolute; left: 8px; right: 8px; bottom: 0; height: 2px; background: var(--signal);
}
.top-btn .count {
  min-width: 15px; height: 15px; padding: 0 3px; border-radius: 999px;
  background: var(--copper); color: #24160c; font-size: 9px; font-weight: 700; line-height: 15px;
}
.rail { grid-column: 1; grid-row: 1; }
.splitter { grid-column: 2; grid-row: 1; }
.stage { grid-column: 3; grid-row: 1; }
.dock {
  grid-column: 1 / -1; grid-row: 2;
  display: flex; flex-direction: column; align-items: flex-start;
  padding: 10px 20px calc(12px + env(safe-area-inset-bottom));
  background: transparent; border: 0;
  pointer-events: none;
}
.copyright { margin: 8px 4px 0; color: var(--muted); font-size: 12px; letter-spacing: 0.08em; }
.handles { display: flex; justify-content: center; gap: 12px; }
.handle {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid rgba(255, 253, 248, 0.7);
  background: transparent; color: #fffdf8;
  display: grid; place-items: center; padding: 0;
  font-size: 14px; line-height: 1;
}
.handle:hover, .handle:focus-visible { border-color: var(--signal); color: var(--signal); }
.handle-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; max-width: 360px; }
.handle-card {
  width: auto; min-width: 0; border: 0; background: transparent; color: inherit;
  display: grid; justify-items: center; gap: 6px; padding: 0;
}
.handle-card .handle { width: 56px; height: 56px; font-size: 18px; }
.integrate-page, .media-page { display: grid; gap: 14px; padding: 8px 16px 16px; align-content: start; }
.integrate-page { max-width: 520px; gap: 18px; }
.integrate-intro h2 { margin: 4px 0 0; font-family: var(--display); font-weight: 500; font-size: 40px; letter-spacing: -0.03em; line-height: 0.95; }
.device-grid { display: grid; gap: 8px; }
.device-card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 18px;
  border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03);
}
.device-card.here { border-color: rgba(125, 222, 200, 0.55); }
.device-mark {
  width: 40px; height: 40px; border-radius: 14px; flex: none;
  display: grid; place-items: center;
  background: #2a2622; color: #f4efe6; font-weight: 700;
}
.device-card strong { display: block; }
.device-card span { color: var(--muted); font-size: 13px; }
.link-panel {
  display: grid; gap: 8px; padding: 16px; border-radius: 22px;
  background: #2a2622; color: #f4efe6;
}
.link-panel h3 { margin: 0; font-size: 18px; }
.link-panel .note { color: #b7aea4; margin: 0; }
.link-panel .row { align-items: center; }
.link-panel input { flex: 1; min-width: 0; background: rgba(255, 253, 248, 0.06); color: #f4efe6; border-color: rgba(255, 253, 248, 0.14); }
.floor {
  pointer-events: auto;
  display: flex; justify-content: center; gap: 2px;
  width: max-content; max-width: calc(100% - 8px);
  padding: 8px 8px 6px;
  border: 1px solid rgba(255, 253, 248, 0.08);
  border-radius: 28px;
  background: #2a2622;
  color: #f4efe6;
  box-shadow: 0 18px 40px rgba(28, 22, 18, 0.28), inset 0 1px 0 rgba(255, 253, 248, 0.1);
}
.floor-btn {
  position: relative; flex: 0 0 auto; width: 72px; border: 0; background: transparent; color: #b7aea4;
  display: grid; justify-items: center; gap: 2px; padding: 6px 0 4px;
  border-radius: 18px;
  font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase;
}
.floor-btn svg { width: 18px; height: 18px; }
.floor-btn:hover, .floor-btn:focus-visible { color: #f6efe6; background: rgba(255, 253, 248, 0.05); }
.floor-btn[aria-selected="true"] { color: #f6efe6; background: rgba(255, 253, 248, 0.07); }
.floor-btn[aria-selected="true"]::after {
  content: ""; width: 18px; height: 2px; border-radius: 2px; background: #7ddec8;
}
.floor-btn .count {
  position: absolute; top: -2px; right: 12px;
  min-width: 15px; height: 15px; padding: 0 3px; border-radius: 999px;
  background: var(--copper); color: #24160c; font-size: 9px; font-weight: 700; line-height: 15px;
}
.desk { display: grid; gap: 10px; padding: 8px max(8px, env(safe-area-inset-right)) 12px max(8px, env(safe-area-inset-left)); }
.desk-media { display: grid; gap: 6px; }
.desk-media .handle { color: var(--text); border-color: var(--line); width: 44px; height: 44px; font-size: 16px; }
.desk-media .handle-card strong { font-size: 11px; font-weight: 600; line-height: 1.15; text-align: center; max-width: 100%; }
.desk-cats { display: flex; gap: 6px; flex-wrap: wrap; }
.desk-cats button {
  border-radius: 999px; border: 1px solid var(--line); background: transparent;
  padding: 6px 12px; color: var(--text);
}
.desk-cats button[aria-pressed="true"] { background: #2a2622; color: #f4efe6; border-color: transparent; }
.desk-group { display: grid; gap: 8px; }
.desk-group header { display: grid; gap: 2px; }
.desk-group .note { margin: 0; }
.desk-grid { display: grid; gap: 8px; }
.desk-row {
  display: grid; gap: 4px; padding: 12px; border-radius: 16px;
  border: 1px solid var(--line); background: rgba(255,255,255,0.03);
}
.desk-row span { color: var(--muted); font-size: 13px; }
.rail, .stage {
  min-width: 0;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: rgba(8, 16, 20, 0.78);
  overflow: hidden;
}
.stage {
  background:
    radial-gradient(720px 240px at 50% -8%, rgba(228, 176, 122, 0.16), transparent 62%),
    rgba(5, 12, 16, 0.55);
}
.splitter { cursor: col-resize; touch-action: none; position: relative; }
.splitter::before {
  content: "";
  position: absolute;
  top: 12px; bottom: 12px; left: 4px; width: 2px;
  border-radius: 2px;
  background: rgba(255,255,255,0.08);
}
.splitter:hover::before, .splitter:focus-visible::before { background: var(--copper); }
.rail { display: flex; flex-direction: column; }
.rail > .brand, .thread-head, .rail-tools { padding: 12px; }
.composer { padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); }
.rail > .brand, .thread-head { display: flex; gap: 10px; border-bottom: 1px solid rgba(255,255,255,0.06); }
.thread-head { align-items: center; }
.rail > .brand { align-items: flex-start; justify-content: flex-start; }
.who-row .update-app { margin-left: auto; flex: none; padding: 6px 10px; border-radius: 999px; font-size: 13px; }
.who-row .profile { margin-left: auto; }
.who-row .update-app + .profile { margin-left: 0; }
.brand strong, .thread-head strong { display: block; }
.grow { flex: 1; min-width: 0; }
.rail > .brand .grow strong, .thread-head .grow strong {
  display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sub { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-tools { display: flex; gap: 8px; align-items: center; }
.rail-tools input { flex: 1; min-width: 0; }
.new-chat { display: inline-flex; align-items: center; gap: 6px; flex: none; padding: 10px 12px; }
.new-chat svg, .icon-btn svg, .send-btn svg { width: 18px; height: 18px; display: block; }
#list, .thread { overflow: auto; }
#list { flex: 1; min-height: 0; padding: 6px; }
.chat {
  width: 100%; text-align: left; border: 0; border-radius: 0; border-left: 2px solid transparent;
  background: transparent; padding: 11px 12px; display: grid; grid-template-columns: 36px 1fr auto; gap: 10px;
}
.chat[aria-current="true"] { background: rgba(228, 176, 122, 0.08); border-left-color: var(--copper); }
.chat:hover { background: rgba(255,255,255,0.04); }
.avatar {
  width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center;
  background: linear-gradient(160deg, rgba(125,222,200,0.3), rgba(228,176,122,0.25));
  position: relative;
}
.pip { width: 10px; height: 10px; border-radius: 50%; background: #5b6b6d; position: absolute; right: -2px; bottom: -2px; border: 2px solid #102026; }
.pip.on { background: var(--signal); box-shadow: 0 0 10px var(--signal); }
.badge { min-width: 22px; height: 22px; border-radius: 999px; display: grid; place-items: center; background: var(--copper); color: #24160c; font-size: 12px; font-weight: 700; }

.stage { display: flex; flex-direction: column; position: relative; }
.update-top {
  position: absolute; top: 10px; right: 12px; z-index: 6;
  padding: 6px 12px; border-radius: 999px;
}
#thread-head { padding-right: 96px; }
#thread-search { margin: 10px 12px 0; width: auto; }
.thread { flex: 1; padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.empty { margin: auto; text-align: center; max-width: 460px; color: var(--muted); display: grid; gap: 12px; justify-items: center; padding: 24px 16px; }
.empty strong {
  color: var(--text);
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(40px, 5vw, 64px);
  letter-spacing: -0.03em;
  line-height: 0.92;
}
.empty p { margin: 0; max-width: 36ch; line-height: 1.45; }
.bubble {
  max-width: min(72%, 560px);
  padding: 12px 14px 8px;
  border-radius: 6px 22px 22px 22px;
  background: rgba(255, 253, 248, 0.04);
  border: 1px solid rgba(255, 253, 248, 0.08);
  animation: rise 0.22s ease;
}
.bubble p { margin: 0; line-height: 1.45; }
.bubble.mine {
  margin-left: auto;
  border-radius: 22px 6px 22px 22px;
  background: linear-gradient(180deg, rgba(228, 176, 122, 0.34), rgba(92, 54, 30, 0.55));
  border-color: rgba(228, 176, 122, 0.3);
}
.system { align-self: center; color: var(--muted); font-size: 13px; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.meta { display: flex; gap: 8px; color: var(--muted); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; margin-top: 8px; }
.quote { border-left: 2px solid var(--signal); padding-left: 8px; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.media { max-width: 100%; border-radius: 12px; display: block; margin-top: 6px; }
.actions { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; opacity: 0; }
.bubble:hover .actions, .bubble:focus-within .actions { opacity: 1; }
.actions button, .icon {
  border: 0; background: rgba(0,0,0,0.2); border-radius: 999px; padding: 4px 8px; font-size: 12px;
}
.composer {
  margin: 0 14px 14px;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  border: 1px solid rgba(255, 253, 248, 0.08);
  border-radius: 26px;
  display: flex; flex-direction: column; gap: 8px;
  background: #2a2622;
  color: #f4efe6;
  box-shadow: 0 18px 40px rgba(28, 22, 18, 0.28), inset 0 1px 0 rgba(255, 253, 248, 0.08);
}
.composer .icon-btn, .composer textarea { color: #f4efe6; }
.composer textarea::placeholder { color: #b7aea4; }
.compose-row {
  display: flex; gap: 4px; align-items: flex-end;
  padding: 4px; border-radius: 22px;
  background: transparent;
  border: 0;
}
.compose-row textarea { border: 0; background: transparent; border-radius: 16px; min-height: 40px; padding: 10px 8px; }
textarea { resize: none; min-height: 46px; max-height: 140px; }
.icon-btn, .send-btn {
  width: 40px; height: 40px; padding: 0; display: grid; place-items: center; flex: none;
  border-radius: 14px; border: 0; background: transparent; color: var(--text);
}
.icon-btn:hover, .icon-btn[aria-pressed="true"] { background: rgba(255,255,255,0.08); }
#voice.recording, #clip.recording { color: var(--danger); background: rgba(255, 139, 122, 0.16); }
.send-btn.primary { width: 40px; height: 40px; padding: 0; border-radius: 14px; }
.reply-bar, .warn, .assist, .bridges {
  display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap;
  padding: 8px 10px; border-radius: 14px; background: rgba(125,222,200,0.08);
}
.warn { background: rgba(228, 176, 122, 0.14); color: #f3ddc6; font-size: 13px; }
.assist, .bridges { align-items: stretch; flex-direction: column; }
.assist-note, .assist-out { margin: 0; color: var(--muted); font-size: 13px; }
.assist-out:empty { display: none; }
.head-actions { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.back { display: none; }
.quiet { color: var(--muted); }
.more { position: relative; }
.more summary { list-style: none; }
.more summary::-webkit-details-marker { display: none; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 6;
  min-width: 196px; padding: 6px;
  background: #102026; border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow);
}
.menu-item {
  width: 100%; text-align: left; background: transparent; border: 0;
  border-radius: 10px; padding: 10px 12px;
}
.menu-item:hover { background: rgba(255,255,255,0.06); }
.menu-label { margin: 6px 12px 2px; color: var(--muted); font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; }
.link-card {
  display: grid; grid-template-columns: 72px 1fr; gap: 8px; align-items: center;
  margin-top: 8px; padding: 6px; border-radius: 12px;
  background: rgba(0,0,0,0.22); color: inherit; text-decoration: none;
}
.link-card img { width: 72px; height: 54px; object-fit: cover; border-radius: 8px; }
.link-card:not(:has(img)) { grid-template-columns: 1fr; }
.link-copy { display: grid; min-width: 0; }
.link-card .site { color: var(--copper); font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; }
.link-card strong, .link-card .sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.rail-slim .rail-tools,
body.rail-slim .rail > .brand .grow,
body.rail-slim .profile,
body.rail-slim .crest span:not(.count),
body.rail-slim .chat strong,
body.rail-slim .chat .sub,
body.rail-slim .splitter { display: none; }
body.rail-slim .crest { flex-direction: column; align-items: center; }
body.rail-slim .rail > .brand { flex-direction: column; align-items: center; }
body.rail-slim .chat { grid-template-columns: 1fr; justify-items: center; padding: 8px 4px; position: relative; }
body.rail-slim .badge { position: absolute; top: 6px; right: 10px; min-width: 8px; width: 8px; height: 8px; padding: 0; font-size: 0; color: transparent; }

.call {
  position: fixed; inset: 16px; z-index: 20; border-radius: 28px; overflow: hidden;
  background: #05080b; box-shadow: var(--shadow); display: grid;
}
#remote, #local { width: 100%; height: 100%; object-fit: cover; background: #05080b; }
.call-grid { display: none; }
.call.meeting .call-grid {
  position: absolute; inset: 18px 18px 108px 18px; display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; align-content: start;
}
.call.meeting #remote { display: none; }
.call-grid .tile { position: relative; min-height: 160px; border-radius: 16px; overflow: hidden; background: #111; }
.call-grid video { width: 100%; height: 100%; object-fit: cover; }
.call-grid .note, .call-grid span {
  position: absolute; left: 10px; bottom: 10px; margin: 0; padding: 6px 10px; border-radius: 999px;
  background: rgba(0,0,0,0.55); color: #fffdf8;
}
.community {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin: 16px 8px 4px; padding-bottom: 6px; border-bottom: 1px solid var(--line);
}
.community strong { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }
.community .ghost { padding: 4px 8px; font-size: 12px; }
#local {
  position: absolute; width: 180px; height: 120px; right: 18px; bottom: 84px;
  border-radius: 18px; border: 1px solid var(--line); box-shadow: var(--shadow);
}
.call-bar {
  position: absolute; left: 16px; right: 16px; bottom: max(16px, env(safe-area-inset-bottom));
  display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 12px; border-radius: 18px; background: rgba(7,16,21,0.8);
}
.bubble a { color: var(--signal); }
dialog {
  width: min(480px, calc(100% - 24px)); border: 1px solid var(--line); border-radius: 24px;
  background: #0d181e; color: var(--text); padding: 18px; box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(0,0,0,0.55); }
.person { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.05); }
.update-bar {
  position: fixed; z-index: 40; left: 50%; top: 16px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px; max-width: calc(100% - 24px);
  padding: 8px 8px 8px 16px; border-radius: 999px;
  background: #2a2622; color: #f4efe6; box-shadow: var(--shadow);
}
.update-bar span { font-size: 14px; }
.update-bar button { padding: 8px 14px; }
.toast {
  position: fixed; left: 50%; bottom: 108px; transform: translateX(-50%);
  background: #10242a; border: 1px solid var(--line); padding: 10px 14px; border-radius: 999px;
  box-shadow: var(--shadow); z-index: 30;
}
body[data-tab="ai"] .composer,
body[data-tab="ai"] #thread-search { display: none; }
body[data-tab="ai"] #thread { display: flex; flex-direction: column; overflow: hidden; }
.ai-page { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; padding: 16px; }
.ai-log { flex: 1; min-height: 0; overflow: auto; display: grid; align-content: start; gap: 10px; }
.ai-turn { display: grid; gap: 6px; padding: 12px 14px; border-radius: 16px; border: 1px solid var(--line); }
.ai-turn.you { background: rgba(228, 176, 122, 0.12); }
.ai-turn.ai { background: rgba(215, 239, 232, 0.08); }
.ai-turn p { margin: 0; white-space: pre-wrap; }
.ai-sources { display: flex; flex-wrap: wrap; gap: 6px; }
.ai-sources a { font-size: 12px; color: var(--signal); }
.ai-ask { display: grid; gap: 8px; }
.ai-tools { display: flex; flex-wrap: wrap; gap: 8px; }
#ai-listen[aria-pressed="true"] { color: var(--danger); border-color: var(--danger); }
.ai-ask textarea { min-height: 72px; }
.ai-picks { display: flex; flex-wrap: wrap; gap: 6px; }
.ai-picks button {
  border-radius: 999px; border: 1px solid var(--line); background: transparent;
  padding: 4px 10px; font-size: 12px; color: inherit;
}
.ai-picks button[aria-pressed="true"] { border-color: var(--signal); color: var(--text); }
.ai-task {
  display: grid; gap: 2px; width: 100%; text-align: left; padding: 10px 12px; margin-bottom: 6px;
  border-radius: 16px; border: 1px solid var(--line); background: transparent; color: inherit;
}
.ai-task[aria-pressed="true"] { border-color: var(--signal); background: rgba(125, 222, 200, 0.1); }
.ai-task span { color: var(--muted); font-size: 12px; }

@media (max-width: 860px) {
  .shell, body.rail-slim .shell { grid-template-columns: minmax(0, 1fr); }
  .rail, .stage, body.rail-slim .stage { grid-column: 1; }
  body.chat-open .dock { display: none; }
  body.chat-open .toast { bottom: 18px; }
  .splitter { display: none; }
  .floor-btn { width: 54px; }
  .rail, .stage { min-height: 0; }
  body:not(.chat-open) .stage { display: none; }
  body[data-tab="ai"] .shell { grid-template-rows: auto minmax(0, 1fr) auto; }
  body[data-tab="ai"] .rail { display: flex; grid-row: 1; }
  body[data-tab="ai"] .rail > :not(.brand) { display: none; }
  body[data-tab="ai"] .stage { display: flex; grid-row: 2; }
  body[data-tab="ai"] .dock { grid-row: 3; }
  body.chat-open .shell { grid-template-columns: 1fr; }
  body.chat-open .rail { display: none; }
  .back { display: grid; }
  .icon-btn, .send-btn { width: 36px; height: 36px; }
  .bubble { max-width: 88%; }
  .bubble .actions { opacity: 1; }
  #local { width: 112px; height: 78px; }
}
@media (hover: none) {
  .bubble .actions { opacity: 1; }
}
body:not(.chat-open) .composer,
body:not(.chat-open) #thread-search { display: none; }
body.home {
  background:
    radial-gradient(700px 280px at 0% 0%, rgba(228, 176, 122, 0.28), transparent 60%),
    radial-gradient(600px 280px at 100% 0%, rgba(125, 222, 200, 0.18), transparent 55%),
    var(--ink);
  color: var(--text);
}
.home { max-width: 980px; margin: 0 auto; padding: 28px 20px 64px; }
.home-bar, .brand { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { justify-content: flex-start; font-size: 18px; }
.hero { margin: 28px 0 18px; }
.manifest {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(260px, 0.85fr);
  gap: 28px;
  align-items: end;
  margin: 36px 0 8px;
}
.brief {
  display: grid;
  gap: 12px;
  padding: 22px 22px 16px;
  border-radius: 28px;
  background: #f4efe6;
  color: #1c1612;
}
.brief .eyebrow { color: #8c5a32; }
.brief-q, .brief-a { margin: 0; }
.brief-q { color: #6b5f55; line-height: 1.45; }
.brief-a { font-size: clamp(22px, 3vw, 28px); letter-spacing: -0.03em; line-height: 1.25; }
.brief-tasks { display: flex; flex-wrap: wrap; gap: 6px; }
.brief-tasks span {
  border: 1px solid rgba(28, 22, 18, 0.16);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
}
.brief .note { color: #6b5f55; }
html[data-theme="day"] .brief { background: #1c1612; color: #f6efe6; }
html[data-theme="day"] .brief .eyebrow { color: #e4b07a; }
html[data-theme="day"] .brief-q,
html[data-theme="day"] .brief .note { color: #c8b8a4; }
html[data-theme="day"] .brief-tasks span { border-color: rgba(246, 239, 230, 0.22); color: #f6efe6; }
.campaign { display: grid; gap: 18px; margin: 36px 0 8px; }
.campaign-lead h2 {
  margin: 0 0 8px;
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(36px, 5vw, 58px);
  letter-spacing: -0.03em;
  line-height: 0.92;
}
.campaign-lead p { margin: 0; max-width: 36ch; color: var(--muted); }
.campaign-frame { position: relative; }
.campaign-rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: calc((100% - 42px) / 4);
  gap: 14px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding-bottom: 8px;
}
.campaign-rail::-webkit-scrollbar { display: none; }
.campaign-nav {
  position: absolute; top: 22%; z-index: 2;
  width: 36px; height: 36px; border: 0; border-radius: 50%;
  background: #f4efe6; color: #1c1612; font-size: 20px; line-height: 1;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
}
.campaign-nav.prev { left: -8px; }
.campaign-nav.next { right: -8px; }
.campaign-nav:disabled { opacity: 0.35; }
.story { scroll-snap-align: start; }
.story img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block;
  border-radius: 22px;
}
.story strong { display: block; margin-top: 10px; font-size: 18px; }
.story p { margin: 4px 0 0; color: var(--muted); line-height: 1.4; }
.pillars { display: grid; margin: 28px 0 8px; }
.pillar {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 8px 16px;
  padding: 22px 0;
  border-top: 1px solid var(--line);
}
.pillar .index { color: var(--copper); letter-spacing: 0.14em; font-size: 13px; padding-top: 10px; }
.pillar h2 { font-size: clamp(26px, 4vw, 36px); }
.pillar p { margin: 0; max-width: 62ch; color: var(--muted); line-height: 1.5; }
.welcome-handles {
  margin: 0 0 18px;
  padding: 18px 16px 14px;
  border-radius: 22px;
  background: #0c0c0e;
  border: 1px solid rgba(255, 253, 248, 0.14);
}
.welcome-handles .handles { justify-content: center; gap: 14px; flex-wrap: nowrap; }
.welcome-handles .handle { width: 48px; height: 48px; font-size: 16px; flex: none; }
.welcome-handles .note { margin: 10px 0 0; text-align: center; color: #b7aea4; font-size: 13px; }
.home h1, .brief-a, .pillar h2 {
  font-family: var(--display);
  font-weight: 500;
}
.home h1 { font-size: clamp(46px, 6vw, 76px); line-height: 0.9; letter-spacing: -0.03em; margin: 8px 0; }
.home h2 { margin: 0 0 8px; font-size: 28px; letter-spacing: -0.03em; }
.home .lede, .home .fine, body.home .note { color: var(--muted); }
.eyebrow { margin: 0; color: #8c5a32; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; font-size: 12px; }
.panel {
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 22px;
  margin: 14px 0;
  box-shadow: var(--shadow);
  color: var(--text);
}
.panel.split { display: grid; grid-template-columns: 1fr 220px; gap: 18px; align-items: center; }
.install-card { display: grid; grid-template-columns: 1fr 220px; gap: 12px; align-items: center; }
.step { display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: start; margin: 10px 0; }
.step p { margin: 0; }
.num {
  width: 28px; height: 28px; display: grid; place-items: center; border-radius: 999px;
  border: 1px solid rgba(28, 22, 18, 0.16); font-size: 13px;
}
.qr { min-height: 180px; display: grid; place-items: center; background: #fff; border-radius: 18px; padding: 8px; }
.qr svg { width: 180px; height: 180px; }
.art svg { width: 100%; height: auto; }
.textish { background: none; border: 0; padding: 8px 0; color: #8c5a32; text-decoration: underline; text-underline-offset: 3px; }
.fine { text-align: center; margin-top: 18px; }
.fine p { margin: 0; }
.fine .copyright { margin-top: 10px; text-align: right; }
.home.narrow { max-width: 520px; }
.devices p { margin: 2px 0; }
body.home .ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
body.home input, body.home textarea { background: color-mix(in srgb, var(--ink) 86%, white); color: var(--text); border-color: var(--line); }
@media (max-width: 720px) {
  .panel.split, .install-card, .manifest { grid-template-columns: 1fr; }
  .campaign-rail { grid-auto-columns: 78%; }
  .story { scroll-snap-align: start; }
  .pillar { grid-template-columns: 44px minmax(0, 1fr); }
}
.look { margin: 8px 0 18px; }
.swatches, .sso .row, .person .row { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch {
  width: 44px; height: 44px; border-radius: 16px; border: 2px solid transparent; padding: 0;
  box-shadow: inset 0 0 0 1px rgba(127,127,127,0.35);
}
.swatch[aria-pressed="true"] { border-color: var(--copper); }
.swatch.night { background: #071015; }
.swatch.day { background: #f4efe6; }
.swatch.dusk { background: #4a2c22; }
.swatch.sea { background: #0e4c52; }
.swatch.white { background: #fff; }
.list-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px 0; }
.list-title {
  margin: 0; flex: 1; min-width: 0; font-size: 13px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--muted); font-weight: 700;
}
.chips { display: flex; gap: 16px; overflow: auto; padding: 2px 14px 0; }
.chips button {
  border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted);
  border-radius: 0; padding: 8px 0; white-space: nowrap; font-size: 13px;
}
.chips button[aria-pressed="true"] { color: var(--text); border-bottom-color: var(--copper); background: transparent; }
.chat-row { display: flex; align-items: center; }
.chat-row .chat { flex: 1; min-width: 0; }
.chat-row > .icon-btn.on { color: var(--copper); }
.archive-row {
  width: 100%; display: flex; align-items: center; gap: 10px;
  border: 0; background: transparent; color: var(--muted); padding: 12px; text-align: left;
}
.archive-row svg { width: 18px; height: 18px; }
.tool-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tool {
  text-align: left; border-radius: 18px; padding: 14px;
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); display: grid; gap: 4px;
}
.tool span { color: var(--muted); font-size: 12px; line-height: 1.35; }
body:not([data-tab="chats"]) .list-head .icon-btn,
body:not([data-tab="chats"]) .list-head .plus { display: none; }
.set-page { display: grid; gap: 10px; padding: 4px 4px 18px; }
.you-card { display: flex; align-items: center; gap: 12px; padding: 4px 4px 8px; }
.set-card {
  border: 1px solid var(--line); border-radius: 22px; padding: 0 14px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
}
.set-card summary {
  list-style: none; display: flex; align-items: center; gap: 10px;
  padding: 14px 0; cursor: pointer; font-weight: 650;
}
.set-card summary::-webkit-details-marker { display: none; }
.set-card summary::after { content: "›"; margin-left: auto; color: var(--muted); font-weight: 400; }
.set-card[open] summary::after { content: "⌄"; }
.set-card .count {
  position: static; min-width: 18px; height: 18px; padding: 0 6px; border-radius: 999px;
  background: var(--signal); color: #04221e; font-size: 11px; font-weight: 700; line-height: 18px;
}
.set-body { display: grid; gap: 8px; padding: 0 0 14px; }
.switch { display: flex; align-items: center; gap: 8px; color: var(--text); }
.set-index { display: grid; gap: 4px; }
.set-index button {
  text-align: left; border: 0; background: transparent; color: var(--text);
  border-radius: 14px; padding: 12px;
}
.set-index button:hover { background: rgba(255, 255, 255, 0.04); }
body.settings-open .composer,
body.settings-open #thread-search { display: none; }
body.settings-open #thread { padding: 12px 18px 28px; }
body.settings-open #thread .set-page { max-width: 680px; }
.plus { position: relative; }
.plus summary { list-style: none; }
.plus summary::-webkit-details-marker { display: none; }
.plus .menu { top: calc(100% + 6px); right: 0; }
select { width: 100%; border-radius: 14px; padding: 12px 14px; background: rgba(0,0,0,0.28); border: 1px solid rgba(255,255,255,0.08); }
.note-pad, .update, .update-form { display: grid; gap: 8px; }
.update, .update-form { padding: 8px; }
body.note-open .composer, body.note-open #thread-search,
body.reel-open .composer, body.reel-open #thread-search { display: none; }
body.rail-slim .list-head,
body.rail-slim .chips,
body.rail-slim .chat-row > .icon-btn { display: none; }
.ghost[aria-pressed="true"] { border-color: var(--copper); color: var(--copper); }
html[data-texture="grain"] body {
  background-image:
    radial-gradient(rgba(255,255,255,0.2) 0.6px, transparent 0.7px),
    radial-gradient(900px 420px at 8% -10%, rgba(228, 176, 122, 0.18), transparent 60%),
    var(--ink);
  background-size: 4px 4px, auto, auto;
}
html[data-texture="linen"] body {
  background-image:
    repeating-linear-gradient(0deg, transparent 0 3px, rgba(127,127,127,0.16) 4px),
    repeating-linear-gradient(90deg, transparent 0 3px, rgba(127,127,127,0.16) 4px),
    var(--ink);
}
html[data-texture="grain"] .rail,
html[data-texture="grain"] .stage,
html[data-texture="linen"] .rail,
html[data-texture="linen"] .stage { background: color-mix(in srgb, var(--panel) 84%, transparent); }
html[data-theme="day"],
html[data-theme="white"] {
  color-scheme: light;
  --panel: rgba(255, 253, 248, 0.94);
  --line: rgba(28, 22, 18, 0.12);
  --text: #1c1612;
  --muted: #6b5f55;
  --copper: #8c5a32;
  --signal: #1d7a66;
  --danger: #9f2d22;
  --shadow: 0 18px 40px rgba(70, 46, 22, 0.08);
}
html[data-theme="day"] { --ink: #f4efe6; }
html[data-theme="white"] { --ink: #ffffff; --panel: #ffffff; }
html[data-theme="white"] body { background: #fff; }
html[data-theme="day"] .rail { background: rgba(255, 252, 247, 0.92); }
html[data-theme="white"] .rail { background: #fff; }
html[data-theme="day"] .device-card { background: #fffdf8; }
html[data-theme="white"] .device-card { background: #fff; }
html[data-theme="day"] .link-panel input,
html[data-theme="white"] .link-panel input { background: rgba(255, 253, 248, 0.06); color: #f4efe6; border-color: rgba(255, 253, 248, 0.14); }
html[data-theme="day"] .stage {
  background:
    radial-gradient(720px 240px at 50% -8%, rgba(228, 176, 122, 0.35), transparent 62%),
    #f7f1e8;
}
html[data-theme="white"] .stage { background: #fff; }
html[data-theme="day"] .composer,
html[data-theme="white"] .composer,
html[data-theme="day"] .composer textarea,
html[data-theme="white"] .composer textarea {
  background: #2a2622;
  color: #f4efe6;
  border-color: rgba(255, 253, 248, 0.08);
}
html[data-theme="day"] .composer .icon-btn,
html[data-theme="white"] .composer .icon-btn { color: #f4efe6; background: transparent; }
html[data-theme="day"] input,
html[data-theme="day"] textarea,
html[data-theme="day"] .compose-row,
html[data-theme="day"] .menu,
html[data-theme="day"] dialog { background: #fffdf8; color: var(--text); border-color: var(--line); }
html[data-theme="white"] input,
html[data-theme="white"] textarea,
html[data-theme="white"] .compose-row,
html[data-theme="white"] .menu,
html[data-theme="white"] dialog { background: #fff; color: var(--text); border-color: var(--line); }
html[data-theme="day"] .bubble,
html[data-theme="white"] .bubble { background: #fff; color: var(--text); }
html[data-theme="day"] .bubble.mine,
html[data-theme="white"] .bubble.mine { background: linear-gradient(180deg, #f6e6d4, #ecd4b4); }
html[data-theme="day"] .ghost, html[data-theme="day"] .icon-btn,
html[data-theme="white"] .ghost, html[data-theme="white"] .icon-btn { color: var(--text); }
html[data-theme="day"] .chat[aria-current="true"],
html[data-theme="day"] .chat:hover,
html[data-theme="day"] .icon-btn:hover,
html[data-theme="white"] .chat[aria-current="true"],
html[data-theme="white"] .chat:hover,
html[data-theme="white"] .icon-btn:hover { background: rgba(28, 22, 18, 0.06); }
html[data-theme="day"] .pip { border-color: #f4efe6; }
html[data-theme="white"] .pip { border-color: #fff; }
html[data-theme="white"] .brief { background: #1c1612; color: #f6efe6; }
html[data-theme="white"] .brief .eyebrow { color: #e4b07a; }
html[data-theme="white"] .brief-q,
html[data-theme="white"] .brief .note { color: #c8b8a4; }
html[data-theme="white"] .brief-tasks span { border-color: rgba(246, 239, 230, 0.22); color: #f6efe6; }
html[data-theme="dusk"] {
  --ink: #140e0c;
  --panel: rgba(42, 24, 18, 0.92);
  --text: #f6efe6;
  --muted: #c4aa96;
  --copper: #e7b089;
  --line: rgba(231, 176, 137, 0.24);
  --signal: #e7c7a4;
}
html[data-theme="dusk"] .rail { background: rgba(36, 20, 16, 0.94); }
html[data-theme="dusk"] .stage { background: rgba(18, 10, 8, 0.88); }
html[data-theme="sea"] {
  --ink: #061416;
  --panel: rgba(8, 36, 40, 0.92);
  --text: #e5f6f4;
  --muted: #8eb0ae;
  --copper: #8fd0c4;
  --copper-deep: #1d6b60;
  --line: rgba(143, 208, 196, 0.24);
  --signal: #9be7d4;
}
html[data-theme="sea"] .rail { background: rgba(7, 32, 36, 0.94); }
html[data-theme="sea"] .stage { background: rgba(4, 18, 20, 0.9); }
html[data-theme="sea"] .primary { color: #04221e; }
@media (max-width: 860px) {
  body.rail-slim .rail-tools,
  body.rail-slim .list-head,
  body.rail-slim .chips { display: flex; }
  body.rail-slim .rail > .brand .grow,
  body.rail-slim .chat strong,
  body.rail-slim .chat .sub,
  body.rail-slim .crest span:not(.count) { display: block; }
  body.rail-slim .profile,
  body.rail-slim .chat-row > .icon-btn { display: grid; }
  body.rail-slim .crest { flex-direction: row; align-items: center; }
  body.rail-slim .rail > .brand { flex-direction: row; align-items: flex-start; }
  body.rail-slim .chat { grid-template-columns: 36px 1fr auto; justify-items: stretch; padding: 11px 12px; position: static; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
