:root {
  color-scheme: light;
  font-family: "Microsoft YaHei UI", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  font-synthesis: none;
  --ink: #1c2738;
  --muted: #7d8798;
  --line: #e1e6ef;
  --surface: #ffffff;
  --canvas: #edf1f7;
  --soft: #f5f7fb;
  --shell: #dfe5ee;
  --deep: #192742;
  --green: #4d6fff;
  --green-soft: #e8edff;
  --coral: #ef6464;
  --coral-soft: #fff0f0;
  --blue: #4976df;
  --blue-soft: #eaf1ff;
  --yellow: #e5ad3d;
  --faint: #a9b2c0;
  --canvas-dot: #cfd7e4;
  --warm: #fff8dc;
  --warm-line: #ead89c;
  --danger-line: #f0caca;
  --nav-muted: rgba(241, 245, 255, 0.72);
  --overlay: rgba(16, 25, 43, 0.56);
  --focus: rgba(77, 111, 255, 0.28);
  --frame-border: rgba(35, 54, 87, 0.12);
  --main-overlay: rgba(245, 247, 251, 0.94);
  --topbar-overlay: rgba(255, 255, 255, 0.88);
  --background-tint: rgba(245, 247, 251, 0.62);
  --background-topbar-tint: rgba(255, 255, 255, 0.72);
  --shadow: 0 24px 70px rgba(27, 40, 64, 0.2);
  --card-shadow: 0 8px 24px rgba(31, 48, 77, 0.08);
}

:root[data-theme="mint"] {
  --ink: #20372e;
  --muted: #71877c;
  --line: #dceae2;
  --surface: #ffffff;
  --canvas: #e7f1eb;
  --soft: #eef7f1;
  --shell: #d4e8dc;
  --deep: #214b38;
  --green: #58b98f;
  --green-soft: #dff4e9;
  --coral: #e86f68;
  --coral-soft: #ffefed;
  --blue: #3f91a0;
  --blue-soft: #e2f2f4;
  --yellow: #d7a943;
  --faint: #9db0a6;
  --canvas-dot: #c7ddd1;
  --warm: #fff8df;
  --warm-line: #e8d798;
  --danger-line: #efcbc7;
  --nav-muted: rgba(239, 250, 244, 0.72);
  --overlay: rgba(20, 51, 37, 0.5);
  --focus: rgba(88, 185, 143, 0.3);
  --frame-border: rgba(42, 91, 68, 0.13);
  --main-overlay: rgba(238, 247, 241, 0.93);
  --topbar-overlay: rgba(238, 247, 241, 0.88);
  --background-tint: rgba(238, 247, 241, 0.62);
  --background-topbar-tint: rgba(238, 247, 241, 0.72);
  --shadow: 0 24px 70px rgba(31, 72, 52, 0.2);
  --card-shadow: 0 8px 24px rgba(38, 82, 61, 0.09);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background-color: var(--shell);
  background-image: var(--custom-background-image, none);
  background-position: center;
  background-size: cover;
  color: var(--ink);
  display: grid;
  place-items: center;
  padding: 20px;
}

button,
input,
textarea,
select {
  font: inherit;
  letter-spacing: 0;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.app-frame {
  width: min(100%, 560px);
  height: min(920px, calc(100vh - 40px));
  min-height: 640px;
  background-color: var(--soft);
  background-image: var(--custom-background-image, none);
  background-position: center;
  background-size: cover;
  border: 1px solid var(--frame-border);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  overflow: hidden;
  border-radius: 8px;
}

.sidebar {
  background: var(--deep);
  color: var(--nav-muted);
  border-right: 1px solid var(--line);
  padding: 18px 9px 14px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.brand {
  width: 44px;
  height: 44px;
  margin: 0 auto 18px;
  border: 0;
  border-radius: 50%;
  background: var(--coral);
  color: white;
  font-weight: 800;
  font-size: 20px;
  cursor: pointer;
  overflow: hidden;
  padding: 0;
  position: relative;
}

.brand:hover {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.16);
}

.brand img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.brand img[hidden] {
  display: none;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  scrollbar-width: none;
}

.nav-list::-webkit-scrollbar {
  display: none;
}

.nav-item {
  width: 100%;
  min-height: 50px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.11);
  color: white;
}

