:root {
  --bg: #eef1ed;
  --surface: #fffdf8;
  --surface-2: #f7f4ed;
  --ink: #1d211f;
  --muted: #69726c;
  --soft: #9aa39d;
  --line: #ded8ca;
  --green: #127453;
  --green-2: #e0f2e9;
  --red: #c73232;
  --red-2: #ffe4df;
  --orange: #c86114;
  --orange-2: #ffefd8;
  --blue: #246cc2;
  --blue-2: #e2efff;
  --purple: #6b4acb;
  --purple-2: #eee7ff;
  --brown: #8a5a32;
  --brown-2: #f1e4d4;
  --shadow: 0 20px 60px rgba(45, 38, 25, 0.13);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(18, 116, 83, 0.12), transparent 320px),
    linear-gradient(135deg, #f5f0e6 0%, #eef1ed 48%, #e7eef3 100%);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  position: relative;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  width: min(430px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.app-shell:not(.home-mode) {
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.app-shell:not(.home-mode) .date-row,
.app-shell:not(.home-mode) .quick-row {
  display: none;
}

.app-head {
  padding: calc(18px + env(safe-area-inset-top)) 16px 12px;
}

.topline,
.date-row,
.section-head,
.todo-head,
.todo-foot,
.comment-head,
.modal-head,
.notice-grid {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topline {
  align-items: flex-start;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
}

.logo-mark {
  width: 188px;
  height: auto;
  max-height: 52px;
  border-radius: 0;
  object-fit: contain;
  overflow: hidden;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  margin-top: 8px;
  font-size: 30px;
  line-height: 1.05;
}

h2 {
  font-size: 20px;
  line-height: 1.2;
}

.identity {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
}

.avatar {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar.friend-a {
  background: #334e7d;
}

.avatar.friend-b {
  background: #7a5633;
}

.date-row {
  margin-top: 16px;
}

.date-copy {
  display: grid;
  gap: 3px;
}

.date-copy b {
  font-size: 15px;
}

.date-copy span,
.section-head p,
.person-stat,
.meta,
.empty-text {
  color: var(--muted);
  font-size: 12px;
}

.date-actions {
  display: flex;
  gap: 7px;
}

.icon-button,
.text-button,
.primary-button,
.chip-button,
.close-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  white-space: nowrap;
}

.icon-button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 20px;
}

.icon-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.text-button {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.primary-button {
  min-height: 44px;
  padding: 0 16px;
  background: var(--green);
  color: #fff;
  font-weight: 900;
}

.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 14px;
  border-radius: var(--radius);
  background: var(--red-2);
  color: var(--red);
  font-weight: 900;
}

.chip-button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.quick-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 0 16px 14px;
}

