/* Equal side columns keep navigation centered on the page container. */
.top.top--centered {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 24px;
  min-height: 100px;
  padding: 22px var(--page-gutter);
  border-bottom: 1px solid var(--line);
  border-image: var(--rule-image) 1 / 0 0 1px / 0;
}
.top--centered > .brand {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 10px;
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -1.2px;
  white-space: nowrap;
}
.brand-mark {
  display: block;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  background: url('/design/brand/workbook-mark-light.svg?v=e43a837b8ef3') center / contain no-repeat;
}
.brand-accent { color: #18514c; }
:root[data-theme=dark] .brand-mark { background-image: url('/design/brand/workbook-mark-dark.svg?v=e43a837b8ef3'); }
:root[data-theme=dark] .brand-accent { color: #6fd9bc; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) .brand-mark { background-image: url('/design/brand/workbook-mark-dark.svg?v=e43a837b8ef3'); }
  :root:not([data-theme=light]) .brand-accent { color: #6fd9bc; }
}
.top.top--centered > nav {
  --nav-padding: 16px;
  grid-column: 2;
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  justify-self: center;
  gap: 0;
  width: auto;
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 14px;
  font-weight: 500;
}
.top.top--centered > nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  min-width: 44px;
  justify-content: center;
  margin: 0;
  padding: 0 var(--nav-padding);
  border: 0;
  background: transparent;
  white-space: nowrap;
  transition: color .15s ease;
}
.top.top--centered > nav a:hover { color: var(--action); background: transparent; }
.top--centered > .header-actions {
  grid-column: 3;
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-self: end;
  gap: 32px;
  min-width: 0;
  max-width: 100%;
}
.header-actions .header-signin, .header-actions #signout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: transparent;
  color: var(--ink);
  font: 500 14px/1.4 var(--font-ui);
  white-space: nowrap;
  transition: background-color .15s ease, color .15s ease;
}
.top--centered .theme-toggle {
  display: inline-grid;
  place-items: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: transparent;
  color: var(--ink);
  transition: background-color .15s ease, color .15s ease;
}
.header-actions :is(.header-signin, #signout, .theme-toggle):hover { background: var(--soft); color: var(--ink); }
.header-actions :is(.header-signin, #signout, .theme-toggle):active { background: var(--soft-pressed); translate: none; }
.theme-toggle svg { grid-area: 1 / 1; width: 20px; height: 20px; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .theme-icon-sun { display: none; }
:root[data-theme=dark] .theme-toggle .theme-icon-sun { display: block; }
:root[data-theme=dark] .theme-toggle .theme-icon-moon { display: none; }
.signed-in .top--centered > nav { --nav-padding: 9px; flex-wrap: nowrap; }
.top--centered .identity { flex-wrap: nowrap; justify-content: flex-end; gap: 6px 12px; width: auto; margin: 0; padding: 0; border: 0; order: 0; }
@media (max-width: 1100px) {
  .top.top--centered { padding-inline: var(--page-gutter); column-gap: 16px; }
  .top--centered > .brand { font-size: 22px; }
  .top.top--centered > nav { --nav-padding: 8px; }
  .top--centered > .header-actions { gap: 16px; }
}
@media (max-width: 760px) {
  .top.top--centered { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; padding: 18px var(--page-gutter); }
  .top--centered .brand-mark { width: 32px; height: 32px; }
  .top.top--centered > nav { --nav-padding: 9px; grid-column: 1 / -1; grid-row: 2; width: max-content; flex-wrap: nowrap; overflow: visible; }
  .top.top--centered > nav a { font-size: 13px; }
  .top--centered > .header-actions { grid-column: 2; grid-row: 1; gap: 12px; }
  .top--centered .identity { justify-content: flex-end; }
}
@media (max-width: 400px) {
  .top.top--centered { column-gap: 8px; }
  .top.top--centered > nav { --nav-padding: 6px; }
  .top--centered > .brand { font-size: 20px; }
  .top--centered > .header-actions { gap: 8px; }
}
@media (max-width: 360px) {
  .top--centered > .brand { font-size: 16px; letter-spacing: -.8px; }
  .header-actions :is(.header-signin, #signout) { padding-inline: 10px; }
  .signed-in .top.top--centered > nav a:focus-visible { outline-offset: -2px; }
}
@media (max-width: 340px) {
  .signed-in .top.top--centered { column-gap: 4px; }
  .top--centered > .brand { gap: 4px; }
  .signed-in .top--centered #signout { padding-inline: 6px; }
  .top.top--centered > nav { --nav-padding: 2px; }
}

/* Signed-in controls share a 44px row; guest and public header sizing stays above. */
.signed-in .top.top--centered { min-height: 72px; padding: 13px var(--page-gutter); column-gap: 16px; }
.signed-in .top--centered > .header-actions { gap: 12px; max-width: none; }
.signed-in .top--centered #header-plan { min-height: 44px; }
.signed-in .top--centered .badge-short { display: none; }
/* The longest badge (Developer overdue) fits the centered row from 1223px. */
@media (max-width: 1222px) {
  .signed-in .top.top--centered { grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; min-height: 110px; padding-block: 8px; }
  .signed-in .top.top--centered > nav { grid-column: 1 / -1; grid-row: 2; }
  .signed-in .top--centered > .header-actions { grid-column: 2; }
}
@media (max-width: 760px) {
  .signed-in .top.top--centered { column-gap: 8px; }
  .signed-in .top--centered > .brand { min-height: 44px; min-width: 44px; justify-content: flex-start; }
  .signed-in .top--centered > .brand > span:last-child { display: none; }
  .signed-in .top--centered > .header-actions, .signed-in .top--centered .identity { gap: 8px; }
  .signed-in .top--centered .badge-long { display: none; }
  .signed-in .top--centered .badge-short { display: inline; }
  .signed-in .top.top--centered > nav { --nav-padding: 6px; }
}
@media (max-width: 360px) {
  .signed-in .top.top--centered { column-gap: 4px; }
  .signed-in .top--centered > .header-actions, .signed-in .top--centered .identity { gap: 4px; }
  .signed-in .top.top--centered > nav { --nav-padding: 2px; }
}
