:root {
  --red: #9f1f24;
  --red-dark: #7c171b;
  --green: #156c57;
  --gold: #c49a4a;
  --ink: #1f2a33;
  --muted: #6f7782;
  --line: #dfe5e9;
  --bg: #f5f7f7;
  --panel: #ffffff;
  --soft-red: #fff5f5;
  --shadow: 0 12px 34px rgba(31, 42, 51, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

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

.site-header {
  background: var(--panel);
  box-shadow: 0 2px 12px rgba(31, 42, 51, 0.08);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topline {
  border-top: 5px solid var(--red);
}

.header-inner {
  min-height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

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

.brand-mark {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: block;
  object-fit: contain;
  background: #fff;
  border: 1px solid rgba(159, 31, 36, 0.16);
  box-shadow: 0 4px 12px rgba(31, 42, 51, 0.12);
  flex: 0 0 auto;
}

.brand-kicker {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 14px;
  font-weight: 700;
}

.brand h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: 0;
}

.header-link {
  border: 1px solid var(--red);
  color: var(--red);
  padding: 9px 16px;
  border-radius: 4px;
  font-weight: 700;
  white-space: nowrap;
}

.nav-bar {
  background: var(--red);
  color: #fff;
}

.nav-scroll {
  display: flex;
  align-items: center;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-scroll::-webkit-scrollbar {
  display: none;
}

.nav-scroll a {
  padding: 14px 20px;
  min-width: max-content;
  font-weight: 700;
}

.nav-scroll a:hover {
  background: var(--red-dark);
}

.hero-band {
  background:
    linear-gradient(90deg, rgba(159, 31, 36, 0.9), rgba(21, 108, 87, 0.82)),
    linear-gradient(135deg, #f3efe3 0%, #dde8e0 100%);
  color: #fff;
  padding: 42px 0;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 28px;
  align-items: stretch;
}

.hero-copy {
  min-height: 330px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.section-label {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.hero-copy .section-label {
  color: #f7d58d;
}

.hero-copy h2,
.section-heading h2,
.admin-toolbar h2 {
  margin: 0;
  letter-spacing: 0;
}

.hero-copy h2 {
  max-width: 680px;
  font-size: 40px;
  line-height: 1.18;
}

.hero-text {
  max-width: 660px;
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 17px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.primary-button,
.secondary-button,
.outline-button {
  min-height: 42px;
  border: 0;
  border-radius: 4px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.primary-button {
  color: #fff;
  background: var(--red);
  box-shadow: 0 8px 20px rgba(159, 31, 36, 0.25);
}

.secondary-button {
  color: var(--red);
  background: #fff;
  border: 1px solid rgba(159, 31, 36, 0.22);
}

.outline-button {
  color: var(--green);
  background: #fff;
  border: 1px solid rgba(21, 108, 87, 0.34);
}

.primary-button:hover,
.secondary-button:hover,
.outline-button:hover {
  transform: translateY(-1px);
}

.notice-panel {
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  border-radius: 8px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
  margin-bottom: 12px;
}

.panel-title span {
  color: var(--red);
  font-weight: 800;
}

.panel-title strong {
  color: var(--green);
}

.material-list,
.tips-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.material-list li,
.tips-list li {
  position: relative;
  padding: 10px 0 10px 18px;
  border-bottom: 1px dashed var(--line);
}

.material-list li::before,
.tips-list li::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--red);
  position: absolute;
  left: 0;
  top: 19px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  padding: 30px 0 42px;
  align-items: start;
}

.form-panel,
.info-block,
.login-panel,
.filter-panel,
.chart-panel,
.table-panel,
.records-panel,
.admin-toolbar,
.admin-hero {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.form-panel {
  padding: 26px;
}

.section-heading {
  border-left: 5px solid var(--red);
  padding-left: 14px;
  margin-bottom: 22px;
}

.section-heading h2 {
  font-size: 26px;
}

.section-heading span {
  color: var(--muted);
  display: block;
  margin-top: 6px;
}

.section-heading.small h2 {
  font-size: 22px;
}

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

label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

label span {
  color: #34414d;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cfd7dd;
  background: #fff;
  color: var(--ink);
  border-radius: 4px;
  min-height: 44px;
  padding: 10px 12px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(21, 108, 87, 0.12);
}

.wide {
  grid-column: 1 / -1;
}

.email-box {
  margin-top: 20px;
  padding: 18px;
  border: 1px solid rgba(159, 31, 36, 0.22);
  background: var(--soft-red);
  border-radius: 8px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(140px, 220px);
  gap: 12px;
  align-items: end;
}

.form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 20px;
}

.message {
  min-height: 22px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.message.success {
  color: var(--green);
  font-weight: 700;
}

.message.error {
  color: var(--red);
  font-weight: 700;
}

body.dialog-open {
  overflow: hidden;
}

.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(20, 28, 34, 0.48);
}

.success-dialog {
  width: min(620px, 100%);
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  position: relative;
  background: #fff;
  border-radius: 8px;
  border-top: 5px solid var(--red);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.24);
  padding: 28px;
}

.success-dialog h2 {
  margin: 0;
  color: var(--red);
  font-size: 28px;
  letter-spacing: 0;
}

.success-dialog p {
  margin: 12px 0 0;
  color: #42505b;
}

.dialog-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: #f1f4f5;
  color: #51606b;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.dialog-close:hover {
  background: #e6ecee;
}

.dialog-materials {
  margin-top: 18px;
  padding: 16px 18px;
  background: #fbfcfc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.dialog-materials strong {
  display: block;
  color: var(--green);
  margin-bottom: 8px;
}

.dialog-materials ul {
  margin: 0;
  padding-left: 20px;
  color: #2f3d48;
}

.dialog-materials li + li {
  margin-top: 6px;
}

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

.side-column {
  display: grid;
  gap: 18px;
}

.info-block {
  padding: 20px;
}

.lookup-form {
  display: grid;
  gap: 12px;
}

.lookup-code-row,
.login-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.full-button {
  width: 100%;
}

.column-title {
  color: var(--red);
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 10px;
}

.footer {
  background: #263238;
  color: rgba(255, 255, 255, 0.82);
}

.footer-inner {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 14px;
}

.admin-shell {
  padding: 26px 0 48px;
}

.admin-page {
  background: #eef3f4;
}

.login-panel {
  max-width: 620px;
  padding: 26px;
  margin: 0 auto;
}

.admin-content {
  display: grid;
  gap: 18px;
}

.is-hidden {
  display: none !important;
}

.admin-hero {
  padding: 22px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  border-top: 4px solid var(--red);
  background:
    linear-gradient(90deg, rgba(159, 31, 36, 0.07), rgba(21, 108, 87, 0.05)),
    #fff;
}

.admin-hero h2 {
  margin: 0;
  font-size: 28px;
}

.admin-hero span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

.admin-toolbar {
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.toolbar-actions {
  display: flex;
  gap: 10px;
  flex: 0 0 auto;
}

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

.stats-grid article {
  background: var(--panel);
  border: 1px solid #d9e2e5;
  border-radius: 8px;
  padding: 18px 18px 16px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.stats-grid article::before {
  content: "";
  width: 5px;
  height: 44px;
  border-radius: 99px;
  background: var(--green);
  position: absolute;
  top: 18px;
  right: 18px;
}

.stats-grid article:nth-child(1)::before,
.stats-grid article:nth-child(4)::before {
  background: var(--red);
}

.stats-grid article:nth-child(3)::before {
  background: var(--gold);
}

.stats-grid span {
  color: var(--muted);
  display: block;
  margin-bottom: 6px;
  font-weight: 700;
}

.stats-grid strong {
  font-size: 34px;
  color: var(--red);
  line-height: 1.1;
}

.filter-panel {
  padding: 18px;
  display: grid;
  grid-template-columns: minmax(280px, 1.6fr) minmax(180px, 0.8fr);
  gap: 12px;
  align-items: end;
}

.filter-field {
  gap: 6px;
}

.filter-field span {
  color: #53616c;
  font-size: 13px;
}

.filter-field input,
.filter-field select {
  min-height: 42px;
  background: #fbfcfc;
}

.filter-search input {
  border-color: rgba(159, 31, 36, 0.28);
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.charts-grid.single-chart {
  grid-template-columns: 1fr;
}

.chart-panel {
  padding: 18px;
  box-shadow: none;
  min-height: 260px;
}

.bar-list {
  display: grid;
  gap: 10px;
}

.bar-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) 40px;
  gap: 10px;
  align-items: center;
  font-size: 14px;
}

.bar-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  height: 12px;
  background: #eef2f3;
  border-radius: 99px;
  overflow: hidden;
}

.bar-value {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--red), var(--green));
  border-radius: inherit;
  min-width: 2px;
}

.pie-layout {
  min-height: 206px;
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 22px;
  align-items: center;
}

.pie-chart {
  width: 180px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  align-content: center;
  position: relative;
  background: conic-gradient(#dfe5e9 0 100%);
  box-shadow: inset 0 0 0 1px rgba(31, 42, 51, 0.08);
}

.pie-chart::after {
  content: "";
  position: absolute;
  inset: 38px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(31, 42, 51, 0.08);
}

.pie-chart span,
.pie-chart small {
  position: relative;
  z-index: 1;
}

.pie-chart span {
  font-size: 34px;
  font-weight: 800;
  color: var(--red);
  line-height: 1.1;
}

.pie-chart small {
  color: var(--muted);
  font-weight: 700;
}

.pie-legend {
  display: grid;
  gap: 12px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid #edf1f2;
  border-radius: 6px;
  background: #fbfcfc;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.male-dot {
  background: var(--green);
}

.female-dot {
  background: var(--red);
}

.legend-item strong,
.legend-item small {
  display: block;
}

.legend-item small {
  color: var(--muted);
  margin-top: 2px;
}

.table-panel {
  overflow: hidden;
}

.records-panel {
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(31, 42, 51, 0.09);
}

.table-head {
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.table-head p {
  margin: 0;
  color: var(--muted);
}

.table-hint {
  font-size: 14px;
}

.records-list {
  display: grid;
  gap: 8px;
  padding: 10px;
  background: #f8fafb;
}

.record-card {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid #dce5e7;
  border-radius: 6px;
  background: #fff;
  box-shadow: none;
}

.record-card:hover {
  border-color: rgba(21, 108, 87, 0.34);
  box-shadow: 0 6px 14px rgba(31, 42, 51, 0.06);
}

.record-main {
  display: grid;
  grid-template-columns: 36px minmax(130px, 0.9fr) minmax(132px, 0.75fr) minmax(200px, 1.15fr) minmax(150px, 0.8fr);
  gap: 12px;
  align-items: center;
}

.student-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #fff;
  background: var(--red);
  font-weight: 800;
}

.student-summary {
  min-width: 0;
}

.student-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.student-line strong {
  font-size: 16px;
}

.student-line > span {
  color: var(--muted);
  font-size: 13px;
}

.record-field {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.record-field span,
.record-meta span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 0;
  flex: 0 0 auto;
}

.record-field strong,
.record-meta strong {
  display: block;
  font-size: 14px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.record-field strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  gap: 12px;
  padding: 6px 0 0 48px;
  border-top: 1px solid #edf1f2;
}

.record-meta > div {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.empty-record {
  padding: 36px;
  text-align: center;
  color: var(--muted);
  background: #fff;
  border: 1px dashed #cfdadd;
  border-radius: 8px;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.pagination-info {
  color: #52616d;
  font-size: 14px;
  font-weight: 700;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-size-field {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.page-size-field span {
  color: var(--muted);
  font-size: 13px;
}

.page-size-field select {
  width: 78px;
  min-height: 36px;
  padding: 6px 8px;
}

.page-button {
  min-height: 36px;
  padding: 0 14px;
}

.page-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

.table-wrap {
  overflow-x: auto;
}

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

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

th {
  background: #f7f9fa;
  color: #34414d;
  font-weight: 800;
}

td strong {
  display: block;
  font-size: 15px;
}

.cell-muted {
  color: var(--muted);
  font-size: 13px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 4px;
  background: #edf4f1;
  color: var(--green);
  font-weight: 700;
  font-size: 12px;
}

.tag.warn {
  background: #fff1e1;
  color: #9a5f00;
}

.row-actions {
  display: grid;
  gap: 8px;
}

.row-actions select,
.row-actions textarea {
  min-width: 160px;
  font-size: 13px;
}

.row-actions button {
  min-height: 34px;
}

@media (max-width: 960px) {
  .hero-grid,
  .content-grid,
  .charts-grid {
    grid-template-columns: 1fr;
  }

  .hero-copy {
    min-height: auto;
  }

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

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

  .record-card {
    grid-template-columns: 1fr;
  }

  .record-main {
    grid-template-columns: 36px minmax(0, 1fr) minmax(140px, 0.6fr);
  }

  .record-field:nth-of-type(2) {
    grid-column: 2 / -1;
  }
}

@media (max-width: 720px) {
  .container {
    width: min(100% - 22px, 1180px);
  }

  .header-inner {
    min-height: 74px;
  }

  .brand-mark {
    width: 48px;
    height: 48px;
  }

  .brand h1 {
    font-size: 21px;
  }

  .brand-kicker {
    font-size: 12px;
  }

  .header-link {
    padding: 8px 10px;
    font-size: 13px;
  }

  .nav-scroll a {
    padding: 12px 14px;
    font-size: 14px;
  }

  .hero-band {
    padding: 30px 0;
  }

  .hero-copy h2 {
    font-size: 30px;
  }

  .hero-text {
    font-size: 15px;
  }

  .form-panel,
  .info-block,
  .login-panel {
    padding: 18px;
  }

  .form-grid,
  .email-box,
  .filter-panel,
  .stats-grid,
  .admin-toolbar,
  .admin-hero,
  .table-head,
  .footer-inner {
    grid-template-columns: 1fr;
  }

  .email-box {
    display: grid;
  }

  .form-footer,
  .admin-toolbar,
  .admin-hero,
  .table-head,
  .footer-inner {
    display: grid;
  }

  .submit-button,
  .toolbar-actions,
  .toolbar-actions button {
    width: 100%;
  }

  .toolbar-actions {
    display: grid;
  }

  .login-row,
  .lookup-code-row {
    grid-template-columns: 1fr;
  }

  .bar-row {
    grid-template-columns: 90px minmax(0, 1fr) 34px;
  }

  .pie-layout {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .pie-legend {
    width: 100%;
  }

  .admin-shell {
    padding-top: 16px;
  }

  .admin-hero {
    padding: 18px;
  }

  .admin-hero h2 {
    font-size: 24px;
  }

  .record-details,
  .record-main,
  .record-meta {
    grid-template-columns: 1fr;
  }

  .success-dialog {
    padding: 22px 18px 18px;
  }

  .success-dialog h2 {
    font-size: 24px;
  }

  .dialog-actions .primary-button {
    width: 100%;
  }

  .record-card {
    padding: 12px;
    gap: 8px;
  }

  .record-meta {
    padding-left: 0;
  }

  .pagination-bar,
  .pagination-controls {
    display: grid;
    grid-template-columns: 1fr;
  }

  .page-size-field {
    justify-content: space-between;
  }

  .page-button {
    width: 100%;
  }

  .records-list {
    padding: 8px;
  }

  .record-details {
    gap: 8px;
  }

  .detail-item {
    padding: 9px 10px;
  }

}
