:root {
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #382d32;
  background: #fff8f8;
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
html,
body {
  overflow-x: hidden;
  max-width: 100vw;
}
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 8%, #ffe0e8 0, transparent 30%),
    radial-gradient(circle at 88% 18%, #ffeccf 0, transparent 27%),
    linear-gradient(150deg, #fffaf8, #fff1f5);
  padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom);
}
body:before,
body:after {
  content: "♥";
  position: fixed;
  color: #ffb1c1;
  opacity: 0.25;
  z-index: -1;
}
body:before {
  font-size: 14rem;
  top: 30%;
  left: -4rem;
  transform: rotate(-18deg);
}
body:after {
  font-size: 10rem;
  right: -2rem;
  bottom: 5%;
  transform: rotate(20deg);
}
.shell {
  width: min(100%, 520px);
  margin: auto;
  padding: 42px 0;
}
.brand {
  text-align: center;
  margin-bottom: 24px;
}
.brand h1 {
  font-size: 2rem;
  margin: 5px 0;
  color: #d74462;
  letter-spacing: 0.15em;
}
.brand p {
  margin: 0;
  color: #8c7078;
  font-size: 0.92rem;
}
.mini-heart {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 8px 25px #ff809c36;
  color: #ff5577;
  font-size: 1.5rem;
}
.card {
  background: #ffffffdc;
  border: 1px solid #fff;
  box-shadow: 0 18px 55px #9e526b1c;
  border-radius: 28px;
  padding: 24px;
  backdrop-filter: blur(12px);
}
h2 {
  margin: 0 0 8px;
  font-size: 1.35rem;
}
.sub {
  margin: 0 0 22px;
  color: #866e76;
  line-height: 1.6;
}
.field {
  display: grid;
  gap: 7px;
  margin: 14px 0;
  min-width: 0;
  max-width: 100%;
}
.field label {
  font-size: 0.85rem;
  color: #725c64;
  font-weight: 650;
}
.field input,
.field textarea {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  border: 1px solid #eadde1;
  background: #fffafd;
  border-radius: 14px;
  padding: 13px 14px;
  font: inherit;
  outline: none;
  transition: 0.2s;
}
.field input:focus,
.field textarea:focus {
  border-color: #ff7792;
  box-shadow: 0 0 0 4px #ff77921a;
}
.field textarea {
  resize: vertical;
  min-height: 82px;
}
.counter {
  text-align: right;
  color: #9b8189;
  font-size: 0.78rem;
}
.button {
  border: 0;
  border-radius: 15px;
  padding: 13px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 0.15s,
    box-shadow 0.15s,
    opacity 0.15s;
}
.button:active {
  transform: scale(0.97);
}
.button:disabled {
  opacity: 0.55;
  cursor: wait;
}
.primary {
  width: 100%;
  background: linear-gradient(135deg, #ff5577, #ff816d);
  color: #fff;
  box-shadow: 0 10px 24px #ff557740;
}
.ghost {
  background: #fff;
  color: #9b5362;
  border: 1px solid #f1dce2;
}
.setup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.dashboard {
  text-align: center;
}
.hello {
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-align: left;
  margin-bottom: 18px;
}
.hello strong {
  color: #d74462;
}
.heart-button {
  position: relative;
  width: 190px;
  height: 190px;
  border: 0;
  border-radius: 50%;
  margin: 15px auto 24px;
  background: linear-gradient(145deg, #ff7892, #ff4d70);
  color: white;
  box-shadow:
    0 24px 50px #ff56774d,
    inset 0 2px 2px #ffffff70;
  cursor: pointer;
  transition: 0.18s;
}
.heart-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 30px 56px #ff56775c;
}
.heart-button:active,
.heart-button.pulse {
  transform: scale(0.92);
}
.heart-button span {
  display: block;
  font-size: 4.4rem;
  line-height: 1;
}
.heart-button b {
  display: block;
  margin-top: 8px;
  font-size: 1.05rem;
}
.today {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  margin: 18px 0 22px;
}
.score {
  background: #fff6f8;
  border-radius: 18px;
  padding: 13px 8px;
}
.score b {
  display: block;
  font-size: 1.65rem;
  color: #d74462;
}
.score small {
  color: #887078;
}
.versus {
  color: #c6a6ae;
  font-size: 0.8rem;
}
.history-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
}
.history-head h3 {
  margin: 0;
}
.history {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  text-align: left;
}
.event {
  padding: 13px 15px;
  border-radius: 16px;
  background: #fff7f9;
  border: 1px solid #f6e5e9;
}
.event-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.83rem;
}
.event-name {
  font-weight: 700;
  color: #d74462;
}
.event-time {
  color: #a18991;
}
.event p {
  margin: 8px 0 0;
  color: #5f4a51;
  line-height: 1.45;
  word-break: break-word;
}
.empty {
  color: #9d858d;
  padding: 24px 0;
  text-align: center;
}
.loading {
  text-align: center;
  color: #9a737e;
  padding: 60px 0;
}
#toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  background: #382d32;
  color: #fff;
  padding: 11px 18px;
  border-radius: 99px;
  opacity: 0;
  pointer-events: none;
  transition: 0.25s;
  z-index: 20;
  max-width: 90%;
  white-space: nowrap;
}
#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
.footer-actions {
  display: flex;
  justify-content: center;
  margin-top: 22px;
}
.error {
  color: #bf3651;
  font-size: 0.85rem;
  margin: 10px 0;
}
@media (max-width: 420px) {
  .shell {
    padding: 25px 0;
  }
  .card {
    padding: 20px;
    border-radius: 23px;
  }
  .heart-button {
    width: 165px;
    height: 165px;
  }
  .setup-grid {
    grid-template-columns: 1fr;
  }
  .brand h1 {
    font-size: 1.75rem;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 14px 0;
  color: #725c64;
  font-size: 0.9rem;
}
.check-row input {
  width: 18px;
  height: 18px;
  accent-color: #d74462;
}
.alias-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 18px 0;
  padding: 14px 16px;
  border-radius: 18px;
  background: #fff7f9;
  border: 1px solid #f4e1e6;
}
.alias-panel strong {
  display: block;
  margin-top: 3px;
  color: #d74462;
  font-size: 1.08rem;
}
.button.small {
  padding: 8px 12px;
  font-size: 0.82rem;
}
.history-head {
  gap: 12px;
  flex-wrap: wrap;
}
.filters {
  display: flex;
  gap: 6px;
  padding: 4px;
  border-radius: 99px;
  background: #f8e9ed;
}
.filter {
  border: 0;
  border-radius: 99px;
  background: transparent;
  color: #846b73;
  padding: 7px 11px;
  cursor: pointer;
}
.filter.active {
  background: #fff;
  color: #c93655;
  box-shadow: 0 3px 12px #9341581c;
}
.history-list {
  display: grid;
  gap: 16px;
}
.history-day h4 {
  margin: 8px 0;
  color: #8a7179;
  font-size: 0.82rem;
  font-weight: 700;
}
.history-item {
  padding: 13px 15px;
  border-radius: 16px;
  background: #fff7f9;
  border: 1px solid #f6e5e9;
}
.history-item.sender-first {
  background: #f1f6fa;
  border-color: #d8e5ee;
}
.history-item + .history-item {
  margin-top: 8px;
}
.history-item div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.history-item strong {
  color: #d74462;
  font-size: 0.88rem;
}
.history-item time {
  color: #a18991;
  font-size: 0.8rem;
}
.history-item p {
  margin: 7px 0 0;
  color: #5f4a51;
  line-height: 1.5;
  word-break: break-word;
  white-space: pre-line;
}
.history-letter {
  display: flex;
  width: 100%;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  margin-top: 9px;
  padding: 0;
  border: 1px solid #e5ccd3;
  border-radius: 12px;
  background: #ffffffa6;
  color: #c94a67;
  cursor: pointer;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}
