:root {
  --bg: #f3e8cd;
  --bg-deep: #e6c98f;
  --ink: #3e2d22;
  --ink-soft: #6d5a47;
  --panel: rgba(255, 248, 233, 0.82);
  --panel-strong: rgba(255, 244, 221, 0.92);
  --line: rgba(150, 103, 54, 0.25);
  --line-strong: rgba(150, 103, 54, 0.42);
  --brand: #b2562d;
  --brand-soft: rgba(219, 141, 73, 0.2);
  --danger: #a1342d;
  --todo: #8a785f;
  --doing: #2f7f6d;
  --done: #7d4e2b;
  --explore: #3c79c3;
  --topic: #7f5abf;
  --dev: #d66b16;
  --inspiration: #7300ff;
  --study: #d66b16;
  --sport: #2f9a72;
  --entertainment: #d94f7f;
  --relax: #2f9a72;
  --sleep: #2f9a72;
  --meal: #52e145;
  --record: #8b6f47;
  --work: #ffe51f;
  --other: #8c8c8c;
  --empty: rgba(174, 147, 117, 0.2);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Noto Serif SC", "Source Han Serif SC", "STKaiti", "KaiTi", serif;
  background:
    radial-gradient(circle at 14% 22%, rgba(84, 156, 154, 0.24) 0%, rgba(84, 156, 154, 0) 36%),
    radial-gradient(circle at 85% 10%, rgba(231, 158, 54, 0.28) 0%, rgba(231, 158, 54, 0) 28%),
    radial-gradient(circle at 68% 70%, rgba(194, 130, 70, 0.18) 0%, rgba(194, 130, 70, 0) 42%),
    linear-gradient(160deg, #f7efd8 0%, #f2e2bf 45%, #edd8ae 100%);
  position: relative;
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  pointer-events: none;
  z-index: 0;
}

body::before {
  inset: -100px -40px auto -40px;
  height: 340px;
  background:
    radial-gradient(circle at 50% 35%, rgba(255, 242, 190, 0.8), rgba(255, 242, 190, 0) 62%),
    repeating-radial-gradient(circle at 50% 35%, rgba(133, 171, 154, 0.18) 0 8px, rgba(133, 171, 154, 0) 8px 24px);
  opacity: 0.65;
}

body::after {
  left: 0;
  right: 0;
  bottom: -40px;
  height: 220px;
  background:
    radial-gradient(120% 100% at 10% 100%, rgba(133, 94, 61, 0.38) 0 38%, rgba(133, 94, 61, 0) 40%),
    radial-gradient(120% 100% at 42% 100%, rgba(114, 87, 62, 0.33) 0 40%, rgba(114, 87, 62, 0) 42%),
    radial-gradient(120% 100% at 78% 100%, rgba(148, 104, 65, 0.36) 0 42%, rgba(148, 104, 65, 0) 44%);
  opacity: 0.45;
}

.app {
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 20px 26px;
  display: grid;
  gap: 16px;
  position: relative;
  z-index: 1;
}

.app-header {
  padding: 8px 4px 14px;
  border-bottom: 1px solid rgba(175, 123, 70, 0.32);
  position: relative;
}

.app-header::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 220px;
  height: 2px;
  background: linear-gradient(90deg, rgba(183, 93, 44, 0.95), rgba(183, 93, 44, 0));
}

.app-header h1 {
  margin: 0;
  font-size: clamp(1.9rem, 3.2vw, 2.7rem);
  line-height: 1.08;
  letter-spacing: 0.05em;
  color: #402919;
  text-shadow: 0 2px 0 rgba(255, 246, 220, 0.65);
}

.app-header p {
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-size: 1rem;
}

.panel {
  background: linear-gradient(165deg, var(--panel-strong), var(--panel));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  backdrop-filter: blur(6px);
  box-shadow:
    0 10px 30px rgba(121, 86, 49, 0.13),
    inset 0 1px 0 rgba(255, 250, 236, 0.95);
  position: relative;
  animation: panelRise 0.5s ease both;
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  border: 1px solid rgba(219, 165, 103, 0.2);
}

.panel:nth-of-type(2) {
  animation-delay: 0.08s;
}

.panel:nth-of-type(3) {
  animation-delay: 0.16s;
}

