/* PoopTracker: playful family utility, designed to fit the phone viewport. */
@font-face {
  font-family: "Bowlby One SC";
  src: url("/fonts/bowlby-one-sc-latin.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Nunito";
  src: url("/fonts/nunito-700-900-latin.woff2") format("woff2");
  font-style: normal;
  font-weight: 700 900;
  font-display: swap;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --paper: #f7f3ea;
  --panel: #fffdf7;
  --muted: #eee6d8;
  --ink: #201d18;
  --line: #d9cebd;
  --orange: #ff6b35;
  --yellow: #ffd84d;
  --blue: #65c7e8;
  --pink: #ff9caa;
  --green: #acd96f;
  --brown: #b97850;
  --warn: #c8442f;
  --good: #4d9e52;
  --shadow: 2px 2px 0 var(--ink);
  /* Compatibility aliases used by the original live-data sheets and charts. */
  --bg: var(--paper);
  --card: var(--panel);
  --card2: var(--muted);
  --ink-soft: color-mix(in srgb, var(--ink) 58%, transparent);
  --amber: var(--yellow);
  --terra: var(--orange);
}

body.night {
  --paper: #171512;
  --panel: #211e19;
  --muted: #2b2721;
  --ink: #f7f0df;
  --line: #51493d;
  --orange: #ff7b47;
  --yellow: #e9c84b;
  --blue: #69bcd9;
  --pink: #e98998;
  --green: #91bd63;
  --brown: #a86e4b;
  --warn: #ef715d;
  --good: #78bd79;
  --shadow: 2px 2px 0 #050505;
}

html,
body {
  width: 100%;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
}

html {
  font-size: 17px;
}

body {
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 8% 15%, color-mix(in srgb, var(--yellow) 18%, transparent), transparent 29%),
    radial-gradient(circle at 92% 78%, color-mix(in srgb, var(--blue) 18%, transparent), transparent 31%),
    #d8d0c3;
  color: var(--ink);
  font-family: "Nunito", ui-rounded, sans-serif;
  font-weight: 800;
  transition: background 220ms ease, color 220ms ease;
}

button,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

#app {
  width: min(100%, 760px);
  height: 100dvh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background:
    linear-gradient(90deg, transparent 0 98%, color-mix(in srgb, var(--orange) 5%, transparent) 98%),
    var(--paper);
  position: relative;
}

@media (min-width: 761px) {
  #app {
    height: min(920px, 100dvh);
    border: 2px solid var(--ink);
    border-radius: 18px;
    box-shadow: 8px 8px 0 rgba(32, 29, 24, 0.3);
  }
}

.app-topbar {
  flex: 0 0 calc(54px + env(safe-area-inset-top));
  min-height: 0;
  display: flex;
  align-items: end;
  gap: 9px;
  padding: env(safe-area-inset-top) 12px 7px;
  border-bottom: 1px solid var(--line);
}

