:root {
  --ink: #16211f;
  --muted: #68736f;
  --line: #d8e1dd;
  --bg: #f4f7f5;
  --panel: #ffffff;
  --green: #27775d;
  --green-soft: #e6f4ed;
  --blue: #3f6f9b;
  --gold: #bd7a26;
  --red: #b9555b;
  --shadow: 0 18px 45px rgba(22, 33, 31, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px clamp(16px, 4vw, 52px) 18px clamp(76px, 8vw, 112px);
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.profile-button {
  position: absolute;
  left: clamp(16px, 4vw, 52px);
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #ffffff;
  background-size: cover;
  background-position: center;
  color: var(--green);
  font-size: 13px;
  font-weight: 900;
  box-shadow: 0 8px 24px rgba(22, 33, 31, 0.1);
}

.profile-button.has-avatar {
  color: #ffffff;
  border-color: transparent;
}

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

.logo {
  display: inline-flex;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--green-soft);
  color: var(--green);
  font-weight: 900;
}

.brand h1 {
  margin: 0;
  font-size: 22px;
}

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

.brand p,
.eyebrow {
  margin: 0;
  font-size: 13px;
}

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

.page {
  width: min(1180px, calc(100% - 32px));
  margin: 24px auto 56px;
}

.grid {
  display: grid;
  gap: 16px;
}

.parent-grid {
  grid-template-columns: 340px 1fr;
  align-items: start;
}

.admin-grid {
  grid-template-columns: 220px 1fr;
  align-items: start;
}

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

.panel,
.card {
  padding: 18px;
}

.sidebar {
  padding: 14px;
  display: grid;
  gap: 8px;
}

.section-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.section-title h2,
.section-title h3,
.card h3,
.task-detail h2 {
  margin: 0;
}

.section-title p {
  margin: 5px 0 0;
}

.login-card {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.login-page {
  max-width: 760px;
  margin: 0 auto;
}

.login-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 22px;
  align-items: start;
  margin-top: 16px;
}

.avatar-editor {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  text-align: center;
}

.avatar-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background: var(--green);
  background-size: cover;
  background-position: center;
  color: #ffffff;
  font-size: 38px;
  font-weight: 900;
}

.avatar-upload {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
}

.avatar-upload input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background: #ffffff;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

.button,
.button-secondary,
.button-danger,
.tab {
  border: 1px solid transparent;
  border-radius: 8px;
  min-height: 42px;
  padding: 0 14px;
  font-weight: 800;
}

.button {
  color: #ffffff;
  background: var(--green);
}

.button-secondary {
  background: #ffffff;
  border-color: var(--line);
  color: var(--ink);
}

.button-danger {
  background: #fff4f4;
  border-color: #efc6c9;
  color: var(--red);
}

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

.tabs {
  display: grid;
  gap: 8px;
}

.tab {
  text-align: left;
  background: transparent;
}

.tab.active {
  background: var(--green-soft);
  color: var(--green);
  border-color: #c7dfd5;
}

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

.product-card {
  text-align: left;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  min-height: 132px;
}

.product-card.active {
  border-color: var(--green);
  background: #f2faf5;
}

.product-card strong,
.product-card span {
  display: block;
}

.product-card > span {
  display: -webkit-box;
  min-height: 42px;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.product-card span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
}

.status.red {
  background: #fff0f0;
  color: var(--red);
}

.status.gold {
  background: #fff6e6;
  color: var(--gold);
}

.camp-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

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

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

.metric strong {
  font-size: 18px;
}

.progress-track {
  height: 10px;
  border-radius: 999px;
  background: #dce6e1;
  overflow: hidden;
  margin: 14px 0;
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--blue));
}

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

.task-row {
  display: grid;
  grid-template-columns: 70px 1fr 86px;
  align-items: center;
  gap: 10px;
  padding: 12px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.task-row.active {
  border-color: var(--green);
  background: #f2faf5;
}

.task-row.locked {
  opacity: 0.55;
}

.task-row span,
.task-row small {
  color: var(--muted);
  font-size: 12px;
}

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

.media-box,
.image-preview {
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed #b9c8c1;
  border-radius: 8px;
  color: var(--muted);
  background: linear-gradient(135deg, rgba(39, 119, 93, 0.1), rgba(63, 111, 155, 0.12));
}

.feedback-box {
  padding: 14px;
  border-left: 4px solid var(--green);
  background: #f2faf5;
  border-radius: 8px;
}

.submission-preview {
  display: grid;
  gap: 10px;
}

.submission-preview p {
  margin: 0;
  color: var(--ink);
  line-height: 1.65;
}

.upload-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.upload-action {
  min-height: 86px;
  padding: 14px;
  border: 1px dashed #aebfb7;
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--ink);
}

.upload-action span,
.upload-action small {
  display: block;
}

.upload-action span {
  font-size: 15px;
  font-weight: 900;
}