.quick-metric {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 11px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.quick-metric span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.quick-metric b {
  font-size: 20px;
  line-height: 1;
}

.content {
  overflow: auto;
  padding: 0 12px 118px;
}

.app-view {
  display: none;
}

.app-view.active {
  display: block;
}

.notice,
.surface-block,
.person {
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
  overflow: hidden;
}

.person {
  overflow: visible;
}

.notice {
  padding: 13px;
  border-color: #d6b884;
  background: #fff6df;
}

.notice strong {
  display: block;
  margin-bottom: 7px;
  font-size: 14px;
}

.notice p {
  color: #75603b;
  font-size: 12px;
  line-height: 1.45;
}

.surface-block {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.section-head {
  align-items: flex-start;
}

.section-head p {
  margin-top: 5px;
  line-height: 1.5;
}

.person-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 13px 13px 10px;
  border-bottom: 1px solid rgba(222, 216, 202, 0.72);
}

.user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.user-copy {
  min-width: 0;
}

.user-copy b {
  display: block;
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.todo-list {
  display: grid;
  gap: 9px;
  padding: 10px;
}

.todo {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffdf9;
  position: relative;
  z-index: 0;
}

.todo.menu-open {
  z-index: 2000;
}

.todo.mine {
  border-color: rgba(18, 116, 83, 0.34);
}

.todo.completed .todo-text,
.todo.abandoned .todo-text {
  color: var(--soft);
}

.todo-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: start;
  gap: 8px;
}

.todo-text {
  min-width: 0;
  max-width: min(24em, 100%);
  font-size: 14px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.mood-inline {
  display: inline-block;
  margin-left: 5px;
}

.edit-area,
textarea,
input[type="text"],
input[type="date"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
}

.edit-area,
textarea {
  min-height: 94px;
  padding: 10px;
  resize: vertical;
  line-height: 1.55;
}

input[type="text"],
input[type="date"] {
  min-height: 40px;
  padding: 0 10px;
}

input:disabled {
  background: #efede6;
  color: var(--soft);
  cursor: not-allowed;
}

.tag,
.terminal-status {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  margin-right: 6px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  vertical-align: 1px;
}

.tag.core {
  background: var(--red-2);
  color: var(--red);
}

.tag.important {
  background: var(--orange-2);
  color: var(--orange);
}

.tag.normal {
  background: var(--blue-2);
  color: var(--blue);
}

.tag.low {
  background: #def3e4;
  color: #2a854b;
}

.terminal-status {
  flex: 0 0 auto;
  margin-right: 0;
  background: #eeeeeb;
  color: #72776f;
  white-space: nowrap;
}

.terminal-status.completed {
  background: var(--green-2);
  color: var(--green);
}

.terminal-status.parked {
  background: var(--purple-2);
  color: var(--purple);
}

.terminal-status.carried {
  background: #f5ead9;
  color: var(--brown);
}

.todo-foot {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
}

.progress {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

input[type="range"] {
  width: 100%;
  margin: 0;
  accent-color: var(--green);
}

input[type="range"].peer-range {
  accent-color: var(--brown);
  opacity: 1;
  pointer-events: none;
}

input[type="range"].peer-range::-webkit-slider-thumb {
  background: var(--brown);
}

input[type="range"].peer-range::-moz-range-progress {
  background: var(--brown);
}

.todo-actions {
  position: relative;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.state-wrap {
  position: relative;
}

.state-wrap.open {
  z-index: 3000;
}

.state-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 9000;
  display: none;
  min-width: 112px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 12px 28px rgba(45, 38, 25, 0.14);
}

.state-wrap.open .state-menu {
  display: grid;
  gap: 4px;
}

.state-menu button {
  min-height: 31px;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-size: 12px;
  font-weight: 850;
}

.state-menu button:hover {
  background: var(--surface-2);
}

.comment-thread {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid #e3ded2;
  border-radius: var(--radius);
  background: #f8f5ee;
}

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

.comment .avatar {
  width: 26px;
  height: 26px;
  font-size: 11px;
}

.comment b {
  font-size: 12px;
}

.comment p {
  margin-top: 2px;
  color: #4e554f;
  font-size: 12px;
  line-height: 1.45;
  word-break: break-word;
}

.reply {
  margin-top: 7px;
  padding-left: 9px;
  border-left: 2px solid #cfc7b6;
}

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

.comment-tools {
  margin-top: 6px;
}

.link-button {
  padding: 0;
  background: transparent;
  color: var(--green);
  font-size: 12px;
  font-weight: 850;
}

.link-button:disabled {
  color: var(--soft);
  cursor: not-allowed;
}

.composer {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  gap: 7px;
}

.composer input {
  min-width: 0;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 10px;
  background: #fff;
}

.composer button {
  height: 36px;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  font-weight: 900;
}

.emoji-wrap {
  position: relative;
}

.composer .emoji-button {
  width: 42px;
  background: #fff;
  color: var(--muted);
  border: 1px solid var(--line);
}

.emoji-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 6px);
  z-index: 8;
  display: none;
  grid-template-columns: repeat(5, 34px);
  gap: 5px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 12px 28px rgba(45, 38, 25, 0.14);
}

.emoji-wrap.open .emoji-menu {
  display: grid;
}

.emoji-menu button {
  width: 34px;
  height: 32px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 13px;
}

.composer .send-button {
  background: var(--blue);
  color: #fff;
  font-size: 15px;
}

.form,
.identity-list {
  display: grid;
  gap: 12px;
}

.form-actions {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
}

.form-actions .primary-button,
.form-actions .danger-button,
.form-actions .text-button {
  min-width: 74px;
  min-height: 44px;
  padding: 0 14px;
  font-weight: 900;
}

.profile-avatar-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-avatar-preview {
  width: 58px;
  height: 58px;
  font-size: 18px;
}

.avatar-upload {
  position: relative;
  overflow: hidden;
}

.avatar-upload input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.field small {
  color: var(--soft);
  font-size: 11px;
  font-weight: 750;
}

.field b {
  color: var(--ink);
}

.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.choice-row button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #555d57;
  font-size: 12px;
  font-weight: 850;
}

