:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #fbfbfd;
  color: #16181d;
  --accent: #6254f3;
  --accent-strong: #4f43db;
  --ink: #16181d;
  --muted: #737780;
  --line: #e8e9ef;
  --tile: #f6f6f8;
  --tile-accent: #f0f0ff;
  --panel: #ffffff;
  --shadow: 0 18px 42px rgba(41, 45, 58, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, #ffffff 0 68%, #f2f3ff 100%);
  color: var(--ink);
}

body.sheet-open {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

svg {
  display: block;
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.25;
}

.app-shell {
  min-height: 100vh;
  width: min(960px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto 1fr;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 4;
  display: grid;
  grid-template-columns: 64px 1fr 64px;
  align-items: center;
  min-height: calc(86px + env(safe-area-inset-top));
  padding: calc(18px + env(safe-area-inset-top)) 22px 12px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(18px);
}

.brand {
  justify-self: center;
  font-size: 30px;
  line-height: 1;
  letter-spacing: 0;
  color: #121318;
}

.brand strong {
  color: var(--accent);
}

.icon-button {
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.94);
  color: var(--accent);
  box-shadow: 0 10px 26px rgba(38, 44, 60, 0.09);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
}

.icon-button.compact {
  width: 42px;
  height: 42px;
  box-shadow: none;
  background: #f5f5f7;
}

.home-view {
  min-height: 0;
  padding: 88px 26px calc(34px + env(safe-area-inset-bottom));
  display: grid;
  align-content: start;
  gap: 30px;
}

.hero {
  display: grid;
  gap: 8px;
  text-align: center;
}

.hero p {
  margin: 0;
  color: var(--muted);
  font-size: 20px;
  line-height: 1.3;
}

.hero h1 {
  margin: 0;
  color: #25282f;
  font-size: 31px;
  line-height: 1.25;
  font-weight: 760;
}

.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.action-card {
  min-height: 174px;
  border: 0;
  border-radius: 20px;
  background: var(--tile);
  color: #15161a;
  padding: 22px 14px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 14px;
  box-shadow: none;
  cursor: pointer;
}

.action-card:disabled {
  opacity: 0.6;
  cursor: wait;
}

.analysis-card {
  background: var(--tile-accent);
}

.monitor-card {
  grid-column: 1 / -1;
  min-height: 132px;
  background: #eef8f7;
  grid-template-columns: 72px 1fr;
  justify-items: start;
  text-align: left;
  padding: 22px 26px;
}

.history-card {
  grid-column: 1 / -1;
  min-height: 108px;
  background: #f7f7fb;
  grid-template-columns: 72px 1fr;
  justify-items: start;
  text-align: left;
  padding: 20px 26px;
}

.tile-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  color: var(--ink);
}

.analysis-card .tile-icon {
  color: var(--accent);
}

.monitor-card .tile-icon {
  color: #2d847d;
}

.history-card .tile-icon {
  color: var(--accent);
}

.monitor-card .tile-title {
  max-width: 20ch;
  text-align: left;
}

.history-card .tile-title {
  max-width: none;
  text-align: left;
}

.tile-icon svg {
  width: 42px;
  height: 42px;
}

.tile-title,
.tile-subtitle {
  display: block;
  text-align: center;
}

.tile-title {
  max-width: 11ch;
  font-size: 22px;
  line-height: 1.14;
  font-weight: 760;
}

.tile-subtitle {
  color: #424650;
  font-size: 18px;
  line-height: 1.2;
  font-weight: 700;
}

.hidden-form,
.hidden {
  display: none !important;
}

.status-panel {
  scroll-margin-top: calc(92px + env(safe-area-inset-top));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
  padding: 18px;
}

.status-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-title p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 780;
  text-transform: uppercase;
}

.status-title h2,
#statusMessage,
.current-file {
  margin: 0;
}

.status-title h2 {
  font-size: 21px;
  line-height: 1.15;
}