.nav-item.active::before {
  content: "";
  width: 3px;
  height: 20px;
  border-radius: 3px;
  background: var(--coral);
  position: absolute;
  left: 0;
}

.nav-item {
  position: relative;
}

.nav-glyph {
  font-weight: 800;
  font-size: 16px;
  line-height: 1;
}

.nav-data {
  margin-top: auto;
}

.app-main {
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  background: var(--main-overlay);
  backdrop-filter: blur(10px);
}

:root.has-custom-background .app-main {
  background-color: transparent;
  background-image:
    linear-gradient(var(--background-tint), var(--background-tint)),
    var(--custom-background-image);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  backdrop-filter: none;
}

.topbar {
  padding: 22px 22px 14px;
  display: grid;
  grid-template-columns: max-content minmax(64px, 1fr) 40px;
  align-items: center;
  gap: 12px;
  min-height: 86px;
  background: var(--topbar-overlay);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.topbar-heading {
  min-width: 0;
}

.global-header-text {
  width: 100%;
  min-width: 0;
  height: 40px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--ink);
  padding: 0 12px;
  font-size: 14px;
  text-overflow: ellipsis;
}

.global-header-text::placeholder {
  color: var(--faint);
}

.global-header-text:hover,
.global-header-text:focus {
  border-color: var(--line);
  background: var(--surface);
}

:root.has-custom-background .topbar {
  background: var(--background-topbar-tint);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

h1,
h2,
h3,
p {
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-size: 25px;
  line-height: 1.15;
}

h2 {
  margin: 0;
  font-size: 20px;
}

h3 {
  margin: 0;
  font-size: 15px;
}

.icon-button {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex: 0 0 auto;
  font-size: 24px;
  line-height: 1;
}

.icon-button.primary-action {
  background: var(--green);
  color: var(--deep);
}

.icon-button.subtle {
  background: var(--canvas);
  color: var(--ink);
}

.icon-button.small {
  width: 30px;
  height: 30px;
  font-size: 16px;
}

.view-container {
  min-height: 0;
  max-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  padding: 16px 22px 28px;
  scrollbar-color: var(--faint) transparent;
  scrollbar-width: thin;
}

.section-stack {
  display: grid;
  gap: 16px;
}

.section-heading,
.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-heading h2 {
  font-size: 16px;
}

.section-link {
  border: 0;
  background: none;
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 0;
}

.date-hero {
  border-left: 4px solid var(--coral);
  padding: 2px 0 2px 14px;
}

.home-checkin-row {
  display: grid;
  grid-template-columns: minmax(94px, 0.7fr) minmax(0, 1.5fr);
  gap: 10px;
  align-items: stretch;
}

.home-checkin-row .date-hero {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.daily-checkin-card {
  min-width: 0;
  min-height: 82px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  box-shadow: var(--card-shadow);
  padding: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.daily-checkin-card div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.daily-checkin-card span,
.daily-checkin-card small {
  color: var(--muted);
  font-size: 9px;
  overflow-wrap: anywhere;
}

.daily-checkin-card strong {
  font-size: 16px;
}

.daily-checkin-card button {
  min-width: 64px;
  min-height: 36px;
  border: 0;
  border-radius: 18px;
  background: var(--green);
  color: white;
  padding: 0 10px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.daily-checkin-card button:disabled {
  background: var(--green-soft);
  color: var(--green);
  cursor: default;
}

.date-hero .day-number {
  font-size: 36px;
  line-height: 1;
  font-weight: 800;
}

.date-hero p {
  color: var(--muted);
  margin: 5px 0 0;
  font-size: 12px;
}

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

.summary-card,
.panel,
.list-item,
.memo-card,
.health-record,
.data-block {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: var(--card-shadow);
}

.summary-card {
  min-height: 112px;
  padding: 15px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  border-left: 4px solid var(--green);
}

.summary-card:nth-child(1) {
  background: var(--surface);
  border-left-color: var(--green);
}

.summary-card:nth-child(2) {
  background: var(--surface);
  border-left-color: var(--coral);
}

.summary-card:nth-child(3) {
  background: var(--surface);
  border-left-color: var(--blue);
}

.summary-card:nth-child(4) {
  border-left-color: var(--yellow);
}

.summary-card strong {
  font-size: 26px;
}

.summary-card span {
  font-size: 12px;
  color: var(--muted);
}

.panel {
  padding: 15px;
}

.quick-note {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 8px;
}

.quick-note input,
.search-input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft);
  color: var(--ink);
  padding: 0 12px;
}

.quick-note button {
  border: 0;
  border-radius: 6px;
  background: var(--green);
  color: white;
  font-size: 20px;
  cursor: pointer;
}

.progress-wrap {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.progress-ring {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--green) var(--progress), var(--canvas) 0);
  position: relative;
  font-size: 11px;
  font-weight: 800;
}

.progress-ring::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: var(--surface);
}

