* {
  box-sizing: border-box;
}
html {
  background: #faf4f9;
  color: #333;
  font-family: 'Work Sans', sans-serif;
  scroll-behavior: smooth;
}
body {
  margin: 0;
  min-height: 100vh;
  font-size: 18px;
  line-height: 1.6;
}
button,
input,
select,
textarea {
  font: inherit;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid #ec00d2;
  outline-offset: 3px;
}
a {
  color: #3b1a54;
}
.skip-link {
  background: #faf4f9;
  left: 1rem;
  padding: 0.6rem 1rem;
  position: fixed;
  top: -5rem;
  z-index: 100;
}
.skip-link:focus {
  top: 1rem;
}
.app-header {
  align-items: center;
  background: #3b1a54;
  color: #faf4f9;
  display: flex;
  justify-content: space-between;
  min-height: 68px;
  padding: 0.65rem clamp(1rem, 3vw, 2rem);
  position: sticky;
  top: 0;
  z-index: 20;
}
.wordmark {
  color: #faf4f9;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.08em;
  text-decoration: none;
}
.header-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}
.compact-field {
  align-items: center;
  display: flex;
  font-size: 0.8rem;
  gap: 0.5rem;
}
.compact-field select {
  min-height: 40px;
}
.wallet-chip,
.status-chip,
.method-chip {
  border: 1px solid currentColor;
  border-radius: 40px;
  display: inline-flex;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.2rem 0.7rem;
}
.wallet-chip:empty {
  display: none;
}
.app-shell {
  display: grid;
  grid-template-columns: minmax(210px, 260px) minmax(0, 1fr) minmax(230px, 300px);
  min-height: calc(100vh - 68px);
}
.side-nav {
  background: #f8f5fb;
  border-right: 1px solid #eddaec;
  padding: 1.4rem 1rem;
}
.nav-list {
  counter-reset: nav;
  display: grid;
  gap: 0.3rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-list li {
  counter-increment: nav;
}
.nav-list a {
  align-items: center;
  border-radius: 9px;
  color: #3b1a54;
  display: grid;
  font-weight: 650;
  grid-template-columns: 2.1rem 1fr;
  min-height: 48px;
  padding: 0.45rem 0.6rem;
  text-decoration: none;
}
.nav-list a::before {
  content: counter(nav, decimal-leading-zero);
  font-size: 0.72rem;
  opacity: 0.65;
}
.nav-list a:hover,
.nav-list a[aria-current='page'] {
  background: #3b1a54;
  color: #faf4f9;
}
#main-content {
  min-width: 0;
  padding: clamp(1.25rem, 4vw, 3.2rem);
}
.context-panel {
  background: #fbfafc;
  border-left: 1px solid #eddaec;
  padding: 1.5rem;
}
h1,
h2,
h3,
h4 {
  color: #3b1a54;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0 0 1rem;
}
h1 {
  color: #be3cb6;
  font-size: clamp(2.3rem, 5vw, 4.5rem);
}
h2 {
  font-size: clamp(1.65rem, 3vw, 2.25rem);
}
p {
  max-width: 72ch;
}
.eyebrow {
  color: #93278f;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
}
.lead {
  font-size: 1.15rem;
}
.button,
button[type='submit'],
.primary-button {
  align-items: center;
  background: #93278f;
  border: 2px solid #93278f;
  border-radius: 9px;
  color: #faf4f9;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 700;
  gap: 0.45rem;
  justify-content: center;
  min-height: 44px;
  padding: 0.65rem 1rem;
  text-decoration: none;
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.button:hover,
button[type='submit']:hover,
.primary-button:hover {
  background: #ec00d2;
  border-color: #ec00d2;
}
.button:active,
button[type='submit']:active,
.primary-button:active {
  transform: translateY(1px);
}
.button:disabled,
button[type='submit']:disabled,
.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}
.button::before,
button[type='submit']::before,
.primary-button::before {
  content: '✦';
  font-size: 1rem;
  line-height: 1;
}
.secondary-button,
.star-button {
  background: transparent;
  border: 2px solid #3b1a54;
  border-radius: 40px;
  color: #3b1a54;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 700;
  justify-content: center;
  min-height: 44px;
  padding: 0.55rem 1rem;
}
.secondary-button:hover,
.star-button:hover {
  background: #3b1a54;
  color: #faf4f9;
}
.danger-button {
  background: transparent;
  border: 2px solid #b42318;
  border-radius: 9px;
  color: #b42318;
  min-height: 44px;
  padding: 0.55rem 1rem;
}
.button-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.25rem;
}
.card-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 1.5rem 0;
}
.card,
.loading-card,
.form-card,
.chat-entry,
.summary-card {
  background: #f8f5fb;
  border: 1px solid #eddaec;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(59,26,84,0.06);
  padding: 1.25rem;
}
.card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover {
  box-shadow: 0 14px 32px rgba(59,26,84,0.12);
  transform: translateY(-2px);
}
.stat {
  color: #3b1a54;
  display: block;
  font-size: 1.85rem;
  font-weight: 800;
}
.form-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.field {
  display: grid;
  gap: 0.35rem;
}
.field.full {
  grid-column: 1/-1;
}
.field label,
.field .label {
  color: #3b1a54;
  font-size: 0.88rem;
  font-weight: 700;
}
.field input,
.field select,
.field textarea {
  background: #faf4f9;
  border: 1px solid #dfdfdf;
  border-radius: 8px;
  color: #333;
  min-height: 44px;
  padding: 0.65rem 0.75rem;
  width: 100%;
}
.field textarea {
  min-height: 110px;
  resize: vertical;
}
.help-text {
  color: #555;
  font-size: 0.82rem;
}
.error-text,
.error-summary {
  color: #b42318;
  font-weight: 700;
}
.error-summary {
  background: #fff1f0;
  border-left: 5px solid #b42318;
  border-radius: 8px;
  padding: 0.75rem 1rem;
}
.notice {
  background: #fff8e8;
  border-left: 5px solid #8a4b00;
  border-radius: 8px;
  padding: 0.8rem 1rem;
}
.disclaimer {
  background: #fbfafc;
  border: 1px solid #eddaec;
  border-radius: 8px;
  font-size: 0.85rem;
  padding: 0.75rem;
}
.wizard-steps {
  counter-reset: steps;
  display: grid;
  gap: 0.5rem;
  grid-template-columns: repeat(4, 1fr);
  list-style: none;
  margin: 0 0 2rem;
  padding: 0;
}
.wizard-steps li {
  border-bottom: 4px solid #ddd;
  color: #555;
  counter-increment: steps;
  font-size: 0.82rem;
  padding: 0.5rem;
}
.wizard-steps li::before {
  content: counter(steps) '. ';
  font-weight: 800;
}
.wizard-steps li.active {
  border-color: #ec00d2;
  color: #3b1a54;
  font-weight: 800;
}
.wizard-steps li.complete {
  border-color: #93278f;
}
.persona-card summary {
  color: #3b1a54;
  cursor: pointer;
  font-weight: 800;
  min-height: 44px;
}
.profile-fields {
  display: grid;
  gap: 0.7rem;
  margin-top: 1rem;
}
.profile-field {
  border-top: 1px solid #eddaec;
  padding-top: 0.6rem;
}
.profile-field dt {
  color: #3b1a54;
  font-weight: 750;
}
.profile-field dd {
  margin: 0.2rem 0 0;
}
.provenance {
  color: #93278f;
  display: block;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}
