.account-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin: 0 0 24px;
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.account-bar small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}
.account-bar div {
  display: flex;
  gap: 12px;
  align-items: center;
}
.account-bar a,
.account-bar button,
.account-card button,
.admin-panel button {
  color: var(--text);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}
.account-card {
  width: 100%;
  box-sizing: border-box;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 28px;
  border-radius: 16px;
}
.account-login {
  width: min(100% - 32px, 480px);
  margin: 8vh auto;
}
.account-login h1 {
  font-size: 30px;
}
.account-login p,
.account-card p {
  color: var(--muted);
  line-height: 1.7;
}
.account-form {
  display: grid;
  gap: 16px;
  margin-top: 22px;
}
.account-form label {
  display: grid;
  gap: 7px;
  font-size: 14px;
}
.account-form input,
.account-form select,
.account-form textarea,
.admin-field {
  width: 100%;
  box-sizing: border-box;
  min-height: 44px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text);
  font: inherit;
}
.account-form textarea {
  resize: vertical;
  min-height: 105px;
}
.account-form button[type="submit"] {
  background: var(--accent);
  color: var(--accent-contrast);
  border-color: var(--accent);
  font-weight: 600;
}
.account-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}
.account-links button {
  background: transparent;
  border: 0;
  padding: 4px 0;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
}
.account-status {
  min-height: 24px;
  margin-top: 18px;
  color: var(--accent);
  line-height: 1.6;
}
.account-brand {
  display: inline-block;
  padding: 9px 11px;
  background: var(--accent);
  color: var(--bg);
  border-radius: 6px;
  font:
    500 12px "DM Mono",
    monospace;
}
.authored-text {
  white-space: pre-wrap;
}
.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0;
}
.admin-nav button {
  padding: 10px 15px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.admin-nav button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--bg);
}
.admin-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 24px;
  border-radius: 14px;
}
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}
.admin-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.admin-row > span {
  flex: 1;
  min-width: 180px;
  overflow-wrap: anywhere;
}
.admin-row small {
  display: block;
  color: var(--muted);
  margin-top: 5px;
}
.admin-row select {
  width: auto;
  max-width: 100%;
}
.admin-row button {
  margin: 0;
}
.admin-question {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-top: 12px;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.admin-table td,
.admin-table th {
  text-align: left;
  padding: 12px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  overflow-wrap: anywhere;
}
button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
[hidden] {
  display: none !important;
}
@media (max-width: 600px) {
  .account-card,
  .admin-panel {
    padding: 20px;
  }
  .account-login {
    margin: 24px auto;
  }
  .admin-row {
    align-items: stretch;
  }
  .admin-row > span {
    flex-basis: 100%;
  }
  .admin-table {
    font-size: 12px;
  }
}

#app > .account-card + .account-card {
  margin-top: 24px;
}
.admin-row select {
  min-height: 44px;
  padding: 8px 12px;
  color: var(--text);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
}
.editor-question {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  min-width: 0;
}
/* Low-specificity defaults also cover controls in dialogs outside main. */
:where(.portal-body) button {
  min-height: 40px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text);
  font:
    500 13px/1.45 system-ui,
    sans-serif;
  cursor: pointer;
}
:where(.portal-body) :is(input, select, textarea) {
  font: inherit;
}
:where(.portal-body)
  :is(button, a, input, textarea, select, summary):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* Shared Questions shell */
.portal-body {
  display: block;
  padding: 0;
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}
.portal-shell {
  width: min(1240px, 100% - 64px);
  margin: auto;
}
.portal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 0;
  border-bottom: 1px solid var(--border);
}
.portal-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--accent);
  font-size: 30px;
  font-weight: 750;
  letter-spacing: -2px;
}
.portal-brand > span {
  font-size: 17px;
  letter-spacing: -0.4px;
  color: var(--text);
}
.portal-brand small {
  display: block;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.2px;
  color: var(--muted);
  margin-top: 3px;
}
.portal-top nav,
.portal-footer nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 24px;
}
.portal-top nav a,
.portal-footer a {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
}
.portal-top nav a:hover,
.portal-footer a:hover {
  color: var(--accent);
}
.portal-theme {
  display: flex;
  gap: 7px;
  padding: 9px 12px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}
