:root {
  --ink: #111111;
  --muted: #555555;
  --line: #d8d8d8;
  --soft: #f6f6f6;
  --panel: #ffffff;
  --husky-purple: #32006e;
  --spirit-purple: #4b2e83;
  --husky-gold: #b7a57a;
  --heritage-gold: #85754d;
  --spirit-gold: #ffc700;
  --purple: var(--husky-purple);
  --purple-2: var(--spirit-purple);
  --gold: var(--husky-gold);
  --teal: #007c89;
  --green: #2f7d4f;
  --red: #a34134;
  --blue: #2563a7;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  --topbar-height: 72px;
  --sticky-gap: 14px;
  --panel-transition-ms: 260ms;
  --app-view-transition-ms: 240ms;
  --glass-bg: rgba(255, 255, 255, 0.82);
  --glass-strong: rgba(255, 255, 255, 0.9);
  --glass-soft: rgba(246, 246, 246, 0.78);
  --glass-border: rgba(255, 255, 255, 0.5);
  font-family: "Encode Sans", "Open Sans", "Uni Sans", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

html {
  scroll-padding-top: calc(var(--topbar-height) + var(--sticky-gap));
}

body {
  margin: 0;
  background: #f7f7f7;
  color: var(--ink);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(rgba(255, 255, 255, 0.36), rgba(255, 255, 255, 0.58)),
    url("./assets/campus-rainier-background.jpg") center / cover no-repeat,
    #f7f7f7;
  pointer-events: none;
  transform: translateZ(0);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(3px) saturate(1.05);
  pointer-events: none;
  transform: translateZ(0);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  position: relative;
  z-index: 0;
  min-height: 100vh;
  padding-top: var(--topbar-height);
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid var(--glass-border);
  backdrop-filter: blur(18px) saturate(1.18);
  box-shadow: 0 1px 0 rgba(50, 0, 110, 0.06);
  transform: translateZ(0);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: inherit;
  text-decoration: none;
}

.brand-logo-full {
  display: block;
  width: min(320px, 34vw);
  height: auto;
}

.brand-logo-mark {
  display: none;
  width: 42px;
  height: auto;
}

.brand-label {
  display: grid;
  gap: 2px;
  max-width: 520px;
  padding-left: 14px;
  border-left: 1px solid var(--line);
  color: var(--ink);
  line-height: 1.15;
}

.brand-label strong {
  color: var(--husky-purple);
  font-size: 0.96rem;
  font-weight: 900;
  letter-spacing: 0;
}

.brand-label span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.page-context,
.metric small,
.range-value,
.lab-meta,
.guide-meta {
  color: var(--muted);
  font-size: 0.82rem;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.topnav,
.segmented {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--glass-border);
  border-radius: 6px;
  backdrop-filter: blur(12px) saturate(1.1);
}

.nav-button,
.segment {
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
}

.nav-button {
  padding: 9px 13px;
}

.nav-button.is-active,
.segment.is-active {
  background: var(--soft);
  color: var(--purple);
  box-shadow: none;
}

.identity-switcher {
  display: grid;
  grid-template-columns: auto 112px 150px;
  gap: 8px;
  align-items: center;
  padding: 4px 4px 4px 10px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid var(--glass-border);
  border-radius: 6px;
  backdrop-filter: blur(12px) saturate(1.1);
}

.identity-switcher label {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.identity-switcher select,
.identity-switcher input {
  min-height: 34px;
}

.identity-switcher input {
  width: 100%;
  min-width: 0;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.86);
}

.auth-session {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 4px;
  border: 1px solid var(--glass-border);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(12px) saturate(1.1);
}

.auth-session[hidden] {
  display: none !important;
}

.auth-session span {
  padding: 0 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.auth-session .secondary-button {
  min-height: 30px;
}

main {
  width: min(1360px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 18px 0 44px;
}

.header-actions[hidden],
.intro-view[hidden],
.database-view[hidden] {
  display: none !important;
}

.intro-view.is-app-view-entering,
.database-view.is-app-view-entering {
  animation: app-view-fade-in var(--app-view-transition-ms, 240ms) ease-out both;
  will-change: opacity, transform;
}

.intro-view.is-app-view-exiting,
.database-view.is-app-view-exiting {
  animation: app-view-fade-out var(--app-view-transition-ms, 240ms) ease-in both;
  will-change: opacity, transform;
}

@keyframes app-view-fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes app-view-fade-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }

  to {
    opacity: 0;
    transform: translateY(-8px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .intro-view.is-app-view-entering,
  .database-view.is-app-view-entering,
  .intro-view.is-app-view-exiting,
  .database-view.is-app-view-exiting {
    animation: none;
    transform: none;
  }
}

.intro-view {
  display: grid;
  place-items: center;
  min-height: calc(100vh - var(--topbar-height) - 62px);
  padding: clamp(36px, 8vh, 84px) 0;
}

.intro-card {
  width: min(780px, 100%);
  padding: clamp(28px, 5vw, 56px);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 18px 60px rgba(17, 17, 17, 0.18);
  backdrop-filter: blur(20px) saturate(1.16);
  text-align: center;
}

.intro-card h1 {
  max-width: none;
  margin: 0;
  color: var(--husky-purple);
  font-size: clamp(2.2rem, 6vw, 4.6rem);
  font-weight: 900;
  line-height: 1;
}

.intro-subtitle {
  max-width: 640px;
  margin: 12px auto 0;
  color: var(--ink);
  font-size: clamp(1.02rem, 2vw, 1.42rem);
  font-weight: 800;
  line-height: 1.35;
}

.intro-body {
  max-width: 560px;
  margin: 28px auto 0;
  padding-top: 24px;
  border-top: 1px solid rgba(50, 0, 110, 0.14);
  color: #30343b;
  font-size: clamp(1rem, 1.6vw, 1.18rem);
  line-height: 1.55;
}

.intro-login-button {
  margin-top: 26px;
}

.command-band {
  padding: 12px 0 14px;
}

.page-context {
  margin: 0 0 6px;
  font-weight: 600;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: min(100%, 980px);
  margin-bottom: 0;
  font-size: 1.55rem;
  line-height: 1.25;
}

.role-banner {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  margin-top: 12px;
  padding: 9px 10px;
  max-width: 780px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-left: 4px solid var(--husky-gold);
  border-radius: 6px;
  color: #333333;
  font-size: 0.9rem;
  backdrop-filter: blur(16px) saturate(1.12);
}

.role-banner strong {
  color: var(--purple);
}

h2 {
  margin-bottom: 0;
  font-size: 1.35rem;
}

h3 {
  margin-bottom: 8px;
  font-size: 1rem;
}

.search-panel {
  padding: 12px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 6px;
  backdrop-filter: blur(16px) saturate(1.12);
}

.search-panel label,
.filter-group label,
.filter-group legend {
  display: block;
  margin-bottom: 8px;
  font-size: 0.84rem;
  font-weight: 700;
}

.search-row {
  display: grid;
  grid-template-columns: 24px 1fr 34px;
  gap: 10px;
  align-items: center;
  padding: 0 8px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.86);
}

svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.search-row svg {
  color: var(--muted);
}

.search-row input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
}

.icon-button,
.dialog-close {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}

.icon-button:hover,
.dialog-close:hover {
  border-color: var(--line);
  background: white;
  color: var(--ink);
}

.summary-grid {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) repeat(3, minmax(92px, 0.333fr));
  gap: 12px;
  margin-bottom: 14px;
}