.chat-list,
.transcript {
  display: grid;
  gap: 0.8rem;
}
.chat-entry {
  background: #fbfafc;
}
.chat-entry.user {
  background: #f8f5fb;
  border-left: 4px solid #93278f;
}
.chat-entry.moderator {
  border-left: 4px solid #ec00d2;
}
.turn-meta {
  color: #555;
  font-size: 0.78rem;
}
.action-dock {
  background: rgba(250,244,249,0.97);
  border-top: 1px solid #eddaec;
  bottom: 0;
  box-shadow: 0 -8px 30px rgba(59,26,84,0.1);
  left: 260px;
  padding: 0.75rem clamp(1rem, 4vw, 3rem);
  position: fixed;
  right: 300px;
  z-index: 15;
}
.toast-region {
  bottom: 1rem;
  display: grid;
  gap: 0.5rem;
  max-width: min(420px, calc(100vw - 2rem));
  position: fixed;
  right: 1rem;
  z-index: 50;
}
.toast {
  background: #3b1a54;
  border-radius: 9px;
  color: #faf4f9;
  padding: 0.8rem 1rem;
}
.toast.error {
  background: #b42318;
}
.empty-state {
  border: 2px dashed #eddaec;
  border-radius: 10px;
  padding: 2rem;
  text-align: center;
}
.login-screen {
  margin: 7vh auto;
  max-width: 780px;
  text-align: center;
}
.login-options {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  margin-top: 2rem;
}
.asset-list {
  display: grid;
  gap: 0.5rem;
  list-style: none;
  padding: 0;
}
.asset-list li {
  align-items: center;
  background: #fbfafc;
  border: 1px solid #eddaec;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
}
.visually-hidden {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}
.page-enter {
  animation: fadeUp 0.3s ease both;
}
@media (max-width: 960px) {
  .app-shell {
    grid-template-columns: 210px minmax(0, 1fr);
  }
  .context-panel {
    display: none;
  }
  .action-dock {
    left: 210px;
    right: 0;
  }
  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 700px) {
  body {
    font-size: 16px;
  }
  .app-header {
    align-items: flex-start;
  }
  .compact-field span {
    clip: rect(0 0 0 0);
    position: absolute;
  }
  .app-shell {
    display: block;
  }
  .side-nav {
    border-bottom: 1px solid #eddaec;
    border-right: 0;
    overflow-x: auto;
    padding: 0.5rem;
  }
  .nav-list {
    display: flex;
    min-width: max-content;
  }
  .nav-list a {
    grid-template-columns: 1fr;
  }
  .nav-list a::before {
    display: none;
  }
  #main-content {
    padding: 1.25rem 1rem 6rem;
  }
  .action-dock {
    left: 0;
    right: 0;
  }
  .form-grid,
  .card-grid {
    grid-template-columns: 1fr;
  }
  .field.full {
    grid-column: auto;
  }
  .wizard-steps {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 450px) {
  .app-header {
    flex-wrap: wrap;
  }
  .header-actions {
    width: 100%;
  }
  .card-grid {
    grid-template-columns: 1fr;
  }
  .button-row,
  .login-options {
    align-items: stretch;
    flex-direction: column;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
@-moz-keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@-webkit-keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@-o-keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
