:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --bg-strong: #eaf0f8;
  --panel: rgba(255, 255, 255, 0.88);
  --panel-solid: #ffffff;
  --panel-muted: #f7faff;
  --ink: #071126;
  --muted: #6d778a;
  --subtle: #98a3b5;
  --line: rgba(130, 149, 176, 0.24);
  --line-strong: rgba(23, 92, 255, 0.28);
  --primary: #175cff;
  --primary-2: #00a6ff;
  --primary-soft: rgba(23, 92, 255, 0.1);
  --cyan-soft: rgba(0, 166, 255, 0.12);
  --green: #0f9f78;
  --orange: #d97706;
  --danger: #b42318;
  --shadow: 0 22px 70px rgba(28, 43, 72, 0.12);
  --shadow-soft: 0 14px 38px rgba(28, 43, 72, 0.08);
  --glow: 0 0 0 1px rgba(23, 92, 255, 0.16), 0 18px 38px rgba(23, 92, 255, 0.12);
  --radius: 8px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #07111f;
  --bg-strong: #0b1a2d;
  --panel: rgba(12, 24, 42, 0.86);
  --panel-solid: #0f1d31;
  --panel-muted: #0b1728;
  --ink: #ecf5ff;
  --muted: #aebbd0;
  --subtle: #7888a0;
  --line: rgba(160, 190, 230, 0.18);
  --line-strong: rgba(77, 163, 255, 0.36);
  --primary: #5aa2ff;
  --primary-2: #2ee6c8;
  --primary-soft: rgba(90, 162, 255, 0.14);
  --cyan-soft: rgba(46, 230, 200, 0.11);
  --green: #34d399;
  --orange: #fbbf24;
  --danger: #f87171;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.42);
  --shadow-soft: 0 18px 44px rgba(0, 0, 0, 0.26);
  --glow: 0 0 0 1px rgba(90, 162, 255, 0.2), 0 20px 50px rgba(46, 230, 200, 0.1);
}

/* ===== 青云之志（绿色系） ===== */
:root[data-theme="qingyun"] {
  color-scheme: light;
  --bg: #f4f8f5;
  --bg-strong: #e9f3ee;
  --panel: rgba(255, 255, 255, 0.88);
  --panel-solid: #ffffff;
  --panel-muted: #f5faf7;
  --ink: #2a5a42;
  --muted: #5a8a72;
  --subtle: #8db8a2;
  --line: rgba(80, 130, 105, 0.22);
  --line-strong: rgba(15, 125, 78, 0.28);
  --primary: #0f7d4e;
  --primary-2: #10b981;
  --primary-soft: rgba(15, 125, 78, 0.1);
  --cyan-soft: rgba(16, 185, 129, 0.12);
  --green: #0f9f78;
  --orange: #d97706;
  --danger: #b42318;
  --shadow: 0 22px 70px rgba(20, 50, 35, 0.12);
  --shadow-soft: 0 14px 38px rgba(20, 50, 35, 0.08);
  --glow: 0 0 0 1px rgba(15, 125, 78, 0.16), 0 18px 38px rgba(15, 125, 78, 0.12);
}

/* ===== 金榜题名（橙红色系） ===== */
:root[data-theme="nuanyang"] {
  color-scheme: light;
  --bg: #fdf8f3;
  --bg-strong: #faf0e6;
  --panel: rgba(255, 255, 255, 0.88);
  --panel-solid: #ffffff;
  --panel-muted: #fef9f4;
  --ink: #6a4224;
  --muted: #9a7050;
  --subtle: #c8a080;
  --line: rgba(160, 110, 70, 0.22);
  --line-strong: rgba(217, 119, 6, 0.28);
  --primary: #d97706;
  --primary-2: #f97316;
  --primary-soft: rgba(217, 119, 6, 0.1);
  --cyan-soft: rgba(249, 115, 22, 0.12);
  --green: #0f9f78;
  --orange: #ea580c;
  --danger: #b42318;
  --shadow: 0 22px 70px rgba(50, 30, 15, 0.12);
  --shadow-soft: 0 14px 38px rgba(50, 30, 15, 0.08);
  --glow: 0 0 0 1px rgba(217, 119, 6, 0.16), 0 18px 38px rgba(217, 119, 6, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 6%, var(--primary-soft), transparent 30%),
    radial-gradient(circle at 84% 0%, var(--cyan-soft), transparent 28%),
    linear-gradient(180deg, var(--bg-strong) 0%, var(--bg) 42%, var(--bg) 100%);
  font-family: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(120, 144, 180, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 144, 180, 0.08) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.72), transparent 70%);
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: 0.62;
}

.app-shell {
  position: relative;
  z-index: 1;
  max-width: 1500px;
  margin: 0 auto;
  padding: 22px;
}

.top-nav {
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 12px 14px;
  margin-bottom: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.brand {
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 900;
  font-size: 20px;
  white-space: nowrap;
}

.brand::before {
  content: "";
  display: inline-block;
  width: 11px;
  height: 11px;
  margin-right: 9px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 0 18px var(--primary);
  vertical-align: 1px;
}

.nav-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  justify-content: flex-end;
}

.nav-tabs[hidden] {
  display: none !important;
}

.nav-tab,
.theme-toggle {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  border-radius: var(--radius);
  padding: 10px 13px;
  white-space: nowrap;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.nav-tab:hover,
.theme-toggle:hover {
  color: var(--ink);
  background: var(--panel-muted);
  border-color: var(--line);
}

.nav-tab.active {
  color: var(--primary);
  background: linear-gradient(180deg, var(--primary-soft), transparent);
  border-color: var(--line-strong);
  box-shadow: inset 0 -2px 0 var(--primary);
  font-weight: 900;
}

.theme-toggle {
  border-color: var(--line);
  background: var(--panel-solid);
  color: var(--ink);
  font-weight: 800;
  position: relative;
}

.theme-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 200;
  min-width: 180px;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 6px;
  display: none;
}

.theme-menu.open {
  display: block;
}

.theme-menu-title {
  font-size: 12px;
  color: var(--subtle);
  padding: 6px 10px 4px;
  font-weight: 600;
}

.theme-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--ink);
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background 120ms ease;
}

