:root {
  --bg: #ffffff;
  --panel: #fafafa;
  --panel-strong: #f4f4f5;
  --text: #171717;
  --muted: #737373;
  --soft: #a3a3a3;
  --border: #e5e5e5;
  --border-strong: #d4d4d4;
  --accent: #111111;
  --focus-fill: #f4f4f5;
  --focus-gray: #555555;
  --wechat: #1f9d55;
  --danger: #dc2626;
  --warning: #c47a12;
  --blue: #2563eb;
  --radius: 6px;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
  color-scheme: light;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
}

.site-footer {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 28px 12px 8px;
  color: var(--soft);
  font-size: 12px;
}

.site-footer a {
  color: inherit;
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--muted);
  text-decoration: underline;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.app-shell.assistant-collapsed {
  grid-template-columns: 260px minmax(0, 1fr) 66px;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px 16px 18px;
  border-right: 1px solid var(--border);
  background: #fbfbfb;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 8px;
  font-size: 20px;
  font-weight: 700;
}

.brand-block {
  padding-bottom: 18px;
}

.brand-date {
  padding-left: 48px;
  color: var(--muted);
  font-size: 14px;
}

.brand-mark {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  background: #111;
  color: #fff;
  font-size: 15px;
}

.nav-section {
  display: grid;
  gap: 4px;
}

.nav-button {
  width: 100%;
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  text-align: left;
}

.nav-button:hover,
.nav-button.active {
  background: var(--panel-strong);
}

.nav-icon {
  color: var(--muted);
  font-size: 14px;
}

.nav-count {
  min-width: 26px;
  padding: 4px 7px;
  border-radius: 999px;
  background: #eeeeee;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 0;
}

.feedback-card,
.wechat-card,
.profile-card {
  margin-top: auto;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}

.feedback-card,
.wechat-card {
  margin-top: auto;
}

.feedback-title,
.wechat-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--wechat);
  font-weight: 650;
}

.feedback-title {
  color: var(--text);
}

.feedback-help {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.feedback-dot,
.wechat-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.feedback-dot {
  background: var(--focus-gray);
}

.wechat-dot {
  background: var(--wechat);
}

.feedback-card textarea,
.feedback-card input {
  width: 100%;
  margin-top: 10px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: 0;
  background: #fff;
  font: inherit;
}

.feedback-card textarea {
  min-height: 88px;
  resize: vertical;
  line-height: 1.5;
}

.feedback-card button {
  width: 100%;
  margin-top: 10px;
}

.wechat-card p,
.profile-card p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.profile-card {
  margin-top: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #111;
  color: #fff;
  font-size: 13px;
}

.main {
  min-width: 0;
  padding: 24px 24px 32px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.title-row {
  display: flex;
  align-items: baseline;
  gap: 16px;
}

h1 {
  margin: 0;
  font-size: 24px;
  letter-spacing: 0;
}

.date-label {
  color: var(--muted);
  font-size: 14px;
}

.search-area {
  position: relative;
  min-width: 260px;
  max-width: 380px;
  flex: 1;
}

.search-box {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--text);
}

.search-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  width: min(620px, 82vw);
  max-height: min(620px, 70vh);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow);
  animation: softExpand 160ms ease-out;
}

.search-popover-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  color: var(--muted);
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}

.search-results {
  max-height: calc(min(620px, 70vh) - 46px);
  overflow-y: auto;
  padding: 8px;
}

.search-result {
  width: 100%;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  text-align: left;
}

.search-result:hover,
.search-result:focus-visible {
  background: var(--focus-fill);
  outline: 0;
}

.search-result-icon {
  color: var(--muted);
  font-weight: 700;
}

.search-result strong,
.search-result small,
.search-result em {
  display: block;
}

.search-result strong {
  margin-bottom: 4px;
}

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

.search-result em {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
  line-height: 1.45;
}

.search-empty {
  padding: 24px 16px;
  color: var(--muted);
  text-align: center;
}

.capture-panel {
  margin: 22px 0 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}

.capture-text {
  display: grid;
  gap: 8px;
}

.capture-input {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--text);
  font-size: 17px;
}

.capture-help {
  color: var(--muted);
  font-size: 13px;
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
}

.primary-button {
  border-color: #111;
  background: #111;
  color: #fff;
  padding: 10px 14px;
  font-weight: 650;
}

