/* ============================================================
   Roni's Health Tracker — Layout
   App shell, sidebar, topbar, grids, responsive breakpoints.
   ============================================================ */

.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }

/* ---------- Sidebar (Mac) ---------- */
.sidebar {
  padding: 28px 20px;
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.wordmark { font-family: var(--serif); font-size: 28px; color: var(--heading); letter-spacing: .5px; margin-bottom: 4px; line-height: 1.15; }
.wordmark small {
  display: block;
  font-family: var(--sans);
  font-size: 10.5px;
  color: var(--text-soft);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-top: 4px;
}
.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 22px; }
.nav button {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 12px;
  font-size: 15px;
  color: var(--text-soft);
  text-align: left;
  width: 100%;
  min-height: 44px;
  transition: background var(--t-fast), color var(--t-fast);
}
.nav button:hover { background: var(--surface-soft); color: var(--text); }
.nav button.active { background: var(--surface); color: var(--accent); font-weight: 600; box-shadow: var(--shadow); }
.nav svg { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sidebar .foot { margin-top: auto; font-size: 11.5px; color: var(--text-soft); line-height: 1.5; }

/* ---------- Main column ---------- */
.main { position: relative; padding: 26px 36px 60px; max-width: 1240px; width: 100%; margin: 0 auto; }

.topbar { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
.topbar h1 { font-family: var(--serif); font-size: 24px; font-weight: 500; flex: 1; }

.dateline { font-size: 14px; color: var(--text-soft); margin-bottom: 22px; }
.dateline strong { color: var(--text); font-weight: 600; }

/* ---------- Period bar ---------- */
.periodbar { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.arrowbtn {
  width: 40px; height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  font-size: 16px;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.arrowbtn:hover { color: var(--accent); border-color: var(--accent-soft); }

/* ---------- Two-column Today grid ---------- */
.grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, 1fr); gap: var(--gap); align-items: start; }
.col { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }

/* ---------- View container ---------- */
.view { display: none; }
.view.active { display: block; }

/* ---------- Responsive: iPad ---------- */
.topnav { display: none; }
@media (max-width: 1100px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding: 20px 22px 60px; }
  .topnav {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    margin: 0 0 18px;
    padding: 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
  }
  .topnav button {
    padding: 9px 14px;
    border-radius: 10px;
    font-size: 13.5px;
    color: var(--text-soft);
    white-space: nowrap;
    min-height: 44px;
  }
  .topnav button.active { background: var(--lavender); color: #fff; font-weight: 600; }
  :root[data-theme="dark"] .topnav button.active { color: #241D2B; }
  @media (prefers-color-scheme: dark) {
    :root[data-theme="system"] .topnav button.active { color: #241D2B; }
  }
}

/* ---------- Responsive: iPhone ---------- */
.tabbar { display: none; }
@media (max-width: 700px) {
  .grid { grid-template-columns: 1fr; }
  .main { padding: 16px 14px 110px; }
  .topnav { display: none; }
  .tabbar {
    display: flex;
    position: fixed;
    bottom: 18px;
    left: 14px;
    right: 14px;
    z-index: 45;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow-lift);
    padding: 8px;
    justify-content: space-around;
  }
  .tabbar button {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    font-size: 10.5px;
    color: var(--text-soft);
    padding: 7px 12px;
    border-radius: 12px;
    min-width: 56px;
    min-height: 48px;
    justify-content: center;
  }
  .tabbar button.active { color: var(--accent); background: var(--surface-soft); font-weight: 600; }
  .tabbar svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
}

/* ---------- Install / Add-to-Home-Screen affordance ----------
 * Lives in each navigation surface: sidebar (Mac), top nav (iPad),
 * tab bar (iPhone). Same behavior everywhere (app/js/ui/pwa.js). */
.install-nav {
  margin-top: 14px;
  color: var(--accent) !important;
  border: 1px dashed var(--accent-soft);
}
.install-nav:hover { background: var(--surface-soft); color: var(--accent); }
.install-topnav {
  flex: none;
  color: var(--accent);
  border: 1px dashed var(--accent-soft);
  white-space: nowrap;
}
.install-tab {
  color: var(--accent);
}
.install-tab svg { stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
[data-install][hidden] { display: none !important; }

/* Home-screen app mode: hide the affordance, hug notch/home indicator. */
@media (display-mode: standalone), (display-mode: fullscreen) {
  [data-install] { display: none !important; }
  .main { padding-top: calc(16px + env(safe-area-inset-top)); }
  .tabbar { bottom: calc(18px + env(safe-area-inset-bottom)); }
}

/* iPhone notch/home-indicator safety even in-browser */
@media (max-width: 700px) {
  .tabbar { bottom: calc(18px + env(safe-area-inset-bottom)); }
}

.pwa-steps { margin: 4px 0 0; padding-left: 22px; display: grid; gap: 10px; font-size: 14.5px; line-height: 1.5; }
.pwa-steps .kbd { font-family: var(--mono); font-size: 12px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 6px; padding: 1px 6px; background: var(--surface-soft); }
