:root {
  --ink: #162334;
  --ink-soft: #30445e;
  --muted: #6c7b8f;
  --paper: #f3f6f8;
  --surface: #ffffff;
  --surface-muted: #f7f9fa;
  --line: #dce4e8;
  --line-strong: #c7d3da;
  --brand: #0e7c73;
  --brand-deep: #0a625b;
  --brand-soft: #e6f5f2;
  --blue: #2264c7;
  --blue-soft: #eaf1fd;
  --amber: #a75a0b;
  --amber-soft: #fff2df;
  --red: #b33a36;
  --red-soft: #fdeceb;
  --green: #27804f;
  --green-soft: #e8f6ed;
  --radius: 8px;
  --shadow: 0 8px 24px rgba(24, 42, 58, 0.07);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
.hidden { display: none !important; }
body.modal-open { overflow: hidden; }

svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.eyebrow.light { color: #d7fff8; }

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.brand-lockup > span:last-child {
  min-width: 0;
}

.brand-lockup strong,
.brand-lockup > span:last-child {
  display: block;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-lockup small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.brand-lockup.light { color: #fff; }

.brand-symbol {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: var(--radius);
  background: var(--brand);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.brand-symbol svg { width: 21px; height: 21px; }

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(39, 128, 79, 0.14);
  display: inline-block;
  flex: 0 0 8px;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(420px, 1.08fr) minmax(400px, 0.92fr);
  background: var(--surface);
}

.login-story {
  position: relative;
  min-height: 100vh;
  padding: 38px 46px 34px;
  background: var(--brand-deep);
  color: #fff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.login-story::after {
  content: "";
  position: absolute;
  inset: auto -90px -100px auto;
  width: 320px;
  height: 320px;
  border: 54px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
}

.login-story-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  position: relative;
  z-index: 2;
}

.login-story .brand-symbol {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.story-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #d7fff8;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 999px;
  padding: 6px 12px;
}

.story-status .status-dot {
  background: #8ce3ba;
  box-shadow: none;
}

.story-copy {
  position: relative;
  z-index: 2;
  max-width: 570px;
  margin: 84px 0 22px;
}

.story-copy h1 {
  margin: 0;
  max-width: 540px;
  font-size: clamp(36px, 4.4vw, 62px);
  line-height: 1.08;
  font-weight: 850;
}

.story-copy > p:not(.eyebrow) {
  max-width: 470px;
  margin: 22px 0 0;
  color: #cde4e1;
  font-size: 16px;
  line-height: 1.8;
}

.story-points {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 26px;
}

.story-points span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.06);
  color: #dcefeb;
  font-size: 12px;
  font-weight: 700;
}

.story-points svg {
  width: 15px;
  height: 15px;
}

.signal-art {
  position: absolute;
  width: min(52vw, 700px);
  right: -74px;
  bottom: 72px;
  opacity: 0.19;
  pointer-events: none;
}

.story-metrics {
  position: relative;
  z-index: 2;
  margin-top: auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  padding-top: 24px;
}

.story-metrics > div {
  min-width: 0;
  padding-right: 18px;
}

.story-metrics > div + div {
  border-left: 1px solid rgba(255, 255, 255, 0.14);
  padding-left: 20px;
}

.story-metrics strong {
  display: block;
  font-size: 25px;
  line-height: 1.2;
}

.story-metrics span {
  display: block;
  margin-top: 4px;
  color: #a9cbc7;
  font-size: 12px;
}

.login-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 42px;
  background: var(--paper);
}

.login-card {
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 18px 50px rgba(24, 42, 58, 0.1);
}

.mobile-login-brand {
  display: none;
  align-items: center;
  gap: 11px;
  margin-bottom: 30px;
}

.login-card h2 {
  margin: 0;
  font-size: 30px;
  line-height: 1.25;
}

.login-card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.secure-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  margin-top: 3px;
  padding: 5px 8px;
  border: 1px solid #bfe0d8;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-deep);
  font-size: 10px;
  font-weight: 800;
}

.secure-badge svg {
  width: 13px;
  height: 13px;
}

.login-intro {
  margin: 8px 0 26px;
  color: var(--muted);
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin: 0 0 20px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
}

