:root {
  color-scheme: light;
  --ink: #1e2832;
  --muted: #637181;
  --line: #dce2e8;
  --surface: #f7f8fa;
  --panel: #ffffff;
  --soft-blue: #eef6ff;
  --blue: #256fb3;
  --green: #2f7661;
  --soft-green: #eef8f4;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--surface);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

body.is-locked {
  overflow: hidden;
}

a {
  color: var(--blue);
  text-decoration: none;
}

a:hover,
a:focus-visible {
  text-decoration: underline;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.app-shell {
  min-height: 100vh;
}

.login-overlay {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    linear-gradient(120deg, rgba(22, 92, 99, 0.88), rgba(37, 111, 179, 0.64)),
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.34), transparent 28%),
    radial-gradient(circle at 80% 80%, rgba(47, 118, 97, 0.28), transparent 34%),
    #165c63;
}

.login-overlay[hidden] {
  display: none;
}

.login-card {
  width: min(430px, 100%);
  border-top: 5px solid #f4ce46;
  border-radius: 8px;
  background: #fff;
  padding: 34px 36px 30px;
  box-shadow: 0 24px 70px rgba(11, 30, 42, 0.28);
}

.login-mark {
  display: grid;
  width: 70px;
  height: 70px;
  margin: 0 auto 16px;
  place-items: center;
  border-radius: 8px;
  background: #165c63;
  color: #fff;
  font-size: 23px;
  font-weight: 850;
}

.login-card h1 {
  text-align: center;
}

.login-card > p:not(.login-error) {
  margin: 8px 0 24px;
  color: var(--muted);
  text-align: center;
}

.login-card label:not(.remember-row) {
  display: block;
  margin: 12px 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.login-card input[type="email"],
.login-card input[type="password"] {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
}

.login-card input:focus {
  outline: 3px solid rgba(37, 111, 179, 0.18);
  border-color: var(--blue);
}

.remember-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0 18px;
  color: var(--muted);
  font-size: 13px;
}

.remember-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
}

.login-card button[type="submit"] {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: #1b365d;
  color: #fff;
  font-weight: 850;
}

.login-card button[type="submit"]:hover,
.login-card button[type="submit"]:focus-visible {
  background: #142946;
}

.login-error {
  min-height: 18px;
  margin-top: 12px;
  color: #b42318;
  font-size: 13px;
  text-align: center;
}

.topbar {
  display: flex;
  min-height: 86px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 32px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.brand-block {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: grid;
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  place-items: center;
  border-radius: 8px;
  background: #165c63;
  color: #fff;
  font-weight: 800;
  letter-spacing: 0;
}

h1 {
  font-size: 22px;
  line-height: 1.15;
}

.topbar p,
.directory-header p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-actions a,
.top-actions button,
.profile-links a {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 7px 12px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.top-actions button {
  cursor: pointer;
}

.product-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  background: #fff;
  padding: 0 32px 14px;
}

.product-tab {
  min-height: 42px;
  flex: 0 0 auto;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  padding: 8px 16px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 800;
}

.product-tab:hover,
.product-tab:focus-visible {
  color: var(--ink);
  background: #f4f7f9;
}

.product-tab.is-active {
  border-color: #1095a8;
  background: #1095a8;
  color: #fff;
}

.workspace {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 22px 28px 32px;
}

.tab-view[hidden] {
  display: none;
}

.control-panel {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 14px 18px;
  align-items: end;
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
}

.search-block label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.search-block input,
.control-actions select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.search-block input {
  padding: 0 13px;
}

.control-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.control-actions select {
  min-width: 170px;
  padding: 0 10px;
}

.result-line {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 13px;
}

.result-line strong {
  color: var(--ink);
}

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

.section-heading h2,
.directory-header h2 {
  font-size: 16px;
}

.content-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
  margin-top: 20px;
}

.content-grid.has-detail {
  grid-template-columns: minmax(420px, 0.9fr) minmax(480px, 1.1fr);
}

.directory-panel,
.detail-panel {
  min-width: 0;
}

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

.directory-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.faculty-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 18px;
  align-items: stretch;
}

.content-grid.has-detail .faculty-list {
  grid-template-columns: 1fr;
  gap: 10px;
}

.faculty-card {
  min-width: 0;
}

.card-button {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  width: 100%;
  height: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 18px;
  color: inherit;
  text-align: left;
}

.content-grid.has-detail .card-button {
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 14px;
  height: 126px;
  padding: 12px;
}

.card-button:hover,
.card-button:focus-visible,
.card-button.is-selected {
  border-color: var(--blue);
  background: #fbfdff;
}

.card-title,
.card-subtitle,
.card-summary,
.card-footer {
  display: block;
}

.card-photo {
  position: relative;
  display: grid;
  width: 120px;
  height: 144px;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: #dcecef;
  color: #165c63;
  font-size: 18px;
  font-weight: 850;
}

.content-grid.has-detail .card-photo {
  width: 74px;
  height: 88px;
}

.card-photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-photo.is-empty img,
.card-photo:not(.is-empty) .photo-fallback {
  display: none;
}

