:root {
  color-scheme: light;
  --bg: #f7f4ee;
  --panel: #fffdf8;
  --ink: #221e1d;
  --muted: #756967;
  --line: rgba(73, 55, 51, .16);
  --blood: #9f3041;
  --blood-dark: #5f2130;
  --teal: #497b78;
  --amber: #b57b42;
  --band: rgba(73, 123, 120, .11);
  --shadow: 0 18px 45px rgba(53, 42, 38, .08);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 78% -10%, rgba(159, 48, 65, .13), transparent 36%),
    linear-gradient(180deg, #f5eee8 0%, var(--bg) 46%, #fbfaf6 100%);
  color: var(--ink);
  font: 15px/1.42 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
}

button {
  font: inherit;
  letter-spacing: 0;
}

.suite-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 18px 0 8px;
}

.suite-brand-cluster,
.suite-app-brand,
.suite-topbar-actions {
  display: inline-flex;
  align-items: center;
}

.suite-brand-cluster {
  gap: 8px;
  min-width: 0;
}

.suite-ao-home,
.suite-app-brand,
.suite-topbar-actions a {
  text-decoration: none;
}

.suite-ao-home {
  display: inline-grid;
  width: 40px;
  height: 40px;
  place-items: center;
}

.suite-ao-home img {
  display: block;
  width: 38px;
  height: 38px;
}

.suite-app-brand {
  gap: 8px;
  min-width: 0;
  font-size: 15px;
  font-weight: 780;
  text-transform: lowercase;
}

.suite-app-mark {
  width: 32px;
  height: 32px;
}

.suite-topbar-actions {
  gap: 4px;
}

.suite-topbar-actions a {
  display: inline-grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  color: var(--blood-dark);
}

.readings-icon,
.sync-icon {
  position: relative;
  display: block;
  width: 16px;
  height: 16px;
}

.readings-icon {
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
}

.readings-icon::before {
  content: "";
  position: absolute;
  left: 3px;
  bottom: 4px;
  width: 12px;
  height: 8px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  transform: skew(-18deg);
}

.sync-icon {
  border: 2px solid currentColor;
  border-radius: 50%;
}

.sync-icon::before {
  content: "";
  position: absolute;
  inset: 3px;
  border-top: 2px solid currentColor;
  transform: rotate(35deg);
}

.shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 10px 0 48px;
}

.graph-surface,
.readings-section,
.sync-section,
.import-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 94%, white);
  box-shadow: var(--shadow);
}

.graph-surface {
  min-height: calc(100vh - 120px);
  padding: 22px;
}

.surface-head,
.section-head,
.sync-section {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.surface-head {
  align-items: center;
  margin-bottom: 10px;
}

.surface-head > div {
  min-width: 0;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(34px, 6vw, 72px);
  line-height: .96;
  font-weight: 780;
}

h2 {
  font-size: 20px;
  line-height: 1.12;
  font-weight: 760;
}

.surface-head p,
.sync-section p,
.import-section p,
.readings-head small,
.chart-note,
.section-head span {
  color: var(--muted);
}

.surface-head p,
.sync-section p,
.import-section p {
  min-width: 0;
  max-width: 690px;
  margin-top: 0;
  font-size: 14px;
  line-height: 1.3;
  font-weight: 640;
  overflow-wrap: break-word;
  word-break: normal;
}

.surface-head .freshness-line {
  max-width: 840px;
  margin-top: 3px;
  color: var(--blood-dark);
  font-size: 13px;
  font-weight: 720;
  overflow-wrap: break-word;
  word-break: normal;
}

#refresh-button,
.range-controls button,
.download-link,
.data-form input,
.data-form select,
.data-form button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf2;
  color: var(--ink);
}

#refresh-button,
.range-controls button,
.data-form button {
  cursor: pointer;
}

#refresh-button {
  min-width: 82px;
  min-height: 36px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 720;
}

.download-link {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  margin-top: 14px;
  padding: 9px 13px;
  background: var(--blood);
  color: #fffaf2;
  font-weight: 760;
  text-decoration: none;
}

#refresh-button:disabled,
.data-form button:disabled {
  cursor: wait;
  opacity: .68;
}

.readings-head {
  display: grid;
  align-content: center;
  gap: 6px;
  min-width: 0;
  padding: 14px 16px;
  border-right: 1px solid rgba(73, 55, 51, .1);
}

.readings-head span,
.readings-head strong,
.readings-head small {
  display: block;
}

.readings-head span {
  color: #5d514e;
  font-size: 11px;
  font-weight: 820;
  line-height: 1.05;
  text-transform: uppercase;
  white-space: nowrap;
}