.brand {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand > span {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 2px 2px 0 var(--ink);
  font-size: 1.15rem;
}

.brand > div {
  min-width: 0;
  display: grid;
  line-height: 1;
}

.brand strong {
  overflow: hidden;
  font-family: "Bowlby One SC", sans-serif;
  font-size: 0.92rem;
  font-weight: 400;
  letter-spacing: -0.025em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.brand small {
  margin-top: 3px;
  font-size: 0.45rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  opacity: 0.52;
  text-transform: uppercase;
}

.top-actions {
  display: flex;
  gap: 5px;
}

.top-actions button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  background: var(--panel);
  cursor: pointer;
  font-size: 0.92rem;
}

.top-actions button:first-child {
  background: var(--yellow);
  box-shadow: 2px 2px 0 var(--ink);
}

.kidtabs {
  flex: 0 0 54px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  padding: 7px 12px 5px;
}

.kidtabs button {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  cursor: pointer;
  text-align: left;
}

.kidtabs button > span {
  font-size: 0.9rem;
}

.kidtabs button strong {
  overflow: hidden;
  font-size: 0.66rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kidtabs button small {
  font-size: 0.41rem;
  letter-spacing: 0.06em;
  opacity: 0.48;
  text-transform: uppercase;
}

.kidtabs button.on {
  border-color: var(--ink);
  background: var(--yellow);
  box-shadow: 2px 2px 0 var(--ink);
}

.rolebar {
  flex: 0 0 25px;
  margin: 0 12px 4px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--muted);
  font-size: 0.48rem;
}

.view-stack {
  flex: 1 1 0;
  min-height: 0;
  position: relative;
}

.view-panel {
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.today-panel {
  display: flex;
  flex-direction: column;
}

.chips {
  flex: 0 0 57px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 7px 12px 4px;
}

.chips article,
.log-summary article {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 5px;
  overflow: hidden;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
}

.chips article > span,
.log-summary article > span {
  width: 23px;
  height: 23px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--muted);
  font-size: 0.72rem;
}

.chips article.orange > span,
.log-summary article.orange > span,
.meaning-grid article.orange > span {
  background: var(--orange);
}

.chips article.blue > span,
.log-summary article.blue > span,
.meaning-grid article.blue > span {
  background: var(--blue);
}

.chips article.pink > span,
.meaning-grid article.pink > span {
  background: var(--pink);
}

.chips article.green > span,
.log-summary article.green > span,
.meaning-grid article.green > span {
  background: var(--green);
}

.chips article.yellow > span,
.meaning-grid article.yellow > span {
  background: var(--yellow);
}

.chips article > div,
.log-summary article > div,
.meaning-grid article > div {
  min-width: 0;
  display: grid;
  line-height: 1.03;
}

.chips small,
.log-summary small,
.meaning-grid small {
  overflow: hidden;
  font-size: 0.38rem;
  font-weight: 900;
  letter-spacing: 0.045em;
  opacity: 0.5;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.chips strong,
.log-summary strong,
.meaning-grid strong {
  overflow: hidden;
  font-size: 0.65rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chips p,
.log-summary p,
.meaning-grid p {
  overflow: hidden;
  margin: 1px 0 0;
  font-size: 0.34rem;
  opacity: 0.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#nudges {
  flex: 0 0 auto;
  max-height: 30px;
  display: flex;
  gap: 5px;
  overflow: hidden;
  padding: 0 12px 3px;
}

.nudge {
  width: 100%;
  min-height: 27px;
  overflow: hidden;
  padding: 4px 8px;
  border: 1px dashed var(--ink);
  border-radius: 7px;
  background: var(--yellow);
  cursor: pointer;
  font-size: 0.45rem;
  font-weight: 900;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nudge.warn {
  border-style: solid;
  background: var(--pink);
}

.section-heading {
  flex: 0 0 23px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  padding: 0 12px 4px;
}

.section-heading span {
  font-size: 0.53rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section-heading small {
  font-size: 0.45rem;
  opacity: 0.46;
}

.grid {
  flex: 0 0 clamp(112px, 20dvh, 146px);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 0 12px 5px;
}

.grid button {
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 3px;
  overflow: hidden;
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  box-shadow: var(--shadow);
  cursor: pointer;
  font-size: 0.59rem;
  font-weight: 900;
  line-height: 1.05;
  text-align: center;
}

.grid button:active {
  box-shadow: none;
  transform: translate(2px, 2px);
}

.grid button .ico {
  font-size: clamp(1.08rem, 3.3dvh, 1.45rem);
  line-height: 1;
}

.grid button.orange { background: var(--brown); }
.grid button.blue { background: var(--blue); }
.grid button.yellow { background: var(--yellow); }
.grid button.pink { background: var(--pink); }
.grid button.green { background: var(--green); }
.grid button.cream { background: var(--panel); }
.grid button.timer-on { outline: 3px solid var(--orange); }

.grid.expected-grid {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
}

.expected-baby-card {
  min-width: 0;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  overflow: hidden;
  border: 1.5px solid var(--ink);
  border-radius: 11px;
  background:
    radial-gradient(circle at 88% 18%, color-mix(in srgb, var(--blue) 44%, transparent), transparent 32%),
    linear-gradient(120deg, color-mix(in srgb, var(--yellow) 70%, var(--panel)), var(--panel));
  box-shadow: var(--shadow);
}

.expected-baby-card > span {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  background: var(--panel);
  color: var(--orange);
  font-family: "Bowlby One SC", sans-serif;
  font-size: 1.65rem;
  line-height: 1;
}

.expected-baby-card > div {
  min-width: 0;
  display: grid;
  align-content: center;
  line-height: 1.08;
}

.expected-baby-card small {
  font-size: 0.38rem;
  letter-spacing: 0.09em;
  opacity: 0.55;
  text-transform: uppercase;
}

.expected-baby-card h2 {
  overflow: hidden;
  margin: 1px 0 2px;
  font-family: "Bowlby One SC", sans-serif;
  font-size: clamp(0.67rem, 3.5vw, 0.88rem);
  font-weight: 400;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.expected-baby-card p {
  overflow: hidden;
  font-size: 0.43rem;
  opacity: 0.62;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.expected-baby-card button,
.expected-master > button {
  width: fit-content;
  min-height: 23px;
  margin-top: 5px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 7px;
  border: 1px solid var(--ink);
  border-radius: 6px;
  background: var(--ink);
  box-shadow: none;
  color: var(--paper);
  font-size: 0.42rem;
  font-weight: 900;
}

.today-rhythm-wrap {
  flex: 0 0 101px;
  min-height: 0;
  margin: 0 12px 4px;
  position: relative;
}

.expected-prep {
  height: 100%;
  display: grid;
  grid-template-rows: 29px minmax(0, 1fr);
  overflow: hidden;
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  background: var(--panel);
}

.expected-prep > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 4px 7px;
  border-bottom: 1px solid var(--line);
  background: var(--muted);
}

.expected-prep > header span {
  font-size: 0.36rem;
  letter-spacing: 0.08em;
  opacity: 0.5;
  text-transform: uppercase;
}

.expected-prep > header strong {
  font-family: "Bowlby One SC", sans-serif;
  font-size: 0.49rem;
  font-weight: 400;
  text-transform: uppercase;
}

.expected-prep > div {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.expected-prep article {
  min-width: 0;
  display: grid;
  grid-template-columns: 21px minmax(0, 1fr);
  align-items: center;
  gap: 4px;
  padding: 4px 5px;
  border-right: 1px solid var(--line);
}

.expected-prep article:last-child {
  border-right: 0;
}

.expected-prep article > span {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--yellow);
  color: #201d18;
  font-size: 0.48rem;
}

.expected-prep p {
  min-width: 0;
  overflow: hidden;
  font-size: 0.32rem;
  line-height: 1.06;
}

.expected-prep p b {
  display: block;
  overflow: hidden;
  margin-bottom: 1px;
  font-size: 0.36rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.expected-empty strong,
.expected-empty span {
  display: block;
}

.rhythm-open {
  z-index: 3;
  position: absolute;
  inset: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
}

.rhythm-open:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 2px;
}

.tl {
  flex: 1 1 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  margin: 0 12px;
  border-top: 1px solid var(--line);
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.tl .row {
  min-height: 43px;
  display: grid;
  grid-template-columns: 27px minmax(0, 1fr) auto auto auto;
  gap: 6px;
  align-items: center;
  padding: 5px 2px;
  border-bottom: 1px solid var(--line);
}

.tl .event-icon {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--muted);
  font-size: 0.7rem;
}

.tl .d {
  min-width: 0;
  overflow: hidden;
  font-size: 0.56rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tl time {
  font-size: 0.48rem;
  opacity: 0.5;
  white-space: nowrap;
}

.tl .sw {
  width: 8px;
  height: 8px;
  border: 1px solid var(--ink);
  border-radius: 2px;
}

.tl button {
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 0.62rem;
  opacity: 0.52;
}

.stats-view {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px 12px 8px;
}

.stats-heading {
  flex: 0 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.stats-heading > div {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.stats-heading > div > span {
  flex: 0 0 auto;
  padding: 4px 5px;
  border-radius: 4px;
  background: var(--orange);
  color: #201d18;
  font-size: 0.4rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.stats-heading > div > strong {
  overflow: hidden;
  font-family: "Bowlby One SC", sans-serif;
  font-size: 0.72rem;
  font-weight: 400;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.range-trigger {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--muted);
  cursor: pointer;
  font-size: 0.43rem;
  text-transform: uppercase;
}

.range-trigger span {
  font-size: 0.68rem;
}

.range-trigger i {
  font-style: normal;
  opacity: 0.5;
}

.stats-lenses {
  flex: 0 0 37px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--muted);
}

.stats-lenses button {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  font-size: 0.48rem;
  font-weight: 900;
}

.stats-lenses button span {
  font-size: 0.68rem;
}

.stats-lenses button.on {
  background: var(--ink);
  color: var(--paper);
}

.stats-lenses.expected button {
  cursor: default;
  opacity: 0.36;
}

.range-trigger:disabled {
  cursor: default;
  opacity: 0.58;
}

.stats-screen {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: hidden;
}

.log-summary {
  flex: 0 0 54px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.master-ledger {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  background: var(--panel);
}

.master-ledger > header {
  flex: 0 0 43px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(120deg, color-mix(in srgb, var(--yellow) 34%, transparent), transparent 64%),
    var(--muted);
}

.master-ledger > header > div {
  min-width: 0;
  display: grid;
  line-height: 1.04;
}

.master-ledger > header span {
  font-size: 0.37rem;
  letter-spacing: 0.08em;
  opacity: 0.5;
  text-transform: uppercase;
}

.master-ledger > header strong {
  overflow: hidden;
  font-family: "Bowlby One SC", sans-serif;
  font-size: 0.58rem;
  font-weight: 400;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.download-trigger {
  min-height: 26px;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 4px 6px;
  border: 1px solid var(--ink);
  border-radius: 7px;
  background: var(--yellow);
  color: #201d18;
  cursor: pointer;
  font-size: 0.41rem;
  font-weight: 900;
  text-transform: uppercase;
}

.download-trigger span {
  font-size: 0.72rem;
}

.master-log-list {
  flex: 1 1 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.expected-master {
  flex: 1 1 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto auto auto;
  place-content: center;
  justify-items: center;
  gap: 12px;
  padding: clamp(18px, 5dvh, 38px) 18px;
  overflow: hidden;
  border: 1.5px solid var(--ink);
  border-radius: 11px;
  background:
    radial-gradient(circle at 86% 12%, color-mix(in srgb, var(--blue) 32%, transparent), transparent 34%),
    radial-gradient(circle at 12% 88%, color-mix(in srgb, var(--yellow) 42%, transparent), transparent 37%),
    var(--panel);
  text-align: center;
}

.expected-master > span {
  width: clamp(62px, 12dvh, 92px);
  height: clamp(62px, 12dvh, 92px);
  display: grid;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 4px 4px 0 var(--ink);
  color: var(--orange);
  font-family: "Bowlby One SC", sans-serif;
  font-size: clamp(1.8rem, 6dvh, 2.8rem);
}

.expected-master-copy {
  max-width: 420px;
}

.expected-master-copy small {
  font-size: 0.42rem;
  letter-spacing: 0.1em;
  opacity: 0.5;
  text-transform: uppercase;
}

.expected-master-copy h2 {
  margin: 3px 0 5px;
  font-family: "Bowlby One SC", sans-serif;
  font-size: clamp(0.9rem, 3dvh, 1.25rem);
  font-weight: 400;
  text-transform: uppercase;
}

.expected-master-copy p {
  font-size: 0.52rem;
  line-height: 1.3;
  opacity: 0.64;
}

.expected-master-grid {
  width: min(100%, 460px);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.expected-master-grid article {
  min-width: 0;
  display: grid;
  padding: 8px 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 82%, var(--muted));
}

.expected-master-grid b {
  font-family: "Bowlby One SC", sans-serif;
  font-size: 0.8rem;
  font-weight: 400;
}

.expected-master-grid span {
  overflow: hidden;
  font-size: 0.42rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.expected-master-grid small {
  font-size: 0.34rem;
  opacity: 0.48;
}

.expected-master > button {
  min-height: 29px;
  margin-top: 0;
  background: var(--orange);
  color: #201d18;
}

.expected-setting-note {
  margin: -3px 0 3px;
  padding: 5px 7px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--yellow) 46%, var(--panel));
  font-size: 0.43rem;
  line-height: 1.2;
}

.log-day > header {
  position: sticky;
  z-index: 2;
  top: 0;
  min-height: 27px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 92%, var(--yellow));
}

.log-day > header button {
  width: 100%;
  min-height: 27px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
  padding: 5px 8px;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.log-day > header strong {
  font-size: 0.49rem;
  text-transform: uppercase;
}

.log-day > header span {
  min-width: 0;
  overflow: hidden;
  font-size: 0.4rem;
  opacity: 0.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.log-day > header b {
  font-size: 0.39rem;
  text-transform: uppercase;
}

.master-log-row {
  min-height: 40px;
  display: grid;
  grid-template-columns: 25px minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
  padding: 5px 8px;
  border-bottom: 1px solid var(--line);
}

.master-log-row > span {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--muted);
  font-size: 0.68rem;
}

.master-log-row > div {
  min-width: 0;
  display: grid;
}

.master-log-row strong,
.master-log-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.master-log-row strong {
  font-size: 0.53rem;
}

.master-log-row small {
  font-size: 0.36rem;
  opacity: 0.45;
}

.master-log-row time {
  font-size: 0.43rem;
  opacity: 0.5;
}

.health-card,
.calendar-card,
.journey-card {
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  background: var(--panel);
}

.health-card {
  flex: 1 1 0;
  min-height: 118px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 7px 8px 6px;
  background:
    radial-gradient(circle at 94% 4%, color-mix(in srgb, var(--blue) 27%, transparent), transparent 36%),
    var(--panel);
}

.mode-tabs {
  flex: 0 0 24px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 5px;
}

.mode-tabs button {
  border: 1px solid var(--ink);
  border-radius: 6px;
  background: var(--muted);
  cursor: pointer;
  font-size: 0.42rem;
  font-weight: 900;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.mode-tabs button.on {
  background: var(--ink);
  color: var(--paper);
}

.meaning-grid {
  flex: 0 0 86px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

.meaning-grid article {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px;
  align-items: center;
  overflow: hidden;
  padding: 4px 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.meaning-grid article > span {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  background: var(--muted);
  font-size: 0.61rem;
}

.care-strip {
  flex: 0 0 39px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
}

.care-strip article {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  overflow: hidden;
  padding: 4px 5px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--muted);
}

.care-strip article > span {
  font-size: 0.63rem;
}

.care-strip article > div {
  min-width: 0;
  display: grid;
}

.care-strip small,
.care-strip strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.care-strip small {
  font-size: 0.32rem;
  opacity: 0.5;
  text-transform: uppercase;
}

.care-strip strong {
  font-size: 0.46rem;
}

.insight-card,
.journey-note {
  flex: 0 0 45px;
  min-width: 0;
  display: grid;
  grid-template-columns: 27px minmax(0, 1fr) auto;
  gap: 7px;
  align-items: center;
  padding: 6px 8px;
  border: 1.5px solid var(--ink);
  border-radius: 9px;
  background: var(--ink);
  color: var(--paper);
}

.insight-card > span,
.journey-note > span {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--orange);
  color: #201d18;
}

.insight-card p,
.journey-note p {
  min-width: 0;
  overflow: hidden;
  font-size: 0.43rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.insight-card p strong,
.journey-note strong {
  display: block;
  color: var(--yellow);
  font-size: 0.37rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.insight-card > b {
  font-family: "Bowlby One SC", sans-serif;
  font-size: 0.8rem;
  font-weight: 400;
}

.trend-stack {
  flex: 1 1 0;
  min-height: 0;
  display: grid;
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: 3px;
}

.trend-stack article {
  min-height: 0;
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 5px;
  align-items: center;
  padding: 2px 4px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--muted) 76%, transparent);
}

.trend-stack article > div {
  min-width: 0;
  display: grid;
}

.trend-stack span {
  overflow: hidden;
  font-size: 0.36rem;
  opacity: 0.55;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.trend-stack strong {
  font-size: 0.48rem;
}

.trend-stack svg {
  width: 100%;
  height: 25px;
}

.calendar-card {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 7px;
  background:
    radial-gradient(circle at 96% 0%, color-mix(in srgb, var(--blue) 24%, transparent), transparent 35%),
    var(--panel);
}

.calendar-top {
  flex: 0 0 43px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
}

.calendar-top > div:first-child {
  min-width: 0;
  display: grid;
  line-height: 1.02;
}

.calendar-top span,
.calendar-top small {
  overflow: hidden;
  font-size: 0.36rem;
  letter-spacing: 0.07em;
  opacity: 0.48;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.calendar-top strong {
  overflow: hidden;
  font-family: "Bowlby One SC", sans-serif;
  font-size: 0.74rem;
  font-weight: 400;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.calendar-controls {
  display: grid;
  grid-template-columns: 26px auto 26px;
  gap: 3px;
  align-items: center;
}

.calendar-controls button {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--ink);
  border-radius: 7px;
  background: var(--paper);
  cursor: pointer;
  font-size: 0.92rem;
}

.calendar-controls button:disabled {
  cursor: default;
  opacity: 0.2;
}

.calendar-controls b {
  padding: 5px 6px;
  border-radius: 6px;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.4rem;
  white-space: nowrap;
}

.calendar-weekdays {
  flex: 0 0 15px;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 3px;
  align-items: center;
}

.calendar-weekdays span {
  font-size: 0.34rem;
  opacity: 0.44;
  text-align: center;
}

.month-grid {
  flex: 1 1 0;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-template-rows: repeat(6, minmax(0, 1fr));
  gap: 3px;
}

.calendar-cell {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: auto 1fr auto;
  gap: 1px;
  align-items: center;
  overflow: hidden;
  padding: 2px 3px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: color-mix(in srgb, var(--muted) 58%, transparent);
  cursor: pointer;
  text-align: left;
}

.calendar-cell.outside {
  border-color: transparent;
  background: transparent;
}

.calendar-cell.logged {
  background: color-mix(in srgb, var(--green) 32%, var(--panel));
}

.calendar-cell.today {
  border: 2px solid var(--ink);
}

.calendar-cell small {
  grid-column: 1 / -1;
  align-self: start;
  font-size: 0.34rem;
  opacity: 0.58;
}

.calendar-cell strong,
.calendar-cell span {
  align-self: center;
  font-size: 0.38rem;
  text-align: center;
}

.calendar-cell > i {
  grid-column: 1 / -1;
  height: 3px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
}

.calendar-cell > i b {
  --fill: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, currentColor var(--fill), var(--line) 0);
}

.calendar-cell .blue { color: var(--blue); }
.calendar-cell .pink { color: var(--pink); }
.calendar-cell .orange { color: var(--orange); }
.calendar-cell .green { color: var(--green); }

.calendar-legend {
  flex: 0 0 21px;
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 10px;
  font-size: 0.33rem;
  text-transform: uppercase;
}

.calendar-legend span {
  display: flex;
  align-items: center;
  gap: 3px;
}

.calendar-legend i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.calendar-legend i.blue { background: var(--blue); }
.calendar-legend i.pink { background: var(--pink); }
.calendar-legend i.orange { background: var(--orange); }
.calendar-legend i.green { background: var(--green); }

.journey-card {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 7px;
  background:
    radial-gradient(circle at 95% 3%, color-mix(in srgb, var(--green) 28%, transparent), transparent 34%),
    var(--panel);
}

.journey-title {
  flex: 0 0 31px;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 7px;
}

.journey-title > div {
  min-width: 0;
  display: grid;
  line-height: 1.02;
}

.journey-title span {
  font-size: 0.36rem;
  letter-spacing: 0.08em;
  opacity: 0.5;
  text-transform: uppercase;
}

.journey-title strong {
  overflow: hidden;
  font-family: "Bowlby One SC", sans-serif;
  font-size: 0.66rem;
  font-weight: 400;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.journey-title em {
  padding: 4px 6px;
  border: 1px solid var(--ink);
  border-radius: 99px;
  font-size: 0.39rem;
  font-style: normal;
  white-space: nowrap;
}

.rhythm-comparison {
  flex: 1 1 0;
  min-height: 0;
  display: grid;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

.comparison-strip {
  flex: 0 0 41px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin-top: 4px;
}

.comparison-strip article {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 4px;
  align-content: center;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--muted);
  overflow: hidden;
}

.comparison-strip article > span {
  grid-row: 1 / -1;
  align-self: center;
  font-size: 0.62rem;
}

.comparison-strip strong,
.comparison-strip small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.comparison-strip strong {
  font-size: 0.42rem;
}

.comparison-strip small {
  font-size: 0.3rem;
  opacity: 0.5;
  text-transform: uppercase;
}

.journey-signals {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
}

.journey-signals > .trend-stack {
  min-height: 105px;
}

.journey-note {
  background: var(--green);
  color: #201d18;
}

.journey-note.building {
  background: var(--yellow);
}

.journey-note p strong {
  color: #201d18;
}

.rhythm-graph {
  min-height: 0;
  overflow: hidden;
  padding: 7px 8px 6px;
  border: 1px solid var(--ink);
  border-radius: 10px;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--yellow) 18%, transparent), transparent 62%),
    var(--panel);
}

.today-rhythm-wrap .rhythm-graph {
  height: 100%;
}

.rhythm-graph > header {
  height: 28px;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 7px;
}

.rhythm-graph > header > div {
  min-width: 0;
  display: grid;
  line-height: 1;
}

.rhythm-graph > header span {
  font-size: 0.35rem;
  letter-spacing: 0.08em;
  opacity: 0.5;
  text-transform: uppercase;
}

.rhythm-graph > header strong {
  overflow: hidden;
  margin-top: 2px;
  font-size: 0.51rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rhythm-graph > header > b {
  flex: 0 0 auto;
  padding: 4px 5px;
  border-radius: 6px;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.35rem;
  text-transform: uppercase;
  white-space: nowrap;
}

.rhythm-axis {
  display: flex;
  justify-content: space-between;
  margin: 0 17px 1px 41px;
}

.rhythm-axis span {
  font-size: 0.28rem;
  opacity: 0.4;
}

.rhythm-tracks {
  display: grid;
  gap: 2px;
}

.rhythm-track {
  min-width: 0;
  height: 15px;
  display: grid;
  grid-template-columns: 39px minmax(0, 1fr) 14px;
  gap: 3px;
  align-items: center;
}

.rhythm-track > strong {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 2px;
  overflow: hidden;
  font-size: 0.34rem;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.rhythm-track > strong span {
  font-size: 0.49rem;
}

.rhythm-track > div {
  height: 10px;
  border-block: 1px solid var(--line);
  background:
    repeating-linear-gradient(to right, transparent 0, transparent calc(25% - 1px), color-mix(in srgb, var(--ink) 13%, transparent) calc(25% - 1px), color-mix(in srgb, var(--ink) 13%, transparent) 25%),
    var(--muted);
  position: relative;
}

.rhythm-dot {
  --x: 50%;
  --size: 7px;
  --alpha: 1;
  width: var(--size);
  height: var(--size);
  display: block;
  border: 1px solid #201d18;
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--panel);
  opacity: var(--alpha);
  position: absolute;
  top: 50%;
  left: var(--x);
  transform: translate(-50%, -50%);
}

.rhythm-dot.blue { background: var(--blue); }
.rhythm-dot.pink { background: var(--pink); }
.rhythm-dot.orange { background: var(--orange); }
.rhythm-dot.green { background: var(--green); }
.rhythm-dot.yellow { background: var(--yellow); }

.now-line {
  --x: 50%;
  width: 1px;
  height: 100%;
  display: block;
  background: var(--ink);
  opacity: 0.3;
  position: absolute;
  top: 0;
  left: var(--x);
}

.now-line::after {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--ink);
  position: absolute;
  top: -2px;
  left: -2px;
}

.rhythm-track > b {
  font-size: 0.35rem;
  opacity: 0.52;
  text-align: right;
}

.rhythm-mini,
.health-rhythm,
.rhythm-compare {
  padding: 5px 7px 4px;
}

.rhythm-mini > header,
.health-rhythm > header,
.rhythm-compare > header {
  height: 21px;
}

.rhythm-mini > header span,
.health-rhythm > header span,
.rhythm-compare > header span {
  font-size: 0.3rem;
}

.rhythm-mini > header strong,
.health-rhythm > header strong,
.rhythm-compare > header strong {
  margin-top: 1px;
  font-size: 0.43rem;
}

.rhythm-mini > header > b,
.health-rhythm > header > b,
.rhythm-compare > header > b {
  padding: 3px 4px;
  font-size: 0.3rem;
}

.rhythm-mini .rhythm-tracks,
.health-rhythm .rhythm-tracks,
.rhythm-compare .rhythm-tracks {
  gap: 1px;
}

.rhythm-mini .rhythm-track,
.health-rhythm .rhythm-track,
.rhythm-compare .rhythm-track {
  height: 11px;
}

.rhythm-mini .rhythm-track > div,
.health-rhythm .rhythm-track > div,
.rhythm-compare .rhythm-track > div {
  height: 9px;
}

.health-rhythm {
  flex: 1 1 0;
  border: 0;
  background: transparent;
}

.rhythm-compare {
  height: 100%;
  min-height: 72px;
}

.notes-view,
.guide-view {
  display: flex;
  flex-direction: column;
  padding: 7px 12px;
}

.view-title {
  flex: 0 0 47px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 5px;
}

.view-title > div {
  display: grid;
  line-height: 1;
}

.view-title small {
  font-size: 0.4rem;
  letter-spacing: 0.09em;
  opacity: 0.5;
  text-transform: uppercase;
}

.view-title strong {
  font-family: "Bowlby One SC", sans-serif;
  font-size: 0.95rem;
  font-weight: 400;
  text-transform: uppercase;
}

.view-title > span {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  background: var(--yellow);
}

.scroll-list {
  flex: 1 1 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.composer {
  flex: 0 0 101px;
  padding: 0 0 7px;
}

.composer textarea {
  width: 100%;
  height: 63px;
  min-height: 0;
  resize: none;
  padding: 8px 9px;
  border: 1.5px solid var(--ink);
  border-radius: 9px;
  background: var(--panel);
  color: var(--ink);
  font-size: 0.55rem;
}

.composer button {
  width: 100%;
  height: 30px;
  margin-top: 4px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--orange);
  color: #201d18;
  cursor: pointer;
  font-size: 0.49rem;
  font-weight: 900;
  text-transform: uppercase;
}

.note {
  padding: 8px 9px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.note .who {
  color: var(--orange);
  font-size: 0.45rem;
  text-transform: uppercase;
}

.note .body {
  margin: 2px 0;
  font-size: 0.57rem;
  line-height: 1.35;
  white-space: pre-wrap;
}

.note .when {
  font-size: 0.38rem;
  opacity: 0.45;
}

.guide {
  padding: 0;
}

.gcard {
  margin-bottom: 6px;
  padding: 9px 10px;
  border: 1.5px solid var(--ink);
  border-radius: 9px;
  background: var(--panel);
}

.gcard.red {
  border-color: var(--warn);
  background: color-mix(in srgb, var(--pink) 24%, var(--panel));
}

.gcard h4 {
  margin-bottom: 4px;
  font-size: 0.58rem;
  text-transform: uppercase;
}

.gcard p,
.gcard li {
  font-size: 0.48rem;
  line-height: 1.4;
}

.gcard ul {
  padding-left: 15px;
}

.gcard .src {
  margin-top: 4px;
  font-size: 0.36rem;
  opacity: 0.5;
}

.disclaimer {
  flex: 0 0 34px;
  padding: 4px 3px 0;
  font-size: 0.36rem;
  line-height: 1.25;
  opacity: 0.52;
}

nav {
  flex: 0 0 calc(52px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 5px 7px env(safe-area-inset-bottom);
  border-top: 1px solid var(--line);
  background: var(--muted);
}

nav button {
  min-width: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 1px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  cursor: pointer;
  font-size: 0.42rem;
  font-weight: 900;
  letter-spacing: 0.025em;
  position: relative;
  text-transform: uppercase;
}

nav button .ico {
  font-size: 0.82rem;
}

nav button.on {
  background: var(--ink);
  color: var(--paper);
}

nav .badge {
  position: absolute;
  top: 2px;
  right: 23%;
  padding: 1px 5px;
  border-radius: 99px;
  background: var(--warn);
  color: white;
  font-size: 0.35rem;
}

#veil {
  z-index: 60;
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(18, 16, 13, 0.58);
  backdrop-filter: blur(2px);
}

#veil.show {
  display: block;
}

.sheet {
  z-index: 61;
  width: min(100%, 760px);
  max-height: calc(100dvh - 8px);
  display: none;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 18px 16px max(17px, env(safe-area-inset-bottom));
  border: 1.5px solid var(--ink);
  border-bottom: 0;
  border-radius: 19px 19px 0 0;
  background: var(--paper);
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  margin-inline: auto;
}

.sheet.show {
  display: block;
  animation: sheet-up 180ms ease both;
}

.sheet h2 {
  margin-bottom: 9px;
  font-family: "Bowlby One SC", sans-serif;
  font-size: 1rem;
  font-weight: 400;
  text-transform: uppercase;
}

.sheet-kicker {
  display: block;
  margin-bottom: 3px;
  font-size: 0.44rem;
  letter-spacing: 0.1em;
  opacity: 0.5;
  text-transform: uppercase;
}

.sheet-copy {
  margin: -3px 0 11px;
  font-size: 0.57rem;
  opacity: 0.58;
}

.sheet .sub {
  margin: 10px 0 5px;
  font-size: 0.5rem;
  letter-spacing: 0.05em;
  opacity: 0.54;
  text-transform: uppercase;
}

.chiprow {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chiprow button {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border: 1.5px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  cursor: pointer;
  font-size: 0.53rem;
  font-weight: 900;
}

.chiprow button.on {
  border-color: var(--ink);
  background: var(--yellow);
  box-shadow: 2px 2px 0 var(--ink);
}

.chiprow button.warnchip.on {
  background: var(--pink);
}

.chiprow .sw {
  width: 14px;
  height: 14px;
  border: 1px solid var(--ink);
  border-radius: 4px;
}

.sheet .actions {
  display: flex;
  gap: 7px;
  margin-top: 13px;
}

.sheet .actions button {
  min-height: 42px;
  flex: 1;
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.58rem;
  font-weight: 900;
  text-transform: uppercase;
}

.sheet .actions .save {
  background: var(--orange);
  color: #201d18;
}

.sheet .actions .cancel {
  background: var(--muted);
}

.stepper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stepper button {
  width: 48px;
  height: 48px;
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  background: var(--muted);
  cursor: pointer;
  font-size: 1.2rem;
}

.stepper b {
  min-width: 82px;
  font-size: 1.15rem;
  text-align: center;
}

.timeadj {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 11px;
}

.timeadj button {
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--panel);
  cursor: pointer;
  font-size: 0.48rem;
}

.timeadj b {
  flex: 1;
  font-size: 0.53rem;
  text-align: center;
}

.flag {
  display: none;
  margin-top: 11px;
  padding: 10px;
  border: 1.5px solid var(--warn);
  border-radius: 9px;
  background: var(--panel);
  font-size: 0.53rem;
  line-height: 1.38;
}

.flag.show {
  display: block;
}

.flag b {
  color: var(--warn);
}

.sheetinput,
.set input {
  width: 100%;
  min-height: 40px;
  padding: 8px 9px;
  border: 1.5px solid var(--ink);
  border-radius: 9px;
  background: var(--panel);
  color: var(--ink);
  font-size: 0.57rem;
}

.set label {
  display: block;
  margin: 9px 0 4px;
  font-size: 0.48rem;
  opacity: 0.55;
  text-transform: uppercase;
}

.set .rowbtns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 12px;
}

.set .rowbtns button,
.set .rowbtns a {
  min-height: 40px;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--ink);
  border-radius: 9px;
  background: var(--panel);
  cursor: pointer;
  font-size: 0.5rem;
  text-align: center;
  text-decoration: none;
}

.range-presets,
.download-options {
  display: grid;
  gap: 6px;
}

.range-presets > button,
.download-options > button {
  min-height: 55px;
  display: grid;
  grid-template-columns: 35px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 7px 9px;
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  background: var(--panel);
  cursor: pointer;
  text-align: left;
}

.range-presets > button > span,
.download-options > button > span {
  width: 33px;
  height: 33px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--muted);
}

.range-presets > button.on {
  background: var(--yellow);
}

.range-presets > button > div,
.download-options > button > div {
  min-width: 0;
  display: grid;
}

.range-presets strong,
.download-options strong {
  font-size: 0.58rem;
}

.range-presets small,
.download-options small {
  font-size: 0.43rem;
  opacity: 0.5;
}

.custom-range {
  display: grid;
  gap: 7px;
  margin-top: 9px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--muted);
}

.custom-range > div {
  display: grid;
}

.custom-range > div strong {
  font-size: 0.58rem;
}

.custom-range > div small {
  font-size: 0.43rem;
  opacity: 0.5;
}

.custom-range section {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 5px;
  align-items: end;
}

.custom-range label {
  display: grid;
  gap: 3px;
  font-size: 0.42rem;
  text-transform: uppercase;
}

.custom-range input {
  min-width: 0;
  height: 37px;
  padding: 4px 5px;
  border: 1px solid var(--ink);
  border-radius: 7px;
  background: var(--panel);
  color: var(--ink);
  font-size: 0.45rem;
}

.custom-range section i {
  padding-bottom: 10px;
  font-style: normal;
}

.custom-range > button {
  min-height: 36px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--orange);
  color: #201d18;
  cursor: pointer;
  font-size: 0.5rem;
  font-weight: 900;
  text-transform: uppercase;
}

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

.tool-grid button {
  min-height: 73px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow);
  cursor: pointer;
  font-size: 0.5rem;
}

.tool-grid button span {
  font-size: 1.15rem;
}

.mixed-note {
  display: grid;
  grid-template-columns: 29px minmax(0, 1fr);
  gap: 7px;
  align-items: center;
  margin-top: 11px;
  padding: 8px;
  border: 1px solid var(--ink);
  border-radius: 9px;
  background: var(--yellow);
  color: #201d18;
  font-size: 0.5rem;
}

.mixed-note > span {
  font-size: 1rem;
}

.daily-record-sheet {
  height: calc(100dvh - 8px);
  max-height: calc(100dvh - 8px);
  display: none;
  flex-direction: column;
  overflow: hidden;
  padding: 15px 14px max(12px, env(safe-area-inset-bottom));
}

.daily-record-sheet.show {
  display: flex;
}

.sheet-close {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  align-self: end;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  background: var(--panel);
  cursor: pointer;
  font-size: 1rem;
  position: absolute;
  top: 13px;
  right: 13px;
}

.daily-head {
  flex: 0 0 64px;
  display: grid;
  align-content: center;
  padding: 0;
}

.daily-head span {
  font-size: 0.4rem;
  letter-spacing: 0.08em;
  opacity: 0.5;
  text-transform: uppercase;
}

.daily-head h2 {
  max-width: calc(100% - 42px);
  margin: 2px 0 0;
  overflow: hidden;
  font-size: 0.9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.daily-head p {
  font-size: 0.45rem;
  opacity: 0.5;
}

.daily-totals {
  flex: 0 0 51px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  margin: 6px 0;
}

.daily-totals article {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: 0 3px;
  align-content: center;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--muted);
}

.daily-totals article > span {
  grid-row: 1 / -1;
  align-self: center;
  font-size: 0.66rem;
}

.daily-totals strong,
.daily-totals small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.daily-totals strong {
  align-self: end;
  font-size: 0.57rem;
}

.daily-totals small {
  align-self: start;
  font-size: 0.34rem;
  opacity: 0.5;
  text-transform: uppercase;
}

.daily-rhythm {
  flex: 0 0 151px;
  margin-bottom: 6px;
}

.daily-timeline-head {
  flex: 0 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px 4px;
  font-size: 0.4rem;
  text-transform: uppercase;
}

.daily-timeline-head b {
  opacity: 0.4;
}

.daily-timeline {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.daily-timeline article {
  min-height: 42px;
  display: grid;
  grid-template-columns: 27px minmax(0, 1fr) auto auto auto;
  gap: 5px;
  align-items: center;
  padding: 4px 2px;
  border-bottom: 1px solid var(--line);
}

.daily-timeline article > span {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--muted);
  font-size: 0.67rem;
}

.daily-timeline article > div {
  min-width: 0;
  display: grid;
}

.daily-timeline strong,
.daily-timeline small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.daily-timeline strong {
  font-size: 0.5rem;
}

.daily-timeline small {
  font-size: 0.34rem;
  opacity: 0.45;
}

.daily-timeline time {
  font-size: 0.42rem;
  opacity: 0.5;
}

.daily-timeline button {
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 0.5rem;
}

.daily-foot {
  flex: 0 0 30px;
  display: flex;
  align-items: end;
  gap: 5px;
  font-size: 0.37rem;
  opacity: 0.55;
}

.chart {
  margin: 6px 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.chart h4 {
  margin-bottom: 5px;
  font-size: 0.45rem;
  text-transform: uppercase;
}

.chartnote {
  font-size: 0.4rem;
  opacity: 0.5;
}

.bars {
  height: 52px;
  display: flex;
  align-items: end;
  gap: 2px;
}

.bars .b {
  min-height: 2px;
  flex: 1;
  border-radius: 3px 3px 0 0;
  background: var(--yellow);
}

.bars .b.today {
  background: var(--orange);
}

.bardays {
  display: flex;
  gap: 2px;
  font-size: 0.3rem;
}

.bardays span {
  flex: 1;
  text-align: center;
}

.stashrow {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.44rem;
}

.stashrow button {
  margin-left: auto;
  padding: 4px 6px;
  border: 1px solid var(--ink);
  border-radius: 6px;
  background: var(--muted);
}

.stashrow.bad {
  color: var(--warn);
}

.empty {
  height: 100%;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 3px;
  padding: 16px;
  color: var(--ink);
  font-size: 0.52rem;
  opacity: 0.52;
  text-align: center;
}

.hidden {
  display: none !important;
}

#photoview {
  z-index: 70;
  display: none;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.9);
  position: fixed;
  inset: 0;
}

#photoview.show {
  display: grid;
}

#photoview img {
  max-width: 100%;
  max-height: 90dvh;
  border-radius: 10px;
}

#toast {
  max-width: calc(100% - 24px);
}

#print-report {
  display: none;
  padding: 20px;
}