.panel h2 {
  margin: 0 0 12px;
  color: #4b2f1d;
  letter-spacing: 0.03em;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
  font-size: 0.93rem;
  color: #614734;
}

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

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 11px;
  color: var(--ink);
  background: rgba(255, 248, 235, 0.9);
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

input[type="datetime-local"] {
  cursor: pointer;
}

input[type="datetime-local"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-datetime-edit,
input[type="datetime-local"]::-webkit-datetime-edit-year-field,
input[type="datetime-local"]::-webkit-datetime-edit-month-field,
input[type="datetime-local"]::-webkit-datetime-edit-day-field,
input[type="datetime-local"]::-webkit-datetime-edit-hour-field,
input[type="datetime-local"]::-webkit-datetime-edit-minute-field {
  cursor: pointer;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(172, 89, 37, 0.7);
  outline: none;
  background: rgba(255, 252, 244, 0.96);
  box-shadow: 0 0 0 3px rgba(188, 122, 61, 0.14);
}

textarea {
  resize: vertical;
}

small {
  color: var(--ink-soft);
  align-self: flex-end;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

#task-form {
  display: grid;
  gap: 12px;
}

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

.task-tag-row {
  align-items: start;
}

.task-tag-row > label:last-child {
  gap: 6px;
}

.optional-tag-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 0;
  margin-bottom: 0;
  padding: 0;
  border: 1px solid rgba(157, 115, 75, 0.34);
  border-radius: 999px;
  background: rgba(255, 248, 233, 0.82);
}

.optional-tag-switch-btn {
  border: 0;
  background: transparent;
  box-shadow: none;
  color: #6a4b35;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.93rem;
  line-height: 1.2;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.optional-tag-switch-btn:hover {
  filter: none;
  background: rgba(214, 171, 126, 0.22);
}

.optional-tag-switch-btn:active {
  transform: none;
}

.optional-tag-switch-btn.is-active {
  color: #fff8eb;
  background: linear-gradient(140deg, #c46631, #ab4d29);
  box-shadow: 0 4px 10px rgba(152, 81, 34, 0.2);
}

.mood-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  gap: 8px;
}

#task-mood-score,
#task-process-score {
  text-align: center;
  font-weight: 600;
}

#task-mood-score::placeholder,
#task-process-score::placeholder {
  letter-spacing: 0.08em;
}
.category-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  padding-top: 2px;
}

.category-group-head {
  display: block;
  padding-right: 132px;
  min-height: 20px;
}

.group-label {
  font-weight: 600;
  font-size: 0.93rem;
  color: #614734;
}

.category-picker {
  border: 1px solid rgba(157, 115, 75, 0.36);
  border-radius: 12px;
  background: rgba(255, 248, 233, 0.9);
  overflow: hidden;
}

.category-summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 36px 10px 11px;
  position: relative;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 0.9rem;
  color: #60432f;
}

.category-summary::-webkit-details-marker {
  display: none;
}

.category-summary::after {
  content: "\2193";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.86rem;
  color: #7a583f;
  transition: transform 0.18s ease;
}

.category-picker[open] .category-summary::after {
  transform: translateY(-50%) rotate(180deg);
}

.category-summary.is-empty {
  color: #876b52;
}

.category-picker .category-checklist {
  padding: 8px;
  border-top: 1px solid rgba(157, 115, 75, 0.24);
}

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

.category-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  font-size: 0.86rem;
  border: 1px solid rgba(157, 115, 75, 0.3);
  border-radius: 10px;
  background: rgba(255, 248, 233, 0.84);
  padding: 7px 8px;
  cursor: pointer;
}

.category-item input {
  accent-color: #b55e2d;
}

.category-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 10px;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.55);
}

.category-manage-trigger {
  position: absolute;
  top: -2px;
  right: 0;
  flex: 0 0 auto;
  padding: 4px 10px;
  font-size: 0.8rem;
}

