:root {
  color-scheme: light;
  --page: #f2f0eb;
  --page-deep: #e2ded5;
  --surface-rgb: 255 255 255;
  --surface-strong: #fcfbf8;
  --surface-muted: #f3f0ea;
  --ink: #191a18;
  --ink-soft: #62655e;
  --ink-faint: #92958d;
  --line: rgb(25 26 24 / 10%);
  --line-strong: rgb(25 26 24 / 17%);
  --accent: #476b58;
  --accent-soft: #dce8df;
  --accent-ink: #173326;
  --success: #3f745a;
  --success-soft: #dcebdd;
  --warning: #9a6a25;
  --warning-soft: #f3e6cb;
  --danger: #a24c45;
  --danger-soft: #f4ddda;
  --surface-alpha: 0.82;
  --shadow: 0 16px 46px rgb(40 42 36 / 10%);
  --shadow-soft: 0 8px 24px rgb(40 42 36 / 7%);
  --serif: "Iowan Old Style", Baskerville, "Noto Serif SC", "Songti SC",
    Georgia, serif;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
}

body[data-theme="moss"] {
  color-scheme: dark;
  --page: #22382d;
  --page-deep: #12251c;
  --surface-rgb: 38 60 48;
  --surface-strong: #21382c;
  --surface-muted: #344f3e;
  --ink: #f4f7f1;
  --ink-soft: #c3cec4;
  --ink-faint: #91a094;
  --line: rgb(238 247 239 / 13%);
  --line-strong: rgb(238 247 239 / 22%);
  --accent: #a8d6a8;
  --accent-soft: rgb(145 193 151 / 20%);
  --accent-ink: #efffee;
  --success: #a7d9ad;
  --success-soft: rgb(81 132 91 / 32%);
  --warning: #f3ca83;
  --warning-soft: rgb(139 95 34 / 34%);
  --danger: #ffaba0;
  --danger-soft: rgb(133 53 48 / 34%);
  --shadow: 0 20px 56px rgb(1 12 7 / 28%);
  --shadow-soft: 0 9px 28px rgb(1 12 7 / 20%);
}

body[data-theme="dusk"] {
  color-scheme: dark;
  --page: #2b2729;
  --page-deep: #171618;
  --surface-rgb: 62 53 57;
  --surface-strong: #382f33;
  --surface-muted: #4d3f44;
  --ink: #fff6f3;
  --ink-soft: #d4c5c3;
  --ink-faint: #a08f8d;
  --line: rgb(255 241 237 / 13%);
  --line-strong: rgb(255 241 237 / 22%);
  --accent: #f08aa3;
  --accent-soft: rgb(240 138 163 / 20%);
  --accent-ink: #fff7fa;
  --success: #a8d3b4;
  --success-soft: rgb(71 123 87 / 32%);
  --warning: #f0bf78;
  --warning-soft: rgb(140 92 29 / 34%);
  --danger: #ff998d;
  --danger-soft: rgb(150 52 47 / 34%);
  --shadow: 0 20px 56px rgb(10 4 6 / 34%);
  --shadow-soft: 0 9px 28px rgb(10 4 6 / 24%);
}

body[data-opacity="68"] {
  --surface-alpha: 0.68;
}

body[data-opacity="82"] {
  --surface-alpha: 0.82;
}

body[data-opacity="94"] {
  --surface-alpha: 0.94;
}

* {
  box-sizing: border-box;
}

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

body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(
      circle at 20% 7%,
      color-mix(in srgb, var(--accent) 18%, transparent),
      transparent 28rem
    ),
    linear-gradient(145deg, var(--page), var(--page-deep));
  color: var(--ink);
  font-family: var(--sans);
  transition:
    background 260ms ease,
    color 200ms ease;
}

button,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
textarea:focus-visible,
input:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent);
  outline-offset: 2px;
}

noscript {
  display: block;
  max-width: 430px;
  margin: 40px auto;
  padding: 20px;
}