.portal-heading {
  margin: 40px 0 26px;
}
.portal-heading h1 {
  font-size: clamp(28px, 4vw, 40px);
  letter-spacing: -1px;
  margin: 8px 0;
}
.portal-heading p {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}
.portal-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--border);
  margin-top: 64px;
  padding: 25px 0 32px;
  color: var(--muted);
  font-size: 12px;
}
.portal-body .learning-shell {
  max-width: 1040px;
  margin: 28px auto 0;
}
.portal-body .account-bar {
  padding: 12px 16px;
  background: transparent;
  border-radius: 10px;
}
.account-bar small {
  font-size: 11px;
}
.account-bar a,
.account-bar button {
  font-size: 12px;
  background: var(--surface);
}
.portal-body .eyebrow {
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 1.8px;
  color: var(--accent);
}
.portal-body button,
.portal-button {
  transition:
    background 0.15s,
    border-color 0.15s;
}
.portal-body button:hover:not(:disabled) {
  border-color: var(--accent);
}
.portal-button,
.workspace-card button,
.filter-bar > button,
.workspace-heading > button,
.admin-grid > button,
.editor-actions button {
  border: 1px solid var(--border);
  background: var(--surface2);
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  text-decoration: none;
  font-size: 13px;
}
.workspace-card button[type="submit"],
.editor-actions button[type="submit"] {
  color: var(--accent-contrast);
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}
.workspace-card button[type="submit"]:hover {
  background: var(--accent-hover);
}
.account-form input,
.account-form select,
.account-form textarea,
.filter-bar input,
.filter-bar select,
.search-field input {
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 11px 12px;
  width: 100%;
  min-height: 44px;
  box-sizing: border-box;
}
.account-form label,
.filter-bar label,
.search-field {
  font-size: 12px;
  font-weight: 550;
  display: grid;
  gap: 7px;
}
.account-form textarea {
  line-height: 1.6;
}
.account-form {
  margin-top: 20px;
  gap: 18px;
}
.account-form p.form-hint {
  font-size: 12px;
  margin: 0;
}
.form-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}
.form-hint a,
.portal-body main a {
  color: var(--accent);
}
.workspace-card h4 {
  margin: 25px 0 10px;
  font-size: 13px;
}
.account-form label.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 400;
}
.checkbox-label input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}
.notice {
  position: sticky;
  top: 12px;
  z-index: 3;
  margin-bottom: 18px;
  background: var(--accent-soft);
  color: var(--text);
  padding: 14px 18px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
}
.notice.is-error {
  border-color: var(--danger);
  background: var(--danger-bg);
}
.loading-card {
  padding: 50px;
  text-align: center;
  color: var(--muted);
}
/* Login */
.login-layout {
  display: grid;
  grid-template-columns: 1fr 440px;
  gap: 90px;
  align-items: center;
  min-height: calc(100vh - 225px);
  padding: 60px 40px 40px;
}
.login-story h1 {
  font-size: clamp(38px, 4.3vw, 58px);
  font-weight: 650;
  line-height: 1.12;
  letter-spacing: -2.5px;
  margin: 22px 0;
}
.login-story h1 em {
  color: var(--accent);
  font-style: normal;
}
.login-story > p {
  color: var(--muted);
  font-size: 16px;
  max-width: 410px;
  line-height: 1.7;
}
.login-benefits {
  margin-top: 35px;
  display: grid;
  gap: 20px;
}
.login-benefits > div {
  display: grid;
  grid-template-columns: 28px 1fr;
  column-gap: 14px;
}
.login-benefits span {
  font: 12px monospace;
  color: var(--accent);
  padding-top: 2px;
  grid-row: span 2;
}
.login-benefits h2 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}
.login-benefits p {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
  max-width: 330px;
}
.login-note {
  font-size: 11px;
  color: var(--muted);
  margin-top: 32px;
}
.login-form-card {
  padding: 36px;
  border-radius: 18px;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.035);
}
.login-form-card .account-brand {
  background: var(--accent-soft);
  color: var(--accent);
  font: 10px system-ui;
  letter-spacing: 1.5px;
  padding: 9px 12px;
}
.login-form-title {
  margin-top: 22px;
  font-size: 25px;
  letter-spacing: -0.7px;
}
.login-form-card > p {
  font-size: 13px;
  margin-top: 8px;
}
.login-form-card .account-links {
  justify-content: space-between;
}
.login-form-card .account-links button {
  font-size: 12px;
}
.login-form-card .account-form button[type="submit"] {
  padding: 13px;
  display: flex;
  justify-content: space-between;
  color: var(--accent-contrast);
}
.account-status {
  font-size: 13px;
}
.account-status.is-error {
  color: var(--danger);
}
.login-form-card section > h2 {
  font-size: 21px;
  margin-top: 22px;
}
.login-form-card section > p {
  font-size: 13px;
}
.password-toggle {
  border: 0 !important;
  background: transparent !important;
  padding: 0 !important;
  color: var(--accent) !important;
  font-size: 11px !important;
  text-align: left;
  width: fit-content;
}
/* Administration */
.admin-layout {
  display: grid;
  grid-template-columns: 218px minmax(0, 1fr);
  gap: 32px;
}
.admin-sidebar {
  align-self: start;
  position: sticky;
  top: 24px;
}
.admin-sidebar nav {
  display: grid;
  gap: 5px;
  margin-top: 18px;
}
.admin-sidebar nav button {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  padding: 13px 12px;
  border-radius: 8px;
  font: 500 13px system-ui;
  color: var(--muted);
  cursor: pointer;
}
.admin-sidebar nav button > span {
  color: var(--muted);
  font: 10px monospace;
}
.admin-sidebar nav button[aria-current="page"] {
  color: var(--text);
  background: var(--accent-soft);
  border-color: var(--border);
}
.admin-sidebar nav button[aria-current="page"] span {
  color: var(--accent);
}
.admin-sidebar-note {
  border-top: 1px solid var(--border);
  margin-top: 30px;
  padding: 22px 10px;
  font-size: 12px;
}
.admin-sidebar-note p {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.6;
  margin: 9px 0;
}
.admin-sidebar-note a {
  color: var(--accent);
  text-decoration: none;
  font-size: 11px;
}
.notification-dot {
  width: 6px;
  height: 6px;
  background: var(--gold);
  border-radius: 50%;
  margin-left: auto;
}
#admin-workspace {
  min-width: 0;
}
.workspace-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 26px;
}
.workspace-heading h2 {
  font-size: 23px;
  letter-spacing: -0.6px;
}
.workspace-heading p {
  color: var(--muted);
  font-size: 13px;
  margin-top: 8px;
  line-height: 1.6;
}
.workspace-card {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 12px;
  padding: 24px;
  min-width: 0;
  margin-bottom: 22px;
}
.workspace-card h3 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.3px;
}
.card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 15px;
}
.card-heading > button {
  font-size: 11px;
  padding: 7px 10px;
  background: transparent;
}
.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 26px;
}
.metric-grid > div {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}
.metric-grid span {
  display: block;
  font-size: 11px;
  color: var(--muted);
}
.metric-grid strong {
  display: block;
  font-size: 31px;
  letter-spacing: -1px;
  font-weight: 550;
  margin-top: 14px;
}
.entity-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 0;
  border-bottom: 1px solid var(--border);
}
.entity-row:last-child {
  border-bottom: 0;
}
.entity-row > div {
  flex: 1;
}
.entity-row strong {
  font-size: 13px;
}
.entity-row small,
.compact-row small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 5px;
}
.avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
}
.status-pill {
  display: inline-block;
  width: fit-content;
  white-space: nowrap;
  padding: 4px 7px;
  border-radius: 5px;
  background: var(--surface2);
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}
.status-pill.active {
  color: var(--success);
  background: var(--success-bg);
}
.status-pill.pending {
  color: var(--warning);
  background: var(--warning-bg);
}
.status-pill.suspended {
  color: var(--danger);
  background: var(--danger-bg);
}
.status-pill.ceo {
  color: var(--accent);
  background: var(--accent-soft);
}
.quick-card {
  text-align: left;
  display: grid;
  grid-template-columns: 1fr auto;
  padding: 24px !important;
  background: var(--surface) !important;
  margin-bottom: 22px;
}
.quick-card span {
  font-size: 14px;
  font-weight: 600;
}
.quick-card small {
  color: var(--muted);
  grid-column: 1;
  line-height: 1.6;
  margin-top: 7px;
  font-size: 12px;
}
.quick-card b {
  grid-column: 2;
  grid-row: 1 / span 2;
  color: var(--accent);
  align-self: center;
}
.empty-state {
  text-align: center;
  padding: 38px 15px;
}
.empty-state > span {
  color: var(--accent);
  font-size: 25px;
}
.empty-state h3 {
  font-size: 15px;
  margin-top: 12px;
}
.empty-state p {
  color: var(--muted);
  line-height: 1.6;
  font-size: 12px;
  margin-top: 8px;
}
.step-list {
  list-style: none;
  counter-reset: step;
  display: grid;
  gap: 18px;
  margin-top: 22px;
}
.step-list li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 5px 12px;
}
.step-list li:before {
  content: counter(step);
  color: var(--accent);
  font-size: 12px;
  background: var(--accent-soft);
  border-radius: 6px;
  padding: 7px;
  text-align: center;
  grid-row: span 2;
  align-self: start;
}
.step-list strong {
  font-size: 13px;
}
.step-list span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 14px;
  margin-bottom: 24px;
}
.filter-bar label {
  flex: 1;
  min-width: 140px;
}
.filter-bar .search-field {
  flex: 2;
}
.member-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 20px;
}
.member-item,
.group-item,
.content-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  padding: 16px 8px !important;
  border: 0 !important;
  border-bottom: 1px solid var(--border) !important;
  border-radius: 0 !important;
  background: transparent !important;
}
.member-item.selected,
.group-item.selected,
.content-item.selected {
  background: var(--accent-soft) !important;
}
.member-item > span:nth-child(2) {
  flex: 1;
  min-width: 0;
}
.member-item strong {
  display: block;
  font-size: 13px;
}
.member-item small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin: 5px 0 9px;
  overflow-wrap: anywhere;
}
.member-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.list-count {
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 10px;
}
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 0;
  font-size: 11px;
  color: var(--muted);
}
.pagination button {
  font-size: 11px;
  padding: 7px 12px;
}
.detail-card > p {
  font-size: 12px;
  color: var(--muted);
  margin-top: 7px;
  overflow-wrap: anywhere;
}
.detail-card .eyebrow {
  font-size: 9px;
}
.detail-card > h3 {
  margin-top: 10px;
}
.group-item {
  display: grid;
  gap: 6px;
}
.group-item small,
.group-item span {
  color: var(--muted);
  font-size: 11px;
}
.form-details {
  margin-top: 22px;
  border-top: 1px solid var(--border);
  padding-top: 18px;
}
.form-details summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--accent);
}
.form-details label {
  margin-top: 16px;
}
.compact-row,
.grant-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.compact-row button,
.grant-row button {
  padding: 7px 10px;
  font-size: 11px;
}
.grant-row small {
  display: block;
  margin: 6px 0;
  color: var(--muted);
  font-size: 11px;
}
.grant-subject {
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 11px;
}
.grant-subject strong {
  color: var(--text);
}
.content-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 20px;
}
.content-browser {
  align-self: start;
}
.content-item {
  display: grid;
  gap: 7px;
}
.content-item strong {
  font-size: 12px;
  line-height: 1.5;
}
.content-item small {
  color: var(--muted);
  font-size: 10px;
}
.content-browser .search-field {
  margin-bottom: 10px;
}
.content-browser #content-list {
  max-height: 620px;
  overflow-y: auto;
}
.editor-question {
  padding: 18px;
}
.editor-question legend {
  padding: 0 6px;
  font-size: 12px;
  color: var(--accent);
}
.editor-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 15px;
  margin-top: 12px;
}
.editor-actions span {
  font-size: 11px;
  color: var(--muted);
}
.content-note {
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  padding: 24px;
  border-radius: 10px;
  margin-bottom: 24px;
}
.content-note p {
  line-height: 1.7;
  margin-top: 14px;
}
.content-dialog {
  width: min(850px, 100% - 40px);
  max-height: min(800px, calc(100dvh - 48px));
  overflow: auto;
  overscroll-behavior: contain;
  margin: auto;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
}
.content-dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
}
.content-preview {
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.7;
}
.activity-row {
  display: flex;
  gap: 14px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}
