:root {
  color-scheme: light;
  --bg: #f6f4f1;
  --panel: #ffffff;
  --panel-soft: #fbfaf8;
  --text: #171412;
  --muted: #6c625b;
  --line: #ded8d1;
  --line-strong: #cfc6be;
  --red: #b13f2d;
  --red-dark: #7f261b;
  --blue: #276a8f;
  --green: #527a49;
  --amber: #a96d1f;
  --violet: #7656a8;
  --teal: #23756d;
  --shadow: 0 24px 60px rgba(55, 45, 38, 0.12);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    "Oracle Sans",
    "Inter",
    "Segoe UI",
    Arial,
    sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

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

.loading,
.error-state {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.loading {
  grid-template-columns: auto auto;
  gap: 16px;
}

.loading-mark,
.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  background: var(--red);
  color: #fff;
  font-weight: 800;
}

.loading-title,
.loading-text {
  margin: 0;
}

.loading-title {
  font-weight: 800;
}

.loading-text,
.muted {
  color: var(--muted);
}

.error-panel {
  max-width: 480px;
  padding: 32px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.error-panel h1 {
  margin: 8px 0;
  font-size: 28px;
}

.error-panel code {
  display: block;
  padding: 12px;
  background: #27221f;
  color: #fff;
  border-radius: 6px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(210px, auto) minmax(220px, 680px) auto;
  gap: 18px;
  align-items: center;
  min-height: 72px;
  padding: 14px 24px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

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

.brand strong,
.brand span span {
  display: block;
}

.brand span span {
  color: var(--muted);
  font-size: 13px;
}

.global-search {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 0 14px;
  height: 44px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.global-search:focus-within {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(177, 63, 45, 0.13);
}

.global-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

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

.icon-button,
.primary-button,
.text-button {
  border: 0;
  border-radius: var(--radius);
  min-height: 40px;
}

.icon-button {
  width: 40px;
  display: grid;
  place-items: center;
  background: #f0ece8;
  color: var(--text);
}

.icon-button:hover,
.person-row:hover,
.report-card:hover,
.org-node:hover {
  background: #ebe4df;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  background: var(--red);
  color: #fff;
  font-weight: 700;
}

.primary-button:hover {
  background: var(--red-dark);
}

.text-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  background: transparent;
  color: var(--red-dark);
  font-weight: 800;
}

.full-width {
  width: 100%;
}

.workspace {
  display: grid;
  grid-template-columns: 326px minmax(0, 1fr);
  min-height: calc(100vh - 72px);
}

.people-rail {
  position: sticky;
  top: 72px;
  height: calc(100vh - 72px);
  overflow: auto;
  padding: 18px;
  border-right: 1px solid var(--line);
  background: #f0ece8;
}

.rail-summary {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 14px;
}

.rail-summary span:first-child {
  font-size: 32px;
  font-weight: 800;
}

.rail-summary span:last-child {
  color: var(--muted);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  padding: 3px;
  margin-bottom: 16px;
  background: #e1dbd5;
  border-radius: var(--radius);
}

.segmented button {
  min-width: 0;
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.segmented button.is-active {
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(54, 46, 40, 0.12);
}

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

.person-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 66px;
  padding: 10px;
  text-align: left;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: inherit;
}

.person-row.is-selected {
  background: var(--panel);
  border-color: var(--line-strong);
  box-shadow: 0 10px 24px rgba(54, 46, 40, 0.08);
}

.person-row-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.person-row-copy strong,
.person-row-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.person-row-copy span {
  color: var(--muted);
  font-size: 13px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.status-dot.available {
  background: var(--green);
}

.status-dot.busy {
  background: var(--amber);
}

.status-dot.out-of-office {
  background: var(--blue);
}

.profile-page {
  min-width: 0;
  padding-bottom: 48px;
}

.org-strip {
  display: flex;
  gap: 4px;
  align-items: center;
  overflow-x: auto;
  padding: 14px 28px;
  border-bottom: 1px solid var(--line);
  background: #fbfaf8;
}

.org-crumb {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  border: 0;
  background: transparent;
  color: var(--muted);
  white-space: nowrap;
}

.org-crumb.is-current {
  color: var(--text);
  font-weight: 800;
}

.profile-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 34px 28px 28px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.identity {
  display: flex;
  gap: 20px;
  min-width: 0;
}

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

.eyebrow {
  margin: 0 0 8px;
  color: var(--red-dark);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.identity h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.1;
}

.identity p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 16px;
}

.identity-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 16px;
}

.identity-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  color: var(--muted);
  font-size: 13px;
}

.tabs {
  display: flex;
  gap: 6px;
  padding: 18px 28px 0;
}

.tabs button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f2eee9;
  color: var(--muted);
  font-weight: 800;
}

.tabs button.is-active {
  background: var(--text);
  color: #fff;
  border-color: var(--text);
}

