:root {
  --green-900: #1f4d2d;
  --green-800: #2f6f42;
  --green-600: #4d8b55;
  --green-300: #b9d8b8;
  --green-100: #edf6ea;
  --ink: #1b211d;
  --muted: #69736d;
  --line: #d7dfd5;
  --paper: #fbfcf8;
  --cream: #f4f1e6;
  --blue: #3b6f9f;
  --amber: #d89932;
  --red: #b9554e;
  --shadow: 0 18px 45px rgba(37, 58, 42, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  background: linear-gradient(135deg, #e9efe6 0%, #fbfcf8 48%, #eef4f6 100%);
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
  min-width: 0;
}

button {
  cursor: pointer;
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px;
  color: #f8fff7;
  background: var(--green-900);
  box-shadow: var(--shadow);
}

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

.brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  color: var(--green-900);
  background: #f7fbef;
  border-radius: 8px;
  font-size: 30px;
  font-weight: 900;
}

.brand h1,
.topbar h2,
.overview-panel h3,
.rate-table-panel h3 {
  margin: 0;
}

.brand h1 {
  font-size: 24px;
  line-height: 1.1;
}

.brand p,
.eyebrow,
.sheet-toolbar span,
.chart-panel header span,
.rate-table-panel header span,
.overview-panel header span,
.stats-strip span,
.month-switcher span,
.sidebar-panel label {
  margin: 0;
  color: inherit;
  opacity: 0.74;
  font-size: 13px;
}

.month-switcher {
  display: grid;
  grid-template-columns: 38px 1fr 38px;
  align-items: center;
  gap: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
}

.month-switcher div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  text-align: center;
}

.icon-button,
.primary-button,
.ghost-button,
.nav-tab {
  border: 0;
  border-radius: 8px;
}

.icon-button {
  width: 38px;
  height: 38px;
  color: #fff;
  background: rgba(255, 255, 255, 0.13);
  font-size: 26px;
  line-height: 1;
}

.sidebar-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar input,
.task-form input,
.task-form select {
  min-height: 40px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 11px;
  outline: 0;
}

.sidebar input {
  width: 100%;
}

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

.nav-tab {
  min-height: 42px;
  color: rgba(255, 255, 255, 0.78);
  background: transparent;
  text-align: left;
  padding: 0 14px;
}

.nav-tab.active {
  color: var(--green-900);
  background: #f7fbef;
  font-weight: 700;
}

.stats-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: auto;
}

.stats-strip div {
  padding: 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
}

.stats-strip strong {
  display: block;
  margin-top: 5px;
  font-size: 22px;
}

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

.topbar > *,
.task-form > *,
.sidebar > *,
.month-switcher > *,
.stats-strip > * {
  min-width: 0;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(430px, 640px);
  gap: 18px;
  align-items: center;
  margin-bottom: 18px;
}

.topbar h2 {
  font-size: 32px;
  letter-spacing: 0;
}

.eyebrow {
  color: var(--green-800);
  opacity: 1;
  font-weight: 700;
}

.task-form {
  display: grid;
  grid-template-columns: 116px 1fr 120px 86px;
  gap: 8px;
  align-items: center;
}

.topbar-actions {
  display: grid;
  gap: 8px;
}

.install-button {
  justify-self: end;
  min-height: 36px;
  padding: 0 14px;
  color: var(--green-900);
  background: #f7fbef;
  border: 1px solid var(--green-300);
  border-radius: 8px;
  font-weight: 800;
}

.task-form input,
.task-form select {
  width: 100%;
}

.primary-button {
  min-height: 40px;
  color: #fff;
  background: var(--green-800);
  font-weight: 700;
}

