/* Quadrax OA —— Tower 风格的轻量设计系统
   原则：白底 + 浅灰背景 + 单一蓝色强调；卡片靠描边和极轻阴影分层；
   不做大色块、不做重阴影，信息密度优先。 */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --border: #e8eaed;
  --border-strong: #dde1e6;
  --text: #1f2329;
  --text-2: #646a73;
  --text-3: #9aa0a6;
  --primary: #3b7ef0;
  --primary-hover: #2f6fdb;
  --primary-weak: #eaf1fe;
  --ai: #7c5cd6;
  --ai-weak: #f2eefc;
  --danger: #c0392b;
  --danger-weak: #fef1f1;
  --ok: #1e7b45;
  --ok-weak: #effaf3;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(31, 35, 41, 0.06);
  --shadow-lg: 0 8px 24px rgba(31, 35, 41, 0.08);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
        "Microsoft YaHei", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
button { font: inherit; }

/* ---------------------------------------------------------------- 布局 */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 232px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 20;
}

.main {
  flex: 1;
  min-width: 0;
  margin-left: 232px;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(6px);
  border-bottom: 1px solid var(--border);
}

.topbar-title { font-size: 14px; font-weight: 600; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.content {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px;
  flex: 1;
}

/* ---------------------------------------------------------------- 侧栏 */

.brand {
  height: 56px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border);
}