#statusMessage,
.current-file {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.input-result-card {
  border: 1px solid #d9e9de;
  border-left: 6px solid #3d9253;
  border-radius: 10px;
  background: #fbfffc;
  display: grid;
  gap: 12px;
  padding: 15px 15px 16px;
}

.input-result-card.positive {
  border-color: #f0d7d7;
  border-left-color: #b63b3b;
  background: #fffafa;
}

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

.result-head p {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 820;
  text-transform: uppercase;
}

.result-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 22px;
  line-height: 1.12;
}

.result-badge {
  flex: 0 0 auto;
  border: 1px solid #bde2c7;
  border-radius: 999px;
  background: #edf9f0;
  color: #2f6f3f;
  font-size: 12px;
  font-weight: 820;
  padding: 6px 10px;
}

.input-result-card.positive .result-badge {
  border-color: #f0c1c1;
  background: #fff0f0;
  color: #9b1c1c;
}

#inputResultCount,
#inputResultNote,
#topNeighborSummary {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.result-rule {
  height: 1px;
  background: #dfe8e2;
}

.result-details {
  margin: 0;
}

.result-details div {
  display: grid;
  gap: 4px;
}

.result-details dt {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.result-details dd {
  margin: 0;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.2;
  font-weight: 800;
}

.result-metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.result-metric-grid div {
  border: 1px solid #f0d7d7;
  border-radius: 12px;
  background: #fff;
  padding: 10px 9px;
  min-width: 0;
}

.result-metric-grid span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 820;
  line-height: 1.15;
  text-transform: uppercase;
}

