/* ── App Shell ── */
#app {
  display: flex;
  flex-direction: column;
  height: calc(var(--app-height) + var(--viewport-overscan-bottom));
  min-height: calc(var(--app-height) + var(--viewport-overscan-bottom));
  max-height: calc(var(--app-height) + var(--viewport-overscan-bottom));
  overflow: hidden;
  padding-bottom: 0;
  background: transparent;
}


/* ── Header ── */
.app-header {
  flex-shrink: 0;
  padding: calc(var(--safe-top) + 12px) max(20px, calc(var(--safe-right) + 20px)) 0 max(20px, calc(var(--safe-left) + 20px));
  background: var(--bg);
  border-bottom: 1px solid var(--separator-soft);
  position: relative;
  z-index: 10;
}
.header-inner {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding-bottom: 13px;
  gap: 12px;
}
.space-title {
  min-width: 0;
  max-width: min(52vw, 220px);
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  color: var(--text);
  font-size: 18px;
  font-weight: 760;
  letter-spacing: -.035em;
  text-align: left;
}
.space-title span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.header-right { margin-left: auto; display: flex; flex-direction: row; align-items: center; gap: 4px; }
.greeting {
  display: block;
  font-size: 10px;
  color: var(--text3);
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-bottom: 4px;
  font-weight: 600;
}
.header-date {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -.03em;
  color: var(--text);
}
.icon-btn {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  color: var(--text3);
  transition: background var(--tr), color var(--tr);
}
.icon-btn:active { background: var(--material-field); color: var(--text); }
.icon-btn:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 2px;
}
.icon-btn svg { width: 17px; height: 17px; }

.space-title:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 3px;
  border-radius: var(--radius-xs);
}

/* ── Pages ── */
.pages-wrap {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
}
.page { position: absolute; inset: 0; min-height: 0; opacity: 0; pointer-events: none; transform: translateY(6px); transition: opacity var(--tr-fast) var(--ease-standard), transform var(--tr-tab) var(--ease-nav); }
.page.active { opacity: 1; pointer-events: auto; transform: translateY(0); }
/* Handoff to Motion for bottom-nav page switches — avoids fighting inline keyframes */
.pages-wrap.page-motion-active .page { transition: none !important; }
.scroll-area {
  flex: 1;
  min-height: 0;
  height: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--pad-page) + 24px);
}

/* ── Bottom Nav (iOS-like tab bar) ── */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(-1 * var(--viewport-overscan-bottom));
  flex-shrink: 0;
  display: flex;
  align-items: center;
  isolation: isolate;
  background: transparent;
  border: none;
  box-shadow: none;
  height: calc(var(--nav-h) + var(--safe-bottom) + var(--viewport-overscan-bottom));
  padding: 4px 22px calc(var(--safe-bottom) + var(--viewport-overscan-bottom) + 4px);
  z-index: 10;
  pointer-events: none;
  filter: none;
  backdrop-filter: blur(22px) saturate(1.12);
  -webkit-backdrop-filter: blur(22px) saturate(1.12);
  transform: translateY(0);
  transition: transform var(--tr-fast) var(--ease-standard);
}

body.keyboard-active .bottom-nav {
  transform: translateY(var(--keyboard-offset));
  transition: none;
}

.bottom-nav::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  background: color-mix(in srgb, var(--material-bar) 90%, var(--bg) 10%);
  border-top: 0.5px solid var(--separator);
  box-shadow: 0 -1px 0 rgba(255,255,255,0.03) inset;
}

.bottom-nav > .nav-item {
  position: relative;
  z-index: 1;
  pointer-events: auto;
}

.nav-item { flex: 1; min-width: 0; min-height: 44px; display: flex; align-items: center; justify-content: center; color: var(--text3); opacity: .74; border-radius: 18px; transition: color var(--tr-fast) var(--ease-standard), opacity var(--tr-fast) var(--ease-standard), transform var(--tr-fast) var(--ease-standard); }
.nav-item span { display: none; }
.nav-item svg { width: 24px; height: 24px; stroke-width: 2.05; }
.nav-item.active { color: var(--text); opacity: .94; }
.nav-item:active { transform: scale(.94); opacity: .82; }
.nav-item[data-page]:focus-visible,
.fab-wrap:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}
.fab-wrap {
  position: relative;
  align-items: center;
  justify-content: center;
  color: var(--text3);
}
.fab {
  width: 44px;
  height: 44px;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  transition: transform var(--tr-fast) var(--ease-standard), background var(--tr-fast) var(--ease-standard);
}
.fab:active { transform: scale(.94); }
.fab-wrap.active,
.fab-wrap:active {
  color: var(--text);
}
.fab-wrap .fab,
.fab-wrap:active .fab {
  background: transparent;
}
.fab .fab-icon-star { width: 24px; height: 24px; stroke: none; fill: currentColor; transition: transform .2s, opacity .2s; }
.fab .fab-icon-plus { width: 24px; height: 24px; stroke: currentColor; stroke-width: 2.35; transition: transform .2s, opacity .2s; }

/* ── Section Label ── */
.section-label { font-size: 12px; font-weight: 600; letter-spacing: .06em; color: var(--text2); margin-bottom: 8px; text-transform: none; }