.secondary-button,
.ghost-button {
  padding: 9px 12px;
  font-weight: 560;
}

.danger-button {
  color: var(--danger);
}

.ghost-button {
  border-color: transparent;
  background: transparent;
}

.secondary-button:hover,
.ghost-button:hover,
.icon-button:hover {
  background: var(--panel-strong);
}

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

.view-tabs {
  display: flex;
  gap: 18px;
  overflow-x: auto;
  scrollbar-width: none;
}

.view-tab {
  padding: 8px 0;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  white-space: nowrap;
}

.view-tab.focus-tab {
  padding: 10px 18px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--focus-fill);
  color: var(--text);
  font-weight: 750;
}

.view-tab.active {
  border-color: #111;
  color: var(--text);
  font-weight: 700;
}

.view-tab.focus-tab.active {
  border-color: var(--border-strong);
  background: var(--focus-fill);
  color: var(--text);
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.task-surface {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
}

.task-scroll {
  overflow-x: auto;
  scrollbar-width: auto;
}

.task-header,
.task-row {
  display: grid;
  grid-template-columns: minmax(230px, 1.55fr) repeat(var(--field-count), minmax(128px, 0.8fr));
  gap: 12px;
  align-items: center;
  min-width: calc(260px + var(--field-count) * 140px);
}

.task-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.task-row {
  min-height: 72px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.task-row:last-child {
  border-bottom: 0;
}

.task-row:hover {
  background: #fcfcfc;
}

.task-row {
  cursor: default;
}

.task-title {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

.task-check {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  margin-top: 3px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: #fff;
}

.task-name {
  min-width: 0;
}

.task-name strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-meta {
  margin-top: 5px;
  color: var(--soft);
  font-size: 12px;
}

.field-cell {
  min-width: 0;
  color: #3f3f46;
  font-size: 13px;
  line-height: 1.45;
}

.field-cell.muted {
  color: var(--soft);
}

.field-cell.danger {
  color: var(--danger);
  font-weight: 650;
}

.status-select {
  width: 100%;
  min-height: 34px;
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.pill.blue {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: var(--blue);
}

.pill.orange {
  border-color: #fed7aa;
  background: #fff7ed;
  color: var(--warning);
}

.pill.red {
  border-color: #fecaca;
  background: #fef2f2;
  color: var(--danger);
}

.pill.green {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #15803d;
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.icon-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
}

.empty-state {
  padding: 58px 20px;
  text-align: center;
  color: var(--muted);
}

.empty-state strong {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
}

.group-heading {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.assistant-panel {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 16px;
  border-left: 1px solid var(--border);
  background: #fbfbfb;
  overflow: auto;
}

.assistant-title {
  margin: 0 0 18px;
  font-size: 18px;
}

.assistant-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.assistant-mini {
  display: flex;
  justify-content: center;
  padding: 24px 10px;
}

.panel-card {
  margin-bottom: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}

.panel-card h2,
.panel-card h3 {
  margin: 0 0 12px;
  font-size: 15px;
}

.report-preview {
  min-height: 280px;
  max-height: 430px;
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: #262626;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.75;
  white-space: pre-wrap;
}

.panel-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.wechat-form {
  display: grid;
  gap: 10px;
}

.wechat-form textarea {
  width: 100%;
  min-height: 86px;
  resize: vertical;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: 0;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.stat {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}

.stat strong {
  display: block;
  margin-bottom: 4px;
  font-size: 20px;
}

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

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 20;
  min-width: 220px;
  padding: 14px 18px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: rgba(244, 244, 245, 0.96);
  box-shadow: var(--shadow);
  color: #404040;
  text-align: center;
  transform: translateX(-50%) translateY(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 15, 15, 0.24);
}

.task-modal {
  width: min(720px, 100%);
  max-height: min(760px, 92vh);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.modal-header,
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.modal-footer {
  border-top: 1px solid var(--border);
  border-bottom: 0;
}

.modal-header h2 {
  margin: 0;
  font-size: 18px;
}

.modal-body {
  overflow: auto;
  padding: 18px;
}

.all-fields-panel {
  display: grid;
  gap: 16px;
  animation: softExpand 180ms ease-out;
  transform-origin: top;
}

.field-group {
  display: grid;
  gap: 10px;
}

.field-group h3 {
  margin: 0;
  color: var(--focus-gray);
  font-size: 13px;
  font-weight: 760;
}

@keyframes softExpand {
  from {
    opacity: 0;
    transform: translateY(-4px) scaleY(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scaleY(1);
  }
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-field {
  display: grid;
  gap: 7px;
}

.form-field.full {
  grid-column: 1 / -1;
}

.form-field label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  outline: 0;
}

.form-field textarea {
  min-height: 88px;
  resize: vertical;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
}

.checkbox-row input {
  width: 16px;
  height: 16px;
}

.more-toggle {
  margin-top: 14px;
}

.hidden {
  display: none !important;
}

.trial-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #fbfbfb;
}

.trial-card {
  width: min(520px, 100%);
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.trial-card h1 {
  margin: 18px 0 10px;
}

.trial-card p {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.7;
}

.trial-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-bottom: 10px;
}

.invite-form {
  grid-template-columns: 1fr;
}

.trial-form input {
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: 0;
}

.trial-warning {
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.subnav {
  display: flex;
  gap: 18px;
  margin: 20px 0 16px;
  overflow-x: auto;
}

.project-layout {
  display: grid;
  grid-template-columns: minmax(280px, 390px) minmax(0, 1fr);
  gap: 16px;
}

.project-layout.form-collapsed {
  grid-template-columns: 104px minmax(0, 1fr);
}

.project-form-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.project-form h2 {
  margin: 0 0 14px;
  font-size: 17px;
}

.form-collapsed .project-form h2 {
  writing-mode: vertical-rl;
  margin: 0;
  line-height: 1.4;
}

.collapsed-hint {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.project-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.project-list {
  align-self: start;
}

.project-list-body {
  max-height: calc(100vh - 210px);
  overflow-y: auto;
}

.project-list-header {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.project-group-title {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--focus-fill);
  color: var(--focus-gray);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0;
}

.selected-record {
  background: #f7f7f7;
  box-shadow: inset 3px 0 0 var(--focus-gray);
}

.date-field,
.date-field input {
  cursor: pointer;
}

.center-row {
  display: grid;
  grid-template-columns: 1fr 1.1fr 1.1fr;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  cursor: default;
}

.center-row:last-child {
  border-bottom: 0;
}

.center-name {
  display: block;
  color: #111;
  font-size: 20px;
  font-weight: 800;
}

.square-reader {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(0, 760px);
  align-items: start;
  gap: 14px;
}

.article-list {
  display: grid;
  gap: 10px;
}

.article-list-item {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  text-align: left;
}

.article-list-item.active {
  border-color: #bdbdbd;
  background: #f6f6f6;
}

.article-list-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.article-list-item strong {
  font-size: 16px;
  line-height: 1.45;
}

.article-list-item small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.article-card {
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.article-source {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.article-card h2 {
  margin: 0 0 12px;
  font-size: 24px;
  line-height: 1.35;
}

.article-card p {
  margin: 0 0 18px;
  color: #404040;
  line-height: 1.8;
}

.article-points {
  display: grid;
  gap: 8px;
  margin: 0 0 18px;
  padding-left: 18px;
  color: #303030;
  line-height: 1.7;
}

.article-note {
  padding-top: 14px;
  border-top: 1px solid var(--border);
  color: var(--muted) !important;
  font-size: 13px;
}

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

.feature-card {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  text-align: left;
}

.feature-card span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 230px minmax(0, 1fr);
  }

  .assistant-panel {
    position: static;
    grid-column: 2;
    height: auto;
    border-left: 0;
    border-top: 1px solid var(--border);
  }

  .square-reader {
    grid-template-columns: 1fr;
  }

  .article-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 780px) {
  .app-shell {
    display: block;
  }

  .sidebar,
  .assistant-panel {
    position: static;
    height: auto;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .main {
    padding: 18px 14px 24px;
  }

  .topbar,
  .view-toolbar,
  .capture-panel {
    display: grid;
  }

  .search-box {
    min-width: 0;
    max-width: none;
    width: 100%;
  }

  .task-surface {
    border: 1px solid var(--border);
    background: #fff;
  }

  .task-header {
    display: grid;
  }

  .task-row {
    margin-bottom: 0;
  }

  .article-list {
    grid-template-columns: 1fr;
  }

  .row-actions {
    justify-content: flex-start;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .project-layout,
  .center-row {
    grid-template-columns: 1fr;
  }

  .trial-form {
    grid-template-columns: 1fr;
  }
}
