:root {
  --bg: #fbf5f1;
  --bg-soft: #f6efe8;
  --surface: rgba(255, 255, 255, 0.84);
  --surface-strong: rgba(255, 255, 255, 0.92);
  --line: rgba(107, 92, 101, 0.12);
  --shadow: 0 18px 40px rgba(105, 79, 89, 0.12);
  --text: #2f2730;
  --muted: #7d6d73;
  --accent: #c88892;
  --accent-deep: #9e5f69;
  --sage: #8fa5a1;
  --sage-deep: #69817d;
  --success: #6e8e79;
  --danger: #b65f61;
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: linear-gradient(180deg, #fffdfb 0%, var(--bg) 100%); }
body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(200, 136, 146, 0.14), transparent 28%),
    radial-gradient(circle at top right, rgba(143, 165, 161, 0.14), transparent 24%),
    linear-gradient(180deg, #fffdfb 0%, var(--bg) 100%);
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
img { max-width: 100%; display: block; }

#mobile-page { min-height: 100vh; }
.app-shell { max-width: 560px; margin: 0 auto; padding: 18px 16px 104px; }
.app-shell--loading { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding-bottom: 0; }
.screen-content { display: grid; gap: 14px; }

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0 16px;
  background: linear-gradient(180deg, rgba(251, 245, 241, 0.96), rgba(251, 245, 241, 0.82) 72%, transparent);
  backdrop-filter: blur(16px);
}

.brand-lockup { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  width: 46px;
  height: 46px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,0.82);
  background:
    radial-gradient(circle at 30% 24%, rgba(255,255,255,0.98), rgba(255,255,255,0.88) 56%, rgba(248, 240, 236, 0.92) 100%);
  box-shadow:
    0 16px 30px rgba(105, 79, 89, 0.14),
    inset 0 1px 0 rgba(255,255,255,0.88);
  padding: 5px;
}
.brand-mark::before {
  content: "";
  position: absolute;
  inset: -14px;
  z-index: -1;
  background: radial-gradient(circle, rgba(200, 136, 146, 0.24), rgba(200, 136, 146, 0) 72%);
  filter: blur(6px);
}
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 13px;
  border: 1px solid rgba(47, 39, 48, 0.08);
  background: linear-gradient(150deg, rgba(255,255,255,0.4), rgba(255,255,255,0));
}
.brand-logo {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.brand-lockup strong { display: block; font-family: "Playfair Display", Georgia, serif; font-size: 1.26rem; letter-spacing: -0.02em; }
.brand-lockup small { display: block; max-width: 20ch; color: var(--muted); font-size: 0.77rem; line-height: 1.35; }
.topbar-actions { margin-left: auto; }
.topbar-select, .input, .select, .textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,0.88);
  color: var(--text);
  padding: 14px 15px;
  outline: none;
}
.demo-switch { display: inline-flex; padding: 4px; gap: 4px; background: rgba(255,255,255,0.7); border-radius: 999px; border: 1px solid var(--line); }
.demo-switch__btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 10px;
}
.demo-switch__btn.is-active { background: var(--text); color: #fff; }

.hero-card, .card, .loading-card, .capture-card, .feed-card, .profile-card {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.5);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  border-radius: var(--radius-xl);
}
.hero-card, .card, .capture-card, .profile-card { padding: 20px; }
.card--compact { padding: 16px; }
.card--flash {
  border-color: rgba(110, 142, 121, 0.18);
  background: rgba(248, 254, 250, 0.94);
  animation: fadeUp 0.45s ease;
}
.loading-card {
  max-width: 360px;
  text-align: center;
  padding: 28px 24px;
}
.loading-card__brand {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  width: 76px;
  height: 76px;
  margin: 0 auto 14px;
  padding: 8px;
  border-radius: 26px;
  border: 1px solid rgba(255,255,255,0.86);
  background:
    radial-gradient(circle at 32% 24%, rgba(255,255,255,1), rgba(255,255,255,0.9) 56%, rgba(248, 240, 236, 0.94) 100%);
  box-shadow:
    0 20px 38px rgba(105, 79, 89, 0.14),
    inset 0 1px 0 rgba(255,255,255,0.92);
}
.loading-card__brand::before {
  content: "";
  position: absolute;
  inset: -18px;
  z-index: -1;
  background: radial-gradient(circle, rgba(200, 136, 146, 0.22), rgba(200, 136, 146, 0) 72%);
  filter: blur(8px);
}
.loading-card__brand::after {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 20px;
  border: 1px solid rgba(47, 39, 48, 0.08);
  background: linear-gradient(150deg, rgba(255,255,255,0.44), rgba(255,255,255,0));
}
.loading-card__logo {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.loading-card__spinner {
  width: 44px; height: 44px; margin: 0 auto 16px; border-radius: 50%;
  border: 4px solid rgba(200, 136, 146, 0.2);
  border-top-color: var(--accent-deep);
  animation: spin 1s linear infinite;
}

.eyebrow { text-transform: uppercase; letter-spacing: 0.16em; color: var(--muted); font-size: 0.72rem; font-weight: 700; margin: 0 0 8px; }
.hero-title, .section-title, .card-title {
  margin: 0;
  font-family: "Playfair Display", Georgia, serif;
  letter-spacing: -0.03em;
}
.hero-title { font-size: clamp(2rem, 6vw, 2.55rem); line-height: 0.96; }
.hero-title--compact { font-size: clamp(1.7rem, 5vw, 2.15rem); line-height: 1.02; }
.hero-copy, .card-copy, .section-copy, .help-text { color: var(--muted); line-height: 1.6; }

.phase-pill, .chip, .memory-meta, .jump-pill, .stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.7);
  color: var(--text);
  font-size: 0.85rem;
}
.phase-pill { background: rgba(200, 136, 146, 0.13); color: var(--accent-deep); border-color: rgba(200, 136, 146, 0.22); }
.stat-pill--success {
  background: rgba(110, 142, 121, 0.12);
  color: var(--success);
  border-color: rgba(110, 142, 121, 0.22);
}
.chip.is-active, .filter-pill.is-active, .capture-tile.is-active {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
  color: #fff;
  border-color: transparent;
}