.importance-level-group {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.importance-level-label {
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.importance-level-options {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.importance-level-item {
  cursor: pointer;
}

.importance-level-item input {
  display: none;
}

.importance-level-item span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  border-radius: 999px;
  border: 1px solid rgba(157, 115, 75, 0.34);
  background: rgba(255, 248, 233, 0.88);
  padding: 3px 10px;
  font-size: 0.8rem;
  color: #6a4b35;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.importance-level-item:hover span {
  border-color: rgba(152, 81, 34, 0.55);
}

.importance-level-item input:checked + span {
  color: #fff8eb;
  border-color: rgba(152, 81, 34, 0.72);
  background: linear-gradient(140deg, #c46631, #ab4d29);
  box-shadow: 0 4px 10px rgba(152, 81, 34, 0.2);
}

.duration-preview {
  margin: 2px 0;
  color: var(--ink-soft);
}

.actions,
.card-actions {
  display: flex;
  gap: 8px;
}

button {
  border: 1px solid rgba(152, 81, 34, 0.34);
  border-radius: 12px;
  padding: 9px 14px;
  cursor: pointer;
  color: #fff8eb;
  background: linear-gradient(140deg, #c46631, #ab4d29);
  box-shadow: 0 6px 14px rgba(152, 81, 34, 0.23);
  transition: transform 0.15s ease, filter 0.2s ease;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-weight: 600;
}

button:hover {
  filter: brightness(1.05);
}

button:active {
  transform: translateY(1px);
}

button.secondary {
  color: #5f422e;
  border: 1px solid rgba(157, 111, 68, 0.44);
  background: rgba(255, 250, 240, 0.86);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

button.danger {
  border-color: rgba(148, 45, 36, 0.4);
  background: linear-gradient(140deg, #bd4a3f, #962a21);
}

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

.head-tools {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.view-switch {
  display: inline-flex;
  border: 1px solid rgba(157, 115, 75, 0.34);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 246, 227, 0.9);
}

.switch-btn {
  border: 0;
  background: transparent;
  color: #6d5039;
  padding: 8px 12px;
  font-size: 0.88rem;
  box-shadow: none;
  border-radius: 0;
}

.switch-btn + .switch-btn {
  border-left: 1px solid rgba(157, 115, 75, 0.24);
}

.switch-btn.is-active {
  background: linear-gradient(145deg, #cc7a3b, #b55e2d);
  color: #fff6e8;
}

#allocation-date-label {
  min-width: 188px;
}

#allocation-date-label input,
.selected-week {
  min-width: 188px;
}

.selected-week {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 11px;
  color: var(--ink);
  background: rgba(255, 248, 235, 0.9);
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-weight: 700;
  text-align: center;
}

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

.summary-item {
  border: 1px solid rgba(161, 117, 76, 0.36);
  border-radius: 12px;
  padding: 10px 12px;
  background: linear-gradient(145deg, rgba(255, 248, 233, 0.94), rgba(247, 230, 204, 0.88));
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.summary-item strong {
  color: #4f2f1a;
}

.week-wrapper {
  margin-top: 12px;
  border: 1px solid rgba(167, 120, 75, 0.3);
  border-radius: 14px;
  background: linear-gradient(170deg, rgba(255, 249, 238, 0.88), rgba(246, 232, 206, 0.75));
  padding: 12px 10px;
  --week-bar-column-width: 96px;
  --week-bar-gap: 12px;
  --week-visible-count: 10;
  display: grid;
  justify-items: center;
}

.week-bars {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: var(--week-bar-column-width);
  gap: var(--week-bar-gap);
  min-height: 240px;
  align-items: end;
  overflow-x: auto;
  padding-bottom: 4px;
  width: min(100%, calc(var(--week-visible-count) * var(--week-bar-column-width) + (var(--week-visible-count) - 1) * var(--week-bar-gap)));
  max-width: 100%;
}

.week-bar-item {
  display: grid;
  justify-items: center;
  gap: 6px;
}

.week-bar-rank {
  color: #6f4f36;
  font-size: 0.78rem;
  font-weight: 700;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.week-bar-track {
  width: min(56px, 100%);
  height: 160px;
  border-radius: 10px;
  border: 1px solid rgba(171, 123, 78, 0.34);
  background: linear-gradient(180deg, rgba(237, 221, 194, 0.65), rgba(222, 201, 169, 0.5));
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

.week-bar-fill {
  width: 100%;
  min-height: 0;
  border-radius: 9px;
  background: linear-gradient(180deg, #d78544 0%, #be5f2f 100%);
  box-shadow: inset 0 1px 0 rgba(255, 232, 205, 0.45);
  transition: height 0.25s ease;
}

.week-bar-hours {
  color: #5c3d28;
  font-size: 0.86rem;
  font-weight: 700;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.week-bar-project {
  color: #816451;
  font-size: 0.76rem;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  text-align: center;
  width: 100%;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.week-bars-empty {
  margin: 0;
  color: #735842;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 0.92rem;
  align-self: center;
}

.week-bars-scroll {
  margin-top: 10px;
  padding: 0 8px 2px;
  width: min(100%, calc(var(--week-visible-count) * var(--week-bar-column-width) + (var(--week-visible-count) - 1) * var(--week-bar-gap)));
  max-width: 100%;
}

.week-bars-scroll-range {
  width: 100%;
  accent-color: #c46b33;
  cursor: pointer;
}

.timeline {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(24, minmax(20px, 1fr));
  gap: 4px;
}

.slot {
  height: 29px;
  border-radius: 8px;
  border: 1px solid rgba(173, 129, 87, 0.24);
  background: linear-gradient(180deg, rgba(244, 232, 213, 0.95), rgba(232, 214, 189, 0.78));
  position: relative;
  overflow: hidden;
}

.slot-fill {
  position: absolute;
  top: 1px;
  bottom: 1px;
  border-radius: 7px;
  z-index: 1;
  opacity: 0.95;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}

.slot[data-label]::after {
  content: attr(data-label);
  position: absolute;
  inset: 0;
  font-size: 0.68rem;
  line-height: 29px;
  text-align: center;
  color: #fff4e0;
  text-shadow: 0 1px 2px rgba(94, 64, 34, 0.45);
  z-index: 2;
  pointer-events: none;
}

.legend {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.legend-item {
  font-size: 0.88rem;
  border: 1px solid rgba(157, 115, 75, 0.34);
  border-radius: 999px;
  padding: 4px 11px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 246, 229, 0.8);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5);
}

.pie-wrapper {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}

.pie-chart-wrap {
  position: relative;
  width: 240px;
  height: 240px;
}

.task-pie {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: conic-gradient(var(--empty) 0 100%);
  box-shadow: inset 0 0 0 1px rgba(160, 119, 77, 0.25), 0 8px 18px rgba(119, 84, 49, 0.16);
  transition: transform 0.18s ease, filter 0.18s ease, background 0.18s ease;
  cursor: pointer;
}

.task-pie::after {
  content: "";
  position: absolute;
  inset: 26%;
  border-radius: 50%;
  background: rgba(255, 246, 226, 0.95);
  box-shadow: inset 0 0 0 1px rgba(157, 115, 75, 0.24);
}

.task-pie-center {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 56px;
  z-index: 1;
  color: #60432f;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-weight: 600;
  font-size: 0.86rem;
  white-space: pre-line;
  transition: transform 0.18s ease, color 0.18s ease;
}

.pie-legend {
  display: grid;
  gap: 8px;
}

.pie-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px solid rgba(157, 115, 75, 0.28);
  background: rgba(255, 248, 233, 0.76);
  font-size: 0.86rem;
  color: #614734;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.pie-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 10px;
}

.pie-legend-empty {
  margin: 0;
  color: #735842;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.pie-legend-item.is-active {
  border-color: rgba(198, 113, 55, 0.55);
  box-shadow: 0 6px 12px rgba(168, 102, 50, 0.18);
  transform: translateX(3px);
}

.pie-tooltip {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid rgba(174, 118, 64, 0.5);
  background: rgba(77, 50, 29, 0.92);
  color: #fff0dc;
  font-size: 0.82rem;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  box-shadow: 0 8px 20px rgba(49, 30, 13, 0.3);
  transform: translate3d(0, 0, 0);
  white-space: nowrap;
}

.is-hidden {
  display: none !important;
}

.category-manager-modal {
  position: fixed;
  inset: 0;
  z-index: 1300;
  background: rgba(47, 32, 22, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.category-manager-dialog {
  width: min(820px, 100%);
  max-height: min(82vh, 760px);
  overflow: auto;
  border-radius: 16px;
  border: 1px solid rgba(168, 121, 78, 0.34);
  background: rgba(255, 247, 231, 0.98);
  box-shadow: 0 20px 44px rgba(55, 35, 17, 0.32);
  padding: 14px;
  display: grid;
  gap: 12px;
}

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

.category-manager-head h3 {
  margin: 0;
  color: #4f3525;
  font-size: 1.12rem;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.category-manager-note {
  margin: 0;
  color: #745947;
  font-size: 0.88rem;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

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

.category-manager-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 164px auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border-radius: 10px;
  border: 1px solid rgba(160, 116, 74, 0.25);
  background: rgba(255, 252, 245, 0.88);
}

.category-manager-color {
  width: 34px;
  height: 30px;
  border: 1px solid rgba(149, 106, 66, 0.4);
  border-radius: 8px;
  padding: 2px;
  background: transparent;
  cursor: pointer;
}

.category-manager-name {
  min-width: 0;
}

.category-manager-key {
  color: #856650;
  font-size: 0.78rem;
  font-family: "JetBrains Mono", "Consolas", monospace;
  text-align: left;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-manager-key-wrap {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  align-items: center;
  justify-self: end;
  width: 164px;
  gap: 6px;
}

.category-manager-drag-handle {
  border: 1px solid rgba(158, 112, 70, 0.32);
  background: rgba(255, 248, 233, 0.84);
  color: #7a5b45;
  border-radius: 8px;
  height: 24px;
  min-width: 24px;
  padding: 0 6px;
  line-height: 1;
  font-size: 0.82rem;
  cursor: grab;
  justify-self: center;
}

.category-manager-drag-handle:active {
  cursor: grabbing;
}

.category-manager-item.is-drag-over {
  border-color: rgba(191, 111, 53, 0.58);
  box-shadow: 0 0 0 2px rgba(206, 136, 83, 0.2);
}

.category-manager-item.is-dragging {
  opacity: 0.62;
}

.category-manager-delete {
  justify-self: flex-end;
}

.category-manager-actions {
  display: flex;
  justify-content: flex-start;
}

#completion-confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1200;
}

.global-menu {
  position: fixed !important;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  z-index: 1000;
  width: max-content;
  transform: translateZ(0);
}

#menu-toggle-btn {
  min-width: 72px;
}

.menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  margin-top: 0;
  width: min(252px, 80vw);
  border: 1px solid rgba(162, 152, 137, 0.28);
  border-radius: 16px;
  background: rgba(245, 244, 241, 0.98);
  box-shadow: 0 14px 30px rgba(35, 32, 27, 0.2);
  padding: 8px 0;
  display: grid;
  gap: 0;
}

.menu-account-block {
  padding: 10px 14px 12px;
}

.menu-account-label {
  margin: 0;
  color: #727782;
  font-size: 0.86rem;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.menu-account-value {
  margin: 6px 0 0;
  color: #1e2b3e;
  font-size: 1.08rem;
  font-weight: 700;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  overflow-wrap: anywhere;
}

.menu-toggle-row {
  margin: 0 8px 6px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(162, 152, 137, 0.22);
  background: rgba(255, 255, 255, 0.55);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.menu-nav-row {
  margin: 0 8px 6px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(162, 152, 137, 0.22);
  background: rgba(255, 255, 255, 0.55);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #39414f;
  box-shadow: none;
  text-align: left;
}

.menu-nav-row:hover {
  background: rgba(216, 221, 230, 0.45);
  filter: none;
}

.menu-nav-row.is-active {
  border-color: rgba(191, 108, 47, 0.45);
  background: rgba(255, 236, 214, 0.82);
}

.menu-nav-arrow {
  color: #6d4f37;
  font-size: 0.9rem;
  font-weight: 700;
}

.menu-toggle-label {
  color: #39414f;
  font-size: 0.9rem;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-weight: 600;
}

.menu-toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  display: inline-flex;
}

.menu-toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.menu-toggle-slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(159, 166, 177, 0.75);
  border: 1px solid rgba(141, 149, 161, 0.56);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.menu-toggle-slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 2px;
  top: 2px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(45, 52, 64, 0.24);
  transition: transform 0.2s ease;
}

.menu-toggle-switch input:checked + .menu-toggle-slider {
  background: #ce7b3f;
  border-color: #b9682f;
}

.menu-toggle-switch input:checked + .menu-toggle-slider::before {
  transform: translateX(20px);
}

.menu-toggle-switch input:focus-visible + .menu-toggle-slider {
  box-shadow: 0 0 0 3px rgba(206, 123, 63, 0.28);
}

.menu-divider {
  height: 1px;
  background: rgba(167, 167, 167, 0.3);
  margin: 0 0 4px;
}

.menu-action-btn {
  margin: 0 8px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: #39414f;
  box-shadow: none;
  text-align: left;
  padding: 9px 10px;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-weight: 600;
}

.menu-action-btn:hover {
  background: rgba(216, 221, 230, 0.45);
}

.menu-action-btn.is-danger {
  color: #e34545;
}

.menu-action-btn.is-danger:hover {
  background: rgba(255, 227, 227, 0.75);
}

.bedtime-review-page {
  display: grid;
  gap: 16px;
}

.bedtime-review-week-tools {
  align-items: center;
}

.bedtime-review-week-tools #bedtime-review-back-btn {
  margin-left: auto;
}

.bedtime-review-page .summary-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.bedtime-review-header h1 {
  margin-bottom: 4px;
}

.bedtime-review-groups {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.bedtime-review-group {
  border: 1px solid rgba(167, 120, 75, 0.3);
  border-radius: 12px;
  background: linear-gradient(170deg, rgba(255, 249, 238, 0.88), rgba(246, 232, 206, 0.75));
  overflow: hidden;
}

.bedtime-review-group-summary {
  list-style: none;
  margin: 0;
  padding: 10px 12px;
  font-size: 0.94rem;
  color: #5c3f29;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.bedtime-review-group-summary::-webkit-details-marker {
  display: none;
}

.bedtime-review-group-summary::after {
  content: "▾";
  color: #7b5a40;
  font-size: 0.84rem;
  transition: transform 0.18s ease;
}

.bedtime-review-group[open] .bedtime-review-group-summary::after {
  transform: rotate(180deg);
}

.bedtime-review-list {
  display: grid;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid rgba(167, 120, 75, 0.22);
}

.bedtime-review-day-empty {
  margin: 0;
  border: 1px dashed rgba(171, 128, 84, 0.42);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
  color: #7a5e48;
  background: rgba(255, 249, 239, 0.72);
}

.bedtime-review-item {
  border: 1px solid rgba(157, 115, 75, 0.28);
  border-radius: 10px;
  padding: 9px 10px;
  background: rgba(255, 248, 233, 0.86);
}

.bedtime-review-item h4 {
  margin: 0;
  color: #4f311e;
  font-size: 0.96rem;
}

.bedtime-review-meta {
  margin: 6px 0 0;
  color: #765945;
  font-size: 0.82rem;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.bedtime-review-tags {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.bedtime-review-tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid rgba(191, 108, 47, 0.42);
  background: rgba(255, 238, 220, 0.88);
  color: #7a4c2a;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 2px 8px;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.bedtime-review-detail {
  margin: 8px 0 0;
  color: #6f533f;
  font-size: 0.86rem;
  line-height: 1.42;
}

.bedtime-review-empty {
  margin: 0;
  border: 1px dashed rgba(161, 119, 76, 0.45);
  border-radius: 10px;
  color: var(--ink-soft);
  text-align: center;
  padding: 12px;
  background: rgba(255, 247, 231, 0.65);
}

.login-page {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(57, 37, 23, 0.33);
  backdrop-filter: blur(2px);
  width: 100%;
  min-height: 100vh;
  margin: 0;
  padding: 20px 14px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 14px;
}

.login-quote-wrap {
  width: min(560px, 92vw);
  text-align: center;
  display: grid;
  justify-items: center;
  gap: 10px;
}

.login-logo-shell {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  border: 1px solid rgba(157, 115, 75, 0.34);
  background: rgba(255, 248, 234, 0.92);
  box-shadow: 0 8px 22px rgba(121, 86, 49, 0.14);
  overflow: hidden;
  display: grid;
  place-items: center;
}

.login-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.login-logo-fallback {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  border: 2px dashed rgba(172, 89, 37, 0.56);
  color: #9f5e34;
  display: grid;
  place-items: center;
  font-size: 0.76rem;
  font-weight: 700;
}

.daily-quote-text {
  margin: 0;
  color: #5b4330;
  line-height: 1.62;
  font-size: 1rem;
  min-height: 52px;
}

.daily-quote-source {
  margin: 0;
  color: #846752;
  font-size: 0.88rem;
}

.login-card {
  position: relative;
  width: min(460px, 92vw);
  border: 1px solid rgba(160, 117, 74, 0.36);
  border-radius: 18px;
  background: linear-gradient(165deg, rgba(255, 248, 233, 0.93), rgba(247, 233, 208, 0.89));
  box-shadow: 0 16px 34px rgba(121, 86, 49, 0.16);
  padding: 24px;
}

.login-close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  padding: 0;
  font-size: 1.15rem;
  line-height: 1;
  box-shadow: none;
}

.login-head {
  text-align: center;
  margin-bottom: 18px;
  padding-right: 34px;
}

.login-head h1 {
  margin: 0;
  font-size: 1.55rem;
  color: #4b2f1d;
}

.login-head p {
  margin: 6px 0 0;
  color: #7c634d;
  font-size: 0.91rem;
}

.login-form {
  display: grid;
  gap: 12px;
}

.login-field {
  display: grid;
  gap: 6px;
  font-size: 0.92rem;
  color: #614734;
}

.login-field input {
  width: 100%;
}

.login-input-wrap {
  position: relative;
}

.login-mail-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: #8b6f57;
  pointer-events: none;
}

#login-email {
  padding-left: 34px;
}

#login-code {
  letter-spacing: 0.2em;
  text-align: center;
  font-family: "JetBrains Mono", "SF Mono", "Consolas", monospace;
}

.login-message {
  border-radius: 10px;
  border: 1px solid rgba(167, 120, 75, 0.28);
  background: rgba(241, 229, 208, 0.65);
  color: #6e543f;
  padding: 9px 10px;
  font-size: 0.88rem;
  line-height: 1.4;
}

.login-message.is-error {
  border-color: rgba(166, 68, 57, 0.42);
  background: rgba(246, 218, 212, 0.72);
  color: #8f2f28;
}

.login-message.is-success {
  border-color: rgba(62, 129, 74, 0.38);
  background: rgba(218, 240, 222, 0.78);
  color: #216d34;
}

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

#login-auth-actions {
  display: grid;
  gap: 8px;
}

.login-footnote {
  margin-top: 16px;
  text-align: center;
  color: #866b54;
  font-size: 0.8rem;
}

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

.column {
  border: 1px solid rgba(166, 120, 75, 0.34);
  border-radius: 14px;
  padding: 10px;
  background: linear-gradient(165deg, rgba(255, 247, 230, 0.82), rgba(245, 227, 199, 0.75));
  box-shadow: inset 0 1px 0 rgba(255, 251, 241, 0.8);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.column-head {
  margin: 4px 0 0;
  position: relative;
  padding-left: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.column-head::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #b96435;
  transform: translateY(-50%);
}

.column-title {
  line-height: 1.2;
}

.column-count {
  min-width: 28px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid rgba(156, 108, 66, 0.4);
  background: rgba(255, 244, 224, 0.88);
  color: #6a452d;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.86rem;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.card-list {
  display: grid;
  gap: 10px;
  flex: 1;
  align-content: start;
  grid-auto-rows: max-content;
}

.done-time-group {
  border: 1px solid rgba(167, 120, 75, 0.32);
  border-radius: 12px;
  padding: 8px;
  background: rgba(255, 248, 234, 0.7);
  display: grid;
  gap: 8px;
  align-content: start;
}

.done-time-group-title {
  margin: 0;
}

.done-time-group-toggle {
  width: 100%;
  padding: 6px 8px;
  border-radius: 8px;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  font-size: 0.92rem;
  color: #6f4b31;
}

.done-time-list {
  display: grid;
  gap: 10px;
  align-content: start;
  grid-auto-rows: max-content;
}

.done-time-list[hidden] {
  display: none;
}

.empty-done-time-group {
  border: 1px dashed rgba(161, 119, 76, 0.42);
  border-radius: 10px;
  color: var(--ink-soft);
  text-align: center;
  padding: 10px;
  background: rgba(255, 247, 231, 0.55);
}

.column-add {
  width: 100%;
  padding: 6px 0 9px;
  border-radius: 10px;
  font-size: 1.6rem;
  line-height: 1;
  letter-spacing: 0;
}

.task-card {
  border: 1px solid rgba(165, 120, 75, 0.35);
  border-radius: 12px;
  padding: 10px;
  background: linear-gradient(150deg, rgba(255, 249, 238, 0.9), rgba(248, 234, 209, 0.84));
  display: grid;
  gap: 8px;
  position: relative;
  align-self: start;
}

.task-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(192, 99, 49, 0.85), rgba(214, 157, 74, 0.25));
}

.task-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding-left: 8px;
}

.card-toggle {
  padding: 5px 10px;
  font-size: 0.82rem;
  white-space: nowrap;
}

.card-extra {
  display: grid;
  gap: 8px;
  padding-left: 8px;
}

.task-card.is-collapsed .card-extra {
  display: none;
}


.card-title-wrap {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}

.card-time-range {
  color: var(--ink-soft);
  font-size: 0.86rem;
  white-space: nowrap;
}
.card-title {
  margin: 0;
  line-height: 1.3;
}

.pill {
  margin: 0;
  width: fit-content;
  border-radius: 999px;
  background: var(--brand-soft);
  color: #7e3f1f;
  border: 1px solid rgba(186, 114, 62, 0.28);
  padding: 4px 10px;
  font-size: 0.82rem;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.pill-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.mood-pill {
  background: rgba(92, 139, 182, 0.14);
  border-color: rgba(74, 118, 160, 0.32);
  color: #2f5376;
}

.process-pill {
  background: rgba(120, 111, 172, 0.14);
  border-color: rgba(93, 86, 145, 0.32);
  color: #463f79;
}

.card-detail {
  margin: 0;
  color: #735741;
  font-size: 0.95rem;
  line-height: 1.42;
  word-break: break-word;
  padding-left: 8px;
}

.card-line {
  margin: 0;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.88rem;
}

.card-line span:first-child {
  color: var(--ink-soft);
}

.card-status {
  max-width: 120px;
  margin-left: auto;
}

.empty-column {
  border: 1px dashed rgba(161, 119, 76, 0.45);
  border-radius: 10px;
  color: var(--ink-soft);
  text-align: center;
  padding: 14px;
  background: rgba(255, 247, 231, 0.65);
}

.slot-explore { background: var(--explore); }
.slot-topic { background: var(--topic); }
.slot-dev { background: var(--dev); }
.slot-inspiration { background: var(--inspiration); }
.slot-study { background: var(--study); }
.slot-sport { background: var(--sport); }
.slot-entertainment { background: var(--entertainment); }
.slot-relax { background: var(--relax); }
.slot-sleep { background: var(--sleep); }
.slot-meal { background: var(--meal); }
.slot-record { background: var(--record); }
.slot-other { background: var(--other); }
.slot-work { background: var(--work); }

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

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

  .app-header p {
    font-size: 0.95rem;
  }

  .login-page {
    padding: 24px 16px;
  }

  .category-manager-item {
    grid-template-columns: 42px minmax(0, 1fr) auto;
    grid-template-areas:
      "color name delete"
      "key key key";
  }

  .category-manager-color {
    grid-area: color;
  }

  .category-manager-name {
    grid-area: name;
  }

  .category-manager-key-wrap {
    grid-area: key;
    width: 100%;
    justify-self: stretch;
  }

  .category-manager-key {
    text-align: left;
  }

  .category-manager-delete {
    grid-area: delete;
  }

}

@media (max-width: 720px) {
  .app {
    padding: 16px 12px 18px;
  }

  .category-group-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-right: 0;
    min-height: 0;
  }

  .category-manage-trigger {
    position: static;
    margin-left: auto;
  }

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

  .category-checklist {
    grid-template-columns: 1fr;
  }

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

  .head-tools {
    width: 100%;
    justify-content: space-between;
    align-items: center;
  }

  .view-switch {
    width: 100%;
    justify-content: space-between;
  }

  .switch-btn {
    flex: 1;
  }

  .pie-wrapper {
    grid-template-columns: 1fr;
  }

  .week-wrapper {
    --week-bar-column-width: 84px;
    --week-bar-gap: 10px;
  }

  .pie-chart-wrap {
    width: 200px;
    height: 200px;
    margin: 0 auto;
  }

  .slot {
    height: 22px;
    border-radius: 6px;
  }

  .slot-fill {
    border-radius: 5px;
  }

  .slot[data-label]::after {
    display: none;
  }

  .legend-item {
    font-size: 0.82rem;
  }

  .login-page {
    padding: 20px 12px;
    gap: 14px;
  }

  .login-card {
    padding: 18px;
  }

  .login-logo-shell {
    width: 92px;
    height: 92px;
  }

  .daily-quote-text {
    min-height: 42px;
    font-size: 0.94rem;
  }

  #menu-toggle-btn {
    min-width: 64px;
    padding: 8px 11px;
  }
}














