/* Morphix brand: dark ink, lime accent, Montserrat headings, IBM Plex Sans body. */
:root {
  --bg: #0E1114; --ink: #14171B; --panel: #1B1F25; --panel2: #232830; --line: #2E343C;
  --fg: #F2F4EF; --muted: #A0A8A3; --dim: #737B76;
  --lime: #C5F82A; --lime-ink: #14171B; --lime-soft: rgba(197, 248, 42, .12);
  --ok: #5FD39A; --warn: #F2B544; --bad: #FF7A6B; --bad-soft: rgba(255, 122, 107, .14);
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); }
body {
  font: 16px/1.5 "IBM Plex Sans", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  min-height: 100vh; padding-bottom: env(safe-area-inset-bottom);
}
h1, h2, h3 { font-family: Montserrat, system-ui, sans-serif; line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 1.6rem; font-weight: 800; }
h2 { font-size: 1.15rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 700; }
p { margin: 0 0 .75em; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 12px) 16px 12px; background: var(--ink); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font: 800 1.05rem/1 Montserrat, sans-serif; letter-spacing: .14em; }
.brand svg { width: 30px; height: 30px; color: var(--fg); }

main { max-width: 560px; margin: 0 auto; padding: 16px; display: grid; gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card.center { text-align: center; }
.card.accent { border-color: var(--lime); background: linear-gradient(180deg, var(--lime-soft), var(--panel) 70%); }
.banner { background: var(--warn); color: var(--ink); text-align: center; padding: 8px 16px; font-weight: 600; }
.error { background: var(--bad-soft); border: 1px solid var(--bad); color: var(--fg); border-radius: 10px; padding: 10px 12px; }

label { display: block; font-weight: 600; margin: 10px 0 6px; }
input {
  width: 100%; padding: 13px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel2); color: var(--fg); font: inherit;
}
input:focus { outline: 2px solid var(--lime); outline-offset: 1px; border-color: transparent; }
button { font: inherit; cursor: pointer; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  margin-top: 14px; padding: 13px 16px; border: 0; border-radius: 10px;
  background: var(--lime); color: var(--lime-ink); font-family: Montserrat, sans-serif; font-weight: 700;
}
.btn.secondary { background: var(--panel2); color: var(--fg); border: 1px solid var(--line); }
.btn:disabled { opacity: .6; cursor: default; }
.link { background: none; border: 0; color: var(--muted); padding: 6px 4px; text-decoration: underline; }
.row { display: flex; gap: 10px; align-items: center; }
.row > .grow { flex: 1; min-width: 0; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.avatar {
  flex: 0 0 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: var(--lime-soft); color: var(--lime); font: 700 .95rem Montserrat, sans-serif;
}
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { font-size: .75rem; padding: 2px 8px; border-radius: 999px; background: var(--panel2); color: var(--muted); }
.soon li { color: var(--muted); }
.soon li::before { content: ""; flex: 0 0 8px; height: 8px; border-radius: 50%; background: var(--dim); }

/* ---- Phase 2: tracking screens ---- */
a { color: var(--lime); }
select, textarea {
  width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel2); color: var(--fg); font: inherit;
}
textarea { resize: vertical; }
select:focus, textarea:focus { outline: 2px solid var(--lime); outline-offset: 1px; border-color: transparent; }
.warn { color: var(--warn); }
.warn-text { color: var(--warn); font-weight: 600; }
.up { color: var(--warn); }
.down { color: var(--ok); }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .72rem; color: var(--muted); margin: 0 0 4px; }
.big { display: block; font: 800 2rem/1.1 Montserrat, sans-serif; margin: 4px 0 8px; }
.status { min-height: 1.4em; margin: 8px 0 0; }

.tabs {
  position: sticky; top: calc(env(safe-area-inset-top) + 59px); z-index: 4; display: flex; gap: 4px;
  overflow-x: auto; padding: 4px; background: var(--ink); border: 1px solid var(--line); border-radius: 12px;
}
.tab {
  flex: 1 0 auto; text-align: center; padding: 9px 12px; border-radius: 9px; color: var(--muted);
  text-decoration: none; font: 700 .9rem Montserrat, sans-serif;
}
.tab[aria-current="page"] { background: var(--lime); color: var(--lime-ink); }
.back { display: inline-block; margin: -6px 0 6px -4px; text-decoration: none; }
.rowlink { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; color: inherit; text-decoration: none; }
.chev { color: var(--dim); font-size: 1.4rem; }

.daynav { display: flex; align-items: center; gap: 8px; }
.daynav h1 { margin: 0; }
.daynav .grow { flex: 1; }
.daynav p { margin: 2px 0 0; }
.iconbtn {
  width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel);
  color: var(--fg); font-size: 1.5rem; line-height: 1;
}
.iconbtn:disabled { opacity: .35; cursor: default; }