.theme-option:hover {
  background: var(--panel-muted);
}

.theme-option.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
}

.theme-swatch {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--line);
  flex-shrink: 0;
}

.theme-swatch.light { background: linear-gradient(135deg, #ffffff 50%, #f4f7fb 50%); }
.theme-swatch.dark { background: linear-gradient(135deg, #5aa2ff 50%, #07111f 50%); }
.theme-swatch.qingyun { background: linear-gradient(135deg, #34d399 50%, #f4f8f5 50%); }
.theme-swatch.nuanyang { background: linear-gradient(135deg, #f97316 50%, #fdf8f3 50%); }

.page-panel {
  min-height: calc(100vh - 120px);
  padding: 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  align-items: center;
  gap: 18px;
  margin-bottom: 22px;
}

.toolbar-segments {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.search {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 58px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-solid);
  box-shadow: var(--shadow-soft);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.search:focus-within {
  border-color: var(--line-strong);
  box-shadow: var(--glow);
}

.search-icon {
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  color: var(--primary);
  font-size: 24px;
  line-height: 1;
}

.search input {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 18px;
}

.search input::placeholder {
  color: var(--subtle);
}

.segmented {
  display: inline-flex;
  max-width: min(100%, 620px);
  overflow-x: auto;
  padding: 4px;
  background: var(--panel-muted);
  background: color-mix(in srgb, var(--panel-muted) 82%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.segmented button {
  flex: 0 0 auto;
  border: 0;
  min-width: 74px;
  padding: 10px 16px;
  color: var(--muted);
  background: transparent;
  border-radius: var(--radius);
  font-weight: 800;
  transition: color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.segmented button.active {
  color: var(--primary);
  background: var(--panel-solid);
  box-shadow: var(--shadow-soft);
}

.discipline-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(80px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.popular-category-grid {
  grid-template-columns: repeat(8, minmax(0, 1fr));
}

.popular-category-grid .discipline-card {
  min-height: 78px;
  padding: 10px 8px;
  text-align: center;
}

.popular-category-grid .discipline-card span:first-child {
  line-height: 1.35;
}

.card-grid.popular-major-card-grid {
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  width: 100%;
}

.discipline-card {
  min-height: 86px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--panel-solid), var(--panel-muted));
  display: grid;
  place-items: center;
  gap: 4px;
  color: var(--ink);
  box-shadow: var(--shadow-soft);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.discipline-card:hover,
.data-card:hover,
.result-card:hover,
.rich-block:hover,
.school-link-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: var(--glow);
}

.discipline-card.active {
  border-color: var(--discipline-color, var(--primary));
  background: var(--panel-solid);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--discipline-color, var(--primary)) 14%, transparent), transparent),
    var(--panel-solid);
  color: var(--discipline-color, var(--primary));
  font-weight: 900;
}

.icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  color: var(--discipline-color, var(--primary));
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.7), transparent 34%),
    color-mix(in srgb, var(--discipline-color, var(--primary)) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--discipline-color, var(--primary)) 34%, transparent);
  border-radius: 8px;
  box-shadow: 0 8px 22px color-mix(in srgb, var(--discipline-color, var(--primary)) 20%, transparent);
  font-size: 20px;
  line-height: 1;
}

.content-layout {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 28px;
}

.side-list {
  max-height: 650px;
  overflow: auto;
  background: var(--panel-muted);
  background: color-mix(in srgb, var(--panel-muted) 84%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px;
}

.side-item {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  padding: 15px 18px;
  border-radius: var(--radius);
  font-weight: 800;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
}

.side-item:hover {
  color: var(--primary);
  background: var(--panel-solid);
  border-color: var(--line);
}

.side-item.active {
  color: var(--primary);
  background: var(--panel-solid);
  border-color: var(--line-strong);
}

.section-title {
  display: flex;
  align-items: baseline;
  gap: 12px;
  justify-content: space-between;
  margin: 4px 0 18px;
}

.section-title-main {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.section-title h2 {
  margin: 0;
  font-size: 23px;
  font-weight: 900;
}

.section-title span {
  color: var(--muted);
}

.section-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.data-card,
.result-card,
.detail-section,
.rich-block,
.metric-card,
.school-rich-card,
.school-history-card,
.program-rich-card,
.rich-list-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-solid);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--panel-solid) 92%, transparent), var(--panel-solid));
  box-shadow: var(--shadow-soft);
}

.data-card {
  min-height: 116px;
  padding: 22px;
  color: var(--ink);
  text-align: left;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.data-card h3 {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: 21px;
  font-weight: 900;
}

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
  color: var(--muted);
}

.pagination-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pagination button {
  min-width: 38px;
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--panel-solid);
  box-shadow: var(--shadow-soft);
  font-weight: 800;
}

.pagination button.active {
  color: var(--primary);
  border-color: var(--line-strong);
  box-shadow: var(--glow);
}

.pagination button:disabled {
  cursor: not-allowed;
  color: var(--subtle);
  background: var(--panel-muted);
  box-shadow: none;
}

.pagination-ellipsis {
  padding: 0 2px;
  color: var(--subtle);
}

.meta {
  color: var(--muted);
  line-height: 1.8;
}

.badge,
.info-chip {
  display: inline-flex;
  align-items: center;
  margin: 0 6px 6px 0;
  padding: 4px 8px;
  color: var(--muted);
  background: var(--panel-muted);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 800;
}

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

.detail-title {
  min-width: 0;
  flex: 1 1 auto;
}

.detail-head h1 {
  margin: 0 0 4px;
  font-size: 30px;
  font-weight: 950;
  line-height: 1.18;
}

.detail-head .back-btn {
  flex: 0 0 auto;
}

.detail-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  align-self: flex-start;
}

.baike-btn {
  color: var(--ink);
  border-color: var(--line);
}

.back-btn,
.primary-btn {
  border: 1px solid var(--line-strong);
  background: var(--panel-solid);
  color: var(--primary);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-weight: 900;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.back-btn:hover,
.primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--glow);
}

.primary-btn {
  border-color: transparent;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
}

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

.detail-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.detail-tab {
  border: 1px solid var(--line);
  background: var(--panel-solid);
  color: var(--muted);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-weight: 800;
}

