:root {
  color-scheme: light;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-strong: #f1f5f4;
  --text: #1d2733;
  --muted: #637083;
  --line: #d9e0e7;
  --primary: #1f7a68;
  --primary-dark: #155c4e;
  --accent: #9b5a22;
  --danger: #b42318;
  --done: #256f45;
  --warning: #a15c00;
  --shadow: 0 10px 26px rgba(24, 36, 50, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a.button {
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 8px 12px;
  text-decoration: none;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

button:hover,
a.button:hover {
  background: var(--primary-dark);
}

button:active,
a.button:active {
  transform: translateY(1px);
}

button.secondary,
a.button.secondary {
  background: #fff;
  border-color: var(--line);
  color: var(--text);
}

button.secondary:hover,
a.button.secondary:hover {
  background: var(--surface-strong);
}

button.danger {
  background: var(--danger);
}

button.danger:hover {
  background: #8f1d14;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  min-height: 72px;
  padding: 12px max(16px, calc((100vw - 1180px) / 2));
  position: sticky;
  top: 0;
  z-index: 5;
}

.topbar h1 {
  font-size: 22px;
  line-height: 1.2;
  margin: 0;
}

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 2px;
}

.topbar nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.nav-link {
  border-radius: 8px;
  color: var(--text);
  padding: 9px 12px;
  text-decoration: none;
}

.nav-link.active {
  background: #e4f0ed;
  color: var(--primary-dark);
  font-weight: 700;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-title {
  font-size: 20px;
  font-weight: 800;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 13px;
}

.nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav a {
  border-radius: 8px;
  color: var(--text);
  padding: 9px 12px;
  text-decoration: none;
}

.nav a.active {
  background: #e4f0ed;
  color: var(--primary-dark);
  font-weight: 700;
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 42px;
}

.site-footer {
  align-items: center;
  border-top: 1px solid var(--line);
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 13px;
  gap: 10px;
  justify-content: center;
  margin: 0 auto;
  padding: 16px;
  width: min(1180px, calc(100% - 32px));
}

.site-footer strong {
  color: var(--text);
  font-weight: 700;
}

.site-footer a {
  color: inherit;
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.section-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  margin: 4px 0 0;
}

.summary-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 4px;
  padding: 16px;
}

.summary-item strong {
  font-size: 28px;
  line-height: 1;
}

.summary-item span,
.muted {
  color: var(--muted);
}

.metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.metric-value {
  display: block;
  font-size: 26px;
  font-weight: 800;
  line-height: 1.1;
}

.metric-label {
  color: var(--muted);
  font-size: 13px;
}

.notice {
  background: #fff7e8;
  border: 1px solid #f1c27d;
  border-radius: 8px;
  color: #714000;
  margin-bottom: 18px;
  padding: 12px 14px;
}

.notice.success {
  background: #eaf6f2;
  border-color: #9bd2c2;
  color: var(--primary-dark);
}

.auth-panel {
  display: grid;
  gap: 10px;
}

.auth-panel form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.auth-panel input {
  max-width: 360px;
}

.readonly-panel p {
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
}

.home-grid,
.split-view {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: start;
}

.panel {
  min-width: 0;
}

.panel-header,
.section-heading {
  align-items: end;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.section-heading.compact {
  align-items: center;
}

.panel h2,
.section-heading h2 {
  font-size: 20px;
  line-height: 1.25;
  margin: 0;
}

.section-heading span {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.panel-count {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.task-list {
  display: grid;
  gap: 10px;
}

.task-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 5px solid var(--primary);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 10px;
  padding: 14px;
}

.task-card h3 {
  font-size: 16px;
  line-height: 1.45;
  margin: 8px 0;
  overflow-wrap: anywhere;
}

.task-card.overdue {
  border-left-color: var(--danger);
}

.task-card.done {
  border-left-color: var(--done);
}

.task-card.abandoned {
  border-left-color: #6f7784;
}

.task-main {
  display: grid;
  gap: 8px;
}

.task-title-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.status,
.category,
.importance {
  align-items: center;
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 700;
  min-height: 24px;
  padding: 3px 9px;
}

.category {
  background: #e7eef7;
  color: #244363;
}

.importance {
  background: #fff0d8;
  color: var(--accent);
}

.status-todo {
  background: #eef1f4;
  color: #44505c;
}

.status-doing {
  background: #e4f0ed;
  color: var(--primary-dark);
}

.status-done {
  background: #e6f4ec;
  color: var(--done);
}

.status-abandoned {
  background: #eceef1;
  color: #59616c;
}

.task-content {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.badges,
.task-meta,
.task-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.task-meta {
  margin: 0;
}

.task-meta div {
  min-width: 126px;
}

.task-meta dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.task-meta dd {
  font-size: 13px;
  margin: 2px 0 0;
}

.attachment-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.link-button {
  background: transparent;
  border: 0;
  color: var(--primary-dark);
  min-height: auto;
  padding: 0;
  text-decoration: underline;
}

.link-button:hover {
  background: transparent;
  color: var(--primary);
}

.badge {
  align-items: center;
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 700;
  min-height: 24px;
  padding: 3px 9px;
}

.badge.category {
  background: #e7eef7;
  color: #244363;
}

.badge.status-未开始 {
  background: #eef1f4;
  color: #44505c;
}

.badge.status-完成中 {
  background: #e4f0ed;
  color: var(--primary-dark);
}

.badge.status-已完成 {
  background: #e6f4ec;
  color: var(--done);
}

.badge.status-已放弃 {
  background: #eceef1;
  color: #59616c;
}

.badge.importance {
  background: #fff0d8;
  color: var(--accent);
}

.meta-item {
  color: var(--muted);
  font-size: 13px;
}

.empty {
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 26px 18px;
  text-align: center;
}

.schedule-thumb,
.schedule-form {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  padding: 18px;
}

.schedule-mini-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(7, minmax(118px, 1fr));
  overflow-x: auto;
  padding-bottom: 2px;
}

.schedule-mini-day {
  background: #f9fbfc;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  min-width: 118px;
  padding: 10px;
}

.schedule-mini-day strong,
.schedule-day-editor strong {
  font-size: 14px;
}

.schedule-mini-day > span,
.schedule-day-editor header span {
  color: var(--muted);
  font-size: 12px;
}

.schedule-mini-day ol {
  display: grid;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.schedule-mini-day li {
  align-items: center;
  background: #e4f0ed;
  border-radius: 6px;
  color: var(--primary-dark);
  display: flex;
  font-size: 12px;
  font-weight: 700;
  gap: 6px;
  min-height: 26px;
  padding: 4px 6px;
}

.schedule-mini-day li span {
  align-items: center;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 999px;
  display: inline-flex;
  flex: 0 0 20px;
  height: 20px;
  justify-content: center;
}

.schedule-mini-day li.is-empty {
  background: #eef1f4;
  color: #6b7280;
}

.schedule-page {
  min-width: 0;
}

.schedule-editor-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(7, minmax(150px, 1fr));
  overflow-x: auto;
  padding-bottom: 4px;
}

.schedule-day-editor {
  background: #f9fbfc;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  min-width: 150px;
  padding: 12px;
}

.schedule-day-editor header {
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 3px;
  padding-bottom: 8px;
}

.schedule-day-editor label {
  color: #334155;
  display: grid;
  font-size: 12px;
  font-weight: 700;
  gap: 5px;
}

.schedule-day-editor select {
  min-height: 36px;
  padding: 7px 8px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.manage-layout {
  display: grid;
  grid-template-columns: minmax(320px, 420px) 1fr;
  gap: 20px;
  align-items: start;
}

.form-panel,
.table-panel,
.task-form {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.task-form {
  display: grid;
  gap: 12px;
}

.task-form label {
  color: #334155;
  display: grid;
  font-size: 13px;
  font-weight: 700;
  gap: 6px;
}

.form-panel h2,
.table-panel h2 {
  font-size: 20px;
  margin: 0 0 14px;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  color: #334155;
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  min-height: 40px;
  padding: 9px 10px;
  width: 100%;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(31, 122, 104, 0.16);
  outline: 0;
}

input:disabled,
select:disabled,
textarea:disabled {
  background: #eef1f4;
  color: #526070;
  cursor: default;
}

.inline-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.helper {
  color: var(--muted);
  font-size: 12px;
}

.table-tools {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.task-table-wrap {
  overflow-x: auto;
}

.task-table {
  border-collapse: collapse;
  min-width: 860px;
  width: 100%;
}

.task-table th,
.task-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
}

.task-table th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.task-table td {
  font-size: 14px;
}

.table-content {
  max-width: 260px;
  overflow-wrap: anywhere;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 220px;
}

.row-actions button,
.row-actions a.button {
  min-height: 32px;
  padding: 6px 9px;
}

.footer-note {
  color: var(--muted);
  font-size: 13px;
  margin-top: 18px;
}

@media (max-width: 900px) {
  .summary-grid,
  .home-grid,
  .split-view,
  .manage-layout {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 12px 0;
    padding-left: 16px;
    padding-right: 16px;
  }

  .topbar nav {
    justify-content: flex-start;
  }

  .schedule-mini-grid,
  .schedule-editor-grid {
    grid-template-columns: repeat(4, minmax(150px, 1fr));
  }
}

@media (max-width: 560px) {
  .summary-grid,
  .inline-fields {
    grid-template-columns: 1fr;
  }

  main,
  .topbar {
    width: min(100% - 20px, 1180px);
  }

  .task-main {
    flex-direction: column;
  }

  .schedule-mini-grid,
  .schedule-editor-grid {
    grid-template-columns: 1fr;
    overflow-x: visible;
  }
}
