:root {
  --bg: #f5f6f8;
  --text: #1e293b;
  --muted: #64748b;
  --line: #dce1e8;
  --primary: #176b5b;
  --primary-weak: #e7f4f0;
  --danger: #b42318;
  --warn: #b75f00;
  --card: #ffffff;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", Arial, sans-serif;
}

body.locked {
  display: block;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  place-items: center;
  background: #10201d;
  padding: 24px;
}

body.locked .login-screen {
  display: grid;
}

.login-card {
  width: min(380px, 100%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: #fff;
  padding: 24px;
}

.login-brand {
  color: var(--text);
}

.login-brand p {
  color: var(--muted);
}

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

button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  min-height: 38px;
  padding: 0 14px;
  cursor: pointer;
}

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

.role-badge {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.role-badge.owner {
  border-color: #f2c86b;
  background: #fff7df;
  color: #7a4b00;
}

.role-badge.teacher {
  border-color: #b7d8cf;
  background: var(--primary-weak);
  color: var(--primary);
}

.link-button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--primary);
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  color: #fff;
  background: var(--primary);
  text-decoration: none;
}

button:hover {
  border-color: var(--primary);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.sidebar {
  background: #10201d;
  color: #fff;
  padding: 24px 18px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 28px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #f2c86b;
  color: #10201d;
  font-weight: 800;
}

.brand h1,
.brand p,
.topbar h2,
.topbar p,
.panel h3,
.panel p {
  margin: 0;
}

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

.brand p {
  color: #b7c8c3;
  font-size: 13px;
  margin-top: 3px;
}

nav {
  display: grid;
  gap: 8px;
}

.nav {
  width: 100%;
  text-align: left;
  background: transparent;
  border-color: transparent;
  color: #d9e6e2;
}

.nav.active,
.nav:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.main {
  padding: 26px;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.topbar h2 {
  font-size: 26px;
}

.topbar p {
  color: var(--muted);
  margin-top: 4px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metrics article,
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metrics article {
  padding: 18px;
}

.metrics span {
  font-size: 30px;
  font-weight: 800;
}

.metrics p {
  margin: 4px 0 0;
  color: var(--muted);
}

.split,
.workspace {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.workspace {
  grid-template-columns: 320px 1fr;
}

.panel {
  padding: 18px;
  min-width: 0;
}

.panel header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.panel header p {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

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

.item {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 12px;
  background: #fff;
}

.item.selected {
  border-color: var(--primary);
  background: var(--primary-weak);
}

.clickable-item {
  cursor: pointer;
}

.clickable-item:hover {
  border-color: var(--primary);
  background: #f8fbfa;
}

.item strong {
  display: block;
  margin-bottom: 4px;
}

.item p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 12px;
  margin-left: 6px;
  background: #e5e7eb;
}

.badge.red {
  background: #fee4e2;
  color: var(--danger);
}

.badge.yellow {
  background: #fff3d6;
  color: var(--warn);
}

.badge.green {
  background: var(--primary-weak);
  color: var(--primary);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.priority-card {
  flex: 1 1 210px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f7fbf9 100%);
}

.priority-card strong {
  display: block;
  margin-bottom: 6px;
}

.priority-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.metric-clickable {
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.metric-clickable:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: 0 10px 24px rgba(23, 107, 91, 0.12);
}

.owner-metrics {
  display: grid;
  grid-template-columns: repeat(7, minmax(100px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.owner-metrics article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fbfa;
  cursor: pointer;
}

.owner-metrics article.active,
.owner-metrics article:hover {
  border-color: var(--primary);
  background: var(--primary-weak);
}

.owner-metrics strong {
  display: block;
  font-size: 22px;
}

.owner-metrics span {
  color: var(--muted);
  font-size: 12px;
}

.owner-user-list {
  display: grid;
  gap: 12px;
}

.owner-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

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

.segmented button {
  min-height: 32px;
  border-radius: 999px;
}

.segmented button.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

#owner-search {
  width: min(360px, 100%);
}

.owner-table {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
  background: #fff;
}

.owner-table table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

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

.owner-table th {
  background: #f8fbfa;
  color: var(--muted);
  font-size: 13px;
}

.owner-table td p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.owner-edit-row td {
  background: #fbfcfd;
}

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

.owner-user-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.list-more {
  width: 100%;
  color: var(--primary);
  border-style: dashed;
  background: #f8fbfa;
}

.owner-user-head,
.owner-user-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.owner-user-head p {
  margin-top: 4px;
}

.owner-user-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.owner-user-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.owner-user-form .field {
  margin-bottom: 0;
}

.owner-user-foot {
  border-top: 1px solid var(--line);
  margin-top: 14px;
  padding-top: 12px;
}

.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: #fff;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 16px;
}

.field span {
  font-weight: 700;
}

textarea {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px;
  resize: vertical;
}

input,
select {
  border: 1px solid var(--line);
  border-radius: 7px;
  min-height: 40px;
  padding: 0 10px;
  background: #fff;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.service-center-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.service-center-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fbfa;
}

.service-center-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.service-center-grid strong {
  font-size: 16px;
}

.service-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  margin: 6px 0 16px;
  padding-bottom: 10px;
}

.service-tabs button {
  min-height: 34px;
  border-radius: 999px;
}

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

.service-tab-panel {
  display: none;
}

.service-tab-panel.active {
  display: block;
}

.service-feed {
  display: grid;
  gap: 10px;
}

.wide-workspace {
  grid-template-columns: minmax(360px, 0.85fr) minmax(420px, 1.15fr);
}

.compact-form {
  grid-template-columns: repeat(2, minmax(180px, 1fr));
}

.check-field {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 24px;
}

.status-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.status-summary article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.status-summary strong {
  display: block;
  font-size: 24px;
  color: var(--primary);
}

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

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.status-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
  display: grid;
  gap: 12px;
}

.status-card.red {
  border-color: #f1b6b0;
}

.status-card.yellow {
  border-color: #f3d39a;
}

.status-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.status-card-head strong {
  display: block;
  font-size: 16px;
}

.status-card-head p,
.status-ring-row p {
  margin: 3px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.status-ring-row {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 12px;
  align-items: center;
}

.mini-ring {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at center, #fff 56%, transparent 57%),
    conic-gradient(var(--primary) calc(var(--progress) * 1%), #e6eaef 0);
  color: var(--primary);
  font-weight: 700;
}

.status-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.status-flags span {
  border-radius: 999px;
  padding: 5px 9px;
  background: #eef2f6;
  color: var(--muted);
  font-size: 12px;
}

.status-flags .ok {
  background: var(--primary-weak);
  color: var(--primary);
}

.status-flags .warn {
  background: #fff4dc;
  color: var(--warn);
}

.work-list {
  display: grid;
  gap: 12px;
}

.work-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.work-card.needs-action {
  border-color: #f3d39a;
  background: #fffdf8;
}

.work-card-main .item {
  border: 0;
  padding: 0;
  background: transparent;
}

.work-card strong {
  display: block;
  margin-bottom: 6px;
}

.work-card p {
  margin: 4px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.work-card-side {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(90px, 1fr));
  gap: 8px;
  margin: 10px 0;
}

.score-grid span {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  color: var(--muted);
  font-size: 12px;
}

.score-grid b {
  display: block;
  margin-top: 3px;
  color: var(--text);
  font-size: 15px;
}

.teacher-note-card,
.plan-stack {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.plan-command-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid #cfe0dc;
  border-radius: 8px;
  padding: 14px;
  background: linear-gradient(135deg, #f4fbf8, #fff);
}

.plan-command-card strong {
  display: block;
  margin-bottom: 4px;
}

.plan-command-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.task-editor-list {
  display: grid;
  gap: 12px;
}

.task-editor {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.task-editor-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.task-editor-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
}

.task-editor-grid label {
  color: var(--muted);
  font-size: 12px;
}

.task-editor-grid input,
.task-editor-grid select {
  margin-top: 5px;
}

.segmented {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
}

.segmented button {
  min-height: 32px;
  border-radius: 999px;
  background: transparent;
}

.segmented button.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.assessment-manager-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.assessment-roster {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.assessment-roster-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.assessment-roster-card.recorded {
  border-color: #cfe0dc;
  background: #f8fbfa;
}

.assessment-roster-card.missing {
  border-color: #f3d39a;
  background: #fffdf8;
}

.assessment-roster-card p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.feed-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.feed-item strong {
  display: block;
  margin-bottom: 5px;
}

.feed-item p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.intervention-list,
.experience-camp-list {
  display: grid;
  gap: 12px;
}

.intervention-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
  cursor: pointer;
}

.intervention-card:hover {
  border-color: var(--primary);
  background: #f8fbfa;
}

.intervention-card p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.intervention-side {
  display: grid;
  gap: 8px;
  justify-items: end;
  color: var(--muted);
  font-size: 13px;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 20px 0 12px;
}

.section-title-row h4,
.section-title-row p {
  margin: 0;
}

.plain {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 12px;
  min-height: 96px;
  color: var(--muted);
  line-height: 1.6;
}

.draft {
  margin-top: 16px;
}

.report-panel {
  margin-top: 16px;
}

.inline-form {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.inline-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

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

.danger-button {
  color: var(--danger);
  border-color: #f3b4ae;
}

.draft-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

pre {
  max-height: 430px;
  overflow: auto;
  white-space: pre-wrap;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 8px;
  padding: 14px;
  line-height: 1.5;
}

.json-editor {
  width: 100%;
  min-height: 430px;
  max-height: 560px;
  overflow: auto;
  white-space: pre;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 8px;
  padding: 14px;
  line-height: 1.5;
  font-family: Consolas, "Courier New", monospace;
}

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

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

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0 4px;
}

.system-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 12px;
}

.system-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.system-card strong {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.system-card p {
  margin: 5px 0;
  color: var(--muted);
  font-size: 13px;
}

.data-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}

.service-editor-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 14px;
}

.service-editor {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

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

.service-editor-head strong {
  display: block;
  font-size: 16px;
}

.service-editor-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline article {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 12px;
}

.plan-draft-visual {
  display: grid;
  gap: 14px;
  margin-top: 12px;
}

.draft-section,
.draft-task-card,
.report-review-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

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

.draft-grid .wide,
.addon-edit-grid .wide {
  grid-column: 1 / -1;
}

.draft-task-list {
  display: grid;
  gap: 12px;
  max-height: 680px;
  overflow: auto;
  padding-right: 4px;
}

.draft-task-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.draft-task-head span {
  color: var(--muted);
  font-size: 12px;
}

.addon-card .addon-edit-grid {
  margin-top: 12px;
  padding: 12px;
  border-radius: 8px;
  background: #f8fafc;
}

.addon-edit-grid label {
  color: var(--muted);
  font-size: 12px;
}

.history-group {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.report-review-card {
  display: grid;
  gap: 10px;
}

.report-review-card strong {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

@media (max-width: 980px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .metrics,
  .owner-metrics,
  .status-summary,
  .split,
  .workspace,
  .wide-workspace,
  .detail-grid,
  .service-center-grid,
  .owner-user-form,
  .service-editor-list,
  .compact-form,
  .score-grid,
  .task-editor-grid,
  .draft-grid,
  .addon-edit-grid {
    grid-template-columns: 1fr;
  }

  .owner-user-head,
  .owner-user-foot,
  .intervention-card,
  .owner-toolbar,
  .pager {
    align-items: flex-start;
  }

  .intervention-card,
  .work-card,
  .assessment-roster-card {
    grid-template-columns: 1fr;
  }

  .plan-command-card,
  .assessment-manager-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .owner-user-head,
  .owner-user-foot,
  .owner-toolbar,
  .pager {
    flex-direction: column;
  }
}