.brand-mark {
  width: 24px;
  height: 24px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.brand-name { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }

.nav { padding: 12px 10px 6px; }
.nav + .nav { padding-top: 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.12s ease, color 0.12s ease;
}

.nav-item svg { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; }
.nav-item:hover { background: #f2f4f7; color: var(--text); }
.nav-item.active { background: var(--primary-weak); color: var(--primary); }

.side-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 12px 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
}

.side-label a {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  color: var(--text-3);
  font-size: 16px;
  line-height: 1;
}
.side-label a:hover { background: #f2f4f7; color: var(--primary); }

.project-nav { padding: 0 10px 8px; overflow-y: auto; }

.project-item {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 13px;
  transition: background 0.12s ease;
}
.project-item:hover { background: #f2f4f7; color: var(--text); }
.project-item.active { background: #f2f4f7; color: var(--text); font-weight: 500; }
.project-item .p-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sidebar-footer {
  margin-top: auto;
  padding: 10px;
  border-top: 1px solid var(--border);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
}
.user-chip:hover { background: #f2f4f7; }
.u-meta { min-width: 0; line-height: 1.3; }
.u-name { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.u-role { font-size: 11px; color: var(--text-3); }

.logout-btn {
  width: 28px;
  height: 28px;
  margin-left: auto;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  border-radius: 6px;
  color: var(--text-3);
  cursor: pointer;
}
.logout-btn:hover { background: #eef0f3; color: var(--danger); }
.logout-btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.7; }

/* ---------------------------------------------------------------- 通用组件 */

.icon-btn {
  position: relative;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  color: var(--text-2);
}
.icon-btn:hover { background: #f2f4f7; color: var(--text); }
.icon-btn svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.7; }
.icon-btn .badge {
  position: absolute;
  top: 3px;
  right: 2px;
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  border-radius: 8px;
  background: #f04438;
  color: #fff;
  font-size: 10px;
  font-style: normal;
  line-height: 15px;
  text-align: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover { background: #f7f8fa; }
.btn-quiet { background: transparent; color: var(--text-2); }
.btn-quiet:hover { background: #f2f4f7; color: var(--text); }
.btn-danger { background: transparent; color: var(--danger); }
.btn-danger:hover { background: var(--danger-weak); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.page-title { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.page-sub { margin-top: 4px; color: var(--text-2); font-size: 13px; }
.head-actions { display: flex; align-items: center; gap: 8px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 16px; }
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.card-title { font-size: 14px; font-weight: 600; }
.card-body { padding: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 8px; }
.row-wrap { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ml-auto { margin-left: auto; }
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.stat { padding: 16px; }
.stat-num { font-size: 24px; font-weight: 600; line-height: 1.2; letter-spacing: -0.02em; }
.stat-label { margin-top: 2px; font-size: 12px; color: var(--text-2); }

.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  align-items: start;
}

.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

/* ---------------------------------------------------------------- 项目卡片 */

.project-card {
  display: block;
  padding: 16px;
  transition: border-color 0.12s ease, transform 0.12s ease, box-shadow 0.12s ease;
}
.project-card:hover {
  border-color: #cfdcf7;
  box-shadow: 0 2px 8px rgba(59, 126, 240, 0.1);
  transform: translateY(-1px);
}
.pc-top { display: flex; align-items: center; gap: 8px; }
.pc-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-desc {
  margin-top: 6px;
  color: var(--text-2);
  font-size: 12px;
  height: 38px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.pc-meta {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #f0f1f3;
  font-size: 12px;
  color: var(--text-3);
}

/* ---------------------------------------------------------------- 头像 / 色点 */

.avatar {
  width: 24px;
  height: 24px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  user-select: none;
}
.avatar-md { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 32px; height: 32px; font-size: 12px; }

.av0 { background: #3b7ef0; }
.av1 { background: #16a394; }
.av2 { background: #7c5cd6; }
.av3 { background: #e8833a; }
.av4 { background: #d9548a; }
.av5 { background: #3f8f4f; }
.av6 { background: #5a6acf; }
.av7 { background: #b5544a; }

.dot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--primary);
}
.dot-lg { width: 10px; height: 10px; }
.c-blue { background: #3b7ef0; }
.c-green { background: #16a394; }
.c-purple { background: #7c5cd6; }
.c-orange { background: #e8833a; }
.c-pink { background: #d9548a; }
.c-teal { background: #2f9fb5; }
.c-indigo { background: #5a6acf; }
.c-red { background: #b5544a; }

.ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 18px;
  padding: 0 7px;
  border-radius: 9px;
  background: var(--ai-weak);
  color: var(--ai);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: 10px;
  background: #f2f4f7;
  color: var(--text-2);
  font-size: 11px;
  font-weight: 500;
}
.pill-ok { background: var(--ok-weak); color: var(--ok); }
.pill-ai { background: var(--ai-weak); color: var(--ai); }
.pill-warn { background: #fff7e8; color: #a86400; }

/* ---------------------------------------------------------------- 表单 */

.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 500; }

.input {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.input::placeholder { color: #b6bbc2; }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59, 126, 240, 0.12); }
textarea.input { height: auto; min-height: 92px; padding: 10px 12px; line-height: 1.6; resize: vertical; }
.hint { margin-top: 6px; font-size: 12px; color: var(--text-3); }
.form-actions { display: flex; align-items: center; gap: 8px; margin-top: 4px; }

.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { position: relative; cursor: pointer; }
.swatch input { position: absolute; opacity: 0; pointer-events: none; }
.swatch span {
  display: block;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid transparent;
  box-shadow: inset 0 0 0 2px #fff;
  transition: border-color 0.12s ease;
}
.swatch input:checked + span { border-color: var(--text); }
.swatch input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }

.checkbox { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.checkbox input { width: 15px; height: 15px; accent-color: var(--primary); }

/* ---------------------------------------------------------------- 提示条 */

.alert {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 13px;
  word-break: break-all;
}
.alert-err { background: var(--danger-weak); border-color: #fadbd8; color: var(--danger); }
.alert-ok { background: var(--ok-weak); border-color: #cdeedb; color: var(--ok); }

/* ---------------------------------------------------------------- 标签页 */

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab {
  padding: 9px 14px;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab .count { margin-left: 4px; color: var(--text-3); font-weight: 400; }

/* ---------------------------------------------------------------- 空态 */

.empty {
  padding: 40px 24px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: #fcfcfd;
  text-align: center;
}
.empty-icon {
  width: 40px;
  height: 40px;
  margin: 0 auto 12px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #f2f4f7;
  color: var(--text-3);
}
.empty-icon svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.6; }
.empty-title { font-size: 14px; font-weight: 600; }
.empty-text { margin-top: 4px; color: var(--text-2); font-size: 13px; }
.empty-actions { margin-top: 16px; }

/* ---------------------------------------------------------------- 表格 */

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  padding: 9px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
}
.table td { padding: 11px 16px; border-bottom: 1px solid #f0f1f3; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: #fcfcfd; }

/* ---------------------------------------------------------------- 项目页 */

.proj-head { display: flex; align-items: center; gap: 10px; }
.proj-title { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }

.member-list { display: flex; flex-direction: column; }
.member-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid #f2f3f5; }
.member-row:last-child { border-bottom: 0; }
.member-name { font-size: 13px; font-weight: 500; }
.member-sub { font-size: 11px; color: var(--text-3); }

.avatar-stack { display: flex; align-items: center; }
.avatar-stack .avatar { margin-left: -6px; border: 2px solid #fff; }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* ---------------------------------------------------------------- 登录 / 注册 */

.auth-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 32px 16px;
  background:
    radial-gradient(900px 420px at 50% -10%, #eef3fe 0%, rgba(238, 243, 254, 0) 70%),
    var(--bg);
}

.auth-brand { display: flex; align-items: center; gap: 10px; }
.auth-brand .brand-mark { width: 28px; height: 28px; border-radius: 8px; font-size: 15px; }
.auth-brand .brand-name { font-size: 16px; }

.auth-card {
  width: 100%;
  max-width: 384px;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
}
.auth-title { font-size: 17px; font-weight: 600; }
.auth-sub { margin-top: 4px; margin-bottom: 20px; color: var(--text-2); font-size: 13px; }
.auth-foot { margin-top: 16px; text-align: center; font-size: 12px; color: var(--text-3); }
.auth-foot a { color: var(--primary); }

/* ---------------------------------------------------------------- 响应式 */

@media (max-width: 860px) {
  .sidebar { width: 64px; }
  .main { margin-left: 64px; }
  .brand { padding: 0 20px; }
  .brand-name,
  .nav-item span,
  .side-label span,
  .side-label a,
  .project-nav,
  .sidebar-footer .u-meta,
  .logout-btn { display: none; }
  .nav { padding: 12px 8px 6px; }
  .nav-item { justify-content: center; padding: 0; }
  .sidebar-footer { display: flex; justify-content: center; }
  .user-chip { padding: 6px; }
  .content { padding: 16px; }
  .stats { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .topbar { padding: 0 16px; }
  .page-head { flex-direction: column; align-items: stretch; }
}

/* ---------------------------------------------------------------- 讨论 / 公共看板 */

.feed { display: flex; flex-direction: column; gap: 14px; max-width: 780px; }
.composer { padding: 14px 16px; }
.composer-row { display: flex; gap: 10px; align-items: flex-start; }
.composer-row .avatar { margin-top: 10px; }
.composer-input { min-height: 64px; }
.composer-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; }

.post-card { padding: 14px 16px; }
.post-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.post-author { font-size: 13px; font-weight: 600; }
.post-comments { margin-left: auto; font-size: 12px; color: var(--text-2); }
.post-comments:hover { color: var(--primary); }
.post-excerpt {
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}
.post-title { font-size: 15px; font-weight: 600; margin: 2px 0 4px; }
.post-title a:hover { color: var(--primary); }
.post-foot { margin-top: 8px; display: flex; }
.post-foot .btn { margin-left: -8px; }
.post-detail { max-width: 780px; padding: 20px 22px; margin-bottom: 24px; }

.prose { font-size: 14px; line-height: 1.75; color: var(--text); word-break: break-word; }
.prose p { margin: 0 0 10px; }
.prose p:last-child { margin-bottom: 0; }
.prose code {
  padding: 1px 5px;
  border-radius: 4px;
  background: #f2f4f7;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
}
.prose pre {
  margin: 10px 0;
  padding: 12px 14px;
  border-radius: 6px;
  background: #f7f8fa;
  border: 1px solid var(--border);
  overflow-x: auto;
}
.prose pre code { padding: 0; background: transparent; font-size: 12.5px; line-height: 1.6; }
.prose blockquote {
  margin: 10px 0;
  padding: 2px 0 2px 12px;
  border-left: 3px solid var(--border-strong);
  color: var(--text-2);
}
.prose ul { margin: 8px 0; padding-left: 20px; list-style: disc; }
.prose a { color: var(--primary); }
.prose a:hover { text-decoration: underline; }

.mention { padding: 0 3px; border-radius: 4px; background: var(--primary-weak); color: var(--primary); font-weight: 500; }

.crumb { font-size: 12px; color: var(--text-2); margin-bottom: 6px; }
.crumb a:hover { color: var(--primary); }

.comments { max-width: 780px; }
.section-title { font-size: 14px; font-weight: 600; margin-bottom: 12px; }
.comment { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid #f2f3f5; }
.comment-main { flex: 1; min-width: 0; }
.comment-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 13px; }
.comment-form { margin-top: 16px; padding: 14px 16px; }
.ai-avatar { background: var(--ai-weak); font-size: 12px; }

.notice-list { overflow: hidden; }
.notice { border-bottom: 1px solid #f2f3f5; }
.notice:last-child { border-bottom: 0; }
.notice-btn {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  background: transparent;
  border: 0;
  text-align: left;
  cursor: pointer;
}
.notice-btn:hover { background: #fcfcfd; }
.notice-dot { width: 7px; height: 7px; border-radius: 50%; margin-top: 7px; background: transparent; flex: none; }
.notice.is-unread .notice-dot { background: #f04438; }
.notice.is-unread .notice-text { font-weight: 500; }
.notice-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.notice-text { font-size: 13px; }
.notice-snippet {
  font-size: 12px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nowrap { white-space: nowrap; }

@media (max-width: 860px) {
  .feed, .comments { max-width: none; }
}