.activity-dot {
  width: 7px;
  height: 7px;
  flex-shrink: 0;
  background: var(--accent);
  border-radius: 50%;
  margin-top: 5px;
}
.activity-row strong {
  font-size: 13px;
}
.activity-row small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
}
.activity-row p {
  font-size: 12px;
  color: var(--muted);
  margin-top: 10px;
}
/* Member experience and public pages */
.legal-layout {
  max-width: 780px;
  margin: auto;
}
.legal-layout section {
  margin: 30px 0;
  border-bottom: 1px solid var(--border);
  padding-bottom: 25px;
}
.legal-layout h2 {
  font-size: 19px;
  margin-bottom: 12px;
}
.legal-layout p {
  color: var(--muted);
  line-height: 1.85;
  font-size: 14px;
}
.legal-incomplete {
  padding: 15px;
  border: 1px solid var(--warning);
  border-radius: 8px;
  background: var(--warning-bg);
  margin-top: 20px;
}
.learning-dashboard {
  margin-bottom: 26px;
}
.welcome-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 24px 0;
}
.welcome-row h2 {
  font-size: 26px;
  letter-spacing: -0.8px;
}
.welcome-row p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  margin-top: 8px;
}
.learning-search {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 18px 20px;
  border-radius: 12px;
}
.learning-search input {
  border: 0;
  outline-offset: 8px;
  width: 100%;
  background: transparent;
  color: var(--text);
  font: 14px system-ui;
  padding: 5px 0;
}
.search-results {
  max-height: 360px;
  overflow: auto;
}
.learning-result {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-top: 1px solid var(--border);
  color: var(--text);
  padding: 14px 0;
  font-size: 13px;
  cursor: pointer;
}
.learning-result small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 7px;
}
.favorite-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}
.favorite-strip button {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 12px;
  cursor: pointer;
}
.favorite-module {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  gap: 12px;
}
.favorite-module label {
  display: flex;
  gap: 12px;
  align-items: center;
}
.favorite-module input {
  accent-color: var(--accent);
}
.profile-summary {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 26px;
}
.profile-summary .avatar {
  height: 56px;
  width: 56px;
  font-size: 22px;
}
.profile-summary h2 {
  font-size: 21px;
}
.profile-summary p {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}
.profile-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
}
@media (max-width: 1100px) {
  .login-layout {
    gap: 40px;
    padding: 45px 0;
    grid-template-columns: 1fr 410px;
  }
  .member-layout {
    grid-template-columns: 1fr;
  }
  .content-layout {
    grid-template-columns: 230px minmax(0, 1fr);
  }
  .metric-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 800px) {
  .portal-shell {
    width: calc(100% - 36px);
  }
  .login-layout {
    grid-template-columns: 1fr;
    padding: 32px 0;
    gap: 32px;
    max-width: 520px;
    margin: auto;
  }
  .login-story h1 {
    font-size: 40px;
  }
  .login-benefits {
    display: none;
  }
  .login-story > p {
    font-size: 14px;
  }
  .login-note {
    margin-top: 16px;
  }
  .login-form-card {
    padding: 26px;
  }
  .admin-layout {
    grid-template-columns: 1fr;
    gap: 22px;
  }
  .admin-sidebar {
    position: static;
  }
  .admin-sidebar nav {
    display: flex;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-top: 10px;
  }
  .admin-sidebar nav button {
    white-space: nowrap;
    font-size: 12px;
    padding: 11px;
  }
  .admin-sidebar-note {
    display: none;
  }
  .admin-sidebar .eyebrow {
    display: none;
  }
  .content-layout {
    grid-template-columns: 1fr;
  }
  .content-browser #content-list {
    max-height: 260px;
  }
  .admin-grid {
    grid-template-columns: 1fr;
  }
  .portal-footer {
    margin-top: 40px;
  }
  .portal-top nav {
    gap: 15px;
  }
  .portal-brand > span {
    font-size: 15px;
  }
  .workspace-card {
    padding: 20px;
  }
  .portal-top {
    gap: 12px;
  }
  .portal-heading {
    margin-top: 28px;
  }
  .welcome-row h2 {
    font-size: 23px;
  }
}
@media (max-width: 440px) {
  .portal-top nav a:first-child {
    display: none;
  }
  .portal-top nav {
    gap: 10px;
  }
  .portal-footer nav {
    gap: 18px;
  }
  .account-bar div {
    gap: 6px;
    flex-wrap: wrap;
  }
  .metric-grid > div {
    padding: 16px;
  }
  .entity-row {
    flex-wrap: wrap;
  }
  .workspace-heading {
    align-items: start;
    flex-wrap: wrap;
  }
  .login-story h1 {
    font-size: 36px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .portal-body * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.admin-sidebar {
  min-width: 0;
}
@media (max-width: 800px) {
  .admin-layout,
  .member-layout,
  .content-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .admin-sidebar nav {
    max-width: 100%;
  }
  .workspace-card,
  .metric-grid > div {
    min-width: 0;
  }
  .workspace-heading p {
    overflow-wrap: anywhere;
  }
}
/* Registration, waiting room, inbox and editable project credits. */
.waiting-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 28px;
  margin-bottom: 20px;
}
.confirmation-address {
  font-weight: 650;
  overflow-wrap: anywhere;
}
.onboarding-steps {
  list-style: none;
  padding: 0;
  counter-reset: onboarding;
  margin: 24px 0;
  display: grid;
  gap: 12px;
}
.onboarding-steps li {
  counter-increment: onboarding;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  line-height: 1.45;
}
.onboarding-steps li:before {
  content: counter(onboarding);
  display: grid;
  place-items: center;
  flex: 0 0 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 50%;
  font-size: 13px;
}
.onboarding-steps .complete:before {
  content: "✓";
  background: var(--accent-soft);
  color: var(--accent);
}
.onboarding-steps .current {
  font-weight: 650;
  color: var(--text);
}
.onboarding-steps .current:before {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
#notification-count {
  display: inline-grid;
  place-items: center;
  background: var(--accent);
  color: white;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 12px;
}
#notification-count[hidden] {
  display: none;
}
.notification-toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1000;
  max-width: min(420px, calc(100vw - 32px));
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 12px 40px #0003;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.notification-toast p {
  flex-basis: 100%;
  margin: 0;
}
.notification-toast button {
  padding: 6px 0;
  color: var(--accent);
  background: none;
  border: 0;
  cursor: pointer;
}
.notification-toast button:last-child {
  margin-left: auto;
}
.notification-dialog {
  width: min(760px, calc(100vw - 32px));
}
.inbox-item {
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}
.inbox-item.unread {
  border-left: 3px solid var(--accent);
  padding-left: 16px;
}
.inbox-item h3 {
  font-size: 17px;
  margin: 0 0 8px;
}
.inbox-item time {
  font-size: 12px;
  color: var(--muted);
}
.inbox-item p {
  font-size: 14px;
  line-height: 1.6;
}
.project-person .avatar {
  margin-bottom: 20px;
}
.project-person .eyebrow {
  display: block;
}
.project-person ul {
  padding-left: 20px;
  line-height: 1.7;
  font-size: 14px;
}
.project-person li + li {
  margin-top: 10px;
}
.contributor-editor {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin: 20px 0;
  min-width: 0;
}
.contributor-editor legend {
  font-weight: 650;
  padding: 0 8px;
}

