:root {
  color-scheme: light dark;
  --ink: #fff7e8;
  --muted: #e1d3be;
  --accent: #9bd3c5;
  --orange: #ff7a1a;
  --orange-dark: #b54a12;
  --panel: rgba(18, 22, 20, 0.78);
  --line: rgba(255, 247, 232, 0.18);
  --paper: #fff7e8;
  --paper-ink: #171c19;
  --paper-muted: #687168;
  --blue: #496f95;
  --wine: #8f4d5a;
  --gold: #b38b2d;
  --green: #253f35;
}

* {
  box-sizing: border-box;
}

body {
  overflow-x: hidden;
  min-height: 100vh;
  margin: 0;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: var(--ink);
  background:
    linear-gradient(120deg, rgba(7, 10, 9, 0.82), rgba(7, 10, 9, 0.24) 58%),
    linear-gradient(0deg, rgba(255, 122, 26, 0.2), rgba(255, 122, 26, 0)),
    url("/assets/home-background.webp") center / cover no-repeat;
  background-attachment: fixed;
}

button,
input,
textarea {
  font: inherit;
}

.dashboard-view,
.agent-dashboard-view,
body[data-site="dashboard"] .home-view,
body[data-site="agents"] .home-view {
  display: none;
}

body[data-site="dashboard"],
body[data-site="agents"] {
  color: var(--paper-ink);
  background: var(--paper);
  background-attachment: scroll;
}

body[data-site="dashboard"] .dashboard-view {
  display: block;
}

body[data-site="agents"] .agent-dashboard-view {
  display: block;
}

.page-shell {
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: clamp(28px, 5vw, 56px);
  min-height: 100vh;
  min-height: 100svh;
  padding: clamp(18px, 4vw, 48px);
}

.site-bar,
.hero-grid,
.activity-feed,
.bio-section {
  width: min(100%, 1160px);
  margin: 0 auto;
}

.site-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.wordmark,
.agent-link,
.primary-link {
  color: inherit;
  text-decoration: none;
}

.wordmark {
  font-size: 1rem;
  font-weight: 800;
}

.wordmark span,
.home-title span {
  color: var(--orange);
}

.agent-link,
.primary-link {
  border: 1px solid rgba(255, 247, 232, 0.28);
  border-radius: 999px;
  background: rgba(255, 247, 232, 0.08);
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    transform 160ms ease;
}

.agent-link {
  padding: 10px 14px;
  font-size: 0.9rem;
  font-weight: 750;
}

.agent-link:hover,
.primary-link:hover {
  border-color: rgba(255, 122, 26, 0.72);
  background: rgba(255, 122, 26, 0.16);
  transform: translateY(-1px);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
  gap: clamp(28px, 5vw, 64px);
  align-items: center;
}

