* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Microsoft YaHei", Arial, sans-serif;
  background: linear-gradient(180deg, #f2f6fb 0%, #edf2f7 100%);
  color: #1f2937;
}
a { color: inherit; }
.site-shell { min-height: 100vh; }
.site-header {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 16px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.site-title { font-size: 24px; font-weight: 700; }
.site-subtitle { color: #64748b; margin-top: 6px; font-size: 14px; }
.user-menu { position: relative; }
.user-menu summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  background: rgba(255,255,255,0.88);
  border: 1px solid #d8e1eb;
  padding: 8px 12px;
  border-radius: 999px;
}
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 160px;
  background: #fff;
  border: 1px solid #d8e1eb;
  border-radius: 14px;
  box-shadow: 0 14px 38px rgba(15, 23, 42, 0.12);
  padding: 8px;
  display: grid;
  gap: 6px;
  z-index: 50;
}
.avatar, .profile-avatar {
  object-fit: cover;
  border-radius: 50%;
  background: #e8eef7;
}
.avatar { width: 34px; height: 34px; }
.profile-avatar { width: 88px; height: 88px; margin-bottom: 12px; }
.menu-link,
.menu-button {
  width: 100%;
  display: block;
  text-align: left;
  border: none;
  background: #f8fafc;
  text-decoration: none;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  cursor: pointer;
}
.menu-button:hover,
.menu-link:hover { background: #eef3f9; }
.guest-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.page { max-width: 1180px; margin: 24px auto; padding: 0 16px 28px; }
.page.wide { max-width: 1400px; }
.card {
  background: rgba(255,255,255,0.92);
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  padding: 22px;
  margin-bottom: 16px;
}
.hero { background: linear-gradient(135deg, #eef6ff 0%, #fbfdff 100%); }
h1, h2, h3 { margin-top: 0; }
.muted { color: #6b7280; font-size: 14px; }
.topbar { display: flex; gap: 10px; margin-bottom: 16px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.btn {
  display: inline-block;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #111827;
  border-radius: 12px;
  padding: 10px 16px;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: #f9fafb; }
.btn-primary { background: #2563eb; border-color: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-danger { background: #dc2626; border-color: #dc2626; color: #fff; }
.grid-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.field-row { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.field-inline {
  flex-direction: row;
  align-items: flex-end;
  gap: 10px;
}
.field-fill {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
input[type="text"], input[type="number"], input[type="email"], input[type="password"], select, input[type="file"] {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  background: #fff;
}
.status {
  margin-top: 12px;
  min-height: 24px;
  font-size: 14px;
}
.status.ok { color: #15803d; }
.status.err { color: #dc2626; }
.simple-list {
  margin: 0;
  padding-left: 18px;
  line-height: 1.9;
}
.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-layout {
  width: min(1080px, 100%);
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  background: rgba(255,255,255,0.92);
  border-radius: 28px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.14);
}
.auth-hero {
  padding: 48px;
  background: linear-gradient(135deg, #153b71 0%, #285ea8 45%, #7db7e8 100%);
  color: #fff;
}
.eyebrow {
  display: inline-block;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
}
.auth-hero h1 {
  font-size: 38px;
  line-height: 1.2;
  margin: 18px 0 14px;
}
.auth-hero p,
.auth-hero .simple-list { color: rgba(255,255,255,0.88); }
.auth-card { padding: 40px 34px; }
.auth-form { margin-top: 18px; }
.auth-submit { width: 100%; margin-top: 6px; }
.auth-switch {
  display: inline-block;
  margin-top: 16px;
  color: #2563eb;
  text-decoration: none;
}
.banner {
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  margin-top: 12px;
}
.banner-error { background: #fef2f2; color: #b91c1c; }
.banner-success { background: #f0fdf4; color: #15803d; }
.profile-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.stats-grid-four {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.stat-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 18px;
}
.stat-value { font-size: 32px; font-weight: 700; }
.stat-label { margin-top: 8px; color: #64748b; }
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.record-table {
  display: grid;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  overflow: hidden;
}
.record-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 0.8fr 0.7fr 1fr;
  gap: 12px;
  padding: 14px 16px;
  background: #fff;
  border-top: 1px solid #eef2f7;
  align-items: center;
  font-size: 14px;
}
.record-row:first-child { border-top: none; }
.record-head {
  background: #f8fafc;
  font-weight: 700;
  color: #475569;
}
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  padding: 5px 10px;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 12px;
}
.pill-score {
  background: #ecfeff;
  color: #0f766e;
}
.empty-panel {
  border: 1px dashed #cbd5e1;
  border-radius: 16px;
  padding: 28px 20px;
  text-align: center;
  color: #64748b;
  background: #f8fafc;
}
.report-history-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.history-card {
  overflow: hidden;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  background: #fff;
}
.history-preview {
  height: 200px;
  background: #f8fafc;
}
.history-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.history-placeholder {
  height: 100%;
  display: grid;
  place-items: center;
  color: #94a3b8;
}
.history-body {
  padding: 16px;
}
.history-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.history-title-row h3 {
  margin: 0;
  font-size: 18px;
}
.history-meta {
  color: #64748b;
  font-size: 14px;
  margin-bottom: 10px;
}
.history-summary {
  margin: 0 0 14px;
  color: #334155;
  line-height: 1.7;
}
.history-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.canvas-wrap { overflow: auto; max-height: 75vh; border: 1px solid #e5e7eb; border-radius: 12px; background: #f8fafc; }
.canvas-stage { position: relative; display: inline-block; }
.canvas-stage img { display: block; max-width: none; }
.canvas-stage canvas { position: absolute; left: 0; top: 0; pointer-events: auto; }
.json-preview {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 12px;
  padding: 12px;
  min-height: 280px;
  overflow: auto;
}
.room-item, .rule-item, .score-item {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
  background: #fafafa;
}
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  margin-left: 6px;
  background: #e5e7eb;
}
.tag.high { background: #fee2e2; color: #991b1b; }
.tag.medium { background: #fef3c7; color: #92400e; }
.tag.low { background: #dbeafe; color: #1d4ed8; }
.report-image { max-width: 100%; border: 1px solid #e5e7eb; border-radius: 12px; }
@media (max-width: 960px) {
  .grid-two,
  .auth-layout { grid-template-columns: 1fr; }
  .site-header {
    align-items: flex-start;
    flex-direction: column;
  }
  .field-inline {
    flex-direction: column;
    align-items: stretch;
  }
  .section-head,
  .history-actions {
    flex-direction: column;
    align-items: flex-start;
  }
  .record-row,
  .report-history-grid,
  .stats-grid-four {
    grid-template-columns: 1fr;
  }
  .auth-hero,
  .auth-card { padding: 28px 22px; }
}