.result-metric-grid strong {
  display: block;
  margin-top: 5px;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.result-image-wrap {
  margin: 2px 0 0;
  display: grid;
  gap: 8px;
}

.result-image-wrap figcaption {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.result-image-wrap a {
  display: block;
  border: 1px solid #e3e3ec;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

.result-image-wrap img {
  display: block;
  width: 100%;
  max-height: 340px;
  object-fit: contain;
  background: #fff;
}

.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid #d8d9e1;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.progress {
  height: 9px;
  background: #ebecef;
  border-radius: 999px;
  overflow: hidden;
}

.progress span {
  display: block;
  width: 0%;
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
  transition: width 0.25s ease;
}

.progress span.indeterminate {
  animation: pulsebar 1.1s ease-in-out infinite alternate;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.status-grid div {
  border: 1px solid #ecedf2;
  border-radius: 14px;
  padding: 10px 8px;
  background: #fbfbfc;
  color: var(--muted);
  font-size: 11px;
}

.status-grid span {
  display: block;
  min-height: 1.2em;
}

.status-grid strong {
  display: block;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.2;
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
}

.analysis-report-card {
  display: block;
  perspective: 1400px;
}

.top-neighbor-card {
  border: 1px solid #e5e1f9;
  border-radius: 16px;
  background: #fbfbff;
  display: grid;
  gap: 12px;
  padding: 15px;
}

.top-neighbor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.top-neighbor-head p {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 820;
  text-transform: uppercase;
}

.top-neighbor-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 22px;
  line-height: 1.12;
}

.top-neighbor-list {
  display: grid;
  gap: 9px;
}

.top-neighbor-item {
  border: 1px solid #eeedf5;
  border-radius: 13px;
  background: #fff;
  display: grid;
  gap: 8px;
  padding: 11px;
}

.top-neighbor-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 9px;
}

.top-neighbor-item strong {
  color: var(--ink);
  font-size: 15px;
  line-height: 1.2;
}

.top-neighbor-item small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.top-neighbor-item .secondary-button {
  min-height: 34px;
  border-radius: 999px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 820;
  flex: 0 0 auto;
}

.top-neighbor-item img {
  display: block;
  width: 100%;
  max-height: 150px;
  object-fit: contain;
  border: 1px solid #f0eff7;
  border-radius: 10px;
  background: #fff;
}

.analysis-card-inner {
  display: grid;
  transform-style: preserve-3d;
  transition: transform 360ms ease;
}

.analysis-report-card.flipped .analysis-card-inner {
  transform: rotateY(180deg);
}

.analysis-card-face {
  grid-area: 1 / 1;
  backface-visibility: hidden;
  border: 1px solid #eceaf8;
  border-radius: 18px;
  background: #fbfbff;
  display: grid;
  gap: 14px;
  padding: 16px;
  min-width: 0;
}

.analysis-card-front {
  pointer-events: auto;
}

.analysis-card-back {
  transform: rotateY(180deg);
  pointer-events: none;
}

.analysis-report-card.flipped .analysis-card-front {
  pointer-events: none;
}

.analysis-report-card.flipped .analysis-card-back {
  pointer-events: auto;
}

.analysis-report-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.analysis-head-actions {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.analysis-report-head p,
.analysis-metrics span,
.pattern-list span,
.metric-guide dt {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 820;
  text-transform: uppercase;
}

.analysis-report-head h3 {
  margin: 2px 0 0;
  font-size: 22px;
  line-height: 1.12;
}

.analysis-badge {
  flex: 0 0 auto;
  border: 1px solid #dcd8ff;
  border-radius: 999px;
  background: #f2f0ff;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 820;
  padding: 6px 10px;
}

.card-icon-button {
  width: 32px;
  height: 32px;
  border: 1px solid #dcd8ff;
  border-radius: 999px;
  background: #fff;
  color: var(--accent-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: 0 0 auto;
  box-shadow: 0 6px 16px rgba(36, 40, 54, 0.08);
}

.card-icon-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.analysis-hero {
  border-radius: 16px;
  background: #fff;
  border: 1px solid #eeedf5;
  padding: 16px;
}

.analysis-hero strong {
  display: block;
  color: var(--ink);
  font-size: 38px;
  line-height: 0.95;
  font-variant-numeric: tabular-nums;
}

.analysis-hero span {
  display: block;
  margin-top: 6px;
  color: #24272f;
  font-size: 18px;
  font-weight: 780;
}

.analysis-hero p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.analysis-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.analysis-metrics div,
.pattern-list div {
  border: 1px solid #eeedf5;
  border-radius: 14px;
  background: #fff;
  padding: 12px;
}

.analysis-metrics strong,
.pattern-list strong {
  display: block;
  color: var(--ink);
  font-size: 20px;
  line-height: 1.15;
  margin-top: 5px;
  font-variant-numeric: tabular-nums;
}

.pattern-list {
  display: grid;
  gap: 8px;
}

.pattern-list div {
  display: grid;
  gap: 4px;
}

.pattern-list small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.25;
}

.analysis-trend-stack {
  display: grid;
  gap: 12px;
}

.analysis-trend-card {
  border: 1px solid #eeedf5;
  border-radius: 16px;
  background: #fff;
  padding: 14px;
  display: grid;
  gap: 12px;
  min-width: 0;
}

.analysis-trend-card.alert {
  border-color: #f0c9c6;
  border-left: 5px solid #c23b38;
  background: #fffbfb;
}

.analysis-trend-card.neutral {
  border-left: 5px solid #6c7280;
}

.analysis-trend-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.analysis-trend-head p,
.analysis-trend-grid span {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 820;
  line-height: 1.15;
  text-transform: uppercase;
}

.analysis-trend-head h4 {
  margin: 3px 0 0;
  color: var(--ink);
  font-size: 19px;
  line-height: 1.08;
}

.analysis-trend-head > span {
  flex: 0 0 auto;
  border: 1px solid #f0bbb7;
  border-radius: 999px;
  background: #fff2f1;
  color: #a22b28;
  font-size: 12px;
  font-weight: 820;
  padding: 6px 10px;
  white-space: nowrap;
}

.analysis-trend-card:not(.alert) .analysis-trend-head > span {
  border-color: #dcd8ff;
  background: #f2f0ff;
  color: var(--accent-strong);
}

.analysis-trend-actions {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: flex-start;
  gap: 7px;
}

.analysis-trend-actions > span {
  flex: 0 0 auto;
  border: 1px solid #dcd8ff;
  border-radius: 999px;
  background: #f2f0ff;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 820;
  padding: 6px 10px;
  white-space: nowrap;
}

.analysis-info-popover {
  position: relative;
}

.analysis-info-popover summary {
  width: 31px;
  height: 31px;
  border: 1px solid #dcd8ff;
  border-radius: 999px;
  background: #fff;
  color: var(--accent-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 860;
  line-height: 1;
  cursor: pointer;
  list-style: none;
  box-shadow: 0 6px 16px rgba(36, 40, 54, 0.08);
}

.analysis-info-popover summary::-webkit-details-marker {
  display: none;
}

.analysis-info-popover div {
  position: absolute;
  right: 0;
  top: 38px;
  z-index: 2;
  width: min(272px, calc(100vw - 76px));
  border: 1px solid #e3e0f8;
  border-radius: 14px;
  background: #fff;
  padding: 11px 12px;
  box-shadow: 0 14px 32px rgba(36, 40, 54, 0.18);
}

.analysis-info-popover p {
  margin: 0;
  color: #4f5662;
  font-size: 12px;
  line-height: 1.3;
}

.analysis-info-popover p + p {
  margin-top: 8px;
}

.analysis-trend-grid {
  display: grid;
  gap: 8px;
}

.analysis-trend-grid:not(.compact) {
  grid-template-columns: 1fr 1fr;
}

.analysis-trend-grid div {
  border-top: 1px solid #ececf2;
  padding-top: 9px;
  min-width: 0;
}

.analysis-trend-grid strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 19px;
  line-height: 1.12;
  font-variant-numeric: tabular-nums;
}

.analysis-trend-grid small,
.analysis-trend-card > p {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.3;
}

.analysis-inference {
  border-top: 1px solid #ececf2;
  padding-top: 11px;
  display: grid;
  gap: 8px;
}

.analysis-inference > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 820;
  text-transform: uppercase;
}

.analysis-inference > div {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.analysis-inference article {
  border: 1px solid #f0d7d4;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.72);
  padding: 10px 11px;
  min-width: 0;
}

.analysis-inference h5 {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 820;
  line-height: 1.2;
  text-transform: uppercase;
}

.analysis-inference strong {
  display: block;
  margin-top: 5px;
  color: var(--ink);
  font-size: 19px;
  line-height: 1.08;
  font-variant-numeric: tabular-nums;
}

.analysis-inference small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.3;
}

.analysis-mini-chart {
  border: 1px solid #eeedf5;
  border-radius: 14px;
  background: #fff;
  padding: 12px 10px 6px;
  overflow: hidden;
}

.analysis-mini-chart svg {
  width: 100%;
  height: auto;
  fill: none;
}

.analysis-mini-chart .chart-axis-label {
  font-size: 16px;
  font-weight: 840;
}

.analysis-mini-chart .chart-tick {
  font-size: 15px;
  font-weight: 820;
}

.analysis-mini-chart .chart-x-label {
  font-size: 14.5px;
}

.analysis-chart-scale {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 10px 2px 2px;
  color: #4f5662;
  font-size: 12px;
  font-weight: 780;
  line-height: 1.2;
}

.analysis-chart-scale strong {
  flex: 0 0 auto;
  color: var(--ink);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.analysis-chart-range {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 4px 2px 0;
  color: #4f5662;
  font-size: 12px;
  font-weight: 820;
  line-height: 1.05;
  text-align: center;
}

.analysis-chart-range span:first-child {
  text-align: left;
}

.analysis-chart-range span:last-child {
  text-align: right;
}

.analysis-chart-range small {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
}

.analysis-chart-note {
  margin: 8px 2px 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  text-align: center;
}

.legend-ci {
  width: 14px;
  height: 12px;
  background: transparent;
  position: relative;
}

.legend-ci::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 0;
  bottom: 0;
  width: 2px;
  border-radius: 999px;
  background: #7f9dc4;
}

.legend-ci::after {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  top: 5px;
  height: 2px;
  border-radius: 999px;
  background: #7f9dc4;
}

.legend-hollow {
  width: 10px;
  height: 10px;
  border: 1.8px solid #567aa8;
  background: transparent;
}

.analysis-top-bins {
  border-top: 1px solid #ececf2;
  padding-top: 11px;
  display: grid;
  gap: 8px;
}

.analysis-top-bins-head {
  display: grid;
  gap: 2px;
}

.analysis-top-bins-head span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 820;
  text-transform: uppercase;
}