.upload-action small {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.upload-action input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-action.disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

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

.image-thumb {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
}

.image-thumb img,
.submitted-images > img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.image-thumb:hover img {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(39, 119, 93, 0.14);
}

.empty {
  padding: 22px;
  text-align: center;
  border: 1px dashed #b9c8c1;
  border-radius: 8px;
  color: var(--muted);
  background: #ffffff;
}

.table {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.table-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border-top: 1px solid var(--line);
}

.table-row:first-child {
  border-top: 0;
}

.table-head {
  color: var(--muted);
  background: #f7f9f8;
  font-weight: 900;
  font-size: 13px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}

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

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

.plan-board {
  --plan-grid-template: minmax(180px, 1.45fr) minmax(72px, 0.6fr) minmax(170px, 1.05fr) minmax(86px, 0.55fr) minmax(190px, 1.25fr) minmax(210px, 0.95fr);
  display: grid;
  gap: 10px;
  margin-bottom: 22px;
  overflow-x: auto;
}

.product-settings {
  display: grid;
  gap: 14px;
}

.product-setting-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.product-form-grid {
  grid-template-columns: 1fr 1fr 1fr 2fr;
}

.product-intro {
  display: grid;
  gap: 14px;
  text-align: left;
}

.product-intro h2,
.product-intro p {
  margin: 0;
}

.plan-row {
  display: grid;
  grid-template-columns: var(--plan-grid-template);
  gap: 12px;
  align-items: center;
  min-width: 1040px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.plan-row > * {
  min-width: 0;
}

.plan-row > span,
.plan-row > strong {
  overflow-wrap: anywhere;
}

.plan-row.header {
  color: var(--muted);
  background: #f7f9f8;
  font-size: 13px;
  font-weight: 900;
}

.plan-row.header span {
  white-space: nowrap;
}

.plan-row.active {
  border-color: var(--green);
  background: #f2faf5;
}

.plan-progress {
  color: var(--green);
  font-size: 18px;
  font-weight: 900;
}

.plan-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: nowrap;
}

.plan-actions button {
  white-space: nowrap;
}

.plan-editor-title {
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.day-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.grading-plan-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.grading-plan-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.grading-plan-card h3,
.grading-plan-card p {
  margin: 0;
}

.grading-card-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.grading-card-metrics span {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fbfcfb;
  font-size: 12px;
}

.grading-card-metrics strong {
  display: block;
  color: var(--ink);
  font-size: 18px;
}

.grading-workspace {
  margin-top: 20px;
}

.grading-tabs,
.grading-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.grading-tabs .day-pill {
  padding: 0 12px;
}

.grading-tabs .day-pill.muted-day {
  border-color: var(--line);
  color: var(--muted);
  background: #f5f7f6;
}

.grading-tabs .day-pill.current-day {
  border-color: var(--green);
  color: var(--green);
  background: var(--green-soft);
}

.grading-tabs .day-pill.active {
  box-shadow: 0 0 0 2px rgba(39, 119, 93, 0.18);
}

.grading-tabs .day-pill span {
  margin-left: 6px;
  color: var(--muted);
  font-size: 12px;
}

.active-filter {
  border-color: var(--green);
  color: var(--green);
  background: var(--green-soft);
}

.grading-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.88fr) minmax(0, 1.4fr);
  gap: 14px;
  align-items: start;
}

.grading-submission-list,
.grading-review-panel {
  display: grid;
  gap: 10px;
}

.grading-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  text-align: left;
}

.grading-row.active {
  border-color: var(--green);
  background: #f2faf5;
}

.grading-row strong,
.grading-row span,
.grading-row small {
  display: block;
}

.grading-row span,
.grading-row small {
  color: var(--muted);
  font-size: 12px;
}

.grading-review-panel {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.grading-review-panel h3,
.grading-review-panel p {
  margin: 0;
}

.homework-card {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  padding: 12px 16px;
  background: #17211f;
  color: #ffffff;
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: none;
  z-index: 20;
}

.toast.show {
  display: block;
}

.image-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 64px 24px 24px;
  background: rgba(12, 18, 16, 0.78);
}

.image-modal img {
  max-width: min(1080px, 96vw);
  max-height: 86vh;
  object-fit: contain;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.32);
}

.image-modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-radius: 8px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.14);
  font-weight: 800;
}

.hidden {
  display: none !important;
}

@media (max-width: 920px) {
  .parent-grid,
  .admin-grid,
  .two-col {
    grid-template-columns: 1fr;
  }

  .product-list,
  .camp-summary,
  .form-grid,
  .template-grid,
  .reminder-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .login-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .app-header,
  .section-title,
  .homework-card {
    display: grid;
  }

  .product-list,
  .camp-summary,
  .form-grid,
  .product-form-grid,
  .grading-plan-board,
  .template-grid,
  .reminder-grid,
  .upload-options {
    grid-template-columns: 1fr;
  }

  .grading-layout {
    grid-template-columns: 1fr;
  }

  .task-row {
    grid-template-columns: 54px 1fr;
  }

  .task-row small {
    grid-column: 2;
  }

  .table {
    overflow-x: auto;
  }

  .table-row,
  .plan-row {
    min-width: 760px;
  }

  .plan-row {
    min-width: 1040px;
  }
}
