:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  color: #12233f;
  background: #fff;
  --ink: #12233f;
  --muted: #55657d;
  --blue: #204a95;
  --blue-soft: #edf4ff;
  --line: #e1e8f1;
  --pale: #f6f8fc;
  --yellow: #ffd928;
  --yellow-soft: #fff8dc;
  --error: #a22e26;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font-size: .9375rem; line-height: 1.55; }
button, select, input, textarea { font: inherit; color: inherit; }
button, select { cursor: pointer; }
button:disabled, select:disabled { cursor: default; }
button, input, select, textarea { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid #245ac5; outline-offset: 3px; }
h1, h2, h3, p, ol { margin: 0; }
ol { list-style: none; padding: 0; }
h1, h2, h3, p, strong, small { overflow-wrap: anywhere; }

.icon { width: 20px; height: 20px; flex: 0 0 auto; display: block; }
.icon-button, .button, .nav-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  font-weight: 650;
  line-height: 1.25;
  transition: background-color 140ms ease, border-color 140ms ease;
}
.icon-button { min-width: 44px; padding: 0 9px; }
.button { padding: 9px 15px; }
.icon-button:hover, .nav-button:hover, .outline:hover { background: var(--blue-soft); }
.primary { background: var(--yellow); border-color: #dfb900; }
.primary:hover { background: #ffcd13; }
.outline { border-color: #cbd7e8; background: #fff; color: var(--blue); }
button:disabled, select:disabled { opacity: .62; }

.topbar { border-bottom: 1px solid var(--line); background: #fff; }
.topbar-inner {
  max-width: 1560px;
  min-height: 73px;
  margin: auto;
  padding: max(10px, env(safe-area-inset-top)) max(32px, env(safe-area-inset-right)) 10px max(32px, env(safe-area-inset-left));
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.brand, .topbar-actions { display: flex; align-items: center; gap: 11px; }
.brand img { flex: 0 0 auto; }
.brand strong, .brand span { display: block; }
.brand strong { font-size: 1.05rem; letter-spacing: .035em; }
.brand span { color: var(--muted); font-size: .75rem; }
.topbar-actions { justify-content: end; flex-wrap: wrap; }
.exit { color: var(--muted); }
.connection {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--pale);
  padding: 5px 10px;
  font-size: .8125rem;
  font-weight: 650;
}
.connection::before { content: ""; flex: 0 0 7px; height: 7px; border-radius: 50%; background: #64748b; }
.connection[data-state="live"] { color: #086744; border-color: #d3ede2; background: #f0faf5; }
.connection[data-state="live"]::before { background: #16875e; }
.connection:is([data-state="offline"], [data-state="error"]) { color: #825300; border-color: #ecdc9d; background: var(--yellow-soft); }
.connection:is([data-state="offline"], [data-state="error"])::before { background: #ad6d05; }

.entry { display: grid; align-items: start; justify-items: center; padding: clamp(32px, 10vh, 100px) 16px 24px; }
.entry-card {
  width: min(100%, 440px);
  padding: clamp(24px, 5vw, 36px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 12px 42px #1e3e6010;
}
.section-icon { width: 46px; height: 46px; display: grid; place-items: center; background: var(--blue-soft); color: var(--blue); border-radius: 13px; flex: 0 0 auto; }
.section-icon .icon { width: 24px; height: 24px; }
.entry-card h1 { margin-top: 14px; font-size: 1.65rem; }
.entry-card > p { color: var(--muted); margin-top: 4px; }
.entry-card form { display: grid; gap: 9px; margin-top: 24px; }
.entry-card label { font-weight: 650; }
.entry-card input {
  width: 100%;
  min-height: 48px;
  padding: 9px 12px;
  border: 1px solid #adbed4;
  border-radius: 10px;
  background: #fff;
  font-size: 1rem;
}
.entry-card .primary { min-height: 48px; margin-top: 8px; }
.error-text { color: var(--error); }

.desk {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 1560px;
  height: calc(100dvh - 74px);
  min-height: 650px;
  margin-inline: auto;
  padding: 22px max(32px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(32px, env(safe-area-inset-left));
}
.workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: clamp(185px, 17vw, 242px) minmax(0, 1fr) clamp(280px, 26vw, 365px);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 8px 30px #1e3e6009;
}
.panel { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.team { background: var(--pale); border-right: 1px solid var(--line); }
.work { background: #fff; border-left: 1px solid var(--line); }
.panel-head { min-height: 83px; padding: 15px 20px; display: flex; align-items: center; gap: 13px; border-bottom: 1px solid var(--line); }
.panel-head h1 { font-size: 1.375rem; line-height: 1.25; letter-spacing: .02em; }
.panel-head h2 { font-size: 1.06rem; line-height: 1.3; }
.panel-head p { color: var(--muted); font-size: .8125rem; margin-top: 4px; }
.chat-head { padding-inline: clamp(16px, 2.2vw, 32px); }
.team-scroll, .work-scroll, .history { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.team-scroll, .work-scroll { padding: 15px 14px; }
.roster { display: grid; gap: 6px; }
.person, .identity {
  min-width: 0;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 11px 8px;
}
button.person { width: 100%; text-align: start; background: transparent; border: 1px solid transparent; border-radius: 12px; }
button.person:hover, button.person[aria-pressed="true"] { background: var(--blue-soft); border-color: #d9e6fb; }
.person strong, .identity strong { display: block; font-size: .875rem; }
.person small, .identity small { display: block; color: var(--muted); line-height: 1.45; font-size: .75rem; margin-top: 3px; }
.team-links { border-top: 1px solid var(--line); margin-top: 15px; padding: 12px 8px 0; }
.team-links h3 { color: var(--muted); font-size: .8125rem; }
.team-links a {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  border-radius: 8px;
  color: var(--blue);
  text-decoration: none;
  font-size: .875rem;
}
.team-links a:hover { text-decoration: underline; }
.team-links .icon { width: 16px; height: 16px; }
.identity { align-items: center; margin: 0 14px; padding: 14px 8px; border-top: 1px solid var(--line); }

.avatar {
  display: grid;
  place-items: center;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  font-size: .875rem;
  font-weight: 750;
  background: #edf0f5;
  color: #45556c;
}
.role-manager { background: #e1ebff; color: #254c98; }
.role-growth { background: #fff0b5; color: #794b03; }
.role-support { background: #dff3ee; color: #11654f; }
.role-engineering { background: #ebe9fb; color: #554696; }
.role-owner { background: #1d3e75; color: #fff; }

.chat-stream { position: relative; display: flex; flex: 1; min-height: 0; }
.history:focus-visible, .work-scroll:focus-visible { outline-offset: -3px; }
.chat-inner, .composer-inner { width: 100%; max-width: 820px; margin-inline: auto; }
.chat-inner { padding: 14px clamp(16px, 2.2vw, 32px) 24px; }
.date-line {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: .75rem;
  margin: 2px 0 20px;
}
.date-line::before, .date-line::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.messages { display: grid; gap: 17px; }
.message { display: flex; align-items: flex-start; gap: 10px; }
.message.mine { flex-direction: row-reverse; }
.message-content { display: grid; justify-items: start; min-width: 0; max-width: min(86%, 620px); }
.mine .message-content { justify-items: end; }
.message-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 9px; margin-bottom: 4px; }
.mine .message-meta { justify-content: flex-end; }
.message-meta strong { font-size: .83rem; }
.message-meta time, .task-meta, .report time { font-size: .75rem; color: var(--muted); }
.bubble, .task-input, .report-body { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
.bubble { background: var(--pale); border: 1px solid #ecf0f6; border-radius: 3px 13px 13px; padding: 9px 12px; }
.mine .bubble { background: var(--blue-soft); border-color: #dce8fb; border-radius: 13px 3px 13px 13px; }
.message-note .bubble { background: #fff; border-color: var(--line); }
.message-task, .parent-link {
  min-height: 44px;
  text-align: start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: .8125rem;
  overflow-wrap: anywhere;
  max-width: 100%;
}
button:is(.message-task, .parent-link):hover { text-decoration: underline; }
.message-task .icon { width: 16px; height: 16px; }
.chat-empty { display: grid; justify-items: center; text-align: center; gap: 8px; padding: clamp(26px, 8vh, 80px) 12px; }
.chat-empty h2 { font-size: 1.125rem; }
.chat-empty p, .team-empty, .panel-empty { color: var(--muted); }
.team-empty, .panel-empty { font-size: .875rem; padding: 12px; }
.new-messages {
  position: absolute;
  bottom: 12px;
  inset-inline-end: 22px;
  border-color: #c6d9f4;
  color: var(--blue);
  background: #fff;
  box-shadow: 0 2px 12px #1e3e601b;
}
.new-messages:hover { background: var(--blue-soft); }

.composer { border-top: 1px solid var(--line); background: #fff; padding: 9px clamp(16px, 2.2vw, 32px) 16px; }
.composer-target { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: .8125rem; }
.composer-target select { min-height: 44px; max-width: 100%; border: 0; background: #fff; font-weight: 650; color: var(--blue); padding: 0 3px; }
.compose-field { border: 1px solid #c8d5e6; border-radius: 13px; overflow: hidden; background: #fff; }
.compose-field:focus-within { border-color: #245ac5; box-shadow: 0 0 0 1px #245ac5; }
.compose-field textarea { display: block; outline: none; width: 100%; min-height: 52px; max-height: 24dvh; border: 0; padding: 10px 12px 1px; background: #fff; resize: vertical; font-size: 1rem; }
.compose-field textarea::placeholder { color: #5d6c82; }
.compose-actions { display: flex; justify-content: end; padding: 5px 8px 8px; }
.compose-actions .button { min-width: 90px; }
.task-context { display: flex; align-items: center; justify-content: space-between; gap: 3px; padding-left: 10px; margin: 0 0 6px; border-radius: 9px; background: var(--blue-soft); color: var(--blue); font-size: .8125rem; }
.task-context span { overflow-wrap: anywhere; }
.task-context .icon { width: 16px; height: 16px; }
.revision-context { background: var(--yellow-soft); color: var(--ink); }
.revision-context > div { display: grid; min-width: 0; padding-block: 5px; }
.revision-context span { color: var(--muted); }
.revision-context .button { flex: none; font-size: .8125rem; }

.work-nav { display: flex; gap: 6px; padding: 8px 14px; border-bottom: 1px solid var(--line); }
.work-nav .nav-button { flex: 1; }
.nav-button { color: var(--muted); padding: 7px 9px; font-size: .875rem; }
.nav-button[aria-current] { background: var(--blue-soft); color: var(--blue); }
.nav-count {
  border-radius: 999px;
  min-width: 21px;
  padding: 2px 5px;
  color: #6d4800;
  background: #ffe885;
  text-align: center;
  font-size: .75rem;
}
.tasks { display: grid; gap: 10px; }
.task {
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  padding: 12px 12px 7px;
  scroll-margin-block: 13px;
}
.task[data-review] { background: #fffdf4; border-color: #ead58a; }
.task-labels, .task-meta { display: flex; gap: 4px 8px; flex-wrap: wrap; align-items: center; }
.task-owner { color: var(--muted); font-size: .75rem; font-weight: 650; }
.task h3 { margin: 7px 0 3px; font-size: .9375rem; line-height: 1.42; }
.state { display: inline-block; border-radius: 6px; padding: 2px 7px; background: #eef1f6; color: #43536a; font-size: .75rem; font-weight: 650; }
.state[data-state="running"] { background: #ebf2ff; color: #254c98; }
.state[data-state="awaiting_owner"] { background: #ffeaa0; color: #6d4800; }
.state[data-state="done"] { background: #e5f5ee; color: #096447; }
.state[data-state="blocked"] { background: #fbeae7; color: var(--error); }
.task details { color: var(--muted); font-size: .8125rem; }
.task summary { width: fit-content; cursor: pointer; min-height: 44px; padding-block: 11px; }
.task-input { color: var(--ink); padding: 0 0 6px; }
.task-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; margin-top: 4px; }
.task-actions .button { font-size: .8125rem; padding-inline: 9px; }
.task-actions .icon { width: 16px; height: 16px; }
.plain { color: var(--blue); }
.plain:hover { background: var(--blue-soft); }
.task-actions .cancel { color: var(--error); }
.task-actions .cancel:hover { background: #fbeae7; }
.report { border: 1px solid var(--line); border-radius: 13px; padding: 14px; }
.report-heading { border-bottom: 1px solid var(--line); padding-bottom: 10px; margin-bottom: 12px; }
.report h3 { font-size: 1rem; }
.report-body { line-height: 1.66; }
.feedback {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 16px;
  padding: 4px 9px 4px 13px;
  border: 1px solid #ecdc9d;
  border-radius: 11px;
  background: var(--yellow-soft);
  color: #674800;
  font-size: .875rem;
}
.feedback p { flex: 1 1 220px; }
.feedback .button { font-size: .8125rem; }
.write-feedback { background: var(--blue-soft); color: var(--ink); border-color: #d5e2f5; }
.mobile-nav { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 1079px) {
  .topbar-inner { min-height: 64px; padding-inline: max(16px, env(safe-area-inset-left)) max(16px, env(safe-area-inset-right)); }
  .desk { height: calc(100dvh - 65px); min-height: 505px; padding: 0 max(0px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(0px, env(safe-area-inset-left)); gap: 0; }
  .desk > .feedback { margin: 6px 12px 0; }
  .workspace { display: flex; flex-direction: column; border: 0; border-radius: 0; box-shadow: none; }
  .workspace .panel { flex: 1; border-inline: 0; }
  .desk:not([data-view="chat"]) .chat, .desk:not([data-view="team"]) .team,
  .desk:is([data-view="chat"], [data-view="team"]) .work { display: none; }
  .mobile-nav { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; padding: 6px 12px; border-bottom: 1px solid var(--line); }
  .mobile-nav .nav-button { flex-wrap: wrap; padding-inline: 2px; gap: 4px; }
  .mobile-nav .icon { width: 17px; height: 17px; }
  .work-nav { display: none; }
  .panel-head { min-height: 70px; padding-block: 11px; padding-inline: 16px; }
  .section-icon { width: 41px; height: 41px; }
  .composer { padding-top: 3px; padding-bottom: 10px; }
  .chat-head h1 { font-size: 1.2rem; }
  .team { background: #fff; }
  .team-scroll, .work-scroll { padding-inline: 16px; }
}
@media (max-width: 470px) {
  .brand { gap: 8px; }
  .brand img { width: 38px; height: 38px; }
  .brand strong { font-size: .95rem; }
  .topbar-actions { gap: 2px; }
  .connection { padding-inline: 8px; }
  .chat-inner { padding-top: 10px; }
  .messages { gap: 14px; }
  .chat .avatar { width: 32px; height: 32px; flex-basis: 32px; }
  .message { gap: 7px; }
}
@media (max-width: 349px) {
  .exit span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