#print-report table {
  width: 100%;
  margin: 8px 0 16px;
  border-collapse: collapse;
}

#print-report td,
#print-report th {
  padding: 4px 6px;
  border: 1px solid #999;
  font-size: 11px;
  text-align: left;
}

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

@media (max-width: 380px) {
  .app-topbar,
  .kidtabs,
  .chips,
  .section-heading,
  .grid,
  #nudges {
    padding-inline: 10px;
  }

  .today-rhythm-wrap,
  .tl,
  .rolebar {
    margin-inline: 10px;
  }

  .stats-view,
  .notes-view,
  .guide-view {
    padding-inline: 10px;
  }

  .kidtabs button small {
    display: none;
  }
}

@media (max-height: 650px) {
  .app-topbar {
    flex-basis: calc(49px + env(safe-area-inset-top));
    padding-bottom: 5px;
  }

  .brand > span {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
  }

  .kidtabs {
    flex-basis: 47px;
    padding-block: 5px 4px;
  }

  .chips {
    flex-basis: 50px;
    padding-top: 4px;
  }

  .section-heading {
    flex-basis: 20px;
    padding-bottom: 3px;
  }

  .grid {
    flex-basis: 105px;
    gap: 5px;
  }

  .today-rhythm-wrap {
    flex-basis: 90px;
  }

  .timeline-heading {
    flex-basis: 20px;
  }

  nav {
    flex-basis: calc(48px + env(safe-area-inset-bottom));
  }

  .stats-view {
    gap: 5px;
    padding-block: 4px 5px;
  }

  .stats-heading {
    flex-basis: 28px;
  }

  .stats-lenses {
    flex-basis: 34px;
  }

  .stats-screen {
    gap: 5px;
  }

  .meaning-grid {
    flex-basis: 80px;
  }

  .care-strip {
    flex-basis: 35px;
  }

  .insight-card,
  .journey-note {
    flex-basis: 41px;
  }

  .comparison-strip {
    display: none;
  }

  .rhythm-compare {
    min-height: 0;
    padding-block: 3px;
  }

  .rhythm-compare > header {
    height: 18px;
  }

  .rhythm-compare .rhythm-track {
    height: 9px;
  }

  .rhythm-compare .rhythm-track > div {
    height: 8px;
  }

  .daily-rhythm {
    flex-basis: 142px;
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  #app {
    width: min(880px, 100%);
  }

  .app-topbar {
    flex-basis: calc(45px + env(safe-area-inset-top));
  }

  .kidtabs {
    flex-basis: 42px;
  }

  .chips {
    flex-basis: 46px;
  }

  .grid {
    flex-basis: 92px;
  }

  .today-rhythm-wrap {
    flex-basis: 83px;
  }

  .timeline-heading,
  .tl {
    display: none;
  }

  nav {
    flex-basis: calc(44px + env(safe-area-inset-bottom));
  }
}

@media print {
  html,
  body {
    height: auto;
    overflow: visible;
    background: white;
    color: black;
  }

  #app,
  #veil,
  .sheet,
  #photoview {
    display: none !important;
  }

  #print-report {
    display: block !important;
  }
}