.auth-tabs button {
  min-width: 0;
  border: 0;
  border-radius: 6px;
  padding: 9px 6px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.auth-tabs button.active {
  background: var(--surface);
  color: var(--brand-deep);
  box-shadow: 0 1px 5px rgba(21, 42, 56, 0.08);
}

.auth-form {
  gap: 14px;
}

.submission-file-field input[type="file"] {
  padding: 8px;
  border-style: dashed;
  background: var(--surface-muted);
}

.task-feedback a {
  color: var(--blue);
  font-weight: 750;
  text-decoration: none;
}

.stack-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field > span {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 750;
}

.field input,
.field select,
.select-control select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 10px 13px;
  outline: none;
  transition: border-color 0.16s, box-shadow 0.16s;
}

.field input::placeholder,
.field textarea::placeholder {
  color: #9aa7b5;
}

.field input:focus,
.field select:focus,
.select-control select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(14, 124, 115, 0.12);
}

.primary-btn,
.secondary-btn,
.icon-button,
.text-btn {
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-weight: 750;
  transition: background 0.16s, border-color 0.16s, color 0.16s, transform 0.16s;
}

.primary-btn {
  background: var(--brand);
  color: #fff;
  padding: 10px 15px;
  box-shadow: 0 6px 14px rgba(14, 124, 115, 0.16);
}

.primary-btn:hover { background: var(--brand-deep); transform: translateY(-1px); }
.primary-btn:disabled { opacity: 0.58; cursor: not-allowed; }
.primary-btn.wide { width: 100%; }

.primary-btn svg,
.secondary-btn svg { width: 17px; height: 17px; }

.primary-btn.wide {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
}

.secondary-btn {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink-soft);
  padding: 9px 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  white-space: nowrap;
}

.secondary-btn:hover { border-color: #9eafba; color: var(--ink); }

.sso-btn {
  margin-top: 13px;
  min-height: 44px;
}

.text-btn {
  border: none;
  background: transparent;
  color: var(--brand-deep);
  padding: 10px 4px;
}

.form-message {
  margin: 0;
  color: var(--red);
  background: var(--red-soft);
  border: 1px solid #f3c9c6;
  border-radius: var(--radius);
  padding: 9px 12px;
  font-size: 13px;
}

.login-help {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.help-icon {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--blue);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.help-icon svg { width: 15px; height: 15px; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
}

.client-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px 16px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}

.client-sidebar .brand-lockup {
  padding: 2px 8px 20px;
  border-bottom: 1px solid var(--line);
}

.client-nav {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 18px 0;
  flex: 1;
}

.nav-item {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  border-radius: var(--radius);
  padding: 10px 11px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  font-weight: 700;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.nav-item:hover {
  background: var(--surface-muted);
  color: var(--ink);
}

.nav-item.active {
  background: var(--brand-soft);
  color: var(--brand-deep);
}

.nav-count {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
}

.nav-count.neutral {
  background: var(--blue-soft);
  color: var(--blue);
}

.sidebar-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 2px 14px;
  padding: 12px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.sidebar-note .status-dot { margin-top: 5px; }
.sidebar-note strong { display: block; font-size: 12px; }
.sidebar-note small { display: block; color: var(--muted); font-size: 11px; }
.sidebar-note.offline .status-dot { background: var(--amber); box-shadow: 0 0 0 3px rgba(167, 90, 11, 0.12); }

.sidebar-user {
  border-top: 1px solid var(--line);
  padding: 15px 4px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-user-text {
  min-width: 0;
  flex: 1;
}

.sidebar-user-text strong,
.sidebar-user-text small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user-text strong { font-size: 14px; }
.sidebar-user-text small { color: var(--muted); font-size: 11px; }

.user-avatar {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--blue);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 850;
}

.icon-button {
  width: 36px;
  height: 36px;
  border-color: var(--line);
  background: var(--surface);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-button:hover { color: var(--ink); border-color: var(--line-strong); }
.icon-button svg { width: 17px; height: 17px; }
.icon-button.subtle { border-color: transparent; }
.icon-button.subtle:hover { border-color: var(--line); }

.workspace {
  width: 100%;
  max-width: 1240px;
  min-width: 0;
  padding: 30px 34px 70px;
}

.workspace-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.workspace-head h1 {
  margin: 0;
  font-size: 29px;
  line-height: 1.25;
}

.workspace-head p:last-child {
  margin: 6px 0 0;
  color: var(--muted);
}

.head-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-box {
  width: min(330px, 32vw);
  min-width: 210px;
  height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}

.search-box:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(14, 124, 115, 0.1);
}

.search-box svg {
  width: 17px;
  height: 17px;
  color: var(--muted);
  flex: 0 0 17px;
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: var(--ink);
}

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(300px, 0.8fr);
  gap: 22px;
  align-items: center;
  background: #172a38;
  color: #fff;
  border-radius: var(--radius);
  padding: 26px 28px;
  margin-bottom: 18px;
  position: relative;
  overflow: hidden;
}

.home-hero::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -88px;
  width: 240px;
  height: 240px;
  border: 36px solid rgba(255, 255, 255, 0.05);
  border-radius: 50%;
}

