:root {
  --blue: #0f6da8;
  --deep: #083c64;
  --gold: #f4b63f;
  --ink: #132238;
  --muted: #64748b;
  --line: #d8e4ee;
  --soft: #f4f8fb;
  --surface: #ffffff;
  --danger: #b42318;
  --success: #13795b;
  --shadow: 0 18px 40px rgba(8, 60, 100, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", Arial, sans-serif;
  color: var(--ink);
  background: var(--soft);
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.admin-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px clamp(18px, 4vw, 48px);
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  color: white;
  font-weight: 800;
  background: linear-gradient(135deg, var(--blue), #45bfd3);
  border-radius: 8px;
}

.brand strong,
.brand small { display: block; }
.brand small, .eyebrow, .hint { color: var(--muted); }

.admin-header nav {
  display: flex;
  gap: 16px;
  color: var(--deep);
  font-weight: 700;
}

.page,
.login-view {
  padding: clamp(28px, 5vw, 54px);
}

.login-view {
  min-height: calc(100vh - 73px);
  display: grid;
  place-items: center;
}

.panel,
dialog {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-panel {
  width: min(440px, 100%);
  padding: 28px;
}

.page-title,
.panel-title,
.dialog-title,
.participants-title,
.toolbar,
.title-actions,
.toolbar-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 16px; font-size: clamp(32px, 5vw, 48px); line-height: 1.12; }
h2 { margin-bottom: 8px; font-size: 26px; }
h3 { margin-bottom: 8px; font-size: 18px; }

.eyebrow {
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

label {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
  font-weight: 700;
}

input, select, textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid #c9d7e3;
  border-radius: 8px;
  outline: none;
  background: white;
}

textarea { resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(15, 109, 168, 0.14);
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
}

.button.primary { color: #07243c; background: var(--gold); }
.button.secondary { color: white; background: var(--blue); }
.button.ghost { color: var(--deep); background: white; border-color: var(--line); }
.button.danger { color: white; background: var(--danger); }

.activity-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px;
  background: linear-gradient(135deg, #083c64, #0f6da8);
  color: white;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.activity-card .eyebrow,
.activity-card p { color: rgba(255,255,255,.82); }

.admin-entry-card {
  background: linear-gradient(135deg, #17324d, #13795b);
}

.activity-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  padding: 20px;
  margin-bottom: 18px;
}

.settings-panel {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 180px auto minmax(140px, 0.45fr);
  gap: 14px;
  align-items: end;
  padding: 20px;
  margin-bottom: 18px;
}

.settings-panel h2 {
  margin-bottom: 4px;
}

.settings-panel .hint {
  margin: 0;
  font-size: 13px;
}

.settings-panel label,
.settings-panel .message {
  margin-bottom: 0;
}

.activity-summary div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.activity-summary span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.activity-summary strong {
  display: block;
  margin-top: 4px;
}

.session-overview {
  padding: 20px;
  margin-bottom: 18px;
}

.session-overview__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

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

.session-card {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfd;
}

.session-card strong {
  color: var(--deep);
  line-height: 1.35;
}

.session-card span,
.session-card small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.toolbar {
  padding: 18px;
  margin-bottom: 18px;
}

.filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 12px;
  flex: 1;
}

.roster-panel {
  padding: 20px;
}

.count-pill {
  padding: 6px 12px;
  color: var(--deep);
  background: #e8f4fd;
  border-radius: 999px;
  font-weight: 800;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
  background: white;
}

th, td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  color: var(--deep);
  background: #eef6fb;
  white-space: nowrap;
}

.mini {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.session-mini {
  color: var(--deep);
  font-weight: 700;
}

.payment-paid { color: var(--success); font-weight: 800; }
.payment-unpaid { color: var(--danger); font-weight: 800; }

dialog {
  width: min(980px, calc(100vw - 28px));
  padding: 0;
}

dialog::backdrop {
  background: rgba(8, 35, 60, .44);
}

.dialog-form {
  padding: 24px;
}

.icon-button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

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

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

.scope-card {
  display: grid;
  gap: 10px;
  align-content: start;
}

.scope-grid select[multiple] {
  min-height: 132px;
}

.inline-editor {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto auto;
  gap: 8px;
  align-items: center;
}

.inline-editor input {
  min-height: 38px;
}

.inline-editor .button {
  min-height: 38px;
  padding-inline: 12px;
  white-space: nowrap;
}

.url-hint {
  display: grid;
  gap: 8px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfd;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.url-hint strong {
  color: var(--deep);
}

.url-hint code {
  display: inline-block;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--ink);
  font-family: Consolas, "Microsoft YaHei", monospace;
}

.admin-table {
  min-width: 960px;
}

.status-pill {
  display: inline-flex;
  min-width: 56px;
  justify-content: center;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.status-pill.active {
  color: var(--success);
  background: #e8f7f0;
}

.status-pill.disabled {
  color: var(--danger);
  background: #fff1f0;
}

.participants-block {
  padding: 16px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfd;
}

.participant-row {
  display: grid;
  grid-template-columns: 120px 1fr 1.35fr 1fr 140px 40px;
  gap: 10px;
  align-items: end;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.participant-row:first-child { border-top: 0; }

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 18px;
}

.message {
  min-height: 22px;
  margin: 10px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.message.error { color: var(--danger); }
.message.success { color: var(--success); }
.hidden { display: none !important; }

@media (max-width: 900px) {
  .admin-header,
  .page-title,
  .toolbar,
  .activity-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .activity-summary,
  .session-overview__grid,
  .settings-panel,
  .filters,
  .form-grid,
  .scope-grid {
    grid-template-columns: 1fr;
  }

  .participant-row {
    grid-template-columns: 1fr;
  }

  .toolbar-actions,
  .title-actions {
    flex-wrap: wrap;
  }

  .inline-editor {
    grid-template-columns: 1fr;
  }
}