.analysis-top-bins-head small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.analysis-top-bin {
  display: grid;
  grid-template-columns: 26px 1fr;
  align-items: start;
  gap: 10px;
  border: 1px solid #eeedf5;
  border-radius: 13px;
  background: #fff;
  padding: 10px 11px;
}

.analysis-top-bin > span {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #f2f0ff;
  color: var(--accent-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 860;
}

.analysis-top-bin strong {
  display: block;
  color: var(--ink);
  font-size: 19px;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.analysis-top-bin small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.3;
}

.metric-guide {
  display: grid;
  gap: 8px;
  margin: 0;
}

.metric-guide div {
  border: 1px solid #eeedf5;
  border-radius: 14px;
  background: #fff;
  padding: 11px 12px;
}

.metric-guide dd {
  margin: 5px 0 0;
  color: #4f5662;
  font-size: 13px;
  line-height: 1.32;
}

.status-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.monitor-report {
  scroll-margin-top: calc(92px + env(safe-area-inset-top));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
  padding: 18px;
}

.history-report {
  scroll-margin-top: calc(92px + env(safe-area-inset-top));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
  padding: 18px;
}

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

.history-mobile-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.monitor-head p,
.history-mobile-head p,
.monitor-section-head span,
.monitor-list span,
.monitor-summary-grid span {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 820;
  text-transform: uppercase;
}

.monitor-head h2,
.history-mobile-head h2,
.monitor-section-head h3 {
  margin: 2px 0 0;
  color: var(--ink);
  line-height: 1.12;
}

.monitor-head h2 {
  font-size: 22px;
}

.history-mobile-head h2 {
  font-size: 25px;
}

.monitor-section-head h3 {
  font-size: 20px;
}

.monitor-message {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

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

.history-item {
  display: grid;
  gap: 8px;
  width: 100%;
  border: 1px solid #ececf3;
  border-radius: 14px;
  background: #fbfbfc;
  padding: 13px;
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: left;
  text-decoration: none;
}

.history-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.history-item-title {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.2;
  font-weight: 780;
}

.history-result-pill {
  flex: 0 0 auto;
  border: 1px solid #dddaf9;
  border-radius: 999px;
  background: #f1f0ff;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 820;
  padding: 5px 9px;
}

.history-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.history-empty {
  margin: 0;
  color: var(--muted);
  border: 1px dashed #dfe0e8;
  border-radius: 14px;
  padding: 18px;
  text-align: center;
}

.monitor-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.monitor-summary-grid div {
  border: 1px solid #eeedf5;
  border-radius: 14px;
  background: #fbfbfc;
  padding: 12px;
}

.monitor-summary-grid strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 21px;
  line-height: 1.12;
  font-variant-numeric: tabular-nums;
}

.monitor-summary-grid small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.25;
}

