/* Base: element defaults, the application shell (sidebar on desktop, bottom tab bar on phones). */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 16px;
}
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ap-ink);
  font: 400 var(--ap-text) / 1.55 var(--ap-body);
  background: var(--ap-paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
button,
a,
input,
select,
textarea,
summary {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
  border: 0;
  background: none;
  padding: 0;
}
button:disabled {
  cursor: not-allowed;
}
a {
  color: inherit;
  text-decoration: none;
}
img,
svg {
  display: block;
  max-width: 100%;
}
h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--ap-display);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.005em;
  text-wrap: balance;
}
p {
  margin: 0;
  text-wrap: pretty;
}
:focus-visible {
  outline: 2px solid var(--ap-accent);
  outline-offset: 2px;
}
::selection {
  background: var(--ap-accent-soft);
}
[hidden] {
  display: none !important;
}
.ap-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.ap-skip {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: var(--ap-radius-sm);
  background: var(--ap-ink);
  color: var(--ap-surface);
  transform: translateY(-160%);
  transition: transform 0.2s var(--ap-ease);
}
.ap-skip:focus {
  transform: none;
}
.ap-noscript {
  margin: 48px;
}

/* Shell */
.ap-body {
  display: grid;
  grid-template-columns: var(--ap-sidebar) minmax(0, 1fr);
}
.ap-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: var(--space-2xl);
  padding: 28px 18px 18px;
  border-right: 1px solid var(--ap-line);
  background: var(--ap-paper);
}
.ap-brand {
  display: block;
  padding: 0 10px;
}
.ap-brand-logo {
  width: 168px;
  height: auto;
}
.ap-navigation {
  display: grid;
  gap: 2px;
}
.ap-nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: var(--ap-radius-sm);
  color: var(--ap-ink-soft);
  font-size: 15px;
  transition:
    background 0.15s,
    color 0.15s;
}
.ap-nav-link svg {
  flex-shrink: 0;
  color: var(--ap-muted);
  transition: color 0.15s;
}
.ap-nav-link:hover {
  background: var(--ap-sunk);
  color: var(--ap-ink);
}
.ap-nav-link[aria-current='page'] {
  background: var(--ap-surface);
  color: var(--ap-ink);
  font-weight: 600;
  box-shadow: var(--ap-shadow-sm), inset 0 0 0 1px var(--ap-line);
}
.ap-nav-link[aria-current='page'] svg {
  color: var(--ap-accent);
}
.ap-nav-count {
  margin-left: auto;
  font: 11.5px var(--ap-mono);
  color: var(--ap-muted);
}
.ap-nav-admin {
  margin-top: var(--space-md);
}
.ap-sidebar-bottom {
  margin-top: auto;
  padding-top: var(--space-lg);
  border-top: 1px solid var(--ap-line);
}
.ap-account {
  display: flex;
  align-items: center;
  gap: 4px;
}
.ap-account-link {
  display: flex;
  flex: 1;
  min-width: 0;
  align-items: center;
  gap: 10px;
  padding: 6px;
  border-radius: var(--ap-radius-sm);
}
.ap-account-link:hover {
  background: var(--ap-sunk);
}
.ap-avatar {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--ap-accent-soft);
  color: var(--ap-accent);
  font: 600 17px var(--ap-display);
}
.ap-account-copy {
  display: grid;
  min-width: 0;
  line-height: 1.3;
}
.ap-account-email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
}
.ap-account-copy small {
  color: var(--ap-muted);
  font-size: 12px;
}
.ap-account-guest {
  display: grid;
  gap: 10px;
  padding: 4px 6px;
}
.ap-account-guest p {
  color: var(--ap-muted);
  font-size: 12.5px;
  line-height: 1.45;
}
.ap-workspace {
  min-width: 0;
}
.ap-topbar {
  display: none;
}
.ap-main {
  max-width: calc(var(--ap-content) + 96px);
  margin: 0 auto;
  padding: 44px 48px 120px;
  outline: none;
}
.ap-loading {
  padding: 80px 0;
  color: var(--ap-muted);
  text-align: center;
}

@media (max-width: 1100px) {
  :root {
    --ap-sidebar: 76px;
  }
  .ap-sidebar {
    padding: 20px 12px;
    align-items: center;
  }
  .ap-brand {
    padding: 0;
    width: 44px;
    overflow: hidden;
  }
  .ap-brand-logo {
    width: 168px;
    max-width: none;
  }
  .ap-nav-link {
    justify-content: center;
    width: 52px;
    padding: 0;
  }
  .ap-nav-label,
  .ap-nav-count,
  .ap-account-copy,
  .ap-account-guest p {
    display: none;
  }
  .ap-account {
    flex-direction: column;
  }
  .ap-account-guest .ap-button {
    padding: 0 10px;
  }
  .ap-main {
    padding: 36px 32px 110px;
  }
}

/* Phones: brand bar on top, the four sections as a bottom tab bar. */
@media (max-width: 740px) {
  .ap-body {
    display: block;
  }
  .ap-sidebar {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 30;
    height: auto;
    display: block;
    padding: 0 6px env(safe-area-inset-bottom);
    border: 0;
    border-top: 1px solid var(--ap-line);
    background: oklch(0.975 0.01 82 / 0.94);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
  }
  .ap-brand,
  .ap-sidebar-bottom {
    display: none;
  }
  .ap-navigation {
    display: flex;
    gap: 0;
  }
  .ap-nav-link,
  .ap-nav-link[aria-current='page'] {
    flex: 1;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    width: auto;
    min-height: var(--ap-tabbar);
    padding: 6px 0 4px;
    border-radius: 0;
    background: none;
    box-shadow: none;
    font-size: 11px;
    font-weight: 500;
  }
  .ap-nav-link:hover {
    background: none;
  }
  .ap-nav-link[aria-current='page'] {
    color: var(--ap-accent);
  }
  .ap-nav-label {
    display: block;
  }
  .ap-nav-count {
    position: absolute;
    top: 6px;
    left: calc(50% + 8px);
    display: block;
    margin: 0;
    font-size: 10px;
  }
  .ap-nav-admin {
    margin: 0;
  }
  .ap-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    height: 56px;
    padding: 0 16px;
    border-bottom: 1px solid var(--ap-line);
    background: oklch(0.967 0.011 80 / 0.94);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
  }
  .ap-topbar-brand img {
    width: 132px;
    height: auto;
  }
  .ap-main {
    padding: 24px 16px calc(var(--ap-tabbar) + 48px + env(safe-area-inset-bottom));
  }
}