.hero-copy,
.hero-stats {
  position: relative;
  z-index: 1;
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #bde8e2;
  font-size: 12px;
  font-weight: 750;
}

.hero-kicker .status-dot {
  background: #79d8ad;
  box-shadow: none;
}

.hero-copy h2 {
  margin: 12px 0 0;
  font-size: 27px;
  line-height: 1.28;
}

.hero-copy p {
  margin: 8px 0 0;
  color: #b7c7d1;
}

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

.hero-actions .primary-btn {
  background: #fff;
  color: #17303d;
}

.hero-actions .primary-btn:hover { background: #edf3f5; }
.hero-actions .text-btn { color: #d4ebe8; }

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius);
  padding: 16px 8px;
}

.hero-stats > div {
  min-width: 0;
  text-align: center;
  padding: 2px 8px;
}

.hero-stats > div + div { border-left: 1px solid rgba(255, 255, 255, 0.12); }
.hero-stats strong { display: block; font-size: 22px; }
.hero-stats span { display: block; color: #a9bdc7; font-size: 11px; }

.content-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.filter-chips {
  display: flex;
  align-items: center;
  gap: 7px;
  overflow-x: auto;
  scrollbar-width: none;
}

.filter-chips::-webkit-scrollbar { display: none; }

.filter-chip {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 6px 12px;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 700;
}

.filter-chip:hover { border-color: #9eafba; }
.filter-chip.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.select-control select {
  cursor: pointer;
  padding: 8px 32px 8px 12px;
  font-size: 13px;
}

.feed-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.feed-heading h2 {
  margin: 0;
  font-size: 18px;
}

.feed-heading p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.result-count {
  color: var(--muted);
  font-size: 12px;
}

.result-count strong { color: var(--ink); }

.feed {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.feed-item {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 3px 12px rgba(24, 42, 58, 0.035);
  overflow: hidden;
}

.feed-item::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: transparent;
}

.feed-item.pinned::before { background: var(--amber); }
.feed-item.unread { border-color: #a9c9eb; }

.item-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 17px 18px 14px;
}

.item-main {
  min-width: 0;
  flex: 1;
}

.item-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}

.item-title {
  margin: 0;
  font-size: 17px;
  line-height: 1.42;
  word-break: break-word;
}

.tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.tag-category { background: var(--blue-soft); color: var(--blue); }
.tag-pinned { background: var(--amber-soft); color: var(--amber); }
.tag-file { background: var(--green-soft); color: var(--green); }
.tag-important { background: var(--amber-soft); color: var(--amber); }
.tag-urgent { background: var(--red-soft); color: var(--red); }
.tag-audience { background: #eef1f3; color: #53677b; }
.tag-new { background: var(--red); color: #fff; }

.item-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  flex-wrap: wrap;
}

.meta-separator {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--line-strong);
}

.item-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.tool-button {
  width: 34px;
  height: 34px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tool-button:hover { background: var(--surface-muted); color: var(--ink); }
.tool-button.active { background: var(--brand-soft); color: var(--brand-deep); }
.tool-button svg { width: 17px; height: 17px; }

.item-summary {
  margin: 0;
  padding: 0 18px 17px;
  color: #506176;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.item-body {
  display: none;
  padding: 0 18px 18px;
}

.feed-item.open .item-body { display: block; }

.body-content {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink-soft);
}

.file-card {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
  overflow: hidden;
}

.file-preview {
  max-height: 420px;
  overflow: hidden;
  background: #14212d;
}

.file-preview img {
  display: block;
  width: 100%;
  max-height: 420px;
  object-fit: contain;
}

.file-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 13px;
}