.monitor-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  border: 1px solid #e4e5ec;
  border-radius: 15px;
  padding: 4px;
  background: #f7f7fa;
}

.monitor-tab {
  min-height: 38px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: #565b65;
  font-size: 13px;
  font-weight: 790;
  cursor: pointer;
}

.monitor-tab.active {
  background: #fff;
  color: var(--accent-strong);
  box-shadow: 0 5px 16px rgba(36, 40, 54, 0.08);
}

.monitor-section {
  display: none;
}

.monitor-section.active {
  display: block;
}

.monitor-card-panel {
  border: 1px solid #eceaf8;
  border-radius: 18px;
  background: #fbfbff;
  display: grid;
  gap: 12px;
  padding: 14px;
}

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

.daily-head {
  display: grid;
}

.daily-head select {
  min-height: 42px;
  border-radius: 12px;
}

.mobile-chart {
  border: 1px solid #eeedf5;
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
  padding: 10px 8px 4px;
}

.mobile-chart svg {
  width: 100%;
  height: auto;
  fill: none;
  stroke-width: 0;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin: 0 2px 5px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #5f6470;
  font-size: 10.5px;
  font-weight: 740;
  line-height: 1.15;
}

.legend-swatch {
  width: 12px;
  height: 3px;
  border-radius: 999px;
  background: #737780;
  flex: 0 0 auto;
}

