:root { --account-bar-height: 72px; }
.account-bar {
  position: sticky; top: 0; z-index: 115; flex: none;
  display: flex; align-items: center; gap: 24px; min-height: 72px;
  padding: 12px 24px; border-bottom: 1px solid #d5dfdf;
  background: #fff; color: #172d43;
  font: 14px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.account-bar [hidden] { display: none; }
.account-home { font-weight: 650; text-decoration: none; color: #254e67; }
.account-home-icon { display: none; }
.app-page .account-home {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px;
  border: 1px solid #9bafbf; border-radius: 7px; background: #edf4f8;
  text-decoration: underline; text-underline-offset: 3px;
}
.app-page .account-home-icon { display: inline; }
.app-page .account-home:hover { background: #dceaf3; border-color: #254e67; }
.account-identity { margin-left: auto; text-align: right; min-width: 0; max-width: 360px; }
.account-label { display: block; color: #526575; font-size: 12px; }
.account-name { display: block; overflow-wrap: anywhere; font-size: 14px; }
.account-email { display: block; overflow-wrap: anywhere; font-size: 13px; color: #526575; }
.account-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 12px; align-items: center; flex-shrink: 0; }
.account-actions a, .account-actions button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 40px;
  padding: 8px 14px; border: 1px solid #9bafbf; border-radius: 7px;
  font: inherit; font-weight: 600; text-decoration: none; color: #254e67; background: #fff;
}
.account-actions a { background: #254e67; color: #fff; border-color: #254e67; }
.account-actions button { cursor: pointer; }
.account-actions button:hover { background: #edf4f8; }
.account-actions button:disabled { opacity: .6; cursor: wait; }
.account-bar a:focus-visible, .account-bar button:focus-visible { outline: 3px solid #2563eb; outline-offset: 3px; }
.account-error { margin: 0; color: #a12d27; }
body.app-page { display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }
.app-page > .shell { flex: 1; min-height: 0; height: auto; }
.app-page .login-overlay { top: var(--account-bar-height); }
.app-page .login-card, .app-page .household-access-card { max-height: calc(100dvh - var(--account-bar-height) - 110px); }
.app-page .app-activity { top: calc(var(--account-bar-height) + 12px); }
@media (max-width: 900px) {
  body.app-page { height: auto; min-height: 100dvh; overflow: auto; }
  .app-page > .shell { flex: none; min-height: calc(100dvh - var(--account-bar-height)); }
  .app-page .rail { top: var(--account-bar-height); }
}
@media (max-width: 600px) {
  .account-bar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px 12px; padding: 10px 16px; }
  .account-home { font-size: 13px; }
  .account-identity { width: 100%; }
  .account-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .account-actions a, .account-actions button { min-height: 36px; padding: 6px 12px; }
  .account-error { grid-column: 1 / -1; }
}

/* Active context stays at the top of every application screen. */
.account-context {flex:1;min-width:0;display:grid;gap:5px;max-width:620px}
.account-context > div {display:grid;grid-template-columns:112px minmax(0,1fr);gap:10px;align-items:baseline}
.account-context-label {font-size:12px;color:#526575;white-space:nowrap}
.account-context strong {font-size:14px;line-height:1.4;overflow-wrap:anywhere}
@media (min-width:601px) and (max-width:1000px) {
  .account-bar {flex-wrap:wrap;gap:10px 18px}
  .account-context {flex-basis:100%;max-width:none;order:4}
}
@media (max-width:600px) {
  .account-home {order:1}
  .account-identity {order:2}
  .account-context {grid-column:1 / -1;order:3;max-width:none}
  .account-actions {order:4}
  .account-error {order:5}
  .account-context > div {grid-template-columns:100px minmax(0,1fr);gap:8px}
}