[data-auth-panel] h2[tabindex="-1"]:focus {
  outline: none;
}

/* Click-based selectors avoid native popup/drag behavior and support keyboard selection. */
.account-form .select-trigger,
.filter-bar .select-trigger {
  text-align: left;
  width: 100%;
  min-height: 44px;
  background: var(--surface);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.select-trigger::after {
  content: "⌄";
  margin-left: 12px;
}
.select-trigger:focus-visible,
.select-popover button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.select-popover {
  position: fixed;
  z-index: 1000;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  overflow: auto;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
  box-sizing: border-box;
}
.select-popover input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  position: sticky;
  top: 0;
}
.select-popover [role="option"] {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 5px;
  padding: 10px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
}
.select-popover [role="option"]:hover,
.select-popover [aria-selected="true"] {
  background: var(--accent-soft);
}
.select-popover [hidden],
select[hidden] {
  display: none !important;
}
.grant-module-card {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
}
.grant-module-card summary {
  cursor: pointer;
  display: grid;
  gap: 5px;
}
.grant-module-card summary small,
.grant-module-card summary span {
  color: var(--muted);
  font-size: 12px;
}
.grant-module-card .grant-row:last-child {
  border-bottom: 0;
}
.directory-layout {
  max-width: 1160px;
  margin: 32px auto;
}
.directory-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-top: 20px;
}
.directory-card h2 {
  font-size: 22px;
  margin-top: 18px;
}
.directory-sections {
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}
.directory-sections li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.directory-sections small {
  color: var(--muted);
  white-space: nowrap;
  font-size: 11px;
}
.request-list {
  display: grid;
  gap: 20px;
}
.request-list fieldset {
  display: grid;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
}
.credit-viewport.credit-reading {
  height: auto;
  overflow: visible;
}
.credit-reading .credit-roll {
  animation: none;
  transform: none;
}
.credit-screen:has(.credit-reading) .credit-vignette {
  display: none;
}
@media (max-width: 700px) {
  .directory-grid {
    grid-template-columns: 1fr;
  }
  .directory-sections li {
    flex-wrap: wrap;
  }
  .directory-layout {
    margin: 20px 0;
  }
  .select-popover {
    font-size: 14px;
  }
}