.progress-ring span {
  position: relative;
  z-index: 1;
}

.progress-copy p,
.muted-copy {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.segmented {
  background: var(--canvas);
  padding: 3px;
  border-radius: 7px;
  display: grid;
  grid-template-columns: repeat(var(--segments, 2), minmax(0, 1fr));
  gap: 3px;
}

.segmented button {
  min-height: 34px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.segmented button.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--card-shadow);
}

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

.plan-item-group {
  display: grid;
  gap: 0;
}

.plan-item-group.with-canvas .list-item {
  border-radius: 7px 7px 0 0;
}

.plan-canvas-toggle {
  min-height: 36px;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 7px 7px;
  background: var(--canvas);
  color: var(--green);
  padding: 0 12px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 7px;
  align-items: center;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.retain-plan-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-top: 0;
  background: var(--surface);
  color: var(--blue);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.retain-plan-button:disabled {
  color: var(--muted);
  background: var(--canvas);
  cursor: default;
}

.retain-plan-button.cancel {
  background: var(--coral-soft);
  color: var(--coral);
}

.plan-item-group.with-canvas .retain-plan-button + .plan-canvas-toggle {
  border-radius: 0 0 7px 7px;
}

.plan-canvas-toggle[aria-expanded="true"] {
  border-radius: 0;
  background: var(--green-soft);
}

.plan-canvas-toggle span:last-child {
  color: var(--muted);
  font-weight: 400;
}

.plan-canvas-panel {
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 7px 7px;
  background: var(--surface);
  padding: 9px;
  display: grid;
  gap: 8px;
}

.list-item {
  padding: 12px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
}

.list-item.completed .item-title {
  text-decoration: line-through;
  color: var(--muted);
}

.check-button {
  width: 23px;
  height: 23px;
  border-radius: 50%;
  border: 2px solid var(--faint);
  background: var(--surface);
  cursor: pointer;
  display: grid;
  place-items: center;
  color: white;
  padding: 0;
  font-size: 13px;
}

.completed .check-button,
.check-button.checked {
  border-color: var(--green);
  background: var(--green);
}

.item-title {
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.item-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
}

.priority-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--yellow);
  display: inline-block;
}

.priority-dot.high {
  background: var(--coral);
}

.priority-dot.low {
  background: var(--blue);
}

.item-menu {
  border: 0;
  background: transparent;
  color: var(--muted);
  width: 28px;
  height: 28px;
  cursor: pointer;
  border-radius: 50%;
}

.item-menu:hover {
  background: var(--canvas);
}

.empty-state {
  padding: 38px 20px;
  border: 1px dashed var(--faint);
  border-radius: 7px;
  text-align: center;
  color: var(--muted);
}