.hero-copy {
  min-width: 0;
  max-width: 760px;
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.home-title {
  max-width: 10ch;
  margin: 0;
  font-size: 8.5rem;
  line-height: 0.82;
  letter-spacing: 0;
  text-wrap: balance;
}

.lede {
  width: min(100%, 42rem);
  max-width: 42rem;
  margin: 30px 0 0;
  color: var(--muted);
  font-size: 1.4rem;
  line-height: 1.45;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-top: 32px;
}

.primary-link {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  color: #160f09;
  background: var(--orange);
  border-color: var(--orange);
  font-weight: 850;
}

.primary-link:hover {
  color: #160f09;
  background: #ff9a47;
}

.mail-note {
  color: var(--muted);
  font-size: 0.92rem;
}

.signal-panel {
  min-width: 0;
  display: grid;
  gap: 22px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(140deg, rgba(255, 122, 26, 0.12), rgba(155, 211, 197, 0.08)),
    rgba(18, 22, 20, 0.72);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(16px);
}

.signal-heading {
  display: grid;
  gap: 8px;
}

.signal-heading span,
.bio-section span {
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.signal-heading strong {
  color: var(--ink);
  font-size: 2.2rem;
  line-height: 1;
}

.mini-chessboard {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid rgba(255, 247, 232, 0.2);
  border-radius: 8px;
}

.mini-chessboard span {
  background: rgba(255, 247, 232, 0.88);
}

.mini-chessboard span:nth-child(2n),
.mini-chessboard span:nth-child(7),
.mini-chessboard span:nth-child(10),
.mini-chessboard span:nth-child(15) {
  background: var(--green);
}

.mini-chessboard span:nth-child(6),
.mini-chessboard span:nth-child(11) {
  position: relative;
  background: var(--orange);
}

.mini-chessboard span:nth-child(6)::after,
.mini-chessboard span:nth-child(11)::after {
  position: absolute;
  inset: 35%;
  border-radius: 50%;
  background: #171c19;
  content: "";
}

.signal-list {
  display: grid;
  gap: 1px;
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 247, 232, 0.14);
  border-radius: 8px;
  background: rgba(255, 247, 232, 0.14);
}

.signal-list div {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 14px;
  padding: 12px;
  background: rgba(8, 12, 10, 0.52);
}

.signal-list dt {
  color: var(--muted);
}

.signal-list dd {
  margin: 0;
  color: var(--ink);
  font-weight: 760;
}

.activity-feed {
  display: grid;
  gap: 16px;
}

.activity-feed-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.activity-feed-heading .eyebrow {
  margin-bottom: 8px;
}

.activity-feed h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1.65rem;
  line-height: 1.1;
}

.activity-updated {
  position: relative;
  flex: 0 0 auto;
  padding: 9px 12px;
  border: 1px solid rgba(155, 211, 197, 0.3);
  border-radius: 999px;
  color: var(--accent);
  background: rgba(18, 22, 20, 0.54);
  font-size: 0.82rem;
  font-weight: 800;
}

.activity-updated::before {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 0 0 rgba(255, 122, 26, 0.5);
  content: "";
  animation: activityPulse 2400ms ease-out infinite;
}

.activity-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.activity-card {
  min-width: 0;
  min-height: 158px;
  padding: 18px;
  border: 1px solid rgba(255, 247, 232, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(155, 211, 197, 0.08), rgba(255, 122, 26, 0.08)),
    rgba(18, 22, 20, 0.62);
  backdrop-filter: blur(14px);
  opacity: 0;
  transform: translateY(10px);
  animation: activityIn 420ms ease-out forwards;
  animation-delay: var(--activity-delay, 0ms);
}

.activity-card > span {
  display: block;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.activity-visual {
  margin-top: 14px;
  overflow: hidden;
  border: 1px solid rgba(255, 247, 232, 0.16);
  border-radius: 8px;
  background: rgba(8, 12, 10, 0.32);
}

.route-visual {
  aspect-ratio: 1.65;
  padding: 8px;
}

.route-visual svg {
  display: block;
  width: 100%;
  height: 100%;
}

.route-visual-grid {
  fill: none;
  stroke: rgba(255, 247, 232, 0.08);
  stroke-linecap: round;
  stroke-width: 0.8;
}

.route-visual-path {
  fill: none;
  stroke: var(--orange);
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4.2;
  filter: drop-shadow(0 6px 10px rgba(255, 122, 26, 0.28));
  animation: routeDraw 900ms ease-out forwards;
  animation-delay: calc(var(--activity-delay, 0ms) + 220ms);
}

.route-visual-start {
  fill: var(--accent);
}

.route-visual-end {
  fill: var(--orange);
  stroke: #160f09;
  stroke-width: 1.1;
}

.board-visual {
  width: min(100%, 178px);
  aspect-ratio: 1;
  max-width: 178px;
  padding: 0;
}

.board-visual-mount {
  width: 100%;
  aspect-ratio: 1;
}

.board-visual .cm-chessboard {
  display: block;
  width: 100%;
  height: 100%;
}

.board-visual .cm-chessboard.green .board .square.white {
  fill: rgba(255, 247, 232, 0.9);
}

.board-visual .cm-chessboard.green .board .square.black {
  fill: var(--green);
}

.board-visual .cm-chessboard .pieces-layer use {
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.3));
}