.detail-tab.active {
  color: var(--primary);
  background: var(--primary-soft);
  border-color: var(--line-strong);
}

.detail-panel {
  min-height: 360px;
}

.detail-section {
  padding: 20px;
}

.detail-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.detail-section h3 {
  margin: 0;
  font-size: 20px;
  flex: 0 0 auto;
}

.detail-source-note {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px 12px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.6;
  text-align: right;
}

.detail-source-links {
  position: relative;
  color: var(--primary);
  font-weight: 800;
}

.detail-source-links summary {
  cursor: pointer;
  list-style: none;
}

.detail-source-links summary::-webkit-details-marker {
  display: none;
}

.detail-source-link-list {
  position: absolute;
  right: 0;
  z-index: 80;
  display: grid;
  min-width: 320px;
  gap: 8px;
  margin-top: 8px;
  padding: 12px;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: left;
}

.detail-source-link-list a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  line-height: 1.45;
}

.detail-source-link-list a:hover {
  color: var(--primary);
}

.detail-section p,
.detail-section li {
  color: var(--muted);
  line-height: 1.85;
}

.rich-text p,
.rich-block p {
  margin: 0 0 12px;
}

.rich-text .rich-subhead,
.rich-block .rich-subhead {
  margin: 16px 0 8px;
  color: var(--ink);
  font-weight: 900;
  line-height: 1.55;
}

.rich-block .course-note {
  margin: 8px 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
}

.rich-blocks,
.school-rich-list,
.school-history-list,
.program-rich-list,
.rich-list {
  display: grid;
  gap: 12px;
}

.rich-block,
.school-rich-card,
.school-history-card,
.program-rich-card,
.rich-list-item {
  padding: 16px;
}

.recommendation-rich-item {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.25fr) minmax(150px, 0.75fr) auto;
  align-items: center;
  gap: 14px;
}

.recommendation-cell {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.recommendation-cell strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 16px;
  font-weight: 900;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recommendation-cell .meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recommendation-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.recommendation-actions .back-btn {
  min-width: 86px;
  white-space: nowrap;
}

.rich-block h4,
.school-rich-card h4,
.school-history-card h4,
.program-rich-card h4 {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 900;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.info-chip {
  min-height: 28px;
  margin: 0;
  line-height: 1.3;
}

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

.metric-card {
  padding: 14px;
}

.metric-card span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.metric-card strong {
  color: var(--ink);
  font-size: 20px;
}

.salary-timeline {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
}

.salary-timeline span {
  padding: 10px 12px;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  font-weight: 800;
}

.school-link-card,
.program-info-btn {
  width: 100%;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.program-rich-card {
  display: grid;
  grid-template-columns: minmax(180px, 0.9fr) minmax(420px, 1.8fr) auto;
  align-items: start;
  gap: 18px;
}

.school-history-card {
  display: grid;
  grid-template-columns: minmax(180px, 0.9fr) minmax(420px, 1.8fr) auto;
  align-items: start;
  gap: 18px;
}

.program-basic,
.school-history-basic,
.program-history-column {
  min-width: 0;
}

.program-history {
  display: grid;
  gap: 7px;
}

.program-history-row {
  display: grid;
  grid-template-columns: 58px 96px 168px minmax(120px, 1fr);
  column-gap: 16px;
  align-items: baseline;
  color: var(--ink);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.55;
}

.program-history-year,
.program-history-plan,
.program-history-score,
.program-history-rank {
  white-space: nowrap;
}

.program-history-empty {
  color: var(--muted);
  font-weight: 800;
  line-height: 1.6;
}

.program-action {
  display: flex;
  justify-content: flex-end;
}

.program-info-btn {
  width: auto;
  white-space: nowrap;
}

.school-note {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.6;
}

.band-row {
  margin-top: 22px;
}

.band-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-size: 20px;
  font-weight: 900;
}

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

.result-card {
  padding: 16px;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.school-detail-entry {
  cursor: pointer;
}

.link-button {
  min-width: 0;
  border: 0;
  padding: 0;
  color: var(--ink);
  background: transparent;
  text-align: left;
  font-weight: 900;
  line-height: 1.35;
}

.link-button:hover {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.result-card .school-detail-link {
  display: block;
  margin-bottom: 8px;
  font-size: 16px;
}

.filling-page {
  display: grid;
  gap: 18px;
}

.filling-filter-board,
.filling-result-board {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel-solid);
  box-shadow: var(--shadow-soft);
}

.filling-filter-head {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}

.filling-mode-tabs {
  display: flex;
  min-height: 50px;
}

.filling-mode-tabs button {
  min-width: 180px;
  border: 0;
  border-right: 1px solid var(--line);
  padding: 0 28px;
  color: var(--ink);
  background: var(--panel-muted);
  font-weight: 500;
}

.filling-mode-tabs button.active {
  color: var(--primary);
  background: var(--panel-solid);
}

.filling-mode-tabs button:disabled,
.filling-mode-tabs button.disabled {
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.48;
}

.filling-student-summary {
  display: flex;
  align-items: center;
  padding-right: 24px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
  white-space: nowrap;
}

.filling-filter-body {
  display: grid;
  gap: 10px;
  padding: 16px 22px;
}

.filling-chip-row {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  align-items: flex-start;
  gap: 10px;
}

.filling-chip-row > span {
  padding-top: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.filling-chip-row > div {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.filling-chip-wrap {
  position: relative;
  display: inline-flex;
}

.filling-chip-row button,
.filling-condition-tag {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 4px 12px;
  color: var(--ink);
  background: var(--panel-solid);
  font-size: 13px;
  font-weight: 400;
}

.filling-chip-row button.filling-select-chip {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 118px;
  padding-right: 10px;
  text-align: left;
}

.filling-select-arrow {
  width: 7px;
  height: 7px;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  color: #9aa3af;
  transform: rotate(45deg) translateY(-2px);
  flex: 0 0 auto;
}

.filling-chip-row button.filling-select-chip.active .filling-select-arrow {
  color: var(--primary);
}

.filling-dropdown-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 20;
  min-width: 360px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel-solid);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.16);
  color: var(--ink);
  font-size: 12px;
}

.filling-major-cascade {
  display: grid;
  grid-template-columns: 132px 172px;
  width: min(304px, calc(100vw - 40px));
  max-width: 304px;
}

.filling-cascade-classes {
  max-height: 300px;
  overflow: auto;
  border-right: 1px solid var(--line);
  padding: 8px 0;
}

.filling-cascade-classes button {
  width: 100%;
  min-height: 30px;
  border: 0;
  border-radius: 0;
  padding: 6px 10px 6px 14px;
  background: transparent;
  color: var(--ink);
  justify-content: space-between;
  font-size: 12px;
  text-align: left;
}

.filling-cascade-classes button.active {
  color: var(--primary);
  background: var(--primary-soft);
}

.filling-cascade-majors-wrap {
  position: relative;
  width: 172px;
  min-width: 0;
}

.filling-scroll-cue {
  position: absolute;
  left: 0;
  right: 0;
  height: 34px;
  pointer-events: none;
}

.filling-scroll-cue::before {
  content: "";
  position: absolute;
  right: 8px;
  z-index: 1;
  width: 7px;
  height: 7px;
  pointer-events: none;
  border-right: 2px solid var(--primary);
  border-bottom: 2px solid var(--primary);
}

.filling-scroll-cue-top {
  top: 0;
  background: linear-gradient(to top, rgba(255, 255, 255, 0), var(--panel-solid) 72%);
}

.filling-scroll-cue-top::before {
  top: 10px;
  transform: rotate(225deg);
}

.filling-scroll-cue-bottom {
  bottom: 0;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0), var(--panel-solid) 72%);
}