.app-frame {
  width: min(100%, 430px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: calc(20px + env(safe-area-inset-top)) 18px
    calc(100px + env(safe-area-inset-bottom));
  overflow: hidden;
  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--page) 91%, transparent),
      var(--page)
    );
  box-shadow:
    0 0 0 1px var(--line),
    0 24px 80px rgb(0 0 0 / 12%);
}

body[data-theme="moss"] .app-frame {
  background:
    radial-gradient(
      circle at 12% 5%,
      rgb(189 224 177 / 17%),
      transparent 27rem
    ),
    radial-gradient(
      circle at 88% 38%,
      rgb(82 140 91 / 18%),
      transparent 24rem
    ),
    linear-gradient(160deg, rgb(55 86 66 / 97%), rgb(18 38 27 / 99%));
}

body[data-theme="dusk"] .app-frame {
  background:
    radial-gradient(
      circle at 8% 5%,
      rgb(239 133 160 / 18%),
      transparent 28rem
    ),
    radial-gradient(
      circle at 92% 36%,
      rgb(140 92 105 / 20%),
      transparent 25rem
    ),
    linear-gradient(160deg, rgb(61 50 55 / 98%), rgb(27 24 27 / 99%));
}

.screen {
  animation: screen-enter 190ms ease both;
}

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

.eyebrow,
.meta-label,
.light-label {
  margin: 0;
  font-size: 10px;
  font-weight: 780;
  letter-spacing: 0.12em;
  line-height: 1.4;
  text-transform: uppercase;
}

.eyebrow,
.meta-label {
  color: var(--ink-soft);
}

.light-label {
  color: rgb(255 255 255 / 58%);
}

.page-title {
  max-width: 275px;
  margin: 5px 0 0;
  font-family: var(--serif);
  font-size: clamp(34px, 10vw, 43px);
  font-weight: 540;
  letter-spacing: -0.04em;
  line-height: 1.03;
}

.page-subtitle {
  max-width: 310px;
  margin: 9px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.7;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-button,
.arrow-link {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  background: rgb(var(--surface-rgb) / var(--surface-alpha));
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  transition:
    transform 150ms ease,
    border-color 150ms ease;
}

.icon-button:hover,
.arrow-link:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.icon-button {
  width: 42px;
  height: 42px;
  border-radius: 50%;
}

.sheet-close {
  width: 38px;
  height: 38px;
  box-shadow: none;
}

.sync-pill,
.status-pill,
.source-tag,
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  border: 1px solid var(--line);
  border-radius: 999px;
  white-space: nowrap;
}

.sync-pill {
  min-height: 38px;
  padding: 0 11px;
  background: rgb(var(--surface-rgb) / var(--surface-alpha));
  color: var(--ink-soft);
  font-size: 9px;
  font-weight: 760;
  box-shadow: var(--shadow-soft);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 15%, transparent);
}

.glass-card,
.dark-card {
  border: 1px solid var(--line);
  border-radius: 25px;
}

.glass-card {
  background: rgb(var(--surface-rgb) / var(--surface-alpha));
  box-shadow: var(--shadow);
  backdrop-filter: blur(28px) saturate(1.1);
  -webkit-backdrop-filter: blur(28px) saturate(1.1);
}

.dark-card {
  border-color: rgb(255 255 255 / 12%);
  background:
    radial-gradient(
      circle at 86% 12%,
      rgb(255 255 255 / 11%),
      transparent 12rem
    ),
    linear-gradient(145deg, #252b28, #111412);
  color: #f7f8f4;
  box-shadow: 0 18px 42px rgb(10 16 12 / 22%);
}

body[data-theme="dusk"] .dark-card {
  background:
    radial-gradient(
      circle at 82% 10%,
      rgb(240 138 163 / 18%),
      transparent 12rem
    ),
    linear-gradient(145deg, #302a2d, #151315);
}

.insight-card {
  position: relative;
  min-height: 214px;
  padding: 22px;
  margin-bottom: 12px;
  overflow: hidden;
}

.insight-card::after {
  content: "";
  position: absolute;
  right: -35px;
  bottom: -70px;
  width: 195px;
  height: 195px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    color-mix(in srgb, var(--accent) 42%, transparent),
    transparent 68%
  );
}

.insight-content {
  position: relative;
  z-index: 1;
}

.insight-title {
  max-width: 320px;
  margin: 12px 0 10px;
  font-family: var(--serif);
  font-size: 29px;
  font-weight: 520;
  letter-spacing: -0.03em;
  line-height: 1.18;
}

.insight-copy {
  max-width: 315px;
  margin: 0;
  color: rgb(255 255 255 / 70%);
  font-size: 13px;
  line-height: 1.75;
}

.insight-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
}

