/* Phone shell for the P2F food app. Shared look comes from /static/food-app.css. */
:root {
  --m-ink: #042A3C;
  --m-vapor: #F7F7EF;
  --m-chlorophyll: #185D4D;
  --m-flavin: #E1F57B;
  --m-line: #E3E3D8;
  --m-tab-h: 64px;
  --m-safe-top: env(safe-area-inset-top, 0px);
  --m-safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--m-vapor);
  color: var(--m-ink);
  font-family: "Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-tap-highlight-color: transparent;
}
button, a, input, select { touch-action: manipulation; }

/* ---------- wordmark (placeholder wordmark from the creative direction) ---------- */
.m-wordmark {
  display: inline-grid;
  justify-items: center;
  gap: 2px;
  font-family: "Aktiv Grotesk", "Inter", sans-serif;
  font-weight: 400;
  color: inherit;
}
.m-wordmark span {
  padding: 4px 10px;
  border: 1.5px solid currentColor;
  font-size: 22px;
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.m-wordmark small { font-size: 13px; letter-spacing: 0; }
.m-wordmark-sm span { padding: 2px 8px; border-width: 1.2px; font-size: 15px; }

/* ---------- app shell ---------- */
.m-app #screen-tracker {
  display: block;
  max-width: 760px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: calc(var(--m-tab-h) + var(--m-safe-bottom) + 96px); /* clear the floating + button */
}

.m-top {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: calc(var(--m-safe-top) + 10px) 16px 8px;
  background: rgba(247, 247, 239, .92);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid rgba(4, 42, 60, .06);
}
.m-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.m-text-btn {
  min-height: 36px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: var(--m-chlorophyll);
  font-family: "Roboto Mono", ui-monospace, monospace;
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  cursor: pointer;
}
#screen-tracker .m-daybar { margin: 8px 0 0; justify-content: space-between; }
#screen-tracker .m-daybar .fa-day { flex: 1; min-width: 0; }

.m-main { display: grid; gap: 14px; padding: 14px 16px 0; }
.m-pane { display: none; gap: 14px; }
#screen-tracker[data-pane="today"] .m-pane[data-pane-name="today"],
#screen-tracker[data-pane="diary"] .m-pane[data-pane-name="diary"],
#screen-tracker[data-pane="nutrients"] .m-pane[data-pane-name="nutrients"] { display: grid; }