.filling-scroll-cue-bottom::before {
  bottom: 9px;
  transform: rotate(45deg);
}

.filling-cascade-majors-wrap:not(.is-scrollable) .filling-scroll-cue,
.filling-cascade-majors-wrap.is-at-top .filling-scroll-cue-top,
.filling-cascade-majors-wrap.is-at-bottom .filling-scroll-cue-bottom {
  display: none;
}

.filling-cascade-majors {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  box-sizing: border-box;
  width: 100%;
  max-height: 300px;
  overflow-x: hidden;
  overflow-y: scroll;
  padding: 12px 0;
  scrollbar-color: var(--primary) var(--primary-soft);
  scrollbar-width: thin;
}

.filling-cascade-majors::-webkit-scrollbar {
  width: 8px;
}

.filling-cascade-majors::-webkit-scrollbar-track {
  background: color-mix(in srgb, var(--primary) 18%, var(--panel-muted));
  border-radius: 999px;
}

.filling-cascade-majors::-webkit-scrollbar-thumb {
  border: 2px solid color-mix(in srgb, var(--primary) 18%, var(--panel-muted));
  border-radius: 999px;
  background: var(--primary);
}

.filling-dropdown-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 8px 14px;
  max-height: 300px;
  overflow: auto;
  padding: 12px 14px;
}

.filling-dropdown-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.35;
  white-space: nowrap;
}

.filling-dropdown-check input {
  width: 13px;
  height: 13px;
  margin: 0;
  accent-color: var(--primary);
}

.filling-cascade-placeholder,
.filling-dropdown-empty {
  color: var(--muted);
  padding: 14px;
  white-space: nowrap;
}

.filling-dropdown-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding: 10px 12px;
}

.filling-dropdown-actions button {
  min-height: 28px;
  min-width: 64px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 4px 14px;
  color: var(--ink);
  background: var(--panel-solid);
  font-size: 12px;
}

.filling-dropdown-actions button.primary {
  color: #fff;
  border-color: var(--primary);
  background: var(--primary);
}

.filling-chip-wrap > button.active,
.filling-condition-tag {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--panel-solid);
}

.filling-focus-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

.filling-focus-row > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.filling-focus-row input {
  width: min(360px, 100%);
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0 14px;
  color: var(--ink);
  background: var(--panel-solid);
  font-size: 13px;
}

.filling-focus-box {
  position: relative;
  width: min(360px, 100%);
}

.filling-focus-box input {
  width: 100%;
}

.filling-focus-results {
  position: absolute;
  z-index: 8;
  top: calc(100% + 4px);
  left: 0;
  width: 100%;
}

.filling-focus-panel,
.filling-focus-empty {
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--panel-solid);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
}

.filling-focus-panel {
  display: grid;
  gap: 4px;
  max-height: 240px;
  overflow: auto;
  padding: 8px;
}

.filling-focus-empty {
  padding: 10px 12px;
  color: var(--muted);
  font-size: 13px;
}

.filling-focus-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  padding: 4px 6px;
  color: var(--ink);
  font-size: 13px;
}

.filling-focus-option input {
  width: 14px;
  height: 14px;
  accent-color: var(--primary);
}

.filling-filter-footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  padding: 10px 22px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel-muted) 76%, transparent);
}

.filling-filter-footer > span:first-child {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.filling-condition-tag {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 18px 3px 10px;
  color: var(--ink);
  border-color: var(--line);
  font-size: 12px;
}

.filling-condition-tag button {
  position: absolute;
  top: -5px;
  right: -5px;
  display: inline-grid;
  place-items: center;
  width: 14px;
  height: 14px;
  min-height: 0;
  border: 1px solid var(--primary);
  border-radius: 50%;
  padding: 0;
  color: var(--primary);
  background: var(--panel-solid);
  font-size: 11px;
  line-height: 1;
}

.filling-condition-empty {
  color: var(--muted);
  font-weight: 400;
}

.filling-clear-btn {
  margin-left: auto;
}

.volunteer-generate-btn {
  min-width: 112px;
}

.filling-hidden-controls {
  display: none;
}

.filling-side-actions {
  position: fixed;
  right: 12px;
  top: 50%;
  z-index: 40;
  display: flex;
  flex-direction: column;
  width: 62px;
  padding: 10px 0;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--line) 76%, transparent);
  border-radius: 18px;
  background: color-mix(in srgb, var(--panel-solid) 96%, white);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.14);
  transform: translateY(-50%);
}