.photo-fallback {
  z-index: 1;
}

.card-copy {
  min-width: 0;
}

.card-title {
  display: -webkit-box;
  overflow: hidden;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.card-subtitle {
  display: -webkit-box;
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

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

.card-themes {
  margin-top: 14px;
  max-height: 30px;
  overflow: hidden;
}

.chip {
  display: inline-flex;
  max-width: 100%;
  min-height: 24px;
  align-items: center;
  border-radius: 999px;
  background: var(--soft-blue);
  padding: 4px 8px;
  color: #185f96;
  font-size: 11px;
  font-weight: 750;
  line-height: 1.25;
}

.chip.keyword {
  background: var(--soft-green);
  color: var(--green);
}

.detail-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.detail-content {
  padding: 22px;
}

.empty-detail {
  color: var(--muted);
}

.profile-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.profile-identity {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.profile-photo {
  display: grid;
  width: 96px;
  height: 112px;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: #dcecef;
  color: #165c63;
  font-size: 22px;
  font-weight: 850;
}

.profile-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-header h2 {
  font-size: 28px;
  line-height: 1.1;
}

.profile-title {
  margin-top: 7px;
  color: var(--muted);
  font-size: 14px;
}

.profile-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.profile-actions {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.close-profile {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 6px 11px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.close-profile:hover,
.close-profile:focus-visible {
  border-color: var(--blue);
  color: var(--ink);
}

.summary-card {
  margin: 18px 0 16px;
  color: #314352;
  font-size: 15px;
  line-height: 1.6;
}

.detail-section {
  margin-top: 18px;
}

.compact-section {
  margin-top: 0;
}

.detail-section h3 {
  margin-bottom: 10px;
  font-size: 14px;
}

.focus-list,
.item-list,
.source-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.focus-list li {
  color: #394957;
  font-size: 14px;
  line-height: 1.45;
}

.focus-list li::before {
  color: var(--blue);
  content: "- ";
}

.item-list li,
.source-list li {
  border-top: 1px solid var(--line);
  padding: 10px 0;
}

.item-list a,
.source-list a {
  font-weight: 700;
}

.item-meta,
.source-meta {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.detail-stack {
  display: grid;
  gap: 8px;
  margin-top: 20px;
}

.detail-disclosure {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.detail-disclosure summary {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
  list-style: none;
}

.detail-disclosure summary::-webkit-details-marker {
  display: none;
}

.detail-disclosure summary span:last-child {
  color: var(--muted);
  font-size: 12px;
}

.disclosure-content {
  border-top: 1px solid var(--line);
  padding: 4px 12px 10px;
}

.no-results {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
  text-align: center;
}

.tool-placeholder {
  max-width: 820px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 28px;
}

.placeholder-label {
  margin-bottom: 10px;
  color: #1095a8;
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.tool-placeholder h2 {
  margin-bottom: 10px;
  font-size: 24px;
}

.tool-placeholder > p:not(.placeholder-label) {
  max-width: 620px;
  color: var(--muted);
  line-height: 1.55;
}

.placeholder-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 22px;
}

.placeholder-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 14px;
  font-size: 13px;
  font-weight: 800;
}

@media (max-width: 1040px) {
  .content-grid {
    grid-template-columns: 1fr;
  }

  .content-grid.has-detail {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 1041px) {
  .content-grid {
    height: calc(100vh - 306px);
    min-height: 440px;
    overflow: hidden;
  }

  .directory-panel,
  .detail-panel {
    height: 100%;
    overflow: auto;
  }

  .directory-panel {
    display: flex;
    flex-direction: column;
  }

  .directory-header {
    flex: 0 0 auto;
  }

  .faculty-list {
    min-height: 0;
    overflow: auto;
    padding-right: 6px;
  }
}

@media (max-width: 720px) {
  .topbar,
  .brand-block,
  .profile-header,
  .profile-identity,
  .control-panel,
  .control-actions {
    display: block;
  }

  .topbar {
    padding: 16px;
  }

  .product-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    overflow: visible;
    padding: 0 12px 12px;
  }

  .product-tab {
    width: 100%;
    min-height: 42px;
    padding: 7px 6px;
    font-size: 12px;
    line-height: 1.15;
    white-space: normal;
  }

  .brand-mark {
    margin-bottom: 12px;
  }

  .top-actions,
  .profile-links {
    justify-content: flex-start;
    margin-top: 14px;
  }

  .profile-actions {
    justify-items: start;
    margin-top: 14px;
  }

  .profile-photo {
    margin-bottom: 14px;
  }

  .workspace {
    padding: 16px 12px 24px;
  }

  .faculty-list {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .card-button,
  .content-grid.has-detail .card-button {
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 14px;
    height: 150px;
    padding: 12px;
  }

  .card-photo,
  .content-grid.has-detail .card-photo {
    width: 88px;
    height: 106px;
  }

  .control-actions {
    margin-top: 12px;
  }

  .control-actions select {
    width: 100%;
    margin-top: 8px;
  }

  .result-line {
    margin-top: 14px;
  }

  .detail-content {
    padding: 18px;
  }

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