:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --border: #e2dfd8;
  --text: #23211d;
  --text-muted: #6b665d;
  --accent: #3c5a4c;
  --accent-soft: #e8eee9;
  --ok: #3f7d58;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(35, 33, 29, 0.06);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.65;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.container {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar__inner {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 8px;
  padding-bottom: 8px;
}

.topbar__left,
.topbar__right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar__right form {
  margin: 0;
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav__link {
  padding: 5px 10px;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 14px;
}

.nav__link:hover {
  text-decoration: none;
  color: var(--text);
  background: var(--bg);
}

.nav__link.is-active {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.user-chip__role {
  color: var(--text-muted);
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 8px;
}

.brand {
  font-weight: 600;
  font-size: 16px;
  color: var(--text);
}

.brand:hover {
  text-decoration: none;
  color: var(--accent);
}

.tag {
  font-size: 12px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 10px;
}

.main {
  flex: 1;
  padding-top: 40px;
  padding-bottom: 56px;
}

.hero {
  margin-bottom: 28px;
}

.hero__eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.hero h1 {
  margin: 0 0 10px;
  font-size: 28px;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.hero__lead {
  margin: 0;
  max-width: 640px;
  color: var(--text-muted);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 24px;
  margin-bottom: 16px;
}

.panel h2 {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 600;
}

.checklist {
  list-style: none;
  margin: 0;
  padding: 0;
}

.checklist li {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 6px 0;
}

.dot {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
}

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

.links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin: 12px 0;
}

.link-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}

.link-card:hover {
  text-decoration: none;
  border-color: var(--accent);
  background: var(--accent-soft);
}

.link-card__title {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

.link-card__desc {
  font-size: 12px;
  color: var(--text-muted);
}

.muted {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

.footer {
  border-top: 1px solid var(--border);
  padding: 16px 0;
  font-size: 12px;
  color: var(--text-muted);
}

/* 表单与按钮 */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--accent);
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  padding: 8px 16px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
}

.btn:hover {
  text-decoration: none;
  filter: brightness(1.08);
}

.btn--ghost {
  background: transparent;
  color: var(--accent);
}

.btn--ghost:hover {
  background: var(--accent-soft);
}

.btn--danger {
  border-color: #b3261e;
  background: #b3261e;
}

.panel--danger {
  border-left: 4px solid #b3261e;
}

.btn--sm {
  padding: 4px 10px;
  font-size: 12px;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
}

.field textarea {
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
}

.field--inline {
  min-width: 150px;
}

.filters {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px;
}

.filters .btn {
  margin-bottom: 1px;
}

/* 登录页 */

.login-wrap {
  display: flex;
  justify-content: center;
  padding-top: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 28px 22px;
}

.login-card h1 {
  margin: 0;
  font-size: 22px;
}

.alert {
  margin-top: 14px;
  border-radius: 7px;
  padding: 9px 12px;
  font-size: 13px;
}

.alert--error {
  background: #fbeeec;
  border: 1px solid #e8c4bd;
  color: #8a3226;
}

.alert--ok {
  background: var(--accent-soft);
  border: 1px solid #c9d8cc;
  color: var(--accent);
}

/* 表单布局 */

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

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

.field--narrow {
  max-width: 320px;
}

.field--check__row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.field--check input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.field input:disabled {
  background: var(--bg);
  color: var(--text-muted);
}

.hint {
  font-size: 12px;
  color: var(--text-muted);
}

.toolbar {
  margin-bottom: 16px;
}

.toolbar--flush {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  margin-bottom: 0;
}

.toolbar--flush form {
  margin: 0;
}

/* 客户详情 */

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}

.detail-item__label {
  font-size: 12px;
  color: var(--text-muted);
}

.detail-item__value {
  font-size: 14px;
}

.note-block {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-left: 3px solid var(--border);
  background: var(--bg);
  font-size: 13px;
  white-space: pre-wrap;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 12px 0;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}

.stat__label {
  font-size: 12px;
  color: var(--text-muted);
}

.stat__value {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.status-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.tag--accent {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.section-head h2 {
  margin: 0;
}

.actions {
  white-space: nowrap;
}

.actions form {
  display: inline;
  margin: 0;
}

/* 表格 */

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table th,
.table td {
  text-align: left;
  vertical-align: top;
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
}

.table th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 12px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table .empty {
  text-align: center;
  color: var(--text-muted);
  padding: 18px 10px;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.nowrap {
  white-space: nowrap;
}

.json {
  margin: 0;
  max-width: 280px;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
  color: var(--text-muted);
}

/* 标签分组选择（项目表单 / 字典 / 详情） */

.req {
  color: var(--ok);
}

.field--wide {
  max-width: 420px;
}

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

.tag-section {
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.tag-section__label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.tag-section__hint {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--text-muted);
}

.tag-group {
  margin-bottom: 12px;
}

.tag-group__title {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.tag-group__items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text);
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
}

.tag-check:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.tag-check input {
  width: auto;
  margin: 0;
}

.tag--muted {
  opacity: 0.5;
  text-decoration: line-through;
}

.table tbody tr.row--muted td {
  opacity: 0.55;
}

/* 阶段 7：四节点、状态机与作废 */

.alert--note {
  background: #fdf6e8;
  border: 1px solid #e6d5ac;
  color: #7a5a15;
}

.banner-void {
  background: #fbeeec;
  border: 1px solid #e8c4bd;
  border-left: 4px solid #b3261e;
  border-radius: 8px;
  color: #8a3226;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.banner-void h2 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
}

.banner-void p {
  margin: 4px 0 0;
  font-size: 13px;
}

.banner-void .muted {
  color: #8a3226;
  opacity: 0.8;
}

.tag--void {
  border-color: #b3261e;
  color: #8a3226;
  margin-left: 6px;
}

.table-input {
  width: 100%;
  min-width: 110px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  padding: 4px 6px;
  font-size: 13px;
  font-family: inherit;
}

.table-input:focus {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
}

.overdue {
  color: #b3261e;
  font-weight: 600;
  white-space: nowrap;
}

/* 阶段 10：归档完整性与豁免 */

.tag--archive {
  margin-left: 6px;
}

.tag--archive-missing {
  border-color: #b3261e;
  color: #8a3226;
}

.tag--archive-due_soon {
  border-color: #b8860b;
  color: #7a5a15;
}

.tag--archive-complete {
  border-color: var(--ok);
  color: var(--ok);
}

.tag--archive-not_applicable {
  border-color: var(--border);
  color: var(--text-muted);
}

.archive-banner {
  border: 1px solid var(--border);
  border-left: 4px solid var(--text-muted);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  margin-bottom: 16px;
}

.archive-banner--missing {
  border-left-color: #b3261e;
  background: #fbeeec;
}

.archive-banner--due_soon {
  border-left-color: #b8860b;
  background: #fdf6e8;
}

.archive-banner--complete {
  border-left-color: var(--ok);
  background: #eef5f0;
}

.archive-banner--not_applicable {
  border-left-color: var(--text-muted);
  background: var(--surface-soft, #f6f6f4);
}

.archive-banner__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.archive-banner__lead {
  margin: 10px 0 4px;
  font-size: 13px;
}

.archive-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.archive-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
}

.archive-item:last-child {
  border-bottom: none;
}

.archive-item__name {
  font-size: 13px;
}

.archive-waive {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.archive-waive__reason {
  min-width: 220px;
}

.archive-waivers {
  margin-top: 10px;
}

.archive-waivers summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
}