.metric,
.filters,
.results-panel,
.tab-panel,
.admin-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 6px;
  backdrop-filter: blur(16px) saturate(1.12);
  box-shadow: 0 10px 32px rgba(17, 17, 17, 0.08);
}

.metric {
  padding: 12px;
}

.metric span {
  display: block;
  color: var(--purple);
  font-size: 1.45rem;
  font-weight: 800;
}

.workspace {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.filters {
  position: sticky;
  top: calc(var(--topbar-height) + var(--sticky-gap));
  max-height: calc(100vh - var(--topbar-height) - (var(--sticky-gap) * 2));
  overflow-y: auto;
  padding: 14px;
  scrollbar-gutter: stable;
}

.filter-header,
.results-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.filter-header {
  margin-bottom: 16px;
}

.filter-header h2 {
  font-size: 1.05rem;
}

.filter-group {
  margin: 0 0 18px;
  padding: 0;
  border: 0;
}

select,
input[type="range"] {
  width: 100%;
}

select {
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--ink);
}

#listing-department option.is-parent {
  font-weight: 800;
}

#listing-department option.is-division {
  color: #30343b;
}

.department-combobox {
  position: relative;
}

.department-filter-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--ink);
  text-align: left;
}

.department-filter-button svg {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.department-filter-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  display: grid;
  max-height: 360px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  box-shadow: var(--shadow);
}

