/* ═══════════════════════════════════════════
   App Shell — Sidebar, Topbar, Layout
   ═══════════════════════════════════════════ */
#app { display: none; min-height: 100vh }
.app-layout { display: flex; min-height: 100vh }

/* ─── Sidebar ─── */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; background: white;
  border-right: 1px solid var(--border); position: fixed;
  top: 0; left: 0; bottom: 0; display: flex;
  flex-direction: column; z-index: 50; overflow-y: auto;
}
.sidebar-brand { padding: 1.5rem 1.5rem 1rem; border-bottom: 1px solid var(--border); flex-shrink: 0 }
.sidebar-brand-name { font-family: var(--serif); font-size: 1.5rem; font-weight: 500; color: var(--rose) }
.sidebar-brand-name span { color: var(--sage) }
.sidebar-brand-sub { font-size: .72rem; color: var(--light); letter-spacing: .06em; margin-top: .1rem }
.sidebar-user { padding: 1rem 1.5rem; border-bottom: 1px solid var(--border); flex-shrink: 0 }
.sidebar-user-name {
  font-weight: 600; font-size: .9rem; color: var(--dark);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-week { font-size: .75rem; color: var(--mid); margin-top: .1rem }
.week-badge {
  display: inline-block; padding: .15rem .6rem; border-radius: 100px;
  font-size: .7rem; font-weight: 600; margin-left: .4rem;
}
.week-t1 { background: var(--rose-p); color: var(--rose) }
.week-t2 { background: var(--terra-p); color: var(--terra) }
.week-t3 { background: var(--sage-p); color: var(--sage) }

.nav-section {
  padding: .75rem 1rem .25rem; font-size: .68rem; font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase; color: var(--light);
}
.nav-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .65rem 1.2rem; margin: 0 .5rem .1rem;
  border-radius: 12px; color: var(--mid); font-size: .88rem;
  font-weight: 500; cursor: pointer; transition: all .18s;
}
.nav-item:hover { background: var(--cream); color: var(--dark) }
.nav-item.active { background: var(--rose-p); color: var(--rose); font-weight: 600 }
.nav-item .nav-icon { font-size: 1.05rem; width: 22px; text-align: center; flex-shrink: 0 }

.sidebar-footer { margin-top: auto; padding: 1rem 1.5rem; border-top: 1px solid var(--border) }
.btn-logout {
  width: 100%; padding: .55rem; background: transparent; border: 1px solid var(--border);
  border-radius: 8px; font-size: .78rem; color: var(--light); font-weight: 500; transition: all .2s;
}
.btn-logout:hover { border-color: var(--rose); color: var(--rose) }

/* ─── Main Content ─── */
.main-content { margin-left: var(--sidebar-w); flex: 1; min-height: 100vh }
.page-content { padding: 2.5rem; max-width: 1100px }

/* ─── Topbar ─── */
.topbar {
  padding: 1rem 2.5rem; background: white; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 30;
}
/* Hamburger menu button (hidden on desktop) */
.topbar-menu {
  display: none; width: 40px; height: 40px; border-radius: 10px;
  border: none; background: var(--cream); color: var(--dark);
  cursor: pointer; align-items: center; justify-content: center;
  transition: all .2s; flex-shrink: 0; margin-right: .5rem;
  position: relative;
}
.topbar-menu:active { transform: scale(.92) }
.topbar-menu .hamburger-line {
  display: block; width: 18px; height: 2px; background: var(--dark);
  border-radius: 2px; transition: all .3s; position: absolute; left: 11px;
}
.topbar-menu .hamburger-line:nth-child(1) { top: 12px }
.topbar-menu .hamburger-line:nth-child(2) { top: 19px }
.topbar-menu .hamburger-line:nth-child(3) { top: 26px }
.topbar-menu.active .hamburger-line:nth-child(1) { top: 19px; transform: rotate(45deg) }
.topbar-menu.active .hamburger-line:nth-child(2) { opacity: 0 }
.topbar-menu.active .hamburger-line:nth-child(3) { top: 19px; transform: rotate(-45deg) }

/* Sidebar close button (mobile only) */
.sidebar-close {
  display: none; width: 32px; height: 32px; border-radius: 8px;
  border: none; background: var(--cream); color: var(--mid);
  font-size: 1rem; cursor: pointer; align-items: center; justify-content: center;
  transition: all .2s; flex-shrink: 0;
}
.sidebar-close:active { background: var(--rose-p); color: var(--rose) }

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(45, 36, 32, .5);
  backdrop-filter: blur(3px); z-index: 999; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.sidebar-overlay.open { display: block }

.topbar-title { font-family: var(--serif); font-size: 1.4rem; font-weight: 500 }
.topbar-right { display: flex; align-items: center; gap: 1rem }
.countdown-chip {
  display: flex; align-items: center; gap: .5rem;
  background: var(--rose-p); color: var(--rose);
  border-radius: 100px; padding: .35rem 1rem;
  font-size: .78rem; font-weight: 600;
}
