:root {
  color-scheme: light;
  --paper: #fbf7ef;
  --ink: #1b1713;
  --muted: #6d6258;
  --hairline: #ded4c8;
  --panel: #fffdfa;
  --warm: #a64f2b;
  --warm-dark: #74351f;
  --green: #2f6d57;
  --blue: #315f7d;
  --shadow: 0 18px 50px rgba(52, 41, 30, 0.1);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100%;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 253, 249, 0.72), rgba(251, 247, 239, 0.94)),
    var(--paper);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

.shell {
  width: min(1120px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px clamp(16px, 4vw, 34px) 42px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--hairline);
  padding-bottom: 16px;
}

.brand {
  display: grid;
  gap: 3px;
}

.brand-row,
.person-title-row,
.icon-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.1rem, 6vw, 4.6rem);
  font-weight: 500;
  line-height: 0.92;
  letter-spacing: 0;
}

.version-pill,
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: rgba(255, 253, 249, 0.82);
  color: var(--muted);
  padding: 0 9px;
  font-size: 0.74rem;
  font-weight: 700;
}

.brand p,
.estimate-note,
.meta,
.empty-copy,
.field-hint,
.last-action,
.disclaimer {
  color: var(--muted);
}

.brand p {
  max-width: 52ch;
  margin: 0;
  font-size: 0.95rem;
}

.icon-button,
.text-button,
.primary-button,
.secondary-button,
.danger-button {
  min-height: 40px;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    background 140ms ease,
    color 140ms ease;
}

.icon-button:hover,
.text-button:hover,
.secondary-button:hover {
  border-color: #bbaea2;
  transform: translateY(-1px);
}

.icon-button {
  width: 42px;
  display: inline-grid;
  place-items: center;
}

.icon-button svg,
.inline-icon {
  width: 18px;
  height: 18px;
  stroke-width: 1.8;
}

.text-button,
.primary-button,
.secondary-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
}

.primary-button {
  border-color: var(--ink);
  background: var(--ink);
  color: white;
}

.primary-button:hover {
  background: #2b251f;
}

.danger-button {
  color: #7f251c;
}

.danger-button:hover {
  border-color: #cf8f83;
  background: #fff4f1;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
  gap: clamp(18px, 4vw, 34px);
  align-items: start;
  padding-top: 28px;
}

.intent-band {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--hairline);
  padding: 22px 0 24px;
}

.intent-band h2 {
  max-width: 760px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.9rem, 5vw, 4rem);
  font-weight: 500;
  line-height: 0.98;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--warm-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mode-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(84px, 1fr));
  min-width: 190px;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel);
}

.mode-toggle button {
  min-height: 40px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
}

.mode-toggle button.is-active {
  background: var(--ink);
  color: white;
}

.form-panel,
.summary-panel,
.person-card {
  min-width: 0;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: rgba(255, 253, 249, 0.86);
  box-shadow: var(--shadow);
}

.layout > * {
  min-width: 0;
}

.form-panel,
.summary-panel {
  padding: 18px;
}

.form-panel {
  position: sticky;
  top: 16px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}

.panel-title .field-hint {
  text-align: right;
  white-space: nowrap;
}

.panel-title h2,
.person-card h3,
.action-box h4 {
  margin: 0;
}

.panel-title h2 {
  font-size: 1.02rem;
  font-weight: 650;
}

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

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

label {
  display: grid;
  gap: 7px;
  font-size: 0.83rem;
  font-weight: 620;
}

input,
select {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  border: 1px solid #cfc4b8;
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 9px 10px;
  outline: none;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 3px solid rgba(49, 95, 125, 0.22);
  outline-offset: 2px;
}

input[type="range"] {
  min-height: 24px;
  padding: 0;
  accent-color: var(--warm);
}

.field-hint {
  min-height: 18px;
  font-size: 0.78rem;
  font-weight: 500;
}

.privacy-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  border: 1px solid rgba(47, 109, 87, 0.16);
  border-radius: 8px;
  background: rgba(47, 109, 87, 0.06);
  color: #345b4b;
  padding: 10px 12px;
  font-size: 0.82rem;
  line-height: 1.35;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 4px;
}

.summary-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.shell-v2 .summary-panel {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat {
  min-height: 86px;
  border-left: 2px solid var(--hairline);
  padding-left: 12px;
}

.stat strong {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.8rem, 4vw, 2.7rem);
  font-weight: 500;
  line-height: 1;
}

.stat span {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.82rem;
}

.people-list {
  display: grid;
  gap: 16px;
}

.empty-state {
  min-height: 460px;
  display: grid;
  place-items: center;
  border: 1px dashed #c9bdb1;
  border-radius: 8px;
  padding: 34px;
  background: rgba(255, 253, 249, 0.58);
  text-align: center;
}