.department-filter-menu[hidden] {
  display: none;
}

.department-filter-option {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 34px;
  padding: 7px 8px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.department-filter-option:hover,
.department-filter-option.is-selected {
  background: var(--soft);
}

.department-filter-option.is-parent {
  font-weight: 900;
}

.department-filter-option.is-division {
  padding-left: 24px;
  color: #30343b;
}

.department-filter-count {
  color: var(--muted);
  font-weight: 700;
}

.check-list {
  display: grid;
  gap: 8px;
}

.check-list label,
.toggle-row {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-size: 0.92rem;
}

.toggle-row {
  margin-bottom: 18px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid var(--glass-border);
  border-radius: 6px;
}

.icon-filter-row {
  cursor: pointer;
}

.icon-filter-checkbox {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.icon-filter-control {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  min-width: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.84);
}

.saved-filter-row {
  cursor: pointer;
}

.saved-filter-row:hover .saved-filter-star,
.saved-filter-row.is-active .saved-filter-star {
  border-color: var(--gold);
  background: #f8f5ec;
}

.remote-filter-row {
  cursor: pointer;
}

.remote-filter-row:hover .remote-filter-icon,
.remote-filter-row.is-active .remote-filter-icon {
  border-color: #c9dfd0;
  background: #eef7f1;
}

.icon-filter-checkbox:focus-visible + .icon-filter-control {
  outline: 2px solid var(--spirit-gold);
  outline-offset: 2px;
}

.icon-filter-row.is-pop .favorite-icon {
  animation: favorite-pop 220ms ease-out;
}

.toggle-row span:not(.toggle-count):not(.icon-filter-control) {
  flex: 1;
}

.toggle-count {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 22px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--purple);
  background: rgba(255, 255, 255, 0.78);
  font-size: 0.78rem;
  font-weight: 900;
}

.range-value {
  margin-top: 7px;
  text-align: right;
}

.more-filters {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.more-filters-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 38px;
  padding: 0;
  border: 0;
  color: var(--purple);
  background: transparent;
  font: inherit;
  font-weight: 900;
  text-align: left;
  cursor: pointer;
}

.more-filters-toggle svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  transition: transform 160ms ease;
}

.more-filters-toggle.is-expanded svg {
  transform: rotate(180deg);
}

.more-filters-toggle:focus-visible {
  outline: 2px solid var(--spirit-gold);
  outline-offset: 3px;
}

.more-filters-panel {
  display: grid;
  gap: 14px;
  padding-top: 10px;
}

.more-filters-panel[hidden] {
  display: none;
}

.participation-filter-group {
  display: grid;
  gap: 8px;
  margin-bottom: 0;
}

.participation-filter-group legend {
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 900;
}

.participation-filter-group .toggle-row {
  align-items: flex-start;
  min-height: 0;
  padding: 9px 10px;
  line-height: 1.35;
}

.participation-filter-group input {
  margin-top: 2px;
}

.results-panel {
  min-height: 520px;
  padding: 14px;
}

