:root {
  color-scheme: light;
  --ink: #172727;
  --ink-soft: #394b4a;
  --subtle: #596765;
  --muted: #697875;
  --line: #dce5e1;
  --line-light: #e8eeea;
  --canvas: #f3f6f4;
  --paper: #fff;
  --nav: #132a2a;
  --nav-active: #294645;
  --nav-dim: #aec3bd;
  --accent: #246457;
  --accent-dark: #184a40;
  --accent-pale: #e7f1ed;
  --amber: #e3ad64;
  --danger: #983f35;
  --radius: 12px;
  --body: "Aptos", "Segoe UI", "Microsoft YaHei UI", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  --mono: "Cascadia Code", Consolas, monospace;
  font-family: var(--body);
  color: var(--ink);
  background: var(--canvas);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; font-size: 1rem; line-height: 1.55; }
button, input, textarea, select { font: inherit; }
button, select { cursor: pointer; }
button[disabled], select[disabled] { cursor: wait; opacity: .58; }
a { color: var(--accent-dark); text-underline-offset: .18em; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid #6a9a8c; outline-offset: 3px; }
img { max-width: 100%; }
[hidden] { display: none !important; }
::selection { color: var(--ink); background: #c9e6db; }
h1, h2, h3, p { margin: 0; }
h1, h2 { letter-spacing: -.035em; }
h1 { line-height: 1.16; font-weight: 735; font-size: clamp(1.75rem, 2.7vw, 2.45rem); }
h2 { line-height: 1.25; font-size: 1.18rem; }
h3 { line-height: 1.35; font-size: 1rem; }
small, .small { font-size: .84rem; }
sub { font-size: .75rem; }
.muted { color: var(--subtle); }
.meta { color: var(--subtle); font-size: .84rem; }
.mono { font-family: var(--mono); font-size: .82rem; overflow-wrap: anywhere; }
.spread, .row, .actions { display: flex; align-items: center; gap: .65rem; }
.spread { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grid { display: grid; gap: 1rem; }
.stack { display: grid; gap: .8rem; }
.grow { flex: 1 1 auto; min-width: 0; }
.line { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ico { flex: 0 0 auto; line-height: 1; font-size: 1.18em; }
.splash { display: grid; justify-items: center; align-content: center; gap: .9rem; min-height: 100dvh; color: var(--subtle); }
.brand-mark {
  display: grid; place-items: center; width: 2.18rem; height: 2.18rem; flex: 0 0 auto;
  background: #d0e3d9; color: #163634; font-size: 1.2rem; font-weight: 830;
  font-family: var(--mono); border-radius: .48rem; line-height: 1; box-shadow: inset 0 -3px #abc6b9;
}
.brand-word { font-size: 1.07rem; font-weight: 720; letter-spacing: -.025em; white-space: nowrap; }
.brand-word b { margin-right: .28rem; letter-spacing: .015em; font-weight: 840; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .43rem; flex: 0 0 auto;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink);
  text-decoration: none; font-size: .9rem; font-weight: 635; line-height: 1.28;
  min-height: 2.4rem; padding: .54rem .82rem; border-radius: .48rem; white-space: nowrap;
  transition: background .13s ease, border-color .13s ease;
}
.btn:hover { background: #f0f6f2; border-color: #bacdc4; }
.btn.primary { border-color: var(--accent); color: white; background: var(--accent); }
.btn.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--accent-pale); }
.btn.danger { color: var(--danger); }
.btn.icon { width: 2.45rem; padding: .4rem; }
.text-button {
  border: 0; padding: 0; background: none; color: var(--accent-dark); text-align: left;
  text-decoration: underline; text-underline-offset: .19em; font-size: .88rem; font-weight: 600;
}
.pill {
  display: inline-flex; width: max-content; align-items: center; gap: .24rem; font-size: .78rem;
  font-weight: 650; line-height: 1.3; padding: .17rem .48rem; border-radius: .3rem;
  color: #355345; background: #e9f0ec; white-space: nowrap; max-width: 100%;
}
.pill.warm { color: #664a24; background: #fbefdc; }
.pill.danger { color: #884036; background: #faeae5; }
.pill.quiet { color: #53615f; background: #edf1ef; font-weight: 520; }
.avatar {
  display: inline-grid; place-items: center; width: 2.25rem; height: 2.25rem; flex: 0 0 auto;
  border-radius: .48rem; font-size: .79rem; font-weight: 760; letter-spacing: .025em;
  background: #dcebe2; color: #285043; text-transform: uppercase;
}
.avatar.sm { width: 1.7rem; height: 1.7rem; font-size: .67rem; border-radius: .37rem; }
.avatar.lg { width: 2.8rem; height: 2.8rem; font-size: .94rem; }
.tone-1 { background: #e7edda; color: #4b5e32; }
.tone-2 { background: #efe2d3; color: #6d4c2c; }
.tone-3 { background: #e6e3ed; color: #514468; }
.tone-4 { background: #dce9ee; color: #365969; }
.tone-5 { background: #eee0e2; color: #704c51; }
.shell { min-height: 100dvh; display: grid; grid-template-columns: 244px minmax(0,1fr); }
.nav {
  background: var(--nav); color: #fff; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100dvh; min-height: 0; z-index: 4;
}
.brand { min-height: 4.5rem; display: flex; align-items: center; gap: .67rem; padding: .9rem 1.22rem; text-decoration: none; color: #fff; }
.nav-scroll { padding: .26rem .72rem 1.05rem; flex: 1 1 auto; min-height: 0; overflow-y: auto; scrollbar-color: #47615e var(--nav); }
.nav-group { margin-top: 1.15rem; }
.nav-heading {
  display: flex; align-items: center; justify-content: space-between; padding: .2rem .55rem .37rem;
  color: var(--nav-dim); font-size: .78rem; font-weight: 630; letter-spacing: .035em;
}
.nav-item {
  display: flex; align-items: center; min-height: 2.47rem; gap: .59rem; padding: .39rem .59rem;
  color: #e1edeb; text-decoration: none; border: 1px solid transparent; border-radius: .39rem;
  position: relative; font-size: .9rem; line-height: 1.25; margin: .12rem 0;
}
.nav-item .ico { color: #97b4ad; }
.nav-item:hover, .nav-item[aria-current="page"] { background: var(--nav-active); color: #fff; }
.nav-item[aria-current="page"] { border-color: #3d5754; font-weight: 660; }
.nav-item[aria-current="page"]::before {
  content: ""; position: absolute; height: .88rem; width: 2px; left: -.32rem;
  background: var(--amber); border-radius: 2px;
}
.nav-number {
  color: #e3f3e8; background: #365c56; border-radius: .3rem; padding: .1rem .37rem;
  line-height: 1.16; font-size: .72rem; font-variant-numeric: tabular-nums;
}
.nav-create { color: var(--nav-dim); background: transparent; border: 0; padding: .15rem .27rem; border-radius: .25rem; }
.nav-create:hover { background: var(--nav-active); color: white; }
.nav-empty { font-size: .84rem; padding: .46rem .59rem; color: var(--nav-dim); }
.profile {
  padding: .86rem .94rem calc(.9rem + env(safe-area-inset-bottom)); border-top: 1px solid #36504d;
  display: flex; align-items: center; gap: .55rem; font-size: .88rem;
}
.profile .btn { color: var(--nav-dim); }
.profile .btn:hover { color: white; background: var(--nav-active); }
.profile .meta { color: var(--nav-dim); }
.nav-overlay, .mobile-toggle { display: none; }
.body-wrap { min-width: 0; }
.top {
  position: sticky; z-index: 3; top: 0; min-height: 4.1rem; display: flex; align-items: center; justify-content: space-between;
  padding: .5rem clamp(1rem, 3vw, 2.3rem); gap: .8rem; background: var(--paper); border-bottom: 1px solid var(--line);
}
.crumb { color: var(--subtle); gap: .4rem; font-size: .88rem; min-width: 0; }
.crumb .ico { font-size: .78em; color: #81958d; }
.crumb a { text-decoration: none; color: var(--subtle); }
.crumb strong { color: var(--ink); font-weight: 640; }
.search-button { color: var(--muted); min-width: 10.5rem; justify-content: start; }
kbd {
  font-family: var(--mono); font-size: .73rem; border: 1px solid var(--line); background: #f4f7f5;
  color: #546662; padding: .04rem .22rem; border-radius: .24rem; margin-left: auto;
}
.page {
  width: min(100%, 1470px); margin: 0 auto;
  padding: clamp(1.1rem, 3vw, 2.7rem) clamp(1rem, 3vw, 2.3rem) 3rem;
}
.page-head { min-width: 0; margin: 0 0 1.32rem; display: flex; align-items: end; justify-content: space-between; gap: .85rem; }
.page-head p { margin-top: .38rem; color: var(--subtle); max-width: 60ch; }
.page-head .eyebrow { display: inline-flex; align-items: center; color: var(--accent-dark); margin-bottom: .48rem; font-size: .85rem; font-weight: 635; }
.page-title { overflow-wrap: anywhere; }
.page-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(224px, 280px); gap: 1.2rem; align-items: start; }
.rail { display: grid; gap: .9rem; min-width: 0; }
.card {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); min-width: 0; overflow: hidden;
  box-shadow: 0 1px 2px #1d493305;
}
.card.pad { padding: 1.11rem; }
.card-head { padding: .89rem 1.06rem; border-bottom: 1px solid var(--line-light); }
.card-foot { padding: .68rem 1.06rem; border-top: 1px solid var(--line-light); }
.card-head h2 { font-size: 1.02rem; font-weight: 685; }
.card-head p { margin-top: .25rem; }
.rail .card-head { border-bottom: 0; padding-bottom: .46rem; }
.rail .card-body { padding: .16rem 1.06rem .96rem; }
.rail .mini-list { display: grid; gap: .14rem; }
.rail-link { padding: .46rem .28rem; border-radius: .35rem; text-decoration: none; color: var(--ink); }
.rail-link:hover { background: var(--canvas); }
.quick {
  position: relative; overflow: hidden; background: #deebe5; border-color: #cadfd5; padding: 1.08rem;
  display: grid; gap: .58rem;
}
.quick .ico { color: var(--accent-dark); }
.quick h2 { font-size: 1.11rem; }
.quick > :is(p, a) { position: relative; color: #3a5750; }
.quick p { max-width: 31ch; font-size: .87rem; }
.quick .btn { width: max-content; background: #f8fcfa; color: #234d44; }
.home-space { display: flex; gap: .8rem; align-items: start; }
.home-space:first-child { margin-top: .12rem; }
.item {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .69rem; padding: 1.01rem 1.05rem;
  border-bottom: 1px solid var(--line-light); position: relative;
}
.item:last-child { border-bottom: 0; }
.item:hover { background: #fbfdfc; }
.item.unread { background: #f5faf7; box-shadow: inset 2px 0 var(--accent); }
.item h3 { font-size: 1.04rem; margin: .12rem 0; overflow-wrap: anywhere; }
.item h3 a { color: var(--ink); text-decoration: none; }
.item h3 a:hover { color: var(--accent-dark); text-decoration: underline; }
.item .preview {
  color: var(--ink-soft); font-size: .93rem; line-height: 1.54; margin: .26rem 0 .42rem;
  overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.item .item-tail { margin-top: .32rem; color: var(--subtle); font-size: .83rem; }
.info-line { display: flex; align-items: baseline; flex-wrap: wrap; gap: .24rem .56rem; font-size: .86rem; }
.info-line .sep { color: #8f9e97; }
.item time, time { font-variant-numeric: tabular-nums; }
.thread-page { display: grid; gap: 1rem; }
.thread-post { padding: 1.35rem 1.42rem; }
.content-body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 1rem; line-height: 1.65; }
.thread-post .content-body { margin-top: 1.14rem; }
.thread-post .tags, .thread-post .files { margin-top: .85rem; }
.mention { color: #1c5a49; font-weight: 675; background: #e9f3ec; border-radius: 3px; padding: 0 .1rem; }
.message { display: grid; gap: .66rem; grid-template-columns: auto minmax(0,1fr); padding: .78rem 1rem; }
.message + .message { border-top: 1px solid var(--line-light); }
.message .content-body { margin-top: .15rem; }
.files { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .52rem; }
.file-link { max-width: 100%; overflow: hidden; flex: 0 1 auto; min-height: 1.85rem; font-size: .83rem; text-decoration: none; }
.composer { border-top: 1px solid var(--line); background: #f9fbfa; }
.composer form { display: grid; gap: .57rem; padding: .85rem 1rem; }
.composer textarea { min-height: 4.8rem; }
.attach-button { position: relative; cursor: pointer; font-weight: 550; }
.attach-button input { position: absolute; inset: 0; padding: 0; opacity: 0; cursor: pointer; }
.attach-button:focus-within { outline: 2px solid #6a9a8c; outline-offset: 2px; }
.mention-control { width: 7.25rem; min-height: 2.3rem; font-size: .88rem; }
.empty { padding: 2.1rem 1.12rem; text-align: center; display: grid; gap: .48rem; justify-items: center; }
.empty p { max-width: 32ch; color: var(--subtle); font-size: .94rem; }
.empty .empty-icon {
  display: grid; place-items: center; width: 2.8rem; height: 2.8rem;
  background: var(--accent-pale); color: var(--accent-dark); border-radius: .67rem; margin-bottom: .2rem;
}
.empty .empty-icon .ico { font-size: 1.4rem; }
.empty .btn { margin-top: .34rem; }
.list-member { padding: .51rem 0; border-bottom: 1px solid var(--line-light); text-decoration: none; color: var(--ink); }
.list-member:last-child { border-bottom: 0; }
.member-copy { display: grid; min-width: 0; line-height: 1.35; }
.member-copy .meta { margin-top: .09rem; }
.data-list .item { grid-template-columns: minmax(0,1fr); }
.data-list .item h3 { margin: 0; }
.scope-list { display: flex; gap: .27rem; flex-wrap: wrap; margin-top: .3rem; }
.tables { display: grid; gap: 1.14rem; }
.panel-bar { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.panel-bar > :first-child { margin-right: auto; }
.tabs { display: flex; gap: .22rem; padding: .22rem; background: #edf2ef; border-radius: .5rem; width: max-content; max-width: 100%; }
.tab { display: inline-flex; text-decoration: none; padding: .35rem .62rem; border-radius: .34rem; font-size: .87rem; font-weight: 610; color: var(--subtle); white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); background: white; box-shadow: 0 1px 3px #294f3921; }
.more { padding: .62rem 1rem; border-top: 1px solid var(--line-light); }
input, textarea, select {
  border: 1px solid #cbd8d1; color: var(--ink); background: var(--paper); border-radius: .4rem;
  padding: .58rem .65rem; min-width: 0; width: 100%; line-height: 1.41; font-weight: 440;
}
input:focus, textarea:focus, select:focus { border-color: #568877; outline: 2px solid #d7ebe2; outline-offset: 0; }
textarea { resize: vertical; min-height: 5.5rem; }
textarea[rows="9"] { min-height: 11rem; }
select {
  min-height: 2.43rem; appearance: none; padding-right: 1.65rem;
  background-image: linear-gradient(45deg, transparent 48%, #526c65 52%),
                    linear-gradient(135deg, #526c65 48%, transparent 52%);
  background-position: calc(100% - .69rem) 53%, calc(100% - .46rem) 53%;
  background-size: .24rem .23rem; background-repeat: no-repeat;
}
input[type="checkbox"] { width: 1.05rem; height: 1.05rem; flex: 0 0 auto; accent-color: var(--accent); }
label.field { min-width: 0; display: grid; gap: .29rem; font-size: .9rem; font-weight: 630; }
label.field .meta { font-weight: 470; }
.field-grid { display: grid; gap: .67rem; grid-template-columns: repeat(2,minmax(0,1fr)); }
.check {
  display: flex; align-items: center; gap: .51rem; padding: .47rem .52rem;
  border: 1px solid var(--line); border-radius: .44rem; font-size: .9rem; width: 100%; color: var(--ink-soft);
}
.check:hover { background: var(--canvas); }
.choice-list { display: grid; gap: .36rem; max-height: 12rem; overflow: auto; padding: 2px; }
.grant-list label { display: grid; grid-template-columns: minmax(0,1fr) 7.15rem; align-items: center; gap: .5rem; }
.grant-list select { font-size: .85rem; }
.error { color: var(--danger); font-size: .86rem; }
.key-value, pre.code {
  display: block; color: #d9eee4; background: #173431; border-radius: .45rem; padding: .74rem .86rem;
  font-family: var(--mono); font-size: .84rem; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0;
}
.api-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.api-table th, .api-table td { text-align: left; padding: .6rem .75rem; border-bottom: 1px solid var(--line-light); vertical-align: top; }
.api-table th { color: var(--subtle); font-weight: 620; }
.api-table td:first-child { overflow-wrap: anywhere; }
.api-table tr:last-child td { border-bottom: 0; }
dialog {
  position: fixed; inset: 0; margin: auto; max-height: min(88dvh, 840px); min-width: 0;
  width: min(560px, calc(100% - 1.8rem)); padding: 0; border: 1px solid #cddbd3; border-radius: .86rem;
  color: var(--ink); background: var(--paper); overflow: auto; box-shadow: 0 25px 70px #152f3340;
}
dialog::backdrop { background: #0e242a78; }
.modal-top {
  position: sticky; top: 0; z-index: 2; padding: .78rem 1.13rem; display: flex; align-items: center;
  justify-content: space-between; border-bottom: 1px solid var(--line-light); background: var(--paper);
}
.modal-body { padding: .95rem 1.13rem 1.16rem; display: grid; gap: .8rem; }
.modal-foot { display: flex; justify-content: end; gap: .52rem; padding-top: .3rem; }
.modal-body section + section { border-top: 1px solid var(--line-light); padding-top: .72rem; }
.search-results { display: grid; gap: .24rem; min-height: 2.1rem; max-height: 50dvh; overflow: auto; }
.search-results a { display: grid; gap: .08rem; border: 1px solid var(--line-light); padding: .46rem .57rem; border-radius: .38rem; text-decoration: none; }
.search-results a:hover { background: var(--canvas); }
.toasts { position: fixed; z-index: 10; bottom: 1rem; right: 1rem; display: grid; gap: .5rem; width: min(360px, calc(100% - 2rem)); pointer-events: none; }
.toast { color: #f3fbf5; background: #234740; box-shadow: 0 5px 20px #143d322e; border-radius: .52rem; padding: .63rem .86rem; font-size: .91rem; }
.toast.bad { background: #813f36; }
.auth-shell { display: grid; grid-template-columns: 1fr 1.13fr; min-height: 100dvh; }
.auth-wall { background: var(--nav); color: #fff; min-height: 30rem; position: relative; isolation: isolate; overflow: hidden; }
.auth-wall .brand { position: relative; z-index: 2; width: max-content; margin: clamp(.95rem,3vw,2rem); }
.auth-lines {
  position: absolute; z-index: -1; inset: 14% -35% -34% 0; transform: rotate(-27deg);
  background: repeating-linear-gradient(90deg, #79a39650 0 1px, transparent 1px 42px);
  mask-image: linear-gradient(to top, black, #000b 60%, transparent 97%);
}
.wall-label { position: absolute; bottom: 17%; left: 9.2%; right: 8%; }
.wall-label .lineart {
  width: 4rem; height: 4rem; margin-bottom: 1.05rem; border: 1px solid #a4c7b9; border-radius: .65rem;
  display: grid; place-items: center; font-family: var(--mono); font-size: 2.02rem; color: #d9ecdf;
}
.wall-label strong { font-weight: 710; font-size: clamp(2rem,4vw,4rem); letter-spacing: -.045em; line-height: 1; }
.wall-label p { margin-top: .9rem; max-width: 25ch; color: #c1d5ce; }
.auth-main { align-self: center; padding: clamp(1rem, 5vw, 4rem); }
.auth-content { max-width: 400px; margin-inline: auto; }
.auth-content h1 { margin: .65rem 0 .32rem; }
.auth-content > p { margin-bottom: 1.2rem; }
.auth-form { display: grid; gap: .79rem; }
.auth-actions { display: flex; gap: .79rem; flex-wrap: wrap; margin-top: 1rem; }
.auth-main .brand-mark { display: none; }
@media (max-width: 1140px) {
  .shell { grid-template-columns: 217px minmax(0,1fr); }
  .page-grid { grid-template-columns: minmax(0,1fr) 224px; }
}
@media (max-width: 950px) {
  .page-grid { grid-template-columns: minmax(0,1fr); }
  .rail { grid-template-columns: repeat(auto-fit, minmax(205px,1fr)); }
  .top .search-button { min-width: 0; }
  .search-button kbd { display: none; }
}
@media (max-width: 720px) {
  .shell { grid-template-columns: minmax(0,1fr); }
  .nav { display: none; position: fixed; top: 0; left: 0; bottom: 0; width: min(285px, 82vw); z-index: 7; }
  .nav-open .nav { display: flex; }
  .nav-open .nav-overlay { display: block; position: fixed; z-index: 6; inset: 0; background: #14282b7a; border: 0; }
  .top { min-height: 3.67rem; padding: .45rem .72rem; gap: .5rem; }
  .mobile-toggle { display: inline-flex; }
  .crumb > a, .crumb > .ico, .top[data-view='chat'] .crumb strong { display: none; }
  .top[data-view='chat'] .crumb > a { display: inline; }
  .top > .row { gap: .28rem; }
  .search-button { width: 2.38rem; padding: .45rem; justify-content: center; }
  .search-button span { display: none; }
  .page { padding: 1.13rem .8rem 1.9rem; }
  .page-head { align-items: start; flex-wrap: wrap; gap: .5rem; margin-bottom: .88rem; }
  .page-head p { font-size: .9rem; }
  .page-head .actions { gap: .32rem; flex-wrap: wrap; }
  .rail { grid-template-columns: 1fr; }
  .item { padding: .78rem .72rem; gap: .52rem; }
  .thread-post { padding: .94rem .82rem; }
  .message { padding: .69rem .73rem; gap: .43rem; }
  .composer form { padding: .68rem .73rem; }
  .api-table th, .api-table td { padding: .43rem .48rem; }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-wall { display: none; }
  .auth-main { padding: 1.8rem 1.05rem; }
  .auth-main .brand-mark { display: grid; }
  .field-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