.ghost-button {
  min-height: 34px;
  color: var(--green-900);
  background: #e5efe2;
  padding: 0 12px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(106px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.mobile-board {
  display: none;
}

.daily-card {
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 6px;
  min-height: 146px;
  padding: 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 22px rgba(33, 62, 44, 0.08);
}

.daily-card.active {
  border-color: var(--green-800);
  box-shadow: inset 0 0 0 2px rgba(47, 111, 66, 0.22), 0 8px 22px rgba(33, 62, 44, 0.08);
}

.weekday {
  color: var(--green-800);
  font-weight: 700;
}

.date {
  font-size: 15px;
}

.ring {
  --rate: 0%;
  display: grid;
  align-self: center;
  justify-self: center;
  width: 72px;
  height: 72px;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--green-600) var(--rate), #dfe7dc 0);
}

.ring::before {
  content: "";
  position: absolute;
}

.ring-value {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 50%;
  background: var(--paper);
  font-weight: 800;
}

.sheet-wrap,
.chart-panel,
.rate-table-panel,
.overview-panel {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.sheet-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.sheet-toolbar div {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}

.sheet-scroll {
  overflow: auto;
  max-height: calc(100vh - 312px);
}

.plan-table {
  width: 100%;
  min-width: 1440px;
  border-collapse: collapse;
  table-layout: fixed;
  background: var(--paper);
}

.plan-table th:nth-child(1),
.plan-table td:nth-child(1) {
  width: 88px;
}

.plan-table th:nth-child(2),
.plan-table td:nth-child(2) {
  width: 240px;
}

.plan-table th:nth-last-child(1),
.plan-table td:nth-last-child(1) {
  width: 68px;
}

.plan-table th,
.plan-table td {
  border: 1px solid var(--line);
  padding: 7px 8px;
  vertical-align: middle;
}

.plan-table th {
  color: #fff;
  background: var(--green-800);
  font-size: 13px;
}

.plan-table td {
  background: #fff;
}

.category-cell {
  width: 86px;
  color: var(--green-900);
  background: var(--green-100) !important;
  font-weight: 700;
  text-align: center;
}

.task-cell {
  width: 210px;
}

.task-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.task-time {
  flex: 0 0 auto;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.task-name-input {
  width: 100%;
  border: 0;
  background: transparent;
  outline: 0;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
}

.delete-task {
  width: 26px;
  height: 26px;
  color: var(--red);
  background: #fff0ef;
  border: 0;
  border-radius: 8px;
}

.progress-cell {
  background: #f8fbf4 !important;
}

.progress-editor {
  display: grid;
  grid-template-columns: 22px 1fr 44px;
  gap: 6px;
  align-items: center;
}

.progress-check {
  width: 18px;
  height: 18px;
  accent-color: var(--green-800);
}

.progress-range {
  width: 100%;
  accent-color: var(--green-800);
}

.progress-value {
  min-width: 38px;
  height: 26px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 3px;
  text-align: center;
  font-size: 12px;
}

.rate-cell {
  color: var(--green-900);
  background: var(--green-100) !important;
  font-weight: 800;
  text-align: center;
}

.empty-cell {
  height: 96px;
  color: var(--muted);
  background: #fff !important;
  text-align: center;
  font-weight: 700;
}

.plan-table tfoot td {
  background: #eef6ea;
  font-weight: 800;
}

.chart-layout {
  display: grid;
  grid-template-columns: minmax(300px, 420px) minmax(420px, 1fr);
  gap: 14px;
}

.chart-panel,
.rate-table-panel,
.overview-panel {
  padding: 16px;
}

.chart-panel header,
.rate-table-panel header,
.overview-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.chart-panel strong,
.overview-panel header span {
  color: var(--green-800);
  font-size: 28px;
}

canvas {
  display: block;
  width: 100%;
  height: 280px;
}

.rate-table-panel {
  margin-top: 14px;
}

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

.rate-day {
  min-height: 88px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbf4;
}

.rate-day strong {
  display: block;
  margin: 4px 0 8px;
  font-size: 23px;
}

.rate-track {
  overflow: hidden;
  height: 8px;
  background: #dfe7dc;
  border-radius: 999px;
}

.rate-fill {
  display: block;
  height: 100%;
  background: var(--green-600);
}

.overview-grid {
  display: grid;
  grid-template-columns: minmax(440px, 1.2fr) minmax(320px, 0.8fr);
  gap: 14px;
}

.overview-list,
.category-bars {
  display: grid;
  gap: 8px;
}

.overview-item {
  display: grid;
  grid-template-columns: 86px 1fr 68px;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.overview-item.complete {
  background: var(--green-100);
}

.overview-item strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  background: #eef1ec;
  color: var(--muted);
  font-size: 12px;
}

.category-row {
  display: grid;
  grid-template-columns: 72px 1fr 48px;
  gap: 9px;
  align-items: center;
}

.category-row span:first-child {
  font-weight: 700;
}

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

.bar-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--green-600), var(--blue));
}

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: grid;
    grid-template-columns: 1fr 260px;
    align-items: center;
  }

  .nav-tabs,
  .stats-strip {
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, 1fr);
  }

  .topbar,
  .chart-layout,
  .overview-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  body {
    background: #f6f8f3;
  }

  .app-shell {
    display: block;
    padding-bottom: 92px;
    width: 100%;
    max-width: 100vw;
  }

  .main-content,
  .sidebar {
    padding: 14px;
    width: 100%;
    max-width: 100vw;
  }

  .sidebar {
    position: static;
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    width: 100%;
    max-width: 100vw;
    padding-bottom: 14px;
    border-radius: 0 0 18px 18px;
  }

  .brand {
    align-items: center;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
    font-size: 28px;
  }

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

  .month-switcher {
    grid-template-columns: 42px 1fr 42px;
    min-height: 64px;
  }

  .sidebar-panel {
    gap: 6px;
  }

  .nav-tabs {
    position: fixed;
    right: 12px;
    bottom: 10px;
    left: 12px;
    width: calc(100vw - 24px);
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 7px;
    background: rgba(31, 77, 45, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 18px;
    box-shadow: 0 14px 38px rgba(20, 41, 26, 0.26);
    backdrop-filter: blur(10px);
  }

  .nav-tab {
    display: grid;
    min-height: 46px;
    place-items: center;
    padding: 0 6px;
    border-radius: 14px;
    text-align: center;
    font-size: 14px;
  }

  .stats-strip {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 0;
  }

  .stats-strip div {
    padding: 10px 12px;
  }

  .stats-strip strong {
    font-size: 24px;
  }

  .topbar {
    display: block;
    margin-bottom: 12px;
  }

  .topbar h2 {
    margin-bottom: 12px;
    font-size: 27px;
  }

  .topbar-actions,
  .task-form,
  .summary-grid,
  .rate-table {
    grid-template-columns: 1fr;
  }

  .install-button {
    justify-self: stretch;
    min-height: 42px;
  }

  .task-form {
    gap: 8px;
    padding: 10px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
  }

  .summary-grid {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 6px;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }

  .summary-grid::-webkit-scrollbar {
    display: none;
  }

  .daily-card {
    flex: 0 0 150px;
    min-width: 0;
    min-height: 146px;
    scroll-snap-align: start;
  }

  .daily-card {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr;
  }

  .date {
    font-size: 13px;
    white-space: nowrap;
  }

  .ring {
    grid-row: 3;
    grid-column: 1;
    width: 62px;
    height: 62px;
  }

  .ring-value {
    width: 42px;
    height: 42px;
    font-size: 14px;
  }

  .mobile-board {
    display: block;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 10px 26px rgba(33, 62, 44, 0.08);
    overflow: hidden;
  }

  .mobile-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px;
    color: #fff;
    background: var(--green-800);
  }

  .mobile-section-head div {
    display: grid;
    gap: 2px;
  }

  .mobile-section-head span {
    opacity: 0.82;
    font-size: 13px;
  }

  .mobile-section-head strong {
    font-size: 30px;
    line-height: 1;
  }

  .mobile-task-list {
    display: grid;
    gap: 10px;
    padding: 12px;
  }

  .mobile-task-card {
    display: grid;
    gap: 10px;
    padding: 12px;
    background: #f8fbf4;
    border: 1px solid var(--line);
    border-radius: 12px;
  }

  .mobile-task-card.complete {
    background: var(--green-100);
    border-color: var(--green-300);
  }

  .mobile-task-main {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: start;
  }

  .mobile-task-main strong {
    overflow-wrap: anywhere;
    font-size: 16px;
  }

  .mobile-task-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .mobile-task-card .progress-editor {
    grid-template-columns: 24px 1fr 52px;
    min-height: 34px;
  }

  .mobile-empty {
    padding: 24px 12px;
    color: var(--muted);
    text-align: center;
    font-weight: 700;
  }

  .sheet-wrap {
    display: none;
  }

  .sheet-toolbar,
  .sheet-toolbar div {
    align-items: flex-start;
    flex-direction: column;
  }

  .chart-panel,
  .rate-table-panel,
  .overview-panel {
    border-radius: 14px;
    box-shadow: 0 10px 26px rgba(33, 62, 44, 0.08);
  }

  .overview-item {
    grid-template-columns: 72px 1fr 58px;
    padding: 9px;
  }
}