.stack-xs { display: grid; gap: 6px; }
.stack-sm { display: grid; gap: 10px; }
.stack-md { display: grid; gap: 14px; }
.grid-2 { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { display: grid; gap: 10px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.quick-row, .filter-row, .chips-row { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.quick-row::-webkit-scrollbar, .filter-row::-webkit-scrollbar, .chips-row::-webkit-scrollbar { display: none; }
.quick-row--tight { gap: 8px; }
.quick-row--composer {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  overflow: visible;
}
.quick-row--composer .composer-save { grid-column: 1 / -1; }
.chips-row--quiet { gap: 8px; }
.filter-row--secondary { padding-top: 2px; }

.button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 14px 18px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
}
.button--primary { background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%); color: #fff; box-shadow: 0 14px 28px rgba(158, 95, 105, 0.24); }
.button--secondary { background: rgba(255,255,255,0.7); color: var(--text); border: 1px solid var(--line); }
.button--sage { background: linear-gradient(135deg, var(--sage) 0%, var(--sage-deep) 100%); color: #fff; }
.button--full { width: 100%; }
.button--hero { min-height: 56px; font-size: 1.02rem; }

.summary-grid, .metric-grid, .stats-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.metric-card, .stat-card {
  padding: 16px;
  background: rgba(255,255,255,0.64);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.metric-card--compact { padding: 14px; }
.metric-value, .stat-value { display: block; font-size: 1.1rem; font-weight: 700; margin-top: 8px; }
.metric-label, .stat-label { color: var(--muted); font-size: 0.86rem; }

.media-strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(164px, 1fr); gap: 10px; overflow-x: auto; padding-bottom: 2px; }
.media-thumb {
  aspect-ratio: 3 / 4;
  border-radius: 22px;
  overflow: hidden;
  background: var(--bg-soft);
  position: relative;
}
.media-thumb img { width: 100%; height: 100%; object-fit: cover; }
.media-thumb__label {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(47, 39, 48, 0.62);
  color: #fff;
  font-size: 0.85rem;
}

.feed-search {
  position: static;
  top: auto;
  z-index: auto;
  padding-top: 0;
  background: none;
}
.filter-pill, .capture-tile {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.76);
  border-radius: 20px;
  padding: 12px 14px;
  white-space: nowrap;
  color: var(--text);
}
.capture-grid { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.capture-tile { text-align: left; min-height: 86px; }
.capture-tile strong, .feed-card strong { display: block; }
.chip--soft {
  background: rgba(255,255,255,0.5);
  color: var(--muted);
}

.feed-group { display: grid; gap: 10px; }
.feed-group__title { margin: 0; padding: 0 4px; font-size: 0.95rem; color: var(--muted); text-transform: capitalize; }
.feed-group__titlewrap { padding: 0 4px; }
.feed-card {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 14px;
  padding: 14px;
}
.feed-card--memory {
  border-radius: 24px;
  padding: 16px;
}
.feed-card.is-new {
  border-color: rgba(200, 136, 146, 0.26);
  animation: flashPulse 0.7s ease;
}
.feed-card[data-tone="neutral"] { background: rgba(255,255,255,0.82); }
.feed-card[data-tone="accent"] { background: rgba(255, 248, 247, 0.9); }
.feed-card[data-tone="calm"] { background: rgba(245, 250, 249, 0.92); }
.feed-card[data-tone="sage"] { background: rgba(242, 248, 247, 0.92); }
.feed-card__media {
  width: 72px;
  aspect-ratio: 1;
  border-radius: 18px;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(200,136,146,0.2), rgba(143,165,161,0.26));
  display: grid;
  place-items: center;
  font-weight: 700;
  color: var(--accent-deep);
}
.feed-card__media--memory {
  width: 84px;
  border-radius: 20px;
}
.feed-card__media img { width: 100%; height: 100%; object-fit: cover; }
.feed-card__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.feed-card__copy { color: var(--muted); margin: 8px 0 10px; line-height: 1.55; }

.hero-card--compact { gap: 12px; }
.hero-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.capture-card--fast {
  padding: 18px;
}

.composer-textarea {
  width: 100%;
  min-height: 158px;
  border: 1px solid rgba(107, 92, 101, 0.11);
  border-radius: 24px;
  background: rgba(255,255,255,0.92);
  color: var(--text);
  padding: 18px 18px 20px;
  font: inherit;
  font-size: 1.02rem;
  line-height: 1.55;
  resize: vertical;
  outline: none;
}

.composer-textarea:focus,
.input:focus,
.select:focus,
.textarea:focus,
.topbar-select:focus {
  border-color: rgba(200, 136, 146, 0.34);
  box-shadow: 0 0 0 4px rgba(200, 136, 146, 0.1);
}

.composer-file {
  width: 100%;
}

.composer-meta {
  padding-top: 6px;
}

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

.segmented-row {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.72);
  border: 1px solid var(--line);
}

.segment-button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
}