.filling-side-actions button {
  display: grid;
  justify-items: center;
  gap: 0;
  width: 100%;
  min-height: 72px;
  border: 0;
  border-radius: 0;
  padding: 8px 4px;
  color: var(--ink);
  background: transparent;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.2;
  cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease;
}

.filling-side-actions button:hover {
  color: var(--primary);
  background: color-mix(in srgb, var(--primary-soft) 82%, transparent);
}

.filling-side-actions svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.filling-side-actions button span {
  display: block;
  white-space: nowrap;
}

.filling-result-toolbar {
  display: grid;
  grid-template-columns: minmax(140px, auto) 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  border-bottom: 2px solid var(--line-strong);
}

.filling-result-tabs {
  display: flex;
}

.filling-result-tabs button {
  min-width: 170px;
  min-height: 46px;
  border: 0;
  border-right: 1px solid var(--line);
  color: var(--ink);
  background: var(--panel-solid);
  font-weight: 900;
}

.filling-result-tabs button.active {
  color: #fff;
  background: var(--primary);
}

.filling-risk-tabs {
  justify-self: end;
  display: flex;
  gap: 6px;
  padding: 5px;
  border-radius: 999px;
  background: var(--panel-muted);
}

.filling-risk-tabs button {
  border: 0;
  border-radius: 999px;
  padding: 5px 14px;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
}

.filling-risk-tabs button.active {
  color: var(--primary);
  background: var(--panel-solid);
  box-shadow: var(--shadow-soft);
}

.filling-range-group,
.filling-probability {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-weight: 800;
  font-size: 13px;
  white-space: nowrap;
}

.filling-range-group {
  justify-self: end;
}

.filling-range-label {
  margin-right: 4px;
}

.range-max-val,
.range-min-val,
.prob-min-val,
.prob-max-val {
  border-radius: 999px;
  padding: 2px 10px;
  color: #fff;
  background: var(--primary);
  font-size: 12px;
  min-width: 28px;
  text-align: center;
}

.dual-range {
  position: relative;
  width: 160px;
  height: 24px;
  display: flex;
  align-items: center;
}

.dual-range-track {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 5px;
  border-radius: 999px;
  background: var(--line);
  transform: translateY(-50%);
  pointer-events: none;
}

.dual-range-thumb {
  position: absolute;
  top: 0;
  left: 0;
  width: 160px;
  height: 24px;
  margin: 0;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  pointer-events: none;
}

.dual-range-thumb::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--primary-2);
  background: var(--panel-solid);
  cursor: grab;
  box-shadow: var(--shadow-soft);
  pointer-events: auto;
  transition: transform 100ms ease;
}

.dual-range-thumb::-webkit-slider-thumb:hover {
  transform: scale(1.18);
}

.dual-range-thumb::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.05);
}

.dual-range-thumb::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--primary-2);
  background: var(--panel-solid);
  cursor: grab;
  box-shadow: var(--shadow-soft);
  pointer-events: auto;
}

.filling-result-head,
.filling-result-row {
  display: grid;
  grid-template-columns: 132px minmax(180px, 1fr) minmax(260px, 1.45fr) minmax(130px, 0.7fr) minmax(240px, 1.15fr) 120px;
}

.filling-result-head {
  min-height: 44px;
  align-items: center;
  color: var(--muted);
  background: var(--panel-muted);
  font-weight: 900;
}

.filling-result-head span {
  padding: 0 18px;
}

.filling-result-list {
  display: grid;
}

.filling-result-row {
  min-height: 160px;
  border-top: 1px solid var(--line);
  background: var(--panel-solid);
}

.filling-result-row > div {
  min-width: 0;
  padding: 18px;
  border-right: 1px solid var(--line);
}

.filling-result-row > div:last-child {
  border-right: 0;
}

.filling-result-row .filling-probability strong {
  color: var(--ink);
  font-size: 30px;
  line-height: 1;
}

.filling-result-row .filling-probability span {
  margin-top: -26px;
  margin-left: 38px;
  font-size: 12px;
}

.filling-result-row .filling-probability em {
  color: var(--muted);
  font-style: normal;
  font-size: 13px;
}

.filling-result-row .filling-probability b {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  color: #fff;
  background: var(--primary);
  text-align: center;
  line-height: 24px;
}

.filling-major-cell,
.filling-school-cell,
.filling-plan-cell,
.filling-history-cell,
.filling-apply-cell {
  display: grid;
  align-content: start;
  gap: 8px;
}

.filling-major-cell .link-button,
.filling-school-cell .link-button {
  color: #1769ff;
  font-size: 18px;
}

.filling-major-cell p,
.filling-school-cell p {
  margin: 0;
  color: var(--ink);
  line-height: 1.5;
}

.filling-major-cell span,
.filling-plan-cell span,
.filling-history-cell span {
  color: var(--muted);
  font-size: 13px;
}

.filling-plan-cell strong {
  color: var(--ink);
  font-size: 20px;
  font-weight: 500;
}

.filling-apply-cell {
  align-content: center;
  justify-items: center;
}

.filling-apply-cell .primary-btn {
  min-width: 74px;
  color: var(--primary);
  background: transparent;
  border-color: var(--primary);
}

.filling-apply-cell .filling-join-btn {
  position: relative;
  min-height: 34px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: none;
}

.filling-apply-cell .filling-join-btn:hover {
  background: var(--primary-soft);
}

.filling-apply-cell .filling-join-btn.is-added {
  color: #b42318;
  background: var(--primary-soft);
  border-color: color-mix(in srgb, var(--primary) 38%, #fff);
}

.filling-apply-cell .filling-join-btn.is-added::before {
  content: "✓";
  margin-right: 3px;
  font-size: 12px;
}

.filling-apply-cell .filling-join-btn .cancel-text {
  display: none;
}

.filling-apply-cell .filling-join-btn.is-added:hover {
  color: var(--primary);
  background: #fff;
  border-color: var(--primary);
}

.filling-apply-cell .filling-join-btn.is-added:hover::before,
.filling-apply-cell .filling-join-btn.is-added:hover .join-text {
  display: none;
}

.filling-apply-cell .filling-join-btn.is-added:hover .cancel-text {
  display: inline;
}

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

.volunteer-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-solid);
  box-shadow: var(--shadow-soft);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.volunteer-row.dragging {
  opacity: 0.48;
}