.legend-blue {
  background: #34728c;
}

.legend-orange {
  background: #c36e35;
}

.legend-purple {
  background: #6d4c91;
}

.legend-teal {
  background: #4c9288;
}

.legend-green {
  background: #659258;
}

.legend-purple-fill {
  height: 8px;
  background: #6d4c91;
}

.legend-baseline {
  background: repeating-linear-gradient(
    90deg,
    #6d4c91 0 6px,
    transparent 6px 10px
  );
  border: 1px solid #6d4c91;
}

.monitor-list {
  display: grid;
  gap: 8px;
}

.monitor-list div {
  border: 1px solid #eeedf5;
  border-radius: 14px;
  background: #fff;
  padding: 11px 12px;
}

.monitor-list strong {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.2;
}

.monitor-list small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.25;
}

.chart-note {
  fill: #737780;
  font-size: 10px;
  font-weight: 700;
}

.chart-axis-label {
  fill: #4f5662;
  font-size: 10.5px;
  font-weight: 820;
}

.chart-tick {
  fill: #737780;
  font-size: 10px;
  font-weight: 760;
}

.chart-axis {
  stroke: #e3e5eb;
  stroke-width: 1;
}

.chart-bar-green {
  fill: #659258;
}

.chart-bar-purple {
  fill: #6d4c91;
}

.chart-workout {
  stroke: #d29b24;
  stroke-width: 3;
}

.chart-line-blue {
  stroke: #34728c;
  stroke-width: 3;
}

.chart-line-abnormal {
  stroke: #557cae;
  stroke-width: 2.2;
}

.chart-ci {
  stroke: #86a2c6;
  stroke-width: 1.1;
}

.chart-point {
  fill: #557cae;
  stroke: #557cae;
  stroke-width: 1.4;
}

.chart-point-hollow {
  fill: #fff;
}

.chart-point-label {
  fill: #4f5662;
  font-size: 15px;
  font-weight: 820;
}

.chart-line-orange {
  stroke: #c36e35;
  stroke-width: 3;
}

.chart-line-purple {
  stroke: #6d4c91;
  stroke-width: 2.5;
}

.chart-line-teal {
  stroke: #4c9288;
  stroke-width: 2.5;
}

.chart-baseline {
  stroke: #6d4c91;
  stroke-width: 2;
  stroke-dasharray: 6 5;
}

.primary-button,
.secondary-button {
  min-height: 48px;
  border-radius: 16px;
  font-weight: 760;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
}

.primary-button {
  border: 0;
  background: var(--accent);
  color: #fff;
}

.secondary-button {
  border: 1px solid #dfdfe8;
  background: #fff;
  color: var(--accent);
}

.settings-sheet {
  position: fixed;
  inset: 0;
  z-index: 10;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 19, 24, 0.28);
}

