:root {
  color-scheme: light;
  font-family: Inter, "Microsoft YaHei", system-ui, sans-serif;
  color: #18211d;
  background: #f4f6f2;
}

* { box-sizing: border-box; }
body { margin: 0; }
a { color: inherit; }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 5vw;
  background: #173c2b;
  color: white;
}

.brand { font-weight: 750; text-decoration: none; }
.site-header nav { display: flex; gap: 16px; align-items: center; }
.site-header form { margin: 0; }
.link-button { border: 0; background: none; color: white; cursor: pointer; }
.page-shell { width: min(1080px, 90vw); margin: 0 auto; padding: 64px 0; }
.hero { max-width: 720px; margin-bottom: 36px; }
.hero h1, .login-card h1 { margin: 8px 0 12px; font-size: clamp(32px, 5vw, 52px); line-height: 1.08; }
.eyebrow { color: #397451; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.muted { color: #657168; }
.error { color: #a12525; }

.count-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: 28px 0 36px;
}

.count-grid article, .login-card {
  background: white;
  border: 1px solid #dfe6df;
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 12px 32px rgba(23, 60, 43, .07);
}

.count-grid strong { display: block; font-size: 34px; color: #173c2b; }
.count-grid span { color: #657168; }
.login-card { max-width: 440px; margin: 4vh auto; }
.stack-form { display: grid; gap: 18px; }
.stack-form label { display: grid; gap: 8px; font-weight: 650; }
.stack-form input { width: 100%; border: 1px solid #cbd5cc; border-radius: 10px; padding: 12px; font: inherit; }
.primary-button { display: inline-block; border: 0; border-radius: 10px; padding: 12px 18px; background: #173c2b; color: white; text-decoration: none; font-weight: 700; cursor: pointer; }
.secondary-button { border: 1px solid #173c2b; border-radius: 10px; padding: 10px 15px; background: white; color: #173c2b; font-weight: 700; cursor: pointer; }
.ai-panel { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px 18px; border: 1px solid #b9d4c2; border-radius: 14px; background: #eef7f1; margin-bottom: 22px; }
.ai-panel small { display: block; margin-top: 5px; color: #657168; }
.site-header nav a { text-decoration: none; }
.notice, .warning { border-radius: 12px; padding: 14px 16px; margin: 0 0 24px; }
.notice { background: #e1f3e7; color: #174d2b; }
.warning { background: #fff1cd; color: #604700; border: 1px solid #efd588; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.page-heading h1 { margin: 4px 0 0; font-size: clamp(30px, 4vw, 44px); }
.material-list { display: grid; gap: 14px; }
.search-form { display: grid; grid-template-columns: 2fr repeat(3, 1fr) auto auto; gap: 12px; align-items: end; padding: 18px; margin-bottom: 22px; border: 1px solid #dfe6df; border-radius: 14px; background: white; }
.search-form div { display: grid; gap: 6px; }
.search-form label { font-size: 13px; font-weight: 700; }
.search-form input, .search-form select { width: 100%; border: 1px solid #cbd5cc; border-radius: 9px; padding: 10px; background: white; font: inherit; }
.material-list article, .empty-state, .form-section { background: white; border: 1px solid #dfe6df; border-radius: 16px; padding: 22px; }
.material-list article { display: flex; justify-content: space-between; gap: 24px; }
.material-list h2 { margin: 0 0 8px; font-size: 20px; }
.material-list p { margin: 6px 0; }
.empty-state { text-align: center; padding: 54px 24px; }
.material-form { display: grid; gap: 20px; }
.form-section { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.form-section h2 { grid-column: 1 / -1; margin: 0; }
.field { display: grid; align-content: start; gap: 7px; }
.field:has(textarea[name="raw_content"]) { grid-column: 1 / -1; }
.field label { font-weight: 700; }
.field input:not([type="checkbox"]), .field select, .field textarea { width: 100%; border: 1px solid #cbd5cc; border-radius: 10px; padding: 11px; font: inherit; background: white; }
.field ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 7px; }
.field ul label { font-weight: 400; }

@media (max-width: 700px) {
  .page-shell { padding: 36px 0; }
  .count-grid { grid-template-columns: repeat(2, 1fr); }
  .page-heading, .material-list article { align-items: stretch; flex-direction: column; }
  .form-section { grid-template-columns: 1fr; }
  .search-form { grid-template-columns: 1fr; }
  .form-section h2, .field:has(textarea[name="raw_content"]) { grid-column: 1; }
}