.volunteer-row.drag-over {
  border-color: var(--line-strong);
  box-shadow: var(--glow);
}

.volunteer-order {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  font-weight: 950;
}

.drag-handle {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-muted);
  color: var(--muted);
  cursor: grab;
  font-weight: 900;
}

.drag-handle:active {
  cursor: grabbing;
}

.volunteer-info {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(240px, 1.35fr) minmax(220px, 1fr);
  gap: 14px;
}

.volunteer-cell {
  min-width: 0;
  display: grid;
  grid-template-rows: 24px 24px;
  align-content: center;
  gap: 4px;
}

.volunteer-cell .link-button,
.volunteer-cell > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.volunteer-cell .link-button {
  color: var(--ink);
  font-size: 16px;
  font-weight: 900;
}

.volunteer-rank-line {
  color: var(--ink);
  font-weight: 500;
}

.volunteer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.form-field {
  display: grid;
  gap: 8px;
}

.form-field span,
.form-field label {
  color: var(--muted);
  font-weight: 800;
}

.form-field input,
.form-field select {
  height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 12px;
  color: var(--ink);
  background: var(--panel-solid);
  outline: 0;
}

.form-field input:focus,
.form-field select:focus {
  border-color: var(--line-strong);
  box-shadow: var(--glow);
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.form-actions > select {
  height: 42px;
  min-width: 96px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 12px;
  color: var(--ink);
  background: var(--panel-solid);
  outline: 0;
}

.form-actions > select:focus {
  border-color: var(--line-strong);
  box-shadow: var(--glow);
}

.profile-save-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 18px;
  margin-top: 18px;
}

.profile-save-hint {
  display: grid;
  flex: 0 1 620px;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.7;
}

.profile-save-row .primary-btn {
  flex: 0 0 auto;
}

.profile-password-grid {
  margin-top: 16px;
}

.permission-panel {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.permission-summary,
.payment-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

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

.permission-card {
  display: grid;
  gap: 8px;
  padding: 16px;
}

.permission-card span,
.payment-card p {
  color: var(--muted);
}

.permission-card strong {
  color: var(--danger);
  font-size: 22px;
}

.permission-card.active strong {
  color: var(--green);
}

.payment-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 16px;
}

.payment-card h3 {
  margin: 0 0 8px;
  font-size: 17px;
}

.payment-card strong {
  display: block;
  margin-bottom: 6px;
  color: var(--primary);
  font-size: 22px;
}

.payment-card p {
  margin: 0;
  line-height: 1.6;
}

.payment-modal {
  width: min(100%, 520px);
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-solid);
  box-shadow: var(--shadow);
}

.payment-body {
  display: grid;
  justify-items: center;
  gap: 14px;
  text-align: center;
}

.payment-price {
  color: var(--primary);
  font-size: 34px;
  font-weight: 950;
}

.payment-qr {
  width: 220px;
  height: 220px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.payment-qr.placeholder {
  display: grid;
  place-items: center;
  padding: 20px;
  color: var(--muted);
  background: var(--panel-muted);
}

.register-panel {
  display: grid;
  place-items: start center;
  padding: 18px 0 8px;
}

.register-card {
  width: min(100%, 780px);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-solid);
  box-shadow: var(--shadow-soft);
}

.register-status {
  margin-bottom: 18px;
  padding: 12px 14px;
  color: var(--muted);
  background: var(--panel-muted);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-weight: 800;
}

.register-status.registered {
  color: var(--green);
  border-color: color-mix(in srgb, var(--green) 34%, var(--line));
  background: color-mix(in srgb, var(--green) 12%, var(--panel-muted));
}

.admin-shell {
  max-width: 1680px;
}

.admin-panel {
  display: grid;
  gap: 20px;
}

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

.admin-head h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.16;
}

.admin-head p {
  margin: 8px 0 0;
  color: var(--muted);
}

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

.admin-metric {
  display: grid;
  gap: 8px;
  min-height: 130px;
  padding: 18px;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.admin-metric span,
.admin-metric small,
.admin-token-line span {
  color: var(--muted);
}

.admin-metric strong {
  font-size: 34px;
  line-height: 1;
}

.admin-token-line {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 0 16px;
  background: var(--panel-muted);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.admin-token-line strong {
  font-size: 20px;
}

.admin-table-wrap {
  display: grid;
  gap: 14px;
}

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

.admin-table {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.admin-table th {
  color: var(--muted);
  background: var(--panel-muted);
  font-size: 13px;
  font-weight: 900;
}

.admin-table tr:last-child td {
  border-bottom: 0;
}

.admin-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  padding: 5px 9px;
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 11%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 24%, transparent);
  border-radius: var(--radius);
  font-weight: 900;
}

.admin-pill.active {
  color: var(--green);
  background: rgba(15, 159, 120, 0.1);
  border-color: rgba(15, 159, 120, 0.28);
}

.admin-empty-cell {
  color: var(--muted);
  text-align: center !important;
}

.admin-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-weight: 800;
}

.admin-switch input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.admin-number-input {
  width: 92px;
  height: 36px;
  padding: 0 10px;
  color: var(--ink);
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: 0;
}

.admin-number-input:focus {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.admin-save-btn {
  min-height: 34px;
  padding: 7px 12px;
}

.register-grid {
  grid-template-columns: repeat(2, minmax(220px, 1fr));
}

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

.verification-field {
  grid-column: 1 / -1;
}

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

.terms-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 18px;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.7;
}

.terms-check input {
  width: 16px;
  height: 16px;
  margin-top: 5px;
  accent-color: var(--primary);
}

.terms-link {
  border: 0;
  padding: 0;
  color: var(--primary);
  background: transparent;
  font-weight: 900;
}

.terms-link:hover {
  text-decoration: underline;
}

.register-actions {
  display: flex;
  justify-content: flex-start;
  margin-top: 18px;
}

.form-error[data-type="notice"] {
  color: var(--primary);
  border-color: var(--line-strong);
  background: var(--primary-soft);
}

.form-error[data-type="success"] {
  color: var(--green);
  border-color: color-mix(in srgb, var(--green) 34%, var(--line));
  background: color-mix(in srgb, var(--green) 12%, var(--panel-muted));
}