.empty-state h2 {
  max-width: 650px;
  margin: 0 auto 12px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.2rem, 8vw, 5.5rem);
  font-weight: 500;
  line-height: 0.98;
  letter-spacing: 0;
}

.empty-copy {
  max-width: 44ch;
  margin: 0 auto 24px;
  line-height: 1.55;
}

.person-card {
  padding: clamp(16px, 3vw, 24px);
}

.person-card.needs-reconnect {
  border-color: rgba(166, 79, 43, 0.34);
}

.person-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.person-card h3 {
  font-size: clamp(1.2rem, 3vw, 1.55rem);
}

.meta {
  margin-top: 3px;
  font-size: 0.84rem;
}

.estimate-row {
  display: grid;
  grid-template-columns: minmax(0, 0.72fr) minmax(220px, 1fr);
  gap: 18px;
  align-items: center;
  margin: 20px 0 16px;
}

.estimate-number {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(4rem, 12vw, 8.8rem);
  font-weight: 500;
  line-height: 0.86;
}

.estimate-note {
  margin-top: 10px;
  font-size: 0.92rem;
}

.estimate-detail {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.dot-grid {
  display: grid;
  grid-template-columns: repeat(20, minmax(0, 1fr));
  gap: 5px;
  min-height: 84px;
  max-height: 210px;
  overflow: hidden;
  border: 1px solid #eadfd3;
  border-radius: 8px;
  background: #fff9f0;
  padding: 12px;
}

.dot {
  aspect-ratio: 1;
  min-width: 5px;
  border: 1px solid rgba(27, 23, 19, 0.72);
  border-radius: 999px;
  background: #fffdfa;
}

.dot.is-muted {
  border-color: rgba(27, 23, 19, 0.18);
}

.relationship-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: -2px 0 14px;
  color: var(--muted);
  font-size: 0.82rem;
}

.relationship-row span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.relationship-row .inline-icon {
  width: 15px;
  height: 15px;
}

.action-box {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(47, 109, 87, 0.18);
  border-radius: 8px;
  background: rgba(47, 109, 87, 0.08);
  padding: 14px;
}

.action-box h4 {
  color: var(--green);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.action-box p {
  margin: 0;
  line-height: 1.48;
  overflow-wrap: anywhere;
}

.action-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.reflection-box {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  border-top: 1px solid rgba(47, 109, 87, 0.14);
  padding-top: 10px;
  color: #345b4b;
  font-size: 0.84rem;
}

.reflection-box button {
  min-height: 32px;
  border: 1px solid rgba(47, 109, 87, 0.2);
  border-radius: 999px;
  background: rgba(255, 253, 249, 0.72);
  color: #274b3e;
  padding: 0 10px;
}

.last-action {
  font-size: 0.82rem;
}

.disclaimer {
  max-width: 72ch;
  margin: 28px 0 0;
  border-top: 1px solid var(--hairline);
  padding-top: 16px;
  font-size: 0.78rem;
  line-height: 1.5;
}

.disclaimer a,
.policy a {
  color: var(--warm-dark);
}

.policy {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 36px clamp(16px, 5vw, 32px) 56px;
}

.policy h1 {
  margin: 0 0 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.6rem, 9vw, 5rem);
  font-weight: 500;
  line-height: 0.96;
  letter-spacing: 0;
}

.policy h2 {
  margin: 30px 0 10px;
  font-size: 1.1rem;
}

.policy p,
.policy li {
  color: #463c34;
  line-height: 1.62;
}

.policy ul {
  padding-left: 20px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: min(320px, calc(100vw - 36px));
  border: 1px solid rgba(49, 95, 125, 0.22);
  border-radius: 8px;
  background: #f4fbff;
  color: #17384e;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  transform: translateY(18px);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 820px) {
  .shell {
    padding-top: 16px;
  }

  .topbar {
    align-items: end;
  }

  .intent-band {
    align-items: start;
    flex-direction: column;
  }

  .mode-toggle {
    width: 100%;
  }

  .layout,
  .estimate-row {
    grid-template-columns: 1fr;
  }

  .form-panel {
    position: static;
  }

  .summary-panel {
    grid-template-columns: 1fr;
  }

  .stat {
    min-height: auto;
  }
}

@media (max-width: 520px) {
  .shell {
    overflow-x: hidden;
  }

  .topbar {
    align-items: start;
  }

  .brand-row {
    align-items: end;
  }

  .brand p {
    max-width: 30ch;
  }

  .topbar .text-button {
    width: 42px;
    padding: 0;
  }

  .topbar .button-label {
    display: none;
  }

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

  .panel-title {
    align-items: start;
  }

  .panel-title .field-hint {
    max-width: 10ch;
    white-space: normal;
  }

  .person-head {
    align-items: start;
    flex-direction: column;
  }

  .icon-row {
    align-self: stretch;
    justify-content: flex-end;
  }

  .dot-grid {
    grid-template-columns: repeat(14, minmax(0, 1fr));
  }
}