.field { display: block; margin: 10px 0 0; }
.field > span:first-child { display: block; font-weight: 600; margin-bottom: 6px; }
.with-unit { position: relative; display: block; }
.with-unit input { padding-right: 56px; }
.with-unit .unit { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: .9rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.btnrow { display: flex; gap: 8px; }
.btnrow .btn { margin-top: 10px; }
.addrow { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.addrow .row { margin-top: 6px; }
.addrow input { min-width: 0; }
.btn.small-btn { width: auto; margin-top: 0; padding: 12px 16px; }

.bar { height: 10px; border-radius: 999px; background: var(--panel2); overflow: hidden; margin: 8px 0 4px; }
.bar > i { display: block; height: 100%; width: 0; background: var(--lime); border-radius: inherit; transition: width .25s; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 8px; }
.chip {
  padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel2);
  color: var(--fg); font-size: .9rem;
}
.chip[aria-pressed="true"] { background: var(--lime); color: var(--lime-ink); border-color: var(--lime); font-weight: 600; }
.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 4px 0; }
.scale button {
  display: grid; justify-items: center; gap: 2px; padding: 9px 2px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel2); color: var(--fg);
}
.scale button b { font: 800 1.05rem Montserrat, sans-serif; }
.scale button span { font-size: .72rem; color: var(--muted); }
.scale button[aria-pressed="true"] { background: var(--lime); border-color: var(--lime); color: var(--lime-ink); }
.scale button[aria-pressed="true"] span { color: var(--lime-ink); }
.scale-ends { display: flex; justify-content: space-between; margin-bottom: 8px; }

.checks { list-style: none; margin: 0; padding: 0; }
.checks li { border-top: 1px solid var(--line); }
.checks li:first-child { border-top: 0; }
.check { display: flex; align-items: center; gap: 12px; margin: 0; padding: 12px 0; font-weight: 500; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--lime); flex: 0 0 auto; }
.plain { margin: 0; padding-left: 18px; }
.plain li { margin: 4px 0; }

.savebar { position: sticky; bottom: calc(env(safe-area-inset-bottom) + 8px); text-align: center; pointer-events: none; }
.savebar .status:not(:empty) {
  display: inline-block; margin: 0; padding: 6px 14px; border-radius: 999px; background: var(--ink);
  border: 1px solid var(--line); pointer-events: auto;
}

.tablewrap { overflow-x: auto; margin: 0 -6px; }
table.days { width: 100%; border-collapse: collapse; font-size: .875rem; }
table.days th, table.days td { padding: 8px 6px; text-align: right; white-space: nowrap; border-top: 1px solid var(--line); }
table.days thead th { border-top: 0; color: var(--muted); font-weight: 600; }
table.days th:first-child, table.days td:first-child { text-align: left; }
table.days tbody th { font-weight: 600; }
table.days .link { padding: 0; color: var(--fg); }

.silwrap { display: grid; grid-template-columns: minmax(0, 220px) 1fr; gap: 14px; align-items: center; }
.silbox { display: grid; place-items: center; min-height: 140px; }
.silhouette { width: 100%; height: auto; max-height: 340px; }
.sil-now path, .sil-now ellipse { fill: var(--lime-soft); stroke: var(--lime); stroke-width: 1.6; }
.sil-ghost path, .sil-ghost ellipse { fill: none; stroke: var(--muted); stroke-width: 1.2; stroke-dasharray: 4 4; }
.sil-scale { stroke: var(--dim); stroke-width: 1; }
.sil-label { fill: var(--muted); font: 600 10px "IBM Plex Sans", sans-serif; }
.ratios p { margin: 2px 0; }

.facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 10px; }
.facts div { display: grid; text-align: center; background: var(--panel2); border-radius: 10px; padding: 10px 4px; }
.facts .v { font: 700 1rem Montserrat, sans-serif; }
.supprow { display: grid; grid-template-columns: 1.3fr 1fr auto; gap: 8px; align-items: center; margin-top: 8px; }
.supprow input { min-width: 0; }
details.card > summary { cursor: pointer; font: 700 1rem Montserrat, sans-serif; }
details.card[open] > summary { margin-bottom: 8px; }

@media (max-width: 420px) {
  .silwrap { grid-template-columns: 1fr; }
  .silbox { max-width: 240px; margin: 0 auto; }
  .facts { grid-template-columns: repeat(2, 1fr); }
  .grid3 { grid-template-columns: 1fr; }
}
.sparkcell { width: 96px; }
.spark { width: 90px; height: 24px; display: block; margin-left: auto; }
.spark polyline { fill: none; stroke: var(--lime); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark circle { fill: var(--lime); }
details.sub { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
details.sub > summary { cursor: pointer; font-weight: 600; color: var(--muted); }

/* iPhone can turn an email address into a mail link on its own; keep taps on the row. */
a[x-apple-data-detectors] { color: inherit !important; text-decoration: none !important; pointer-events: none; }
.rowlink { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; cursor: pointer; }
.version { text-align: center; margin: 8px 0 24px; }
