:root {
  --bg: #f7f3e8;
  --bg-deep: #efe9da;
  --text: #1d2a24;
  --text-2: #526157;
  --muted: #7f8b81;
  --line: rgba(29, 42, 36, .12);
  --glass: rgba(255, 253, 248, .86);
  --surface: #fffdf8;
  --surface-2: #f2eee3;
  --primary: #3f7d5c;
  --primary-soft: rgba(63, 125, 92, .10);
  --pink: #b7544a;
  --cyan: #7d9b76;
  --amber: #d9a441;
  --green: #4f8b6b;
  --shadow-sm: 0 2px 10px rgba(29, 42, 36, .05);
  --shadow-md: 0 14px 40px rgba(29, 42, 36, .09);
  --shadow-lg: 0 28px 70px rgba(29, 42, 36, .14);
  --radius: 24px;
  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #0e1a15;
  --bg-deep: #13221c;
  --text: #f3efe3;
  --text-2: #c4cdbf;
  --muted: #8d9a8e;
  --line: rgba(232, 226, 206, .14);
  --glass: rgba(14, 26, 21, .72);
  --surface: #16261f;
  --surface-2: #1c3027;
  --primary-soft: rgba(143, 190, 159, .16);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, .18);
  --shadow-md: 0 16px 44px rgba(0, 0, 0, .30);
  --shadow-lg: 0 30px 80px rgba(0, 0, 0, .42);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background .35s ease, color .35s ease;
}

body::before,
body::after {
  content: "";
  position: fixed;
  z-index: -1;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  opacity: .55;
}

body::before {
  width: 520px;
  height: 520px;
  top: -180px;
  right: -100px;
  background: radial-gradient(circle, rgba(63, 125, 92, .20), transparent 68%);
}

body::after {
  width: 460px;
  height: 460px;
  bottom: -180px;
  left: -120px;
  background: radial-gradient(circle, rgba(217, 164, 65, .16), transparent 68%);
}

html[data-theme="dark"] body::before { opacity: .45; }
html[data-theme="dark"] body::after { opacity: .30; }

::selection { background: rgba(63, 125, 92, .22); }

button { font: inherit; }
a { color: inherit; text-decoration: none; }

.muted { color: var(--muted); }

/* ---------------------------------------------------------------- boot */
.boot-screen {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
}

.boot-screen .brand-mark { width: 54px; height: 54px; font-size: 24px; }
.boot-dot {
  width: 26px;
  height: 4px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--primary), var(--cyan));
  animation: loading 1.2s ease-in-out infinite;
}

.boot-screen.error h2 { margin: 0 0 8px; font-size: 20px; }
.boot-screen.error p { margin: 0; color: var(--muted); }

@keyframes loading {
  0%, 100% { transform: scaleX(.45); opacity: .5; }
  50% { transform: scaleX(1); opacity: 1; }
}

/* ---------------------------------------------------------------- shared */
.brand,
.auth-brand,
.auth-mobile-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: -.02em;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  background: linear-gradient(135deg, #3f7d5c 0%, #5f8c7e 48%, #7d9b76 100%);
  box-shadow: 0 10px 26px rgba(63, 125, 92, .32);
  flex: none;
}

.brand-word { font-size: 17px; }
.brand-word, .auth-brand > span:last-child, .auth-mobile-brand > span:last-child {
  font-family: "Noto Serif SC", "Songti SC", "STSong", serif;
  font-weight: 600;
  letter-spacing: .08em;
}
.brand-mark { overflow: hidden; padding: 0; background: transparent; box-shadow: 0 8px 20px rgba(16, 42, 35, .22); }
.brand-mark img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: inherit; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .16em;
  color: var(--primary);
}

.icon-ghost {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 12px;
  color: var(--text-2);
  background: transparent;
  cursor: pointer;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}

.icon-ghost:hover {
  color: var(--primary);
  background: var(--primary-soft);
  transform: translateY(-1px);
}

