:root {
  --bg: #f4f1ea;
  --card: #fffdf8;
  --ink: #3f2f24;
  --muted: #7a6758;
  --line: #e4d8c8;
  --primary: #4f6f57;
  --primary-dark: #3f5a47;
  --warn: #8a5a1f;
  --error: #9b3d3d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #f8f4ec 0%, var(--bg) 100%);
}

a {
  color: var(--primary);
  text-decoration: none;
}

.container {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar {
  background: rgba(255, 253, 248, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
}

.brand {
  font-weight: 700;
  color: var(--ink);
}

.topnav {
  display: flex;
  gap: 16px;
}

.page {
  padding: 24px 0 48px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 20px;
}

.page-header h1,
.card h2 {
  margin: 0 0 8px;
}

.muted {
  color: var(--muted);
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 10px 30px rgba(79, 56, 40, 0.05);
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.filters label,
.form label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.filters-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

.table-card {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

.table th {
  color: var(--muted);
  font-weight: 600;
}

.empty {
  text-align: center;
  color: var(--muted);
}

.tag {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(79, 111, 87, 0.12);
  color: var(--primary-dark);
  font-size: 12px;
  margin-right: 6px;
}

.tag-soft {
  background: rgba(138, 90, 31, 0.12);
  color: var(--warn);
}

.alert {
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
}

.alert-error {
  background: rgba(155, 61, 61, 0.1);
  color: var(--error);
}

.alert-warn {
  background: rgba(138, 90, 31, 0.1);
  color: var(--warn);
}

.alert-success {
  background: rgba(79, 111, 87, 0.12);
  color: var(--primary-dark);
}

.alert-info {
  background: #eef6f0;
  border: 1px solid #c5dcc9;
  color: var(--primary-dark);
}

.field-hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.share-preview {
  margin: 16px 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

.share-preview img {
  display: block;
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
}

.share-preview-meta {
  margin-top: 12px;
}

.share-form textarea {
  width: 100%;
  min-height: 88px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  resize: vertical;
  font: inherit;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 12px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.detail-list {
  margin: 0;
}

.detail-list div {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.detail-list dt {
  margin: 0;
  color: var(--muted);
}

.detail-list dd {
  margin: 0;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.product-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.product-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.product-tagline {
  color: var(--primary-dark);
  font-weight: 600;
}

.raw-json pre {
  overflow: auto;
  background: #faf7f1;
  padding: 16px;
  border-radius: 10px;
  font-size: 12px;
}

.identity-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #efe6d8;
  color: var(--ink);
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
}

.identity-code {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 8px;
  background: #faf7f1;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  word-break: break-all;
}

.identity-note {
  margin: 0 0 12px;
  font-size: 13px;
}

.user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-cell__avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: #efe6d8;
  border: 1px solid #e4d8c8;
}

.user-cell__avatar--empty {
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 600;
  color: #7a6758;
}

.identity-card {
  overflow: hidden;
}

.identity-head {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 12px;
}

.identity-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: #efe6d8;
  border: 1px solid #e4d8c8;
}

.identity-avatar--empty {
  display: grid;
  place-items: center;
  font-size: 12px;
  color: #7a6758;
}

.identity-summary {
  min-width: 0;
}

.identity-name {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 700;
}

.identity-wechat {
  margin: 0 0 6px;
  color: var(--primary-dark);
}

.identity-meta {
  margin: 0;
  font-size: 13px;
}

.cell-sub {
  margin-top: 4px;
  font-size: 12px;
}

.back-link {
  display: inline-block;
  margin-bottom: 8px;
}

.score-hint {
  margin: 0 0 12px;
  font-size: 13px;
}

.score-table td {
  vertical-align: middle;
}

.score-row-primary {
  background: rgba(79, 111, 87, 0.06);
}

.score-row-secondary {
  background: rgba(139, 111, 71, 0.04);
}

.score-bar-row {
  display: grid;
  grid-template-columns: minmax(80px, 1fr) 36px;
  gap: 10px;
  align-items: center;
}

.score-bar {
  height: 8px;
  border-radius: 999px;
  background: #efe6d8;
  overflow: hidden;
}

.score-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--primary);
}

.score-bar-fill--emotion {
  background: #8b6f47;
}

.score-value {
  font-weight: 600;
  text-align: right;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.login-card {
  width: min(420px, calc(100% - 32px));
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 16px 40px rgba(79, 56, 40, 0.08);
}

.login-card h1 {
  margin: 0 0 8px;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 20px;
}

@media (max-width: 900px) {
  .filters-grid,
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .detail-list div {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}
