:root {
  --color-brand-50: #EFF7FF;
  --color-brand-100: #D9EBFF;
  --color-brand-200: #B9D9FF;
  --color-brand-300: #8FC0FF;
  --color-brand-400: #63A6FF;
  --color-brand-500: #3B8DFF;
  --color-brand-600: #1F6FEB;
  --color-brand-700: #1553B8;
  --color-brand-800: #0F4188;
  --color-brand-900: #0A2E5C;
  --color-neutral-0: #FFFFFF;
  --color-neutral-25: #F3F9FF;
  --color-neutral-50: #EFF5FB;
  --color-neutral-100: #E4EDF7;
  --color-neutral-200: #DFEAF5;
  --color-neutral-300: #C9DCEF;
  --color-neutral-400: #A9BECE;
  --color-neutral-500: #6B8199;
  --color-neutral-600: #4A6076;
  --color-neutral-900: #0B1B2B;
  --color-accent-lime: #C9F24D;
  --color-accent-lime-soft: #F4FDD9;
  --color-on-accent: #0B1B2B;
  --color-info-fg: #1A5FD0;
  --color-info-bg: #EAF2FE;
  --color-info-on: #26456E;
  --color-success-fg: #087457;
  --color-success-bg: #E7F6F0;
  --color-success-on: #0A4A3B;
  --color-warning-fg: #985000;
  --color-warning-bg: #FFF4E3;
  --color-warning-on: #6B4700;
  --color-danger-fg: #C7302B;
  --color-danger-bg: #FDECEC;
  --color-danger-on: #7A2622;
  --color-tier-ch-fg: #B93D0A;
  --color-tier-ch-bg: #FDEEE7;
  --color-tier-st-fg: #1A5FD0;
  --color-tier-st-bg: #EAF2FE;
  --color-tier-ba-fg: #087457;
  --color-tier-ba-bg: #E7F6F0;
  --color-admin-brand: #2C4F73;
  --color-admin-secondary: #5A6B7C;
  --color-admin-header: #1F2D3A;
  --color-admin-bg-page: #F4F5F7;
  --color-admin-table-head: #EDEFF2;
  --color-text-primary: #0B1B2B;
  --color-text-secondary: #4A6076;
  --color-text-tertiary: #6B8199;
  --color-text-disabled: #A9BECE;
  --color-text-inverse: #FFFFFF;
  --color-bg-page: #F3F9FF;
  --color-bg-surface: #FFFFFF;
  --color-bg-subtle: #EFF5FB;
  --color-bg-hover: #EFF7FF;
  --color-bg-selected: #D9EBFF;
  --color-border-default: #DFEAF5;
  --color-border-strong: #C9DCEF;
  --color-border-focus: #1F6FEB;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-full: 999px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --shadow-1: 0 2px 8px rgba(11,27,43,.05);
  --shadow-2: 0 12px 32px rgba(11,27,43,.10);
  --shadow-focus: 0 0 0 3px rgba(31,111,235,.16);
  --shadow-focus-error: 0 0 0 3px rgba(199,48,43,.14);
  --size-sm: 32px;
  --size-md: 40px;
  --size-lg: 48px;
  --font: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
}
body.is-admin {
  --color-brand-600: var(--color-admin-brand);
  --color-brand-700: var(--color-admin-header);
  --color-brand-800: var(--color-admin-header);
  --color-bg-page: var(--color-admin-bg-page);
  --color-bg-subtle: var(--color-admin-table-head);
  --color-border-focus: var(--color-admin-brand);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--color-bg-page);
  color: var(--color-text-primary);
  font: 15px/26px var(--font);
}
a { color: var(--color-brand-600); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
.topbar {
  --top-tint: rgba(255,255,255,.10);
  --top-border: rgba(255,255,255,.25);
  background: linear-gradient(90deg, #0B3D8C, #1D6DE2 60%, #3688F5);
  color: var(--color-text-inverse);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-6);
  min-height: 56px;
  padding: var(--space-2) var(--space-4);
  font-size: 14px;
  line-height: 20px;
}
.top-brand, .top-link {
  display: inline-flex;
  align-items: center;
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}
.top-brand { gap: 10px; font-size: 18px; font-weight: 600; }
.top-brand span {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  background: var(--color-accent-lime);
  color: var(--color-on-accent);
  font-size: 14px;
}
.top-nav, .top-side {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-1);
}
.top-side { gap: var(--space-2); margin-left: auto; font-size: 13px; }
.top-link {
  gap: 6px;
  min-height: var(--size-md);
  padding: 0 10px;
  border-radius: var(--radius-sm);
}
.is-admin .top-brand span { background: var(--color-neutral-0); }
.top-link:hover, .top-disclosure[open] > summary { background: var(--top-tint); }
.top-link:is(.top-role, .top-assistant):hover { border-color: currentColor; background: var(--top-border); }
.top-link[aria-current="page"], .top-current {
  background: rgba(255,255,255,.18);
  font-weight: 600;
}
.topbar :is(a, summary):focus-visible { outline: 2px solid var(--color-neutral-0); outline-offset: 2px; }
.top-count, .top-score {
  background: var(--top-tint);
  border-radius: var(--radius-full);
  font-variant-numeric: tabular-nums;
}
.top-count { min-width: 22px; padding: 0 6px; text-align: center; font-size: 12px; }
.top-score { padding: 6px 12px; white-space: nowrap; }
.top-subjects, .top-logout { color: var(--color-brand-50); }
.top-role, .top-assistant {
  min-height: var(--size-sm);
  border: 1px solid var(--top-border);
  background: var(--top-tint);
}
.top-assistant { margin-left: var(--space-3); padding: 0 12px; border-radius: var(--radius-full); }
.top-assistant::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: var(--radius-full);
  background: var(--color-accent-lime);
}
.is-admin .top-assistant::before { background: var(--color-neutral-0); }
.top-disclosure { position: relative; }
.top-disclosure > summary { list-style: none; cursor: pointer; }
.top-disclosure > summary::-webkit-details-marker { display: none; }
.top-nav summary::after, .top-role::after {
  content: "";
  width: 5px;
  height: 5px;
  border: solid currentColor;
  border-width: 0 1.5px 1.5px 0;
  transform: translateY(-1px) rotate(45deg);
  margin-left: 2px;
}
.top-disclosure[open] > summary::after { transform: translateY(2px) rotate(225deg); }
.top-menu {
  position: absolute;
  z-index: 5;
  inset: calc(100% + 4px) auto auto 0;
  min-width: 148px;
  padding: var(--space-1);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
  background: var(--color-bg-surface);
  color: var(--color-text-primary);
  box-shadow: var(--shadow-2);
}
.top-side .top-menu { inset-inline: auto 0; }
.top-menu > a, .top-account {
  display: block;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: inherit;
  text-decoration: none;
}
.top-account { color: var(--color-text-secondary); overflow-wrap: anywhere; }
.top-menu > a:hover, .top-menu > a[aria-current="page"] { background: var(--color-bg-hover); }
.topbar .top-menu a:focus-visible { outline-color: var(--color-border-focus); outline-offset: -2px; }
.top-profile { width: min(290px, calc(100vw - 32px)); padding: var(--space-3); }
.top-profile dl { display: grid; grid-template-columns: auto 1fr; gap: 6px var(--space-3); margin: 0; }
.top-profile dt { color: var(--color-text-secondary); }
.top-profile dd { margin: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.top-profile form {
  display: grid;
  gap: var(--space-1);
  border-top: 1px solid var(--color-border-default);
  margin-top: var(--space-2);
  padding-top: var(--space-2);
}
.top-profile select { padding-inline-start: var(--space-2); min-width: 0; min-height: var(--size-sm); height: auto; }
@media (max-width: 1320px) {
  .topbar { column-gap: var(--space-3); padding-inline: var(--space-3); }
  .top-link { padding-inline: var(--space-2); }
  .top-side { gap: var(--space-1); }
}
.top-menu > .top-menu-logout, .top-menu-stat { display: none; }
@media (max-width: 1280px) {
  .top-side > :is(.top-score, .top-subjects, .top-logout) { display: none; }
  .top-menu > .top-menu-logout, .top-menu-stat { display: block; }
}
.top-menu > :is(.top-nav-menu-narrow, .top-nav-menu-small, .top-nav-menu-compact) { display: none; }
:where(html:not(.is-phone)) .is-expert :is(.topbar, .top-nav, .top-side) { flex-wrap: nowrap; }
:where(html:not(.is-phone)) .is-expert .top-subjects { white-space: nowrap; }
@media (max-width: 1440px) {
  :where(html:not(.is-phone)) .is-expert .top-side > :is(.top-score, .top-subjects, .top-logout) { display: none; }
  :where(html:not(.is-phone)) .is-expert :is(.top-menu-logout, .top-menu-stat) { display: block; }
}
@media (max-width: 960px) {
  :where(html:not(.is-phone)) .is-student :is(.topbar, .top-nav, .top-side) { flex-wrap: nowrap; }
  :where(html:not(.is-phone)) :is(.is-expert, .is-student) .top-nav > .top-nav-narrow { display: none; }
  :where(html:not(.is-phone)) :is(.is-expert, .is-student) .top-menu > .top-nav-menu-narrow { display: block; }
}
@media (max-width: 680px) {
  :where(html:not(.is-phone)) :is(.is-expert, .is-student) .top-nav > .top-nav-small { display: none; }
  :where(html:not(.is-phone)) :is(.is-expert, .is-student) .top-menu > .top-nav-menu-small { display: block; }
}
@media (max-width: 480px) {
  :where(html:not(.is-phone)) :is(.is-expert, .is-student) .topbar { column-gap: 4px; padding-inline: 8px; }
  :where(html:not(.is-phone)) :is(.is-expert, .is-student) .top-nav > .top-nav-compact { display: none; }
  :where(html:not(.is-phone)) :is(.is-expert, .is-student) .top-menu > .top-nav-menu-compact { display: block; }
}
:where(.is-phone) .topbar {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 4px 8px;
  padding: 8px 12px;
  font-size: 13px;
}
:where(.is-phone) .top-brand { gap: 6px; font-size: 16px; }
:where(.is-phone) .top-nav { grid-area: 2 / 1 / 3 / -1; min-width: 0; gap: 2px 4px; position: relative; }
:where(.is-phone) .top-side { grid-area: 1 / 2 / 2 / 3; justify-self: end; gap: 2px; }
:where(.is-phone) .top-link { min-height: 36px; padding-inline: 6px; }
:where(.is-phone) .top-side .top-menu { inset-inline: auto 0; }
:where(.is-phone) .top-nav .top-disclosure { position: static; }
:where(.is-phone) .top-nav .top-menu { inset-inline: 0 auto; }
:where(.is-phone) .top-assistant { margin-left: 0; }
.shell {
  max-width: 1728px;
  margin-inline: auto;
  padding: 24px clamp(16px, 2vw, 24px) 56px;
}
:where(.is-phone) .shell { padding: 16px 12px 40px; }
:where(.is-phone) .shell > :is(main, section) { min-width: 0; }
:where(.is-phone) .shell :is(.panel, .card) { padding: 14px; overflow-wrap: anywhere; }
:where(.is-phone) .phone { margin: 16px auto; width: calc(100% - 24px); padding: 20px; }
.system-page { display: flex; flex-direction: column; min-height: 100vh; }
.system-page > .shell { width: 100%; min-width: 0; flex: 1; }
.system-footer { background: var(--color-brand-900); color: var(--color-neutral-300); font-size: 12.5px; }
.system-footer-inner {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px 32px;
  max-width: 1120px;
  padding: 16px 20px;
  margin: auto;
  line-height: 1.9;
}
.system-footer-inner > div { display: flex; flex-wrap: wrap; gap: 0 6px; }
.system-footer-inner > div > span:first-child { color: var(--color-neutral-400); }
.system-footer a { color: inherit; text-decoration: none; }
.system-footer a:hover { text-decoration: underline; }
:where(html:not(.is-phone)) .system-page > .topbar { position: sticky; top: 0; z-index: 20; }
:where(.is-phone) .system-footer-inner { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; }
.pill {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-full);
  padding: 4px 12px;
  font-size: 13px;
  color: var(--color-text-secondary);
}
.display { font-size: 34px; line-height: 40px; font-weight: 600; font-variant-numeric: tabular-nums; margin: 0; }
h1 { font-size: 24px; line-height: 32px; font-weight: 600; margin: 0 0 var(--space-3); }
h2 { font-size: 18px; line-height: 26px; font-weight: 600; margin: 0 0 var(--space-3); }
h3 { font-size: 15px; line-height: 24px; font-weight: 600; margin: 0 0 var(--space-2); }
p { margin: 0 0 var(--space-3); color: var(--color-text-secondary); }
.panel, .card {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  padding: var(--space-5);
  margin: 0 0 var(--space-4);
}
.hero {
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, #EAF6FF, #C4E4FF);
  padding: var(--space-6);
  margin-bottom: var(--space-4);
}
.hero-stats { display: flex; gap: var(--space-8); flex-wrap: wrap; }
.hero-stats .display small { font-size: 16px; font-weight: 600; }
.pill b { font-variant-numeric: tabular-nums; font-weight: 600; }
a.pill { text-decoration: none; color: var(--color-brand-700); cursor: pointer; }
a.pill:hover { border-color: var(--color-brand-600); color: var(--color-brand-700); }
a.pill:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
input[type=range] { width: 100%; accent-color: var(--color-brand-600); height: 32px; }
input[type=range]:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.sort-on { box-shadow: inset 3px 0 0 var(--color-brand-600); }
body.is-admin .hero { background: var(--color-bg-surface); border: 1px solid var(--color-border-default); }
.home-content { display: grid; gap: clamp(20px, 2.4vw, 32px); }
.home-carousel { position: relative; min-width: 0; }
.home-carousel-slides {
  display: grid;
  overflow: hidden;
  border-radius: clamp(var(--radius-sm), 2vw, var(--radius-xl));
  background: var(--color-bg-subtle);
}
.home-carousel-slides img {
  display: block;
  grid-area: 1 / 1;
  width: 100%;
  height: auto;
  opacity: 1;
  transition: opacity 600ms ease-in-out;
}
.home-carousel-slides img[aria-hidden="true"] { opacity: 0; }
.home-carousel-controls:not([hidden]) {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.home-carousel-controls button {
  display: grid;
  place-items: center;
  min-height: 36px;
  padding: 0 var(--space-2);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: #fff;
  cursor: pointer;
  pointer-events: auto;
}
.home-carousel-controls button:focus-visible { outline: 2px solid currentColor; outline-offset: -4px; }
.home-carousel-controls button:hover::before,
.home-carousel-controls button:focus-visible::before { opacity: 1; }
.home-carousel-toggle { position: absolute; right: 8px; bottom: 0; min-width: 36px; }
.home-carousel-toggle::before {
  content: "";
  width: 7px;
  height: 9px;
  border-inline: 2px solid currentColor;
  opacity: .4;
  filter: drop-shadow(0 1px 2px #000);
}
.home-carousel-toggle[aria-pressed="true"]::before {
  width: 0;
  height: 0;
  border: 5px solid transparent;
  border-left: 7px solid currentColor;
  border-right: 0;
}
.home-carousel-dot { width: 36px; }
.home-carousel-dot::before {
  content: "";
  width: 20px;
  height: 2px;
  background: currentColor;
  opacity: .35;
  box-shadow: 0 1px 2px #000;
  border-radius: var(--radius-full);
}
.home-carousel-dot[aria-current="true"]::before { opacity: .65; }
@media (max-width: 600px) {
  .home-carousel-slides img {
    height: clamp(130px, 34vw, 170px);
    object-fit: cover;
  }
}
@media (prefers-reduced-motion: reduce) {
  .home-carousel-slides img { transition: none; }
}
.home-student {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: clamp(24px, 4vw, 56px);
  padding: clamp(20px, 2.4vw, 32px);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-xl);
  background: linear-gradient(112deg, var(--color-bg-surface) 18%, var(--color-brand-50) 72%, #E3F1FF);
  box-shadow: var(--shadow-1);
}
.home-student-summary h1 { margin: 0 0 6px; }
.home-student-summary p { margin: 0; font-size: 14px; line-height: 22px; }
.home-student-stats {
  display: grid;
  grid-template-columns: auto auto;
  gap: var(--space-6);
  margin: 0;
}
.home-student-stats > div + div {
  border-inline-start: 1px solid var(--color-border-strong);
  padding-inline-start: var(--space-6);
}
.home-student-stats dt { color: var(--color-text-secondary); font-size: 13px; line-height: 20px; }
.home-student-stats dd {
  color: var(--color-brand-900);
  margin: 3px 0 0;
  font-size: 32px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.home-student-stats small { font-size: 14px; font-weight: 500; }
.home-student-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.home-student-actions .btn { font-size: 14px; font-weight: 600; white-space: nowrap; }
.home-shortcuts h2 { margin: 0 0 var(--space-3); }
.home-shortcut-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(12px, 1.25vw, 20px);
}
.home-shortcut {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: clamp(10px, 1vw, 14px);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  background: var(--color-bg-surface);
  color: var(--color-text-primary);
  text-decoration: none;
  box-shadow: var(--shadow-1);
}
.home-shortcut-visual {
  height: 104px;
  margin-bottom: 4px;
  border-radius: var(--radius-md);
  background: radial-gradient(ellipse at center, #F9FCFF, var(--color-brand-50));
  overflow: hidden;
  position: relative;
}
.home-shortcut-visual img {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -54%);
  width: 164px;
  height: 164px;
}
.home-shortcut-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 16px;
  line-height: 22px;
  font-weight: 600;
}
.home-shortcut-action {
  flex: 0 0 48px;
  border-radius: var(--radius-full);
  background: var(--color-brand-50);
  color: var(--color-brand-700);
  font-size: 12px;
  line-height: 26px;
  text-align: center;
}
.home-shortcut-description { color: var(--color-text-secondary); font-size: 13px; line-height: 20px; }
.home-shortcut:focus-visible { outline: 2px solid var(--color-brand-600); outline-offset: 2px; }
.home-note {
  margin: 0;
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border-default);
  color: var(--color-text-tertiary);
  font-size: 13px;
  line-height: 20px;
}
@media (hover: hover) {
  .home-shortcut:hover { border-color: var(--color-brand-300); box-shadow: var(--shadow-2); }
  .home-shortcut:hover .home-shortcut-action { background: var(--color-brand-100); }
}
:where(.is-phone) .home-student { grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-5); }
:where(.is-phone) .home-student-actions { grid-column: 1 / -1; justify-content: flex-start; }
:where(.is-phone) .home-shortcut-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 620px) {
  :where(.is-phone) .home-student { grid-template-columns: minmax(0, 1fr); }
  :where(.is-phone) .home-student-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  :where(.is-phone) .home-student-actions .btn { flex: 1 1 auto; justify-content: center; }
  :where(.is-phone) .home-student { padding: 16px; }
  :where(.is-phone) .home-shortcut-heading { flex-wrap: wrap; }
  :where(.is-phone) .home-shortcut-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  :where(.is-phone) .home-shortcut-heading { font-size: 15px; }
}
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-4); }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--space-3); margin-bottom: var(--space-4); }
label.field { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--color-text-primary); }
input[type=text], input[type=password], input[type=number], input[type=email], input[type=date], select, textarea {
  height: var(--size-md);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-bg-surface);
  padding: 0 12px;
  width: 100%;
}
select {
  appearance: none;
  padding-inline-end: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='m2.5 4.5 3.5 3.5 3.5-3.5' fill='none' stroke='%23475569' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px;
}
@media (forced-colors: active) {
  select { appearance: auto; background-image: none; }
}
textarea { height: auto; padding: 10px 12px; }
input:hover, select:hover, textarea:hover { border-color: var(--color-brand-300); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--color-border-focus); box-shadow: var(--shadow-focus); }
.btn, button.btn {
  height: var(--size-md);
  border-radius: var(--radius-md);
  padding: 0 16px;
  border: 0;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn-primary { background: var(--color-brand-600); color: var(--color-text-inverse); }
.btn-primary:hover { background: var(--color-brand-700); }
.btn-primary:active { background: var(--color-brand-800); }
.btn-primary:focus-visible { box-shadow: var(--shadow-focus); }
.btn-secondary { background: var(--color-bg-surface); color: var(--color-text-primary); border: 1px solid var(--color-border-strong); }
.btn-secondary:hover { background: var(--color-bg-hover); color: var(--color-brand-700); border-color: var(--color-brand-500); }
.btn-secondary:focus-visible { box-shadow: var(--shadow-focus); }
.btn-ghost { background: var(--color-brand-50); color: var(--color-brand-700); }
.btn-ghost:hover { background: var(--color-brand-100); }
.btn-ghost:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.btn-text { background: transparent; color: var(--color-brand-600); }
.btn-text:hover { background: var(--color-bg-hover); }
.btn-danger { background: var(--color-bg-surface); color: var(--color-danger-fg); border: 1px solid #EFC9C6; }
.btn-danger:hover { background: var(--color-danger-bg); }
.btn-danger-solid { background: var(--color-danger-fg); color: var(--color-text-inverse); }
.btn:disabled, .btn[disabled] { background: var(--color-neutral-100); color: var(--color-text-disabled); border-color: transparent; cursor: not-allowed; }
.toolbar { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; margin: var(--space-3) 0; }
.tag { display: inline-flex; align-items: center; border-radius: var(--radius-sm); padding: 2px 8px; font-size: 13px; font-weight: 600; }
.tag-ch { color: var(--color-tier-ch-fg); background: var(--color-tier-ch-bg); }
.tag-st { color: var(--color-tier-st-fg); background: var(--color-tier-st-bg); }
.tag-ba { color: var(--color-tier-ba-fg); background: var(--color-tier-ba-bg); }
.tag-added { color: var(--color-success-fg); background: var(--color-success-bg); }
.badge {
  background: var(--color-accent-lime);
  color: var(--color-on-accent);
  border-radius: var(--radius-full);
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
}
body.is-admin .badge { background: var(--color-bg-subtle); color: var(--color-text-secondary); }
.note { background: var(--color-info-bg); color: var(--color-info-on); border-radius: var(--radius-md); padding: 12px 14px; margin: 0 0 var(--space-4); }
.note strong { color: var(--color-info-fg); }
.ok { background: var(--color-success-bg); color: var(--color-success-on); border-radius: var(--radius-md); padding: 12px 14px; }
.warn { background: var(--color-warning-bg); color: var(--color-warning-on); border-radius: var(--radius-md); padding: 12px 14px; }
.alert { border-radius: var(--radius-md); padding: 12px 14px; margin: 0 0 var(--space-4); }
.alert-error { background: var(--color-danger-bg); color: var(--color-danger-on); }
.coach-student-message:not(:empty) {
  position: fixed;
  z-index: 100;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 32px);
  box-sizing: border-box;
  padding: 10px 16px;
  border: 1px solid currentColor;
  border-radius: var(--radius-md);
  background: var(--color-danger-bg);
  color: var(--color-danger-on);
  box-shadow: 0 4px 16px rgb(0 0 0 / 12%);
}
.alert-ok { background: var(--color-success-bg); color: var(--color-success-on); }
.table-wrap { overflow-x: auto; min-width: 0; }
.table-wrap :is(th, td) { overflow-wrap: anywhere; }
.table-wrap tbody .has-major-remark > td { border-bottom: 0; padding-bottom: 4px; }
.table-wrap tbody .major-remark-row > td {
  padding-top: 0;
  color: var(--color-text-secondary);
  font-size: 12px;
  line-height: 1.5;
  text-align: start;
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.table-wrap tbody tr:is(.has-major-remark, .major-remark-row, :has(input[name="planId"]:checked)) {
  background: var(--plan-row-background, transparent);
}
.table-wrap tbody tr:is(.has-major-remark, .major-remark-row, :has(input[name="planId"]:checked)) > td {
  background: transparent;
}
@media (hover: hover) {
  .table-wrap tbody :where(
    .has-major-remark:hover,
    .has-major-remark:has(+ .major-remark-row:hover),
    .has-major-remark:hover + .major-remark-row,
    .major-remark-row:hover
  ) {
    --plan-row-background: var(--color-bg-hover);
  }
}
.table-wrap tbody :where(
  tr:has(input[name="planId"]:checked),
  .has-major-remark:active,
  .has-major-remark:has(+ .major-remark-row:active),
  .has-major-remark:is(:active, :has(input[name="planId"]:checked)) + .major-remark-row,
  .major-remark-row:active
) {
  --plan-row-background: var(--color-bg-selected);
}
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--color-border-default); vertical-align: middle; }
th.mid, td.mid { text-align: center; }
td.code { font-variant-numeric: tabular-nums; }
.q-item { padding: 14px 0; border-bottom: 1px solid var(--color-border-default); }
.q-item h2 { font-size: 16px; line-height: 26px; margin: 0; }
.yn-row { display: flex; gap: 12px; margin-top: 8px; }
.yn {
  display: inline-flex; align-items: center; gap: 8px;
  min-width: 88px; height: 40px; padding: 0 14px;
  border: 1px solid var(--color-border-strong); border-radius: 12px;
  background: var(--color-bg-surface); cursor: pointer;
}
.yn:has(input:checked) {
  border-color: var(--color-brand-600);
  background: var(--color-bg-selected);
  box-shadow: inset 3px 0 0 var(--color-brand-600);
}
.yn:focus-within { box-shadow: var(--shadow-focus); }
.yn:has(input:checked):focus-within { box-shadow: var(--shadow-focus), inset 3px 0 0 var(--color-brand-600); }
.yn input:focus { outline: none; }
th { background: var(--color-bg-subtle); color: var(--color-text-secondary); font-weight: 600; white-space: nowrap; }
tr:hover td { background: var(--color-bg-hover); }
td.num, th.num { font-variant-numeric: tabular-nums; text-align: right; }
tr[data-wish] { cursor: grab; }
tr[data-wish] button, tr[data-wish] select, tr[data-wish] a { cursor: pointer; }
.handle { color: var(--color-text-tertiary); }
tr.dragging td { background: var(--color-bg-selected); }
tr.dragging { pointer-events: none; }
body.dragging-wish { user-select: none; cursor: grabbing; }
.empty { color: var(--color-text-tertiary); text-align: center; padding: var(--space-6); }
dialog {
  border: 0;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-2);
  padding: var(--space-6);
  max-width: 460px;
  color: var(--color-text-primary);
}
dialog::backdrop { background: rgba(11,27,43,.45); }
.login-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  background: linear-gradient(135deg, #EAF6FF, #C4E4FF);
}
.login-copy { padding: 64px; }
.login-card {
  margin: 32px;
  background: var(--color-bg-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-2);
  padding: var(--space-6);
}
.login-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); margin: 0 0 var(--space-4); }
.login-tab {
  height: var(--size-lg);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-bg-surface);
  color: var(--color-text-secondary);
  font-weight: 600;
  cursor: pointer;
}
.login-tab:hover { background: var(--color-bg-hover); color: var(--color-text-primary); }
.login-tab:active { background: var(--color-bg-selected); }
.login-tab:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.login-tab.is-on {
  color: var(--color-brand-700);
  background: var(--color-bg-selected);
  border-color: var(--color-brand-600);
  box-shadow: inset 3px 0 0 var(--color-brand-600);
}
.login-tab.is-on:focus-visible { outline: none; box-shadow: var(--shadow-focus), inset 3px 0 0 var(--color-brand-600); }
.login-panel[hidden] { display: none; }
.qr-box { width: 196px; height: 196px; margin: 12px auto; display: grid; place-items: center; background: var(--color-bg-surface); border-radius: var(--radius-md); border: 1px solid var(--color-border-default); }
.phone {
  max-width: 420px;
  margin: 32px auto;
  background: var(--color-bg-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-2);
  padding: var(--space-6);
}
.steps { display: flex; gap: 8px; margin-bottom: 16px; }
.steps i { flex: 1; height: 6px; border-radius: var(--radius-full); background: var(--color-neutral-100); display: block; }
.steps i.on { background: var(--color-brand-500); }
.chat { display: grid; gap: 12px; }
.bubble { border: 1px solid var(--color-border-default); border-radius: var(--radius-lg); padding: 12px 14px; background: var(--color-bg-surface); }
.bubble b { display: block; margin-bottom: 4px; }
.muted { color: var(--color-text-tertiary); font-size: 12px; line-height: 18px; }
.split { display: grid; grid-template-columns: 280px 1fr; gap: var(--space-4); }
:where(.is-phone) .login-wrap, :where(.is-phone) .split { grid-template-columns: 1fr; }
:where(.is-phone) .login-copy { display: none; }

:where(.is-phone) :is(input[type="text"], input[type="password"], input[type="email"], input[type="number"], input[type="date"], textarea) {
  font-size: max(1em, 16px);
  min-width: 0;
}