.file-icon {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: var(--radius);
  background: var(--green-soft);
  color: var(--green);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.file-icon svg { width: 20px; height: 20px; }
.file-text { min-width: 0; flex: 1; }
.file-name {
  display: block;
  font-weight: 750;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-detail { color: var(--muted); font-size: 11px; }

.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #b7d9c3;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--green);
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.download-btn:hover { background: var(--green-soft); }
.download-btn svg { width: 15px; height: 15px; }

.empty-state {
  padding: 62px 24px;
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
}

.empty-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: var(--surface-muted);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-icon svg { width: 22px; height: 22px; }
.empty-state strong { display: block; color: var(--ink-soft); font-size: 16px; }
.empty-state span { display: block; margin-top: 3px; font-size: 13px; }

.learning-section + .learning-section { margin-top: 24px; }

.ai-search-panel {
  margin-bottom: 14px;
  padding: 14px 15px;
  border: 1px solid #b7d9d4;
  border-radius: var(--radius);
  background: var(--brand-soft);
}

.ai-search-panel strong {
  display: block;
  color: var(--brand-deep);
}

.ai-search-panel p {
  margin: 7px 0 0;
  color: var(--ink-soft);
  white-space: pre-wrap;
}

.ai-search-panel small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

.knowledge-graph-svg {
  display: block;
  width: 100%;
  height: auto;
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.knowledge-edge {
  stroke: var(--line-strong);
  stroke-width: 1.5;
}

.knowledge-node {
  fill: var(--blue-soft);
  stroke: var(--blue);
  stroke-width: 2;
}

.knowledge-node.completed {
  fill: var(--green-soft);
  stroke: var(--green);
}

.knowledge-label {
  fill: var(--ink);
  font-size: 11px;
  font-weight: 700;
  text-anchor: middle;
}

.learning-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.learning-section-head h2 {
  margin: 0;
  font-size: 18px;
}

.learning-section-head p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.space-grid,
.resource-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 10px;
}

.space-card,
.resource-card,
.task-card,
.discussion-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 16px;
  box-shadow: 0 3px 12px rgba(24, 42, 58, 0.035);
}

.space-card::before,
.task-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--blue);
}

.space-card.type-topic::before { background: var(--amber); }
.space-card.color-teal::before { background: var(--brand); }
.space-card.color-green::before { background: var(--green); }
.space-card.color-red::before { background: var(--red); }
.space-card.color-slate::before { background: #71879a; }

.learning-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.learning-card-title {
  margin: 0;
  font-size: 16px;
  line-height: 1.45;
  word-break: break-word;
}

.learning-card-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  flex-wrap: wrap;
}

.learning-card-copy {
  margin: 11px 0 0;
  color: #53667b;
  white-space: pre-wrap;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.learning-card-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 13px;
  flex-wrap: wrap;
}

.learning-card-actions a {
  text-decoration: none;
}

.roster-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.roster-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.roster-copy {
  min-width: 0;
}

.roster-copy strong,
.roster-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.roster-copy small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.role-select {
  min-width: 88px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink-soft);
  padding: 6px 8px;
  font-size: 11px;
}

.teaching-workspace {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.teacher-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.teacher-summary article {
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.teacher-summary span,
.teacher-summary strong {
  display: block;
}

.teacher-summary span {
  color: var(--muted);
  font-size: 12px;
}

.teacher-summary strong {
  margin-top: 5px;
  font-size: 27px;
  line-height: 1;
}

.teacher-course-card::before {
  background: var(--brand);
}

.teacher-submission-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 12px;
}

.teacher-task-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 12px;
}

.teacher-task-card,
.teacher-submission-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.teacher-task-card .learning-card-title,
.teacher-submission-card .learning-card-title {
  margin-bottom: 0;
}

