:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --border: #dfe4ec;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --danger-dark: #b91c1c;
  --success: #15803d;
  --warning: #b45309;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 8px 24px rgba(15, 23, 42, 0.04);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  line-height: 1.6;
}

.wrap { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 64px; }
.brand { font-size: 18px; font-weight: 700; color: var(--text); text-decoration: none; }
.main-nav { display: flex; gap: 20px; }
.main-nav a { color: var(--muted); text-decoration: none; font-size: 14px; }
.main-nav a:hover { color: var(--primary); }
.main-content { padding: 28px 0 40px; min-height: calc(100vh - 130px); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}

h1 { margin: 0 0 8px; font-size: 24px; }
h2 { margin: 0 0 12px; font-size: 20px; }
.lead { margin: 0 0 24px; color: var(--muted); font-size: 14px; }
.required { color: var(--danger); }

.flashes { margin-bottom: 20px; display: grid; gap: 8px; }
.flash { padding: 10px 14px; border-radius: 8px; font-size: 14px; border: 1px solid transparent; }
.flash-success { background: #ecfdf3; color: var(--success); border-color: #bbf7d0; }
.flash-error { background: #fef2f2; color: var(--danger); border-color: #fecaca; }
.flash-warning { background: #fffbeb; color: var(--warning); border-color: #fde68a; }
.flash-info { background: #eff6ff; color: var(--primary); border-color: #bfdbfe; }

.submit-card, .login-card, .error-card { max-width: 640px; margin: 0 auto; }

.field { margin-bottom: 18px; border: 0; padding: 0; }
.field label, .field legend { display: block; margin-bottom: 6px; font-weight: 600; font-size: 14px; }
.field input[type="text"], .field input[type="email"], .field input[type="password"],
.field select, .field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: #fff; color: var(--text); font: inherit; font-size: 14px;
}
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.field-error { margin: 6px 0 0; color: var(--danger); font-size: 13px; min-height: 1em; }
.radio-label { display: inline-flex; align-items: center; gap: 8px; margin-right: 20px; font-weight: 400; }
.honeypot { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

button { font: inherit; cursor: pointer; }
.btn-primary, .btn-secondary, .btn-danger {
  display: inline-block; border-radius: 8px; padding: 10px 16px; font-size: 14px;
  font-weight: 600; text-decoration: none; border: 1px solid transparent;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: #fff; color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: #f9fafb; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-dark); }
.btn-block { width: 100%; }
.btn-small { padding: 5px 10px; font-size: 12px; border-radius: 6px; border: 1px solid var(--border); background: #fff; color: var(--text); }
.btn-small:hover { background: #f9fafb; }
.btn-reply { background: #eff6ff; color: var(--primary); border-color: #bfdbfe; }
.btn-reply:hover { background: #dbeafe; }
.form-result { margin: 14px 0 0; font-size: 14px; min-height: 1.5em; }
.form-result.success { color: var(--success); }
.form-result.error { color: var(--danger); }

.admin-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.admin-header .lead { margin-bottom: 0; }
.status-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.status-tabs a {
  padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--muted); text-decoration: none; font-size: 14px;
}
.status-tabs a span { margin-left: 4px; font-size: 12px; opacity: 0.8; }
.status-tabs a.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.table-card { padding: 18px; }
.table-toolbar { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }
.select-all-label { font-size: 14px; color: var(--muted); }
.table-scroll { overflow-x: auto; }
.feedback-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.feedback-table th, .feedback-table td { padding: 12px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.feedback-table th { color: var(--muted); font-weight: 600; font-size: 13px; white-space: nowrap; }
.feedback-table tr:last-child td { border-bottom: 0; }
.col-check { width: 34px; }
.col-id { width: 60px; color: var(--muted); white-space: nowrap; }
.col-meta { width: 240px; }
.col-status { width: 90px; }
.col-actions { width: 210px; }

.info-line { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.tag { display: inline-block; background: #eff6ff; color: var(--primary); border: 1px solid #bfdbfe;
       border-radius: 6px; padding: 1px 8px; font-size: 12px; }
.muted { color: var(--muted); font-size: 12px; }
.detail-text, .plain-text { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; font-family: inherit; }
.reply-history { margin-top: 8px; font-size: 13px; color: var(--muted); }
.reply-history summary { cursor: pointer; }
.reply-history .detail-text { margin-top: 6px; padding: 8px; background: #f9fafb; border-radius: 6px; }

.status-badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; white-space: nowrap; }
.status-未处理 { background: #fff7ed; color: var(--warning); }
.status-已处理 { background: #ecfdf3; color: var(--success); }
.status-不处理 { background: #f3f4f6; color: var(--muted); }
.status-已反馈 { background: #eff6ff; color: var(--primary); }

.action-group { display: flex; flex-wrap: wrap; gap: 6px; }
.inline-form { margin: 0; }
.table-note, .empty-state { color: var(--muted); font-size: 13px; margin: 14px 0 0; }
.empty-state { text-align: center; padding: 36px 0; }

.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.45); }
.modal-dialog { position: relative; width: min(560px, 100%); max-height: calc(100vh - 40px); overflow-y: auto;
                background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.modal-subtitle { color: var(--muted); font-size: 14px; margin: 0 0 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 10px; }
.footer { padding: 0 0 24px; color: var(--muted); font-size: 12px; }

@media (max-width: 760px) {
  .admin-header { flex-direction: column; }
  .card { padding: 20px; }
  .col-meta, .col-actions { width: auto; }
}