.empty-mark {
  width: 42px;
  height: 42px;
  margin: 0 auto 10px;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green);
  display: grid;
  place-items: center;
  font-size: 22px;
}

.empty-state p {
  margin: 0;
  font-size: 12px;
}

.calendar {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 14px;
}

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

.calendar-head button {
  border: 0;
  background: var(--canvas);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
}

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

.calendar-week span {
  text-align: center;
  color: var(--muted);
  font-size: 10px;
  padding: 4px 0 8px;
}

.calendar-day {
  aspect-ratio: 1;
  min-width: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  cursor: pointer;
  position: relative;
  font-size: 11px;
}

.calendar-day:hover {
  background: var(--canvas);
}

.calendar-day.other {
  color: var(--faint);
}

.calendar-day.today {
  background: var(--green);
  color: var(--deep);
}

.calendar-day.selected {
  box-shadow: inset 0 0 0 2px var(--coral);
}

.calendar-day.has-plan::after {
  content: "";
  width: 4px;
  height: 4px;
  background: var(--coral);
  border-radius: 50%;
  position: absolute;
  bottom: 3px;
  left: calc(50% - 2px);
}

.calendar-day.has-daily-checkin::before {
  content: "✓";
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--green);
  color: var(--deep);
  position: absolute;
  top: 2px;
  right: 2px;
  display: grid;
  place-items: center;
  font-size: 8px;
  font-weight: 900;
  line-height: 1;
}

.calendar-day.today.has-daily-checkin::before {
  background: var(--surface);
  color: var(--green);
}

.date-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 4px;
}

.calendar-daily-checkin {
  min-height: 66px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--green);
  border-radius: 7px;
  background: var(--surface);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--card-shadow);
}

.calendar-daily-checkin > span {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green);
  display: grid;
  place-items: center;
  font-weight: 900;
}

.calendar-daily-checkin p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.calendar-item-with-canvas {
  display: grid;
}

.calendar-item-with-canvas .list-item {
  border-radius: 7px 7px 0 0;
}

.calendar-canvas-preview {
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 7px 7px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--card-shadow);
}

.calendar-canvas-preview header {
  min-height: 36px;
  padding: 0 11px;
  background: var(--green-soft);
  color: var(--green);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 10px;
}

.calendar-canvas-preview header span {
  color: var(--muted);
}

.calendar-canvas-preview header div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.calendar-canvas-preview header button,
.calendar-canvas-view-button {
  border: 0;
  background: var(--green);
  color: var(--deep);
  cursor: pointer;
  font-weight: 800;
}

.calendar-canvas-preview header button {
  min-height: 26px;
  border-radius: 5px;
  padding: 0 9px;
  font-size: 10px;
}

.calendar-canvas-stage {
  height: 210px;
  position: relative;
  overflow: hidden;
  background-color: var(--surface);
  background-image: radial-gradient(var(--canvas-dot) 1px, transparent 1px);
  background-size: 18px 18px;
}

.calendar-canvas-content {
  width: 1800px;
  height: 1800px;
  position: absolute;
  transform: translate(-360px, -315px) scale(0.5);
  transform-origin: 0 0;
}

.calendar-canvas-item {
  position: absolute;
  overflow: hidden;
  border: 1px solid var(--warm-line);
  border-radius: 6px;
  background: var(--warm);
  box-shadow: var(--card-shadow);
  padding: 12px;
}

.calendar-canvas-item p {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.6;
}

.calendar-canvas-item.media {
  padding: 6px;
  border-color: var(--line);
  background: var(--surface);
}

