:root {
  color-scheme: light;
  --bg: #eef2f5;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #637083;
  --line: #d9e0e7;
  --accent: #1c6dd0;
  --accent-dark: #1659aa;
  --teal: #0f766e;
  --gold: #9a6a12;
  --danger: #b42318;
  --soft-blue: #eaf2ff;
  --soft-teal: #e8f7f4;
  --shadow: 0 12px 30px rgba(23, 32, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

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

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.25;
}

h2 {
  font-size: 18px;
  line-height: 1.25;
}

.topbar p,
.document-toolbar p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

.identity-bar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.field input,
.field textarea,
.inline-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
  padding: 11px 12px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field textarea {
  min-height: 88px;
  resize: vertical;
}

.field input:focus,
.field textarea:focus,
.inline-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(28, 109, 208, 0.14);
}

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

.titles-panel {
  margin-bottom: 16px;
}

.section-head,
.document-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.count-pill {
  min-width: 30px;
  height: 26px;
  border-radius: 999px;
  background: var(--soft-teal);
  color: var(--teal);
  display: inline-grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
}

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

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

.completion-task-title {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 8px;
  align-items: start;
  line-height: 1.5;
}

.completion-task-title span {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--soft-blue);
  color: var(--accent);
  display: inline-grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
}

.completion-task-title strong {
  font-size: 15px;
}

.title-detail-button {
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0;
  text-align: left;
  cursor: pointer;
  font-weight: 700;
  line-height: 1.5;
  text-decoration: underline;
  text-decoration-color: #9fc3f3;
  text-underline-offset: 3px;
}

.title-detail-button:hover {
  color: var(--accent);
}

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

.completion-shared-item {
  border-left: 3px solid #9fc3f3;
  background: #f4f8fe;
  padding: 8px 10px;
  display: grid;
  gap: 4px;
}

.completion-shared-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.completion-shared-item p {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
}

.empty-state {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.work-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}

.stack {
  display: grid;
  gap: 12px;
}

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

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

.plan-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.plan-card-head strong {
  font-size: 15px;
}

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

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

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

.date-button {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  padding: 11px 12px;
  cursor: pointer;
}

.date-button:hover {
  border-color: var(--accent);
}

.rating-row {
  display: flex;
  gap: 4px;
}

.rating-button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #a2adba;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.rating-button.active {
  border-color: #f2b8b5;
  background: #fff5f5;
  color: #d92d20;
}

.rating-button:hover {
  border-color: #d92d20;
  color: #d92d20;
}

.participant-tools {
  display: grid;
  gap: 8px;
}

.input-row {
  display: grid;
  grid-template-columns: 1fr 40px;
  gap: 8px;
}

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

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #79bdb4;
  background: #dff3ef;
  color: #0b5f59;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 600;
}

.field .chip {
  color: #0b5f59;
}

.chip button {
  border: 0;
  background: transparent;
  color: #0b5f59;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  font-weight: 700;
}

.quick-chip {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(23, 32, 51, 0.04);
}

.quick-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--soft-blue);
}

.icon-button,
.remove-button {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  font-weight: 700;
  text-decoration: none;
}

.icon-button:hover,
.remove-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.remove-button {
  color: var(--danger);
}

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

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

.submitter-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 32px;
  align-items: center;
}

.submitter-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border: 1px solid #9fc3f3;
  background: var(--soft-blue);
  color: var(--accent);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 13px;
  font-weight: 700;
}

.document-toolbar {
  align-items: flex-start;
}

.plan-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.save-button {
  min-width: 148px;
}

.primary-button,
.secondary-button,
.download-button {
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 10px 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
}

.compact-action {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 13px;
}

.primary-button {
  background: var(--accent);
  color: #fff;
}

.primary-button:hover {
  background: var(--accent-dark);
}

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

.download-button {
  background: #10243d;
  color: #fff;
}

.compact-download {
  min-height: 34px;
  padding: 7px 11px;
  font-size: 13px;
  white-space: nowrap;
}