.insight-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #f7f8f4;
  font-size: 12px;
  font-weight: 760;
  cursor: pointer;
}

.evidence-count {
  color: rgb(255 255 255 / 64%);
  font-family: var(--serif);
  font-size: 13px;
}

.risk-focus {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--warning) 30%, transparent);
  border-radius: 20px;
  background: var(--warning-soft);
}

.risk-focus-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 14px;
  background: color-mix(in srgb, var(--warning) 15%, transparent);
  color: var(--warning);
}

.risk-focus-title,
.risk-focus-copy,
.goal-title,
.goal-meta,
.metric-value,
.metric-caption,
.agent-name,
.agent-copy,
.collection-title,
.collection-copy,
.fact-title,
.fact-copy,
.system-name,
.system-purpose {
  margin: 0;
}

.risk-focus-title {
  font-size: 12px;
  font-weight: 800;
}

.risk-focus-copy {
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.5;
}

.arrow-link {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: rgb(var(--surface-rgb) / 58%);
  box-shadow: none;
}

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

.section-title {
  margin: 2px 0 0;
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 560;
  letter-spacing: -0.02em;
}

.section-meta {
  margin: 0;
  color: var(--ink-soft);
  font-size: 11px;
}

.goal-panel {
  padding: 7px 18px;
  overflow: hidden;
}

.goal-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 88px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.goal-row:last-child {
  border-bottom: 0;
}

.check-control {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface-muted);
  cursor: pointer;
}

.check-control.done {
  border-color: transparent;
  background: var(--accent);
  color: var(--accent-ink);
}

.goal-title {
  font-size: 14px;
  font-weight: 780;
  line-height: 1.48;
}

.goal-title.done {
  color: var(--ink-soft);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.goal-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-top: 7px;
  color: var(--ink-soft);
  font-size: 10px;
}

.tag-button {
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 9px;
  font-weight: 730;
  cursor: pointer;
}

.status-pill,
.source-tag,
.tag {
  min-height: 25px;
  padding: 0 9px;
  font-size: 9px;
  font-weight: 760;
}

.status-pill.success,
.tag.success {
  border-color: color-mix(in srgb, var(--success) 24%, transparent);
  background: var(--success-soft);
  color: var(--success);
}

.status-pill.warning,
.tag.warning {
  border-color: color-mix(in srgb, var(--warning) 24%, transparent);
  background: var(--warning-soft);
  color: var(--warning);
}

.status-pill.danger,
.tag.danger {
  border-color: color-mix(in srgb, var(--danger) 24%, transparent);
  background: var(--danger-soft);
  color: var(--danger);
}

.status-pill.neutral,
.tag.neutral {
  background: var(--surface-muted);
  color: var(--ink-soft);
}

.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.metric-card {
  min-height: 165px;
  padding: 17px;
}

.metric-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.metric-icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
}

.metric-value {
  margin-top: 15px;
  font-family: var(--serif);
  font-size: 34px;
  line-height: 1;
}

.metric-value small {
  margin-left: 4px;
  color: var(--ink-soft);
  font-family: var(--sans);
  font-size: 10px;
}

.metric-caption {
  margin-top: 8px;
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.5;
}

.mini-bars {
  display: flex;
  align-items: end;
  gap: 5px;
  height: 34px;
  margin-top: 12px;
}

.mini-bars span {
  flex: 1;
  min-width: 7px;
  border-radius: 6px 6px 2px 2px;
  background: color-mix(in srgb, var(--accent) 72%, var(--surface-muted));
}

