:root {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #667085;
  --line: #dfe4ec;
  --primary: #2364d2;
  --primary-dark: #164da8;
  --success: #0f8a5f;
  --success-soft: #e7f7ef;
  --warning: #ad6b00;
  --warning-soft: #fff3d8;
  --danger: #c4362e;
  --danger-soft: #fde8e6;
  --shadow: 0 16px 40px rgba(23, 32, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(35, 100, 210, 0.08), transparent 320px),
    var(--bg);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  color: var(--text);
  background: #fff;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(35, 100, 210, 0.14);
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
}

.app-header,
.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.app-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding: 34px 0 22px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 7px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(26px, 4vw, 40px);
}

h2 {
  font-size: 20px;
}

.header-actions,
.form-actions,
.toolbar,
.row-actions,
.status-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.primary-btn,
.secondary-btn,
.danger-btn,
.status-btn,
.text-btn {
  min-height: 40px;
  border-radius: 8px;
  padding: 9px 14px;
  font-weight: 700;
  white-space: nowrap;
}

.primary-btn {
  color: #fff;
  background: var(--primary);
}

.primary-btn:hover {
  background: var(--primary-dark);
}

.secondary-btn {
  color: var(--text);
  background: #eef2f7;
}

.danger-btn {
  color: #fff;
  background: var(--danger);
}

.event-panel,
.form-panel,
.list-panel,
.csv-preview {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.event-panel,
.csv-preview {
  padding: 22px;
}

.csv-preview {
  margin-top: 16px;
}

.csv-preview textarea {
  width: 100%;
  min-height: 180px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--text);
  background: #fbfcff;
  resize: vertical;
  line-height: 1.7;
}

.export-status {
  flex-basis: 100%;
  border: 1px solid #b7d7c5;
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--success);
  background: var(--success-soft);
  font-size: 14px;
}

.download-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  border-radius: 8px;
  padding: 9px 14px;
  color: #fff;
  background: var(--primary);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

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

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.section-heading.compact {
  margin-bottom: 14px;
}

.save-hint {
  color: var(--success);
  font-size: 13px;
  white-space: nowrap;
}

.event-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 16px 0;
}

.stat-card {
  display: grid;
  gap: 8px;
  min-height: 104px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #fff;
}

.stat-card span {
  color: var(--muted);
}

.stat-card strong {
  font-size: 30px;
}

.stat-card.checked {
  background: var(--success-soft);
}

.stat-card.pending {
  background: var(--warning-soft);
}

.stat-card.limit {
  background: #edf3ff;
}

.manager-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  padding-bottom: 34px;
}

.form-panel,
.list-panel {
  padding: 20px;
}

.person-form {
  display: grid;
  gap: 14px;
}

.form-actions {
  flex-wrap: wrap;
  margin-top: 2px;
}

.form-message {
  min-height: 20px;
  margin: 0;
  color: var(--success);
  font-size: 13px;
}

.list-heading {
  align-items: flex-end;
}

.toolbar {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.search-box {
  width: 210px;
}

.filter-box {
  width: 140px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 13px 10px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  background: #fafbfc;
}

td {
  font-size: 14px;
}

.person-name {
  display: grid;
  gap: 4px;
}

.person-name strong {
  font-size: 15px;
}

.person-name span,
.subtle {
  color: var(--muted);
  font-size: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 700;
}

.badge.checked {
  color: var(--success);
  background: var(--success-soft);
}

.badge.unchecked {
  color: var(--warning);
  background: var(--warning-soft);
}

.status-btn {
  color: var(--primary);
  background: #edf3ff;
}

.text-btn {
  color: var(--primary);
  background: transparent;
  padding-inline: 8px;
}

.text-btn.danger {
  color: var(--danger);
}

.empty-state {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 180px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  margin-top: 16px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
  background: #fafbfc;
}

.empty-state strong {
  color: var(--text);
}

.empty-state p {
  margin: 0;
}

.hidden {
  display: none !important;
}

@media (max-width: 960px) {
  .app-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .event-grid,
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .manager-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .app-header,
  .app-shell {
    width: min(100% - 20px, 1180px);
  }

  .app-header {
    padding-top: 22px;
  }

  .header-actions,
  .csv-actions,
  .toolbar,
  .form-actions {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }

  .header-actions button,
  .csv-actions a,
  .csv-actions button,
  .form-actions button,
  .search-box,
  .filter-box {
    width: 100%;
  }

  .event-panel,
  .csv-preview,
  .form-panel,
  .list-panel {
    padding: 16px;
  }

  .section-heading,
  .list-heading {
    flex-direction: column;
    align-items: stretch;
  }

  .event-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .stat-card {
    min-height: 86px;
  }

  table {
    min-width: 0;
  }

  thead {
    display: none;
  }

  tbody,
  tr,
  td {
    display: block;
    width: 100%;
  }

  tr {
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 12px;
    padding: 10px;
    background: #fff;
  }

  td {
    border-bottom: 0;
    padding: 8px 4px;
  }

  td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
  }

  .row-actions,
  .status-cell {
    align-items: stretch;
    flex-direction: column;
  }

  .row-actions button,
  .status-cell button {
    width: 100%;
  }
}