.profile-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 26px;
  padding: 24px 28px 0;
}

.main-column,
.side-column,
.badge-board {
  display: grid;
  gap: 18px;
  align-content: start;
}

.content-section,
.side-panel,
.badge-group,
.org-map,
.org-details {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 30px rgba(55, 45, 38, 0.06);
}

.content-section,
.side-panel,
.badge-group,
.org-details {
  padding: 20px;
}

.section-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.section-title-row h2 {
  margin: 0;
  font-size: 18px;
}

.section-title-row span {
  margin-left: auto;
  color: var(--muted);
  font-weight: 800;
}

.about-copy,
.away-copy {
  margin: 0;
  color: #302a26;
  line-height: 1.6;
}

.org-summary,
.info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.org-summary > div,
.info-grid > div,
.stacked-info > div {
  min-width: 0;
  padding: 14px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.field-label,
dt,
.contact-line small {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

dl {
  margin: 0;
}

dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.inline-person {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
}

.report-row,
.badge-row,
.tag-row,
.link-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.report-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 10px;
  min-width: 220px;
  max-width: 280px;
  padding: 12px;
  text-align: left;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: inherit;
}

.report-card .avatar {
  grid-row: 1 / 3;
}

.report-card strong,
.report-card span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-card span {
  color: var(--muted);
  font-size: 13px;
}

.badge-pill,
.tag,
.profile-link {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.badge-pill {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 10px;
  min-width: 220px;
  padding: 10px;
}

.badge-pill > span {
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  color: #fff;
}

.badge-pill strong,
.badge-pill small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge-pill small {
  color: var(--muted);
}

.profile-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 12px;
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  color: #413832;
  font-weight: 800;
  font-size: 13px;
}

.empty-prompt {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: #f7f1eb;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
}

.empty-prompt p {
  margin: 0;
}

.contact-stack,
.stacked-info {
  display: grid;
  gap: 10px;
}

.contact-stack {
  margin-bottom: 16px;
}

.contact-line {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.contact-line strong {
  display: block;
  overflow-wrap: anywhere;
}

.compact {
  margin-top: 12px;
}

.org-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 26px;
  padding: 24px 28px 0;
}

.org-map {
  padding: 16px;
  overflow: auto;
}

.org-node-wrap {
  min-width: 280px;
}

.org-node {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: calc(100% - (var(--depth) * 18px));
  margin-left: calc(var(--depth) * 18px);
  min-height: 56px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
  color: inherit;
  text-align: left;
}

.org-node.is-selected {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(177, 63, 45, 0.12);
}

.org-node strong,
.org-node small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.org-node small {
  color: var(--muted);
}

.org-children {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  padding-left: 10px;
  border-left: 1px solid var(--line-strong);
}

.badge-board {
  padding: 24px 28px 0;
}

.badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.badge-card,
.patent-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.badge-card h3,
.patent-card h3 {
  margin: 0 0 6px;
  font-size: 15px;
}

.badge-card p,
.badge-card time,
.patent-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.badge-medal {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  color: #fff;
}

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

.avatar {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: var(--radius);
  color: #fff;
  font-weight: 900;
}

.avatar-xl {
  width: 92px;
  height: 92px;
  font-size: 28px;
}

.avatar-md {
  width: 42px;
  height: 42px;
}

.avatar-sm {
  width: 38px;
  height: 38px;
  font-size: 13px;
}

.avatar-xs {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  font-size: 10px;
}

[data-tone="red"] {
  background: var(--red);
}

[data-tone="blue"] {
  background: var(--blue);
}

[data-tone="green"] {
  background: var(--green);
}

[data-tone="amber"] {
  background: var(--amber);
}

[data-tone="violet"] {
  background: var(--violet);
}

[data-tone="teal"] {
  background: var(--teal);
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 30;
  min-width: 180px;
  padding: 12px 16px;
  background: #241f1c;
  color: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1080px) {
  .workspace {
    grid-template-columns: 280px minmax(0, 1fr);
  }

  .profile-grid,
  .org-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .global-search {
    grid-column: 1 / -1;
    grid-row: 2;
  }

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

  .people-rail {
    position: static;
    height: auto;
    max-height: 360px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .profile-hero {
    display: grid;
  }

  .identity {
    display: grid;
  }

  .org-summary,
  .info-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .topbar,
  .profile-hero,
  .org-strip,
  .tabs,
  .profile-grid,
  .org-layout,
  .badge-board {
    padding-left: 16px;
    padding-right: 16px;
  }

  .identity h1 {
    font-size: 28px;
  }

  .hero-actions,
  .tabs {
    justify-content: stretch;
  }

  .hero-actions .primary-button,
  .tabs button {
    flex: 1 1 130px;
  }

  .empty-prompt {
    grid-template-columns: 1fr;
  }
}