.readings-head strong {
  color: var(--ink);
  font-size: 19px;
  line-height: 1.12;
  font-weight: 780;
}

.readings-head small {
  font-size: 13px;
  line-height: 1.25;
  font-weight: 680;
}

.anxiety-strip {
  display: grid;
  grid-template-columns: minmax(150px, .36fr) minmax(0, 1fr);
  gap: 0;
  align-items: stretch;
  margin: 0 0 10px;
  overflow: hidden;
  border: 1px solid rgba(73, 55, 51, .14);
  border-radius: 8px;
  background: #fffdf8;
}

.health-strip {
  display: grid;
  grid-template-columns: minmax(190px, .42fr) minmax(0, 1.58fr);
  gap: 0;
  align-items: stretch;
  margin: 16px 0 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
}

.anxiety-readout,
.health-metrics,
.health-suggestion {
  min-width: 0;
  background: transparent;
}

.anxiety-readout {
  display: grid;
  align-content: start;
  gap: 6px;
  padding: 14px 16px;
}

.anxiety-readout span,
.health-metrics span {
  color: #5d514e;
  font-size: 11px;
  font-weight: 820;
  line-height: 1.05;
  text-transform: uppercase;
  white-space: nowrap;
}

.anxiety-readout div {
  display: flex;
  align-items: baseline;
  gap: 5px;
  color: var(--blood-dark);
}

.anxiety-readout strong {
  font-size: clamp(38px, 4.4vw, 54px);
  line-height: .92;
  font-weight: 820;
  font-variant-numeric: tabular-nums;
}

.anxiety-readout strong.is-loading {
  font-size: 22px;
  line-height: 1;
}

.anxiety-readout small {
  font-size: 14px;
  font-weight: 800;
}

.health-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(72px, 1fr));
  gap: 0;
  overflow: hidden;
}

.health-metrics div {
  min-width: 0;
  padding: 11px 10px;
  border-left: 1px solid rgba(73, 55, 51, .1);
}

.health-metrics div:first-child {
  border-left: 0;
}

.health-metrics strong {
  display: block;
  margin-top: 6px;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.05;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: normal;
}

.health-metrics strong.is-waiting {
  color: var(--muted);
  font-size: 14px;
}

.health-suggestion {
  display: grid;
  align-content: center;
  padding: 16px 20px;
  border-left: 1px solid rgba(73, 55, 51, .12);
}

.health-suggestion #health-read {
  display: block;
  min-width: 0;
  color: var(--ink);
  font-size: clamp(18px, 1.5vw, 22px);
  line-height: 1.34;
  font-weight: 400;
  overflow-wrap: break-word;
  word-break: normal;
}

.range-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.range-controls button {
  min-width: 64px;
  min-height: 36px;
  padding: 7px 12px;
  font-weight: 750;
}

.range-controls button.is-active {
  border-color: color-mix(in srgb, var(--blood) 48%, var(--line));
  background: var(--blood);
  color: #fffaf2;
}

.chart-frame {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf2;
}

.charts {
  display: grid;
}

.chart-panel {
  border-bottom: 1px solid rgba(73, 55, 51, .1);
  background: #fffaf2;
}

.chart-panel:last-child {
  border-bottom: 0;
}

.chart-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px 0;
}

.chart-panel-head strong {
  font-size: 14px;
  line-height: 1.05;
  font-weight: 820;
  text-transform: uppercase;
}

.chart-panel-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.chart-panel-head .chart-current {
  display: grid;
  justify-items: end;
  gap: 2px;
  line-height: 1.05;
  min-width: 0;
}

.chart-current b {
  display: block;
  max-width: 100%;
  color: #6d5f5c;
  font-size: 13px;
  font-weight: 820;
  overflow-wrap: break-word;
  word-break: normal;
}

.chart-current small {
  display: block;
  max-width: 190px;
  color: #867977;
  font-size: 10px;
  font-weight: 720;
  line-height: 1.15;
  overflow-wrap: break-word;
  word-break: normal;
}

.metric-chart {
  display: block;
  width: 100%;
  height: auto;
}

.plot-bg {
  fill: #fffdf8;
}

.reference-band {
  fill: var(--band);
}

.gridline line,
.x-tick line {
  stroke: rgba(34, 30, 29, .12);
  stroke-width: 1;
}

.gridline text,
.x-tick text,
.axis-label {
  fill: rgba(34, 30, 29, .56);
  font-size: 13px;
  font-weight: 700;
}

.gridline text {
  text-anchor: end;
}

.x-tick text {
  text-anchor: middle;
}

.trend-area {
  fill: rgba(159, 48, 65, .08);
}