.m-about-img {
  height: 150px;
  margin: -14px -14px 14px;
  border-radius: 18px 18px 0 0;
  background: linear-gradient(180deg, rgba(4, 42, 60, 0) 40%, rgba(4, 42, 60, .55) 100%), url("/static/brand/lab-microscope.jpg") center 35% / cover;
}
.m-about h3 { margin: 4px 0 0; font-family: "Aktiv Grotesk", "Inter", sans-serif; font-weight: 300; font-size: 22px; letter-spacing: -0.01em; }
.m-about p { margin: 8px 0 0; color: #3E5866; font-size: 13px; line-height: 1.5; }
.m-about .m-about-meta { color: #6B7F89; font-size: 12px; }
.m-about a { color: var(--m-chlorophyll); }

/* ---------- floating add button ---------- */
#screen-tracker .m-fab {
  position: fixed;
  z-index: 35;
  right: max(16px, calc(50vw - 380px + 16px));
  bottom: calc(var(--m-tab-h) + var(--m-safe-bottom) + 16px);
  width: 60px;
  height: 60px;
  min-height: 60px;
  padding: 0;
  border-radius: 50%;
  font-family: "Inter", sans-serif;
  font-weight: 300;
  font-size: 34px;
  line-height: 1;
  box-shadow: 0 12px 28px rgba(4, 42, 60, .28);
}

/* ---------- bottom tabs ---------- */
.m-tabs {
  position: fixed;
  z-index: 40;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  height: calc(var(--m-tab-h) + var(--m-safe-bottom));
  padding-bottom: var(--m-safe-bottom);
  background: rgba(255, 255, 255, .94);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-top: 1px solid var(--m-line);
}
.m-tab {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 3px;
  border: 0;
  background: transparent;
  color: #6B7F89;
  font-family: "Roboto Mono", ui-monospace, monospace;
  font-weight: 700;
  font-size: 10px;
  text-transform: uppercase;
  cursor: pointer;
}
.m-tab svg { width: 24px; height: 24px; }
.m-tab[aria-current="page"] { color: var(--m-ink); }
.m-tab[aria-current="page"] svg { color: var(--m-chlorophyll); }

/* ---------- install hint ---------- */
.m-install {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px;
  gap: 8px;
  padding: 12px 12px 12px 14px;
  border-radius: 16px;
  background: var(--m-ink);
  color: var(--m-vapor);
  font-size: 13px;
  line-height: 1.45;
}
.m-install b { color: var(--m-flavin); font-weight: 600; }
.m-install span { display: block; margin-top: 2px; }
.m-install svg { width: 16px; height: 16px; vertical-align: -3px; }
.m-install button {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: rgba(247, 247, 239, .12);
  color: var(--m-vapor);
  font-size: 20px;
  cursor: pointer;
}

/* ---------- sheet: respect the home indicator ---------- */
.m-app .fa-sheet-body { padding-bottom: calc(16px + var(--m-safe-bottom)); }
.m-app .fa-sheet-actions { padding-bottom: calc(16px + var(--m-safe-bottom)); }
.m-app .fa-sheet { z-index: 60; }
.m-app .fa-sheet-backdrop { z-index: 59; }
.m-app .fa-tooltip { z-index: 70; }

/* ---------- tablets / desktop: show everything side by side ---------- */
@media (min-width: 900px) {
  .m-app #screen-tracker { max-width: 1180px; padding-bottom: 40px; }
  .m-tabs { display: none; }
  .m-main { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: start; padding-top: 18px; }
  .m-pane { display: grid !important; }
  .m-pane[data-pane-name="today"] { grid-row: span 2; }
  #screen-tracker .m-fab { bottom: 28px; right: 28px; }
}

/* ---------- login ---------- */
.m-login {
  display: grid;
  place-items: end center;
  min-height: 100vh;
  padding: calc(var(--m-safe-top) + 24px) 20px calc(var(--m-safe-bottom) + 32px);
  /* Brand photo: a lens over a green vegetable, the "looking closer" idea */
  background:
    linear-gradient(180deg, rgba(4, 42, 60, .15) 0%, rgba(4, 42, 60, .55) 32%, rgba(4, 42, 60, .96) 58%, var(--m-ink) 72%),
    url("/static/brand/hero-lens.jpg") 42% 0 / auto 62vh no-repeat,
    var(--m-ink);
  color: var(--m-vapor);
}
@media (min-width: 700px) {
  .m-login {
    place-items: center;
    background:
      linear-gradient(90deg, var(--m-ink) 0%, rgba(4, 42, 60, .92) 40%, rgba(4, 42, 60, .35) 100%),
      url("/static/brand/hero-lens.jpg") center / cover no-repeat,
      var(--m-ink);
  }
}
.m-login-card { width: min(400px, 100%); }
.m-login h1 {
  margin: 36px 0 8px;
  font-family: "Aktiv Grotesk", "Inter", sans-serif;
  font-weight: 300;
  font-size: 38px;
  line-height: 1.05;
  letter-spacing: -0.01em;
}
.m-login p { margin: 0 0 24px; color: rgba(247, 247, 239, .75); }
.m-login label {
  display: block;
  margin-bottom: 8px;
  font-family: "Roboto Mono", ui-monospace, monospace;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--m-flavin);
}
.m-login input {
  width: 100%;
  min-height: 50px;
  padding: 0 16px;
  border: 1.5px solid rgba(247, 247, 239, .35);
  border-radius: 14px;
  background: rgba(247, 247, 239, .08);
  color: var(--m-vapor);
  font: inherit;
  font-size: 17px;
}
.m-login input:focus { outline: none; border-color: var(--m-flavin); }
.m-login button {
  width: 100%;
  min-height: 52px;
  margin-top: 16px;
  border: 1.5px solid var(--m-flavin);
  border-radius: 999px;
  background: transparent;
  color: var(--m-flavin);
  font-family: "Roboto Mono", ui-monospace, monospace;
  font-weight: 700;
  font-size: 14px;
  text-transform: uppercase;
  cursor: pointer;
}
.m-login button:active { background: rgba(225, 245, 123, .12); }
.m-login .m-login-error { margin: 10px 0 0; color: #FFB3B3; font-size: 14px; }