.bar-height-1 {
  height: 10%;
}
.bar-height-2 {
  height: 20%;
}
.bar-height-3 {
  height: 30%;
}
.bar-height-4 {
  height: 40%;
}
.bar-height-5 {
  height: 50%;
}
.bar-height-6 {
  height: 60%;
}
.bar-height-7 {
  height: 70%;
}
.bar-height-8 {
  height: 80%;
}
.bar-height-9 {
  height: 90%;
}
.bar-height-10 {
  height: 100%;
}

.agent-strip {
  padding: 16px;
}

.agent-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.agent-row + .agent-row {
  padding-top: 12px;
  margin-top: 12px;
  border-top: 1px solid var(--line);
}

.agent-avatar {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 14px;
  background: var(--surface-muted);
  color: var(--accent);
}

.agent-name {
  font-size: 13px;
  font-weight: 800;
}

.agent-copy {
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.48;
}

.task-tabs {
  margin-bottom: 16px;
}

.segmented {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-muted);
}

.segment-button {
  flex: 1;
  min-width: 0;
  min-height: 37px;
  padding: 0 7px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 760;
  cursor: pointer;
}

.segment-button.active {
  background: var(--surface-strong);
  color: var(--ink);
  box-shadow: var(--shadow-soft);
}

.collection-card {
  padding: 0 18px;
}

.collection-row,
.fact-row,
.system-risk-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.collection-row:last-child,
.fact-row:last-child {
  border-bottom: 0;
}

.collection-title,
.fact-title {
  font-size: 12px;
  font-weight: 800;
}

.collection-copy,
.fact-copy {
  margin-top: 5px;
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.55;
}

.quick-add {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  margin-top: 13px;
  border: 1px dashed var(--line-strong);
  border-radius: 17px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 760;
  cursor: pointer;
}

.timeline {
  position: relative;
  margin-top: 20px;
  padding-left: 21px;
}

.timeline::before {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 18px;
  left: 6px;
  width: 1px;
  background: var(--line-strong);
}

.timeline-item {
  position: relative;
  padding: 0 0 25px 16px;
}