.segment-button.is-active {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
  color: #fff;
  box-shadow: 0 12px 22px rgba(158, 95, 105, 0.2);
}

.growth-card {
  overflow: hidden;
}

.growth-chart-wrap {
  position: relative;
  min-height: 280px;
  padding: 16px 10px 4px;
  border-radius: 24px;
  background: rgba(255,255,255,0.64);
  border: 1px solid var(--line);
}

.growth-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.growth-legend span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.growth-legend i {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  display: inline-block;
}

.measurement-list {
  display: grid;
  gap: 10px;
}

.measurement-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 20px;
  background: rgba(255,255,255,0.7);
  border: 1px solid var(--line);
}

.measurement-item p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.item-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.item-action-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.82);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
}

.item-action-btn--danger {
  color: var(--danger);
  border-color: rgba(182, 95, 97, 0.2);
  background: rgba(255, 245, 245, 0.92);
}

.field { display: grid; gap: 8px; }
.field label { font-weight: 700; font-size: 0.92rem; }
.textarea { min-height: 120px; resize: vertical; }
.split { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-note {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(143, 165, 161, 0.14);
  color: var(--sage-deep);
  border: 1px solid rgba(143, 165, 161, 0.2);
}

.empty-state, .banner {
  padding: 18px;
  border-radius: 22px;
  background: rgba(255,255,255,0.76);
  border: 1px solid var(--line);
}
.banner--demo { background: rgba(255, 250, 244, 0.88); }
.banner--quiet { background: rgba(245, 250, 249, 0.82); }

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  width: min(528px, calc(100vw - 20px));
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border-radius: 28px;
  background: rgba(47, 39, 48, 0.92);
  box-shadow: 0 26px 44px rgba(32, 27, 33, 0.28);
  backdrop-filter: blur(20px);
}
.bottom-nav__item {
  color: rgba(255,255,255,0.72);
  border-radius: 20px;
  padding: 10px 6px;
  display: grid;
  justify-items: center;
  gap: 4px;
  font-size: 0.78rem;
}
.bottom-nav__item.is-active { background: rgba(255,255,255,0.12); color: #fff; }
.bottom-nav__icon {
  width: 28px; height: 28px; border-radius: 999px; display: grid; place-items: center;
  background: rgba(255,255,255,0.12); font-size: 0.72rem; font-weight: 700;
}
.bottom-nav__item.is-active .bottom-nav__icon { background: linear-gradient(135deg, var(--accent) 0%, var(--sage) 100%); }

#app-toast {
  position: fixed;
  left: 50%;
  bottom: 104px;
  transform: translateX(-50%);
  z-index: 40;
  width: min(460px, calc(100vw - 32px));
}
.app-toast {
  padding: 14px 18px;
  border-radius: 18px;
  background: rgba(47, 39, 48, 0.94);
  color: #fff;
  box-shadow: var(--shadow);
}
.app-toast--success { background: rgba(110, 142, 121, 0.96); }
.app-toast--error { background: rgba(182, 95, 97, 0.96); }

