/* App shell: header, main area, bottom tab bar (phones) / top nav (wider screens). Mobile first. */

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }

.skip { position: absolute; left: var(--s-2); top: -100px; z-index: 100; padding: var(--s-2) var(--s-4); background: var(--surface); color: var(--ink); border-radius: var(--r-sm); box-shadow: var(--shadow-lg); }
.skip:focus { top: var(--s-2); }

/* ---- Header ---- */
.site-header { position: sticky; top: 0; z-index: 20; background: var(--brand); color: var(--on-brand); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.12); }
.header-inner { display: flex; align-items: center; gap: var(--s-4); min-height: 60px; padding-top: var(--s-2); padding-bottom: var(--s-2); }
.brand { display: flex; align-items: center; gap: var(--s-3); min-height: var(--tap); color: var(--on-brand); text-decoration: none; font-weight: 700; font-size: var(--fs-lg); letter-spacing: -0.01em; min-width: 0; }
.brand:hover { color: var(--on-brand); }
.brand img { width: 40px; height: 40px; border-radius: var(--r-sm); flex-shrink: 0; }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: var(--s-2); }
.header-link { display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 var(--s-3); color: var(--on-brand); font-weight: 600; text-decoration: none; border-radius: var(--r-pill); }
.header-link:hover { color: var(--on-brand); background: rgba(255, 255, 255, 0.14); }

/* Top nav: hidden on phones (the tab bar takes over) */
.topnav { display: none; }
.topnav a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 var(--s-4); border-radius: var(--r-pill); color: rgba(255, 255, 255, 0.9); font-weight: 500; text-decoration: none; }
.topnav a:hover { color: var(--on-brand); background: rgba(255, 255, 255, 0.12); }
.topnav a[aria-current="page"] { color: var(--on-brand); background: rgba(255, 255, 255, 0.2); font-weight: 700; }

/* Account / area menu: a <details> disclosure, works without JS */
.account-menu { position: relative; }
.account-menu > summary { list-style: none; display: inline-flex; align-items: center; gap: var(--s-2); min-height: var(--tap); padding: 0 var(--s-3) 0 var(--s-1); border-radius: var(--r-pill); cursor: pointer; color: var(--on-brand); font-weight: 600; }
.account-menu > summary::-webkit-details-marker { display: none; }
.account-menu > summary:hover, .account-menu[open] > summary { background: rgba(255, 255, 255, 0.14); }
.avatar { width: 34px; height: 34px; border-radius: var(--r-pill); background: rgba(255, 255, 255, 0.22); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; text-transform: uppercase; }
.account-name { display: none; }
.account-panel { position: absolute; right: 0; top: calc(100% + var(--s-2)); width: min(18rem, calc(100vw - 2 * var(--gutter))); background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg); padding: var(--s-2); }
.account-panel .panel-label { display: block; padding: var(--s-2) var(--s-3) var(--s-1); font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.account-panel a, .account-panel button { display: flex; align-items: center; gap: var(--s-3); width: 100%; min-height: var(--tap); padding: 0 var(--s-3); border: 0; border-radius: var(--r-sm); background: none; color: var(--ink); text-decoration: none; text-align: left; font-weight: 500; cursor: pointer; }
.account-panel a:hover, .account-panel button:hover { background: var(--surface-2); }
.account-panel a[aria-current="page"] { color: var(--brand-strong); font-weight: 700; }
.account-panel hr { border: 0; border-top: 1px solid var(--line-soft); margin: var(--s-2) 0; }
.account-panel form { margin: 0; }

/* ---- Main ---- */
.main { padding-top: var(--s-5); padding-bottom: calc(var(--tabbar-h) + var(--s-6) + env(safe-area-inset-bottom)); }

/* ---- Bottom tab bar (phones) ---- */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; background: var(--surface); border-top: 1px solid var(--line); padding: var(--s-1) var(--s-1) calc(var(--s-1) + env(safe-area-inset-bottom)); }
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 56px; color: var(--muted); font-size: var(--fs-xs); font-weight: 500; text-decoration: none; }
.tabbar .tab-icon { display: flex; align-items: center; justify-content: center; width: 56px; height: 30px; border-radius: var(--r-pill); }
.tabbar a[aria-current="page"] { color: var(--brand-strong); font-weight: 700; }
.tabbar a[aria-current="page"] .tab-icon { background: var(--brand-tint); }

/* ---- Wider screens: top nav instead of the tab bar ---- */
@media (min-width: 48rem) {
  .topnav { display: flex; gap: var(--s-1); }
  .tabbar { display: none; }
  .main { padding-top: var(--s-6); padding-bottom: var(--s-7); }
  .account-name { display: inline; max-width: 12rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