.calendar-canvas-item img,
.calendar-canvas-item video,
.calendar-canvas-item audio {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.calendar-canvas-empty {
  margin: 0;
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 10px;
}

.calendar-memo-with-canvas {
  min-width: 0;
  display: grid;
}

.calendar-memo-with-canvas .memo-card {
  width: 100%;
  border-radius: 7px 7px 0 0;
}

.calendar-canvas-view-button {
  min-height: 38px;
  border-radius: 0 0 7px 7px;
  padding: 0 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
}

.calendar-canvas-view-button small {
  font-size: 9px;
  opacity: 0.72;
}

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

.calendar-note {
  padding: 14px;
  border-left: 4px solid var(--yellow);
  background: var(--warm);
  border-radius: 0 6px 6px 0;
}

.calendar-note p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

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

.memo-item-group {
  min-width: 0;
  display: grid;
  align-content: start;
}

.memo-item-group.expanded {
  grid-column: 1 / -1;
}

.memo-item-group .memo-card {
  width: 100%;
  border-radius: 7px 7px 0 0;
}

.memo-item-group .plan-canvas-toggle {
  border-radius: 0 0 7px 7px;
}

.memo-card {
  min-height: 128px;
  padding: 13px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  text-align: left;
  overflow: hidden;
}

.memo-card.pinned {
  border-top: 3px solid var(--yellow);
}

.memo-card h3,
.memo-card p {
  overflow-wrap: anywhere;
}

.memo-card p {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  overflow: hidden;
  margin: 8px 0;
}

.memo-card time {
  margin-top: auto;
  color: var(--faint);
  font-size: 9px;
}

.health-hero {
  background: var(--deep);
  color: white;
  border-radius: 7px;
  padding: 17px;
  display: flex;
  justify-content: space-between;
  align-items: end;
}

.health-hero strong {
  font-size: 34px;
}

.health-hero p {
  margin: 4px 0 0;
  color: var(--nav-muted);
  font-size: 11px;
}

.health-record {
  padding: 13px;
}

.record-value {
  color: var(--green);
  font-weight: 800;
  font-size: 13px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--canvas);
  color: var(--muted);
  font-size: 10px;
}

.canvas-toolbar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.canvas-shell {
  min-width: 0;
  min-height: 0;
  display: grid;
  gap: 6px;
}

.canvas-clipboard-toolbar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.canvas-toolbar button,
.canvas-clipboard-toolbar button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}

.canvas-clipboard-toolbar button {
  color: var(--green);
}

.canvas-viewport {
  height: 580px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background-color: var(--surface);
  background-image: radial-gradient(var(--canvas-dot) 1px, transparent 1px);
  background-size: 20px 20px;
  position: relative;
  touch-action: none;
  cursor: grab;
}

.canvas-viewport.compact {
  height: 340px;
}

.canvas-viewport.panning {
  cursor: grabbing;
}

.infinite-canvas {
  width: 1800px;
  height: 1800px;
  transform-origin: 0 0;
  position: absolute;
  left: 0;
  top: 0;
}

.canvas-item {
  position: absolute;
  width: 190px;
  min-height: 90px;
  border-radius: 6px;
  background: var(--warm);
  border: 1px solid var(--warm-line);
  box-shadow: var(--card-shadow);
  padding: 12px;
  cursor: move;
  overflow: hidden;
}

.canvas-item.resizable {
  min-width: 120px;
  min-height: 90px;
}

.canvas-item.media {
  background: var(--surface);
  border-color: var(--line);
  width: 230px;
  padding: 0 8px 8px;
}

.canvas-item p {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.6;
  height: 100%;
  overflow: auto;
  padding: 0 18px 18px 0;
}

.canvas-item img,
.canvas-item video {
  width: 100%;
  height: calc(100% - 36px);
  display: block;
  border-radius: 4px;
  object-fit: contain;
}

.canvas-item audio {
  width: 100%;
  height: calc(100% - 36px);
  min-height: 34px;
}

.canvas-delete {
  position: absolute;
  right: 5px;
  top: 5px;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: var(--overlay);
  color: white;
  cursor: pointer;
  opacity: 0;
}