.timeline-dot {
  position: absolute;
  top: 7px;
  left: -20px;
  width: 12px;
  height: 12px;
  border: 3px solid var(--page);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.timeline-time {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 10px;
}

.source-tag.hermes {
  background: var(--warning-soft);
  color: var(--warning);
}

.source-tag.codex {
  background: var(--accent-soft);
  color: var(--accent);
}

.source-tag.manual {
  background: var(--success-soft);
  color: var(--success);
}

.timeline-title {
  margin: 7px 0 5px;
  overflow-wrap: anywhere;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 560;
  line-height: 1.35;
}

.timeline-copy {
  margin: 0;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.72;
}

.timeline-evidence {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.agent-card,
.system-card,
.trend-card {
  padding: 18px;
}

.agent-card + .agent-card,
.trend-card + .trend-card {
  margin-top: 13px;
}

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

.card-title {
  margin: 6px 0 0;
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 560;
}

.card-copy {
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.6;
}

.agent-card > .segmented {
  margin-top: 15px;
}

.agent-facts {
  margin-top: 12px;
}

.policy-note {
  padding: 18px;
  margin-top: 13px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: color-mix(in srgb, var(--surface-muted) 72%, transparent);
}

.policy-note h3 {
  margin: 0;
  font-size: 12px;
}

.policy-note p {
  margin: 7px 0 0;
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.65;
}

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

.system-name {
  font-size: 14px;
  font-weight: 820;
}

.system-purpose {
  margin-top: 6px;
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.55;
}

.system-evidence {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}

.evidence-cell {
  padding: 11px;
  border-radius: 14px;
  background: var(--surface-muted);
}

.evidence-cell span {
  display: block;
  color: var(--ink-soft);
  font-size: 8px;
  font-weight: 760;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.evidence-cell strong {
  display: block;
  margin-top: 5px;
  font-size: 10px;
  line-height: 1.45;
}

.system-risk-row {
  padding-bottom: 0;
  border-bottom: 0;
}

.trend-chart {
  width: 100%;
  height: auto;
  margin-top: 15px;
}

.trend-rect {
  fill: var(--accent);
  opacity: 0.86;
}

.trend-label {
  fill: var(--ink-soft);
  font-family: var(--sans);
  font-size: 10px;
}

.distribution {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.distribution-row {
  display: grid;
  grid-template-columns: 78px 1fr 34px;
  gap: 9px;
  align-items: center;
  font-size: 10px;
}

.distribution-progress {
  width: 100%;
  height: 8px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: var(--surface-muted);
}

.distribution-progress::-webkit-progress-bar {
  border-radius: 999px;
  background: var(--surface-muted);
}

.distribution-progress::-webkit-progress-value {
  border-radius: 999px;
  background: var(--accent);
}

.distribution-progress.warning::-webkit-progress-value {
  background: var(--warning);
}

.distribution-progress.muted::-webkit-progress-value {
  background: var(--ink-faint);
}

.distribution-progress::-moz-progress-bar {
  border-radius: 999px;
  background: var(--accent);
}

.recommendation-card {
  padding: 22px;
  margin-top: 13px;
}

.recommendation-card h2 {
  margin: 10px 0 7px;
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 540;
}

.recommendation-card > p:not(.light-label) {
  margin: 0;
  color: rgb(255 255 255 / 68%);
  font-size: 11px;
  line-height: 1.65;
}

.progress-block {
  margin-top: 18px;
}

.progress-block meter {
  width: 100%;
  height: 10px;
  border: 0;
  border-radius: 999px;
  background: rgb(255 255 255 / 14%);
}

.progress-block meter::-webkit-meter-bar {
  border: 0;
  border-radius: 999px;
  background: rgb(255 255 255 / 14%);
}

.progress-block meter::-webkit-meter-optimum-value {
  border-radius: 999px;
  background: linear-gradient(90deg, #a9d8b0, #f0c98b);
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 7px;
  color: rgb(255 255 255 / 62%);
  font-size: 9px;
}

.bottom-nav {
  position: fixed;
  z-index: 50;
  right: 0;
  bottom: 0;
  left: 0;
  width: min(100%, 430px);
  margin: 0 auto;
  padding: 9px 9px calc(9px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--page) 80%, transparent);
  box-shadow: 0 -14px 36px rgb(20 20 18 / 7%);
  backdrop-filter: blur(28px) saturate(1.15);
  -webkit-backdrop-filter: blur(28px) saturate(1.15);
}

.bottom-nav-inner {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 3px;
}

.nav-button {
  display: grid;
  min-height: 52px;
  place-items: center;
  padding: 5px 2px 4px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: var(--ink-faint);
  cursor: pointer;
}

.nav-button span {
  margin-top: 3px;
  font-size: 8px;
  font-weight: 740;
}

.nav-button.active {
  background: rgb(var(--surface-rgb) / var(--surface-alpha));
  color: var(--ink);
  box-shadow: var(--shadow-soft);
}

.scrim {
  position: fixed;
  z-index: 180;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 18px 12px 0;
  background: rgb(12 14 13 / 50%);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fade-in 170ms ease both;
}

.sheet {
  width: min(100%, 430px);
  max-height: min(86dvh, 780px);
  padding: 10px 18px calc(24px + env(safe-area-inset-bottom));
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 34px 34px 0 0;
  background: var(--surface-strong);
  color: var(--ink);
  box-shadow: 0 -20px 70px rgb(0 0 0 / 22%);
  animation: sheet-up 300ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.sheet-handle {
  width: 42px;
  height: 5px;
  margin: 0 auto 16px;
  border-radius: 999px;
  background: var(--line-strong);
}

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

.sheet-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 540;
}

.sheet-description {
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.65;
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 20px;
}

.theme-choice {
  min-height: 92px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-muted);
  color: var(--ink-soft);
  cursor: pointer;
}

.theme-choice.active {
  border-color: var(--accent);
  color: var(--ink);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 18%, transparent);
}

.theme-swatch {
  display: block;
  width: 38px;
  height: 38px;
  margin: 0 auto 8px;
  border: 2px solid rgb(255 255 255 / 54%);
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgb(0 0 0 / 10%);
}

.theme-paper {
  background: linear-gradient(145deg, #faf9f5, #d9d4ca);
}

.theme-moss {
  background: linear-gradient(145deg, #78957d, #20392b);
}

.theme-dusk {
  background: linear-gradient(145deg, #e195a8, #2a2427);
}

.theme-choice > span:last-child {
  display: block;
  text-align: center;
  font-size: 10px;
  font-weight: 760;
}

.sheet-stack {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.sheet-section {
  padding: 16px;
  margin-top: 13px;
  border-radius: 18px;
  background: var(--surface-muted);
}

.sheet-stack .sheet-section {
  margin-top: 0;
}

.sheet-section h3 {
  margin: 0;
  font-size: 12px;
}

.sheet-section p,
.plain-list {
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.65;
}

.plain-list {
  padding-left: 18px;
}

.evidence-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.evidence-item {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 11px;
  border-radius: 15px;
  background: var(--surface-muted);
}

.evidence-item-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
}

.evidence-item strong,
.evidence-item span {
  display: block;
}

.evidence-item strong {
  font-size: 10px;
}

.evidence-item div span {
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 8px;
}

.manual-form {
  margin-top: 18px;
}

.manual-input {
  width: 100%;
  min-height: 132px;
  padding: 14px;
  resize: vertical;
  border: 1px solid var(--line-strong);
  border-radius: 17px;
  background: var(--surface-muted);
  color: var(--ink);
  line-height: 1.65;
}

.form-error {
  min-height: 18px;
  margin: 6px 0 0;
  color: var(--danger);
  font-size: 10px;
}

.sheet-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
}

.primary-button,
.secondary-button {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 15px;
  font-size: 11px;
  font-weight: 780;
  cursor: pointer;
}

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

.secondary-button {
  border: 1px solid var(--line);
  background: var(--surface-muted);
  color: var(--ink);
}

.primary-button:disabled,
.secondary-button:disabled,
.daily-action:disabled {
  cursor: wait;
  opacity: 0.58;
}

.sync-button {
  max-width: 118px;
  overflow: hidden;
  font-family: inherit;
  text-overflow: ellipsis;
  cursor: pointer;
}

.sync-button.busy .status-dot,
.loading-icon {
  animation: soft-pulse 900ms ease-in-out infinite alternate;
}

.notice-button {
  position: relative;
}

.notice-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  display: grid;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  place-items: center;
  border: 2px solid var(--surface-strong);
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 8px;
  font-weight: 850;
}

.active-risk {
  border-color: color-mix(in srgb, var(--danger) 38%, transparent);
  background: var(--danger-soft);
}

.active-risk .risk-focus-icon {
  background: color-mix(in srgb, var(--danger) 16%, transparent);
  color: var(--danger);
}

.daily-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0 24px;
}

.daily-action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 48px;
  padding: 0 10px;
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 10px;
  font-weight: 780;
  cursor: pointer;
}

.auth-screen {
  display: grid;
  min-height: calc(100dvh - 120px);
  place-items: center;
  padding: 24px 0;
}

.auth-card {
  width: min(100%, 380px);
  padding: 28px 22px;
  text-align: center;
}

.auth-icon {
  display: grid;
  width: 52px;
  height: 52px;
  margin: 0 auto 18px;
  place-items: center;
  border-radius: 18px;
  background: var(--accent-soft);
  color: var(--accent);
}

.auth-icon.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.auth-title {
  margin: 8px 0 0;
  font-family: var(--serif);
  font-size: 34px;
  font-weight: 540;
  letter-spacing: -0.035em;
}

.auth-copy {
  max-width: 290px;
  margin: 10px auto 0;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.7;
}

.auth-form {
  display: grid;
  gap: 8px;
  margin-top: 24px;
  text-align: left;
}

.field-label {
  margin-top: 7px;
  color: var(--ink-soft);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.text-input {
  width: 100%;
  min-height: 46px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  outline: none;
  background: var(--surface-muted);
  color: var(--ink);
  font: inherit;
  font-size: 12px;
}

.text-input:focus,
.manual-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}

.compact-input {
  min-height: 88px;
}

.full-button {
  width: 100%;
  margin-top: 10px;
}

.danger-button {
  border-color: color-mix(in srgb, var(--danger) 34%, var(--line));
  color: var(--danger);
}

.session-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 14px;
}