.icon-ghost.danger:hover { color: #b7544a; background: rgba(183, 84, 74, .10); }

.member-avatar {
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  overflow: hidden;
  color: #fff;
  font-weight: 800;
  flex: none;
  line-height: 1;
  transition: transform .18s ease;
}

.member-avatar.has-ring { border: 2px solid rgba(255, 255, 255, .92); box-shadow: 0 2px 8px rgba(29, 42, 36, .10); }
html[data-theme="dark"] .member-avatar.has-ring { border-color: #16261f; }
.member-avatar.has-icon { background: #fff !important; padding: 4px; }
.member-avatar-svg, .member-avatar-svg svg { width: 100%; height: 100%; display: block; }
.member-avatar:hover { transform: translateY(-2px) scale(1.04); }

/* ---------------------------------------------------------------- topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--glass) 88%, transparent);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  width: min(1240px, 100%);
  margin: 0 auto;
  min-height: 68px;
  padding: 10px 28px;
  display: flex;
  align-items: center;
  gap: 22px;
}

.top-search { width: 340px; margin-left: auto; }
.top-search .n-input { background: var(--surface-2) !important; }
.mobile-search { display: none; }

.top-actions { display: flex; align-items: center; gap: 10px; }

.count-pill {
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-soft);
  white-space: nowrap;
}

.theme-toggle { background: var(--surface-2); }

.new-ws-btn { box-shadow: 0 10px 24px rgba(63, 125, 92, .26); }

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 7px 4px 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  cursor: pointer;
  color: var(--text);
  transition: box-shadow .2s ease, transform .2s ease;
}

.user-chip:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }

.user-copy { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.user-copy b { font-size: 12.5px; }
.user-copy small { color: var(--muted); font-size: 10px; }
.user-chevron { color: var(--muted); margin-right: 2px; }

/* ---------------------------------------------------------------- home */
.home-shell { min-height: 100vh; }

.page {
  width: min(1200px, 100%);
  margin: 0 auto;
  padding: 34px 28px 96px;
  animation: pageIn .45s ease both;
}

@keyframes pageIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
  padding: 16px 4px 42px;
}

.hero-copy { max-width: 560px; }
.hero-copy .eyebrow { margin-bottom: 14px; }

.hero-copy h1 {
  margin: 0;
  font-size: clamp(38px, 5vw, 56px);
  line-height: 1.06;
  letter-spacing: -.045em;
  font-weight: 800;
}

.hero-copy h1 em {
  font-style: normal;
  background: linear-gradient(120deg, #3f7d5c 0%, #5f8c7e 42%, #7d9b76 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-copy p { margin: 18px 0 0; color: var(--muted); font-size: 14.5px; }

.hero-side { display: flex; flex-direction: column; gap: 12px; width: 330px; flex: none; }

.hero-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(145deg, color-mix(in srgb, var(--surface) 92%, transparent), var(--surface-2));
  box-shadow: var(--shadow-md);
  transform: rotate(1.2deg);
  transition: transform .35s ease;
}

.hero-card:hover { transform: rotate(0deg) translateY(-3px); }

.hero-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .14em;
}

.hero-dots { display: flex; gap: 4px; }
.hero-dots i { width: 6px; height: 6px; border-radius: 50%; background: #b7544a; }
.hero-dots i:nth-child(2) { background: #d9a441; }
.hero-dots i:nth-child(3) { background: #4f8b6b; }

.hero-branches { position: relative; height: 128px; margin: 8px 0 2px; }

.branch-root,
.branch {
  position: absolute;
  padding: 7px 11px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  background: #fff;
  color: #2f6b55;
  box-shadow: 0 5px 14px rgba(29, 42, 36, .10);
}

html[data-theme="dark"] .branch-root,
html[data-theme="dark"] .branch { background: #1b2d24; color: #d9e4d8; }

.branch-root { left: 8px; top: 46px; }
.branch.b1 { left: 118px; top: 18px; color: #4d7c77; }
.branch.b2 { left: 132px; top: 54px; color: #9e463d; }
.branch.b3 { left: 110px; top: 90px; color: #4d7c77; }

.hero-branches::before {
  content: "";
  position: absolute;
  left: 78px;
  top: 58px;
  width: 48px;
  height: 1px;
  background: linear-gradient(90deg, rgba(63, 125, 92, .1), rgba(63, 125, 92, .6));
  box-shadow: 0 22px 0 rgba(77, 124, 119, .24), 0 44px 0 rgba(183, 84, 74, .24);
}

.hero-avatars { display: flex; align-items: center; gap: 6px; }
.hero-avatars .member-avatar { margin-left: -9px; }
.hero-avatars .member-avatar:first-child { margin-left: 0; }
.hero-avatars span { margin-left: auto; font-size: 10px; color: var(--muted); }

.hero-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  border: 1px dashed rgba(63, 125, 92, .4);
  border-radius: 14px;
  color: var(--primary);
  background: transparent;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s ease, border-color .2s ease, transform .2s ease;
}

.hero-cta:hover { background: var(--primary-soft); border-color: var(--primary); transform: translateY(-1px); }

.section-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin: 0 4px 18px;
}

.section-title h2 { margin: 0; font-size: 20px; letter-spacing: -.02em; }
.section-title p { margin: 4px 0 0; font-size: 12px; color: var(--muted); }

.section-count {
  min-width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.workspace-list { display: flex; flex-direction: column; gap: 22px; }

/* ---------------------------------------------------------------- workspace */
.workspace-card {
  position: relative;
  padding: 20px 22px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--glass);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  animation: rise .5s cubic-bezier(.2, .8, .2, 1) both;
  transition: box-shadow .25s ease, transform .25s ease, border-color .25s ease;
}

.workspace-card:hover { box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--ws-a) 28%, var(--line)); }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.ws-accent {
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--ws-a), var(--ws-b));
  opacity: .9;
}

.ws-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.ws-symbol {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  flex: none;
  border-radius: 15px;
  color: var(--ws-text);
  background: var(--ws-soft);
}

html[data-theme="dark"] .ws-symbol { background: color-mix(in srgb, var(--ws-a) 18%, transparent); color: var(--ws-b); }

.ws-title { min-width: 0; }
.ws-title h3 { margin: 0; font-size: 17px; letter-spacing: -.02em; }
.ws-tags { display: flex; gap: 5px; margin-top: 5px; flex-wrap: wrap; }

.tag-kind { background: var(--ws-soft) !important; color: var(--ws-text) !important; }
html[data-theme="dark"] .tag-kind { background: color-mix(in srgb, var(--ws-a) 18%, transparent) !important; color: var(--ws-b) !important; }
.tag-admin { background: rgba(217, 164, 65, .14) !important; color: #8a6a4a !important; }
html[data-theme="dark"] .tag-admin { background: rgba(217, 164, 65, .16) !important; color: #e5b65b !important; }
.tag-soft { background: rgba(79, 139, 107, .11) !important; color: #3f7d5c !important; }
html[data-theme="dark"] .tag-soft { background: rgba(79, 139, 107, .16) !important; color: #7d9b76 !important; }

.ws-people { display: flex; align-items: center; margin-left: auto; }
.ws-people .member-avatar { margin-left: -8px; }
.ws-people .member-avatar:first-child { margin-left: 0; }
.ws-more { margin-left: 6px; font-size: 11px; color: var(--muted); font-weight: 700; }

.ws-actions { display: flex; gap: 3px; }

.ws-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0 16px 60px;
  font-size: 12px;
  color: var(--muted);
}

.ws-meta > span { display: inline-flex; align-items: center; gap: 4px; }
.ws-meta .n-icon { color: var(--amber); }
.dot-sep { width: 3px; height: 3px; border-radius: 50%; background: var(--line); }
.ws-member-names { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .85; }

.map-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.map-card {
  position: relative;
  min-height: 186px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--map-a) 16%, var(--line));
  border-radius: 19px;
  overflow: hidden;
  cursor: pointer;
  background: linear-gradient(135deg, color-mix(in srgb, var(--map-a) 10%, var(--surface)), var(--surface));
  transition: transform .25s cubic-bezier(.2, .8, .2, 1), box-shadow .25s ease, border-color .25s ease;
}

.map-card::after {
  content: "";
  position: absolute;
  width: 120px;
  height: 120px;
  right: -40px;
  bottom: -50px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--map-a) 20%, transparent), transparent 68%);
  pointer-events: none;
}

.map-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 18px 38px rgba(29, 42, 36, .10);
  border-color: color-mix(in srgb, var(--map-a) 36%, transparent);
}