.canvas-media-toolbar {
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.canvas-drag-handle {
  min-width: 0;
  flex: 1;
  height: 28px;
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  cursor: move;
  user-select: none;
}

.canvas-media-toolbar .canvas-delete {
  position: static;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  opacity: 1;
  background: var(--canvas);
  color: var(--ink);
}

.canvas-media-toolbar .canvas-lock {
  min-width: 38px;
  height: 26px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 4px;
  background: var(--canvas);
  color: var(--muted);
  cursor: pointer;
  font-size: 9px;
  font-weight: 800;
}

.canvas-media-toolbar .canvas-lock.active {
  background: var(--green-soft);
  color: var(--green);
}

.canvas-item.has-toolbar p {
  height: calc(100% - 36px);
}

.canvas-item.locked {
  cursor: default;
  border-color: var(--green);
}

.canvas-item.locked .canvas-drag-handle {
  cursor: default;
}

.canvas-item.locked .canvas-resize-handle,
.template-block.unified-content-block.locked .template-block-resize {
  display: none;
}

.canvas-resize-handle {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 22px;
  height: 22px;
  border-right: 3px solid var(--green);
  border-bottom: 3px solid var(--green);
  border-radius: 0 0 4px 0;
  cursor: nwse-resize;
  touch-action: none;
  z-index: 4;
}

.canvas-resize-handle::before {
  content: "";
  position: absolute;
  right: 5px;
  bottom: 5px;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--green);
  border-bottom: 2px solid var(--green);
}

.canvas-item:hover .canvas-delete,
.canvas-item:focus-within .canvas-delete {
  opacity: 1;
}

.zoom-controls {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: flex;
  gap: 5px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px;
  z-index: 3;
}

.zoom-controls button {
  width: 30px;
  height: 30px;
  border: 0;
  background: var(--canvas);
  border-radius: 4px;
  cursor: pointer;
}

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

.checkin-day {
  aspect-ratio: 1;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 5px;
  font-size: 10px;
  cursor: pointer;
}

.checkin-day.checked {
  background: var(--green);
  color: white;
  border-color: var(--green);
}

.data-block {
  padding: 16px;
}

.data-block p {
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
  margin: 7px 0 14px;
}

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

.theme-choice {
  min-width: 0;
  min-height: 82px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft);
  color: var(--muted);
  padding: 9px 6px;
  display: grid;
  place-items: center;
  gap: 7px;
  cursor: pointer;
}

.theme-choice.active {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--green);
}

.theme-choice strong {
  min-width: 0;
  font-size: 11px;
  overflow-wrap: anywhere;
}

.theme-swatches {
  width: 62px;
  height: 28px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.theme-swatches i {
  display: block;
}

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

.background-settings strong {
  font-size: 12px;
}

.background-settings p {
  margin: 3px 0 0;
  font-size: 10px;
}

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

.text-button {
  min-height: 40px;
  border-radius: 6px;
  padding: 0 16px;
  border: 1px solid transparent;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
}

.text-button.primary {
  background: var(--green);
  color: white;
}

.text-button.secondary {
  background: var(--surface);
  border-color: var(--line);
}

.text-button.danger {
  color: var(--coral);
  border-color: var(--danger-line);
  background: var(--surface);
}

.modal {
  width: min(430px, calc(100vw - 32px));
  max-height: min(760px, calc(100vh - 32px));
  border: 0;
  padding: 0;
  border-radius: 8px;
  box-shadow: var(--shadow);
  background: var(--surface);
  color: var(--ink);
}

.modal::backdrop {
  background: var(--overlay);
}

.modal-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  max-height: min(760px, calc(100vh - 32px));
}

.modal-header,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px;
  gap: 10px;
}

.modal-header {
  border-bottom: 1px solid var(--line);
}

.modal-actions {
  border-top: 1px solid var(--line);
  justify-content: flex-end;
}

.modal-body {
  padding: 18px;
  overflow-y: auto;
  display: grid;
  gap: 14px;
}

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

.field label,
.field-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft);
  padding: 10px 11px;
  color: var(--ink);
}