.toolbar-actions,
.button-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.segment {
  display: grid;
  place-items: center;
  width: 36px;
  height: 34px;
}

.segment svg {
  pointer-events: none;
}

.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 26px;
  margin: 12px 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 24px;
  padding: 0 7px;
  color: var(--purple-2);
  background: #f5f2f8;
  border: 1px solid #ddd4e8;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 700;
}

.lab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 12px;
}

.lab-grid.is-list {
  grid-template-columns: 1fr;
}

.listing-results {
  display: grid;
  gap: 20px;
}

.listing-section {
  display: grid;
  gap: 10px;
}

.listing-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px;
}

.listing-section-heading.is-clickable {
  cursor: pointer;
}

.listing-section-heading.is-clickable:hover .listing-section-toggle {
  color: var(--husky-purple);
}

.listing-section-heading h3 {
  margin: 0;
  color: var(--ink);
  font-size: 0.98rem;
}

.listing-section-count {
  min-width: 28px;
  height: 24px;
  padding: 0 8px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.78);
  font-size: 0.78rem;
  font-weight: 800;
  text-align: center;
}

.listing-section-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  padding: 0;
  border: 0;
  color: var(--ink);
  background: transparent;
  font-size: 0.98rem;
  font-weight: 800;
}

.listing-section-toggle:hover {
  color: var(--husky-purple);
}

.listing-section-toggle:focus-visible {
  outline: 2px solid var(--spirit-gold);
  outline-offset: 3px;
}

.section-toggle-icon {
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 7px solid currentColor;
  transform: rotate(90deg);
  transition: transform 160ms ease;
}

.listing-section.is-collapsed .section-toggle-icon {
  transform: rotate(0deg);
}

.listing-section.is-collapsed .lab-grid {
  display: none;
}

.lab-card {
  display: grid;
  gap: 14px;
  padding: 14px;
  min-height: 230px;
  background: var(--glass-strong);
  border: 1px solid var(--glass-border);
  border-radius: 6px;
  backdrop-filter: blur(14px) saturate(1.1);
  box-shadow: 0 8px 24px rgba(17, 17, 17, 0.07);
}

.lab-card.is-archived {
  background: rgba(251, 250, 248, 0.86);
  border-style: dashed;
}

.lab-grid.is-list .lab-card {
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 0;
}

.lab-card,
.lab-title,
.lab-meta,
.lab-meta-primary,
.lab-investigator,
.lab-department,
.lab-location,
.lab-description,
.tag,
.netid-tag,
.button-row,
.card-actions {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.lab-card:hover {
  border-color: var(--husky-gold);
}

.lab-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.lab-title {
  margin: 0 0 6px;
  font-size: 1.125rem;
  line-height: 1.25;
}

.lab-meta {
  display: grid;
  gap: 2px;
}

.lab-meta-primary {
  display: flex;
  align-items: baseline;
  gap: 4px;
  flex-wrap: wrap;
  font-size: 15px;
  line-height: 1.2;
}

.lab-investigator,
.lab-department {
  font-size: 15px;
}

.lab-investigator {
  font-weight: 700;
  color: var(--ink);
}

.lab-department {
  font-style: italic;
  color: var(--muted);
}

.lab-location {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.25;
}

.lab-hours {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.25;
}

.lab-description {
  margin-bottom: 0;
  color: #3f4550;
  line-height: 1.5;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.inline-listing-note {
  color: var(--purple);
  font-weight: 800;
}

.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: max-content;
  height: 24px;
  padding: 0 7px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 800;
}

.status-stack {
  display: grid;
  justify-items: end;
  gap: 6px;
}

.status.Open {
  color: var(--green);
  background: #e8f4ed;
}

.status.Limited {
  color: #8a650e;
  background: #fff4d8;
}

.status.Closed {
  color: var(--red);
  background: #f9e7e4;
}

.archive-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: max-content;
  height: 24px;
  padding: 0 7px;
  border-radius: 6px;
  color: #6b556a;
  background: #eee7ee;
  font-size: 0.76rem;
  font-weight: 800;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 26px;
  padding: 0 7px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #3f4550;
  font-size: 0.78rem;
}