.paper {
  background: #fff;
  border: 1px solid #cfd8e3;
  border-radius: 6px;
  padding: 32px 42px;
  min-height: 520px;
  line-height: 1.8;
  overflow-wrap: anywhere;
}

.paper h3,
.paper h4 {
  margin: 0;
  text-align: center;
}

.paper h3 {
  font-size: 24px;
  font-family: "STXinwei", "华文新魏", serif;
}

.paper h4 {
  font-size: 16px;
  font-family: "STKaiti", "华文楷体", serif;
  font-weight: 400;
}

.paper .section-title {
  margin-top: 24px;
  font-family: "STKaiti", "华文楷体", serif;
  font-size: 18px;
  font-weight: 700;
}

.paper p {
  margin-top: 4px;
  font-family: "STFangsong", "华文仿宋", "FangSong", serif;
  font-weight: 700;
}

.paper .plan-title {
  margin-top: 10px;
  font-family: "SimHei", "黑体", sans-serif;
}

.paper .underlined-title {
  text-decoration: underline;
}

.red-stars,
.paper .red-stars {
  color: #d92d20;
}

.calendar-dialog,
.work-detail-dialog {
  border: 0;
  padding: 0;
  background: transparent;
}

.login-dialog {
  border: 0;
  padding: 0;
  background: transparent;
}

.login-dialog::backdrop {
  background: rgba(15, 23, 42, 0.42);
}

.login-card {
  width: min(420px, calc(100vw - 28px));
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.24);
  display: grid;
  gap: 14px;
}

.login-card p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.login-user-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.login-user-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
}

.login-user-button.active {
  border-color: var(--accent);
  background: var(--soft-blue);
  color: var(--accent);
}

.login-button {
  width: 100%;
}

.calendar-dialog::backdrop,
.work-detail-dialog::backdrop {
  background: rgba(15, 23, 42, 0.38);
}

.calendar-card {
  width: min(420px, calc(100vw - 28px));
  background: #fff;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.24);
}

.work-detail-card {
  width: min(620px, calc(100vw - 28px));
  max-height: min(760px, calc(100vh - 28px));
  overflow: auto;
  background: #fff;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.24);
}

.work-detail-head,
.work-detail-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.work-detail-head {
  margin-bottom: 12px;
}

.work-detail-head strong {
  font-size: 16px;
  line-height: 1.45;
}

.work-detail-body {
  display: grid;
  gap: 10px;
}

.work-detail-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
  display: grid;
  gap: 10px;
}

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

.work-detail-item dl {
  margin: 0;
  display: grid;
  gap: 8px;
}

.work-detail-item dl div {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 8px;
}

.work-detail-item dt {
  color: var(--muted);
  font-size: 13px;
}

.work-detail-item dd {
  margin: 0;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.calendar-head,
.calendar-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.weekday-row,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.weekday-row {
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.calendar-grid {
  margin-top: 8px;
}

.day-cell {
  aspect-ratio: 1;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #f7f9fb;
  color: var(--ink);
  cursor: pointer;
}

.day-cell.muted {
  color: #a2adba;
  background: #fafafa;
}

.day-cell.selected,
.day-cell.range {
  background: var(--soft-blue);
  border-color: #9fc3f3;
  color: var(--accent);
  font-weight: 700;
}

.calendar-actions {
  margin-top: 14px;
  justify-content: flex-end;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  min-width: 220px;
  max-width: calc(100vw - 32px);
  background: #10243d;
  color: #fff;
  border-radius: 8px;
  padding: 10px 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 20px, 680px);
    padding-top: 14px;
  }

  .work-grid,
  .two-col {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 22px;
  }

  .topbar {
    display: grid;
  }

  .identity-bar {
    justify-content: space-between;
  }

  .panel {
    padding: 14px;
  }

  .document-toolbar {
    display: flex;
    align-items: flex-start;
  }

  .plan-actions {
    justify-content: stretch;
  }

  .save-button {
    width: 100%;
  }

  .work-detail-item dl div {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .paper {
    padding: 22px 16px;
    min-height: 420px;
  }
}
