/* Team Mears — shared stylesheet.
   Rules carried over from the Ökohaus system:
     - every page declares EXACTLY TWO colours:  :root { --ink: …; --bg: … }
       and every visual (borders, checker, cards, buttons) derives from them.
     - outline cards, not filled boxes. One focal card per page.
     - wide-by-default on desktop, untouched phone layout.
   New for Team Mears: the retro checker strip (Vans style), built from
   ink+bg only so it works on every page colourway.

   Page palette guide (bright + retro, pick ONE pair per page):
     Off-white #FAF4E8  ·  Bright red #D93A2B     (home)
     Sunshine  #FFC72C  ·  Near-black #1D1D1B     (login)
     Pool blue #2FA8E0  ·  Off-white  #FAF4E8
     Hot pink  #F2568C  ·  Off-white  #FAF4E8
     Grass     #2E9E4F  ·  Off-white  #FAF4E8
*/

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --ink: #D93A2B;
  --bg: #FAF4E8;
  --line:  color-mix(in srgb, var(--ink) 22%, transparent);
  --edge:  color-mix(in srgb, var(--ink) 46%, transparent);
  --muted: color-mix(in srgb, var(--ink) 62%, transparent);
  --sans: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  --script: Georgia, 'Times New Roman', serif;
}

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 1.5rem calc(env(safe-area-inset-bottom, 0px) + 3rem);
  min-height: 100vh;
}
@media (min-width: 700px)  { .app { max-width: 680px; padding-left: 2.6rem; padding-right: 2.6rem; } }
@media (min-width: 1000px) { .app { max-width: 880px; padding-left: 3rem;   padding-right: 3rem;   } }
@media (min-width: 1280px) { .app { max-width: 960px; } .app.tm-wide { max-width: min(94vw, 1760px); } }

/* Desktop dashboard grid — inert below 1280px so phone/iPad stack as-is. */
@media (min-width: 1280px) {
  .tm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 2.2rem; align-items: start; }
  .tm-grid .span-2 { grid-column: 1 / -1; }
}
@media (min-width: 1560px) { .tm-grid { grid-template-columns: 1fr 1fr 1fr; } }

/* ---- The checker strip. ink+bg only, so it travels across colourways. ---- */
.checker {
  height: 12px;
  background: repeating-conic-gradient(var(--ink) 0% 25%, var(--bg) 0% 50%);
  background-size: 16px 16px;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}
.checker.thick { height: 20px; background-size: 26.66px 26.66px; }

/* ---- Logo lockup (placeholder until the real logo file lands).
   "Team" in flowing serif italic + "MEARS" chunky condensed caps. ---- */
.logo-row {
  display: flex; flex-direction: column; align-items: center;
  padding: calc(env(safe-area-inset-top, 0px) + 1.6rem) 0 0.9rem;
  gap: 0.1rem;
}
.logo-team {
  font-family: var(--script);
  font-style: italic;
  font-size: 1.35rem;
  line-height: 1;
  letter-spacing: 0.02em;
}
.logo-mears {
  font-family: var(--sans);
  font-weight: 900;
  font-size: 2.1rem;
  line-height: 0.95;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-stretch: condensed;
}
.logo-row img { height: 56px; width: auto; display: block; }
@media (min-width: 700px)  { .logo-mears { font-size: 2.5rem; } .logo-row img { height: 68px; } }
@media (min-width: 1000px) { .logo-mears { font-size: 2.9rem; } .logo-row img { height: 80px; } }

/* ---- Header: title left, avatar right ---- */
header {
  display: flex; align-items: center;
  padding: 0.9rem 0 0.4rem;
}
header .title {
  font-weight: 800;
  font-size: 1.55rem;
  line-height: 1.05;
  letter-spacing: -0.01em;
}
header .subtitle { display: block; font-size: 0.9rem; font-weight: 500; color: var(--muted); margin-top: 0.25rem; }
header .avatar {
  flex-shrink: 0; margin-left: auto;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--ink); color: var(--bg);
  border: none; cursor: pointer; padding: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--sans); font-weight: 700; font-size: 0.95rem;
}
header .avatar:active { opacity: 0.6; }
@media (min-width: 700px) { header .avatar { width: 48px; height: 48px; font-size: 1.1rem; } }

/* ---- Sections: eyebrow heading + outline card ---- */
.section-eyebrow {
  display: flex; align-items: center; gap: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  font-weight: 800;
  margin: 2.2rem 0 0.7rem;
}
.section-eyebrow:first-of-type { margin-top: 1.1rem; }

.tm-card {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.3rem 1.15rem;
  margin: 0 0 1.4rem;
}
.tm-card.focal { border-width: 1.6px; border-color: var(--edge); }

/* Rows inside cards */
.tile-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.85rem; width: 100%;
  padding: 0.95rem 0;
  background: transparent; border: none; text-align: left;
  color: inherit; font: inherit; cursor: pointer;
}
.tile-row + .tile-row { border-top: 1px solid var(--line); }
.tile-row:active { opacity: 0.65; }
.tile-text { flex: 1; min-width: 0; }
.tile-label { display: block; font-weight: 650; line-height: 1.25; }
.tile-meta { display: block; font-size: 0.83rem; color: var(--muted); margin-top: 0.14rem; font-weight: 400; line-height: 1.3; }
.tile-side { flex-shrink: 0; font-weight: 800; font-size: 0.85rem; text-align: right; }
.tile-side .pill {
  display: inline-block; padding: 0.22rem 0.6rem; border-radius: 999px;
  border: 1.4px solid var(--ink); font-size: 0.78rem; letter-spacing: 0.03em;
}
.tile-side .pill.solid { background: var(--ink); color: var(--bg); }

.empty-note { padding: 0.95rem 0; color: var(--muted); font-size: 0.9rem; }

/* Focal "today" numbers row */
.stat-row { display: flex; gap: 0; padding: 0.9rem 0; }
.stat { flex: 1; text-align: center; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat .n { display: block; font-weight: 900; font-size: 1.7rem; line-height: 1; }
.stat .l { display: block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.09em; margin-top: 0.35rem; color: var(--muted); font-weight: 700; }

/* ---- Buttons + forms (login) ---- */
.btn {
  display: block; width: 100%;
  padding: 1rem;
  border: 1.6px solid var(--ink);
  border-radius: 14px;
  background: transparent; color: var(--ink);
  font: inherit; font-weight: 800; font-size: 1.05rem;
  cursor: pointer; text-align: center;
}
.btn.solid { background: var(--ink); color: var(--bg); }
.btn:active { opacity: 0.7; }
.btn + .btn { margin-top: 0.7rem; }

input.field {
  width: 100%;
  padding: 1rem;
  border: 1.6px solid var(--ink);
  border-radius: 14px;
  background: transparent; color: var(--ink);
  font: inherit; font-size: 1.2rem; font-weight: 700;
  text-align: center; letter-spacing: 0.35em;
}
input.field::placeholder { color: var(--muted); letter-spacing: 0.05em; font-weight: 500; }
input.field:focus { outline: 2.5px solid var(--ink); outline-offset: 2px; }

/* Toast */
#tm-toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 1.4rem);
  transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--bg);
  padding: 0.75rem 1.2rem; border-radius: 12px;
  font-weight: 650; font-size: 0.95rem;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  max-width: 88vw; text-align: center; z-index: 99;
}
#tm-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.loading { padding: 2rem 0; text-align: center; color: var(--muted); font-weight: 600; }