.netid-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.netid-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 24px;
  padding: 0 7px;
  border-radius: 6px;
  font-size: 0.76rem;
  font-weight: 800;
}

.primary-netid {
  color: #372163;
  background: #f5f2f8;
  border: 1px solid #ddd4e8;
}

.delegate-netid {
  color: #4a412d;
  background: #f8f5ec;
  border: 1px solid #ded4b8;
}

.remote-tag {
  color: #244d35;
  background: #eef7f1;
  border-color: #c9dfd0;
}

.lab-card .participation-tag {
  color: #102f45;
  background: #a2d6f9;
  border-color: #83c2ec;
  font-weight: 800;
}

.lab-card .participation-tag.is-highlighted {
  color: #244d35;
  background: #eef7f1;
  border-color: #c9dfd0;
}

.listing-deadline {
  margin-top: 8px;
  color: var(--purple);
  font-size: 0.84rem;
  font-weight: 800;
}

.card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.card-actions.is-readonly {
  justify-content: flex-end;
}

.card-indicators {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.primary-button,
.secondary-button,
.text-button {
  border-radius: 6px;
  font-weight: 800;
}

.primary-button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--purple);
  color: white;
  background: var(--purple);
}

.secondary-button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  color: var(--purple);
  background: rgba(255, 255, 255, 0.84);
}

.favorite-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  min-width: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.84);
}

.remote-icon-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  min-width: 38px;
  border: 1px solid #c9dfd0;
  border-radius: 6px;
  background: #eef7f1;
}

.remote-icon-indicator.is-mostly-remote {
  border-color: #e7d48c;
  background: #fff6d7;
}

.favorite-button:hover,
.favorite-button.is-favorite {
  border-color: var(--gold);
  background: #f8f5ec;
}

.favorite-button:focus-visible {
  outline: 2px solid var(--spirit-gold);
  outline-offset: 2px;
}

.favorite-icon {
  display: block;
  width: 21px;
  height: 21px;
}

.remote-icon {
  display: block;
  width: 21px;
  height: 21px;
}

.favorite-button.is-pop .favorite-icon {
  animation: favorite-pop 220ms ease-out;
}

@keyframes favorite-pop {
  0% {
    transform: scale(0.82);
  }

  55% {
    transform: scale(1.22);
  }

  100% {
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .favorite-button.is-pop .favorite-icon,
  .icon-filter-row.is-pop .favorite-icon,
  .icon-filter-row.is-pop .remote-icon {
    animation: none;
  }
}

button:disabled,
.disabled-button {
  cursor: not-allowed;
  border-color: #cfd5df;
  color: #6c7480;
  background: #e7eaf0;
  box-shadow: none;
}

.danger-button {
  color: var(--red);
  border-color: #e0c0ba;
}

.text-button {
  border: 0;
  color: var(--purple);
  background: transparent;
}

.empty-state {
  padding: 44px 16px;
  text-align: center;
  color: var(--muted);
}

.restricted-results {
  display: grid;
  gap: 8px;
  max-width: 560px;
  margin: 42px auto;
  padding: 24px;
  border: 1px solid var(--glass-border);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.86);
  text-align: center;
  color: var(--muted);
}

.restricted-results h3 {
  margin: 0;
  color: var(--ink);
  font-size: 1.1rem;
}

.restricted-results p {
  margin: 0;
  line-height: 1.5;
}

.tab-panel {
  margin-top: 18px;
  padding: 16px;
}

.lower-panel-stage {
  margin-top: 18px;
  scroll-margin-top: calc(var(--topbar-height) + var(--sticky-gap));
}

.lower-panel-stack {
  position: relative;
  overflow: hidden;
}

.lower-panel-stage .tab-panel {
  margin-top: 0;
}

.lower-panel.is-entering-from-right {
  animation: panel-in-from-right var(--panel-transition-ms) ease both;
}