.board-visual.has-error .board-visual-mount {
  display: grid;
  place-items: center;
  min-height: 120px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.activity-card strong,
.activity-card a {
  display: block;
  margin-top: 16px;
  color: var(--ink);
  font-size: 1.45rem;
  font-weight: 850;
  line-height: 1.05;
  text-decoration: none;
}

.activity-card a:hover {
  color: var(--orange);
}

.activity-card p {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.45;
}

.activity-card small {
  display: block;
  margin-top: 18px;
  color: rgba(255, 247, 232, 0.66);
  font-weight: 750;
}

.activity-card.is-loading {
  opacity: 0.72;
  animation: none;
  transform: none;
}

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

@keyframes activityPulse {
  70% {
    box-shadow: 0 0 0 8px rgba(255, 122, 26, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(255, 122, 26, 0);
  }
}

@keyframes routeDraw {
  to {
    stroke-dashoffset: 0;
  }
}

.bio-section {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding-bottom: 6px;
}

.bio-section article {
  min-height: 142px;
  padding: 18px;
  border: 1px solid rgba(255, 247, 232, 0.16);
  border-radius: 8px;
  background: rgba(18, 22, 20, 0.58);
  backdrop-filter: blur(14px);
}

.bio-section p {
  margin: 14px 0 0;
  color: var(--ink);
  font-size: 1.05rem;
  line-height: 1.5;
}

.dashboard-view,
.agent-dashboard-view {
  width: min(100%, 1180px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px;
}

.dashboard-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 0 26px;
  border-bottom: 1px solid rgba(23, 33, 29, 0.14);
}

.dashboard-header .eyebrow {
  margin-bottom: 10px;
  color: var(--blue);
}

.dashboard-header h1 {
  font-size: 4.8rem;
  color: var(--paper-ink);
}

.date-chip {
  min-width: 150px;
  padding: 10px 14px;
  border: 1px solid rgba(23, 33, 29, 0.16);
  border-radius: 8px;
  color: var(--paper-muted);
  text-align: center;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: 24px 0;
  border: 1px solid rgba(23, 33, 29, 0.14);
  background: rgba(23, 33, 29, 0.14);
}

.metric {
  min-height: 128px;
  padding: 18px;
  background: #fffdf8;
}

.metric-label,
.metric span:last-child,
.save-state {
  color: var(--paper-muted);
  font-size: 0.82rem;
}

.metric strong {
  display: block;
  margin: 14px 0 8px;
  color: var(--paper-ink);
  font-size: 1.9rem;
  line-height: 1;
}

.metric:nth-child(1) strong {
  color: var(--blue);
}

.metric:nth-child(2) strong {
  color: var(--wine);
}

.metric:nth-child(3) strong {
  color: var(--gold);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  gap: 18px;
  padding-bottom: 28px;
}

.panel {
  min-width: 0;
  padding: 22px;
  border: 1px solid rgba(23, 33, 29, 0.14);
  border-radius: 8px;
  background: #fffdf8;
}

.brief-panel {
  grid-column: 1 / -1;
}

.notes-panel {
  grid-column: 1 / 2;
}

.appointments-panel {
  grid-column: 1 / 2;
}

.maintenance-panel {
  grid-column: 1 / 2;
}

.updates-panel {
  grid-column: 2 / 3;
}

.watchlist-panel {
  grid-column: 2 / 3;
}

.source-panel {
  grid-column: 2 / 3;
}

.profile-panel {
  grid-column: 2 / 3;
}

.status-panel {
  grid-column: 2 / 3;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel h2 {
  margin: 0 0 18px;
  color: var(--paper-ink);
  font-size: 1.05rem;
  line-height: 1.2;
}

.panel-heading h2 {
  margin-bottom: 0;
}

.small-button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(23, 33, 29, 0.18);
  border-radius: 8px;
  color: var(--paper-ink);
  background: transparent;
  cursor: pointer;
}

.small-button:hover {
  border-color: var(--blue);
}

.task-list {
  display: grid;
  gap: 10px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.task-groups {
  display: grid;
  gap: 20px;
  margin-top: 20px;
}

.group-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.group-heading h3 {
  margin: 0;
  font-size: 0.9rem;
}

.group-heading span,
.info-item span {
  color: var(--paper-muted);
  font-size: 0.78rem;
  font-weight: 750;
  text-transform: uppercase;
}

.task-list label {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid rgba(23, 33, 29, 0.12);
  border-radius: 8px;
  background: #f8f4eb;
}

.task-list input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--blue);
}

.task-list input:checked + span {
  color: var(--paper-muted);
  text-decoration: line-through;
}

.task-list strong,
.task-list small {
  display: block;
}

.task-list strong {
  color: inherit;
  line-height: 1.35;
}

.task-list small {
  margin-top: 4px;
  color: var(--paper-muted);
  line-height: 1.35;
}

.link-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.link-grid a {
  min-height: 56px;
  padding: 16px;
  border: 1px solid rgba(23, 33, 29, 0.12);
  border-radius: 8px;
  color: var(--paper-ink);
  text-decoration: none;
  background: #f8f4eb;
}

.link-grid a:hover {
  border-color: var(--wine);
}

textarea {
  width: 100%;
  min-height: 220px;
  margin-top: 18px;
  padding: 14px;
  border: 1px solid rgba(23, 33, 29, 0.14);
  border-radius: 8px;
  color: var(--paper-ink);
  background: #f8f4eb;
  resize: vertical;
}

.appointment-list,
.brief-list,
.update-list,
.watchlist,
.source-list {
  display: grid;
  gap: 10px;
}

.info-item {
  padding: 14px;
  border: 1px solid rgba(23, 33, 29, 0.12);
  border-radius: 8px;
  background: #f8f4eb;
}

.info-item strong,
.info-item p,
.info-item em {
  display: block;
}

.info-item strong {
  margin-top: 8px;
  color: var(--paper-ink);
  line-height: 1.3;
}

.info-item p {
  margin: 8px 0 0;
  color: var(--paper-muted);
  line-height: 1.45;
}

.info-item em {
  margin-top: 10px;
  color: var(--blue);
  font-size: 0.86rem;
  font-style: normal;
  font-weight: 750;
}

.status-list {
  display: grid;
  gap: 1px;
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(23, 33, 29, 0.14);
  border-radius: 8px;
  background: rgba(23, 33, 29, 0.14);
}

.status-list div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  padding: 14px;
  background: #f8f4eb;
}