.mini-action {
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink-soft);
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 750;
  text-decoration: none;
}

.mini-action.primary {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.mini-action:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.resource-kind {
  border-radius: 999px;
  padding: 2px 8px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 10px;
  font-weight: 800;
}

.task-state {
  border-radius: 999px;
  padding: 2px 8px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.task-state.submitted { background: var(--amber-soft); color: var(--amber); }
.task-state.graded { background: var(--green-soft); color: var(--green); }
.task-state.late { background: var(--red-soft); color: var(--red); }

.task-feedback {
  margin-top: 11px;
  padding: 10px;
  border-radius: 6px;
  background: var(--brand-soft);
  color: var(--brand-deep);
  font-size: 12px;
}

.qa-replies {
  margin-top: 12px;
  border-top: 1px solid var(--line);
}

.qa-reply {
  padding: 9px 0 2px;
  border-bottom: 1px solid var(--line);
}

.qa-reply:last-child { border-bottom: none; }

.qa-reply-head {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 10px;
}

.qa-reply-head strong { color: var(--ink-soft); font-size: 11px; }
.qa-reply p { margin: 4px 0 0; color: var(--ink-soft); font-size: 12px; white-space: pre-wrap; }

.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  background: rgba(15, 27, 38, 0.52);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(600px, 100%);
  max-height: min(780px, calc(100vh - 48px));
  overflow-y: auto;
  padding: 22px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(15, 27, 38, 0.25);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.modal-head h2 { margin: 0; font-size: 21px; }
.modal-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 4px; }

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 80;
  max-width: min(380px, calc(100vw - 32px));
  padding: 11px 15px;
  border-radius: var(--radius);
  background: #172a38;
  color: #fff;
  box-shadow: 0 14px 34px rgba(15, 28, 38, 0.23);
  font-size: 13px;
}

.ai-toggle-btn {
  background: #f3f8f7;
  border-color: #bcd8d3;
  color: var(--brand-deep);
}

.ai-assistant-panel {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 130;
  width: min(410px, 100vw);
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line-strong);
  background: var(--surface);
  box-shadow: -22px 0 55px rgba(18, 37, 51, 0.16);
  transform: translateX(105%);
  visibility: hidden;
  transition: transform 0.24s ease, visibility 0.24s;
}

.ai-assistant-panel.open {
  transform: translateX(0);
  visibility: visible;
}

.ai-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 17px 17px 14px;
  border-bottom: 1px solid var(--line);
}

.ai-panel-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.ai-panel-title > span:last-child { min-width: 0; }
.ai-panel-title strong,
.ai-panel-title small { display: block; }
.ai-panel-title strong { font-size: 14px; }
.ai-panel-title small {
  color: var(--muted);
  font-size: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-panel-mark,
.ai-empty-mark {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--brand-deep);
  font-size: 12px;
  font-weight: 850;
}

.ai-panel-mark svg { width: 19px; height: 19px; }
.ai-panel-actions { display: flex; gap: 4px; }

.ai-message-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 16px;
  background: var(--surface-muted);
}

.ai-empty-state {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 30px;
}

.ai-empty-state strong { margin-top: 12px; font-size: 15px; }
.ai-empty-state p {
  max-width: 270px;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.ai-message { display: flex; margin-bottom: 12px; }
.ai-message.user { justify-content: flex-end; }
.ai-message-bubble {
  max-width: 88%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.ai-message.user .ai-message-bubble {
  border-color: #a9d3cb;
  background: var(--brand-soft);
  color: var(--brand-deep);
}

.ai-message.error .ai-message-bubble {
  border-color: #f3c9c6;
  background: var(--red-soft);
  color: var(--red);
}

.ai-message-meta {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 9px;
}

.ai-typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 18px;
}

.ai-typing i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--brand);
  animation: ai-pulse 1.1s infinite ease-in-out;
}

.ai-typing i:nth-child(2) { animation-delay: 0.15s; }
.ai-typing i:nth-child(3) { animation-delay: 0.3s; }

@keyframes ai-pulse {
  0%, 80%, 100% { opacity: 0.28; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}

.ai-quick-prompts {
  display: flex;
  gap: 6px;
  padding: 10px 14px 0;
  overflow-x: auto;
  background: var(--surface);
}

.ai-quick-prompts button {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-soft);
  padding: 5px 9px;
  font-size: 10px;
}