.terms-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(4, 10, 22, 0.58);
  backdrop-filter: blur(14px);
}

.terms-page {
  width: min(100%, 980px);
  max-height: min(86vh, 920px);
  overflow: auto;
  padding: 24px;
  color: var(--ink);
  background: var(--panel-solid);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.terms-head {
  position: sticky;
  top: -24px;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 0 0 16px;
  margin-bottom: 14px;
  background: var(--panel-solid);
  border-bottom: 1px solid var(--line);
}

.terms-head h2 {
  margin: 8px 0 0;
  font-size: 24px;
  line-height: 1.25;
}

.terms-body {
  display: grid;
  gap: 12px;
}

.terms-section {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.terms-section:last-child {
  border-bottom: 0;
}

.terms-section h3 {
  margin: 0 0 8px;
  font-size: 17px;
}

.terms-section p {
  margin: 0;
  color: var(--muted);
  line-height: 1.9;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}

.inline-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.score-rank-card {
  display: grid;
  gap: 6px;
  margin: 4px 0 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--primary-soft);
}

.score-rank-card strong {
  color: var(--ink);
}

.score-rank-card span {
  color: var(--muted);
  line-height: 1.55;
}

.ai-plan-panel {
  margin: 16px 0 22px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--primary) 12%, transparent), transparent 46%),
    var(--panel-solid);
  box-shadow: var(--shadow);
}

.ai-plan-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.ai-plan-head h3 {
  margin: 8px 0 0;
  font-size: 22px;
}

.ai-plan-panel p {
  margin: 0 0 14px;
  color: var(--muted);
  line-height: 1.8;
}

.ai-plan-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 12px;
}

.ai-preference-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}

.ai-plan-block {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.ai-plan-block h4 {
  margin: 0 0 10px;
  color: var(--ink);
}

.ai-plan-block ul {
  margin: 0;
  padding-left: 18px;
}

.ai-plan-block li {
  margin-bottom: 8px;
  color: var(--muted);
  line-height: 1.65;
}

.ai-plan-note {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.mentor-shell {
  display: grid;
  grid-template-columns: minmax(190px, 226px) minmax(0, 1fr);
  gap: 18px;
  min-height: 620px;
}

.mentor-context,
.mentor-chat-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-solid);
  box-shadow: var(--shadow-soft);
}

.mentor-context {
  padding: 18px;
}

.mentor-context h3 {
  margin: 0 0 14px;
  font-size: 18px;
}

.mentor-context-grid {
  display: grid;
  gap: 10px;
}

.mentor-context-item {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-muted);
}

.mentor-context-item span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.mentor-context-item strong {
  color: var(--ink);
  font-size: 17px;
}

.mentor-note {
  margin-top: 14px;
  color: var(--muted);
  line-height: 1.75;
  font-size: 13px;
}

.mentor-chat-panel {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  min-width: 0;
  overflow: hidden;
}

.mentor-messages {
  display: grid;
  align-content: start;
  gap: 16px;
  max-height: 480px;
  overflow-y: auto;
  padding: 22px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--primary) 8%, transparent), transparent 38%),
    var(--panel-muted);
}

.mentor-message {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  max-width: 82%;
}

.mentor-message.user {
  justify-self: end;
  grid-template-columns: minmax(0, 1fr) 38px;
}

.mentor-message.user .mentor-avatar {
  grid-column: 2;
  grid-row: 1;
}

.mentor-message.user .mentor-bubble {
  grid-column: 1;
  grid-row: 1;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  border-color: transparent;
}

.mentor-message.user .mentor-text,
.mentor-message.user .mentor-text p {
  color: #fff;
}

.mentor-message.loading .mentor-bubble {
  border-color: var(--line-strong);
  box-shadow: var(--glow);
}

.mentor-message.loading .mentor-text::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-left: 8px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 10px 0 0 var(--primary-2), 20px 0 0 var(--subtle);
  vertical-align: 2px;
}

.mentor-avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  font-weight: 900;
}

.mentor-bubble {
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-solid);
  box-shadow: var(--shadow-soft);
}

.mentor-text {
  color: var(--ink);
  line-height: 1.78;
}

.mentor-text p {
  margin: 0;
  color: var(--ink);
  line-height: 1.78;
}

.mentor-text p + p {
  margin-top: 12px;
}

.mentor-text strong {
  color: var(--ink);
  font-weight: 900;
}

.mentor-message.user .mentor-text strong {
  color: #fff;
}

.mentor-text ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.mentor-text li {
  margin: 6px 0;
  line-height: 1.72;
}

.mentor-text code {
  padding: 2px 5px;
  border-radius: 5px;
  background: var(--panel-muted);
  color: var(--primary);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}

.mentor-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px 0;
  background: var(--panel-solid);
}

.mentor-prompt {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
  color: var(--primary);
  background: var(--primary-soft);
  font-weight: 800;
}

.mentor-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 16px;
  background: var(--panel-solid);
}

.mentor-input-row textarea {
  min-height: 54px;
  max-height: 140px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 13px;
  color: var(--ink);
  background: var(--panel-muted);
  outline: 0;
  line-height: 1.6;
}

.mentor-input-row textarea:focus {
  border-color: var(--line-strong);
  box-shadow: var(--glow);
}

.mentor-input-row .primary-btn {
  align-self: end;
  min-width: 92px;
  min-height: 54px;
}

.subject-block {
  margin: 4px 0 18px;
}

.subject-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 260px));
  gap: 14px;
}

.subject-column {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-muted);
}

.subject-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  color: var(--ink);
  font-weight: 800;
}

.subject-option input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--primary);
}

.form-error {
  margin-top: 10px;
  color: var(--danger);
  font-weight: 800;
  line-height: 1.6;
}

