/* ==========================================================================
   Header & Navigation (Editorial Floating Glass Bar)
   ========================================================================== */

.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background-color: var(--bg-glass);
  backdrop-filter: blur(20px) saturate(165%);
  -webkit-backdrop-filter: blur(20px) saturate(165%);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: 0 4px 24px -6px rgba(0, 0, 0, 0.18);
}

.app-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1.5px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--accent-primary) 50%,
    transparent 100%
  );
  opacity: 0.65;
  pointer-events: none;
}

.header-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0.72rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}

.brand-mark {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 0.68rem;
  background: linear-gradient(135deg, var(--accent-primary-soft) 0%, var(--bg-elevated) 100%);
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-subtle);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 2px 8px rgba(0, 0, 0, 0.14);
  flex-shrink: 0;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.brand-group:hover .brand-mark {
  transform: translateY(-1px);
  border-color: var(--accent-primary);
}

.brand-mark-svg {
  width: 1.24rem;
  height: 1.24rem;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.brand-group:hover .brand-mark-svg {
  transform: rotate(-8deg) scale(1.07);
}

.brand-identity {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-title-row {
  display: flex;
  align-items: center;
  gap: 0.52rem;
  flex-wrap: nowrap;
}

.brand-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  line-height: 1.15;
}

.brand-divider {
  color: var(--border-strong);
  font-size: 0.9rem;
  font-weight: 400;
  user-select: none;
}

.header-owner-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.36rem;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.header-owner-dot {
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background-color: var(--status-success);
  box-shadow: 0 0 0 2px var(--status-success-bg);
  flex-shrink: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.header-period-capsule {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  padding: 0.2rem 0.26rem;
  border-radius: 999px;
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.header-period-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.header-period-step:hover {
  background-color: var(--bg-surface);
  color: var(--text-primary);
}

.header-period-text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 8.6rem;
  gap: 0.35rem;
  padding: 0 0.4rem;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.header-calendar-icon {
  color: var(--accent-primary);
  flex-shrink: 0;
}

.header-pill-btn {
  border-radius: 999px;
  padding: 0.32rem 0.72rem;
  font-size: 0.74rem;
  gap: 0.35rem;
}

.header-demo-pill {
  border-color: rgba(245, 158, 11, 0.38);
  background-color: var(--status-warning-bg);
  color: var(--status-warning);
}

.header-demo-pill:hover {
  border-color: var(--status-warning);
  background-color: rgba(245, 158, 11, 0.22);
  color: var(--status-warning);
}

.header-settings-btn {
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 999px;
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.header-settings-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background-color: var(--bg-surface);
}

.header-settings-svg {
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.header-settings-btn:hover .header-settings-svg,
#btn-open-settings.active .header-settings-svg {
  transform: rotate(38deg);
}

@media (max-width: 600px) {
  .brand-divider,
  .header-owner-pill {
    display: none;
  }
  .header-inner {
    padding: 0.65rem 0.9rem;
  }
}

.bottom-nav {
  height: calc(62px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
