* { box-sizing: border-box; }
html { font-size: 16px; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font-body); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
.app-shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100svh; }
.app-header { position: sticky; top: 0; align-self: start; height: 100svh; overflow-y: auto; display: flex; flex-direction: column; gap: 32px; padding: 28px 16px 16px 20px; background: var(--paper); }
.brand { display: inline-flex; align-self: flex-start; color: var(--ink); text-decoration: none; }
.brand-logo { display: block; flex-shrink: 0; overflow: visible; }
.app-nav { display: grid; gap: 6px; }
.app-nav a { display: block; padding: 9px 10px; border-left: 3px solid transparent; color: var(--ink); font: 400 14px/1.4 var(--font-body); text-decoration: none; }
.app-nav a:hover { background: var(--accent-soft); text-decoration: none; }
.app-nav a[aria-current="page"] { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
/* One account block: who you are, then a single row of controls of equal height. */
.app-account { display: grid; gap: 10px; margin-top: auto; min-width: 0; padding-top: 14px; border-top: 1px solid var(--line); }
.app-identity { display: grid; gap: 1px; min-width: 0; }
.app-identity strong { min-width: 0; overflow: hidden; font-size: 14px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.app-identity small { color: var(--muted-foreground); font-size: 12px; }
.app-account-controls { display: flex; gap: 6px; min-width: 0; }
.theme-control { display: flex; flex: 1; min-width: 0; font-family: var(--font-body); font-size: 13px; color: var(--muted-foreground); }
.theme-control > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.theme-control select { width: 100%; min-width: 0; height: 32px; padding: 0 6px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 0; font: inherit; }
.signout-form { margin: 0; flex: 0 0 auto; }
.signout-btn { height: 32px; border: 1px solid var(--line); padding: 0 10px; border-radius: 0; background: var(--surface); color: var(--ink); font: 500 13px/1 var(--font-body); cursor: pointer; white-space: nowrap; }
.signout-btn:hover { background: var(--accent-soft); }
/* The divider belongs to the workspace so it spans the whole page, not only the first screen. */
.app-workspace { min-width: 0; display: flex; flex-direction: column; border-left: 1px solid var(--line); }
.app-main { width: 100%; max-width: 1600px; padding: 28px 32px 40px; margin-inline: auto; flex: 1; min-width: 0; }
.app-footer { width: 100%; max-width: 1600px; margin: auto auto 0; padding: 16px 32px; border-top: 1px solid var(--line); color: var(--muted-foreground); font-size: 12px; }
.app-footer p { margin: 0; max-width: 100ch; }
.app-range-controls { padding: 16px 32px 0; }
.app-range-controls > div { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.app-shell :focus-visible, .theme-control select:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.skip-link { position: fixed; left: 16px; top: -120px; padding: 10px 16px; background: var(--surface); color: var(--accent); border: 1px solid var(--accent); z-index: 100; }
.skip-link:focus { top: 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }
@media (max-width: 900px) {
  /* Header row sizes to its content; the workspace takes the rest, so short pages leave no gap. */
  .app-shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .app-workspace { border-left: 0; }
  /* Brand and account share the first row; navigation scrolls on its own row. */
  .app-header { position: static; height: auto; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; padding: 12px 20px 0; gap: 8px 16px; border-bottom: 1px solid var(--line); }
  .brand-logo { height: 34px; width: auto; }
  .app-nav { grid-column: 1 / -1; grid-row: 2; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; margin: 0 -20px; padding: 0 16px; }
  .app-nav a { padding: 10px 10px; border-left: 0; border-bottom: 3px solid transparent; white-space: nowrap; }
  .app-nav a[aria-current="page"] { background: transparent; }
  .app-account { grid-column: 2; grid-row: 1; display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin: 0; padding: 0; border: 0; }
  .app-identity { text-align: right; min-width: 0; }
  .app-account-controls { flex: 0 0 auto; }
  .theme-control select { width: 92px; }
  .app-main { padding: 24px; }
  .app-footer { padding: 16px 24px; }
  .app-range-controls { padding: 16px 24px 0; }
}
@media (max-width: 480px) {
  .app-header { padding: 10px 16px 0; }
  .app-nav { margin: 0 -16px; padding: 0 12px; }
  .app-account { gap: 8px; }
  .app-identity small { display: none; }
  .theme-control select { width: 78px; }
  .app-main { padding: 20px 16px 28px; }
  .app-footer { padding: 16px; }
  .app-range-controls { padding: 16px 16px 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
