:root {
  color-scheme: light;
  --forest-950: #18382f;
  --forest-900: #21483c;
  --forest-700: #3f6f5c;
  --forest-100: #eaf2ed;
  --forest-50: #f3f7f4;
  --cream: #f6f3ec;
  --paper: #fffdfa;
  --ink: #202724;
  --muted: #6b746f;
  --line: #e3e6e2;
  --red: #b84d45;
  --red-soft: #fbecea;
  --amber: #b87520;
  --amber-soft: #fff4df;
  --blue: #4d6f96;
  --blue-soft: #edf3f9;
  --shadow: 0 10px 35px rgba(24, 56, 47, 0.07);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--cream); color: var(--ink); font: 14px/1.55 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 224px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 28px 18px 22px; background: var(--forest-950); color: white; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 10px 28px; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; background: #f0d7a0; color: var(--forest-950); font-size: 20px; font-weight: 800; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 18px; letter-spacing: .04em; }
.brand small { margin-top: 2px; color: #b9cdc5; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 10px; color: #d7e4de; text-decoration: none; font-weight: 650; }
.nav-item span { font-size: 19px; }
.nav-item.active { background: rgba(255, 255, 255, .12); color: white; }
.scope-note { margin-top: auto; padding: 14px; display: flex; align-items: flex-start; gap: 9px; border-top: 1px solid rgba(255,255,255,.13); color: #b9cdc5; font-size: 12px; }
.scope-dot { width: 7px; height: 7px; margin-top: 6px; border-radius: 50%; background: #77c49f; box-shadow: 0 0 0 4px rgba(119,196,159,.12); }

.main-content { width: min(1280px, 100%); margin: 0 auto; padding: 34px 42px 64px; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.header-status { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.operator-block { min-width: 126px; text-align: right; }
.operator-block span, .operator-block small { display: block; }
.operator-block span { color: var(--forest-900); font-weight: 750; }
.operator-block small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.operator-block small.saving { color: var(--amber); }
.operator-block small.saved { color: var(--forest-700); }
.operator-block small.error { color: var(--red); }
.eyebrow { margin: 0 0 4px; color: var(--forest-700); font-size: 11px; line-height: 1.2; font-weight: 800; letter-spacing: .12em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 4px; font-size: 31px; line-height: 1.25; letter-spacing: -.02em; }
h2 { margin-bottom: 0; font-size: 20px; line-height: 1.35; }
.subtitle { margin: 0; color: var(--muted); }
.date-block { text-align: right; color: var(--forest-900); }
.date-block span, .date-block small { display: block; }
.date-block span { font-weight: 750; }
.date-block small { margin-top: 3px; color: var(--muted); }

.source-banner { min-height: 0; margin-bottom: 18px; padding: 12px 15px; border: 1px solid #ead4a7; border-radius: 11px; background: #fff8e7; color: #72551f; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.source-banner:empty { display: none; }
.source-banner a { color: inherit; font-weight: 700; white-space: nowrap; }

.toolbar { display: grid; grid-template-columns: 180px 170px minmax(230px, 1fr); gap: 12px; margin-bottom: 16px; padding: 15px; background: rgba(255,253,250,.76); border: 1px solid var(--line); border-radius: 14px; }
label > span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 12px; font-weight: 650; }
select, input, textarea { width: 100%; border: 1px solid #d7dcd8; border-radius: 9px; background: white; color: var(--ink); outline: none; transition: border .18s, box-shadow .18s; }
select, input { min-height: 39px; padding: 0 11px; }
textarea { padding: 10px 11px; resize: vertical; }
select:focus, input:focus, textarea:focus { border-color: var(--forest-700); box-shadow: 0 0 0 3px rgba(63,111,92,.12); }
.search-label { max-width: 420px; justify-self: end; width: 100%; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin-bottom: 20px; }
.stat-card { min-height: 110px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); box-shadow: 0 5px 20px rgba(24,56,47,.035); }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); }
.stat-icon { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 9px; background: var(--forest-100); color: var(--forest-700); font-weight: 800; }
.stat-card strong { display: block; margin-top: 9px; font-size: 27px; line-height: 1; }
.stat-card small { display: block; margin-top: 6px; color: var(--muted); }

.category-panel, .group-data-alerts, .task-section, .resolved-section { margin-top: 20px; }
.category-panel { padding: 20px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255,253,250,.76); }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 15px; }
.section-heading p:last-child { margin: 0; color: var(--muted); font-size: 12px; }
.category-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.category-chip { min-height: 58px; padding: 12px 13px; border: 1px solid var(--line); border-radius: 11px; background: white; display: flex; align-items: center; justify-content: space-between; gap: 9px; }
.category-chip span { color: #46514c; }
.category-chip strong { min-width: 27px; height: 27px; padding: 0 7px; display: grid; place-items: center; border-radius: 99px; background: var(--forest-100); color: var(--forest-900); }
.category-chip.zero { opacity: .62; }

.group-data-alerts { padding: 20px; border: 1px solid #cad8e7; border-radius: 15px; background: var(--blue-soft); }
.group-data-alerts[hidden] { display: none; }
.group-alert-list { display: grid; gap: 10px; }
.group-alert { padding: 14px 15px; border: 1px solid #d4dfeb; border-radius: 11px; background: white; }
.group-alert-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 7px; }
.group-alert small { display: block; margin-top: 6px; color: #8796a5; }

.cards { display: grid; gap: 14px; }
.student-card { border: 1px solid var(--line); border-radius: 15px; background: var(--paper); box-shadow: var(--shadow); overflow: hidden; }
.card-head { padding: 17px 19px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
.student-line { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.student-line h3 { margin: 0; font-size: 19px; }
.student-meta { margin-top: 5px; color: var(--muted); font-size: 12px; }
.card-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.badge { display: inline-flex; align-items: center; min-height: 24px; padding: 2px 9px; border-radius: 99px; font-size: 11px; font-weight: 750; }
.badge.P0 { background: var(--red-soft); color: var(--red); }
.badge.P1 { background: var(--amber-soft); color: var(--amber); }
.badge.DATA { background: var(--blue-soft); color: var(--blue); }
.pause-badge { background: #efe9fb; color: #6f4f9a; }
.button { min-height: 37px; padding: 0 14px; border: 1px solid transparent; border-radius: 9px; font-weight: 700; }
.button.primary { background: var(--forest-900); color: white; }
.button.primary:hover { background: var(--forest-950); }
.button.secondary { border-color: #d7dcd8; background: white; color: #48514d; }
.button.small { min-height: 32px; padding: 0 11px; font-size: 12px; }

.issues { padding: 4px 19px 0; }
.issue { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 11px; padding: 15px 0; border-bottom: 1px solid #eceeeb; }
.issue:last-child { border-bottom: 0; }
.issue-check { width: 17px; height: 17px; margin-top: 3px; accent-color: var(--forest-900); }
.issue-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-bottom: 7px; }
.issue-number { color: var(--muted); font-weight: 750; }
.issue-title { font-weight: 750; }
.category-label { padding: 2px 7px; border-radius: 5px; background: var(--forest-50); color: var(--forest-700); font-size: 11px; font-weight: 700; }
.issue.DATA .category-label { background: var(--blue-soft); color: var(--blue); }
.evidence { display: flex; flex-wrap: wrap; gap: 6px 13px; color: var(--muted); font-size: 12px; }
.evidence span::before { content: "·"; margin-right: 5px; color: #9aa39e; }
.issue-source { margin-top: 5px; color: #909894; font-size: 11px; }
.issue-controls { margin-top: 10px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.course-complete-button { color: var(--forest-700); border-color: #b8c8bf; }
.issue-control-hint { color: var(--muted); font-size: 11px; }

.handling { padding: 15px 19px 18px; border-top: 1px solid var(--line); background: #fafbf9; }
.handling label > span { display: flex; justify-content: space-between; gap: 12px; }
.handling textarea { min-height: 74px; background: white; }
.handling-footer { margin-top: 10px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.handling-hint { margin: 0; color: var(--muted); font-size: 12px; }
.form-error { min-height: 18px; margin: 6px 0 0; color: var(--red); font-size: 12px; }

.handled-fold { margin: 0 19px 15px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.handled-fold summary { padding: 10px 12px; cursor: pointer; color: var(--muted); font-size: 12px; font-weight: 700; }
.handled-list { padding: 0 12px 10px; display: grid; gap: 7px; }
.handled-item { padding: 9px 10px; border-radius: 8px; background: var(--forest-50); color: #4d5853; font-size: 12px; }
.manual-completion-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.manual-completion-copy { display: grid; gap: 3px; }
.manual-completion-copy strong { color: var(--ink); }
.manual-completion-copy span,
.manual-completion-copy small { color: var(--muted); font-size: 11px; }

.empty-state { padding: 50px 24px; border: 1px dashed #ccd3ce; border-radius: 15px; background: rgba(255,255,255,.6); text-align: center; color: var(--muted); }
.empty-state strong { display: block; margin-bottom: 5px; color: var(--forest-900); font-size: 18px; }
#resolvedDetails { border: 1px solid var(--line); border-radius: 14px; background: rgba(255,253,250,.74); overflow: hidden; }
#resolvedDetails > summary { padding: 15px 18px; display: flex; justify-content: space-between; align-items: center; gap: 12px; cursor: pointer; list-style: none; }
#resolvedDetails > summary::-webkit-details-marker { display: none; }
#resolvedDetails > summary > span:first-child { display: flex; align-items: center; gap: 9px; }
#resolvedDetails > summary > span:last-child { color: var(--muted); font-size: 12px; }
.fold-icon { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 50%; background: var(--forest-100); color: var(--forest-700); }
.resolved-cards { padding: 0 18px 18px; display: grid; gap: 8px; }
.resolved-card { padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.resolved-identity strong { margin-right: 8px; }
.resolved-identity span { color: var(--muted); font-size: 12px; }
.resolved-history-detail { margin-top: 8px; }
.resolved-history-detail > summary { width: fit-content; padding: 2px 0; color: var(--forest-700); cursor: pointer; font-size: 12px; font-weight: 700; }
.resolved-history-detail .handled-list { padding: 8px 0 0; }
.resolved-history-detail .handled-item { display: grid; gap: 3px; }
.resolved-history-detail .handled-item strong { color: var(--ink); font-size: 12px; }
.resolved-history-detail .handled-item span,
.resolved-history-detail .handled-item small { color: var(--muted); font-size: 11px; }

.dialog { width: min(540px, calc(100vw - 30px)); padding: 0; border: 0; border-radius: 16px; box-shadow: 0 25px 80px rgba(20,40,32,.28); }
.dialog::backdrop { background: rgba(17,30,25,.45); backdrop-filter: blur(2px); }
.dialog form { padding: 22px; }
.dialog-head { display: flex; justify-content: space-between; gap: 18px; }
.dialog-head h2 { font-size: 23px; }
.dialog-head p:last-child { margin: 4px 0 0; color: var(--muted); }
.icon-button { width: 34px; height: 34px; border: 0; border-radius: 8px; background: #f3f4f2; color: var(--muted); font-size: 23px; }
.dialog-tip { padding: 10px 12px; border-radius: 9px; background: var(--forest-50); color: #52635b; font-size: 12px; }
.dialog label { display: block; margin-top: 14px; }
.dialog label b { color: var(--red); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dialog-actions { margin-top: 18px; display: flex; justify-content: flex-end; gap: 9px; }
.toast { position: fixed; right: 26px; bottom: 26px; z-index: 20; max-width: 360px; padding: 12px 15px; border-radius: 10px; background: var(--forest-950); color: white; box-shadow: var(--shadow); opacity: 0; transform: translateY(10px); pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translateY(0); }

.login-page { min-height: 100vh; background: linear-gradient(140deg, var(--cream), #e7f0eb); }
.login-shell { min-height: 100vh; padding: 28px 18px; display: grid; place-items: center; }
.login-card { width: min(430px, 100%); padding: 34px; border: 1px solid rgba(63,111,92,.16); border-radius: 20px; background: var(--paper); box-shadow: 0 24px 70px rgba(24,56,47,.14); }
.login-brand { margin-bottom: 30px; display: flex; align-items: center; gap: 11px; color: var(--forest-900); font-size: 16px; font-weight: 800; }
.login-card h1 { margin-bottom: 9px; }
.login-copy { margin-bottom: 24px; color: var(--muted); }
.login-card form { display: grid; gap: 16px; }
.login-submit { width: 100%; margin-top: 2px; }
.login-submit:disabled { opacity: .62; cursor: wait; }
.login-note { margin: 20px 0 0; padding-top: 17px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }

@media (max-width: 1050px) {
  .app-shell { grid-template-columns: 184px minmax(0, 1fr); }
  .main-content { padding: 30px 26px 56px; }
  .category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; padding: 14px 16px; flex-direction: row; align-items: center; gap: 12px; }
  .brand { padding: 0; }
  .brand small, .scope-note { display: none; }
  .sidebar nav { margin-left: auto; }
  .nav-item { padding: 9px 11px; }
  .main-content { padding: 24px 16px 44px; }
  .page-header { align-items: flex-start; }
  .header-status { align-items: flex-end; flex-direction: column; }
  .operator-block { text-align: right; }
  .date-block { display: none; }
  .toolbar { grid-template-columns: 1fr 1fr; }
  .search-label { grid-column: 1 / -1; max-width: none; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .category-grid { grid-template-columns: 1fr 1fr; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 5px; }
  .card-head { flex-direction: column; }
  .card-actions { justify-content: flex-start; }
  .handling-footer { align-items: stretch; flex-direction: column; }
  .handling-footer .button { width: 100%; }
  .manual-completion-item { align-items: stretch; flex-direction: column; }
  .source-banner { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 430px) {
  h1 { font-size: 27px; }
  .toolbar, .stats-grid, .category-grid { grid-template-columns: 1fr; }
  .search-label { grid-column: auto; }
  .form-row { grid-template-columns: 1fr; }
  .page-header { display: block; }
  .header-status { margin-top: 16px; align-items: flex-start; }
  .operator-block { text-align: left; }
  .login-card { padding: 26px 22px; }
}