.status-list dt {
  color: var(--paper-muted);
}

.status-list dd {
  margin: 0;
  font-weight: 700;
}

.protocol-panel .status-list div,
.definitions-panel .status-list div {
  grid-template-columns: 86px minmax(0, 1fr);
  align-items: start;
}

.protocol-panel .status-list dd,
.definitions-panel .status-list dd {
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.agent-dashboard-grid {
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
}

.agents-panel {
  grid-column: 1 / 2;
  grid-row: span 2;
}

.activity-panel,
.support-panel,
.protocol-panel,
.definitions-panel {
  grid-column: 2 / 3;
}

.agent-list,
.support-list,
.activity-list {
  display: grid;
  gap: 12px;
}

.agent-card,
.support-item {
  padding: 16px;
  border: 1px solid rgba(23, 33, 29, 0.12);
  border-radius: 8px;
  background: #f8f4eb;
}

.agent-card-header,
.support-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.agent-card h3 {
  margin: 0;
  color: var(--paper-ink);
  font-size: 1.2rem;
  line-height: 1.2;
}

.agent-card-header span,
.support-item small {
  display: block;
  margin-top: 5px;
  color: var(--paper-muted);
  font-size: 0.82rem;
}

.status-badge {
  flex: 0 0 auto;
  padding: 5px 9px;
  border: 1px solid rgba(23, 33, 29, 0.14);
  border-radius: 999px;
  color: var(--paper-muted);
  background: #fffdf8;
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.status-badge-good {
  border-color: rgba(37, 63, 53, 0.26);
  color: var(--green);
  background: rgba(155, 211, 197, 0.22);
}

.status-badge-planned {
  border-color: rgba(179, 139, 45, 0.26);
  color: #71530f;
  background: rgba(179, 139, 45, 0.14);
}

.agent-identity,
.agent-notes,
.support-item p {
  margin: 12px 0 0;
  color: var(--paper-muted);
  line-height: 1.45;
}

.agent-notes {
  color: var(--paper-ink);
}

.agent-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 16px 0 0;
  overflow: hidden;
  border: 1px solid rgba(23, 33, 29, 0.12);
  border-radius: 8px;
  background: rgba(23, 33, 29, 0.12);
}

.agent-stats div {
  min-width: 0;
  padding: 12px;
  background: #fffdf8;
}

.agent-stats dt {
  color: var(--paper-muted);
  font-size: 0.78rem;
}

.agent-stats dd {
  overflow-wrap: anywhere;
  margin: 6px 0 0;
  color: var(--paper-ink);
  font-weight: 800;
}

@media (max-width: 860px) {
  .hero-grid,
  .activity-cards,
  .bio-section {
    grid-template-columns: 1fr;
  }

  .hero-grid {
    align-items: start;
    gap: 22px;
  }

  .home-title {
    font-size: 5.6rem;
  }

  .signal-heading strong {
    font-size: 1.8rem;
  }

  .dashboard-view,
  .agent-dashboard-view {
    padding: 18px;
  }

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

  .dashboard-header h1 {
    font-size: 3.4rem;
  }

  .date-chip {
    width: 100%;
  }

  .metric-strip,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .notes-panel,
  .appointments-panel,
  .updates-panel,
  .watchlist-panel,
  .status-panel,
  .agents-panel,
  .activity-panel,
  .support-panel,
  .protocol-panel,
  .definitions-panel {
    grid-column: auto;
    grid-row: auto;
  }
}

@media (max-width: 620px) {
  .page-shell {
    gap: 24px;
    padding: 16px;
  }

  .site-bar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .hero-copy {
    max-width: 100%;
  }

  .eyebrow {
    margin-bottom: 12px;
  }

  .agent-link,
  .primary-link {
    max-width: 100%;
    width: 100%;
    justify-content: center;
  }

  .home-title {
    max-width: none;
    font-size: 4rem;
    line-height: 0.86;
  }

  .lede {
    max-width: 100%;
    margin-top: 22px;
    font-size: 1.12rem;
    overflow-wrap: break-word;
  }

  .hero-actions {
    width: 100%;
    margin-top: 24px;
  }

  .activity-feed-heading {
    align-items: start;
    flex-direction: column;
  }

  .activity-feed h2 {
    font-size: 1.35rem;
  }

  .signal-panel {
    display: none;
  }

  .bio-section article {
    min-height: auto;
  }
}

@media (max-width: 480px) {
  body {
    background-attachment: scroll;
  }

  .page-shell {
    gap: 22px;
  }

  .home-title {
    font-size: 2.85rem;
  }

  .lede {
    font-size: 1.02rem;
  }

  .activity-cards {
    gap: 10px;
  }

  .activity-card {
    min-height: auto;
    padding: 14px;
  }

  .route-visual {
    aspect-ratio: 1.45;
  }

  .board-visual {
    max-width: 150px;
  }

  .wordmark {
    font-size: 0.92rem;
  }

  .metric {
    min-height: 112px;
  }

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

  .agent-stats {
    grid-template-columns: 1fr;
  }

  .protocol-panel .status-list div,
  .definitions-panel .status-list div {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .dashboard-header h1 {
    font-size: 2.8rem;
  }
}

@media (max-width: 360px) {
  .home-title {
    font-size: 2.45rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .activity-card,
  .activity-updated::before,
  .route-visual-path {
    animation: none;
  }

  .activity-card {
    opacity: 1;
    transform: none;
  }

  .route-visual-path {
    stroke-dashoffset: 0;
  }
}
