:root {
  --ink: #142033;
  --muted: #5c6b7e;
  --line: #d7e0ea;
  --bg: #eef3f8;
  --panel: #ffffff;
  --brand: #0b3d5c;
  --brand-2: #1a6a8a;
  --accent: #c45c26;
  --ok: #1f7a4c;
  --danger: #a32020;
  --shadow: 0 10px 30px rgba(20, 32, 51, 0.08);
  --radius: 14px;
  --font: "Source Han Sans SC", "Noto Sans SC", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
  --display: "Source Han Serif SC", "Noto Serif SC", "Songti SC", "STSong", serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #d9e8f4 0%, transparent 55%),
    radial-gradient(900px 420px at 100% 0%, #f3e6d8 0%, transparent 50%),
    var(--bg);
}

a {
  color: var(--brand-2);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

.nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.4rem;
  background: rgba(11, 61, 92, 0.96);
  color: #f4f8fb;
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(8px);
}

.nav a {
  color: #d7e8f3;
}
.nav a.active,
.nav a:hover {
  color: #fff;
  text-decoration: none;
}

.brand {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  color: #fff !important;
  margin-right: 0.5rem;
}

.nav-links {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  flex: 1;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.9rem;
  color: #c5d8e6;
}

.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1.2rem 3rem;
}

.page-head h1 {
  margin: 0 0 0.35rem;
  font-family: var(--display);
  font-size: 1.8rem;
  letter-spacing: 0.02em;
}
.page-head p {
  margin: 0 0 1.25rem;
  color: var(--muted);
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.metric,
.panel,
.login-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.metric {
  padding: 1.1rem 1.2rem;
}
.metric-label {
  color: var(--muted);
  font-size: 0.9rem;
}
.metric-value {
  font-size: 2rem;
  font-weight: 700;
  margin-top: 0.25rem;
  color: var(--brand);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.panel {
  padding: 1.1rem 1.2rem;
}
.panel h2,
.section-title {
  margin: 0 0 0.85rem;
  font-size: 1.05rem;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.35rem 0;
  border-bottom: 1px dashed var(--line);
  font-size: 0.95rem;
}
.stat-row:last-child {
  border-bottom: 0;
}

.enroll-scroll {
  max-height: 220px;
  overflow: auto;
}

.table-wrap {
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.table th,
.table td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.table th {
  background: #f4f8fb;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}
.table tr.dup {
  background: #fff8f2;
}
.ellipsis {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1rem;
  align-items: center;
}
.filters input,
.filters select,
label input,
label textarea,
label select,
.stack input,
.stack textarea,
.stack select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  font: inherit;
  background: #fff;
}
.filters input {
  min-width: 220px;
  flex: 1;
}
.filters select {
  width: auto;
  min-width: 140px;
}

label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: var(--muted);
}
label.check {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  width: auto;
}
label.check input {
  width: auto;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem 1rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.2rem;
}
.form-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 0.6rem;
  margin-top: 0.4rem;
}

.stack {
  display: grid;
  gap: 0.8rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 0.5rem 1rem;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover {
  text-decoration: none;
  border-color: var(--brand-2);
}
.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  border-color: transparent;
}
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: inherit;
  padding-inline: 0.5rem;
}
.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: transparent;
}

.tag {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: #f0e2d5;
  color: #7a3d16;
}
.tag-ok {
  background: #d9eee3;
  color: var(--ok);
}

.flash {
  margin-bottom: 1rem;
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
}
.flash-ok {
  background: #e8f6ee;
  border-color: #b7dfc7;
  color: var(--ok);
}
.flash-error {
  background: #fdecec;
  border-color: #efc0c0;
  color: var(--danger);
}

.login-wrap {
  min-height: calc(100vh - 3rem);
  display: grid;
  place-items: center;
}
.login-card {
  width: min(420px, 100%);
  padding: 2rem 1.6rem;
}
.login-card .eyebrow {
  margin: 0;
  color: var(--accent);
  letter-spacing: 0.12em;
  font-size: 0.8rem;
  text-transform: uppercase;
}
.login-card h1 {
  margin: 0.35rem 0 0.2rem;
  font-family: var(--display);
  font-size: 2rem;
  color: var(--brand);
}
.login-card .sub {
  margin: 0 0 1.2rem;
  color: var(--muted);
}

.export-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-bottom: 1.5rem;
}

.danger-zone {
  border-color: #efc0c0;
}
.danger-zone h2 {
  color: var(--danger);
}

.dup-group {
  margin-bottom: 1rem;
}
.dup-row {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  padding: 0.45rem 0;
  border-bottom: 1px dashed var(--line);
}
.dup-row input[type='radio'] {
  width: auto;
  margin-top: 0.3rem;
}

.inline {
  display: inline;
}
.muted {
  color: var(--muted);
}

@media (max-width: 860px) {
  .cards,
  .grid-2,
  .form-grid {
    grid-template-columns: 1fr;
  }
  .nav {
    flex-wrap: wrap;
  }
}