.empty {
  padding: 28px;
  color: var(--muted);
  background: var(--panel-muted);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.source-note {
  margin-top: 18px;
}

.source-note a {
  color: var(--primary);
  text-decoration: none;
}

@media (max-width: 980px) {
  .toolbar,
  .content-layout {
    display: block;
  }

  .toolbar-segments {
    display: flex;
    justify-content: flex-start;
    overflow-x: auto;
    margin-top: 12px;
  }

  .app-shell {
    padding: 14px;
  }

  .top-nav {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
  }

  .brand {
    min-width: 0;
    text-align: left;
  }

  .nav-tabs {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
    margin-top: 2px;
    overflow: visible;
    justify-content: stretch;
  }

  .nav-tab {
    min-width: 0;
    padding: 10px 8px;
    text-align: center;
    font-size: 14px;
  }

  .theme-toggle {
    padding: 9px 12px;
  }

  .page-panel {
    padding: 16px;
  }

  .section-title {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .section-title-main {
    flex-wrap: wrap;
  }

  .section-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .filling-side-actions {
    right: 8px;
    top: 50%;
    bottom: auto;
    width: 62px;
    transform: translateY(-50%);
  }

  .filling-filter-head,
  .filling-result-toolbar {
    grid-template-columns: 1fr;
    display: grid;
  }

  .filling-mode-tabs,
  .filling-result-tabs {
    overflow-x: auto;
  }

  .filling-student-summary,
  .filling-range {
    padding: 0 18px 6px;
  }

  .filling-range-group {
    padding-bottom: 8px;
  }

  .filling-chip-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .filling-result-board {
    overflow-x: auto;
  }

  .filling-result-head,
  .filling-result-row {
    min-width: 1120px;
  }

  .recommendation-rich-item {
    grid-template-columns: minmax(160px, 1fr) minmax(180px, 1fr) auto;
  }

  .recommendation-rank {
    grid-column: 1 / 3;
  }

  .volunteer-row {
    grid-template-columns: 40px minmax(0, 1fr);
    align-items: flex-start;
  }

  .volunteer-info {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .volunteer-cell {
    grid-template-rows: auto auto;
  }

  .volunteer-actions {
    grid-column: 2;
    justify-content: flex-start;
  }

  .toolbar > * {
    margin-top: 12px;
  }

  .detail-head {
    align-items: flex-start;
    gap: 12px;
  }

  .detail-head h1 {
    font-size: 24px;
  }

  .detail-actions {
    gap: 8px;
  }

  .detail-actions .back-btn {
    padding: 9px 11px;
  }

  .ai-plan-head,
  .form-actions,
  .profile-save-row {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .permission-summary,
  .payment-grid {
    grid-template-columns: 1fr;
  }

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

  .register-grid,
  .verification-row {
    grid-template-columns: 1fr;
  }

  .terms-modal {
    padding: 12px;
  }

  .terms-page {
    padding: 18px;
    max-height: 88vh;
  }

  .terms-head {
    top: -18px;
    flex-wrap: wrap;
  }

  .mentor-messages {
    max-height: 440px;
    padding: 16px;
  }

  .mentor-message {
    max-width: 100%;
  }

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

  .mentor-input-row .primary-btn {
    width: 100%;
  }

  .mentor-context {
    padding: 14px;
  }

  .mentor-context-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .mentor-context-item {
    padding: 10px;
  }

  .mentor-note {
    font-size: 12px;
    line-height: 1.65;
  }

  .mentor-prompts {
    padding: 10px 12px 0;
  }

  .mentor-prompt {
    padding: 7px 9px;
    font-size: 13px;
  }

  .discipline-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .popular-category-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .side-list {
    display: flex;
    gap: 8px;
    max-height: none;
    overflow-x: auto;
    margin-bottom: 18px;
  }

  .side-item {
    white-space: nowrap;
  }

  .pagination {
    align-items: flex-start;
    flex-direction: column;
  }

  .pagination-actions {
    justify-content: flex-start;
  }

  .card-grid,
  .result-grid,
  .ai-plan-grid,
  .form-grid,
  .metric-grid,
  .admin-metric-grid,
  .salary-timeline {
    grid-template-columns: 1fr;
  }

  .subject-grid {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

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

@media (max-width: 720px) {
  .app-shell {
    padding: 10px;
  }

  .top-nav {
    gap: 10px;
    padding: 10px;
  }

  .brand {
    font-size: 18px;
    white-space: normal;
    line-height: 1.25;
  }

  .program-rich-card {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .school-history-card {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .recommendation-rich-item {
    grid-template-columns: 1fr;
    align-items: flex-start;
  }

  .recommendation-rank {
    grid-column: auto;
  }

  .recommendation-actions {
    justify-content: flex-start;
  }

  .filling-filter-body {
    padding: 16px;
  }

  .filling-filter-footer {
    padding: 12px 16px;
  }

  .detail-section-head {
    display: grid;
    gap: 8px;
  }

  .detail-source-note {
    justify-content: flex-start;
    text-align: left;
  }

  .detail-source-link-list {
    right: auto;
    left: 0;
    min-width: min(320px, calc(100vw - 44px));
  }

  .program-history-row {
    grid-template-columns: 48px minmax(82px, 1fr);
    column-gap: 10px;
    row-gap: 2px;
    font-size: 12px;
  }

  .program-history-score,
  .program-history-rank {
    grid-column: 2;
  }

  .program-action {
    justify-content: flex-start;
  }

  .nav-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
  }

  .nav-tab {
    min-height: 38px;
    padding: 8px 6px;
    font-size: 13px;
    line-height: 1.2;
  }

  .theme-toggle {
    min-height: 36px;
    padding: 8px 10px;
    font-size: 13px;
  }

  .mentor-shell {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .mentor-context-grid {
    grid-template-columns: 1fr;
  }

  .mentor-message,
  .mentor-message.user {
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 8px;
  }

  .mentor-message.user .mentor-avatar {
    grid-column: 1;
  }

  .mentor-message.user .mentor-bubble {
    grid-column: 2;
  }

  .mentor-avatar {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  .mentor-bubble {
    padding: 11px 12px;
  }

  .mentor-text,
  .mentor-text p {
    line-height: 1.7;
  }

  .mentor-input-row {
    padding: 12px;
  }

  .admin-head {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-head h1 {
    font-size: 24px;
  }

  .admin-token-line {
    align-items: flex-start;
    flex-direction: column;
    padding: 12px;
  }
}

@media (max-width: 560px) {
  .popular-category-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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