.trend-line {
  fill: none;
  stroke: var(--blood);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.trend-line.anxiety,
.point.anxiety {
  stroke: #7a2439;
}

.trend-line.heart-rate,
.point.heart-rate {
  stroke: var(--teal);
}

.trend-line.hrv,
.point.hrv {
  stroke: #6f5aa8;
}

.trend-line.sleep,
.point.sleep {
  stroke: var(--amber);
}

.trend-line.steps,
.point.steps {
  stroke: #4f6f3f;
}

.trend-area.anxiety {
  fill: rgba(122, 36, 57, .08);
}

.trend-area.heart-rate {
  fill: rgba(73, 123, 120, .08);
}

.trend-area.hrv {
  fill: rgba(111, 90, 168, .08);
}

.trend-area.sleep {
  fill: rgba(181, 123, 66, .08);
}

.trend-area.steps {
  fill: rgba(79, 111, 63, .08);
}

.point {
  fill: #fffaf2;
  stroke: var(--blood-dark);
  stroke-width: 2;
}

.empty-series {
  fill: rgba(34, 30, 29, .5);
  font-size: 13px;
  font-weight: 720;
}

.latest-marker circle {
  fill: var(--blood);
  stroke: #fffaf2;
  stroke-width: 3;
}

.latest-marker text {
  fill: var(--blood-dark);
  font-size: 18px;
  font-weight: 800;
}

.chart-boundary {
  display: grid;
  min-height: 430px;
  place-content: center;
  gap: 8px;
  padding: 24px;
  text-align: center;
}

.chart-boundary strong {
  font-size: 24px;
  line-height: 1.1;
}

.chart-boundary p {
  max-width: 560px;
  color: var(--muted);
  font-weight: 620;
}

.chart-note {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 9px;
  font-size: 12px;
  font-weight: 700;
}

.readings-section {
  margin-top: 18px;
  padding: 18px;
}

.section-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.section-head span {
  font-size: 13px;
  font-weight: 720;
}

.readings-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px 12px;
  min-width: 0;
  color: var(--muted);
}

.readings-tools label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.readings-tools label span {
  color: #5d514e;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.readings-tools input {
  width: 164px;
  min-height: 36px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fffdf8;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}

.readings-tools small {
  flex-basis: 100%;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: right;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
  background: #fffdf8;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid rgba(73, 55, 51, .1);
  text-align: left;
  vertical-align: top;
}

th {
  color: #5d514e;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

td {
  font-size: 14px;
  font-weight: 610;
}

.disregard-button {
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid rgba(95, 33, 48, .25);
  border-radius: 7px;
  background: #fff7f3;
  color: var(--blood-dark);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.disregard-button:disabled {
  cursor: wait;
  opacity: .62;
}

td strong {
  color: var(--blood-dark);
  font-variant-numeric: tabular-nums;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.sync-section {
  margin-top: 18px;
  padding: 18px;
}

.sync-section > div:first-child {
  max-width: 640px;
}

.sync-steps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-width: min(430px, 100%);
}

.sync-steps span {
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 8px 10px;
  border-left: 3px solid var(--teal);
  background: rgba(73, 123, 120, .08);
  color: #314b49;
  font-size: 13px;
  font-weight: 760;
}

.import-section {
  display: grid;
  grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr);
  gap: 18px;
  margin-top: 18px;
  padding: 18px;
}

.score-citations {
  margin-top: 18px;
  padding: 14px 0 0;
  border-top: 1px solid var(--line);
}

.score-citations h2 {
  margin: 0 0 10px;
  font-size: 15px;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: lowercase;
}

.basis-list {
  display: grid;
  gap: 8px;
  max-width: 1040px;
  margin: 0;
  padding-left: 22px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.38;
}

.basis-list li {
  padding-left: 3px;
}

.basis-list a {
  color: #315d58;
  font-weight: 850;
}

.paper-main {
  width: min(920px, calc(100% - 28px));
  margin: 0 auto;
  padding: 10px 0 52px;
}

.paper-hero,
.paper-doc {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 96%, white);
  box-shadow: var(--shadow);
}

.paper-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 22px;
  align-items: end;
  padding: 22px;
}

.paper-hero .eyebrow {
  margin-bottom: 8px;
  color: var(--blood-dark);
  font-size: 12px;
  font-weight: 820;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.paper-hero h1 {
  max-width: 760px;
  font-size: clamp(30px, 5vw, 54px);
  line-height: 1;
}

.paper-hero .lead {
  max-width: 680px;
  margin-top: 12px;
  color: var(--muted);
  font-weight: 620;
}

.primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 9px 14px;
  border-radius: 8px;
  background: var(--blood);
  color: #fffaf2;
  font-weight: 780;
  text-decoration: none;
  white-space: nowrap;
}

