:root {
  color-scheme: light;
  --theme-primary: #f472b6;
  --theme-rgb: 244 114 182;
  --bg: #fff7fb;
  --ink: #202124;
  --muted: #667085;
  --line: #eaddea;
  --panel: #ffffff;
  --green: var(--theme-primary);
  --blue: #2563eb;
  --red: #e11d48;
  --amber: #b7791f;
  --shadow: 0 18px 55px rgba(32, 33, 36, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgb(var(--theme-rgb) / 0.12), #fff7fb 44%, #eff6ff);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

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

button {
  cursor: pointer;
}

.app {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px;
  background: rgb(255 255 255 / 0.82);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

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

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--theme-primary), #fbbf24);
  color: #fff;
  font-size: 24px;
  font-weight: 800;
}

.brand-mark img,
.avatar-preview img,
.child-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

h1,
h2,
p {
  margin: 0;
}

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

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

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

.field span {
  color: #3d4752;
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

input,
select {
  height: 42px;
  padding: 0 12px;
}

textarea {
  resize: vertical;
  padding: 12px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgb(var(--theme-rgb) / 0.16);
}

.hidden {
  display: none !important;
}

.login-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgb(var(--theme-rgb) / 0.14), #fff7fb 46%, #ecfeff);
}

.login-card {
  display: grid;
  width: min(420px, 100%);
  gap: 18px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.form-message {
  min-height: 20px;
  color: var(--red);
  font-size: 13px;
  font-weight: 800;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(32, 33, 36, 0.42);
}

.modal-panel {
  display: grid;
  width: min(520px, 100%);
  max-height: calc(100vh - 40px);
  gap: 14px;
  overflow: auto;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.check-group {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.check-group legend {
  padding: 0 6px;
  color: #3d4752;
  font-size: 13px;
  font-weight: 800;
}

.check-group label,
.mini-checks label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #3d4752;
  font-size: 13px;
  font-weight: 800;
}

.check-group input,
.mini-checks input,
.check-line input,
.tiny-check input {
  width: 16px;
  height: 16px;
  padding: 0;
}

.check-line,
.tiny-check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #3d4752;
  font-size: 13px;
  font-weight: 800;
}

.panel,
.note-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(32, 33, 36, 0.06);
}

.compact {
  padding: 14px;
}

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

.panel-head h2 {
  font-size: 16px;
}

.icon-btn,
.primary-btn,
.tab {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.icon-btn {
  width: 34px;
  height: 34px;
  font-size: 22px;
  line-height: 1;
}

.primary-btn {
  min-height: 40px;
  padding: 0 14px;
  background: linear-gradient(135deg, var(--theme-primary), #fbbf24);
  color: #fff;
  border-color: transparent;
  font-weight: 800;
}

.ghost-btn {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #3d4752;
  font-weight: 800;
}

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

.child-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: left;
}

.child-btn.active {
  border-color: var(--green);
  background: rgb(var(--theme-rgb) / 0.12);
}

.child-btn:disabled {
  cursor: default;
  opacity: 0.65;
}

.child-chip {
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  border-radius: 50%;
}

.child-avatar {
  display: block;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  overflow: hidden;
  border: 2px solid rgb(var(--theme-rgb) / 0.24);
  border-radius: 50%;
  background: #fff;
}

.child-main {
  min-width: 0;
  flex: 1;
}

.child-main strong,
.child-main small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.child-main small {
  color: var(--muted);
}

.status {
  border-radius: 999px;
  background: rgb(var(--theme-rgb) / 0.12);
  color: var(--green);
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 800;
}

.badge-dot {
  display: inline-grid;
  min-width: 18px;
  height: 18px;
  place-items: center;
  margin-left: 4px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
}

.workspace {
  min-width: 0;
  padding: 28px;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

.tab {
  min-height: 40px;
  padding: 0 16px;
  color: #3d4752;
  font-weight: 800;
}

.tab.active {
  background: linear-gradient(135deg, var(--theme-primary), #fbbf24);
  color: #fff;
  border-color: transparent;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

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

.eyebrow {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.section-title h2 {
  margin-top: 4px;
  font-size: 28px;
}

.score-pill {
  display: grid;
  min-width: 160px;
  gap: 3px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--theme-primary), #fbbf24);
  color: #fff;
  padding: 10px 14px;
  text-align: right;
  font-weight: 900;
}

.score-pill strong,
.score-pill span,
.score-pill small {
  display: block;
}

.score-pill strong {
  font-size: 22px;
}

.score-pill span,
.score-pill small {
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
}

.task-grid {
  display: grid;
  gap: 18px;
}

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

.task-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.task-group-head h3 {
  margin: 0;
  font-size: 18px;
}

.task-group-head span {
  border-radius: 999px;
  background: #eef2f7;
  color: #344054;
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 900;
}

.task-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}

.task-card {
  min-height: 230px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(32, 33, 36, 0.06);
}

.task-card.done {
  border-color: rgb(var(--theme-rgb) / 0.45);
  background: rgb(var(--theme-rgb) / 0.10);
}

.task-card.pending {
  border-color: #fbbf24;
  background: #fffbeb;
}

.task-top {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.task-title {
  font-size: 18px;
  font-weight: 900;
  line-height: 1.35;
}

.done-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #fff;
  font-size: 24px;
  font-weight: 900;
}

.task-card.done .done-mark {
  border-color: var(--green);
  background: var(--green);
}

.task-card.pending .done-mark {
  border-color: #fbbf24;
  background: #fbbf24;
}

.time-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
  color: #3d4752;
  font-size: 13px;
  font-weight: 800;
}

.task-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.task-actions button {
  min-height: 38px;
}

.secondary-btn {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #202124;
  font-weight: 800;
}

.primary-btn:disabled,
.secondary-btn:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.task-status {
  margin-top: 14px;
  font-size: 13px;
}

.task-note {
  margin-top: 14px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.tag {
  border-radius: 999px;
  background: #eef2f7;
  color: #344054;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 800;
}

.warn-tag {
  background: #fffbeb;
  color: #92400e;
}

.attachment-box {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.attachment-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #3d4752;
  font-size: 13px;
}

.mini-upload {
  position: relative;
  overflow: hidden;
  border-radius: 999px;
  background: rgb(var(--theme-rgb) / 0.12);
  color: var(--green);
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 900;
}

.mini-upload input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.attachment-list,
.history-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.attachment-list img,
.history-attachments img {
  width: 58px;
  height: 58px;
  object-fit: cover;
  border: 2px solid rgb(var(--theme-rgb) / 0.22);
  border-radius: 8px;
  background: #fff;
}

.note-panel {
  margin-top: 16px;
  padding: 16px;
}

.reward-panel {
  margin-top: 12px;
}

.reward-form {
  display: grid;
  grid-template-columns: minmax(160px, 1.3fr) 90px minmax(180px, 1.5fr) auto;
  align-items: end;
  gap: 12px;
}

.quick-form {
  display: grid;
  grid-template-columns: minmax(160px, 1.3fr) repeat(3, minmax(120px, 1fr)) auto;
  align-items: end;
  gap: 12px;
}

.quick-form h3 {
  margin: 0 0 4px;
  font-size: 18px;
}

.quick-form .form-message {
  grid-column: 1 / -1;
}

.status-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #fde68a;
  border-radius: 8px;
  background: #fffbeb;
  color: #92400e;
  font-weight: 900;
}

.status-banner.makeup {
  border-color: rgb(var(--theme-rgb) / 0.30);
  background: rgb(var(--theme-rgb) / 0.10);
  color: var(--green);
}

.comment-stack {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.comment-stack blockquote {
  margin: 0;
  padding: 12px;
  border-left: 4px solid var(--theme-primary);
  border-radius: 8px;
  background: rgb(var(--theme-rgb) / 0.08);
  color: #344054;
  font-weight: 800;
}

.comment-stack small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

.reward-form h3 {
  margin: 0 0 4px;
  font-size: 18px;
}

.reward-form .form-message {
  grid-column: 1 / -1;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

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

.metric span {
  color: var(--muted);
  font-weight: 800;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 34px;
}

.week-chart,
.editor-list,
.history-list,
.review-list {
  display: grid;
  gap: 12px;
}

.weekly-report {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.weekly-report h3 {
  margin: 0;
}

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

.report-grid div,
.empty-card,
.review-card,
.shop-card,
.template-card,
.leaderboard,
.badge-wall,
.goal-wall,
.goal-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.report-grid span,
.review-card span,
.review-card small,
.shop-card p,
.template-card span,
.leader-row span,
.goal-card span,
.achievement span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.report-grid strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.calendar-week {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  text-align: center;
}

.calendar-cell {
  display: grid;
  min-height: 104px;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #202124;
  text-align: left;
}

.calendar-cell.selected {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgb(var(--theme-rgb) / 0.14);
}

.muted-cell {
  opacity: 0.45;
}

.calendar-cell span,
.calendar-cell small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.mini-bar {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #eef2f7;
}

.mini-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--theme-primary), #fbbf24);
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}

.shop-card {
  display: grid;
  gap: 12px;
}

.shop-card h3 {
  margin: 0 0 6px;
}

.shop-cost {
  justify-self: start;
  border-radius: 999px;
  background: #eef2f7;
  color: #344054;
  padding: 6px 11px;
  font-weight: 900;
}

.disabled-card {
  opacity: 0.56;
}

.shop-form {
  display: grid;
  grid-template-columns: minmax(160px, 1.3fr) minmax(150px, 1.1fr) 110px minmax(180px, 1.5fr) auto;
  align-items: end;
  gap: 12px;
}

.shop-form .form-message {
  grid-column: 1 / -1;
}

.review-list {
  margin-top: 16px;
}

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

.notice-card.good {
  border-color: rgb(var(--theme-rgb) / 0.32);
  background: rgb(var(--theme-rgb) / 0.08);
}

.notice-card.warm {
  border-color: #fde68a;
  background: #fffbeb;
}

.notice-card.danger {
  border-color: #fecdd3;
  background: #fff1f2;
}

.leaderboard,
.badge-wall,
.goal-wall {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.leaderboard h3,
.badge-wall h3,
.goal-wall h3,
.review-list h3 {
  margin: 0;
}

.leader-row,
.template-card,
.goal-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.achievement {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  opacity: 0.62;
}

.achievement.unlocked {
  border-color: rgb(var(--theme-rgb) / 0.35);
  background: rgb(var(--theme-rgb) / 0.10);
  opacity: 1;
}

.template-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

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

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

.history-head strong,
.history-head span {
  display: block;
}

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

.history-score {
  border-radius: 8px;
  background: #202124;
  color: #fff;
  padding: 8px 10px;
  font-weight: 900;
}

.history-tasks {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
}

.history-tasks li span,
.history-tasks li p {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.history-note {
  border-left: 3px solid var(--green);
  padding-left: 10px;
  color: #3d4752;
  font-size: 13px;
}

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

.form-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.form-panel h3 {
  margin: 0;
  font-size: 18px;
}

.avatar-upload {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
}

.avatar-preview {
  display: grid;
  width: 84px;
  height: 84px;
  place-items: center;
  overflow: hidden;
  border: 3px solid rgb(var(--theme-rgb) / 0.30);
  border-radius: 50%;
  background: linear-gradient(135deg, var(--theme-primary), #fbbf24);
  color: #fff;
  font-size: 34px;
  font-weight: 900;
}

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

.day-row,
.editor-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) 80px;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.bar {
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #eef2f7;
}

.bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--theme-primary), #fbbf24);
}

.editor-row {
  grid-template-columns: minmax(150px, 1.8fr) minmax(86px, 0.9fr) minmax(86px, 0.9fr) minmax(86px, 0.9fr) 68px 72px minmax(118px, 1fr) 42px;
}

.editor-row input,
.editor-row select {
  min-width: 0;
}

.mini-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.danger-btn {
  width: 42px;
  height: 42px;
  border: 1px solid #fecdd3;
  border-radius: 8px;
  background: #fff1f2;
  color: var(--red);
  font-weight: 900;
}

@media (max-width: 860px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .workspace {
    padding: 20px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .account-grid {
    grid-template-columns: 1fr;
  }

  .editor-row,
  .day-row,
  .reward-form,
  .shop-form,
  .quick-form,
  .review-card {
    grid-template-columns: 1fr;
  }

  .review-card {
    align-items: stretch;
  }

  .leader-row,
  .template-card,
  .goal-card {
    align-items: stretch;
    flex-direction: column;
  }

  .report-grid,
  .calendar-grid {
    grid-template-columns: 1fr;
  }

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

  .score-pill {
    text-align: left;
  }

  .avatar-upload {
    grid-template-columns: 1fr;
  }
}
