:root {
  --bg: #f2e4c8;
  --bg-accent: #e9d9b6;
  --surface: rgba(253, 247, 236, 0.84);
  --surface-strong: rgba(255, 249, 238, 0.96);
  --text: #18120f;
  --muted: #43382b;
  --line: rgba(24, 18, 15, 0.12);
  --primary: #283224;
  --primary-deep: #1d2419;
  --accent: #d8a640;
  --accent-strong: #ad7420;
  --warning: #a85a2b;
  --shadow: 0 24px 60px rgba(55, 38, 17, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 8%, rgba(255, 255, 255, 0.75), transparent 24%),
    radial-gradient(circle at 85% 16%, rgba(216, 166, 64, 0.18), transparent 22%),
    radial-gradient(circle at 82% 72%, rgba(40, 50, 36, 0.12), transparent 19%),
    linear-gradient(180deg, #f5ead3 0%, #efe1c5 48%, #f3e7d0 100%);
  scroll-behavior: smooth;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(24, 18, 15, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(24, 18, 15, 0.025) 1px, transparent 1px);
  background-size: 36px 36px;
  opacity: 0.55;
}

.page-shell {
  position: relative;
  max-width: 1280px;
  margin: 0 auto;
  padding: 40px 20px 48px;
}

.site-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid rgba(24, 18, 15, 0.08);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 249, 239, 0.98), rgba(248, 239, 222, 0.88));
  box-shadow: 0 18px 48px rgba(80, 56, 26, 0.12);
  backdrop-filter: blur(18px);
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.site-brand__mark {
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary) 0%, #3d4934 100%);
  color: #fbf5ea;
  font-size: 0.95rem;
  font-weight: 800;
}

.site-brand__text {
  display: grid;
  gap: 2px;
}

.site-brand__text strong {
  font-family: "Fraunces", serif;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
}

.site-brand__text span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.topbar-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(24, 18, 15, 0.08);
  background: rgba(255, 249, 238, 0.82);
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
}

.hero {
  display: grid;
  grid-template-columns: 1.3fr 0.9fr;
  gap: 24px;
  align-items: stretch;
  margin-bottom: 28px;
}

.hero-copy,
.status-panel,
.card {
  border: 1px solid var(--line);
  background: var(--surface);
  backdrop-filter: blur(18px);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 34px;
}

.eyebrow,
.section-label,
.status-kicker {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-strong);
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Manrope", sans-serif;
  font-weight: 800;
  letter-spacing: -0.05em;
}

h1 {
  font-size: clamp(2.4rem, 6vw, 4.4rem);
  line-height: 0.96;
  max-width: 12ch;
}

.hero-text,
.meta,
.helper-text,
.message-bubble p,
.history-list,
label,
textarea,
input,
select,
button {
  font-size: 0.98rem;
}

.hero-text,
.meta,
.helper-text,
.message-bubble p,
.history-item-meta,
#status-text {
  color: var(--muted);
}

.hero-text {
  max-width: 58ch;
  margin-top: 18px;
  line-height: 1.7;
}

.status-panel {
  padding: 28px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.status-panel h2 {
  font-size: 1.9rem;
  margin-bottom: 12px;
}

.status-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(40, 50, 36, 0.09);
  color: var(--primary-deep);
  font-weight: 700;
}

.pill.complete {
  background: rgba(40, 50, 36, 0.18);
}

.pill.pending {
  background: rgba(168, 90, 43, 0.15);
  color: var(--warning);
}

.dashboard {
  display: grid;
  grid-template-columns: 1.15fr 1.15fr 0.78fr;
  gap: 24px;
  align-items: start;
}

.ritual-rail {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 22px;
}

.rail-chip,
.count-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 800;
  text-decoration: none;
}

.rail-chip {
  color: var(--primary-deep);
  background: rgba(255, 253, 247, 0.9);
  border: 1px solid rgba(24, 18, 15, 0.1);
}

.count-chip {
  color: var(--primary-deep);
  background: rgba(216, 166, 64, 0.14);
}

.card {
  padding: 26px;
}

.prompt-card {
  min-height: 100%;
}

.side-card {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.support-panel {
  gap: 0;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
  margin-bottom: 22px;
}

.section-heading.compact {
  margin-bottom: 0;
}

.section-heading h2 {
  font-size: 1.65rem;
}

.support-summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  cursor: pointer;
}

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

.support-summary-meta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(47, 106, 79, 0.09);
  color: var(--primary-deep);
  font-weight: 800;
  white-space: nowrap;
}

.support-panel-body {
  display: grid;
  gap: 22px;
  margin-top: 20px;
}

.optional-drawer {
  margin-top: 18px;
  border: 1px solid rgba(47, 106, 79, 0.12);
  border-radius: 20px;
  background: rgba(255, 253, 247, 0.72);
}

.drawer-summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  cursor: pointer;
}

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