/* Consistent spacing, dialog actions and containment across all portal views. */
.portal-body {
  line-height: 1.5;
}
.portal-body .portal-shell,
.portal-body main,
.portal-body #app,
#admin-workspace,
#admin-view {
  min-width: 0;
}
.portal-body :where(h1, h2, h3, p, label, legend, summary) {
  overflow-wrap: anywhere;
}
.portal-body :where(.portal-button, .select-trigger) {
  line-height: 1.45;
}
.portal-body button[aria-busy="true"] {
  cursor: progress;
}
.portal-body .account-bar > div {
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
}
.account-bar > span {
  min-width: 0;
  overflow-wrap: anywhere;
}
.account-bar strong {
  font-size: 14px;
}
.account-bar small {
  font-size: 12px;
}
.content-dialog {
  font-size: 14px;
  line-height: 1.6;
}
.content-dialog .card-heading {
  align-items: flex-start;
}
.content-dialog .card-heading :is(h2, h3) {
  font-size: clamp(20px, 3vw, 24px);
  letter-spacing: -0.4px;
  line-height: 1.3;
  min-width: 0;
}
.content-dialog .card-heading > button {
  flex-shrink: 0;
  font-size: 13px;
}
.content-dialog > p {
  margin: 12px 0;
}
.content-dialog .form-hint {
  font-size: 13px;
}
.content-dialog .profile-actions {
  align-items: center;
}
.profile-actions > a:not(.portal-button) {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 13px;
  text-decoration: none;
  line-height: 1.5;
}
.profile-actions > a:hover {
  border-color: var(--accent);
}
#notification-status {
  color: var(--muted);
  font-size: 12px;
  margin: 16px 0 4px;
}
.inbox-item > div:first-child {
  display: grid;
  gap: 5px;
}
.inbox-item p {
  margin-top: 12px;
  overflow-wrap: anywhere;
}
.inbox-item .profile-actions {
  margin-top: 14px;
}
.inbox-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}
.notification-toast {
  font-size: 14px;
  line-height: 1.6;
}
.notification-toast button:last-child {
  min-width: 40px;
  padding: 8px;
}
.welcome-row {
  gap: 24px;
  align-items: flex-end;
  margin: 28px 0 22px;
}
.welcome-row > div {
  min-width: 0;
  flex: 1;
}
.welcome-row h2 {
  margin-top: 8px;
  font-size: clamp(23px, 3vw, 29px);
  line-height: 1.25;
}
.welcome-row .portal-button {
  flex-shrink: 0;
  font-size: 13px;
}
.learning-search {
  padding: 16px 18px;
}
.learning-search input {
  min-width: 0;
  min-height: 32px;
}
.search-results .form-hint {
  margin: 12px 0 4px;
}
.portal-body .section-intro h2 {
  line-height: 1.35;
}
.directory-card > p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  margin: 10px 0 18px;
}
.directory-card .card-heading {
  flex-wrap: wrap;
}
.directory-card .status-pill {
  white-space: normal;
}
.directory-card .notice {
  position: static;
  margin-top: 16px;
}
.directory-card .profile-actions {
  margin-top: 18px;
}
.card-heading > :first-child {
  min-width: 0;
}
.entity-row > div,
.compact-row > div,
.grant-row > div {
  min-width: 0;
  overflow-wrap: anywhere;
}
.content-preview {
  overflow-wrap: anywhere;
}
.credit-controls {
  flex-wrap: wrap;
}
.credit-controls span {
  margin-left: 0;
  flex: 1 1 220px;
  line-height: 1.5;
}
@media (max-width: 700px) {
  .welcome-row {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 16px;
  }
  .welcome-row > div {
    flex-basis: 100%;
  }
  .portal-body .account-bar > div {
    justify-content: flex-start;
  }
  .portal-body .account-bar {
    gap: 14px;
  }
  .content-dialog {
    width: calc(100% - 24px);
    padding: 20px;
    max-height: calc(100dvh - 24px);
  }
  .content-dialog .card-heading {
    flex-wrap: wrap;
    gap: 12px;
  }
  .notification-toast {
    right: 12px;
    bottom: 12px;
    padding: 16px;
  }
  .portal-body .portal-top {
    flex-wrap: wrap;
    padding: 18px 0;
  }
  .portal-top nav {
    width: 100%;
    gap: 10px 18px;
  }
  .portal-top nav a {
    padding: 5px 0;
  }
  .portal-theme {
    margin-left: auto;
  }
  .portal-top nav a:first-child {
    display: inline;
  }
  .portal-body .quiz-header {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .portal-body .quiz-header h1 {
    font-size: clamp(22px, 6vw, 28px);
  }
  .portal-body .quiz-header p {
    font-size: 13px;
  }
  .credit-viewport {
    min-height: 360px;
  }
  .credit-person {
    padding-inline: 10px;
  }
  .grant-row,
  .compact-row {
    flex-wrap: wrap;
  }
  .grant-row > div,
  .compact-row > div {
    flex: 1 1 180px;
  }
  .filter-bar label {
    min-width: min(180px, 100%);
  }
}

html:has(.content-dialog[open]) {
  overflow: hidden;
}

.workspace-card button[name="decision"][value="rejected"] {
  background: var(--surface);
  color: var(--danger);
  border-color: var(--border);
}
.workspace-card button[name="decision"][value="rejected"]:hover {
  background: var(--danger-bg);
  border-color: var(--danger);
}
/* Answer buttons become read-only after evaluation; their feedback stays legible. */
.portal-body .option-btn:disabled,
.portal-body .match-target:disabled {
  opacity: 1;
  cursor: default;
}
.portal-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  max-width: 100%;
  text-align: center;
  white-space: normal;
}
.login-form-card [data-auth-panel] .waiting-icon {
  margin-top: 22px;
}