.criterion-card,
.approval-card {
  margin-top: 0;
}

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

.criterion-head h3 {
  min-width: 0;
  line-height: 1.5;
}

.inline-evidence-form {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.critical-card {
  padding: 16px;
  border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
  border-radius: 18px;
  background: var(--danger-soft);
}

.critical-card p,
.critical-card small {
  display: block;
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.6;
}

.critical-card .manual-input {
  min-height: 72px;
  margin-top: 12px;
  background: rgb(var(--surface-rgb) / 55%);
}

.notification-list {
  display: grid;
  gap: 9px;
  margin-top: 18px;
}

.notification-item {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 8px;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-muted);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.notification-item.read {
  opacity: 0.7;
}

.notification-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
}

.notification-item strong {
  font-size: 10px;
}

.notification-item p {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 9px;
  line-height: 1.5;
}

.unread-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--danger);
}

.grill-question {
  border: 1px solid color-mix(in srgb, var(--warning) 28%, transparent);
  background: var(--warning-soft);
}

.evidence-item small {
  display: block;
  margin-top: 4px;
  color: var(--ink-faint);
  font-size: 8px;
  line-height: 1.4;
}

.empty-state {
  padding: 28px 20px;
  border: 1px solid var(--line);
  border-radius: 22px;
  text-align: center;
}