.map-top { display: flex; align-items: center; gap: 7px; position: relative; z-index: 1; }

.map-glyph {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  box-shadow: 0 6px 14px color-mix(in srgb, var(--map-a) 30%, transparent);
}

.map-access { margin-left: auto; background: rgba(255, 255, 255, .7) !important; color: var(--map-text) !important; }
html[data-theme="dark"] .map-access { background: rgba(20, 33, 27, .62) !important; color: #d9e4d8 !important; }
.map-access.is-view { color: var(--muted) !important; }

.map-menu { width: 30px; height: 30px; }

.map-body { position: relative; z-index: 1; padding: 20px 2px 0; }
.map-body h4 { margin: 0; font-size: 15px; line-height: 1.35; letter-spacing: -.015em; }
.map-body p { margin: 7px 0 0; font-size: 11px; color: var(--muted); }

.map-foot { position: absolute; left: 16px; right: 16px; bottom: 13px; z-index: 1; }
.map-open {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--map-text);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity .2s ease, transform .2s ease;
}
.map-card:hover .map-open { opacity: 1; transform: translateX(0); }

.ws-empty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 18px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  color: var(--muted);
  font-size: 12px;
}

.home-empty { padding: 70px 0; }

/* ---------------------------------------------------------------- auth */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(420px, .95fr); }

.auth-visual {
  position: relative;
  overflow: hidden;
  padding: 42px 52px 36px;
  color: #fff;
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 255, 255, .18), transparent 30%),
    radial-gradient(circle at 82% 78%, rgba(217, 164, 65, .28), transparent 38%),
    linear-gradient(145deg, #2f6b55 0%, #3f7d5c 34%, #5f8c7e 66%, #4d7c77 100%);
  display: flex;
  flex-direction: column;
}