.choice-row .selected,
.identity-option.active {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.identity-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.identity-code {
  display: grid;
  gap: 7px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.identity-code span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.identity-code b {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  word-break: break-all;
}

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

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

.month b {
  min-width: 120px;
  text-align: center;
}

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

.week span {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.day {
  position: relative;
  display: grid;
  place-items: center;
  gap: 1px;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font-weight: 850;
}

.day span {
  line-height: 1;
}

.day small {
  min-height: 12px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
}

.day.weekend {
  background: #f1f5fb;
}

.day.today {
  border-color: rgba(18, 116, 83, 0.34);
  background: var(--green-2);
  color: var(--green);
}

.day.muted {
  border-color: transparent;
  background: rgba(255, 255, 255, 0.44);
  color: var(--soft);
}

.day.active {
  background: var(--ink);
  color: #fff;
}

.day.active small {
  color: rgba(255, 255, 255, 0.78);
}

.day.has::after {
  position: absolute;
  right: 7px;
  bottom: 7px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  content: "";
}

.day.active::after {
  background: #fff;
}

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  width: min(430px, 100%);
  margin: 0 auto;
  padding: 10px 14px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.94);
  backdrop-filter: blur(16px);
  z-index: 50;
}

.bottom-nav button {
  display: grid;
  min-height: 58px;
  place-items: center;
  gap: 3px;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.bottom-nav button b {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  font-size: 25px;
  line-height: 1;
}

.bottom-nav button svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.bottom-nav .active {
  background: var(--green-2);
  color: var(--green);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(29, 33, 31, 0.38);
}

.modal-backdrop.hidden {
  display: none;
}

.modal {
  width: min(760px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.modal-head {
  position: sticky;
  top: 0;
  z-index: 1;
  align-items: flex-start;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.96);
  backdrop-filter: blur(14px);
}

.modal-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.close-button {
  width: 38px;
  height: 38px;
  background: var(--ink);
  color: #fff;
  font-size: 18px;
}

.modal-body {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.reminder-item {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.reminder-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

.empty-text {
  padding: 16px;
  line-height: 1.5;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 88px;
  z-index: 40;
  display: none;
  max-width: min(360px, calc(100vw - 32px));
  padding: 10px 13px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 850;
  transform: translateX(-50%);
  box-shadow: 0 12px 32px rgba(29, 33, 31, 0.22);
}

.toast.show {
  display: block;
}

.hidden {
  display: none !important;
}

.desktop-shell {
  display: none;
}

@media (min-width: 901px) {
  .app-shell {
    display: none;
  }

  body {
    min-height: 100vh;
    overflow: hidden;
  }

  .desktop-shell {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    width: min(1500px, calc(100vw - 40px));
    height: calc(100vh - 40px);
    min-height: 720px;
    margin: 20px auto;
    border: 1px solid rgba(222, 216, 202, 0.86);
    border-radius: 18px;
    background: rgba(255, 253, 248, 0.94);
    box-shadow: var(--shadow);
    overflow: hidden;
  }

  .desktop-topbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 18px;
    padding: 16px 22px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 253, 248, 0.92);
    backdrop-filter: blur(16px);
  }

  .desktop-logo {
    display: block;
    width: 172px;
    height: auto;
  }

  .desktop-title {
    display: grid;
    gap: 2px;
    justify-self: center;
    text-align: center;
  }

  .desktop-title b {
    font-size: 15px;
  }

  .desktop-title span,
  .desktop-panel p,
  .desktop-panel span,
  .desktop-comment-head p,
  .desktop-member-meta,
  .desktop-person-stat {
    color: var(--muted);
    font-size: 12px;
  }

  .desktop-profile-entry {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 4px 12px 4px 5px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--muted);
    font-size: 13px;
    font-weight: 850;
  }

  .desktop-workspace {
    position: relative;
    display: grid;
    grid-template-columns: 336px minmax(520px, 1fr) 370px;
    min-height: 0;
  }

  .desktop-left-pane,
  .desktop-comment-pane {
    display: grid;
    align-content: start;
    gap: 14px;
    padding: 18px;
    background: rgba(247, 244, 237, 0.68);
    overflow: auto;
  }

  .desktop-left-pane {
    border-right: 1px solid var(--line);
  }

  .desktop-comment-pane {
    position: relative;
    display: block;
    border-left: 1px solid var(--line);
    overflow: hidden;
  }

  .desktop-main-pane {
    min-width: 0;
    min-height: 0;
    overflow: auto;
  }

  .desktop-main-content {
    position: relative;
    display: grid;
    gap: 14px;
    align-content: start;
    min-height: 100%;
    padding: 20px 28px 32px;
  }

  .desktop-line-layer {
    position: absolute;
    inset: 0;
    z-index: 5;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
  }

  .desktop-line-layer path {
    fill: none;
    stroke: rgba(18, 116, 83, 0.34);
    stroke-width: 2;
  }

  .desktop-line-layer path.user-friend-a {
    stroke: rgba(51, 78, 125, 0.34);
  }

  .desktop-line-layer path.user-friend-b {
    stroke: rgba(138, 90, 50, 0.36);
  }

  .desktop-line-layer path.active {
    stroke-width: 3;
  }

  .desktop-content-layer {
    position: relative;
    z-index: 10;
    display: grid;
    gap: 14px;
    align-content: start;
    overflow: visible;
  }

  .desktop-main-sticky {
    position: sticky;
    top: 0;
    z-index: 25;
    display: grid;
    gap: 12px;
    align-content: start;
    padding: 20px 0 14px;
    background: rgba(255, 253, 248, 0.94);
    backdrop-filter: blur(14px);
  }

  .desktop-hero-row,
  .section-line,
  .desktop-person-head,
  .desktop-todo-head,
  .desktop-todo-foot,
  .desktop-comment-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  .desktop-hero-row {
    align-items: flex-start;
  }

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

  .desktop-metric {
    display: grid;
    align-content: center;
    gap: 5px;
    height: 72px;
    min-width: 0;
    padding: 11px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
  }

  .desktop-metric span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 850;
  }

  .desktop-metric b {
    font-size: 22px;
    line-height: 1;
  }

  .desktop-panel {
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.78);
  }

  .desktop-calendar .day {
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 2px;
    min-height: 42px;
    padding: 0;
  }

  .desktop-calendar .day span,
  .desktop-calendar .day small {
    line-height: 1;
  }

  .desktop-calendar .day small {
    min-height: 11px;
    padding-bottom: 5px;
  }

  .desktop-calendar .day.has::after {
    right: 6px;
    bottom: 4px;
  }

  .desktop-member-list,
  .desktop-todo-sections,
  .desktop-todo-list {
    display: grid;
    gap: 9px;
    align-content: start;
    align-items: start;
  }

  .desktop-member-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 58px;
    padding: 9px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    color: var(--ink);
    text-align: left;
  }

  .desktop-member-card.active {
    border-color: rgba(18, 116, 83, 0.42);
    background: var(--green-2);
  }

  .desktop-person {
    position: relative;
    z-index: 0;
    align-self: start;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.8);
    overflow: visible;
  }

  .desktop-person.highlight {
    border-color: rgba(18, 116, 83, 0.62);
    box-shadow: 0 0 0 4px rgba(18, 116, 83, 0.08);
  }

  .desktop-person.menu-open {
    z-index: 9500;
  }

  .desktop-person-head {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(222, 216, 202, 0.8);
  }

  .desktop-todo-list {
    padding: 10px;
  }

  .desktop-todo {
    position: relative;
    z-index: 0;
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fffdf9;
  }

  .desktop-todo.menu-open {
    z-index: 9000;
  }

  .desktop-todo .todo-text {
    width: 100%;
    max-width: none;
    font-size: 14px;
    line-height: 1.55;
  }

  .desktop-todo .progress {
    max-width: 260px;
  }

  .desktop-todo .todo-actions {
    flex-wrap: nowrap;
  }

  .desktop-todo.mine {
    border-color: rgba(18, 116, 83, 0.34);
  }

  .desktop-todo.active,
  .desktop-comment-card.active {
    border-color: rgba(18, 116, 83, 0.62);
    background: var(--green-2);
    box-shadow: 0 0 0 3px rgba(18, 116, 83, 0.08);
  }

  .desktop-todo.friend-a.active,
  .desktop-comment-card.friend-a.active {
    border-color: rgba(51, 78, 125, 0.58);
    background: #e5ecf8;
  }

  .desktop-todo.friend-b.active,
  .desktop-comment-card.friend-b.active {
    border-color: rgba(138, 90, 50, 0.58);
    background: var(--brown-2);
  }

  .desktop-comment-head {
    position: absolute;
    top: 18px;
    right: 18px;
    left: 18px;
    z-index: 35;
    display: grid;
    gap: 3px;
    min-height: 58px;
    padding-bottom: 10px;
    background: linear-gradient(180deg, rgba(247, 244, 237, 0.96) 0%, rgba(247, 244, 237, 0.9) 74%, rgba(247, 244, 237, 0) 100%);
  }

  .desktop-comment-scroll {
    position: absolute;
    inset: 18px;
    overflow: hidden;
    pointer-events: none;
  }

  .desktop-comment-layer {
    position: relative;
    z-index: 10;
    min-height: 100%;
    pointer-events: auto;
  }

  .desktop-comment-card {
    position: absolute;
    right: 0;
    left: 0;
    display: grid;
    gap: 9px;
    padding: 11px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--green);
    border-radius: var(--radius);
    background: #fff;
  }

  .desktop-comment-card.friend-a {
    border-left-color: #334e7d;
  }

  .desktop-comment-card.friend-b {
    border-left-color: var(--brown);
  }

  .desktop-comment-title {
    align-items: flex-start;
  }

  .desktop-comment-title b {
    font-size: 13px;
    line-height: 1.35;
  }

  .desktop-comment-reply {
    display: grid;
    gap: 3px;
    padding: 8px;
    border: 1px solid #e3ded2;
    border-radius: var(--radius);
    background: #f8f5ee;
    font-size: 12px;
    line-height: 1.42;
  }

  .desktop-comment-children {
    display: grid;
    gap: 7px;
    margin-top: 6px;
    margin-left: 18px;
    padding-left: 12px;
    border-left: 3px solid rgba(105, 114, 108, 0.22);
  }

  .desktop-comment-children .desktop-comment-reply {
    padding: 7px 0 0;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  .desktop-comment-reply .composer {
    margin-top: 6px;
  }

  .desktop-comment-reply-tools {
    display: flex;
    justify-content: flex-end;
  }

  .desktop-reply-author {
    color: var(--green);
  }

  .desktop-reply-author.friend-a {
    color: #334e7d;
  }

  .desktop-reply-author.friend-b {
    color: var(--brown);
  }

  .desktop-empty {
    padding: 18px;
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    color: var(--muted);
    background: rgba(255, 255, 255, 0.6);
    font-size: 13px;
    line-height: 1.5;
  }

  .desktop-comment-layer > .desktop-empty {
    margin-top: 72px;
  }

  #desktopTodoModal .modal,
  #desktopProfileModal .modal {
    display: grid;
    gap: 14px;
    width: min(640px, calc(100vw - 44px));
    padding: 18px;
  }

  #desktopTodoModal .modal-head,
  #desktopProfileModal .modal-head {
    padding: 0 0 14px;
    border-bottom: 1px solid var(--line);
  }

  #desktopTodoModal .form,
  #desktopProfileModal .form {
    gap: 13px;
  }

  #desktopTodoModal textarea {
    min-height: 96px;
  }

  #desktopTodoModal .form-actions,
  #desktopProfileModal .form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    align-items: center;
  }

  #desktopTodoModal .form-actions .primary-button,
  #desktopTodoModal .form-actions .danger-button,
  #desktopTodoModal .form-actions .text-button,
  #desktopProfileModal .form-actions .primary-button,
  #desktopProfileModal .form-actions .danger-button,
  #desktopProfileModal .form-actions .text-button {
    width: auto;
    min-width: 86px;
    min-height: 44px;
    padding: 0 16px;
    font-size: 14px;
    font-weight: 900;
    line-height: 1;
  }
}