.field textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.6;
}

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

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

.radio-grid.four {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.workspace-toolbar {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
}

.workspace-toolbar button,
.block-canvas-toolbar button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.module-workspace-viewport {
  height: 650px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background-color: var(--soft);
  background-image: radial-gradient(var(--canvas-dot) 1px, transparent 1px);
  background-size: 20px 20px;
  overscroll-behavior: contain;
  touch-action: none;
}

.module-workspace {
  width: 2600px;
  height: 2000px;
  position: relative;
  transform-origin: 0 0;
}

.template-block {
  position: absolute;
  min-width: 220px;
  min-height: 180px;
  display: grid;
  grid-template-rows: 38px minmax(0, 1fr);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--card-shadow);
  overflow: hidden;
}

.template-block-header {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 6px 5px 10px;
  background: var(--green-soft);
  border-bottom: 1px solid var(--line);
}

.template-block-header button {
  width: 27px;
  height: 27px;
  border: 0;
  border-radius: 4px;
  background: var(--surface);
  cursor: pointer;
}

.template-block-drag {
  min-width: 0;
  flex: 1;
  font-size: 11px;
  font-weight: 800;
  color: var(--green);
  cursor: move;
  user-select: none;
}

.template-block-body {
  min-height: 0;
  overflow: auto;
  padding: 10px;
}

.unified-content-block {
  min-width: 160px;
  min-height: 120px;
}

.unified-content-block.locked {
  border-color: var(--green);
}

.unified-content-block.locked .template-block-drag {
  cursor: default;
}

html.canvas-immersive .app-frame {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  min-height: 0;
  border: 0;
  border-radius: 0;
  grid-template-columns: 1fr;
  z-index: 100;
}

html.canvas-immersive .sidebar,
html.canvas-immersive .topbar {
  display: none;
}

html.canvas-immersive .app-main {
  grid-template-rows: minmax(0, 1fr);
}

html.canvas-immersive .view-container {
  padding: 0;
  overflow: hidden;
}

html.canvas-immersive .view-container > * {
  animation: none !important;
  transform: none !important;
}

.canvas-shell.fullscreen,
.workspace-shell.fullscreen {
  position: fixed;
  inset: 0;
  z-index: 110;
  min-width: 0;
  min-height: 0;
  background: var(--soft);
  padding:
    calc(10px + env(safe-area-inset-top))
    calc(10px + env(safe-area-inset-right))
    calc(10px + env(safe-area-inset-bottom))
    calc(10px + env(safe-area-inset-left));
}

.canvas-shell.fullscreen {
  grid-template-rows: auto auto minmax(0, 1fr);
}

.canvas-shell.fullscreen .canvas-viewport,
.canvas-shell.fullscreen .canvas-viewport.compact {
  width: 100%;
  height: 100%;
  min-height: 0;
  border-radius: 0;
}

.workspace-shell.fullscreen {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 7px;
}

.workspace-shell.fullscreen .module-workspace-viewport {
  width: 100%;
  height: 100%;
  min-height: 0;
  border-radius: 0;
}

.unified-content-body {
  padding: 8px;
  overflow: hidden;
}

.unified-content-body .unified-text-content {
  height: 100%;
  margin: 0;
  padding: 4px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 12px;
  line-height: 1.65;
}