.drawer-summary h3 {
  font-size: 1.08rem;
}

.drawer-body {
  padding: 0 18px 18px;
}

.goal-link-drawer .meta {
  margin: 0 0 14px;
}

.quick-entity-block,
.starter-entity-block {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.quick-entity-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-entity-chip,
.starter-entity-btn {
  padding: 10px 12px;
  border-radius: 999px;
  font-size: 0.9rem;
}

.entity-filter-bar {
  display: grid;
  gap: 12px;
}

.heading-meta {
  display: grid;
  gap: 8px;
  justify-items: end;
  text-align: right;
}

.goal-form {
  display: grid;
  gap: 14px;
}

.monthly-grid {
  grid-template-columns: 1fr;
}

.goal-row {
  display: grid;
  gap: 8px;
}

.goal-row span {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--primary-deep);
}

.field-wrap {
  display: grid;
  gap: 8px;
  margin-top: 20px;
}

label {
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(47, 106, 79, 0.16);
  background: var(--surface-strong);
  color: var(--text);
  font-family: inherit;
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: rgba(47, 106, 79, 0.4);
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(47, 106, 79, 0.12);
}

textarea {
  resize: vertical;
}

.template-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}

.primary-btn {
  border: none;
  border-radius: 16px;
  padding: 15px 18px;
  background: linear-gradient(135deg, var(--primary), #3d4934);
  color: #f9f6ef;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 14px 28px rgba(40, 50, 36, 0.22);
}

.primary-btn:hover {
  background: linear-gradient(135deg, var(--primary-deep), var(--primary));
}

.secondary-btn {
  border: 1px solid rgba(24, 18, 15, 0.12);
  border-radius: 16px;
  padding: 14px 16px;
  background: rgba(255, 253, 247, 0.88);
  color: var(--primary-deep);
  font-weight: 800;
  cursor: pointer;
}

.secondary-btn:hover {
  background: rgba(24, 18, 15, 0.06);
}

.backup-actions {
  display: grid;
  gap: 12px;
}

.entity-link-list {
  display: grid;
  gap: 12px;
}

.entity-link-row {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(47, 106, 79, 0.12);
  background: rgba(255, 253, 247, 0.82);
}

.entity-link-label {
  font-weight: 800;
  color: var(--text);
}

.entity-link-helper {
  color: var(--muted);
  font-size: 0.9rem;
}

.archive-toolbar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.archive-filter-bar {
  display: grid;
  gap: 8px;
}

.archive-tab {
  border: 1px solid rgba(47, 106, 79, 0.14);
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(255, 253, 247, 0.78);
  color: var(--primary-deep);
  font-weight: 800;
  cursor: pointer;
}

.archive-tab.is-active {
  background: rgba(47, 106, 79, 0.14);
  border-color: rgba(47, 106, 79, 0.24);
}

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

.archive-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.archive-list-item {
  margin: 0;
}

.archive-entry-btn {
  width: 100%;
  text-align: left;
  border: 1px solid rgba(47, 106, 79, 0.1);
  border-radius: 18px;
  padding: 14px 16px;
  background: rgba(255, 253, 247, 0.88);
  color: inherit;
  cursor: pointer;
}

.archive-entry-btn.is-active {
  border-color: rgba(47, 106, 79, 0.3);
  background: linear-gradient(145deg, rgba(47, 106, 79, 0.12), rgba(255, 253, 247, 0.94));
}

.archive-preview {
  min-height: 180px;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid rgba(47, 106, 79, 0.12);
  background: rgba(255, 253, 247, 0.88);
  display: grid;
  gap: 14px;
}

.archive-preview-header {
  display: grid;
  gap: 6px;
}

.archive-preview-meta {
  color: var(--muted);
}

.archive-goals {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
}

.archive-note {
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(47, 106, 79, 0.07);
  color: var(--muted);
}

.goal-entity-badge,
.entity-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(47, 106, 79, 0.12);
  color: var(--primary-deep);
  font-size: 0.86rem;
  font-weight: 800;
}

.entity-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 12px;
}

.entity-detail-panel,
.entity-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(47, 106, 79, 0.12);
  background: rgba(255, 253, 247, 0.88);
}

.entity-card.is-selected,
.entity-detail-panel {
  background: linear-gradient(145deg, rgba(47, 106, 79, 0.12), rgba(255, 253, 247, 0.95));
  border-color: rgba(47, 106, 79, 0.24);
}

.entity-card-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.entity-detail-header {
  display: grid;
  gap: 10px;
}

.entity-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.entity-type-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(168, 90, 43, 0.12);
  color: var(--warning);
  font-size: 0.86rem;
  font-weight: 800;
}

.entity-card-notes {
  color: var(--muted);
}

.entity-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.entity-inline-form {
  display: grid;
  gap: 14px;
}

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