@media (max-width: 520px) {
  body {
    background: var(--surface);
  }

  .app-shell {
    width: 100%;
    box-shadow: none;
  }

  h1 {
    font-size: 28px;
  }

  .quick-row {
    padding-inline: 14px;
  }

  .todo-actions {
    justify-content: flex-end;
  }

  .modal-backdrop {
    padding: 14px;
  }

  #reminderModal {
    place-items: center;
  }

  #reminderModal .modal {
    width: min(360px, calc(100vw - 34px));
    max-height: calc(100vh - 110px);
    border-radius: 15px;
  }

  #reminderModal .modal-head {
    padding: 12px;
  }

  #reminderModal .modal-head h2 {
    font-size: 18px;
    line-height: 1.2;
  }

  #reminderModal .modal-head p {
    font-size: 12px;
    line-height: 1.35;
  }

  #reminderModal .close-button {
    width: 34px;
    height: 34px;
    font-size: 17px;
  }

  #reminderModal .modal-body {
    gap: 8px;
    padding: 10px;
  }

  #reminderModal .reminder-item {
    gap: 9px;
    padding: 10px;
  }

  #reminderModal .todo-text {
    font-size: 13px;
    line-height: 1.45;
  }

  #reminderModal .field {
    gap: 5px;
    font-size: 11px;
  }

  #reminderModal .reminder-actions {
    gap: 6px;
  }

  #reminderModal .reminder-actions button {
    min-height: 30px;
    padding: 0 6px;
    font-size: 11px;
  }
}
