:root {
  color-scheme: light;
  font-family: 'Segoe UI', system-ui, sans-serif;
  line-height: 1.5;
  color: #172840;
  background: #f3f6fb;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
a { color: #0053a7; }

:focus-visible {
  outline: 3px solid #0053a7;
  outline-offset: 4px;
}

.site-header {
  background: #fff;
  border-block-end: 1px solid #d7e0ed;
  border-block-start: 4px solid #0053a7;
}

.header-inner, .portal, .status {
  width: min(100% - 2rem, 68rem);
  margin-inline: auto;
}

.header-inner, .header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.header-inner {
  justify-content: space-between;
  min-height: 4.5rem;
  padding-block: 0.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
}

.brand img {
  display: block;
  width: 8rem;
  height: 2.75rem;
  object-fit: contain;
}


.portal-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.portal-nav a {
  padding: 0.5rem 0.85rem;
  border-radius: 0.375rem;
  color: #395271;
  font-weight: 650;
  text-decoration: none;
}

.portal-nav a:hover, .portal-nav a[aria-current] {
  color: #0053a7;
  background: #eaf2fc;
}

.environment {
  border: 1px solid #cedbec;
  border-radius: 0.375rem;
  padding: 0.25rem 0.625rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #304b6e;
  background: #eff4fb;
}

.environment[data-environment="production"] {
  color: #1c5c43;
  border-color: #b2d7c8;
  background: #e6f4ed;
}

h1, h2, p { margin-block: 0; }
h1 {
  font-size: clamp(1.85rem, 4vw, 2.75rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
}
h2 { font-size: 1.125rem; }
p { color: #425671; }

.login {
  width: min(100% - 2rem, 31rem);
  margin: clamp(3rem, 10vw, 8rem) auto;
}

.portal { margin-block: clamp(2.5rem, 6vw, 5rem); }
.portal-grid {
  display: grid;
  align-items: start;
  gap: 1rem;
  margin-block-start: 1.5rem;
}

.portal-grid.with-tools { grid-template-columns: minmax(0, 1fr) minmax(14rem, 19rem); }

.panel {
  display: grid;
  align-content: start;
  justify-items: start;
  gap: 1rem;
  border: 1px solid #d7e0ed;
  border-radius: 0.75rem;
  padding: clamp(1.25rem, 4vw, 2rem);
  background: #fff;
}

.login .panel { border-block-start: 4px solid #0053a7; }
.tools-panel { background: #f8fbff; }
.app-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.app-card h2, .assignment-list strong { overflow-wrap: anywhere; }
.permissions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0;
  margin: 0;
  list-style: none;
}

.permissions li {
  padding: 0.2rem 0.55rem;
  border-radius: 0.375rem;
  background: #eaf2fc;
  color: #184779;
  font-size: 0.875rem;
}

.button, #sign-out {
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 0.875rem;
  border-radius: 0.375rem;
  font: inherit;
  font-weight: 650;
  line-height: 1.25;
}

.button {
  border: 1px solid transparent;
  color: #fff;
  background: #0053a7;
  cursor: pointer;
  text-decoration: none;
}

.button:hover:not(:disabled) { background: #003d80; }
.button.secondary { border-color: #d6deea; background: #fff; color: #254a72; }
.button.secondary:hover:not(:disabled) { background: #f0f5fb; }
.button.danger { border-color: #edcdc9; color: #962c20; }
.button.danger:hover:not(:disabled) { background: #fff1ed; }
.button:disabled { opacity: 0.5; cursor: default; }

#sign-out {
  border: 1px solid #cad6e7;
  color: #173252;
  background: #fff;
  cursor: pointer;
}

#sign-out:hover { background: #eff4fb; }
#sign-out:disabled { cursor: wait; }
.status { margin-block-start: 1rem; color: #893118; }

.access-page { margin-block: clamp(1.75rem, 4vw, 3.5rem); }
.admin-nav { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-block-end: 1.25rem; }
.admin-nav a, .admin-nav button {
  padding: 0.4rem 0.75rem;
  border: 1px solid #d7e0ed;
  border-radius: 0.375rem;
  background: #fff;
  color: #28496c;
  font-weight: 650;
  text-decoration: none;
}
.admin-nav button {
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}
.admin-nav a:hover, .admin-nav a[aria-current="page"], .admin-nav button:hover {
  border-color: #b7cce7;
  background: #eaf2fc;
  color: #0053a7;
}
.page-intro p { margin-block-start: 0.5rem; }
.access-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.13fr) minmax(0, 0.87fr);
  gap: 1rem;
  align-items: start;
  margin-block-start: 1.5rem;
}

.access-editor, .assignment-panel { justify-items: stretch; }
.selection {
  display: grid;
  gap: 0.375rem;
  font-weight: 650;
}

.selection :is(select, input) {
  width: 100%;
  min-height: 2.75rem;
  padding-inline: 0.625rem;
  border: 1px solid #aebed3;
  border-radius: 0.375rem;
  color: inherit;
  background: #fff;
  font: inherit;
  font-weight: 400;
}

.selection input[readonly] { background: #f3f6fb; }
#users-oid-help { font-size: 0.9rem; }

.directory-picker { display: grid; min-width: 0; gap: 0.375rem; }
.directory-field {
  position: relative;
  display: flex;
  min-width: 0;
  border: 1px solid #aebed3;
  border-radius: 0.5rem;
  background: #fff;
}
.directory-field:focus-within {
  border-color: #0053a7;
  outline: 3px solid #d9eaff;
}
.directory-field input {
  width: 100%;
  min-width: 0;
  min-height: 2.75rem;
  border: 0;
  border-radius: inherit;
  padding: 0.625rem 0.75rem;
  background: transparent;
  color: inherit;
  font: inherit;
  outline: none;
}
.directory-field input::placeholder { color: #52647e; }
.directory-toggle {
  display: grid;
  place-items: center;
  flex: 0 0 2.75rem;
  border: 0;
  border-radius: 0 0.5rem 0.5rem 0;
  background: transparent;
  color: #254a72;
  cursor: pointer;
}
.directory-toggle:hover:not(:disabled) { background: #eff5fc; }
.directory-toggle span {
  width: 0.5rem;
  height: 0.5rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-0.125rem) rotate(45deg);
}
.directory-toggle[aria-expanded="true"] span { transform: translateY(0.125rem) rotate(225deg); }
.directory-popup {
  position: absolute;
  z-index: 3;
  inset: calc(100% + 0.4rem) -1px auto;
  overflow: hidden;
  border: 1px solid #bfcee1;
  border-radius: 0.55rem;
  background: #fff;
  box-shadow: 0 0.75rem 1.7rem #17325220;
}
.directory-popup ul {
  list-style: none;
  max-height: min(45vh, 16rem);
  overflow-y: auto;
  margin: 0;
  padding: 0.25rem;
}
.directory-popup ul:empty { display: none; }
.directory-popup [role="option"] {
  padding: 0.5rem 0.65rem;
  border-radius: 0.35rem;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.directory-popup [role="option"]:is(:hover, [aria-selected="true"]) { background: #eaf2fc; }
.directory-empty { padding: 0.75rem; color: #52647e; }

#access-permissions {
  min-width: 0;
  margin: 0;
  padding: 0.7rem 0.9rem 0.85rem;
  border: 1px solid #d7e0ed;
  border-radius: 0.5rem;
}

#access-permissions legend { padding-inline: 0.25rem; font-weight: 650; }
#access-permissions p { font-size: 0.9rem; }
.permission-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.2rem 0.875rem;
  margin-block-start: 0.5rem;
}
.permission-options label {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 2.5rem;
}
.permission-options input { width: 1rem; height: 1rem; margin: 0; accent-color: #0053a7; }
.permission-options label:has(input:disabled) { color: #5c6c83; }
.form-actions { display: flex; flex-wrap: wrap; gap: 0.625rem; }
.access-status:not(:empty), .retry-link { margin-block-start: 1rem; }
.access-status[data-tone="success"] { color: #176345; }
.access-status[data-tone="error"] { color: #893118; }
.retry-link { display: inline-block; }
.assignment-list { margin: 0; padding: 0; list-style: none; }
.assignment-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  padding-block: 0.75rem;
  border-block-start: 1px solid #d7e0ed;
}

.assignment-list p { font-size: 0.875rem; }
.text-button {
  border: 1px solid #d6deea;
  border-radius: 0.375rem;
  padding: 0.45rem 0.625rem;
  background: #fff;
  color: #0053a7;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 650;
  cursor: pointer;
}
.text-button:hover:not(:disabled) { background: #eff4fb; }
.text-button:disabled { opacity: 0.5; cursor: default; }
#administrators-workspace, .member-workspace { grid-template-columns: minmax(0, 0.86fr) minmax(0, 1.14fr); }
:is(#administrators-workspace, .member-workspace) .panel { padding-inline: clamp(1rem, 2.4vw, 2rem); }
#administrators-list strong, .member-workspace .assignment-list strong { font-size: 0.9rem; }
.revoke-role { flex-shrink: 0; white-space: nowrap; color: #962c20; }
.revoke-role:hover:not(:disabled) { background: #fff1ed; }

@media (max-width: 47rem) {
  .portal-grid.with-tools, .access-workspace, #administrators-workspace { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 36rem) {
  .portal-nav { order: 1; width: 100%; }
}

@media (max-width: 28rem) {
  .permission-options { grid-template-columns: 1fr; }
}