.history-letter:hover {
  border-color: #d68da0;
  background: #fff;
  transform: translateY(-1px);
}
.history-letter:focus-visible {
  outline: 3px solid #d7446240;
  outline-offset: 2px;
}
.history-letter:disabled {
  cursor: wait;
  opacity: 0.58;
  transform: none;
}
.envelope-icon {
  position: relative;
  width: 28px;
  height: 20px;
  overflow: hidden;
  border: 2px solid currentColor;
  border-radius: 3px;
}
.envelope-icon::before,
.envelope-icon::after {
  position: absolute;
  top: -7px;
  width: 20px;
  height: 20px;
  border-bottom: 2px solid currentColor;
  content: "";
}
.envelope-icon::before {
  left: -4px;
  transform: rotate(38deg);
}
.envelope-icon::after {
  right: -4px;
  transform: rotate(-38deg);
}
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 6px;
  color: #8a7179;
  font-size: 0.84rem;
}
.pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.alias-dialog {
  width: min(calc(100% - 32px), 420px);
  border: 0;
  border-radius: 24px;
  padding: 24px;
  color: #382d32;
  box-shadow: 0 22px 70px #66384642;
}
.alias-dialog::backdrop {
  background: #382d3266;
  backdrop-filter: blur(4px);
}
.alias-dialog h3 {
  margin: 0 0 8px;
}
.alias-dialog label {
  display: grid;
  gap: 7px;
  color: #725c64;
  font-size: 0.88rem;
}
.alias-dialog input {
  width: 100%;
  border: 1px solid #eadde1;
  background: #fff9fa;
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 18px;
}
@media (max-width: 420px) {
  .alias-panel {
    align-items: flex-start;
  }
  .history-head {
    align-items: flex-start;
  }
  .filters {
    width: 100%;
  }
  .filter {
    flex: 1;
  }
  .pagination {
    justify-content: space-between;
  }
}