.manage-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(28, 24, 28, 0.48);
  backdrop-filter: blur(10px);
  display: grid;
  align-items: end;
  padding: 14px;
}

.manage-modal {
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
  background: rgba(255,255,255,0.96);
  border: 1px solid rgba(255,255,255,0.7);
  box-shadow: 0 24px 48px rgba(32, 27, 33, 0.22);
  border-radius: 28px 28px 18px 18px;
  padding: 20px;
}

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

.manage-close {
  appearance: none;
  border: 0;
  background: rgba(47,39,48,0.08);
  color: var(--text);
  width: 38px;
  height: 38px;
  border-radius: 999px;
  font-size: 1.3rem;
  cursor: pointer;
}

.manage-actions {
  display: grid;
  gap: 10px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (min-width: 700px) {
  .app-shell { max-width: 740px; }
  .screen-content { gap: 18px; }
  .hero-title { font-size: 3rem; }
  .split-desktop { display: grid; gap: 16px; grid-template-columns: 1.1fr 0.9fr; }
  .feed-card { grid-template-columns: 94px 1fr; }
  .feed-card__media { width: 94px; }
  .quick-row--composer {
    grid-template-columns: 1fr 1fr 1fr;
  }
  .quick-row--composer .composer-save {
    grid-column: auto;
  }
  .manage-modal-backdrop { align-items: center; }
  .manage-modal { border-radius: 28px; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes flashPulse {
  0% { transform: translateY(6px); box-shadow: 0 10px 22px rgba(105, 79, 89, 0.08); }
  100% { transform: translateY(0); box-shadow: var(--shadow); }
}

@keyframes fadeUp {
  0% { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}