.unified-content-body img,
.unified-content-body video,
.unified-content-body audio {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.unified-content-body audio {
  min-height: 54px;
}

.template-block-body.canvas-template-body {
  padding: 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
}

.template-block-resize {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 22px;
  height: 22px;
  border-right: 3px solid var(--coral);
  border-bottom: 3px solid var(--coral);
  cursor: nwse-resize;
  z-index: 6;
}

.block-list,
.block-notes {
  display: grid;
  gap: 6px;
}

.block-list-row {
  min-height: 34px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 7px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
}

.block-list-row.completed span {
  color: var(--muted);
  text-decoration: line-through;
}

.block-list-row > button:last-child {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.block-notes button {
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--soft);
  padding: 8px;
  text-align: left;
  cursor: pointer;
}

.block-notes strong,
.block-notes span {
  display: block;
  overflow-wrap: anywhere;
}

.block-notes span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.block-empty {
  margin: 8px 0;
  color: var(--muted);
  text-align: center;
  font-size: 10px;
}

.block-checkin-today {
  width: 100%;
  min-height: 72px;
  border: 1px dashed var(--faint);
  border-radius: 6px;
  background: var(--soft);
  color: var(--green);
  font-weight: 800;
  cursor: pointer;
}

.block-checkin-today.checked {
  border-style: solid;
  background: var(--green);
  color: white;
}

.block-canvas-toolbar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 6px;
  border-bottom: 1px solid var(--line);
}

.block-canvas-toolbar button {
  min-height: 30px;
}

.block-canvas-toolbar.canvas-clipboard-toolbar {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding-top: 0;
}

.workspace-canvas-scroll {
  min-height: 0;
  overflow: auto;
}

.workspace-canvas-stage {
  width: 1200px;
  height: 900px;
  position: relative;
  background-color: var(--surface);
  background-image: radial-gradient(var(--canvas-dot) 1px, transparent 1px);
  background-size: 18px 18px;
}

.workspace-canvas-item {
  z-index: 1;
}

.workspace-canvas-item p {
  height: calc(100% - 36px);
  padding-top: 6px;
}

.workspace-canvas-item .canvas-delete {
  position: static;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  opacity: 1;
  background: var(--canvas);
  color: var(--ink);
}

@media (max-width: 620px) {
  .workspace-toolbar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .module-workspace-viewport {
    height: calc(100dvh - 190px);
    min-height: 430px;
  }

  .theme-choice {
    min-height: 72px;
    padding-inline: 4px;
  }
}

.radio-card {
  position: relative;
}

.radio-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.radio-card span {
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 8px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.radio-card input:checked + span {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green);
}

.toast-region {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  display: grid;
  gap: 8px;
  z-index: 20;
  pointer-events: none;
}

.toast {
  background: var(--ink);
  color: white;
  border-radius: 6px;
  padding: 10px 15px;
  font-size: 12px;
  box-shadow: 0 8px 30px rgba(29, 41, 36, 0.2);
}

.danger-zone {
  border-color: var(--danger-line);
}

@media (max-width: 620px) {
  body {
    display: block;
    padding: 0;
    background-color: var(--soft);
    background-image: var(--custom-background-image, none);
    background-position: center;
    background-size: cover;
  }

  .app-frame {
    width: 100%;
    height: 100dvh;
    min-height: 560px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    grid-template-columns: 70px minmax(0, 1fr);
  }

  .sidebar {
    padding: calc(18px + env(safe-area-inset-top)) 6px calc(14px + env(safe-area-inset-bottom));
  }

  .topbar {
    padding: calc(22px + env(safe-area-inset-top)) 18px 14px;
  }

  .view-container {
    padding: 16px 18px calc(28px + env(safe-area-inset-bottom));
  }

  .canvas-viewport {
    height: calc(100dvh - 235px);
    min-height: 380px;
  }
}

@media (max-width: 380px) {
  .app-frame {
    grid-template-columns: 62px minmax(0, 1fr);
  }

  .topbar,
  .view-container {
    padding-left: 14px;
    padding-right: 14px;
  }

  .topbar {
    grid-template-columns: max-content minmax(48px, 1fr) 40px;
    gap: 8px;
  }

  .global-header-text {
    padding-inline: 8px;
  }

  .summary-grid,
  .memo-grid {
    grid-template-columns: 1fr;
  }

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

@media (prefers-reduced-motion: no-preference) {
  .view-container > * {
    animation: enter 180ms ease-out;
  }

  @keyframes enter {
    from {
      opacity: 0;
      transform: translateY(4px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}