.entity-stat-card {
  display: grid;
  gap: 6px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(47, 106, 79, 0.1);
  background: rgba(255, 253, 247, 0.9);
}

.entity-stat-label {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.entity-stat-value {
  color: var(--primary-deep);
  font-size: 1.02rem;
}

.entity-detail-recent {
  display: grid;
  gap: 10px;
}

.entity-detail-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.entity-detail-list li {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(47, 106, 79, 0.1);
  background: rgba(255, 253, 247, 0.86);
}

.entity-action-btn {
  padding: 10px 12px;
  border-radius: 14px;
}

.reminder-health {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid rgba(47, 106, 79, 0.12);
  background: rgba(255, 253, 247, 0.88);
}

.reminder-health-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
}

.reminder-health-row strong {
  color: var(--primary-deep);
  text-align: right;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(47, 106, 79, 0.12);
  background: rgba(255, 253, 247, 0.88);
}

.toggle-row input[type="checkbox"] {
  width: 22px;
  height: 22px;
  accent-color: var(--primary);
  flex: 0 0 auto;
}

.window-grid {
  display: grid;
  gap: 14px;
}

.inline-field {
  margin-top: 0;
}

.message-stack {
  display: grid;
  gap: 14px;
}

.message-bubble {
  padding: 18px;
  border-radius: 22px 22px 22px 8px;
  border: 1px solid rgba(47, 106, 79, 0.12);
  background: rgba(255, 253, 247, 0.88);
}

.message-bubble.active {
  background: linear-gradient(145deg, rgba(47, 106, 79, 0.16), rgba(255, 253, 247, 0.92));
}

.message-title {
  margin: 0 0 8px;
  color: var(--text);
  font-weight: 800;
}

.history-block {
  display: grid;
  gap: 10px;
}

.history-block h3 {
  font-size: 1.15rem;
}

.history-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 12px;
}

.history-list li {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 253, 247, 0.88);
  border: 1px solid rgba(47, 106, 79, 0.1);
}

.history-item-title {
  display: block;
  margin-bottom: 4px;
  font-weight: 800;
  color: var(--text);
}

.empty-state {
  color: var(--muted);
  font-style: italic;
}

.card[id] {
  scroll-margin-top: 110px;
}

.mobile-action-bar {
  display: none;
}

.mobile-action-btn {
  width: 100%;
}

@media (max-width: 1100px) {
  .hero,
  .dashboard {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .page-shell {
    padding: 16px 12px 100px;
  }

  .site-topbar {
    flex-direction: column;
    align-items: stretch;
    border-radius: 24px;
  }

  .hero-copy,
  .status-panel,
  .card {
    border-radius: 22px;
    padding: 18px;
  }

  .section-heading {
    flex-direction: column;
    align-items: start;
  }

  .section-heading h2 {
    font-size: 1.4rem;
  }

  .heading-meta {
    width: 100%;
    justify-items: start;
    text-align: left;
  }

  .ritual-rail {
    position: sticky;
    top: 10px;
    z-index: 10;
    padding: 8px;
    border-radius: 20px;
    background: rgba(244, 239, 227, 0.92);
    backdrop-filter: blur(14px);
  }

  .rail-chip {
    flex: 1 1 calc(33.333% - 7px);
    min-width: 0;
    font-size: 0.92rem;
    padding: 12px 10px;
  }

  .goal-form {
    gap: 12px;
  }

  .support-summary {
    align-items: start;
  }

  .support-summary-meta {
    font-size: 0.88rem;
    padding: 8px 10px;
  }

  .support-panel-body {
    margin-top: 16px;
    gap: 16px;
  }

  .drawer-summary {
    padding: 14px 16px;
    align-items: start;
  }

  .drawer-body {
    padding: 0 16px 16px;
  }

  input,
  textarea,
  select {
    padding: 13px 14px;
  }

  .field-wrap {
    margin-top: 16px;
  }

  .archive-toolbar {
    grid-template-columns: 1fr;
  }

  .entity-detail-stats {
    grid-template-columns: 1fr;
  }

  .archive-preview {
    min-height: 0;
  }

  .entity-card-header {
    flex-direction: column;
  }

  .entity-card-actions {
    flex-direction: column;
  }

  .quick-entity-chips {
    align-items: stretch;
  }

  .quick-entity-chip,
  .starter-entity-btn {
    width: 100%;
    justify-content: center;
  }

  .reminder-health-row {
    align-items: start;
    flex-direction: column;
    gap: 4px;
  }

  .mobile-action-bar {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 20;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 10px;
    border: 1px solid rgba(47, 106, 79, 0.12);
    border-radius: 22px;
    background: rgba(255, 252, 245, 0.94);
    backdrop-filter: blur(18px);
    box-shadow: 0 18px 34px rgba(53, 43, 22, 0.16);
  }

  .mobile-action-btn {
    padding: 14px 12px;
  }
}