.ai-composer {
  padding: 12px 14px 14px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.ai-composer textarea {
  width: 100%;
  resize: none;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 10px 11px;
  outline: none;
  color: var(--ink);
  background: var(--surface);
}

.ai-composer textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(14, 124, 115, 0.12);
}

.ai-composer-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
}

.ai-composer-foot span { color: var(--muted); font-size: 10px; }
.ai-composer-foot .primary-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
}

.ai-composer-foot svg { width: 15px; height: 15px; }

.mobile-nav { display: none; }

@media (max-width: 1040px) {
  .app-shell { grid-template-columns: 216px minmax(0, 1fr); }
  .workspace { padding: 26px 24px 64px; }
  .home-hero { grid-template-columns: 1fr; }
  .hero-stats { max-width: 520px; }
}

@media (max-width: 820px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-story { display: none; }
  .login-panel { min-height: 100vh; padding: 24px 16px; }
  .login-card {
    max-height: none;
    overflow: visible;
    padding: 26px 22px;
  }
  .mobile-login-brand { display: flex; }

  .app-shell {
    display: block;
    padding-bottom: 72px;
  }

  .client-sidebar { display: none; }
  .workspace { padding: 22px 16px 38px; }
  .workspace-head { align-items: flex-start; flex-direction: column; gap: 14px; }
  .head-tools { width: 100%; }
  .search-box { flex: 1; width: auto; min-width: 0; }
  .mobile-nav {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: 10px;
    z-index: 50;
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    padding: 7px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
    box-shadow: 0 16px 34px rgba(24, 42, 58, 0.16);
  }
  .mobile-nav.teacher-mode { grid-template-columns: repeat(8, minmax(0, 1fr)); }
  .mobile-nav-item {
    border: none;
    background: transparent;
    color: var(--muted);
    border-radius: var(--radius);
    min-height: 52px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 11px;
    font-weight: 700;
  }
  .mobile-nav-item svg { width: 19px; height: 19px; }
  .mobile-nav-item.active { background: var(--brand-soft); color: var(--brand-deep); }
  .teacher-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  .login-card { padding: 24px 18px; }
  .login-card-heading { flex-direction: column; gap: 8px; }
  .secure-badge { margin-top: 0; }
  .auth-tabs button { padding-inline: 4px; font-size: 11px; }
  .mobile-nav-item { font-size: 9px; min-height: 50px; }
  .mobile-nav-item svg { width: 18px; height: 18px; }
  .workspace-head h1 { font-size: 25px; }
  .head-tools .secondary-btn { width: 40px; padding: 0; }
  .head-tools .secondary-btn svg { width: 18px; }
  .head-tools .secondary-btn { font-size: 0; gap: 0; }
  .home-hero { padding: 22px 18px; }
  .hero-copy h2 { font-size: 23px; }
  .hero-stats { grid-template-columns: 1fr; max-width: none; }
  .hero-stats > div { text-align: left; padding: 9px 10px; }
  .hero-stats > div + div { border-left: none; border-top: 1px solid rgba(255, 255, 255, 0.12); }
  .content-toolbar { align-items: stretch; flex-direction: column; }
  .select-control.compact select { width: 100%; }
  .item-head { padding: 15px 14px 12px; }
  .item-summary { padding: 0 14px 15px; }
  .item-body { padding: 0 14px 16px; }
  .item-title { font-size: 16px; }
  .file-row { flex-wrap: wrap; }
  .download-btn { width: 100%; justify-content: center; }
  .space-grid,
  .resource-grid { grid-template-columns: 1fr; }
  .teacher-task-list,
  .teacher-submission-list { grid-template-columns: 1fr; }
  .roster-row { grid-template-columns: 34px minmax(0, 1fr); }
  .roster-row > :not(.user-avatar):not(.roster-copy) { grid-column: 2; }
  .modal-shell { padding: 10px; align-items: flex-end; }
  .modal-card {
    width: 100%;
    max-height: calc(100vh - 20px);
    padding: 18px 15px;
    border-radius: 12px 12px 8px 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
