/* ===== Header ===== */
.header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(16px, env(safe-area-inset-left)) 0 max(16px, env(safe-area-inset-right));
  background: color-mix(in srgb, var(--bg-primary) 88%, transparent);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
  z-index: 10;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.header-title {
  font-size: 0.98rem;
  font-weight: 800;
  letter-spacing: 0;
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ===== Bottom Nav ===== */
.bottom-nav {
  height: calc(68px + var(--safe-bottom));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px calc(8px + var(--safe-bottom)) 16px;
  background: color-mix(in srgb, var(--bg-surface) 94%, transparent);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 10;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.nav-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 92px;
  height: 44px;
  padding: 0 12px;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  transition: color var(--transition-fast), background var(--transition-fast);
  border-radius: var(--radius-md);
}
.nav-item.active {
  color: var(--text-primary);
  background: var(--grad-brand-soft);
  box-shadow: inset 0 0 0 1px var(--border-strong);
}
.nav-item.active svg {
  stroke: var(--accent);
}
.nav-item svg {
  width: 19px;
  height: 19px;
  stroke-width: 2;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ===== Main Content ===== */
.main {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 16px 16px 22px;
}

.section {
  display: none;
  animation: fadeIn var(--transition-base) forwards;
}
.section.active {
  display: block;
}

/* ===== Grid ===== */
.grid {
  display: grid;
  gap: 14px;
}
.grid-2 {
  grid-template-columns: 1fr;
}
@media (min-width: 768px) {
  .grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 1024px) {
  .grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ===== Page Layout Helpers ===== */
.page-header {
  margin-bottom: 20px;
}
.page-header.compact {
  margin-top: 18px;
  margin-bottom: 12px;
}
.page-header h2 {
  font-size: 1.28rem;
  font-weight: 800;
  letter-spacing: 0;
  margin-bottom: 4px;
}
.page-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ===== Empty State ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
}
.empty-state.wide {
  grid-column: 1 / -1;
}
.empty-state svg {
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
}
.empty-state h3 {
  color: var(--text-secondary);
  font-size: 1.1rem;
  margin-bottom: 8px;
}
.empty-state p {
  font-size: 0.85rem;
  max-width: 240px;
}

/* ===== Fixed FAB ===== */
.fab {
  position: fixed;
  bottom: calc(86px + var(--safe-bottom));
  right: 20px;
  width: 54px;
  height: 54px;
  border-radius: var(--radius-xl);
  background: var(--grad-brand);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md), var(--glow-brand);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  z-index: 20;
  animation: breathe 3.2s ease-in-out infinite;
}
.fab:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}
.fab:active {
  transform: scale(0.95);
}
.fab svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