.paper-doc {
  margin-top: 16px;
  padding: 22px;
}

.paper-doc h2 {
  margin-top: 22px;
}

.paper-doc h2:first-child {
  margin-top: 0;
}

.paper-doc p {
  margin-top: 8px;
  color: #3a312f;
  font-size: 16px;
}

.paper-doc code {
  padding: 1px 4px;
  border-radius: 5px;
  background: rgba(73, 123, 120, .1);
  color: var(--blood-dark);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .92em;
}

.entry-tools {
  display: grid;
  gap: 14px;
}

.fallback-tools {
  min-width: 0;
}

.fallback-tools summary {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf2;
  color: var(--blood-dark);
  cursor: pointer;
  font-weight: 760;
}

.fallback-tools[open] summary {
  margin-bottom: 14px;
}

.data-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  gap: 10px;
  align-items: end;
}

.manual-entry {
  grid-template-columns: minmax(86px, .42fr) minmax(170px, .76fr) minmax(132px, .58fr) minmax(160px, .72fr) auto;
}

.data-form label,
.data-form label span,
.data-form p {
  min-width: 0;
}

.data-form label span {
  display: block;
  margin-bottom: 5px;
  color: #5d514e;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.data-form input,
.data-form select {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  font: inherit;
  font-size: 14px;
}

.data-form button {
  min-height: 40px;
  padding: 8px 13px;
  background: var(--blood);
  color: #fffaf2;
  font-weight: 760;
}

.data-form p {
  grid-column: 1 / -1;
  font-size: 13px;
  font-weight: 700;
}

@media (max-width: 760px) {
  .suite-topbar,
  .shell,
  .paper-main {
    width: min(100% - 20px, 1180px);
  }

  .suite-topbar {
    padding-top: 12px;
  }

  .suite-topbar-actions {
    display: none;
  }

  .graph-surface {
    min-height: auto;
    padding: 15px;
  }

  .surface-head,
  .section-head,
  .sync-section,
  .import-section {
    display: block;
  }

  .readings-tools {
    justify-content: flex-start;
    margin-top: 8px;
  }

  .readings-tools small {
    text-align: left;
  }

  .readings-tools input {
    width: min(178px, 54vw);
  }

  #refresh-button {
    margin-top: 14px;
  }

  .readings-head {
    border-right: 0;
    border-bottom: 1px solid rgba(73, 55, 51, .1);
  }

  .anxiety-strip,
  .health-strip {
    grid-template-columns: 1fr;
  }

  .anxiety-readout,
  .health-suggestion {
    padding: 12px;
  }

  .health-suggestion {
    border-top: 1px solid rgba(73, 55, 51, .12);
    border-left: 0;
  }

  .health-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .health-metrics div {
    border-left: 0;
    border-top: 1px solid rgba(73, 55, 51, .1);
  }

  .health-metrics div:nth-child(-n + 2) {
    border-top: 0;
  }

  .health-metrics div:nth-child(even) {
    border-left: 1px solid rgba(73, 55, 51, .1);
  }

  .chart-frame {
    overflow: hidden;
  }

  .metric-chart {
    min-width: 0;
  }

  .chart-panel-head {
    align-items: flex-start;
    padding: 9px 10px 0;
  }

  .chart-panel-head .chart-current {
    max-width: 56%;
  }

  .chart-panel-head span {
    font-size: 12px;
  }

  .chart-note {
    display: block;
  }

  .chart-note span {
    display: block;
  }

  .chart-boundary {
    min-height: 280px;
  }

  table {
    min-width: 0;
    table-layout: fixed;
  }

  th,
  td {
    padding: 10px 9px;
    font-size: 12px;
    overflow-wrap: normal;
    word-break: normal;
  }

  th:nth-child(1),
  td:nth-child(1) {
    width: 48%;
  }

  th:nth-child(2),
  td:nth-child(2) {
    width: 19%;
  }

  th:nth-child(3),
  td:nth-child(3),
  th:nth-child(4),
  td:nth-child(4) {
    display: none;
  }

  th:nth-child(5),
  td:nth-child(5) {
    width: 33%;
  }

  .disregard-button {
    min-height: 32px;
    padding: 5px 8px;
    font-size: 12px;
  }

  .sync-steps {
    grid-template-columns: 1fr;
    margin-top: 14px;
  }

  .data-form,
  .manual-entry {
    grid-template-columns: 1fr;
    margin-top: 14px;
  }

  .paper-hero {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .paper-doc {
    padding: 16px;
  }

  .primary-action {
    width: 100%;
  }
}