.auth-orbit { position: absolute; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .18); pointer-events: none; }
.orbit-a { width: 520px; height: 520px; right: -200px; top: -150px; animation: orbit 18s linear infinite; }
.orbit-b { width: 340px; height: 340px; left: -120px; bottom: -140px; animation: orbit 24s linear infinite reverse; }

@keyframes orbit { to { transform: rotate(360deg); } }

.auth-brand { position: relative; z-index: 1; font-size: 18px; }
.auth-brand .brand-mark { background: rgba(255, 255, 255, .18); border: 1px solid rgba(255, 255, 255, .26); box-shadow: none; backdrop-filter: blur(8px); }

.auth-copy { position: relative; z-index: 1; margin-top: auto; padding-top: 60px; }
.auth-copy .eyebrow { color: rgba(255, 255, 255, .72); margin-bottom: 16px; }
.auth-copy h1 { margin: 0; font-size: clamp(38px, 4.4vw, 58px); line-height: 1.06; letter-spacing: -.045em; font-weight: 800; }
.auth-copy h1 em { font-style: normal; color: #dce8dc; }
.auth-copy p { max-width: 430px; margin: 20px 0 0; color: rgba(255, 255, 255, .74); font-size: 14px; line-height: 1.7; }

.auth-nodes { position: relative; z-index: 1; height: 170px; margin: 22px 0 10px; }
.auth-nodes svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.auth-nodes path { stroke: rgba(255, 255, 255, .32); stroke-width: 1.4; fill: none; stroke-dasharray: 4 5; }
.auth-node {
  position: absolute;
  padding: 8px 13px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .13);
  border: 1px solid rgba(255, 255, 255, .20);
  backdrop-filter: blur(12px);
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 10px 26px rgba(29, 42, 36, .12);
  animation: floaty 5s ease-in-out infinite;
}
.auth-node.n1 { left: 4%; top: 18px; }
.auth-node.n2 { left: 28%; top: 92px; animation-delay: -1.8s; }
.auth-node.n3 { left: 58%; top: 52px; animation-delay: -3s; }
.auth-node.n4 { right: 4%; top: 4px; animation-delay: -2.3s; opacity: .8; }

@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }

.auth-foot { position: relative; z-index: 1; margin-top: auto; font-size: 10px; font-weight: 700; letter-spacing: .16em; color: rgba(255, 255, 255, .48); }

.auth-panel {
  position: relative;
  display: grid;
  place-items: center;
  padding: 48px 36px;
  background: var(--bg);
}

.theme-fab {
  position: absolute;
  top: 22px;
  right: 24px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  transition: transform .2s ease, color .2s ease;
}
.theme-fab:hover { transform: rotate(-10deg); color: var(--primary); }

.auth-card { width: min(400px, 100%); animation: authIn .55s cubic-bezier(.2, .8, .2, 1) both; }

@keyframes authIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

.auth-mobile-brand { display: none; margin-bottom: 26px; }
.auth-heading h2 { margin: 0; font-size: 28px; letter-spacing: -.03em; }
.auth-heading p { margin: 8px 0 22px; color: var(--muted); font-size: 13px; line-height: 1.6; }

.auth-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  margin-bottom: 22px;
  border-radius: 13px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.auth-switch button {
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s ease, color .2s ease, box-shadow .2s ease;
}

.auth-switch button.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); }

.auth-form { display: flex; flex-direction: column; gap: 8px; }
.field-label { display: block; margin: 10px 2px 6px; font-size: 12px; font-weight: 700; color: var(--text-2); }
.field-label .muted { font-weight: 500; font-size: 11px; }
.field-block { display: flex; flex-direction: column; gap: 2px; }

.auth-submit { margin-top: 14px; height: 48px !important; }

.auth-error {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 9px 11px;
  border-radius: 10px;
  background: rgba(183, 84, 74, .10);
  color: #b7544a;
  font-size: 12px;
}

.auth-legal { position: absolute; bottom: 20px; font-size: 10.5px; color: var(--muted); }

.field-enter-active, .field-leave-active { transition: opacity .2s ease, transform .2s ease; }
.field-enter-from, .field-leave-to { opacity: 0; transform: translateY(-6px); }
.fade-enter-active, .fade-leave-active { transition: opacity .2s ease; }
.fade-enter-from, .fade-leave-to { opacity: 0; }