.empty-state h2 {
  margin: 10px 0 0;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 540;
}

.empty-state p {
  margin: 7px auto 0;
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.6;
}

.empty-icon {
  display: grid;
  width: 44px;
  height: 44px;
  margin: 0 auto;
  place-items: center;
  border-radius: 15px;
  background: var(--accent-soft);
  color: var(--accent);
}

.toast {
  position: fixed;
  z-index: 240;
  top: calc(18px + env(safe-area-inset-top));
  left: 50%;
  width: min(calc(100% - 32px), 390px);
  padding: 13px 15px;
  border: 1px solid rgb(255 255 255 / 16%);
  border-radius: 16px;
  background: rgb(15 17 16 / 94%);
  color: #f5f7f4;
  box-shadow: 0 14px 42px rgb(0 0 0 / 26%);
  font-size: 10px;
  font-weight: 740;
  transform: translateX(-50%);
  animation: toast-in 210ms ease both;
}

svg {
  display: block;
}

@keyframes screen-enter {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes sheet-up {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, -12px);
  }
}

@keyframes soft-pulse {
  to {
    opacity: 0.45;
    transform: rotate(8deg) scale(0.94);
  }
}

@media (min-width: 760px) {
  body {
    padding: 28px 0;
  }

  .app-frame {
    min-height: calc(100dvh - 56px);
    border-radius: 38px;
  }

  .bottom-nav {
    bottom: 28px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 0 0 38px 38px;
  }

  .scrim {
    align-items: center;
  }

  .sheet {
    border-radius: 34px;
  }
}

@media (max-width: 360px) {
  .app-frame {
    padding-right: 14px;
    padding-left: 14px;
  }

  .page-title {
    font-size: 32px;
  }

  .metric-card {
    min-height: 155px;
    padding: 14px;
  }

  .goal-row {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .goal-row > .status-pill {
    grid-column: 2;
    justify-self: start;
  }

  .sync-pill {
    display: none;
  }
}

@media (max-width: 410px) {
  .topbar > div:first-child {
    min-width: 0;
  }

  .sync-pill {
    max-width: 74px;
    padding-right: 8px;
    padding-left: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}