/* 2026 mobile-first visual refresh */
.login-card {
  width: min(100%, 480px);
  padding: 36px;
  border-color: rgba(218, 111, 136, 0.18);
  box-shadow: 0 24px 70px rgba(111, 55, 70, 0.13);
}
.login-intro {
  display: grid;
  justify-items: center;
  margin-bottom: 28px;
  text-align: center;
}
.login-intro .eyebrow {
  margin-bottom: 10px;
  letter-spacing: 0.16em;
}
.login-intro h2 {
  margin: 0 0 10px;
  font-size: clamp(1.75rem, 6vw, 2.15rem);
}
.login-intro .sub {
  max-width: 25rem;
  margin: 0;
}
.login-form {
  display: grid;
  gap: 18px;
}
.login-form > label:not(.check-row) {
  display: grid;
  gap: 8px;
  color: #634d55;
  font-size: 0.88rem;
  font-weight: 700;
}
.login-form input:not([type="checkbox"]) {
  width: 100%;
  min-height: 52px;
  border: 1px solid #eadce1;
  border-radius: 16px;
  background: #fffafb;
  padding: 0 16px;
  color: #382d32;
  font: inherit;
  font-size: 1rem;
  outline: none;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}
.login-form input:not([type="checkbox"]):focus {
  border-color: #df718b;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(215, 68, 98, 0.1);
}
.login-form .check-row {
  margin: -2px 0 0;
}
.login-submit {
  min-height: 54px;
  margin-top: 2px;
  border-radius: 16px;
  font-size: 1rem;
}
.topline > div {
  min-width: 0;
}
.topline h2 {
  text-wrap: balance;
}
.alias-panel {
  min-height: 74px;
}
.alias-panel .button,
.topline .button {
  flex: 0 0 auto;
  min-width: 64px;
}
.miss-form {
  display: grid;
  justify-items: center;
  gap: 20px;
  margin-top: 22px;
}
.message-panel {
  width: 100%;
  padding: 16px 16px 12px;
  border: 1px solid #f0dfe4;
  border-radius: 20px;
  background: linear-gradient(145deg, #fffafb, #fff5f7);
}
.message-field {
  gap: 9px;
  margin: 0;
}
.message-field > span {
  color: #684f58;
  font-size: 0.9rem;
  font-weight: 750;
}
.message-field textarea {
  display: block;
  width: 100%;
  min-height: 132px;
  resize: vertical;
  border: 0;
  border-radius: 14px;
  background: #fff;
  padding: 14px 15px;
  box-shadow: inset 0 0 0 1px rgba(225, 190, 199, 0.76);
  font: inherit;
  font-size: 1rem;
  line-height: 1.6;
}
.message-field textarea:focus {
  box-shadow:
    inset 0 0 0 1px #df718b,
    0 0 0 4px rgba(215, 68, 98, 0.09);
}
.message-hint {
  display: block;
  margin-top: 8px;
  color: #a48a92;
  font-size: 0.76rem;
  text-align: right;
}
.miss-form .heart-button {
  margin: 0;
}
.today-counts {
  display: grid;
  justify-items: center;
  gap: 7px;
  margin: 22px 0 8px;
  padding: 16px;
  border-radius: 20px;
  background: #fff6f8;
  color: #684f58;
}
.count-line {
  font-size: 1rem;
  line-height: 1.5;
}
.count-value {
  margin-left: 4px;
  color: #d74462;
  font-size: 1.35rem;
  font-weight: 800;
}
.counts-heart {
  color: #ea6c86;
  font-size: 0.9rem;
  line-height: 1;
}

@media (max-width: 600px) {
  body {
    background:
      radial-gradient(
        circle at 50% -8%,
        rgba(255, 214, 224, 0.9),
        transparent 34%
      ),
      linear-gradient(180deg, #fff9fa 0%, #fff4f6 100%);
  }
  .app-shell {
    width: 100%;
    min-height: 100dvh;
    padding: max(20px, env(safe-area-inset-top)) 16px
      max(24px, env(safe-area-inset-bottom));
  }
  .brand {
    margin: 8px 0 22px;
    text-align: center;
  }
  .brand h1 {
    font-size: 1.65rem;
    letter-spacing: -0.03em;
  }
  .brand p {
    margin-top: 5px;
    font-size: 0.86rem;
  }
  .card {
    border-radius: 24px;
    padding: 24px 20px;
    box-shadow: 0 18px 50px rgba(111, 55, 70, 0.1);
  }
  .login-card {
    padding: 30px 22px 24px;
  }
  .login-intro {
    margin-bottom: 24px;
  }
  .login-form {
    gap: 16px;
  }
  .login-form input:not([type="checkbox"]) {
    min-height: 50px;
    border-radius: 14px;
  }
  .topline {
    align-items: flex-start;
    gap: 12px;
  }
  .topline h2 {
    margin-top: 5px;
    font-size: clamp(1.35rem, 6.3vw, 1.65rem);
    line-height: 1.25;
  }
  .topline > div:first-child {
    text-align: center;
  }
  .topline .button {
    min-width: 58px;
    min-height: 40px;
    padding: 8px 12px;
  }
  .alias-panel {
    align-items: center;
    gap: 12px;
    margin: 16px 0;
    padding: 13px 14px;
    border-radius: 17px;
  }
  .alias-panel .button {
    min-width: 58px;
    min-height: 40px;
    padding: 8px 12px;
  }
  #logout {
    min-width: 0;
  }
  .today-counts {
    gap: 5px;
    margin-top: 18px;
    padding: 13px 10px;
  }
  .count-line {
    font-size: 0.9rem;
  }
  .count-value {
    font-size: 1.2rem;
  }
  .message-panel {
    padding: 14px 14px 11px;
    border-radius: 18px;
  }
  .message-field textarea {
    min-height: 144px;
  }
  .heart-button {
    width: 126px;
    height: 126px;
  }
  .history {
    margin-top: 30px;
    padding-top: 24px;
  }
  .history-head {
    gap: 14px;
  }
  .history-head h3 {
    margin: 0;
  }
  .filters {
    padding: 3px;
    border-radius: 13px;
  }
  .filter {
    min-height: 40px;
    padding: 8px 11px;
    border-radius: 10px;
  }
  .history-item {
    padding: 14px;
    border-radius: 16px;
  }
  .pagination .button {
    min-height: 40px;
    padding-inline: 12px;
  }
}

@media (max-width: 380px) {
  .app-shell {
    padding-inline: 12px;
  }
  .brand {
    margin-bottom: 18px;
  }
  .card {
    padding: 22px 17px;
    border-radius: 22px;
  }
  .login-card {
    padding: 27px 19px 22px;
  }
  .login-intro h2 {
    font-size: 1.7rem;
  }
  .login-intro .sub {
    font-size: 0.91rem;
  }
  .topline h2 {
    font-size: 1.38rem;
  }
  .alias-panel {
    padding-inline: 12px;
  }
  .today-counts {
    padding-inline: 7px;
  }
  .message-field textarea {
    min-height: 150px;
  }
  .history-head {
    align-items: stretch;
  }
  .filters {
    width: 100%;
  }
  .filter {
    flex: 1;
  }
  .pagination {
    justify-content: space-between;
  }
}
/* image attachments */
.image-attach { display: flex; align-items: center; gap: 8px; margin-top: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.image-preview { display: block; max-width: 100%; max-height: 160px; border-radius: 12px; margin-top: 8px; object-fit: contain; cursor: zoom-in; }
.image-preview[hidden] { display: none; }
.history-image-wrap { padding: 0; border: 0; background: none; display: block; margin-top: 6px; cursor: zoom-in; }
.history-image { display: block; max-width: min(100%, 220px); max-height: 220px; border-radius: 12px; object-fit: cover; }
.letter-body p { margin: 0 0 6px; }
.image-lightbox { position: fixed; inset: 0; background: rgba(15,10,20,0.88); display: flex; align-items: center; justify-content: center; z-index: 1000; cursor: zoom-out; padding: 24px; }
.image-lightbox img { max-width: 100%; max-height: 100%; border-radius: 12px; object-fit: contain; }

/* Shared space navigation, calendar and milestones */
.space-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin: 20px 0 18px;
  padding: 5px;
  border-radius: 18px;
  background: #fff3f6;
}
.space-tab {
  border: 0;
  border-radius: 14px;
  padding: 10px 6px;
  background: transparent;
  color: #9a7780;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
}
.space-tab.active {
  background: #fff;
  color: #d74462;
  box-shadow: 0 6px 18px #a84f6820;
}
.space-tab:focus-visible {
  outline: 3px solid #ff779244;
  outline-offset: 2px;
}
.space-panel[hidden] { display: none; }
.feature-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  margin: 8px 0 18px;
}
.feature-head h3 { margin: 3px 0 0; }
.month-nav { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.month-nav .button { min-width: 34px; padding: 7px 10px; }
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
  padding: 12px;
  border: 1px solid #f1e0e4;
  border-radius: 20px;
  background: #fffafb;
}
.calendar-weekday {
  text-align: center;
  padding: 5px 0 8px;
  color: #ac8f97;
  font-size: 0.76rem;
  font-weight: 700;
}
.calendar-day {
  position: relative;
  aspect-ratio: 1;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #614d54;
  font: inherit;
  cursor: pointer;
}
.calendar-day:hover { background: #ffeef2; }
.calendar-day.selected { background: #ff607d; color: #fff; font-weight: 750; }
.calendar-day.has-events:after {
  content: "";
  position: absolute;
  inset: -3px -1px;
  transform: rotate(-5deg);
  background: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHZpZXdCb3g9JzAgMCA0NCA0NCcgZmlsbD0nbm9uZSc+PHBhdGggZD0nTTIyIDkgQzMwIDkgMzUuNSAxNCAzNS41IDIxLjUgQzM1LjUgMjkuNSAzMCAzNS41IDIxLjUgMzUuNSBDMTMuNSAzNS41IDguNSAyOS41IDguNSAyMS41IEM4LjUgMTQgMTQgOSAyMSA4LjcnIHN0cm9rZT0nI2QyMzA1Mycgc3Ryb2tlLXdpZHRoPScxLjcnIHN0cm9rZS1saW5lY2FwPSdyb3VuZCcvPjxwYXRoIGQ9J00yMyAxMC41IEMyOS41IDExIDMzLjUgMTUuNSAzMy41IDIxLjUgQzMzLjUgMjggMjguNSAzMyAyMS41IDMzIEMxNSAzMyAxMSAyOC41IDExIDIyIEMxMSAxNi41IDE1IDEyIDIwIDExJyBzdHJva2U9JyNlMjUwNmInIHN0cm9rZS13aWR0aD0nMScgc3Ryb2tlLWxpbmVjYXA9J3JvdW5kJyBvcGFjaXR5PScuNjUnLz48L3N2Zz4=") center/contain no-repeat;
  pointer-events: none;
}
.calendar-day.has-events { color: #d33b58; font-weight: 750; }

.calendar-day.selected.has-events:after { filter: brightness(0) invert(1); opacity: .9; }
.milestone-list { position: relative; padding-left: 20px; }
.milestone-list:before {
  content: "";
  position: absolute;
  left: 5px; top: 8px; bottom: 8px;
  width: 2px;
  border-radius: 2px;
  background: linear-gradient(#f2b8c6, #f7dde4);
}
.milestone-card { position: relative; border-radius: 62% 38% 55% 45% / 48% 60% 40% 52%; }
.milestone-card:before {
  content: "♥";
  position: absolute;
  left: -20px; top: 10px;
  width: 12px;
  color: #e2506b;
  font-size: 0.7rem;
  text-shadow: 0 0 0 #fff;
}
.calendar-agenda, .milestone-list { display: grid; gap: 9px; margin: 14px 0; text-align: left; }
.plan-card, .milestone-card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 10px;
  padding: 14px;
  border: 1px solid #f3e2e7;
  border-radius: 17px;
  background: #fff8fa;
}
.plan-card > div { display: grid; gap: 4px; }
.plan-card strong, .milestone-card strong { color: #593f48; }
.plan-card small, .milestone-card small { color: #9a8189; }
.plan-card p, .milestone-card p { margin: 4px 0; color: #715c64; line-height: 1.55; white-space: pre-wrap; }
.plan-kind {
  width: max-content;
  padding: 2px 8px;
  border-radius: 99px;
  background: #ffe7ed;
  color: #cb4963;
  font-size: 0.72rem;
  font-weight: 700;
}
.icon-delete {
  border: 0;
  background: transparent;
  color: #b799a1;
  font-size: 1.25rem;
  cursor: pointer;
}
.icon-delete:hover { color: #d74462; }
.feature-form {
  margin-top: 15px;
  padding: 14px;
  border: 1px solid #f0dfe4;
  border-radius: 18px;
  background: #fff;
  text-align: left;
  min-width: 0;
  overflow-x: clip;
}
.feature-form summary { color: #cc4e68; font-weight: 750; cursor: pointer; }
.feature-form form { margin-top: 12px; }
.feature-form.open-form { margin-bottom: 16px; }
.feature-form select {
  width: 100%;
  border: 1px solid #eadde1;
  border-radius: 14px;
  padding: 13px 14px;
  background: #fffafd;
  font: inherit;
}
.form-pair { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 10px; min-width: 0; }
.milestone-card { grid-template-columns: 78px 1fr auto; background: linear-gradient(145deg, #fff9f4, #fff7fa); }
.milestone-card time { color: #d35b70; font-size: 0.78rem; font-weight: 750; }
.milestone-card > div { display: grid; gap: 4px; }

@media (max-width: 520px) {
  .space-tab { font-size: 0.76rem; padding-inline: 2px; }
  .feature-head { align-items: flex-start; flex-direction: column; }
  .month-nav { width: 100%; justify-content: space-between; }
  .calendar-grid { gap: 2px; padding: 8px; }
  .calendar-day { font-size: 0.84rem; }
  .form-pair { grid-template-columns: minmax(0,1fr); gap: 0; }
  .milestone-card { grid-template-columns: 1fr auto; }
  .milestone-card time { grid-column: 1 / -1; }
}


/* ---- settings menu (v11) ---- */
.settings-menu {
  position: relative;
  flex: 0 0 auto;
  margin-left: auto;
  align-self: flex-start;
}
.settings-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid #f4d7de;
  border-radius: 50%;
  background: #fff;
  color: #b76e80;
  cursor: pointer;
  box-shadow: 0 6px 18px #9e526b1f;
  transition: transform 0.35s ease, color 0.2s ease, border-color 0.2s ease;
}
.settings-btn:hover,
.settings-btn:focus-visible {
  color: #d74462;
  border-color: #ffb1c1;
  transform: rotate(60deg);
  outline: none;
}
.settings-btn[aria-expanded="true"] {
  color: #d74462;
  border-color: #ffb1c1;
  transform: rotate(60deg);
  background: #fff7f9;
}
.settings-pop {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 40;
  display: grid;
  min-width: 168px;
  padding: 7px;
  border-radius: 18px;
  background: #ffffff;
  border: 1px solid #f4e1e6;
  box-shadow: 0 18px 45px #9e526b2e;
  animation: settings-pop-in 0.18s ease;
}
@keyframes settings-pop-in {
  from { opacity: 0; transform: translateY(-5px) scale(0.97); }
  to { opacity: 1; transform: none; }
}
.settings-pop button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 13px;
  border: 0;
  border-radius: 13px;
  background: none;
  color: #5d4a51;
  font: inherit;
  font-size: 0.95rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.settings-pop button:hover,
.settings-pop button:focus-visible {
  background: #fff2f5;
  color: #d74462;
  outline: none;
}
.settings-pop button.danger {
  color: #c2506b;
}
.settings-pop button.danger:hover,
.settings-pop button.danger:focus-visible {
  background: #ffeef1;
  color: #b32c4c;
}
.settings-pop[hidden] {
  display: none;
}
.settings-pop button svg {
  flex: 0 0 auto;
  opacity: 0.75;
}
@media (max-width: 520px) {
  .settings-btn {
    width: 38px;
    height: 38px;
  }
  .settings-pop {
    min-width: 156px;
  }
}

/* v13.1: topline text centered in box + gear stays top-right on mobile */
.topline { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.topline > div:first-child { flex: 1; min-width: 0; text-align: center; }
.settings-menu { margin-left: auto; position: relative; flex: 0 0 auto; }
.milestone-card .history-image { max-width: 100%; max-height: 220px; border-radius: 12px; object-fit: cover; cursor: zoom-in; }

/* v13.1: milestone image attach vs submit button spacing */
#milestone-form .image-attach { margin-top: 16px; margin-bottom: 4px; }
#milestone-form > .button.primary { margin-top: 14px; }

/* v13.1: form inputs never overflow card (iOS date/time intrinsic width) */
.feature-form .field { grid-template-columns: minmax(0, 1fr); }
.feature-form .field input,
.feature-form .field select,
.feature-form .field textarea { min-width: 0; }
.feature-form .field input,
.feature-form .field select,
.feature-form .field textarea {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.feature-form .field input[type="date"],
.feature-form .field input[type="time"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.feature-form .field input[type="date"] {
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239b8189' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='3'/%3E%3Cpath d='M8 3v4M16 3v4M3 10h18'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px 18px;
}