/* ---------------------------------------------------------------- drawer */
.n-drawer-content { background: var(--surface) !important; }
.drawer-title { display: flex; flex-direction: column; gap: 3px; }
.drawer-head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; }
.drawer-title span { font-size: 17px; font-weight: 800; letter-spacing: -.02em; }
.drawer-title small { color: var(--muted); font-size: 11px; font-weight: 500; }
.drawer-body { padding-bottom: 30px; }

.inline-field { display: flex; gap: 8px; align-items: center; }
.inline-field .n-button { height: 44px; width: 46px; flex: none; }

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 0;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
}
.setting-row b { display: block; font-size: 12.5px; }
.setting-row small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }

.drawer-section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 24px 0 10px;
  font-size: 13px;
  font-weight: 800;
}
.drawer-section-title em { color: var(--muted); font-size: 11px; font-style: normal; font-weight: 500; }

.invite-row { display: flex; gap: 8px; }
.invite-row .n-button { flex: none; }

.member-list, .access-list { display: flex; flex-direction: column; gap: 7px; margin-top: 10px; }
.member-row, .access-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}
.member-copy { flex: 1; min-width: 0; line-height: 1.2; }
.member-copy b { display: block; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member-copy small { color: var(--muted); font-size: 10.5px; }
.member-ops { display: flex; gap: 2px; }
.member-ops .icon-ghost { width: 32px; height: 32px; }
.permission-select { width: 108px; flex: none; }
.map-select { margin-bottom: 4px; }
.drawer-empty { padding: 18px; text-align: center; color: var(--muted); font-size: 12px; }

.drawer-save { margin-top: 22px; height: 42px; }
.tab-hint { margin: 0 0 12px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.profile-hero { display: flex; align-items: center; gap: 14px; margin: 8px 0 20px; }
.profile-hero b { display: block; font-size: 15px; }
.profile-hero small { color: var(--muted); font-size: 11px; }

.icon-edit-preview { display: grid; place-items: center; padding: 18px; }
.icon-drop {
  margin: 12px 0;
  padding: 24px;
  border: 1px dashed rgba(63, 125, 92, .35);
  border-radius: 16px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  transition: background .2s ease, border-color .2s ease;
}
.icon-drop:hover, .icon-drop.over { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.icon-code { margin-top: 8px; }
.icon-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }

/* ---------------------------------------------------------------- modal */
.edit-modal { width: min(92vw, 460px); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 980px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
  .auth-panel { min-height: 100vh; padding: 64px 24px 52px; }
  .auth-mobile-brand { display: inline-flex; }
  .auth-legal { display: none; }
  .hero-side { width: 300px; }
}

@media (max-width: 760px) {
  .topbar-inner { min-height: 60px; padding: 9px 14px; gap: 8px; }
  .brand-word { display: none; }
  .brand-mark { width: 36px; height: 36px; border-radius: 12px; }
  .top-search, .count-pill { display: none; }
  .mobile-search { display: block; padding: 0 14px 10px; }
  .top-actions { margin-left: auto; gap: 6px; }
  .user-copy small, .user-chevron { display: none; }
  .user-copy b { max-width: 74px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .user-chip { padding: 3px 8px 3px 3px; }
  .new-ws-btn { height: 38px; }
  .new-ws-btn .btn-label { display: none; }

  .page { padding: 22px 14px 70px; }
  .hero { padding: 4px 2px 24px; gap: 18px; }
  .hero-copy h1 { font-size: 36px; }
  .hero-copy p { margin-top: 12px; font-size: 13px; }
  .hero-side { display: none; }
  .section-title { margin-bottom: 14px; }
  .section-title h2 { font-size: 18px; }
  .workspace-list { gap: 14px; }
  .workspace-card { padding: 16px 14px 16px; border-radius: 20px; }
  .ws-symbol { width: 42px; height: 42px; border-radius: 13px; }
  .ws-title h3 { font-size: 15.5px; }
  .ws-people { order: 4; width: 100%; margin-left: 0; margin-top: 2px; }
  .ws-actions { order: 3; }
  .ws-actions .icon-ghost { width: 34px; height: 34px; }
  .ws-meta { margin: 8px 0 13px 0; gap: 7px; font-size: 11.5px; }
  .ws-member-names { width: 100%; }
  .map-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .map-card { min-height: 170px; padding: 12px; border-radius: 16px; }
  .map-body { padding-top: 14px; }
  .map-body h4 { font-size: 13.5px; }
  .map-glyph { width: 32px; height: 32px; }
  .map-foot { display: none; }
  .ws-empty { flex-direction: column; align-items: flex-start; }
  .ws-empty .n-button { padding-left: 0; }

  .auth-panel { padding: 58px 18px 42px; place-items: start center; }
  .theme-fab { top: 14px; right: 14px; }
  .auth-card { margin-top: 18px; }
  .auth-heading h2 { font-size: 25px; }
  .auth-mobile-brand { margin-bottom: 16px; }

  .n-drawer { max-width: 94vw; }
  .permission-select { width: 96px; }
  .member-row, .access-row { padding: 8px; }
  .member-copy b { font-size: 12px; }
}

@media (max-width: 380px) {
  .user-copy { display: none; }
  .new-ws-btn { width: 38px; padding: 0 !important; }
  .hero-copy h1 { font-size: 32px; }
  .map-grid { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------- AI */
.ai-top-btn {
  height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  border: 1px solid rgba(63, 125, 92, .22);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(63, 125, 92, .10), rgba(217, 164, 65, .12));
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease;
}
.ai-top-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(63, 125, 92, .16); }

.ai-fab {
  position: fixed;
  right: 26px;
  bottom: 26px;
  z-index: 40;
  width: 58px;
  height: 58px;
  border: 0;
  border-radius: 20px;
  display: grid;
  place-items: center;
  gap: 1px;
  color: #fff;
  background: linear-gradient(145deg, #3f7d5c, #5f8c7e 55%, #7d9b76);
  box-shadow: 0 18px 40px rgba(63, 125, 92, .38);
  cursor: pointer;
  animation: fabIn .5s .35s cubic-bezier(.2, .8, .2, 1) both;
  transition: transform .2s ease, box-shadow .2s ease;
}
.ai-fab span { font-size: 9px; font-weight: 800; letter-spacing: .08em; }
.ai-fab:hover { transform: translateY(-3px) rotate(-2deg); box-shadow: 0 22px 48px rgba(63, 125, 92, .46); }

@keyframes fabIn { from { opacity: 0; transform: scale(.6) translateY(10px); } to { opacity: 1; transform: none; } }

.ai-drawer-content .n-drawer-header { padding: 14px 18px !important; }
.ai-drawer-content .n-drawer-body-content-wrapper {
  padding: 0 !important;
  height: calc(100dvh - 68px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.ai-head { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 10px; }
.ai-head-actions { display: flex; align-items: center; gap: 2px; flex: none; }
.ai-head-actions .icon-ghost { width: 34px; height: 34px; }
.ai-head-actions .icon-ghost:disabled { opacity: .35; cursor: default; }
.ai-head-title { display: flex; align-items: center; gap: 10px; }
.ai-head-title b { display: block; font-size: 15px; letter-spacing: -.02em; }
.ai-head-title small { display: block; margin-top: 2px; color: var(--muted); font-size: 10.5px; }
.ai-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(135deg, #3f7d5c, #7d9b76);
  box-shadow: 0 8px 18px rgba(63, 125, 92, .26);
}

.ai-shell { position: relative; display: flex; flex-direction: column; min-height: 0; flex: 1; background: var(--bg); }

.ai-history-panel {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 12;
  max-height: min(72%, 560px);
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  backdrop-filter: blur(18px);
  box-shadow: 0 22px 40px rgba(29, 42, 36, .12);
  animation: aiHistoryIn .18s cubic-bezier(.2, .8, .2, 1);
}
@keyframes aiHistoryIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
.ai-history-head { display: flex; align-items: center; justify-content: space-between; padding: 13px 14px 10px; }
.ai-history-head b { display: block; font-size: 13px; }
.ai-history-head small { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; }
.ai-history-head button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid rgba(63, 125, 92, .18);
  border-radius: 8px;
  padding: 5px 8px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}
.ai-history-list { overflow-y: auto; padding: 0 8px 10px; }
.ai-history-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 8px;
  border-radius: 10px;
  cursor: pointer;
  transition: background .15s;
}
.ai-history-item:hover { background: var(--surface-2); }
.ai-history-item.active { background: var(--primary-soft); }
.ai-history-copy { flex: 1; min-width: 0; }
.ai-history-copy b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; color: var(--text); }
.ai-history-copy small { display: block; margin-top: 2px; color: var(--muted); font-size: 9.5px; }
.ai-history-delete {
  flex: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
  padding: 2px 4px;
  cursor: pointer;
  opacity: .55;
}
.ai-history-delete:hover { color: #b7544a; opacity: 1; }
.ai-thread { flex: 1; overflow-y: auto; padding: 18px 16px 6px; scroll-behavior: smooth; }
.ai-thread::-webkit-scrollbar { width: 5px; }
.ai-thread::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; }

.ai-welcome { padding: 20px 6px 26px; }
.ai-welcome-mark {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  color: #fff;
  background: linear-gradient(145deg, #3f7d5c, #5f8c7e 55%, #7d9b76);
  box-shadow: 0 16px 34px rgba(63, 125, 92, .28);
  margin-bottom: 16px;
}
.ai-welcome h3 { margin: 0; font-size: 20px; letter-spacing: -.03em; }
.ai-welcome p { margin: 8px 0 18px; color: var(--muted); font-size: 12.5px; line-height: 1.75; }
.ai-suggestions { display: flex; flex-direction: column; gap: 7px; }
.ai-suggestions button {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 12px;
  text-align: left;
  cursor: pointer;
  transition: border-color .2s ease, color .2s ease, transform .2s ease, background .2s ease;
}
.ai-suggestions button:hover {
  color: var(--primary);
  border-color: rgba(63, 125, 92, .35);
  background: var(--primary-soft);
  transform: translateX(2px);
}

.ai-message { margin-bottom: 16px; display: flex; flex-direction: column; }
.ai-message.user { align-items: flex-end; }
.ai-bubble.user {
  max-width: 84%;
  padding: 10px 13px;
  border-radius: 16px 16px 5px 16px;
  color: #fff;
  background: linear-gradient(135deg, #3f7d5c, #5f8c7e);
  font-size: 12.5px;
  line-height: 1.65;
  box-shadow: 0 8px 18px rgba(63, 125, 92, .20);
  white-space: pre-wrap;
}
.ai-answer { width: 100%; }
.ai-answer-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
}
.ai-avatar {
  width: 23px;
  height: 23px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, #3f7d5c, #7d9b76);
}
.ai-live { display: inline-flex; gap: 3px; margin-left: 2px; }
.ai-live i { width: 4px; height: 4px; border-radius: 50%; background: var(--primary); animation: aiDot 1.2s ease-in-out infinite; }
.ai-live i:nth-child(2) { animation-delay: .15s; }
.ai-live i:nth-child(3) { animation-delay: .3s; }

@keyframes aiDot { 0%, 100% { opacity: .25; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-2px); } }

.ai-bubble.assistant {
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 4px 16px 16px 16px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 12.5px;
  line-height: 1.75;
  box-shadow: var(--shadow-sm);
  overflow-wrap: anywhere;
}
.ai-bubble.assistant strong { color: var(--text); font-weight: 800; }
.ai-bubble.assistant code {
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--primary);
  font-size: 11.5px;
}

.ai-thinking { display: flex; align-items: center; gap: 4px; padding: 8px 2px; color: var(--muted); font-size: 10.5px; }
.ai-thinking i { width: 4px; height: 4px; border-radius: 50%; background: var(--primary); animation: aiDot 1.2s infinite; }
.ai-thinking i:nth-child(2) { animation-delay: .15s; }
.ai-thinking i:nth-child(3) { animation-delay: .3s; }
.ai-thinking span { margin-left: 4px; }
.ai-cancelled { color: var(--muted); font-size: 11px; padding: 4px 2px; }

.ai-choices { margin: 2px 0 8px; padding: 11px 12px; border: 1px solid rgba(63, 125, 92, .16); border-radius: 13px; background: var(--primary-soft); }
.ai-choices p { margin: 0 0 8px; color: var(--text-2); font-size: 12px; font-weight: 700; line-height: 1.55; }
.ai-choice-buttons { display: flex; flex-direction: column; gap: 6px; }
.ai-choice-buttons button {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border: 1px solid rgba(63, 125, 92, .18);
  border-radius: 10px;
  color: var(--primary);
  background: var(--surface);
  font-size: 11.5px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
}
.ai-choice-buttons button:hover { transform: translateX(2px); border-color: var(--primary); background: var(--surface-2); }

.ai-created {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0 8px;
  padding: 9px 11px;
  border: 1px solid rgba(79, 139, 107, .20);
  border-radius: 11px;
  background: rgba(79, 139, 107, .08);
  color: #3f7d5c;
  font-size: 11px;
  font-weight: 700;
}
.ai-created span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-created button {
  flex: none;
  border: 0;
  border-radius: 7px;
  padding: 5px 8px;
  color: #fff;
  background: #4f8b6b;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.ai-timeline { margin: 2px 0 10px; }
.ai-tool { position: relative; display: flex; gap: 9px; padding: 0 0 13px 0; }
.ai-tool-line { position: absolute; left: 12px; top: 24px; bottom: -2px; width: 1px; background: var(--line); }
.ai-tool:last-child .ai-tool-line { display: none; }
.ai-tool-icon {
  position: relative;
  z-index: 1;
  width: 24px;
  height: 24px;
  flex: none;
  display: grid;
  place-items: center;
  margin-top: 1px;
  border-radius: 8px;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid rgba(63, 125, 92, .16);
}
.ai-tool.success .ai-tool-icon { color: #3f7d5c; background: rgba(79, 139, 107, .12); border-color: rgba(79, 139, 107, .20); }
.ai-tool.error .ai-tool-icon { color: #b7544a; background: rgba(183, 84, 74, .12); border-color: rgba(183, 84, 74, .20); }
.ai-spin { display: grid; place-items: center; animation: aiSpin 1.1s linear infinite; }
@keyframes aiSpin { to { transform: rotate(360deg); } }

.ai-tool-body {
  flex: 1;
  min-width: 0;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
}
.ai-tool-title { display: flex; align-items: center; gap: 6px; }
.ai-tool-title b { font-size: 11.5px; }
.ai-duration { margin-left: auto; color: var(--muted); font-size: 9.5px; }
.ai-tool-detail { margin-top: 4px; color: var(--text-2); font-size: 10.5px; overflow-wrap: anywhere; }
.ai-tool-summary { margin-top: 5px; color: #3f7d5c; font-size: 10.5px; line-height: 1.55; }
.ai-tool-summary.error { color: #b7544a; }
.ai-tool-raw { margin-top: 6px; }
.ai-tool-raw summary { color: var(--muted); font-size: 10px; cursor: pointer; }
.ai-tool-raw pre {
  max-height: 170px;
  overflow: auto;
  margin: 6px 0 0;
  padding: 8px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 9.5px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.ai-files-bar {
  flex: none;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 12px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 72%, transparent);
}
.ai-files-bar::-webkit-scrollbar { height: 0; }

.ai-folder-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: none;
  max-width: 220px;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 10px;
  cursor: pointer;
  transition: border-color .18s, background .18s;
}
.ai-folder-chip.active { border-color: rgba(63, 125, 92, .30); background: var(--primary-soft); color: var(--primary); }
.ai-folder-chip.saved { cursor: pointer; }
.ai-folder-chip.saved.muted { opacity: .62; border-style: dashed; }
.ai-folder-chip .ai-folder-name { max-width: 95px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.ai-folder-chip small { color: var(--muted); white-space: nowrap; font-size: 9.5px; }
.ai-folder-x {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0 1px;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}
.ai-folder-x:hover { color: var(--danger, #b7544a); }
.ai-folder-add {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 9px;
  border: 1px dashed rgba(63, 125, 92, .30);
  border-radius: 9px;
  background: transparent;
  color: var(--primary);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}
.ai-folder-add:hover { background: var(--primary-soft); }
.ai-folder-add:disabled { opacity: .5; cursor: default; }

.ai-file-error { flex: none; padding: 6px 14px; color: #b7544a; font-size: 10px; background: rgba(183, 84, 74, .07); }

.ai-drop-overlay {
  position: absolute;
  inset: 10px;
  z-index: 8;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  border: 2px dashed rgba(63, 125, 92, .4);
  border-radius: 18px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(8px);
  color: var(--primary);
  text-align: center;
  pointer-events: none;
}
.ai-drop-overlay b { font-size: 14px; }
.ai-drop-overlay span { color: var(--muted); font-size: 10.5px; }

.ai-compose { flex: none; padding: 10px 14px 12px; border-top: 1px solid var(--line); background: var(--surface); }.ai-status-line { display: flex; align-items: center; justify-content: space-between; min-height: 18px; margin-bottom: 6px; color: var(--muted); font-size: 10px; }
.ai-status-line > span { display: inline-flex; align-items: center; gap: 5px; }
.ai-pulse { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(79, 139, 107, .14); animation: aiPulse 1.2s infinite; }
@keyframes aiPulse { 50% { opacity: .45; } }
.ai-clear { border: 0; background: transparent; color: var(--muted); font-size: 10px; cursor: pointer; }
.ai-clear:hover { color: var(--primary); }
.ai-input-row { display: flex; align-items: flex-end; gap: 8px; }
.ai-input-row .n-input { flex: 1; }
.ai-send { flex: none; width: 38px; height: 38px; }
.ai-powered { margin-top: 6px; text-align: center; color: var(--muted); font-size: 9px; opacity: .8; }

@media (max-width: 760px) {
  .ai-fab { right: 16px; bottom: 18px; width: 52px; height: 52px; border-radius: 17px; }
  .ai-top-btn { width: 36px; padding: 0; justify-content: center; }
  .ai-top-btn span { display: none; }
  .ai-drawer-content .n-drawer-body-content-wrapper { height: calc(100dvh - 68px); }
  .ai-thread { padding: 14px 12px 4px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* 枝间 — paper-and-ink typography */
.hero-copy h1,
.auth-copy h1,
.auth-heading h2,
.section-title,
.board-title {
  font-family: "Noto Serif SC", "Songti SC", "STSong", serif;
  font-weight: 600;
  letter-spacing: .01em;
}

.hero-copy h1 { line-height: 1.12; }
