.account-menu { position: relative; }
.topbar { position: relative; z-index: 5; }
.account-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 9px 4px 5px;
  min-height: 42px;
  background: var(--card);
  border: 1px solid var(--edge);
  border-radius: 14px;
  text-align: left;
}
.account-trigger:hover { background: var(--muted); }
.account-trigger-text { display: grid; min-width: 0; line-height: 1.15; gap: 3px; }
.account-trigger-text strong { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 140px; }
.account-trigger-text .muted { font-size: 11px; }
.account-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 9;
  width: min(235px, calc(100vw - 24px));
  background: var(--card);
  border: 1px solid var(--edge);
  border-radius: var(--radius-control);
  padding: 6px;
  box-shadow: var(--shadow-pop);
}
.account-menu-item {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 42px;
  width: 100%;
  padding: 8px 9px;
  text-align: left;
  text-decoration: none;
  color: var(--foreground);
  border: 0;
  border-radius: 8px;
  background: transparent;
}
.account-menu-item:hover { background: var(--muted); }
.account-menu-switch { padding: 8px 9px; margin-block: 4px; border-block: 1px solid var(--edge); }
.account-profile-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.account-profile-head .avatar { width: 52px; height: 52px; font-size: 18px; }
.login-shell { min-height: 100dvh; padding: 0 32px 36px; }
.login-header { width: min(100%, 1160px); margin: auto; padding: 20px 0; display: flex; align-items: center; justify-content: space-between; }
.login-header .brand { padding-inline: 0; }
.login-main { display: grid; place-items: center; padding-top: clamp(20px, 8vh, 96px); }
.login-main:focus { outline: none; }
.login-frame {
  width: min(100%, 950px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 26px;
  align-items: stretch;
}
.login-card { padding: 28px !important; align-self: center; }
.login-card h1 { margin-bottom: 8px; }
.login-card > form, .login-card > .stack, .login-choices { margin-top: 22px; }
.login-password { border-top: 1px solid var(--edge); padding-top: 12px; }
.login-password summary { color: var(--muted-foreground); cursor: pointer; }
.login-password > form { margin-top: 12px; }
.login-art {
  min-height: 340px;
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  isolation: isolate;
  border-radius: calc(var(--radius) + 10px);
  border: 1px solid var(--brand-edge);
  background: radial-gradient(circle at 64% 46%, var(--secondary) 3%, var(--brand-tint) 63%, var(--card));
}
.login-art-grid {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(var(--edge) 1px, transparent 1px), linear-gradient(to right, var(--edge) 1px, transparent 1px);
  background-size: 27px 27px;
  opacity: .6;
  z-index: -1;
}
.login-art-mark {
  display: grid;
  place-items: center;
  width: clamp(90px, 13vw, 158px);
  aspect-ratio: 1;
  border-radius: 30%;
  color: var(--button-text);
  background: var(--button-bg);
  box-shadow: var(--shadow-pop);
}
.login-art-mark .icon { width: 55%; height: 55%; }
.login-choices { display: grid; gap: 10px; }
.login-choice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  text-decoration: none;
  color: var(--foreground);
  border: 1px solid var(--edge);
  border-radius: var(--radius-control);
  padding: 10px;
}
.login-choice strong, .login-choice .small { display: block; }
.login-choice:hover { border-color: var(--brand-edge); background: var(--brand-tint); }
.login-example { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: space-between; }
.login-caption { margin-top: 16px; }
.dir-status { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.directory-layout { display: grid; grid-template-columns: minmax(220px, 265px) minmax(0, 1fr); gap: 16px; }
.dir-tree, .dir-tree ul { padding: 0; margin: 0; list-style: none; }
.dir-tree ul { padding-left: 14px; }
.dir-tree-row { display: flex; gap: 2px; align-items: center; }
.dir-expand, .dir-expand-spacer { display: grid; place-items: center; min-width: 25px; min-height: 36px; }
.dir-expand, .dir-department { border: 0; background: transparent; border-radius: 8px; }
.dir-department {
  display: flex;
  gap: 6px;
  text-align: left;
  align-items: center;
  min-height: 38px;
  padding: 6px 8px;
  flex: 1;
  min-width: 0;
}
.dir-expand:hover, .dir-department:hover { background: var(--muted); }
.dir-department[aria-pressed="true"] { color: var(--brand-text); background: var(--brand-tint); font-weight: 650; }
.dir-members-head { flex-wrap: wrap; }
.dir-member { flex: 1 1 110px; min-width: 0; overflow-wrap: anywhere; }
.dir-members .mini-item { flex-wrap: wrap; }
.dir-members input { width: 18px; height: 18px; flex: none; }
.dir-members input:disabled { opacity: .45; }
.staff-control { display: flex; align-items: center; gap: 8px; text-align: left; }
.staff-control > span:first-child { flex: 1 1 auto; }
.staff-control > span.small { flex: 0 0 auto; }
.staff-control:hover { border-color: var(--brand-edge); background: var(--brand-tint); }
dialog:has(.staff-picker) { width: min(850px, calc(100% - 28px)); }
.staff-picker { min-width: 0; }
.picker-layout { grid-template-columns: minmax(192px, .8fr) minmax(0, 1.4fr); margin-bottom: 10px; }
.staff-tree, .staff-list { min-width: 0; border: 1px solid var(--edge); border-radius: var(--radius-control); padding: 12px; }
.staff-tree > h3 { margin-bottom: 8px; }
.staff-list .dir-members { overflow-y: auto; max-height: min(40dvh, 380px); }
@media (max-width: 780px) {
  .login-frame { grid-template-columns: minmax(0, 1fr); max-width: 520px; }
  .login-art { display: none; }
  .login-shell { padding-inline: 16px; }
  .directory-layout:not(.picker-layout) { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .login-card { padding: 18px !important; }
  .login-card h1 { font-size: 25px; }
  .login-header { padding-block: 14px; }
  .picker-layout { grid-template-columns: 1fr; }
  .dir-expand, .dir-department, .account-menu-item { min-height: 44px; }
  .dir-members input { width: 22px; height: 22px; }
}