.lower-panel.is-entering-from-left {
  animation: panel-in-from-left var(--panel-transition-ms) ease both;
}

@keyframes panel-in-from-right {
  from {
    opacity: 0.7;
    transform: translateX(34px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes panel-in-from-left {
  from {
    opacity: 0.7;
    transform: translateX(-34px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .lower-panel.is-entering-from-right,
  .lower-panel.is-entering-from-left {
    animation: none;
  }
}

.section-heading {
  margin-bottom: 14px;
}

.guide-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 12px;
}

.guide-card {
  padding: 14px;
  background: var(--glass-strong);
  border: 1px solid var(--glass-border);
  border-radius: 6px;
  backdrop-filter: blur(14px) saturate(1.1);
  box-shadow: 0 8px 24px rgba(17, 17, 17, 0.07);
}

.guide-card p,
.guide-body p {
  color: #3f4550;
  line-height: 1.5;
}

.guide-card .primary-button {
  margin-top: 14px;
}

.guide-article {
  padding: 22px;
}

.guide-article-card {
  display: grid;
  gap: 16px;
  padding: 18px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.guide-article-card .secondary-button {
  justify-self: start;
}

.guide-article-header {
  display: grid;
  gap: 8px;
}

.guide-article-header h2 {
  margin: 0;
  color: var(--ink);
  line-height: 1.18;
}

.guide-body {
  display: grid;
  gap: 12px;
}

.guide-body p {
  margin: 0;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  gap: 12px;
}

.admin-card,
.account-card {
  padding: 16px;
}

.admin-card,
.account-card {
  background: var(--glass-strong);
  border: 1px solid var(--glass-border);
  border-radius: 6px;
  backdrop-filter: blur(14px) saturate(1.1);
  box-shadow: 0 8px 24px rgba(17, 17, 17, 0.07);
}

.data-mode-card {
  display: grid;
  gap: 10px;
  align-content: start;
}

.data-mode-card p {
  margin: 0;
  color: #3f4550;
}

.data-mode-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.data-mode-option {
  position: relative;
}

.data-mode-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.data-mode-option span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--purple);
  font-weight: 800;
  background: rgba(255, 255, 255, 0.78);
}

.data-mode-option input:focus-visible + span {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.data-mode-option input:checked + span {
  color: white;
  border-color: var(--purple);
  background: var(--purple);
}

.account-layout {
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
  gap: 12px;
}

.account-card {
  background: var(--glass-strong);
  border: 1px solid var(--glass-border);
  border-radius: 6px;
  backdrop-filter: blur(14px) saturate(1.1);
}

.account-actions {
  margin-top: 16px;
}

.account-listings {
  display: grid;
  gap: 10px;
}

.account-listing {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--glass-border);
  border-radius: 6px;
}

.account-listing span,
.muted-note {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
}

.admin-table-card {
  margin-top: 12px;
  overflow-x: auto;
}

.admin-table table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.admin-table th,
.admin-table td {
  padding: 12px;
  border-top: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.admin-table th {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.admin-table td span {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
}

.quality-bars {
  display: grid;
  gap: 12px;
}

.quality-row {
  display: grid;
  grid-template-columns: 160px 1fr 48px;
  gap: 12px;
  align-items: center;
}

.bar {
  height: 10px;
  overflow: hidden;
  background: var(--soft);
  border-radius: 6px;
}

.bar span {
  display: block;
  height: 100%;
  background: var(--spirit-purple);
}

.lab-dialog,
.listing-dialog,
.confirm-dialog {
  width: min(820px, calc(100vw - 32px));
  max-height: min(780px, calc(100vh - 32px));
  padding: 0;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  background: var(--glass-strong);
  box-shadow: 0 18px 60px rgba(17, 17, 17, 0.22);
  backdrop-filter: blur(18px) saturate(1.12);
}

.lab-dialog::backdrop,
.listing-dialog::backdrop,
.confirm-dialog::backdrop {
  background: rgba(16, 18, 24, 0.58);
}

.dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(255, 255, 255, 0.84);
}

.dialog-profile {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 16px;
  padding: 22px;
}

.profile-aside {
  padding: 16px;
  background: var(--glass-soft);
  border: 1px solid var(--glass-border);
  border-radius: 6px;
  backdrop-filter: blur(12px) saturate(1.08);
}

.avatar {
  display: grid;
  place-items: center;
  width: 82px;
  height: 82px;
  margin-bottom: 14px;
  border-radius: 6px;
  color: white;
  background: var(--purple);
  font-size: 1.6rem;
  font-weight: 900;
}

.profile-main p {
  line-height: 1.55;
}

.profile-department {
  margin-bottom: 6px;
  color: var(--muted);
  font-weight: 700;
}

.profile-last-edited,
.form-submeta {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.profile-website {
  margin: 12px 0 0;
  color: var(--ink);
  font-size: 0.86rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.profile-website strong {
  font-weight: 800;
}

.profile-website a {
  color: var(--purple);
  font-weight: 800;
}

.detail-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.detail-item {
  padding: 10px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--glass-border);
  border-radius: 6px;
}

.detail-item strong {
  display: block;
  margin-bottom: 3px;
}

.listing-dialog {
  width: min(900px, calc(100vw - 32px));
  overflow: visible;
}

.confirm-dialog {
  width: min(460px, calc(100vw - 32px));
}

.auth-dialog {
  width: min(480px, calc(100vw - 32px));
}

.auth-form {
  position: relative;
  display: grid;
  gap: 14px;
  padding: 24px;
}

.auth-form h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1.3rem;
}

.auth-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.45;
}

.form-error {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #f3b4b4;
  border-radius: 6px;
  background: #fff5f5;
  color: #8f1d1d;
  font-weight: 800;
}

.confirm-content {
  display: grid;
  gap: 12px;
  padding: 22px;
}

.confirm-content h2 {
  font-size: 1.18rem;
}

.confirm-content p {
  margin-bottom: 4px;
  color: var(--muted);
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.listing-dialog form {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  max-height: min(780px, calc(100vh - 32px));
  padding: 22px;
  overflow: hidden;
}

.form-header,
.form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.form-header {
  margin-bottom: 18px;
}

.form-header .dialog-close {
  position: static;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  min-height: 0;
  overflow-y: auto;
  padding: 0 4px 4px 0;
}

.form-grid label {
  display: grid;
  gap: 7px;
  color: #30343b;
  font-size: 0.86rem;
  font-weight: 800;
}

.field-label {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px;
  position: relative;
}

.inline-help-link {
  margin-left: 6px;
  padding: 0;
  border: 0;
  color: var(--purple);
  background: transparent;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.inline-help-link:hover {
  color: var(--spirit-purple);
}

.inline-help-link:focus-visible {
  outline: 2px solid var(--spirit-gold);
  outline-offset: 2px;
}

.required-marker {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.character-count {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.character-count.is-near-limit {
  color: #8a650e;
}

.character-count.is-over-limit {
  color: var(--red);
}

.field-help {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 17px;
  height: 17px;
  margin-left: 2px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--purple);
  background: white;
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1;
  cursor: help;
}

.field-help:focus-visible {
  outline: 2px solid var(--spirit-gold);
  outline-offset: 2px;
}

.field-help-tooltip {
  position: fixed;
  z-index: 2147483646;
  max-width: min(280px, calc(100vw - 24px));
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: white;
  box-shadow: var(--shadow);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.35;
  pointer-events: none;
}

.field-help-tooltip[hidden] {
  display: none;
}

.help-dialog {
  width: min(680px, calc(100vw - 32px));
}

.help-dialog-content {
  position: relative;
  padding: 24px;
}

.help-dialog-content h2 {
  margin: 0 36px 10px 0;
}

.help-dialog-content p {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.55;
}

.help-definition-list {
  display: grid;
  gap: 14px;
  margin: 0;
}

.help-definition-list div {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.help-definition-list dt {
  margin: 0 0 5px;
  color: var(--purple);
  font-weight: 900;
}

.help-definition-list dd {
  margin: 0;
  color: var(--ink);
  line-height: 1.5;
}

.form-grid label[hidden] {
  display: none;
}

.checkbox-field {
  align-content: start;
}

.checkbox-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  color: var(--ink);
  font-weight: 600;
}

.form-grid input,
.form-grid select,
.form-grid textarea {
  width: 100%;
  min-height: 40px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--ink);
  font: inherit;
  font-weight: 400;
}

.form-grid .checkbox-control input {
  width: 16px;
  min-height: 16px;
  padding: 0;
}

.form-grid input[readonly] {
  color: var(--muted);
  background: #f4f5f8;
}

.form-grid input.is-invalid {
  border-color: var(--red);
  box-shadow: 0 0 0 1px rgba(163, 65, 52, 0.2);
}

.chip-input {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-height: 42px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
}

.chip-input.has-error {
  border-color: var(--red);
  box-shadow: 0 0 0 1px rgba(163, 65, 52, 0.2);
}

.chip-input.is-readonly {
  background: #f4f5f8;
}

.chip-input-list {
  display: contents;
}

.delegate-chip,
.field-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 3px 7px;
  color: #4a412d;
  background: #f8f5ec;
  border: 1px solid #ded4b8;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 800;
}

.field-chip {
  color: #372163;
  background: #f5f2f8;
  border-color: #ddd4e8;
}

.delegate-chip button,
.field-chip button {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  color: #4a412d;
  background: #eee5cf;
  font-weight: 900;
  line-height: 1;
}

.field-chip button {
  color: #372163;
  background: #e9e2f2;
}

.chip-input-field {
  flex: 1 1 150px;
  min-width: 120px;
  min-height: 28px;
  padding: 0 4px;
  border: 0;
  outline: 0;
  background: transparent;
}

.chip-input-empty {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 400;
}

.chip-error,
.field-error {
  margin: -2px 0 0;
  color: var(--red);
  font-size: 0.8rem;
  font-weight: 800;
  line-height: 1.35;
}

.chip-error[hidden],
.field-error[hidden] {
  display: none;
}

.form-grid textarea {
  resize: vertical;
}

.form-wide {
  grid-column: 1 / -1;
}

.form-footer {
  margin-top: 0;
  padding-top: 18px;
}

.form-footer span {
  color: var(--muted);
  font-size: 0.86rem;
}

@media (max-width: 920px) {
  .topbar,
  .workspace,
  .summary-grid,
  .account-layout,
  .admin-grid,
  .dialog-profile {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .brand-logo-full {
    display: none;
  }

  .brand-logo-mark {
    display: block;
  }

  .brand-label {
    max-width: min(100%, 520px);
    padding-left: 0;
    border-left: 0;
  }

  .topnav {
    width: 100%;
    overflow-x: auto;
  }

  .header-actions {
    width: 100%;
    justify-content: stretch;
  }

  .identity-switcher {
    width: 100%;
    grid-template-columns: auto minmax(96px, 0.5fr) minmax(140px, 1fr);
  }

  .auth-session {
    width: 100%;
    justify-content: space-between;
  }

  .nav-button {
    flex: 1;
    min-width: max-content;
  }

  .filters {
    position: static;
    max-height: none;
    overflow-y: visible;
  }
}

@media (max-width: 560px) {
  main {
    width: min(100vw - 20px, 1440px);
    padding-top: 12px;
  }

  h1 {
    font-size: 1.35rem;
  }

  .search-row {
    grid-template-columns: 22px 1fr 32px;
  }

  .lab-grid,
  .guide-list {
    grid-template-columns: 1fr;
  }

  .lab-grid.is-list .lab-card {
    grid-template-columns: 1fr;
  }

  .quality-row {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .account-listing,
  .form-header,
  .form-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .identity-switcher {
    grid-template-columns: 1fr;
  }
}