.sheet-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: min(78vh, 720px);
  overflow: auto;
  border-radius: 28px 28px 0 0;
  background: #fff;
  padding: 18px 22px calc(24px + env(safe-area-inset-bottom));
  box-shadow: 0 -20px 50px rgba(19, 22, 32, 0.18);
  display: grid;
  gap: 18px;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.sheet-head h2,
.settings-group h3 {
  margin: 0;
}

.sheet-head h2 {
  font-size: 24px;
}

.settings-group {
  display: grid;
  gap: 12px;
  padding-top: 6px;
}

.settings-group + .settings-group {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.settings-group h3 {
  font-size: 15px;
  color: var(--muted);
  text-transform: uppercase;
}

.store-status {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 4px;
  background: #f8f9fb;
}

.store-status.error {
  border-color: #d86363;
  background: #fff8f8;
}

.store-status span,
.store-status small {
  color: var(--muted);
  font-size: 12px;
}

.store-status strong {
  font-size: 18px;
}

.segmented-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.segmented-control label {
  display: block;
  position: relative;
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.segmented-control label + label {
  border-left: 1px solid var(--line);
}

.segmented-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented-control span {
  min-height: 44px;
  display: grid;
  place-items: center;
  padding: 0 12px;
}

.segmented-control input:checked + span {
  background: var(--accent);
  color: #fff;
}

label {
  display: grid;
  gap: 7px;
  color: #3d414a;
  font-size: 13px;
  font-weight: 750;
}

input,
select {
  width: 100%;
  min-height: 48px;
  border: 1px solid #d7d8e0;
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
}

input[type="checkbox"] {
  width: 20px;
  height: 20px;
  min-height: 20px;
  padding: 0;
  accent-color: var(--accent);
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #2a2d35;
  font-weight: 680;
}

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

@keyframes pulsebar {
  from {
    transform: translateX(-18%);
    opacity: 0.55;
  }
  to {
    transform: translateX(118%);
    opacity: 1;
  }
}

@media (min-width: 720px) {
  .app-header {
    grid-template-columns: 72px 1fr 72px;
    min-height: 96px;
    padding-left: 34px;
    padding-right: 34px;
  }

  .home-view {
    width: min(680px, 100%);
    justify-self: center;
    padding-top: 110px;
  }

  .action-card {
    min-height: 210px;
  }

  .monitor-card {
    min-height: 150px;
  }

  .tile-title {
    max-width: 14ch;
    font-size: 25px;
  }

  .tile-subtitle {
    font-size: 20px;
  }

  .sheet-panel {
    width: min(560px, calc(100% - 36px));
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    border-radius: 28px;
    bottom: 24px;
  }
}

@media (max-width: 430px) {
  .app-header {
    grid-template-columns: 58px 1fr 58px;
    min-height: calc(78px + env(safe-area-inset-top));
    padding-left: 18px;
    padding-right: 18px;
  }

  .brand {
    font-size: 28px;
  }

  .icon-button {
    width: 50px;
    height: 50px;
  }

  .home-view {
    padding-top: 72px;
  }

  .action-grid {
    gap: 14px;
  }

  .action-card {
    min-height: 154px;
    border-radius: 19px;
    padding: 18px 10px;
  }

  .monitor-card {
    min-height: 118px;
    grid-template-columns: 58px 1fr;
    padding: 18px 22px;
  }

  .tile-icon {
    width: 48px;
    height: 48px;
  }

  .tile-icon svg {
    width: 38px;
    height: 38px;
  }

  .tile-title {
    font-size: 20px;
  }

  .tile-subtitle {
    font-size: 16px;
  }

  .status-grid,
  .status-actions,
  .monitor-summary-grid {
    grid-template-columns: 1fr 1fr;
  }

  .analysis-trend-grid:not(.compact) {
    grid-template-columns: 1fr;
  }

  .analysis-trend-head h4 {
    font-size: 18px;
  }

  .analysis-inference > div {
    grid-template-columns: 1fr;
  }
}
